logging-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mattsic...@apache.org
Subject svn commit: r1585242 - in /logging/log4j/log4j2/trunk/log4j-plugin-processor/src: main/java/org/apache/logging/log4j/core/config/plugins/processor/ test/java/org/apache/logging/log4j/core/config/plugins/processor/
Date Sun, 06 Apr 2014 04:06:27 GMT
Author: mattsicker
Date: Sun Apr  6 04:06:27 2014
New Revision: 1585242

URL: http://svn.apache.org/r1585242
Log:
Fix log4j2plugins.dat file format incompatibility.

  - Turns out that DataOutputStream and ObjectOutputStream are 
  different!

Modified:
    logging/log4j/log4j2/trunk/log4j-plugin-processor/src/main/java/org/apache/logging/log4j/core/config/plugins/processor/PluginProcessor.java
    logging/log4j/log4j2/trunk/log4j-plugin-processor/src/test/java/org/apache/logging/log4j/core/config/plugins/processor/PluginProcessorTest.java

Modified: logging/log4j/log4j2/trunk/log4j-plugin-processor/src/main/java/org/apache/logging/log4j/core/config/plugins/processor/PluginProcessor.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-plugin-processor/src/main/java/org/apache/logging/log4j/core/config/plugins/processor/PluginProcessor.java?rev=1585242&r1=1585241&r2=1585242&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-plugin-processor/src/main/java/org/apache/logging/log4j/core/config/plugins/processor/PluginProcessor.java
(original)
+++ logging/log4j/log4j2/trunk/log4j-plugin-processor/src/main/java/org/apache/logging/log4j/core/config/plugins/processor/PluginProcessor.java
Sun Apr  6 04:06:27 2014
@@ -18,9 +18,8 @@
 package org.apache.logging.log4j.core.config.plugins.processor;
 
 import java.io.BufferedOutputStream;
+import java.io.DataOutputStream;
 import java.io.IOException;
-import java.io.ObjectOutput;
-import java.io.ObjectOutputStream;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
@@ -104,7 +103,7 @@ public class PluginProcessor extends Abs
 
     private void writeCacheFile(final Element... elements) throws IOException {
         final FileObject fo = processingEnv.getFiler().createResource(CLASS_OUTPUT, PLUGINS_PACKAGE_NAME,
FILENAME, elements);
-        final ObjectOutput out = new ObjectOutputStream(new BufferedOutputStream(fo.openOutputStream()));
+        final DataOutputStream out = new DataOutputStream(new BufferedOutputStream(fo.openOutputStream()));
         try {
             out.writeInt(pluginCategories.size());
             for (final Map.Entry<String, ConcurrentMap<String, PluginEntry>>
category : pluginCategories.entrySet()) {
@@ -113,8 +112,6 @@ public class PluginProcessor extends Abs
                 out.writeInt(m.size());
                 for (final Map.Entry<String, PluginEntry> entry : m.entrySet()) {
                     final PluginEntry plugin = entry.getValue();
-                    // TODO: would this work? or do we need to override the writeObject(ObjectOutputStream)
method?
-                    //out.writeObject(plugin);
                     out.writeUTF(plugin.getKey());
                     out.writeUTF(plugin.getClassName());
                     out.writeUTF(plugin.getName());

Modified: logging/log4j/log4j2/trunk/log4j-plugin-processor/src/test/java/org/apache/logging/log4j/core/config/plugins/processor/PluginProcessorTest.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-plugin-processor/src/test/java/org/apache/logging/log4j/core/config/plugins/processor/PluginProcessorTest.java?rev=1585242&r1=1585241&r2=1585242&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-plugin-processor/src/test/java/org/apache/logging/log4j/core/config/plugins/processor/PluginProcessorTest.java
(original)
+++ logging/log4j/log4j2/trunk/log4j-plugin-processor/src/test/java/org/apache/logging/log4j/core/config/plugins/processor/PluginProcessorTest.java
Sun Apr  6 04:06:27 2014
@@ -18,8 +18,7 @@
 package org.apache.logging.log4j.core.config.plugins.processor;
 
 import java.io.BufferedInputStream;
-import java.io.ObjectInput;
-import java.io.ObjectInputStream;
+import java.io.DataInputStream;
 import java.net.URL;
 import java.util.Enumeration;
 import java.util.concurrent.ConcurrentHashMap;
@@ -51,7 +50,7 @@ public class PluginProcessorTest {
         final Enumeration<URL> resources = PluginProcessor.class.getClassLoader().getResources(CACHE_FILE);
         while (resources.hasMoreElements()) {
             final URL url = resources.nextElement();
-            final ObjectInput in = new ObjectInputStream(new BufferedInputStream(url.openStream()));
+            final DataInputStream in = new DataInputStream(new BufferedInputStream(url.openStream()));
             try {
                 final int count = in.readInt();
                 for (int i = 0; i < count; i++) {



Mime
View raw message