harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ndbe...@apache.org
Subject svn commit: r422316 - in /incubator/harmony/enhanced/classlib/trunk/modules/logging/src: main/java/java/util/logging/ test/java/org/apache/harmony/logging/tests/java/util/logging/
Date Sat, 15 Jul 2006 23:11:58 GMT
Author: ndbeyer
Date: Sat Jul 15 16:11:57 2006
New Revision: 422316

URL: http://svn.apache.org/viewvc?rev=422316&view=rev
Log:
Code cleanup.

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/logging/src/main/java/java/util/logging/Handler.java
    incubator/harmony/enhanced/classlib/trunk/modules/logging/src/main/java/java/util/logging/LogManager.java
    incubator/harmony/enhanced/classlib/trunk/modules/logging/src/main/java/java/util/logging/MemoryHandler.java
    incubator/harmony/enhanced/classlib/trunk/modules/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/ErrorManagerTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/FileHandlerTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/FilterTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/FormatterTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/LevelTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/LogManagerTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/LogRecordTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/LoggerTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/LoggingPermissionTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/MemoryHandlerTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/SimpleFormatterTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/SocketHandlerTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/StreamHandlerTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/XMLFormatterTest.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/logging/src/main/java/java/util/logging/Handler.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/logging/src/main/java/java/util/logging/Handler.java?rev=422316&r1=422315&r2=422316&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/logging/src/main/java/java/util/logging/Handler.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/logging/src/main/java/java/util/logging/Handler.java
Sat Jul 15 16:11:57 2006
@@ -103,12 +103,13 @@
     // get a instance from given class name, using context classloader
     private Object getCustomizeInstance(final String className)
             throws Exception {
-        Class c = AccessController.doPrivileged(new PrivilegedExceptionAction<Class>()
{
-                    public Class run() throws Exception {
+        Class<?> c = AccessController.doPrivileged(new PrivilegedExceptionAction<Class<?>>()
{
+                    public Class<?> run() throws Exception {
                         ClassLoader loader = Thread.currentThread()
                                 .getContextClassLoader();
-                        if (null == loader)
+                        if (null == loader) {
                             loader = ClassLoader.getSystemClassLoader();
+                        }
                         return loader.loadClass(className);
                     }
                 });
@@ -236,9 +237,9 @@
     }
 
     /**
-     * Gets the fomatter used by this handler to format the logging messages.
+     * Gets the formatter used by this handler to format the logging messages.
      * 
-     * @return the fomatter used by this handler
+     * @return the formatter used by this handler
      */
     public Formatter getFormatter() {
         return this.formatter;
@@ -265,7 +266,7 @@
     public boolean isLoggable(LogRecord record) {
         if (null == record) {
             reportError(
-                    "Null pointer of LogRecord", new NullPointerException("null"), ErrorManager.GENERIC_FAILURE);
//$NON-NLS-1$ //$NON-NLS-2$
+                    "Null pointer of LogRecord", new NullPointerException(), ErrorManager.GENERIC_FAILURE);
//$NON-NLS-1$ //$NON-NLS-2$
             return false;
         }
         if (this.level.intValue() == Level.OFF.intValue()) {
@@ -346,7 +347,7 @@
     public void setErrorManager(ErrorManager em) {
         LogManager.getLogManager().checkAccess();
         if (null == em) {
-            throw new NullPointerException("null"); //$NON-NLS-1$
+            throw new NullPointerException();
         }
         this.errorMan = em;
     }
@@ -370,11 +371,11 @@
      * not check security.
      * 
      * @param newFormatter
-     *            the fomatter to set
+     *            the formatter to set
      */
     void internalSetFormatter(Formatter newFormatter) {
         if (null == newFormatter) {
-            throw new NullPointerException("null"); //$NON-NLS-1$
+            throw new NullPointerException();
         }
         this.formatter = newFormatter;
     }
@@ -383,7 +384,7 @@
      * Sets the formatter to be used by this handler.
      * 
      * @param newFormatter
-     *            the fomatter to set
+     *            the formatter to set
      * @throws SecurityException
      *             If a security manager determines that the caller does not
      *             have the required permission.
@@ -404,7 +405,7 @@
      */
     public void setLevel(Level newLevel) {
         if (null == newLevel) {
-            throw new NullPointerException("null"); //$NON-NLS-1$
+            throw new NullPointerException();
         }
         LogManager.getLogManager().checkAccess();
         this.level = newLevel;

Modified: incubator/harmony/enhanced/classlib/trunk/modules/logging/src/main/java/java/util/logging/LogManager.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/logging/src/main/java/java/util/logging/LogManager.java?rev=422316&r1=422315&r2=422316&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/logging/src/main/java/java/util/logging/LogManager.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/logging/src/main/java/java/util/logging/LogManager.java
Sat Jul 15 16:11:57 2006
@@ -38,7 +38,7 @@
  * There is only one global <code>LogManager</code> instance in the
  * application, which can be get by calling static method
  * <code>LogManager.getLogManager()</code>. This instance is created and
- * inited during class initialization and cannot be changed.
+ * initialized during class initialization and cannot be changed.
  * </p>
  * <p>
  * The <code>LogManager</code> class can be specified by
@@ -73,25 +73,25 @@
  * </p>
  * <p>
  * If "java.util.logging.config.class" property is not set, or it is invalid, or
- * some exception is throwed during the instantiation, then the
+ * some exception is thrown during the instantiation, then the
  * "java.util.logging.config.file" system property can be used to specify a
  * properties file. The <code>LogManager</code> will read initial
  * configuration from this file.
  * </p>
  * <p>
- * If neither of these properties is defined, or some exception is throwed
+ * If neither of these properties is defined, or some exception is thrown
  * during these two properties using, the <code>LogManager</code> will read
  * its initial configuration from default properties file, as described above.
  * </p>
  * <p>
  * The global logging properties may include:
  * <ul>
- * <li>"handlers". This property's valus should be a list of class names for
+ * <li>"handlers". This property's values should be a list of class names for
  * handler classes separated by whitespace, these classes must be subclasses of
  * <code>Handler</code> and each must have a default constructor, these
  * classes will be loaded, instantiated and registered as handlers on the root
  * <code>Logger</code> (the <code>Logger</code> named ""). These
- * <code>Handler</code>s maybe inited lazily.</li>
+ * <code>Handler</code>s maybe initialized lazily.</li>
  * <li>"config". The property defines a list of class names separated by
  * whitespace. Each class must have a default constructor, in which it can
  * update the logging configuration, such as levels, handlers, or filters for
@@ -158,10 +158,10 @@
     private Logger root;
 
     // the configuration properties
-    private Properties props = null;
+    private Properties props;
 
     // the property change listener
-    private PropertyChangeSupport listeners = null;
+    private PropertyChangeSupport listeners;
 
     /*
      * -------------------------------------------------------------------
@@ -240,7 +240,7 @@
      * Check that the caller has <code>LoggingPermission("control")</code> so
      * that it is trusted to modify the configuration for logging framework. If
      * the check passes, just return, otherwise <code>SecurityException</code>
-     * will be throwed.
+     * will be thrown.
      * 
      * @throws SecurityException
      *             if there is a security manager in operation and the invoker
@@ -409,7 +409,7 @@
     // use SystemClassLoader to load class from system classpath
     static Object getInstanceByClass(final String className) {
         try {
-            Class clazz = ClassLoader.getSystemClassLoader().loadClass(
+            Class<?> clazz = ClassLoader.getSystemClassLoader().loadClass(
                     className);
             return clazz.newInstance();
         } catch (Exception e) {
@@ -421,7 +421,7 @@
 
     }
 
-    // actual default initilization process
+    // actual default initialization process
     private synchronized void readConfigurationImpl() throws IOException {
         checkAccess();
         boolean needInit = true;
@@ -440,7 +440,7 @@
             String configFile = getSystemProperty("java.util.logging.config.file"); //$NON-NLS-1$
             if (null == configFile) {
                 // if cannot find configFile, use default logging.properties
-                configFile = new StringBuffer().append(
+                configFile = new StringBuilder().append(
                         System.getProperty("java.home")).append(fileSeparator) //$NON-NLS-1$
                         .append("lib").append(fileSeparator).append( //$NON-NLS-1$
                                 "logging.properties").toString(); //$NON-NLS-1$
@@ -477,7 +477,7 @@
 
     // init "level" properties for all registered loggers
     private void initLevelForLoggers() {
-        Enumeration enumeration = props.propertyNames();
+        Enumeration<?> enumeration = props.propertyNames();
         while (enumeration.hasMoreElements()) {
             // search for all properties whose name is ended with ".level"
             String loggerLevel = (String) enumeration.nextElement();
@@ -561,7 +561,7 @@
     public synchronized void reset() {
         checkAccess();
         props.clear();
-        Iterator it = loggers.values().iterator();
+        Iterator<Logger> it = loggers.values().iterator();
         while (it.hasNext()) {
             Logger l = (Logger) it.next();
             l.setLevel(null);

Modified: incubator/harmony/enhanced/classlib/trunk/modules/logging/src/main/java/java/util/logging/MemoryHandler.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/logging/src/main/java/java/util/logging/MemoryHandler.java?rev=422316&r1=422315&r2=422316&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/logging/src/main/java/java/util/logging/MemoryHandler.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/logging/src/main/java/java/util/logging/MemoryHandler.java
Sat Jul 15 16:11:57 2006
@@ -26,7 +26,7 @@
  * <p> 
  * Mostly this <code>MemoryHandler</code> just puts the given <code>LogRecord</code>
  * into the internal buffer and doesn't perform any formatting or any other process.
- * When the buffer is full, the earlist buffered records will be discarded.  
+ * When the buffer is full, the earliest buffered records will be discarded.  
  * </p>
  * <p>
  * Every <code>MemoryHandler</code> has a target handler, and push action can
be 
@@ -44,7 +44,7 @@
  * </p>
  * <p>
  * <code>MemoryHandler</code> will read following <code>LogManager</code>

- * properties for initialization, if given propeties are not defined or has 
+ * properties for initialization, if given properties are not defined or has 
  * invalid values, default value will be used.
  * <ul>
  * <li>java.util.logging.MemoryHandler.level specifies the level for this 
@@ -107,8 +107,8 @@
         //init target
         final String targetName = manager.getProperty(className+".target"); //$NON-NLS-1$
         try {
-            Class targetClass = AccessController.doPrivileged(new PrivilegedExceptionAction<Class>(){
-                public Class run() throws Exception{
+            Class<?> targetClass = AccessController.doPrivileged(new PrivilegedExceptionAction<Class<?>>(){
+                public Class<?> run() throws Exception{
                     ClassLoader loader = Thread.currentThread().getContextClassLoader();
                     if(loader == null){
                         loader = ClassLoader.getSystemClassLoader();
@@ -235,7 +235,7 @@
      * </p>
      * <p>
      * The given <code>LogRecord</code> is loggable if and only if it has 
-     * approriate level and it pass any associated filter's check. 
+     * appropriate level and it pass any associated filter's check. 
      * </p>
      * <p>
      * Note that the push level is not used for this check. 
@@ -249,7 +249,7 @@
     }
 
     /**
-     * Trig a push action to output all buffered records to the target handler,
+     * Triggers a push action to output all buffered records to the target handler,
      * and the target handler will publish them. Then the buffer is cleared.
      */
     public void push() {
@@ -285,7 +285,4 @@
         newLevel.intValue();
         this.push = newLevel;
     }
-
 }
-
-

Modified: incubator/harmony/enhanced/classlib/trunk/modules/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/ErrorManagerTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/ErrorManagerTest.java?rev=422316&r1=422315&r2=422316&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/ErrorManagerTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/ErrorManagerTest.java
Sat Jul 15 16:11:57 2006
@@ -19,35 +19,12 @@
 
 import junit.framework.TestCase;
 
-/**
- */
 public class ErrorManagerTest extends TestCase {
-	private static String className = ErrorManagerTest.class.getName();
-
 	ErrorManager em;
 
-	/*
-	 * @see TestCase#setUp()
-	 */
 	protected void setUp() throws Exception {
 		super.setUp();
 		em = new ErrorManager();
-	}
-
-	/*
-	 * @see TestCase#tearDown()
-	 */
-	protected void tearDown() throws Exception {
-		super.tearDown();
-	}
-
-	/**
-	 * Constructor for ErrorManagerTest.
-	 * 
-	 * @param arg0
-	 */
-	public ErrorManagerTest(String arg0) {
-		super(arg0);
 	}
 
 	public void testErrorWithNullParameter() {

Modified: incubator/harmony/enhanced/classlib/trunk/modules/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/FileHandlerTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/FileHandlerTest.java?rev=422316&r1=422315&r2=422316&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/FileHandlerTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/FileHandlerTest.java
Sat Jul 15 16:11:57 2006
@@ -497,7 +497,7 @@
 		assertFalse(file.exists());
 
 		try {
-			FileHandler h = new FileHandler(null);
+			new FileHandler(null);
 			fail("should throw null exception");
 		} catch (NullPointerException e) {
 		}
@@ -507,22 +507,22 @@
 			fail("should not throw NPE");
 		}
 		try {
-			FileHandler h = new FileHandler(null, false);
+			new FileHandler(null, false);
 			fail("should throw null exception");
 		} catch (NullPointerException e) {
 		}
 		try {
-			FileHandler h = new FileHandler("");
+			new FileHandler("");
 			fail("should throw null exception");
 		} catch (NullPointerException e) {
 		}
 		try {
-			FileHandler h = new FileHandler("%t/java%u", 0, 0);
+			new FileHandler("%t/java%u", 0, 0);
 			fail("should throw IllegalArgumentException");
 		} catch (IllegalArgumentException e) {
 		}
 		try {
-			FileHandler h = new FileHandler("%t/java%u", -1, 1);
+			new FileHandler("%t/java%u", -1, 1);
 			fail("should throw IllegalArgumentException");
 		} catch (IllegalArgumentException e) {
 		}

Modified: incubator/harmony/enhanced/classlib/trunk/modules/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/FilterTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/FilterTest.java?rev=422316&r1=422315&r2=422316&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/FilterTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/FilterTest.java
Sat Jul 15 16:11:57 2006
@@ -25,8 +25,6 @@
  * 
  */
 public class FilterTest extends TestCase {
-	private static String className = FilterTest.class.getName();
-
 	public void testFilter() {
 		MockFilter f = new MockFilter();
 		f.isLoggable(null);

Modified: incubator/harmony/enhanced/classlib/trunk/modules/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/FormatterTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/FormatterTest.java?rev=422316&r1=422315&r2=422316&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/FormatterTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/FormatterTest.java
Sat Jul 15 16:11:57 2006
@@ -24,12 +24,7 @@
 
 import junit.framework.TestCase;
 
-/**
- * 
- */
 public class FormatterTest extends TestCase {
-	private static String className = FormatterTest.class.getName();
-
 	Formatter f;
 
 	LogRecord r;
@@ -43,22 +38,6 @@
 		super.setUp();
 		f = new MockFormatter();
 		r = new LogRecord(Level.FINE, MSG);
-	}
-
-	/*
-	 * @see TestCase#tearDown()
-	 */
-	protected void tearDown() throws Exception {
-		super.tearDown();
-	}
-
-	/**
-	 * Constructor for FormatterTest.
-	 * 
-	 * @param arg0
-	 */
-	public FormatterTest(String arg0) {
-		super(arg0);
 	}
 
 	public void testFormat() {

Modified: incubator/harmony/enhanced/classlib/trunk/modules/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/LevelTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/LevelTest.java?rev=422316&r1=422315&r2=422316&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/LevelTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/LevelTest.java
Sat Jul 15 16:11:57 2006
@@ -16,12 +16,10 @@
 package org.apache.harmony.logging.tests.java.util.logging;
 
 import java.io.Serializable;
-import java.util.Locale;
 import java.util.ResourceBundle;
 import java.util.logging.Level;
 
 import junit.framework.TestCase;
-
 import tests.util.SerializationTester;
 
 /**
@@ -32,8 +30,6 @@
 
 	private static final long serialVersionUID = 1L;
 
-	private static String className = LevelTest.class.getName();
-
 	transient ResourceBundle rb;
 
 	/*
@@ -45,13 +41,6 @@
 	}
 
 	/*
-	 * @see TestCase#tearDown()
-	 */
-	protected void tearDown() throws Exception {
-		super.tearDown();
-	}
-
-	/*
 	 * Test the constructor without resource bundle parameter using normal
 	 * values. As byproducts, getName & intValue are also tested.
 	 */
@@ -68,7 +57,7 @@
 	 */
 	public void testConstructorNoResBundle_NullName() {
         try {
-            MockLevel l = new MockLevel(null, -2);
+            new MockLevel(null, -2);
             fail("No expected NullPointerException");
         } catch (NullPointerException ignore) {
         }
@@ -101,7 +90,7 @@
 	 */
 	public void testConstructorHavingResBundle_NullName() {
         try {
-            MockLevel l = new MockLevel(null, -123, "qwe");
+            new MockLevel(null, -123, "qwe");
             fail("No expected NullPointerException");
         } catch (NullPointerException ignore) {
         }
@@ -150,7 +139,7 @@
 	 */
 	public void testParse_EmptyString() {
 		try {
-			Level l = Level.parse("");
+			Level.parse("");
 			fail("Should throw IllegalArgumentException");
 		} catch (IllegalArgumentException e) {
 		}

Modified: incubator/harmony/enhanced/classlib/trunk/modules/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/LogManagerTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/LogManagerTest.java?rev=422316&r1=422315&r2=422316&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/LogManagerTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/LogManagerTest.java
Sat Jul 15 16:11:57 2006
@@ -150,7 +150,7 @@
 
 		assertNull(mockManager.getLogger("bad name"));
 
-		Enumeration enumar = mockManager.getLoggerNames();
+		Enumeration<String> enumar = mockManager.getLoggerNames();
 		int i = 0;
 		while (enumar.hasMoreElements()) {
 			String name = (String) enumar.nextElement();
@@ -168,7 +168,7 @@
 		assertSame(foo, mockManager.getLogger("foo"));
 		assertFalse(mockManager.addLogger(foo2));
 		assertSame(foo, mockManager.getLogger("foo"));
-		Enumeration enumar = mockManager.getLoggerNames();
+		Enumeration<String> enumar = mockManager.getLoggerNames();
 		int i = 0;
 		while (enumar.hasMoreElements()) {
 			enumar.nextElement();

Modified: incubator/harmony/enhanced/classlib/trunk/modules/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/LogRecordTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/LogRecordTest.java?rev=422316&r1=422315&r2=422316&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/LogRecordTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/LogRecordTest.java
Sat Jul 15 16:11:57 2006
@@ -25,9 +25,6 @@
 import junit.framework.TestCase;
 import tests.util.SerializationTester;
 
-/**
- * 
- */
 public class LogRecordTest extends TestCase {
 
 	static final String MSG = "test msg, pls. ignore itb";
@@ -36,39 +33,20 @@
 
 	private static String className = LogRecordTest.class.getName();
 
-	/*
-	 * @see TestCase#setUp()
-	 */
 	protected void setUp() throws Exception {
 		super.setUp();
 		lr = new LogRecord(Level.CONFIG, MSG);
 
 	}
 
-	/*
-	 * @see TestCase#tearDown()
-	 */
-	protected void tearDown() throws Exception {
-		super.tearDown();
-	}
-
-	/**
-	 * Constructor for LogRecordTest.
-	 * 
-	 * @param arg0
-	 */
-	public LogRecordTest(String arg0) {
-		super(arg0);
-	}
-
 	public void testLogRecordWithNullPointers() {
 		try {
-			LogRecord r = new LogRecord(null, null);
+			new LogRecord(null, null);
 			fail("should throw NullPointerException");
 		} catch (NullPointerException e) {
 		}
 		try {
-			LogRecord r = new LogRecord(null, MSG);
+			new LogRecord(null, MSG);
 			fail("should throw NullPointerException");
 		} catch (NullPointerException e) {
 		}
@@ -248,6 +226,7 @@
 
 	public void testGetSetMillis() {
 		long milli = lr.getMillis();
+        assertTrue(milli > 0);
 		lr.setMillis(-1);
 		assertEquals(-1, lr.getMillis());
 		lr.setMillis(0);

Modified: incubator/harmony/enhanced/classlib/trunk/modules/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/LoggerTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/LoggerTest.java?rev=422316&r1=422315&r2=422316&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/LoggerTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/LoggerTest.java
Sat Jul 15 16:11:57 2006
@@ -40,8 +40,6 @@
  */
 public class LoggerTest extends TestCase {
 
-	private static String className = LoggerTest.class.getName();
-
 	private final static String VALID_RESOURCE_BUNDLE = "bundles/java/util/logging/res";
 
 	private final static String VALID_RESOURCE_BUNDLE2 = "bundles/java/util/logging/res2";
@@ -118,7 +116,7 @@
 		assertEquals("myname", mlog.getName());
 		assertNull(mlog.getParent());
 		ResourceBundle rb = mlog.getResourceBundle();
-		assertEquals(VALID_VALUE, mlog.getResourceBundle().getString(VALID_KEY));
+		assertEquals(VALID_VALUE, rb.getString(VALID_KEY));
 		assertEquals(mlog.getResourceBundleName(), VALID_RESOURCE_BUNDLE);
 		assertTrue(mlog.getUseParentHandlers());
 	}
@@ -492,31 +490,27 @@
 	 * existing logger with different associated resource bundle.
 	 */
 	public void testGetLoggerWithRes_ExistingLoggerWithDiffRes() {
-		assertNull(LogManager.getLogManager().getLogger(
-				"testGetLoggerWithRes_ExistingLoggerWithDiffRes_ANewLogger"));
-		// create a new logger
-		Logger log1 = Logger.getLogger(
-				"testGetLoggerWithRes_ExistingLoggerWithDiffRes_ANewLogger",
-				VALID_RESOURCE_BUNDLE);
-		// get an existing logger
-		try {
-			Logger log2 = Logger
-					.getLogger(
-							"testGetLoggerWithRes_ExistingLoggerWithDiffRes_ANewLogger",
-							VALID_RESOURCE_BUNDLE2);
-			fail("Should throw IllegalArgumentException!");
-		} catch (IllegalArgumentException e) {
-		}
-
-		try {
-			Logger log2 = Logger
-					.getLogger(
-							"testGetLoggerWithRes_ExistingLoggerWithDiffRes_ANewLogger",
-							null);
-			fail("Should throw IllegalArgumentException!");
-		} catch (IllegalArgumentException e) {
-		}
-	}
+        assertNull(LogManager.getLogManager().getLogger(
+                "testGetLoggerWithRes_ExistingLoggerWithDiffRes_ANewLogger"));
+        // create a new logger
+        Logger log1 = Logger.getLogger(
+                "testGetLoggerWithRes_ExistingLoggerWithDiffRes_ANewLogger",
+                VALID_RESOURCE_BUNDLE);
+        assertNotNull(log1);
+        // get an existing logger
+        try {
+            Logger.getLogger("testGetLoggerWithRes_ExistingLoggerWithDiffRes_ANewLogger",
+                    VALID_RESOURCE_BUNDLE2);
+            fail("Should throw IllegalArgumentException!");
+        } catch (IllegalArgumentException e) {
+        }
+
+        try {
+            Logger.getLogger("testGetLoggerWithRes_ExistingLoggerWithDiffRes_ANewLogger",
null);
+            fail("Should throw IllegalArgumentException!");
+        } catch (IllegalArgumentException e) {
+        }
+    }
 
 	/*
 	 * Test getLogger(String, String) with invalid name.

Modified: incubator/harmony/enhanced/classlib/trunk/modules/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/LoggingPermissionTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/LoggingPermissionTest.java?rev=422316&r1=422315&r2=422316&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/LoggingPermissionTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/LoggingPermissionTest.java
Sat Jul 15 16:11:57 2006
@@ -20,34 +20,7 @@
 import junit.framework.TestCase;
 import tests.util.SerializationTester;
 
-/**
- */
 public class LoggingPermissionTest extends TestCase {
-	private static String className = LoggingPermissionTest.class.getName();
-
-	/*
-	 * @see TestCase#setUp()
-	 */
-	protected void setUp() throws Exception {
-		super.setUp();
-	}
-
-	/*
-	 * @see TestCase#tearDown()
-	 */
-	protected void tearDown() throws Exception {
-		super.tearDown();
-	}
-
-	/**
-	 * Constructor for LoggingPermissionTest.
-	 * 
-	 * @param arg0
-	 */
-	public LoggingPermissionTest(String arg0) {
-		super(arg0);
-	}
-
 	public void testSerializationCompability() throws Exception {
 		LoggingPermission lp = new LoggingPermission("control", "");
 		SerializationTester.assertCompabilityEquals(lp,
@@ -56,33 +29,35 @@
 
 	public void testLoggingPermission() {
 		try {
-			LoggingPermission lp = new LoggingPermission(null, null);
+			new LoggingPermission(null, null);
 			fail("should throw IllegalArgumentException");
 		} catch (NullPointerException e) {
 		}
 		try {
-			LoggingPermission lp = new LoggingPermission("", null);
+			new LoggingPermission("", null);
 			fail("should throw IllegalArgumentException");
 		} catch (IllegalArgumentException e) {
 		}
 		try {
-			LoggingPermission lp = new LoggingPermission("bad name", null);
+			new LoggingPermission("bad name", null);
 			fail("should throw IllegalArgumentException");
 		} catch (IllegalArgumentException e) {
 		}
 		try {
-			LoggingPermission lp = new LoggingPermission("Control", null);
+			new LoggingPermission("Control", null);
 			fail("should throw IllegalArgumentException");
 		} catch (IllegalArgumentException e) {
 		}
 		try {
-			LoggingPermission lp = new LoggingPermission("control",
+			new LoggingPermission("control",
 					"bad action");
 			fail("should throw IllegalArgumentException");
 		} catch (IllegalArgumentException e) {
 		}
-		LoggingPermission lp = new LoggingPermission("control", "");
-		lp = new LoggingPermission("control", null);
+		
+        new LoggingPermission("control", "");
+		
+        new LoggingPermission("control", null);
 	}
 
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/MemoryHandlerTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/MemoryHandlerTest.java?rev=422316&r1=422315&r2=422316&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/MemoryHandlerTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/MemoryHandlerTest.java
Sat Jul 15 16:11:57 2006
@@ -49,8 +49,6 @@
 
 	final static SecurityManager securityManager = new MockSecurityManager();
 
-	private static String className = MemoryHandlerTest.class.getName();
-
 	MemoryHandler handler;
 
 	Handler target = new MockHandler();

Modified: incubator/harmony/enhanced/classlib/trunk/modules/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/SimpleFormatterTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/SimpleFormatterTest.java?rev=422316&r1=422315&r2=422316&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/SimpleFormatterTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/SimpleFormatterTest.java
Sat Jul 15 16:11:57 2006
@@ -34,8 +34,6 @@
 
 	private static String MSG = "test msg. pls. ignore it\nadaadasfdasfd\nadfafdadfsa";
 
-	private static String className = SimpleFormatterTest.class.getName();
-
 	/*
 	 * @see TestCase#setUp()
 	 */
@@ -43,22 +41,6 @@
 		super.setUp();
 		sf = new SimpleFormatter();
 		lr = new LogRecord(Level.FINE, MSG);
-	}
-
-	/*
-	 * @see TestCase#tearDown()
-	 */
-	protected void tearDown() throws Exception {
-		super.tearDown();
-	}
-
-	/**
-	 * Constructor for SimpleFormatterTest.
-	 * 
-	 * @param arg0
-	 */
-	public SimpleFormatterTest(String arg0) {
-		super(arg0);
 	}
 
 	public void testFormatNull() {

Modified: incubator/harmony/enhanced/classlib/trunk/modules/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/SocketHandlerTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/SocketHandlerTest.java?rev=422316&r1=422315&r2=422316&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/SocketHandlerTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/SocketHandlerTest.java
Sat Jul 15 16:11:57 2006
@@ -219,7 +219,7 @@
 		oldMan = System.getSecurityManager();
 		System.setSecurityManager(new MockNoSocketSecurityManager());
 		try {
-			Handler h = new SocketHandler();
+			new SocketHandler();
 			fail("Should throw SecurityException!");
 		} catch (SecurityException e) {
 		} finally {
@@ -227,7 +227,7 @@
 		}
 		System.setSecurityManager(new MockNoSocketSecurityManager());
 		try {
-			Handler h = new SocketHandler("127.0.0.1", 6666);
+			new SocketHandler("127.0.0.1", 6666);
 			fail("Should throw SecurityException!");
 		} catch (SecurityException e) {
 		} finally {

Modified: incubator/harmony/enhanced/classlib/trunk/modules/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/StreamHandlerTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/StreamHandlerTest.java?rev=422316&r1=422315&r2=422316&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/StreamHandlerTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/StreamHandlerTest.java
Sat Jul 15 16:11:57 2006
@@ -300,8 +300,7 @@
 		assertEquals(LogManager.getLogManager().getProperty(
 				"java.util.logging.StreamHandler.encoding"), "iso-8859-1");
 		try {
-			StreamHandler h = new StreamHandler(new ByteArrayOutputStream(),
-					null);
+			new StreamHandler(new ByteArrayOutputStream(), null);
 			fail("Should throw NullPointerException!");
 		} catch (NullPointerException e) {
 		}
@@ -328,7 +327,7 @@
 		assertEquals(LogManager.getLogManager().getProperty(
 				"java.util.logging.StreamHandler.encoding"), "iso-8859-1");
 		try {
-			StreamHandler h = new StreamHandler(null, new MockFormatter2());
+			new StreamHandler(null, new MockFormatter2());
 			fail("Should throw NullPointerException!");
 		} catch (NullPointerException e) {
 		}

Modified: incubator/harmony/enhanced/classlib/trunk/modules/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/XMLFormatterTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/XMLFormatterTest.java?rev=422316&r1=422315&r2=422316&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/XMLFormatterTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/XMLFormatterTest.java
Sat Jul 15 16:11:57 2006
@@ -24,9 +24,6 @@
 
 import junit.framework.TestCase;
 
-/**
- * 
- */
 public class XMLFormatterTest extends TestCase {
 
 	XMLFormatter formatter = null;
@@ -35,11 +32,6 @@
 
 	LogRecord lr = null;
 
-	private static String className = XMLFormatterTest.class.getName();
-
-	/*
-	 * @see TestCase#setUp()
-	 */
 	protected void setUp() throws Exception {
 		super.setUp();
 		formatter = new XMLFormatter();
@@ -47,13 +39,6 @@
 		lr = new LogRecord(Level.SEVERE, "pattern");
 	}
 
-	/*
-	 * @see TestCase#tearDown()
-	 */
-	protected void tearDown() throws Exception {
-		super.tearDown();
-	}
-
 	public void testLocalFormat() {
 		// if set resource bundle, output will use localized message,
 		// but put the original message into the key element
@@ -138,7 +123,6 @@
 
 	public void testGetHead() throws SecurityException,
 			UnsupportedEncodingException {
-		String defaultEncoding = System.getProperty("file.encoding");
 		String result = formatter.getHead(handler);
 		assertNull(handler.getEncoding());
 		// TODO: where do we get the default encoding from?



Mime
View raw message