private static JCorsConfig loadFromFileStream ( InputStream fileStream ) { try { JAXBContext context = JAXBContext . newInstance ( ConfigBuilder . class ) ; Unmarshaller unmarshaller = context . createUnmarshaller ( ) ; unmarshaller . setSchema ( loadXmlSchema ( ) ) ; ConfigBuilder configBuilder = ( ConfigBuilder ) unmarshaller . unmarshal ( fileStream ) ; Constraint . ensureNotNull ( configBuilder , "It was not possible to get a valid configuration builder instance" ) ; return configBuilder . buildConfig ( ) ; } catch ( Exception e ) { log . error ( "Failed loading configuration file" , e ) ; return null ; } }
Builds a configuration class based on XML file