Package com.sun.enterprise.deployment.node

Examples of com.sun.enterprise.deployment.node.SaxParserHandler


      "enterprise.deployment.io.errorcontext",
      "archive {0} and deployment descriptor file {1}",
      new Object []{ error, getDeploymentDescriptorPath()});
       
        SAXParser sp = getSAXParser(getXMLValidation());
        SaxParserHandler dh = SaxParserHandlerFactory.newInstance();
  if (validationLevel.equals(FULL_VALIDATION)) {
      dh.setStopOnError(true);
  }
        if (descriptor!=null) {
            dh.setTopNode(getRootXMLNode(descriptor));
        }

        dh.setErrorReportingString(errorReporting);
       
        InputSource input =new InputSource(is);
        try {
            sp.parse(input,dh);
        } catch(SAXParseException e) {
            DOLUtils.getDefaultLogger().log(Level.SEVERE, "enterprise.deployment.backend.saxParserError",
                                new Object[]{e.getMessage()});
           
            errorReporting += "  " + e.getLocalizedMessage();
            SAXParseException spe = new SAXParseException(errorReporting,
                                                        e.getSystemId(),
                                                        e.getPublicId(),
                                                        e.getLineNumber(),
                                                        e.getColumnNumber(),
                                                        e);

            throw spe;           
        } catch(SAXException e) {
            if (e.getException()!=null) {
                e.getException().printStackTrace();
            }
            DOLUtils.getDefaultLogger().log(Level.SEVERE, "enterprise.deployment.backend.saxParserError",
                                new Object[]{e.getMessage()});           
            return null;
        } catch (IOException e) {
            DOLUtils.getDefaultLogger().log(Level.SEVERE, "enterprise.deployment.backend.saxParserError",
                                e.getMessage() == null ? "" : new Object[]{e.getMessage()});           

            // Let's check if the root cause of this IOException is failing to
            // connect. If yes, it means two things:
            // 1. The public id declared is not one of the pre-defined ones.
            //    So we need to ask user the check for typo.
            // 2. If the user does intend to use the system id to go outside.
            //    We need to ask them to check whether they have proper
            //    access to the internet (proxy setting etc).     
            StackTraceElement[] stElements = e.getStackTrace();
            for (int i = 0; i < stElements.length; i++) {
                StackTraceElement stElement = stElements[i];
                if (stElement.getClassName().equals("java.net.Socket") &&
                    stElement.getMethodName().equals("connect")) {
                    String msg = localStrings.getLocalString(
                        "enterprise.deployment.can_not_locate_dtd",
      "Unable to locate the DTD to validate your deployment descriptor file [{1}] in archive [{0}]. Please make sure the DOCTYPE is correct (no typo in public ID or system ID) and you have proper access to the Internet.",
       new Object []{ error, getDeploymentDescriptorPath()});
                    IOException ioe = new IOException(msg);
                    ioe.initCause(e);
                    throw ioe;
                }
            }

            IOException ioe = new IOException(localStrings.getLocalString(
                    "enterprise.deployment.backend.error_parsing_descr",
                    "Error parsing descriptor: {0}", new Object[] {errorReporting}));
            ioe.initCause(e);
            throw ioe;
        }
        if (dh.getTopNode()!=null) {
            Object topDesc = dh.getTopNode().getDescriptor();
            if (topDesc instanceof Descriptor) {
                return (Descriptor) topDesc;
            }
        }
        return null;
View Full Code Here


    private void checkDescriptors(FileArchive farc, String fileName, String dirName) throws IOException {
        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
        factory.setValidating(false);
        try {
            DocumentBuilder docBuilder = factory.newDocumentBuilder();
            docBuilder.setEntityResolver(new SaxParserHandler());
            String dirPath = farc.getArchiveUri();
            Document document = docBuilder.parse(dirPath + File.separatorChar + dirName + File.separatorChar + fileName);
            Element docEle = document.getDocumentElement();
            NodeList securityBindingList = docEle.getElementsByTagName("message-security-binding");
            for(int i=0; i<securityBindingList.getLength();i++) {
View Full Code Here

    private InputStream fixWebServiceDescriptor(FileArchive farc) throws IOException {
        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
        factory.setValidating(false);
        try {
            DocumentBuilder docBuilder = factory.newDocumentBuilder();
            docBuilder.setEntityResolver(new SaxParserHandler());
            String dirPath = farc.getArchiveUri();
            Document document = docBuilder.parse(dirPath + File.separatorChar + "WEB-INF" + File.separatorChar + "web.xml");
            Element docEle = document.getDocumentElement();
            NodeList servletList = docEle.getElementsByTagName("servlet");
            for(int i=0; i<servletList.getLength();i++) {
View Full Code Here

    private void checkDescriptors(FileArchive farc, String fileName, String dirName) throws IOException {
        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
        factory.setValidating(false);
        try {
            DocumentBuilder docBuilder = factory.newDocumentBuilder();
            docBuilder.setEntityResolver(new SaxParserHandler());
            String dirPath = farc.getArchiveUri();
            Document document = docBuilder.parse(dirPath + File.separatorChar + dirName + File.separatorChar + fileName);
            Element docEle = document.getDocumentElement();
            NodeList securityBindingList = docEle.getElementsByTagName("message-security-binding");
            for(int i=0; i<securityBindingList.getLength();i++) {
View Full Code Here

    private InputStream fixWebServiceDescriptor(FileArchive farc) throws IOException {
        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
        factory.setValidating(false);
        try {
            DocumentBuilder docBuilder = factory.newDocumentBuilder();
            docBuilder.setEntityResolver(new SaxParserHandler());
            String dirPath = farc.getArchiveUri();
            Document document = docBuilder.parse(dirPath + File.separatorChar + "WEB-INF" + File.separatorChar + "web.xml");
            Element docEle = document.getDocumentElement();
            NodeList servletList = docEle.getElementsByTagName("servlet");
            for(int i=0; i<servletList.getLength();i++) {
View Full Code Here

      "enterprise.deployment.io.errorcontext",
      "archive {0} and deployment descriptor file {1}",
                        error, getDeploymentDescriptorPath());
       
        SAXParser sp = getSAXParser(getXMLValidation());
        SaxParserHandler dh = SaxParserHandlerFactory.newInstance();
  if (validationLevel.equals(FULL_VALIDATION)) {
      dh.setStopOnError(true);
  }
        if (descriptor!=null) {
            dh.setTopNode(getRootXMLNode(descriptor));
        }

        dh.setErrorReportingString(errorReporting);
       
        InputSource input =new InputSource(is);
        try {
            sp.parse(input,dh);
        } catch(SAXParseException e) {
            DOLUtils.getDefaultLogger().log(Level.SEVERE, "enterprise.deployment.backend.saxParserError",
                                new Object[]{e.getMessage()});
           
            errorReporting += "  " + e.getLocalizedMessage();
            SAXParseException spe = new SAXParseException(errorReporting,
                                                        e.getSystemId(),
                                                        e.getPublicId(),
                                                        e.getLineNumber(),
                                                        e.getColumnNumber(),
                                                        e);

            throw spe;           
        } catch(SAXException e) {
            DOLUtils.getDefaultLogger().log(Level.SEVERE, "enterprise.deployment.backend.saxParserError",
                                new Object[]{e.getMessage()});           
            DOLUtils.getDefaultLogger().log(Level.SEVERE, "Error occurred", e);
            return null;
        } catch (IOException e) {
            DOLUtils.getDefaultLogger().log(Level.SEVERE, "enterprise.deployment.backend.saxParserError",
                                e.getMessage() == null ? "" : new Object[]{e.getMessage()});           

            // Let's check if the root cause of this IOException is failing to
            // connect. If yes, it means two things:
            // 1. The public id declared is not one of the pre-defined ones.
            //    So we need to ask user the check for typo.
            // 2. If the user does intend to use the system id to go outside.
            //    We need to ask them to check whether they have proper
            //    access to the internet (proxy setting etc).     
            for (StackTraceElement stElement : e.getStackTrace()) {
                if (stElement.getClassName().equals("java.net.Socket") &&
                        stElement.getMethodName().equals("connect")) {
                    String msg = localStrings.getLocalString(
                            "enterprise.deployment.can_not_locate_dtd",
                            "Unable to locate the DTD to validate your deployment descriptor file [{1}] in archive [{0}]. Please make sure the DOCTYPE is correct (no typo in public ID or system ID) and you have proper access to the Internet.",
                            error, getDeploymentDescriptorPath());
                    IOException ioe = new IOException(msg);
                    ioe.initCause(e);
                    throw ioe;
                }
            }

            IOException ioe = new IOException(localStrings.getLocalString(
                    "enterprise.deployment.backend.error_parsing_descr",
                    "Error parsing descriptor: {0}", errorReporting));
            ioe.initCause(e);
            throw ioe;
        }
        if (dh.getTopNode()!=null) {
            return ((RootXMLNode<T>) dh.getTopNode()).getDescriptor();
        }
        return null;
    }               
View Full Code Here

      "enterprise.deployment.io.errorcontext",
      "archive {0} and deployment descriptor file {1}",
                        error, getDeploymentDescriptorPath());
       
        SAXParser sp = getSAXParser(getXMLValidation());
        SaxParserHandler dh = SaxParserHandlerFactory.newInstance();
  if (validationLevel.equals(FULL_VALIDATION)) {
      dh.setStopOnError(true);
  }
        if (descriptor!=null) {
            dh.setTopNode(getRootXMLNode(descriptor));
        }

        dh.setErrorReportingString(errorReporting);
       
        InputSource input =new InputSource(is);
        try {
            sp.parse(input,dh);
        } catch(SAXParseException e) {
            DOLUtils.getDefaultLogger().log(Level.SEVERE, "enterprise.deployment.backend.saxParserError",
                                new Object[]{e.getMessage()});
           
            errorReporting += "  " + e.getLocalizedMessage();
            SAXParseException spe = new SAXParseException(errorReporting,
                                                        e.getSystemId(),
                                                        e.getPublicId(),
                                                        e.getLineNumber(),
                                                        e.getColumnNumber(),
                                                        e);

            throw spe;           
        } catch(SAXException e) {
            DOLUtils.getDefaultLogger().log(Level.SEVERE, "enterprise.deployment.backend.saxParserError",
                                new Object[]{e.getMessage()});           
            DOLUtils.getDefaultLogger().log(Level.SEVERE, "Error occurred", e);
            return null;
        } catch (IOException e) {
            DOLUtils.getDefaultLogger().log(Level.SEVERE, "enterprise.deployment.backend.saxParserError",
                                e.getMessage() == null ? "" : new Object[]{e.getMessage()});           

            // Let's check if the root cause of this IOException is failing to
            // connect. If yes, it means two things:
            // 1. The public id declared is not one of the pre-defined ones.
            //    So we need to ask user the check for typo.
            // 2. If the user does intend to use the system id to go outside.
            //    We need to ask them to check whether they have proper
            //    access to the internet (proxy setting etc).     
            for (StackTraceElement stElement : e.getStackTrace()) {
                if (stElement.getClassName().equals("java.net.Socket") &&
                        stElement.getMethodName().equals("connect")) {
                    String msg = localStrings.getLocalString(
                            "enterprise.deployment.can_not_locate_dtd",
                            "Unable to locate the DTD to validate your deployment descriptor file [{1}] in archive [{0}]. Please make sure the DOCTYPE is correct (no typo in public ID or system ID) and you have proper access to the Internet.",
                            error, getDeploymentDescriptorPath());
                    IOException ioe = new IOException(msg);
                    ioe.initCause(e);
                    throw ioe;
                }
            }

            IOException ioe = new IOException(localStrings.getLocalString(
                    "enterprise.deployment.backend.error_parsing_descr",
                    "Error parsing descriptor: {0}", errorReporting));
            ioe.initCause(e);
            throw ioe;
        }
        if (dh.getTopNode()!=null) {
            return ((RootXMLNode<T>) dh.getTopNode()).getDescriptor();
        }
        return null;
    }               
View Full Code Here

TOP

Related Classes of com.sun.enterprise.deployment.node.SaxParserHandler

Copyright © 2018 www.massapicom. 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.