--- /dev/null
+<project name="SecurityManagerTest" default="all" basedir=".">
+
+ <property name="aspectj" value="j:\eclipse\aspectj_ws\aj-build\dist\tools\lib"/>
+ <property name="aspectjrt" value="${aspectj}/aspectjrt.jar" />
+ <property name="aspectjtools" value="${aspectj}/aspectjtools.jar" />
+
+ <taskdef resource="org/aspectj/tools/ant/taskdefs/aspectjTaskdefs.properties">
+ <classpath>
+ <pathelement path="${aspectjtools}"/>
+ </classpath>
+ </taskdef>
+
+ <target name="compile">
+ <iajc
+ srcdir="${basedir}/src"
+ classpath="${aspectjrt}"
+ destdir="${basedir}/bin"
+ verbose="true"
+
+ fork="true"
+ forkclasspath="${aspectjtools}"
+ >
+ </iajc>
+ </target>
+
+ <target name="run">
+ <java
+ classname="HelloWorld"
+ classpath="${basedir}/../../../runtime/bin;${basedir}/bin"
+ fork="yes"
+ >
+ <jvmarg value="-Djava.security.manager"/>
+ </java>
+ </target>
+
+ <target name="all" depends="compile, run"/>
+
+</project>
--- /dev/null
+/*\r
+ * Created on 28-Sep-2004\r
+ *\r
+ * TODO To change the template for this generated file go to\r
+ * Window - Preferences - Java - Code Style - Code Templates\r
+ */\r
+\r
+\r
+\r
+/**
+ * @author websterm
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */\r
+public aspect Aspect {\r
+\r
+ pointcut method () :\r
+ execution(* println(..)) && within(HelloWorld) && cflow(execution(* main(..)));\r
+ \r
+ before () : method () {\r
+ System.out.println(thisJoinPoint.getSignature());\r
+ }\r
+}\r
--- /dev/null
+/*
+ * 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");
+ }
+}
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");
}
}
+
+ 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();
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");
}
}
+ 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();