/** * For each services file look for uncommented provider names on each * line. */ private void addProviderNames(URL url, Collection<ProviderName> providerNames) { InputStream in = null; try { in = url.openStream(); BufferedReader reader = new BufferedReader(new InputStreamReader(in)); String line; while ((line = reader.readLine()) != null) { line = line.trim(); Matcher m = nonCommentPattern.matcher(line); if (m.find()) { providerNames.add(new ProviderName(m.group().trim(), url)); } } } catch (IOException ioe) { throw new PersistenceException("IOException caught reading: " + url, ioe); } finally { if (in != null) { try { in.close(); } catch (IOException e) { } } } }
PersistenceProvider provider = (PersistenceProvider) loader.loadClass(providerName.getName()).newInstance(); loadedProviders.add(provider); } catch (ClassNotFoundException cnfe) { log(Level.WARNING, "No valid providers found using:"); for (ProviderName name : providerNames) { log(Level.WARNING, name.toString());
/** * For each services file look for uncommented provider names on each line. */ private void addProviderNames(URL url, Collection<ProviderName> providerNames) { InputStream in = null; try { in = url.openStream(); final BufferedReader reader = new BufferedReader(new InputStreamReader(in)); String line; while ((line = reader.readLine()) != null) { line = line.trim(); final Matcher m = DefaultPersistenceProviderResolver.nonCommentPattern.matcher(line); if (m.find()) { providerNames.add(new ProviderName(m.group().trim(), url)); } } } catch (final IOException ioe) { throw new PersistenceException("IOException caught reading: " + url, ioe); } finally { if (in != null) { try { in.close(); } catch (final IOException e) {} } } }