Skip to content

Commit

Permalink
0000753: The url for extracting a batch http://server:31415/sync/batc…
Browse files Browse the repository at this point in the history
…h/nodeid-batchid [^] does not work if the nodeid has a '-' in it
  • Loading branch information
chenson42 committed Aug 8, 2012
1 parent 4bc6a8d commit f8770a5
Showing 1 changed file with 10 additions and 6 deletions.
Expand Up @@ -50,13 +50,17 @@ public void handleWithCompression(HttpServletRequest req, HttpServletResponse re
int batchIdStartIndex = path.lastIndexOf("/") + 1;
String nodeIdBatchId = path.substring(batchIdStartIndex);
if (nodeIdBatchId.contains("-")) {
String[] array = nodeIdBatchId.split("-");
String nodeId = array[0];
String batchId = array[1];
if (!write(batchId, nodeId, res.getOutputStream())) {
ServletUtils.sendError(res, HttpServletResponse.SC_NOT_FOUND);
int dashIndex = nodeIdBatchId.lastIndexOf("-");
if (dashIndex > 0) {
String nodeId = nodeIdBatchId.substring(0, dashIndex);
String batchId = nodeIdBatchId.substring(dashIndex+1, nodeIdBatchId.length());
if (!write(batchId, nodeId, res.getOutputStream())) {
ServletUtils.sendError(res, HttpServletResponse.SC_NOT_FOUND);
} else {
res.flushBuffer();
}
} else {
res.flushBuffer();
ServletUtils.sendError(res, HttpServletResponse.SC_NOT_FOUND);
}
} else {
ServletUtils.sendError(res, HttpServletResponse.SC_NOT_FOUND);
Expand Down

0 comments on commit f8770a5

Please sign in to comment.