You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ni...@apache.org on 2010/10/04 08:06:01 UTC

svn commit: r1004122 - /commons/proper/io/trunk/src/java/org/apache/commons/io/input/XmlStreamReader.java

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(