Examples of MarshalException


Examples of java.rmi.MarshalException

        }
        if (ex instanceof NO_PERMISSION) {
            return new AccessException(ex.getMessage(), ex);
        }
        if (ex instanceof MARSHAL) {
            return new MarshalException(ex.getMessage(), ex);
        }
        if (ex instanceof UNKNOWN) {
            return new RemoteException(ex.getMessage(), ex);
        }
        return delegate.mapSystemException(ex);
View Full Code Here

Examples of java.rmi.MarshalException

      
       /* 01) any instance of java.rmi.MarshalException in which the
          value of the exception's detail field is an instance of
          java.io.ObjectStreamException */
       badInvException01 =
     new MarshalException("LeaseExpirationTest",
      new StreamCorruptedException("LeaseExpirationTest"));
       badInvOwner01 =
     new FailingOpCountingOwner(badInvException01, 0, renewGrant);

       /* 02) any instance of java.rmi.UnmarshalException in which the
View Full Code Here

Examples of java.rmi.MarshalException

    /** Construct, log, and throw a new MarshalException */
    private static MarshalException throwNewMarshalException(
      String msg, Exception nested)
  throws MarshalException
    {
  final MarshalException me = new MarshalException(msg, nested);
  if (logger.isLoggable(Levels.FAILED)) {
      logger.log(Levels.FAILED, msg, me);
  }

  throw me;
View Full Code Here

Examples of java.rmi.MarshalException

  MarshalledObject data;
  try {
      data = new MarshalledObject(desc);
  } catch (Exception e) {
            MarshalException me =
          new MarshalException("marshalling ActivateDesc", e);
      logger.throwing(ActivateWrapper.class.getName(),
          "register", me);
      throw me;
  }
 
View Full Code Here

Examples of javax.xml.bind.MarshalException

    throws JAXBException
  {
    ClassSkeleton skeleton = _context.findSkeletonForObject(jaxbObject);

    if (skeleton == null)
      throw new MarshalException(L.l("Unable to update {0}: its type unknown to this JAXBContext", jaxbObject));

    try {
      return skeleton.bindTo(this, xmlNode, jaxbObject, null, null);
    }
    catch (IOException e) {
View Full Code Here

Examples of javax.xml.bind.MarshalException

    throws JAXBException
  {
    ClassSkeleton skeleton = _context.findSkeletonForObject(jaxbElement);

    if (skeleton == null)
      throw new MarshalException(L.l("Unable to marshal {0}: its type unknown to this JAXBContext", jaxbElement));

    Class c = skeleton.getType();
    writer = StaxUtil.toRepairingXMLStreamWriter(writer);

    // tck/JAXBMarshall
    if (! _context.createJAXBIntrospector().isElement(jaxbElement) &&
        ! c.isAnnotationPresent(XmlRootElement.class))
      throw new MarshalException("JAXBIntrospector.isElement()==false");

    /*
    String name = null;
    String namespace = null;

View Full Code Here

Examples of javax.xml.bind.MarshalException

  }

  public void marshal(Object obj, Result result) throws JAXBException
  {
    if (! _context.createJAXBIntrospector().isElement(obj))
      throw new MarshalException(L.l("Object is not a JAXB element: {0}", obj));

    try {
      XMLStreamWriter out = _xmlOutputFactory.createXMLStreamWriter(result);

      marshal(obj, out);
View Full Code Here

Examples of javax.xml.bind.MarshalException

    public void marshal(Object obj, Result result) throws JAXBException {
        //XMLSerializable so = Util.toXMLSerializable(obj);
        XMLSerializable so = context.getGrammarInfo().castToXMLSerializable(obj);

        if(so==null)
            throw new MarshalException(
                Messages.format( Messages.NOT_MARSHALLABLE ) );


        if (result instanceof SAXResult) {
            write(so, ((SAXResult) result).getHandler());
            return;
        }
        if (result instanceof DOMResult) {
            Node node = ((DOMResult) result).getNode();

            if (node == null) {
                try {
                    DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
                    dbf.setNamespaceAware(true);
                    DocumentBuilder db = dbf.newDocumentBuilder();
                    Document doc = db.newDocument();
                    ((DOMResult) result).setNode(doc);
                    write(so, new SAX2DOMEx(doc));
                } catch (ParserConfigurationException pce) {
                    throw new JAXBAssertionError(pce);
                }
            } else {
                write(so, new SAX2DOMEx(node));
            }

            return;
        }
        if (result instanceof StreamResult) {
            StreamResult sr = (StreamResult) result;
            XMLWriter w = null;

            if (sr.getWriter() != null)
                w = createWriter(sr.getWriter());
            else if (sr.getOutputStream() != null)
                w = createWriter(sr.getOutputStream());
            else if (sr.getSystemId() != null) {
                String fileURL = sr.getSystemId();

                if (fileURL.startsWith("file:///")) {
                    if (fileURL.substring(8).indexOf(":") > 0)
                        fileURL = fileURL.substring(8);
                    else
                        fileURL = fileURL.substring(7);
                } // otherwise assume that it's a file name

                try {
                    w = createWriter(new FileOutputStream(fileURL));
                } catch (IOException e) {
                    throw new MarshalException(e);
                }
            }

            if (w == null)
                throw new IllegalArgumentException();

            write(so, w);
            return;
        }

        // unsupported parameter type
        throw new MarshalException(
            Messages.format( Messages.UNSUPPORTED_RESULT ) );
    }
View Full Code Here

Examples of javax.xml.bind.MarshalException

            obj.serializeBody(serializer);
            writer.endDocument();
           
            serializer.reconcileID();   // extra check
        } catch( SAXException e ) {
            throw new MarshalException(e);
        }
    }
View Full Code Here

Examples of javax.xml.bind.MarshalException

        try {
            return createWriter(
                new OutputStreamWriter(os,getJavaEncoding(encoding)),
                encoding );
        } catch( UnsupportedEncodingException e ) {
            throw new MarshalException(
                Messages.format( Messages.UNSUPPORTED_ENCODING, encoding ),
                e );
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.