coliver 2003/12/27 01:06:26
Modified: src/java/org/apache/cocoon/components/flow/javascript/fom
CompilingClassLoader.java
Log:
Notify source listeners of dependent classes
Revision Changes Path
1.2 +31 -25
cocoon-2.1/src/java/org/apache/cocoon/components/flow/javascript/fom/CompilingClassLoader.java
Index: CompilingClassLoader.java
===================================================================
RCS file:
/home/cvs/cocoon-2.1/src/java/org/apache/cocoon/components/flow/javascript/fom/CompilingClassLoader.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- CompilingClassLoader.java 27 Dec 2003 07:30:42 -0000 1.1
+++ CompilingClassLoader.java 27 Dec 2003 09:06:26 -0000 1.2
@@ -137,38 +137,42 @@
}
public void setSourcePath(String[] path) {
- sourcePath.clear();
- for (int i = 0; i < path.length; i++) {
- sourcePath.add(path[i]);
+ synchronized (sourcePath) {
+ sourcePath.clear();
+ for (int i = 0; i < path.length; i++) {
+ sourcePath.add(path[i]);
+ }
+ sourcePath.add("");
}
- sourcePath.add("");
}
private Source getSource(String className) {
- Iterator iter = sourcePath.iterator();
- while (iter.hasNext()) {
- String prefix = (String)iter.next();
- if (prefix.length() > 0) {
- if (!prefix.endsWith("/")) {
- prefix = prefix + "/";
+ synchronized (sourcePath) {
+ Iterator iter = sourcePath.iterator();
+ while (iter.hasNext()) {
+ String prefix = (String)iter.next();
+ if (prefix.length() > 0) {
+ if (!prefix.endsWith("/")) {
+ prefix = prefix + "/";
+ }
}
+ String uri = prefix + className.replace('.', '/') + ".java";
+ Source src;
+ try {
+ src = sourceResolver.resolveURI(uri);
+ } catch (MalformedURLException ignored) {
+ continue;
+ } catch (IOException ignored) {
+ continue;
+ }
+ if (src.exists()) {
+ return src;
+ }
+ releaseSource(src);
}
- String uri = prefix + className.replace('.', '/') + ".java";
- Source src;
- try {
- src = sourceResolver.resolveURI(uri);
- } catch (MalformedURLException ignored) {
- continue;
- } catch (IOException ignored) {
- continue;
- }
- if (src.exists()) {
- return src;
- }
- releaseSource(src);
+ return null;
}
- return null;
}
private void releaseSource(Source src) {
@@ -279,6 +283,9 @@
System.out.println("Compiled: " + className);
output.put(className,
s.toByteArray());
+ Source src = getSource(className);
+ notifyListeners(src, null);
+ releaseSource(src);
}
};
}
@@ -347,7 +354,6 @@
throw new ClassCompilationException(msg);
}
- notifyListeners(src, null);
return (byte[])output.get(className);
} finally {
releaseSource(src);