inprogress
[jalview.git] / forester / java / src / org / forester / io / parsers / phyloxml / PhyloXmlParser.java
index e5fa2d0..b8de6cf 100644 (file)
@@ -5,7 +5,7 @@
 // Copyright (C) 2008-2009 Christian M. Zmasek
 // Copyright (C) 2008-2009 Burnham Institute for Medical Research
 // All rights reserved
-// 
+//
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 // License as published by the Free Software Foundation; either
@@ -15,7 +15,7 @@
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 // Lesser General Public License for more details.
-// 
+//
 // You should have received a copy of the GNU Lesser General Public
 // License along with this library; if not, write to the Free Software
 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
@@ -131,6 +131,7 @@ public class PhyloXmlParser implements PhylogenyParser {
         return _zipped_inputstream;
     }
 
+    @Override
     public Phylogeny[] parse() throws IOException, PhylogenyParserException {
         reset();
         final PhyloXmlHandler handler = new PhyloXmlHandler();
@@ -192,18 +193,12 @@ public class PhyloXmlParser implements PhylogenyParser {
             else if ( getSource() instanceof InputStream ) {
                 if ( !isZippedInputstream() ) {
                     final InputStream is = ( InputStream ) getSource();
-                    final Reader reader = new InputStreamReader( is );
-                    xml_reader.parse( new InputSource( reader ) );
+                    xml_reader.parse( new InputSource( new InputStreamReader( is ) ) );
                 }
                 else {
                     final ZipInputStream zip_is = new ZipInputStream( ( InputStream ) getSource() );
                     zip_is.getNextEntry();
-                    final Reader reader = new InputStreamReader( zip_is );
-                    if ( reader == null ) {
-                        throw new PhylogenyParserException( "zip input stream \"" + getSource()
-                                + "\" appears not to contain any (phyloXML) data" );
-                    }
-                    xml_reader.parse( new InputSource( reader ) );
+                    xml_reader.parse( new InputSource( new InputStreamReader( zip_is ) ) );
                 }
             }
             else if ( getSource() instanceof String ) {
@@ -257,6 +252,7 @@ public class PhyloXmlParser implements PhylogenyParser {
         _warning_messages = new StringBuffer();
     }
 
+    @Override
     public void setSource( final Object source ) {
         _source = source;
     }