You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by pa...@apache.org on 2019/03/16 05:16:08 UTC
[groovy] branch GROOVY_2_5_X updated: minor refactor - pull out a
constant
This is an automated email from the ASF dual-hosted git repository.
paulk pushed a commit to branch GROOVY_2_5_X
in repository https://gitbox.apache.org/repos/asf/groovy.git
The following commit(s) were added to refs/heads/GROOVY_2_5_X by this push:
new c321fd8 minor refactor - pull out a constant
c321fd8 is described below
commit c321fd89bd6d67b568e5ebf435771db978b082f8
Author: Paul King <pa...@asert.com.au>
AuthorDate: Sat Mar 16 15:15:52 2019 +1000
minor refactor - pull out a constant
---
.../apache/groovy/internal/util/UnicodeConst.java | 23 ++++++++++++++++++++++
.../groovy/json/internal/JsonParserCharArray.java | 4 ++--
2 files changed, 25 insertions(+), 2 deletions(-)
diff --git a/src/main/java/org/apache/groovy/internal/util/UnicodeConst.java b/src/main/java/org/apache/groovy/internal/util/UnicodeConst.java
new file mode 100644
index 0000000..cb56ebd
--- /dev/null
+++ b/src/main/java/org/apache/groovy/internal/util/UnicodeConst.java
@@ -0,0 +1,23 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.groovy.internal.util;
+
+public class UnicodeConst {
+ public static char ZERO = '\u0000';
+}
diff --git a/subprojects/groovy-json/src/main/java/org/apache/groovy/json/internal/JsonParserCharArray.java b/subprojects/groovy-json/src/main/java/org/apache/groovy/json/internal/JsonParserCharArray.java
index 08613d0..bbaf64f 100644
--- a/subprojects/groovy-json/src/main/java/org/apache/groovy/json/internal/JsonParserCharArray.java
+++ b/subprojects/groovy-json/src/main/java/org/apache/groovy/json/internal/JsonParserCharArray.java
@@ -19,6 +19,7 @@
package org.apache.groovy.json.internal;
import groovy.json.JsonException;
+import org.apache.groovy.internal.util.UnicodeConst;
import java.util.ArrayList;
import java.util.List;
@@ -70,8 +71,7 @@ public class JsonParserCharArray extends BaseJsonParser {
__index++;
return __currentChar = charArray[__index];
} else {
- // TODO move unicode 0 to separate file to avoid doc parsing issues
- return '\u0000';
+ return UnicodeConst.ZERO;
}
} catch (Exception ex) {
throw new JsonException(exceptionDetails("unable to advance character"), ex);