View | Details | Raw Unified | Return to bug 137235 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/aspectj/util/Reflection.java (-1 / +1 lines)
Lines 136-142 Link Here
136
//            if (!file.canRead()) {
136
//            if (!file.canRead()) {
137
//                throw new IllegalArgumentException("cannot read " + file);
137
//                throw new IllegalArgumentException("cannot read " + file);
138
//            }
138
//            }
139
            if (FileUtil.hasZipSuffix(file)) {
139
            if (FileUtil.isZipFile(file)) {
140
                libs.add(file);
140
                libs.add(file);
141
            } else if (file.isDirectory()) {
141
            } else if (file.isDirectory()) {
142
                dirs.add(file);
142
                dirs.add(file);
(-)src/org/aspectj/util/FileUtil.java (-8 / +11 lines)
Lines 17-23 Link Here
17
import java.net.*;
17
import java.net.*;
18
import java.util.*;
18
import java.util.*;
19
import java.util.zip.*;
19
import java.util.zip.*;
20
import java.util.zip.ZipFile;
21
20
22
21
23
/**
22
/**
Lines 33-39 Link Here
33
    
32
    
34
    public static final FileFilter ZIP_FILTER = new FileFilter() {
33
    public static final FileFilter ZIP_FILTER = new FileFilter() {
35
        public boolean accept(File file) {
34
        public boolean accept(File file) {
36
            return hasZipSuffix(file);
35
            return isZipFile(file);
37
        }
36
        }
38
        public String toString() { 
37
        public String toString() { 
39
            return "ZIP_FILTER"; 
38
            return "ZIP_FILTER"; 
Lines 70-84 Link Here
70
        PERMIT_CVS = LangUtil.getBoolean(name, false);
69
        PERMIT_CVS = LangUtil.getBoolean(name, false);
71
    }
70
    }
72
71
73
    /** @return true if file path has a zip/jar suffix */
72
    /** @return true if file exists and is a zip file */
74
    public static boolean hasZipSuffix(File file) {
73
    public static boolean isZipFile(File file) {
75
        return ((null != file) && hasZipSuffix(file.getPath()));
74
        try {
75
			return (null != file) && new ZipFile(file) != null;
76
		} catch (IOException e) {
77
			return false;
78
		}
76
    }
79
    }
77
80
78
    /** @return true if path ends with .zip or .jar */
81
    /** @return true if path ends with .zip or .jar */
79
    public static boolean hasZipSuffix(String path) {
82
//    public static boolean hasZipSuffix(String path) {
80
        return ((null != path) && (0 != zipSuffixLength(path)));
83
//        return ((null != path) && (0 != zipSuffixLength(path)));
81
    }
84
//    }
82
    
85
    
83
    /** @return 0 if file has no zip/jar suffix or 4 otherwise  */
86
    /** @return 0 if file has no zip/jar suffix or 4 otherwise  */
84
    public static int zipSuffixLength(File file) {
87
    public static int zipSuffixLength(File file) {
(-)src/org/aspectj/systemtest/ajc150/ltw/LTWTests.java (+19 lines)
Lines 89-94 Link Here
89
  		runTest("Override suppressing of warning when advice doesn't match using -Xlint:warning");
89
  		runTest("Override suppressing of warning when advice doesn't match using -Xlint:warning");
90
  	}
90
  	}
91
  	
91
  	
92
  	public void testNonstandardJarFiles() {
93
  		runTest("Nonstandard jar file extensions");  		
94
  	}
95
  	
96
  	public void testOddzipOnClasspath() {  	
97
		runTest("Odd zip on classpath");  		
98
  	}
99
  	
100
  	// separate bugzilla patch has this one... commented out
101
//  	public void testSeparateCompilationDeclareParentsCall() {
102
//  		runTest("Separate compilation with ltw: declare parents and call");
103
//  	}
104
//  	
105
//  	public void testChildAspectDoesntWeaveParentDeclareParentsCall() {
106
//		setSystemProperty(WeavingAdaptor.WEAVING_ADAPTOR_VERBOSE,"true");
107
//		setSystemProperty(WeavingAdaptor.SHOW_WEAVE_INFO_PROPERTY,"true");
108
//  		runTest("Child loader aspect won't weave parent loader: declare parents and call");
109
//  	}
110
  	
92
  	/*
111
  	/*
93
  	 * Allow system properties to be set and restored
112
  	 * Allow system properties to be set and restored
94
  	 * TODO maw move to XMLBasedAjcTestCase or RunSpec
113
  	 * TODO maw move to XMLBasedAjcTestCase or RunSpec
(-)src/org/aspectj/systemtest/ajc150/ltw/ltw-tests.xml (-2 / +130 lines)
Lines 1-6 Link Here
1
1
2
<!-- Load-time weaving tests -->
2
<!-- Load-time weaving tests -->
3
4
	<ajc-test dir="ltw"
3
	<ajc-test dir="ltw"
5
      title="Ensure 1st aspect is rewoven when weaving 2nd aspect"
4
      title="Ensure 1st aspect is rewoven when weaving 2nd aspect"
6
      keywords="reweavable">
5
      keywords="reweavable">
Lines 339-342 Link Here
339
        	</stderr>
338
        	</stderr>
340
        </run>
339
        </run>
341
    </ajc-test>
340
    </ajc-test>
342
    
341
342
	<!-- based on "Ensure 1st aspect is rewoven when weaving 2nd aspect" -->
343
	<ajc-test dir="ltw"
344
      title="Nonstandard jar file extensions" pr="137235">
345
        <compile
346
        	files="folder.jar/Main.java, folder.jar/Aspect1.aj"
347
			outjar="folder.jar/main1.zip"
348
            options="-showWeaveInfo"
349
        >
350
        	<message kind="weave" text="method-execution(void Main.test1())' in Type 'Main' (Main.java:17) advised by before advice from 'Aspect1' (Aspect1.aj:16)"/>
351
        </compile>	
352
        <compile
353
        	classpath="$sandbox/folder.jar/main1.zip"
354
        	files="Aspect2.aj"
355
        	outjar="aspect2Jar"
356
            options="-showWeaveInfo"
357
        >
358
        </compile>	
359
        <run class="Main" ltw="aop-ltwreweavable.xml" classpath="$sandbox/folder.jar/main1.zip,$sandbox/aspect2Jar">
360
        	<stdout>
361
                <line text="Main.main"/>
362
                <line text="Main.test1"/>
363
                <line text="Main.test2"/>
364
            </stdout>
365
        	<stderr>
366
	  	    	<line text="weaveinfo Join point 'method-execution(void Main.test1())' in Type 'Main' (Main.java:17) advised by before advice from 'Aspect1' (Aspect1.aj:16)"/>
367
				<line text="weaveinfo Join point 'method-execution(void Main.test2())' in Type 'Main' (Main.java:21) advised by before advice from 'Aspect2' (Aspect2.aj:16)"/>
368
                <line text="Aspect1.before_test1"/>
369
                <line text="Aspect2.before_test2"/>
370
            </stderr>
371
        </run>
372
    </ajc-test>
373
374
	<ajc-test dir="ltw"
375
      title="Odd zip on classpath" pr="137235">
376
        <compile
377
        	files="folder.jar/Main.java, folder.jar/Aspect1.aj"
378
			outjar="folder.jar/main1.archive"
379
            options="-showWeaveInfo"
380
        >
381
        	<message kind="weave" text="method-execution(void Main.test1())' in Type 'Main' (Main.java:17) advised by before advice from 'Aspect1' (Aspect1.aj:16)"/>
382
        </compile>	
383
        <compile
384
        	classpath="$sandbox/folder.jar/main1.archive"
385
        	files="Aspect2.aj"
386
        	outjar="aspect2Jar"
387
            options="-showWeaveInfo"
388
        >
389
        </compile>	
390
        <run class="Main" ltw="aop-ltwreweavable.xml" classpath="$sandbox/folder.jar/main1.archive,$sandbox/aspect2Jar">
391
        	<stdout>
392
                <line text="Main.main"/>
393
                <line text="Main.test1"/>
394
                <line text="Main.test2"/>
395
            </stdout>
396
        	<stderr>
397
	  	    	<line text="weaveinfo Join point 'method-execution(void Main.test1())' in Type 'Main' (Main.java:17) advised by before advice from 'Aspect1' (Aspect1.aj:16)"/>
398
				<line text="weaveinfo Join point 'method-execution(void Main.test2())' in Type 'Main' (Main.java:21) advised by before advice from 'Aspect2' (Aspect2.aj:16)"/>
399
                <line text="Aspect1.before_test1"/>
400
                <line text="Aspect2.before_test2"/>
401
            </stderr>
402
        </run>
403
    </ajc-test>
404
405
<!--    
406
commented out: reported in another bugzilla bug...
407
408
	<ajc-test dir="ltw/hier"
409
      title="Separate compilation with ltw: declare parents and call"
410
      keywords="ltw">
411
        <compile
412
        	files="util/A.aj,util/T.aj"
413
        />
414
        <compile
415
        	files="child/Executor.aj,child/Advisor.aj,top/SimpleMain.aj"
416
        >
417
        	<message kind="warning" text="this affected type is not exposed to the weaver: util.A"/>
418
		</compile>        
419
        <run class="top.SimpleMain" ltw="aop-single.xml">
420
        	<stdout>
421
                <line text="T call"/>
422
        	</stdout>
423
        	<stderr>
424
        	    <line text="weaveinfo Extending interface set for type 'util.A' (A.aj) to include 'util.T' (Advisor.aj)"/>
425
	        	< - - TODO: fix up any errors in the expected output when the join point actually matches - - >
426
				<line text="weaveinfo Join point 'method-call(void A.foo())' in Type 'child.Executor' (Executor.aj:19) advised by before advice from 'child.Advisor' (Advisor.aj:20)"/>
427
        	</stderr>
428
        </run>
429
    </ajc-test>
430
431
	<ajc-test dir="ltw/hier"
432
      title="Child loader aspect won't weave parent loader: declare parents and call"
433
      keywords="ltw">
434
        <compile
435
        	files="top/HierMain.aj"
436
        />
437
        <compile
438
        	files="util/A.aj,util/T.aj"
439
			outjar="util.jar"
440
        />
441
        <compile
442
        	files="child/Executor.aj,child/Advisor.aj"
443
        	classpath="util.jar"
444
            options="-outxml"
445
            outjar="child.zip"
446
        >
447
        	<message kind="warning" text="this affected type is not exposed to the weaver: util.A"/>
448
		</compile>        
449
		< - - limitation: to turn on load-time weaving we HAVE to have a top-level aop.xml file
450
		   since we don't want any top-level aspects, we deploy an empty one! 
451
		   the important aop.xml file in this test was created with -outxml and lives in child.jar - - >
452
        <run class="top.HierMain" ltw="null-aop.xml">
453
        	<stdout/>
454
        	<stderr>
455
                <line text="info AspectJ Weaver Version"/>
456
                <line text="info register classloader"/>
457
                <line text="info using"/>
458
	        	<line text="info weaving 'top.HierMain'"/>
459
                <line text="info AspectJ Weaver Version"/>
460
                <line text="info register classloader"/>
461
                <line text="info using"/>
462
                <line text="info using file:"/>
463
                <line text="info register aspect child.Advisor"/>
464
                <line text="info weaving 'child.Executor'"/>
465
                <line text="info weaving 'util.A'"/>
466
        	</stderr>
467
        </run>
468
    </ajc-test>
469
-->
470
    
(-)src/org/aspectj/systemtest/ajc152/Ajc152Tests.java (+2 lines)
Lines 44-49 Link Here
44
// this next one reported as a bug by Rob Harrop, but I can't reproduce the failure yet...
44
// this next one reported as a bug by Rob Harrop, but I can't reproduce the failure yet...
45
//public void testAtAspectWithReferencePCPerClause_pr138220() { runTest("@Aspect with reference pointcut in perclause");}  
45
//public void testAtAspectWithReferencePCPerClause_pr138220() { runTest("@Aspect with reference pointcut in perclause");}  
46
46
47
  public void testJarChecking_pr137235_1() { runTest("directory with .jar extension: source and outjar"); }	    
48
  public void testJarChecking_pr137235_2() { runTest("directory with .jar extension"); }	  
47
  /////////////////////////////////////////
49
  /////////////////////////////////////////
48
  public static Test suite() {
50
  public static Test suite() {
49
    return XMLBasedAjcTestCase.loadSuite(Ajc152Tests.class);
51
    return XMLBasedAjcTestCase.loadSuite(Ajc152Tests.class);
(-)src/org/aspectj/systemtest/ajc152/ajc152.xml (+25 lines)
Lines 192-195 Link Here
192
      </run>
192
      </run>
193
    </ajc-test>
193
    </ajc-test>
194
194
195
    <ajc-test dir="bugs152/pr137235"  pr="137235"
196
		title="directory with .jar extension: source and outjar">
197
	    <compile files="directory.jar/Hello.java" outjar="directory.jar/run.custom"/>
198
        <run class="Hello" classpath="$sandbox/directory.jar/run.custom">
199
          <stdout>
200
            <line text="Hello Java"/>
201
          </stdout>
202
        </run>
203
    </ajc-test>
204
    
205
    <ajc-test dir="bugs152/pr137235"  pr="137235"
206
		title="directory with .jar extension"  >
207
	    <compile files="directory.jar/Before.java" outjar="directory.jar/inOne.custom"/>
208
	    <compile files="directory.jar/BeforeExec.aj" outjar="directory.jar/inTwo"/>
209
	    <compile files="directory.jar/Rename.aj" outjar="directory.jar/weave.jar"/>
210
	    <compile files="directory.jar/Hello.java" inpath="directory.jar/inOne.custom,directory.jar/inTwo" aspectpath="directory.jar/weave.jar" outjar="directory.jar/outJar.jar"/>
211
        <run class="Hello" classpath="$sandbox/directory.jar/outJar.jar,$sandbox/directory.jar/weave.jar">
212
          <stdout>
213
            <line text="Before call"/>
214
            <line text="Before execution"/>
215
            <line text="Hello AspectJ not just Java"/>
216
          </stdout>
217
        </run>
218
    </ajc-test>
219
    
195
</suite>
220
</suite>
(-)src/org/aspectj/systemtest/ajc120/ajc120-tests.xml (-1 / +4 lines)
Lines 467-479 Link Here
467
    <ajc-test dir="bugs"  pr="43714"
467
    <ajc-test dir="bugs"  pr="43714"
468
    	title="weaving using an empty jar in -injars"  >
468
    	title="weaving using an empty jar in -injars"  >
469
        <compile files="notAJar.jar" outjar="outJar.jar"> 
469
        <compile files="notAJar.jar" outjar="outJar.jar"> 
470
        	<message kind="error" line="0"/>
470
        	<message kind="warning" text="build config error: skipping missing, empty or corrupt inpath entry"/>
471
        	<message kind="error" text="no sources specified"/>
472
        	<message kind="fail"/>
471
        </compile>
473
        </compile>
472
    </ajc-test>
474
    </ajc-test>
473
	
475
	
474
	 <ajc-test dir="bugs"  pr="43714"
476
	 <ajc-test dir="bugs"  pr="43714"
475
    	title="weaving using an empty jar in -aspectpath"  >
477
    	title="weaving using an empty jar in -aspectpath"  >
476
        <compile files="WeaveLocal.java" aspectpath="notAJar.jar" outjar="outJar.jar" >         	
478
        <compile files="WeaveLocal.java" aspectpath="notAJar.jar" outjar="outJar.jar" >         	
479
        	<message kind="warning" text="build config error: skipping missing, empty or corrupt aspectpath entry"/>
477
        </compile>
480
        </compile>
478
    </ajc-test>
481
    </ajc-test>
479
    
482
    
(-)bugs152/pr137235/directory.jar/Hello.java (+6 lines)
Added Link Here
1
public class Hello {
2
    public static void main(String argz[]) {
3
        System.out.println("Hello "+getName());
4
    }
5
    public static String getName() { return "Java"; }
6
}
(-)ltw/folder.jar/Main.java (+41 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2005 Contributors.
3
 * All rights reserved. 
4
 * This program and the accompanying materials are made available 
5
 * under the terms of the Eclipse Public License v1.0 
6
 * which accompanies this distribution and is available at 
7
 * http://eclipse.org/legal/epl-v10.html 
8
 * 
9
 * Contributors:
10
 *   Matthew Webster         initial implementation
11
 *******************************************************************************/
12
import java.lang.reflect.Method;
13
import java.lang.reflect.Modifier;
14
15
public class Main {
16
17
	public void test1 () {
18
		System.out.println("Main.test1");
19
	}
20
21
	public void test2 () {
22
		System.out.println("Main.test2");
23
	}
24
25
	public void invokeDeclaredMethods () throws Exception {
26
		Method[] methods = getClass().getDeclaredMethods();
27
		for (int i = 0; i < methods.length; i++) {
28
			Method method = methods[i];
29
			int modifiers = method.getModifiers();
30
			if (!Modifier.isStatic(modifiers) && !method.getName().equals("invokeDeclaredMethods")) {
31
				method.invoke(this,new Object[] {});
32
			}
33
		}
34
	}
35
	
36
	public static void main (String[] args) throws Exception {
37
		System.out.println("Main.main");
38
		new Main().test1();
39
		new Main().test2();
40
	}
41
}
(-)ltw/folder.jar/Aspect1.aj (+19 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2005 Contributors.
3
 * All rights reserved. 
4
 * This program and the accompanying materials are made available 
5
 * under the terms of the Eclipse Public License v1.0 
6
 * which accompanies this distribution and is available at 
7
 * http://eclipse.org/legal/epl-v10.html 
8
 * 
9
 * Contributors:
10
 *   Matthew Webster         initial implementation
11
 *******************************************************************************/
12
import org.aspectj.lang.JoinPoint;
13
14
public aspect Aspect1 {
15
	
16
		before () : execution(void Main.test1()) {
17
			System.err.println("Aspect1.before_" + thisJoinPoint.getSignature().getName());
18
		}
19
}
(-)bugs152/pr137235/directory.jar/BeforeExec.aj (+5 lines)
Added Link Here
1
public aspect BeforeExec {
2
    before() : execution(* getName()) {
3
        System.out.println("Before execution");
4
    }
5
}
(-)bugs152/pr137235/directory.jar/Before.java (+5 lines)
Added Link Here
1
public aspect Before {
2
    before() : call(* getName()) {
3
        System.out.println("Before call");
4
    }
5
}
(-)bugs152/pr137235/directory.jar/Rename.aj (+5 lines)
Added Link Here
1
public aspect Rename {
2
    String around() : call(* getName()) { 
3
    	return "AspectJ not just "+proceed(); 
4
	}
5
}
(-)ltw/folder.jar/Aspect2.aj (+19 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2005 Contributors.
3
 * All rights reserved. 
4
 * This program and the accompanying materials are made available 
5
 * under the terms of the Eclipse Public License v1.0 
6
 * which accompanies this distribution and is available at 
7
 * http://eclipse.org/legal/epl-v10.html 
8
 * 
9
 * Contributors:
10
 *   Matthew Webster	initial implementation
11
 *******************************************************************************/
12
import org.aspectj.lang.JoinPoint;
13
14
public aspect Aspect2 {
15
	
16
		before () : execution(void Main.test2()){
17
			System.err.println("Aspect2.before_" + thisJoinPoint.getSignature().getName());
18
		}
19
}
(-)src/org/aspectj/weaver/tools/WeavingAdaptor.java (-2 / +1 lines)
Lines 317-324 Link Here
317
	private void addAspectLibrary(String aspectLibraryName) {
317
	private void addAspectLibrary(String aspectLibraryName) {
318
		File aspectLibrary = new File(aspectLibraryName);
318
		File aspectLibrary = new File(aspectLibraryName);
319
		if (aspectLibrary.isDirectory()
319
		if (aspectLibrary.isDirectory()
320
                || (aspectLibrary.isFile() 
320
                || (FileUtil.isZipFile(aspectLibrary))) {
321
                        && FileUtil.hasZipSuffix(aspectLibraryName))) {
322
			try {
321
			try {
323
				info("adding aspect library: '" + aspectLibrary + "'");
322
				info("adding aspect library: '" + aspectLibrary + "'");
324
				weaver.addLibraryJarFile(aspectLibrary);
323
				weaver.addLibraryJarFile(aspectLibrary);
(-)src/org/aspectj/weaver/bcel/ClassPathManager.java (-9 / +10 lines)
Lines 65-86 Link Here
65
	public void addPath (String name, IMessageHandler handler) {
65
	public void addPath (String name, IMessageHandler handler) {
66
		File f = new File(name);
66
		File f = new File(name);
67
		String lc = name.toLowerCase();
67
		String lc = name.toLowerCase();
68
		if (lc.endsWith(".jar") || lc.endsWith(".zip")) {
68
		if (!f.isDirectory()) {
69
			if (!f.isFile()) {
69
			if (!f.isFile()) {
70
			MessageUtil.info(handler, WeaverMessages.format(WeaverMessages.ZIPFILE_ENTRY_MISSING,name));
70
				if (!lc.endsWith(".jar") || lc.endsWith(".zip")) {
71
			return;
71
					// heuristic-only: ending with .jar or .zip means probably a zip file
72
					MessageUtil.info(handler, WeaverMessages.format(WeaverMessages.ZIPFILE_ENTRY_MISSING,name));
73
				} else { 
74
					MessageUtil.info(handler, WeaverMessages.format(WeaverMessages.DIRECTORY_ENTRY_MISSING,name));
75
				}
76
				return;
72
			}
77
			}
73
			try {
78
			try {
74
				entries.add(new ZipFileEntry(f));
79
				entries.add(new ZipFileEntry(f));
75
			} catch (IOException ioe) {
80
			} catch (IOException ioe) {
76
			MessageUtil.warn(handler, WeaverMessages.format(WeaverMessages.ZIPFILE_ENTRY_INVALID,name,ioe.getMessage()));
81
				MessageUtil.warn(handler, WeaverMessages.format(WeaverMessages.ZIPFILE_ENTRY_INVALID,name,ioe.getMessage()));
77
			return;
82
				return;
78
			}
83
			}
79
		} else {
84
		} else {
80
			if (!f.isDirectory()) {
81
			MessageUtil.info(handler, WeaverMessages.format(WeaverMessages.DIRECTORY_ENTRY_MISSING,name));
82
			return;
83
			}
84
			entries.add(new DirEntry(f));
85
			entries.add(new DirEntry(f));
85
		}
86
		}
86
	}
87
	}
(-)testdata/WeavingURLClassLoaderTest/builtLibs/test.jar/main.file (+5 lines)
Added Link Here
1
PKo3META-INF/MANIFEST.MFþÊóMÌËLK-.Ñ
2
K-*ÎÌϳR0Ô3àår.JM,IMÑuª´Rp,.HM.ñRpÎÏ-ÈÌI-âåâåPK²ÔWŠ97PKo3packag/Main.classmP=OA}+(‚àg??A‹£±ÃháGZ`LŒÕp·9Ï[²ø»¬H4ÑÞeœEŒa“?·3ûòæÍ|~½¾ð°'P‘ÿHa«K*v ÊCšR+¢8lÝô‡ÒO¤²'*VÉ©@ªyx'?>×?,"ƒ¬‹4rkËëÉS_š[êGR ÒÑ>Ewd”Í‹éd Æ¥ÎŸ®m.?1
3
ԛ?E÷^bT¶m;O›Ð£ñˆÝ½gISi¼®L:¸?~D†¥ã…¶³?¹4Fëdô$L•/ã?žDAcÀj
4
?"%9‘FæP¨5—9±×\TPgÏdB¥ºÄ²€ÛÓãË+e‡ÎÛ)=ËÂ>Vx_ö¬@Øõqt8k1
5
ÆÌÑù—ù·Ë1;/¦PàXü!0–óXųÊüÎñµ¢gs©cæ[¦û†Ê}ec†Í?z™?z.¶°Í(°3gí~PK'Jq4aPKo3²ÔWŠ97META-INF/MANIFEST.MFþÊPKo3'Jq4apackag/Main.classPK…
(-)testdata/WeavingURLClassLoaderTest/builtLibs/aspectNoExt (+10 lines)
Added Link Here
1
PKp3META-INF/MANIFEST.MFþÊóMÌËLK-.Ñ
2
K-*ÎÌϳR0Ô3àår.JM,IMÑuª´Rp,.HM.ñRpÎÏ-ÈÌI-âåâåPK²ÔWŠ97PKp3packag/Aspect.classíU[oEþƗ8vÝÖMz—´PÓÚnð’6%´-®K$À´®J-•Ézj¯ÙìZ»ã¤<ðÊàÁ/।•HE¼?ÔE93»õ%q!< !ÈJggæ̹ϙùžüþãϊ¸Ê°¿ËÍÏxË(û]aÊC¦Ã×¹as§eÜXíhn”á0ï˜Y˱ä2·ìž'*¼ç†#Õ?ôJÛs7øª-JǕxWx5ËiÙBºÎ{Ž/¹c’ÊÁêˆOž\2meú2C4—¯3Ä*n“$h#®/+z;?4R)D°??8&’4;È0=&€)?–#®÷ÖV…·¢˜SU×äv?{–Z‡Ì‰%í:?#ÊxGɽl[>Ã)åž{nÏifƒ?ï!gç³çî..,,^\e0rU×k\ït¯çHkM–#…çpÛ(kÛõ©j%•ÝÉCùâ†àëÂ+–›ë–*NqÌއB¶Ýæ5aÚÜãÒr?Ab‡(È;|ØÃÜ߉ˆ¡°‹<»žk
3
ÑdH½{Ï]Uhv\&?ÚçŽli™dz÷?$ð*?É0œÉÝ®noÂR~'+?,^KáN3äþÔSÅu(6_E?@Ž!¹îZÍ:·{T­Ó¹]:+àl
4
yÌQÎnÜ¥úçòÛú9?&Us¾A™G¥­]w±«*õ~-8׿‹añ'±@õŽ­&=ºM¥±7._W
5
üf
6
ç±Héµ¹XÑ7êui¨¯S5·ç™bÙR}ŸŠ¼ÃprÌ9ÞÔC=¨Úsš6t1N=pEu—âžß)?‡šäRàŠ0F?R)u·i6£ÊH£ú'‰Ë°?Vs42Ó?pà;L~PxˆÌ¦æDIkŠfÓ4Ÿ9L]êPÓ5ã…-ÛÔ®+Cǵ³Qå¼@㋴ú&Îè
7
L’©« ð4ühw…èf±5n9`$2}{ç±mWú”¨5X8–‰ÚDKD–
8
k^M0ô½D¤"?éM•è?ÀIՄIªïe̎Ôj‚vNètOjcôXҙ¨O™,?¾²?.DBìœy„וu6TÂth=IÀb?ô@û¬8öó¿!óçoM]x€ÌÞú…Xß÷
9
E´úE\QŸÕæ?ÉþŠxì~ôþˆFJÁˆƉ0Ý}?¹µ…ÒCÌoŽ¨ÄuA#x—u¶ŠwE9gýcx‡–6Þ¯\j´Ý5ÑØðmÁ›? uRø²É%o¨¦Óýø£jÅæ¾_uy“à†vÁenôo™ne C4¥K
10
¬}Eô5Ñ·(“À—ÓÁñ$¾xò¤Ë{ ½Ò{ ½Òÿ4Hïƒô[ú|ŽŒÀè³7÷/°x»Ê(.ÿG°xo¸Ìú¸ÌB\þ?aqì_ˆÅPKLY[Î"PKp3²ÔWŠ97META-INF/MANIFEST.MFþÊPKp3LY[Î"packag/Aspect.classPK‡Æ
(-)testsrc/org/aspectj/ajde/NullIdeProperties.java (-1 / +6 lines)
Lines 33-38 Link Here
33
	private Set sourceRoots;
33
	private Set sourceRoots;
34
	private Set aspectPath;
34
	private Set aspectPath;
35
	private String outJar;
35
	private String outJar;
36
	private String outputPath = "bin";
36
37
37
	public NullIdeProperties(String testProjectPath) {
38
	public NullIdeProperties(String testProjectPath) {
38
		this.testProjectPath = testProjectPath;
39
		this.testProjectPath = testProjectPath;
Lines 75-81 Link Here
75
    }
76
    }
76
77
77
    public String getOutputPath() {
78
    public String getOutputPath() {
78
    	return testProjectPath + "/bin"; 
79
    	return testProjectPath + "/" + outputPath; 
80
    }
81
    
82
    public void setOutputPath(String outputPath) {
83
    	this.outputPath = outputPath;
79
    }
84
    }
80
85
81
    public String getAjcWorkingDir() {
86
    public String getAjcWorkingDir() {
(-)testsrc/org/aspectj/ajde/ResourceCopyTestCase.java (+23 lines)
Lines 98-103 Link Here
98
		assertTrue("Build warnings",ideManager.getCompilationSourceLineTasks().isEmpty());
98
		assertTrue("Build warnings",ideManager.getCompilationSourceLineTasks().isEmpty());
99
		compareInjarsToBin(injar1,"src","bin");
99
		compareInjarsToBin(injar1,"src","bin");
100
	}
100
	}
101
102
	public void testInjarsToOddBin () {
103
		Set injars = new HashSet();
104
		File injar1 = openFile(injar1Name);
105
		injars.add(injar1);
106
		ideManager.getProjectProperties().setOutputPath("crazy.jar");
107
		ideManager.getProjectProperties().setInJars(injars);
108
		assertTrue("Build failed",doSynchronousBuild("config2.lst"));
109
		assertTrue("Build warnings",ideManager.getCompilationSourceLineTasks().isEmpty());
110
		compareInjarsToBin(injar1,"src","crazy.jar");
111
	}
112
	
113
	public void testInjarsToOutjarOddNames () {
114
		Set injars = new HashSet();
115
		File injar1 = openFile("input1");
116
		File outjar = openFile(outjarName+".fozout");
117
		injars.add(injar1);
118
		ideManager.getProjectProperties().setInJars(injars);
119
		ideManager.getProjectProperties().setOutJar(outjar.getAbsolutePath());
120
		assertTrue("Build failed",doSynchronousBuild("config2.lst"));
121
		assertTrue("Build warnings",ideManager.getCompilationSourceLineTasks().isEmpty());
122
		compareJars(injar1,"src",outjar);
123
	}
101
	
124
	
102
	/*
125
	/*
103
	 * Ensure bin contains all non-Java resouces from source and injars
126
	 * Ensure bin contains all non-Java resouces from source and injars
(-)testsrc/org/aspectj/ajde/internal/LstBuildConfigManagerTest.java (-1 / +1 lines)
Lines 54-60 Link Here
54
		doSynchronousBuild("bad-injar.lst");
54
		doSynchronousBuild("bad-injar.lst");
55
		messages = NullIdeManager.getIdeManager().getCompilationSourceLineTasks();
55
		messages = NullIdeManager.getIdeManager().getCompilationSourceLineTasks();
56
		message = (NullIdeTaskListManager.SourceLineTask)messages.get(0);
56
		message = (NullIdeTaskListManager.SourceLineTask)messages.get(0);
57
		assertTrue(message.getContainedMessage().getMessage().indexOf("bad inpath") != -1);
57
		assertTrue(message.getContainedMessage().getMessage().indexOf("skipping missing, empty or corrupt inpath entry") != -1);
58
	}
58
	}
59
59
60
	public void testErrorMessages() throws IOException {
60
	public void testErrorMessages() throws IOException {
(-)testdata/bug-36071a/input1 (+23 lines)
Added Link Here
1
PKÙvc/	META-INF/þÊPKPKÙvc/META-INF/MANIFEST.MFóMÌËLK-.Ñ
2
K-*ÎÌϳR0Ô3àår.JM,IMÑuª	ëƘ(h—æ)øf&åW—¤æ+xæ%ëiòrñrPK;ï:GGPKèM/
3
Main.classmQMOÂ@}K¥Aªø?'ÄH¯/F“Š&ãi?
4
.?–”bü5^={‘D€?Ê8»¹Ðü?·oæÍl¿¾ß?aàûæ5—?Æ?ðGî
5
yÐ÷n:Ñ?-©SÈøŒÁ¨´I~öDI¤˜H3ä|ˆÆtÔQ‹w†‚¡à‡]>lóHªü?4ã9¡n¾²;¡|DÈàVïý¹m3ŽdÐ?Q>ÎÅSWŒcTUÔzW7ÿ´…RÅb×ÇQ8ž¤Q$¡Ê½…[âDK1±PràªQÍaÈ{¥ê"ËÖQVÂ
6
ò¨¯lÌÆ`k»éUœf8?ºâRª½mµo]©PA‚žL}	0õ‚-Ê<BF˜¬Í`¿êk‡bJ“y,QÌü
7
—	md‘#UžÎ&Ýt›61	Â?Úç3ìšqü‚daÕÿ€{7ÃÚá6ç½³ô÷?"á*Ê(i÷·[Ø֊v°«GÛÓu•PK«Œo6PK]vc/META-INF/test.xml³±¯ÈÍQ(K-*ÎÌϳU2Ô3PR°·ãå²ÉJ,RÈKÌMµUÊÌ+(-1Ô
8
(?$ô? ÍËPKÔÂå€7;PK
9
NX/test/PK?XX/test/test.props+I-.±-FPK…Y]
10
11
PKèM/test/TestProperties.classmSÛnÓ@œÍÍ?	´©ÛPÒRh¹ÙiSs¿!¡ªHHîEM‰GÇ]…­;²×^ø'xH%?ø>
12
qÖ	?I”]ïÙٙñœÍ¯ßß"?&^2’ÇÒ>¡á(
13
<’‚ÇÙûѵ}7èهÝ3îI
14
y†Ò+ùš!oZ†ÂnxÊ+(¢¤£€9†yGü éwytâv}ΰ脞ëwÜH¨õ¸X?DÌ°ìÌPoѶº§´m:m‰ ×RªúÞ'?¤â0Rˆíw‡e
15
U†¹—»¾+Œie˜Òb«KÊõ2¹þgSÃU:Dç?y&‘ÇßÄ$ÏÝ>ƒ5˓sá!$r%?k¨ëXÁ*ÃR
16
H¤ðílÌ×u¬«ÔV̙V§‚+¸©@Ù?@4Üb(z~Sî¨.ÜÆÝ©Þµ?ǒΤ–…‰T™ÿå9"ó³
17
l•aa[¥/b9e*‹T¦v`+S÷	¸ý´Éÿ…Â?AV.ûfdz@9Pkjάh ·Óäß
18
u_Œé+²£Î`9jŸúäÀÔ¤Q£•M3£¹Ø8Gùkº­ÓXJ‹.ÑXh¾L3£”ç	µ@ÏZ-¦4_Æô›?!j[C¬íÿÀúûsÜ8hn±I¿{Íohñ`¢Q' †2µ½Jý¯Q¥ŽU²º–ê6FŒc]õô?H±LØÇxB,Uú>Å3ú{2<Oy_üPK†v¯…¯PKÙvc/	META-INF/þÊPKÙvc/;ï:GG=META-INF/MANIFEST.MFPKèM/«Œo6
19
ÆMain.classPK]vc/ÔÂå€7;mMETA-INF/test.xmlPK
20
21
NX/ãtest/PK?XX/…Y]
22
23
test/test.propsPKèM/†v¯…¯Mtest/TestProperties.classPK«¦
(-)src/org/aspectj/testing/harness/bridge/Sandbox.java (-1 / +1 lines)
Lines 510-516 Link Here
510
            int len = (null == paths ? 0 : paths.length);
510
            int len = (null == paths ? 0 : paths.length);
511
            for (int j = 0; j < len; j++) {
511
            for (int j = 0; j < len; j++) {
512
                File f = paths[j];
512
                File f = paths[j];
513
                if (FileUtil.hasZipSuffix(f) && (!readable || f.canRead())) {
513
                if (FileUtil.isZipFile(f) && (!readable || f.canRead())) {
514
                    result.add(f);
514
                    result.add(f);
515
                }
515
                }
516
			}
516
			}
(-)newsrc/org/aspectj/testing/CompileSpec.java (-2 / +1 lines)
Lines 134-141 Link Here
134
	 * @param inpath The inpath to set.
134
	 * @param inpath The inpath to set.
135
	 */
135
	 */
136
	public void setInpath(String inpath) {
136
	public void setInpath(String inpath) {
137
		this.inpath = inpath.replace(',',File.pathSeparatorChar);
137
		this.inpath = inpath.replace(',',File.pathSeparatorChar).replace(';',File.pathSeparatorChar);
138
		this.inpath = inpath.replace(';',File.pathSeparatorChar);
139
	}
138
	}
140
	/**
139
	/**
141
	 * @return Returns the options.
140
	 * @return Returns the options.
(-)newsrc/org/aspectj/testing/WeaveSpec.java (+1 lines)
Lines 62-67 Link Here
62
			}
62
			}
63
			setClasspath("classes.jar");
63
			setClasspath("classes.jar");
64
			args = buildArgs();
64
			args = buildArgs();
65
//			inTestCase.setJarWeaverNext(new CmdLineWeaver());
65
			result = inTestCase.ajc(base,args);
66
			result = inTestCase.ajc(base,args);
66
			inTestCase.assertNoMessages(result,failMessage);
67
			inTestCase.assertNoMessages(result,failMessage);
67
			createJar(sandbox,"aspects.jar",false);
68
			createJar(sandbox,"aspects.jar",false);
(-)newsrc/org/aspectj/testing/RunSpec.java (-6 / +45 lines)
Lines 14-20 Link Here
14
import java.io.File;
14
import java.io.File;
15
import java.io.IOException;
15
import java.io.IOException;
16
import java.util.ArrayList;
16
import java.util.ArrayList;
17
import java.util.Enumeration;
17
import java.util.List;
18
import java.util.List;
19
import java.util.Properties;
18
import java.util.StringTokenizer;
20
import java.util.StringTokenizer;
19
21
20
import org.aspectj.tools.ajc.AjcTestCase;
22
import org.aspectj.tools.ajc.AjcTestCase;
Lines 53-64 Link Here
53
//		System.err.println("? execute() inTestCase='" + inTestCase + "', ltwFile=" + ltwFile);
55
//		System.err.println("? execute() inTestCase='" + inTestCase + "', ltwFile=" + ltwFile);
54
		boolean useLtw = copyLtwFile(inTestCase.getSandboxDirectory());
56
		boolean useLtw = copyLtwFile(inTestCase.getSandboxDirectory());
55
		copyXlintFile(inTestCase.getSandboxDirectory());
57
		copyXlintFile(inTestCase.getSandboxDirectory());
56
		AjcTestCase.RunResult rr = inTestCase.run(getClassToRun(),args,getClasspath(),useLtw);
58
		try {
57
		if (stdErrSpec != null) {
59
			setSystemProperty("test.base.dir", inTestCase.getSandboxDirectory().getAbsolutePath());
58
			stdErrSpec.matchAgainst(rr.getStdErr());
60
			
61
			AjcTestCase.RunResult rr = inTestCase.run(getClassToRun(),args,getClasspath(),useLtw);
62
			
63
			if (stdErrSpec != null) {
64
				stdErrSpec.matchAgainst(rr.getStdErr());
65
			}
66
			if (stdOutSpec != null) {
67
				stdOutSpec.matchAgainst(rr.getStdOut());
68
			}
69
		} finally {
70
			restoreProperties();
59
		}
71
		}
60
		if (stdOutSpec != null) {
72
	}
61
			stdOutSpec.matchAgainst(rr.getStdOut());
73
	
74
	/* 
75
	 * Logic to save/restore system properties. Copied from LTWTests.
76
	 * As Matthew noted, need to refactor LTWTests to use this 
77
  	 */
78
79
	private Properties savedProperties = new Properties();
80
  	 	
81
	public void setSystemProperty (String key, String value) {
82
		Properties systemProperties = System.getProperties();
83
		copyProperty(key,systemProperties,savedProperties);
84
		systemProperties.setProperty(key,value);
85
	}
86
	
87
	private static void copyProperty (String key, Properties from, Properties to) {
88
		String value = from.getProperty(key,NULL);
89
		to.setProperty(key,value);
90
	}
91
	
92
	private final static String NULL = "null";
93
94
	protected void restoreProperties() {
95
		Properties systemProperties = System.getProperties();
96
		for (Enumeration enu = savedProperties.keys(); enu.hasMoreElements(); ) {
97
			String key = (String)enu.nextElement();
98
			String value = savedProperties.getProperty(key);
99
			if (value == NULL) systemProperties.remove(key);
100
			else systemProperties.setProperty(key,value);
62
		}
101
		}
63
	}
102
	}
64
103
Lines 84-90 Link Here
84
	
123
	
85
	public String getClasspath() {
124
	public String getClasspath() {
86
		if (cpath == null) return null;
125
		if (cpath == null) return null;
87
		return this.cpath.replace('/', File.separatorChar);
126
		return this.cpath.replace('/', File.separatorChar).replace(',', File.pathSeparatorChar);
88
	}
127
	}
89
 	
128
 	
90
	public void setClasspath(String cpath) {
129
	public void setClasspath(String cpath) {
(-)src/org/aspectj/tools/ant/taskdefs/AjcTask.java (-6 / +2 lines)
Lines 1106-1117 Link Here
1106
                    || (null != inpathDirCopyFilter)) {
1106
                    || (null != inpathDirCopyFilter)) {
1107
                String path = outjar.getAbsolutePath();
1107
                String path = outjar.getAbsolutePath();
1108
                int len = FileUtil.zipSuffixLength(path);
1108
                int len = FileUtil.zipSuffixLength(path);
1109
                if (len < 1) {
1109
                path = path.substring(0, path.length()-len) + ".tmp.jar";
1110
                    this.logger.info("not copying resources - weird outjar: " + path);
1110
                tmpOutjar = new File(path);
1111
                } else {
1112
                    path = path.substring(0, path.length()-len) + ".tmp.jar";
1113
                    tmpOutjar = new File(path);
1114
                }
1115
            }
1111
            }
1116
            if (null == tmpOutjar) {                
1112
            if (null == tmpOutjar) {                
1117
                cmd.addFlagged("-outjar", outjar.getAbsolutePath());        
1113
                cmd.addFlagged("-outjar", outjar.getAbsolutePath());        
(-)testsrc/org/aspectj/tools/ant/taskdefs/AjcTaskTest.java (-1 / +10 lines)
Lines 359-371 Link Here
359
    }
359
    }
360
    
360
    
361
    public void testInpathDirCopyFilterWithJar() throws IOException {
361
    public void testInpathDirCopyFilterWithJar() throws IOException {
362
    	checkInpathCopy("testInpathDirCopyFilterWithJar-out.jar");
363
    }
364
365
    // test resource copying for oddball jar files that don't end in .jar
366
    public void testInpathDirCopyFilterWithOddjar() throws IOException {
367
    	checkInpathCopy("testInpathDirCopyFilterWithJar-outJarFile");
368
    }
369
    
370
    private void checkInpathCopy(String outjarFileStr) throws IOException {
362
        // inpathDirCopyFilter works with output jar
371
        // inpathDirCopyFilter works with output jar
363
        File destDir = getTempDir();
372
        File destDir = getTempDir();
364
        assertTrue(
373
        assertTrue(
365
            "unable to create " + destDir,
374
            "unable to create " + destDir,
366
            destDir.canRead() || destDir.mkdirs());
375
            destDir.canRead() || destDir.mkdirs());
367
        AjcTask task = getTask(NOFILE, null);        
376
        AjcTask task = getTask(NOFILE, null);        
368
        File destJar = new File(destDir, "testInpathDirCopyFilterWithJar-out.jar");
377
        File destJar = new File(destDir, outjarFileStr);
369
        task.setOutjar(destJar);
378
        task.setOutjar(destJar);
370
        Project p = task.getProject();
379
        Project p = task.getProject();
371
        Path indirs = new Path(p);
380
        Path indirs = new Path(p);
(-)testsrc/org/aspectj/tools/ajc/AjcTestCase.java (-1 / +7 lines)
Lines 558-564 Link Here
558
		lastRunResult = null;
558
		lastRunResult = null;
559
		StringBuffer cp = new StringBuffer();
559
		StringBuffer cp = new StringBuffer();
560
		if (classpath != null) {
560
		if (classpath != null) {
561
			cp.append(classpath);
561
			// allow replacing this special variable, rather than copying all files to allow tests of jars that don't end in .jar
562
			cp.append(substituteSandbox(classpath));
562
			cp.append(File.pathSeparator);
563
			cp.append(File.pathSeparator);
563
		}
564
		}
564
		cp.append(ajc.getSandboxDirectory().getAbsolutePath());
565
		cp.append(ajc.getSandboxDirectory().getAbsolutePath());
Lines 622-627 Link Here
622
		}
623
		}
623
		return lastRunResult;
624
		return lastRunResult;
624
	}
625
	}
626
627
	private String substituteSandbox(String classpath) {
628
		return classpath.replace("$sandbox", ajc.getSandboxDirectory().getAbsolutePath());
629
	}
625
    
630
    
626
    /**
631
    /**
627
     * Any central pre-processing of args.
632
     * Any central pre-processing of args.
Lines 639-644 Link Here
639
        		args[i] = adaptToPlatform(args[i]);
644
        		args[i] = adaptToPlatform(args[i]);
640
            if ("-classpath".equals(args[i])) {
645
            if ("-classpath".equals(args[i])) {
641
                cpIndex = i;
646
                cpIndex = i;
647
                args[i+1] = substituteSandbox(args[i+1]);
642
                String next = args[i+1];
648
                String next = args[i+1];
643
                hasruntime = ((null != next) 
649
                hasruntime = ((null != next) 
644
                        && (-1 != next.indexOf("aspectjrt.jar")));
650
                        && (-1 != next.indexOf("aspectjrt.jar")));
(-)src/org/aspectj/ajdt/ajc/BuildArgParser.java (-7 / +7 lines)
Lines 397-410 Link Here
397
					while (st.hasMoreTokens()) {
397
					while (st.hasMoreTokens()) {
398
						String filename = st.nextToken();
398
						String filename = st.nextToken();
399
						File file = makeFile(filename);
399
						File file = makeFile(filename);
400
						if (file.exists() && FileUtil.hasZipSuffix(filename)) {
400
						if (FileUtil.isZipFile(file)) {
401
							inPath.add(file);    
401
							inPath.add(file);    
402
						} else {
402
						} else {
403
							if (file.isDirectory()) {
403
							if (file.isDirectory()) {
404
								inPath.add(file);
404
								inPath.add(file);
405
							} else 
405
							} else 
406
		            		
406
		            		
407
							showError("bad inpath component: " + filename);  
407
							showWarning("skipping missing, empty or corrupt inpath entry: " + filename);  
408
						}
408
						}
409
					}
409
					}
410
					buildConfig.setInPath(inPath);
410
					buildConfig.setInPath(inPath);
Lines 420-426 Link Here
420
		            while (st.hasMoreTokens()) {
420
		            while (st.hasMoreTokens()) {
421
		            	String filename = st.nextToken();
421
		            	String filename = st.nextToken();
422
		            	File jarFile = makeFile(filename);
422
		            	File jarFile = makeFile(filename);
423
		            	if (jarFile.exists() && FileUtil.hasZipSuffix(filename)) {
423
		            	if (FileUtil.isZipFile(jarFile)) {
424
			            	buildConfig.getInJars().add(jarFile);    
424
			            	buildConfig.getInJars().add(jarFile);    
425
		            	} else {
425
		            	} else {
426
		            		File dirFile = makeFile(filename);
426
		            		File dirFile = makeFile(filename);
Lines 428-434 Link Here
428
		            			buildConfig.getInJars().add(dirFile);
428
		            			buildConfig.getInJars().add(dirFile);
429
		            		} else 
429
		            		} else 
430
		            		
430
		            		
431
                            showError("bad injar: " + filename);  
431
                            showWarning("skipping missing, empty or corrupt injar: " + filename);  
432
		            	}
432
		            	}
433
		            }
433
		            }
434
					
434
					
Lines 442-451 Link Here
442
		            while (st.hasMoreTokens()) {
442
		            while (st.hasMoreTokens()) {
443
		            	String filename = st.nextToken();
443
		            	String filename = st.nextToken();
444
		            	File jarFile = makeFile(filename);
444
		            	File jarFile = makeFile(filename);
445
                        if (jarFile.exists() && (FileUtil.hasZipSuffix(filename) || jarFile.isDirectory())) {
445
                        if (FileUtil.isZipFile(jarFile) || jarFile.isDirectory()) {
446
			            	buildConfig.getAspectpath().add(jarFile);    
446
			            	buildConfig.getAspectpath().add(jarFile);    
447
		            	} else {
447
		            	} else {
448
                            showError("bad aspectpath: " + filename);
448
                            showWarning("skipping missing, empty or corrupt aspectpath entry: " + filename);  
449
		            	}
449
		            	}
450
		            }
450
		            }
451
					
451
					
Lines 476-482 Link Here
476
				if (args.size() > nextArgIndex) {
476
				if (args.size() > nextArgIndex) {
477
//					buildConfig.getAjOptions().put(AjCompilerOptions.OPTION_OutJAR, CompilerOptions.GENERATE);
477
//					buildConfig.getAjOptions().put(AjCompilerOptions.OPTION_OutJAR, CompilerOptions.GENERATE);
478
					File jarFile = makeFile(((ConfigParser.Arg)args.get(nextArgIndex)).getValue());
478
					File jarFile = makeFile(((ConfigParser.Arg)args.get(nextArgIndex)).getValue());
479
					if (FileUtil.hasZipSuffix(jarFile)) {
479
					if (!jarFile.isDirectory()) {
480
						try {
480
						try {
481
							if (!jarFile.exists()) {
481
							if (!jarFile.exists()) {
482
                                jarFile.createNewFile();
482
                                jarFile.createNewFile();
(-)testsrc/org/aspectj/ajdt/ajc/BuildArgParserTestCase.java (+66 lines)
Lines 115-120 Link Here
115
		String FILE_PATH =   "@" + TEST_DIR + "configWithClasspathExtdirsBootCPArgs.lst";
115
		String FILE_PATH =   "@" + TEST_DIR + "configWithClasspathExtdirsBootCPArgs.lst";
116
		AjBuildConfig config = genBuildConfig(new String[] { FILE_PATH }, messageWriter);
116
		AjBuildConfig config = genBuildConfig(new String[] { FILE_PATH }, messageWriter);
117
		List classpath = config.getFullClasspath();
117
		List classpath = config.getFullClasspath();
118
		// note that empty or corrupt jars are NOT included in the classpath
118
		// should have three entries, resolved relative to location of .lst file
119
		// should have three entries, resolved relative to location of .lst file
119
		assertEquals("Three entries in classpath",3,classpath.size());
120
		assertEquals("Three entries in classpath",3,classpath.size());
120
		Iterator cpIter = classpath.iterator();
121
		Iterator cpIter = classpath.iterator();
Lines 507-512 Link Here
507
		assertEquals("Wrong outxml","custom/aop.xml",config.getOutxmlName());
508
		assertEquals("Wrong outxml","custom/aop.xml",config.getOutxmlName());
508
		assertTrue("Following option currupted",config.getShowWeavingInformation());
509
		assertTrue("Following option currupted",config.getShowWeavingInformation());
509
	}
510
	}
511
512
	public void testNonstandardInjars() {
513
		AjBuildConfig config = setupNonstandardPath("-injars");
514
		assertEquals("bad path: " + config.getInJars(), 3, config.getInJars().size());
515
	}
516
	
517
	public void testNonstandardInpath() {
518
		AjBuildConfig config = setupNonstandardPath("-inpath");
519
		assertEquals("bad path: " + config.getInpath(), 3, config.getInpath().size());
520
	}
521
	
522
	public void testNonstandardAspectpath() {
523
		AjBuildConfig config = setupNonstandardPath("-aspectpath");
524
		assertEquals("bad path: " + config.getAspectpath(), 3, config.getAspectpath().size());
525
	}
526
527
	public void testNonstandardClasspath() throws IOException {
528
		AjBuildConfig config = setupNonstandardPath("-classpath");
529
		checkPathSubset(config.getClasspath());
530
	}
531
	
532
	public void testNonstandardBootpath() throws IOException {
533
		AjBuildConfig config = setupNonstandardPath("-bootclasspath");
534
		checkPathSubset(config.getBootclasspath());
535
	}
536
	
537
	private void checkPathSubset(List path) throws IOException {
538
		String files[] = { "aspectjJar.file", "jarChild", "parent.zip" };
539
		for (int i = 0; i < files.length; i++) {
540
			File file = new File(NONSTANDARD_JAR_DIR+files[i]);
541
			assertTrue("bad path: " + path, path.contains(file.getCanonicalPath()));			
542
		}
543
	}
544
545
	public void testNonstandardOutjar() {
546
		final String OUT_JAR = NONSTANDARD_JAR_DIR + File.pathSeparator + "outputFile";
547
		
548
		AjBuildConfig config = genBuildConfig(new String[] { 
549
			"-outjar", OUT_JAR }, 
550
			messageWriter);
551
552
		File newJar = new File(OUT_JAR);
553
		assertEquals(
554
			getCanonicalPath(newJar),config.getOutputJar().getAbsolutePath()); 
555
	
556
		newJar.delete();
557
	}
558
559
	public void testNonstandardOutputDirectorySetting() throws InvalidInputException {
560
		String filePath = AjdtAjcTests.TESTDATA_PATH + File.separator + "ajc.jar" + File.separator;
561
		File testDir = new File(filePath);
562
		AjBuildConfig config = genBuildConfig(new String[] {  "-d", filePath }, messageWriter);
563
		
564
		assertEquals(testDir.getAbsolutePath(), config.getOutputDir().getAbsolutePath());	
565
	}
566
	
567
	private static final String NONSTANDARD_JAR_DIR = AjdtAjcTests.TESTDATA_PATH + "/OutjarTest/folder.jar/";
568
	
569
	private AjBuildConfig setupNonstandardPath(String pathType) {
570
		String NONSTANDARD_PATH_ENTRY = NONSTANDARD_JAR_DIR+"aspectjJar.file" + File.pathSeparator + NONSTANDARD_JAR_DIR+"aspectJar.file" + File.pathSeparator + NONSTANDARD_JAR_DIR+"jarChild" + File.pathSeparator + NONSTANDARD_JAR_DIR+"parent.zip";		
571
		
572
		return genBuildConfig(new String[] { 
573
			pathType, NONSTANDARD_PATH_ENTRY }, 
574
			messageWriter);
575
	}
510
	
576
	
511
	protected void setUp() throws Exception {
577
	protected void setUp() throws Exception {
512
		super.setUp();
578
		super.setUp();
(-)testdata/OutjarTest/folder.jar/parent.zip (+5 lines)
Added Link Here
1
PK rS3META-INF/MANIFEST.MFþÊóMÌËLK-.Ñ
2
K-*ÎÌϳR0Ô3àår.JM,IMÑuª´Rp,.HM.ñRpÎÏ-ÈÌI-âåâåPK²ÔWŠ97PK rS3jar1/Parent.classmOËJA¬ÎûéÆD½{‹
3
»xŽxQ<­ˆÁSg3lfÙÌÊd¿Ë“àÁð£Äž?? t×tMMu÷×÷Ç'‡„vÂö<x`«L^z	¯9HÙÄÁý4Q‘°eBíB?_ÊÓ	¡r•ÍTUÔZ¨ AðBmÔÝj1Uö‘§©"ôÃ,âtÂV»ú—¬äs½$tÃ?®#¡¬
4
áhøn»?s«M<ríüÌÆ>/_dšÄU¼VÖ¿Uù<›]«(e˹ÎÌv1dKŸÁ?~„Ö8[ÙHÝh7Q{3„ït8FIÖq§rÛI®K’`õôÍ·â¹%¹V?]´%w6Á®`{ðDՓ{C“/O…Õ™„SÒ_›ÞŽ
5
aý…êàPKµ“l§²PK rS3²ÔWŠ97META-INF/MANIFEST.MFþÊPK rS3µ“l§²jar1/Parent.classPK…Û
(-)testdata/ajc/abc.jar (+4 lines)
Added Link Here
1
PK?V¿2
2
.cvsignoreþÊË/-áåJÊÌãåJIMK,Í)ÑKÌ*®ÌEpsŠ!
3
JRAPKó㖢"/PK?V¿2ó㖢"/
4
.cvsignoreþÊPK<^
(-)testdata/OutjarTest/folder.jar/jarChild (+3 lines)
Added Link Here
1
PK rS3META-INF/MANIFEST.MFþÊóMÌËLK-.Ñ
2
K-*ÎÌϳR0Ô3àår.JM,IMÑuª´Rp,.HM.ñRpÎÏ-ÈÌI-âåâåPK²ÔWŠ97PK rS3jar2/Child.classmQMOÂ@}ƒH¡TA¿?P/è¡?^<`ô ñ„†DãÅÓ
3
XRZ²,þ(=hâÁà?2Î<Фó:¯³3oÞ~ÿ|~ð±Gp{Bç]¶!ÏùaÐZFÆÁ!s¢"eN	3µý;Bú<nK³È¸H#K(4T$¯Gý©oÅC(	¥FÜá?ÐÊædÚtÕ?à5&óêÌö…ŠKµ{æEŠ¨Ü­¢NÝNócÝñÅp [¦ç?Iñ(µ%M7n_ÈV(´0*Ž&Åmž‡Fö,°ôxd•ñM`xŒýº‡2s(¡B˜?«&Ê|+«¶ŸÅ2¡<å?ƒU‚3°DÈò+µiê=¬cÃÅ6yO¡;¼}yʚ|7ñH·ä¥²>¹c¶;H±ÇöI?¬åÎFbœ=ø@î5ùírÌ$dyŽÞ¸€qŽ1‡yæS(òw–ß>ò’´:NZsŖJ+ïؚ´sÁ¾dÙ I˶Qe$Vg+wPKÐCë¹}MPK rS3²ÔWŠ97META-INF/MANIFEST.MFþÊPK rS3ÐCë¹}Mjar2/Child.classPK„:
(-)testdata/OutjarTest/folder.jar/aspectJar.file (+9 lines)
Added Link Here
1
PK rS3META-INF/MANIFEST.MFþÊóMÌËLK-.Ñ
2
K-*ÎÌϳR0Ô3àår.JM,IMÑuª´Rp,.HM.ñRpÎÏ-ÈÌI-âåâåPK²ÔWŠ97PK rS3jar3/Aspect.classíTÝoUÿÝýÞu
3
e¡@ý(EØ]p¶”J+Å&ÆBk¶©©ÙÄÜÎÞvgÙÎlfî¶%&ÆDß|òÁÄÿÀlI,‘DbŒhø£ÔsïL»ÁHœä7sï¹çœß¹çcžüõó/L¼ÏðR“{+×ý¶°dŒa¸É7y¥Å?õÊÂjSKãÇxÓ*؎-ç¸Ýêxb–w|Á02ßÕ^jxî_m‰i†“J½-¼ªí¬·„t?_rÇ"“¡ùFRÍÌX-åø*C¼XZfH̺uÒ;¤]¸¾œÕÇärˆaÈ@©,­3? OãÃáyÛ·;«Â[RB†ü¼kñÖ2÷lµ…©Mm`D9Oà8шí3Œ+z¾&…WPñ~Ä[˜,¬®MMMM\森·nr-oš[‚o
4
ϼ^ß´Õ-͈³[B6ÜúMaµ¸Ç¥í:ÝûÒ^½ëK±‘Æ«”·#²l»•EÏvdUz‚oLé,^Ã8]÷Úx ¹Ám§XÊàõýäô[¥Q`H·• å?çbOIƒÊ5]Z6pçr8ƒ"•'¸Ä‘Kµ‹Ê@³zב
5
!mË@U©7Αj%T
6
èn»?ŸnÇ©°m‰¶ÊI•°)Ôg0ÉPŽˆ3²õTð#¸˜Ã.1dܼèæúTõ•8Wu;ž%ælÕÙ0q¼Ép6â>‹.åÊêȞºQwD(~¢?ËÂóµJdw„±D™1ͺŽÛ2:µCUr)pš®’ !Ž!§æ?V£*ÛôMÑ;KRJ#í.ЗÑ×x€C? óQù>†w´$NšyZÕ6J2Dï‘ËJh™,ïáϦ:¦BœÔdýÆ£dÇË´+Äè4¡šø;|ÈÃ7„o•«/õâZ*/y-Q¤—‰EyËîâtþ?ŸP$Îö«rªU†Î³(ã<í/@=ÊÕy?àÄ.Ì?0ü+ù·v1¼‡·‘èG:bÚqL»}GswÍÇ4‘?îc$÷â÷ú,rê‡ÔgqJËiý±•=L݇¹Óg’»zuÓôýuàW¨mÔ±¸&O2U‚Ô"÷„#ƒpzÓXÀP^ÂÞ*àˆS?…ü¿Hjäº'Eƒà¤÷?¼,Ñuþô*Mk„-B?°?]–8ºÏ{*—ìÀö*mwP?»RÛr½;~›[¯…]=YëmqÞ¬KÓr=Q“—u.ym¡#)ð%ÚÖ|Ϫ©KԆ•'|Løšð„rF-Á	_¾"|GxLqŽŠ„2áá&a…ð9?tc¤{Dø?ð;áO\£é?ÕàFñ;zûý¿ž¸KºæϞ¸XßÐì÷Æs&oФ
7
ÿÃɜ³§'ñE˜¼äÿ“÷BLÞ?PKYü椚
8
PK rS3²ÔWŠ97META-INF/MANIFEST.MFþÊPK rS3Yü椚
9
jar3/Aspect.classPK…¿
(-)testsrc/org/aspectj/weaver/loadtime/WeavingURLClassLoaderTest.java (-2 / +29 lines)
Lines 30-37 Link Here
30
/**
30
/**
31
 * @author websterm
31
 * @author websterm
32
 *
32
 *
33
 * To change the template for this generated type comment go to
34
 * Window>Preferences>Java>Code Generation>Code and Comments
35
 */
33
 */
36
public class WeavingURLClassLoaderTest extends TestCase {
34
public class WeavingURLClassLoaderTest extends TestCase {
37
35
Lines 432-437 Link Here
432
        }
430
        }
433
    }
431
    }
434
    
432
    
433
	public void testWeavingURLClassLoaderOddJars() throws Exception {
434
		URL classes = FileUtil.getFileURL(new File(TEST_BASE+"/test.jar/main.file"));
435
		URL aspectjrt = FileUtil.getFileURL(new File(ASPECTJRT));
436
		URL aspects = FileUtil.getFileURL(new File(TEST_BASE+"/aspectNoExt"));
437
		URL[] classURLs = new URL[] { aspects, classes, aspectjrt };
438
		URL[] aspectURLs = new URL[] { aspects };
439
		WeavingURLClassLoader loader = new WeavingURLClassLoader(classURLs,aspectURLs,getClass().getClassLoader());
440
441
        Class clazz = loader.loadClass("packag.Main");
442
        invokeMain(clazz,new String[] { }); 
443
	}
444
	
445
	public void testWeavingURLClassLoaderMissingJars() throws Exception {
446
		try {
447
			URL classes = FileUtil.getFileURL(new File(TEST_BASE+"/test.jar/main.file"));
448
			URL aspectjrt = FileUtil.getFileURL(new File(ASPECTJRT));
449
			URL aspects = FileUtil.getFileURL(new File(TEST_BASE+"/MissingFile"));
450
			URL[] classURLs = new URL[] { aspects, classes, aspectjrt };
451
			URL[] aspectURLs = new URL[] { aspects };
452
			WeavingURLClassLoader loader = new WeavingURLClassLoader(classURLs,aspectURLs,getClass().getClassLoader());
453
	
454
	        Class clazz = loader.loadClass("packag.Main");
455
	        invokeMain(clazz,new String[] { }); 
456
			fail("Should reject bad aspect MissingFile");
457
		} catch (AbortException ae) {
458
			assertTrue("Unexpected cause: "+ae.getMessage(), ae.getMessage().indexOf("bad aspect library")!=-1);
459
		}
460
	}
461
    
435
    private void doTestZipAspects(String aspectLib) throws Exception {
462
    private void doTestZipAspects(String aspectLib) throws Exception {
436
        File classZip = new File(TEST_BASE + "/main.zip");        
463
        File classZip = new File(TEST_BASE + "/main.zip");        
437
        File zipLib = new File(aspectLib);  
464
        File zipLib = new File(aspectLib);  

Return to bug 137235