Skip to content

Commit 5194631

Browse files
committed
[fix] minor improvements in LocationStep
Use equals() to compare object references.
1 parent 6177fe1 commit 5194631

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

exist-core/src/main/java/org/exist/xquery/LocationStep.java

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ public void analyze(final AnalyzeContextInfo contextInfo) throws XPathException
312312
contextStepTest = cStep.getTest();
313313

314314
if ((contextStepTest.getType() == Type.ATTRIBUTE || contextStepTest.getType() == Type.TEXT) &&
315-
contextStepTest != stepTest) {
315+
!contextStepTest.equals(stepTest)) {
316316
// return empty sequence
317317
contextInfo.setStaticType(Type.EMPTY);
318318
staticReturnType = Type.EMPTY;
@@ -598,7 +598,7 @@ protected Sequence getAttributes(final XQueryContext context, final Sequence con
598598
final DocumentSet docs = getDocumentSet(contextSet);
599599
synchronized (context) {
600600
if (currentSet == null || currentDocs == null || (
601-
!optimized && !(docs == currentDocs || docs.equalDocs(currentDocs)))) {
601+
!optimized && !(docs.equals(currentDocs) || docs.equalDocs(currentDocs)))) {
602602
final StructuralIndex index = context.getBroker().getStructuralIndex();
603603
if (context.getProfiler().isEnabled()) {
604604
context.getProfiler().message(
@@ -686,7 +686,7 @@ private Sequence getChildren(final XQueryContext context, final Sequence context
686686
// TODO : understand why this one is different from the other
687687
// ones
688688
if (currentSet == null || currentDocs == null || (
689-
!optimized && !(docs == currentDocs || docs.equalDocs(currentDocs)))) {
689+
!optimized && !(docs.equals(currentDocs) || docs.equalDocs(currentDocs)))) {
690690
final StructuralIndex index = context.getBroker().getStructuralIndex();
691691
if (context.getProfiler().isEnabled()) {
692692
context.getProfiler().message(
@@ -743,10 +743,9 @@ private Sequence getDescendants(final XQueryContext context, final Sequence cont
743743
} else if (hasPreloadedData()) {
744744
final DocumentSet docs = getDocumentSet(contextSet);
745745
synchronized (context) {
746-
// TODO : understand why this one is different from the other
747-
// ones
746+
// TODO : understand why this one is different from the other ones
748747
if (currentSet == null || currentDocs == null || (
749-
!optimized && !(docs == currentDocs || docs.equalDocs(currentDocs)))) {
748+
!optimized && !(docs.equals(currentDocs) || docs.equalDocs(currentDocs)))) {
750749
final StructuralIndex index = context.getBroker().getStructuralIndex();
751750
if (context.getProfiler().isEnabled()) {
752751
context.getProfiler().message(
@@ -821,8 +820,7 @@ protected Sequence getSiblings(final XQueryContext context, final Sequence conte
821820
}
822821

823822
final NodeSet contextSet = contextSequence.toNodeSet();
824-
// TODO : understand this. I guess comments should be treated in a
825-
// similar way ? -pb
823+
// TODO : understand this. I guess comments should be treated in a similar way ? -pb
826824
if (test.getType() == Type.PROCESSING_INSTRUCTION) {
827825
final VirtualNodeSet vset = new VirtualNodeSet(context.getBroker(), axis,
828826
test, contextId, contextSet);
@@ -1147,8 +1145,8 @@ protected Sequence getParents(final XQueryContext context, final Sequence contex
11471145
} else if (hasPreloadedData()) {
11481146
final DocumentSet docs = getDocumentSet(contextSet);
11491147
synchronized (context) {
1150-
if (currentSet == null || currentDocs == null ||
1151-
(!optimized && !(docs == currentDocs || docs.equalDocs(currentDocs)))) {
1148+
if (currentSet == null || currentDocs == null || (
1149+
!optimized && !(docs.equals(currentDocs) || docs.equalDocs(currentDocs)))) {
11521150
final StructuralIndex index = context.getBroker().getStructuralIndex();
11531151
if (context.getProfiler().isEnabled()) {
11541152
context.getProfiler().message(

0 commit comments

Comments
 (0)