static String parseContentType ( String contentType ) throws IOException { if ( contentType . indexOf ( System . getProperty ( "line.separator" ) ) > 0 ) { BufferedReader reader = new BufferedReader ( new StringReader ( contentType ) ) ; try { String plainContentType = reader . readLine ( ) ; if ( plainContentType != null && plainContentType . trim ( ) . endsWith ( ";" ) ) { plainContentType = plainContentType . trim ( ) . substring ( 0 , plainContentType . length ( ) - 1 ) ; } return plainContentType ; } finally { try { reader . close ( ) ; } catch ( IOException e ) { log . warn ( "Failed to close reader" , e ) ; } } } return contentType ; }
When content type has multiple lines this method just returns plain content type information in first line . This is the case when multipart mixed content type has boundary information in next line .