Project

Profile

Help

Java extension BestFit prb/bug (8.3/8.4)

Added by Anonymous about 19 years ago

Legacy ID: #3092188 Legacy Poster: Daniel Chaffiol (vonc)

Hi, I have an java.lang.ArrayIndexOutOfBoundsException: x, if I have two public java extension functions with the same name, the correct called java function having more parameters than the second one. In my xslt code, I call a public static function f(int i, int j) (for instance) If I have in the same extention java class another function f (static or not), like f(String k), I will get an ArrayIndexOutOfBoundsException: 2: (see call statck at the end) More specifically, the line net.sf.saxon.functions.JavaExtensionLibrary.getBestFit(JavaExtensionLibrary.java:539) should have more check when manipulating arays of int... like a: if(k < pref_i.length) { // ADDITIONAL TEST which seems to be enough to fix the problem if (pref_i[k] > pref_j[k] && !eliminated[i]) { // high number means less preferred [...] Daniel Chaffiol call stack java.lang.ArrayIndexOutOfBoundsException: 3 at net.sf.saxon.functions.JavaExtensionLibrary.getBestFit(JavaExtensionLibrary.java:539) at net.sf.saxon.functions.JavaExtensionLibrary.bind(JavaExtensionLibrary.java:449) at net.sf.saxon.functions.FunctionLibraryList.bind(FunctionLibraryList.java:71) at net.sf.saxon.expr.ExpressionParser.parseFunctionCall(ExpressionParser.java:1732) at net.sf.saxon.expr.ExpressionParser.parseBasicStep(ExpressionParser.java:1234) at net.sf.saxon.expr.ExpressionParser.parseStepExpression(ExpressionParser.java:1149) at net.sf.saxon.expr.ExpressionParser.parseRelativePath(ExpressionParser.java:1089) at net.sf.saxon.expr.ExpressionParser.parsePathExpression(ExpressionParser.java:1075) at net.sf.saxon.expr.ExpressionParser.parseUnaryExpression(ExpressionParser.java:954) at net.sf.saxon.expr.ExpressionParser.parseCastExpression(ExpressionParser.java:625) at net.sf.saxon.expr.ExpressionParser.parseCastableExpression(ExpressionParser.java:600) at net.sf.saxon.expr.ExpressionParser.parseTreatExpression(ExpressionParser.java:581) at net.sf.saxon.expr.ExpressionParser.parseInstanceOfExpression(ExpressionParser.java:563) at net.sf.saxon.expr.ExpressionParser.parseIntersectExpression(ExpressionParser.java:987) at net.sf.saxon.expr.ExpressionParser.parseUnionExpression(ExpressionParser.java:969) at net.sf.saxon.expr.ExpressionParser.parseMultiplicativeExpression(ExpressionParser.java:906) at net.sf.saxon.expr.ExpressionParser.parseAdditiveExpression(ExpressionParser.java:886) at net.sf.saxon.expr.ExpressionParser.parseRangeExpression(ExpressionParser.java:798) at net.sf.saxon.expr.ExpressionParser.parseComparisonExpression(ExpressionParser.java:748) at net.sf.saxon.expr.ExpressionParser.parseAndExpression(ExpressionParser.java:370) at net.sf.saxon.expr.ExpressionParser.parseOrExpression(ExpressionParser.java:352) at net.sf.saxon.expr.ExpressionParser.parseExprSingle(ExpressionParser.java:306) at net.sf.saxon.expr.ExpressionParser.parseExpression(ExpressionParser.java:269) at net.sf.saxon.expr.ExpressionParser.parse(ExpressionParser.java:191) at net.sf.saxon.expr.ExpressionTool.make(ExpressionTool.java:50) at net.sf.saxon.style.StyleElement.makeExpression(StyleElement.java:453) at net.sf.saxon.style.XSLGeneralVariable.prepareAttributes(XSLGeneralVariable.java:185) at net.sf.saxon.style.XSLVariable.prepareAttributes(XSLVariable.java:34) at net.sf.saxon.style.StyleElement.processAttributes(StyleElement.java:353) at net.sf.saxon.style.StyleElement.processAllAttributes(StyleElement.java:323) at net.sf.saxon.style.StyleElement.processAllAttributes(StyleElement.java:331) at net.sf.saxon.style.XSLStylesheet.processAllAttributes(XSLStylesheet.java:882) at net.sf.saxon.style.XSLStylesheet.preprocess(XSLStylesheet.java:618) at net.sf.saxon.PreparedStylesheet.setStylesheetDocument(PreparedStylesheet.java:295) at net.sf.saxon.PreparedStylesheet.prepare(PreparedStylesheet.java:116) at net.sf.saxon.TransformerFactoryImpl.newTemplates(TransformerFactoryImpl.java:125) at net.sf.saxon.Transform.doMain(Transform.java:464) at net.sf.saxon.Transform.main(Transform.java:59) Fatal error during transformation: 3


Replies (1)

RE: Java extension BestFit prb/bug (8.3/8.4) - Added by Anonymous about 19 years ago

Legacy ID: #3094585 Legacy Poster: Michael Kay (mhkay)

Thanks for reporting this. I've included a description of the bug and a source fix at http://sourceforge.net/tracker/index.php?func=detail&amp;aid=1180904&amp;group_id=29872&amp;atid=397617 I believe the problem only occurs when comparing a static method having N arguments with a non-static method having N-1 arguments - if the number of arguments on the method doesn't "match" the number in the call, they won't be included in candidateMethods and won't be compared using this routine. The fix includes the first argument of the call in the comparison whether the method is static or not, treating the non-static method as having a first argument whose class is the target class being called. Michael Kay

    (1-1/1)

    Please register to reply