PLEASE DO NOT REPLY TO THIS MESSAGE. TO FURTHER COMMENT ON THE STATUS OF THIS BUG PLEASE FOLLOW THE LINK BELOW AND USE THE ON-LINE APPLICATION. REPLYING TO THIS MESSAGE DOES NOT UPDATE THE DATABASE, AND SO YOUR COMMENT WILL BE LOST SOMEWHERE. http://nagoya.apache.org/bugzilla/show_bug.cgi?id=2866 *** shadow/2866 Fri Jul 27 14:00:11 2001 --- shadow/2866.tmp.2677 Fri Jul 27 14:00:11 2001 *************** *** 0 **** --- 1,34 ---- + +============================================================================+ + | Limit of 100 tokens in xpath expression | + +----------------------------------------------------------------------------+ + | Bug #: 2866 Product: XalanJ2 | + | Status: NEW Version: 2.2.x | + | Resolution: Platform: PC | + | Severity: Normal OS/Version: Other | + | Priority: Other Component: org.apache.xpath | + +----------------------------------------------------------------------------+ + | Assigned To: [EMAIL PROTECTED] | + | Reported By: [EMAIL PROTECTED] | + | CC list: Cc: | + +----------------------------------------------------------------------------+ + | URL: | + +============================================================================+ + | DESCRIPTION | + Lexer.mapPatternElemPos throws a java.lang.ArrayIndexOutOfBoundsException for + xpath expressions with more than 100 tokens. The hard-coded size of the + m_patternMap attribute is the problem -- it is sized to 100. My quick and easy + fix was to the modify org.apache.xpath.compiler.Lexer source in the following + ways: + 1. Added a constant: + static public final int MAX_TOKENS = 1000; + 2. Changed declaration of m_patternMap to this: + private int m_patternMap[] = new int[MAX_TOKENS]; + 3. In mapPatternElemPos method, threw a TransformerException when the index + into that array is greater or equal to MAX_TOKENS. + + Since the Lexer code may not live much longer, this quick & simple fix may be + the best solution. + + Thanks, + + Joe Baysdon
