From d46c28243e5bafd2390f5356f5d77388af046bc1 Mon Sep 17 00:00:00 2001 From: mwebster Date: Fri, 15 Sep 2006 11:13:14 +0000 Subject: [PATCH] ignore duplicate aop.xml definition --- .../weaver/loadtime/ClassLoaderWeavingAdaptor.java | 14 ++++++++++++-- .../org/aspectj/weaver/tools/AbstractTrace.java | 2 ++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java b/loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java index 45fb96d8a..3f4ad5729 100644 --- a/loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java +++ b/loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java @@ -21,9 +21,11 @@ import java.net.URL; import java.util.ArrayList; import java.util.Enumeration; import java.util.HashMap; +import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Properties; +import java.util.Set; import java.util.StringTokenizer; import org.aspectj.asm.IRelationship; @@ -193,10 +195,18 @@ public class ClassLoaderWeavingAdaptor extends WeavingAdaptor { Enumeration xmls = weavingContext.getResources(st.nextToken()); // System.out.println("? registerDefinitions: found-aop.xml=" + xmls.hasMoreElements() + ", loader=" + loader); + Set seenBefore = new HashSet(); while (xmls.hasMoreElements()) { URL xml = (URL) xmls.nextElement(); - info("using configuration " + weavingContext.getFile(xml)); - definitions.add(DocumentParser.parse(xml)); + trace.event("parseDefinitions",this,xml); + if (!seenBefore.contains(xml)) { + info("using configuration " + weavingContext.getFile(xml)); + definitions.add(DocumentParser.parse(xml)); + seenBefore.add(xml); + } + else { + warn("ignoring duplicate definition: " + xml); + } } } if (definitions.isEmpty()) { diff --git a/weaver/src/org/aspectj/weaver/tools/AbstractTrace.java b/weaver/src/org/aspectj/weaver/tools/AbstractTrace.java index 6034a1f05..b426c0e9e 100644 --- a/weaver/src/org/aspectj/weaver/tools/AbstractTrace.java +++ b/weaver/src/org/aspectj/weaver/tools/AbstractTrace.java @@ -12,6 +12,7 @@ package org.aspectj.weaver.tools; import java.io.File; import java.lang.reflect.Array; +import java.net.URL; import java.text.SimpleDateFormat; import java.util.Collection; import java.util.Date; @@ -123,6 +124,7 @@ public abstract class AbstractTrace implements Trace { || obj instanceof Class || obj instanceof File || obj instanceof StringBuffer + || obj instanceof URL ) return obj; else if (obj.getClass().isArray()) { return formatArray(obj); -- 2.39.5