diff --git a/json-path/src/main/java/com/jayway/jsonpath/internal/JsonContext.java b/json-path/src/main/java/com/jayway/jsonpath/internal/JsonContext.java index 5cc0889c..627255e4 100644 --- a/json-path/src/main/java/com/jayway/jsonpath/internal/JsonContext.java +++ b/json-path/src/main/java/com/jayway/jsonpath/internal/JsonContext.java @@ -146,8 +146,8 @@ public class JsonContext implements ParseContext, DocumentContext { if(jsonPath != null){ return read(jsonPath); } else { - jsonPath = compile(path, filters); - cache.put(cacheKey, jsonPath); + jsonPath = compile(path, filters); + cache.put(cacheKey, jsonPath); return read(jsonPath); } diff --git a/json-path/src/main/java/com/jayway/jsonpath/internal/function/latebinding/ILateBindingValue.java b/json-path/src/main/java/com/jayway/jsonpath/internal/function/latebinding/ILateBindingValue.java index e293affa..3edac244 100644 --- a/json-path/src/main/java/com/jayway/jsonpath/internal/function/latebinding/ILateBindingValue.java +++ b/json-path/src/main/java/com/jayway/jsonpath/internal/function/latebinding/ILateBindingValue.java @@ -1,9 +1,22 @@ +/* + * Copyright 2011 the original author or authors. + * Licensed 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 com.jayway.jsonpath.internal.function.latebinding; /** * Obtain the late binding value at runtime rather than storing the value in the cache thus trashing the cache * - * Created by mattg on 3/27/17. */ public interface ILateBindingValue { /** diff --git a/json-path/src/main/java/com/jayway/jsonpath/internal/function/latebinding/JsonLateBindingValue.java b/json-path/src/main/java/com/jayway/jsonpath/internal/function/latebinding/JsonLateBindingValue.java index b608aa5d..0f653ad1 100644 --- a/json-path/src/main/java/com/jayway/jsonpath/internal/function/latebinding/JsonLateBindingValue.java +++ b/json-path/src/main/java/com/jayway/jsonpath/internal/function/latebinding/JsonLateBindingValue.java @@ -1,10 +1,25 @@ +/* + * Copyright 2011 the original author or authors. + * Licensed 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 com.jayway.jsonpath.internal.function.latebinding; import com.jayway.jsonpath.internal.function.Parameter; import com.jayway.jsonpath.spi.json.JsonProvider; /** - * Created by mattg on 3/27/17. + * Defines the JSON document Late binding approach to function arguments. + * */ public class JsonLateBindingValue implements ILateBindingValue { private final JsonProvider jsonProvider; diff --git a/json-path/src/main/java/com/jayway/jsonpath/internal/function/latebinding/PathLateBindingValue.java b/json-path/src/main/java/com/jayway/jsonpath/internal/function/latebinding/PathLateBindingValue.java index c96ce767..04181cb7 100644 --- a/json-path/src/main/java/com/jayway/jsonpath/internal/function/latebinding/PathLateBindingValue.java +++ b/json-path/src/main/java/com/jayway/jsonpath/internal/function/latebinding/PathLateBindingValue.java @@ -1,3 +1,17 @@ +/* + * Copyright 2011 the original author or authors. + * Licensed 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 com.jayway.jsonpath.internal.function.latebinding; import com.jayway.jsonpath.Configuration; @@ -10,7 +24,6 @@ import com.jayway.jsonpath.internal.function.ParamType; * * Acts like a lambda function with references, but since we're supporting JDK 6+, we're left doing this... * - * Created by mattg on 3/27/17. */ public class PathLateBindingValue implements ILateBindingValue { private final Path path; diff --git a/json-path/src/main/java/com/jayway/jsonpath/internal/function/text/Concatenate.java b/json-path/src/main/java/com/jayway/jsonpath/internal/function/text/Concatenate.java index 19689edf..4cf05524 100644 --- a/json-path/src/main/java/com/jayway/jsonpath/internal/function/text/Concatenate.java +++ b/json-path/src/main/java/com/jayway/jsonpath/internal/function/text/Concatenate.java @@ -27,8 +27,9 @@ public class Concatenate implements PathFunction { } if (parameters != null) { for (Parameter param : parameters) { - if (param.getValue() != null) { - result.append(param.getValue().toString()); + Object value = param.getValue(); + if (value != null) { + result.append(value.toString()); } } }