Opened 9 years ago
Closed 9 years ago
#579 closed bug (fixed)
Unexisting paths not handled in getObjectByPath method
Reported by: | car031 | Owned by: | |
---|---|---|---|
Priority: | minor | Milestone: | 7.3 |
Component: | CMIS | Version: | 7.2.1 |
Keywords: | Cc: | oliver.pehnke@…, jurrie@… |
Description
My colleague encountered a nasty little bug in LogicalDOC's CMIS
support. He ported the Apache VFS CMIS provider to the latest version of
Apache VFS (check it out here:
https://github.com/topicusfinan/commons-vfs-cmis)
The bug is in the "getObjectByPath" method, when calling it with a
non-existing path. A little funny, but this is the way the VFS provider
works. It then catches the CmisObjectNotFoundException? and goes on its
merry way (generating an imaginary VFS file, which will be created for
real later).
The bug is that the "getObjectByPath" method does not throw a
CmisObjectNotFoundException?, but rather just returns NULL. The OpenCMIS
framework specifies that that is illegal in the Javadoc above the
method: "Object infos should contain the returned object." (See here for
the class:
https://svn.apache.org/repos/asf/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/server/AbstractCmisService.java)
The fix for the bug would be in function
com.logicaldoc.cmis.LDRepository.getObjectByPath(CallContext?, String,
String, Boolean, IncludeRelationships?, String, Boolean, Boolean,
ExtensionsData?). Just append the lines to LDRepository.java around line
992 (replacing "return out;"):
if (out == null) {
throw new CmisObjectNotFoundException?("Object not found!");
} else {
return out;
}
This prevents
org.apache.chemistry.opencmis.server.impl.atompub.ObjectService?$GetObjectByPath?.serve
throwing a stacktrace, and instead returns a correct 404 HTTP response.
With kind regards,
Jurrie Overgoor
Change History (1)
comment:1 Changed 9 years ago by car031
- Resolution set to fixed
- Status changed from new to closed
Stop LogicalDOC
Unpacke the patch file into tomcat/webapps/ROOT/WEB-INF/classes
Start LogicalDOC