From e0512669a483279b56e400335d45239133860543 Mon Sep 17 00:00:00 2001 From: Stanislav Malyshev Date: Wed, 29 May 2019 17:20:01 -0700 Subject: [PATCH] Fix handling of numbers that convert to negative longs Bug: T223946 Change-Id: I9e8ce75581cd068fb365bbe207dc9fdf5b3913dc --- .../bigdata/rdf/internal/InlineUnsignedIntegerURIHandler.java | 3 +++ .../src/test/java/com/bigdata/rdf/store/TestInlineURIs.java | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/bigdata-core/bigdata-rdf/src/java/com/bigdata/rdf/internal/InlineUnsignedIntegerURIHandler.java b/bigdata-core/bigdata-rdf/src/java/com/bigdata/rdf/internal/InlineUnsignedIntegerURIHandler.java index 8054df0a55..a06c92595f 100644 --- a/bigdata-core/bigdata-rdf/src/java/com/bigdata/rdf/internal/InlineUnsignedIntegerURIHandler.java +++ b/bigdata-core/bigdata-rdf/src/java/com/bigdata/rdf/internal/InlineUnsignedIntegerURIHandler.java @@ -90,6 +90,9 @@ public static AbstractLiteralIV createInlineIV(final BigInteger value) { */ @SuppressWarnings("rawtypes") public static AbstractLiteralIV createInlineIV(final long value) { + if (value < 0L) { + return new XSDUnsignedLongIV(value + Long.MIN_VALUE); + } if (value < 256L) { return new XSDUnsignedByteIV((byte) (value + Byte.MIN_VALUE)); } diff --git a/bigdata-rdf-test/src/test/java/com/bigdata/rdf/store/TestInlineURIs.java b/bigdata-rdf-test/src/test/java/com/bigdata/rdf/store/TestInlineURIs.java index 20d64441ec..07bba47d1a 100644 --- a/bigdata-rdf-test/src/test/java/com/bigdata/rdf/store/TestInlineURIs.java +++ b/bigdata-rdf-test/src/test/java/com/bigdata/rdf/store/TestInlineURIs.java @@ -1,5 +1,5 @@ /** -Copyright (C) SYSTAP, LLC DBA Blazegraph 2006-2016. All rights reserved. +Copyright (C) SYSTAP, LLC DBA Blazegraph 2006-2016. All rights reserved. Contact: SYSTAP, LLC DBA Blazegraph @@ -246,6 +246,7 @@ public void testUnsignedInteger() throws Exception { UNSIGNED_INT_NAMESPACE + Short.MAX_VALUE, true,// UNSIGNED_INT_NAMESPACE + Integer.MAX_VALUE, true,// UNSIGNED_INT_NAMESPACE + Long.MAX_VALUE, true,// + UNSIGNED_INT_NAMESPACE + "12148449524915690527", true,// UNSIGNED_INT_NAMESPACE + "19223372036854775807", true,// UNSIGNED_INT_NAMESPACE + "foo", false); }