From 5ecb1afe13dbbacfb2e737ed956924b5236a3679 Mon Sep 17 00:00:00 2001 From: Owen Stephens Date: Thu, 14 Jun 2018 12:19:30 +0100 Subject: [PATCH 1/2] Updated toString test to new behaviour for `null`.toString() --- .../tests/expr/functions/strings/ToFromConversionTests.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/tests/server/src/com/google/refine/tests/expr/functions/strings/ToFromConversionTests.java b/main/tests/server/src/com/google/refine/tests/expr/functions/strings/ToFromConversionTests.java index fcc69fcbd..9070ee094 100644 --- a/main/tests/server/src/com/google/refine/tests/expr/functions/strings/ToFromConversionTests.java +++ b/main/tests/server/src/com/google/refine/tests/expr/functions/strings/ToFromConversionTests.java @@ -112,7 +112,7 @@ public class ToFromConversionTests extends RefineTest { @Test public void testToString() throws CalendarParserException { Assert.assertTrue(invoke("toString") instanceof EvalError); - Assert.assertEquals(invoke("toString", (Object) null), "null"); + Assert.assertEquals(invoke("toString", (Object) null), ""); Assert.assertEquals(invoke("toString", Long.valueOf(100)),"100"); Assert.assertEquals(invoke("toString", Double.valueOf(100.0)),"100.0"); Assert.assertEquals(invoke("toString", Double.valueOf(100.0),"%.0f"),"100"); From 09c624a249545cb249a525af96b5b263b9de3226 Mon Sep 17 00:00:00 2001 From: Owen Stephens Date: Thu, 14 Jun 2018 12:24:30 +0100 Subject: [PATCH 2/2] Updated `null`.toString() to return an empty string as per #1635 --- main/src/com/google/refine/util/StringUtils.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/src/com/google/refine/util/StringUtils.java b/main/src/com/google/refine/util/StringUtils.java index f2e69715a..f9f5821d0 100644 --- a/main/src/com/google/refine/util/StringUtils.java +++ b/main/src/com/google/refine/util/StringUtils.java @@ -17,7 +17,7 @@ public class StringUtils { OffsetDateTime odt = (OffsetDateTime)o; return odt.format(DateTimeFormatter.ofPattern(DEFAULT_PATTERN)); } else if (o == null) { - return "null"; + return ""; } else { return o.toString(); }