Issue 111491 - Defect in XStorable.storeToURL( "Private:stream", xPropertySet)
Summary: Defect in XStorable.storeToURL( "Private:stream", xPropertySet)
Status: CLOSED NOT_AN_OOO_ISSUE
Alias: None
Product: Base
Classification: Application
Component: code (show other issues)
Version: OOO320m12
Hardware: Mac All
: P3 Trivial (vote)
Target Milestone: ---
Assignee: AOO issues mailing list
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-05-09 16:05 UTC by keithmcfarlane
Modified: 2023-02-06 17:17 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description keithmcfarlane 2010-05-09 16:05:20 UTC
It seems to be impossible in OO3.2 to store a Database document to an XOuputStream via the code 
sequence: 
[code]
XComponent xComponent; // Maybe Writer, Impress, Calc or Database document.
java.io.OutputStream output;
PropertyValue [ ] xPropertyValue = new PropertyValue [ 2 ];
xPropertyValue [ 0 ] = new PropertyValue ( );
xPropertyValue [ 0 ] . Name = "FilterName";
ReportOutputStream document; XStorable xStorable;
xPropertyValue [ 0 ] . Value = "writer8"; // for example
 document = new DocumentOutputStream ( output );
 xPropertyValue [ 1 ] = new PropertyValue ( );
 xPropertyValue [ 1 ] . Name = "OutputStream";
 xPropertyValue [ 1 ] . Value = document;
  try
    { xStorable = ( XStorable ) UnoRuntime . queryInterface
        ( XStorable.class, xComponent );
      xStorable . storeToURL ( "private:stream", xPropertyValue );
   }
catch ( final com.sun.star.io.IOException exception )
  { final String message = exception . getMessage ( );
     throw new DatabaseException ( message );
 }
[/code]

The reported error message is as follows (The text "Could not save document" is transcribed from the 
underlying OO stack)

com.entropy.reporting.database.DatabaseException: Could not save the document:
com.sun.star.ucb.ContentCreationException:
No Content Provider available for given URL!

 THIS IS IMPORTANT BECAUSE THE METHOD PROVIDES A DIRECT TRANSCRIPTION IF A DYNAMICALLY 
GENERATED DOCUMENT TO A SERVLET HTTPServletResponse OutputStream. THE APPROACH WORKS for 
Writer, Calc and Impress. IT SHOULD ALSO WORK FOR DATABASE IN MY VIEW. I THINK, THEREFORE, 
THAT THIS BUG SHOULD HAVE A HIGH PRIORITY!

The Writer, Calc and Impress documents are typically created as follows:
[code]
XDesktop XDesktop;
xComponentLoader = ( XComponentLoader ) UnoRuntime . queryInterface
  ( XComponentLoader.class, xDesktop );
 PropertyValue [ ] xDeskProps = new PropertyValue [ 1 ];
 xDeskProps [ 0 ] = new PropertyValue ( );
 xDeskProps [ 0 ] . Name = "Hidden";
 xDeskProps [ 0 ] . Value = false;

 xComponent = xComponentLoader . loadComponentFromURL
   ( "private:factory/swriter", "_blank", 0, xDeskProps );

 xComponent = xComponentLoader . loadComponentFromURL
   ( "private:factory/simpress", "_blank", 0, xDeskProps );

 xComponent = xComponentLoader . loadComponentFromURL
   ( "private:factory/scalc", "_blank", 0, xDeskProps );
[/code]

 Note that the same empty document instantiation works for Database also. There is however no (not 
even any empty) XDataSource object. NEITHER CAN THIS BE CREATED USING THE APPROACH OUTLINED 
IN THE MANUAL / USER-GUIDE (SEE http://www.openoffice.org/issues/show_bug.cgi?id=111454 ).

 Your effort (and any reasonable work-around) would be much appreciated.
Comment 1 r4zoli 2012-09-09 07:26:09 UTC
Change component to none, priority to P3.
Comment 2 oooforum (fr) 2023-02-06 09:11:57 UTC
Why use storeToUrl and not storeAsUrl?