OODT-890 remove unneeded boxing, unboxing, swap indexof to contains, stringbuffer to builder
Project: http://git-wip-us.apache.org/repos/asf/oodt/repo Commit: http://git-wip-us.apache.org/repos/asf/oodt/commit/b9cf9110 Tree: http://git-wip-us.apache.org/repos/asf/oodt/tree/b9cf9110 Diff: http://git-wip-us.apache.org/repos/asf/oodt/diff/b9cf9110 Branch: refs/heads/master Commit: b9cf91101660b96593d675eec121ea6b563c5683 Parents: 3939769 Author: Tom Barber <[email protected]> Authored: Sun Oct 25 22:34:30 2015 +0000 Committer: Tom Barber <[email protected]> Committed: Sun Oct 25 22:34:30 2015 +0000 ---------------------------------------------------------------------- .../gui/perspective/build/BuildPerspective.java | 8 ++- .../apache/oodt/commons/activity/Incident.java | 34 ++++++------ .../apache/oodt/commons/exec/EnvUtilities.java | 9 ++-- .../org/apache/oodt/commons/util/XMLTest.java | 2 +- .../oodt/cas/crawl/daemon/CrawlDaemon.java | 6 +-- .../curation/util/CurationXmlStructFactory.java | 13 ++--- .../catalog/DataSourceCatalogFactory.java | 2 +- .../oodt/cas/filemgr/catalog/LuceneCatalog.java | 4 +- .../filemgr/catalog/LuceneCatalogFactory.java | 2 +- .../catalog/solr/DefaultProductSerializer.java | 26 ++++----- .../extractors/AbstractFilemgrMetExtractor.java | 15 +++--- .../oodt/cas/filemgr/tools/DeleteProduct.java | 10 ++-- .../filemgr/tools/OptimizeLuceneCatalog.java | 2 +- .../oodt/cas/filemgr/tools/SolrIndexer.java | 42 +++++++-------- .../cas/filemgr/versioning/BasicVersioner.java | 17 +++--- .../oodt/cas/metadata/SerializableMetadata.java | 12 ++--- .../oodt/opendapps/util/ProfileChecker.java | 2 +- .../apache/oodt/pcs/util/FileManagerUtils.java | 2 +- .../apache/oodt/pcs/input/PGEXMLFileUtils.java | 3 +- .../pushpull/filerestrictions/VirtualFile.java | 2 +- .../oodt/security/sso/opensso/SSOProxy.java | 49 +++++++---------- .../health/VisibilityAndSortToggler.java | 2 +- .../webcomponents/health/VisibilityToggler.java | 2 +- .../cas/product/data/DataDeliveryServlet.java | 2 - .../oodt/cas/product/rdf/RDFDatasetServlet.java | 49 ++++++++--------- .../oodt/cas/product/rss/RSSProductServlet.java | 4 -- .../product/rss/RSSProductTransferServlet.java | 57 ++++++++++---------- .../PrioritizedQueueBasedWorkflowEngine.java | 3 +- .../oodt/cas/workflow/engine/TaskQuerier.java | 18 +++---- .../engine/ThreadPoolWorkflowEngine.java | 18 +++---- .../processor/WorkflowProcessorQueue.java | 7 ++- .../engine/runner/AbstractEngineRunnerBase.java | 12 ++--- .../MemoryWorkflowInstanceRepository.java | 4 +- .../repository/XMLWorkflowRepository.java | 2 +- .../workflow/system/XmlRpcWorkflowManager.java | 6 +-- .../cas/workflow/tools/InstanceRepoCleaner.java | 5 +- 36 files changed, 208 insertions(+), 245 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/oodt/blob/b9cf9110/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/build/BuildPerspective.java ---------------------------------------------------------------------- diff --git a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/build/BuildPerspective.java b/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/build/BuildPerspective.java index d7966ec..90c7d20 100644 --- a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/build/BuildPerspective.java +++ b/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/build/BuildPerspective.java @@ -285,10 +285,14 @@ public class BuildPerspective extends MultiStatePerspective { mainViews = new HashMap<View, ViewState>(); propView = createPropView(); - propView.registerListener(this); + if (propView != null) { + propView.registerListener(this); + } treeView = createTreeView(); - treeView.registerListener(this); + if (treeView != null) { + treeView.registerListener(this); + } tabbedPane = new JTabbedPane(); http://git-wip-us.apache.org/repos/asf/oodt/blob/b9cf9110/commons/src/main/java/org/apache/oodt/commons/activity/Incident.java ---------------------------------------------------------------------- diff --git a/commons/src/main/java/org/apache/oodt/commons/activity/Incident.java b/commons/src/main/java/org/apache/oodt/commons/activity/Incident.java index e95293f..ff1d062 100644 --- a/commons/src/main/java/org/apache/oodt/commons/activity/Incident.java +++ b/commons/src/main/java/org/apache/oodt/commons/activity/Incident.java @@ -1,19 +1,19 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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. - */ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 org.apache.oodt.commons.activity; @@ -84,7 +84,7 @@ public class Incident implements Serializable, Comparable { */ public int compareTo(Object obj) { Incident rhs = (Incident) obj; - int idComp = id == null && rhs.id != null? -1 : id == null && rhs.id == null? 0 : id != null && rhs.id == null? 1 + int idComp = id == null && rhs.id != null ? -1 : id == null ? 0 : rhs.id == null ? 1 : id.compareTo(rhs.id); if (idComp == 0) return time.compareTo(rhs.time); http://git-wip-us.apache.org/repos/asf/oodt/blob/b9cf9110/commons/src/main/java/org/apache/oodt/commons/exec/EnvUtilities.java ---------------------------------------------------------------------- diff --git a/commons/src/main/java/org/apache/oodt/commons/exec/EnvUtilities.java b/commons/src/main/java/org/apache/oodt/commons/exec/EnvUtilities.java index 939238b..3e7fd2c 100644 --- a/commons/src/main/java/org/apache/oodt/commons/exec/EnvUtilities.java +++ b/commons/src/main/java/org/apache/oodt/commons/exec/EnvUtilities.java @@ -159,12 +159,9 @@ public final class EnvUtilities { buf.append(line).append("\n"); } - if (reader != null) { - try { - reader.close(); - } catch (Exception ignore) { - } - + try { + reader.close(); + } catch (Exception ignore) { } return new ByteArrayInputStream(buf.toString().getBytes()); http://git-wip-us.apache.org/repos/asf/oodt/blob/b9cf9110/commons/src/test/java/org/apache/oodt/commons/util/XMLTest.java ---------------------------------------------------------------------- diff --git a/commons/src/test/java/org/apache/oodt/commons/util/XMLTest.java b/commons/src/test/java/org/apache/oodt/commons/util/XMLTest.java index f2098b9..e91ca83 100644 --- a/commons/src/test/java/org/apache/oodt/commons/util/XMLTest.java +++ b/commons/src/test/java/org/apache/oodt/commons/util/XMLTest.java @@ -44,7 +44,7 @@ public class XMLTest extends TestCase { */ public void testDocumentCreation() { Document doc = XML.createDocument(); - assertTrue(doc instanceof Document); + assertTrue(doc != null); } /** Test the {@link XML#createDOMParser} and {@link XML#serialize} methods. http://git-wip-us.apache.org/repos/asf/oodt/blob/b9cf9110/crawler/src/main/java/org/apache/oodt/cas/crawl/daemon/CrawlDaemon.java ---------------------------------------------------------------------- diff --git a/crawler/src/main/java/org/apache/oodt/cas/crawl/daemon/CrawlDaemon.java b/crawler/src/main/java/org/apache/oodt/cas/crawl/daemon/CrawlDaemon.java index bc9ca2a..cb13ad2 100644 --- a/crawler/src/main/java/org/apache/oodt/cas/crawl/daemon/CrawlDaemon.java +++ b/crawler/src/main/java/org/apache/oodt/cas/crawl/daemon/CrawlDaemon.java @@ -20,13 +20,13 @@ package org.apache.oodt.cas.crawl.daemon; //OODT imports import org.apache.oodt.cas.crawl.ProductCrawler; +import org.apache.xmlrpc.WebServer; -//JDK imports import java.util.logging.Level; import java.util.logging.Logger; +//JDK imports //APACHE imports -import org.apache.xmlrpc.WebServer; /** * @author mattmann @@ -161,7 +161,7 @@ public class CrawlDaemon { */ public boolean stop() { this.running = false; - return this.running; + return false; } /** http://git-wip-us.apache.org/repos/asf/oodt/blob/b9cf9110/curator/services/src/main/java/org/apache/oodt/cas/curation/util/CurationXmlStructFactory.java ---------------------------------------------------------------------- diff --git a/curator/services/src/main/java/org/apache/oodt/cas/curation/util/CurationXmlStructFactory.java b/curator/services/src/main/java/org/apache/oodt/cas/curation/util/CurationXmlStructFactory.java index ec04c37..3aeb7a8 100644 --- a/curator/services/src/main/java/org/apache/oodt/cas/curation/util/CurationXmlStructFactory.java +++ b/curator/services/src/main/java/org/apache/oodt/cas/curation/util/CurationXmlStructFactory.java @@ -19,16 +19,17 @@ package org.apache.oodt.cas.curation.util; //JDK imports -import java.net.URLEncoder; -import java.util.List; +import org.apache.oodt.cas.filemgr.structs.ProductType; +import org.apache.oodt.cas.filemgr.util.XmlStructFactory; +import org.apache.oodt.commons.xml.XMLUtils; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.NodeList; +import java.net.URLEncoder; +import java.util.List; + //OODT imports -import org.apache.oodt.commons.xml.XMLUtils; -import org.apache.oodt.cas.filemgr.structs.ProductType; -import org.apache.oodt.cas.filemgr.util.XmlStructFactory; /** * @@ -86,7 +87,7 @@ public class CurationXmlStructFactory { Element valElem = doc.createElement("val"); if (val == null) { throw new Exception("Attempt to write null value " - + "for property: [" + key + "]: val: [" + val + "]"); + + "for property: [" + key + "]: val: [null]"); } valElem http://git-wip-us.apache.org/repos/asf/oodt/blob/b9cf9110/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/DataSourceCatalogFactory.java ---------------------------------------------------------------------- diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/DataSourceCatalogFactory.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/DataSourceCatalogFactory.java index e027d37..1f4f1c8 100644 --- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/DataSourceCatalogFactory.java +++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/DataSourceCatalogFactory.java @@ -148,7 +148,7 @@ public class DataSourceCatalogFactory implements CatalogFactory { */ public Catalog createCatalog() { if (validationLayer==null) { - return new LenientDataSourceCatalog(dataSource, validationLayer, fieldIdStr, + return new LenientDataSourceCatalog(dataSource, null, fieldIdStr, pageSize, cacheUpdateMinutes, productIdString, orderedValues); } else { return new DataSourceCatalog(dataSource, validationLayer, fieldIdStr, http://git-wip-us.apache.org/repos/asf/oodt/blob/b9cf9110/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/LuceneCatalog.java ---------------------------------------------------------------------- diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/LuceneCatalog.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/LuceneCatalog.java index 86d4a59..fe49e42 100644 --- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/LuceneCatalog.java +++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/LuceneCatalog.java @@ -1196,9 +1196,7 @@ public class LuceneCatalog implements Catalog { if (cp.getReferences() != null && cp.getReferences().size() > 0) { // make sure there is a data store ref for each of the refs for (Reference r : cp.getReferences()) { - if (r.getDataStoreReference() == null - || (r.getDataStoreReference() != null && r - .getDataStoreReference().equals(""))) { + if (r.getDataStoreReference() == null || (r.getDataStoreReference().equals(""))) { return false; } } http://git-wip-us.apache.org/repos/asf/oodt/blob/b9cf9110/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/LuceneCatalogFactory.java ---------------------------------------------------------------------- diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/LuceneCatalogFactory.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/LuceneCatalogFactory.java index a80c52f..1f64633 100644 --- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/LuceneCatalogFactory.java +++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/LuceneCatalogFactory.java @@ -76,7 +76,7 @@ public class LuceneCatalogFactory implements CatalogFactory { throw new IllegalArgumentException( "error initializing lucene catalog: " + "[org.apache.oodt.cas.filemgr.catalog.lucene.idxPath=" - + indexFilePath); + + null); } //do env var replacement http://git-wip-us.apache.org/repos/asf/oodt/blob/b9cf9110/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/solr/DefaultProductSerializer.java ---------------------------------------------------------------------- diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/solr/DefaultProductSerializer.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/solr/DefaultProductSerializer.java index 82d13ec..f758b4f 100644 --- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/solr/DefaultProductSerializer.java +++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/solr/DefaultProductSerializer.java @@ -16,16 +16,6 @@ */ package org.apache.oodt.cas.filemgr.catalog.solr; -import java.io.StringReader; -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; - import org.apache.oodt.cas.filemgr.structs.Product; import org.apache.oodt.cas.filemgr.structs.ProductType; import org.apache.oodt.cas.filemgr.structs.Reference; @@ -37,6 +27,16 @@ import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.xml.sax.InputSource; +import java.io.StringReader; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; + /** * Default implementation of {@link ProductSerializer} * that transforms a CAS product into a single Solr document based on the following rules: @@ -257,17 +257,17 @@ public class DefaultProductSerializer implements ProductSerializer { if (values.isEmpty()) { // use special value to flag removal - delFields.add( this.encodeUpdateField(key, Parameters.NULL, replace) ); + delFields.add( this.encodeUpdateField(key, Parameters.NULL, true) ); } else { for (String value : values) { - setFields.add( this.encodeUpdateField(key, value, replace) ); + setFields.add( this.encodeUpdateField(key, value, true) ); } } } else { for (String value : values) { - addFields.add( this.encodeUpdateField(key, value, replace) ); + addFields.add( this.encodeUpdateField(key, value, false) ); } } http://git-wip-us.apache.org/repos/asf/oodt/blob/b9cf9110/filemgr/src/main/java/org/apache/oodt/cas/filemgr/metadata/extractors/AbstractFilemgrMetExtractor.java ---------------------------------------------------------------------- diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/metadata/extractors/AbstractFilemgrMetExtractor.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/metadata/extractors/AbstractFilemgrMetExtractor.java index 5eec97d..e2c4e1d 100644 --- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/metadata/extractors/AbstractFilemgrMetExtractor.java +++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/metadata/extractors/AbstractFilemgrMetExtractor.java @@ -75,17 +75,16 @@ public abstract class AbstractFilemgrMetExtractor implements protected void validateProduct(Product product, Metadata met) throws MetExtractionException { - if (product.getProductType() == null - || (product.getProductType() != null && (product - .getProductType().getName() == null || (product - .getProductType().getName() != null && product - .getProductType().getName().equals(""))))) { + if (product.getProductType() == null || ((product + .getProductType().getName() == null || (product + .getProductType() + .getName() + .equals(""))))) { throw new MetExtractionException("Product Type undefined"); } - if (product.getProductReferences() == null - || (product.getProductReferences() != null && product - .getProductReferences().size() == 0)) { + if (product.getProductReferences() == null || (product + .getProductReferences().size() == 0)) { throw new MetExtractionException("Product references undefined"); } http://git-wip-us.apache.org/repos/asf/oodt/blob/b9cf9110/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/DeleteProduct.java ---------------------------------------------------------------------- diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/DeleteProduct.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/DeleteProduct.java index 5da89bf..f85853e 100644 --- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/DeleteProduct.java +++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/DeleteProduct.java @@ -134,13 +134,11 @@ public class DeleteProduct { LOG.log(Level.WARNING, "Error reading prod id: line: [" + line + "]: Message: " + e.getMessage(), e); } finally { - if (br != null) { - try { - br.close(); - } catch (Exception ignore) { - } - + try { + br.close(); + } catch (Exception ignore) { } + } return prodIds; http://git-wip-us.apache.org/repos/asf/oodt/blob/b9cf9110/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/OptimizeLuceneCatalog.java ---------------------------------------------------------------------- diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/OptimizeLuceneCatalog.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/OptimizeLuceneCatalog.java index 2d402fc..06d1d79 100644 --- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/OptimizeLuceneCatalog.java +++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/OptimizeLuceneCatalog.java @@ -61,7 +61,7 @@ public class OptimizeLuceneCatalog { try { writer = new IndexWriter(catalogPath, new StandardAnalyzer(), - createIndex); + false); writer.setMergeFactor(this.mergeFactor); long timeBefore = System.currentTimeMillis(); writer.optimize(); http://git-wip-us.apache.org/repos/asf/oodt/blob/b9cf9110/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/SolrIndexer.java ---------------------------------------------------------------------- diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/SolrIndexer.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/SolrIndexer.java index 493d3d7..d75d652 100755 --- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/SolrIndexer.java +++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/SolrIndexer.java @@ -18,22 +18,6 @@ package org.apache.oodt.cas.filemgr.tools; //JDK imports -import java.io.BufferedReader; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.net.MalformedURLException; -import java.net.URL; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Properties; -import java.util.logging.Logger; - import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.CommandLineParser; import org.apache.commons.cli.GnuParser; @@ -60,6 +44,22 @@ import org.apache.solr.client.solrj.impl.CommonsHttpSolrServer; import org.apache.solr.common.SolrInputDocument; import org.springframework.util.StringUtils; +import java.io.BufferedReader; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.net.MalformedURLException; +import java.net.URL; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Properties; +import java.util.logging.Logger; + /** * Indexes products from the File Manager catalog to a Solr instance. Uses an * associated config file, indexer.properties to specify how to perform the @@ -698,12 +698,10 @@ public class SolrIndexer { LOG.severe("Error reading product id: line: [" + line + "]: Message: " + e.getMessage()); } finally { - if (br != null) { - try { - br.close(); - } catch (Exception ignore) { - } - } + try { + br.close(); + } catch (Exception ignore) { + } } return productIds; } http://git-wip-us.apache.org/repos/asf/oodt/blob/b9cf9110/filemgr/src/main/java/org/apache/oodt/cas/filemgr/versioning/BasicVersioner.java ---------------------------------------------------------------------- diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/versioning/BasicVersioner.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/versioning/BasicVersioner.java index a9319a1..437c4d2 100644 --- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/versioning/BasicVersioner.java +++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/versioning/BasicVersioner.java @@ -18,20 +18,21 @@ package org.apache.oodt.cas.filemgr.versioning; //JDK imports +import org.apache.oodt.cas.filemgr.structs.Product; +import org.apache.oodt.cas.filemgr.structs.Reference; +import org.apache.oodt.cas.filemgr.structs.exceptions.VersioningException; +import org.apache.oodt.cas.metadata.Metadata; + import java.io.File; import java.io.UnsupportedEncodingException; +import java.net.MalformedURLException; import java.net.URI; import java.net.URISyntaxException; import java.net.URLEncoder; -import java.net.MalformedURLException; -import java.util.logging.Logger; import java.util.logging.Level; +import java.util.logging.Logger; //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.filemgr.structs.exceptions.VersioningException; /** * @author mattmann @@ -70,9 +71,7 @@ public class BasicVersioner implements Versioner { if (product.getProductStructure() .equals(Product.STRUCTURE_HIERARCHICAL)) { - if (product.getProductReferences() == null - || (product.getProductReferences() != null && product - .getProductReferences().size() == 0)) { + if (product.getProductReferences() == null || (product.getProductReferences().size() == 0)) { throw new VersioningException( "Hierarchical product and references not set!"); } http://git-wip-us.apache.org/repos/asf/oodt/blob/b9cf9110/metadata/src/main/java/org/apache/oodt/cas/metadata/SerializableMetadata.java ---------------------------------------------------------------------- diff --git a/metadata/src/main/java/org/apache/oodt/cas/metadata/SerializableMetadata.java b/metadata/src/main/java/org/apache/oodt/cas/metadata/SerializableMetadata.java index 34fae67..a47c8be 100644 --- a/metadata/src/main/java/org/apache/oodt/cas/metadata/SerializableMetadata.java +++ b/metadata/src/main/java/org/apache/oodt/cas/metadata/SerializableMetadata.java @@ -17,6 +17,10 @@ package org.apache.oodt.cas.metadata; //JDK imports import org.apache.oodt.commons.xml.XMLUtils; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.NodeList; +import org.xml.sax.InputSource; import java.io.IOException; import java.io.InputStream; @@ -35,11 +39,6 @@ import javax.xml.transform.TransformerFactory; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.NodeList; -import org.xml.sax.InputSource; - /** * @author mattmann * @author bfoster @@ -191,8 +190,7 @@ public class SerializableMetadata extends Metadata implements Serializable { Element valElem = document.createElement("val"); if (value == null) { throw new Exception("Attempt to write null value " - + "for property: [" + key + "]: val: [" - + value + "]"); + + "for property: [" + key + "]: val: [null]"); } if (this.useCDATA) valElem.appendChild(document http://git-wip-us.apache.org/repos/asf/oodt/blob/b9cf9110/opendapps/src/main/java/org/apache/oodt/opendapps/util/ProfileChecker.java ---------------------------------------------------------------------- diff --git a/opendapps/src/main/java/org/apache/oodt/opendapps/util/ProfileChecker.java b/opendapps/src/main/java/org/apache/oodt/opendapps/util/ProfileChecker.java index a84daba..8451807 100644 --- a/opendapps/src/main/java/org/apache/oodt/opendapps/util/ProfileChecker.java +++ b/opendapps/src/main/java/org/apache/oodt/opendapps/util/ProfileChecker.java @@ -58,7 +58,7 @@ public class ProfileChecker { boolean ok = true; sb.append("\nChecking profile=").append(profile.getProfileAttributes().getID()); - ok = ok && checkResourceAttribute("Identifier", profile.getResourceAttributes().getIdentifier(), true, sb); + ok = checkResourceAttribute("Identifier", profile.getResourceAttributes().getIdentifier(), true, sb); ok = ok && checkResourceAttribute("Title", profile.getResourceAttributes().getTitle(), true, sb); http://git-wip-us.apache.org/repos/asf/oodt/blob/b9cf9110/pcs/core/src/main/java/org/apache/oodt/pcs/util/FileManagerUtils.java ---------------------------------------------------------------------- diff --git a/pcs/core/src/main/java/org/apache/oodt/pcs/util/FileManagerUtils.java b/pcs/core/src/main/java/org/apache/oodt/pcs/util/FileManagerUtils.java index c6bd26a..2705707 100644 --- a/pcs/core/src/main/java/org/apache/oodt/pcs/util/FileManagerUtils.java +++ b/pcs/core/src/main/java/org/apache/oodt/pcs/util/FileManagerUtils.java @@ -357,7 +357,7 @@ public class FileManagerUtils implements PCSConfigMetadata { public static boolean check(String propName, String propValue, Metadata metadata) { if (propValue == null) { - LOG.log(Level.SEVERE, "PCS: " + propName + ": value: " + propValue); + LOG.log(Level.SEVERE, "PCS: " + propName + ": value: " + null); metadata.replaceMetadata("ApplicationSuccess", "false"); return false; } else { http://git-wip-us.apache.org/repos/asf/oodt/blob/b9cf9110/pcs/input/src/main/java/org/apache/oodt/pcs/input/PGEXMLFileUtils.java ---------------------------------------------------------------------- diff --git a/pcs/input/src/main/java/org/apache/oodt/pcs/input/PGEXMLFileUtils.java b/pcs/input/src/main/java/org/apache/oodt/pcs/input/PGEXMLFileUtils.java index 6d69d26..b4d412b 100644 --- a/pcs/input/src/main/java/org/apache/oodt/pcs/input/PGEXMLFileUtils.java +++ b/pcs/input/src/main/java/org/apache/oodt/pcs/input/PGEXMLFileUtils.java @@ -77,8 +77,7 @@ public final class PGEXMLFileUtils { NodeList rowNodeList = matrix.getElementsByTagName("tr"); // there has to be at least one 1 - if (rowNodeList == null - || (rowNodeList != null && rowNodeList.getLength() <= 0)) { + if (rowNodeList == null || (rowNodeList.getLength() <= 0)) { throw new PGEConfigFileException( "there must be at least one row in a matrix!"); } http://git-wip-us.apache.org/repos/asf/oodt/blob/b9cf9110/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 d3a4a2d..ddb8bb0 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 @@ -126,7 +126,7 @@ public class VirtualFile { } public static VirtualFile mergeTwoFiles(VirtualFile vf1, VirtualFile vf2) { - if (vf1.isDir && vf1.isDir) { + if (vf1.isDir) { VirtualFile newFile = VirtualFile.createRootDir(); newFile.children.addAll(vf1.children); newFile.children.addAll(vf2.children); http://git-wip-us.apache.org/repos/asf/oodt/blob/b9cf9110/sso/src/main/java/org/apache/oodt/security/sso/opensso/SSOProxy.java ---------------------------------------------------------------------- diff --git a/sso/src/main/java/org/apache/oodt/security/sso/opensso/SSOProxy.java b/sso/src/main/java/org/apache/oodt/security/sso/opensso/SSOProxy.java index 6a47838..972fedf 100755 --- a/sso/src/main/java/org/apache/oodt/security/sso/opensso/SSOProxy.java +++ b/sso/src/main/java/org/apache/oodt/security/sso/opensso/SSOProxy.java @@ -18,6 +18,12 @@ package org.apache.oodt.security.sso.opensso; //JDK imports +import org.apache.commons.httpclient.HttpClient; +import org.apache.commons.httpclient.HttpException; +import org.apache.commons.httpclient.HttpStatus; +import org.apache.commons.httpclient.NameValuePair; +import org.apache.commons.httpclient.methods.PostMethod; + import java.io.BufferedReader; import java.io.ByteArrayInputStream; import java.io.IOException; @@ -26,11 +32,6 @@ import java.util.logging.Level; import java.util.logging.Logger; //APACHE imports -import org.apache.commons.httpclient.HttpClient; -import org.apache.commons.httpclient.HttpException; -import org.apache.commons.httpclient.HttpStatus; -import org.apache.commons.httpclient.NameValuePair; -import org.apache.commons.httpclient.methods.PostMethod; /** * @@ -216,21 +217,16 @@ public class SSOProxy implements SSOMetKeys { LOG.log(Level.WARNING, "Error reading service response line: [" + line + "]: Message: " + e.getMessage()); } finally { - if (is != null) { - try { - is.close(); - } catch (Exception ignore) { - } - + try { + is.close(); + } catch (Exception ignore) { } - if (br != null) { - try { - br.close(); - } catch (Exception ignore) { - } - + try { + br.close(); + } catch (Exception ignore) { } + } return details; @@ -271,21 +267,16 @@ public class SSOProxy implements SSOMetKeys { LOG.log(Level.WARNING, "Error reading service response line: [" + line + "]: Message: " + e.getMessage()); } finally { - if (is != null) { - try { - is.close(); - } catch (Exception ignore) { - } - + try { + is.close(); + } catch (Exception ignore) { } - if (br != null) { - try { - br.close(); - } catch (Exception ignore) { - } - + try { + br.close(); + } catch (Exception ignore) { } + } return details; http://git-wip-us.apache.org/repos/asf/oodt/blob/b9cf9110/webapp/components/src/main/java/org/apache/oodt/pcs/webcomponents/health/VisibilityAndSortToggler.java ---------------------------------------------------------------------- diff --git a/webapp/components/src/main/java/org/apache/oodt/pcs/webcomponents/health/VisibilityAndSortToggler.java b/webapp/components/src/main/java/org/apache/oodt/pcs/webcomponents/health/VisibilityAndSortToggler.java index 0845375..586f1c9 100644 --- a/webapp/components/src/main/java/org/apache/oodt/pcs/webcomponents/health/VisibilityAndSortToggler.java +++ b/webapp/components/src/main/java/org/apache/oodt/pcs/webcomponents/health/VisibilityAndSortToggler.java @@ -56,7 +56,7 @@ class VisibilityAndSortToggler extends VisibilityToggler { Link<Link> sortLink; Link<Link> unsortLink = null; - sortLink = new Link<Link>(sortLinkId, new Model<Link>(unsortLink)) { + sortLink = new Link<Link>(sortLinkId, new Model<Link>(null)) { /* * (non-Javadoc) * http://git-wip-us.apache.org/repos/asf/oodt/blob/b9cf9110/webapp/components/src/main/java/org/apache/oodt/pcs/webcomponents/health/VisibilityToggler.java ---------------------------------------------------------------------- diff --git a/webapp/components/src/main/java/org/apache/oodt/pcs/webcomponents/health/VisibilityToggler.java b/webapp/components/src/main/java/org/apache/oodt/pcs/webcomponents/health/VisibilityToggler.java index 62993cd..6f4ea72 100644 --- a/webapp/components/src/main/java/org/apache/oodt/pcs/webcomponents/health/VisibilityToggler.java +++ b/webapp/components/src/main/java/org/apache/oodt/pcs/webcomponents/health/VisibilityToggler.java @@ -56,7 +56,7 @@ public class VisibilityToggler extends WebMarkupContainer { final WebMarkupContainer moreComponent = new WebMarkupContainer(moreId); add(moreComponent); - showLink = new Link<Link>(showLinkId, new Model<Link>(hideLink)) { + showLink = new Link<Link>(showLinkId, new Model<Link>(null)) { /* * (non-Javadoc) * http://git-wip-us.apache.org/repos/asf/oodt/blob/b9cf9110/webapp/fmprod/src/main/java/org/apache/oodt/cas/product/data/DataDeliveryServlet.java ---------------------------------------------------------------------- diff --git a/webapp/fmprod/src/main/java/org/apache/oodt/cas/product/data/DataDeliveryServlet.java b/webapp/fmprod/src/main/java/org/apache/oodt/cas/product/data/DataDeliveryServlet.java index be68235..970eff4 100644 --- a/webapp/fmprod/src/main/java/org/apache/oodt/cas/product/data/DataDeliveryServlet.java +++ b/webapp/fmprod/src/main/java/org/apache/oodt/cas/product/data/DataDeliveryServlet.java @@ -66,8 +66,6 @@ public class DataDeliveryServlet extends HttpServlet implements } catch (Exception e) { throw new ServletException("Failed to get filemgr url : " + e.getMessage(), e); } - if (fileMgrURL == null) - fileMgrURL = "http://localhost:9000"; client = new XmlRpcFileManagerClient(new URL(fileMgrURL)); } catch (MalformedURLException ex) { throw new ServletException(ex); http://git-wip-us.apache.org/repos/asf/oodt/blob/b9cf9110/webapp/fmprod/src/main/java/org/apache/oodt/cas/product/rdf/RDFDatasetServlet.java ---------------------------------------------------------------------- diff --git a/webapp/fmprod/src/main/java/org/apache/oodt/cas/product/rdf/RDFDatasetServlet.java b/webapp/fmprod/src/main/java/org/apache/oodt/cas/product/rdf/RDFDatasetServlet.java index f66aab0..50b7026 100644 --- a/webapp/fmprod/src/main/java/org/apache/oodt/cas/product/rdf/RDFDatasetServlet.java +++ b/webapp/fmprod/src/main/java/org/apache/oodt/cas/product/rdf/RDFDatasetServlet.java @@ -19,11 +19,32 @@ package org.apache.oodt.cas.product.rdf; //JDK imports +import org.apache.commons.lang.StringEscapeUtils; +import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang.WordUtils; +import org.apache.oodt.cas.filemgr.structs.ProductType; +import org.apache.oodt.cas.filemgr.structs.exceptions.ConnectionException; +import org.apache.oodt.cas.filemgr.structs.exceptions.RepositoryManagerException; +import org.apache.oodt.cas.filemgr.system.XmlRpcFileManagerClient; +import org.apache.oodt.cas.metadata.util.PathUtils; +import org.apache.oodt.commons.xml.XMLUtils; +import org.w3c.dom.Document; +import org.w3c.dom.Element; + +import java.io.FileNotFoundException; +import java.io.IOException; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.List; +import java.util.Vector; +import java.util.logging.Level; +import java.util.logging.Logger; + +import javax.servlet.ServletConfig; +import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import javax.servlet.ServletConfig; -import javax.servlet.ServletException; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import javax.xml.transform.Transformer; @@ -31,27 +52,8 @@ import javax.xml.transform.TransformerException; import javax.xml.transform.TransformerFactory; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; -import java.util.List; -import java.util.Vector; -import java.util.logging.Logger; -import java.util.logging.Level; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.net.MalformedURLException; -import java.net.URL; -import org.apache.commons.lang.StringEscapeUtils; -import org.apache.commons.lang.StringUtils; -import org.apache.commons.lang.WordUtils; //OODT imports -import org.apache.oodt.cas.filemgr.structs.exceptions.RepositoryManagerException; -import org.apache.oodt.cas.filemgr.structs.exceptions.ConnectionException; -import org.apache.oodt.cas.filemgr.structs.ProductType; -import org.apache.oodt.cas.filemgr.system.XmlRpcFileManagerClient; -import org.apache.oodt.cas.metadata.util.PathUtils; -import org.apache.oodt.commons.xml.XMLUtils; /** * @@ -105,11 +107,6 @@ public class RDFDatasetServlet extends HttpServlet { "filemgr.url") ); } catch (Exception e) { throw new ServletException("Failed to get filemgr url : " + e.getMessage(), e); - } - - if (fileManagerUrl == null) { - // try the default port - fileManagerUrl = "http://localhost:9000"; } fClient = null; http://git-wip-us.apache.org/repos/asf/oodt/blob/b9cf9110/webapp/fmprod/src/main/java/org/apache/oodt/cas/product/rss/RSSProductServlet.java ---------------------------------------------------------------------- diff --git a/webapp/fmprod/src/main/java/org/apache/oodt/cas/product/rss/RSSProductServlet.java b/webapp/fmprod/src/main/java/org/apache/oodt/cas/product/rss/RSSProductServlet.java index e1cf5ae..285bc3c 100644 --- a/webapp/fmprod/src/main/java/org/apache/oodt/cas/product/rss/RSSProductServlet.java +++ b/webapp/fmprod/src/main/java/org/apache/oodt/cas/product/rss/RSSProductServlet.java @@ -108,10 +108,6 @@ public class RSSProductServlet extends HttpServlet { } catch (Exception e) { throw new ServletException("Failed to get filemgr url : " + e.getMessage(), e); } - if (fileManagerUrl == null) { - // try the default port - fileManagerUrl = "http://localhost:9000"; - } this.getFileManager(fileManagerUrl); try { http://git-wip-us.apache.org/repos/asf/oodt/blob/b9cf9110/webapp/fmprod/src/main/java/org/apache/oodt/cas/product/rss/RSSProductTransferServlet.java ---------------------------------------------------------------------- diff --git a/webapp/fmprod/src/main/java/org/apache/oodt/cas/product/rss/RSSProductTransferServlet.java b/webapp/fmprod/src/main/java/org/apache/oodt/cas/product/rss/RSSProductTransferServlet.java index 389469a..3574e1f 100644 --- a/webapp/fmprod/src/main/java/org/apache/oodt/cas/product/rss/RSSProductTransferServlet.java +++ b/webapp/fmprod/src/main/java/org/apache/oodt/cas/product/rss/RSSProductTransferServlet.java @@ -19,11 +19,34 @@ package org.apache.oodt.cas.product.rss; //JDK imports +import org.apache.oodt.cas.filemgr.structs.FileTransferStatus; +import org.apache.oodt.cas.filemgr.structs.exceptions.CatalogException; +import org.apache.oodt.cas.filemgr.structs.exceptions.ConnectionException; +import org.apache.oodt.cas.filemgr.structs.exceptions.DataTransferException; +import org.apache.oodt.cas.filemgr.system.XmlRpcFileManagerClient; +import org.apache.oodt.cas.metadata.Metadata; +import org.apache.oodt.cas.metadata.util.PathUtils; +import org.apache.oodt.commons.util.DateConvert; +import org.apache.oodt.commons.xml.XMLUtils; +import org.w3c.dom.Document; +import org.w3c.dom.Element; + +import java.io.File; +import java.io.FileNotFoundException; +import java.net.MalformedURLException; +import java.net.URL; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.List; +import java.util.logging.Level; +import java.util.logging.Logger; + +import javax.servlet.ServletConfig; +import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import javax.servlet.ServletConfig; -import javax.servlet.ServletException; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import javax.xml.transform.Transformer; @@ -31,30 +54,10 @@ import javax.xml.transform.TransformerException; import javax.xml.transform.TransformerFactory; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; -import java.util.List; -import java.util.Date; -import java.util.logging.Logger; -import java.util.logging.Level; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import java.io.File; -import java.io.FileNotFoundException; -import java.net.MalformedURLException; -import java.net.URL; -import java.text.SimpleDateFormat; -import java.text.ParseException; -//OODT imports import static org.apache.oodt.cas.product.rss.RSSConfigMetKeys.RSS_TRANSFER_CONF_KEY; -import org.apache.oodt.cas.filemgr.structs.exceptions.CatalogException; -import org.apache.oodt.cas.filemgr.structs.exceptions.DataTransferException; -import org.apache.oodt.cas.filemgr.structs.exceptions.ConnectionException; -import org.apache.oodt.cas.filemgr.structs.FileTransferStatus; -import org.apache.oodt.cas.filemgr.system.XmlRpcFileManagerClient; -import org.apache.oodt.commons.xml.XMLUtils; -import org.apache.oodt.cas.metadata.Metadata; -import org.apache.oodt.cas.metadata.util.PathUtils; -import org.apache.oodt.commons.util.DateConvert; + +//OODT imports /** * @author mattmann @@ -109,13 +112,9 @@ public class RSSProductTransferServlet extends HttpServlet { "filemgr.url") ); } catch (Exception e) { throw new ServletException("Failed to get filemgr url : " + e.getMessage(), e); - } - if (fileManagerUrl == null) { - // try the default port - fileManagerUrl = "http://localhost:9000"; } - fClient = null; + fClient = null; try { fClient = new XmlRpcFileManagerClient(new URL(fileManagerUrl)); http://git-wip-us.apache.org/repos/asf/oodt/blob/b9cf9110/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/PrioritizedQueueBasedWorkflowEngine.java ---------------------------------------------------------------------- diff --git a/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/PrioritizedQueueBasedWorkflowEngine.java b/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/PrioritizedQueueBasedWorkflowEngine.java index 11ec7b9..66102ec 100644 --- a/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/PrioritizedQueueBasedWorkflowEngine.java +++ b/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/PrioritizedQueueBasedWorkflowEngine.java @@ -241,8 +241,7 @@ public class PrioritizedQueueBasedWorkflowEngine implements WorkflowEngine { private synchronized void persist(WorkflowInstance inst) throws EngineException { try { - if (inst.getId() == null - || (inst.getId() != null && inst.getId().equals(""))) { + if (inst.getId() == null || (inst.getId().equals(""))) { // we have to persist it by adding it // rather than updating it repo.addWorkflowInstance(inst); http://git-wip-us.apache.org/repos/asf/oodt/blob/b9cf9110/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/TaskQuerier.java ---------------------------------------------------------------------- diff --git a/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/TaskQuerier.java b/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/TaskQuerier.java index c745b8d..56e6fe5 100644 --- a/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/TaskQuerier.java +++ b/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/TaskQuerier.java @@ -18,12 +18,6 @@ package org.apache.oodt.cas.workflow.engine; //JDK imports -import java.util.List; -import java.util.Vector; -import java.util.logging.Level; -import java.util.logging.Logger; - -//OODT imports import org.apache.oodt.cas.workflow.engine.processor.TaskProcessor; import org.apache.oodt.cas.workflow.engine.processor.WorkflowProcessor; import org.apache.oodt.cas.workflow.engine.processor.WorkflowProcessorHelper; @@ -35,6 +29,13 @@ import org.apache.oodt.cas.workflow.structs.PrioritySorter; import org.apache.oodt.cas.workflow.structs.WorkflowInstance; import org.apache.oodt.cas.workflow.structs.exceptions.InstanceRepositoryException; +import java.util.List; +import java.util.Vector; +import java.util.logging.Level; +import java.util.logging.Logger; + +//OODT imports + /** * * The purpose of this class is to constantly pop off tasks that are run to run @@ -132,7 +133,7 @@ public class TaskQuerier implements Runnable { processorsToRun.add(tp); } - if (processorsToRun != null && processorsToRun.size() > 1) { + if (processorsToRun.size() > 1) { prioritizer.sort(processorsToRun); } @@ -199,8 +200,7 @@ public class TaskQuerier implements Runnable { private synchronized void persist(WorkflowInstance instance) { if (this.repo != null) { try { - if (instance.getId() == null - || (instance.getId() != null && instance.getId().equals(""))) { + if (instance.getId() == null || (instance.getId().equals(""))) { // we have to persist it by adding it // rather than updating it repo.addWorkflowInstance(instance); http://git-wip-us.apache.org/repos/asf/oodt/blob/b9cf9110/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/ThreadPoolWorkflowEngine.java ---------------------------------------------------------------------- diff --git a/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/ThreadPoolWorkflowEngine.java b/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/ThreadPoolWorkflowEngine.java index 6b512f0..805d782 100644 --- a/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/ThreadPoolWorkflowEngine.java +++ b/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/ThreadPoolWorkflowEngine.java @@ -365,10 +365,9 @@ public class ThreadPoolWorkflowEngine implements WorkflowEngine, WorkflowStatus Date workflowStartDateTime; - if (inst.getStartDateTimeIsoStr() == null - || (inst.getStartDateTimeIsoStr() != null && (inst - .getStartDateTimeIsoStr().equals("") || inst - .getStartDateTimeIsoStr().equals("null")))) { + if (inst.getStartDateTimeIsoStr() == null || ((inst + .getStartDateTimeIsoStr().equals("") || inst + .getStartDateTimeIsoStr().equals("null")))) { return 0.0; } @@ -398,10 +397,10 @@ public class ThreadPoolWorkflowEngine implements WorkflowEngine, WorkflowStatus Date workflowTaskStartDateTime; - if (inst.getCurrentTaskStartDateTimeIsoStr() == null - || (inst.getCurrentTaskStartDateTimeIsoStr() != null && (inst - .getCurrentTaskStartDateTimeIsoStr().equals("") || inst - .getCurrentTaskStartDateTimeIsoStr().equals("null")))) { + if (inst.getCurrentTaskStartDateTimeIsoStr() == null || ((inst + .getCurrentTaskStartDateTimeIsoStr().equals("") + || inst + .getCurrentTaskStartDateTimeIsoStr().equals("null")))) { return 0.0; } @@ -435,8 +434,7 @@ public class ThreadPoolWorkflowEngine implements WorkflowEngine, WorkflowStatus throws EngineException { try { - if (wInst.getId() == null - || (wInst.getId() != null && wInst.getId().equals(""))) { + if (wInst.getId() == null || (wInst.getId().equals(""))) { // we have to persist it by adding it // rather than updating it instRep.addWorkflowInstance(wInst); http://git-wip-us.apache.org/repos/asf/oodt/blob/b9cf9110/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/processor/WorkflowProcessorQueue.java ---------------------------------------------------------------------- diff --git a/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/processor/WorkflowProcessorQueue.java b/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/processor/WorkflowProcessorQueue.java index 7d5507f..b594604 100644 --- a/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/processor/WorkflowProcessorQueue.java +++ b/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/processor/WorkflowProcessorQueue.java @@ -107,8 +107,7 @@ public class WorkflowProcessorQueue { public synchronized void persist(WorkflowInstance inst) { try { - if (inst.getId() == null - || (inst.getId() != null && inst.getId().equals(""))) { + if (inst.getId() == null || (inst.getId().equals(""))) { // we have to persist it by adding it // rather than updating it repo.addWorkflowInstance(inst); @@ -134,7 +133,7 @@ public class WorkflowProcessorQueue { LOG.log(Level.SEVERE, "Unable to process Graph for workflow instance: [" + inst.getId() + "]"); - return processor; + return null; } if (isCompositeProcessor(inst)) { @@ -446,7 +445,7 @@ public class WorkflowProcessorQueue { e.printStackTrace(); } - return task; + return null; } } http://git-wip-us.apache.org/repos/asf/oodt/blob/b9cf9110/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/runner/AbstractEngineRunnerBase.java ---------------------------------------------------------------------- diff --git a/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/runner/AbstractEngineRunnerBase.java b/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/runner/AbstractEngineRunnerBase.java index 456c698..0b8b092 100644 --- a/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/runner/AbstractEngineRunnerBase.java +++ b/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/runner/AbstractEngineRunnerBase.java @@ -18,10 +18,6 @@ package org.apache.oodt.cas.workflow.engine.runner; //JDK imports -import java.util.logging.Level; -import java.util.logging.Logger; - -//OODT imports import org.apache.oodt.cas.workflow.engine.processor.TaskProcessor; import org.apache.oodt.cas.workflow.instrepo.WorkflowInstanceRepository; import org.apache.oodt.cas.workflow.lifecycle.WorkflowLifecycle; @@ -29,6 +25,11 @@ import org.apache.oodt.cas.workflow.structs.WorkflowInstance; import org.apache.oodt.cas.workflow.structs.WorkflowTask; import org.apache.oodt.cas.workflow.structs.exceptions.InstanceRepositoryException; +import java.util.logging.Level; +import java.util.logging.Logger; + +//OODT imports + /** * * An abstract base class providing helper functionality to persist @@ -76,8 +77,7 @@ public abstract class AbstractEngineRunnerBase extends EngineRunner { protected synchronized void persist(WorkflowInstance instance) { if(instRep == null) return; try { - if (instance.getId() == null - || (instance.getId() != null && instance.getId().equals(""))) { + if (instance.getId() == null || (instance.getId().equals(""))) { // we have to persist it by adding it // rather than updating it instRep.addWorkflowInstance(instance); http://git-wip-us.apache.org/repos/asf/oodt/blob/b9cf9110/workflow/src/main/java/org/apache/oodt/cas/workflow/instrepo/MemoryWorkflowInstanceRepository.java ---------------------------------------------------------------------- diff --git a/workflow/src/main/java/org/apache/oodt/cas/workflow/instrepo/MemoryWorkflowInstanceRepository.java b/workflow/src/main/java/org/apache/oodt/cas/workflow/instrepo/MemoryWorkflowInstanceRepository.java index 279572f..32d53bc 100644 --- a/workflow/src/main/java/org/apache/oodt/cas/workflow/instrepo/MemoryWorkflowInstanceRepository.java +++ b/workflow/src/main/java/org/apache/oodt/cas/workflow/instrepo/MemoryWorkflowInstanceRepository.java @@ -204,9 +204,7 @@ public class MemoryWorkflowInstanceRepository extends throws InstanceRepositoryException { int cnt = 0; - if (this.workflowInstMap != null - && this.workflowInstMap.keySet() != null - && this.workflowInstMap.keySet().size() > 0) { + if (this.workflowInstMap != null && this.workflowInstMap.keySet().size() > 0) { for (Object o : this.workflowInstMap.keySet()) { String wInstId = (String) o; WorkflowInstance inst = (WorkflowInstance) this.workflowInstMap http://git-wip-us.apache.org/repos/asf/oodt/blob/b9cf9110/workflow/src/main/java/org/apache/oodt/cas/workflow/repository/XMLWorkflowRepository.java ---------------------------------------------------------------------- diff --git a/workflow/src/main/java/org/apache/oodt/cas/workflow/repository/XMLWorkflowRepository.java b/workflow/src/main/java/org/apache/oodt/cas/workflow/repository/XMLWorkflowRepository.java index 6456887..361dcaf 100644 --- a/workflow/src/main/java/org/apache/oodt/cas/workflow/repository/XMLWorkflowRepository.java +++ b/workflow/src/main/java/org/apache/oodt/cas/workflow/repository/XMLWorkflowRepository.java @@ -290,7 +290,7 @@ public class XMLWorkflowRepository implements WorkflowRepository { @Override public String addWorkflow(Workflow workflow) throws RepositoryException { // first check to see that its tasks are all present - if(workflow.getTasks() == null || (workflow.getTasks() != null && workflow.getTasks().size() == 0)){ + if(workflow.getTasks() == null || (workflow.getTasks().size() == 0)){ throw new RepositoryException("Attempt to define a new worklfow: ["+workflow.getName()+"] with no tasks."); } http://git-wip-us.apache.org/repos/asf/oodt/blob/b9cf9110/workflow/src/main/java/org/apache/oodt/cas/workflow/system/XmlRpcWorkflowManager.java ---------------------------------------------------------------------- diff --git a/workflow/src/main/java/org/apache/oodt/cas/workflow/system/XmlRpcWorkflowManager.java b/workflow/src/main/java/org/apache/oodt/cas/workflow/system/XmlRpcWorkflowManager.java index 693511e..55e11d3 100644 --- a/workflow/src/main/java/org/apache/oodt/cas/workflow/system/XmlRpcWorkflowManager.java +++ b/workflow/src/main/java/org/apache/oodt/cas/workflow/system/XmlRpcWorkflowManager.java @@ -676,10 +676,8 @@ public class XmlRpcWorkflowManager { if (wInsts != null && wInsts.size() > 0) { for (Object wInst1 : wInsts) { WorkflowInstance wInst = (WorkflowInstance) wInst1; - if (wInst.getWorkflow() == null || - (wInst.getWorkflow() != null && - (wInst.getWorkflow().getName() == null || - wInst.getWorkflow().getId() == null))) { + if (wInst.getWorkflow() == null || ((wInst.getWorkflow().getName() == null + || wInst.getWorkflow().getId() == null))) { wInst.setWorkflow(safeGetWorkflowById(wInst.getWorkflow() .getId())); } else { http://git-wip-us.apache.org/repos/asf/oodt/blob/b9cf9110/workflow/src/main/java/org/apache/oodt/cas/workflow/tools/InstanceRepoCleaner.java ---------------------------------------------------------------------- diff --git a/workflow/src/main/java/org/apache/oodt/cas/workflow/tools/InstanceRepoCleaner.java b/workflow/src/main/java/org/apache/oodt/cas/workflow/tools/InstanceRepoCleaner.java index be77073..83196e9 100644 --- a/workflow/src/main/java/org/apache/oodt/cas/workflow/tools/InstanceRepoCleaner.java +++ b/workflow/src/main/java/org/apache/oodt/cas/workflow/tools/InstanceRepoCleaner.java @@ -115,9 +115,8 @@ public class InstanceRepoCleaner { LOG.log(Level.INFO, "Existing status: [" + inst.getStatus() + "]: setting to [" + WorkflowStatus.FINISHED + "]"); inst.setEndDateTimeIsoStr(endDateTimeIsoStr); - if (inst.getStartDateTimeIsoStr() == null - || (inst.getStartDateTimeIsoStr() != null && inst - .getStartDateTimeIsoStr().equals(""))) { + if (inst.getStartDateTimeIsoStr() == null || (inst + .getStartDateTimeIsoStr().equals(""))) { inst.setStartDateTimeIsoStr(endDateTimeIsoStr); } inst.setStatus(WorkflowStatus.FINISHED);
