com.sun.org.apache.xpath.internal.XPathProcessorException Java Examples

The following examples show how to use com.sun.org.apache.xpath.internal.XPathProcessorException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: XPathParser.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Consume an expected token, throwing an exception if it
 * isn't there.
 *
 * @param expected The string to be expected.
 *
 * @throws javax.xml.transform.TransformerException
 */
private final void consumeExpected(String expected)
        throws javax.xml.transform.TransformerException
{

  if (tokenIs(expected))
  {
    nextToken();
  }
  else
  {
    error(XPATHErrorResources.ER_EXPECTED_BUT_FOUND, new Object[]{ expected,
                                                                   m_token });  //"Expected "+expected+", but found: "+m_token);

        // Patch for Christina's gripe. She wants her errorHandler to return from
        // this error and continue trying to parse, rather than throwing an exception.
        // Without the patch, that put us into an endless loop.
              throw new XPathProcessorException(CONTINUE_AFTER_FATAL_ERROR);
      }
}
 
Example #2
Source File: XPathParser.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Consume an expected token, throwing an exception if it
 * isn't there.
 *
 * @param expected the character to be expected.
 *
 * @throws javax.xml.transform.TransformerException
 */
private final void consumeExpected(char expected)
        throws javax.xml.transform.TransformerException
{

  if (tokenIs(expected))
  {
    nextToken();
  }
  else
  {
    error(XPATHErrorResources.ER_EXPECTED_BUT_FOUND,
          new Object[]{ String.valueOf(expected),
                        m_token });  //"Expected "+expected+", but found: "+m_token);

        // Patch for Christina's gripe. She wants her errorHandler to return from
        // this error and continue trying to parse, rather than throwing an exception.
        // Without the patch, that put us into an endless loop.
              throw new XPathProcessorException(CONTINUE_AFTER_FATAL_ERROR);
  }
}
 
Example #3
Source File: XPathParser.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Consume an expected token, throwing an exception if it
 * isn't there.
 *
 * @param expected The string to be expected.
 *
 * @throws javax.xml.transform.TransformerException
 */
private final void consumeExpected(String expected)
        throws javax.xml.transform.TransformerException
{

  if (tokenIs(expected))
  {
    nextToken();
  }
  else
  {
    error(XPATHErrorResources.ER_EXPECTED_BUT_FOUND, new Object[]{ expected,
                                                                   m_token });  //"Expected "+expected+", but found: "+m_token);

        // Patch for Christina's gripe. She wants her errorHandler to return from
        // this error and continue trying to parse, rather than throwing an exception.
        // Without the patch, that put us into an endless loop.
              throw new XPathProcessorException(CONTINUE_AFTER_FATAL_ERROR);
      }
}
 
Example #4
Source File: XPathParser.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Consume an expected token, throwing an exception if it
 * isn't there.
 *
 * @param expected the character to be expected.
 *
 * @throws javax.xml.transform.TransformerException
 */
private final void consumeExpected(char expected)
        throws javax.xml.transform.TransformerException
{

  if (tokenIs(expected))
  {
    nextToken();
  }
  else
  {
    error(XPATHErrorResources.ER_EXPECTED_BUT_FOUND,
          new Object[]{ String.valueOf(expected),
                        m_token });  //"Expected "+expected+", but found: "+m_token);

        // Patch for Christina's gripe. She wants her errorHandler to return from
        // this error and continue trying to parse, rather than throwing an exception.
        // Without the patch, that put us into an endless loop.
              throw new XPathProcessorException(CONTINUE_AFTER_FATAL_ERROR);
  }
}
 
Example #5
Source File: XPathParser.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Consume an expected token, throwing an exception if it
 * isn't there.
 *
 * @param expected The string to be expected.
 *
 * @throws javax.xml.transform.TransformerException
 */
private final void consumeExpected(String expected)
        throws javax.xml.transform.TransformerException
{

  if (tokenIs(expected))
  {
    nextToken();
  }
  else
  {
    error(XPATHErrorResources.ER_EXPECTED_BUT_FOUND, new Object[]{ expected,
                                                                   m_token });  //"Expected "+expected+", but found: "+m_token);

        // Patch for Christina's gripe. She wants her errorHandler to return from
        // this error and continue trying to parse, rather than throwing an exception.
        // Without the patch, that put us into an endless loop.
              throw new XPathProcessorException(CONTINUE_AFTER_FATAL_ERROR);
      }
}
 
Example #6
Source File: XPathParser.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Consume an expected token, throwing an exception if it
 * isn't there.
 *
 * @param expected the character to be expected.
 *
 * @throws javax.xml.transform.TransformerException
 */
private final void consumeExpected(char expected)
        throws javax.xml.transform.TransformerException
{

  if (tokenIs(expected))
  {
    nextToken();
  }
  else
  {
    error(XPATHErrorResources.ER_EXPECTED_BUT_FOUND,
          new Object[]{ String.valueOf(expected),
                        m_token });  //"Expected "+expected+", but found: "+m_token);

        // Patch for Christina's gripe. She wants her errorHandler to return from
        // this error and continue trying to parse, rather than throwing an exception.
        // Without the patch, that put us into an endless loop.
              throw new XPathProcessorException(CONTINUE_AFTER_FATAL_ERROR);
  }
}
 
Example #7
Source File: XPathParser.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Consume an expected token, throwing an exception if it
 * isn't there.
 *
 * @param expected The string to be expected.
 *
 * @throws javax.xml.transform.TransformerException
 */
private final void consumeExpected(String expected)
        throws javax.xml.transform.TransformerException
{

  if (tokenIs(expected))
  {
    nextToken();
  }
  else
  {
    error(XPATHErrorResources.ER_EXPECTED_BUT_FOUND, new Object[]{ expected,
                                                                   m_token });  //"Expected "+expected+", but found: "+m_token);

        // Patch for Christina's gripe. She wants her errorHandler to return from
        // this error and continue trying to parse, rather than throwing an exception.
        // Without the patch, that put us into an endless loop.
              throw new XPathProcessorException(CONTINUE_AFTER_FATAL_ERROR);
      }
}
 
Example #8
Source File: XPathParser.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Consume an expected token, throwing an exception if it
 * isn't there.
 *
 * @param expected the character to be expected.
 *
 * @throws javax.xml.transform.TransformerException
 */
private final void consumeExpected(char expected)
        throws javax.xml.transform.TransformerException
{

  if (tokenIs(expected))
  {
    nextToken();
  }
  else
  {
    error(XPATHErrorResources.ER_EXPECTED_BUT_FOUND,
          new Object[]{ String.valueOf(expected),
                        m_token });  //"Expected "+expected+", but found: "+m_token);

        // Patch for Christina's gripe. She wants her errorHandler to return from
        // this error and continue trying to parse, rather than throwing an exception.
        // Without the patch, that put us into an endless loop.
              throw new XPathProcessorException(CONTINUE_AFTER_FATAL_ERROR);
  }
}
 
Example #9
Source File: XPathParser.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Consume an expected token, throwing an exception if it
 * isn't there.
 *
 * @param expected The string to be expected.
 *
 * @throws javax.xml.transform.TransformerException
 */
private final void consumeExpected(String expected)
        throws javax.xml.transform.TransformerException
{

  if (tokenIs(expected))
  {
    nextToken();
  }
  else
  {
    error(XPATHErrorResources.ER_EXPECTED_BUT_FOUND, new Object[]{ expected,
                                                                   m_token });  //"Expected "+expected+", but found: "+m_token);

        // Patch for Christina's gripe. She wants her errorHandler to return from
        // this error and continue trying to parse, rather than throwing an exception.
        // Without the patch, that put us into an endless loop.
              throw new XPathProcessorException(CONTINUE_AFTER_FATAL_ERROR);
      }
}
 
Example #10
Source File: XPathParser.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
/**
 * Consume an expected token, throwing an exception if it
 * isn't there.
 *
 * @param expected the character to be expected.
 *
 * @throws javax.xml.transform.TransformerException
 */
private final void consumeExpected(char expected)
        throws javax.xml.transform.TransformerException
{

  if (tokenIs(expected))
  {
    nextToken();
  }
  else
  {
    error(XPATHErrorResources.ER_EXPECTED_BUT_FOUND,
          new Object[]{ String.valueOf(expected),
                        m_token });  //"Expected "+expected+", but found: "+m_token);

        // Patch for Christina's gripe. She wants her errorHandler to return from
        // this error and continue trying to parse, rather than throwing an exception.
        // Without the patch, that put us into an endless loop.
              throw new XPathProcessorException(CONTINUE_AFTER_FATAL_ERROR);
  }
}
 
Example #11
Source File: XPathParser.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
/**
 * Consume an expected token, throwing an exception if it
 * isn't there.
 *
 * @param expected The string to be expected.
 *
 * @throws javax.xml.transform.TransformerException
 */
private final void consumeExpected(String expected)
        throws javax.xml.transform.TransformerException
{

  if (tokenIs(expected))
  {
    nextToken();
  }
  else
  {
    error(XPATHErrorResources.ER_EXPECTED_BUT_FOUND, new Object[]{ expected,
                                                                   m_token });  //"Expected "+expected+", but found: "+m_token);

        // Patch for Christina's gripe. She wants her errorHandler to return from
        // this error and continue trying to parse, rather than throwing an exception.
        // Without the patch, that put us into an endless loop.
              throw new XPathProcessorException(CONTINUE_AFTER_FATAL_ERROR);
      }
}
 
Example #12
Source File: XPathParser.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Consume an expected token, throwing an exception if it
 * isn't there.
 *
 * @param expected the character to be expected.
 *
 * @throws javax.xml.transform.TransformerException
 */
private final void consumeExpected(char expected)
        throws javax.xml.transform.TransformerException
{

  if (tokenIs(expected))
  {
    nextToken();
  }
  else
  {
    error(XPATHErrorResources.ER_EXPECTED_BUT_FOUND,
          new Object[]{ String.valueOf(expected),
                        m_token });  //"Expected "+expected+", but found: "+m_token);

        // Patch for Christina's gripe. She wants her errorHandler to return from
        // this error and continue trying to parse, rather than throwing an exception.
        // Without the patch, that put us into an endless loop.
              throw new XPathProcessorException(CONTINUE_AFTER_FATAL_ERROR);
  }
}
 
Example #13
Source File: XPathParser.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Consume an expected token, throwing an exception if it
 * isn't there.
 *
 * @param expected the character to be expected.
 *
 * @throws javax.xml.transform.TransformerException
 */
private final void consumeExpected(char expected)
        throws javax.xml.transform.TransformerException
{

  if (tokenIs(expected))
  {
    nextToken();
  }
  else
  {
    error(XPATHErrorResources.ER_EXPECTED_BUT_FOUND,
          new Object[]{ String.valueOf(expected),
                        m_token });  //"Expected "+expected+", but found: "+m_token);

        // Patch for Christina's gripe. She wants her errorHandler to return from
        // this error and continue trying to parse, rather than throwing an exception.
        // Without the patch, that put us into an endless loop.
              throw new XPathProcessorException(CONTINUE_AFTER_FATAL_ERROR);
  }
}
 
Example #14
Source File: XPathParser.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Consume an expected token, throwing an exception if it
 * isn't there.
 *
 * @param expected The string to be expected.
 *
 * @throws javax.xml.transform.TransformerException
 */
private final void consumeExpected(String expected)
        throws javax.xml.transform.TransformerException
{

  if (tokenIs(expected))
  {
    nextToken();
  }
  else
  {
    error(XPATHErrorResources.ER_EXPECTED_BUT_FOUND, new Object[]{ expected,
                                                                   m_token });  //"Expected "+expected+", but found: "+m_token);

        // Patch for Christina's gripe. She wants her errorHandler to return from
        // this error and continue trying to parse, rather than throwing an exception.
        // Without the patch, that put us into an endless loop.
              throw new XPathProcessorException(CONTINUE_AFTER_FATAL_ERROR);
      }
}
 
Example #15
Source File: XPathParser.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
/**
 * Consume an expected token, throwing an exception if it
 * isn't there.
 *
 * @param expected The string to be expected.
 *
 * @throws javax.xml.transform.TransformerException
 */
private final void consumeExpected(String expected)
        throws javax.xml.transform.TransformerException
{

  if (tokenIs(expected))
  {
    nextToken();
  }
  else
  {
    error(XPATHErrorResources.ER_EXPECTED_BUT_FOUND, new Object[]{ expected,
                                                                   m_token });  //"Expected "+expected+", but found: "+m_token);

        // Patch for Christina's gripe. She wants her errorHandler to return from
        // this error and continue trying to parse, rather than throwing an exception.
        // Without the patch, that put us into an endless loop.
              throw new XPathProcessorException(CONTINUE_AFTER_FATAL_ERROR);
      }
}
 
Example #16
Source File: XPathParser.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
/**
 * Consume an expected token, throwing an exception if it
 * isn't there.
 *
 * @param expected the character to be expected.
 *
 * @throws javax.xml.transform.TransformerException
 */
private final void consumeExpected(char expected)
        throws javax.xml.transform.TransformerException
{

  if (tokenIs(expected))
  {
    nextToken();
  }
  else
  {
    error(XPATHErrorResources.ER_EXPECTED_BUT_FOUND,
          new Object[]{ String.valueOf(expected),
                        m_token });  //"Expected "+expected+", but found: "+m_token);

        // Patch for Christina's gripe. She wants her errorHandler to return from
        // this error and continue trying to parse, rather than throwing an exception.
        // Without the patch, that put us into an endless loop.
              throw new XPathProcessorException(CONTINUE_AFTER_FATAL_ERROR);
  }
}
 
Example #17
Source File: XPathParser.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Consume an expected token, throwing an exception if it
 * isn't there.
 *
 * @param expected The string to be expected.
 *
 * @throws javax.xml.transform.TransformerException
 */
private final void consumeExpected(String expected)
        throws javax.xml.transform.TransformerException
{

  if (tokenIs(expected))
  {
    nextToken();
  }
  else
  {
    error(XPATHErrorResources.ER_EXPECTED_BUT_FOUND, new Object[]{ expected,
                                                                   m_token });  //"Expected "+expected+", but found: "+m_token);

        // Patch for Christina's gripe. She wants her errorHandler to return from
        // this error and continue trying to parse, rather than throwing an exception.
        // Without the patch, that put us into an endless loop.
              throw new XPathProcessorException(CONTINUE_AFTER_FATAL_ERROR);
      }
}
 
Example #18
Source File: XPathParser.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Consume an expected token, throwing an exception if it
 * isn't there.
 *
 * @param expected the character to be expected.
 *
 * @throws javax.xml.transform.TransformerException
 */
private final void consumeExpected(char expected)
        throws javax.xml.transform.TransformerException
{

  if (tokenIs(expected))
  {
    nextToken();
  }
  else
  {
    error(XPATHErrorResources.ER_EXPECTED_BUT_FOUND,
          new Object[]{ String.valueOf(expected),
                        m_token });  //"Expected "+expected+", but found: "+m_token);

        // Patch for Christina's gripe. She wants her errorHandler to return from
        // this error and continue trying to parse, rather than throwing an exception.
        // Without the patch, that put us into an endless loop.
              throw new XPathProcessorException(CONTINUE_AFTER_FATAL_ERROR);
  }
}
 
Example #19
Source File: XPathParser.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Consume an expected token, throwing an exception if it
 * isn't there.
 *
 * @param expected The string to be expected.
 *
 * @throws javax.xml.transform.TransformerException
 */
private final void consumeExpected(String expected)
        throws javax.xml.transform.TransformerException
{

  if (tokenIs(expected))
  {
    nextToken();
  }
  else
  {
    error(XPATHErrorResources.ER_EXPECTED_BUT_FOUND, new Object[]{ expected,
                                                                   m_token });  //"Expected "+expected+", but found: "+m_token);

        // Patch for Christina's gripe. She wants her errorHandler to return from
        // this error and continue trying to parse, rather than throwing an exception.
        // Without the patch, that put us into an endless loop.
              throw new XPathProcessorException(CONTINUE_AFTER_FATAL_ERROR);
      }
}
 
Example #20
Source File: XPathParser.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Consume an expected token, throwing an exception if it
 * isn't there.
 *
 * @param expected the character to be expected.
 *
 * @throws javax.xml.transform.TransformerException
 */
private final void consumeExpected(char expected)
        throws javax.xml.transform.TransformerException
{

  if (tokenIs(expected))
  {
    nextToken();
  }
  else
  {
    error(XPATHErrorResources.ER_EXPECTED_BUT_FOUND,
          new Object[]{ String.valueOf(expected),
                        m_token });  //"Expected "+expected+", but found: "+m_token);

        // Patch for Christina's gripe. She wants her errorHandler to return from
        // this error and continue trying to parse, rather than throwing an exception.
        // Without the patch, that put us into an endless loop.
              throw new XPathProcessorException(CONTINUE_AFTER_FATAL_ERROR);
  }
}
 
Example #21
Source File: XPathParser.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
/**
 * Consume an expected token, throwing an exception if it
 * isn't there.
 *
 * @param expected The string to be expected.
 *
 * @throws javax.xml.transform.TransformerException
 */
private final void consumeExpected(String expected)
        throws javax.xml.transform.TransformerException
{

  if (tokenIs(expected))
  {
    nextToken();
  }
  else
  {
    error(XPATHErrorResources.ER_EXPECTED_BUT_FOUND, new Object[]{ expected,
                                                                   m_token });  //"Expected "+expected+", but found: "+m_token);

        // Patch for Christina's gripe. She wants her errorHandler to return from
        // this error and continue trying to parse, rather than throwing an exception.
        // Without the patch, that put us into an endless loop.
              throw new XPathProcessorException(CONTINUE_AFTER_FATAL_ERROR);
      }
}
 
Example #22
Source File: XPathParser.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
/**
 * Consume an expected token, throwing an exception if it
 * isn't there.
 *
 * @param expected the character to be expected.
 *
 * @throws javax.xml.transform.TransformerException
 */
private final void consumeExpected(char expected)
        throws javax.xml.transform.TransformerException
{

  if (tokenIs(expected))
  {
    nextToken();
  }
  else
  {
    error(XPATHErrorResources.ER_EXPECTED_BUT_FOUND,
          new Object[]{ String.valueOf(expected),
                        m_token });  //"Expected "+expected+", but found: "+m_token);

        // Patch for Christina's gripe. She wants her errorHandler to return from
        // this error and continue trying to parse, rather than throwing an exception.
        // Without the patch, that put us into an endless loop.
              throw new XPathProcessorException(CONTINUE_AFTER_FATAL_ERROR);
  }
}
 
Example #23
Source File: XPathParser.java    From JDKSourceCode1.8 with MIT License 4 votes vote down vote up
/**
 * Given an string, init an XPath object for selections,
 * in order that a parse doesn't
 * have to be done each time the expression is evaluated.
 *
 * @param compiler The compiler object.
 * @param expression A string conforming to the XPath grammar.
 * @param namespaceContext An object that is able to resolve prefixes in
 * the XPath to namespaces.
 *
 * @throws javax.xml.transform.TransformerException
 */
public void initXPath(
        Compiler compiler, String expression, PrefixResolver namespaceContext)
          throws javax.xml.transform.TransformerException
{

  m_ops = compiler;
  m_namespaceContext = namespaceContext;
  m_functionTable = compiler.getFunctionTable();

  Lexer lexer = new Lexer(compiler, namespaceContext, this);

  lexer.tokenize(expression);

  m_ops.setOp(0,OpCodes.OP_XPATH);
  m_ops.setOp(OpMap.MAPINDEX_LENGTH,2);


      // Patch for Christine's gripe. She wants her errorHandler to return from
      // a fatal error and continue trying to parse, rather than throwing an exception.
      // Without the patch, that put us into an endless loop.
      //
      // %REVIEW% Is there a better way of doing this?
      // %REVIEW% Are there any other cases which need the safety net?
      //      (and if so do we care right now, or should we rewrite the XPath
      //      grammar engine and can fix it at that time?)
      try {

    nextToken();
    Expr();

    if (null != m_token)
    {
      String extraTokens = "";

      while (null != m_token)
      {
        extraTokens += "'" + m_token + "'";

        nextToken();

        if (null != m_token)
          extraTokens += ", ";
      }

      error(XPATHErrorResources.ER_EXTRA_ILLEGAL_TOKENS,
            new Object[]{ extraTokens });  //"Extra illegal tokens: "+extraTokens);
    }

  }
  catch (com.sun.org.apache.xpath.internal.XPathProcessorException e)
  {
        if(CONTINUE_AFTER_FATAL_ERROR.equals(e.getMessage()))
        {
              // What I _want_ to do is null out this XPath.
              // I doubt this has the desired effect, but I'm not sure what else to do.
              // %REVIEW%!!!
              initXPath(compiler, "/..",  namespaceContext);
        }
        else
              throw e;
  }

  compiler.shrink();
}
 
Example #24
Source File: XPathParser.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Given an string, init an XPath object for selections,
 * in order that a parse doesn't
 * have to be done each time the expression is evaluated.
 *
 * @param compiler The compiler object.
 * @param expression A string conforming to the XPath grammar.
 * @param namespaceContext An object that is able to resolve prefixes in
 * the XPath to namespaces.
 *
 * @throws javax.xml.transform.TransformerException
 */
public void initXPath(
        Compiler compiler, String expression, PrefixResolver namespaceContext)
          throws javax.xml.transform.TransformerException
{

  m_ops = compiler;
  m_namespaceContext = namespaceContext;
  m_functionTable = compiler.getFunctionTable();

  Lexer lexer = new Lexer(compiler, namespaceContext, this);

  lexer.tokenize(expression);

  m_ops.setOp(0,OpCodes.OP_XPATH);
  m_ops.setOp(OpMap.MAPINDEX_LENGTH,2);


      // Patch for Christine's gripe. She wants her errorHandler to return from
      // a fatal error and continue trying to parse, rather than throwing an exception.
      // Without the patch, that put us into an endless loop.
      //
      // %REVIEW% Is there a better way of doing this?
      // %REVIEW% Are there any other cases which need the safety net?
      //      (and if so do we care right now, or should we rewrite the XPath
      //      grammar engine and can fix it at that time?)
      try {

    nextToken();
    Expr();

    if (null != m_token)
    {
      String extraTokens = "";

      while (null != m_token)
      {
        extraTokens += "'" + m_token + "'";

        nextToken();

        if (null != m_token)
          extraTokens += ", ";
      }

      error(XPATHErrorResources.ER_EXTRA_ILLEGAL_TOKENS,
            new Object[]{ extraTokens });  //"Extra illegal tokens: "+extraTokens);
    }

  }
  catch (com.sun.org.apache.xpath.internal.XPathProcessorException e)
  {
        if(CONTINUE_AFTER_FATAL_ERROR.equals(e.getMessage()))
        {
              // What I _want_ to do is null out this XPath.
              // I doubt this has the desired effect, but I'm not sure what else to do.
              // %REVIEW%!!!
              initXPath(compiler, "/..",  namespaceContext);
        }
        else
              throw e;
  }

  compiler.shrink();
}
 
Example #25
Source File: XPathParser.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
/**
 * Given an string, init an XPath object for selections,
 * in order that a parse doesn't
 * have to be done each time the expression is evaluated.
 *
 * @param compiler The compiler object.
 * @param expression A string conforming to the XPath grammar.
 * @param namespaceContext An object that is able to resolve prefixes in
 * the XPath to namespaces.
 *
 * @throws javax.xml.transform.TransformerException
 */
public void initXPath(
        Compiler compiler, String expression, PrefixResolver namespaceContext)
          throws javax.xml.transform.TransformerException
{

  m_ops = compiler;
  m_namespaceContext = namespaceContext;
  m_functionTable = compiler.getFunctionTable();

  Lexer lexer = new Lexer(compiler, namespaceContext, this);

  lexer.tokenize(expression);

  m_ops.setOp(0,OpCodes.OP_XPATH);
  m_ops.setOp(OpMap.MAPINDEX_LENGTH,2);


      // Patch for Christine's gripe. She wants her errorHandler to return from
      // a fatal error and continue trying to parse, rather than throwing an exception.
      // Without the patch, that put us into an endless loop.
      //
      // %REVIEW% Is there a better way of doing this?
      // %REVIEW% Are there any other cases which need the safety net?
      //      (and if so do we care right now, or should we rewrite the XPath
      //      grammar engine and can fix it at that time?)
      try {

    nextToken();
    Expr();

    if (null != m_token)
    {
      String extraTokens = "";

      while (null != m_token)
      {
        extraTokens += "'" + m_token + "'";

        nextToken();

        if (null != m_token)
          extraTokens += ", ";
      }

      error(XPATHErrorResources.ER_EXTRA_ILLEGAL_TOKENS,
            new Object[]{ extraTokens });  //"Extra illegal tokens: "+extraTokens);
    }

  }
  catch (com.sun.org.apache.xpath.internal.XPathProcessorException e)
  {
        if(CONTINUE_AFTER_FATAL_ERROR.equals(e.getMessage()))
        {
              // What I _want_ to do is null out this XPath.
              // I doubt this has the desired effect, but I'm not sure what else to do.
              // %REVIEW%!!!
              initXPath(compiler, "/..",  namespaceContext);
        }
        else
              throw e;
  } catch (StackOverflowError sof) {
      error(XPATHErrorResources.ER_PREDICATE_TOO_MANY_OPEN,
            new Object[]{m_token, m_queueMark, countPredicate});
  }

  compiler.shrink();
}
 
Example #26
Source File: XPathParser.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Given an string, init an XPath object for selections,
 * in order that a parse doesn't
 * have to be done each time the expression is evaluated.
 *
 * @param compiler The compiler object.
 * @param expression A string conforming to the XPath grammar.
 * @param namespaceContext An object that is able to resolve prefixes in
 * the XPath to namespaces.
 *
 * @throws javax.xml.transform.TransformerException
 */
public void initXPath(
        Compiler compiler, String expression, PrefixResolver namespaceContext)
          throws javax.xml.transform.TransformerException
{

  m_ops = compiler;
  m_namespaceContext = namespaceContext;
  m_functionTable = compiler.getFunctionTable();

  Lexer lexer = new Lexer(compiler, namespaceContext, this);

  lexer.tokenize(expression);

  m_ops.setOp(0,OpCodes.OP_XPATH);
  m_ops.setOp(OpMap.MAPINDEX_LENGTH,2);


      // Patch for Christine's gripe. She wants her errorHandler to return from
      // a fatal error and continue trying to parse, rather than throwing an exception.
      // Without the patch, that put us into an endless loop.
      //
      // %REVIEW% Is there a better way of doing this?
      // %REVIEW% Are there any other cases which need the safety net?
      //      (and if so do we care right now, or should we rewrite the XPath
      //      grammar engine and can fix it at that time?)
      try {

    nextToken();
    Expr();

    if (null != m_token)
    {
      String extraTokens = "";

      while (null != m_token)
      {
        extraTokens += "'" + m_token + "'";

        nextToken();

        if (null != m_token)
          extraTokens += ", ";
      }

      error(XPATHErrorResources.ER_EXTRA_ILLEGAL_TOKENS,
            new Object[]{ extraTokens });  //"Extra illegal tokens: "+extraTokens);
    }

  }
  catch (com.sun.org.apache.xpath.internal.XPathProcessorException e)
  {
        if(CONTINUE_AFTER_FATAL_ERROR.equals(e.getMessage()))
        {
              // What I _want_ to do is null out this XPath.
              // I doubt this has the desired effect, but I'm not sure what else to do.
              // %REVIEW%!!!
              initXPath(compiler, "/..",  namespaceContext);
        }
        else
              throw e;
  }

  compiler.shrink();
}
 
Example #27
Source File: XPathParser.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Given an string, init an XPath object for selections,
 * in order that a parse doesn't
 * have to be done each time the expression is evaluated.
 *
 * @param compiler The compiler object.
 * @param expression A string conforming to the XPath grammar.
 * @param namespaceContext An object that is able to resolve prefixes in
 * the XPath to namespaces.
 *
 * @throws javax.xml.transform.TransformerException
 */
public void initXPath(
        Compiler compiler, String expression, PrefixResolver namespaceContext)
          throws javax.xml.transform.TransformerException
{

  m_ops = compiler;
  m_namespaceContext = namespaceContext;
  m_functionTable = compiler.getFunctionTable();

  Lexer lexer = new Lexer(compiler, namespaceContext, this);

  lexer.tokenize(expression);

  m_ops.setOp(0,OpCodes.OP_XPATH);
  m_ops.setOp(OpMap.MAPINDEX_LENGTH,2);


      // Patch for Christine's gripe. She wants her errorHandler to return from
      // a fatal error and continue trying to parse, rather than throwing an exception.
      // Without the patch, that put us into an endless loop.
      //
      // %REVIEW% Is there a better way of doing this?
      // %REVIEW% Are there any other cases which need the safety net?
      //      (and if so do we care right now, or should we rewrite the XPath
      //      grammar engine and can fix it at that time?)
      try {

    nextToken();
    Expr();

    if (null != m_token)
    {
      String extraTokens = "";

      while (null != m_token)
      {
        extraTokens += "'" + m_token + "'";

        nextToken();

        if (null != m_token)
          extraTokens += ", ";
      }

      error(XPATHErrorResources.ER_EXTRA_ILLEGAL_TOKENS,
            new Object[]{ extraTokens });  //"Extra illegal tokens: "+extraTokens);
    }

  }
  catch (com.sun.org.apache.xpath.internal.XPathProcessorException e)
  {
        if(CONTINUE_AFTER_FATAL_ERROR.equals(e.getMessage()))
        {
              // What I _want_ to do is null out this XPath.
              // I doubt this has the desired effect, but I'm not sure what else to do.
              // %REVIEW%!!!
              initXPath(compiler, "/..",  namespaceContext);
        }
        else
              throw e;
  }

  compiler.shrink();
}
 
Example #28
Source File: XPathParser.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Given an string, init an XPath object for selections,
 * in order that a parse doesn't
 * have to be done each time the expression is evaluated.
 *
 * @param compiler The compiler object.
 * @param expression A string conforming to the XPath grammar.
 * @param namespaceContext An object that is able to resolve prefixes in
 * the XPath to namespaces.
 *
 * @throws javax.xml.transform.TransformerException
 */
public void initXPath(
        Compiler compiler, String expression, PrefixResolver namespaceContext)
          throws javax.xml.transform.TransformerException
{

  m_ops = compiler;
  m_namespaceContext = namespaceContext;
  m_functionTable = compiler.getFunctionTable();

  Lexer lexer = new Lexer(compiler, namespaceContext, this);

  lexer.tokenize(expression);

  m_ops.setOp(0,OpCodes.OP_XPATH);
  m_ops.setOp(OpMap.MAPINDEX_LENGTH,2);


      // Patch for Christine's gripe. She wants her errorHandler to return from
      // a fatal error and continue trying to parse, rather than throwing an exception.
      // Without the patch, that put us into an endless loop.
      //
      // %REVIEW% Is there a better way of doing this?
      // %REVIEW% Are there any other cases which need the safety net?
      //      (and if so do we care right now, or should we rewrite the XPath
      //      grammar engine and can fix it at that time?)
      try {

    nextToken();
    Expr();

    if (null != m_token)
    {
      String extraTokens = "";

      while (null != m_token)
      {
        extraTokens += "'" + m_token + "'";

        nextToken();

        if (null != m_token)
          extraTokens += ", ";
      }

      error(XPATHErrorResources.ER_EXTRA_ILLEGAL_TOKENS,
            new Object[]{ extraTokens });  //"Extra illegal tokens: "+extraTokens);
    }

  }
  catch (com.sun.org.apache.xpath.internal.XPathProcessorException e)
  {
        if(CONTINUE_AFTER_FATAL_ERROR.equals(e.getMessage()))
        {
              // What I _want_ to do is null out this XPath.
              // I doubt this has the desired effect, but I'm not sure what else to do.
              // %REVIEW%!!!
              initXPath(compiler, "/..",  namespaceContext);
        }
        else
              throw e;
  }

  compiler.shrink();
}
 
Example #29
Source File: XPathParser.java    From jdk1.8-source-analysis with Apache License 2.0 4 votes vote down vote up
/**
 * Given an string, init an XPath object for selections,
 * in order that a parse doesn't
 * have to be done each time the expression is evaluated.
 *
 * @param compiler The compiler object.
 * @param expression A string conforming to the XPath grammar.
 * @param namespaceContext An object that is able to resolve prefixes in
 * the XPath to namespaces.
 *
 * @throws javax.xml.transform.TransformerException
 */
public void initXPath(
        Compiler compiler, String expression, PrefixResolver namespaceContext)
          throws javax.xml.transform.TransformerException
{

  m_ops = compiler;
  m_namespaceContext = namespaceContext;
  m_functionTable = compiler.getFunctionTable();

  Lexer lexer = new Lexer(compiler, namespaceContext, this);

  lexer.tokenize(expression);

  m_ops.setOp(0,OpCodes.OP_XPATH);
  m_ops.setOp(OpMap.MAPINDEX_LENGTH,2);


      // Patch for Christine's gripe. She wants her errorHandler to return from
      // a fatal error and continue trying to parse, rather than throwing an exception.
      // Without the patch, that put us into an endless loop.
      //
      // %REVIEW% Is there a better way of doing this?
      // %REVIEW% Are there any other cases which need the safety net?
      //      (and if so do we care right now, or should we rewrite the XPath
      //      grammar engine and can fix it at that time?)
      try {

    nextToken();
    Expr();

    if (null != m_token)
    {
      String extraTokens = "";

      while (null != m_token)
      {
        extraTokens += "'" + m_token + "'";

        nextToken();

        if (null != m_token)
          extraTokens += ", ";
      }

      error(XPATHErrorResources.ER_EXTRA_ILLEGAL_TOKENS,
            new Object[]{ extraTokens });  //"Extra illegal tokens: "+extraTokens);
    }

  }
  catch (com.sun.org.apache.xpath.internal.XPathProcessorException e)
  {
        if(CONTINUE_AFTER_FATAL_ERROR.equals(e.getMessage()))
        {
              // What I _want_ to do is null out this XPath.
              // I doubt this has the desired effect, but I'm not sure what else to do.
              // %REVIEW%!!!
              initXPath(compiler, "/..",  namespaceContext);
        }
        else
              throw e;
  }

  compiler.shrink();
}
 
Example #30
Source File: XPathParser.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Given an string, init an XPath object for selections,
 * in order that a parse doesn't
 * have to be done each time the expression is evaluated.
 *
 * @param compiler The compiler object.
 * @param expression A string conforming to the XPath grammar.
 * @param namespaceContext An object that is able to resolve prefixes in
 * the XPath to namespaces.
 *
 * @throws javax.xml.transform.TransformerException
 */
public void initXPath(
        Compiler compiler, String expression, PrefixResolver namespaceContext)
          throws javax.xml.transform.TransformerException
{

  m_ops = compiler;
  m_namespaceContext = namespaceContext;
  m_functionTable = compiler.getFunctionTable();

  Lexer lexer = new Lexer(compiler, namespaceContext, this);

  lexer.tokenize(expression);

  m_ops.setOp(0,OpCodes.OP_XPATH);
  m_ops.setOp(OpMap.MAPINDEX_LENGTH,2);


      // Patch for Christine's gripe. She wants her errorHandler to return from
      // a fatal error and continue trying to parse, rather than throwing an exception.
      // Without the patch, that put us into an endless loop.
      //
      // %REVIEW% Is there a better way of doing this?
      // %REVIEW% Are there any other cases which need the safety net?
      //      (and if so do we care right now, or should we rewrite the XPath
      //      grammar engine and can fix it at that time?)
      try {

    nextToken();
    Expr();

    if (null != m_token)
    {
      String extraTokens = "";

      while (null != m_token)
      {
        extraTokens += "'" + m_token + "'";

        nextToken();

        if (null != m_token)
          extraTokens += ", ";
      }

      error(XPATHErrorResources.ER_EXTRA_ILLEGAL_TOKENS,
            new Object[]{ extraTokens });  //"Extra illegal tokens: "+extraTokens);
    }

  }
  catch (com.sun.org.apache.xpath.internal.XPathProcessorException e)
  {
        if(CONTINUE_AFTER_FATAL_ERROR.equals(e.getMessage()))
        {
              // What I _want_ to do is null out this XPath.
              // I doubt this has the desired effect, but I'm not sure what else to do.
              // %REVIEW%!!!
              initXPath(compiler, "/..",  namespaceContext);
        }
        else
              throw e;
  } catch (StackOverflowError sof) {
      error(XPATHErrorResources.ER_PREDICATE_TOO_MANY_OPEN,
            new Object[]{m_token, m_queueMark, countPredicate});
  }

  compiler.shrink();
}