Source:
<code>private EntityDescriptor generateMetadataObjectFromString(String metadataString) { EntityDescriptor entityDescriptor = null; try { Configuration.registerObjectProvider(UseFullyQualifiedUsername.DEFAULT_ELEMENT_NAME, new UseFullyQualifiedUsernameBuilder(), new UseFullyQualifiedUsernameMarshaller(), new UseFullyQualifiedUsernameUnmarshaller()); Configuration.registerObjectProvider(DoSignResponse.DEFAULT_ELEMENT_NAME, new DoSignResponseBuilder(), new DoSignResponseMarshaller(), new DoSignResponseUnmarshaller()); Configuration.registerObjectProvider(IdPInitSSOEnabled.DEFAULT_ELEMENT_NAME, new IdPInitSSOEnabledBuilder (), new IdPInitSSOEnabledMarshaller(), new IdPInitSSOEnabledUnmarshaller()); Configuration.registerObjectProvider(RequestedRecipients.DEFAULT_ELEMENT_NAME, new RequestedRecipientsBuilder(), new RequestedRecipientsMarshaller(), new RequestedRecipientsUnmarshaller()); Configuration.registerObjectProvider(RequestedAudiences.DEFAULT_ELEMENT_NAME, new RequestedAudiencesBuilder(), new RequestedAudiencesMarshaller(), new RequestedAudiencesUnmarshaller()); Configuration.registerObjectProvider(Audience.DEFAULT_ELEMENT_NAME, new AudienceBuilder(), new AudienceMarshaller(), new AudienceUnmarshaller()); Configuration.registerObjectProvider(Recipient.DEFAULT_ELEMENT_NAME, new RecipientBuilder(), new RecipientMarshaller(), new RecipientUnmarshaller()); Configuration.registerObjectProvider(EnableEncryptedAssertion.DEFAULT_ELEMENT_NAME, new EnableEncryptedAssertionBuilder(), new EnableEncryptedAssertionMarshaller(), new EnableEncryptedAssertionUnmarshaller()); DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setNamespaceAware(true); DocumentBuilder builder = factory.newDocumentBuilder(); Document document = builder.parse(new ByteArrayInputStream(metadataString.getBytes())); Element node = document.getDocumentElement(); DOMMetadataProvider idpMetaDataProvider = new DOMMetadataProvider(node); idpMetaDataProvider.setRequireValidMetadata(true); idpMetaDataProvider.setParserPool(new BasicParserPool()); idpMetaDataProvider.initialize(); XMLObject xmlObject = idpMetaDataProvider.getMetadata(); entityDescriptor = (EntityDescriptor) xmlObject; } catch (MetadataProviderException | SAXException | ParserConfigurationException | IOException e) { <START> log.error("Error While reading Service Provider metadata xml", e); <END> } return entityDescriptor; }</code><technical_language>throwing exception this level</technical_language>

Target:
private EntityDescriptor generateMetadataObjectFromString(String metadataString) throws IdentityException { EntityDescriptor entityDescriptor = null; try { Configuration.registerObjectProvider(UseFullyQualifiedUsername.DEFAULT_ELEMENT_NAME, new UseFullyQualifiedUsernameBuilder(), new UseFullyQualifiedUsernameMarshaller(), new UseFullyQualifiedUsernameUnmarshaller()); Configuration.registerObjectProvider(DoSignResponse.DEFAULT_ELEMENT_NAME, new DoSignResponseBuilder(), new DoSignResponseMarshaller(), new DoSignResponseUnmarshaller()); Configuration.registerObjectProvider(IdPInitSSOEnabled.DEFAULT_ELEMENT_NAME, new IdPInitSSOEnabledBuilder (), new IdPInitSSOEnabledMarshaller(), new IdPInitSSOEnabledUnmarshaller()); Configuration.registerObjectProvider(RequestedRecipients.DEFAULT_ELEMENT_NAME, new RequestedRecipientsBuilder(), new RequestedRecipientsMarshaller(), new RequestedRecipientsUnmarshaller()); Configuration.registerObjectProvider(RequestedAudiences.DEFAULT_ELEMENT_NAME, new RequestedAudiencesBuilder(), new RequestedAudiencesMarshaller(), new RequestedAudiencesUnmarshaller()); Configuration.registerObjectProvider(Audience.DEFAULT_ELEMENT_NAME, new AudienceBuilder(), new AudienceMarshaller(), new AudienceUnmarshaller()); Configuration.registerObjectProvider(Recipient.DEFAULT_ELEMENT_NAME, new RecipientBuilder(), new RecipientMarshaller(), new RecipientUnmarshaller()); Configuration.registerObjectProvider(EnableEncryptedAssertion.DEFAULT_ELEMENT_NAME, new EnableEncryptedAssertionBuilder(), new EnableEncryptedAssertionMarshaller(), new EnableEncryptedAssertionUnmarshaller()); DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setNamespaceAware(true); DocumentBuilder builder = factory.newDocumentBuilder(); Document document = builder.parse(new ByteArrayInputStream(metadataString.getBytes())); Element node = document.getDocumentElement(); DOMMetadataProvider idpMetaDataProvider = new DOMMetadataProvider(node); idpMetaDataProvider.setRequireValidMetadata(true); idpMetaDataProvider.setParserPool(new BasicParserPool()); idpMetaDataProvider.initialize(); XMLObject xmlObject = idpMetaDataProvider.getMetadata(); entityDescriptor = (EntityDescriptor) xmlObject; } catch (MetadataProviderException | SAXException | ParserConfigurationException | IOException e) { log.error("Error While reading Service Provider metadata xml"); throw new IdentityException("Error While reading Service Provider metadata xml", e); } return entityDescriptor; }