return null; } catch ( SAXException saxe ) { saxe.printStackTrace(); throw new RemoteException( saxe.getMessage() ); } catch ( EXistException e ) { throw new RemoteException( e.getMessage() ); } catch ( PermissionDeniedException e ) { throw new RemoteException( e.getMessage() ); } finally { pool.release( broker ); } }
return serializer.serialize(document);          } catch (SAXException saxe) { saxe.printStackTrace(); throw new RemoteException(saxe.getMessage()); } catch (EXistException e) { throw new RemoteException(e.getMessage()); } catch (PermissionDeniedException e) { throw new RemoteException(e.getMessage()); } finally { pool.release(broker); } }
    public byte[] getResource( String name, String encoding,                               boolean prettyPrint )         throws java.rmi.RemoteException {        DBBroker broker = null;        try {            broker = pool.get();            DocumentImpl document =                (DocumentImpl) broker.getDocument( name );            if ( document == null )                throw new RemoteException( "resource " + name + " not found" );            Serializer serializer = broker.getSerializer();            String xml = null;            if ( prettyPrint ) {                StringWriter sout = new StringWriter();                OutputFormat format =                    new OutputFormat( "xml", encoding, true );                format.setOmitXMLDeclaration( false );                format.setOmitComments( false );                format.setLineWidth( 60 );                XMLSerializer xmlout =                    new XMLSerializer( sout, format );                serializer.setContentHandler( xmlout );                serializer.setLexicalHandler( xmlout );                serializer.toSAX( document );                xml = sout.toString();            }            else                xml = serializer.serialize( document );            if ( xml != null )                try {                    return xml.getBytes( encoding );                } catch ( java.io.UnsupportedEncodingException e ) {                    return xml.getBytes();                }            return null;        } catch ( SAXException saxe ) {            saxe.printStackTrace();            throw new RemoteException( saxe.getMessage() );        } catch ( EXistException e ) {            throw new RemoteException( e.getMessage() );        } catch ( PermissionDeniedException e ) {            throw new RemoteException( e.getMessage() );        } finally {            pool.release( broker );        }    }