Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jdk9 support #417

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,23 @@
language: groovy
jdk:
- oraclejdk7
- openjdk7
- oraclejdk8
- oraclejdk9
before_cache:
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
cache:
directories:
- $HOME/.gradle/caches
- $HOME/.gradle/wrapper
before_install:
chmod +x gradlew
- chmod +x gradlew
- sudo apt-get -qq update
- sudo apt-get install -y zip curl locate libbcprov-java
- |
sudo ln -s /usr/share/java/bcprov.jar /usr/lib/jvm/java-7-openjdk-amd64/jre/lib/ext/bcprov.jar \
&& sudo awk -F . -v OFS=. 'BEGIN{n=2}/^security\.provider/ {split($3, posAndEquals, "=");$3=n++"="posAndEquals[2];print;next} 1' /etc/java-7-openjdk/security/java.security > /tmp/java.security \
&& sudo echo "security.provider.1=org.bouncycastle.jce.provider.BouncyCastleProvider" >> /tmp/java.security \
&& sudo mv /tmp/java.security /etc/java-7-openjdk/security/java.security
before_script:
- "export DISPLAY=:99.0"
- "sh -e /etc/init.d/xvfb start"
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ tomcat7_servlet_api_version=3.0.1
tomcat8_version=8.0.44
tomcat8_servlet_api_version=3.1.0
asm_version=5.0.3
groovy_version=2.4.11
groovy_version=2.4.13
spock_version=1.1-groovy-2.4
logback_version=1.1.3
slf4j_version=1.7.12
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.0-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.5.1-bin.zip
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,11 @@
package org.akhikhl.gretty;

import org.eclipse.jetty.webapp.WebAppClassLoader;
import sun.misc.CompoundEnumeration;
import sun.misc.Resource;
import sun.misc.URLClassPath;

import java.io.IOException;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Enumeration;
import java.util.List;

Expand All @@ -31,12 +28,25 @@ public class FilteringClassLoader extends WebAppClassLoader {

private final List<String> serverResources = new ArrayList<String>();

private ClassLoader bootClassLoader;

public FilteringClassLoader(Context context) throws IOException {
super(context);
findBootClassLoader();
}

public FilteringClassLoader(ClassLoader parent, Context context) throws IOException {
super(parent, context);
findBootClassLoader();
}

protected void findBootClassLoader() {
bootClassLoader = getParent();
if (bootClassLoader != null) {
while(bootClassLoader.getParent() != null) {
bootClassLoader = bootClassLoader.getParent();
}
}
}

public void addServerClass(String serverClass) {
Expand Down Expand Up @@ -64,31 +74,18 @@ protected Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundE

@Override
public Enumeration<URL> getResources(String name) throws IOException {
for(String serverResource : serverResources)
for(String serverResource : serverResources) {
if(name.startsWith(serverResource)) {
Enumeration<URL>[] tmp = (Enumeration<URL>[]) new Enumeration<?>[2];
tmp[0] = getBootstrapResources(name);
tmp[1] = findResources(name);
return new CompoundEnumeration(tmp);
final List<URL> resources = new ArrayList<>();
resources.addAll(Collections.list(getBootstrapResources(name)));
resources.addAll(Collections.list(findResources(name)));
return Collections.enumeration(resources);
}
}
return super.getResources(name);
}

private static Enumeration<URL> getBootstrapResources(String name) throws IOException {
final Enumeration<Resource> e =
getBootstrapClassPath().getResources(name);
return new Enumeration<URL> () {
public URL nextElement() {
return e.nextElement().getURL();
}
public boolean hasMoreElements() {
return e.hasMoreElements();
}
};
}

// Returns the URLClassPath that is used for finding system resources.
static URLClassPath getBootstrapClassPath() {
return sun.misc.Launcher.getBootstrapClassPath();
private Enumeration<URL> getBootstrapResources(String name) throws IOException {
return bootClassLoader.getResources(name);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,11 @@
package org.akhikhl.gretty;

import org.eclipse.jetty.webapp.WebAppClassLoader;
import sun.misc.CompoundEnumeration;
import sun.misc.Resource;
import sun.misc.URLClassPath;

import java.io.IOException;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Enumeration;
import java.util.List;

Expand All @@ -31,12 +28,25 @@ public class FilteringClassLoader extends WebAppClassLoader {

private final List<String> serverResources = new ArrayList<String>();

private ClassLoader bootClassLoader;

public FilteringClassLoader(Context context) throws IOException {
super(context);
findBootClassLoader();
}

public FilteringClassLoader(ClassLoader parent, Context context) throws IOException {
super(parent, context);
findBootClassLoader();
}

protected void findBootClassLoader() {
bootClassLoader = getParent();
if (bootClassLoader != null) {
while(bootClassLoader.getParent() != null) {
bootClassLoader = bootClassLoader.getParent();
}
}
}

public void addServerClass(String serverClass) {
Expand Down Expand Up @@ -64,31 +74,18 @@ protected Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundE

@Override
public Enumeration<URL> getResources(String name) throws IOException {
for(String serverResource : serverResources)
for(String serverResource : serverResources) {
if(name.startsWith(serverResource)) {
Enumeration<URL>[] tmp = (Enumeration<URL>[]) new Enumeration<?>[2];
tmp[0] = getBootstrapResources(name);
tmp[1] = findResources(name);
return new CompoundEnumeration(tmp);
final List<URL> resources = new ArrayList<>();
resources.addAll(Collections.list(getBootstrapResources(name)));
resources.addAll(Collections.list(findResources(name)));
return Collections.enumeration(resources);
}
}
return super.getResources(name);
}

private static Enumeration<URL> getBootstrapResources(String name) throws IOException {
final Enumeration<Resource> e =
getBootstrapClassPath().getResources(name);
return new Enumeration<URL> () {
public URL nextElement() {
return e.nextElement().getURL();
}
public boolean hasMoreElements() {
return e.hasMoreElements();
}
};
}

// Returns the URLClassPath that is used for finding system resources.
static URLClassPath getBootstrapClassPath() {
return sun.misc.Launcher.getBootstrapClassPath();
private Enumeration<URL> getBootstrapResources(String name) throws IOException {
return bootClassLoader.getResources(name);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,11 @@
package org.akhikhl.gretty;

import org.eclipse.jetty.webapp.WebAppClassLoader;
import sun.misc.CompoundEnumeration;
import sun.misc.Resource;
import sun.misc.URLClassPath;

import java.io.IOException;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Enumeration;
import java.util.List;

Expand All @@ -31,12 +28,25 @@ public class FilteringClassLoader extends WebAppClassLoader {

private final List<String> serverResources = new ArrayList<String>();

private ClassLoader bootClassLoader;

public FilteringClassLoader(Context context) throws IOException {
super(context);
findBootClassLoader();
}

public FilteringClassLoader(ClassLoader parent, Context context) throws IOException {
super(parent, context);
findBootClassLoader();
}

protected void findBootClassLoader() {
bootClassLoader = getParent();
if (bootClassLoader != null) {
while(bootClassLoader.getParent() != null) {
bootClassLoader = bootClassLoader.getParent();
}
}
}

public void addServerClass(String serverClass) {
Expand Down Expand Up @@ -64,31 +74,18 @@ protected Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundE

@Override
public Enumeration<URL> getResources(String name) throws IOException {
for(String serverResource : serverResources)
for(String serverResource : serverResources) {
if(name.startsWith(serverResource)) {
Enumeration<URL>[] tmp = (Enumeration<URL>[]) new Enumeration<?>[2];
tmp[0] = getBootstrapResources(name);
tmp[1] = findResources(name);
return new CompoundEnumeration(tmp);
final List<URL> resources = new ArrayList<>();
resources.addAll(Collections.list(getBootstrapResources(name)));
resources.addAll(Collections.list(findResources(name)));
return Collections.enumeration(resources);
}
}
return super.getResources(name);
}

private static Enumeration<URL> getBootstrapResources(String name) throws IOException {
final Enumeration<Resource> e =
getBootstrapClassPath().getResources(name);
return new Enumeration<URL> () {
public URL nextElement() {
return e.nextElement().getURL();
}
public boolean hasMoreElements() {
return e.hasMoreElements();
}
};
}

// Returns the URLClassPath that is used for finding system resources.
static URLClassPath getBootstrapClassPath() {
return sun.misc.Launcher.getBootstrapClassPath();
private Enumeration<URL> getBootstrapResources(String name) throws IOException {
return bootClassLoader.getResources(name);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,11 @@
package org.akhikhl.gretty;

import org.eclipse.jetty.webapp.WebAppClassLoader;
import sun.misc.CompoundEnumeration;
import sun.misc.Resource;
import sun.misc.URLClassPath;

import java.io.IOException;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Enumeration;
import java.util.List;

Expand All @@ -31,12 +28,25 @@ public class FilteringClassLoader extends WebAppClassLoader {

private final List<String> serverResources = new ArrayList<String>();

private ClassLoader bootClassLoader;

public FilteringClassLoader(Context context) throws IOException {
super(context);
findBootClassLoader();
}

public FilteringClassLoader(ClassLoader parent, Context context) throws IOException {
super(parent, context);
findBootClassLoader();
}

protected void findBootClassLoader() {
bootClassLoader = getParent();
if (bootClassLoader != null) {
while(bootClassLoader.getParent() != null) {
bootClassLoader = bootClassLoader.getParent();
}
}
}

public void addServerClass(String serverClass) {
Expand Down Expand Up @@ -64,31 +74,18 @@ protected Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundE

@Override
public Enumeration<URL> getResources(String name) throws IOException {
for(String serverResource : serverResources)
for(String serverResource : serverResources) {
if(name.startsWith(serverResource)) {
Enumeration<URL>[] tmp = (Enumeration<URL>[]) new Enumeration<?>[2];
tmp[0] = getBootstrapResources(name);
tmp[1] = findResources(name);
return new CompoundEnumeration(tmp);
final List<URL> resources = new ArrayList<>();
resources.addAll(Collections.list(getBootstrapResources(name)));
resources.addAll(Collections.list(findResources(name)));
return Collections.enumeration(resources);
}
}
return super.getResources(name);
}

private static Enumeration<URL> getBootstrapResources(String name) throws IOException {
final Enumeration<Resource> e =
getBootstrapClassPath().getResources(name);
return new Enumeration<URL> () {
public URL nextElement() {
return e.nextElement().getURL();
}
public boolean hasMoreElements() {
return e.hasMoreElements();
}
};
}

// Returns the URLClassPath that is used for finding system resources.
static URLClassPath getBootstrapClassPath() {
return sun.misc.Launcher.getBootstrapClassPath();
private Enumeration<URL> getBootstrapResources(String name) throws IOException {
return bootClassLoader.getResources(name);
}
}
Loading