Details
-
Bug
-
Resolution: Not a bug
-
Low
-
None
-
5.1.4
Description
Symptoms
Attempting to remove a page version which does not exist results in a misleading error, either giving a NullPointerException if the version is 1 more than the highest version available (displayed as "CURRENT" in the web interface), or otherwise "java.lang.Exception: com.atlassian.confluence.rpc.NotPermittedException: You do not have the permissions to perform this action".
Steps to Reproduce
I reproduced this using the Python CLI as seen below:
>>> import xmlrpclib >>> server = xmlrpclib.ServerProxy("http://BASEURL/rpc/xmlrpc") >>> token = server.confluence2.login("username", "password") >>> server.confluence2.getPageHistory(token, "2031636") [{'id': '2031637', 'modifier': 'admin', 'version': '1', 'modified': <DateTime '20130625T14:29:18' at 100cfd5a8>}] >>> server.confluence2.removePageVersionByVersion(token, '2031636', 2) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xmlrpclib.py", line 1224, in __call__ return self.__send(self.__name, args) File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xmlrpclib.py", line 1578, in __request verbose=self.__verbose File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xmlrpclib.py", line 1264, in request return self.single_request(host, handler, request_body, verbose) File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xmlrpclib.py", line 1297, in single_request return self.parse_response(response) File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xmlrpclib.py", line 1473, in parse_response return u.close() File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xmlrpclib.py", line 793, in close raise Fault(**self._stack[0]) xmlrpclib.Fault: <Fault 0: 'java.lang.Exception: java.lang.NullPointerException'> >>> server.confluence2.removePageVersionByVersion(token, '2031636', 3) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xmlrpclib.py", line 1224, in __call__ return self.__send(self.__name, args) File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xmlrpclib.py", line 1578, in __request verbose=self.__verbose File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xmlrpclib.py", line 1264, in request return self.single_request(host, handler, request_body, verbose) File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xmlrpclib.py", line 1297, in single_request return self.parse_response(response) File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xmlrpclib.py", line 1473, in parse_response return u.close() File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xmlrpclib.py", line 793, in close raise Fault(**self._stack[0]) xmlrpclib.Fault: <Fault 0: 'java.lang.Exception: com.atlassian.confluence.rpc.NotPermittedException: You do not have the permissions to perform this action'>
Workaround
Do not attempt to remove any non-existent version.