Skip to content

Commit

Permalink
jetty-repacked:9.4.7.v20171121
Browse files Browse the repository at this point in the history
  • Loading branch information
gorvin committed Feb 28, 2018
1 parent 5856ef0 commit 045ef0d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion selenium-bravo-servlet/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ repositories {
dependencies {
compile 'com.google.guava:guava:23.0'
compile 'io.sterodium:sterodium-rmi:0.3'
compile 'org.seleniumhq.selenium:jetty-repacked:9.4.5.v20170502'
compile 'org.seleniumhq.selenium:jetty-repacked:9.4.7.v20171121'
compile 'commons-io:commons-io:2.5'
compile 'org.slf4j:slf4j-api:1.7.12'
compile 'org.slf4j:slf4j-simple:1.7.12'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@
import java.net.URLClassLoader;
import java.util.Arrays;
import java.util.function.BiConsumer;
import java.util.logging.Logger;

public class RuntimeJar {
BiConsumer<String, Object> addToRmiFacade = null;
private static final Logger LOGGER = Logger.getLogger(SikuliScreen.class.getName());

private BiConsumer<String, Object> addToRmiFacade = null;
public RuntimeJar(BiConsumer<String, Object> addToRmiFacade) {
this.addToRmiFacade = addToRmiFacade;
}
Expand All @@ -20,6 +23,7 @@ public RuntimeJar(BiConsumer<String, Object> addToRmiFacade) {
* if the library is already loaded.
*/
private synchronized void loadModule(String jarPath) throws TypeNotPresentException {
LOGGER.info("Loading module " + jarPath);
File jar = new File(jarPath);
try {
/*We are using reflection here to circumvent encapsulation; addURL is not public*/
Expand All @@ -33,6 +37,7 @@ private synchronized void loadModule(String jarPath) throws TypeNotPresentExcept
Method method = URLClassLoader.class.getDeclaredMethod("addURL", new Class[]{java.net.URL.class});
method.setAccessible(true); /*promote the method to public access*/
method.invoke(loader, new Object[]{url});
LOGGER.info("... loaded module " + jarPath);
} catch (final NoSuchMethodException | IllegalAccessException
| MalformedURLException | InvocationTargetException e){
throw new TypeNotPresentException("FAILED loading module ", e);
Expand All @@ -41,7 +46,9 @@ private synchronized void loadModule(String jarPath) throws TypeNotPresentExcept

public void addRemoteInstance(String jarPath, String remoteId, String className) throws ClassNotFoundException, IllegalAccessException, InstantiationException {
loadModule(jarPath);
LOGGER.info("Creating object of class " + className);
Object obj = Class.forName(className).newInstance();
LOGGER.info("Registering object " + className);
addToRmiFacade.accept(remoteId, obj);
}
}

0 comments on commit 045ef0d

Please sign in to comment.