1 22 23 28 29 package org.xquark.mapper.util; 30 31 import java.io.IOException ; 32 33 import org.xml.sax.InputSource ; 34 import org.xml.sax.SAXException ; 35 import org.xml.sax.helpers.XMLFilterImpl ; 36 import org.xquark.mapper.RepositoryException; 37 import org.xquark.mapper.storage.RepositoryReader; 38 39 43 public class DisposableReaderFilter extends XMLFilterImpl 44 { 45 private static final String RCSRevision = "$Revision: 1.1 $"; 46 private static final String RCSName = "$Name: $"; 47 public DisposableReaderFilter(RepositoryReader reader) throws RepositoryException 48 { 49 super(reader); 50 } 51 52 public void parse(InputSource input) 53 throws IOException , SAXException 54 { 55 super.parse(input); 56 try { 57 ((RepositoryReader)getParent()).close(); 58 } 59 catch (RepositoryException e) { 60 if (e.getException() instanceof Exception ) 61 throw new SAXException (e.getMessage(), (Exception )e.getException()); 62 else 63 throw (Error )e.getException(); 64 } 65 } 66 public void parse(String systemID) 67 throws IOException , SAXException 68 { 69 super.parse(systemID); 70 try { 71 ((RepositoryReader)getParent()).close(); 72 } 73 catch (RepositoryException e) { 74 if (e.getException() instanceof Exception ) 75 throw new SAXException (e.getMessage(), (Exception )e.getException()); 76 else 77 throw (Error )e.getException(); 78 } 79 } 80 } 81 | Popular Tags |