You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ibatis.apache.org by "Bret Gregory (JIRA)" <ib...@incubator.apache.org> on 2005/11/10 19:48:03 UTC

[jira] Created: (IBATIS-220) Null Pointer in SqlExecutor.handleResults where ResultSet is null.

Null Pointer in SqlExecutor.handleResults where ResultSet is null.
------------------------------------------------------------------

         Key: IBATIS-220
         URL: http://issues.apache.org/jira/browse/IBATIS-220
     Project: iBatis for Java
        Type: Bug
    Versions: 2.1.5, 2.1.6    
 Environment: Windows XP Pro
MS SQL Server
    Reporter: Bret Gregory


I recently ran into a problem while executing a stored procedure using an inline map in iBatis 2.1.5_582.  I tested this in 2.1.6_592 to see if the problem was resolved and I am still running into the issue.  I am not sure if this is specific to the JDBC implementation for my SQL Server driver or not.  

Caused by: java.lang.NullPointerException

        at com.ibatis.sqlmap.engine.execution.SqlExecutor.handleResults(SqlExecutor.java:355)

        at com.ibatis.sqlmap.engine.execution.SqlExecutor.executeQueryProcedure(SqlExecutor.java:291)

        at com.ibatis.sqlmap.engine.mapping.statement.ProcedureStatement.sqlExecuteQuery(ProcedureStatement.java:34)

        at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWithCallback(GeneralStatement.java:173)

The problem looks to be caused by the callable statement not returning a result set in the executeQueryProcedure method.  The rs variable is set to null and passed into the handleResults() method.  This method attempts to get the Type, and the Null Pointer is thrown.  

This looks like a bug and this code executes normally in iBatis 2.0.9.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (IBATIS-220) Null Pointer in SqlExecutor.handleResults where ResultSet is null.

Posted by "Paul Wilton (JIRA)" <ib...@incubator.apache.org>.
    [ http://issues.apache.org/jira/browse/IBATIS-220?page=comments#action_12359493 ] 

Paul Wilton commented on IBATIS-220:
------------------------------------

In my opinion this should be  a blocker, as it totally prevents ongoing work with this build if one is using stored procs/procedure mapping.

Note we are using iBatis with Sybase 12.5.1 and JDK 1.4 

> Null Pointer in SqlExecutor.handleResults where ResultSet is null.
> ------------------------------------------------------------------
>
>          Key: IBATIS-220
>          URL: http://issues.apache.org/jira/browse/IBATIS-220
>      Project: iBatis for Java
>         Type: Bug
>     Versions: 2.1.5, 2.1.6
>  Environment: Windows XP Pro
> MS SQL Server
>     Reporter: Bret Gregory
>  Attachments: CronJob.xml
>
> I recently ran into a problem while executing a stored procedure using an inline map in iBatis 2.1.5_582.  I tested this in 2.1.6_592 to see if the problem was resolved and I am still running into the issue.  I am not sure if this is specific to the JDBC implementation for my SQL Server driver or not.  
> Caused by: java.lang.NullPointerException
>         at com.ibatis.sqlmap.engine.execution.SqlExecutor.handleResults(SqlExecutor.java:355)
>         at com.ibatis.sqlmap.engine.execution.SqlExecutor.executeQueryProcedure(SqlExecutor.java:291)
>         at com.ibatis.sqlmap.engine.mapping.statement.ProcedureStatement.sqlExecuteQuery(ProcedureStatement.java:34)
>         at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWithCallback(GeneralStatement.java:173)
> The problem looks to be caused by the callable statement not returning a result set in the executeQueryProcedure method.  The rs variable is set to null and passed into the handleResults() method.  This method attempts to get the Type, and the Null Pointer is thrown.  
> This looks like a bug and this code executes normally in iBatis 2.0.9.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Closed: (IBATIS-220) Null Pointer in SqlExecutor.handleResults where ResultSet is null.

Posted by "Clinton Begin (JIRA)" <ib...@incubator.apache.org>.
     [ http://issues.apache.org/jira/browse/IBATIS-220?page=all ]
     
Clinton Begin closed IBATIS-220:
--------------------------------

    Fix Version: 2.2.0
     Resolution: Fixed
      Assign To: Clinton Begin


Fixed, results are now only processed if a result set exists....It's not surprising this bug exists....afterall, why would anyone run a *query* and not expect a resulset.  ;-)

> Null Pointer in SqlExecutor.handleResults where ResultSet is null.
> ------------------------------------------------------------------
>
>          Key: IBATIS-220
>          URL: http://issues.apache.org/jira/browse/IBATIS-220
>      Project: iBatis for Java
>         Type: Bug
>     Versions: 2.1.5, 2.1.6
>  Environment: Windows XP Pro
> MS SQL Server
>     Reporter: Bret Gregory
>     Assignee: Clinton Begin
>      Fix For: 2.2.0
>  Attachments: CronJob.xml
>
> I recently ran into a problem while executing a stored procedure using an inline map in iBatis 2.1.5_582.  I tested this in 2.1.6_592 to see if the problem was resolved and I am still running into the issue.  I am not sure if this is specific to the JDBC implementation for my SQL Server driver or not.  
> Caused by: java.lang.NullPointerException
>         at com.ibatis.sqlmap.engine.execution.SqlExecutor.handleResults(SqlExecutor.java:355)
>         at com.ibatis.sqlmap.engine.execution.SqlExecutor.executeQueryProcedure(SqlExecutor.java:291)
>         at com.ibatis.sqlmap.engine.mapping.statement.ProcedureStatement.sqlExecuteQuery(ProcedureStatement.java:34)
>         at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWithCallback(GeneralStatement.java:173)
> The problem looks to be caused by the callable statement not returning a result set in the executeQueryProcedure method.  The rs variable is set to null and passed into the handleResults() method.  This method attempts to get the Type, and the Null Pointer is thrown.  
> This looks like a bug and this code executes normally in iBatis 2.0.9.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (IBATIS-220) Null Pointer in SqlExecutor.handleResults where ResultSet is null.

Posted by "Paul Wilton (JIRA)" <ib...@incubator.apache.org>.
    [ http://issues.apache.org/jira/browse/IBATIS-220?page=comments#action_12359268 ] 

Paul Wilton commented on IBATIS-220:
------------------------------------

I am also getting the same error with v2.1.5.  
I am not also NOT using a custom type handler.

agree also should either change back to executeQuery or handle the null resultSet properly. A nasty which is causing us nightmares (especially since we need to upgrqade from 2.0.9 to get arounf otherr problems  ;o)



> Null Pointer in SqlExecutor.handleResults where ResultSet is null.
> ------------------------------------------------------------------
>
>          Key: IBATIS-220
>          URL: http://issues.apache.org/jira/browse/IBATIS-220
>      Project: iBatis for Java
>         Type: Bug
>     Versions: 2.1.5, 2.1.6
>  Environment: Windows XP Pro
> MS SQL Server
>     Reporter: Bret Gregory
>  Attachments: CronJob.xml
>
> I recently ran into a problem while executing a stored procedure using an inline map in iBatis 2.1.5_582.  I tested this in 2.1.6_592 to see if the problem was resolved and I am still running into the issue.  I am not sure if this is specific to the JDBC implementation for my SQL Server driver or not.  
> Caused by: java.lang.NullPointerException
>         at com.ibatis.sqlmap.engine.execution.SqlExecutor.handleResults(SqlExecutor.java:355)
>         at com.ibatis.sqlmap.engine.execution.SqlExecutor.executeQueryProcedure(SqlExecutor.java:291)
>         at com.ibatis.sqlmap.engine.mapping.statement.ProcedureStatement.sqlExecuteQuery(ProcedureStatement.java:34)
>         at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWithCallback(GeneralStatement.java:173)
> The problem looks to be caused by the callable statement not returning a result set in the executeQueryProcedure method.  The rs variable is set to null and passed into the handleResults() method.  This method attempts to get the Type, and the Null Pointer is thrown.  
> This looks like a bug and this code executes normally in iBatis 2.0.9.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (IBATIS-220) Null Pointer in SqlExecutor.handleResults where ResultSet is null.

Posted by "Bret Gregory (JIRA)" <ib...@incubator.apache.org>.
    [ http://issues.apache.org/jira/browse/IBATIS-220?page=comments#action_12360455 ] 

Bret Gregory commented on IBATIS-220:
-------------------------------------

Okay, a little more background into this.  It seems to be related to complex stored procedures and the rows affected being returned.  If we set the NOCOUNT ON the problem goes away at least in some cases.  

This is going to need some more investigation, but I thought I would post it case it helps someone else experiencing this problem.

> Null Pointer in SqlExecutor.handleResults where ResultSet is null.
> ------------------------------------------------------------------
>
>          Key: IBATIS-220
>          URL: http://issues.apache.org/jira/browse/IBATIS-220
>      Project: iBatis for Java
>         Type: Bug
>     Versions: 2.1.5, 2.1.6
>  Environment: Windows XP Pro
> MS SQL Server
>     Reporter: Bret Gregory
>  Attachments: CronJob.xml
>
> I recently ran into a problem while executing a stored procedure using an inline map in iBatis 2.1.5_582.  I tested this in 2.1.6_592 to see if the problem was resolved and I am still running into the issue.  I am not sure if this is specific to the JDBC implementation for my SQL Server driver or not.  
> Caused by: java.lang.NullPointerException
>         at com.ibatis.sqlmap.engine.execution.SqlExecutor.handleResults(SqlExecutor.java:355)
>         at com.ibatis.sqlmap.engine.execution.SqlExecutor.executeQueryProcedure(SqlExecutor.java:291)
>         at com.ibatis.sqlmap.engine.mapping.statement.ProcedureStatement.sqlExecuteQuery(ProcedureStatement.java:34)
>         at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWithCallback(GeneralStatement.java:173)
> The problem looks to be caused by the callable statement not returning a result set in the executeQueryProcedure method.  The rs variable is set to null and passed into the handleResults() method.  This method attempts to get the Type, and the Null Pointer is thrown.  
> This looks like a bug and this code executes normally in iBatis 2.0.9.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Updated: (IBATIS-220) Null Pointer in SqlExecutor.handleResults where ResultSet is null.

Posted by "Bret Gregory (JIRA)" <ib...@incubator.apache.org>.
     [ http://issues.apache.org/jira/browse/IBATIS-220?page=all ]

Bret Gregory updated IBATIS-220:
--------------------------------

    Attachment: CronJob.xml

> Null Pointer in SqlExecutor.handleResults where ResultSet is null.
> ------------------------------------------------------------------
>
>          Key: IBATIS-220
>          URL: http://issues.apache.org/jira/browse/IBATIS-220
>      Project: iBatis for Java
>         Type: Bug
>     Versions: 2.1.5, 2.1.6
>  Environment: Windows XP Pro
> MS SQL Server
>     Reporter: Bret Gregory
>  Attachments: CronJob.xml
>
> I recently ran into a problem while executing a stored procedure using an inline map in iBatis 2.1.5_582.  I tested this in 2.1.6_592 to see if the problem was resolved and I am still running into the issue.  I am not sure if this is specific to the JDBC implementation for my SQL Server driver or not.  
> Caused by: java.lang.NullPointerException
>         at com.ibatis.sqlmap.engine.execution.SqlExecutor.handleResults(SqlExecutor.java:355)
>         at com.ibatis.sqlmap.engine.execution.SqlExecutor.executeQueryProcedure(SqlExecutor.java:291)
>         at com.ibatis.sqlmap.engine.mapping.statement.ProcedureStatement.sqlExecuteQuery(ProcedureStatement.java:34)
>         at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWithCallback(GeneralStatement.java:173)
> The problem looks to be caused by the callable statement not returning a result set in the executeQueryProcedure method.  The rs variable is set to null and passed into the handleResults() method.  This method attempts to get the Type, and the Null Pointer is thrown.  
> This looks like a bug and this code executes normally in iBatis 2.0.9.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (IBATIS-220) Null Pointer in SqlExecutor.handleResults where ResultSet is null.

Posted by "Bret Gregory (JIRA)" <ib...@incubator.apache.org>.
    [ http://issues.apache.org/jira/browse/IBATIS-220?page=comments#action_12357932 ] 

Bret Gregory commented on IBATIS-220:
-------------------------------------

Okay, me again.  Maybe the solution shouldn't be to change back to executeQuery(), but the code should handle when the getResultSet returns null.  

> Null Pointer in SqlExecutor.handleResults where ResultSet is null.
> ------------------------------------------------------------------
>
>          Key: IBATIS-220
>          URL: http://issues.apache.org/jira/browse/IBATIS-220
>      Project: iBatis for Java
>         Type: Bug
>     Versions: 2.1.5, 2.1.6
>  Environment: Windows XP Pro
> MS SQL Server
>     Reporter: Bret Gregory

>
> I recently ran into a problem while executing a stored procedure using an inline map in iBatis 2.1.5_582.  I tested this in 2.1.6_592 to see if the problem was resolved and I am still running into the issue.  I am not sure if this is specific to the JDBC implementation for my SQL Server driver or not.  
> Caused by: java.lang.NullPointerException
>         at com.ibatis.sqlmap.engine.execution.SqlExecutor.handleResults(SqlExecutor.java:355)
>         at com.ibatis.sqlmap.engine.execution.SqlExecutor.executeQueryProcedure(SqlExecutor.java:291)
>         at com.ibatis.sqlmap.engine.mapping.statement.ProcedureStatement.sqlExecuteQuery(ProcedureStatement.java:34)
>         at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWithCallback(GeneralStatement.java:173)
> The problem looks to be caused by the callable statement not returning a result set in the executeQueryProcedure method.  The rs variable is set to null and passed into the handleResults() method.  This method attempts to get the Type, and the Null Pointer is thrown.  
> This looks like a bug and this code executes normally in iBatis 2.0.9.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (IBATIS-220) Null Pointer in SqlExecutor.handleResults where ResultSet is null.

Posted by "Bret Gregory (JIRA)" <ib...@incubator.apache.org>.
    [ http://issues.apache.org/jira/browse/IBATIS-220?page=comments#action_12357908 ] 

Bret Gregory commented on IBATIS-220:
-------------------------------------

Okay, I have done a little more digging into the problem.  The problem is caused by the SqlExecutor.executeQueryProcedure(...) on line 287.
The change between iBatis 2.0.9 and iBatis 2.1.5 is the call on the CallableStatement changed from cs.executeQuery() which always returns a ResultSet to cs.execute().  Then the ResultSet is fetched from the callable statement, but this is null.  

The change should be to change the cs.execute() back to cs.executeQuery().  I am surprised that more people haven't run into this problem.  

Hope this helps.  
-Bret


> Null Pointer in SqlExecutor.handleResults where ResultSet is null.
> ------------------------------------------------------------------
>
>          Key: IBATIS-220
>          URL: http://issues.apache.org/jira/browse/IBATIS-220
>      Project: iBatis for Java
>         Type: Bug
>     Versions: 2.1.5, 2.1.6
>  Environment: Windows XP Pro
> MS SQL Server
>     Reporter: Bret Gregory

>
> I recently ran into a problem while executing a stored procedure using an inline map in iBatis 2.1.5_582.  I tested this in 2.1.6_592 to see if the problem was resolved and I am still running into the issue.  I am not sure if this is specific to the JDBC implementation for my SQL Server driver or not.  
> Caused by: java.lang.NullPointerException
>         at com.ibatis.sqlmap.engine.execution.SqlExecutor.handleResults(SqlExecutor.java:355)
>         at com.ibatis.sqlmap.engine.execution.SqlExecutor.executeQueryProcedure(SqlExecutor.java:291)
>         at com.ibatis.sqlmap.engine.mapping.statement.ProcedureStatement.sqlExecuteQuery(ProcedureStatement.java:34)
>         at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWithCallback(GeneralStatement.java:173)
> The problem looks to be caused by the callable statement not returning a result set in the executeQueryProcedure method.  The rs variable is set to null and passed into the handleResults() method.  This method attempts to get the Type, and the Null Pointer is thrown.  
> This looks like a bug and this code executes normally in iBatis 2.0.9.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (IBATIS-220) Null Pointer in SqlExecutor.handleResults where ResultSet is null.

Posted by "Sven Boden (JIRA)" <ib...@incubator.apache.org>.
    [ http://issues.apache.org/jira/browse/IBATIS-220?page=comments#action_12358073 ] 

Sven Boden commented on IBATIS-220:
-----------------------------------

- Are you using custom type handlers?
- can you attach your xml maps to JIRA?

Regards,
Sven

> Null Pointer in SqlExecutor.handleResults where ResultSet is null.
> ------------------------------------------------------------------
>
>          Key: IBATIS-220
>          URL: http://issues.apache.org/jira/browse/IBATIS-220
>      Project: iBatis for Java
>         Type: Bug
>     Versions: 2.1.5, 2.1.6
>  Environment: Windows XP Pro
> MS SQL Server
>     Reporter: Bret Gregory

>
> I recently ran into a problem while executing a stored procedure using an inline map in iBatis 2.1.5_582.  I tested this in 2.1.6_592 to see if the problem was resolved and I am still running into the issue.  I am not sure if this is specific to the JDBC implementation for my SQL Server driver or not.  
> Caused by: java.lang.NullPointerException
>         at com.ibatis.sqlmap.engine.execution.SqlExecutor.handleResults(SqlExecutor.java:355)
>         at com.ibatis.sqlmap.engine.execution.SqlExecutor.executeQueryProcedure(SqlExecutor.java:291)
>         at com.ibatis.sqlmap.engine.mapping.statement.ProcedureStatement.sqlExecuteQuery(ProcedureStatement.java:34)
>         at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWithCallback(GeneralStatement.java:173)
> The problem looks to be caused by the callable statement not returning a result set in the executeQueryProcedure method.  The rs variable is set to null and passed into the handleResults() method.  This method attempts to get the Type, and the Null Pointer is thrown.  
> This looks like a bug and this code executes normally in iBatis 2.0.9.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (IBATIS-220) Null Pointer in SqlExecutor.handleResults where ResultSet is null.

Posted by "Bret Gregory (JIRA)" <ib...@incubator.apache.org>.
    [ http://issues.apache.org/jira/browse/IBATIS-220?page=comments#action_12358679 ] 

Bret Gregory commented on IBATIS-220:
-------------------------------------

I am not using custom type handlers.  
I attached the XML Map.  

>From what I can tell, it is okay for the JDBC Driver to be returning null in the execute method and this scenario is not handled within the iBatis code and should be.  It was handled previously because the code used executeQuery which always returns a result set even if it is empty.  



> Null Pointer in SqlExecutor.handleResults where ResultSet is null.
> ------------------------------------------------------------------
>
>          Key: IBATIS-220
>          URL: http://issues.apache.org/jira/browse/IBATIS-220
>      Project: iBatis for Java
>         Type: Bug
>     Versions: 2.1.5, 2.1.6
>  Environment: Windows XP Pro
> MS SQL Server
>     Reporter: Bret Gregory
>  Attachments: CronJob.xml
>
> I recently ran into a problem while executing a stored procedure using an inline map in iBatis 2.1.5_582.  I tested this in 2.1.6_592 to see if the problem was resolved and I am still running into the issue.  I am not sure if this is specific to the JDBC implementation for my SQL Server driver or not.  
> Caused by: java.lang.NullPointerException
>         at com.ibatis.sqlmap.engine.execution.SqlExecutor.handleResults(SqlExecutor.java:355)
>         at com.ibatis.sqlmap.engine.execution.SqlExecutor.executeQueryProcedure(SqlExecutor.java:291)
>         at com.ibatis.sqlmap.engine.mapping.statement.ProcedureStatement.sqlExecuteQuery(ProcedureStatement.java:34)
>         at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWithCallback(GeneralStatement.java:173)
> The problem looks to be caused by the callable statement not returning a result set in the executeQueryProcedure method.  The rs variable is set to null and passed into the handleResults() method.  This method attempts to get the Type, and the Null Pointer is thrown.  
> This looks like a bug and this code executes normally in iBatis 2.0.9.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira