Examples of ErrorMsg


Examples of org.apache.xalan.xsltc.compiler.util.ErrorMsg

  else if (name.equals("auto-translet")) {
      return new Boolean(_autoTranslet);
  }

  // Throw an exception for all other attributes
  ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_INVALID_ATTR_ERR, name);
  throw new IllegalArgumentException(err.toString());
    }
View Full Code Here

Examples of org.apache.xalan.xsltc.compiler.util.ErrorMsg

    return;
      }
  }

  // Throw an exception for all other attributes
  final ErrorMsg err
      = new ErrorMsg(ErrorMsg.JAXP_INVALID_ATTR_ERR, name);
  throw new IllegalArgumentException(err.toString());
    }
View Full Code Here

Examples of org.apache.xalan.xsltc.compiler.util.ErrorMsg

        bytecodes = getBytecodesFromClasses(source, transletClassName);     
   
      if (bytecodes != null) {
        if (_debug) {
              if (_jarFileName != null)
            System.err.println(new ErrorMsg(
                    ErrorMsg.TRANSFORM_WITH_JAR_STR, transletClassName, _jarFileName));
              else
                System.err.println(new ErrorMsg(
                    ErrorMsg.TRANSFORM_WITH_TRANSLET_STR, transletClassName));
        }

        // Reset the per-session attributes to their default values
        // after each newTemplates() call.
        resetTransientAttributes();
     
        return new TemplatesImpl(bytecodes, transletClassName, null, _indentNumber, this);     
      }
  }
 
  // Create and initialize a stylesheet compiler
  final XSLTC xsltc = new XSLTC();
  if (_debug) xsltc.setDebug(true);
  if (_enableInlining) xsltc.setTemplateInlining(true);
  xsltc.init();

  // Set a document loader (for xsl:include/import) if defined
  if (_uriResolver != null) {
      xsltc.setSourceLoader(this);
  }

  // Pass parameters to the Parser to make sure it locates the correct
  // <?xml-stylesheet ...?> PI in an XML input document
  if ((_piParams != null) && (_piParams.get(source) != null)) {
      // Get the parameters for this Source object
      PIParamWrapper p = (PIParamWrapper)_piParams.get(source);
      // Pass them on to the compiler (which will pass then to the parser)
      if (p != null) {
    xsltc.setPIParameters(p._media, p._title, p._charset);
      }
  }

  // Set the attributes for translet generation
  int outputType = XSLTC.BYTEARRAY_OUTPUT;
  if (_generateTranslet || _autoTranslet) {
      // Set the translet name
      if (!_transletName.equals(DEFAULT_TRANSLET_NAME))
          xsltc.setClassName(_transletName);
   
      if (_destinationDirectory != null)
        xsltc.setDestDirectory(_destinationDirectory);
      else {
        String xslName = getStylesheetFileName(source);
        if (xslName != null) {
              File xslFile = new File(xslName);
              String xslDir = xslFile.getParent();
     
              if (xslDir != null)
                  xsltc.setDestDirectory(xslDir);
        }
      }
   
      if (_packageName != null)
          xsltc.setPackageName(_packageName);
 
      if (_jarFileName != null) {
        xsltc.setJarFileName(_jarFileName);
        outputType = XSLTC.BYTEARRAY_AND_JAR_OUTPUT;
      }
      else
        outputType = XSLTC.BYTEARRAY_AND_FILE_OUTPUT;
  }

  // Compile the stylesheet
  final InputSource input = Util.getInputSource(xsltc, source);
  byte[][] bytecodes = xsltc.compile(null, input, outputType);
  final String transletName = xsltc.getClassName();

  // Output to the jar file if the jar file name is set.
  if ((_generateTranslet || _autoTranslet)
       && bytecodes != null && _jarFileName != null) {
      try {
        xsltc.outputToJar();
      }
      catch (java.io.IOException e) { }
  }

  // Reset the per-session attributes to their default values
  // after each newTemplates() call.
  resetTransientAttributes();

  // Pass compiler warnings to the error listener
  if (_errorListener != this) {
      try {
    passWarningsToListener(xsltc.getWarnings());
      }
      catch (TransformerException e) {
    throw new TransformerConfigurationException(e);
      }
  }
  else {
      xsltc.printWarnings();
  }

  // Check that the transformation went well before returning
  if (bytecodes == null) {
      // Pass compiler errors to the error listener
      if (_errorListener != null) {
    passErrorsToListener(xsltc.getErrors());
      }
      else {
    xsltc.printErrors();
      }
      ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_COMPILE_ERR);
      throw new TransformerConfigurationException(err.toString());
  }

  return new TemplatesImpl(bytecodes, transletName,
      xsltc.getOutputProperties(), _indentNumber, this);
    }
View Full Code Here

Examples of org.apache.xalan.xsltc.compiler.util.ErrorMsg

    public void error(TransformerException e)
  throws TransformerException
    {
  Throwable wrapped = e.getException();
        if (wrapped != null) {
            System.err.println(new ErrorMsg(ErrorMsg.ERROR_PLUS_WRAPPED_MSG,
                                            e.getMessageAndLocation(),
                                            wrapped.getMessage()));
        } else {
            System.err.println(new ErrorMsg(ErrorMsg.ERROR_MSG,
                                            e.getMessageAndLocation()));
  }
  throw e;  
    }
View Full Code Here

Examples of org.apache.xalan.xsltc.compiler.util.ErrorMsg

    public void fatalError(TransformerException e)
  throws TransformerException
    {
  Throwable wrapped = e.getException();
        if (wrapped != null) {
            System.err.println(new ErrorMsg(ErrorMsg.FATAL_ERR_PLUS_WRAPPED_MSG,
                                            e.getMessageAndLocation(),
                                            wrapped.getMessage()));
        } else {
            System.err.println(new ErrorMsg(ErrorMsg.FATAL_ERR_MSG,
                                            e.getMessageAndLocation()));
        }
  throw e;
    }
View Full Code Here

Examples of org.apache.xalan.xsltc.compiler.util.ErrorMsg

    public void warning(TransformerException e)
  throws TransformerException
    {
  Throwable wrapped = e.getException();
  if (wrapped != null) {
            System.err.println(new ErrorMsg(ErrorMsg.WARNING_PLUS_WRAPPED_MSG,
                                            e.getMessageAndLocation(),
                                            wrapped.getMessage()));
  } else {
            System.err.println(new ErrorMsg(ErrorMsg.WARNING_MSG,
                                            e.getMessageAndLocation()));
        }
    }
View Full Code Here

Examples of org.apache.xalan.xsltc.compiler.util.ErrorMsg

    else {
        input = new InputSource(systemId);
    }
      }
      else {
    ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_UNKNOWN_SOURCE_ERR);
    throw new TransformerConfigurationException(err.toString());
      }
      input.setSystemId(systemId);
  }
  catch (NullPointerException e) {
       ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_NO_SOURCE_ERR,
          "TransformerFactory.newTemplates()");
      throw new TransformerConfigurationException(err.toString());
  }
  catch (SecurityException e) {
       ErrorMsg err = new ErrorMsg(ErrorMsg.FILE_ACCESS_ERR, systemId);
      throw new TransformerConfigurationException(err.toString());
  }
  finally {
      return input;
  }
    }
View Full Code Here

Examples of org.apache.xalan.xsltc.compiler.util.ErrorMsg

      _expression = expression;
      _lineNumber = lineNumber;
      return super.parse();
        }
        catch (IllegalCharException e) {
            ErrorMsg err = new ErrorMsg(ErrorMsg.ILLEGAL_CHAR_ERR,
                                        lineNumber, e.getMessage());
            _parser.reportError(Constants.FATAL, err);
        }
        return null;
    }
View Full Code Here

Examples of org.apache.xalan.xsltc.compiler.util.ErrorMsg

    public final void addError(ErrorMsg error) {
  _parser.reportError(Constants.ERROR, error);
    }
          
    public void report_error(String message, Object info) {
  final ErrorMsg err = new ErrorMsg(ErrorMsg.SYNTAX_ERR, _lineNumber,
      _expression);
  _parser.reportError(Constants.FATAL, err);
    }
View Full Code Here

Examples of org.apache.xalan.xsltc.compiler.util.ErrorMsg

      final ParentLocationPath plp = (ParentLocationPath) rlp;
      final RelativeLocationPath newrlp = insertStep(step, plp.getPath());
      return new ParentLocationPath(newrlp, plp.getStep());
  }
  else {
      addError(new ErrorMsg(ErrorMsg.INTERNAL_ERR, "XPathParser.insertStep"));
      return rlp;
  }
    }
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.