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