Vaibhav95g / h2database

Automatically exported from code.google.com/p/h2database
0 stars 0 forks source link

RunScript.execute() causes nullpointer exception in 1.3.175 when script contains only comment line or only white spaces #555

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
When the script is an empty string (or trim-able to an empty string) or if it 
only contains comment lines, the H2 1.3.175 throws the exception.

Stack trace: 

Caused by: org.h2.jdbc.JdbcSQLException: General error: 
"java.lang.NullPointerException" [50000-175]
      at org.h2.message.DbException.getJdbcSQLException(DbException.java:332)
      at org.h2.message.DbException.get(DbException.java:161)
      at org.h2.message.DbException.convert(DbException.java:284)
      at org.h2.message.DbException.toSQLException(DbException.java:257)
      at org.h2.message.TraceObject.logAndConvert(TraceObject.java:368)
      at org.h2.jdbc.JdbcStatement.execute(JdbcStatement.java:158)
      at org.h2.tools.RunScript.execute(RunScript.java:170)
      at com.hp.it.techasmts.bate.atl.core.out.SqlInstruction.executeScript(SqlInstruction.java:69)
      ... 3 more
Caused by: java.lang.NullPointerException
      at org.h2.expression.Function.getCost(Function.java:2391)
      at org.h2.expression.Comparison.getCost(Comparison.java:480)
      at org.h2.expression.ConditionAndOr.optimize(ConditionAndOr.java:133)
      at org.h2.command.dml.Select.prepare(Select.java:813)
      at org.h2.command.Parser.prepare(Parser.java:220)
      at org.h2.engine.Session.prepare(Session.java:403)
      at org.h2.index.ViewIndex.getCost(ViewIndex.java:159)
      at org.h2.table.TableView.getBestPlanItem(TableView.java:210)
      at org.h2.table.TableFilter.getBestPlanItem(TableFilter.java:184)
      at org.h2.table.Plan.calculateCost(Plan.java:111)
      at org.h2.command.dml.Optimizer.testPlan(Optimizer.java:177)
      at org.h2.command.dml.Optimizer.calculateBestPlan(Optimizer.java:81)
      at org.h2.command.dml.Optimizer.optimize(Optimizer.java:230)
      at org.h2.command.dml.Select.preparePlan(Select.java:933)
      at org.h2.command.dml.Select.prepare(Select.java:834)
      at org.h2.command.Parser.prepare(Parser.java:220)
      at org.h2.engine.Session.prepare(Session.java:403)
      at org.h2.index.ViewIndex.getCost(ViewIndex.java:159)
      at org.h2.table.TableView.getBestPlanItem(TableView.java:210)
      at org.h2.table.TableFilter.getBestPlanItem(TableFilter.java:184)
      at org.h2.table.Plan.calculateCost(Plan.java:111)
      at org.h2.command.dml.Optimizer.testPlan(Optimizer.java:177)
      at org.h2.command.dml.Optimizer.calculateBestPlan(Optimizer.java:81)
      at org.h2.command.dml.Optimizer.optimize(Optimizer.java:230)
      at org.h2.command.dml.Select.preparePlan(Select.java:933)
      at org.h2.command.dml.Select.prepare(Select.java:834)
      at org.h2.command.Parser.prepare(Parser.java:220)
      at org.h2.engine.Session.prepare(Session.java:403)
      at org.h2.engine.Session.prepare(Session.java:390)
      at org.h2.table.TableView.compileViewQuery(TableView.java:104)
      at org.h2.table.TableView.initColumnsAndTables(TableView.java:149)
      at org.h2.table.TableView.init(TableView.java:100)
      at org.h2.table.TableView.<init>(TableView.java:66)
      at org.h2.table.TableView.createTempView(TableView.java:454)
      at org.h2.command.Parser.readTableFilter(Parser.java:1134)
      at org.h2.command.Parser.parseSelectSimpleFromPart(Parser.java:1813)
      at org.h2.command.Parser.parseSelectSimple(Parser.java:1921)
      at org.h2.command.Parser.parseSelectSub(Parser.java:1807)
      at org.h2.command.Parser.parseSelectUnion(Parser.java:1631)
      at org.h2.command.Parser.parseSelect(Parser.java:1619)
      at org.h2.command.Parser.parseCreateView(Parser.java:4524)
      at org.h2.command.Parser.parseCreate(Parser.java:3946)
      at org.h2.command.Parser.parsePrepared(Parser.java:343)
      at org.h2.command.Parser.parse(Parser.java:298)
      at org.h2.command.Parser.parse(Parser.java:270)
      at org.h2.command.Parser.prepareCommand(Parser.java:235)
      at org.h2.engine.Session.prepareLocal(Session.java:436)
      at org.h2.engine.Session.prepareCommand(Session.java:379)
      at org.h2.jdbc.JdbcConnection.prepareCommand(JdbcConnection.java:1138)
      at org.h2.jdbc.JdbcStatement.executeInternal(JdbcStatement.java:168)
      at org.h2.jdbc.JdbcStatement.execute(JdbcStatement.java:156)
      ... 5 more

There was no such issue on previous versions.

Best regards,
Jean Guiannotte

Original issue reported on code.google.com by jean.gui...@gmail.com on 1 Apr 2014 at 1:53

GoogleCodeExporter commented 9 years ago
Please close this issue. The problem description is incorrect.
The corrected problem has been submitted under number 556.
This is a NullPointer exception with 1.3.175, but not related to comments.

Original comment by jean.gui...@gmail.com on 3 Apr 2014 at 12:48

GoogleCodeExporter commented 9 years ago
OK, I will close it. Issue 556 is fixed in the latest trunk by the way.

Original comment by thomas.t...@gmail.com on 5 Apr 2014 at 12:18