Changeset 5110


Ignore:
Timestamp:
05/14/09 09:58:59 (11 years ago)
Author:
melissa
Message:

Fixed bug in parsing XML from a byte array.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/components/common/src/loci/common/DataTools.java

    r5103 r5110  
    728728    DefaultHandler handler) throws IOException 
    729729  { 
     730    byte[] b = new byte[(int) (stream.getFilePointer() - stream.length())]; 
     731    stream.read(b); 
     732    parseXML(b, handler); 
     733    b = null; 
     734  } 
     735 
     736  public static void parseXML(byte[] xml, DefaultHandler handler) 
     737    throws IOException 
     738  { 
    730739    try { 
    731740      SAXParser parser = SAX_FACTORY.newSAXParser(); 
    732       parser.parse(stream, handler); 
     741      parser.parse(new ByteArrayInputStream(xml), handler); 
    733742    } 
    734743    catch (ParserConfigurationException exc) { 
     
    741750      e.initCause(exc); 
    742751      throw e; 
    743     } 
    744   } 
    745  
    746   public static void parseXML(byte[] xml, DefaultHandler handler) 
    747     throws IOException 
    748   { 
    749     parseXML(new RandomAccessInputStream(xml), handler); 
     752 
     753    } 
    750754  } 
    751755 
Note: See TracChangeset for help on using the changeset viewer.