From 6e155a6b9b78ec64f2fd4dc08152698277f1e7b7 Mon Sep 17 00:00:00 2001 From: aclement Date: Thu, 14 Oct 2004 08:12:09 +0000 Subject: [PATCH] Fix for Bugzilla Bug 74238: Applet which uses cflow pointcut gets AccessControlException --- ajde/testdata/SecurityManagerTest/build.xml | 38 ++++++++++++++++++ .../SecurityManagerTest/src/Aspect.aj | 24 +++++++++++ .../SecurityManagerTest/src/HelloWorld.java | 24 +++++++++++ lib/test/aspectjrt.jar | Bin 41305 -> 41549 bytes .../runtime/internal/CFlowCounter.java | 12 +++++- .../aspectj/runtime/internal/CFlowStack.java | 12 +++++- 6 files changed, 108 insertions(+), 2 deletions(-) create mode 100644 ajde/testdata/SecurityManagerTest/build.xml create mode 100644 ajde/testdata/SecurityManagerTest/src/Aspect.aj create mode 100644 ajde/testdata/SecurityManagerTest/src/HelloWorld.java diff --git a/ajde/testdata/SecurityManagerTest/build.xml b/ajde/testdata/SecurityManagerTest/build.xml new file mode 100644 index 000000000..2b2496fc1 --- /dev/null +++ b/ajde/testdata/SecurityManagerTest/build.xml @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ajde/testdata/SecurityManagerTest/src/Aspect.aj b/ajde/testdata/SecurityManagerTest/src/Aspect.aj new file mode 100644 index 000000000..74a3f6bc9 --- /dev/null +++ b/ajde/testdata/SecurityManagerTest/src/Aspect.aj @@ -0,0 +1,24 @@ +/* + * Created on 28-Sep-2004 + * + * TODO To change the template for this generated file go to + * Window - Preferences - Java - Code Style - Code Templates + */ + + + +/** + * @author websterm + * + * TODO To change the template for this generated type comment go to + * Window - Preferences - Java - Code Style - Code Templates + */ +public aspect Aspect { + + pointcut method () : + execution(* println(..)) && within(HelloWorld) && cflow(execution(* main(..))); + + before () : method () { + System.out.println(thisJoinPoint.getSignature()); + } +} diff --git a/ajde/testdata/SecurityManagerTest/src/HelloWorld.java b/ajde/testdata/SecurityManagerTest/src/HelloWorld.java new file mode 100644 index 000000000..fe981e7e6 --- /dev/null +++ b/ajde/testdata/SecurityManagerTest/src/HelloWorld.java @@ -0,0 +1,24 @@ +/* + * Created on 28-Sep-2004 + * + * TODO To change the template for this generated file go to + * Window - Preferences - Java - Code Style - Code Templates + */ + +/** + * @author websterm + * + * TODO To change the template for this generated type comment go to + * Window - Preferences - Java - Code Style - Code Templates + */ +public class HelloWorld { + + public static void println () { + System.out.println("Hello World!"); + } + + public static void main(String[] args) { + println(); +// System.getProperty("foo"); + } +} diff --git a/lib/test/aspectjrt.jar b/lib/test/aspectjrt.jar index 1e52a637314b5fff6038c7fb74ec869fbf3c4620..7f2818be5d9c0bbc0b81e26bd9e8cbaadb2e636f 100644 GIT binary patch delta 4961 zcmZWs2|Sct`yLb78)VA9HCZQ1$WGSmMkMQ4vs8B3GbM&ZmdBcPVu|JVEHH*?+RKG%KS=iJXTXL;QNC-=dbF-C`|8DRT=%6g`$%&3zf z$UyBsU(_J_26#vvBwC3a+UMUuLr^0J!J^bY031|`5L!@aLzqLQu#XMnR4!DIp?JuW zVkA@7!66DZmbbx)R)Nwm*5U=a5X^u{3KDot-vJS3nIwRU6i(nR!z3ip%!q;{fLW$@ z|5Jd1R+yjv2@nSa(zpO2W)yG|5drxq!lZxL2w*PlDA3A6Ndk@n(oh1}0TSy9#7m|Y z0uliPFvYgD-)MrYF^ooGkeKr&I-=>hY+NzeEV3ZlC-?&v6P2)vm^adJl8WC7`$e^DeqGt40rl>_ z*^@}cEG60X;dYP3t9yU_SXYQILR3dfCiaiqzIt@cRjX1s_ltaKpY$obFKSpcMMl!u z>SnY*XW;2YugdQ3Yv+ij={Y~o;`a^0Wl29*>Uq?ks@$44OpZkSEX&8;5 zDrNdqL(Y$@O}};@7=B|aQ`K^*IwIGrzge}oZyf*8zkh7_(PN)CW)5cK{AF2Zc&d>B zF1)tM(vNO$i21N9w2P6&vuB(+!p#OMSMSJbT^Z)ce3yhftrN}`hWDJ1^uuS`^uFJS z@=8)MdUMYp?Pq1x6?bePQyn7K+_%?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jAq?WiuTijLNituqTt&&Y0y4)qS$8AiSS-3PNV0D};VTF9>^y zE)Ys&)9P{AG~JuMx*aR*L6M6wY`rz}=M_UpoQPKd|@)&^~ zNd^E@zzTKRo+}JLCbicj5BWIp?fYgEm`>$@>D1AG9Dt<-={+GE;82Kw#Mn6l)_kz3 z4Se+WiP;rFu@116hk!a_%NK^TDS?zJfXS!z9R*Ta%0MmhDDXO;8&Z7*DPI+kvH)fa z4gp>TLJ%EQAPm=4+oMGxY6ql5ks##^Y!}n~#oZK!M`?kS31F+uuuDTj^hq%i@C6so z?*I&DzHf+mI*{0|kOvYLP2Hw;K zfsDOLS``Vyb8G-4SsdJ{ije(N?(Fsi@SpMGAPlCp&wk1d6iNWpB1uRnbX{%U44mLP zBMf$ApRm;t6wIyMe!(B2yfAFQr(#KnX1*m1*9hFBx&QM9M|G3k&Vz68J~+w! z3)CG9i7x{jU@YN-eDs4pvO*!c4g1f!sgwxAsbL^34v2>%{VR%3Cj%yJcgFt$JbPL4 diff --git a/runtime/src/org/aspectj/runtime/internal/CFlowCounter.java b/runtime/src/org/aspectj/runtime/internal/CFlowCounter.java index e48f67864..3e20cae28 100644 --- a/runtime/src/org/aspectj/runtime/internal/CFlowCounter.java +++ b/runtime/src/org/aspectj/runtime/internal/CFlowCounter.java @@ -50,7 +50,7 @@ public class CFlowCounter { private static ThreadStackFactory getThreadLocalStackFactoryFor11() { return new ThreadStackFactoryImpl11(); } private static void selectFactoryForVMVersion() { - String override = System.getProperty("aspectj.runtime.cflowstack.usethreadlocal","unspecified"); + String override = getSystemPropertyWithoutSecurityException("aspectj.runtime.cflowstack.usethreadlocal","unspecified"); boolean useThreadLocalImplementation = false; if (override.equals("unspecified")) { String v = System.getProperty("java.class.version","0.0"); @@ -67,6 +67,16 @@ public class CFlowCounter { } } + + private static String getSystemPropertyWithoutSecurityException (String aPropertyName, String aDefaultValue) { + try { + return System.getProperty(aPropertyName, aDefaultValue); + } + catch (SecurityException ex) { + return aDefaultValue; + } + } + // For debug ... public static String getThreadStackFactoryClassName() { return tsFactory.getClass().getName(); diff --git a/runtime/src/org/aspectj/runtime/internal/CFlowStack.java b/runtime/src/org/aspectj/runtime/internal/CFlowStack.java index 5e6eff590..e9d811124 100644 --- a/runtime/src/org/aspectj/runtime/internal/CFlowStack.java +++ b/runtime/src/org/aspectj/runtime/internal/CFlowStack.java @@ -121,7 +121,7 @@ public class CFlowStack { private static ThreadStackFactory getThreadLocalStackFactoryFor11() { return new ThreadStackFactoryImpl11(); } private static void selectFactoryForVMVersion() { - String override = System.getProperty("aspectj.runtime.cflowstack.usethreadlocal","unspecified"); + String override = getSystemPropertyWithoutSecurityException("aspectj.runtime.cflowstack.usethreadlocal","unspecified"); boolean useThreadLocalImplementation = false; if (override.equals("unspecified")) { String v = System.getProperty("java.class.version","0.0"); @@ -138,6 +138,16 @@ public class CFlowStack { } } + private static String getSystemPropertyWithoutSecurityException (String aPropertyName, String aDefaultValue) { + try { + return System.getProperty(aPropertyName, aDefaultValue); + } + catch (SecurityException ex) { + return aDefaultValue; + } + } + + // For debug ... public static String getThreadStackFactoryClassName() { return tsFactory.getClass().getName(); -- 2.39.5