public static OAuthApp getOAuthApplicationData(String appName) throws DynamicClientRegistrationException { Resource resource; String resourcePath = DynamicClientRegistrationConstants.OAUTH_APP_DATA_REGISTRY_PATH + "/" + appName; try { resource = DynamicClientWebAppRegistrationUtil.getRegistryResource(resourcePath); if (resource != null) { JAXBContext context = JAXBContext.newInstance(OAuthApp.class); Unmarshaller unmarshaller = context.createUnmarshaller(); return (OAuthApp) unmarshaller.unmarshal( new StringReader( new String( (byte[]) resource.getContent(), Charset.forName( DynamicClientRegistrationConstants.CharSets.CHARSET_UTF8)))); } return new OAuthApp(); } catch (JAXBException e) { throw new DynamicClientRegistrationException( "Error occurred while parsing the OAuth application data : " + appName, e); } catch (RegistryException e) { throw new DynamicClientRegistrationException( "Error occurred while retrieving the Registry resource of OAuth application : " + appName, e); } }