Return-Path: Delivered-To: apmail-commons-commits-archive@minotaur.apache.org Received: (qmail 79296 invoked from network); 4 Oct 2010 06:06:29 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 4 Oct 2010 06:06:29 -0000 Received: (qmail 80332 invoked by uid 500); 4 Oct 2010 06:06:29 -0000 Delivered-To: apmail-commons-commits-archive@commons.apache.org Received: (qmail 79964 invoked by uid 500); 4 Oct 2010 06:06:25 -0000 Mailing-List: contact commits-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@commons.apache.org Delivered-To: mailing list commits@commons.apache.org Received: (qmail 79955 invoked by uid 99); 4 Oct 2010 06:06:25 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 04 Oct 2010 06:06:25 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 04 Oct 2010 06:06:22 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 2865523889E9; Mon, 4 Oct 2010 06:06:01 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: commits@commons.apache.org From: niallp@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20101004060601.2865523889E9@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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(