commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nia...@apache.org
Subject svn commit: r1004122 - /commons/proper/io/trunk/src/java/org/apache/commons/io/input/XmlStreamReader.java
Date Mon, 04 Oct 2010 06:06:01 GMT
Author: niallp
Date: Mon Oct  4 06:06:00 2010
New Revision: 1004122

URL: http://svn.apache.org/viewvc?rev=1004122&view=rev
Log:
IO-162 Minor refactoring to improve readability

Modified:
    commons/proper/io/trunk/src/java/org/apache/commons/io/input/XmlStreamReader.java

Modified: commons/proper/io/trunk/src/java/org/apache/commons/io/input/XmlStreamReader.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/java/org/apache/commons/io/input/XmlStreamReader.java?rev=1004122&r1=1004121&r2=1004122&view=diff
==============================================================================
--- commons/proper/io/trunk/src/java/org/apache/commons/io/input/XmlStreamReader.java (original)
+++ commons/proper/io/trunk/src/java/org/apache/commons/io/input/XmlStreamReader.java Mon
Oct  4 06:06:00 2010
@@ -603,8 +603,12 @@ public class XmlStreamReader extends Rea
         String mime = null;
         if (httpContentType != null) {
             int i = httpContentType.indexOf(";");
-            mime = ((i == -1) ? httpContentType : httpContentType.substring(0,
-                    i)).trim();
+            if (i >= 0) {
+                mime = httpContentType.substring(0, i);
+            } else {
+                mime = httpContentType;
+            }
+            mime = mime.trim();
         }
         return mime;
     }
@@ -701,12 +705,11 @@ public class XmlStreamReader extends Rea
      * otherwise false
      */
     private static boolean isAppXml(String mime) {
-        return mime != null
-                && (mime.equals("application/xml")
-                        || mime.equals("application/xml-dtd")
-                        || mime
-                                .equals("application/xml-external-parsed-entity") || (mime
-                        .startsWith("application/") && mime.endsWith("+xml")));
+        return mime != null &&
+               (mime.equals("application/xml") || 
+                mime.equals("application/xml-dtd") ||
+                mime.equals("application/xml-external-parsed-entity") ||
+               (mime.startsWith("application/") && mime.endsWith("+xml")));
     }
 
     /**
@@ -717,10 +720,10 @@ public class XmlStreamReader extends Rea
      * otherwise false
      */
     private static boolean isTextXml(String mime) {
-        return mime != null
-                && (mime.equals("text/xml")
-                        || mime.equals("text/xml-external-parsed-entity") || (mime
-                        .startsWith("text/") && mime.endsWith("+xml")));
+        return mime != null &&
+              (mime.equals("text/xml") ||
+               mime.equals("text/xml-external-parsed-entity") ||
+              (mime.startsWith("text/") && mime.endsWith("+xml")));
     }
 
     private static final MessageFormat RAW_EX_1 = new MessageFormat(



Mime
View raw message