cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anto...@apache.org
Subject svn commit: r366725 - in /cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon: components/source/ components/source/impl/ generation/ matching/modular/ transformation/ util/ xml/dom/
Date Sat, 07 Jan 2006 13:53:39 GMT
Author: antonio
Date: Sat Jan  7 05:53:30 2006
New Revision: 366725

URL: http://svn.apache.org/viewcvs?rev=366725&view=rev
Log:
Remove redundant nullcheck of values known to be not-null.

Modified:
    cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/source/SourceUtil.java
    cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/source/impl/EmptySource.java
    cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/generation/CSVGenerator.java
    cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/matching/modular/CachingRegexpMatcher.java
    cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/matching/modular/CachingWildcardMatcher.java
    cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/matching/modular/WildcardMatcher.java
    cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/transformation/I18nTransformer.java
    cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/transformation/XIncludeTransformer.java
    cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/util/IOUtils.java
    cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/xml/dom/DOMUtil.java

Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/source/SourceUtil.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/source/SourceUtil.java?rev=366725&r1=366724&r2=366725&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/source/SourceUtil.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/source/SourceUtil.java
Sat Jan  7 05:53:30 2006
@@ -708,12 +708,11 @@
                     } catch (ComponentException e) {
                         throw new ProcessingException("Unable to lookup serializer.", e);
                     } finally {
-                        if (oStream != null) {
-                            oStream.flush();
-                            try {
-                                oStream.close();
-                            } catch (Exception ignore) {
-                            }
+                        oStream.flush();
+                        try {
+                            oStream.close();
+                        } catch (Exception ignore) {
+                            // do nothing
                         }
                         if (selector != null) {
                             selector.release(serializer);

Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/source/impl/EmptySource.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/source/impl/EmptySource.java?rev=366725&r1=366724&r2=366725&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/source/impl/EmptySource.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/source/impl/EmptySource.java
Sat Jan  7 05:53:30 2006
@@ -53,9 +53,9 @@
         final int pos = location.indexOf(':');
         this.scheme = location.substring(0, pos);
 
-        final String rootName = location.substring(pos + 1);
-        if (rootName != null && rootName.trim().length() > 0) {
-            this.rootElementName = rootName.trim();
+        final String rootName = location.substring(pos + 1).trim();
+        if (rootName.length() > 0) {
+            this.rootElementName = rootName;
             this.xmlDocument = '<' + this.rootElementName + "/>";
         } else {
             this.xmlDocument = "";

Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/generation/CSVGenerator.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/generation/CSVGenerator.java?rev=366725&r1=366724&r2=366725&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/generation/CSVGenerator.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/generation/CSVGenerator.java Sat
Jan  7 05:53:30 2006
@@ -418,7 +418,7 @@
                 for (i = 1; i < l ; i++) {
                     c = read();
                     if (c == -1) break;
-                    if (b != null) b[o + i] = (char)c;
+                    b[o + i] = (char)c;
                 }
             } catch (IOException ee) {
                 return i;

Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/matching/modular/CachingRegexpMatcher.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/matching/modular/CachingRegexpMatcher.java?rev=366725&r1=366724&r2=366725&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/matching/modular/CachingRegexpMatcher.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/matching/modular/CachingRegexpMatcher.java
Sat Jan  7 05:53:30 2006
@@ -46,7 +46,7 @@
  * @author <a href="mailto:haul@apache.org">Christian Haul</a>
  * @author <a href="mailto:sylvain@apache.org">Sylvain Wallez</a>
  * @author <a href="mailto:vgritsenko@apache.org">Vadim Gritsenko</a>
- * @version CVS $Id: CachingRegexpMatcher.java,v 1.3 2004/03/05 13:02:57 bdelacretaz Exp
$
+ * @version CVS $Id$
  */
 public class CachingRegexpMatcher extends AbstractRegexpMatcher
     implements Configurable,  Initializable, Composable, Disposable
@@ -175,7 +175,7 @@
             try {
                 // obtain input module
                 iputSelector=(ComponentSelector) this.manager.lookup(INPUT_MODULE_SELECTOR);

-                if (inputName != null && iputSelector != null && iputSelector.hasComponent(inputName)){
+                if (iputSelector != null && iputSelector.hasComponent(inputName))
{
                     iput = (InputModule) iputSelector.select(inputName);
                 }
                 if (iput != null) {

Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/matching/modular/CachingWildcardMatcher.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/matching/modular/CachingWildcardMatcher.java?rev=366725&r1=366724&r2=366725&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/matching/modular/CachingWildcardMatcher.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/matching/modular/CachingWildcardMatcher.java
Sat Jan  7 05:53:30 2006
@@ -46,7 +46,7 @@
  * @author <a href="mailto:haul@apache.org">Christian Haul</a>
  * @author <a href="mailto:sylvain@apache.org">Sylvain Wallez</a>
  * @author <a href="mailto:vgritsenko@apache.org">Vadim Gritsenko</a>
- * @version CVS $Id: CachingWildcardMatcher.java,v 1.3 2004/03/05 13:02:57 bdelacretaz Exp
$
+ * @version CVS $Id$
  */
 public class CachingWildcardMatcher extends AbstractWildcardMatcher
     implements Configurable,  Initializable, Composable, Disposable
@@ -175,7 +175,7 @@
             try {
                 // obtain input module
                 iputSelector=(ComponentSelector) this.manager.lookup(INPUT_MODULE_SELECTOR);

-                if (inputName != null && iputSelector != null && iputSelector.hasComponent(inputName)){
+                if (iputSelector != null && iputSelector.hasComponent(inputName))
{
                     iput = (InputModule) iputSelector.select(inputName);
                 }
                 if (iput != null) {

Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/matching/modular/WildcardMatcher.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/matching/modular/WildcardMatcher.java?rev=366725&r1=366724&r2=366725&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/matching/modular/WildcardMatcher.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/matching/modular/WildcardMatcher.java
Sat Jan  7 05:53:30 2006
@@ -43,7 +43,7 @@
  * @author <a href="mailto:haul@apache.org">Christian Haul</a>
  * @author <a href="mailto:sylvain@apache.org">Sylvain Wallez</a>
  * @author <a href="mailto:vgritsenko@apache.org">Vadim Gritsenko</a>
- * @version CVS $Id: WildcardMatcher.java,v 1.3 2004/03/05 13:02:57 bdelacretaz Exp $
+ * @version CVS $Id$
  */
 public class WildcardMatcher extends AbstractWildcardMatcher
     implements Configurable, Composable
@@ -102,7 +102,7 @@
         try {
             // obtain input module
             inputSelector=(ComponentSelector) this.manager.lookup(INPUT_MODULE_SELECTOR);

-            if (inputName != null && inputSelector != null && inputSelector.hasComponent(inputName)){
+            if (inputSelector != null && inputSelector.hasComponent(inputName)) {
                 input = (InputModule) inputSelector.select(inputName);
             }
             if (input != null) {

Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/transformation/I18nTransformer.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/transformation/I18nTransformer.java?rev=366725&r1=366724&r2=366725&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/transformation/I18nTransformer.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/transformation/I18nTransformer.java
Sat Jan  7 05:53:30 2006
@@ -2073,23 +2073,15 @@
             to_fmt.applyPattern(pattern);
         }
 
-        if (value == null) {
-            numberValue = new Long(0);
-        } else {
-            try {
-                numberValue = from_fmt.parse(value);
-                if (int_currency > 0) {
-                    numberValue = new Double(numberValue.doubleValue() /
-                                             int_currency);
-                } else {
-                    // what?
-                }
-            } catch (ParseException pe) {
-                throw new SAXException(
-                        this.getClass().getName()
-                        + "i18n:number - parsing error.", pe
-                );
+        try {
+            numberValue = from_fmt.parse(value);
+            if (int_currency > 0) {
+                numberValue = new Double(numberValue.doubleValue() / int_currency);
+            } else {
+                // what?
             }
+        } catch (ParseException pe) {
+            throw new SAXException(this.getClass().getName() + "i18n:number - parsing error.",
pe);
         }
 
         // we have all necessary data here: do formatting.

Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/transformation/XIncludeTransformer.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/transformation/XIncludeTransformer.java?rev=366725&r1=366724&r2=366725&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/transformation/XIncludeTransformer.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/transformation/XIncludeTransformer.java
Sat Jan  7 05:53:30 2006
@@ -416,10 +416,8 @@
                         reader = new BufferedReader(isr);
                         int read;
                         char ary[] = new char[1024 * 4];
-                        if (reader != null) {
-                            while ((read = reader.read(ary)) != -1) {
-                                super.characters(ary,0,read);
-                            }
+                        while ((read = reader.read(ary)) != -1) {
+                            super.characters(ary,0,read);
                         }
                     } finally {
                         if (reader != null) reader.close();

Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/util/IOUtils.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/util/IOUtils.java?rev=366725&r1=366724&r2=366725&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/util/IOUtils.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/util/IOUtils.java Sat Jan  7 05:53:30
2006
@@ -81,7 +81,7 @@
             fw.write(string);
             fw.flush();
         } finally {
-            if (fw != null) fw.close();
+            fw.close();
         }
     }
 
@@ -104,7 +104,7 @@
                 buffer.append(chr, 0, len);
             }
         } finally {
-            if (reader != null) reader.close();
+            reader.close();
         }
         return buffer.toString();
     }
@@ -125,7 +125,7 @@
             oos.writeObject(object);
             oos.flush();
         } finally {
-            if (fos != null) fos.close();
+            fos.close();
         }
     }
 
@@ -145,7 +145,7 @@
             ObjectInputStream ois = new ObjectInputStream(new BufferedInputStream(fis));
             object = ois.readObject();
         } finally {
-            if (fis != null) fis.close();
+            fis.close();
         }
         return object;
     }

Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/xml/dom/DOMUtil.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/xml/dom/DOMUtil.java?rev=366725&r1=366724&r2=366725&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/xml/dom/DOMUtil.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/xml/dom/DOMUtil.java Sat Jan 
7 05:53:30 2006
@@ -339,7 +339,7 @@
                             }
                         }
                         value = valueBuffer.toString().trim();
-                        if (key != null && value != null && value.length()
> 0) {
+                        if (key != null && value.length() > 0) {
                             par.setParameter(key, value);
                         }
                     }



Mime
View raw message