Details
-
Bug
-
Resolution: Unresolved
-
Low
-
None
-
6.15.9
-
None
-
1
-
Severity 3 - Minor
-
1
-
Description
Issue Summary
Using the JAVA API methods com.atlassian.confluence.core.ContentEntityObject.removeOutgoingLink() and com.atlassian.confluence.links.DefaultLinkManager.removeLink() in a script is not working
Environment
- Confluence 6.15.9
- ScriptRunner for Confluence 5.5.11
Steps to Reproduce
- In a test space create undefined page links in at least 2 different pages;
- Open the Script Console under the Administration console;
- Copy the contents of the attached Script.txt into the console;
- Edit the space key in line 24 to match your test space;
- Click on Run - verify that the output lists the different pages created and the undefined links created in step #1;
- Open the pages listed on the output of the previous steps;
- Go back to the Script Console and uncomment the code dlm.removeLink(link2) in line 37;
- Click on Run.
Expected Results
The undefined links listed in the script output should be removed from the page.
Actual Results
After step #6 the page links are still present in the pages.
Running the script after step #Y just returns null and the below exception is thrown in the atlassian_confluence.log:
2019-09-24 13:37:02,768 WARN [http-nio-26156-exec-2] [runner.rest.common.UserScriptEndpoint] exec Script console script failed: -- referer: http://localhost:26156/c6156/plugins/servlet/scriptrunner/admin/console | url: /c6156/rest/scriptrunner/latest/user/exec/ | traceId: 00b5911e85ae0161 | userName: admin | sr.execution.id: 587f7765-62a7-480a-bb03-ae1ddb5b9f33 java.lang.NullPointerException at com.atlassian.confluence.links.DefaultLinkManager.removeLink(DefaultLinkManager.java:73) at com.atlassian.confluence.links.LinkManager$removeLink.call(Unknown Source) at Script53.run(Script53.groovy:42) ...
Notes
The classes and methods in question are documented in:
Workaround
Currently there is no known workaround for this behaviour. A workaround will be added here when available