Update of /cvsroot/jicarilla/jicarilla-sandbox/platform/components/http/impl/src/java/org/jicarilla
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2537/components/http/impl/src/java/org/jicarilla
Modified Files:
Main.java PureJavaMain.java
Log Message:
Ran some code analysis tools on the code and changed approximately 200 small things based on that. Nothing shocking (I hope!)
Index: Main.java
===================================================================
RCS file: /cvsroot/jicarilla/jicarilla-sandbox/platform/components/http/impl/src/java/org/jicarilla/Main.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- Main.java 4 Jan 2004 16:10:17 -0000 1.2
+++ Main.java 26 Feb 2004 16:51:55 -0000 1.3
@@ -44,13 +44,15 @@
*/
public class Main
{
- public final static void main( String[] args )
+ public final static int SHUTDOWN_DELAY_IN_MILLISECONDS = 1000;
+
+ public static void main( final String[] args )
{
Log log = null;
SocketServer server = null;
PicoContainer container = null;
- Interpreter i = new Interpreter();
+ final Interpreter i = new Interpreter();
try { i.set( "args", args ); }
catch( EvalError e ) {
printError( "The server experienced a strange internal error: ",
@@ -64,7 +66,7 @@
printError( "Error reading the configuration file: ",
"Please try again. If the problem persists, contact your administrator.", ioe, true ); }
catch( EvalError ee ) {
- int line = ee.getErrorLineNumber();
+ final int line = ee.getErrorLineNumber();
printError( "Error in configuration file on line "+line+": ",
"", ee, true ); }
try
@@ -90,7 +92,7 @@
{
LifecycleUtil.dispose( server );
LifecycleUtil.dispose( container );
- Thread.sleep( 1000 );
+ Thread.sleep( SHUTDOWN_DELAY_IN_MILLISECONDS );
}
catch( Throwable t )
{
@@ -100,7 +102,7 @@
}
}
- protected static void printError( String prefix, String postfix, Throwable t, boolean recurse )
+ protected static void printError( final String prefix, final String postfix, final Throwable t, final boolean recurse )
{
System.err.println( prefix + t.getMessage() );
if(recurse)
@@ -118,7 +120,7 @@
System.err.println( postfix );
}
- protected static void printRecursiveMessages( Throwable t, int indent )
+ protected static void printRecursiveMessages( final Throwable t, final int indent )
{
if( t == null )
return;
@@ -132,10 +134,10 @@
printRecursiveMessages( t.getCause(), indent+4 );
}
- protected static String friendlyClassName( Object o )
+ protected static String friendlyClassName( final Object o )
{
- String fqn = o.getClass().getName();
- String last = fqn.substring( fqn.lastIndexOf('.') );
+ final String fqn = o.getClass().getName();
+ final String last = fqn.substring( fqn.lastIndexOf('.') );
return last;
}
}
Index: PureJavaMain.java
===================================================================
RCS file: /cvsroot/jicarilla/jicarilla-sandbox/platform/components/http/impl/src/java/org/jicarilla/PureJavaMain.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- PureJavaMain.java 25 Jan 2004 22:12:15 -0000 1.1
+++ PureJavaMain.java 26 Feb 2004 16:51:55 -0000 1.2
@@ -75,6 +75,8 @@
*/
public class PureJavaMain implements Active
{
+ public final static double MILLISECONDS_IN_A_SECOND = 1000.0;
+
// default configuration
public final static int DEFAULT_PORT = 8080;
public final static int DEFAULT_BACKLOG = 500;
@@ -106,9 +108,9 @@
protected CommandLine m_options;
// instrumentation
- long startTime = System.currentTimeMillis();
+ protected long startTime = System.currentTimeMillis();
- protected PureJavaMain( String[] args ) throws Exception
+ protected PureJavaMain( final String[] args ) throws Exception
{
m_args = args;
setupCommandLine();
@@ -127,7 +129,7 @@
LifecycleUtil.initialize( m_server );
m_log.debug( "Up in " +
- (System.currentTimeMillis()-startTime)/1000.0 +
+ (System.currentTimeMillis()-startTime)/MILLISECONDS_IN_A_SECOND +
" seconds." );
}
@@ -138,7 +140,7 @@
m_resolver.releaseInstance( m_server );
}
- public final static void main( String[] args )
+ public static void main( final String[] args )
{
Active main = null;
try
@@ -171,7 +173,7 @@
// ----------------------------------------------------------------------
protected void setupCommandLine()
{
- Options o = new Options();
+ final Options o = new Options();
OptionBuilder.withArgName( "string" );
OptionBuilder.withLongOpt( "base-directory" );
@@ -240,13 +242,13 @@
try
{
- PosixParser parser = new PosixParser();
+ final PosixParser parser = new PosixParser();
//parser = new GnuParser();
m_options = parser.parse( o, m_args );
}
catch( Exception e )
{
- HelpFormatter formatter = new HelpFormatter();
+ final HelpFormatter formatter = new HelpFormatter();
System.out.println( e.getMessage() );
System.out.println(
"--------------------------------------------------" );
@@ -259,7 +261,7 @@
protected void setupContainer() throws Exception
{
- Builder builder = DefaultBuilder.newInstance()
+ final Builder builder = DefaultBuilder.newInstance()
.addComponent( m_log )
.addComponent( m_config );
@@ -283,7 +285,7 @@
m_options.getOptionValue("address") :
DEFAULT_ADDRESS;
- m_directory = (m_options.hasOption("directory"))?
+ m_directory = m_options.hasOption("directory")?
m_options.getOptionValue("directory") : DEFAULT_DIRECTORY;
m_threads = m_options.hasOption("threads")?
@@ -310,7 +312,7 @@
m_log = log;
}
- protected void populate( Builder builder )
+ protected void populate( final Builder builder )
{
builder.addComponent(
ExceptionListener.class,
@@ -409,8 +411,8 @@
// ----------------------------------------------------------------------
// Error Printing Helpers
// ----------------------------------------------------------------------
- protected static void printError( String prefix, String postfix,
- Throwable t, boolean recurse )
+ protected static void printError( final String prefix, final String postfix,
+ final Throwable t, final boolean recurse )
{
System.err.println( prefix + t.getMessage() );
if( recurse )
@@ -430,7 +432,7 @@
System.err.println( postfix );
}
- protected static void printRecursiveMessages( Throwable t, int indent )
+ protected static void printRecursiveMessages( final Throwable t, final int indent )
{
if( t == null )
return;
@@ -446,10 +448,10 @@
printRecursiveMessages( t.getCause(), indent + 4 );
}
- protected static String friendlyClassName( Object o )
+ protected static String friendlyClassName( final Object o )
{
- String fqn = o.getClass().getName();
- String last = fqn.substring( fqn.lastIndexOf( '.' ) );
+ final String fqn = o.getClass().getName();
+ final String last = fqn.substring( fqn.lastIndexOf( '.' ) );
return last;
}
@@ -457,7 +459,7 @@
// Jetty Integration
// ----------------------------------------------------------------------
- protected void populateWithJetty( Builder builder ) throws UnknownHostException, MultiException
+ protected void populateWithJetty( final Builder builder ) throws UnknownHostException, MultiException
{
builder.addComponent(
ExceptionListener.class,
@@ -555,16 +557,16 @@
protected HttpServer createJettyServer() throws MultiException
{
- HttpServer jetty = new HttpServer();
+ final HttpServer jetty = new HttpServer();
configureJetty( jetty );
return jetty;
}
- protected void configureJetty( HttpServer server ) throws MultiException
+ protected void configureJetty( final HttpServer server ) throws MultiException
{
- HttpContext context = new HttpContext();
+ final HttpContext context = new HttpContext();
context.setContextPath( "/" );
context.setResourceBase( m_directory );
context.addHandler( new ResourceHandler() );
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.