|
From: <tri...@us...> - 2008-12-03 14:27:13
|
Revision: 892
http://equanda.svn.sourceforge.net/equanda/?rev=892&view=rev
Author: triathlon98
Date: 2008-12-03 14:27:10 +0000 (Wed, 03 Dec 2008)
Log Message:
-----------
EQ-299 remove checkstyle errors and warnings
Modified Paths:
--------------
trunk/config/checkstyle.xml
trunk/equanda-util/src/main/java/org/equanda/util/accessor/ObjectAccessor.java
trunk/equanda-util/src/main/java/org/equanda/util/barcode/EAN128Support.java
trunk/equanda-util/src/main/java/org/equanda/util/script/BooleanExtension.java
trunk/equanda-util/src/main/java/org/equanda/util/script/DatabaseExtension.java
trunk/equanda-util/src/main/java/org/equanda/util/script/DateExtension.java
trunk/equanda-util/src/main/java/org/equanda/util/script/FScriptExtensionPool.java
trunk/equanda-util/src/main/java/org/equanda/util/script/FileExtension.java
trunk/equanda-util/src/main/java/org/equanda/util/script/GeneralExtension.java
trunk/equanda-util/src/main/java/org/equanda/util/script/StringExtension.java
trunk/equanda-util/src/main/java/org/equanda/util/xml/XMLSerializer.java
Modified: trunk/config/checkstyle.xml
===================================================================
--- trunk/config/checkstyle.xml 2008-12-03 14:09:45 UTC (rev 891)
+++ trunk/config/checkstyle.xml 2008-12-03 14:27:10 UTC (rev 892)
@@ -196,7 +196,9 @@
<property name="severity" value="warning"/>
</module>
<!--<module name="MagicNumber"/>-->
- <module name="MissingSwitchDefault"/>
+ <module name="MissingSwitchDefault">
+ <property name="severity" value="info"/>
+ </module>
<module name="ModifiedControlVariable"/>
<!--<module name="RedundantThrows"/>-->
<module name="SimplifyBooleanExpression"/>
Modified: trunk/equanda-util/src/main/java/org/equanda/util/accessor/ObjectAccessor.java
===================================================================
--- trunk/equanda-util/src/main/java/org/equanda/util/accessor/ObjectAccessor.java 2008-12-03 14:09:45 UTC (rev 891)
+++ trunk/equanda-util/src/main/java/org/equanda/util/accessor/ObjectAccessor.java 2008-12-03 14:27:10 UTC (rev 892)
@@ -42,7 +42,7 @@
* @author NetRom team
* @author <a href="mailto:jo...@pr...">Joachim Van der Auwera</a>
*/
-public class ObjectAccessor
+public final class ObjectAccessor
{
private static final String CLASS_SELECTOR_SUFFIX = "Selector";
private static final String CLASS_SELECTOREJB_SUFFIX = "SelectorEJB";
@@ -54,9 +54,9 @@
private static final String METHOD_ADDER_PREFIX = "set";
private static final long CACHE_MAX_AGE = 300000; // fluch cache every x ms
- protected static final WeakHashMap<String, Method> methodCache = new WeakHashMap<String, Method>();
- protected static long cacheTimeout;
- protected static Class[] uoidClass = new Class[1]; // avoid dependency on equanda core
+ protected static final WeakHashMap<String, Method> METHOD_CACHE = new WeakHashMap<String, Method>();
+ protected static long CACHE_TIMEOUT;
+ protected static Class[] UOID_CLASS = new Class[1]; // avoid dependency on equanda core
private ObjectAccessor() {}
@@ -82,7 +82,7 @@
// avoid dependency on equanda core
try
{
- uoidClass[ 0 ] = Thread.currentThread().getContextClassLoader().loadClass( "org.equanda.persistence.UOID" );
+ UOID_CLASS[ 0 ] = Thread.currentThread().getContextClassLoader().loadClass( "org.equanda.persistence.UOID" );
}
catch ( ClassNotFoundException cnfe )
{
@@ -92,11 +92,11 @@
public static void clean()
{
- methodCache.clear();
+ METHOD_CACHE.clear();
}
public static Object getSelector( String jndi, String name )
- throws ObjectAccessorException
+ throws ObjectAccessorException
{
Object selector;
// build the selector home name
@@ -122,7 +122,7 @@
catch ( ClassCastException cce )
{
throw new ObjectAccessorException(
- "Object found for " + jndi + " does not match the type of " + selectorHomeName, cce );
+ "Object found for " + jndi + " does not match the type of " + selectorHomeName, cce );
}
catch ( NamingException ne )
{
@@ -145,7 +145,7 @@
* @throws ObjectAccessorException oops
*/
public static Object createBean( String jndi, String name, Object uoid )
- throws ObjectAccessorException
+ throws ObjectAccessorException
{
Object ejb;
// build the ejb home name
@@ -181,7 +181,7 @@
catch ( ClassCastException cce )
{
throw new ObjectAccessorException(
- "Object found for " + jndi + " does not match the type of " + ejbHomeName, cce );
+ "Object found for " + jndi + " does not match the type of " + ejbHomeName, cce );
}
catch ( NamingException ne )
{
@@ -196,7 +196,7 @@
Method init;
try
{
- init = ejb.getClass().getMethod( METHOD_INIT, uoidClass );
+ init = ejb.getClass().getMethod( METHOD_INIT, UOID_CLASS );
}
catch ( Exception e )
{
@@ -224,9 +224,9 @@
* @throws ObjectAccessorException oops
*/
public static Object createProxy( String prefix, String name )
- throws ObjectAccessorException
+ throws ObjectAccessorException
{
- String proxyName = getProxyClassName(prefix, name);
+ String proxyName = getProxyClassName( prefix, name );
Class proxyClass = getProxyClass( proxyName );
Method init;
try
@@ -269,9 +269,9 @@
* @throws ObjectAccessorException oops
*/
public static Class getProxyClass( String prefix, String name )
- throws ObjectAccessorException
+ throws ObjectAccessorException
{
- return getProxyClass( getProxyClassName(prefix, name) );
+ return getProxyClass( getProxyClassName( prefix, name ) );
}
/**
@@ -282,7 +282,7 @@
* @throws ObjectAccessorException oops
*/
public static Class getProxyClass( String proxyName )
- throws ObjectAccessorException
+ throws ObjectAccessorException
{
try
{
@@ -295,7 +295,7 @@
}
public static Object get( Object obj, String fieldName )
- throws ObjectAccessorException
+ throws ObjectAccessorException
{
String getterName = TextBuilder.newInstance().append( METHOD_GETTER_PREFIX ).append( fieldName ).toString();
try
@@ -314,7 +314,7 @@
}
public static void set( Object obj, String fieldName, Class[] param, Object[] values )
- throws ObjectAccessorException
+ throws ObjectAccessorException
{
String setterName = TextBuilder.newInstance().append( METHOD_SETTER_PREFIX ).append( fieldName ).toString();
try
@@ -333,7 +333,7 @@
}
public static void add( Object obj, String fieldName, Class[] param, Object[] values )
- throws ObjectAccessorException
+ throws ObjectAccessorException
{
String setterName = TextBuilder.newInstance().append( METHOD_ADDER_PREFIX ).append( fieldName ).toString();
try
@@ -352,7 +352,7 @@
}
public static Method getMethod( Class objClass, String name, Class[] param )
- throws ObjectAccessorException
+ throws ObjectAccessorException
{
try
{
@@ -367,32 +367,32 @@
catch ( NoSuchMethodException e )
{
throw new ObjectAccessorException(
- "Method " + name + "(" + param + ") not found for class " + objClass.getCanonicalName() );
+ "Method " + name + "(" + param + ") not found for class " + objClass.getCanonicalName() );
}
}
protected static void addToCache( Class clsName, String methodName, Method method )
{
- methodCache.put( clsName.getName() + "." + methodName, method );
- if ( cacheTimeout == 0 ) cacheTimeout = System.currentTimeMillis() + CACHE_MAX_AGE;
+ METHOD_CACHE.put( clsName.getName() + "." + methodName, method );
+ if ( CACHE_TIMEOUT == 0 ) CACHE_TIMEOUT = System.currentTimeMillis() + CACHE_MAX_AGE;
}
protected static Method getFromCache( Class clsName, String methodName )
{
// invalidate the cache every CACHE_MAX_AGE ms to prevent stale data
- if ( System.currentTimeMillis() > cacheTimeout )
+ if ( System.currentTimeMillis() > CACHE_TIMEOUT )
{
// flush cache
- cacheTimeout = 0;
- methodCache.clear();
+ CACHE_TIMEOUT = 0;
+ METHOD_CACHE.clear();
return null;
}
String name = clsName.getName() + "." + methodName;
- return methodCache.get( name );
+ return METHOD_CACHE.get( name );
}
public static UserTransaction startTransaction()
- throws Exception
+ throws Exception
{
InitialContext ctx = new InitialContext();
UserTransaction tx = (UserTransaction) ctx.lookup( "UserTransaction" );
Modified: trunk/equanda-util/src/main/java/org/equanda/util/barcode/EAN128Support.java
===================================================================
--- trunk/equanda-util/src/main/java/org/equanda/util/barcode/EAN128Support.java 2008-12-03 14:09:45 UTC (rev 891)
+++ trunk/equanda-util/src/main/java/org/equanda/util/barcode/EAN128Support.java 2008-12-03 14:27:10 UTC (rev 892)
@@ -31,7 +31,7 @@
*
* @author <a href="mailto:jo...@pr...">Joachim Van der Auwera</a>
*/
-public class EAN128Support
+public final class EAN128Support
{
/**
* array with the fixed length for the AI's, according to the first digits of the AI.
Modified: trunk/equanda-util/src/main/java/org/equanda/util/script/BooleanExtension.java
===================================================================
--- trunk/equanda-util/src/main/java/org/equanda/util/script/BooleanExtension.java 2008-12-03 14:09:45 UTC (rev 891)
+++ trunk/equanda-util/src/main/java/org/equanda/util/script/BooleanExtension.java 2008-12-03 14:27:10 UTC (rev 892)
@@ -34,7 +34,7 @@
*
* @author <a href="mailto:jo...@pr...">Joachim Van der Auwera</a>
*/
-public class BooleanExtension
+public final class BooleanExtension
{
public static final Integer TRUE = new Integer( 1 );
public static final Integer FALSE = new Integer( 0 );
Modified: trunk/equanda-util/src/main/java/org/equanda/util/script/DatabaseExtension.java
===================================================================
--- trunk/equanda-util/src/main/java/org/equanda/util/script/DatabaseExtension.java 2008-12-03 14:09:45 UTC (rev 891)
+++ trunk/equanda-util/src/main/java/org/equanda/util/script/DatabaseExtension.java 2008-12-03 14:27:10 UTC (rev 892)
@@ -56,7 +56,7 @@
private Connection connection = null;
private Hashtable variables = new Hashtable();
private ExceptionListener exceptionListener = null;
- private static JDBCLogger nullLogger = new JDBCLogger()
+ private static JDBCLogger NULL_LOGGER = new JDBCLogger()
{
public final boolean isDebug() { return false; }
@@ -66,7 +66,7 @@
public final void logInfo( String database, String comment ) {}
};
- private JDBCLogger logger = nullLogger;
+ private JDBCLogger logger = NULL_LOGGER;
public DatabaseExtension( Connection connection )
{
@@ -87,7 +87,7 @@
public void setJDBCLogger( JDBCLogger logger )
{
this.logger = logger;
- if ( logger == null ) this.logger = nullLogger;
+ if ( logger == null ) this.logger = NULL_LOGGER;
}
@@ -187,9 +187,7 @@
throw new FSUnsupportedException();
}
- /**
- * ExceptionListener allows proper handling of database access errors
- */
+ /** ExceptionListener allows proper handling of database access errors */
public interface ExceptionListener
{
public void errorOccured( Throwable t, String extra )
@@ -198,9 +196,7 @@
public void recovered();
}
- /**
- * JDBCLogger allows proper handling of database access logging
- */
+ /** JDBCLogger allows proper handling of database access logging */
public interface JDBCLogger
{
public boolean isInfo();
@@ -212,9 +208,7 @@
public void logDebug( String database, String comment );
}
- /**
- * DatabaseVariable contains all the data for a database resultset etc
- */
+ /** DatabaseVariable contains all the data for a database resultset etc */
private class DatabaseVariable
{
private Connection connection;
@@ -286,7 +280,7 @@
if ( fields == null ) fields = new Hashtable();
fields.clear();
if ( logger.isDebug() ) logger.logDebug( database, "get field names" );
- for ( int i = 1 ; i <= colCount ; i++ )
+ for ( int i = 1; i <= colCount ; i++ )
{
fields.put( md.getColumnName( i ).toLowerCase(), new Integer( i ) );
}
@@ -320,9 +314,7 @@
return null;
}
- /**
- * next moves to the next record and returns whether this has succeeded
- */
+ /** next moves to the next record and returns whether this has succeeded */
public Object next()
throws FSException
{
@@ -336,9 +328,10 @@
{
if ( logger.isDebug() ) logger.logDebug( database, "get data" );
// cache results for this row, to allow out of order fetching
- for ( int i = 1 ; i <= colCount ; i++ )
+ for ( int i = 1; i <= colCount ; i++ )
{
- String str = "???"; // make sure we don't get thrown out for fields which don't support getString
+ String str = "???"
+ ; // make sure we don't get thrown out for fields which don't support getString
try
{
str = results.getString( i );
@@ -471,7 +464,7 @@
{
exceptionListener.errorOccured( e,
"dbvar.field(" + params.get( 0 ).toString() + " "
- + params.get( 1 ).toString() );
+ + params.get( 1 ).toString() );
}
}
if ( rs != null )
Modified: trunk/equanda-util/src/main/java/org/equanda/util/script/DateExtension.java
===================================================================
--- trunk/equanda-util/src/main/java/org/equanda/util/script/DateExtension.java 2008-12-03 14:09:45 UTC (rev 891)
+++ trunk/equanda-util/src/main/java/org/equanda/util/script/DateExtension.java 2008-12-03 14:27:10 UTC (rev 892)
@@ -24,9 +24,6 @@
package org.equanda.util.script;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.GregorianCalendar;
import murlen.util.fscript.FSException;
import murlen.util.fscript.FSFastExtension;
import murlen.util.fscript.FSFunctionExtension;
@@ -35,12 +32,16 @@
import org.joda.time.format.DateTimeFormat;
import org.joda.time.format.DateTimeFormatter;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.GregorianCalendar;
+
/**
* StringExtension, FScript extension, string manipulations
*
* @author <a href="mailto:jo...@pr...">Joachim Van der Auwera</a>
*/
-public class DateExtension
+public final class DateExtension
{
public static final DateTimeFormatter DATE_FORMAT = DateTimeFormat.forPattern( "yyyyMMdd" );
public static final DateTimeFormatter TIME_FORMAT = DateTimeFormat.forPattern( "HHmmssSSS" );
@@ -69,7 +70,7 @@
throws FSException
{
if ( params.size() != 2 || !( params.get( 0 ) instanceof String )
- || !( params.get( 1 ) instanceof Integer ) )
+ || !( params.get( 1 ) instanceof Integer ) )
{
throw new FSException( "datecalc(string, integer) wrong parameter count/type" );
}
@@ -156,7 +157,7 @@
throws FSException
{
if ( params.size() != 2 || !( params.get( 0 ) instanceof String ) ||
- !( params.get( 1 ) instanceof Integer ) )
+ !( params.get( 1 ) instanceof Integer ) )
{
throw new FSException( "setdateday(string,integer) wrong parameter count/type" );
}
@@ -184,7 +185,7 @@
throws FSException
{
if ( params.size() != 2 || !( params.get( 0 ) instanceof String ) ||
- !( params.get( 1 ) instanceof Integer ) )
+ !( params.get( 1 ) instanceof Integer ) )
{
throw new FSException( "setdatedaypast(string,integer) wrong parameter count/type" );
}
Modified: trunk/equanda-util/src/main/java/org/equanda/util/script/FScriptExtensionPool.java
===================================================================
--- trunk/equanda-util/src/main/java/org/equanda/util/script/FScriptExtensionPool.java 2008-12-03 14:09:45 UTC (rev 891)
+++ trunk/equanda-util/src/main/java/org/equanda/util/script/FScriptExtensionPool.java 2008-12-03 14:27:10 UTC (rev 892)
@@ -36,27 +36,27 @@
*
* @author <a href="mailto:jo...@pr...">Joachim Van der Auwera</a>
*/
-public class FScriptExtensionPool
+public final class FScriptExtensionPool
implements FSExtension
{
- private static FScriptExtensionPool instance = null;
- private static ArrayList extensions = new ArrayList();
+ private static FScriptExtensionPool INSTANCE = null;
+ private static ArrayList EXTENSIONS = new ArrayList();
private FScriptExtensionPool() {}
public static FScriptExtensionPool getPool()
{
- if ( instance == null ) instance = new FScriptExtensionPool();
- return instance;
+ if ( INSTANCE == null ) INSTANCE = new FScriptExtensionPool();
+ return INSTANCE;
}
public Object getVar( String name )
throws FSException
{
FSExtension ext;
- for ( int i = 0 ; i < extensions.size() ; i++ )
+ for ( int i = 0; i < EXTENSIONS.size() ; i++ )
{
- ext = (FSExtension) extensions.get( i );
+ ext = (FSExtension) EXTENSIONS.get( i );
try
{
return ext.getVar( name );
@@ -71,9 +71,9 @@
throws FSException
{
FSExtension ext;
- for ( int i = 0 ; i < extensions.size() ; i++ )
+ for ( int i = 0; i < EXTENSIONS.size() ; i++ )
{
- ext = (FSExtension) extensions.get( i );
+ ext = (FSExtension) EXTENSIONS.get( i );
try
{
ext.setVar( name, value );
@@ -89,9 +89,9 @@
throws FSException
{
FSExtension ext;
- for ( int i = 0 ; i < extensions.size() ; i++ )
+ for ( int i = 0; i < EXTENSIONS.size() ; i++ )
{
- ext = (FSExtension) extensions.get( i );
+ ext = (FSExtension) EXTENSIONS.get( i );
try
{
return ext.callFunction( name, params );
@@ -106,9 +106,9 @@
throws FSException
{
FSExtension ext;
- for ( int i = 0 ; i < extensions.size() ; i++ )
+ for ( int i = 0; i < EXTENSIONS.size() ; i++ )
{
- ext = (FSExtension) extensions.get( i );
+ ext = (FSExtension) EXTENSIONS.get( i );
try
{
return ext.getVar( name, index );
@@ -123,9 +123,9 @@
throws FSException
{
FSExtension ext;
- for ( int i = 0 ; i < extensions.size() ; i++ )
+ for ( int i = 0; i < EXTENSIONS.size() ; i++ )
{
- ext = (FSExtension) extensions.get( i );
+ ext = (FSExtension) EXTENSIONS.get( i );
try
{
ext.setVar( name, index, value );
@@ -139,6 +139,6 @@
public static void add( FSExtension ext )
{
- extensions.add( ext );
+ EXTENSIONS.add( ext );
}
}
Modified: trunk/equanda-util/src/main/java/org/equanda/util/script/FileExtension.java
===================================================================
--- trunk/equanda-util/src/main/java/org/equanda/util/script/FileExtension.java 2008-12-03 14:09:45 UTC (rev 891)
+++ trunk/equanda-util/src/main/java/org/equanda/util/script/FileExtension.java 2008-12-03 14:27:10 UTC (rev 892)
@@ -24,9 +24,12 @@
package org.equanda.util.script;
+import murlen.util.fscript.FSException;
+import murlen.util.fscript.FSFastExtension;
+import murlen.util.fscript.FSFunctionExtension;
+
+import java.io.*;
import java.util.ArrayList;
-import java.io.*;
-import murlen.util.fscript.*;
/**
* FileExtension, FScript extension, file i/o,
@@ -49,7 +52,7 @@
*
* @author <a href="mailto:jo...@pr...">Joachim Van der Auwera</a>
*/
-public class FileExtension
+public final class FileExtension
{
private static ArrayList files = new ArrayList();
@@ -65,7 +68,7 @@
int n;
if ( params.size() != 2 ) throw new FSException( "open(file,mode) needs two parameters" );
// find unused spot in list of files
- for ( n = 0 ; n < files.size() ; n++ )
+ for ( n = 0; n < files.size() ; n++ )
{
if ( files.get( n ) == null ) break;
}
@@ -139,7 +142,7 @@
}
int n;
String s = "";
- for ( n = 1 ; n < params.size() ; n++ )
+ for ( n = 1; n < params.size() ; n++ )
{
s += params.get( n );
}
@@ -257,7 +260,7 @@
throws FSException
{
if ( params.size() != 2 || !( params.get( 0 ) instanceof String )
- || !( params.get( 1 ) instanceof String ) )
+ || !( params.get( 1 ) instanceof String ) )
{
throw new FSException( "rename(from,to) parameter count/type incorrect" );
}
Modified: trunk/equanda-util/src/main/java/org/equanda/util/script/GeneralExtension.java
===================================================================
--- trunk/equanda-util/src/main/java/org/equanda/util/script/GeneralExtension.java 2008-12-03 14:09:45 UTC (rev 891)
+++ trunk/equanda-util/src/main/java/org/equanda/util/script/GeneralExtension.java 2008-12-03 14:27:10 UTC (rev 892)
@@ -39,8 +39,10 @@
* @author <a href="mailto:jo...@pr...">Joachim Van der Auwera</a>
* @author <a href="mailto:an...@pa...">Andrei Chiritescu</a>
*/
-public class GeneralExtension
+public final class GeneralExtension
{
+ private GeneralExtension() {}
+
public static void addExtension( FSFastExtension ext )
{
ext.addFunctionExtension( "wait", new FSFunctionExtension()
Modified: trunk/equanda-util/src/main/java/org/equanda/util/script/StringExtension.java
===================================================================
--- trunk/equanda-util/src/main/java/org/equanda/util/script/StringExtension.java 2008-12-03 14:09:45 UTC (rev 891)
+++ trunk/equanda-util/src/main/java/org/equanda/util/script/StringExtension.java 2008-12-03 14:27:10 UTC (rev 892)
@@ -39,7 +39,7 @@
* @author <a href="mailto:jo...@pr...">Joachim Van der Auwera</a>
* @author <a href="mailto:an...@pa...">Andrei Chiritescu</a>
*/
-public class StringExtension
+public final class StringExtension
{
private StringExtension()
{}
@@ -619,7 +619,7 @@
throws FSException
{
if ( params.size() != 3 || !( params.get( 1 ) instanceof Integer )
- || !( params.get( 2 ) instanceof Integer ) )
+ || !( params.get( 2 ) instanceof Integer ) )
{
throw new FSException( "wordwrap(string,linelen,line) parameter count or type wrong" );
}
@@ -640,8 +640,8 @@
throws FSException
{
if ( params.size() != 2
- || !( params.get( 0 ) instanceof String ) || !( params.get( 1 ) instanceof String )
- || params.get( 0 ) == null || params.get( 1 ) == null )
+ || !( params.get( 0 ) instanceof String ) || !( params.get( 1 ) instanceof String )
+ || params.get( 0 ) == null || params.get( 1 ) == null )
{
throw new FSException(
"split(string stringToSplit, string separator) parameter count or type wrong" );
Modified: trunk/equanda-util/src/main/java/org/equanda/util/xml/XMLSerializer.java
===================================================================
--- trunk/equanda-util/src/main/java/org/equanda/util/xml/XMLSerializer.java 2008-12-03 14:09:45 UTC (rev 891)
+++ trunk/equanda-util/src/main/java/org/equanda/util/xml/XMLSerializer.java 2008-12-03 14:27:10 UTC (rev 892)
@@ -41,7 +41,6 @@
*/
public class XMLSerializer
{
-
protected Writer writer;
/**
@@ -133,7 +132,7 @@
// write attributes
NamedNodeMap nnm = element.getAttributes();
- for ( int i = 0 ; i < nnm.getLength() ; i++ )
+ for ( int i = 0; i < nnm.getLength() ; i++ )
{
Attr item = (Attr) nnm.item( i );
String name = item.getName();
@@ -236,7 +235,7 @@
private void escape( TextBuilder sb, String text, boolean keepQuote )
{
int length = text.length();
- for ( int i = 0 ; i < length ; ++i )
+ for ( int i = 0; i < length ; ++i )
{
int ch = text.charAt( i );
escapeXMLChar( sb, ch, keepQuote );
@@ -279,7 +278,3 @@
}
}
}
-
-
-
-
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|