sampurnachhantyal / caldav4j

Automatically exported from code.google.com/p/caldav4j
0 stars 0 forks source link

BUG: CalDAVCollection.add(HttpClient, Calendar) adds 3 calendars instead of 1! #38

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Initialize a CalDAVCollection object.
2. Call the function add(HttpClient, Calendar).

What is the expected output? What do you see instead?
One calendar is supposed to be added to the collection, however, three 
calendars are being added.

What version of the product are you using? On what operating system?
I downloaded the source and built it using maven as in the instructions. The 
jar file's name is: "caldav4j-0.7-SNAPSHOT.jar." I am using Windows XP 
Professional (5.1, Build 2600).

Please provide any additional information below.
The bug is caused because the boolean didIt is never being changed from false 
to true.

Here is how I think the fix would look like. Simply change the current switch 
block in the function with:

switch (statusCode){
  case CaldavStatus.SC_CREATED:
  case CaldavStatus.SC_NO_CONTENT:
    didIt = true;
    break;
  case CaldavStatus.SC_PRECONDITION_FAILED:
    break;              
  default:
    MethodUtil.StatusToExceptions(putMethod);
}

Original issue reported on code.google.com by shivji...@gmail.com on 8 Jun 2010 at 6:04

GoogleCodeExporter commented 8 years ago
Bad refactoring: fixed, thx!

Original comment by robipo...@gmail.com on 10 Jun 2010 at 10:56