You are viewing a plain text version of this content. The canonical link for it is here.
Posted to slide-dev@jakarta.apache.org by "Pill, Juergen" <Ju...@softwareag.com> on 2000/11/22 19:26:12 UTC

Properties second put

The Ms FileManager send two PUT commands, if a file is dragged onto a
folder. The first PUT has a content length of 0, the second PUT has the
"real"  content (length). If I ask the properties in the content store for
the content type (getContentType) the first call of the put delivers
TEXT/PLAIN, but the second PUT delivers an empty string. Debugging the code
I found following:

1)     public void storeRevisionDescriptor
2)         (Uri uri, NodeRevisionDescriptor revisionDescriptor)
3)         throws ServiceAccessException,
RevisionDescriptorNotFoundException {
4)         String key = uri + "-" + revisionDescriptor.getRevisionNumber();
5)         if (!descriptor.contains(key)) {
6)             throw new
RevisionDescriptorNotFoundException(uri.toString());
7)         }
8)         descriptor.put(key, revisionDescriptor.cloneObject());
9)     }

Should line 5 read something like:          if
(!descriptor.containsKey(key)) {


The old line had the effect that an exception was thrown, which was catched
in ContentImpl.create in line b.


a. try {
i. // We update the descriptor's properties
ii. NodeRevisionDescriptor oldRevisionDescriptor = 
iii. objectUri.getDescriptorsStore()
iv. .retrieveRevisionDescriptor(objectUri, 
a. newRevisionNumber);
v. Enumeration newPropertiesList = 
vi. revisionDescriptor.enumerateProperties();
vii. while (newPropertiesList.hasMoreElements()) {
viii. oldRevisionDescriptor
ix. .setProperty( (NodeProperty) newPropertiesList
1. .nextElement() );
x. }
xi. objectUri.getDescriptorsStore()
xii. .storeRevisionDescriptor(objectUri, 
a. oldRevisionDescriptor);
i. revisionDescriptor = oldRevisionDescriptor;
b. } catch (RevisionDescriptorNotFoundException e) {
i. // Should NEVER happen.
ii. // Basically, it would mean that there is no initial 
iii. // revision, which is incorrect since the object 
iv. // HAS revisions.
v. objectUri.getDescriptorsStore()
vi. .createRevisionDescriptor(objectUri, 
a. revisionDescriptor);
c. }


Additionally the line   revisionDescriptor = oldRevisionDescriptor;
(a.xii.a.i)  was missing (to my understanding).

Does this make sense?



Best regards

Juergen Pill



Re: Properties second put

Posted by Remy Maucherat <re...@apache.org>.
> Does this make sense?

Yes it does :) I applied both patches (the most important one being the
first one, of course). Thanks a lot.

BTW, it's easier to read for me (and faster for you) if you generate a diff
of the file, especially for more complex patches (those two were small
enough).

Remy