You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by an...@apache.org on 2015/12/03 04:36:26 UTC
[1/9] tomee git commit: commons-collections 3.2.2
Repository: tomee
Updated Branches:
refs/heads/tomee-7.0.0-M1 439eb9a27 -> 93921cbdf
commons-collections 3.2.2
Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/256e1405
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/256e1405
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/256e1405
Branch: refs/heads/tomee-7.0.0-M1
Commit: 256e140529bf317bdb172d67729cdeb151684aee
Parents: f9f73a4
Author: AndyGee <an...@gmx.de>
Authored: Thu Dec 3 02:11:56 2015 +0100
Committer: AndyGee <an...@gmx.de>
Committed: Thu Dec 3 02:13:58 2015 +0100
----------------------------------------------------------------------
pom.xml | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tomee/blob/256e1405/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 8c74383..aaa2633 100644
--- a/pom.xml
+++ b/pom.xml
@@ -152,7 +152,7 @@
<commons-logging-api.version>1.1</commons-logging-api.version>
<commons-dbcp.version>2.1</commons-dbcp.version>
<commons-pool.version>2.3</commons-pool.version>
- <commons-collections.version>3.2.1</commons-collections.version>
+ <commons-collections.version>3.2.2</commons-collections.version>
<commons-codec.version>1.10</commons-codec.version>
<commons-fileupload.version>1.3.1</commons-fileupload.version>
<commons-discovery.version>0.5</commons-discovery.version>
@@ -1247,6 +1247,10 @@
<artifactId>geronimo-jta_1.1_spec</artifactId>
</exclusion>
<exclusion>
+ <groupId>commons-collections</groupId>
+ <artifactId>commons-collections</artifactId>
+ </exclusion>
+ <exclusion>
<groupId>commons-pool</groupId>
<artifactId>commons-pool</artifactId>
</exclusion>
[2/9] tomee git commit: Fix recursion
Posted by an...@apache.org.
Fix recursion
Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/26770ac8
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/26770ac8
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/26770ac8
Branch: refs/heads/tomee-7.0.0-M1
Commit: 26770ac8bc62968e88c55b1b0ca1b383ec3e13d5
Parents: 256e140
Author: AndyGee <an...@gmx.de>
Authored: Thu Dec 3 03:12:52 2015 +0100
Committer: AndyGee <an...@gmx.de>
Committed: Thu Dec 3 03:12:52 2015 +0100
----------------------------------------------------------------------
.../main/java/org/apache/openejb/monitoring/LocalMBeanServer.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tomee/blob/26770ac8/container/openejb-core/src/main/java/org/apache/openejb/monitoring/LocalMBeanServer.java
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/main/java/org/apache/openejb/monitoring/LocalMBeanServer.java b/container/openejb-core/src/main/java/org/apache/openejb/monitoring/LocalMBeanServer.java
index 94b3b2f..2ce5e1a 100644
--- a/container/openejb-core/src/main/java/org/apache/openejb/monitoring/LocalMBeanServer.java
+++ b/container/openejb-core/src/main/java/org/apache/openejb/monitoring/LocalMBeanServer.java
@@ -184,7 +184,7 @@ public final class LocalMBeanServer implements MBeanServer {
@Override
public Set<ObjectInstance> queryMBeans(final ObjectName name, final QueryExp query) {
- return queryMBeans(name, query);
+ return s().queryMBeans(name, query);
}
@Override
[8/9] tomee git commit: Use property!
Posted by an...@apache.org.
Use property!
Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/a415f3ee
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/a415f3ee
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/a415f3ee
Branch: refs/heads/tomee-7.0.0-M1
Commit: a415f3ee4bbdb39f92bb34c3a9fa2ad9df0e3464
Parents: eb50749
Author: AndyGee <an...@gmx.de>
Authored: Thu Dec 3 04:21:57 2015 +0100
Committer: AndyGee <an...@gmx.de>
Committed: Thu Dec 3 04:21:57 2015 +0100
----------------------------------------------------------------------
itests/openejb-itests-beans/pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tomee/blob/a415f3ee/itests/openejb-itests-beans/pom.xml
----------------------------------------------------------------------
diff --git a/itests/openejb-itests-beans/pom.xml b/itests/openejb-itests-beans/pom.xml
index 6303e2d..daf8932 100644
--- a/itests/openejb-itests-beans/pom.xml
+++ b/itests/openejb-itests-beans/pom.xml
@@ -65,7 +65,7 @@
<dependency>
<groupId>org.apache.openjpa</groupId>
<artifactId>openjpa</artifactId>
- <version>2.4.0</version>
+ <version>${openjpa.version}</version>
</dependency>
</dependencies>
</plugin>
[3/9] tomee git commit: Finals
Posted by an...@apache.org.
Finals
Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/cf2e1138
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/cf2e1138
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/cf2e1138
Branch: refs/heads/tomee-7.0.0-M1
Commit: cf2e113838a898bc866cb79823bd0022eade0fe5
Parents: 26770ac
Author: AndyGee <an...@gmx.de>
Authored: Thu Dec 3 03:18:10 2015 +0100
Committer: AndyGee <an...@gmx.de>
Committed: Thu Dec 3 03:18:10 2015 +0100
----------------------------------------------------------------------
.../openejb/server/httpd/HttpResponseImpl.java | 112 +++++++++----------
1 file changed, 56 insertions(+), 56 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tomee/blob/cf2e1138/server/openejb-http/src/main/java/org/apache/openejb/server/httpd/HttpResponseImpl.java
----------------------------------------------------------------------
diff --git a/server/openejb-http/src/main/java/org/apache/openejb/server/httpd/HttpResponseImpl.java b/server/openejb-http/src/main/java/org/apache/openejb/server/httpd/HttpResponseImpl.java
index 180e3e2..cb73dcf 100644
--- a/server/openejb-http/src/main/java/org/apache/openejb/server/httpd/HttpResponseImpl.java
+++ b/server/openejb-http/src/main/java/org/apache/openejb/server/httpd/HttpResponseImpl.java
@@ -33,8 +33,8 @@ import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.net.URLConnection;
-import java.util.Arrays;
import java.util.Collection;
+import java.util.Collections;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
@@ -99,7 +99,7 @@ public class HttpResponseImpl implements HttpResponse {
private String encoding = "UTF-8";
private Locale locale = Locale.getDefault();
- protected void setRequest(HttpRequestImpl request) {
+ protected void setRequest(final HttpRequestImpl request) {
this.request = request;
}
@@ -109,68 +109,68 @@ public class HttpResponseImpl implements HttpResponse {
* @param name the name of the header
* @param value the value of the header
*/
- public void setHeader(String name, String value) {
+ public void setHeader(final String name, final String value) {
headers.put(name, value);
}
@Override
- public void setIntHeader(String s, int i) {
+ public void setIntHeader(final String s, final int i) {
headers.put(s, Integer.toString(i));
}
@Override
- public void setStatus(int i) {
+ public void setStatus(final int i) {
setCode(i);
}
@Override
- public void setStatus(int i, String s) {
+ public void setStatus(final int i, final String s) {
setCode(i);
setStatusMessage(s);
}
@Override
- public void addCookie(Cookie cookie) {
+ public void addCookie(final Cookie cookie) {
headers.put(cookie.getName(), cookie.getValue());
}
@Override
- public void addDateHeader(String s, long l) {
+ public void addDateHeader(final String s, final long l) {
headers.put(s, Long.toString(l));
}
@Override
- public void addHeader(String s, String s1) {
+ public void addHeader(final String s, final String s1) {
headers.put(s, s1);
}
@Override
- public void addIntHeader(String s, int i) {
+ public void addIntHeader(final String s, final int i) {
setIntHeader(s, i);
}
@Override
- public boolean containsHeader(String s) {
+ public boolean containsHeader(final String s) {
return headers.containsKey(s);
}
@Override
- public String encodeURL(String s) {
+ public String encodeURL(final String s) {
return toEncoded(s);
}
@Override
- public String encodeRedirectURL(String s) {
+ public String encodeRedirectURL(final String s) {
return toEncoded(s);
}
@Override
- public String encodeUrl(String s) {
+ public String encodeUrl(final String s) {
return toEncoded(s);
}
@Override
- public String encodeRedirectUrl(String s) {
+ public String encodeRedirectUrl(final String s) {
return encodeRedirectURL(s);
}
@@ -180,7 +180,7 @@ public class HttpResponseImpl implements HttpResponse {
* @param name The name of the header
* @return the value of the header
*/
- public String getHeader(String name) {
+ public String getHeader(final String name) {
return headers.get(name);
}
@@ -190,8 +190,8 @@ public class HttpResponseImpl implements HttpResponse {
}
@Override
- public Collection<String> getHeaders(String s) {
- return Arrays.asList(headers.get(s));
+ public Collection<String> getHeaders(final String s) {
+ return Collections.singletonList(headers.get(s));
}
@Override
@@ -200,12 +200,12 @@ public class HttpResponseImpl implements HttpResponse {
}
@Override
- public void sendError(int i) throws IOException {
+ public void sendError(final int i) throws IOException {
setCode(i);
}
@Override
- public void sendError(int i, String s) throws IOException {
+ public void sendError(final int i, final String s) throws IOException {
setCode(i);
setStatusMessage(s);
}
@@ -227,7 +227,7 @@ public class HttpResponseImpl implements HttpResponse {
}
@Override
- public void setDateHeader(String s, long l) {
+ public void setDateHeader(final String s, final long l) {
addDateHeader(s, l);
}
@@ -281,7 +281,7 @@ public class HttpResponseImpl implements HttpResponse {
*
* @param code the code to be sent to the browser
*/
- public void setCode(int code) {
+ public void setCode(final int code) {
this.code = code;
commited = true;
}
@@ -300,12 +300,12 @@ public class HttpResponseImpl implements HttpResponse {
*
* @param type the type to be sent to the browser (i.e. "text/html")
*/
- public void setContentType(String type) {
+ public void setContentType(final String type) {
setHeader("Content-Type", type);
}
@Override
- public void setLocale(Locale loc) {
+ public void setLocale(final Locale loc) {
locale = loc;
}
@@ -328,7 +328,7 @@ public class HttpResponseImpl implements HttpResponse {
*
* @param responseString the response string
*/
- public void setResponseString(String responseString) {
+ public void setResponseString(final String responseString) {
this.responseString = responseString;
}
@@ -345,17 +345,17 @@ public class HttpResponseImpl implements HttpResponse {
}
@Override
- public void setBufferSize(int i) {
+ public void setBufferSize(final int i) {
// no-op
}
@Override
- public void setCharacterEncoding(String s) {
+ public void setCharacterEncoding(final String s) {
encoding = s;
}
@Override
- public void setContentLength(int i) {
+ public void setContentLength(final int i) {
// no-op
}
@@ -371,7 +371,7 @@ public class HttpResponseImpl implements HttpResponse {
* @param code the code to be sent to the browser
* @param responseString the response string to be sent to the browser
*/
- public void reset(int code, String responseString) {
+ public void reset(final int code, final String responseString) {
setCode(code);
setResponseString(responseString);
initBody();
@@ -396,7 +396,7 @@ public class HttpResponseImpl implements HttpResponse {
* @param responseString the response string to be sent back
* @param contentType the content type to be sent back
*/
- protected HttpResponseImpl(int code, String responseString, String contentType) {
+ protected HttpResponseImpl(final int code, final String responseString, final String contentType) {
this.responseString = responseString;
this.code = code;
@@ -421,7 +421,7 @@ public class HttpResponseImpl implements HttpResponse {
* @param output the output to send the response to
* @throws java.io.IOException if an exception is thrown
*/
- protected void writeMessage(OutputStream output, boolean indent) throws IOException {
+ protected void writeMessage(final OutputStream output, final boolean indent) throws IOException {
flushBuffer();
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
@@ -467,7 +467,7 @@ public class HttpResponseImpl implements HttpResponse {
if (content == null) {
writer.flush();
writer.close();
- int length = sosi.getOutputStream().toByteArray().length;
+ final int length = sosi.getOutputStream().toByteArray().length;
setHeader("Content-Length", length + "");
} else {
setHeader("Content-Length", content.getContentLength() + "");
@@ -497,7 +497,7 @@ public class HttpResponseImpl implements HttpResponse {
* @param out the output stream to write the response line to
* @throws java.io.IOException if an exception is thrown
*/
- private void writeResponseLine(DataOutput out) throws IOException {
+ private void writeResponseLine(final DataOutput out) throws IOException {
out.writeBytes(HTTP_VERSION);
out.writeBytes(SP);
out.writeBytes(code + "");
@@ -514,7 +514,7 @@ public class HttpResponseImpl implements HttpResponse {
* @param out the output stream to be sent to the browser
* @throws java.io.IOException if an exception is thrown
*/
- private void writeHeaders(DataOutput out) throws IOException {
+ private void writeHeaders(final DataOutput out) throws IOException {
for (final Map.Entry<String, String> entry : headers.entrySet()) {
out.writeBytes("" + entry.getKey());
out.writeBytes(CSP);
@@ -530,7 +530,7 @@ public class HttpResponseImpl implements HttpResponse {
* @param indent format xml
* @throws java.io.IOException if an exception is thrown
*/
- private void writeBody(DataOutput out, boolean indent) throws IOException {
+ private void writeBody(final DataOutput out, final boolean indent) throws IOException {
out.writeBytes(CRLF);
if (content == null) {
if (indent && OpenEJBHttpServer.isTextXml(headers)) {
@@ -540,8 +540,8 @@ public class HttpResponseImpl implements HttpResponse {
out.write(sosi.getOutputStream().toByteArray());
}
} else {
- InputStream in = content.getInputStream();
- byte buf[] = new byte[1024];
+ final InputStream in = content.getInputStream();
+ final byte[] buf = new byte[1024];
int i;
while ((i = in.read(buf)) != -1) {
@@ -572,7 +572,7 @@ public class HttpResponseImpl implements HttpResponse {
* @param message the error message to be sent
* @return the HttpResponseImpl that this error belongs to
*/
- protected static HttpResponseImpl createError(String message) {
+ protected static HttpResponseImpl createError(final String message) {
return createError(message, null);
}
@@ -583,12 +583,12 @@ public class HttpResponseImpl implements HttpResponse {
* @param t a Throwable to print a stack trace to
* @return the HttpResponseImpl that this error belongs to
*/
- protected static HttpResponseImpl createError(String message, Throwable t) {
- HttpResponseImpl res = new HttpResponseImpl(500, "Internal Server Error", "text/html");
+ protected static HttpResponseImpl createError(String message, final Throwable t) {
+ final HttpResponseImpl res = new HttpResponseImpl(500, "Internal Server Error", "text/html");
PrintWriter body = null;
try {
body = res.getWriter();
- } catch (IOException e) { // impossible normally
+ } catch (final IOException e) { // impossible normally
// no-op
}
@@ -602,7 +602,7 @@ public class HttpResponseImpl implements HttpResponse {
}
if (message != null) {
- StringTokenizer msg = new StringTokenizer(message, "\n\r");
+ final StringTokenizer msg = new StringTokenizer(message, "\n\r");
while (msg.hasMoreTokens()) {
body.print(msg.nextToken());
@@ -614,19 +614,19 @@ public class HttpResponseImpl implements HttpResponse {
try {
body.println("<br><br>");
body.println("Stack Trace:<br>");
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- PrintWriter writer = new PrintWriter(baos);
+ final ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ final PrintWriter writer = new PrintWriter(baos);
t.printStackTrace(writer);
writer.flush();
writer.close();
message = new String(baos.toByteArray());
- StringTokenizer msg = new StringTokenizer(message, "\n\r");
+ final StringTokenizer msg = new StringTokenizer(message, "\n\r");
while (msg.hasMoreTokens()) {
body.print(msg.nextToken());
body.println("<br>");
}
- } catch (Exception e) {
+ } catch (final Exception e) {
}
}
@@ -642,12 +642,12 @@ public class HttpResponseImpl implements HttpResponse {
* @param ip the ip that is forbidden
* @return the HttpResponseImpl that this error belongs to
*/
- protected static HttpResponseImpl createForbidden(String ip) {
- HttpResponseImpl res = new HttpResponseImpl(403, "Forbidden", "text/html");
+ protected static HttpResponseImpl createForbidden(final String ip) {
+ final HttpResponseImpl res = new HttpResponseImpl(403, "Forbidden", "text/html");
PrintWriter body = null;
try {
body = res.getWriter();
- } catch (IOException e) { // normally impossible
+ } catch (final IOException e) { // normally impossible
// no-op
}
@@ -670,7 +670,7 @@ public class HttpResponseImpl implements HttpResponse {
* @param out the ObjectOutputStream to write to
* @throws java.io.IOException if an exception is thrown
*/
- private void writeObject(java.io.ObjectOutputStream out) throws IOException {
+ private void writeObject(final java.io.ObjectOutputStream out) throws IOException {
/** Response string */
out.writeObject(responseString);
@@ -682,7 +682,7 @@ public class HttpResponseImpl implements HttpResponse {
/** Response body */
writer.flush();
- byte[] body = sosi.getOutputStream().toByteArray();
+ final byte[] body = sosi.getOutputStream().toByteArray();
//System.out.println("[] body "+body.length );
out.writeObject(body);
}
@@ -695,7 +695,7 @@ public class HttpResponseImpl implements HttpResponse {
* @throws ClassNotFoundException if an exception is thrown
*/
@SuppressWarnings({"unchecked"})
- private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {
+ private void readObject(final java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {
/** Response string */
this.responseString = (String) in.readObject();
@@ -703,12 +703,12 @@ public class HttpResponseImpl implements HttpResponse {
this.code = in.readInt();
/** Response headers */
- Map headers = (Map) in.readObject();
+ final Map headers = (Map) in.readObject();
this.headers.clear();
this.headers.putAll(headers);
/** Response body */
- byte[] body = (byte[]) in.readObject();
+ final byte[] body = (byte[]) in.readObject();
//System.out.println("[] body "+body.length );
sosi = new ServletByteArrayOutputStream();
sosi.write(body);
@@ -719,11 +719,11 @@ public class HttpResponseImpl implements HttpResponse {
/**
* @param content The content to set.
*/
- public void setContent(URLConnection content) {
+ public void setContent(final URLConnection content) {
this.content = content;
}
- public void setStatusMessage(String responseString) {
+ public void setStatusMessage(final String responseString) {
this.setResponseString(responseString);
}
[4/9] tomee git commit: Deps required after exclude Cannot use body
if getWriter fails
Posted by an...@apache.org.
Deps required after exclude
Cannot use body if getWriter fails
Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/87beb070
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/87beb070
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/87beb070
Branch: refs/heads/tomee-7.0.0-M1
Commit: 87beb070daf3421515a74ca51502e136422a92d2
Parents: cf2e113
Author: AndyGee <an...@gmx.de>
Authored: Thu Dec 3 03:33:54 2015 +0100
Committer: AndyGee <an...@gmx.de>
Committed: Thu Dec 3 03:33:54 2015 +0100
----------------------------------------------------------------------
container/openejb-core/pom.xml | 4 ++++
pom.xml | 2 +-
.../org/apache/openejb/server/httpd/HttpResponseImpl.java | 8 ++++----
3 files changed, 9 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tomee/blob/87beb070/container/openejb-core/pom.xml
----------------------------------------------------------------------
diff --git a/container/openejb-core/pom.xml b/container/openejb-core/pom.xml
index 3be1987..d133463 100644
--- a/container/openejb-core/pom.xml
+++ b/container/openejb-core/pom.xml
@@ -511,6 +511,10 @@
<groupId>commons-cli</groupId>
<artifactId>commons-cli</artifactId>
</dependency>
+ <dependency>
+ <groupId>commons-collections</groupId>
+ <artifactId>commons-collections</artifactId>
+ </dependency>
<!-- ActiveMQ -->
<dependency>
http://git-wip-us.apache.org/repos/asf/tomee/blob/87beb070/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index aaa2633..813b364 100644
--- a/pom.xml
+++ b/pom.xml
@@ -242,7 +242,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
- <version>3.2</version>
+ <version>3.3</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
http://git-wip-us.apache.org/repos/asf/tomee/blob/87beb070/server/openejb-http/src/main/java/org/apache/openejb/server/httpd/HttpResponseImpl.java
----------------------------------------------------------------------
diff --git a/server/openejb-http/src/main/java/org/apache/openejb/server/httpd/HttpResponseImpl.java b/server/openejb-http/src/main/java/org/apache/openejb/server/httpd/HttpResponseImpl.java
index cb73dcf..f33ad34 100644
--- a/server/openejb-http/src/main/java/org/apache/openejb/server/httpd/HttpResponseImpl.java
+++ b/server/openejb-http/src/main/java/org/apache/openejb/server/httpd/HttpResponseImpl.java
@@ -585,11 +585,11 @@ public class HttpResponseImpl implements HttpResponse {
*/
protected static HttpResponseImpl createError(String message, final Throwable t) {
final HttpResponseImpl res = new HttpResponseImpl(500, "Internal Server Error", "text/html");
- PrintWriter body = null;
+ final PrintWriter body;
try {
body = res.getWriter();
} catch (final IOException e) { // impossible normally
- // no-op
+ return res;
}
body.println("<html>");
@@ -644,11 +644,11 @@ public class HttpResponseImpl implements HttpResponse {
*/
protected static HttpResponseImpl createForbidden(final String ip) {
final HttpResponseImpl res = new HttpResponseImpl(403, "Forbidden", "text/html");
- PrintWriter body = null;
+ final PrintWriter body;
try {
body = res.getWriter();
} catch (final IOException e) { // normally impossible
- // no-op
+ return res;
}
body.println("<html>");
[9/9] tomee git commit: Merge branch 'master' into tomee-7.0.0-M1
Posted by an...@apache.org.
Merge branch 'master' into tomee-7.0.0-M1
Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/93921cbd
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/93921cbd
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/93921cbd
Branch: refs/heads/tomee-7.0.0-M1
Commit: 93921cbdf8d791fe50196103b9a5d48c1fce2866
Parents: 439eb9a a415f3e
Author: AndyGee <an...@gmx.de>
Authored: Thu Dec 3 04:36:13 2015 +0100
Committer: AndyGee <an...@gmx.de>
Committed: Thu Dec 3 04:36:13 2015 +0100
----------------------------------------------------------------------
container/openejb-core/pom.xml | 4 +
.../openejb/core/ObjectInputStreamFiltered.java | 39 ++++++
.../openejb/core/managed/SimplePassivater.java | 3 +-
.../core/rmi/BlacklistClassResolver.java | 9 +-
.../openejb/monitoring/LocalMBeanServer.java | 2 +-
.../logging/LoggingPreparedSqlStatement.java | 4 +-
.../java/org/apache/openejb/spi/Serializer.java | 39 ++++--
.../timer/EjbTimerImplSerializableTest.java | 3 +-
...ionOfTransactionRolledBackExceptionTest.java | 3 +-
.../openejb/util/PojoExternalizationTest.java | 5 +-
.../openejb/util/PojoSerializationTest.java | 5 +-
.../proxy/LocalBeanProxySerializationTest.java | 3 +-
.../proxy/LocalReferenceSerializationTest.java | 3 +-
itests/openejb-itests-beans/pom.xml | 2 +-
pom.xml | 2 +-
.../openejb/server/httpd/HttpResponseImpl.java | 138 ++++++++++---------
.../tck/cdi/tomee/embedded/BeansImpl.java | 15 +-
17 files changed, 183 insertions(+), 96 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tomee/blob/93921cbd/container/openejb-core/pom.xml
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tomee/blob/93921cbd/itests/openejb-itests-beans/pom.xml
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tomee/blob/93921cbd/pom.xml
----------------------------------------------------------------------
[7/9] tomee git commit: Use ObjectInputStreamFiltered
Posted by an...@apache.org.
Use ObjectInputStreamFiltered
Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/eb507494
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/eb507494
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/eb507494
Branch: refs/heads/tomee-7.0.0-M1
Commit: eb5074943832b2b9ad410a25f2d38b352eb24f23
Parents: a7a915f
Author: AndyGee <an...@gmx.de>
Authored: Thu Dec 3 04:11:13 2015 +0100
Committer: AndyGee <an...@gmx.de>
Committed: Thu Dec 3 04:11:13 2015 +0100
----------------------------------------------------------------------
.../org/apache/openejb/timer/EjbTimerImplSerializableTest.java | 3 ++-
.../SerializationOfTransactionRolledBackExceptionTest.java | 3 ++-
.../java/org/apache/openejb/util/PojoExternalizationTest.java | 5 +++--
.../java/org/apache/openejb/util/PojoSerializationTest.java | 5 +++--
.../openejb/util/proxy/LocalBeanProxySerializationTest.java | 3 ++-
.../openejb/util/proxy/LocalReferenceSerializationTest.java | 3 ++-
6 files changed, 14 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tomee/blob/eb507494/container/openejb-core/src/test/java/org/apache/openejb/timer/EjbTimerImplSerializableTest.java
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/test/java/org/apache/openejb/timer/EjbTimerImplSerializableTest.java b/container/openejb-core/src/test/java/org/apache/openejb/timer/EjbTimerImplSerializableTest.java
index b0a951d..daabbc5 100644
--- a/container/openejb-core/src/test/java/org/apache/openejb/timer/EjbTimerImplSerializableTest.java
+++ b/container/openejb-core/src/test/java/org/apache/openejb/timer/EjbTimerImplSerializableTest.java
@@ -18,6 +18,7 @@ package org.apache.openejb.timer;
import org.apache.openejb.BeanContext;
import org.apache.openejb.MethodContext;
+import org.apache.openejb.core.ObjectInputStreamFiltered;
import org.apache.openejb.core.timer.CalendarTimerData;
import org.apache.openejb.core.timer.EjbTimeoutJob;
import org.apache.openejb.core.timer.EjbTimerService;
@@ -113,7 +114,7 @@ public class EjbTimerImplSerializableTest {
private static Object deserialize(final byte[] serial) throws Exception {
final ByteArrayInputStream bais = new ByteArrayInputStream(serial);
- final ObjectInputStream ois = new ObjectInputStream(bais);
+ final ObjectInputStream ois = new ObjectInputStreamFiltered(bais);
return ois.readObject();
}
http://git-wip-us.apache.org/repos/asf/tomee/blob/eb507494/container/openejb-core/src/test/java/org/apache/openejb/transaction/SerializationOfTransactionRolledBackExceptionTest.java
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/test/java/org/apache/openejb/transaction/SerializationOfTransactionRolledBackExceptionTest.java b/container/openejb-core/src/test/java/org/apache/openejb/transaction/SerializationOfTransactionRolledBackExceptionTest.java
index 369a494..c6a2d98 100644
--- a/container/openejb-core/src/test/java/org/apache/openejb/transaction/SerializationOfTransactionRolledBackExceptionTest.java
+++ b/container/openejb-core/src/test/java/org/apache/openejb/transaction/SerializationOfTransactionRolledBackExceptionTest.java
@@ -16,6 +16,7 @@
*/
package org.apache.openejb.transaction;
+import org.apache.openejb.core.ObjectInputStreamFiltered;
import org.junit.Test;
import javax.transaction.TransactionRolledbackException;
@@ -42,7 +43,7 @@ public class SerializationOfTransactionRolledBackExceptionTest {
private static Object deserialize(final byte[] serial) throws Exception {
final ByteArrayInputStream bais = new ByteArrayInputStream(serial);
- final ObjectInputStream ois = new ObjectInputStream(bais);
+ final ObjectInputStream ois = new ObjectInputStreamFiltered(bais);
return ois.readObject();
}
http://git-wip-us.apache.org/repos/asf/tomee/blob/eb507494/container/openejb-core/src/test/java/org/apache/openejb/util/PojoExternalizationTest.java
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/test/java/org/apache/openejb/util/PojoExternalizationTest.java b/container/openejb-core/src/test/java/org/apache/openejb/util/PojoExternalizationTest.java
index e8b49ab..a269a50 100644
--- a/container/openejb-core/src/test/java/org/apache/openejb/util/PojoExternalizationTest.java
+++ b/container/openejb-core/src/test/java/org/apache/openejb/util/PojoExternalizationTest.java
@@ -17,6 +17,7 @@
package org.apache.openejb.util;
import junit.framework.TestCase;
+import org.apache.openejb.core.ObjectInputStreamFiltered;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
@@ -47,7 +48,7 @@ public class PojoExternalizationTest extends TestCase {
out.close();
final ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
- final ObjectInputStream in = new ObjectInputStream(bais);
+ final ObjectInputStream in = new ObjectInputStreamFiltered(bais);
for (int i = count; i > 0; i--) {
final Green actual = (Green) in.readObject();
@@ -69,7 +70,7 @@ public class PojoExternalizationTest extends TestCase {
out.close();
final ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
- final ObjectInputStream in = new ObjectInputStream(bais);
+ final ObjectInputStream in = new ObjectInputStreamFiltered(bais);
final Green actual = (Green) in.readObject();
assertEquals(green, actual);
http://git-wip-us.apache.org/repos/asf/tomee/blob/eb507494/container/openejb-core/src/test/java/org/apache/openejb/util/PojoSerializationTest.java
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/test/java/org/apache/openejb/util/PojoSerializationTest.java b/container/openejb-core/src/test/java/org/apache/openejb/util/PojoSerializationTest.java
index 6603a74..a661498 100644
--- a/container/openejb-core/src/test/java/org/apache/openejb/util/PojoSerializationTest.java
+++ b/container/openejb-core/src/test/java/org/apache/openejb/util/PojoSerializationTest.java
@@ -17,6 +17,7 @@
package org.apache.openejb.util;
import junit.framework.TestCase;
+import org.apache.openejb.core.ObjectInputStreamFiltered;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
@@ -47,7 +48,7 @@ public class PojoSerializationTest extends TestCase {
out.close();
final ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
- final ObjectInputStream in = new ObjectInputStream(bais);
+ final ObjectInputStream in = new ObjectInputStreamFiltered(bais);
for (int i = count; i > 0; i--) {
final Green actual = (Green) in.readObject();
@@ -69,7 +70,7 @@ public class PojoSerializationTest extends TestCase {
out.close();
final ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
- final ObjectInputStream in = new ObjectInputStream(bais);
+ final ObjectInputStream in = new ObjectInputStreamFiltered(bais);
final Green actual = (Green) in.readObject();
assertEquals(green, actual);
http://git-wip-us.apache.org/repos/asf/tomee/blob/eb507494/container/openejb-core/src/test/java/org/apache/openejb/util/proxy/LocalBeanProxySerializationTest.java
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/test/java/org/apache/openejb/util/proxy/LocalBeanProxySerializationTest.java b/container/openejb-core/src/test/java/org/apache/openejb/util/proxy/LocalBeanProxySerializationTest.java
index 27a6eda..35cd691 100644
--- a/container/openejb-core/src/test/java/org/apache/openejb/util/proxy/LocalBeanProxySerializationTest.java
+++ b/container/openejb-core/src/test/java/org/apache/openejb/util/proxy/LocalBeanProxySerializationTest.java
@@ -17,6 +17,7 @@
package org.apache.openejb.util.proxy;
+import org.apache.openejb.core.ObjectInputStreamFiltered;
import org.apache.openejb.jee.Empty;
import org.apache.openejb.jee.StatelessBean;
import org.apache.openejb.junit.ApplicationComposer;
@@ -54,7 +55,7 @@ public class LocalBeanProxySerializationTest {
oos.writeObject(bean);
final ByteArrayInputStream bis = new ByteArrayInputStream(baos.toByteArray());
- final ObjectInputStream ois = new ObjectInputStream(bis);
+ final ObjectInputStream ois = new ObjectInputStreamFiltered(bis);
final SampleLocalBean deserialized = (SampleLocalBean) ois.readObject();
assertEquals(5, deserialized.add(2, 3));
}
http://git-wip-us.apache.org/repos/asf/tomee/blob/eb507494/container/openejb-core/src/test/java/org/apache/openejb/util/proxy/LocalReferenceSerializationTest.java
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/test/java/org/apache/openejb/util/proxy/LocalReferenceSerializationTest.java b/container/openejb-core/src/test/java/org/apache/openejb/util/proxy/LocalReferenceSerializationTest.java
index 0b3acc9..0167d81 100644
--- a/container/openejb-core/src/test/java/org/apache/openejb/util/proxy/LocalReferenceSerializationTest.java
+++ b/container/openejb-core/src/test/java/org/apache/openejb/util/proxy/LocalReferenceSerializationTest.java
@@ -18,6 +18,7 @@
package org.apache.openejb.util.proxy;
import org.apache.openejb.ProxyInfo;
+import org.apache.openejb.core.ObjectInputStreamFiltered;
import org.apache.openejb.core.ServerFederation;
import org.apache.openejb.jee.EjbJar;
import org.apache.openejb.jee.StatelessBean;
@@ -102,7 +103,7 @@ public class LocalReferenceSerializationTest {
oos.writeObject(bean);
final ByteArrayInputStream bis = new ByteArrayInputStream(baos.toByteArray());
- final ObjectInputStream ois = new ObjectInputStream(bis);
+ final ObjectInputStream ois = new ObjectInputStreamFiltered(bis);
return (T) ois.readObject();
}
[5/9] tomee git commit: Close printwriter properly
Posted by an...@apache.org.
Close printwriter properly
Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/e6dabe14
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/e6dabe14
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/e6dabe14
Branch: refs/heads/tomee-7.0.0-M1
Commit: e6dabe142d5f4ad21c098342102dd3acad58489f
Parents: 87beb07
Author: AndyGee <an...@gmx.de>
Authored: Thu Dec 3 03:38:15 2015 +0100
Committer: AndyGee <an...@gmx.de>
Committed: Thu Dec 3 03:38:15 2015 +0100
----------------------------------------------------------------------
.../openejb/server/httpd/HttpResponseImpl.java | 20 +++++++++++++++-----
1 file changed, 15 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tomee/blob/e6dabe14/server/openejb-http/src/main/java/org/apache/openejb/server/httpd/HttpResponseImpl.java
----------------------------------------------------------------------
diff --git a/server/openejb-http/src/main/java/org/apache/openejb/server/httpd/HttpResponseImpl.java b/server/openejb-http/src/main/java/org/apache/openejb/server/httpd/HttpResponseImpl.java
index f33ad34..2229a42 100644
--- a/server/openejb-http/src/main/java/org/apache/openejb/server/httpd/HttpResponseImpl.java
+++ b/server/openejb-http/src/main/java/org/apache/openejb/server/httpd/HttpResponseImpl.java
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -572,6 +572,7 @@ public class HttpResponseImpl implements HttpResponse {
* @param message the error message to be sent
* @return the HttpResponseImpl that this error belongs to
*/
+ @SuppressWarnings("unused")
protected static HttpResponseImpl createError(final String message) {
return createError(message, null);
}
@@ -611,14 +612,17 @@ public class HttpResponseImpl implements HttpResponse {
}
if (t != null) {
+
+ PrintWriter writer = null;
+
try {
body.println("<br><br>");
body.println("Stack Trace:<br>");
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
- final PrintWriter writer = new PrintWriter(baos);
+ writer = new PrintWriter(baos);
t.printStackTrace(writer);
writer.flush();
- writer.close();
+
message = new String(baos.toByteArray());
final StringTokenizer msg = new StringTokenizer(message, "\n\r");
@@ -627,6 +631,11 @@ public class HttpResponseImpl implements HttpResponse {
body.println("<br>");
}
} catch (final Exception e) {
+ //no-op
+ } finally {
+ if (writer != null) {
+ writer.close();
+ }
}
}
@@ -642,6 +651,7 @@ public class HttpResponseImpl implements HttpResponse {
* @param ip the ip that is forbidden
* @return the HttpResponseImpl that this error belongs to
*/
+ @SuppressWarnings("unused")
protected static HttpResponseImpl createForbidden(final String ip) {
final HttpResponseImpl res = new HttpResponseImpl(403, "Forbidden", "text/html");
final PrintWriter body;
[6/9] tomee git commit: Use ObjectInputStreamFiltered
Posted by an...@apache.org.
Use ObjectInputStreamFiltered
Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/a7a915f3
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/a7a915f3
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/a7a915f3
Branch: refs/heads/tomee-7.0.0-M1
Commit: a7a915f369c825aad6f5086ef57bd9012f3163f7
Parents: e6dabe1
Author: AndyGee <an...@gmx.de>
Authored: Thu Dec 3 04:07:38 2015 +0100
Committer: AndyGee <an...@gmx.de>
Committed: Thu Dec 3 04:07:38 2015 +0100
----------------------------------------------------------------------
.../openejb/core/ObjectInputStreamFiltered.java | 39 ++++++++++++++++++++
.../openejb/core/managed/SimplePassivater.java | 3 +-
.../core/rmi/BlacklistClassResolver.java | 9 ++++-
.../logging/LoggingPreparedSqlStatement.java | 4 +-
.../java/org/apache/openejb/spi/Serializer.java | 39 +++++++++++++++-----
.../tck/cdi/tomee/embedded/BeansImpl.java | 15 ++++----
6 files changed, 88 insertions(+), 21 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tomee/blob/a7a915f3/container/openejb-core/src/main/java/org/apache/openejb/core/ObjectInputStreamFiltered.java
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/main/java/org/apache/openejb/core/ObjectInputStreamFiltered.java b/container/openejb-core/src/main/java/org/apache/openejb/core/ObjectInputStreamFiltered.java
new file mode 100644
index 0000000..8af39a6
--- /dev/null
+++ b/container/openejb-core/src/main/java/org/apache/openejb/core/ObjectInputStreamFiltered.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.openejb.core;
+
+import org.apache.openejb.core.rmi.BlacklistClassResolver;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectStreamClass;
+
+/**
+ * Ensures blacklisted classes cannot be loaded
+ */
+public class ObjectInputStreamFiltered extends ObjectInputStream {
+
+ public ObjectInputStreamFiltered(final InputStream in) throws IOException {
+ super(in);
+ }
+
+ @Override
+ protected Class resolveClass(final ObjectStreamClass classDesc) throws IOException, ClassNotFoundException {
+ return super.resolveClass(BlacklistClassResolver.DEFAULT.check(classDesc));
+ }
+}
http://git-wip-us.apache.org/repos/asf/tomee/blob/a7a915f3/container/openejb-core/src/main/java/org/apache/openejb/core/managed/SimplePassivater.java
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/main/java/org/apache/openejb/core/managed/SimplePassivater.java b/container/openejb-core/src/main/java/org/apache/openejb/core/managed/SimplePassivater.java
index b0947ee..8360a16 100644
--- a/container/openejb-core/src/main/java/org/apache/openejb/core/managed/SimplePassivater.java
+++ b/container/openejb-core/src/main/java/org/apache/openejb/core/managed/SimplePassivater.java
@@ -19,6 +19,7 @@ package org.apache.openejb.core.managed;
import org.apache.openejb.SystemException;
import org.apache.openejb.core.EnvProps;
+import org.apache.openejb.core.ObjectInputStreamFiltered;
import org.apache.openejb.loader.IO;
import org.apache.openejb.loader.SystemInstance;
import org.apache.openejb.util.LogCategory;
@@ -107,7 +108,7 @@ public class SimplePassivater implements PassivationStrategy {
if (sessionFile.exists()) {
logger.info("Activating from file " + sessionFile);
- final ObjectInputStream ois = new ObjectInputStream(IO.read(sessionFile));
+ final ObjectInputStream ois = new ObjectInputStreamFiltered(IO.read(sessionFile));
final Object state = ois.readObject();
ois.close();
if (!sessionFile.delete()) {
http://git-wip-us.apache.org/repos/asf/tomee/blob/a7a915f3/container/openejb-core/src/main/java/org/apache/openejb/core/rmi/BlacklistClassResolver.java
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/main/java/org/apache/openejb/core/rmi/BlacklistClassResolver.java b/container/openejb-core/src/main/java/org/apache/openejb/core/rmi/BlacklistClassResolver.java
index 4ca5299..0d3b994 100644
--- a/container/openejb-core/src/main/java/org/apache/openejb/core/rmi/BlacklistClassResolver.java
+++ b/container/openejb-core/src/main/java/org/apache/openejb/core/rmi/BlacklistClassResolver.java
@@ -16,6 +16,8 @@
*/
package org.apache.openejb.core.rmi;
+import java.io.ObjectStreamClass;
+
public class BlacklistClassResolver {
public static final BlacklistClassResolver DEFAULT = new BlacklistClassResolver(
toArray(System.getProperty(
@@ -35,6 +37,11 @@ public class BlacklistClassResolver {
return (whitelist != null && !contains(whitelist, name)) || contains(blacklist, name);
}
+ public final ObjectStreamClass check(final ObjectStreamClass classDesc) {
+ check(classDesc.getName());
+ return classDesc;
+ }
+
public final String check(final String name) {
if (isBlacklisted(name)) {
throw new SecurityException(name + " is not whitelisted as deserialisable, prevented before loading.");
@@ -46,7 +53,7 @@ public class BlacklistClassResolver {
return property == null ? null : property.split(" *, *");
}
- private static boolean contains(final String[] list, String name) {
+ private static boolean contains(final String[] list, final String name) {
if (list != null) {
for (final String white : list) {
if (name.startsWith(white)) {
http://git-wip-us.apache.org/repos/asf/tomee/blob/a7a915f3/container/openejb-core/src/main/java/org/apache/openejb/resource/jdbc/logging/LoggingPreparedSqlStatement.java
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/main/java/org/apache/openejb/resource/jdbc/logging/LoggingPreparedSqlStatement.java b/container/openejb-core/src/main/java/org/apache/openejb/resource/jdbc/logging/LoggingPreparedSqlStatement.java
index 242d6b8..9b78d3f 100644
--- a/container/openejb-core/src/main/java/org/apache/openejb/resource/jdbc/logging/LoggingPreparedSqlStatement.java
+++ b/container/openejb-core/src/main/java/org/apache/openejb/resource/jdbc/logging/LoggingPreparedSqlStatement.java
@@ -17,12 +17,12 @@
package org.apache.openejb.resource.jdbc.logging;
+import org.apache.openejb.core.ObjectInputStreamFiltered;
import org.apache.openejb.util.Join;
import org.apache.openejb.util.LogCategory;
import org.apache.openejb.util.Logger;
import java.io.ByteArrayInputStream;
-import java.io.ObjectInputStream;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.sql.ParameterMetaData;
@@ -88,7 +88,7 @@ public class LoggingPreparedSqlStatement implements InvocationHandler {
final ByteArrayInputStream bais = ByteArrayInputStream.class.cast(param.value);
try {
bais.reset(); // already read when arriving here - mainly openjpa case
- val = new ObjectInputStream(bais).readObject().toString();
+ val = new ObjectInputStreamFiltered(bais).readObject().toString();
} catch (final Exception e) {
val = param.value.toString();
}
http://git-wip-us.apache.org/repos/asf/tomee/blob/a7a915f3/container/openejb-core/src/main/java/org/apache/openejb/spi/Serializer.java
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/main/java/org/apache/openejb/spi/Serializer.java b/container/openejb-core/src/main/java/org/apache/openejb/spi/Serializer.java
index 4e412bb..d176387 100644
--- a/container/openejb-core/src/main/java/org/apache/openejb/spi/Serializer.java
+++ b/container/openejb-core/src/main/java/org/apache/openejb/spi/Serializer.java
@@ -14,9 +14,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.apache.openejb.spi;
+import org.apache.openejb.core.ObjectInputStreamFiltered;
+
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
@@ -26,18 +27,36 @@ import java.io.ObjectOutputStream;
public class Serializer {
public static Object deserialize(final byte[] bytes)
- throws IOException, ClassNotFoundException {
- final ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
- final ObjectInputStream ois = new ObjectInputStream(bais);
- return ois.readObject();
+ throws IOException, ClassNotFoundException {
+
+ ObjectInputStream ois = null;
+
+ try {
+ final ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
+ ois = new ObjectInputStreamFiltered(bais);
+ return ois.readObject();
+ } finally {
+ if (ois != null) {
+ ois.close();
+ }
+ }
}
public static byte[] serialize(final Object object) throws IOException {
- final ByteArrayOutputStream baos = new ByteArrayOutputStream();
- final ObjectOutputStream oos = new ObjectOutputStream(baos);
- oos.writeObject(object);
- oos.flush();
- return baos.toByteArray();
+
+ ObjectOutputStream oos = null;
+
+ try {
+ final ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ oos = new ObjectOutputStream(baos);
+ oos.writeObject(object);
+ oos.flush();
+ return baos.toByteArray();
+ } finally {
+ if (oos != null) {
+ oos.close();
+ }
+ }
}
}
http://git-wip-us.apache.org/repos/asf/tomee/blob/a7a915f3/tck/cdi-tomee-embedded/src/main/java/org/apache/openejb/tck/cdi/tomee/embedded/BeansImpl.java
----------------------------------------------------------------------
diff --git a/tck/cdi-tomee-embedded/src/main/java/org/apache/openejb/tck/cdi/tomee/embedded/BeansImpl.java b/tck/cdi-tomee-embedded/src/main/java/org/apache/openejb/tck/cdi/tomee/embedded/BeansImpl.java
index a3d4a66..4b6b27c 100644
--- a/tck/cdi-tomee-embedded/src/main/java/org/apache/openejb/tck/cdi/tomee/embedded/BeansImpl.java
+++ b/tck/cdi-tomee-embedded/src/main/java/org/apache/openejb/tck/cdi/tomee/embedded/BeansImpl.java
@@ -16,6 +16,7 @@
*/
package org.apache.openejb.tck.cdi.tomee.embedded;
+import org.apache.openejb.core.ObjectInputStreamFiltered;
import org.apache.openejb.core.ivm.IntraVmCopyMonitor;
import org.apache.openejb.core.ivm.IntraVmProxy;
@@ -30,17 +31,17 @@ import java.io.ObjectOutputStream;
*/
public class BeansImpl implements org.jboss.jsr299.tck.spi.Beans {
- public boolean isProxy(Object instance) {
+ public boolean isProxy(final Object instance) {
System.out.println("isProxy: " + instance);
return instance instanceof IntraVmProxy || instance.getClass().getName().contains("$Owb");
}
@Override
- public byte[] serialize(Object instance) throws IOException {
+ public byte[] serialize(final Object instance) throws IOException {
IntraVmCopyMonitor.prePassivationOperation();
try {
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- ObjectOutputStream os = new ObjectOutputStream(baos);
+ final ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ final ObjectOutputStream os = new ObjectOutputStream(baos);
os.writeObject(instance);
os.flush();
return baos.toByteArray();
@@ -50,9 +51,9 @@ public class BeansImpl implements org.jboss.jsr299.tck.spi.Beans {
}
@Override
- public Object deserialize(byte[] bytes) throws IOException, ClassNotFoundException {
- ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
- ObjectInputStream is = new ObjectInputStream(bais);
+ public Object deserialize(final byte[] bytes) throws IOException, ClassNotFoundException {
+ final ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
+ final ObjectInputStream is = new ObjectInputStreamFiltered(bais);
return is.readObject();
}
}