To comment on the following update, log in, then open the issue:
http://www.openoffice.org/issues/show_bug.cgi?id=63270
                  Issue #:|63270
                  Summary:|Problem with closing a document with API & JAVA
                Component:|api
                  Version:|OOo 2.0.1
                 Platform:|Sun
                      URL:|
               OS/Version:|Solaris
                   Status:|UNCONFIRMED
        Status whiteboard:|
                 Keywords:|
               Resolution:|
               Issue type:|DEFECT
                 Priority:|P3
             Subcomponent:|code
              Assigned to:|sw
              Reported by:|thoriredd





------- Additional comments from [EMAIL PROTECTED] Thu Mar 16 09:36:20 -0800 
2006 -------
Hi, i would to close a document that i have generated withe the API (the
document is a Writer, that i have composed with some rtf files with images and
table and then is converted in sxw). I use the code that i have found in the SDK
the code is this:
   /**
     * Try to close the document without any saving of modifications.
     * We can try it only! Controller and/or model of this document
     * can disagree with that. But mostly they doesn't do so.
     *
     * @param   xDocument   document which should be clcosed
     */
    public static void closeDocument(com.sun.star.lang.XComponent xDocument)
    {
        try
        {
            // Check supported functionality of the document (model or 
controller).
            com.sun.star.frame.XModel xModel =
                (com.sun.star.frame.XModel)UnoRuntime.queryInterface(
                    com.sun.star.frame.XModel.class, xDocument);

            if(xModel!=null)
            {
                // It's a full featured office document.
                // Reset the modify state of it and close it.
                // Note: Model can disgree by throwing a veto exception.
                com.sun.star.util.XModifiable xModify =
                    (com.sun.star.util.XModifiable)UnoRuntime.queryInterface(
                        com.sun.star.util.XModifiable.class, xModel);

                xModify.setModified(false);
                xDocument.dispose();
            }
            else
            {
                // It's a document which supports a controller .. or may by a 
pure
                // window only. If it's at least a controller - we can try to
                // suspend him. But - he can disagree with that!
                com.sun.star.frame.XController xController =
                    (com.sun.star.frame.XController)UnoRuntime.queryInterface(
                        com.sun.star.frame.XController.class, xDocument);

                if(xController!=null)
                {
                    if(xController.suspend(true)==true)
                    {
                        // Note: Don't dispose the controller - destroy the 
frame
                        // to make it right!
                        com.sun.star.frame.XFrame xFrame = 
xController.getFrame();
                        xFrame.dispose();
                    }
                }
            }
        }
        catch(com.sun.star.beans.PropertyVetoException exVeto)
        {
            // Can be thrown by "setModified()" call on model.
            // He disagree with our request.
            // But there is nothing to do then. Following "dispose()" call 
wasn't
            // never called (because we catch it before). Closing failed 
-that's it.
            exVeto.printStackTrace();
        }
        catch(com.sun.star.lang.DisposedException exDisposed)
        {
            // If an UNO object was already disposed before - he throw this 
special
            // runtime exception. Of course every UNO call must be look for 
that -
            // but it's a question of error handling.
            // For demonstration this exception is handled here.
            exDisposed.printStackTrace();
        }
        catch(com.sun.star.uno.RuntimeException exRuntime)
        {
            // Every uno call can throw that.
            // Do nothing - closing failed - that's it.
            exRuntime.printStackTrace();
        }
    }


But sometimes and underline sometimes, the API stops before the istruction
"xDocument.dispose()"..
I don't have any error... if i kill the soffice process, i obtain this error:

com.sun.star.lang.DisposedException: com.sun.star.io.IOException: EOF reached -
socket,host=localhost,port=10100,localHost=localhost,localPort=60088,peerHost=localhost,peerPort=10100
       at
com.sun.star.lib.uno.bridges.java_remote.java_remote_bridge$MessageDispatcher.invoke(java_remote_bridge.java:282)
       at
com.sun.star.lib.uno.bridges.java_remote.java_remote_bridge$MessageDispatcher.run(java_remote_bridge.java:175)

I try with OOo 2.0.1, with OOo 1.1.4 but the error is the same..

---------------------------------------------------------------------
Please do not reply to this automatically generated notification from
Issue Tracker. Please log onto the website and enter your comments.
http://qa.openoffice.org/issue_handling/project_issues.html#notification

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to