Hi, 

Me, again.  :)

I'm having problems with XComponentLoader.ComponentFromURL where it is loading 
from an XinputStream.  I'm a bit paranoid and don't
want this to be a reoccurance of bug 75191 ( 
http://www.openoffice.org/issues/show_bug.cgi?id=75191 ).  Can anyone see what 
I could
have possibly done wrong in the following code?  Thanks!

ps: The ultimate goal is to load from a byte[].  This seemed to be a good first 
step.

pps: Nothing is null and the file does exist.  In fact, I have successfully 
loaded from a URL via "XComponent xComponent =
xComponentLoader.loadComponentFromURL("file:///c:/test.docx", "_blank", 0, 
loadProps);" where "loadProps" is empty.

ppps: I'm using the most recent version of everything.


[begin]
XComponentContext xContext = Bootstrap.bootstrap();
XMultiComponentFactory xServiceManager = xContext.getServiceManager();
Object desktop = 
xServiceManager.createInstanceWithContext("com.sun.star.frame.Desktop", 
xContext);
XComponentLoader xComponentLoader = 
(XComponentLoader)UnoRuntime.queryInterface(XComponentLoader.class, desktop);
XSimpleFileAccess xSimpleFileAccess = 
(XSimpleFileAccess)UnoRuntime.queryInterface(XSimpleFileAccess.class,
xServiceManager.createInstanceWithContext("com.sun.star.ucb.SimpleFileAccess", 
xContext));
XInputStream xInputStream = 
xSimpleFileAccess.openFileRead("file:///c:/test.docx");
PropertyValue[] loadProps = new PropertyValue[1];
loadProps[0] = new PropertyValue();
loadProps[0].Name = "InputStream";
loadProps[0].Value = xInputStream;
XComponent xComponent = xComponentLoader.loadComponentFromURL("private:stream", 
"_blank", 0, loadProps);
[end]


leads to (line numbers are off, of course):
com.sun.star.lang.IllegalArgumentException: URL seems to be an unsupported one.
        at 
com.sun.star.lib.uno.environments.remote.Job.remoteUnoRequestRaisedException(Job.java:182)
        at com.sun.star.lib.uno.environments.remote.Job.execute(Job.java:148)
        at 
com.sun.star.lib.uno.environments.remote.JobQueue.enter(JobQueue.java:344)
        at 
com.sun.star.lib.uno.environments.remote.JobQueue.enter(JobQueue.java:313)
        at 
com.sun.star.lib.uno.environments.remote.JavaThreadPool.enter(JavaThreadPool.java:101)
        at 
com.sun.star.lib.uno.bridges.java_remote.java_remote_bridge.sendRequest(java_remote_bridge.java:652)
        at 
com.sun.star.lib.uno.bridges.java_remote.ProxyFactory$Handler.request(ProxyFactory.java:154)
        at 
com.sun.star.lib.uno.bridges.java_remote.ProxyFactory$Handler.invoke(ProxyFactory.java:136)
        at $Proxy3.loadComponentFromURL(Unknown Source)
        at com.snowbound.testOOUno.main(testOOUno.java:223)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at com.sun.star.lib.loader.Loader.main(Loader.java:144)





-
Albert 



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

Reply via email to