On Wed, Aug 27, 2008 at 2:04 PM, Peter Eberlein
<[EMAIL PROTECTED]> wrote:

Hi Peter,

I tried it in Java ...

public class GraphicHelper
{
        /**
         * Creates XGraphic from byte[] array.
         *
         * @param connection OpenOffice.org connection.
         * @param imageData Image data.
         * @return XGraphic object with image or null if an error occurs.
         */
        public static XGraphic createGraphic( OfficeConnection connection,
byte[] imageData )
        {
                try
                {
                        Object oGraphicProvider = connection.createInstance(
"com.sun.star.graphic.GraphicProvider" );
                        XGraphicProvider provider = ( XGraphicProvider )
UnoRuntime.queryInterface( XGraphicProvider.class, oGraphicProvider );
                        Props properties = new Props();
                        properties.put( "InputStream", new 
ByteArrayInputStream( imageData ) );
                        return provider.queryGraphic( 
properties.toPropertyValueArray() );                      
                }
                catch ( Exception ex )
                {
                        System.out.println( "OO.o - Failed to create XGraphic 
object from byte[]" );
                        ex.printStackTrace();
                }
                
                return null;
        }
}

... and the last call - provider.queryGraphic() throws exception ...

OO.o - Failed to create XGraphic object from byte[]
com.sun.star.lang.DisposedException: java.io.IOException:
closeConnection message received
        at 
com.sun.star.lib.uno.bridges.java_remote.java_remote_bridge$MessageDispatcher.run(java_remote_bridge.java:176)
com.sun.star.lang.DisposedException: java_remote_bridge
[EMAIL PROTECTED] 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:141)
        at $Proxy225.setString(Unknown Source)
        at cane.FillProfileHelper.fillImages(FillProfileHelper.java:85)
        ...

... I'm using OpenOffice.org remotely via css.connection.Connection
and socket. After this exception, connection is closed, but the
OpenOffice.org is still remotely running and accepting incoming
connections. Any idea what can be wrong? Or how to debug remote
OpenOffice.org instance?

-- 
Robert Vojta

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

Reply via email to