Hello,
I am seeing a possible bug during exception-handling while using Java binding in BaseX version 9.1.1. The problem can be illustrated by the following minimal working example query:
Q{java.lang.String}new*java.lang.String(())
This is equivalent to the Java expression "new String(null)". "null" is not valid for this constructor so an exception is thrown.
In version 9.1, I see the expected error:
[XPTY0004] String.new(empty-sequence()): java.lang.NullPointerException.
In version 9.1.1, I get message suggesting a potential bug along with a full stack trace:
Improper use? Potential bug? Your feedback is welcome: Contact: basex-talk@... Version: BaseX 9.1.1 Java: Oracle Corporation, 1.8.0_92 OS: Windows 10, amd64 Stack Trace: java.lang.NullPointerException at org.basex.util.Util.className(Util.java:70) at org.basex.query.func.java.JavaEval.type(JavaEval.java:203) at org.basex.query.func.java.JavaEval.types(JavaEval.java:188) at org.basex.query.func.java.JavaEval.execError(JavaEval.java:149) at org.basex.query.func.java.DynJavaConstr.eval(DynJavaConstr.java:78) at org.basex.query.func.java.JavaCall.value(JavaCall.java:70) at org.basex.query.func.java.JavaCall.iter(JavaCall.java:63) at org.basex.query.scope.MainModule.iter(MainModule.java:118) at org.basex.query.QueryContext.iter(QueryContext.java:335) at org.basex.query.QueryContext.cache(QueryContext.java:613) at org.basex.query.QueryProcessor.cache(QueryProcessor.java:112) at org.basex.core.cmd.AQuery.query(AQuery.java:103) at org.basex.core.cmd.XQuery.run(XQuery.java:22) at org.basex.core.Command.run(Command.java:257) at org.basex.core.Command.execute(Command.java:93) at org.basex.gui.GUI.exec(GUI.java:429) at org.basex.gui.GUI.lambda$4(GUI.java:372) at java.lang.Thread.run(Thread.java:745)
The stack trace suggests that the error is occurring while the system is assembling the error message. It generates a string describing the Java arguments:
https://github.com/BaseXdb/basex/blob/9.1.1/basex-core/src/main/java/org/bas...
... but when it tries to determine the type of "null":
https://github.com/BaseXdb/basex/blob/9.1.1/basex-core/src/main/java/org/bas...
... it incurs a NullPointerException while calling "null.getClass()":
https://github.com/BaseXdb/basex/blob/9.1.1/basex-core/src/main/java/org/bas...
I hope this report is helpful.
Take care,
Mark
Mark McSweeny Development Team Lead t: 403-648-4602 + 4602 e: mark.mcsweeny@aucerna.com Learn more about Aucerna www.3esi-enersight.com/blog/palantir-solutions Confidentiality Notice: The information transmitted herein may contain confidential, proprietary and/or privileged material which belongs to Aucerna and is only for the intended addressee(s). Any unauthorized review, distribution or other use of this information is prohibited. Finally, the recipient should check this email and any attachments for the presence of viruses. The organization accepts no liability for any damage caused by any virus transmitted by this email. If you received this email in error, please contact us at (403) 270-3270 or by return email and delete this email and any copies immediately. v&7.11.1989&$
Hi Mark,
Thanks for the helpful observation and the code analysis. The error message construction has been fixed in the latest snapshot [1,2].
Best, Christian
[1] https://github.com/BaseXdb/basex/commit/997dad45781c043af7224691a760097c84f0... [2] http://files.basex.org/releases/latest/
On Thu, Dec 20, 2018 at 11:56 PM Mark McSweeny mark.mcsweeny@aucerna.com wrote:
Hello,
I am seeing a possible bug during exception-handling while using Java binding in BaseX version 9.1.1. The problem can be illustrated by the following minimal working example query:
Q{java.lang.String}new*java.lang.String(())
This is equivalent to the Java expression "new String(null)". "null" is not valid for this constructor so an exception is thrown.
In version 9.1, I see the expected error:
[XPTY0004] String.new(empty-sequence()): java.lang.NullPointerException.
In version 9.1.1, I get message suggesting a potential bug along with a full stack trace:
Improper use? Potential bug? Your feedback is welcome: Contact: basex-talk@... Version: BaseX 9.1.1 Java: Oracle Corporation, 1.8.0_92 OS: Windows 10, amd64 Stack Trace: java.lang.NullPointerException at org.basex.util.Util.className(Util.java:70) at org.basex.query.func.java.JavaEval.type(JavaEval.java:203) at org.basex.query.func.java.JavaEval.types(JavaEval.java:188) at org.basex.query.func.java.JavaEval.execError(JavaEval.java:149) at org.basex.query.func.java.DynJavaConstr.eval(DynJavaConstr.java:78) at org.basex.query.func.java.JavaCall.value(JavaCall.java:70) at org.basex.query.func.java.JavaCall.iter(JavaCall.java:63) at org.basex.query.scope.MainModule.iter(MainModule.java:118) at org.basex.query.QueryContext.iter(QueryContext.java:335) at org.basex.query.QueryContext.cache(QueryContext.java:613) at org.basex.query.QueryProcessor.cache(QueryProcessor.java:112) at org.basex.core.cmd.AQuery.query(AQuery.java:103) at org.basex.core.cmd.XQuery.run(XQuery.java:22) at org.basex.core.Command.run(Command.java:257) at org.basex.core.Command.execute(Command.java:93) at org.basex.gui.GUI.exec(GUI.java:429) at org.basex.gui.GUI.lambda$4(GUI.java:372) at java.lang.Thread.run(Thread.java:745)
The stack trace suggests that the error is occurring while the system is assembling the error message. It generates a string describing the Java arguments:
https://github.com/BaseXdb/basex/blob/9.1.1/basex-core/src/main/java/org/bas...
... but when it tries to determine the type of "null":
https://github.com/BaseXdb/basex/blob/9.1.1/basex-core/src/main/java/org/bas...
... it incurs a NullPointerException while calling "null.getClass()":
https://github.com/BaseXdb/basex/blob/9.1.1/basex-core/src/main/java/org/bas...
I hope this report is helpful.
Take care,
Mark
Mark McSweeny Development Team Lead t: *403-648-4602 + 4602* <403-648-4602%20+%204602> e: *mark.mcsweeny@aucerna.com* mark.mcsweeny@aucerna.com Learn more about Aucerna *www.3esi-enersight.com/blog/palantir-solutions* https://3esi-enersight.com/blog/palantir-solutions/ [image: Facebook] https://www.facebook.com/3esiEnersight/ [image: LinkedIn] https://www.linkedin.com/company/3esi [image: Twitter] https://www.twitter.com/3esi_Enersight Confidentiality Notice: The information transmitted herein may contain confidential, proprietary and/or privileged material which belongs to Aucerna and is only for the intended addressee(s). Any unauthorized review, distribution or other use of this information is prohibited. Finally, the recipient should check this email and any attachments for the presence of viruses. The organization accepts no liability for any damage caused by any virus transmitted by this email. If you received this email in error, please contact us at (403) 270-3270 or by return email and delete this email and any copies immediately. v&7.11.1989&$
basex-talk@mailman.uni-konstanz.de