Silent exceptions in the TMQL search and query

Found a bug in Wandora. Please report it here.

Silent exceptions in the TMQL search and query

Postby mordenkainen » Sun Mar 08, 2015 5:40 pm

There is the TMQL tab inside Search and Query dialogue, which is called by Ctrl-F.

If you misprint some query here, it pops exception dialogue which contains exception name and stack trace. I suppose it is the intended way to inform the user about syntax error in his query.

I write couple of queries that output stack trace to the console running Wandora but the interface keep quiet and no popup is shown. I suppose it is a bug.

The map: http://s000.tinyupload.com/index.php?fi ... 6780062304

The query:
Code: Select all
%prefix core http://wandora.org/si/core/
select $t
where
    some $d in core:wandora-class << types [ . / tm:name == "DDD" ] satisfies true
 &  some $t in core:wandora-class << types [ . / tm:name == "AAA" ] << types satisfies $t isa $d


The stack trace, shown only in console:
Code: Select all
   de.topicmapslab.tmql4j.exception.TMQLGeneratorException: Invalid state, grammar unknown for given query.
   at de.topicmapslab.tmql4j.components.parser.ParserTreeImpl.createRootExpression(ParserTreeImpl.java:181)
   at de.topicmapslab.tmql4j.components.parser.ParserTreeImpl.<init>(ParserTreeImpl.java:134)
   at de.topicmapslab.tmql4j.draft2010.components.parser.TmqlParserTree.<init>(TmqlParserTree.java:46)
   at de.topicmapslab.tmql4j.draft2010.components.parser.TMQLParser.getParserTreeInstance(TMQLParser.java:43)
   at de.topicmapslab.tmql4j.components.parser.ParserImpl.parse(ParserImpl.java:67)
   at de.topicmapslab.tmql4j.components.processor.TmqlProcessorImpl.parse(TmqlProcessorImpl.java:125)
   at de.topicmapslab.tmql4j.components.processor.TmqlProcessorImpl.query(TmqlProcessorImpl.java:57)
   at de.topicmapslab.tmql4j.draft2010.components.processor.runtime.TmqlRuntime.doRun(TmqlRuntime.java:100)
   at de.topicmapslab.tmql4j.components.processor.runtime.TmqlRuntimeImpl.run(TmqlRuntimeImpl.java:160)
   at de.topicmapslab.tmql4j.components.processor.runtime.TmqlRuntimeImpl.run(TmqlRuntimeImpl.java:191)
   at de.topicmapslab.tmql4j.path.components.interpreter.QuantifiedExpression$1.run(QuantifiedExpression.java:273)
   at de.topicmapslab.tmql4j.path.components.interpreter.QuantifiedExpression.interpretQuantifiedExpression(QuantifiedExpression.java:300)
   at de.topicmapslab.tmql4j.path.components.interpreter.QuantifiedExpression.interpret(QuantifiedExpression.java:167)
   at de.topicmapslab.tmql4j.path.components.interpreter.ExistsClauseInterpreter.interpret(ExistsClauseInterpreter.java:86)
   at de.topicmapslab.tmql4j.path.components.interpreter.ExistsClauseInterpreter.interpret(ExistsClauseInterpreter.java:52)
   at de.topicmapslab.tmql4j.path.components.interpreter.BooleanPrimitiveInterpreter.interpretExsistsExpression(BooleanPrimitiveInterpreter.java:331)
   at de.topicmapslab.tmql4j.path.components.interpreter.BooleanPrimitiveInterpreter.interpret(BooleanPrimitiveInterpreter.java:114)
   at de.topicmapslab.tmql4j.path.components.interpreter.BooleanPrimitiveInterpreter.interpret(BooleanPrimitiveInterpreter.java:69)
   at de.topicmapslab.tmql4j.path.components.interpreter.BooleanExpressionInterpreter.interpretBooleanPrimitve(BooleanExpressionInterpreter.java:257)
   at de.topicmapslab.tmql4j.path.components.interpreter.BooleanExpressionInterpreter.interpret(BooleanExpressionInterpreter.java:89)
   at de.topicmapslab.tmql4j.path.components.interpreter.BooleanExpressionInterpreter.interpret(BooleanExpressionInterpreter.java:50)
   at de.topicmapslab.tmql4j.path.components.interpreter.BooleanExpressionInterpreter.interpretConjunction(BooleanExpressionInterpreter.java:189)
   at de.topicmapslab.tmql4j.path.components.interpreter.BooleanExpressionInterpreter.interpret(BooleanExpressionInterpreter.java:83)
   at de.topicmapslab.tmql4j.path.components.interpreter.BooleanExpressionInterpreter.interpret(BooleanExpressionInterpreter.java:50)
   at de.topicmapslab.tmql4j.select.components.interpreter.WhereClauseInterpreter.interpret(WhereClauseInterpreter.java:60)
   at de.topicmapslab.tmql4j.select.components.interpreter.WhereClauseInterpreter.interpret(WhereClauseInterpreter.java:37)
   at de.topicmapslab.tmql4j.components.interpreter.ExpressionInterpreterImpl.extractArguments(ExpressionInterpreterImpl.java:248)
   at de.topicmapslab.tmql4j.select.components.interpreter.SelectExpressionInterpreter.interpretWhereClause(SelectExpressionInterpreter.java:276)
   at de.topicmapslab.tmql4j.select.components.interpreter.SelectExpressionInterpreter.interpret(SelectExpressionInterpreter.java:111)
   at de.topicmapslab.tmql4j.select.components.interpreter.SelectExpressionInterpreter.interpret(SelectExpressionInterpreter.java:55)
   at de.topicmapslab.tmql4j.select.components.interpreter.QueryExpressionInterpreter.interpret(QueryExpressionInterpreter.java:69)
   at de.topicmapslab.tmql4j.select.components.interpreter.QueryExpressionInterpreter.interpret(QueryExpressionInterpreter.java:38)
   at de.topicmapslab.tmql4j.grammar.productions.ExpressionImpl.interpret(ExpressionImpl.java:335)
   at de.topicmapslab.tmql4j.components.processor.TmqlProcessorImpl.query(TmqlProcessorImpl.java:61)
   at de.topicmapslab.tmql4j.path.components.processor.runtime.TmqlRuntime2007.doRun(TmqlRuntime2007.java:87)
   at de.topicmapslab.tmql4j.components.processor.runtime.TmqlRuntimeImpl.run(TmqlRuntimeImpl.java:160)
   at de.topicmapslab.tmql4j.components.processor.runtime.TmqlRuntimeImpl.run(TmqlRuntimeImpl.java:191)
   at org.wandora.topicmap.TMQLRunner.runTMQL(TMQLRunner.java:62)
   at org.wandora.application.gui.search.TMQLPanel.getTopicsByTMQL(TMQLPanel.java:182)
   at org.wandora.application.gui.search.TMQLPanel.runButtonActionPerformed(TMQLPanel.java:364)
   at org.wandora.application.gui.search.TMQLPanel.access$400(TMQLPanel.java:61)
   at org.wandora.application.gui.search.TMQLPanel$4.actionPerformed(TMQLPanel.java:303)
   at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2018)
   at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2341)
   at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
   at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
   at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252)
   at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:289)
   at java.awt.Component.processMouseEvent(Component.java:6516)
   at javax.swing.JComponent.processMouseEvent(JComponent.java:3312)
   at java.awt.Component.processEvent(Component.java:6281)
   at java.awt.Container.processEvent(Container.java:2229)
   at java.awt.Component.dispatchEventImpl(Component.java:4872)
   at java.awt.Container.dispatchEventImpl(Container.java:2287)
   at java.awt.Component.dispatchEvent(Component.java:4698)
   at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4832)
   at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4492)
   at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4422)
   at java.awt.Container.dispatchEventImpl(Container.java:2273)
   at java.awt.Window.dispatchEventImpl(Window.java:2719)
   at java.awt.Component.dispatchEvent(Component.java:4698)
   at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:740)
   at java.awt.EventQueue.access$300(EventQueue.java:103)
   at java.awt.EventQueue$3.run(EventQueue.java:699)
   at java.awt.EventQueue$3.run(EventQueue.java:697)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
   at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:87)
   at java.awt.EventQueue$4.run(EventQueue.java:713)
   at java.awt.EventQueue$4.run(EventQueue.java:711)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
   at java.awt.EventQueue.dispatchEvent(EventQueue.java:710)
   at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
   at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
   at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
   at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
   at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
   at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)
Caused by: java.lang.reflect.InvocationTargetException
   at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
   at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
   at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
   at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
   at de.topicmapslab.tmql4j.components.parser.ParserTreeImpl.createRootExpression(ParserTreeImpl.java:169)
   ... 78 more
Caused by: de.topicmapslab.tmql4j.exception.TMQLGeneratorException: java.lang.reflect.InvocationTargetException
   at de.topicmapslab.tmql4j.grammar.productions.ExpressionImpl.checkForExtensions(ExpressionImpl.java:307)
   at de.topicmapslab.tmql4j.draft2010.grammar.productions.QueryExpression.<init>(QueryExpression.java:130)
   at de.topicmapslab.tmql4j.draft2010.grammar.productions.QueryExpression.<init>(QueryExpression.java:60)
   ... 83 more
Caused by: java.lang.reflect.InvocationTargetException
   at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
   at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
   at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
   at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
   at de.topicmapslab.tmql4j.grammar.productions.ExpressionImpl.checkForExtensions(ExpressionImpl.java:301)
   ... 85 more
Caused by: de.topicmapslab.tmql4j.exception.TMQLGeneratorException: java.lang.reflect.InvocationTargetException
   at de.topicmapslab.tmql4j.grammar.productions.ExpressionImpl.checkForExtensions(ExpressionImpl.java:307)
   at de.topicmapslab.tmql4j.draft2010.grammar.productions.Expression.<init>(Expression.java:78)
   ... 90 more
Caused by: java.lang.reflect.InvocationTargetException
   at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
   at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
   at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
   at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
   at de.topicmapslab.tmql4j.grammar.productions.ExpressionImpl.checkForExtensions(ExpressionImpl.java:301)
   ... 91 more
Caused by: de.topicmapslab.tmql4j.exception.TMQLGeneratorException: java.lang.reflect.InvocationTargetException
   at de.topicmapslab.tmql4j.grammar.productions.ExpressionImpl.checkForExtensions(ExpressionImpl.java:307)
   at de.topicmapslab.tmql4j.draft2010.grammar.productions.PathExpression$1.newToken(PathExpression.java:75)
   at de.topicmapslab.tmql4j.draft2010.components.parser.ParserUtils.split(ParserUtils.java:371)
   at de.topicmapslab.tmql4j.draft2010.components.parser.ParserUtils.split(ParserUtils.java:305)
   at de.topicmapslab.tmql4j.draft2010.grammar.productions.PathExpression.<init>(PathExpression.java:90)
   ... 96 more
Caused by: java.lang.reflect.InvocationTargetException
   at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
   at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
   at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
   at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
   at de.topicmapslab.tmql4j.grammar.productions.ExpressionImpl.checkForExtensions(ExpressionImpl.java:301)
   ... 100 more
Caused by: de.topicmapslab.tmql4j.exception.TMQLInvalidSyntaxException: Message: Expression is invalid.
Expression: SimpleExpression
language-specific Tokens:  Element Element Element BracketSquareOpen Dot Axis Element Equality Element BracketSquareClose Element Element BracketSquareOpen Dot Element Element Element Element BracketSquareClose
string-represented Tokens: [core:wandora-class, <<, types, [, ., /, tm:name, ==, "AAA", ], <<, types, [, ., isa, "ID1379043793-ID2063089-topic74", <<, id, ]]

   at de.topicmapslab.tmql4j.grammar.productions.ExpressionImpl.<init>(ExpressionImpl.java:98)
   at de.topicmapslab.tmql4j.draft2010.grammar.productions.SimpleExpression.<init>(SimpleExpression.java:67)
   ... 105 more


There is also a query that produces infinite stack trace. In fue seconds it had writed more than 75 MB to the stderr.
Code: Select all
%prefix core http://wandora.org/si/core/
select $t
where
    some $d in core:wandora-class << types [ . / tm:name == "DDD" ]
 &  some $t in core:wandora-class << types [ . / tm:name == "AAA" ] << types satisfies $t isa $d

I write this query by accident. I forget to write the satisfies clause and get infinite exception.
mordenkainen
 
Posts: 24
Joined: Fri Feb 13, 2015 5:11 pm

Re: Silent exceptions in the TMQL search and query

Postby akivela » Tue Mar 10, 2015 10:51 am

Thanks for the bug report, Mordenkainen. I'll look at this and try to make the error messages visible. I'll post a message here when the issue has been resolved.

--Aki / Wandora Team
akivela
Site Admin
 
Posts: 257
Joined: Tue Sep 18, 2007 10:20 am
Location: Helsinki, Finland


Return to Bugs

Who is online

Users browsing this forum: No registered users and 1 guest

cron