Skip to content

Commit

Permalink
Removing no longer needed preload function.
Browse files Browse the repository at this point in the history
  • Loading branch information
tHerrmann committed Nov 23, 2015
1 parent bff1756 commit 1d70cd9
Showing 1 changed file with 0 additions and 57 deletions.
57 changes: 0 additions & 57 deletions src-setup/org/opencms/setup/CmsUpdateBean.java
Expand Up @@ -59,22 +59,18 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;

import javax.servlet.jsp.JspWriter;

import org.apache.commons.logging.Log;

import com.google.common.collect.Lists;
import com.google.common.collect.MapMaker;

/**
* A java bean as a controller for the OpenCms update wizard.<p>
Expand Down Expand Up @@ -516,58 +512,6 @@ public boolean isNeedDbUpdate() {
return m_detectedVersion != 8;
}

/**
* Try to preload necessary classes, to avoid ugly class loader issues caused by JARs being deleted during the update.
*/
public void preload() {

//opencms.jar
preload(OpenCms.class);

//guava
preload(MapMaker.class);

//xerces
preload(org.apache.xerces.impl.Constants.class);
}

/**
* Preloads classes from the same jar file as a given class.<p>
*
* @param cls the class for which the classes from the same jar file should be loaded
*/
public void preload(Class<?> cls) {

try {
File jar = new File(cls.getProtectionDomain().getCodeSource().getLocation().getFile());
java.util.jar.JarFile jarfile = new JarFile(jar);
try {
Enumeration<JarEntry> entries = jarfile.entries();
while (entries.hasMoreElements()) {
JarEntry entry = entries.nextElement();
String name = entry.getName();
if (name.endsWith(".class")) {
String className = name.replaceFirst("\\.class$", "");
className = className.replace('/', '.');
try {
Class.forName(className);
} catch (VirtualMachineError e) {
throw e;
} catch (Throwable e) {
LOG.error(e.getLocalizedMessage(), e);
}
}
}
} finally {
jarfile.close();
}
} catch (VirtualMachineError e) {
throw e;
} catch (Throwable e) {
LOG.error(e.getLocalizedMessage(), e);
}
}

/**
* Prepares step 1 of the update wizard.<p>
*/
Expand Down Expand Up @@ -644,7 +588,6 @@ public void prepareUpdateStep1bOutput(JspWriter out) throws IOException {
public void prepareUpdateStep5() {

if (isInitialized()) {
preload();
try {
String fileName = getWebAppRfsPath() + FOLDER_UPDATE + "cmsupdate";
// read the file
Expand Down

0 comments on commit 1d70cd9

Please sign in to comment.