Skip to content

Commit 4d7c980

Browse files
committed
Fix inconsistent synchronization of NamespaceResolver.pointer; locked
50% of time (SpotBugs: MT_CORRECTNESS IS2_INCONSISTENT_SYNC)
1 parent 1e0c381 commit 4d7c980

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/changes/changes.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ The <action> type attribute can be add,update,fix,remove.
5252
<action type="fix" dev="ggregory" due-to="Gary Gregory">POM assembly:single does not generate binary convenience files (tar/zip).</action>
5353
<action type="fix" dev="ggregory" due-to="Dima1224, Gary Gregory">Make dynamicPropertyHandlerMap in ValueUtils thread-safe #251.</action>
5454
<action type="fix" dev="ggregory" due-to="Gary Gregory">Refactor JXPathIntrospector internal static maps to use concurrent classes instead of synchronization.</action>
55+
<action type="fix" dev="ggregory" due-to="Gary Gregory">Fix inconsistent synchronization of NamespaceResolver.pointer; locked 50% of time (SpotBugs: MT_CORRECTNESS IS2_INCONSISTENT_SYNC).</action>
5556
<!-- ADD -->
5657
<!-- UPDATE -->
5758
<action type="update" dev="ggregory" due-to="Gary Gregory, Dependabot">Bump org.apache.commons:commons-parent from 81 to 92 #239, #262, #265.</action>

src/main/java/org/apache/commons/jxpath/ri/NamespaceResolver.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ protected synchronized String getExternallyRegisteredPrefix(final String namespa
133133
*
134134
* @return Pointer
135135
*/
136-
public Pointer getNamespaceContextPointer() {
136+
public synchronized Pointer getNamespaceContextPointer() {
137137
if (pointer == null && parent != null) {
138138
return parent.getNamespaceContextPointer();
139139
}
@@ -201,7 +201,7 @@ public void seal() {
201201
*
202202
* @param pointer the Pointer to set.
203203
*/
204-
public void setNamespaceContextPointer(final NodePointer pointer) {
204+
public synchronized void setNamespaceContextPointer(final NodePointer pointer) {
205205
this.pointer = pointer;
206206
}
207207
}

0 commit comments

Comments
 (0)