Apache OpenOffice (AOO) Bugzilla – Issue 35453
insertByIndex removeByIndex crashes on inserting 0 rows
Last modified: 2013-02-24 21:10:10 UTC
If I try to insert 0 Rows into a com.sun.star.text.XTextTable within a writer document using the api by doing : com.sun.star.text.XTableRows xRows = xTextTable.getRows(); xRows.insertByIndex(xRows.getCount()-1, 0); xRows.removeByIndex(xRows.getCount()-1, 0); a com.sun.star.uno.RuntimeException is thrown: ------------------------------------------------- com.sun.star.uno.RuntimeException: at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:274) at com.sun.star.lib.uno.protocols.urp.Unmarshal.readThrowable(Unmarshal.java:315) at com.sun.star.lib.uno.protocols.urp.Unmarshal.readAny(Unmarshal.java:157) at com.sun.star.lib.uno.protocols.urp.Unmarshal.readObject(Unmarshal.java:404) at com.sun.star.lib.uno.protocols.urp.urp.readReply(urp.java:192) at com.sun.star.lib.uno.protocols.urp.urp.readMessage(urp.java:308) at com.sun.star.lib.uno.protocols.urp.urp.readMessage(urp.java:607) at com.sun.star.lib.uno.bridges.java_remote.java_remote_bridge$MessageDispatcher.invoke(java_remote_bridge.java:184) at com.sun.star.lib.uno.bridges.java_remote.java_remote_bridge$MessageDispatcher.run(java_remote_bridge.java:175) ------------------------------------------------------
my vote for it ;-).
a com::sun::star::lang::IllegalArgumentException seems to be more reasonable here. The Simple Basic Macro: xTextTable=thisComponent.getTextTables().getByIndex(0) xRows = xTextTable.getRows() xRows.insertByIndex(xRows.getCount()-1, 0) xRows.removeByIndex(xRows.getCount()-1, 0) can be run with a document that contains at least one table to reproduce the behaviour.
as dicussed on the mailinglist, why not throw no exception at all when trying to insert/remove 0 rows?
As cyb mentions throwing no Exception on inserting/removing 0 rows will be a more convenient way i think. My Application is calculating a amount of additional needed rows in a XTextTable and by now i have to bypass the insertion if no more rows are needed. IMHO this always will be a workaround. Allowedly inserting 0 rows seems to be stupid, but the fishy programmers of the world will be thankful ...
Duplicate to issue #23386# which is already fixed that way in CWS tl14. *** This issue has been marked as a duplicate of 23386 ***
The Issue you raised has been marked as 'Resolved' and not updated within the last 1 year+. I am therefore setting this issue to 'Verified' as the first step towards Closing it. If you feel this is incorrect, please re-open the issue and add any comments. Many thanks, Andrew Cleaning-up and Closing old Issues ~ The Grand Bug Squash, pre v3 ~ http://marketing.openoffice.org/3.0/announcementbeta.html
As per previous posting: Verified -> Closed. A Closed Issue is a Happy Issue (TM). Regards, Andrew