String path = resource.getResourceURI().getPath();
FSRoot root = resource.getRoot();
FSFS fsfs = resource.getFSFS();
FSTransactionInfo txn = resource.getTxnInfo();
FSCommitter committer = getCommitter(fsfs, root, txn, resource.getLockTokens(), resource.getUserName());
SVNNodeKind kind = DAVServletUtil.checkPath(resource.getRoot(), resource.getResourceURI().getPath());
if (kind == SVNNodeKind.NONE) {
try {
committer.makeFile(path);
} catch (SVNException svne) {
throw DAVException.convertError(svne.getErrorMessage(), HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
"Could not create file within the repository.", null);
}
}
if (resource.isAutoCheckedOut() && myRequest.getContentType() != null) {
SVNProperties props = null;
try {
props = fsfs.getProperties(root.getRevisionNode(path));
} catch (SVNException svne) {
throw DAVException.convertError(svne.getErrorMessage(), HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
"Error fetching mime-type property.", null);
}
String mimeType = props.getStringValue(SVNProperty.MIME_TYPE);
if (mimeType == null) {
try {
committer.changeNodeProperty(path, SVNProperty.MIME_TYPE, SVNPropertyValue.create(myRequest.getContentType()));
} catch (SVNException svne) {
throw DAVException.convertError(svne.getErrorMessage(), HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
"Could not set mime-type property.", null);
}
}