}
}
try
{
PutMethod method = new PutMethod(urlStr);
method.setRequestEntity(entity);
setupMethod(method);
execute(method);
setUserName(fileName, urlStr);
}
catch (FileSystemException ex)
{
if (!isCheckedIn)
{
try
{
UncheckoutMethod method = new UncheckoutMethod(urlStr);
setupMethod(method);
execute(method);
isCheckedIn = true;
}
catch (Exception e)
{
// Ignore the exception. Going to throw original.
}
throw ex;
}
}
if (!fileExists)
{
createVersion(urlStr);
try
{
DavPropertySet props = getPropertyNames(fileName);
isCheckedIn = !props.contains(VersionControlledResource.CHECKED_OUT);
}
catch (FileNotFoundException fnfe)
{
// Ignore the error
}
}
if (!isCheckedIn)
{
CheckinMethod checkin = new CheckinMethod(urlStr);
setupMethod(checkin);
execute(checkin);
}
}
else
{
PutMethod method = new PutMethod(urlStr);
method.setRequestEntity(entity);
setupMethod(method);
execute(method);
try
{
setUserName(fileName, urlStr);