Discussion:
[JIRA] Created: (MYO-109) NPE when reading resultset containing zero year (with option yearIsDateType=false)
Gilles Rayrat (JIRA)
2009-10-01 16:40:46 UTC
Permalink
NPE when reading resultset containing zero year (with option yearIsDateType=false)
----------------------------------------------------------------------------------

Key: MYO-109
URL: https://forge.continuent.org/jira/browse/MYO-109
Project: Tungsten Connector
Type: Bug

Components: MySQL protocol
Reporter: Gilles Rayrat
Assigned to: Gilles Rayrat
Fix For: 0.6.8


With the following entries:
mysql> show create table t;
+-------+--------------------------------------------------------------------------------------------------------------------+
| Table | Create Table |
+-------+--------------------------------------------------------------------------------------------------------------------+
| t | CREATE TABLE `t` (
`y1` year(4) DEFAULT NULL,
`y2` year(2) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 |
+-------+--------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

mysql> select * from t;
+------+------+
| y1 | y2 |
+------+------+
| 0000 | 00 |
+------+------+
4 rows in set (0.00 sec)

selecting * from t from the connector where mysql url option has yearIsDateType=false will show the following stacktrace:
INFO | jvm 1 | 2009/10/01 18:38:41 | Exception in thread "pool-2-thread-1" java.lang.NullPointerException
INFO | jvm 1 | 2009/10/01 18:38:41 | at org.continuent.myosotis.protocol.mysql.MySQLProtocolHandler.sendDate(MySQLProtocolHandler.java:1537)
INFO | jvm 1 | 2009/10/01 18:38:41 | at org.continuent.myosotis.protocol.mysql.MySQLProtocolHandler.sendResultSetRowMessage(MySQLProtocolHandler.java:1438)
INFO | jvm 1 | 2009/10/01 18:38:41 | at org.continuent.myosotis.protocol.mysql.MySQLProtocolHandler.sendResultSet(MySQLProtocolHandler.java:543)
INFO | jvm 1 | 2009/10/01 18:38:41 | at org.continuent.myosotis.protocol.mysql.MySQLProtocolHandler.sendAllResultSets(MySQLProtocolHandler.java:458)
INFO | jvm 1 | 2009/10/01 18:38:41 | at org.continuent.myosotis.protocol.mysql.MySQLProtocolHandler.processQuery(MySQLProtocolHandler.java:383)
INFO | jvm 1 | 2009/10/01 18:38:41 | at org.continuent.myosotis.protocol.mysql.MySQLProtocolHandler.processCommand(MySQLProtocolHandler.java:198)
INFO | jvm 1 | 2009/10/01 18:38:41 | at org.continuent.myosotis.protocol.mysql.MySQLProtocolHandler.processClientPacket(MySQLProtocolHandler.java:154)
INFO | jvm 1 | 2009/10/01 18:38:41 | at org.continuent.myosotis.protocol.mysql.MySQLConnectionHandler.run(MySQLConnectionHandler.java:104)
INFO | jvm 1 | 2009/10/01 18:38:41 | at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
INFO | jvm 1 | 2009/10/01 18:38:41 | at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
INFO | jvm 1 | 2009/10/01 18:38:41 | at java.lang.Thread.run(Thread.java:595)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://forge.continuent.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
Gilles Rayrat (JIRA)
2010-02-09 13:42:46 UTC
Permalink
[ https://forge.continuent.org/jira/browse/MYO-109?page=all ]

Gilles Rayrat closed MYO-109:
-----------------------------

Resolution: Fixed

When year was received as short, we still tried to send it via getDate(), which was returning null
Now added a check on the result type, if it is a short, send it as so
Fix submitted to SVN
Post by Gilles Rayrat (JIRA)
NPE when reading resultset containing zero year (with option yearIsDateType=false)
----------------------------------------------------------------------------------
Key: MYO-109
URL: https://forge.continuent.org/jira/browse/MYO-109
Project: Tungsten Connector
Type: Bug
Components: MySQL protocol
Reporter: Gilles Rayrat
Assignee: Gilles Rayrat
Fix For: 0.6.8
mysql> show create table t;
+-------+--------------------------------------------------------------------------------------------------------------------+
| Table | Create Table |
+-------+--------------------------------------------------------------------------------------------------------------------+
| t | CREATE TABLE `t` (
`y1` year(4) DEFAULT NULL,
`y2` year(2) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 |
+-------+--------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
mysql> select * from t;
+------+------+
| y1 | y2 |
+------+------+
| 0000 | 00 |
+------+------+
4 rows in set (0.00 sec)
INFO | jvm 1 | 2009/10/01 18:38:41 | Exception in thread "pool-2-thread-1" java.lang.NullPointerException
INFO | jvm 1 | 2009/10/01 18:38:41 | at org.continuent.myosotis.protocol.mysql.MySQLProtocolHandler.sendDate(MySQLProtocolHandler.java:1537)
INFO | jvm 1 | 2009/10/01 18:38:41 | at org.continuent.myosotis.protocol.mysql.MySQLProtocolHandler.sendResultSetRowMessage(MySQLProtocolHandler.java:1438)
INFO | jvm 1 | 2009/10/01 18:38:41 | at org.continuent.myosotis.protocol.mysql.MySQLProtocolHandler.sendResultSet(MySQLProtocolHandler.java:543)
INFO | jvm 1 | 2009/10/01 18:38:41 | at org.continuent.myosotis.protocol.mysql.MySQLProtocolHandler.sendAllResultSets(MySQLProtocolHandler.java:458)
INFO | jvm 1 | 2009/10/01 18:38:41 | at org.continuent.myosotis.protocol.mysql.MySQLProtocolHandler.processQuery(MySQLProtocolHandler.java:383)
INFO | jvm 1 | 2009/10/01 18:38:41 | at org.continuent.myosotis.protocol.mysql.MySQLProtocolHandler.processCommand(MySQLProtocolHandler.java:198)
INFO | jvm 1 | 2009/10/01 18:38:41 | at org.continuent.myosotis.protocol.mysql.MySQLProtocolHandler.processClientPacket(MySQLProtocolHandler.java:154)
INFO | jvm 1 | 2009/10/01 18:38:41 | at org.continuent.myosotis.protocol.mysql.MySQLConnectionHandler.run(MySQLConnectionHandler.java:104)
INFO | jvm 1 | 2009/10/01 18:38:41 | at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
INFO | jvm 1 | 2009/10/01 18:38:41 | at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
INFO | jvm 1 | 2009/10/01 18:38:41 | at java.lang.Thread.run(Thread.java:595)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://forge.continuent.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
Loading...