aboutsummaryrefslogtreecommitdiffstats
path: root/loadtime
diff options
context:
space:
mode:
authoravasseur <avasseur>2005-10-19 09:51:17 +0000
committeravasseur <avasseur>2005-10-19 09:51:17 +0000
commit31c2e3f98737cb9cb2923040d2fd12784785a671 (patch)
treea3b6e8eb7f069106df5f85f72cf9c39866344248 /loadtime
parent745b7b93661f19d37b79c87081ec024a493d00f6 (diff)
downloadaspectj-31c2e3f98737cb9cb2923040d2fd12784785a671.tar.gz
aspectj-31c2e3f98737cb9cb2923040d2fd12784785a671.zip
fix for odd NPE - don't know what this readAspect goal is (javadoc welcome) and thus if my fix is ok
Diffstat (limited to 'loadtime')
-rw-r--r--loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java15
1 files changed, 11 insertions, 4 deletions
diff --git a/loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java b/loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java
index f314e19d5..1698f9d7a 100644
--- a/loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java
+++ b/loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java
@@ -416,9 +416,14 @@ public class ClassLoaderWeavingAdaptor extends WeavingAdaptor {
* @return the bytecode representation of the aspect
*/
private String readAspect(String name, ClassLoader loader){
- try {
+ if (true) return name+"@"+(loader==null?"0":loader.hashCode());
+ // FIXME AV - ?? can someone tell me why we read the whole bytecode
+ // especially one byte by one byte
+ // also it does some NPE sometime (see AtAjLTW "LTW Decp2")
+ InputStream is = null;
+ try {
String result = "";
- InputStream is = loader.getResourceAsStream(name.replace('.','/')+".class");
+ is = loader.getResourceAsStream(name.replace('.','/')+".class");
int b = is.read();
while(b!=-1){
result = result + b;
@@ -429,11 +434,13 @@ public class ClassLoaderWeavingAdaptor extends WeavingAdaptor {
} catch (IOException e) {
e.printStackTrace();
return "";
- }catch (NullPointerException e) {
+ } catch (NullPointerException e) {
//probably tried to read in a "non aspect @missing@" aspect
System.err.println("ClassLoaderWeavingAdaptor.readAspect() name: "+name+" Exception: "+e);
return "";
- }
+ } finally {
+ try {is.close();} catch (Throwable t) {;}
+ }
}
}