logging-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r1334637 - in /logging/log4j/trunk: src/main/java/org/apache/log4j/ src/main/java/org/apache/log4j/config/ src/main/java/org/apache/log4j/helpers/ src/main/java/org/apache/log4j/jmx/ src/main/java/org/apache/log4j/pattern/ src/main/java/org...
Date Sun, 06 May 2012 14:24:30 GMT
Author: ggregory
Date: Sun May  6 14:24:29 2012
New Revision: 1334637

URL: http://svn.apache.org/viewvc?rev=1334637&view=rev
Log:
Remove unnecessary type casts.

Modified:
    logging/log4j/trunk/src/main/java/org/apache/log4j/Hierarchy.java
    logging/log4j/trunk/src/main/java/org/apache/log4j/Level.java
    logging/log4j/trunk/src/main/java/org/apache/log4j/LogManager.java
    logging/log4j/trunk/src/main/java/org/apache/log4j/PropertyConfigurator.java
    logging/log4j/trunk/src/main/java/org/apache/log4j/config/PropertySetter.java
    logging/log4j/trunk/src/main/java/org/apache/log4j/helpers/OptionConverter.java
    logging/log4j/trunk/src/main/java/org/apache/log4j/jmx/AbstractDynamicMBean.java
    logging/log4j/trunk/src/main/java/org/apache/log4j/jmx/LayoutDynamicMBean.java
    logging/log4j/trunk/src/main/java/org/apache/log4j/pattern/DatePatternConverter.java
    logging/log4j/trunk/src/main/java/org/apache/log4j/pattern/LogEvent.java
    logging/log4j/trunk/src/main/java/org/apache/log4j/spi/LoggingEvent.java
    logging/log4j/trunk/src/main/java/org/apache/log4j/xml/DOMConfigurator.java
    logging/log4j/trunk/tests/src/java/org/apache/log4j/LoggerTestCase.java
    logging/log4j/trunk/tests/src/java/org/apache/log4j/xml/XLevel.java

Modified: logging/log4j/trunk/src/main/java/org/apache/log4j/Hierarchy.java
URL: http://svn.apache.org/viewvc/logging/log4j/trunk/src/main/java/org/apache/log4j/Hierarchy.java?rev=1334637&r1=1334636&r2=1334637&view=diff
==============================================================================
--- logging/log4j/trunk/src/main/java/org/apache/log4j/Hierarchy.java (original)
+++ logging/log4j/trunk/src/main/java/org/apache/log4j/Hierarchy.java Sun May  6 14:24:29
2012
@@ -164,7 +164,7 @@ public class Hierarchy implements Logger
   */
   public
   void setThreshold(String levelStr) {
-    Level l = (Level) Level.toLevel(levelStr, null);
+    Level l = Level.toLevel(levelStr, null);
     if(l != null) {
       setThreshold(l);
     } else {
@@ -381,7 +381,7 @@ public class Hierarchy implements Logger
   public
   void resetConfiguration() {
 
-    getRootLogger().setLevel((Level) Level.DEBUG);
+    getRootLogger().setLevel(Level.DEBUG);
     root.setResourceBundle(null);
     setThreshold(Level.ALL);
 

Modified: logging/log4j/trunk/src/main/java/org/apache/log4j/Level.java
URL: http://svn.apache.org/viewvc/logging/log4j/trunk/src/main/java/org/apache/log4j/Level.java?rev=1334637&r1=1334636&r2=1334637&view=diff
==============================================================================
--- logging/log4j/trunk/src/main/java/org/apache/log4j/Level.java (original)
+++ logging/log4j/trunk/src/main/java/org/apache/log4j/Level.java Sun May  6 14:24:29 2012
@@ -112,7 +112,7 @@ public class Level extends Priority impl
   public
   static
   Level toLevel(String sArg) {
-    return (Level) toLevel(sArg, Level.DEBUG);
+    return toLevel(sArg, Level.DEBUG);
   }
 
   /**
@@ -123,7 +123,7 @@ public class Level extends Priority impl
   public
   static
   Level toLevel(int val) {
-    return (Level) toLevel(val, Level.DEBUG);
+    return toLevel(val, Level.DEBUG);
   }
 
   /**

Modified: logging/log4j/trunk/src/main/java/org/apache/log4j/LogManager.java
URL: http://svn.apache.org/viewvc/logging/log4j/trunk/src/main/java/org/apache/log4j/LogManager.java?rev=1334637&r1=1334636&r2=1334637&view=diff
==============================================================================
--- logging/log4j/trunk/src/main/java/org/apache/log4j/LogManager.java (original)
+++ logging/log4j/trunk/src/main/java/org/apache/log4j/LogManager.java Sun May  6 14:24:29
2012
@@ -79,7 +79,7 @@ public class LogManager {
 
   static {
     // By default we use a DefaultRepositorySelector which always returns 'h'.
-    Hierarchy h = new Hierarchy(new RootLogger((Level) Level.DEBUG));
+    Hierarchy h = new Hierarchy(new RootLogger(Level.DEBUG));
     repositorySelector = new DefaultRepositorySelector(h);
 
     /** Search for the properties file log4j.properties in the CLASSPATH.  */

Modified: logging/log4j/trunk/src/main/java/org/apache/log4j/PropertyConfigurator.java
URL: http://svn.apache.org/viewvc/logging/log4j/trunk/src/main/java/org/apache/log4j/PropertyConfigurator.java?rev=1334637&r1=1334636&r2=1334637&view=diff
==============================================================================
--- logging/log4j/trunk/src/main/java/org/apache/log4j/PropertyConfigurator.java (original)
+++ logging/log4j/trunk/src/main/java/org/apache/log4j/PropertyConfigurator.java Sun May 
6 14:24:29 2012
@@ -507,7 +507,7 @@ new PropertyConfigurator().doConfigure(i
 						       properties);
     if(thresholdStr != null) {
       hierarchy.setThreshold(OptionConverter.toLevel(thresholdStr,
-						     (Level) Level.ALL));
+						     Level.ALL));
       LogLog.debug("Hierarchy threshold set to ["+hierarchy.getThreshold()+"].");
     }
     
@@ -750,7 +750,7 @@ new PropertyConfigurator().doConfigure(i
 	  logger.setLevel(null);
 	}
       } else {
-	logger.setLevel(OptionConverter.toLevel(levelStr, (Level) Level.DEBUG));
+	logger.setLevel(OptionConverter.toLevel(levelStr, Level.DEBUG));
       }
       LogLog.debug("Category " + loggerName + " set to " + logger.getLevel());
     }

Modified: logging/log4j/trunk/src/main/java/org/apache/log4j/config/PropertySetter.java
URL: http://svn.apache.org/viewvc/logging/log4j/trunk/src/main/java/org/apache/log4j/config/PropertySetter.java?rev=1334637&r1=1334636&r2=1334637&view=diff
==============================================================================
--- logging/log4j/trunk/src/main/java/org/apache/log4j/config/PropertySetter.java (original)
+++ logging/log4j/trunk/src/main/java/org/apache/log4j/config/PropertySetter.java Sun May
 6 14:24:29 2012
@@ -280,7 +280,7 @@ public class PropertySetter {
         return Boolean.FALSE;
       }
     } else if (Priority.class.isAssignableFrom(type)) {
-      return OptionConverter.toLevel(v, (Level) Level.DEBUG);
+      return OptionConverter.toLevel(v, Level.DEBUG);
     } else if (ErrorHandler.class.isAssignableFrom(type)) {
       return OptionConverter.instantiateByClassName(v, 
 	  ErrorHandler.class, null);

Modified: logging/log4j/trunk/src/main/java/org/apache/log4j/helpers/OptionConverter.java
URL: http://svn.apache.org/viewvc/logging/log4j/trunk/src/main/java/org/apache/log4j/helpers/OptionConverter.java?rev=1334637&r1=1334636&r2=1334637&view=diff
==============================================================================
--- logging/log4j/trunk/src/main/java/org/apache/log4j/helpers/OptionConverter.java (original)
+++ logging/log4j/trunk/src/main/java/org/apache/log4j/helpers/OptionConverter.java Sun May
 6 14:24:29 2012
@@ -195,7 +195,7 @@ public class OptionConverter {
 	return null;
       } else {
 	// no class name specified : use standard Level class
-	return(Level) Level.toLevel(value, defaultValue);
+	return Level.toLevel(value, defaultValue);
       }
     }
 

Modified: logging/log4j/trunk/src/main/java/org/apache/log4j/jmx/AbstractDynamicMBean.java
URL: http://svn.apache.org/viewvc/logging/log4j/trunk/src/main/java/org/apache/log4j/jmx/AbstractDynamicMBean.java?rev=1334637&r1=1334636&r2=1334637&view=diff
==============================================================================
--- logging/log4j/trunk/src/main/java/org/apache/log4j/jmx/AbstractDynamicMBean.java (original)
+++ logging/log4j/trunk/src/main/java/org/apache/log4j/jmx/AbstractDynamicMBean.java Sun May
 6 14:24:29 2012
@@ -82,7 +82,7 @@ public abstract class AbstractDynamicMBe
     // build the result attribute list
     for (int i=0 ; i<attributeNames.length ; i++){
       try {
-	Object value = getAttribute((String) attributeNames[i]);
+	Object value = getAttribute(attributeNames[i]);
 	resultList.add(new Attribute(attributeNames[i],value));
       } catch (JMException e) {
 	     e.printStackTrace();

Modified: logging/log4j/trunk/src/main/java/org/apache/log4j/jmx/LayoutDynamicMBean.java
URL: http://svn.apache.org/viewvc/logging/log4j/trunk/src/main/java/org/apache/log4j/jmx/LayoutDynamicMBean.java?rev=1334637&r1=1334636&r2=1334637&view=diff
==============================================================================
--- logging/log4j/trunk/src/main/java/org/apache/log4j/jmx/LayoutDynamicMBean.java (original)
+++ logging/log4j/trunk/src/main/java/org/apache/log4j/jmx/LayoutDynamicMBean.java Sun May
 6 14:24:29 2012
@@ -157,7 +157,7 @@ public class LayoutDynamicMBean extends 
 
     if(operationName.equals("activateOptions") &&
                      layout instanceof OptionHandler) {
-      OptionHandler oh = (OptionHandler) layout;
+      OptionHandler oh = layout;
       oh.activateOptions();
       return "Options activated.";
     }

Modified: logging/log4j/trunk/src/main/java/org/apache/log4j/pattern/DatePatternConverter.java
URL: http://svn.apache.org/viewvc/logging/log4j/trunk/src/main/java/org/apache/log4j/pattern/DatePatternConverter.java?rev=1334637&r1=1334636&r2=1334637&view=diff
==============================================================================
--- logging/log4j/trunk/src/main/java/org/apache/log4j/pattern/DatePatternConverter.java (original)
+++ logging/log4j/trunk/src/main/java/org/apache/log4j/pattern/DatePatternConverter.java Sun
May  6 14:24:29 2012
@@ -153,7 +153,7 @@ public final class DatePatternConverter 
 
     // if the option list contains a TZ option, then set it.
     if ((options != null) && (options.length > 1)) {
-      TimeZone tz = TimeZone.getTimeZone((String) options[1]);
+      TimeZone tz = TimeZone.getTimeZone(options[1]);
       simpleFormat.setTimeZone(tz);
     } else {
       simpleFormat = new DefaultZoneDateFormat(simpleFormat);

Modified: logging/log4j/trunk/src/main/java/org/apache/log4j/pattern/LogEvent.java
URL: http://svn.apache.org/viewvc/logging/log4j/trunk/src/main/java/org/apache/log4j/pattern/LogEvent.java?rev=1334637&r1=1334636&r2=1334637&view=diff
==============================================================================
--- logging/log4j/trunk/src/main/java/org/apache/log4j/pattern/LogEvent.java (original)
+++ logging/log4j/trunk/src/main/java/org/apache/log4j/pattern/LogEvent.java Sun May  6 14:24:29
2012
@@ -338,7 +338,7 @@ public class LogEvent implements java.io
       mdcCopyLookupRequired = false;
       // the clone call is required for asynchronous logging.
       // See also bug #5932.
-      Hashtable t = (Hashtable) MDC.getContext();
+      Hashtable t = MDC.getContext();
       if(t != null) {
 	mdcCopy = (Hashtable) t.clone();
       }

Modified: logging/log4j/trunk/src/main/java/org/apache/log4j/spi/LoggingEvent.java
URL: http://svn.apache.org/viewvc/logging/log4j/trunk/src/main/java/org/apache/log4j/spi/LoggingEvent.java?rev=1334637&r1=1334636&r2=1334637&view=diff
==============================================================================
--- logging/log4j/trunk/src/main/java/org/apache/log4j/spi/LoggingEvent.java (original)
+++ logging/log4j/trunk/src/main/java/org/apache/log4j/spi/LoggingEvent.java Sun May  6 14:24:29
2012
@@ -348,7 +348,7 @@ public class LoggingEvent implements jav
       mdcCopyLookupRequired = false;
       // the clone call is required for asynchronous logging.
       // See also bug #5932.
-      Hashtable t = (Hashtable) MDC.getContext();
+      Hashtable t = MDC.getContext();
       if(t != null) {
 	mdcCopy = (Hashtable) t.clone();
       }

Modified: logging/log4j/trunk/src/main/java/org/apache/log4j/xml/DOMConfigurator.java
URL: http://svn.apache.org/viewvc/logging/log4j/trunk/src/main/java/org/apache/log4j/xml/DOMConfigurator.java?rev=1334637&r1=1334636&r2=1334637&view=diff
==============================================================================
--- logging/log4j/trunk/src/main/java/org/apache/log4j/xml/DOMConfigurator.java (original)
+++ logging/log4j/trunk/src/main/java/org/apache/log4j/xml/DOMConfigurator.java Sun May  6
14:24:29 2012
@@ -560,7 +560,7 @@ public class DOMConfigurator implements 
       final int length 	= params.getLength();
 
       for (int loop = 0; loop < length; loop++) {
-	Node currentNode = (Node)params.item(loop);
+	Node currentNode = params.item(loop);
 	if (currentNode.getNodeType() == Node.ELEMENT_NODE) {
 	  Element currentElement = (Element) currentNode;
 	  String tagName = currentElement.getTagName();
@@ -613,7 +613,7 @@ public class DOMConfigurator implements 
           final int length 	= params.getLength();
 
           for (int loop = 0; loop < length; loop++) {
-                Node currentNode = (Node)params.item(loop);
+                Node currentNode = params.item(loop);
                 if (currentNode.getNodeType() == Node.ELEMENT_NODE) {
                     Element currentElement = (Element) currentNode;
                     String tagName = currentElement.getTagName();

Modified: logging/log4j/trunk/tests/src/java/org/apache/log4j/LoggerTestCase.java
URL: http://svn.apache.org/viewvc/logging/log4j/trunk/tests/src/java/org/apache/log4j/LoggerTestCase.java?rev=1334637&r1=1334636&r2=1334637&view=diff
==============================================================================
--- logging/log4j/trunk/tests/src/java/org/apache/log4j/LoggerTestCase.java (original)
+++ logging/log4j/trunk/tests/src/java/org/apache/log4j/LoggerTestCase.java Sun May  6 14:24:29
2012
@@ -216,7 +216,7 @@ public class LoggerTestCase extends Test
 
     LoggerRepository h = LogManager.getLoggerRepository();
     //h.disableDebug();
-    h.setThreshold((Level) Level.INFO);
+    h.setThreshold(Level.INFO);
     assertEquals(caRoot.counter, 0);     
 
     root.debug(MSG); assertEquals(caRoot.counter, 0);  
@@ -225,7 +225,7 @@ public class LoggerTestCase extends Test
     root.warn(MSG); assertEquals(caRoot.counter, 3);  
 
     //h.disableInfo();
-    h.setThreshold((Level) Level.WARN);
+    h.setThreshold(Level.WARN);
     root.debug(MSG); assertEquals(caRoot.counter, 3);  
     root.info(MSG); assertEquals(caRoot.counter, 3);  
     root.log(Level.WARN, MSG); assertEquals(caRoot.counter, 4);  
@@ -319,7 +319,7 @@ public class LoggerTestCase extends Test
 
   public
   void testHierarchy1() {
-    Hierarchy h = new Hierarchy(new RootLogger((Level) Level.ERROR));
+    Hierarchy h = new Hierarchy(new RootLogger(Level.ERROR));
     Logger a0 = h.getLogger("a");
     assertEquals("a", a0.getName());
     assertNull(a0.getLevel());

Modified: logging/log4j/trunk/tests/src/java/org/apache/log4j/xml/XLevel.java
URL: http://svn.apache.org/viewvc/logging/log4j/trunk/tests/src/java/org/apache/log4j/xml/XLevel.java?rev=1334637&r1=1334636&r2=1334637&view=diff
==============================================================================
--- logging/log4j/trunk/tests/src/java/org/apache/log4j/xml/XLevel.java (original)
+++ logging/log4j/trunk/tests/src/java/org/apache/log4j/xml/XLevel.java Sun May  6 14:24:29
2012
@@ -53,7 +53,7 @@ public class XLevel extends Level {
   public
   static
   Level toLevel(String sArg) {
-    return (Level) toLevel(sArg, XLevel.TRACE);
+    return toLevel(sArg, XLevel.TRACE);
   }
 
 
@@ -72,7 +72,7 @@ public class XLevel extends Level {
       return XLevel.LETHAL;
     }
       
-    return Level.toLevel(sArg, (Level) defaultValue);    
+    return Level.toLevel(sArg, defaultValue);    
   }
 
 



Mime
View raw message