To comment on the following update, log in, then open the issue:
http://www.openoffice.org/issues/show_bug.cgi?id=81738





------- Additional comments from setve...@openoffice.org Tue Mar 31 08:37:54 
+0000 2009 -------
I encounter a issue like this.
My application connect to OpenOffice 2.4.0 to convert some files among  MS
Office Document, RTF and OpenOffice Document. It does work fine initially, but
it doesn't work now. The Exception like this:


com.sun.star.lang.DisposedException: java_remote_bridge
com.sun.star.lib.uno.bridges.java_remote.java_remote_bri...@6f67c6fd is disposed
        at
com.sun.star.lib.uno.bridges.java_remote.java_remote_bridge.checkDisposed(java_remote_bridge.java:720)
        at
com.sun.star.lib.uno.bridges.java_remote.java_remote_bridge.sendRequest(java_remote_bridge.java:639)
        at
com.sun.star.lib.uno.bridges.java_remote.ProxyFactory$Handler.request(ProxyFactory.java:159)
        at
com.sun.star.lib.uno.bridges.java_remote.ProxyFactory$Handler.invoke(ProxyFactory.java:136)
        at $Proxy6.queryInterface(Unknown Source)
        at com.sun.star.uno.UnoRuntime.queryInterface(UnoRuntime.java:159)
        at com.sun.star.uno.UnoRuntime.queryInterface(UnoRuntime.java:186)

Here is the relative code as below:

public class OpenOfficeDocumentConverter extends
AbstractOpenOfficeDocumentConverter {

//    private static final Logger logger =
LoggerFactory.getLogger(OpenOfficeDocumentConverter.class);

        public OpenOfficeDocumentConverter(OPConnection connection) {
                super(connection);
        }

        public OpenOfficeDocumentConverter(OPConnection connection,
DocumentFormatRegistry formatRegistry) {
                super(connection, formatRegistry);
        }

        /**
         * In this file-based implementation, streams are emulated using 
temporary files.
         */
        protected void convertInternal(InputStream inputStream, DocumentFormat
inputFormat, OutputStream outputStream, DocumentFormat outputFormat) throws
Exception{
                File inputFile = null;
                File outputFile = null;
                try {
                        inputFile = File.createTempFile("document", "." +
inputFormat.getFileExtension()); //$NON-NLS-1$ //$NON-NLS-2$
                        OutputStream inputFileStream = null;
                        try {
                                inputFileStream = new 
FileOutputStream(inputFile);
                                IOUtils.copy(inputStream, inputFileStream);
                        } finally {
                                IOUtils.closeQuietly(inputFileStream);
                        }

                        outputFile = File.createTempFile("document", "." +
outputFormat.getFileExtension()); //$NON-NLS-1$ //$NON-NLS-2$
                        convert(inputFile, inputFormat, outputFile, 
outputFormat);
                        InputStream outputFileStream = null;
                        try {
                                outputFileStream = new 
FileInputStream(outputFile);
                                IOUtils.copy(outputFileStream, outputStream);
                        } finally {
                                IOUtils.closeQuietly(outputFileStream);
                        }
                } catch (IOException ioException) {
                        throw new 
OPException(Messages.getString("OpenOfficeDocumentConverter.4"),
ioException); //$NON-NLS-1$
                } finally {
                        if (inputFile != null) {
                                inputFile.delete();
                        }
                        if (outputFile != null) {
                                outputFile.delete();
                        }
                }
        }

        @SuppressWarnings("unchecked") //$NON-NLS-1$
        protected void convertInternal(File inputFile, DocumentFormat 
inputFormat, File
outputFile, DocumentFormat outputFormat) throws Exception {
        Map/*<String,Object>*/ loadProperties = new HashMap();
        loadProperties.putAll(getDefaultLoadProperties());
        loadProperties.putAll(inputFormat.getImportOptions());

        Map/*<String,Object>*/ storeProperties =
outputFormat.getExportOptions(inputFormat.getFamily());

        synchronized (openOfficeConnection) {
                        XFileIdentifierConverter fileContentProvider =
openOfficeConnection.getFileContentProvider();
                        String inputUrl = 
fileContentProvider.getFileURLFromSystemPath("",
inputFile.getAbsolutePath()); //$NON-NLS-1$
                        String outputUrl = 
fileContentProvider.getFileURLFromSystemPath("",
outputFile.getAbsolutePath()); //$NON-NLS-1$

                        loadAndExport(inputUrl, loadProperties, outputUrl, 
storeProperties);
                }
        }

        @SuppressWarnings("unchecked") //$NON-NLS-1$
        private void loadAndExport(String inputUrl, Map/*<String,Object>*/
loadProperties, String outputUrl, Map/*<String,Object>*/ storeProperties) throws
Exception {
                XComponent document;
            document = loadDocument(inputUrl, loadProperties);
                if (document == null) {
                    throw new
OPException(Messages.getString("OpenOfficeDocumentConverter.9")); //$NON-NLS-1$
                }

            refreshDocument(document);
            storeDocument(document, outputUrl, storeProperties);
        }

    @SuppressWarnings("unchecked") //$NON-NLS-1$
        private XComponent loadDocument(String inputUrl, Map loadProperties) 
throws
com.sun.star.io.IOException, IllegalArgumentException {
        XComponentLoader desktop = openOfficeConnection.getDesktopObject();
        return desktop.loadComponentFromURL(inputUrl, "_blank", 0,
toPropertyValues(loadProperties)); //$NON-NLS-1$
    }

    @SuppressWarnings("unchecked") //$NON-NLS-1$
        private void storeDocument(XComponent document, String outputUrl, Map
storeProperties) throws com.sun.star.io.IOException {
        try {
                        XStorable storable = (XStorable) 
UnoRuntime.queryInterface(XStorable.class,
document);
                        storable.storeToURL(outputUrl, 
toPropertyValues(storeProperties));
                } finally {
                    XCloseable closeable = (XCloseable)
UnoRuntime.queryInterface(XCloseable.class, document);
                    if (closeable != null) {
                    try {
                    closeable.close(true);
                } catch (CloseVetoException closeVetoException) {
                        if(net.heartsome.common.Constants.DEBUG_MODE){
                                closeVetoException.printStackTrace();
                        }

                }
                    } else {
                        document.dispose();
                    }
                }
    }

}

In addition, This code does work fine on the another computer.
Could you suggest whether its a code problem or configuration issue?



---------------------------------------------------------------------
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: issues-unsubscr...@api.openoffice.org
For additional commands, e-mail: issues-h...@api.openoffice.org


---------------------------------------------------------------------
To unsubscribe, e-mail: allbugs-unsubscr...@openoffice.org
For additional commands, e-mail: allbugs-h...@openoffice.org

Reply via email to