You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by majohnst <ma...@lattaoutdoors.com> on 2008/11/19 17:59:39 UTC

OCM stripping file extension of file

I am using 1.6-snapshot of OCM to map Files and Resources like in the unit
tests. I am dynamically creating a text file called /folder/test.txt  When I
save the file and resource, I don't get an error. But when I look at the
repository, my file has been renamed to /folder/test  When I open the test
"test" file, it is a correct text file with my text in it. I can even rename
the file as test.txt through webdav. 

Is there a reason why my file extension is being stripped?

File file = new File();
file.setPath(path);

ByteArrayInputStream ba = new ByteArrayInputStream(text.getBytes());
Resource resource = new Resource();
resource.setData(ba);
resource.setLastModified(Calendar.getInstance());
resource.setMimeType("plain/text");
file.setResource(resource);
-- 
View this message in context: http://www.nabble.com/OCM-stripping-file-extension-of-file-tp20584249p20584249.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.


Re: OCM stripping file extension of file

Posted by majohnst <ma...@lattaoutdoors.com>.
I answered my own question. I was saving the files in a map:

@Collection
private Map<String, HierarchyNode> files = new
HashMap<String,HierarchyNode>();

In my code, I was passing the wrong value for the map key. Once I changed
the map key to be the filename, like "test.txt", everything worked fine.
-- 
View this message in context: http://www.nabble.com/OCM-stripping-file-extension-of-file-tp20584249p20584847.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.