Hello,
I followed the example on Perspectives (Introduction) and Perspectives (History).
So far it’s working nice.
But now I try to save and load the perspectives in/from a file.
I get the following IOException.
What I do is just: On the AWT thread, in a temporary file in /tmp
@Override
public void savePerspective(String name, File file) throws IOException {
perspectives.setPerspective(name, perspective);
control.write(file);
}
@Override
public void loadPerspective(String name, File file) throws IOException {
control.read(file);
control.load(name);
}
I don’t know if it is the problem, but I’m a little bit lazy and I’m using ObjectOutput/InputStream in the custom layout:
// in my custom MultipleCDockableLayout
@Override
public void writeStream(DataOutputStream out) throws IOException {
ObjectOutputStream obj = new ObjectOutputStream(out);
obj.writeObject(meta);
out.flush();
}
@SuppressWarnings("unchecked")
@Override
public void readStream(DataInputStream in) throws IOException {
try {
ObjectInputStream obj = new ObjectInputStream(in);
meta = (WindowType) obj.readObject();
} catch (ClassNotFoundException e) {
throw log.errorReadStream(this, e);
}
}
The exception:
Exception in thread „AWT-EventQueue-0“ java.security.PrivilegedActionException: java.io.IOException: Trying to read something from the future: 291941.1936982272.256 is greater than the current version 1.1.1a
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:697)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)
Caused by: java.io.IOException: Trying to read something from the future: 291941.1936982272.256 is greater than the current version 1.1.1a
at bibliothek.util.Version.checkCurrent(Version.java:137)
at bibliothek.gui.DockFrontend.readBlop(DockFrontend.java:1910)
at bibliothek.gui.DockFrontend.read(DockFrontend.java:1896)
at bibliothek.gui.DockFrontend.read(DockFrontend.java:1884)
at bibliothek.gui.dock.common.CControl$9.read(CControl.java:880)
at bibliothek.gui.dock.support.util.ApplicationResourceManager.readStream(ApplicationResourceManager.java:144)
at bibliothek.gui.dock.support.util.ApplicationResourceManager.readFile(ApplicationResourceManager.java:204)
at bibliothek.gui.dock.common.CControl.read(CControl.java:2600)
at com.anrisoftware.fdsanalysis.windows.docks.dockingframes.DockingFramesDock.loadPerspective(DockingFramesDock.java:126)
at com.anrisoftware.fdsanalysis.windows.docks.api.Dock$loadPerspective.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:120)
at com.anrisoftware.fdsanalysis.windows.docks.dockingframes.DocksStorageTest$_manually_store_and_load_perspective_closure3_closure7.doCall(DocksStorageTest.groovy:43)
at com.anrisoftware.fdsanalysis.windows.docks.dockingframes.DocksStorageTest$_manually_store_and_load_perspective_closure3_closure7.doCall(DocksStorageTest.groovy)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:272)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:909)
at groovy.lang.Closure.call(Closure.java:411)
at groovy.lang.Closure.call(Closure.java:405)
at groovy.lang.Closure.run(Closure.java:492)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:251)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:727)
at java.awt.EventQueue.access$200(EventQueue.java:103)
at java.awt.EventQueue$3.run(EventQueue.java:688)
at java.awt.EventQueue$3.run(EventQueue.java:686)
… 9 more