Skip to content

Commit

Permalink
Inlined init() and removed getResources()
Browse files Browse the repository at this point in the history
- Now we see that system cl is final
- setResources can be called just before CL started (consistency)

Signed-off-by: David Matějček <david.matejcek@omnifish.ee>
  • Loading branch information
dmatej committed Jan 15, 2023
1 parent 4be208f commit 611cabb
Showing 1 changed file with 8 additions and 30 deletions.
Expand Up @@ -297,7 +297,7 @@ public class WebappClassLoader extends GlassfishUrlClassLoader
private ClassLoader parent;

/** The system class loader. */
private ClassLoader system;
private final ClassLoader system;

private LifeCycleStatus status = LifeCycleStatus.NEW;

Expand Down Expand Up @@ -348,7 +348,12 @@ public class WebappClassLoader extends GlassfishUrlClassLoader
*/
public WebappClassLoader(ClassLoader parent) {
super(new URL[0], parent);
init();
this.parent = getParent();
this.system = this.getClass().getClassLoader();
if (SECURITY_MANAGER != null) {
refreshPolicy();
}
this.permissionsHolder = new PermsHolder();
}


Expand All @@ -361,18 +366,11 @@ public void setOverridablePackages(Set<String> packageNames){
}


/**
* @return associated resources.
*/
public DirContext getResources() {
return this.resources;
}


/**
* Set associated resources.
*/
public void setResources(DirContext resources) {
checkStatus(LifeCycleStatus.NEW);
this.resources = resources;
final DirContext dirCtx;
if (resources instanceof ProxyDirContext) {
Expand Down Expand Up @@ -716,16 +714,6 @@ public void addTransformer(final ClassFileTransformer transformer) {
}


/**
* Create and return a temporary loader with the same visibility
* as this loader. The temporary loader may be used to load
* resources or any other application classes for the purposes of
* introspecting them for annotations. The persistence provider
* should not maintain any references to the temporary loader,
* or any objects loaded by it.
*
* @return A temporary classloader with the same classpath as this loader
*/
@Override
public ClassLoader copy() {
LOG.log(DEBUG, "copy()");
Expand Down Expand Up @@ -1288,16 +1276,6 @@ public synchronized URL[] getURLs() {
}


private void init() {
this.parent = getParent();
this.system = this.getClass().getClassLoader();
if (SECURITY_MANAGER != null) {
refreshPolicy();
}
this.permissionsHolder = new PermsHolder();
}


/**
* Start the class loader.
*/
Expand Down

0 comments on commit 611cabb

Please sign in to comment.