Skip to content

Commit

Permalink
Return status from first propstat element when found.
Browse files Browse the repository at this point in the history
  • Loading branch information
dkocher committed Jan 10, 2025
1 parent fa17c2e commit d464713
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/main/java/com/github/sardine/DavResource.java
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,18 @@ public DavResource(Response response) throws URISyntaxException
*/
private int getStatusCode(Response response)
{
List<Propstat> list = response.getPropstat();
for(Propstat propstat : list) {
if(propstat.getStatus() != null) {
try {
return BasicLineParser.parseStatusLine(propstat.getStatus(), null).getStatusCode();
}
catch(ParseException e) {
log.warning(String.format("Failed to parse status line: %s", propstat.getStatus()));
return -1;
}
}
}
String status = response.getStatus();
if (status == null || status.isEmpty())
{
Expand Down

0 comments on commit d464713

Please sign in to comment.