public static RegistryEntry parse ( final byte [ ] bytes ) throws IOException , SAXException , ParserConfigurationException { try { return SecurityHelper . doPrivilegedExceptionAction ( new PrivilegedExceptionAction < RegistryEntry > ( ) { public RegistryEntry run ( ) throws Exception { return new RegistryEntry ( DocumentBuilderFactory . newInstance ( ) . newDocumentBuilder ( ) . parse ( new ByteArrayInputStream ( bytes ) ) ) ; } } ) ; } catch ( PrivilegedActionException pae ) { Throwable cause = pae . getCause ( ) ; if ( cause instanceof ParserConfigurationException ) { throw ( ParserConfigurationException ) cause ; } else if ( cause instanceof IOException ) { throw ( IOException ) cause ; } else if ( cause instanceof SAXException ) { throw ( SAXException ) cause ; } else if ( cause instanceof RuntimeException ) { throw ( RuntimeException ) cause ; } else { throw new RuntimeException ( cause ) ; } } }
Factory method to create RegistryEntry from serialized XML