You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by gn...@apache.org on 2016/09/06 11:59:46 UTC
[1/2] karaf git commit: [KARAF-4687] Prevent classloader leaks with
static Throwables
Repository: karaf
Updated Branches:
refs/heads/master fef371380 -> e653836d7
[KARAF-4687] Prevent classloader leaks with static Throwables
Project: http://git-wip-us.apache.org/repos/asf/karaf/repo
Commit: http://git-wip-us.apache.org/repos/asf/karaf/commit/09c17953
Tree: http://git-wip-us.apache.org/repos/asf/karaf/tree/09c17953
Diff: http://git-wip-us.apache.org/repos/asf/karaf/diff/09c17953
Branch: refs/heads/master
Commit: 09c1795378115ab46eb537a3b3d9ac6dd3e185af
Parents: fef3713
Author: Grzegorz Grzybek <gg...@redhat.com>
Authored: Wed Aug 31 18:15:08 2016 +0200
Committer: Guillaume Nodet <gn...@apache.org>
Committed: Tue Sep 6 13:40:19 2016 +0200
----------------------------------------------------------------------
.../src/main/java/java/lang/Exception.java | 33 +++++++++++++++++---
1 file changed, 29 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/karaf/blob/09c17953/exception/src/main/java/java/lang/Exception.java
----------------------------------------------------------------------
diff --git a/exception/src/main/java/java/lang/Exception.java b/exception/src/main/java/java/lang/Exception.java
index 76eee71..d07c280 100644
--- a/exception/src/main/java/java/lang/Exception.java
+++ b/exception/src/main/java/java/lang/Exception.java
@@ -18,6 +18,8 @@
package java.lang;
import java.lang.reflect.Field;
+import java.lang.ref.Reference;
+import java.lang.ref.WeakReference;
import javax.xml.bind.annotation.XmlTransient;
@@ -34,13 +36,14 @@ import javax.xml.bind.annotation.XmlTransient;
public class Exception extends Throwable {
private static final long serialVersionUID = -3387516993124229948L;
- private transient Class[] classContext = SecurityManagerEx.getInstance().getThrowableContext(this);
+ private transient Reference<Class<?>>[] classContext;
/**
* Constructs a new {@code Exception} that includes the current stack trace.
*/
public Exception() {
super();
+ initClassContext();
}
/**
@@ -52,6 +55,7 @@ public class Exception extends Throwable {
*/
public Exception(String detailMessage) {
super(detailMessage);
+ initClassContext();
}
/**
@@ -65,6 +69,7 @@ public class Exception extends Throwable {
*/
public Exception(String detailMessage, Throwable throwable) {
super(detailMessage, throwable);
+ initClassContext();
}
/**
@@ -76,6 +81,7 @@ public class Exception extends Throwable {
*/
public Exception(Throwable throwable) {
super(throwable);
+ initClassContext();
}
/**
@@ -115,17 +121,36 @@ public class Exception extends Throwable {
} catch (Exception e) {
e.printStackTrace();
}
-
+ initClassContext();
}
@XmlTransient
@Deprecated
public Class[] getClassContext() {
- return classContext;
+ Class<?>[] context = new Class<?>[classContext.length];
+ for (int i = 0; i < classContext.length; i++) {
+ Class<?> c = classContext[i].get();
+ context[i] = c == null ? Object.class : c;
+ }
+ return context;
+ }
+
+ @SuppressWarnings("unchecked")
+ private void initClassContext() {
+ Class[] context = SecurityManagerEx.getInstance().getThrowableContext(this);
+ classContext = new Reference[context.length];
+ for (int i = 0; i < context.length; i++) {
+ classContext[i] = new WeakReference<Class<?>>(context[i]);
+ }
}
protected Class[] classContext() {
- return classContext;
+ Class<?>[] context = new Class<?>[classContext.length];
+ for (int i = 0; i < classContext.length; i++) {
+ Class<?> c = classContext[i].get();
+ context[i] = c == null ? Object.class : c;
+ }
+ return context;
}
private static class SecurityManagerEx extends SecurityManager
[2/2] karaf git commit: [KARAF-2844] Skip maven plugin tests if
standard unit tests are disabled (that was broken with commit
6bc4817ae587562042f09144f6e0ca7f2a9a4919)
Posted by gn...@apache.org.
[KARAF-2844] Skip maven plugin tests if standard unit tests are disabled (that was broken with commit 6bc4817ae587562042f09144f6e0ca7f2a9a4919)
Project: http://git-wip-us.apache.org/repos/asf/karaf/repo
Commit: http://git-wip-us.apache.org/repos/asf/karaf/commit/e653836d
Tree: http://git-wip-us.apache.org/repos/asf/karaf/tree/e653836d
Diff: http://git-wip-us.apache.org/repos/asf/karaf/diff/e653836d
Branch: refs/heads/master
Commit: e653836d74e1cedecd9d9775e9bbf596de93f620
Parents: 09c1795
Author: Guillaume Nodet <gn...@apache.org>
Authored: Tue Sep 6 13:59:12 2016 +0200
Committer: Guillaume Nodet <gn...@apache.org>
Committed: Tue Sep 6 13:59:12 2016 +0200
----------------------------------------------------------------------
tooling/karaf-maven-plugin/pom.xml | 35 +++++++++++++++++++++++++++------
1 file changed, 29 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/karaf/blob/e653836d/tooling/karaf-maven-plugin/pom.xml
----------------------------------------------------------------------
diff --git a/tooling/karaf-maven-plugin/pom.xml b/tooling/karaf-maven-plugin/pom.xml
index 1c01767..646d11f 100644
--- a/tooling/karaf-maven-plugin/pom.xml
+++ b/tooling/karaf-maven-plugin/pom.xml
@@ -298,14 +298,37 @@
</reporting>
<profiles>
<profile>
- <id>java9</id>
- <properties>
+ <id>java9</id>
+ <properties>
<mvn.opts>-XaddExports:java.base/sun.net.www.protocol.http=ALL-UNNAMED -XaddExports:java.base/sun.net.www.protocol.https=ALL-UNNAMED -XaddExports:java.xml.bind/com.sun.xml.internal.bind.v2.runtime=ALL-UNNAMED -XaddExports:jdk.xml.dom/org.w3c.dom.html=ALL-UNNAMED -addmods java.activation,java.annotations.common,java.corba,java.transaction,java.xml.bind,java.xml.ws -Djava.io.tmpdir=${project.build.directory}</mvn.opts>
- </properties>
- <activation>
- <jdk>9</jdk>
+ </properties>
+ <activation>
+ <jdk>9</jdk>
</activation>
- </profile>
+ </profile>
+ <profile>
+ <id>skiptests</id>
+ <properties>
+ <invoker.skip>true</invoker.skip>
+ </properties>
+ <activation>
+ <property>
+ <name>skipTests</name>
+ </property>
+ </activation>
+ </profile>
+ <profile>
+ <id>skiptests2</id>
+ <properties>
+ <invoker.skip>true</invoker.skip>
+ </properties>
+ <activation>
+ <property>
+ <name>maven.test.skip</name>
+ <value>true</value>
+ </property>
+ </activation>
+ </profile>
</profiles>