Bug in CalDavCalendarCollection.addCalendar()

Jan.ITC
2012-01-26
2013-06-05
  • Jan.ITC

    Jan.ITC - 2012-01-26

    Hi,

    it seems there is a bug in CalDavCalendarCollection.addCalendar(calendar) on building the collection path:

    The path is builded by

        PutMethod putMethod = new PutMethod(getPath() + "/" + uid.getValue() + ".ics");
    [code]
    You can see, there is a "/" separator between the path and the uid added.
    The getPath() method however is implemented in this way:
    [code]
        public final String getPath() {
            if (!getId().endsWith("/")) {
                return getId() + "/";
            }
            return getId();
        }
    [code]
    
    That means, in all cases getPath() returns a string ending with an "/" . So building the collection path string always results in a string containing a double slash "//" betwenn the path and the uid.
    This results in an error: "Error creating calendar on server: HTTP/1.1 404 Not Found" if you try to add something. If one of the slashes is removed all is fine.
    regards,
    Jan
    
     
  • Jan.ITC

    Jan.ITC - 2012-01-26

    Sorry, it seems there is no edit/delete for posts. So, here the question again in a more reable way:

    Hi,

    it seems there is a bug in CalDavCalendarCollection.addCalendar(calendar) on building the collection path:

    The path is builded by

        PutMethod putMethod = new PutMethod(getPath() + "/" + uid.getValue() + ".ics");
    

    You can see, there is a "/" separator between the path and the uid added.
    The getPath() method however is implemented in this way:

        public final String getPath() {
            if (!getId().endsWith("/")) {
                return getId() + "/";
            }
            return getId();
        }
    

    That means, in all cases getPath() returns a string ending with an "/" . So building the collection path string always results in a string containing a double slash "//" betwenn the path and the uid.

    This results in an error: "Error creating calendar on server: HTTP/1.1 404 Not Found" if you try to add something. If one of the slashes is removed all is fine.

    regards,
    Jan

     
  • Pascal Robert

    Pascal Robert - 2012-01-26

    Hi Jan,

    That was fixed a couple of weeks ago, make sure you update your copy of the code. The code was modified for:

            String path = getPath();
            if (!path.endsWith("/")) {
                path = path.concat("/");
            }
            PutMethod putMethod = new PutMethod(path + uid.getValue() + ".ics");

     
  • Jan.ITC

    Jan.ITC - 2012-01-26

    Hi Pascal,

    thanks for the quick response.
    In fact I see the changes in the svm 3 weeks ago. But unfortunately it is not yet released, so the 0.9.2-snapshot release was a while ago. I'll try to get it from the repository.

     
  • Ben Fortuna

    Ben Fortuna - 2012-01-26

    It has been quite a while since the last release, so I will try to get a new release out shortly.

    regards,
    ben

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks