[ 
https://issues.apache.org/jira/browse/DERBY-3094?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12543876
 ] 

Thomas Nielsen commented on DERBY-3094:
---------------------------------------

I reproduced this in my sandbox even with the ready-to-commit patch for 
DERBY-2352 applied, so it's not a dup of 2352.

Good news is it throws the NPE with both sane and insane builds, and here's the 
callstack with line numbers
---
2007-11-20 11:43:05.545 GMT Thread[main,5,main] (XID = 173), (SESSIONID = 0), 
(DATABASE = d3094), (DRDAID = null), Failed Statement is: select a, 
a*(b/100.000000), count(*) from xx group by a, a*(b/100.000000)
ERROR 38000: The exception 'java.lang.NullPointerException' was thrown while 
evaluating an expression.
        at 
org.apache.derby.iapi.error.StandardException.newException(StandardException.java:294)
        at 
org.apache.derby.iapi.error.StandardException.unexpectedUserException(StandardException.java:554)
        at 
org.apache.derby.impl.services.reflect.DirectCall.invoke(ReflectGeneratedClass.java:164)
        at 
org.apache.derby.impl.sql.execute.ProjectRestrictResultSet.doProjection(ProjectRestrictResultSet.java:488)
        at 
org.apache.derby.impl.sql.execute.ProjectRestrictResultSet.getNextRowCore(ProjectRestrictResultSet.java:291)
        at 
org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl.getNextRow(BasicNoPutResultSetImpl.java:463)
        at 
org.apache.derby.impl.jdbc.EmbedResultSet.movePosition(EmbedResultSet.java:424)
        at 
org.apache.derby.impl.jdbc.EmbedResultSet.next(EmbedResultSet.java:368)
        at 
org.apache.derby.tools.JDBCDisplayUtil.indent_DisplayResults(JDBCDisplayUtil.java:382)
        at 
org.apache.derby.tools.JDBCDisplayUtil.indent_DisplayResults(JDBCDisplayUtil.java:338)
        at 
org.apache.derby.tools.JDBCDisplayUtil.indent_DisplayResults(JDBCDisplayUtil.java:241)
        at 
org.apache.derby.tools.JDBCDisplayUtil.DisplayResults(JDBCDisplayUtil.java:229)
        at 
org.apache.derby.impl.tools.ij.utilMain.displayResult(utilMain.java:435)
        at org.apache.derby.impl.tools.ij.utilMain.doCatch(utilMain.java:509)
        at 
org.apache.derby.impl.tools.ij.utilMain.runScriptGuts(utilMain.java:350)
        at org.apache.derby.impl.tools.ij.utilMain.go(utilMain.java:248)
        at org.apache.derby.impl.tools.ij.Main.go(Main.java:215)
        at org.apache.derby.impl.tools.ij.Main.mainCore(Main.java:181)
        at org.apache.derby.impl.tools.ij.Main.main(Main.java:73)
        at org.apache.derby.tools.ij.main(ij.java:59)
Caused by: java.lang.NullPointerException
        at 
org.apache.derby.exe.ac601a400fx0116x5cddx8367x000000107e400.e3(Unknown Source)
        at 
org.apache.derby.impl.services.reflect.DirectCall.invoke(ReflectGeneratedClass.java:145)
        ... 17 more
============= begin nested exception, level (1) ===========
java.lang.NullPointerException
        at 
org.apache.derby.exe.ac601a400fx0116x5cddx8367x000000107e400.e3(Unknown Source)
        at 
org.apache.derby.impl.services.reflect.DirectCall.invoke(ReflectGeneratedClass.java:145)
        at 
org.apache.derby.impl.sql.execute.ProjectRestrictResultSet.doProjection(ProjectRestrictResultSet.java:488)
        at 
org.apache.derby.impl.sql.execute.ProjectRestrictResultSet.getNextRowCore(ProjectRestrictResultSet.java:291)
        at 
org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl.getNextRow(BasicNoPutResultSetImpl.java:463)
        at 
org.apache.derby.impl.jdbc.EmbedResultSet.movePosition(EmbedResultSet.java:424)
        at 
org.apache.derby.impl.jdbc.EmbedResultSet.next(EmbedResultSet.java:368)
        at 
org.apache.derby.tools.JDBCDisplayUtil.indent_DisplayResults(JDBCDisplayUtil.java:382)
        at 
org.apache.derby.tools.JDBCDisplayUtil.indent_DisplayResults(JDBCDisplayUtil.java:338)
        at 
org.apache.derby.tools.JDBCDisplayUtil.indent_DisplayResults(JDBCDisplayUtil.java:241)
        at 
org.apache.derby.tools.JDBCDisplayUtil.DisplayResults(JDBCDisplayUtil.java:229)
        at 
org.apache.derby.impl.tools.ij.utilMain.displayResult(utilMain.java:435)
        at org.apache.derby.impl.tools.ij.utilMain.doCatch(utilMain.java:509)
        at 
org.apache.derby.impl.tools.ij.utilMain.runScriptGuts(utilMain.java:350)
        at org.apache.derby.impl.tools.ij.utilMain.go(utilMain.java:248)
        at org.apache.derby.impl.tools.ij.Main.go(Main.java:215)
        at org.apache.derby.impl.tools.ij.Main.mainCore(Main.java:181)
        at org.apache.derby.impl.tools.ij.Main.main(Main.java:73)
        at org.apache.derby.tools.ij.main(ij.java:59)
--

ProjectRestrictResultSet seems to consider the obvious case where projection == 
null, but it still fails
   // Use reflection to do as much of projection as required
   if (projection != null)
   {
      result = (ExecRow) projection.invoke(activation);          <== ln 488
   }
   else
   {
      result = mappedResultRow;
   }

> Grouping of expressions causes NullPointerException
> ---------------------------------------------------
>
>                 Key: DERBY-3094
>                 URL: https://issues.apache.org/jira/browse/DERBY-3094
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.3.1.4
>         Environment: Windows XP, Eclipse 3.2.2, java 1.5.0.11
>            Reporter: Peter Balon
>            Priority: Critical
>
> Following steps to reproduce the bug:
> create table xx (a double, b double);
> insert into xx values (2, 3);
> select a, a*(b/100.000000), count(*) from xx  group by a, a*(b/100.000000);
> Starting run
> select a, a*(b/100.000000), count(*) from xx 
> group by a, a*(b/100.000000)
> Run successful
> SQL State = 38000 SQL Code = 20000 SQL Message = Bei der Auswertung eines 
> Ausdrucks wurde die Ausnahme 'java.lang.NullPointerException' ausgelöst. 
> Exception message = java.sql.SQLException: Bei der Auswertung eines Ausdrucks 
> wurde die Ausnahme 'java.lang.NullPointerException' ausgelöst.
> Work around:
> select a, a*(b/100.000000), count(*) from xx group by a, b, a*(b/100.000000) 
> Stack trace from application:
> java.sql.SQLException: Bei der Auswertung eines Ausdrucks wurde die Ausnahme 
> 'java.lang.NullPointerException' ausgelöst.
>       at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
>       at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown Source)
>       at org.apache.derby.impl.jdbc.Util.seeNextException(Unknown Source)
>       at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown 
> Source)
>       at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown 
> Source)
>       at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown 
> Source)
>       at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown 
> Source)
>       at 
> org.apache.derby.impl.jdbc.EmbedResultSet.closeOnTransactionError(Unknown 
> Source)
>       at org.apache.derby.impl.jdbc.EmbedResultSet.movePosition(Unknown 
> Source)
>       at org.apache.derby.impl.jdbc.EmbedResultSet.next(Unknown Source)
>       at 
> de.arcor.billy.report.views.designer.ReportViewerView.setInput(ReportViewerView.java:255)
>       at 
> de.arcor.billy.report.views.designer.ReportViewerView.createPartControl(ReportViewerView.java:113)
>       at 
> org.eclipse.ui.internal.ViewReference.createPartHelper(ViewReference.java:332)
>       at 
> org.eclipse.ui.internal.ViewReference.createPart(ViewReference.java:197)
>       at 
> org.eclipse.ui.internal.WorkbenchPartReference.getPart(WorkbenchPartReference.java:566)
>       at org.eclipse.ui.internal.Perspective.showView(Perspective.java:1675)
>       at 
> org.eclipse.ui.internal.WorkbenchPage.busyShowView(WorkbenchPage.java:987)
>       at 
> org.eclipse.ui.internal.WorkbenchPage.access$13(WorkbenchPage.java:968)
>       at org.eclipse.ui.internal.WorkbenchPage$13.run(WorkbenchPage.java:3514)
>       at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:67)
>       at 
> org.eclipse.ui.internal.WorkbenchPage.showView(WorkbenchPage.java:3511)
>       at 
> de.arcor.billy.report.data.ReportDataAdvisor$2.perspectiveChanged(ReportDataAdvisor.java:268)
>       at 
> de.arcor.billy.system.actions.AbstractOpenPerspectiveActionDelegate$1.run(AbstractOpenPerspectiveActionDelegate.java:66)
>       at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
>       at 
> org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:123)
>       at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3325)
>       at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2971)
>       at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1930)
>       at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1894)
>       at 
> org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:422)
>       at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
>       at de.arcor.billy.product.Billy.run(Billy.java:15)
>       at 
> org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:78)
>       at 
> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:92)
>       at 
> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:68)
>       at 
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:400)
>       at 
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:177)
>       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>       at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>       at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>       at java.lang.reflect.Method.invoke(Unknown Source)
>       at org.eclipse.core.launcher.Main.invokeFramework(Main.java:336)
>       at org.eclipse.core.launcher.Main.basicRun(Main.java:280)
>       at org.eclipse.core.launcher.Main.run(Main.java:977)
>       at org.eclipse.core.launcher.Main.main(Main.java:952)
> Caused by: java.sql.SQLException: Java-Ausnahme: ': 
> java.lang.NullPointerException'.
>       at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
>       at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown Source)
>       at org.apache.derby.impl.jdbc.Util.javaException(Unknown Source)
>       at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown 
> Source)
>       ... 42 more
> Caused by: java.lang.NullPointerException
>       at 
> org.apache.derby.exe.ac9b638174x0115x5f93x1332x0000046fd8a01b.e10(Unknown 
> Source)
>       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>       at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>       at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>       at java.lang.reflect.Method.invoke(Unknown Source)
>       at org.apache.derby.impl.services.reflect.ReflectMethod.invoke(Unknown 
> Source)
>       at 
> org.apache.derby.impl.sql.execute.ProjectRestrictResultSet.doProjection(Unknown
>  Source)
>       at 
> org.apache.derby.impl.sql.execute.ProjectRestrictResultSet.getNextRowCore(Unknown
>  Source)
>       at 
> org.apache.derby.impl.sql.execute.ScrollInsensitiveResultSet.getNextRowFromSource(Unknown
>  Source)
>       at 
> org.apache.derby.impl.sql.execute.ScrollInsensitiveResultSet.getNextRowCore(Unknown
>  Source)
>       at 
> org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl.getNextRow(Unknown 
> Source)
>       ... 37 more

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to