IGNITE-5204: Fixed NPE on certain data with index inlining. This closes #2115.
authorSergey Kalashnikov <skalashnikov@gridgain.com>
Fri, 7 Jul 2017 12:54:52 +0000 (15:54 +0300)
committerdevozerov <vozerov@gridgain.com>
Fri, 7 Jul 2017 12:54:52 +0000 (15:54 +0300)
modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/InlineIndexHelper.java
modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/database/InlineIndexHelperTest.java

index 1fd45f3..19cf857 100644 (file)
@@ -441,7 +441,7 @@ public class InlineIndexHelper {
                     size = (short)s.length;
                 else {
                     s = trimUTF8(s, maxSize - 3);
-                    size = (short)(s.length | 0x8000);
+                    size = (short)(s == null ? 0 : s.length | 0x8000);
                 }
 
                 if (s == null) {
index 2579023..a2a3a72 100644 (file)
@@ -167,6 +167,10 @@ public class InlineIndexHelperTest extends TestCase {
             assertTrue(ih.isValueFull(pageAddr, off));
 
             assertEquals("aaa", ih.get(pageAddr, off, 3 + 5).getString());
+
+            ih.put(pageAddr, off, ValueString.get("\u20acaaa"), 3 + 2);
+
+            assertNull(ih.get(pageAddr, off, 3 + 2));
         }
         finally {
             if (page != 0L)