You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by cz...@apache.org on 2007/12/19 18:16:18 UTC
svn commit: r605626 -
/incubator/sling/trunk/scripting/api/src/main/java/sun/misc/Service.java
Author: cziegeler
Date: Wed Dec 19 09:16:17 2007
New Revision: 605626
URL: http://svn.apache.org/viewvc?rev=605626&view=rev
Log:
Remove unused import.
Modified:
incubator/sling/trunk/scripting/api/src/main/java/sun/misc/Service.java
Modified: incubator/sling/trunk/scripting/api/src/main/java/sun/misc/Service.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/scripting/api/src/main/java/sun/misc/Service.java?rev=605626&r1=605625&r2=605626&view=diff
==============================================================================
--- incubator/sling/trunk/scripting/api/src/main/java/sun/misc/Service.java (original)
+++ incubator/sling/trunk/scripting/api/src/main/java/sun/misc/Service.java Wed Dec 19 09:16:17 2007
@@ -18,7 +18,6 @@
*/
package sun.misc;
-import java.awt.image.ImagingOpException;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
@@ -46,7 +45,7 @@
public class Service {
private static final String PREFIX = "META-INF/services/";
-
+
/** Returns an empty iterator */
public static <ProviderType> Iterator<ProviderType> providers(Class<ProviderType> type, ClassLoader loader) throws IOException {
if (loader != null) {
@@ -62,47 +61,47 @@
}
private static class NameIterator<ProviderType> implements Iterator<ProviderType> {
-
+
private final ClassLoader loader;
-
+
private final Enumeration<?> files;
private Iterator<String> currentFile;
-
+
private ProviderType nextProvider;
-
+
public NameIterator(ClassLoader loader, Enumeration<?> files) {
this.loader = loader;
this.files = files;
seek();
}
-
+
public boolean hasNext() {
return nextProvider != null;
}
-
+
public ProviderType next() {
if (nextProvider == null) {
throw new NoSuchElementException();
}
-
+
ProviderType result = nextProvider;
seek();
return result;
}
-
+
public void remove() {
throw new UnsupportedOperationException();
}
-
+
private void seek() {
if (currentFile == null || !currentFile.hasNext()) {
currentFile = getNames();
}
-
+
nextProvider = getClass(currentFile);
}
-
+
private Iterator<String> getNames() {
while (files.hasMoreElements()) {
URL fileUrl = (URL) files.nextElement();
@@ -118,15 +117,15 @@
name = name.substring(0, hash);
}
name = name.trim();
-
+
if (name.length() > 0) {
names.add(name);
}
}
-
+
return names.iterator();
} catch (IOException ioe) {
-
+
} finally {
if (ins != null) {
try {
@@ -140,7 +139,7 @@
// exhausted search
return null;
}
-
+
@SuppressWarnings("unchecked")
private ProviderType getClass(Iterator<String> currentFile) {
if (currentFile != null && currentFile.hasNext()) {
@@ -149,10 +148,10 @@
Class<?> clazz = Class.forName(name, true, loader);
return (ProviderType) clazz.newInstance();
} catch (Throwable t) {
- //
+ //
}
}
-
+
return null;
}
}