Issue 115745

Summary: OO crashes when repeatedly triggering API commands
Product: App Dev Reporter: mattraffic <syntheticore>
Component: apiAssignee: AOO issues mailing list <issues>
Status: UNCONFIRMED --- QA Contact: Alex <alex13qa>
Severity: Trivial    
Priority: P3 CC: arielch, issues
Version: 3.3.0 or older (OOo)   
Target Milestone: ---   
Hardware: PC   
OS: Windows Vista   
Issue Type: DEFECT Latest Confirmation in: ---
Developer Difficulty: ---
Attachments:
Description Flags
NetBeans project showing how it works none

Description mattraffic 2010-11-23 16:29:03 UTC
When creating a document programmatically using the open office API, we need to 
insert occasional sleep statements to make it work halfway stable. Removing the 
these statements in code such as the following, makes OO crash.

         for (int i = 2; i < 3000; i++) {
            String sCellName = "A" + (i-1);
            XText cellText = (XText)xTextTable.getCellByName (sCellName);
            XTextCursor cursor = cellText.createTextCursor();
            
            XTextViewCursor viewCursor = cursorSup.getViewCursor();
            viewCursor.gotoRange(cursor, false);
            XDispatchHelper xDispatchHelper = 
(XDispatchHelper)multiServiceFactory.createInstance( 
"com.sun.star.frame.DispatchHelper");
            PropertyValue[] tableArgs = new 
unoidl.com.sun.star.beans.PropertyValue[0];
            xDispatchHelper.executeDispatch((XDispatchProvider)frame, 
".uno:InsertRows", "", 0, tableArgs);

            xTextTable.getCellByName ("A" + i).setValue (22.5);
               System.Threading.Thread.Sleep(5);
            xTextTable.getCellByName ("B" + i).setValue (5615.3);
               System.Threading.Thread.Sleep(5);
            xTextTable.getCellByName ("C" + i).setValue (-2315.7);
               System.Threading.Thread.Sleep(5);
            xTextTable.getCellByName ("D" + i).setValue (-315.7);
               System.Threading.Thread.Sleep(5);
            if (i%100==0) {
               Console.WriteLine("Row: " + i);
               System.Threading.Thread.Sleep(50);
            }
         }
Is this a known issue? Please fix it!!!
Comment 1 jsc 2010-11-23 17:13:30 UTC
jsc -> nn: seems to be one for calc
Comment 2 jsc 2010-11-23 17:13:52 UTC
change prio to P3
Comment 3 niklas.nebel 2010-11-23 17:35:49 UTC
It's about Writer tables, not Calc.
Comment 4 Ariel Constenla-Haile 2010-11-24 06:26:35 UTC
.
Comment 5 Ariel Constenla-Haile 2010-11-24 06:30:04 UTC
mattraffic: why do you use the dispatch? did you try using only API calls?
I think this is more for dev@api.openoffice.org than for an issue.
Comment 6 mattraffic 2010-12-01 15:34:42 UTC
arielch: Yes, we tried using only the API before, but had the same problem. This 
code will crash OO Writer as well:

         for (int i = 2; i < 3000; i++)
         {
             {
                 String sCellName = "A" + (i - 1);
                 XText cellText = (XText)xTextTable.getCellByName(sCellName);
                 cellText.setString("value" + i);
             }
             {
                 String sCellName = "B" + (i - 1);
                 XText cellText = (XText)xTextTable.getCellByName(sCellName);
                 cellText.setString("value" + i);
             }
             {
                 String sCellName = "C" + (i - 1);
                 XText cellText = (XText)xTextTable.getCellByName(sCellName);
                 cellText.setString("value" + i);
             }
             {
                 String sCellName = "D" + (i - 1);
                 XText cellText = (XText)xTextTable.getCellByName(sCellName);
                 cellText.setString("value" + i);
             }
             if (i % 100 == 0)
             {
                 Console.WriteLine("Row: " + i);
             }
         }
Comment 7 Ariel Constenla-Haile 2010-12-01 18:44:52 UTC
Created attachment 75209 [details]
NetBeans project showing how it works
Comment 8 Ariel Constenla-Haile 2010-12-01 18:51:02 UTC
arielch->mattraffic: please 
http://www.openoffice.org/nonav/issues/showattachment.cgi/75209/TableSample.zip

Using pure API calls, it works with a 3000 row text table, in less than one minute 
when the document is HIDDEN. When the document is visible, it takes longer, but it 
does not crash.

Using the Dispatch API here is a no-go.

arielch->os: I think this can be closed as invalid. 
Comment 9 mattraffic 2010-12-15 14:28:12 UTC
OK, it seems your sample is working... 
We should have mentioned in the first place that we are doing all this using the
C# API. Sorry for the misunderstanding. Maybe you can have another look?
Comment 10 Ariel Constenla-Haile 2010-12-15 14:33:52 UTC
arielch->mattraffic: sorry, I know nothing about C#. But OOo API is basically
the same in all the language bindings it supports. It should be easy for you to
translate the Java example to C#.
Also you could attach your code to this issue, so that someone in the know of C#
stuff can take a closer look.
Comment 11 Marcus 2017-05-20 11:27:43 UTC
Reset assigne to the default "issues@openoffice.apache.org".