FSFS fsfs = resource.getFSFS();
FSTransactionInfo txn = resource.getTxnInfo();
Collection lockTokens = resource.getLockTokens();
String userName = resource.getUserName();
FSCommitter committer = getCommitter(fsfs, root, txn, lockTokens, userName);
ISVNDeltaConsumer deltaConsumer = getDeltaConsumer(root, committer, fsfs, userName, lockTokens);
SVNDeltaGenerator deltaGenerator = new SVNDeltaGenerator();
InputStream inputStream = null;
try {
inputStream = getRequestInputStream();
byte[] buffer = new byte[2048];
int readCount = -1;
while ((readCount = inputStream.read(buffer)) != -1) {
if (readCount == 0) {
continue;
}
if (deltaReader != null) {
deltaReader.nextWindow(buffer, 0, readCount, path, deltaConsumer);
} else {
deltaGenerator.sendDelta(path, buffer, readCount, deltaConsumer);
}
}
} catch (IOException ioe) {
error = new DAVException("An error occurred while reading the request body.", HttpServletResponse.SC_BAD_REQUEST, 0);
} catch (SVNException svne) {
error = DAVException.convertError(svne.getErrorMessage(), HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
"could not write the file contents", null);
} finally {
SVNFileUtil.closeFile(inputStream);
if (deltaReader != null) {
try {
deltaReader.reset(path, deltaConsumer);
} catch (SVNException svne) {
error2 = DAVException.convertError(svne.getErrorMessage(), HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
"error finalizing applying windows", null);
}
if (error2 != null && error == null) {
error = error2;
}
deltaConsumer.textDeltaEnd(path);
}
}
}
if (error == null) {