@@ -603,8 +603,12 @@ private static String getContentTypeMime(String httpContentType) {
603603 String mime = null ;
604604 if (httpContentType != null ) {
605605 int i = httpContentType .indexOf (";" );
606- mime = ((i == -1 ) ? httpContentType : httpContentType .substring (0 ,
607- i )).trim ();
606+ if (i >= 0 ) {
607+ mime = httpContentType .substring (0 , i );
608+ } else {
609+ mime = httpContentType ;
610+ }
611+ mime = mime .trim ();
608612 }
609613 return mime ;
610614 }
@@ -701,12 +705,11 @@ private static String getXmlProlog(InputStream is, String guessedEnc)
701705 * otherwise false
702706 */
703707 private static boolean isAppXml (String mime ) {
704- return mime != null
705- && (mime .equals ("application/xml" )
706- || mime .equals ("application/xml-dtd" )
707- || mime
708- .equals ("application/xml-external-parsed-entity" ) || (mime
709- .startsWith ("application/" ) && mime .endsWith ("+xml" )));
708+ return mime != null &&
709+ (mime .equals ("application/xml" ) ||
710+ mime .equals ("application/xml-dtd" ) ||
711+ mime .equals ("application/xml-external-parsed-entity" ) ||
712+ (mime .startsWith ("application/" ) && mime .endsWith ("+xml" )));
710713 }
711714
712715 /**
@@ -717,10 +720,10 @@ private static boolean isAppXml(String mime) {
717720 * otherwise false
718721 */
719722 private static boolean isTextXml (String mime ) {
720- return mime != null
721- && (mime .equals ("text/xml" )
722- || mime .equals ("text/xml-external-parsed-entity" ) || ( mime
723- .startsWith ("text/" ) && mime .endsWith ("+xml" )));
723+ return mime != null &&
724+ (mime .equals ("text/xml" ) ||
725+ mime .equals ("text/xml-external-parsed-entity" ) ||
726+ ( mime .startsWith ("text/" ) && mime .endsWith ("+xml" )));
724727 }
725728
726729 private static final MessageFormat RAW_EX_1 = new MessageFormat (
0 commit comments