aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/javassist/Loader.java
diff options
context:
space:
mode:
authorchiba <chiba@30ef5769-5b8d-40dd-aea6-55b5d6557bb3>2006-08-07 15:48:31 +0000
committerchiba <chiba@30ef5769-5b8d-40dd-aea6-55b5d6557bb3>2006-08-07 15:48:31 +0000
commit2405e6804619f75ef93c9a8e9ba366e595f4899d (patch)
treea5fac709b60ce7e9f161fe5b55e144e24283cdcf /src/main/javassist/Loader.java
parenta62c5816078737cc3a392beaa88c2c03d95ea961 (diff)
downloadjavassist-2405e6804619f75ef93c9a8e9ba366e595f4899d.tar.gz
javassist-2405e6804619f75ef93c9a8e9ba366e595f4899d.zip
fixed the bug reported as JASSIST-23.
git-svn-id: http://anonsvn.jboss.org/repos/javassist/trunk@305 30ef5769-5b8d-40dd-aea6-55b5d6557bb3
Diffstat (limited to 'src/main/javassist/Loader.java')
-rw-r--r--src/main/javassist/Loader.java18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/main/javassist/Loader.java b/src/main/javassist/Loader.java
index b676a63a..716fc988 100644
--- a/src/main/javassist/Loader.java
+++ b/src/main/javassist/Loader.java
@@ -18,6 +18,7 @@ package javassist;
import java.io.*;
import java.util.Hashtable;
import java.util.Vector;
+import java.security.ProtectionDomain;
/**
* The class loader for Javassist.
@@ -136,6 +137,7 @@ public class Loader extends ClassLoader {
private Vector notDefinedPackages; // must be atomic.
private ClassPool source;
private Translator translator;
+ private ProtectionDomain domain;
/**
* Specifies the algorithm of class loading.
@@ -183,6 +185,7 @@ public class Loader extends ClassLoader {
notDefinedPackages = new Vector();
source = cp;
translator = null;
+ domain = null;
delegateLoadingOf("javassist.Loader");
}
@@ -202,6 +205,16 @@ public class Loader extends ClassLoader {
}
/**
+ * Sets the protection domain for the classes handled by this class
+ * loader. Without registering an appropriate protection domain,
+ * the program loaded by this loader will not work with a security
+ * manager or a signed jar file.
+ */
+ public void setDomain(ProtectionDomain d) {
+ domain = d;
+ }
+
+ /**
* Sets the soruce <code>ClassPool</code>.
*/
public void setClassPool(ClassPool cp) {
@@ -362,7 +375,10 @@ public class Loader extends ClassLoader {
}
}
- return defineClass(name, classfile, 0, classfile.length);
+ if (domain == null)
+ return defineClass(name, classfile, 0, classfile.length);
+ else
+ return defineClass(name, classfile, 0, classfile.length, domain);
}
protected Class loadClassByDelegation(String name)