To protect your data, the CISO officer has suggested users to enable 2FA as soon as possible.
Currently 2.7% of users enabled 2FA.

Commit 8bcec28c authored by john's avatar john
Browse files

added the property dacapo.callback.classpath which can be used to specify the...

added the property dacapo.callback.classpath which can be used to specify the path for finding user defined Callback classes
parent 961c1787
......@@ -8,13 +8,16 @@
* @date $Date: 2009-12-24 11:19:36 +1100 (Thu, 24 Dec 2009) $
* @id $Id: Harness.java 738 2009-12-24 00:19:36Z steveb-oss $
*/
import java.io.File;
import java.io.InputStream;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.net.URLClassLoader;
public class Harness {
// The DaCapo Harness is in a separate library within the dacapo.jar
......@@ -23,12 +26,14 @@ public class Harness {
private static final String HARNESS_CLASS = "org.dacapo.harness.TestHarness";
private static final String HARNESS_METHOD = "main";
public static void main(String[] args) throws ClassNotFoundException, SecurityException, NoSuchMethodException, IllegalArgumentException, IllegalAccessException, InvocationTargetException {
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
URL harnessJarURL = classLoader.getResource(HARNESS_PATH);
//
private static final String CALLBACK_CLASSPATH_PROPERTY = "dacapo.callback.classpath";
ClassLoader harnessClassLoader = new URLClassLoader(new URL[] { harnessJarURL });
public static void main(String[] args) throws MalformedURLException,
URISyntaxException, ClassNotFoundException, SecurityException,
NoSuchMethodException, IllegalArgumentException, IllegalAccessException,
InvocationTargetException {
ClassLoader harnessClassLoader = makeHarnessClassLoader();
Thread.currentThread().setContextClassLoader(harnessClassLoader);
......@@ -38,9 +43,34 @@ public class Harness {
harnessMain.invoke(null, new Object[] { args });
/* TestHarness.main(args); */
System.exit(0);
}
private static ClassLoader makeHarnessClassLoader() throws MalformedURLException, URISyntaxException {
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
String dacapoCallbackClasspath = System
.getProperty(CALLBACK_CLASSPATH_PROPERTY);
URL harnessJarURL = classLoader.getResource(HARNESS_PATH);
URL[] urls = null;
if (dacapoCallbackClasspath != null) {
File file = new File(dacapoCallbackClasspath);
URI callbackClasspath = null;
if (file.isDirectory())
callbackClasspath = file.getAbsoluteFile().toURI();
else
callbackClasspath = new URI(dacapoCallbackClasspath);
if (callbackClasspath == null)
throw new URISyntaxException(dacapoCallbackClasspath, "is not a URI nor a directory nor a class file");
urls = new URL[] { harnessJarURL, callbackClasspath.toURL() };
} else
urls = new URL[] { harnessJarURL };
return new URLClassLoader(urls);
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment