OODT-892 remove null assignments
Project: http://git-wip-us.apache.org/repos/asf/oodt/repo Commit: http://git-wip-us.apache.org/repos/asf/oodt/commit/0a3ff32c Tree: http://git-wip-us.apache.org/repos/asf/oodt/tree/0a3ff32c Diff: http://git-wip-us.apache.org/repos/asf/oodt/diff/0a3ff32c Branch: refs/heads/master Commit: 0a3ff32cbf61e3ff0c877f985e2b5aeb8425ba8f Parents: 720d4bd Author: Tom Barber <[email protected]> Authored: Wed Oct 14 07:56:06 2015 +0100 Committer: Tom Barber <[email protected]> Committed: Wed Oct 14 07:56:06 2015 +0100 ---------------------------------------------------------------------- .../org/apache/oodt/commons/io/LogWriter.java | 5 +- .../org/apache/oodt/commons/xml/XMLUtils.java | 35 +- .../cas/crawl/action/MimeTypeCrawlerAction.java | 20 +- .../cas/curation/service/PolicyResource.java | 25 +- .../apache/oodt/cas/curation/CurationApp.java | 24 +- .../oodt/cas/filemgr/catalog/LuceneCatalog.java | 58 +-- .../datatransfer/LocalDataTransferer.java | 162 +++---- .../oodt/cas/filemgr/ingest/LocalCache.java | 14 +- .../oodt/cas/filemgr/ingest/RmiCacheServer.java | 6 +- .../metadata/extractors/CoreMetExtractor.java | 10 +- .../oodt/cas/filemgr/structs/Reference.java | 16 +- .../cas/filemgr/system/XmlRpcFileManager.java | 154 +++---- .../oodt/cas/filemgr/tools/ExpImpCatalog.java | 266 +++++------ .../versioning/SingleFileBasicVersioner.java | 13 +- .../main/java/org/apache/oodt/grid/Server.java | 10 +- .../oodt/cas/install/CASInstallDistMojo.java | 103 +++-- .../org/apache/oodt/pcs/pedigree/Pedigree.java | 23 +- .../apache/oodt/pcs/tools/PCSHealthMonitor.java | 105 ++--- .../apache/oodt/pcs/tools/PCSLongLister.java | 14 +- .../apache/oodt/pcs/util/FileManagerUtils.java | 12 +- .../oodt/pcs/input/PGEConfigFileReader.java | 14 +- .../oodt/pcs/input/PGEConfigFileWriter.java | 11 +- .../apache/oodt/pcs/input/PGEXMLFileUtils.java | 35 +- .../handlers/ofsn/AbstractCrawlLister.java | 5 +- .../product/handlers/ofsn/OFSNFileHandler.java | 33 +- .../profile/handlers/cas/CASProfileHandler.java | 31 +- .../oodt/cas/pushpull/config/SiteInfo.java | 2 +- .../parsers/DirStructXmlParser.java | 27 +- .../browser/metadata/MetadataBrowser.java | 88 ++-- .../oodt/cas/product/CASProductHandler.java | 50 +- .../product/data/DatasetDeliveryServlet.java | 32 +- .../oodt/cas/workflow/engine/TaskRunner.java | 6 +- .../DataSourceWorkflowInstanceRepository.java | 2 +- .../DataSourceWorkflowRepository.java | 26 +- .../repository/PackagedWorkflowRepository.java | 61 +-- .../PackagedWorkflowRepositoryFactory.java | 3 +- .../repository/XMLWorkflowRepository.java | 457 +++++++++---------- .../workflow/structs/ConditionTaskInstance.java | 10 +- .../oodt/cas/workflow/structs/TaskJob.java | 3 +- .../workflow/system/XmlRpcWorkflowManager.java | 32 +- .../org/apache/oodt/xmlps/mapping/Mapping.java | 5 +- .../apache/oodt/xmlps/mapping/MappingField.java | 31 +- .../oodt/xmlps/mapping/MappingReader.java | 9 +- .../oodt/xmlps/product/XMLPSProductHandler.java | 24 +- .../apache/oodt/xmlps/structs/CDEResult.java | 4 +- 45 files changed, 930 insertions(+), 1146 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/oodt/blob/0a3ff32c/commons/src/main/java/org/apache/oodt/commons/io/LogWriter.java ---------------------------------------------------------------------- diff --git a/commons/src/main/java/org/apache/oodt/commons/io/LogWriter.java b/commons/src/main/java/org/apache/oodt/commons/io/LogWriter.java index 2f8f37b..da60933 100644 --- a/commons/src/main/java/org/apache/oodt/commons/io/LogWriter.java +++ b/commons/src/main/java/org/apache/oodt/commons/io/LogWriter.java @@ -320,8 +320,9 @@ public class LogWriter extends java.io.Writer { println("Null stack trace in " + t.getClass().getName()); else { println(t.getClass().getName() + ":"); - for (int i = 0; i < frames.length; ++i) - println(frames[i]); + for (StackTraceElement frame : frames) { + println(frame); + } } } } http://git-wip-us.apache.org/repos/asf/oodt/blob/0a3ff32c/commons/src/main/java/org/apache/oodt/commons/xml/XMLUtils.java ---------------------------------------------------------------------- diff --git a/commons/src/main/java/org/apache/oodt/commons/xml/XMLUtils.java b/commons/src/main/java/org/apache/oodt/commons/xml/XMLUtils.java index 0b3ee9e..b48eade 100644 --- a/commons/src/main/java/org/apache/oodt/commons/xml/XMLUtils.java +++ b/commons/src/main/java/org/apache/oodt/commons/xml/XMLUtils.java @@ -19,22 +19,9 @@ package org.apache.oodt.commons.xml; //JDK imports -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.transform.Result; -import javax.xml.transform.Source; -import javax.xml.transform.Transformer; -import javax.xml.transform.TransformerFactory; -import javax.xml.transform.stream.StreamResult; -import javax.xml.transform.dom.DOMSource; -import javax.xml.transform.OutputKeys; -import org.w3c.dom.Attr; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; -import org.w3c.dom.Text; +import org.w3c.dom.*; import org.xml.sax.InputSource; + import java.io.InputStream; import java.io.OutputStream; import java.net.URLDecoder; @@ -44,6 +31,12 @@ import java.util.Vector; import java.util.logging.Level; import java.util.logging.Logger; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.transform.*; +import javax.xml.transform.dom.DOMSource; +import javax.xml.transform.stream.StreamResult; + /** * @author mattmann * @author bfoster @@ -108,7 +101,7 @@ public class XMLUtils { for (int i = 0; i < valueNodes.getLength(); i++) { Element valElem = (Element) valueNodes.item(i); - String value = null; + String value; try { value = URLDecoder.decode( @@ -152,7 +145,7 @@ public class XMLUtils { public static String getSimpleElementText(Element node, boolean trim) { if (node.getChildNodes().item(0) instanceof Text) { - String elemTxt = null; + String elemTxt; if (trim) { elemTxt = node.getChildNodes().item(0).getNodeValue().trim(); } else { @@ -183,10 +176,10 @@ public class XMLUtils { public static Document getDocumentRoot(InputStream is) { // open up the XML file - DocumentBuilderFactory factory = null; - DocumentBuilder parser = null; - Document document = null; - InputSource inputSource = null; + DocumentBuilderFactory factory; + DocumentBuilder parser; + Document document; + InputSource inputSource; inputSource = new InputSource(is); http://git-wip-us.apache.org/repos/asf/oodt/blob/0a3ff32c/crawler/src/main/java/org/apache/oodt/cas/crawl/action/MimeTypeCrawlerAction.java ---------------------------------------------------------------------- diff --git a/crawler/src/main/java/org/apache/oodt/cas/crawl/action/MimeTypeCrawlerAction.java b/crawler/src/main/java/org/apache/oodt/cas/crawl/action/MimeTypeCrawlerAction.java index b9e8ef1..79b9e73 100644 --- a/crawler/src/main/java/org/apache/oodt/cas/crawl/action/MimeTypeCrawlerAction.java +++ b/crawler/src/main/java/org/apache/oodt/cas/crawl/action/MimeTypeCrawlerAction.java @@ -17,24 +17,23 @@ package org.apache.oodt.cas.crawl.action; //OODT static imports -import static org.apache.oodt.cas.crawl.AutoDetectProductCrawler.MIME_TYPES_HIERARCHY; - -//Apache imports import org.apache.commons.lang.Validate; - -//OODT imports import org.apache.oodt.cas.crawl.structs.exceptions.CrawlerActionException; import org.apache.oodt.cas.metadata.Metadata; +import org.springframework.beans.factory.annotation.Required; -//JDK imports import java.io.File; import java.util.Collections; import java.util.List; import java.util.Vector; import java.util.logging.Level; +import static org.apache.oodt.cas.crawl.AutoDetectProductCrawler.MIME_TYPES_HIERARCHY; + +//Apache imports +//OODT imports +//JDK imports //Spring imports -import org.springframework.beans.factory.annotation.Required; /** * Calls a {@link CrawlerAction} if this {@link File} matches the specified set @@ -54,9 +53,8 @@ public class MimeTypeCrawlerAction extends CrawlerAction { .getAllMetadata(MIME_TYPES_HIERARCHY); if (mimeTypeHierarchy == null) mimeTypeHierarchy = new Vector<String>(); - if (mimeTypes == null - || (mimeTypes != null && !Collections.disjoint(mimeTypes, - mimeTypeHierarchy))) { + if (mimeTypes == null || (!Collections.disjoint(mimeTypes, + mimeTypeHierarchy))) { return this.actionToCall.performAction(product, productMetadata); } else { LOG.log(Level.INFO, "Skipping action (id = " + this.getId() @@ -88,7 +86,7 @@ public class MimeTypeCrawlerAction extends CrawlerAction { return mimeTypes; } - public void setMimeTypes(List<String> mimeTypes) { + public void asetMimeTypes(List<String> mimeTypes) { this.mimeTypes = mimeTypes; } } http://git-wip-us.apache.org/repos/asf/oodt/blob/0a3ff32c/curator/services/src/main/java/org/apache/oodt/cas/curation/service/PolicyResource.java ---------------------------------------------------------------------- diff --git a/curator/services/src/main/java/org/apache/oodt/cas/curation/service/PolicyResource.java b/curator/services/src/main/java/org/apache/oodt/cas/curation/service/PolicyResource.java index ff98753..0fa980a 100644 --- a/curator/services/src/main/java/org/apache/oodt/cas/curation/service/PolicyResource.java +++ b/curator/services/src/main/java/org/apache/oodt/cas/curation/service/PolicyResource.java @@ -19,6 +19,8 @@ package org.apache.oodt.cas.curation.service; //OODT imports +import net.sf.json.JSONObject; + import org.apache.commons.lang.StringEscapeUtils; import org.apache.oodt.cas.filemgr.repository.XMLRepositoryManager; import org.apache.oodt.cas.filemgr.structs.Product; @@ -27,33 +29,24 @@ import org.apache.oodt.cas.filemgr.structs.ProductType; import org.apache.oodt.cas.filemgr.structs.Query; import org.apache.oodt.cas.filemgr.structs.exceptions.RepositoryManagerException; -//JDK imports import java.io.File; import java.io.FilenameFilter; import java.io.IOException; import java.net.MalformedURLException; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Vector; +import java.util.*; import java.util.logging.Level; import java.util.logging.Logger; -//JAX-RS imports import javax.servlet.ServletContext; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import javax.ws.rs.DefaultValue; -import javax.ws.rs.GET; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; +import javax.ws.rs.*; import javax.ws.rs.core.Context; import javax.ws.rs.core.UriInfo; +//JDK imports +//JAX-RS imports //JSON imports -import net.sf.json.JSONObject; @Path("policy") public class PolicyResource extends CurationService { @@ -124,9 +117,9 @@ public class PolicyResource extends CurationService { ProductType productType; ProductPage page; try { - productType = this.config.getFileManagerClient().getProductTypeByName( + productType = config.getFileManagerClient().getProductTypeByName( productTypeName); - page = this.config.getFileManagerClient().pagedQuery(new Query(), + page = config.getFileManagerClient().pagedQuery(new Query(), productType, pageNum); } catch (Exception e) { e.printStackTrace(); @@ -146,7 +139,7 @@ public class PolicyResource extends CurationService { private String encodeProductsAsHTML(ProductPage page, String policy, String productTypeName) { - StringBuffer html = new StringBuffer(); + StringBuilder html = new StringBuilder(); html.append("<ul class=\"fileTree\" >\r\n"); for (Product product : page.getPageProducts()) { http://git-wip-us.apache.org/repos/asf/oodt/blob/0a3ff32c/curator/webapp/src/main/java/org/apache/oodt/cas/curation/CurationApp.java ---------------------------------------------------------------------- diff --git a/curator/webapp/src/main/java/org/apache/oodt/cas/curation/CurationApp.java b/curator/webapp/src/main/java/org/apache/oodt/cas/curation/CurationApp.java index 2a27b81..2decb08 100644 --- a/curator/webapp/src/main/java/org/apache/oodt/cas/curation/CurationApp.java +++ b/curator/webapp/src/main/java/org/apache/oodt/cas/curation/CurationApp.java @@ -17,22 +17,18 @@ package org.apache.oodt.cas.curation; -import java.util.HashSet; -import java.util.Set; -import java.util.logging.Level; -import java.util.logging.Logger; - import org.apache.oodt.cas.curation.login.LoginPage; import org.apache.oodt.cas.webcomponents.curation.workbench.Workbench; -import org.apache.wicket.Page; -import org.apache.wicket.Request; -import org.apache.wicket.ResourceReference; -import org.apache.wicket.Response; -import org.apache.wicket.Session; +import org.apache.wicket.*; import org.apache.wicket.protocol.http.WebApplication; import org.apache.wicket.request.target.coding.MixedParamUrlCodingStrategy; import org.apache.wicket.util.file.File; +import java.util.HashSet; +import java.util.Set; +import java.util.logging.Level; +import java.util.logging.Logger; + public class CurationApp extends WebApplication { private static final Logger LOG = Logger.getLogger(CurationApp.class @@ -59,8 +55,8 @@ public class CurationApp extends WebApplication { Set<String> localResources = Workbench.getImageFiles(localPath); benchResources = filterBenchResources(benchResources, localResources, localPath); - doImageMounts(benchResources, (Class<?>) Workbench.class); - doImageMounts(localResources, (Class<?>) HomePage.class); + doImageMounts(benchResources, Workbench.class); + doImageMounts(localResources, HomePage.class); MixedParamUrlCodingStrategy loginPageMount = new MixedParamUrlCodingStrategy( "auth", LoginPage.class, new String[] { "action" }); @@ -113,9 +109,9 @@ public class CurationApp extends WebApplication { private Set<String> filterBenchResources(Set<String> bench, Set<String> local, String localPrefix) { - if (local == null || (local != null && local.size() == 0)) + if (local == null || (local.size() == 0)) return bench; - if (bench == null || (bench != null && bench.size() == 0)) + if (bench == null || (bench.size() == 0)) return bench; Set<String> filtered = new HashSet<String>(); for (String bResource : bench) { http://git-wip-us.apache.org/repos/asf/oodt/blob/0a3ff32c/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 574b7e9..c3ce8e2 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 @@ -404,7 +404,6 @@ public class LuceneCatalog implements Catalog { searcher.close(); } catch (Exception ignore) { } - searcher = null; } } } @@ -454,7 +453,6 @@ public class LuceneCatalog implements Catalog { searcher.close(); } catch (Exception ignore) { } - searcher = null; } } } @@ -520,7 +518,6 @@ public class LuceneCatalog implements Catalog { searcher.close(); } catch (Exception ignore) { } - searcher = null; } } @@ -578,7 +575,6 @@ public class LuceneCatalog implements Catalog { searcher.close(); } catch (Exception ignore) { } - searcher = null; } } @@ -616,7 +612,6 @@ public class LuceneCatalog implements Catalog { searcher.close(); } catch (Exception ignore) { } - searcher = null; } } } @@ -646,8 +641,7 @@ public class LuceneCatalog implements Catalog { if (fullProducts != null && fullProducts.size() > 0) { productIds = new Vector<String>(fullProducts.size()); - for (Iterator<Product> i = fullProducts.iterator(); i.hasNext();) { - Product p = i.next(); + for (Product p : fullProducts) { productIds.add(p.getProductId()); } } @@ -703,7 +697,6 @@ public class LuceneCatalog implements Catalog { searcher.close(); } catch (Exception ignore) { } - searcher = null; } } @@ -764,7 +757,7 @@ public class LuceneCatalog implements Catalog { */ public ProductPage getFirstPage(ProductType type) { ProductPage firstPage = new ProductPage(); - List<Product> products = null; + List<Product> products; Query query = new Query(); // now construct the page @@ -780,7 +773,7 @@ public class LuceneCatalog implements Catalog { return null; } // There are no products and thus no first page - if (products == null || (products != null && products.size() == 0)) { + if (products == null || (products.size() == 0)) { return null; } @@ -797,7 +790,7 @@ public class LuceneCatalog implements Catalog { public ProductPage getLastProductPage(ProductType type) { ProductPage lastPage = new ProductPage(); ProductPage firstPage = getFirstPage(type); - List<Product> products = null; + List<Product> products; Query query = new Query(); // now construct the page @@ -813,7 +806,7 @@ public class LuceneCatalog implements Catalog { return null; } // There are no products thus there is no last page - if (products == null || (products != null && products.size() == 0)) { + if (products == null || (products.size() == 0)) { return null; } lastPage.setPageProducts(products); @@ -839,7 +832,7 @@ public class LuceneCatalog implements Catalog { return currentPage; } - List<Product> products = null; + List<Product> products; ProductPage nextPage = new ProductPage(); Query query = new Query(); @@ -856,7 +849,7 @@ public class LuceneCatalog implements Catalog { return null; } // There are no products and thus no next page - if (products == null || (products != null && products.size() == 0)) { + if (products == null || (products.size() == 0)) { return null; } nextPage.setPageProducts(products); @@ -882,12 +875,12 @@ public class LuceneCatalog implements Catalog { if (currentPage.isFirstPage()) { return currentPage; } - List<Product> products = null; - ProductPage prevPage = new ProductPage(); + List<Product> products; + Query query = new Query(); // now construct the page - prevPage = new ProductPage(); + ProductPage prevPage = new ProductPage(); prevPage.setPageNum(currentPage.getPageNum() - 1); prevPage.setPageSize(pageSize); try { @@ -901,7 +894,7 @@ public class LuceneCatalog implements Catalog { } // There are no products and thus no pages - if (products == null || (products != null && products.size() == 0)) { + if (products == null || (products.size() == 0)) { return null; } prevPage.setPageProducts(products); @@ -956,7 +949,6 @@ public class LuceneCatalog implements Catalog { } catch (Exception ignore) { } - reader = null; } } @@ -968,7 +960,7 @@ public class LuceneCatalog implements Catalog { File indexDir = new File(indexFilePath); - boolean createIndex = false; + boolean createIndex; if (indexDir.exists() && indexDir.isDirectory()) { createIndex = false; @@ -996,10 +988,11 @@ public class LuceneCatalog implements Catalog { + e.getMessage()); } finally { try { - writer.close(); + if (writer != null) { + writer.close(); + } } catch (Exception ignore) { } - writer = null; } } @@ -1143,11 +1136,10 @@ public class LuceneCatalog implements Catalog { // validation layer: add only specifically configured keys if (valLayer!=null) { List<Element> elements = quietGetElements(product.getProductType()); - for (Iterator<Element> i = elements.iterator(); i.hasNext();) { - Element element = i.next(); + for (Element element : elements) { String key = element.getElementName(); keys.add(key); - } + } // no validation layer: add all keys that are NOT already in doc // (otherwise some keys such as the product_* keys are duplicated) } else { @@ -1174,10 +1166,9 @@ public class LuceneCatalog implements Catalog { continue; } - for (Iterator<String> j = values.iterator(); j.hasNext();) { - String val = j.next(); + for (String val : values) { doc.add(new Field(key, val, Field.Store.YES, - Field.Index.UN_TOKENIZED)); + Field.Index.UN_TOKENIZED)); } } @@ -1210,11 +1201,10 @@ public class LuceneCatalog implements Catalog { if (cp.getMetadata() != null && cp.getProduct() != null) { if (cp.getReferences() != null && cp.getReferences().size() > 0) { // make sure there is a data store ref for each of the refs - for (Iterator<Reference> i = cp.getReferences().iterator(); i.hasNext();) { - Reference r = i.next(); + for (Reference r : cp.getReferences()) { if (r.getDataStoreReference() == null - || (r.getDataStoreReference() != null && r - .getDataStoreReference().equals(""))) { + || (r.getDataStoreReference() != null && r + .getDataStoreReference().equals(""))) { return false; } } @@ -1264,7 +1254,6 @@ public class LuceneCatalog implements Catalog { searcher.close(); } catch (Exception ignore) { } - searcher = null; } } @@ -1353,7 +1342,6 @@ public class LuceneCatalog implements Catalog { searcher.close(); } catch (Exception ignore) { } - searcher = null; } } @@ -1363,7 +1351,7 @@ public class LuceneCatalog implements Catalog { private org.apache.lucene.search.Query getQuery(QueryCriteria queryCriteria) throws CatalogException { if (queryCriteria instanceof BooleanQueryCriteria) { BooleanQuery booleanQuery = new BooleanQuery(); - BooleanClause.Occur occur = null; + BooleanClause.Occur occur; switch (((BooleanQueryCriteria) queryCriteria).getOperator()) { case BooleanQueryCriteria.AND: occur = BooleanClause.Occur.MUST; http://git-wip-us.apache.org/repos/asf/oodt/blob/0a3ff32c/filemgr/src/main/java/org/apache/oodt/cas/filemgr/datatransfer/LocalDataTransferer.java ---------------------------------------------------------------------- diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/datatransfer/LocalDataTransferer.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/datatransfer/LocalDataTransferer.java index a385e91..5ea4edb 100644 --- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/datatransfer/LocalDataTransferer.java +++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/datatransfer/LocalDataTransferer.java @@ -19,30 +19,29 @@ package org.apache.oodt.cas.filemgr.datatransfer; //APACHE Imports import org.apache.commons.io.FileUtils; - -//OODT 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.DataTransferException; import org.apache.oodt.cas.filemgr.structs.exceptions.ConnectionException; -import org.apache.oodt.cas.filemgr.versioning.VersioningUtils; +import org.apache.oodt.cas.filemgr.structs.exceptions.DataTransferException; import org.apache.oodt.cas.filemgr.system.XmlRpcFileManagerClient; +import org.apache.oodt.cas.filemgr.versioning.VersioningUtils; import org.apache.tika.mime.MimeTypeException; import org.apache.tika.mime.MimeTypes; import org.apache.tika.mime.MimeTypesFactory; -//JDK imports -import java.io.IOException; import java.io.File; -import java.util.List; -import java.util.Iterator; -import java.util.Vector; -import java.util.logging.Logger; -import java.util.logging.Level; +import java.io.IOException; import java.net.URI; +import java.net.URISyntaxException; import java.net.URL; import java.net.URLEncoder; -import java.net.URISyntaxException; +import java.util.List; +import java.util.Vector; +import java.util.logging.Level; +import java.util.logging.Logger; + +//OODT imports +//JDK imports /** * @author mattmann @@ -108,7 +107,7 @@ public class LocalDataTransferer implements DataTransfer { LOG.log( Level.WARNING, "URI Syntax Exception when moving dir " - + ((Reference) product.getProductReferences().get(0)) + + product.getProductReferences().get(0) .getOrigReference() + ": Message: " + e.getMessage()); throw new DataTransferException(e); @@ -150,7 +149,7 @@ public class LocalDataTransferer implements DataTransfer { LOG.log( Level.WARNING, "URI Syntax Exception when moving dir " - + ((Reference) product.getProductReferences().get(0)) + + product.getProductReferences().get(0) .getDataStoreReference() + ": Message: " + e.getMessage()); throw new DataTransferException(e); @@ -235,11 +234,10 @@ public class LocalDataTransferer implements DataTransfer { } } - if (transferType == null - || (transferType != null && ((transferType.equals("dir") && dirReference == null) - || (transferType.equals("files") && fileReferences == null) - || (transferType != null && !(transferType.equals("dir") || transferType - .equals("files"))) || productName == null || productRepo == null))) { + if (transferType == null || (((transferType.equals("dir") && dirReference == null) || ( + transferType.equals("files") && fileReferences == null) || (!( + transferType.equals("dir") || transferType + .equals("files"))) || productName == null || productRepo == null))) { System.err.println(usage); System.exit(1); } @@ -274,48 +272,45 @@ public class LocalDataTransferer implements DataTransfer { private void copyDirToDir(Product product, File directory) throws IOException, URISyntaxException { - Reference dirRef = (Reference) product.getProductReferences().get(0); + Reference dirRef = product.getProductReferences().get(0); LOG.log( Level.INFO, "LocalDataTransferer: Staging Directory: " + dirRef.getDataStoreReference() + " into directory " + directory.getAbsolutePath()); - for (Iterator<Reference> i = product.getProductReferences().iterator(); i - .hasNext();) { - Reference r = i.next(); - File fileRef = new File(new URI(r.getDataStoreReference())); - - if (fileRef.isFile()) { - copyFile(r, directory); - } else if (fileRef.isDirectory() - && (fileRef.list() != null && fileRef.list().length == 0)) { - // if it's a directory and it doesn't exist yet, we should - // create it - // just in case there's no files in it - File dest = new File(directory, fileRef.getName()); - if (!new File(new URI(dest.getAbsolutePath())).exists()) { - LOG.log(Level.FINER, "Directory: [" + dest.getAbsolutePath() - + "] doesn't exist: creating it"); - try { - FileUtils.forceMkdir(new File(new URI(dest.getAbsolutePath()))); - } - catch(IOException e){ - LOG.log( - Level.WARNING, - "Unable to create directory: [" - + dest.getAbsolutePath() - + "] in local data transferer"); - - } - } + for (Reference r : product.getProductReferences()) { + File fileRef = new File(new URI(r.getDataStoreReference())); + + if (fileRef.isFile()) { + copyFile(r, directory); + } else if (fileRef.isDirectory() + && (fileRef.list() != null && fileRef.list().length == 0)) { + // if it's a directory and it doesn't exist yet, we should + // create it + // just in case there's no files in it + File dest = new File(directory, fileRef.getName()); + if (!new File(new URI(dest.getAbsolutePath())).exists()) { + LOG.log(Level.FINER, "Directory: [" + dest.getAbsolutePath() + + "] doesn't exist: creating it"); + try { + FileUtils.forceMkdir(new File(new URI(dest.getAbsolutePath()))); + } catch (IOException e) { + LOG.log( + Level.WARNING, + "Unable to create directory: [" + + dest.getAbsolutePath() + + "] in local data transferer"); + + } } - } + } + } } private void moveDirToProductRepo(Product product) throws IOException, URISyntaxException { - Reference dirRef = (Reference) product.getProductReferences().get(0); + Reference dirRef = product.getProductReferences().get(0); LOG.log( Level.INFO, "LocalDataTransferer: Moving Directory: " @@ -325,34 +320,31 @@ public class LocalDataTransferer implements DataTransfer { // notify the file manager that we started quietNotifyTransferProduct(product); - for (Iterator<Reference> i = product.getProductReferences().iterator(); i - .hasNext();) { - Reference r = i.next(); - File fileRef = new File(new URI(r.getOrigReference())); - - if (fileRef.isFile()) { - moveFile(r, false); - } else if (fileRef.isDirectory() - && (fileRef.list() != null && fileRef.list().length == 0)) { - // if it's a directory and it doesn't exist yet, we should - // create it - // just in case there's no files in it - if (!new File(new URI(r.getDataStoreReference())).exists()) { - LOG.log(Level.FINER, "Directory: [" + r.getDataStoreReference() - + "] doesn't exist: creating it"); - try { - FileUtils.forceMkdir(new File(new URI(r.getDataStoreReference()))); - } - catch(IOException e){ - LOG.log( - Level.WARNING, - "Unable to create directory: [" - + r.getDataStoreReference() - + "] in local data transferer"); - } - } + for (Reference r : product.getProductReferences()) { + File fileRef = new File(new URI(r.getOrigReference())); + + if (fileRef.isFile()) { + moveFile(r, false); + } else if (fileRef.isDirectory() + && (fileRef.list() != null && fileRef.list().length == 0)) { + // if it's a directory and it doesn't exist yet, we should + // create it + // just in case there's no files in it + if (!new File(new URI(r.getDataStoreReference())).exists()) { + LOG.log(Level.FINER, "Directory: [" + r.getDataStoreReference() + + "] doesn't exist: creating it"); + try { + FileUtils.forceMkdir(new File(new URI(r.getDataStoreReference()))); + } catch (IOException e) { + LOG.log( + Level.WARNING, + "Unable to create directory: [" + + r.getDataStoreReference() + + "] in local data transferer"); + } } - } + } + } // notify the file manager that we're done quietNotifyProductTransferComplete(product); @@ -366,10 +358,9 @@ public class LocalDataTransferer implements DataTransfer { // notify the file manager that we started quietNotifyTransferProduct(product); - for (Iterator<Reference> i = refs.iterator(); i.hasNext();) { - Reference r = (Reference) i.next(); - moveFile(r, true); - } + for (Reference r : refs) { + moveFile(r, true); + } // notify the file manager that we're done quietNotifyProductTransferComplete(product); @@ -378,10 +369,9 @@ public class LocalDataTransferer implements DataTransfer { private void copyFilesToDir(Product product, File directory) throws IOException, URISyntaxException { List<Reference> refs = product.getProductReferences(); - for (Iterator<Reference> i = refs.iterator(); i.hasNext();) { - Reference r = (Reference) i.next(); - copyFile(r, directory); - } + for (Reference r : refs) { + copyFile(r, directory); + } } private void moveFile(Reference r, boolean log) throws IOException, @@ -421,7 +411,6 @@ public class LocalDataTransferer implements DataTransfer { LOG.log(Level.WARNING, "Error notifying file manager of product transfer initiation for product: [" + p.getProductId() + "]: Message: " + e.getMessage()); - return; } } @@ -439,7 +428,6 @@ public class LocalDataTransferer implements DataTransfer { LOG.log(Level.WARNING, "Error notifying file manager of product transfer completion for product: [" + p.getProductId() + "]: Message: " + e.getMessage()); - return; } } } http://git-wip-us.apache.org/repos/asf/oodt/blob/0a3ff32c/filemgr/src/main/java/org/apache/oodt/cas/filemgr/ingest/LocalCache.java ---------------------------------------------------------------------- diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/ingest/LocalCache.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/ingest/LocalCache.java index 795ac36..a4c56b1 100644 --- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/ingest/LocalCache.java +++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/ingest/LocalCache.java @@ -67,7 +67,6 @@ public class LocalCache implements Cache { /** * * @param fmUrl - * @param uniqueElementName * @param rangeQueryElementName * @param startOfQuery * @param endOfQuery @@ -82,7 +81,6 @@ public class LocalCache implements Cache { * * @param fmUrl * @param uniqueElementName - * @param uniqueElementProductType * @param rangeQueryElementName * @param startOfQuery * @param endOfQuery @@ -125,9 +123,7 @@ public class LocalCache implements Cache { this.rangeQueryElementName, productType, this.startOfQuery, this.endOfQuery)); clear(); - for (Iterator<Product> i = products.iterator(); i.hasNext();) { - Product product = i.next(); - + for (Product product : products) { String value = getValueForMetadata(product, uniqueElementName); this.uniqueElements.add(value); } @@ -185,9 +181,8 @@ public class LocalCache implements Cache { * @see org.apache.oodt.cas.filemgr.ingest.Cache#sync() */ public void sync() throws CacheException { - if (this.uniqueElementName == null - || (this.uniqueElementProductTypeNames == null || - (this.uniqueElementProductTypeNames != null && this.uniqueElementProductTypeNames.size() == 0))) { + if (this.uniqueElementName == null || (this.uniqueElementProductTypeNames == null || ( + this.uniqueElementProductTypeNames.size() == 0))) { throw new CacheException( "Both uniqueElementName and uniqueElementProductTypeName must " + "be defined in order to use this form of the sync operation!"); @@ -278,8 +273,7 @@ public class LocalCache implements Cache { startOfQuery, endOfQuery)); if(this.uniqueElementProductTypeNames != null && this.uniqueElementProductTypeNames.size() > 0){ - for(Iterator<String> i = this.uniqueElementProductTypeNames.iterator(); i.hasNext(); ){ - String productTypeName = i.next(); + for (String productTypeName : this.uniqueElementProductTypeNames) { products.addAll(getProducts(query, productTypeName)); } http://git-wip-us.apache.org/repos/asf/oodt/blob/0a3ff32c/filemgr/src/main/java/org/apache/oodt/cas/filemgr/ingest/RmiCacheServer.java ---------------------------------------------------------------------- diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/ingest/RmiCacheServer.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/ingest/RmiCacheServer.java index f34f0c6..8d4ab10 100644 --- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/ingest/RmiCacheServer.java +++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/ingest/RmiCacheServer.java @@ -121,9 +121,9 @@ public class RmiCacheServer extends UnicastRemoteObject implements RemoteableCac } public void sync() throws RemoteException { - if (this.uniqueElementName == null - || (this.uniqueElementProductTypeNames == null || (this.uniqueElementProductTypeNames != null && this.uniqueElementProductTypeNames - .size() == 0))) { + if (this.uniqueElementName == null || (this.uniqueElementProductTypeNames == null || ( + this.uniqueElementProductTypeNames + .size() == 0))) { throw new RemoteException( "Both uniqueElementName and uniqueElementProductTypeNames must " + "be defined in order to use this form of the sync operation!"); http://git-wip-us.apache.org/repos/asf/oodt/blob/0a3ff32c/filemgr/src/main/java/org/apache/oodt/cas/filemgr/metadata/extractors/CoreMetExtractor.java ---------------------------------------------------------------------- diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/metadata/extractors/CoreMetExtractor.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/metadata/extractors/CoreMetExtractor.java index e58af79..93daa83 100644 --- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/metadata/extractors/CoreMetExtractor.java +++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/metadata/extractors/CoreMetExtractor.java @@ -109,7 +109,7 @@ public class CoreMetExtractor extends AbstractFilemgrMetExtractor implements public void doConfigure() { if (this.configuration != null) { namespaceAware = Boolean.valueOf( - this.configuration.getProperty("nsAware")).booleanValue(); + this.configuration.getProperty("nsAware")); if (namespaceAware) { elementNs = this.configuration.getProperty("elementNs"); @@ -121,13 +121,9 @@ public class CoreMetExtractor extends AbstractFilemgrMetExtractor implements } private boolean isNsReplace(String elemName) { - if (this.nsReplaceElements == null - || (this.nsReplaceElements != null && this.nsReplaceElements - .size() == 0)) { - return false; - } + return !(this.nsReplaceElements == null || (this.nsReplaceElements.size() == 0)) && namespaceAware + && this.nsReplaceElements.contains(elemName); - return namespaceAware && this.nsReplaceElements.contains(elemName); } } http://git-wip-us.apache.org/repos/asf/oodt/blob/0a3ff32c/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/Reference.java ---------------------------------------------------------------------- diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/Reference.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/Reference.java index 702eb78..7e7c246 100644 --- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/Reference.java +++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/Reference.java @@ -209,8 +209,7 @@ public class Reference { * the String name of the mimetype of this reference */ public void setMimeType(String name) { - if(name == null || (name != null && - name.equals(""))) return; + if(name == null || (name.equals(""))) return; try { this.mimeType = mimeTypeRepository.forName(name); @@ -225,17 +224,8 @@ public class Reference { * @see java.lang.Object#toString() */ public String toString() { - StringBuffer buf = new StringBuffer(); - buf.append("[orig="); - buf.append(this.origReference); - buf.append(",dest="); - buf.append(this.dataStoreReference); - buf.append(",size="); - buf.append(this.fileSize); - buf.append(",mime="); - buf.append(this.mimeType != null ? this.mimeType.toString() : "N/A"); - buf.append("]"); - return buf.toString(); + return "[orig=" + this.origReference + ",dest=" + this.dataStoreReference + ",size=" + this.fileSize + ",mime=" + + (this.mimeType != null ? this.mimeType.toString() : "N/A") + "]"; } } http://git-wip-us.apache.org/repos/asf/oodt/blob/0a3ff32c/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/XmlRpcFileManager.java ---------------------------------------------------------------------- diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/XmlRpcFileManager.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/XmlRpcFileManager.java index 2338547..9cdd3f9 100644 --- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/XmlRpcFileManager.java +++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/XmlRpcFileManager.java @@ -18,30 +18,16 @@ package org.apache.oodt.cas.filemgr.system; //APACHE imports -import org.apache.xmlrpc.WebServer; +import com.google.common.collect.Lists; -//OODT imports -import org.apache.oodt.cas.metadata.Metadata; -import org.apache.oodt.cas.metadata.exceptions.MetExtractionException; -import org.apache.oodt.commons.date.DateUtils; import org.apache.oodt.cas.filemgr.catalog.Catalog; +import org.apache.oodt.cas.filemgr.datatransfer.DataTransfer; +import org.apache.oodt.cas.filemgr.datatransfer.TransferStatusTracker; import org.apache.oodt.cas.filemgr.metadata.ProductMetKeys; import org.apache.oodt.cas.filemgr.metadata.extractors.FilemgrMetExtractor; import org.apache.oodt.cas.filemgr.repository.RepositoryManager; -import org.apache.oodt.cas.filemgr.structs.Element; -import org.apache.oodt.cas.filemgr.structs.ExtractorSpec; -import org.apache.oodt.cas.filemgr.structs.FileTransferStatus; -import org.apache.oodt.cas.filemgr.structs.ProductPage; -import org.apache.oodt.cas.filemgr.structs.ProductType; -import org.apache.oodt.cas.filemgr.structs.Product; -import org.apache.oodt.cas.filemgr.structs.Query; -import org.apache.oodt.cas.filemgr.structs.Reference; -import org.apache.oodt.cas.filemgr.structs.exceptions.CatalogException; -import org.apache.oodt.cas.filemgr.structs.exceptions.QueryFormulationException; -import org.apache.oodt.cas.filemgr.structs.exceptions.RepositoryManagerException; -import org.apache.oodt.cas.filemgr.structs.exceptions.DataTransferException; -import org.apache.oodt.cas.filemgr.structs.exceptions.ValidationLayerException; -import org.apache.oodt.cas.filemgr.structs.exceptions.VersioningException; +import org.apache.oodt.cas.filemgr.structs.*; +import org.apache.oodt.cas.filemgr.structs.exceptions.*; import org.apache.oodt.cas.filemgr.structs.query.ComplexQuery; import org.apache.oodt.cas.filemgr.structs.query.QueryFilter; import org.apache.oodt.cas.filemgr.structs.query.QueryResult; @@ -49,35 +35,25 @@ import org.apache.oodt.cas.filemgr.structs.query.QueryResultComparator; import org.apache.oodt.cas.filemgr.structs.query.filter.ObjectTimeEvent; import org.apache.oodt.cas.filemgr.structs.query.filter.TimeEvent; import org.apache.oodt.cas.filemgr.structs.type.TypeHandler; -import org.apache.oodt.cas.filemgr.datatransfer.DataTransfer; import org.apache.oodt.cas.filemgr.util.GenericFileManagerObjectFactory; import org.apache.oodt.cas.filemgr.util.XmlRpcStructFactory; import org.apache.oodt.cas.filemgr.versioning.Versioner; import org.apache.oodt.cas.filemgr.versioning.VersioningUtils; -import org.apache.oodt.cas.filemgr.datatransfer.TransferStatusTracker; - -import com.google.common.collect.Lists; - - - +import org.apache.oodt.cas.metadata.Metadata; +import org.apache.oodt.cas.metadata.exceptions.MetExtractionException; +import org.apache.oodt.commons.date.DateUtils; +import org.apache.xmlrpc.WebServer; -//JDK imports -import java.util.logging.Level; -import java.util.logging.Logger; -import java.util.Arrays; -import java.util.Hashtable; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Vector; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.FileNotFoundException; +import java.io.*; import java.net.URI; import java.net.URISyntaxException; import java.net.URL; +import java.util.*; +import java.util.logging.Level; +import java.util.logging.Logger; + +//OODT imports +//JDK imports /** * @author mattmann @@ -193,8 +169,7 @@ public class XmlRpcFileManager { public double getProductPctTransferred(Hashtable<String, Object> productHash) { Product product = XmlRpcStructFactory.getProductFromXmlRpc(productHash); - double pct = transferStatusTracker.getPctTransferred(product); - return pct; + return transferStatusTracker.getPctTransferred(product); } public double getRefPctTransferred(Hashtable<String, Object> refHash) { @@ -233,7 +208,7 @@ public class XmlRpcFileManager { .getProductTypeFromXmlRpc(productTypeHash); Query query = XmlRpcStructFactory.getQueryFromXmlRpc(queryHash); - ProductPage prodPage = null; + ProductPage prodPage; try { prodPage = catalog.pagedQuery(this.getCatalogQuery(query, type), type, pageNum); @@ -364,7 +339,7 @@ public class XmlRpcFileManager { public Vector<Hashtable<String, Object>> getTopNProducts(int n) throws CatalogException { - List<Product> topNProducts = null; + List<Product> topNProducts; try { topNProducts = catalog.getTopNProducts(n); @@ -383,7 +358,7 @@ public class XmlRpcFileManager { throws CatalogException { ProductType type = XmlRpcStructFactory .getProductTypeFromXmlRpc(productTypeHash); - List<Product> topNProducts = null; + List<Product> topNProducts; try { topNProducts = catalog.getTopNProducts(n, type); @@ -516,7 +491,7 @@ public class XmlRpcFileManager { throws CatalogException { ProductType type = XmlRpcStructFactory .getProductTypeFromXmlRpc(productTypeHash); - List<Product> productList = null; + List<Product> productList; try { productList = catalog.getProductsByProductType(type); @@ -552,7 +527,7 @@ public class XmlRpcFileManager { public Hashtable<String, Object> getElementById(String elementId) throws ValidationLayerException { - Element element = null; + Element element; try { element = catalog.getValidationLayer().getElementById(elementId); @@ -567,7 +542,7 @@ public class XmlRpcFileManager { public Hashtable<String, Object> getElementByName(String elementName) throws ValidationLayerException { - Element element = null; + Element element; try { element = catalog.getValidationLayer() @@ -588,7 +563,7 @@ public class XmlRpcFileManager { .getComplexQueryFromXmlRpc(complexQueryHash); // get ProductTypes - List<ProductType> productTypes = null; + List<ProductType> productTypes; if (complexQuery.getReducedProductTypeNames() == null) { productTypes = this.repositoryManager.getProductTypes(); } else { @@ -722,8 +697,7 @@ public class XmlRpcFileManager { Metadata expandedMetdata = addMetadata(p, m); // version the product - if (!clientTransfer || (clientTransfer - && Boolean.getBoolean("org.apache.oodt.cas.filemgr.serverside.versioning"))) { + if (!clientTransfer || (Boolean.getBoolean("org.apache.oodt.cas.filemgr.serverside.versioning"))) { Versioner versioner = null; try { versioner = GenericFileManagerObjectFactory @@ -801,7 +775,7 @@ public class XmlRpcFileManager { + "' bytes from file '" + filePath + "' at index '" + offset + "' : " + e.getMessage(), e); } finally { - try { is.close(); } catch (Exception e) {} + try { is.close(); } catch (Exception ignored) {} } } @@ -850,14 +824,12 @@ public class XmlRpcFileManager { + filePath + ": Message: " + e.getMessage()); success = false; } finally { - if (fOut != null) { - try { - fOut.close(); - } catch (Exception ignore) { - } + try { + fOut.close(); + } catch (Exception ignore) { + } - fOut = null; - } + fOut = null; } } @@ -873,16 +845,14 @@ public class XmlRpcFileManager { // first thing we care about is if the product is flat or heirarchical if (p.getProductStructure().equals(Product.STRUCTURE_FLAT)) { // we just need to get its first reference - if (p.getProductReferences() == null - || (p.getProductReferences() != null && p - .getProductReferences().size() != 1)) { + if (p.getProductReferences() == null || (p.getProductReferences().size() != 1)) { throw new DataTransferException( "Flat products must have a single reference: cannot move"); } // okay, it's fine to move it // first, we need to update the data store ref - Reference r = (Reference) p.getProductReferences().get(0); + Reference r = p.getProductReferences().get(0); if (r.getDataStoreReference().equals( new File(newPath).toURI().toString())) { throw new DataTransferException("cannot move product: [" @@ -1102,8 +1072,10 @@ public class XmlRpcFileManager { for (ExtractorSpec spec: product.getProductType().getExtractors()) { FilemgrMetExtractor extractor = GenericFileManagerObjectFactory .getExtractorFromClassName(spec.getClassName()); + if (extractor != null) { extractor.configure(spec.getConfiguration()); - LOG.log(Level.INFO, "Running Met Extractor: [" + } + LOG.log(Level.INFO, "Running Met Extractor: [" + extractor.getClass().getName() + "] for product type: [" + product.getProductType().getName() + "]"); @@ -1131,15 +1103,14 @@ public class XmlRpcFileManager { private void setProductType(List<Product> products) throws Exception { if (products != null && products.size() > 0) { - for (Iterator<Product> i = products.iterator(); i.hasNext();) { - Product p = i.next(); - try { - p.setProductType(repositoryManager.getProductTypeById(p - .getProductType().getProductTypeId())); - } catch (RepositoryManagerException e) { - throw new Exception(e.getMessage()); - } + for (Product p : products) { + try { + p.setProductType(repositoryManager.getProductTypeById(p + .getProductType().getProductTypeId())); + } catch (RepositoryManagerException e) { + throw new Exception(e.getMessage()); } + } } } @@ -1152,18 +1123,17 @@ public class XmlRpcFileManager { if (productIdList != null && productIdList.size() > 0) { productList = new Vector<Product>(productIdList.size()); - for (Iterator<String> i = productIdList.iterator(); i.hasNext();) { - String productId = i.next(); - Product product = catalog.getProductById(productId); - // it is possible here that the underlying catalog did not - // set the ProductType - // to obey the contract of the File Manager, we need to make - // sure its set here - product.setProductType(this.repositoryManager - .getProductTypeById(product.getProductType() - .getProductTypeId())); - productList.add(product); - } + for (String productId : productIdList) { + Product product = catalog.getProductById(productId); + // it is possible here that the underlying catalog did not + // set the ProductType + // to obey the contract of the File Manager, we need to make + // sure its set here + product.setProductType(this.repositoryManager + .getProductTypeById(product.getProductType() + .getProductTypeId())); + productList.add(product); + } return productList; } else { return new Vector<Product>(); // null values not supported by XML-RPC @@ -1179,7 +1149,7 @@ public class XmlRpcFileManager { private Metadata getReducedMetadata(Product product, List<String> elements) throws CatalogException { try { - Metadata m = null; + Metadata m; if (elements != null && elements.size() > 0) { m = catalog.getReducedMetadata(product, elements); }else { @@ -1229,9 +1199,9 @@ public class XmlRpcFileManager { List<TypeHandler> handlers = this.repositoryManager.getProductTypeById( productType.getProductTypeId()).getHandlers(); if (handlers != null) { - for (Iterator<TypeHandler> iter = handlers.iterator(); iter - .hasNext();) - iter.next().preAddMetadataHandle(metadata); + for (TypeHandler handler : handlers) { + handler.preAddMetadataHandle(metadata); + } } return metadata; } @@ -1241,9 +1211,9 @@ public class XmlRpcFileManager { List<TypeHandler> handlers = this.repositoryManager.getProductTypeById( productType.getProductTypeId()).getHandlers(); if (handlers != null) { - for (Iterator<TypeHandler> iter = handlers.iterator(); iter - .hasNext();) - iter.next().preQueryHandle(query); + for (TypeHandler handler : handlers) { + handler.preQueryHandle(query); + } } return query; } @@ -1306,7 +1276,7 @@ public class XmlRpcFileManager { List<Reference> refs = product.getProductReferences(); - if (refs == null || (refs != null && refs.size() == 0)) { + if (refs == null || (refs.size() == 0)) { refs = this.catalog.getProductReferences(product); } http://git-wip-us.apache.org/repos/asf/oodt/blob/0a3ff32c/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/ExpImpCatalog.java ---------------------------------------------------------------------- diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/ExpImpCatalog.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/ExpImpCatalog.java index 9d124c9..b41819e 100644 --- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/ExpImpCatalog.java +++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/ExpImpCatalog.java @@ -18,15 +18,6 @@ package org.apache.oodt.cas.filemgr.tools; // JDK imports -import java.io.File; -import java.net.URL; -import java.util.Iterator; -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.filemgr.catalog.Catalog; import org.apache.oodt.cas.filemgr.structs.Product; import org.apache.oodt.cas.filemgr.structs.ProductPage; @@ -37,6 +28,15 @@ import org.apache.oodt.cas.filemgr.system.XmlRpcFileManagerClient; import org.apache.oodt.cas.filemgr.util.GenericFileManagerObjectFactory; import org.apache.oodt.cas.metadata.Metadata; +import java.io.File; +import java.net.URL; +import java.util.List; +import java.util.Vector; +import java.util.logging.Level; +import java.util.logging.Logger; + +// OODT imports + /** * @author mattmann * @version $Revision$ @@ -159,17 +159,17 @@ public class ExpImpCatalog { // we'll use the get product page method for each product type // paginate through products using source product type - for (Iterator i = sourceProductTypes.iterator(); i.hasNext();) { - ProductType type = (ProductType) i.next(); - try { - exportTypeToDest(type); - } catch (Exception e) { - LOG.log(Level.WARNING, "Error exporting product type: [" - + type.getName() + "] from source to dest: Message: " - + e.getMessage(), e); - throw e; - } + for (Object sourceProductType : sourceProductTypes) { + ProductType type = (ProductType) sourceProductType; + try { + exportTypeToDest(type); + } catch (Exception e) { + LOG.log(Level.WARNING, "Error exporting product type: [" + + type.getName() + "] from source to dest: Message: " + + e.getMessage(), e); + throw e; } + } } @@ -208,97 +208,101 @@ public class ExpImpCatalog { private void exportProductsToDest(List products, ProductType type) throws Exception { if (products != null && products.size() > 0) { - for (Iterator i = products.iterator(); i.hasNext();) { - Product p = (Product) i.next(); - - if (ensureUnique) { - boolean hasProduct = safeHasProductTypeByName(p - .getProductName()); - if (hasProduct) { - LOG.log(Level.INFO, "Skipping product: [" - + p.getProductName() - + "]: ensure unique enabled: " - + "product exists in dest catalog"); - continue; - } - } - - p.setProductType(type); - if (sourceClient != null) { - p - .setProductReferences(sourceClient - .getProductReferences(p)); - } else - p.setProductReferences(srcCatalog.getProductReferences(p)); - - Metadata met = null; - - if (sourceClient != null) { - met = sourceClient.getMetadata(p); - } else { - met = srcCatalog.getMetadata(p); - } + for (Object product : products) { + Product p = (Product) product; + + if (ensureUnique) { + boolean hasProduct = safeHasProductTypeByName(p + .getProductName()); + if (hasProduct) { + LOG.log(Level.INFO, "Skipping product: [" + + p.getProductName() + + "]: ensure unique enabled: " + + "product exists in dest catalog"); + continue; + } + } - LOG - .log( - Level.INFO, - "Source Product: [" - + p.getProductName() - + "]: Met Extraction and " - + "Reference Extraction successful: writing to dest file manager"); - - // OODT-543 - if(sourceClient != null){ - // remove the default CAS fields for metadata - met.removeMetadata("CAS.ProductId"); - met.removeMetadata("CAS.ProductReceivedTime"); - met.removeMetadata("CAS.ProductName"); - } - - Product destProduct = new Product(); - // copy through - destProduct.setProductName(p.getProductName()); - destProduct.setProductStructure(p.getProductStructure()); - destProduct.setProductType((destClient != null) ? destClient - .getProductTypeById(type.getProductTypeId()) : type); - destProduct.setTransferStatus(p.getTransferStatus()); - - LOG.log(Level.INFO, "Cataloging Product: [" - + p.getProductName() + "]"); - String destProductId = null; - if (destCatalog != null) { - destCatalog.addProduct(destProduct); - destProductId = destProduct.getProductId(); - } else - destProductId = destClient.catalogProduct(destProduct); - LOG.log(Level.INFO, "Catalog successful: dest product id: [" - + destProductId + "]"); - destProduct.setProductId(destProductId); - - LOG.log(Level.INFO, "Adding references for dest product: [" - + destProductId + "]"); - destProduct.setProductReferences(p.getProductReferences()); - if (destCatalog != null) { - destCatalog.addProductReferences(destProduct); - } else - destClient.addProductReferences(destProduct); - LOG.log(Level.INFO, - "Reference addition successful for dest product: [" + p.setProductType(type); + if (sourceClient != null) { + p + .setProductReferences(sourceClient + .getProductReferences(p)); + } else { + p.setProductReferences(srcCatalog.getProductReferences(p)); + } + + Metadata met; + + if (sourceClient != null) { + met = sourceClient.getMetadata(p); + } else { + met = srcCatalog.getMetadata(p); + } + + LOG + .log( + Level.INFO, + "Source Product: [" + + p.getProductName() + + "]: Met Extraction and " + + "Reference Extraction successful: writing to dest file manager"); + + // OODT-543 + if (sourceClient != null) { + // remove the default CAS fields for metadata + met.removeMetadata("CAS.ProductId"); + met.removeMetadata("CAS.ProductReceivedTime"); + met.removeMetadata("CAS.ProductName"); + } + + Product destProduct = new Product(); + // copy through + destProduct.setProductName(p.getProductName()); + destProduct.setProductStructure(p.getProductStructure()); + destProduct.setProductType((destClient != null) ? destClient + .getProductTypeById(type.getProductTypeId()) : type); + destProduct.setTransferStatus(p.getTransferStatus()); + + LOG.log(Level.INFO, "Cataloging Product: [" + + p.getProductName() + "]"); + String destProductId; + if (destCatalog != null) { + destCatalog.addProduct(destProduct); + destProductId = destProduct.getProductId(); + } else { + destProductId = destClient.catalogProduct(destProduct); + } + LOG.log(Level.INFO, "Catalog successful: dest product id: [" + destProductId + "]"); + destProduct.setProductId(destProductId); - LOG.log(Level.INFO, "Adding metadata for dest product: [" - + destProductId + "]"); - if (destCatalog != null) { - destCatalog.addMetadata(met, destProduct); - } else - destClient.addMetadata(destProduct, met); - LOG.log(Level.INFO, - "Met addition successful for dest product: [" + LOG.log(Level.INFO, "Adding references for dest product: [" + destProductId + "]"); + destProduct.setProductReferences(p.getProductReferences()); + if (destCatalog != null) { + destCatalog.addProductReferences(destProduct); + } else { + destClient.addProductReferences(destProduct); + } + LOG.log(Level.INFO, + "Reference addition successful for dest product: [" + + destProductId + "]"); - LOG.log(Level.INFO, "Successful import of product: [" - + p.getProductName() + "] into dest file manager"); + LOG.log(Level.INFO, "Adding metadata for dest product: [" + + destProductId + "]"); + if (destCatalog != null) { + destCatalog.addMetadata(met, destProduct); + } else { + destClient.addMetadata(destProduct, met); } + LOG.log(Level.INFO, + "Met addition successful for dest product: [" + + destProductId + "]"); + + LOG.log(Level.INFO, "Successful import of product: [" + + p.getProductName() + "] into dest file manager"); + } } } @@ -341,13 +345,13 @@ public class ExpImpCatalog { String[] typesAndIdsEnc = args[++i].split(","); types = new Vector(typesAndIdsEnc.length); - for (int j = 0; j < typesAndIdsEnc.length; j++) { - String[] typeIdToks = typesAndIdsEnc[j].split("\\|"); - ProductType type = new ProductType(); - type.setName(typeIdToks[0]); - type.setProductTypeId(typeIdToks[1]); - types.add(type); - } + for (String aTypesAndIdsEnc : typesAndIdsEnc) { + String[] typeIdToks = aTypesAndIdsEnc.split("\\|"); + ProductType type = new ProductType(); + type.setName(typeIdToks[0]); + type.setProductTypeId(typeIdToks[1]); + types.add(type); + } } else if (args[i].equals("--sourceCatProps")) { srcCatPropFile = args[++i]; } else if (args[i].equals("--destCatProps")) { @@ -355,14 +359,13 @@ public class ExpImpCatalog { } } - if (((sourceUrl == null || destUrl == null) && (srcCatPropFile == null || destCatPropFile == null)) - || (sourceUrl != null && destUrl != null && (srcCatPropFile != null || destCatPropFile != null)) - || ((srcCatPropFile != null && destCatPropFile == null) || (destCatPropFile != null && srcCatPropFile == null))) { + if (((sourceUrl == null || destUrl == null) && (srcCatPropFile == null || destCatPropFile == null)) || ( + sourceUrl != null && destUrl != null && (srcCatPropFile != null || destCatPropFile != null))) { System.err.println(usage); System.exit(1); } - ExpImpCatalog tool = null; + ExpImpCatalog tool; if (srcCatPropFile != null) { tool = new ExpImpCatalog(srcCatPropFile, destCatPropFile, unique); @@ -377,41 +380,40 @@ public class ExpImpCatalog { } private boolean typesExist(List sourceList, List destList) { - if (sourceList == null - || (sourceList != null && sourceList.size() == 0)) { + if (sourceList == null || (sourceList.size() == 0)) { return false; } - if (destList == null || (destList != null && destList.size() == 0)) { + if (destList == null || (destList.size() == 0)) { return false; } // iterate through the source types and try and find the type in the // destList - for (Iterator i = sourceList.iterator(); i.hasNext();) { - ProductType type = (ProductType) i.next(); - if (!typeInList(type, destList)) { - LOG.log(Level.WARNING, "Source type: [" + type.getName() - + "] not present in dest file manager"); - return false; - } + for (Object aSourceList : sourceList) { + ProductType type = (ProductType) aSourceList; + if (!typeInList(type, destList)) { + LOG.log(Level.WARNING, "Source type: [" + type.getName() + + "] not present in dest file manager"); + return false; } + } return true; } private boolean typeInList(ProductType type, List typeList) { - if (typeList == null || (typeList != null && typeList.size() == 0)) { + if (typeList == null || (typeList.size() == 0)) { return false; } - for (Iterator i = typeList.iterator(); i.hasNext();) { - ProductType destType = (ProductType) i.next(); - if (destType.getProductTypeId().equals(type.getProductTypeId()) - && destType.getName().equals(type.getName())) { - return true; - } + for (Object aTypeList : typeList) { + ProductType destType = (ProductType) aTypeList; + if (destType.getProductTypeId().equals(type.getProductTypeId()) + && destType.getName().equals(type.getName())) { + return true; } + } return false; } http://git-wip-us.apache.org/repos/asf/oodt/blob/0a3ff32c/filemgr/src/main/java/org/apache/oodt/cas/filemgr/versioning/SingleFileBasicVersioner.java ---------------------------------------------------------------------- diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/versioning/SingleFileBasicVersioner.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/versioning/SingleFileBasicVersioner.java index cc40d0e..209ba61 100644 --- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/versioning/SingleFileBasicVersioner.java +++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/versioning/SingleFileBasicVersioner.java @@ -18,15 +18,16 @@ 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.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.filemgr.structs.exceptions.VersioningException; -import org.apache.oodt.cas.metadata.Metadata; /** * @author mattmann @@ -77,7 +78,7 @@ public class SingleFileBasicVersioner implements Versioner { // we need the Filename Metadata parameter for this to work String filename = metadata.getMetadata(FILENAME_FIELD); - if (filename == null || (filename != null && filename.equals(""))) { + if (filename == null || (filename.equals(""))) { throw new VersioningException( "SingleFileVersioner: unable to version without " + "Filename metadata field specified!"); @@ -101,7 +102,7 @@ public class SingleFileBasicVersioner implements Versioner { // get the first reference back // set its data store ref - Reference ref = (Reference) product.getProductReferences().get(0); + Reference ref = product.getProductReferences().get(0); LOG.log(Level.INFO, "Generated data store ref: [" + dataStoreRef + "] from origRef: [" + ref.getOrigReference() + "]"); ref.setDataStoreReference(dataStoreRef); http://git-wip-us.apache.org/repos/asf/oodt/blob/0a3ff32c/grid/src/main/java/org/apache/oodt/grid/Server.java ---------------------------------------------------------------------- diff --git a/grid/src/main/java/org/apache/oodt/grid/Server.java b/grid/src/main/java/org/apache/oodt/grid/Server.java index 5d4eb3b..f84cadf 100755 --- a/grid/src/main/java/org/apache/oodt/grid/Server.java +++ b/grid/src/main/java/org/apache/oodt/grid/Server.java @@ -17,13 +17,14 @@ package org.apache.oodt.grid; -import java.io.Serializable; -import java.net.URL; -import java.net.URLClassLoader; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.xml.sax.SAXException; + +import java.io.Serializable; +import java.net.URL; +import java.net.URLClassLoader; import java.util.List; /** @@ -120,8 +121,7 @@ public abstract class Server implements Serializable { return true; if (obj instanceof Server) { Server rhs = (Server) obj; - return configuration.equals(configuration) - && className.equals(rhs.className); + return className.equals(rhs.className); } return false; } http://git-wip-us.apache.org/repos/asf/oodt/blob/0a3ff32c/mvn/plugins/cas-install/src/main/java/org/apache/oodt/cas/install/CASInstallDistMojo.java ---------------------------------------------------------------------- diff --git a/mvn/plugins/cas-install/src/main/java/org/apache/oodt/cas/install/CASInstallDistMojo.java b/mvn/plugins/cas-install/src/main/java/org/apache/oodt/cas/install/CASInstallDistMojo.java index b789368..6f3fdf3 100644 --- a/mvn/plugins/cas-install/src/main/java/org/apache/oodt/cas/install/CASInstallDistMojo.java +++ b/mvn/plugins/cas-install/src/main/java/org/apache/oodt/cas/install/CASInstallDistMojo.java @@ -108,9 +108,8 @@ public class CASInstallDistMojo extends AbstractMojo { */ public void execute() throws MojoExecutionException, MojoFailureException { - if (casDistributionFile == null - || (casDistributionFile != null && !casDistributionFile - .exists())) { + if (casDistributionFile == null || (!casDistributionFile + .exists())) { throw new MojoExecutionException("the CAS distribution: [" + casDistributionFile + "] does not exist!"); } @@ -173,30 +172,30 @@ public class CASInstallDistMojo extends AbstractMojo { AntDecorator.deleteAllFilesAndDir(policyDir); } catch (IOException e) { getLog().warn( - "IO exception when removing default policy from: [" - + policyDir + "]: Message: " + e.getMessage()); + "IO exception when removing default policy from null policy dir: " + + "Message: " + e.getMessage()); } - for (int i = 0; i < customPolicyDirs.length; i++) { - getLog().info( - "Installing: [" + customPolicyDirs[i] + "] to: [" - + policyDir + "]"); - - if (customPolicyDirs[i].exists()) { - try { - FileUtils.copyDirectoryToDirectory(customPolicyDirs[i], - policyDir); - } catch (IOException e) { - getLog().warn( - "error copying custom policy dir: [" - + customPolicyDirs[i] - + "] to policy dir: [" + policyDir - + "]"); - } - } - + for (File customPolicyDir : customPolicyDirs) { + getLog().info( + "Installing: [" + customPolicyDir + "] to: [" + + policyDir + "]"); + + if (customPolicyDir.exists()) { + try { + FileUtils.copyDirectoryToDirectory(customPolicyDir, + policyDir); + } catch (IOException e) { + getLog().warn( + "error copying custom policy dir: [" + + customPolicyDir + + "] to policy dir: [" + policyDir + + "]"); + } } + } + } if (customConfigurationDir != null && customConfigurationDir.exists()) { @@ -259,16 +258,16 @@ public class CASInstallDistMojo extends AbstractMojo { "Replacing env vars on [" + envVarReplaceFiles.length + "] files"); - for (int i = 0; i < envVarReplaceFiles.length; i++) { - try { - envVarReplaceFiles[i].doEnvReplace(); - } catch (IOException e) { - getLog().warn( - "IOException while doing env replacement on: [" - + envVarReplaceFiles[i].getFilepath() - + "]: Message: " + e.getMessage()); - } + for (EnvReplacer envVarReplaceFile : envVarReplaceFiles) { + try { + envVarReplaceFile.doEnvReplace(); + } catch (IOException e) { + getLog().warn( + "IOException while doing env replacement on: [" + + envVarReplaceFile.getFilepath() + + "]: Message: " + e.getMessage()); } + } } if (customBinScripts != null && customBinScripts.length > 0) { @@ -287,27 +286,27 @@ public class CASInstallDistMojo extends AbstractMojo { + e.getMessage()); } - for (int i = 0; i < customBinScripts.length; i++) { - getLog().info( - "installing [" + customBinScripts[i] + "] to [" - + binDir + "]"); - try { - FileUtils.copyFileToDirectory(customBinScripts[i], binDir); - // now chmod it with exec perms - String custBinScriptFullPath = binDir + File.separator - + customBinScripts[i].getName(); - - getLog().info("fixing perms on ["+custBinScriptFullPath+"]"); - AntDecorator.chmodFile(new File(custBinScriptFullPath), - "ugo+rx"); - } catch (IOException e) { - getLog().warn( - "unable to install [" + customBinScripts[i] - + "] to [" + binDir - + "]: IO exception: Message: " - + e.getMessage()); - } + for (File customBinScript : customBinScripts) { + getLog().info( + "installing [" + customBinScript + "] to [" + + binDir + "]"); + try { + FileUtils.copyFileToDirectory(customBinScript, binDir); + // now chmod it with exec perms + String custBinScriptFullPath = binDir + File.separator + + customBinScript.getName(); + + getLog().info("fixing perms on [" + custBinScriptFullPath + "]"); + AntDecorator.chmodFile(new File(custBinScriptFullPath), + "ugo+rx"); + } catch (IOException e) { + getLog().warn( + "unable to install [" + customBinScript + + "] to [" + binDir + + "]: IO exception: Message: " + + e.getMessage()); } + } } } http://git-wip-us.apache.org/repos/asf/oodt/blob/0a3ff32c/pcs/core/src/main/java/org/apache/oodt/pcs/pedigree/Pedigree.java ---------------------------------------------------------------------- diff --git a/pcs/core/src/main/java/org/apache/oodt/pcs/pedigree/Pedigree.java b/pcs/core/src/main/java/org/apache/oodt/pcs/pedigree/Pedigree.java index 0bae718..1aa321c 100644 --- a/pcs/core/src/main/java/org/apache/oodt/pcs/pedigree/Pedigree.java +++ b/pcs/core/src/main/java/org/apache/oodt/pcs/pedigree/Pedigree.java @@ -105,7 +105,7 @@ public class Pedigree implements PCSMetadata, PCSConfigMetadata { * @return A {@link PedigreeTree} containing the Pedigree of a given product. */ public PedigreeTree doPedigree(Product orig, boolean upstream) { - List pedProds = null; + List pedProds; PedigreeTreeNode origRoot = PedigreeTreeNode .getPedigreeTreeNodeFromProduct(orig, null); @@ -128,8 +128,8 @@ public class Pedigree implements PCSMetadata, PCSConfigMetadata { } if (pedProds != null && pedProds.size() > 0) { - for (Iterator i = pedProds.iterator(); i.hasNext();) { - Product p = (Product) i.next(); + for (Object pedProd : pedProds) { + Product p = (Product) pedProd; if (p.getProductName().equals( currRoot.getNodeProduct().getProductName())) { // don't allow for the same pedigreed product to be @@ -140,8 +140,6 @@ public class Pedigree implements PCSMetadata, PCSConfigMetadata { .getPedigreeTreeNodeFromProduct(p, currRoot); roots.add(prodNode); } - } else { - // System.out.println("Pedigree products is null or size 0"); } } while (!roots.empty()); @@ -159,13 +157,8 @@ public class Pedigree implements PCSMetadata, PCSConfigMetadata { * {@link Product}. */ public List getUpstreamPedigreedProducts(Product orig) { - if (orig == null - || (orig != null && orig.getProductType() == null) - || (orig != null && orig.getProductType() != null - && orig.getProductType().getName() == null) - || (orig != null && orig.getProductType() != null - && orig.getProductType().getName() != null && - orig.getProductType().getName().equals(UNKNOWN))) { + if (orig == null || (orig.getProductType() == null) || + (orig.getProductType().getName() == null) || (orig.getProductType().getName().equals(UNKNOWN))) { return new Vector(); } Metadata pMet = fm.safeGetMetadata(orig); @@ -204,14 +197,14 @@ public class Pedigree implements PCSMetadata, PCSConfigMetadata { } private List getProducts(List prodNames) { - if (prodNames == null || (prodNames != null && prodNames.size() == 0)) { + if (prodNames == null || (prodNames.size() == 0)) { return new Vector(); } List prods = new Vector(prodNames.size()); - for (Iterator i = prodNames.iterator(); i.hasNext();) { - String prodName = (String) i.next(); + for (Object prodName1 : prodNames) { + String prodName = (String) prodName1; List prodList = fm.queryAllTypes(new FilenameQuery(prodName, fm) .buildQuery(), this.prodTypeExcludeList); if (prodList != null && prodList.size() > 0) {
