Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorslewis2018-10-12 15:35:39 -0400
committerslewis2018-10-12 15:35:39 -0400
commit5ebd0b5b0e2e8f17886b62337e7e9065dafb72ce (patch)
treea8eb8f7c686b8c7c0002b98350705f809359be19 /framework
parent845fb7356c86d76235f647d1a171bc4b3682a875 (diff)
downloadorg.eclipse.ecf-5ebd0b5b0e2e8f17886b62337e7e9065dafb72ce.tar.gz
org.eclipse.ecf-5ebd0b5b0e2e8f17886b62337e7e9065dafb72ce.tar.xz
org.eclipse.ecf-5ebd0b5b0e2e8f17886b62337e7e9065dafb72ce.zip
Fix for bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=540082
Diffstat (limited to 'framework')
-rw-r--r--framework/bundles/org.eclipse.ecf/META-INF/MANIFEST.MF2
-rw-r--r--framework/bundles/org.eclipse.ecf/pom.xml2
-rw-r--r--framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/util/OSGIObjectInputStream.java31
-rw-r--r--framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/util/OSGIObjectOutputStream.java21
4 files changed, 17 insertions, 39 deletions
diff --git a/framework/bundles/org.eclipse.ecf/META-INF/MANIFEST.MF b/framework/bundles/org.eclipse.ecf/META-INF/MANIFEST.MF
index 24ab73dda..9a25cf6a0 100644
--- a/framework/bundles/org.eclipse.ecf/META-INF/MANIFEST.MF
+++ b/framework/bundles/org.eclipse.ecf/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-Name: %plugin.name
Bundle-SymbolicName: org.eclipse.ecf;singleton:=true
Automatic-Module-Name: org.eclipse.ecf
-Bundle-Version: 3.9.2.qualifier
+Bundle-Version: 3.9.3.qualifier
Bundle-Activator: org.eclipse.ecf.internal.core.ECFPlugin
Bundle-Vendor: %plugin.provider
Bundle-Localization: plugin
diff --git a/framework/bundles/org.eclipse.ecf/pom.xml b/framework/bundles/org.eclipse.ecf/pom.xml
index 8b20f70c7..7aa20adb0 100644
--- a/framework/bundles/org.eclipse.ecf/pom.xml
+++ b/framework/bundles/org.eclipse.ecf/pom.xml
@@ -10,6 +10,6 @@
</parent>
<groupId>org.eclipse.ecf</groupId>
<artifactId>org.eclipse.ecf</artifactId>
- <version>3.9.2-SNAPSHOT</version>
+ <version>3.10.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
diff --git a/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/util/OSGIObjectInputStream.java b/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/util/OSGIObjectInputStream.java
index fea2887e9..1d0c70293 100644
--- a/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/util/OSGIObjectInputStream.java
+++ b/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/util/OSGIObjectInputStream.java
@@ -39,6 +39,7 @@ public class OSGIObjectInputStream extends ObjectInputStream implements OSGIObje
this.logger = log;
}
+ @SuppressWarnings("deprecation")
protected void trace(String message) {
LogService ls = this.logger;
if (ls != null) {
@@ -156,7 +157,7 @@ public class OSGIObjectInputStream extends ObjectInputStream implements OSGIObje
itr.add(readObjectOverride());
return itr;
case C_EXTER : // Externalizable
- return readExternalizable();
+ return in.readObject();
case C_STRING : // String
trace("readString"); //$NON-NLS-1$
return in.readUTF();
@@ -221,26 +222,8 @@ public class OSGIObjectInputStream extends ObjectInputStream implements OSGIObje
return result;
}
- private Object createInstance(ObjectStreamClass osc) throws IOException {
- try {
- Method m = osc.getClass().getDeclaredMethod("newInstance", (Class<?>[]) null); //$NON-NLS-1$
- m.setAccessible(true);
- return m.invoke(osc, (Object[]) null);
- } catch (Exception e) {
- IOException t = new IOException("Exception creating newInstance of class=" + osc.getName()); //$NON-NLS-1$
- t.setStackTrace(e.getStackTrace());
- throw t;
- }
- }
-
protected Object readExternalizable() throws ClassNotFoundException, IOException {
- final String clazzName = in.readUTF();
- trace("readExternalizable " + clazzName); //$NON-NLS-1$
- Class<?> clazz = loadClass(clazzName);
- Object inst = createInstance(clazz);
- Externalizable ex = (Externalizable) inst;
- ex.readExternal(this);
- return inst;
+ return in.readObject();
}
protected Object readFields(Class<?> clazz, Object inst) throws IOException {
@@ -288,13 +271,7 @@ public class OSGIObjectInputStream extends ObjectInputStream implements OSGIObje
}
protected Object readSerializedObject() throws IOException, ClassNotFoundException {
- // read object stream class
- ObjectStreamClass osc = (ObjectStreamClass) in.readObject();
- trace("readSerializedObject " + osc.getName()); //$NON-NLS-1$
- Class<?> clazz = osc.forClass();
- // create instance
- final Object instance = createInstance(osc);
- return readFields(clazz, instance);
+ return in.readObject();
}
/**
diff --git a/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/util/OSGIObjectOutputStream.java b/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/util/OSGIObjectOutputStream.java
index f363c2aa2..25324866a 100644
--- a/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/util/OSGIObjectOutputStream.java
+++ b/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/util/OSGIObjectOutputStream.java
@@ -49,9 +49,10 @@ public class OSGIObjectOutputStream extends ObjectOutputStream implements OSGIOb
protected void writeExternalizable(Externalizable obj, Class<?> clazz) throws IOException {
trace("writeExternalizable " + clazz.getName()); //$NON-NLS-1$
- obj.writeExternal(this);
+ out.writeObject(obj);
}
+ @SuppressWarnings("deprecation")
protected void trace(String message) {
LogService ls = this.logger;
if (ls != null) {
@@ -78,10 +79,14 @@ public class OSGIObjectOutputStream extends ObjectOutputStream implements OSGIOb
continue;
else if (!Modifier.isPublic(mod))
allFields[i].setAccessible(true);
- // write field name
- out.writeUTF(allFields[i].getName());
- // field value
- writeObjectOverride(allFields[i].get(obj));
+ Object val = allFields[i].get(obj);
+ // Check to see it's not a circular ref
+ if (val != obj) {
+ // write field name
+ out.writeUTF(allFields[i].getName());
+ // field value
+ writeObjectOverride(val);
+ }
}
} catch (final Exception e) {
throw new NotSerializableException("Exception while serializing " + obj.toString() //$NON-NLS-1$
@@ -102,11 +107,7 @@ public class OSGIObjectOutputStream extends ObjectOutputStream implements OSGIOb
}
protected void writeSerializable(Object obj, Class<?> clazz) throws IOException {
- // lookup object stream class
- trace("writeSerializable " + clazz.getName()); //$NON-NLS-1$
- // write the osc
- out.writeObject(ObjectStreamClass.lookup(clazz));
- writeFields(obj, clazz);
+ out.writeObject(obj);
}
@Override

Back to the top