- Remove custom stringutils and move to common-lang3\n- Update javadoc to allow mvn site to build again\n- Addressed a few bugs from FindBugs report (mostly performance related)
git-svn-id: https://svn.apache.org/repos/asf/turbine/fulcrum/trunk/yaafi@1844827 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/pom.xml b/pom.xml
index c3c7ba2..836601f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -61,6 +61,13 @@
</developers>
<dependencies>
+
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-lang3</artifactId>
+ <version>3.8.1</version>
+ </dependency>
+
<!-- Avalon depedencies -->
<dependency>
<groupId>org.apache.avalon.framework</groupId>
diff --git a/src/java/org/apache/fulcrum/yaafi/cli/Main.java b/src/java/org/apache/fulcrum/yaafi/cli/Main.java
index 4ed62dd..1f385aa 100644
--- a/src/java/org/apache/fulcrum/yaafi/cli/Main.java
+++ b/src/java/org/apache/fulcrum/yaafi/cli/Main.java
@@ -106,7 +106,11 @@
this.applicationHome = ".";
this.tempHome = System.getProperty("java.io.tmpdir",".");
this.applicationName = "main";
- this.args = ( this.args != null ? this.args : new String[0] );
+
+ // Arguments are specified in the constructor, but if
+ // null, set to an empty string array
+ if ( this.args == null ) { this.args = new String[0]; }
+
this.isBlocking = false;
this.hasShutdownHook = true;
this.isInitialized = false;
diff --git a/src/java/org/apache/fulcrum/yaafi/framework/component/AvalonServiceComponentImpl.java b/src/java/org/apache/fulcrum/yaafi/framework/component/AvalonServiceComponentImpl.java
index eed8d28..b5258c7 100644
--- a/src/java/org/apache/fulcrum/yaafi/framework/component/AvalonServiceComponentImpl.java
+++ b/src/java/org/apache/fulcrum/yaafi/framework/component/AvalonServiceComponentImpl.java
@@ -252,7 +252,7 @@
/**
* @see org.apache.avalon.framework.logger.LogEnabled#enableLogging(org.apache.avalon.framework.logger.Logger)
- * @param logger
+ * @param logger logger to enable
*/
public void enableLogging(Logger logger)
{
@@ -276,6 +276,8 @@
/**
* @see org.apache.avalon.framework.context.Contextualizable#contextualize(org.apache.avalon.framework.context.Context)
+ * @param context the context to add to this service
+ * @throws ContextException
*/
public void contextualize(Context context) throws ContextException
{
@@ -305,8 +307,8 @@
/**
* @see org.apache.avalon.framework.service.Serviceable#service(org.apache.avalon.framework.service.ServiceManager)
- * @param serviceManager
- * @throws ServiceException
+ * @param serviceManager instance of the service manager to work with
+ * @throws ServiceException throws exception if service failed for any reason
*/
public void service(ServiceManager serviceManager) throws ServiceException
{
diff --git a/src/java/org/apache/fulcrum/yaafi/framework/configuration/ComponentConfigurationPropertiesResolver.java b/src/java/org/apache/fulcrum/yaafi/framework/configuration/ComponentConfigurationPropertiesResolver.java
index 108545e..10952d4 100644
--- a/src/java/org/apache/fulcrum/yaafi/framework/configuration/ComponentConfigurationPropertiesResolver.java
+++ b/src/java/org/apache/fulcrum/yaafi/framework/configuration/ComponentConfigurationPropertiesResolver.java
@@ -39,6 +39,7 @@
*
* @param defaults the default properties
* @return the custom properties
+ * @throws Exception throws an exception if failed to resolve
*/
Properties resolve(Properties defaults) throws Exception;
}
diff --git a/src/java/org/apache/fulcrum/yaafi/framework/configuration/ComponentConfigurationPropertiesResolverBaseImpl.java b/src/java/org/apache/fulcrum/yaafi/framework/configuration/ComponentConfigurationPropertiesResolverBaseImpl.java
index fef4587..bcb2f82 100644
--- a/src/java/org/apache/fulcrum/yaafi/framework/configuration/ComponentConfigurationPropertiesResolverBaseImpl.java
+++ b/src/java/org/apache/fulcrum/yaafi/framework/configuration/ComponentConfigurationPropertiesResolverBaseImpl.java
@@ -52,16 +52,18 @@
/** the container configuration */
private Configuration configuration;
- /*
+ /**
* @see org.apache.avalon.framework.logger.LogEnabled#enableLogging(org.apache.avalon.framework.logger.Logger)
+ * @param logger the logger instance
*/
public void enableLogging(Logger logger)
{
this.logger = logger;
}
- /*
+ /**
* @see org.apache.avalon.framework.context.Contextualizable#contextualize(org.apache.avalon.framework.context.Context)
+ * @param context the Context to add
*/
public void contextualize(Context context) throws ContextException
{
@@ -70,6 +72,7 @@
/**
* @see org.apache.avalon.framework.configuration.Configurable#configure(org.apache.avalon.framework.configuration.Configuration)
+ * @param configuration the configuration object to use
*/
public void configure(Configuration configuration) throws ConfigurationException
{
@@ -126,6 +129,8 @@
/**
* Creates an InputStream using a Locator.
* @return the InputStrem or null if the resource was not found
+ * @param location the location of the file
+ * @throws IOException if file not found
*/
protected InputStream createInputStream(String location) throws IOException
{
@@ -135,6 +140,7 @@
/**
* Add the Avalon context variables.
+ * @param properties properties to be set
*/
protected void addAvalonContext(Properties properties) throws ContextException
{
@@ -159,10 +165,15 @@
);
}
- protected Properties loadProperties(String location) throws Exception
+
+ /**
+ * Set properties from a file location
+ * @param fileLocation file location of properties properties to be set
+ */
+ protected Properties loadProperties(String fileLocation) throws Exception
{
Properties result = new Properties();
- InputStream is = this.createInputStream(location);
+ InputStream is = this.createInputStream(fileLocation);
try
{
@@ -174,14 +185,14 @@
}
else
{
- this.getLogger().debug("Unable to load the following optional file :" + location);
+ this.getLogger().debug("Unable to load the following optional file :" + fileLocation);
}
return result;
}
catch ( Exception e )
{
- String msg = "Unable to parse the following file : " + location;
+ String msg = "Unable to parse the following file : " + fileLocation;
this.getLogger().error( msg , e );
throw e;
}
diff --git a/src/java/org/apache/fulcrum/yaafi/framework/container/ServiceContainerImpl.java b/src/java/org/apache/fulcrum/yaafi/framework/container/ServiceContainerImpl.java
index 1e13f67..895cfb9 100644
--- a/src/java/org/apache/fulcrum/yaafi/framework/container/ServiceContainerImpl.java
+++ b/src/java/org/apache/fulcrum/yaafi/framework/container/ServiceContainerImpl.java
@@ -52,10 +52,12 @@
import org.apache.fulcrum.yaafi.framework.role.RoleEntry;
import org.apache.fulcrum.yaafi.framework.util.ConfigurationUtil;
import org.apache.fulcrum.yaafi.framework.util.InputStreamLocator;
-import org.apache.fulcrum.yaafi.framework.util.StringUtils;
import org.apache.fulcrum.yaafi.framework.util.ToStringBuilder;
import org.apache.fulcrum.yaafi.framework.util.Validate;
+import org.apache.commons.lang3.StringUtils;
+
+
/**
* Yet another avalon framework implementation (YAAFI).
*
@@ -837,7 +839,6 @@
public String toString()
{
ToStringBuilder toStringBuilder = new ToStringBuilder(this);
-
toStringBuilder.append("applicationRootDir", this.getApplicationRootDir());
toStringBuilder.append("tempRootDir", this.getTempRootDir());
toStringBuilder.append("componentRolesLocation", this.componentRolesLocation);
diff --git a/src/java/org/apache/fulcrum/yaafi/framework/interceptor/AvalonInterceptorContextImpl.java b/src/java/org/apache/fulcrum/yaafi/framework/interceptor/AvalonInterceptorContextImpl.java
index 8af89a1..e300624 100644
--- a/src/java/org/apache/fulcrum/yaafi/framework/interceptor/AvalonInterceptorContextImpl.java
+++ b/src/java/org/apache/fulcrum/yaafi/framework/interceptor/AvalonInterceptorContextImpl.java
@@ -91,7 +91,7 @@
Validate.notNull(serviceDelegate,"serviceDelegate");
Validate.notNull(method,"method");
- this.invocationId = new Long(++AvalonInterceptorContextImpl.invocationCounter);
+ this.invocationId = Long.valueOf(++AvalonInterceptorContextImpl.invocationCounter);
this.serviceName = serviceName;
this.serviceShorthand = serviceShorthand;
this.serviceDelegate = serviceDelegate;
@@ -199,11 +199,11 @@
if( invocationDepth != null )
{
int currInvocationDepth = invocationDepth.intValue();
- this.getThreadContext().put(INVOCATIONDEPTH_KEY, new Integer(++currInvocationDepth));
+ this.getThreadContext().put(INVOCATIONDEPTH_KEY, Integer.valueOf(++currInvocationDepth));
}
else
{
- this.getThreadContext().put(INVOCATIONDEPTH_KEY, new Integer(0));
+ this.getThreadContext().put(INVOCATIONDEPTH_KEY, Integer.valueOf(0));
}
}
@@ -217,7 +217,7 @@
if( invocationDepth != null )
{
int currInvocationDepth = invocationDepth.intValue();
- this.getThreadContext().put(INVOCATIONDEPTH_KEY, new Integer(--currInvocationDepth));
+ this.getThreadContext().put(INVOCATIONDEPTH_KEY, Integer.valueOf(--currInvocationDepth));
}
}
diff --git a/src/java/org/apache/fulcrum/yaafi/framework/role/RoleEntry.java b/src/java/org/apache/fulcrum/yaafi/framework/role/RoleEntry.java
index 7795992..8fdeea5 100644
--- a/src/java/org/apache/fulcrum/yaafi/framework/role/RoleEntry.java
+++ b/src/java/org/apache/fulcrum/yaafi/framework/role/RoleEntry.java
@@ -22,7 +22,7 @@
import java.util.Collection;
/**
- * Contains the data of a <role> element.
+ * Contains the data of a role element.
*
* @author <a href="mailto:siegfried.goeschl@it20one.at">Siegfried Goeschl</a>
*/
diff --git a/src/java/org/apache/fulcrum/yaafi/framework/util/ConfigurationUtil.java b/src/java/org/apache/fulcrum/yaafi/framework/util/ConfigurationUtil.java
index 618332a..68d01a9 100644
--- a/src/java/org/apache/fulcrum/yaafi/framework/util/ConfigurationUtil.java
+++ b/src/java/org/apache/fulcrum/yaafi/framework/util/ConfigurationUtil.java
@@ -107,10 +107,94 @@
}
/**
- * @return the expand a string
+ * Perform a series of substitutions. The substitutions
+ * are performed by replacing ${variable} in the target
+ * string with the value of provided by the key "variable"
+ * in the provided hashtable.
+ *
+ * The unexpanded ${variable} is always written to
+ * the string buffer.
+ *
+ * @param argStr target string
+ * @param vars name/value pairs used for substitution
+ * @return String target string with replacements.
*/
- private static String expand(String value, Map vars)
+ private static String expand(String argStr, Map vars)
{
- return StringUtils.stringSubstitution(value, vars, true).toString();
+ // ignore failures
+ boolean isLenient = true;
+
+ StringBuilder argBuf = new StringBuilder();
+ int argStrLength = argStr.length();
+
+ for (int cIdx = 0 ; cIdx < argStrLength;)
+ {
+ char ch = argStr.charAt(cIdx);
+ char del = ' ';
+
+ switch (ch)
+ {
+ case '$':
+ StringBuilder nameBuf = new StringBuilder();
+ del = argStr.charAt(cIdx+1);
+ if( del == '{')
+ {
+ cIdx++;
+
+ for (++cIdx ; cIdx < argStr.length(); ++cIdx)
+ {
+ ch = argStr.charAt(cIdx);
+ if (ch != '}')
+ nameBuf.append(ch);
+ else
+ break;
+ }
+
+ if (nameBuf.length() > 0)
+ {
+ Object value = vars.get(nameBuf.toString());
+
+ if (value != null)
+ {
+ argBuf.append(value.toString());
+ }
+ else
+ {
+ if (!isLenient)
+ {
+ throw new RuntimeException("No value found for : " + nameBuf );
+ }
+ else
+ {
+ argBuf.append("${").append(nameBuf).append("}");
+ }
+ }
+
+ del = argStr.charAt(cIdx);
+
+ if( del != '}')
+ {
+ throw new RuntimeException("Delimineter not found for : " + nameBuf );
+ }
+ }
+
+ cIdx++;
+ }
+ else
+ {
+ argBuf.append(ch);
+ ++cIdx;
+ }
+
+ break;
+
+ default:
+ argBuf.append(ch);
+ ++cIdx;
+ break;
+ }
+ }
+
+ return argBuf.toString();
}
}
diff --git a/src/java/org/apache/fulcrum/yaafi/framework/util/StringUtils.java b/src/java/org/apache/fulcrum/yaafi/framework/util/StringUtils.java
deleted file mode 100644
index ed3b266..0000000
--- a/src/java/org/apache/fulcrum/yaafi/framework/util/StringUtils.java
+++ /dev/null
@@ -1,352 +0,0 @@
-/*
- * 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.fulcrum.yaafi.framework.util;
-
-import java.util.Map;
-
-
-/**
- * A subset of the utilities available in commons-lang-2.1 StringUtils.
- *
- * @author <a href="mailto:siegfried.goeschl@it20one.at">Siegfried Goeschl</a>
- */
-public class StringUtils
-{
- // Replacing
- //-----------------------------------------------------------------------
- /**
- * <p>Replaces a String with another String inside a larger String, once.</p>
- *
- * <p>A <code>null</code> reference passed to this method is a no-op.</p>
- *
- * <pre>
- * StringUtils.replaceOnce(null, *, *) = null
- * StringUtils.replaceOnce("", *, *) = ""
- * StringUtils.replaceOnce("aba", null, null) = "aba"
- * StringUtils.replaceOnce("aba", null, null) = "aba"
- * StringUtils.replaceOnce("aba", "a", null) = "aba"
- * StringUtils.replaceOnce("aba", "a", "") = "aba"
- * StringUtils.replaceOnce("aba", "a", "z") = "zba"
- * </pre>
- *
- * @see #replace(String text, String repl, String with, int max)
- * @param text text to search and replace in, may be null
- * @param repl the String to search for, may be null
- * @param with the String to replace with, may be null
- * @return the text with any replacements processed,
- * <code>null</code> if null String input
- */
- public static String replaceOnce(String text, String repl, String with) {
- return replace(text, repl, with, 1);
- }
-
- /**
- * <p>Replaces all occurrences of a String within another String.</p>
- *
- * <p>A <code>null</code> reference passed to this method is a no-op.</p>
- *
- * <pre>
- * StringUtils.replace(null, *, *) = null
- * StringUtils.replace("", *, *) = ""
- * StringUtils.replace("aba", null, null) = "aba"
- * StringUtils.replace("aba", null, null) = "aba"
- * StringUtils.replace("aba", "a", null) = "aba"
- * StringUtils.replace("aba", "a", "") = "aba"
- * StringUtils.replace("aba", "a", "z") = "zbz"
- * </pre>
- *
- * @see #replace(String text, String repl, String with, int max)
- * @param text text to search and replace in, may be null
- * @param repl the String to search for, may be null
- * @param with the String to replace with, may be null
- * @return the text with any replacements processed,
- * <code>null</code> if null String input
- */
- public static String replace(String text, String repl, String with) {
- return replace(text, repl, with, -1);
- }
-
- /**
- * <p>Replaces a String with another String inside a larger String,
- * for the first <code>max</code> values of the search String.</p>
- *
- * <p>A <code>null</code> reference passed to this method is a no-op.</p>
- *
- * <pre>
- * StringUtils.replace(null, *, *, *) = null
- * StringUtils.replace("", *, *, *) = ""
- * StringUtils.replace("abaa", null, null, 1) = "abaa"
- * StringUtils.replace("abaa", null, null, 1) = "abaa"
- * StringUtils.replace("abaa", "a", null, 1) = "abaa"
- * StringUtils.replace("abaa", "a", "", 1) = "abaa"
- * StringUtils.replace("abaa", "a", "z", 0) = "abaa"
- * StringUtils.replace("abaa", "a", "z", 1) = "zbaa"
- * StringUtils.replace("abaa", "a", "z", 2) = "zbza"
- * StringUtils.replace("abaa", "a", "z", -1) = "zbzz"
- * </pre>
- *
- * @param text text to search and replace in, may be null
- * @param repl the String to search for, may be null
- * @param with the String to replace with, may be null
- * @param max maximum number of values to replace, or <code>-1</code> if no maximum
- * @return the text with any replacements processed,
- * <code>null</code> if null String input
- */
- public static String replace(String text, String repl, String with, int max) {
- if (text == null || repl == null || with == null || repl.length() == 0 || max == 0) {
- return text;
- }
-
- StringBuilder buf = new StringBuilder(text.length());
- int start = 0, end = 0;
- while ((end = text.indexOf(repl, start)) != -1) {
- buf.append(text.substring(start, end)).append(with);
- start = end + repl.length();
-
- if (--max == 0) {
- break;
- }
- }
- buf.append(text.substring(start));
- return buf.toString();
- }
-
- // Replace, character based
- //-----------------------------------------------------------------------
- /**
- * <p>Replaces all occurrences of a character in a String with another.
- * This is a null-safe version of {@link String#replace(char, char)}.</p>
- *
- * <p>A <code>null</code> string input returns <code>null</code>.
- * An empty ("") string input returns an empty string.</p>
- *
- * <pre>
- * StringUtils.replaceChars(null, *, *) = null
- * StringUtils.replaceChars("", *, *) = ""
- * StringUtils.replaceChars("abcba", 'b', 'y') = "aycya"
- * StringUtils.replaceChars("abcba", 'z', 'y') = "abcba"
- * </pre>
- *
- * @param str String to replace characters in, may be null
- * @param searchChar the character to search for, may be null
- * @param replaceChar the character to replace, may be null
- * @return modified String, <code>null</code> if null string input
- * @since 2.0
- */
- public static String replaceChars(String str, char searchChar,
- char replaceChar)
- {
- if (str == null)
- {
- return null;
- }
- return str.replace( searchChar, replaceChar );
- }
-
- /**
- * <p>Replaces multiple characters in a String in one go.
- * This method can also be used to delete characters.</p>
- *
- * <p>For example:<br />
- * <code>replaceChars("hello", "ho", "jy") = jelly</code>.</p>
- *
- * <p>A <code>null</code> string input returns <code>null</code>.
- * An empty ("") string input returns an empty string.
- * A null or empty set of search characters returns the input string.</p>
- *
- * <p>The length of the search characters should normally equal the length
- * of the replace characters.
- * If the search characters is longer, then the extra search characters
- * are deleted.
- * If the search characters is shorter, then the extra replace characters
- * are ignored.</p>
- *
- * <pre>
- * StringUtils.replaceChars(null, *, *) = null
- * StringUtils.replaceChars("", *, *) = ""
- * StringUtils.replaceChars("abc", null, *) = "abc"
- * StringUtils.replaceChars("abc", "", *) = "abc"
- * StringUtils.replaceChars("abc", "b", null) = "ac"
- * StringUtils.replaceChars("abc", "b", "") = "ac"
- * StringUtils.replaceChars("abcba", "bc", "yz") = "ayzya"
- * StringUtils.replaceChars("abcba", "bc", "y") = "ayya"
- * StringUtils.replaceChars("abcba", "bc", "yzx") = "ayzya"
- * </pre>
- *
- * @param str String to replace characters in, may be null
- * @param searchChars a set of characters to search for, may be null
- * @param replaceChars a set of characters to replace, may be null
- * @return modified String, <code>null</code> if null string input
- * @since 2.0
- */
- public static String replaceChars(String str, String searchChars,
- String replaceChars)
- {
- if (isEmpty( str ) || isEmpty( searchChars ))
- {
- return str;
- }
- if (replaceChars == null)
- {
- replaceChars = "";
- }
- boolean modified = false;
- StringBuilder buf = new StringBuilder( str.length() );
- for (int i = 0; i < str.length(); i++)
- {
- char ch = str.charAt( i );
- int index = searchChars.indexOf( ch );
- if (index >= 0)
- {
- modified = true;
- if (index < replaceChars.length())
- {
- buf.append( replaceChars.charAt( index ) );
- }
- }
- else
- {
- buf.append( ch );
- }
- }
- if (modified)
- {
- return buf.toString();
- }
- else
- {
- return str;
- }
- }
-
- /**
- * <p>Checks if a String is empty ("") or null.</p>
- *
- * <pre>
- * StringUtils.isEmpty(null) = true
- * StringUtils.isEmpty("") = true
- * StringUtils.isEmpty(" ") = false
- * StringUtils.isEmpty("bob") = false
- * StringUtils.isEmpty(" bob ") = false
- * </pre>
- *
- * <p>NOTE: This method changed in Lang version 2.0.
- * It no longer trims the String.
- * That functionality is available in isBlank().</p>
- *
- * @param str the String to check, may be null
- * @return <code>true</code> if the String is empty or null
- */
- public static boolean isEmpty(String str)
- {
- return str == null || str.length() == 0;
- }
-
- /**
- * Perform a series of substitutions. The substitutions
- * are performed by replacing ${variable} in the target
- * string with the value of provided by the key "variable"
- * in the provided hashtable.
- *
- * If the "variable" is not found then an exception is
- * thrown when "isLenient" is false - otherwise the unexpanded
- * ${variable} is written to the string buffer.
- *
- * @param argStr target string
- * @param vars name/value pairs used for substitution
- * @param isLenient ignore failures
- * @return String target string with replacements.
- */
- public static StringBuilder stringSubstitution(String argStr, Map vars, boolean isLenient)
- {
- StringBuilder argBuf = new StringBuilder();
- int argStrLength = argStr.length();
-
- for (int cIdx = 0 ; cIdx < argStrLength;)
- {
- char ch = argStr.charAt(cIdx);
- char del = ' ';
-
- switch (ch)
- {
- case '$':
- StringBuilder nameBuf = new StringBuilder();
- del = argStr.charAt(cIdx+1);
- if( del == '{')
- {
- cIdx++;
-
- for (++cIdx ; cIdx < argStr.length(); ++cIdx)
- {
- ch = argStr.charAt(cIdx);
- if (ch != '}')
- nameBuf.append(ch);
- else
- break;
- }
-
- if (nameBuf.length() > 0)
- {
- Object value = vars.get(nameBuf.toString());
-
- if (value != null)
- {
- argBuf.append(value.toString());
- }
- else
- {
- if (!isLenient)
- {
- throw new RuntimeException("No value found for : " + nameBuf );
- }
- else
- {
- argBuf.append("${").append(nameBuf).append("}");
- }
- }
-
- del = argStr.charAt(cIdx);
-
- if( del != '}')
- {
- throw new RuntimeException("Delimineter not found for : " + nameBuf );
- }
- }
-
- cIdx++;
- }
- else
- {
- argBuf.append(ch);
- ++cIdx;
- }
-
- break;
-
- default:
- argBuf.append(ch);
- ++cIdx;
- break;
- }
- }
-
- return argBuf;
- }
-}
diff --git a/src/java/org/apache/fulcrum/yaafi/framework/util/Validate.java b/src/java/org/apache/fulcrum/yaafi/framework/util/Validate.java
index 5b2888d..4382015 100644
--- a/src/java/org/apache/fulcrum/yaafi/framework/util/Validate.java
+++ b/src/java/org/apache/fulcrum/yaafi/framework/util/Validate.java
@@ -29,7 +29,7 @@
* deemed invalid, an IllegalArgumentException is thrown. For example:</p>
*
* <pre>
- * Validate.isTrue( i > 0, "The value must be greater than zero: ", i);
+ * Validate.isTrue( i > 0, "The value must be greater than zero: ", i);
* Validate.notNull( surname, "The surname must not be null");
* </pre>
*
@@ -93,7 +93,7 @@
* expression.</p>
*
* <pre>
- * Validate.isTrue( i > 0, "The value must be greater than zero: ", i);
+ * Validate.isTrue( i > 0, "The value must be greater than zero: ", i);
* </pre>
*
* <p>For performance reasons, the long value is passed as a separate parameter and
@@ -121,7 +121,7 @@
* expression.</p>
*
* <pre>
- * Validate.isTrue( d > 0.0, "The value must be greater than zero: ", d);
+ * Validate.isTrue( d > 0.0, "The value must be greater than zero: ", d);
* </pre>
*
* <p>For performance reasons, the double value is passed as a separate parameter and
@@ -150,7 +150,7 @@
* expression.</p>
*
* <pre>
- * Validate.isTrue( (i > 0), "The value must be greater than zero");
+ * Validate.isTrue( (i > 0), "The value must be greater than zero");
* Validate.isTrue( myObject.isOk(), "The object is not OK");
* </pre>
*
diff --git a/src/java/org/apache/fulcrum/yaafi/interceptor/baseservice/BaseInterceptorServiceImpl.java b/src/java/org/apache/fulcrum/yaafi/interceptor/baseservice/BaseInterceptorServiceImpl.java
index bd1f78a..44dff16 100644
--- a/src/java/org/apache/fulcrum/yaafi/interceptor/baseservice/BaseInterceptorServiceImpl.java
+++ b/src/java/org/apache/fulcrum/yaafi/interceptor/baseservice/BaseInterceptorServiceImpl.java
@@ -32,7 +32,7 @@
import org.apache.avalon.framework.service.ServiceManager;
import org.apache.fulcrum.yaafi.framework.interceptor.AvalonInterceptorContext;
import org.apache.fulcrum.yaafi.framework.interceptor.AvalonInterceptorService;
-import org.apache.fulcrum.yaafi.framework.util.StringUtils;
+import org.apache.commons.lang3.StringUtils;
/**
* A base service providing common functionality for interceptors
diff --git a/src/java/org/apache/fulcrum/yaafi/interceptor/performance/PerformanceInterceptorServiceImpl.java b/src/java/org/apache/fulcrum/yaafi/interceptor/performance/PerformanceInterceptorServiceImpl.java
index 4a83e94..d5ec305 100644
--- a/src/java/org/apache/fulcrum/yaafi/interceptor/performance/PerformanceInterceptorServiceImpl.java
+++ b/src/java/org/apache/fulcrum/yaafi/interceptor/performance/PerformanceInterceptorServiceImpl.java
@@ -271,6 +271,7 @@
/**
* Prints the argument list.
*
+ * @param args array of arguments
* @return the debug output
*/
protected String toString( Object[] args )
diff --git a/src/java/org/apache/fulcrum/yaafi/interceptor/util/ArgumentToStringBuilderImpl.java b/src/java/org/apache/fulcrum/yaafi/interceptor/util/ArgumentToStringBuilderImpl.java
index 7481abf..4a16e2f 100644
--- a/src/java/org/apache/fulcrum/yaafi/interceptor/util/ArgumentToStringBuilderImpl.java
+++ b/src/java/org/apache/fulcrum/yaafi/interceptor/util/ArgumentToStringBuilderImpl.java
@@ -25,7 +25,7 @@
import java.util.Dictionary;
import java.util.Iterator;
-import org.apache.fulcrum.yaafi.framework.util.StringUtils;
+import org.apache.commons.lang3.StringUtils;
/**
* Creates a string representation of method argument.
@@ -50,7 +50,7 @@
private static final int MAX_LINE_LENGTH = 2000;
/** seperator for the arguments in the logfile */
- private static final char SEPERATOR = ';';
+ private static final String SEPERATOR = ";";
/** the output for a NULL value **/
private static final String NULL_STRING = "<null>";
@@ -621,6 +621,7 @@
* Create a string representation of a String.
*
* @param string the string to print
+ * @return the result
*/
protected String toString(String string)
{
@@ -991,39 +992,33 @@
* away excessive fluff.
*
* @param source the source string
+ * @return formatted string
*/
protected String format( String source )
{
boolean isTruncated = false;
+
+ // test for null or empty string
+ if ( StringUtils.isEmpty(source) )
+ return "";
+
+ // remove the line breaks and tabs for logging output and replace
+ StringUtils.replace(source, "\r", " ");
+ StringUtils.replace(source, "\n", " ");
+ StringUtils.replace(source, "\t", " ");
+ StringUtils.replace(source, SEPERATOR, " ");
+
+ // Build the output
StringBuilder stringBuilder = new StringBuilder(source);
// trim the string to avoid dumping tons of data
-
if( stringBuilder.length() > this.getMaxArgLength() )
{
stringBuilder.delete(this.getMaxArgLength()-1, stringBuilder.length());
isTruncated = true;
}
-
- // remove the line breaks and tabs for logging output and replace
-
- for( int i=0; i<stringBuilder.length(); i++ )
- {
- if( ( stringBuilder.charAt(i) == '\r' ) ||
- ( stringBuilder.charAt(i) == '\n' ) ||
- ( stringBuilder.charAt(i) == '\t' ) )
- {
- stringBuilder.setCharAt(i,' ');
- }
-
- if( ( stringBuilder.charAt(i) == SEPERATOR ) )
- {
- stringBuilder.setCharAt(i,' ');
- }
- }
-
+
// show the user that we truncated the ouptut
-
if( isTruncated )
{
if (source.endsWith("]"))
@@ -1035,7 +1030,6 @@
stringBuilder.append(" ...");
}
}
-
return stringBuilder.toString();
}
}
diff --git a/src/java/org/apache/fulcrum/yaafi/interceptor/util/StopWatch.java b/src/java/org/apache/fulcrum/yaafi/interceptor/util/StopWatch.java
index 0f3e3b5..116378c 100644
--- a/src/java/org/apache/fulcrum/yaafi/interceptor/util/StopWatch.java
+++ b/src/java/org/apache/fulcrum/yaafi/interceptor/util/StopWatch.java
@@ -40,9 +40,9 @@
* Thus you cannot now call stop before start, resume before suspend or
* unsplit before split.</p>
*
- * <p>1. split(), suspend(), or stop() cannot be invoked twice<br />
- * 2. unsplit() may only be called if the watch has been split()<br />
- * 3. resume() may only be called if the watch has been suspend()<br />
+ * <p>1. split(), suspend(), or stop() cannot be invoked twice <br>
+ * 2. unsplit() may only be called if the watch has been split()<br>
+ * 3. resume() may only be called if the watch has been suspend()<br>
* 4. start() cannot be called twice without calling reset()</p>
*
* @author Henri Yandell
diff --git a/src/java/org/apache/fulcrum/yaafi/service/baseservice/BaseServiceImpl.java b/src/java/org/apache/fulcrum/yaafi/service/baseservice/BaseServiceImpl.java
index ce9945f..bfade81 100644
--- a/src/java/org/apache/fulcrum/yaafi/service/baseservice/BaseServiceImpl.java
+++ b/src/java/org/apache/fulcrum/yaafi/service/baseservice/BaseServiceImpl.java
@@ -204,6 +204,8 @@
/**
* @see org.apache.avalon.framework.service.ServiceManager#hasService(java.lang.String)
+ * @param key name of the service to test for
+ * @return boolean indicator if the service exists
*/
protected boolean hasService(String key)
{
@@ -212,6 +214,8 @@
/**
* @see org.apache.avalon.framework.service.ServiceManager#lookup(java.lang.String)
+ * @param key name of service to lookup from the service manager
+ * @return reference to the service
*/
protected Object lookup(String key)
{
@@ -228,6 +232,7 @@
}
/**
+ * @param object service to release
* @see org.apache.avalon.framework.service.ServiceManager#release(java.lang.Object)
*/
protected void release(Object object)
diff --git a/src/java/org/apache/fulcrum/yaafi/service/shutdown/ShutdownEntry.java b/src/java/org/apache/fulcrum/yaafi/service/shutdown/ShutdownEntry.java
index 39fb249..93c19d7 100644
--- a/src/java/org/apache/fulcrum/yaafi/service/shutdown/ShutdownEntry.java
+++ b/src/java/org/apache/fulcrum/yaafi/service/shutdown/ShutdownEntry.java
@@ -180,6 +180,8 @@
/**
* Creates an InputStream
+ * @return InputStream of the location
+ * @throws IOException
*/
public InputStream locate() throws IOException
{
@@ -188,6 +190,8 @@
/**
* Creates a message digest
+ * @param is Input stream
+ * @return byte array of the input stream
*/
private byte[] getDigest( InputStream is )
throws Exception
diff --git a/src/site/site.xml b/src/site/site.xml
index e595b8d..585acdb 100644
--- a/src/site/site.xml
+++ b/src/site/site.xml
@@ -24,7 +24,6 @@
<version position="left" />
<publishDate format="dd MMM yyyy"/>
<body>
- <head></head>
<menu name="Overview">
<item name="Main" href="/index.html"/>
<item name="Downloads" href="/downloads.html"/>
@@ -64,6 +63,5 @@
<item name="Design Considerations" href="/design.html"/>
<item name="Todo's" href="/todo.html"/>
</menu>
- ${reports}
</body>
</project>