OODT-890 replace == with .equals()
Project: http://git-wip-us.apache.org/repos/asf/oodt/repo Commit: http://git-wip-us.apache.org/repos/asf/oodt/commit/4a50c609 Tree: http://git-wip-us.apache.org/repos/asf/oodt/tree/4a50c609 Diff: http://git-wip-us.apache.org/repos/asf/oodt/diff/4a50c609 Branch: refs/heads/master Commit: 4a50c609d97621bfdfb43a02ee730e60de2ea5af Parents: 7ebb59a Author: Tom Barber <[email protected]> Authored: Sun Oct 25 22:41:36 2015 +0000 Committer: Tom Barber <[email protected]> Committed: Sun Oct 25 22:41:36 2015 +0000 ---------------------------------------------------------------------- .../structs/query/QueryResultComparator.java | 4 +--- .../examples/TestTikaAutoDetectExtractor.java | 18 +++++++++--------- .../pushpull/filerestrictions/VirtualFile.java | 2 +- .../cas/resource/mux/XmlBackendRepository.java | 18 +++++++++--------- 4 files changed, 20 insertions(+), 22 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/oodt/blob/4a50c609/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/query/QueryResultComparator.java ---------------------------------------------------------------------- diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/query/QueryResultComparator.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/query/QueryResultComparator.java index 9552d11..9bab383 100644 --- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/query/QueryResultComparator.java +++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/query/QueryResultComparator.java @@ -45,11 +45,9 @@ public class QueryResultComparator implements Comparator<QueryResult> { public int compare(QueryResult qr1, QueryResult qr2) { String m1 = qr1.getMetadata().getMetadata(sortByMetKey); String m2 = qr2.getMetadata().getMetadata(sortByMetKey); - if (m1 == m2) + if (m1.equals(m2)) return 0; // return null last, since they are the least interesting - if (m1 == null) - return 1; if (m2 == null) return -1; return m1.compareTo(m2); http://git-wip-us.apache.org/repos/asf/oodt/blob/4a50c609/filemgr/src/test/java/org/apache/oodt/cas/filemgr/metadata/extractors/examples/TestTikaAutoDetectExtractor.java ---------------------------------------------------------------------- diff --git a/filemgr/src/test/java/org/apache/oodt/cas/filemgr/metadata/extractors/examples/TestTikaAutoDetectExtractor.java b/filemgr/src/test/java/org/apache/oodt/cas/filemgr/metadata/extractors/examples/TestTikaAutoDetectExtractor.java index 331b67a..189f369 100644 --- a/filemgr/src/test/java/org/apache/oodt/cas/filemgr/metadata/extractors/examples/TestTikaAutoDetectExtractor.java +++ b/filemgr/src/test/java/org/apache/oodt/cas/filemgr/metadata/extractors/examples/TestTikaAutoDetectExtractor.java @@ -18,21 +18,21 @@ package org.apache.oodt.cas.filemgr.metadata.extractors.examples; //JDK imports -import java.net.URL; - -//Junit imports +import org.apache.oodt.cas.filemgr.structs.Product; +import org.apache.oodt.cas.filemgr.structs.Reference; +import org.apache.oodt.cas.metadata.Metadata; +import org.apache.oodt.cas.metadata.exceptions.MetExtractionException; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; -// JUnit static imports +import java.net.URL; + import static junit.framework.Assert.*; +//Junit imports +// JUnit static imports //OODT imports -import org.apache.oodt.cas.filemgr.structs.Product; -import org.apache.oodt.cas.filemgr.structs.Reference; -import org.apache.oodt.cas.metadata.Metadata; -import org.apache.oodt.cas.metadata.exceptions.MetExtractionException; @RunWith(JUnit4.class) @@ -57,6 +57,6 @@ public class TestTikaAutoDetectExtractor { assertNotNull(outputMetadata); assertTrue(outputMetadata.getAllKeys().size() > 0); assertTrue(outputMetadata.containsKey("X-Parsed-By")); - assertFalse(outputMetadata.getMetadata("X-Parsed-By") == "org.apache.tika.parser.EmptyParser"); + assertFalse(outputMetadata.getMetadata("X-Parsed-By").equals("org.apache.tika.parser.EmptyParser")); } } http://git-wip-us.apache.org/repos/asf/oodt/blob/4a50c609/pushpull/src/main/java/org/apache/oodt/cas/pushpull/filerestrictions/VirtualFile.java ---------------------------------------------------------------------- diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/filerestrictions/VirtualFile.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/filerestrictions/VirtualFile.java index ddb8bb0..c49f35a 100644 --- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/filerestrictions/VirtualFile.java +++ b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/filerestrictions/VirtualFile.java @@ -195,7 +195,7 @@ public class VirtualFile { StringBuilder path = new StringBuilder(this.regExp); VirtualFile parent = this.parent; while (parent != null) { - path.insert(0, (parent.regExp != "/" ? parent.regExp : "") + "/"); + path.insert(0, (!parent.regExp.equals("/") ? parent.regExp : "") + "/"); parent = parent.parent; } return path.toString(); http://git-wip-us.apache.org/repos/asf/oodt/blob/4a50c609/resource/src/main/java/org/apache/oodt/cas/resource/mux/XmlBackendRepository.java ---------------------------------------------------------------------- diff --git a/resource/src/main/java/org/apache/oodt/cas/resource/mux/XmlBackendRepository.java b/resource/src/main/java/org/apache/oodt/cas/resource/mux/XmlBackendRepository.java index ffa2779..da0a82d 100644 --- a/resource/src/main/java/org/apache/oodt/cas/resource/mux/XmlBackendRepository.java +++ b/resource/src/main/java/org/apache/oodt/cas/resource/mux/XmlBackendRepository.java @@ -16,14 +16,6 @@ */ package org.apache.oodt.cas.resource.mux; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.net.URI; -import java.net.URISyntaxException; -import java.util.logging.Level; -import java.util.logging.Logger; - import org.apache.oodt.cas.resource.scheduler.Scheduler; import org.apache.oodt.cas.resource.structs.exceptions.RepositoryException; import org.apache.oodt.cas.resource.util.GenericResourceManagerObjectFactory; @@ -32,6 +24,14 @@ import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.NodeList; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.net.URI; +import java.net.URISyntaxException; +import java.util.logging.Level; +import java.util.logging.Logger; + /** * Class to load BackendManager from XML file. * @author starchmd @@ -175,7 +175,7 @@ public class XmlBackendRepository implements BackendRepository { NodeList children = elem.getElementsByTagName(tag); try { String attr; - if (children.getLength() != 1 || (attr = ((Element)children.item(0)).getAttribute("factory")) == "") { + if (children.getLength() != 1 || (attr = ((Element) children.item(0)).getAttribute("factory")).equals("")) { throw new RepositoryException("Could not find exactly one "+tag+", with factory set, in queue: "+queue); } return attr;
