throw dave;
}
if (parentResource == null || !parentResource.exists()) {
autoCheckIn(resource, true, false, info);
throw new DAVException("Missing one or more intermediate collections. Cannot create resource {0}.",
new Object[] { SVNEncodingUtil.xmlEncodeCDATA(resource.getResourceURI().getRequestURI()) },
HttpServletResponse.SC_CONFLICT, 0);
}
info.setParentResource(parentResource);
if (parentResource.isVersioned() && !parentResource.isWorking()) {
boolean checkOutParent = false;
try {
checkOutParent = canAutoCheckOut(parentResource, lockProvider, parentResource.getAutoVersion());
} catch (DAVException dave) {
autoCheckIn(resource, true, false, info);
throw dave;
}
if (!checkOutParent) {
autoCheckIn(resource, true, false, info);
throw new DAVException("<DAV:cannot-modify-checked-in-parent>", HttpServletResponse.SC_CONFLICT, 0);
}
try {
checkOut(parentResource, true, false, false, null);
} catch (DAVException dave) {
autoCheckIn(resource, true, false, info);
throw new DAVException("Unable to auto-checkout parent collection. Cannot create resource {0}.",
new Object[] { resource.getResourceURI().getRequestURI() }, HttpServletResponse.SC_CONFLICT, dave, 0);
}
info.setParentCheckedOut(true);
}
}
if (isParentOnly) {
return info;
}
if (!resource.exists() && resource.getAutoVersion() == DAVAutoVersion.ALWAYS) {
try {
resource.versionControl(null);
} catch (DAVException dave) {
autoCheckIn(resource, true, false, info);
throw new DAVException("Unable to create versioned resource {0}.",
new Object[] { SVNEncodingUtil.xmlEncodeCDATA(resource.getResourceURI().getRequestURI()) },
HttpServletResponse.SC_CONFLICT, dave, 0);
}
info.setResourceVersioned(true);
}
if (resource.isVersioned() && !resource.isWorking()) {
boolean checkOutResource = false;
try {
checkOutResource = canAutoCheckOut(resource, lockProvider, resource.getAutoVersion());
} catch (DAVException dave) {
autoCheckIn(resource, true, false, info);
throw dave;
}
if (!checkOutResource) {
autoCheckIn(resource, true, false, info);
throw new DAVException("<DAV:cannot-modify-version-controlled-content>", HttpServletResponse.SC_CONFLICT, 0);
}
try {
checkOut(resource, true, false, false, null);
} catch (DAVException dave) {
autoCheckIn(resource, true, false, info);
throw new DAVException("Unable to checkout resource {0}.",
new Object[] { SVNEncodingUtil.xmlEncodeCDATA(resource.getResourceURI().getRequestURI()) },
HttpServletResponse.SC_CONFLICT, 0);
}
info.setResourceCheckedOut(true);