SymtabEntry parmType = Util.typeOf (parm.type ());
if (parmType instanceof StringEntry)
if ((parm.passType () == ParameterEntry.In) ||
(parm.passType () == ParameterEntry.Inout))
{
StringEntry string = (StringEntry)parmType;
if (string.maxSize () != null)
{
stream.print (THREE_INDENT + "if (" + parm.name ());
if (parm.passType () == ParameterEntry.Inout)
stream.print (".value"); // get from holder
stream.print (" == null || " + parm.name ());
if (parm.passType () == ParameterEntry.Inout)
stream.print (".value"); // get from holder
stream.println (".length () > (" +
Util.parseExpression (string.maxSize ()) + "))");
stream.println (THREE_INDENT +
"throw new org.omg.CORBA.BAD_PARAM (0," +
" org.omg.CORBA.CompletionStatus.COMPLETED_NO);");
}
}
}
// end <d56554> in/inout string bounds check
// Step 2 Load the parameters into the outputStream
parms = m.parameters ().elements ();
while (parms.hasMoreElements ())
{
ParameterEntry parm = (ParameterEntry)parms.nextElement ();
if (parm.passType () == ParameterEntry.In)
writeOutputStreamWrite(FOUR_INDENT, "$out", parm.name (), parm.type (),
stream);
else if (parm.passType () == ParameterEntry.Inout)
writeOutputStreamWrite(FOUR_INDENT, "$out", parm.name () + ".value",
parm.type (), stream);
}
// Step 2a. Write the context parameter if necessary. <d59560>
if (m.contexts ().size () > 0)
{
stream.println(FOUR_INDENT + "org.omg.CORBA.ContextList $contextList =" +
"_orb ().create_context_list ();");
for (int cnt = 0; cnt < m.contexts ().size (); cnt++)
{
stream.println(FOUR_INDENT +
"$contextList.add (\"" + m.contexts (). elementAt (cnt) + "\");");
}
stream.println(FOUR_INDENT +
"$out.write_Context ($context, $contextList);");
}
// Step 3 Invoke the method with the output stream
stream.println (FOUR_INDENT + "$in = _invoke ($out);");
SymtabEntry mtype = m.type ();
if (mtype != null)
Util.writeInitializer (FOUR_INDENT, "$result", "", mtype,
writeInputStreamRead ("$in", mtype), stream);
// Step 4 Read the inout/out values
parms = m.parameters ().elements ();
while (parms.hasMoreElements ())
{
ParameterEntry parm = (ParameterEntry)parms.nextElement ();
if (parm.passType () != ParameterEntry.In)
{
if (parm.type () instanceof ValueBoxEntry)
{
ValueBoxEntry v = (ValueBoxEntry) parm.type ();
TypedefEntry member =
((InterfaceState) v.state ().elementAt (0)).entry;
SymtabEntry mType = member.type ();
if (mType instanceof PrimitiveEntry)
stream.println(FOUR_INDENT + parm.name () +
".value = (" + writeInputStreamRead ("$in", parm.type ()) +
").value;");
else
stream.println(FOUR_INDENT + parm.name () +
".value = " + writeInputStreamRead ("$in", parm.type ()) +";");
}
else
stream.println (FOUR_INDENT + parm.name () + ".value = " +
writeInputStreamRead ("$in", parm.type ()) + ";");
}
}
// Step 4.b. Check string bounds <d56554 - klr>
// begin <d56554> out/inout/return string bounds check
parms = m.parameters ().elements ();
while (parms.hasMoreElements ())
{
ParameterEntry parm = (ParameterEntry)parms.nextElement ();
SymtabEntry parmType = Util.typeOf (parm.type ());
if (parmType instanceof StringEntry)
if ((parm.passType () == ParameterEntry.Out) ||
(parm.passType () == ParameterEntry.Inout))
{
StringEntry string = (StringEntry)parmType;
if (string.maxSize () != null)
{
stream.print (FOUR_INDENT + "if (" + parm.name () +
".value.length ()");
stream.println (" > (" +
Util.parseExpression (string.maxSize ()) + "))");
stream.println (FIVE_INDENT + "throw new org.omg.CORBA.MARSHAL(0,"+
"org.omg.CORBA.CompletionStatus.COMPLETED_NO);");
}
}
}
if (mtype instanceof StringEntry)
{
StringEntry string = (StringEntry)mtype;
if (string.maxSize () != null)
{
stream.println(FOUR_INDENT + "if ($result.length () > (" +
Util.parseExpression (string.maxSize ()) + "))");
stream.println (FIVE_INDENT + "throw new org.omg.CORBA.MARSHAL (0," +
" org.omg.CORBA.CompletionStatus.COMPLETED_NO);");
}
}
// end <d56554> out/inout/return string bounds check