diff --git a/plugins/tasks/tasks-core/src/com/intellij/tasks/generic/JsonPathResponseHandler.java b/plugins/tasks/tasks-core/src/com/intellij/tasks/generic/JsonPathResponseHandler.java index 794043ef9f7f..c79cb81899f7 100644 --- a/plugins/tasks/tasks-core/src/com/intellij/tasks/generic/JsonPathResponseHandler.java +++ b/plugins/tasks/tasks-core/src/com/intellij/tasks/generic/JsonPathResponseHandler.java @@ -114,6 +114,7 @@ public final class JsonPathResponseHandler extends SelectorBasedResponseHandler return extractValueAndCheckType(selector, (String)context, Boolean.class); } + @SuppressWarnings("UnusedDeclaration") @Nullable private Long selectLong(@NotNull Selector selector, @NotNull String source) throws Exception { return extractValueAndCheckType(selector, source, Long.class); @@ -121,16 +122,17 @@ public final class JsonPathResponseHandler extends SelectorBasedResponseHandler @NotNull private JsonPath lazyCompile(@NotNull String path) throws Exception { - if (!myCompiledCache.containsKey(path)) { + JsonPath jsonPath = myCompiledCache.get(path); + if (jsonPath == null) { try { - final JsonPath jsonPath = JsonPath.compile(path); + jsonPath = JsonPath.compile(path); myCompiledCache.put(path, jsonPath); } catch (InvalidPathException e) { throw new Exception(String.format("Malformed JsonPath expression '%s'", path)); } } - return myCompiledCache.get(path); + return jsonPath; } @NotNull diff --git a/plugins/tasks/tasks-core/src/com/intellij/tasks/generic/XPathResponseHandler.java b/plugins/tasks/tasks-core/src/com/intellij/tasks/generic/XPathResponseHandler.java index 8d82ac189f50..2306e6286be9 100644 --- a/plugins/tasks/tasks-core/src/com/intellij/tasks/generic/XPathResponseHandler.java +++ b/plugins/tasks/tasks-core/src/com/intellij/tasks/generic/XPathResponseHandler.java @@ -65,16 +65,17 @@ public final class XPathResponseHandler extends SelectorBasedResponseHandler { @NotNull private XPath lazyCompile(@NotNull String path) throws Exception { - if (!myCompiledCache.containsKey(path)) { + XPath xPath = myCompiledCache.get(path); + if (xPath == null) { try { - final XPath compiled = XPath.newInstance(path); - myCompiledCache.put(path, compiled); + xPath = XPath.newInstance(path); + myCompiledCache.put(path, xPath); } catch (JDOMException e) { throw new Exception(String.format("Malformed XPath expression '%s'", path)); } } - return myCompiledCache.get(path); + return xPath; } @NotNull