You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@turbine.apache.org by pa...@apache.org on 2018/10/25 12:53:53 UTC
svn commit: r1844827 - in /turbine/fulcrum/trunk/yaafi: ./
src/java/org/apache/fulcrum/yaafi/cli/
src/java/org/apache/fulcrum/yaafi/framework/component/
src/java/org/apache/fulcrum/yaafi/framework/configuration/
src/java/org/apache/fulcrum/yaafi/framew...
Author: painter
Date: Thu Oct 25 12:53:53 2018
New Revision: 1844827
URL: http://svn.apache.org/viewvc?rev=1844827&view=rev
Log:
- 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)
Removed:
turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/util/StringUtils.java
Modified:
turbine/fulcrum/trunk/yaafi/pom.xml
turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/cli/Main.java
turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/component/AvalonServiceComponentImpl.java
turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/configuration/ComponentConfigurationPropertiesResolver.java
turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/configuration/ComponentConfigurationPropertiesResolverBaseImpl.java
turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/container/ServiceContainerImpl.java
turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/interceptor/AvalonInterceptorContextImpl.java
turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/role/RoleEntry.java
turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/util/ConfigurationUtil.java
turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/util/Validate.java
turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/interceptor/baseservice/BaseInterceptorServiceImpl.java
turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/interceptor/performance/PerformanceInterceptorServiceImpl.java
turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/interceptor/util/ArgumentToStringBuilderImpl.java
turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/interceptor/util/StopWatch.java
turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/service/baseservice/BaseServiceImpl.java
turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/service/shutdown/ShutdownEntry.java
turbine/fulcrum/trunk/yaafi/src/site/site.xml
Modified: turbine/fulcrum/trunk/yaafi/pom.xml
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/yaafi/pom.xml?rev=1844827&r1=1844826&r2=1844827&view=diff
==============================================================================
--- turbine/fulcrum/trunk/yaafi/pom.xml (original)
+++ turbine/fulcrum/trunk/yaafi/pom.xml Thu Oct 25 12:53:53 2018
@@ -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>
Modified: turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/cli/Main.java
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/cli/Main.java?rev=1844827&r1=1844826&r2=1844827&view=diff
==============================================================================
--- turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/cli/Main.java (original)
+++ turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/cli/Main.java Thu Oct 25 12:53:53 2018
@@ -106,7 +106,11 @@ public class Main implements Runnable, D
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;
Modified: turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/component/AvalonServiceComponentImpl.java
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/component/AvalonServiceComponentImpl.java?rev=1844827&r1=1844826&r2=1844827&view=diff
==============================================================================
--- turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/component/AvalonServiceComponentImpl.java (original)
+++ turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/component/AvalonServiceComponentImpl.java Thu Oct 25 12:53:53 2018
@@ -252,7 +252,7 @@ public class AvalonServiceComponentImpl
/**
* @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 @@ public class AvalonServiceComponentImpl
/**
* @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 @@ public class AvalonServiceComponentImpl
/**
* @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
{
Modified: turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/configuration/ComponentConfigurationPropertiesResolver.java
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/configuration/ComponentConfigurationPropertiesResolver.java?rev=1844827&r1=1844826&r2=1844827&view=diff
==============================================================================
--- turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/configuration/ComponentConfigurationPropertiesResolver.java (original)
+++ turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/configuration/ComponentConfigurationPropertiesResolver.java Thu Oct 25 12:53:53 2018
@@ -39,6 +39,7 @@ public interface ComponentConfigurationP
*
* @param defaults the default properties
* @return the custom properties
+ * @throws Exception throws an exception if failed to resolve
*/
Properties resolve(Properties defaults) throws Exception;
}
Modified: turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/configuration/ComponentConfigurationPropertiesResolverBaseImpl.java
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/configuration/ComponentConfigurationPropertiesResolverBaseImpl.java?rev=1844827&r1=1844826&r2=1844827&view=diff
==============================================================================
--- turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/configuration/ComponentConfigurationPropertiesResolverBaseImpl.java (original)
+++ turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/configuration/ComponentConfigurationPropertiesResolverBaseImpl.java Thu Oct 25 12:53:53 2018
@@ -52,16 +52,18 @@ public abstract class ComponentConfigura
/** 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 @@ public abstract class ComponentConfigura
/**
* @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 @@ public abstract class ComponentConfigura
/**
* 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 @@ public abstract class ComponentConfigura
/**
* Add the Avalon context variables.
+ * @param properties properties to be set
*/
protected void addAvalonContext(Properties properties) throws ContextException
{
@@ -159,10 +165,15 @@ public abstract class ComponentConfigura
);
}
- 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 @@ public abstract class ComponentConfigura
}
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;
}
Modified: turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/container/ServiceContainerImpl.java
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/container/ServiceContainerImpl.java?rev=1844827&r1=1844826&r2=1844827&view=diff
==============================================================================
--- turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/container/ServiceContainerImpl.java (original)
+++ turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/container/ServiceContainerImpl.java Thu Oct 25 12:53:53 2018
@@ -52,10 +52,12 @@ import org.apache.fulcrum.yaafi.framewor
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 class ServiceContainerImpl
public String toString()
{
ToStringBuilder toStringBuilder = new ToStringBuilder(this);
-
toStringBuilder.append("applicationRootDir", this.getApplicationRootDir());
toStringBuilder.append("tempRootDir", this.getTempRootDir());
toStringBuilder.append("componentRolesLocation", this.componentRolesLocation);
Modified: turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/interceptor/AvalonInterceptorContextImpl.java
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/interceptor/AvalonInterceptorContextImpl.java?rev=1844827&r1=1844826&r2=1844827&view=diff
==============================================================================
--- turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/interceptor/AvalonInterceptorContextImpl.java (original)
+++ turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/interceptor/AvalonInterceptorContextImpl.java Thu Oct 25 12:53:53 2018
@@ -91,7 +91,7 @@ public class AvalonInterceptorContextImp
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 @@ public class AvalonInterceptorContextImp
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 @@ public class AvalonInterceptorContextImp
if( invocationDepth != null )
{
int currInvocationDepth = invocationDepth.intValue();
- this.getThreadContext().put(INVOCATIONDEPTH_KEY, new Integer(--currInvocationDepth));
+ this.getThreadContext().put(INVOCATIONDEPTH_KEY, Integer.valueOf(--currInvocationDepth));
}
}
Modified: turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/role/RoleEntry.java
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/role/RoleEntry.java?rev=1844827&r1=1844826&r2=1844827&view=diff
==============================================================================
--- turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/role/RoleEntry.java (original)
+++ turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/role/RoleEntry.java Thu Oct 25 12:53:53 2018
@@ -22,7 +22,7 @@ package org.apache.fulcrum.yaafi.framewo
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>
*/
Modified: turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/util/ConfigurationUtil.java
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/util/ConfigurationUtil.java?rev=1844827&r1=1844826&r2=1844827&view=diff
==============================================================================
--- turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/util/ConfigurationUtil.java (original)
+++ turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/util/ConfigurationUtil.java Thu Oct 25 12:53:53 2018
@@ -107,10 +107,94 @@ public class ConfigurationUtil
}
/**
- * @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();
}
}
Modified: turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/util/Validate.java
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/util/Validate.java?rev=1844827&r1=1844826&r2=1844827&view=diff
==============================================================================
--- turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/util/Validate.java (original)
+++ turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/util/Validate.java Thu Oct 25 12:53:53 2018
@@ -29,7 +29,7 @@ import java.util.Map;
* 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 @@ public class Validate
* 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 @@ public class Validate
* 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 @@ public class Validate
* 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>
*
Modified: turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/interceptor/baseservice/BaseInterceptorServiceImpl.java
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/interceptor/baseservice/BaseInterceptorServiceImpl.java?rev=1844827&r1=1844826&r2=1844827&view=diff
==============================================================================
--- turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/interceptor/baseservice/BaseInterceptorServiceImpl.java (original)
+++ turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/interceptor/baseservice/BaseInterceptorServiceImpl.java Thu Oct 25 12:53:53 2018
@@ -32,7 +32,7 @@ import org.apache.avalon.framework.logge
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
Modified: turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/interceptor/performance/PerformanceInterceptorServiceImpl.java
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/interceptor/performance/PerformanceInterceptorServiceImpl.java?rev=1844827&r1=1844826&r2=1844827&view=diff
==============================================================================
--- turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/interceptor/performance/PerformanceInterceptorServiceImpl.java (original)
+++ turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/interceptor/performance/PerformanceInterceptorServiceImpl.java Thu Oct 25 12:53:53 2018
@@ -271,6 +271,7 @@ public class PerformanceInterceptorServi
/**
* Prints the argument list.
*
+ * @param args array of arguments
* @return the debug output
*/
protected String toString( Object[] args )
Modified: turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/interceptor/util/ArgumentToStringBuilderImpl.java
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/interceptor/util/ArgumentToStringBuilderImpl.java?rev=1844827&r1=1844826&r2=1844827&view=diff
==============================================================================
--- turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/interceptor/util/ArgumentToStringBuilderImpl.java (original)
+++ turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/interceptor/util/ArgumentToStringBuilderImpl.java Thu Oct 25 12:53:53 2018
@@ -25,7 +25,7 @@ import java.util.Collection;
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 @@ public class ArgumentToStringBuilderImpl
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 @@ public class ArgumentToStringBuilderImpl
* 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 @@ public class ArgumentToStringBuilderImpl
* 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 @@ public class ArgumentToStringBuilderImpl
stringBuilder.append(" ...");
}
}
-
return stringBuilder.toString();
}
}
Modified: turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/interceptor/util/StopWatch.java
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/interceptor/util/StopWatch.java?rev=1844827&r1=1844826&r2=1844827&view=diff
==============================================================================
--- turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/interceptor/util/StopWatch.java (original)
+++ turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/interceptor/util/StopWatch.java Thu Oct 25 12:53:53 2018
@@ -40,9 +40,9 @@ package org.apache.fulcrum.yaafi.interce
* 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
Modified: turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/service/baseservice/BaseServiceImpl.java
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/service/baseservice/BaseServiceImpl.java?rev=1844827&r1=1844826&r2=1844827&view=diff
==============================================================================
--- turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/service/baseservice/BaseServiceImpl.java (original)
+++ turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/service/baseservice/BaseServiceImpl.java Thu Oct 25 12:53:53 2018
@@ -204,6 +204,8 @@ public abstract class BaseServiceImpl
/**
* @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 @@ public abstract class BaseServiceImpl
/**
* @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 @@ public abstract class BaseServiceImpl
}
/**
+ * @param object service to release
* @see org.apache.avalon.framework.service.ServiceManager#release(java.lang.Object)
*/
protected void release(Object object)
Modified: turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/service/shutdown/ShutdownEntry.java
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/service/shutdown/ShutdownEntry.java?rev=1844827&r1=1844826&r2=1844827&view=diff
==============================================================================
--- turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/service/shutdown/ShutdownEntry.java (original)
+++ turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/service/shutdown/ShutdownEntry.java Thu Oct 25 12:53:53 2018
@@ -180,6 +180,8 @@ public class ShutdownEntry
/**
* Creates an InputStream
+ * @return InputStream of the location
+ * @throws IOException
*/
public InputStream locate() throws IOException
{
@@ -188,6 +190,8 @@ public class ShutdownEntry
/**
* Creates a message digest
+ * @param is Input stream
+ * @return byte array of the input stream
*/
private byte[] getDigest( InputStream is )
throws Exception
Modified: turbine/fulcrum/trunk/yaafi/src/site/site.xml
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/yaafi/src/site/site.xml?rev=1844827&r1=1844826&r2=1844827&view=diff
==============================================================================
--- turbine/fulcrum/trunk/yaafi/src/site/site.xml (original)
+++ turbine/fulcrum/trunk/yaafi/src/site/site.xml Thu Oct 25 12:53:53 2018
@@ -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>