public MARSHAL invalidIndirection(CompletionStatus cs, Throwable t, Object arg0) {
    MARSHAL exc = new MARSHAL(INVALID_INDIRECTION, cs);
    if (t != null) exc.initCause(t);

    if (logger.isLoggable(Level.WARNING)) {
      Object[] parameters = new Object[1];
      parameters[0] = arg0;
      doLog(Level.WARNING, "UTIL.invalidIndirection", parameters, UtilSystemException.class, exc);
    }

    return exc;
  }
  /**
   * Write the structure to the CDR output stream. Writes the integer identifier of the tag, then
   * the size of the tag data and then the specified number of bytes, representing the data of the
   * tag.
   *
   * @param output a org.omg.CORBA.portable stream stream to write into.
   * @param value a value to write.
   */
  public static void write(OutputStream output, TaggedComponent value) {
    output.write_long(value.tag);
    output.write_long(value.component_data.length);

    try {
      output.write(value.component_data);
    } catch (IOException e) {
      MARSHAL m = new MARSHAL();
      m.minor = Minor.Encapsulation;
      m.initCause(e);
      throw m;
    }
  }
 /**
  * Read the structure from the CDR intput stream. Expects the integer identifier of the tag, then
  * the size of the tag data and then the specified number of bytes, representing the data of the
  * tag.
  *
  * @param input a org.omg.CORBA.portable stream to read from.
  */
 public static TaggedComponent read(InputStream input) {
   TaggedComponent value = new TaggedComponent();
   value.tag = input.read_long();
   value.component_data = new byte[input.read_long()];
   try {
     input.read(value.component_data);
   } catch (IOException e) {
     MARSHAL m = new MARSHAL();
     m.minor = Minor.Encapsulation;
     m.initCause(e);
     throw m;
   }
   return value;
 }
Пример #4
0
 @Test
 public void testFailOnNullEncodedString() throws Exception {
   byte[] codedText = {0, 0, 0, 0};
   CDRInputStream stream = new CDRInputStream(orb, codedText);
   try {
     stream.read_string();
     fail("Null encoded string should have failed with an exception");
   } catch (MARSHAL e) {
     assertNotNull(e.getMessage());
     assertTrue(
         "Not a MARSHALL exception: " + e.getMessage(),
         e.getMessage().matches("^.*invalid string size: 0.*$"));
   } finally {
     stream.close();
   }
 }
  public MARSHAL unableLocateValueHelper(CompletionStatus cs, Throwable t) {
    MARSHAL exc = new MARSHAL(UNABLE_LOCATE_VALUE_HELPER, cs);
    if (t != null) exc.initCause(t);

    if (logger.isLoggable(Level.WARNING)) {
      Object[] parameters = null;
      doLog(
          Level.WARNING,
          "UTIL.unableLocateValueHelper",
          parameters,
          UtilSystemException.class,
          exc);
    }

    return exc;
  }
Пример #6
0
    /** Write the internet profile (except the heading tag. */
    public void write(AbstractCdrOutput out) {
      try {
        // Need to write the Internet profile into the separate
        // stream as we must know the size in advance.
        AbstractCdrOutput b = out.createEncapsulation();

        version.write(b);
        b.write_string(host);

        b.write_ushort((short) (port & 0xFFFF));

        // Write the object key.
        b.write_long(key.length);
        b.write(key);

        // Number of the tagged components.
        b.write_long(1 + components.size());

        b.write_long(CodeSets_profile.TAG_CODE_SETS);
        CodeSets.write(b);

        TaggedComponent t;

        for (int i = 0; i < components.size(); i++) {
          t = (TaggedComponent) components.get(i);
          TaggedComponentHelper.write(b, t);
        }

        b.close();
      } catch (Exception e) {
        MARSHAL m = new MARSHAL("Unable to write Internet profile.");
        m.minor = Minor.IOR;
        m.initCause(e);
        throw m;
      }
    }