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/559a65f6 Tree: http://git-wip-us.apache.org/repos/asf/oodt/tree/559a65f6 Diff: http://git-wip-us.apache.org/repos/asf/oodt/diff/559a65f6 Branch: refs/heads/master Commit: 559a65f615de08e12f4053805020065e4d639556 Parents: edb01cb Author: Tom Barber <[email protected]> Authored: Sun Oct 25 11:33:17 2015 +0000 Committer: Tom Barber <[email protected]> Committed: Sun Oct 25 11:33:17 2015 +0000 ---------------------------------------------------------------------- .../browser/controller/TableListener.java | 2 +- .../filemgr/browser/view/panels/TablePane.java | 2 +- .../catalog/cli/action/PagedQueryCliAction.java | 2 +- .../cas/catalog/cli/action/QueryCliAction.java | 2 +- .../cli/action/ReducedPagedQueryCliAction.java | 2 +- .../cli/action/ReducedQueryCliAction.java | 2 +- .../cas/catalog/query/parser/TokenMgrError.java | 2 +- .../XmlRpcCommunicationChannelServer.java | 4 +- .../apache/oodt/cas/cli/util/CmdLineUtils.java | 4 +- .../oodt/cas/cli/util/TestCmdLineIterable.java | 2 +- .../org/apache/oodt/commons/Configuration.java | 4 +- .../org/apache/oodt/commons/ExecServer.java | 3 +- .../org/apache/oodt/commons/MultiServer.java | 34 ++++----- .../apache/oodt/commons/activity/Activity.java | 4 +- .../oodt/commons/activity/DatagramLogger.java | 34 ++++----- .../DatagramLoggingActivityFactory.java | 34 ++++----- .../apache/oodt/commons/activity/History.java | 36 +++++----- .../apache/oodt/commons/database/SqlScript.java | 2 +- .../apache/oodt/commons/exec/EnvUtilities.java | 4 +- .../apache/oodt/commons/exec/ExecHelper.java | 4 +- .../commons/filter/TimeEventWeightedHash.java | 2 +- .../oodt/commons/object/jndi/RMIContext.java | 2 +- .../apache/oodt/commons/util/DateConvert.java | 2 +- .../java/org/apache/oodt/commons/util/LDAP.java | 2 +- .../java/org/apache/oodt/commons/util/XML.java | 2 +- .../org/apache/oodt/commons/util/XMLRPC.java | 2 +- .../org/apache/oodt/commons/xml/DOMUtil.java | 2 +- .../apache/oodt/cas/crawl/ProductCrawler.java | 2 +- .../oodt/cas/crawl/action/FileSettings.java | 2 +- .../cas/crawl/daemon/CrawlDaemonController.java | 23 +++--- .../MimeExtractorConfigReader.java | 5 +- .../cas/crawl/option/TestBooleanOptions.java | 4 +- .../cas/curation/service/DirectoryResource.java | 2 +- .../cas/curation/service/IngestionResource.java | 4 +- .../cas/curation/service/MetadataResource.java | 4 +- .../cas/curation/service/PolicyResource.java | 4 +- .../curation/util/ExtractorConfigWriter.java | 2 +- .../catalog/DataSourceCatalogFactory.java | 12 ++-- .../filemgr/catalog/LuceneCatalogFactory.java | 17 +++-- .../catalog/solr/DefaultProductSerializer.java | 5 +- .../cli/action/AbstractQueryCliAction.java | 2 +- .../datatransfer/RemoteDataTransferFactory.java | 4 +- .../oodt/cas/filemgr/structs/Product.java | 3 +- .../apache/oodt/cas/filemgr/structs/Query.java | 2 +- .../oodt/cas/filemgr/tools/QueryTool.java | 2 +- .../oodt/cas/filemgr/util/QueryUtils.java | 2 +- .../oodt/cas/filemgr/util/XmlStructFactory.java | 7 +- .../versioning/MetadataBasedFileVersioner.java | 2 +- .../filemgr/structs/type/TestTypeHandler.java | 12 ++-- .../oodt/grid/RestfulProductQueryServlet.java | 2 +- .../main/java/org/apache/oodt/grid/Utility.java | 2 +- .../metadata/extractors/ExternConfigReader.java | 17 ++--- .../oodt/cas/metadata/util/PathUtils.java | 4 +- .../apache/oodt/pcs/pedigree/PedigreeTree.java | 2 +- .../apache/oodt/pcs/tools/PCSHealthMonitor.java | 3 +- .../xmlquery/ChunkedProductInputStream.java | 2 +- .../java/org/apache/oodt/profile/Profile.java | 2 +- .../lightweight/LightweightProfileServer.java | 2 +- .../org/apache/oodt/profile/ProfileTest.java | 2 +- .../oodt/cas/protocol/http/util/HttpUtils.java | 2 +- .../oodt/cas/protocol/imaps/ImapsProtocol.java | 4 +- .../pushpull/filerestrictions/VirtualFile.java | 4 +- .../retrievalsystem/FileRetrievalSystem.java | 2 +- .../cas/resource/batchmgr/XmlRpcBatchMgr.java | 2 +- .../resource/batchmgr/XmlRpcBatchMgrProxy.java | 10 ++- .../resource/system/extern/XmlRpcBatchStub.java | 6 +- .../cas/resource/util/XmlStructFactory.java | 7 +- .../security/sso/opensso/IdentityDetails.java | 2 +- .../oodt/security/sso/opensso/UserDetails.java | 2 +- .../workflow/model/WorkflowViewer.java | 2 +- .../jaxrs/configurations/RdfConfiguration.java | 2 +- .../jaxrs/configurations/RssConfiguration.java | 2 +- .../oodt/cas/product/rdf/RDFDatasetServlet.java | 2 +- .../oodt/cas/product/rdf/RDFProductServlet.java | 2 +- .../oodt/cas/product/rss/RSSProductServlet.java | 2 +- .../apache/oodt/cas/product/rss/RSSUtils.java | 2 +- .../processor/WorkflowProcessorHelper.java | 4 +- .../oodt/cas/workflow/examples/MailTask.java | 4 +- ...SourceWorkflowInstanceRepositoryFactory.java | 3 +- ...LuceneWorkflowInstanceRepositoryFactory.java | 3 +- ...MemoryWorkflowInstanceRepositoryFactory.java | 3 +- .../structs/HighestFIFOPrioritySorter.java | 6 +- .../workflow/structs/ParentChildWorkflow.java | 2 +- .../system/XmlRpcWorkflowManagerClient.java | 75 +++++++++----------- .../cas/workflow/util/XmlRpcStructFactory.java | 4 +- .../cas/workflow/util/XmlStructFactory.java | 3 +- .../engine/TestThreadPoolWorkflowEngine.java | 20 +++--- .../oodt/xmlps/profile/XMLPSProfileHandler.java | 2 +- .../org/apache/oodt/xmlps/structs/CDERow.java | 2 +- .../oodt/xmlquery/CompressedStringCodec.java | 2 +- .../java/org/apache/oodt/xmlquery/XMLQuery.java | 4 +- 91 files changed, 261 insertions(+), 288 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/oodt/blob/559a65f6/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/controller/TableListener.java ---------------------------------------------------------------------- diff --git a/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/controller/TableListener.java b/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/controller/TableListener.java index dec6add..3e86b7a 100644 --- a/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/controller/TableListener.java +++ b/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/controller/TableListener.java @@ -110,7 +110,7 @@ public class TableListener implements MouseListener, ActionListener { } } else if (arg0.getActionCommand().equals("Unhide Columns")) { while (!table.hiddenCols.isEmpty()) { - table.unhideColumn((table.hiddenCols.firstElement()).intValue()); + table.unhideColumn(table.hiddenCols.firstElement()); } } else if (arg0.getActionCommand().equals("Export Table")) { http://git-wip-us.apache.org/repos/asf/oodt/blob/559a65f6/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/panels/TablePane.java ---------------------------------------------------------------------- diff --git a/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/panels/TablePane.java b/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/panels/TablePane.java index 3c096da..3c06a60 100644 --- a/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/panels/TablePane.java +++ b/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/panels/TablePane.java @@ -135,7 +135,7 @@ public class TablePane extends JPanel{ for(int i=1;i<this.getComponentCount();i++){ ((Row)this.getComponent(i)).hideCol(colNum); } - hiddenCols.add(Integer.valueOf(colNum)); + hiddenCols.add(colNum); } public void unhideColumn(int colNum){ http://git-wip-us.apache.org/repos/asf/oodt/blob/559a65f6/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/PagedQueryCliAction.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/PagedQueryCliAction.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/PagedQueryCliAction.java index 0fef91a..fe30a63 100644 --- a/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/PagedQueryCliAction.java +++ b/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/PagedQueryCliAction.java @@ -65,7 +65,7 @@ public class PagedQueryCliAction extends CatalogServiceCliAction { for (TransactionalMetadata tMet : transactionMetadatas) { printer.print("ID: " + tMet.getTransactionId() + " ; CatalogIDs: " + tMet.getCatalogIds() + " ; Metadata: ("); - StringBuffer sb = new StringBuffer(""); + StringBuilder sb = new StringBuilder(""); for (Object metKey : tMet.getMetadata().getHashtable().keySet()) { sb.append(metKey + "=" http://git-wip-us.apache.org/repos/asf/oodt/blob/559a65f6/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/QueryCliAction.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/QueryCliAction.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/QueryCliAction.java index a896e13..0152990 100644 --- a/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/QueryCliAction.java +++ b/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/QueryCliAction.java @@ -60,7 +60,7 @@ public class QueryCliAction extends CatalogServiceCliAction { for (TransactionalMetadata tMet : transactionMetadatas) { printer.print("ID: " + tMet.getTransactionId() + " ; CatalogIDs: " + tMet.getCatalogIds() + " ; Metadata: ("); - StringBuffer sb = new StringBuffer(""); + StringBuilder sb = new StringBuilder(""); for (Object metKey : tMet.getMetadata().getHashtable().keySet()) { sb.append(metKey + "=" http://git-wip-us.apache.org/repos/asf/oodt/blob/559a65f6/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/ReducedPagedQueryCliAction.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/ReducedPagedQueryCliAction.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/ReducedPagedQueryCliAction.java index a6a0574..0620a55 100644 --- a/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/ReducedPagedQueryCliAction.java +++ b/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/ReducedPagedQueryCliAction.java @@ -68,7 +68,7 @@ public class ReducedPagedQueryCliAction extends CatalogServiceCliAction { List<TransactionalMetadata> transactionMetadatas = getClient() .getMetadata(page); for (TransactionalMetadata tMet : transactionMetadatas) { - StringBuffer sb = new StringBuffer(""); + StringBuilder sb = new StringBuilder(""); for (String termName : this.termNames) { List<String> values = tMet.getMetadata().getAllMetadata( (String) termName); http://git-wip-us.apache.org/repos/asf/oodt/blob/559a65f6/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/ReducedQueryCliAction.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/ReducedQueryCliAction.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/ReducedQueryCliAction.java index 8753db7..0e374c2 100644 --- a/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/ReducedQueryCliAction.java +++ b/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/ReducedQueryCliAction.java @@ -62,7 +62,7 @@ public class ReducedQueryCliAction extends CatalogServiceCliAction { List<TransactionalMetadata> transactionMetadatas = getClient() .getAllPages(queryPager); for (TransactionalMetadata tMet : transactionMetadatas) { - StringBuffer sb = new StringBuffer(""); + StringBuilder sb = new StringBuilder(""); for (String termName : this.termNames) { List<String> values = tMet.getMetadata().getAllMetadata( (String) termName); http://git-wip-us.apache.org/repos/asf/oodt/blob/559a65f6/catalog/src/main/java/org/apache/oodt/cas/catalog/query/parser/TokenMgrError.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/parser/TokenMgrError.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/query/parser/TokenMgrError.java index 27df15c..8ea8f26 100644 --- a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/parser/TokenMgrError.java +++ b/catalog/src/main/java/org/apache/oodt/cas/catalog/query/parser/TokenMgrError.java @@ -48,7 +48,7 @@ public class TokenMgrError extends Error * equivalents in the given string */ protected static final String addEscapes(String str) { - StringBuffer retval = new StringBuffer(); + StringBuilder retval = new StringBuilder(); char ch; for (int i = 0; i < str.length(); i++) { switch (str.charAt(i)) http://git-wip-us.apache.org/repos/asf/oodt/blob/559a65f6/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/xmlrpc/XmlRpcCommunicationChannelServer.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/xmlrpc/XmlRpcCommunicationChannelServer.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/xmlrpc/XmlRpcCommunicationChannelServer.java index 59187f3..d26458d 100644 --- a/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/xmlrpc/XmlRpcCommunicationChannelServer.java +++ b/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/xmlrpc/XmlRpcCommunicationChannelServer.java @@ -233,11 +233,11 @@ public class XmlRpcCommunicationChannelServer extends } public String xmlrpc_isRestrictIngestPermissions() throws Exception { - return this.serializer.serializeObject(new Boolean(this.isRestrictIngestPermissions())); + return this.serializer.serializeObject(this.isRestrictIngestPermissions()); } public String xmlrpc_isRestrictQueryPermissions() throws Exception { - return this.serializer.serializeObject(new Boolean(this.isRestrictQueryPermissions())); + return this.serializer.serializeObject(this.isRestrictQueryPermissions()); } public String xmlrpc_query(String queryExpressionObject) throws Exception { http://git-wip-us.apache.org/repos/asf/oodt/blob/559a65f6/cli/src/main/java/org/apache/oodt/cas/cli/util/CmdLineUtils.java ---------------------------------------------------------------------- diff --git a/cli/src/main/java/org/apache/oodt/cas/cli/util/CmdLineUtils.java b/cli/src/main/java/org/apache/oodt/cas/cli/util/CmdLineUtils.java index 06e1454..c23f8bb 100755 --- a/cli/src/main/java/org/apache/oodt/cas/cli/util/CmdLineUtils.java +++ b/cli/src/main/java/org/apache/oodt/cas/cli/util/CmdLineUtils.java @@ -1048,7 +1048,7 @@ public class CmdLineUtils { */ public static String getFormattedString(String string, int startIndex, int endIndex) { - StringBuffer outputString = new StringBuffer(""); + StringBuilder outputString = new StringBuilder(""); String[] splitStrings = StringUtils.split(string, " "); StringBuffer curLine = null; for (int i = 0; i < splitStrings.length; i++) { @@ -1108,7 +1108,7 @@ public class CmdLineUtils { doubles.add(new Double(value)); return doubles; } else if (type.equals(String.class)) { - StringBuffer combinedString = new StringBuffer(""); + StringBuilder combinedString = new StringBuilder(""); for (String value : values) combinedString.append(value + " "); return Lists.newArrayList(combinedString.toString().trim()); http://git-wip-us.apache.org/repos/asf/oodt/blob/559a65f6/cli/src/test/java/org/apache/oodt/cas/cli/util/TestCmdLineIterable.java ---------------------------------------------------------------------- diff --git a/cli/src/test/java/org/apache/oodt/cas/cli/util/TestCmdLineIterable.java b/cli/src/test/java/org/apache/oodt/cas/cli/util/TestCmdLineIterable.java index 3ba75e3..e07590a 100644 --- a/cli/src/test/java/org/apache/oodt/cas/cli/util/TestCmdLineIterable.java +++ b/cli/src/test/java/org/apache/oodt/cas/cli/util/TestCmdLineIterable.java @@ -36,7 +36,7 @@ public class TestCmdLineIterable extends TestCase { private static final String ARGS_STRING = "--operation download --url http://somewhere.com --user foo --pass bar --toDir /tmp"; public void testIteration() throws CmdLineParserException { - StringBuffer argsString = new StringBuffer(""); + StringBuilder argsString = new StringBuilder(""); CmdLineIterable<ParsedArg> args = createArgs(); for (ParsedArg arg : args) { if (arg.getType().equals(ParsedArg.Type.OPTION)) { http://git-wip-us.apache.org/repos/asf/oodt/blob/559a65f6/commons/src/main/java/org/apache/oodt/commons/Configuration.java ---------------------------------------------------------------------- diff --git a/commons/src/main/java/org/apache/oodt/commons/Configuration.java b/commons/src/main/java/org/apache/oodt/commons/Configuration.java index 69a6909..00028af 100644 --- a/commons/src/main/java/org/apache/oodt/commons/Configuration.java +++ b/commons/src/main/java/org/apache/oodt/commons/Configuration.java @@ -300,7 +300,7 @@ public class Configuration { Node xmlNode = children.item(i); if ("entityRef".equals(xmlNode.getNodeName())) { NodeList dirNodes = xmlNode.getChildNodes(); - StringBuffer refDirs = new StringBuffer(System.getProperty(ENTITY_DIRS_PROP, "")); + StringBuilder refDirs = new StringBuilder(System.getProperty(ENTITY_DIRS_PROP, "")); for (int j = 0; j < dirNodes.getLength(); ++j) refDirs.append(',').append(XML.unwrappedText(dirNodes.item(j))); if (refDirs.length() > 0) @@ -331,7 +331,7 @@ public class Configuration { String registryList = System.getProperty("org.apache.oodt.commons.rmiregistries", System.getProperty("rmiregistries")); if (registryList == null) { String host = System.getProperty("rmiregistry.host", "localhost"); - int port = Integer.getInteger("rmiregistry.port", Registry.REGISTRY_PORT).intValue(); + int port = Integer.getInteger("rmiregistry.port", Registry.REGISTRY_PORT); registryList = "rmi://" + host + ":" + port; } contextEnvironment.put("rmiregistries", registryList); http://git-wip-us.apache.org/repos/asf/oodt/blob/559a65f6/commons/src/main/java/org/apache/oodt/commons/ExecServer.java ---------------------------------------------------------------------- diff --git a/commons/src/main/java/org/apache/oodt/commons/ExecServer.java b/commons/src/main/java/org/apache/oodt/commons/ExecServer.java index 4f4f5ee..6a61f3c 100644 --- a/commons/src/main/java/org/apache/oodt/commons/ExecServer.java +++ b/commons/src/main/java/org/apache/oodt/commons/ExecServer.java @@ -475,5 +475,6 @@ public class ExecServer { public static final String DISABLE_BINDING = "org.apache.oodt.commons.ExecServer.disableBinding"; /** How long to wait before bind attempts, in ms. */ - private static final long REBIND_PERIOD = Long.getLong("org.apache.oodt.commons.ExecServer.rebindPeriod", 30*60*1000).longValue(); + private static final long REBIND_PERIOD = + Long.getLong("org.apache.oodt.commons.ExecServer.rebindPeriod", 30 * 60 * 1000); } http://git-wip-us.apache.org/repos/asf/oodt/blob/559a65f6/commons/src/main/java/org/apache/oodt/commons/MultiServer.java ---------------------------------------------------------------------- diff --git a/commons/src/main/java/org/apache/oodt/commons/MultiServer.java b/commons/src/main/java/org/apache/oodt/commons/MultiServer.java index db89f91..baa6054 100644 --- a/commons/src/main/java/org/apache/oodt/commons/MultiServer.java +++ b/commons/src/main/java/org/apache/oodt/commons/MultiServer.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; @@ -157,7 +157,7 @@ public class MultiServer { String registryList = System.getProperty("org.apache.oodt.commons.rmiregistries", System.getProperty("rmiregistries")); if (registryList == null) { String host = System.getProperty("rmiregistry.host", "localhost"); - int port = Integer.getInteger("rmiregistry.port", Registry.REGISTRY_PORT).intValue(); + int port = Integer.getInteger("rmiregistry.port", Registry.REGISTRY_PORT); registryList = "rmi://" + host + ":" + port; } t.put("rmiregistries", registryList); http://git-wip-us.apache.org/repos/asf/oodt/blob/559a65f6/commons/src/main/java/org/apache/oodt/commons/activity/Activity.java ---------------------------------------------------------------------- diff --git a/commons/src/main/java/org/apache/oodt/commons/activity/Activity.java b/commons/src/main/java/org/apache/oodt/commons/activity/Activity.java index 5941573..1f35901 100644 --- a/commons/src/main/java/org/apache/oodt/commons/activity/Activity.java +++ b/commons/src/main/java/org/apache/oodt/commons/activity/Activity.java @@ -100,12 +100,12 @@ public abstract class Activity { Date date = new Date(); // Get the current time byte[] bytes = new byte[32]; // Make space for 32 random bytes RANDOM.nextBytes(bytes); // Fill in 32 random bytes - StringBuffer input = new StringBuffer(); // Make space to put the 1st 3 components... + StringBuilder input = new StringBuilder(); // Make space to put the 1st 3 components... input.append(addr).append(nextNum).append(date); // ...together and put 'em together MessageDigest messageDigest = MessageDigest.getInstance("MD5");// Prepare to take a hash messageDigest.update(input.toString().getBytes()); // Add the 1st 3 components byte[] sig = messageDigest.digest(bytes); // And add the random bytes - StringBuffer output = new StringBuffer(); // Make space to store the hash as a string + StringBuilder output = new StringBuilder(); // Make space to store the hash as a string for (int i = 0; i < sig.length; ++i) // For each byte in the hash output.append(Integer.toHexString(((int)sig[i])&0xff));// Store it as a hex value return output.toString(); // And return the string http://git-wip-us.apache.org/repos/asf/oodt/blob/559a65f6/commons/src/main/java/org/apache/oodt/commons/activity/DatagramLogger.java ---------------------------------------------------------------------- diff --git a/commons/src/main/java/org/apache/oodt/commons/activity/DatagramLogger.java b/commons/src/main/java/org/apache/oodt/commons/activity/DatagramLogger.java index 4cdc3dd..64bf60b 100644 --- a/commons/src/main/java/org/apache/oodt/commons/activity/DatagramLogger.java +++ b/commons/src/main/java/org/apache/oodt/commons/activity/DatagramLogger.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; @@ -44,7 +44,7 @@ class DatagramLogger { System.err.println("Set the activity.storage property to set the Storage class to use."); System.exit(1); } - int port = Integer.getInteger("activity.port", 4556).intValue(); + int port = Integer.getInteger("activity.port", 4556); String className = System.getProperty("activity.storage"); if (className == null) { System.err.println("No Storage class defined via the `activity.storage' property; exiting..."); http://git-wip-us.apache.org/repos/asf/oodt/blob/559a65f6/commons/src/main/java/org/apache/oodt/commons/activity/DatagramLoggingActivityFactory.java ---------------------------------------------------------------------- diff --git a/commons/src/main/java/org/apache/oodt/commons/activity/DatagramLoggingActivityFactory.java b/commons/src/main/java/org/apache/oodt/commons/activity/DatagramLoggingActivityFactory.java index fabdae7..7903797 100644 --- a/commons/src/main/java/org/apache/oodt/commons/activity/DatagramLoggingActivityFactory.java +++ b/commons/src/main/java/org/apache/oodt/commons/activity/DatagramLoggingActivityFactory.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; @@ -52,7 +52,7 @@ public class DatagramLoggingActivityFactory implements ActivityFactory { String hostname = System.getProperty("org.apache.oodt.commons.activity.DatagramLoggingActivityFactory.host", System.getProperty("activity.host", "")); port = Integer.getInteger("org.apache.oodt.commons.activity.DatagramLoggingActivityFactory.port", - Integer.getInteger("activity.port", 4556)).intValue(); + Integer.getInteger("activity.port", 4556)); if (hostname.length() == 0) throw new IllegalStateException("System property `org.apache.oodt.commons.activity.DatagramLoggingActivityFactory.host'" + " (or simply `activity.host') not defined or is empty"); http://git-wip-us.apache.org/repos/asf/oodt/blob/559a65f6/commons/src/main/java/org/apache/oodt/commons/activity/History.java ---------------------------------------------------------------------- diff --git a/commons/src/main/java/org/apache/oodt/commons/activity/History.java b/commons/src/main/java/org/apache/oodt/commons/activity/History.java index ae9a507..7267338 100644 --- a/commons/src/main/java/org/apache/oodt/commons/activity/History.java +++ b/commons/src/main/java/org/apache/oodt/commons/activity/History.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; @@ -150,8 +150,8 @@ final class History { private static final Timer TIMER = new Timer(/*isDaemon*/true); /** How many milliseconds to wait before giving up on an idle history. */ - static long idleTime = Long.getLong("org.apache.oodt.commons.activity.History.idle", 5*60*1000).longValue(); + static long idleTime = Long.getLong("org.apache.oodt.commons.activity.History.idle", 5 * 60 * 1000); /** How many milliseconds to wait to give a history extra time to receive incidents before saving it to storage. */ - static long closeTime = Long.getLong("org.apache.oodt.commons.activity.History.close", 5*60*1000).longValue(); + static long closeTime = Long.getLong("org.apache.oodt.commons.activity.History.close", 5 * 60 * 1000); } http://git-wip-us.apache.org/repos/asf/oodt/blob/559a65f6/commons/src/main/java/org/apache/oodt/commons/database/SqlScript.java ---------------------------------------------------------------------- diff --git a/commons/src/main/java/org/apache/oodt/commons/database/SqlScript.java b/commons/src/main/java/org/apache/oodt/commons/database/SqlScript.java index 1127293..e54888a 100644 --- a/commons/src/main/java/org/apache/oodt/commons/database/SqlScript.java +++ b/commons/src/main/java/org/apache/oodt/commons/database/SqlScript.java @@ -114,7 +114,7 @@ public class SqlScript { try { String line = null; - StringBuffer query = new StringBuffer(); + StringBuilder query = new StringBuilder(); boolean queryEnds = false; while ((line = reader.readLine()) != null) { http://git-wip-us.apache.org/repos/asf/oodt/blob/559a65f6/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 ae06eac..e224480 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 @@ -136,7 +136,7 @@ public final class EnvUtilities { * If any error occurs. */ public static String slurp(InputStream in) throws IOException { - StringBuffer out = new StringBuffer(); + StringBuilder out = new StringBuilder(); byte[] b = new byte[4096]; for (int n; (n = in.read(b)) != -1;) { out.append(new String(b, 0, n)); @@ -151,7 +151,7 @@ public final class EnvUtilities { // so \\\\ with \\\\\\\\ BufferedReader reader = new BufferedReader(new InputStreamReader(is)); String line = null; - StringBuffer buf = new StringBuffer(); + StringBuilder buf = new StringBuilder(); while ((line = reader.readLine()) != null) { // fix the line http://git-wip-us.apache.org/repos/asf/oodt/blob/559a65f6/commons/src/main/java/org/apache/oodt/commons/exec/ExecHelper.java ---------------------------------------------------------------------- diff --git a/commons/src/main/java/org/apache/oodt/commons/exec/ExecHelper.java b/commons/src/main/java/org/apache/oodt/commons/exec/ExecHelper.java index e5e89b4..b6730a5 100644 --- a/commons/src/main/java/org/apache/oodt/commons/exec/ExecHelper.java +++ b/commons/src/main/java/org/apache/oodt/commons/exec/ExecHelper.java @@ -329,8 +329,8 @@ public final class ExecHelper { */ private ExecHelper(Process process, String charset) throws IOException { try { - StringBuffer output = new StringBuffer(); - StringBuffer error = new StringBuffer(); + StringBuilder output = new StringBuilder(); + StringBuilder error = new StringBuilder(); Reader stdout; Reader stderr; http://git-wip-us.apache.org/repos/asf/oodt/blob/559a65f6/commons/src/main/java/org/apache/oodt/commons/filter/TimeEventWeightedHash.java ---------------------------------------------------------------------- diff --git a/commons/src/main/java/org/apache/oodt/commons/filter/TimeEventWeightedHash.java b/commons/src/main/java/org/apache/oodt/commons/filter/TimeEventWeightedHash.java index 38aa8fd..528e395 100644 --- a/commons/src/main/java/org/apache/oodt/commons/filter/TimeEventWeightedHash.java +++ b/commons/src/main/java/org/apache/oodt/commons/filter/TimeEventWeightedHash.java @@ -368,7 +368,7 @@ public class TimeEventWeightedHash { } public String toString() { - StringBuffer sb = new StringBuffer(""); + StringBuilder sb = new StringBuilder(""); LinkedList<TimeEventNode> printNodes = new LinkedList<TimeEventNode>(); printNodes.add(this.root); sb.append(printNodes(printNodes, "-", 0)); http://git-wip-us.apache.org/repos/asf/oodt/blob/559a65f6/commons/src/main/java/org/apache/oodt/commons/object/jndi/RMIContext.java ---------------------------------------------------------------------- diff --git a/commons/src/main/java/org/apache/oodt/commons/object/jndi/RMIContext.java b/commons/src/main/java/org/apache/oodt/commons/object/jndi/RMIContext.java index b3427e4..b8063be 100644 --- a/commons/src/main/java/org/apache/oodt/commons/object/jndi/RMIContext.java +++ b/commons/src/main/java/org/apache/oodt/commons/object/jndi/RMIContext.java @@ -333,7 +333,7 @@ public class RMIContext implements Context { if (registry != null) return registry; try { String host = environment.containsKey("host")? (String) environment.get("host") : "localhost"; - int port = environment.containsKey("port")? ((Integer) environment.get("port")).intValue() + int port = environment.containsKey("port")? (Integer) environment.get("port") : Registry.REGISTRY_PORT; http://git-wip-us.apache.org/repos/asf/oodt/blob/559a65f6/commons/src/main/java/org/apache/oodt/commons/util/DateConvert.java ---------------------------------------------------------------------- diff --git a/commons/src/main/java/org/apache/oodt/commons/util/DateConvert.java b/commons/src/main/java/org/apache/oodt/commons/util/DateConvert.java index 4e4ea57..2a8d1d8 100644 --- a/commons/src/main/java/org/apache/oodt/commons/util/DateConvert.java +++ b/commons/src/main/java/org/apache/oodt/commons/util/DateConvert.java @@ -132,7 +132,7 @@ public class DateConvert { // Determine the sign of the offset. String sign = "+"; - if (String.valueOf(tzOffsetMS).indexOf("-") != -1) { + if (String.valueOf(tzOffsetMS).contains("-")) { sign = "-"; } http://git-wip-us.apache.org/repos/asf/oodt/blob/559a65f6/commons/src/main/java/org/apache/oodt/commons/util/LDAP.java ---------------------------------------------------------------------- diff --git a/commons/src/main/java/org/apache/oodt/commons/util/LDAP.java b/commons/src/main/java/org/apache/oodt/commons/util/LDAP.java index 81a0c70..0dc52d4 100644 --- a/commons/src/main/java/org/apache/oodt/commons/util/LDAP.java +++ b/commons/src/main/java/org/apache/oodt/commons/util/LDAP.java @@ -32,7 +32,7 @@ public class LDAP { * @return An escaped, LDAP-safe string. */ public static String toLDAPString(String str) { - StringBuffer result = new StringBuffer(); + StringBuilder result = new StringBuilder(); for (int i = 0; i < str.length(); ++i) { char ch = str.charAt(i); switch (ch) { http://git-wip-us.apache.org/repos/asf/oodt/blob/559a65f6/commons/src/main/java/org/apache/oodt/commons/util/XML.java ---------------------------------------------------------------------- diff --git a/commons/src/main/java/org/apache/oodt/commons/util/XML.java b/commons/src/main/java/org/apache/oodt/commons/util/XML.java index 3f82380..bd0a71b 100644 --- a/commons/src/main/java/org/apache/oodt/commons/util/XML.java +++ b/commons/src/main/java/org/apache/oodt/commons/util/XML.java @@ -439,7 +439,7 @@ public class XML { public static String unwrappedText(Node node) { if (node == null) return null; StringBuffer buffer = new StringBuffer(); - StringBuffer wrapped = new StringBuffer(text1(node, buffer)); + StringBuilder wrapped = new StringBuilder(text1(node, buffer)); boolean newline = false; for (int i = 0; i < wrapped.length(); ++i) { if (newline == false) { http://git-wip-us.apache.org/repos/asf/oodt/blob/559a65f6/commons/src/main/java/org/apache/oodt/commons/util/XMLRPC.java ---------------------------------------------------------------------- diff --git a/commons/src/main/java/org/apache/oodt/commons/util/XMLRPC.java b/commons/src/main/java/org/apache/oodt/commons/util/XMLRPC.java index 14d7549..b2ed7f8 100644 --- a/commons/src/main/java/org/apache/oodt/commons/util/XMLRPC.java +++ b/commons/src/main/java/org/apache/oodt/commons/util/XMLRPC.java @@ -83,7 +83,7 @@ public class XMLRPC { if (value instanceof Integer || value instanceof Short) { XML.add(valueElement, "int", value.toString()); } else if (value instanceof Boolean) { - XML.add(valueElement, "boolean", ((Boolean) value).booleanValue()? "1" : "0"); + XML.add(valueElement, "boolean", (Boolean) value ? "1" : "0"); } else if (value instanceof String) { Element stringElement = doc.createElement("string"); valueElement.appendChild(stringElement); http://git-wip-us.apache.org/repos/asf/oodt/blob/559a65f6/commons/src/main/java/org/apache/oodt/commons/xml/DOMUtil.java ---------------------------------------------------------------------- diff --git a/commons/src/main/java/org/apache/oodt/commons/xml/DOMUtil.java b/commons/src/main/java/org/apache/oodt/commons/xml/DOMUtil.java index c780323..0343d27 100644 --- a/commons/src/main/java/org/apache/oodt/commons/xml/DOMUtil.java +++ b/commons/src/main/java/org/apache/oodt/commons/xml/DOMUtil.java @@ -92,7 +92,7 @@ public class DOMUtil { * @return String text inbetween the simple element tag. */ public static String getSimpleElementText(Element node) { - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); NodeList children = node.getChildNodes(); for (int i = 0; i < children.getLength(); i++) { http://git-wip-us.apache.org/repos/asf/oodt/blob/559a65f6/crawler/src/main/java/org/apache/oodt/cas/crawl/ProductCrawler.java ---------------------------------------------------------------------- diff --git a/crawler/src/main/java/org/apache/oodt/cas/crawl/ProductCrawler.java b/crawler/src/main/java/org/apache/oodt/cas/crawl/ProductCrawler.java index 2f96746..2a7966a 100644 --- a/crawler/src/main/java/org/apache/oodt/cas/crawl/ProductCrawler.java +++ b/crawler/src/main/java/org/apache/oodt/cas/crawl/ProductCrawler.java @@ -231,7 +231,7 @@ public abstract class ProductCrawler extends ProductCrawlerBean { } @VisibleForTesting void validateActions() { - StringBuffer actionErrors = new StringBuffer(""); + StringBuilder actionErrors = new StringBuilder(""); for (CrawlerAction action : actionRepo.getActions()) { try { action.validate(); http://git-wip-us.apache.org/repos/asf/oodt/blob/559a65f6/crawler/src/main/java/org/apache/oodt/cas/crawl/action/FileSettings.java ---------------------------------------------------------------------- diff --git a/crawler/src/main/java/org/apache/oodt/cas/crawl/action/FileSettings.java b/crawler/src/main/java/org/apache/oodt/cas/crawl/action/FileSettings.java index 66665b7..fc86178 100755 --- a/crawler/src/main/java/org/apache/oodt/cas/crawl/action/FileSettings.java +++ b/crawler/src/main/java/org/apache/oodt/cas/crawl/action/FileSettings.java @@ -59,7 +59,7 @@ public class FileSettings { } public String getPreparedFileString(File file) { - StringBuffer fileString = new StringBuffer(); + StringBuilder fileString = new StringBuilder(); if (file.getParent() != null) { fileString.append(file.getParent()); http://git-wip-us.apache.org/repos/asf/oodt/blob/559a65f6/crawler/src/main/java/org/apache/oodt/cas/crawl/daemon/CrawlDaemonController.java ---------------------------------------------------------------------- diff --git a/crawler/src/main/java/org/apache/oodt/cas/crawl/daemon/CrawlDaemonController.java b/crawler/src/main/java/org/apache/oodt/cas/crawl/daemon/CrawlDaemonController.java index 1628fa5..c23264d 100644 --- a/crawler/src/main/java/org/apache/oodt/cas/crawl/daemon/CrawlDaemonController.java +++ b/crawler/src/main/java/org/apache/oodt/cas/crawl/daemon/CrawlDaemonController.java @@ -59,8 +59,8 @@ public class CrawlDaemonController { double avgCrawlTime = -1.0d; try { - avgCrawlTime = ((Double) client.execute( - "crawldaemon.getAverageCrawlTime", argList)).doubleValue(); + avgCrawlTime = (Double) client.execute( + "crawldaemon.getAverageCrawlTime", argList); } catch (XmlRpcException e) { throw new CrawlException(e.getMessage()); } catch (IOException e) { @@ -76,8 +76,8 @@ public class CrawlDaemonController { int milisCrawling = -1; try { - milisCrawling = ((Integer) client.execute( - "crawldaemon.getMilisCrawling", argList)).intValue(); + milisCrawling = (Integer) client.execute( + "crawldaemon.getMilisCrawling", argList); } catch (XmlRpcException e) { throw new CrawlException(e.getMessage()); } catch (IOException e) { @@ -93,8 +93,8 @@ public class CrawlDaemonController { int waitInterval = -1; try { - waitInterval = ((Integer) client.execute( - "crawldaemon.getWaitInterval", argList)).intValue(); + waitInterval = (Integer) client.execute( + "crawldaemon.getWaitInterval", argList); } catch (XmlRpcException e) { throw new CrawlException(e.getMessage()); } catch (IOException e) { @@ -109,8 +109,8 @@ public class CrawlDaemonController { int numCrawls = -1; try { - numCrawls = ((Integer) client.execute("crawldaemon.getNumCrawls", - argList)).intValue(); + numCrawls = (Integer) client.execute("crawldaemon.getNumCrawls", + argList); } catch (XmlRpcException e) { throw new CrawlException(e.getMessage()); } catch (IOException e) { @@ -126,8 +126,8 @@ public class CrawlDaemonController { boolean running = false; try { - running = ((Boolean) client.execute("crawldaemon.isRunning", - argList)).booleanValue(); + running = (Boolean) client.execute("crawldaemon.isRunning", + argList); } catch (XmlRpcException e) { throw new CrawlException(e.getMessage()); } catch (IOException e) { @@ -142,8 +142,7 @@ public class CrawlDaemonController { boolean running = false; try { - running = ((Boolean) client.execute("crawldaemon.stop", argList)) - .booleanValue(); + running = (Boolean) client.execute("crawldaemon.stop", argList); } catch (XmlRpcException e) { throw new CrawlException(e.getMessage()); } catch (IOException e) { http://git-wip-us.apache.org/repos/asf/oodt/blob/559a65f6/crawler/src/main/java/org/apache/oodt/cas/crawl/typedetection/MimeExtractorConfigReader.java ---------------------------------------------------------------------- diff --git a/crawler/src/main/java/org/apache/oodt/cas/crawl/typedetection/MimeExtractorConfigReader.java b/crawler/src/main/java/org/apache/oodt/cas/crawl/typedetection/MimeExtractorConfigReader.java index 520245a..db39a56 100644 --- a/crawler/src/main/java/org/apache/oodt/cas/crawl/typedetection/MimeExtractorConfigReader.java +++ b/crawler/src/main/java/org/apache/oodt/cas/crawl/typedetection/MimeExtractorConfigReader.java @@ -54,7 +54,7 @@ public final class MimeExtractorConfigReader implements MimeExtractorRepo extractorRepo = new MimeExtractorRepo(); extractorRepo.setMagic(Boolean.valueOf( - root.getAttribute(MAGIC_ATTR)).booleanValue()); + root.getAttribute(MAGIC_ATTR))); String mimeTypeFile = PathUtils.replaceEnvVariables(root .getAttribute(MIME_REPO_ATTR)); if (!mimeTypeFile.startsWith("/")) { @@ -183,8 +183,7 @@ public final class MimeExtractorConfigReader implements Element elem = XMLUtils.getFirstElement(elemName, root); if (elem != null) { filePath = elem.getAttribute(FILE_ATTR); - if (Boolean.valueOf(elem.getAttribute(ENV_REPLACE_ATTR)) - .booleanValue()) + if (Boolean.valueOf(elem.getAttribute(ENV_REPLACE_ATTR))) filePath = PathUtils.replaceEnvVariables(filePath); } return filePath; http://git-wip-us.apache.org/repos/asf/oodt/blob/559a65f6/crawler/src/test/java/org/apache/oodt/cas/crawl/option/TestBooleanOptions.java ---------------------------------------------------------------------- diff --git a/crawler/src/test/java/org/apache/oodt/cas/crawl/option/TestBooleanOptions.java b/crawler/src/test/java/org/apache/oodt/cas/crawl/option/TestBooleanOptions.java index 63d2a94..865b5fc 100644 --- a/crawler/src/test/java/org/apache/oodt/cas/crawl/option/TestBooleanOptions.java +++ b/crawler/src/test/java/org/apache/oodt/cas/crawl/option/TestBooleanOptions.java @@ -39,7 +39,7 @@ public final class TestBooleanOptions extends TestCase { try { crawler.getClass().getMethod("setNoRecur", new Class[] { boolean.class }).invoke(crawler, - new Object[] { new Boolean(true) }); + new Object[] { true }); } catch (Exception e) { fail(e.getMessage()); } @@ -47,7 +47,7 @@ public final class TestBooleanOptions extends TestCase { try { crawler.getClass().getMethod("setCrawlForDirs", new Class[] { boolean.class }).invoke(crawler, - new Object[] { new Boolean(true) }); + new Object[] { true }); } catch (Exception e) { fail(e.getMessage()); } http://git-wip-us.apache.org/repos/asf/oodt/blob/559a65f6/curator/services/src/main/java/org/apache/oodt/cas/curation/service/DirectoryResource.java ---------------------------------------------------------------------- diff --git a/curator/services/src/main/java/org/apache/oodt/cas/curation/service/DirectoryResource.java b/curator/services/src/main/java/org/apache/oodt/cas/curation/service/DirectoryResource.java index 85e07c3..e469fb4 100644 --- a/curator/services/src/main/java/org/apache/oodt/cas/curation/service/DirectoryResource.java +++ b/curator/services/src/main/java/org/apache/oodt/cas/curation/service/DirectoryResource.java @@ -87,7 +87,7 @@ public class DirectoryResource extends CurationService { public String getDirectoryAreaAsHTML(String base, String path, boolean showFiles) { - StringBuffer html = new StringBuffer(); + StringBuilder html = new StringBuilder(); String relativePath = null; try { relativePath = this.cleansePath(path); http://git-wip-us.apache.org/repos/asf/oodt/blob/559a65f6/curator/services/src/main/java/org/apache/oodt/cas/curation/service/IngestionResource.java ---------------------------------------------------------------------- diff --git a/curator/services/src/main/java/org/apache/oodt/cas/curation/service/IngestionResource.java b/curator/services/src/main/java/org/apache/oodt/cas/curation/service/IngestionResource.java index 0a28842..e1ba9b9 100644 --- a/curator/services/src/main/java/org/apache/oodt/cas/curation/service/IngestionResource.java +++ b/curator/services/src/main/java/org/apache/oodt/cas/curation/service/IngestionResource.java @@ -183,7 +183,7 @@ public class IngestionResource extends CurationService { } private String encodeTaskListAsHTML(List<IngestionTask> taskList) { - StringBuffer out = new StringBuffer(); + StringBuilder out = new StringBuilder(); for (IngestionTask task : taskList) { out.append("<tr>"); @@ -245,7 +245,7 @@ public class IngestionResource extends CurationService { } private String encodeIngestResponseAsHTML(boolean success, String msg) { - StringBuffer out = new StringBuffer(); + StringBuilder out = new StringBuilder(); if (success) { out.append("Success"); } else { http://git-wip-us.apache.org/repos/asf/oodt/blob/559a65f6/curator/services/src/main/java/org/apache/oodt/cas/curation/service/MetadataResource.java ---------------------------------------------------------------------- diff --git a/curator/services/src/main/java/org/apache/oodt/cas/curation/service/MetadataResource.java b/curator/services/src/main/java/org/apache/oodt/cas/curation/service/MetadataResource.java index e7ed3db..73a6e85 100644 --- a/curator/services/src/main/java/org/apache/oodt/cas/curation/service/MetadataResource.java +++ b/curator/services/src/main/java/org/apache/oodt/cas/curation/service/MetadataResource.java @@ -170,7 +170,7 @@ public class MetadataResource extends CurationService { protected String getExtractorConfigIdsAsHTML(String[] configIds, String current) { - StringBuffer html = new StringBuffer(); + StringBuilder html = new StringBuilder(); for (int i = 0; i < configIds.length; i++) { html.append("<option "); if (configIds[i].equals(current)) { @@ -407,7 +407,7 @@ public class MetadataResource extends CurationService { return "<table></table>"; } - StringBuffer html = new StringBuffer(); + StringBuilder html = new StringBuilder(); html.append("<table>\r\n"); for (String key : (Set<String>) metadata.getHashtable().keySet()) { http://git-wip-us.apache.org/repos/asf/oodt/blob/559a65f6/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 0fa980a..56912d2 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 @@ -203,7 +203,7 @@ public class PolicyResource extends CurationService { } private String encodePoliciesAsHTML(String[] policyDirs) { - StringBuffer out = new StringBuffer(); + StringBuilder out = new StringBuilder(); out.append("<ul class=\"fileTree\" >"); for (String policy : policyDirs) { out.append("<li class=\"directory collapsed\"><a href=\"#\" rel=\"/"); @@ -228,7 +228,7 @@ public class PolicyResource extends CurationService { } private String encodeProductTypesAsHTML(String policy, String[] typeNames) { - StringBuffer out = new StringBuffer(); + StringBuilder out = new StringBuilder(); out.append("<ul class=\"fileTree\" >"); for (String type : typeNames) { out http://git-wip-us.apache.org/repos/asf/oodt/blob/559a65f6/curator/services/src/main/java/org/apache/oodt/cas/curation/util/ExtractorConfigWriter.java ---------------------------------------------------------------------- diff --git a/curator/services/src/main/java/org/apache/oodt/cas/curation/util/ExtractorConfigWriter.java b/curator/services/src/main/java/org/apache/oodt/cas/curation/util/ExtractorConfigWriter.java index 3e3488d..5571c23 100644 --- a/curator/services/src/main/java/org/apache/oodt/cas/curation/util/ExtractorConfigWriter.java +++ b/curator/services/src/main/java/org/apache/oodt/cas/curation/util/ExtractorConfigWriter.java @@ -35,7 +35,7 @@ public class ExtractorConfigWriter { props.setProperty(ExtractorConfig.PROP_CLASS_NAME, config.getClassName()); File configDir = new File(dir, config.getIdentifier()); configDir.mkdirs(); - StringBuffer files = new StringBuffer(); + StringBuilder files = new StringBuilder(); for (Iterator<File> i = config.getConfigFiles().iterator(); i.hasNext();) { File file = i.next(); files.append(file.toURI()); http://git-wip-us.apache.org/repos/asf/oodt/blob/559a65f6/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 6975397..cdb16c7 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 @@ -127,13 +127,13 @@ public class DataSourceCatalogFactory implements CatalogFactory { .getBoolean("org.apache.oodt.cas.filemgr.catalog.datasource.quoteFields"); pageSize = Integer - .getInteger( - "org.apache.oodt.cas.filemgr.catalog.datasource.pageSize", - 20).intValue(); + .getInteger( + "org.apache.oodt.cas.filemgr.catalog.datasource.pageSize", + 20); cacheUpdateMinutes = Long - .getLong( - "org.apache.oodt.cas.filemgr.catalog.datasource.cacheUpdateMinutes", - 5L).longValue(); + .getLong( + "org.apache.oodt.cas.filemgr.catalog.datasource.cacheUpdateMinutes", + 5L); productIdString = Boolean.parseBoolean( System.getProperty("org.apache.oodt.cas.filemgr.catalog.datasource.productId.string", "false") ); http://git-wip-us.apache.org/repos/asf/oodt/blob/559a65f6/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 35bfe7c..a80c52f 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 @@ -92,19 +92,18 @@ public class LuceneCatalogFactory implements CatalogFactory { .getValidationLayerFromFactory(validationLayerFactoryClass); } - pageSize = Integer.getInteger("org.apache.oodt.cas.filemgr.catalog.lucene.pageSize", 20).intValue(); + pageSize = Integer.getInteger("org.apache.oodt.cas.filemgr.catalog.lucene.pageSize", 20); commitLockTimeOut = Long - .getLong( - "org.apache.oodt.cas.filemgr.catalog.lucene.commitLockTimeout.seconds", - 60).longValue(); + .getLong( + "org.apache.oodt.cas.filemgr.catalog.lucene.commitLockTimeout.seconds", + 60); writeLockTimeOut = Long - .getLong( - "org.apache.oodt.cas.filemgr.catalog.lucene.writeLockTimeout.seconds", - 60).longValue(); + .getLong( + "org.apache.oodt.cas.filemgr.catalog.lucene.writeLockTimeout.seconds", + 60); mergeFactor = Integer.getInteger( - "org.apache.oodt.cas.filemgr.catalog.lucene.mergeFactor", 20) - .intValue(); + "org.apache.oodt.cas.filemgr.catalog.lucene.mergeFactor", 20); } /* http://git-wip-us.apache.org/repos/asf/oodt/blob/559a65f6/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 d299765..5de3afe 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 @@ -175,8 +175,9 @@ public class DefaultProductSerializer implements ProductSerializer { for (String key : metadata.getKeys()) { if (! (key.startsWith(Parameters.NS) // skip metadata keys starting with reserved namespace - || Parameters.PRODUCT_TYPE_NAME.indexOf(key)>=0 // skip 'ProductType' as already stored as 'CAS.ProductTypeName' - || Parameters.PRODUCT_STRUCTURE.indexOf(key)>=0)) { // skip 'ProductType' as already stored as 'CAS.ProductStructure' + || Parameters.PRODUCT_TYPE_NAME.contains(key) + // skip 'ProductType' as already stored as 'CAS.ProductTypeName' + || Parameters.PRODUCT_STRUCTURE.contains(key))) { // skip 'ProductType' as already stored as 'CAS.ProductStructure' for (String value : metadata.getAllMetadata(key)) { this.addKeyValueToMap(fields, key, value); } http://git-wip-us.apache.org/repos/asf/oodt/blob/559a65f6/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/AbstractQueryCliAction.java ---------------------------------------------------------------------- diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/AbstractQueryCliAction.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/AbstractQueryCliAction.java index 7c15a44..5073617 100644 --- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/AbstractQueryCliAction.java +++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/AbstractQueryCliAction.java @@ -73,7 +73,7 @@ public abstract class AbstractQueryCliAction extends FileManagerCliAction { complexQuery.setQueryFilter(filter); } List<QueryResult> results = getClient().complexQuery(complexQuery); - StringBuffer returnString = new StringBuffer(""); + StringBuilder returnString = new StringBuilder(""); for (QueryResult qr : results) { returnString.append(qr.toString() + delimiter); } http://git-wip-us.apache.org/repos/asf/oodt/blob/559a65f6/filemgr/src/main/java/org/apache/oodt/cas/filemgr/datatransfer/RemoteDataTransferFactory.java ---------------------------------------------------------------------- diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/datatransfer/RemoteDataTransferFactory.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/datatransfer/RemoteDataTransferFactory.java index 7b4e95a..ecd89ab 100644 --- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/datatransfer/RemoteDataTransferFactory.java +++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/datatransfer/RemoteDataTransferFactory.java @@ -44,8 +44,8 @@ public class RemoteDataTransferFactory implements DataTransferFactory { */ public RemoteDataTransferFactory() throws InstantiationException { chunkSize = Integer.getInteger( - "org.apache.oodt.cas.filemgr.datatransfer.remote.chunkSize", - 1024).intValue(); + "org.apache.oodt.cas.filemgr.datatransfer.remote.chunkSize", + 1024); LOG.log(Level.INFO, "RemoteDataTransfer enabled: using chunk size: [" + chunkSize + "]"); http://git-wip-us.apache.org/repos/asf/oodt/blob/559a65f6/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/Product.java ---------------------------------------------------------------------- diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/Product.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/Product.java index 3c25ed3..fb089db 100644 --- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/Product.java +++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/Product.java @@ -355,8 +355,7 @@ public class Product { Reference r = new Reference(); r.setOrigReference(refElem.getAttribute("orig")); r.setDataStoreReference(refElem.getAttribute("dataStore")); - r.setFileSize(Long.valueOf(refElem.getAttribute("size")) - .longValue()); + r.setFileSize(Long.valueOf(refElem.getAttribute("size"))); this.references.add(r); } } http://git-wip-us.apache.org/repos/asf/oodt/blob/559a65f6/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/Query.java ---------------------------------------------------------------------- diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/Query.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/Query.java index 3b4f19a..257d69a 100644 --- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/Query.java +++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/Query.java @@ -79,7 +79,7 @@ public class Query { * @return A String representation of this Query. */ public String toString() { - StringBuffer rStr = new StringBuffer(); + StringBuilder rStr = new StringBuilder(); rStr.append("q="); http://git-wip-us.apache.org/repos/asf/oodt/blob/559a65f6/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/QueryTool.java ---------------------------------------------------------------------- diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/QueryTool.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/QueryTool.java index b761530..ba9ece4 100644 --- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/QueryTool.java +++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/QueryTool.java @@ -250,7 +250,7 @@ public final class QueryTool { complexQuery.setSortByMetKey(sortBy); complexQuery.setToStringResultFormat(outputFormat); List<QueryResult> results = new XmlRpcFileManagerClient(new URL(filemgrUrl)).complexQuery(complexQuery); - StringBuffer returnString = new StringBuffer(""); + StringBuilder returnString = new StringBuilder(""); for (QueryResult qr : results) returnString.append(qr.toString() + delimiter); return returnString.substring(0, returnString.length() - delimiter.length()); http://git-wip-us.apache.org/repos/asf/oodt/blob/559a65f6/filemgr/src/main/java/org/apache/oodt/cas/filemgr/util/QueryUtils.java ---------------------------------------------------------------------- diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/util/QueryUtils.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/util/QueryUtils.java index f5ee4a9..0c8c1b1 100644 --- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/util/QueryUtils.java +++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/util/QueryUtils.java @@ -41,7 +41,7 @@ public class QueryUtils { public static String getQueryResultsAsString( List<QueryResult> queryResults, String delimiter) { - StringBuffer returnString = new StringBuffer(""); + StringBuilder returnString = new StringBuilder(""); for (QueryResult qr : queryResults) returnString.append(qr.toString() + delimiter); return returnString.substring(0, returnString.length() - delimiter.length()); http://git-wip-us.apache.org/repos/asf/oodt/blob/559a65f6/filemgr/src/main/java/org/apache/oodt/cas/filemgr/util/XmlStructFactory.java ---------------------------------------------------------------------- diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/util/XmlStructFactory.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/util/XmlStructFactory.java index 4912830..bb3496a 100644 --- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/util/XmlStructFactory.java +++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/util/XmlStructFactory.java @@ -155,10 +155,9 @@ public final class XmlStructFactory { String propertyValue = propertyElem .getAttribute("value"); if (Boolean - .valueOf( - propertyElem - .getAttribute("envReplace")) - .booleanValue()) { + .valueOf( + propertyElem + .getAttribute("envReplace"))) { propertyValue = PathUtils .replaceEnvVariables(propertyValue); } http://git-wip-us.apache.org/repos/asf/oodt/blob/559a65f6/filemgr/src/main/java/org/apache/oodt/cas/filemgr/versioning/MetadataBasedFileVersioner.java ---------------------------------------------------------------------- diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/versioning/MetadataBasedFileVersioner.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/versioning/MetadataBasedFileVersioner.java index 99e7d19..93c90e1 100644 --- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/versioning/MetadataBasedFileVersioner.java +++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/versioning/MetadataBasedFileVersioner.java @@ -109,7 +109,7 @@ public class MetadataBasedFileVersioner implements Versioner { private String parseFilePathSpec(String filePathSpec, String productTypeRepoPath, Metadata metadata) { - StringBuffer finalFilePath = new StringBuffer(); + StringBuilder finalFilePath = new StringBuilder(); finalFilePath.append(productTypeRepoPath); if (finalFilePath.charAt(finalFilePath.length() - 1) == '/') { http://git-wip-us.apache.org/repos/asf/oodt/blob/559a65f6/filemgr/src/test/java/org/apache/oodt/cas/filemgr/structs/type/TestTypeHandler.java ---------------------------------------------------------------------- diff --git a/filemgr/src/test/java/org/apache/oodt/cas/filemgr/structs/type/TestTypeHandler.java b/filemgr/src/test/java/org/apache/oodt/cas/filemgr/structs/type/TestTypeHandler.java index 7c09e3a..9182dde 100644 --- a/filemgr/src/test/java/org/apache/oodt/cas/filemgr/structs/type/TestTypeHandler.java +++ b/filemgr/src/test/java/org/apache/oodt/cas/filemgr/structs/type/TestTypeHandler.java @@ -451,11 +451,11 @@ public class TestTypeHandler extends TestCase { String tableName = type.getName() + "_metadata"; String subSelectQueryBase = "SELECT product_id FROM " + tableName + " "; - StringBuffer selectClause = new StringBuffer( + StringBuilder selectClause = new StringBuilder( "SELECT DISTINCT p.product_id "); - StringBuffer fromClause = new StringBuffer("FROM " + tableName + StringBuilder fromClause = new StringBuilder("FROM " + tableName + " p "); - StringBuffer whereClause = new StringBuffer("WHERE "); + StringBuilder whereClause = new StringBuilder("WHERE "); boolean gotFirstClause = false; int clauseNum = 0; @@ -692,11 +692,11 @@ public class TestTypeHandler extends TestCase { String tableName = type.getName() + "_metadata"; String subSelectQueryBase = "SELECT product_id FROM " + tableName + " "; - StringBuffer selectClause = new StringBuffer( + StringBuilder selectClause = new StringBuilder( "SELECT COUNT(DISTINCT p.product_id) AS numResults "); - StringBuffer fromClause = new StringBuffer("FROM " + tableName + StringBuilder fromClause = new StringBuilder("FROM " + tableName + " p "); - StringBuffer whereClause = new StringBuffer("WHERE "); + StringBuilder whereClause = new StringBuilder("WHERE "); boolean gotFirstClause = false; int clauseNum = 0; http://git-wip-us.apache.org/repos/asf/oodt/blob/559a65f6/grid/src/main/java/org/apache/oodt/grid/RestfulProductQueryServlet.java ---------------------------------------------------------------------- diff --git a/grid/src/main/java/org/apache/oodt/grid/RestfulProductQueryServlet.java b/grid/src/main/java/org/apache/oodt/grid/RestfulProductQueryServlet.java index 0bfcce2..7d24d36 100644 --- a/grid/src/main/java/org/apache/oodt/grid/RestfulProductQueryServlet.java +++ b/grid/src/main/java/org/apache/oodt/grid/RestfulProductQueryServlet.java @@ -60,7 +60,7 @@ public class RestfulProductQueryServlet extends ProductQueryServlet { // combine all HTTP (name, value) pairs into XML query string with logical AND } else { - StringBuffer q = new StringBuffer(""); + StringBuilder q = new StringBuilder(""); Enumeration<String> parameterNames = req.getParameterNames(); while (parameterNames.hasMoreElements()) { String paramName = parameterNames.nextElement(); http://git-wip-us.apache.org/repos/asf/oodt/blob/559a65f6/grid/src/main/java/org/apache/oodt/grid/Utility.java ---------------------------------------------------------------------- diff --git a/grid/src/main/java/org/apache/oodt/grid/Utility.java b/grid/src/main/java/org/apache/oodt/grid/Utility.java index 93cc215..e160e52 100755 --- a/grid/src/main/java/org/apache/oodt/grid/Utility.java +++ b/grid/src/main/java/org/apache/oodt/grid/Utility.java @@ -32,7 +32,7 @@ public class Utility { * @return <var>str</var> escaped. */ public static String esc(String str) { - StringBuffer s = new StringBuffer(str.length()); // Assume at least the same + StringBuilder s = new StringBuilder(str.length()); // Assume at least the same // length for (int i = 0; i < str.length(); ++i) { // For each character char c = str.charAt(i); // Grab the character http://git-wip-us.apache.org/repos/asf/oodt/blob/559a65f6/metadata/src/main/java/org/apache/oodt/cas/metadata/extractors/ExternConfigReader.java ---------------------------------------------------------------------- diff --git a/metadata/src/main/java/org/apache/oodt/cas/metadata/extractors/ExternConfigReader.java b/metadata/src/main/java/org/apache/oodt/cas/metadata/extractors/ExternConfigReader.java index c770763..18a5d4c 100644 --- a/metadata/src/main/java/org/apache/oodt/cas/metadata/extractors/ExternConfigReader.java +++ b/metadata/src/main/java/org/apache/oodt/cas/metadata/extractors/ExternConfigReader.java @@ -67,8 +67,7 @@ public final class ExternConfigReader implements MetExtractorConfigReader, Element binPathElem = XMLUtils.getFirstElement( EXTRACTOR_BIN_PATH_TAG, execElement); String binPath = XMLUtils.getSimpleElementText(binPathElem); - if (Boolean.valueOf(binPathElem.getAttribute(ENV_REPLACE_ATTR)) - .booleanValue()) { + if (Boolean.valueOf(binPathElem.getAttribute(ENV_REPLACE_ATTR))) { binPath = PathUtils.replaceEnvVariables(binPath); } @@ -90,12 +89,12 @@ public final class ExternConfigReader implements MetExtractorConfigReader, Element argElem = (Element) argNodes.item(i); String argStr = null; if (Boolean.valueOf( - argElem.getAttribute(IS_DATA_FILE_ATTR) - .toLowerCase()).booleanValue()) + argElem.getAttribute(IS_DATA_FILE_ATTR) + .toLowerCase())) argStr = DATA_FILE_PLACE_HOLDER; else if (Boolean.valueOf( - argElem.getAttribute(IS_MET_FILE_ATTR) - .toLowerCase()).booleanValue()) + argElem.getAttribute(IS_MET_FILE_ATTR) + .toLowerCase())) argStr = MET_FILE_PLACE_HOLDER; else argStr = XMLUtils.getSimpleElementText(argElem); @@ -106,13 +105,11 @@ public final class ExternConfigReader implements MetExtractorConfigReader, argStr += "." + appendExt; if (Boolean.valueOf( - argElem.getAttribute(ENV_REPLACE_ATTR)) - .booleanValue()) { + argElem.getAttribute(ENV_REPLACE_ATTR))) { argStr = PathUtils.replaceEnvVariables(argStr); } - if (Boolean.valueOf(argElem.getAttribute(IS_PATH_ATTR)) - .booleanValue()) { + if (Boolean.valueOf(argElem.getAttribute(IS_PATH_ATTR))) { argStr = argStr.replaceAll("\\s", "\\\\ "); } http://git-wip-us.apache.org/repos/asf/oodt/blob/559a65f6/metadata/src/main/java/org/apache/oodt/cas/metadata/util/PathUtils.java ---------------------------------------------------------------------- diff --git a/metadata/src/main/java/org/apache/oodt/cas/metadata/util/PathUtils.java b/metadata/src/main/java/org/apache/oodt/cas/metadata/util/PathUtils.java index 7b6586a..bfa245e 100644 --- a/metadata/src/main/java/org/apache/oodt/cas/metadata/util/PathUtils.java +++ b/metadata/src/main/java/org/apache/oodt/cas/metadata/util/PathUtils.java @@ -61,7 +61,7 @@ public final class PathUtils { public static String replaceEnvVariables(String origPath, Metadata metadata, boolean expand) { - StringBuffer finalPath = new StringBuffer(); + StringBuilder finalPath = new StringBuilder(); for (int i = 0; i < origPath.length(); i++) { if (origPath.charAt(i) == '[') { @@ -340,7 +340,7 @@ public final class PathUtils { } private static VarData readEnvVarName(String origPathStr, int startIdx) { - StringBuffer varName = new StringBuffer(); + StringBuilder varName = new StringBuilder(); int idx = startIdx + 1; do { http://git-wip-us.apache.org/repos/asf/oodt/blob/559a65f6/pcs/core/src/main/java/org/apache/oodt/pcs/pedigree/PedigreeTree.java ---------------------------------------------------------------------- diff --git a/pcs/core/src/main/java/org/apache/oodt/pcs/pedigree/PedigreeTree.java b/pcs/core/src/main/java/org/apache/oodt/pcs/pedigree/PedigreeTree.java index 0498d27..f57b7da 100644 --- a/pcs/core/src/main/java/org/apache/oodt/pcs/pedigree/PedigreeTree.java +++ b/pcs/core/src/main/java/org/apache/oodt/pcs/pedigree/PedigreeTree.java @@ -91,7 +91,7 @@ public class PedigreeTree { } private String getTabStr(int num) { - StringBuffer tabStrBuf = new StringBuffer(); + StringBuilder tabStrBuf = new StringBuilder(); for (int i = 0; i < num; i++) { tabStrBuf.append("\t"); } http://git-wip-us.apache.org/repos/asf/oodt/blob/559a65f6/pcs/core/src/main/java/org/apache/oodt/pcs/tools/PCSHealthMonitor.java ---------------------------------------------------------------------- diff --git a/pcs/core/src/main/java/org/apache/oodt/pcs/tools/PCSHealthMonitor.java b/pcs/core/src/main/java/org/apache/oodt/pcs/tools/PCSHealthMonitor.java index a5b92d1..889f8aa 100644 --- a/pcs/core/src/main/java/org/apache/oodt/pcs/tools/PCSHealthMonitor.java +++ b/pcs/core/src/main/java/org/apache/oodt/pcs/tools/PCSHealthMonitor.java @@ -587,8 +587,7 @@ public final class PCSHealthMonitor implements CoreMetKeys, Vector argList = new Vector(); try { - return ((Boolean) client.execute("batchstub.isAlive", argList)) - .booleanValue(); + return (Boolean) client.execute("batchstub.isAlive", argList); } catch (Exception e) { return false; } http://git-wip-us.apache.org/repos/asf/oodt/blob/559a65f6/product/src/main/java/org/apache/oodt/xmlquery/ChunkedProductInputStream.java ---------------------------------------------------------------------- diff --git a/product/src/main/java/org/apache/oodt/xmlquery/ChunkedProductInputStream.java b/product/src/main/java/org/apache/oodt/xmlquery/ChunkedProductInputStream.java index bdf21d1..36c03b8 100644 --- a/product/src/main/java/org/apache/oodt/xmlquery/ChunkedProductInputStream.java +++ b/product/src/main/java/org/apache/oodt/xmlquery/ChunkedProductInputStream.java @@ -200,5 +200,5 @@ final class ChunkedProductInputStream extends InputStream { private boolean open; /** Size of chunks. */ - private static final int BLOCK_SIZE = Integer.getInteger("org.apache.oodt.xmlquery.blockSize", 4096).intValue(); + private static final int BLOCK_SIZE = Integer.getInteger("org.apache.oodt.xmlquery.blockSize", 4096); } http://git-wip-us.apache.org/repos/asf/oodt/blob/559a65f6/profile/src/main/java/org/apache/oodt/profile/Profile.java ---------------------------------------------------------------------- diff --git a/profile/src/main/java/org/apache/oodt/profile/Profile.java b/profile/src/main/java/org/apache/oodt/profile/Profile.java index bd7e0e6..7fab8ec 100644 --- a/profile/src/main/java/org/apache/oodt/profile/Profile.java +++ b/profile/src/main/java/org/apache/oodt/profile/Profile.java @@ -369,7 +369,7 @@ public class Profile implements Serializable, Cloneable, Comparable<Object>, Doc System.err.println("Usage: <profile.xml>"); System.exit(1); } - StringBuffer b = new StringBuffer(); + StringBuilder b = new StringBuilder(); BufferedReader reader = new BufferedReader(new FileReader(argv[0])); char[] buf = new char[512]; int num; http://git-wip-us.apache.org/repos/asf/oodt/blob/559a65f6/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/LightweightProfileServer.java ---------------------------------------------------------------------- diff --git a/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/LightweightProfileServer.java b/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/LightweightProfileServer.java index dba1d80..c31db1c 100644 --- a/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/LightweightProfileServer.java +++ b/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/LightweightProfileServer.java @@ -271,7 +271,7 @@ final public class LightweightProfileServer implements ProfileHandler { LightweightProfileServer lp = new LightweightProfileServer(); // Gather together the command-line arguments into a single long string. - StringBuffer b = new StringBuffer(); + StringBuilder b = new StringBuilder(); for (int i = 0; i < argv.length; ++i) b.append(argv[i]).append(' '); http://git-wip-us.apache.org/repos/asf/oodt/blob/559a65f6/profile/src/test/java/org/apache/oodt/profile/ProfileTest.java ---------------------------------------------------------------------- diff --git a/profile/src/test/java/org/apache/oodt/profile/ProfileTest.java b/profile/src/test/java/org/apache/oodt/profile/ProfileTest.java index a6eee4d..c6061b5 100644 --- a/profile/src/test/java/org/apache/oodt/profile/ProfileTest.java +++ b/profile/src/test/java/org/apache/oodt/profile/ProfileTest.java @@ -43,7 +43,7 @@ public class ProfileTest extends TestCase { oldProfNS = System.getProperty("jpl.rdf.ns"); System.setProperty("jpl.rdf.ns", "http://enterprise.jpl.nasa.gov/rdfs/prof.rdf#"); - StringBuffer buffer = new StringBuffer("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"); + StringBuilder buffer = new StringBuilder("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"); buffer.append("<!DOCTYPE profile PUBLIC \"").append(Profile.PROFILES_DTD_FPI).append("\" \"") .append(Profile.PROFILES_DTD_URL).append("\">\n"); BufferedReader reader = new BufferedReader(new InputStreamReader(getClass().getResourceAsStream("test.xml"))); http://git-wip-us.apache.org/repos/asf/oodt/blob/559a65f6/protocol/http/src/main/java/org/apache/oodt/cas/protocol/http/util/HttpUtils.java ---------------------------------------------------------------------- diff --git a/protocol/http/src/main/java/org/apache/oodt/cas/protocol/http/util/HttpUtils.java b/protocol/http/src/main/java/org/apache/oodt/cas/protocol/http/util/HttpUtils.java index a006598..5788262 100644 --- a/protocol/http/src/main/java/org/apache/oodt/cas/protocol/http/util/HttpUtils.java +++ b/protocol/http/src/main/java/org/apache/oodt/cas/protocol/http/util/HttpUtils.java @@ -92,7 +92,7 @@ public class HttpUtils { Scanner scanner = new Scanner(conn.getInputStream()); // Read in link - StringBuffer sb = new StringBuffer(""); + StringBuilder sb = new StringBuilder(""); while (scanner.hasNext()) sb.append(scanner.nextLine()); http://git-wip-us.apache.org/repos/asf/oodt/blob/559a65f6/protocol/imaps/src/main/java/org/apache/oodt/cas/protocol/imaps/ImapsProtocol.java ---------------------------------------------------------------------- diff --git a/protocol/imaps/src/main/java/org/apache/oodt/cas/protocol/imaps/ImapsProtocol.java b/protocol/imaps/src/main/java/org/apache/oodt/cas/protocol/imaps/ImapsProtocol.java index 723d2ae..8ee8e87 100644 --- a/protocol/imaps/src/main/java/org/apache/oodt/cas/protocol/imaps/ImapsProtocol.java +++ b/protocol/imaps/src/main/java/org/apache/oodt/cas/protocol/imaps/ImapsProtocol.java @@ -305,7 +305,7 @@ public class ImapsProtocol implements Protocol { private String getContentFromPlainText(Part p) throws MessagingException, IOException, DecoderException { - StringBuffer content = new StringBuffer(""); + StringBuilder content = new StringBuilder(""); if (p.isMimeType("text/plain")) { content.append((String) p.getContent()); } else if (p.isMimeType("multipart/*")) { @@ -323,7 +323,7 @@ public class ImapsProtocol implements Protocol { private String getContentFromHTML(Part p) throws MessagingException, IOException, DecoderException, SAXException, TikaException { - StringBuffer content = new StringBuffer(""); + StringBuilder content = new StringBuilder(""); if (p.isMimeType("multipart/*")) { Multipart mp = (Multipart) p.getContent(); int count = mp.getCount(); http://git-wip-us.apache.org/repos/asf/oodt/blob/559a65f6/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 68849e6..9a1ba4d 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 @@ -194,7 +194,7 @@ public class VirtualFile { public String getAbsolutePath() { if (regExp == null) return null; - StringBuffer path = new StringBuffer(this.regExp); + StringBuilder path = new StringBuilder(this.regExp); VirtualFile parent = this.parent; while (parent != null) { path.insert(0, (parent.regExp != "/" ? parent.regExp : "") + "/"); @@ -270,7 +270,7 @@ public class VirtualFile { } public String toString() { - StringBuffer sb = new StringBuffer( + StringBuilder sb = new StringBuilder( "-<VirtualFile>\t : allowNewDirs/noDirs\t : allowNewFiles/noFiles\n------------\n"); LinkedList<VirtualFile> printFiles = new LinkedList<VirtualFile>(); printFiles.add(this); http://git-wip-us.apache.org/repos/asf/oodt/blob/559a65f6/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalsystem/FileRetrievalSystem.java ---------------------------------------------------------------------- diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalsystem/FileRetrievalSystem.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalsystem/FileRetrievalSystem.java index 23b7fca..c7d5bb4 100644 --- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalsystem/FileRetrievalSystem.java +++ b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalsystem/FileRetrievalSystem.java @@ -439,7 +439,7 @@ public class FileRetrievalSystem { String description = this.mimeTypeDetection .getDescriptionForMimeType(mimeType); if (!Strings.isNullOrEmpty(description)) { - if(description.indexOf("&") != -1){ + if(description.contains("&")){ for (String field : description.split("\\&\\&")) { String[] keyval = field.split("\\="); remoteFile.addMetadata(keyval[0].trim(), keyval[1].trim());
