1212import java .util .HashMap ;
1313import java .util .List ;
1414import java .util .Map ;
15- import java .util .logging .Level ;
16- import java .util .logging .Logger ;
1715import javax .xml .parsers .ParserConfigurationException ;
1816import javax .xml .xpath .XPathException ;
1917import org .biojava .nbio .core .sequence .template .Sequence ;
2018import org .biojava .nbio .core .util .XMLHelper ;
19+ import org .slf4j .LoggerFactory ;
2120import org .w3c .dom .Document ;
2221import org .w3c .dom .Element ;
2322import org .xml .sax .SAXException ;
3433 * @author Paolo Pavan
3534 */
3635public class BlastXMLParser implements ResultFactory {
37- private static final Logger log = Logger .getLogger (BlastXMLParser .class . getName () );
36+ private static final org . slf4j . Logger logger = LoggerFactory .getLogger (Hsp .class );
3837 Document blastDoc = null ;
3938 private File targetFile ;
4039 private List <Sequence > queryReferences , databaseReferences ;
@@ -48,17 +47,17 @@ public void setFile(File f){
4847 }
4948
5049 private void readFile (String blastFile ) throws IOException , ParseException {
51- log .info ("Start reading " + blastFile );
50+ logger .info ("Start reading " + blastFile );
5251 try {
5352 blastDoc = XMLHelper .loadXML (blastFile );
5453 } catch (SAXException ex ) {
55- Logger . getLogger ( BlastXMLParser . class . getName ()). log ( Level . SEVERE , null , ex );
54+ logger . error ( "A parsing error has occurred while reading XML blast file" );
5655 throw new ParseException (ex .getMessage (),0 );
5756 } catch (ParserConfigurationException ex ) {
58- Logger . getLogger ( BlastXMLParser . class . getName ()). log ( Level . SEVERE , null , ex );
57+ logger . error ( "Internal XML parser non properly configured" );
5958 throw new ParseException (ex .getMessage (),0 );
6059 }
61- log .info ("Read finished" );
60+ logger .info ("Read finished" );
6261 }
6362
6463 public List <Result > createObjects (double maxEScore ) throws IOException , ParseException {
@@ -80,9 +79,9 @@ public List<Result> createObjects(double maxEScore) throws IOException, ParseExc
8079 String reference = XMLHelper .selectSingleElement (blastDoc .getDocumentElement (),"BlastOutput_reference" ).getTextContent ();
8180 String dbFile = XMLHelper .selectSingleElement (blastDoc .getDocumentElement (),"BlastOutput_db" ).getTextContent ();
8281
83- log .info ("Query for hits in " + targetFile );
82+ logger .info ("Query for hits in " + targetFile );
8483 ArrayList <Element > IterationsList = XMLHelper .selectElements (blastDoc .getDocumentElement (), "BlastOutput_iterations/Iteration[Iteration_hits]" );
85- log .info (IterationsList .size () + " results" );
84+ logger .info (IterationsList .size () + " results" );
8685
8786 resultsCollection = new ArrayList ();
8887 for (Element element : IterationsList ) {
@@ -167,7 +166,7 @@ public List<Result> createObjects(double maxEScore) throws IOException, ParseExc
167166 } catch (XPathException e ) {
168167 throw new ParseException (e .getMessage (),0 );
169168 }
170- log .info ("Parsing of " +targetFile +" finished." );
169+ logger .info ("Parsing of " +targetFile +" finished." );
171170
172171 return resultsCollection ;
173172 }
0 commit comments