Skip to content

Commit 9721337

Browse files
committed
1 parent 5e42691 commit 9721337

File tree

12 files changed

+71
-63
lines changed

12 files changed

+71
-63
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ The easiest way to use this library is to include it as a dependency in your Mav
1414
<dependency>
1515
<groupId>com.ibm.jsonata4java</groupId>
1616
<artifactId>JSONata4Java</artifactId>
17-
<version>2.5.3</version>
17+
<version>2.5.4</version>
1818
</dependency>
1919
```
2020

@@ -51,8 +51,8 @@ Note: to build and deploy the jars to Maven Central you need to use a command li
5151
`mvn clean install deploy -Prelease`
5252

5353
Once you have run the launcher, you can find the jar files in the /target directory. There are two&colon;
54-
* **JSONata4Java-2.5.3-jar-with-dependencies.jar** (thinks includes dependent jar files)
55-
* **JSONata4Java-2.5.3.jar** (only the JSONata4Java code)
54+
* **JSONata4Java-2.5.4-jar-with-dependencies.jar** (thinks includes dependent jar files)
55+
* **JSONata4Java-2.5.4.jar** (only the JSONata4Java code)
5656

5757
The com.api.jsonata4java.Tester program enables you to enter an expression and run it
5858
against the same JSON as is used at the https://try.jsonata.org site. You can also

makeRelease.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ export OLD_JAVA_HOME=$JAVA_HOME
33
export OLD_PATH=$PATH
44
export JAVA_HOME=/Library/Java/JavaVirtualMachines/ibm-semeru-open-17.jdk/Contents/Home
55
export PATH=$JAVA_HOME:$PATH
6+
gpg --version
7+
echo "test" | gpg --clearsign
8+
69
mvn clean install deploy -Prelease
710
export JAVA_HOME=$OLD_JAVA_HOME
811
export PATH=$OLD_PATH

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<modelVersion>4.0.0</modelVersion>
1515
<groupId>com.ibm.jsonata4java</groupId>
1616
<artifactId>JSONata4Java</artifactId>
17-
<version>2.5.3</version>
17+
<version>2.5.4</version>
1818
<name>JSONata4Java</name>
1919
<description>Port of jsonata.js to Java to enable rules for JSON content</description>
2020
<url>https://github.com/IBM/JSONata4Java</url>

src/main/java/com/api/jsonata4java/expressions/ExpressionsVisitor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2223,7 +2223,7 @@ public JsonNode visitObject(ObjectContext ctx) {
22232223
for (JsonNode element : context) {
22242224
_environment.pushContext(element);
22252225
final JsonNode fieldList = visit(ctx.fieldList());
2226-
fieldList.fields().forEachRemaining(e -> grouping
2226+
fieldList.properties().forEach(e -> grouping
22272227
.computeIfAbsent(e.getKey(), ignore -> factory.arrayNode()).add(e.getValue()));
22282228
_environment.popContext();
22292229
}

src/main/java/com/api/jsonata4java/expressions/utils/FunctionUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ public static Object_constructorContext getObjectConstructorContext(ExprContext
408408
int count = 0;
409409
CommonToken token = null;
410410
TerminalNode tn = null;
411-
for (Iterator<Entry<String, JsonNode>> it = object.fields(); it.hasNext();) {
411+
for (Iterator<Entry<String, JsonNode>> it = object.properties().iterator(); it.hasNext();) {
412412
Entry<String, JsonNode> field = it.next();
413413
count++;
414414
if (count > 1) {

src/main/java/com/api/jsonata4java/expressions/utils/JsonMergeUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public static JsonNode merge(JsonNode x, JsonNode y) {
7878

7979
private static ObjectNode merge(ObjectNode x, ObjectNode y) {
8080

81-
final Iterator<Map.Entry<String, JsonNode>> yit = y.fields();
81+
final Iterator<Map.Entry<String, JsonNode>> yit = y.properties().iterator();
8282
while (yit.hasNext()) {
8383
final Map.Entry<String, JsonNode> ye = yit.next();
8484
final String f = ye.getKey();

src/test/java/com/api/jsonata4java/expressions/utils/TestLogFormatter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public String format(LogRecord r) {
7171
sb.append('[');
7272
sb.append(date);
7373
sb.append("] ");
74-
sb.append(r.getThreadID());
74+
sb.append(r.getLongThreadID());
7575
sb.append(" ");
7676
sb.append(className);
7777
sb.append(' ');

src/test/java/com/api/jsonata4java/expressions/utils/Utils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ public static <X extends JsonNode> X ensureAllIntegralsAreLongs(JsonNode input)
195195
switch (input.getNodeType()) {
196196
case OBJECT: {
197197
ObjectNode output = JsonNodeFactory.instance.objectNode();
198-
Iterator<Entry<String, JsonNode>> it = ((ObjectNode) input).fields();
198+
Iterator<Entry<String, JsonNode>> it = ((ObjectNode) input).properties().iterator();
199199
while (it.hasNext()) {
200200
Entry<String, JsonNode> e = it.next();
201201
String field = e.getKey();
Lines changed: 56 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
package testmanually;
2+
23
import org.junit.Test;
34
import org.springframework.core.task.SimpleAsyncTaskExecutor;
45
import org.springframework.core.task.TaskExecutor;
@@ -8,55 +9,59 @@
89

910
public class ThreadTester {
1011

11-
static boolean showError = false;
12-
13-
@Test
14-
public void threadSafeTest() throws Exception {
15-
String json1 = "{ \"a\":\"aaa\" }";
16-
String json2 = "{ \"a\":\"bbb\" }";
17-
Expressions exp = Expressions.parse("a");
18-
TaskExecutor theExecutor = new SimpleAsyncTaskExecutor();
19-
if (showError) {
20-
theExecutor.execute(new ThreadTest(exp, new ObjectMapper().readTree(json1)));
21-
theExecutor.execute(new ThreadTest(exp, new ObjectMapper().readTree(json2)));
22-
} else {
23-
theExecutor.execute(new ThreadTest(Expressions.parse("a"), new ObjectMapper().readTree(json1)));
24-
theExecutor.execute(new ThreadTest(Expressions.parse("a"), new ObjectMapper().readTree(json2)));
25-
26-
}
27-
28-
while (true) {
29-
Thread.sleep(1000);
30-
}
31-
}
32-
33-
public class ThreadTest implements Runnable {
34-
35-
JsonNode data;
36-
Expressions exp;
37-
38-
public ThreadTest(Expressions exp, JsonNode data) {
39-
this.data = data;
40-
this.exp = exp;
41-
}
42-
43-
@Override
44-
public void run() {
45-
while (true) {
46-
try {
47-
JsonNode result = exp.evaluate(data);
48-
if (result != null) {
49-
if (!this.data.get("a").asText().equals(result.asText())) {
50-
System.out.println(String.format("\n%s %s", this.data.get("a").asText(), result.asText()));
51-
}
52-
} else {
53-
System.out.println("Got null result from " + exp.hashCode() + " data: " + data);
54-
}
55-
} catch (Exception ex) {
56-
// System.out.println(ex);
57-
ex.printStackTrace();
58-
}
59-
}
60-
}
61-
}
12+
static boolean showError = false;
13+
14+
@Test
15+
public void threadSafeTest() throws Exception {
16+
String json1 = "{ \"a\":\"aaa\" }";
17+
String json2 = "{ \"a\":\"bbb\" }";
18+
Expressions exp = Expressions.parse("a");
19+
TaskExecutor theExecutor = new SimpleAsyncTaskExecutor();
20+
try {
21+
if (showError) {
22+
theExecutor.execute(new ThreadTest(exp, new ObjectMapper().readTree(json1)));
23+
theExecutor.execute(new ThreadTest(exp, new ObjectMapper().readTree(json2)));
24+
} else {
25+
theExecutor.execute(new ThreadTest(Expressions.parse("a"), new ObjectMapper().readTree(json1)));
26+
theExecutor.execute(new ThreadTest(Expressions.parse("a"), new ObjectMapper().readTree(json2)));
27+
28+
}
29+
30+
while (true) {
31+
Thread.sleep(1000);
32+
}
33+
} finally {
34+
((SimpleAsyncTaskExecutor) theExecutor).close();
35+
}
36+
}
37+
38+
public class ThreadTest implements Runnable {
39+
40+
JsonNode data;
41+
Expressions exp;
42+
43+
public ThreadTest(Expressions exp, JsonNode data) {
44+
this.data = data;
45+
this.exp = exp;
46+
}
47+
48+
@Override
49+
public void run() {
50+
while (true) {
51+
try {
52+
JsonNode result = exp.evaluate(data);
53+
if (result != null) {
54+
if (!this.data.get("a").asText().equals(result.asText())) {
55+
System.out.println(String.format("\n%s %s", this.data.get("a").asText(), result.asText()));
56+
}
57+
} else {
58+
System.out.println("Got null result from " + exp.hashCode() + " data: " + data);
59+
}
60+
} catch (Exception ex) {
61+
// System.out.println(ex);
62+
ex.printStackTrace();
63+
}
64+
}
65+
}
66+
}
6267
}

tester.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
#! /bin/bash
2-
java -cp target/JSONata4Java-2.5.3-jar-with-dependencies.jar com.api.jsonata4java.Tester $1
2+
java -cp target/JSONata4Java-2.5.4-jar-with-dependencies.jar com.api.jsonata4java.Tester $1

testerui.cmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
java -cp target/JSONata4Java-2.5.3-jar-with-dependencies.jar com.api.jsonata4java.testerui.TesterUI
1+
java -cp target/JSONata4Java-2.5.4-jar-with-dependencies.jar com.api.jsonata4java.testerui.TesterUI

testerui.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
#! /bin/bash
2-
java -cp target/JSONata4Java-2.5.3-jar-with-dependencies.jar com.api.jsonata4java.testerui.TesterUI
2+
java -cp target/JSONata4Java-2.5.4-jar-with-dependencies.jar com.api.jsonata4java.testerui.TesterUI

0 commit comments

Comments
 (0)