30
30
package testsuite .regression ;
31
31
32
32
import static org .junit .jupiter .api .Assertions .assertEquals ;
33
+ import static org .junit .jupiter .api .Assertions .assertFalse ;
34
+ import static org .junit .jupiter .api .Assertions .assertNull ;
33
35
import static org .junit .jupiter .api .Assertions .assertTrue ;
34
36
import static org .junit .jupiter .api .Assumptions .assumeTrue ;
35
37
@@ -1110,6 +1112,8 @@ public void testBug101413() throws Exception {
1110
1112
createTable ("testBug101413" , "(createtime1 TIMESTAMP, createtime2 DATETIME)" );
1111
1113
1112
1114
Properties props = new Properties ();
1115
+ props .setProperty (PropertyKey .sslMode .getKeyName (), "DISABLED" );
1116
+ props .setProperty (PropertyKey .allowPublicKeyRetrieval .getKeyName (), "true" );
1113
1117
for (boolean forceConnectionTimeZoneToSession : new boolean [] { false , true }) {
1114
1118
for (boolean preserveInstants : new boolean [] { false , true }) {
1115
1119
for (boolean useSSPS : new boolean [] { false , true }) {
@@ -1136,4 +1140,25 @@ public void testBug101413() throws Exception {
1136
1140
}
1137
1141
}
1138
1142
}
1143
+
1144
+ /**
1145
+ * Tests fix for Bug#104559 (33232419), ResultSet.getObject(i, java.util.Date.class) throws NPE when the value is null.
1146
+ *
1147
+ * @throws Exception
1148
+ */
1149
+ @ Test
1150
+ public void testBug104559 () throws Exception {
1151
+ createTable ("testBug104559" , "(`dt` DATE DEFAULT NULL)" );
1152
+ this .stmt .executeUpdate ("INSERT INTO testBug104559 VALUES (null)" );
1153
+
1154
+ Properties props = new Properties ();
1155
+ props .setProperty (PropertyKey .sslMode .getKeyName (), "DISABLED" );
1156
+ props .setProperty (PropertyKey .allowPublicKeyRetrieval .getKeyName (), "true" );
1157
+ Connection con = getConnectionWithProps (props );
1158
+ Statement st = con .createStatement ();
1159
+ this .rs = st .executeQuery ("SELECT * FROM testBug104559" );
1160
+ assertTrue (this .rs .next ());
1161
+ assertNull (this .rs .getObject ("dt" , java .util .Date .class ));
1162
+ assertFalse (this .rs .next ());
1163
+ }
1139
1164
}
0 commit comments