To comment on the following update, log in, then open the issue: http://www.openoffice.org/issues/show_bug.cgi?id=69706 Issue #|69706 Summary|setName(name) on a bookmark throws an undocumented Run |timeException if the name already exists Component|Word processor Version|OOo 2.0.2 Platform|Opteron/x86_64 URL| OS/Version|All Status|UNCONFIRMED Status whiteboard| Keywords| Resolution| Issue type|DEFECT Priority|P3 Subcomponent|code Assigned to|mru Reported by|clutz
------- Additional comments from [EMAIL PROTECTED] Wed Sep 20 08:25:19 -0700 2006 ------- The following code tries to do a setName(...) call on a bookmark with a name that already exists and OOo throws a RuntimeException. According to the idl-reference, setName() is not allowed to throw any Exceptions!!! There are two ways to fix this problem: 1) change the code, so that setName(name) recognizes a name conflict and sets a different name in the form "name<NUMBER>" (example "foo1") in the same way, the insertContent-command behaves when inserting a bookmark with an already existing name. OR 2a) setName(name) throws an appropriate Exception (eg. IllegalArgumentException, or NameAlreadyExistsException) and not just a RuntimeException. 2b) the IDL-documentation gets a rewrite, so that it reflects the new behaviour and the (new) Exception is documented. Here the code: Sub renameBookmarkError doc = ThisComponent ' insert the first bookmark "foo" bm1 = doc.createInstance("com.sun.star.text.Bookmark") bm1.setName("foo") doc.Text.insertTextContent(doc.Text.Start, bm1, true) ' insert the second bookmark "bar" bm2 = doc.createInstance("com.sun.star.text.Bookmark") bm2.setName("bar") doc.Text.insertTextContent(doc.Text.Start, bm2, true) ' rename bookmark "bar" to "foo" bm2.setName("test") ' works correct print bm2.getName() bm2.setName("foo") ' either generate a new name "foo1" ' or throw a appropriate Exception ' (and not RuntimeException) print bm2.getName() End Sub --------------------------------------------------------------------- Please do not reply to this automatically generated notification from Issue Tracker. Please log onto the website and enter your comments. http://qa.openoffice.org/issue_handling/project_issues.html#notification --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]