stone9981/httpsqs

Java客户端中HttpsqsStatus正则表达式有bug

Opened this issue · 0 comments

HttpsqsStatus.java line58:
protected static Pattern pattern = Pattern.compile("HTTP Simple Queue Service 
v(.+?)\\s(?:.+?)\\sQueue Name: (.+?)\\sMaximum number of queues: (\\d+)\\sPut 
position of queue \\((\\d+)st lap\\): (\\d+)\\sGet position of queue 
\\((\\d+)st lap\\): (\\d+)\\sNumber of unread queue: (\\d+)");

since the client use (\\d+)st lap to match the first lap, it will cause regex 
matching failed when the unread number goes into lap 2 or latter.

I change the pattern as follows:
protected static Pattern pattern = Pattern.compile("HTTP Simple Queue Service 
v(.+?)\\s(?:.+?)\\sQueue Name: (.+?)\\sMaximum number of queues: (\\d+)\\sPut 
position of queue \\((\\d+)\\w\\w lap\\): (\\d+)\\sGet position of queue 
\\((\\d+)\\w\\w lap\\): (\\d+)\\sNumber of unread queue: (\\d+)");

hope this would help

Original issue reported on code.google.com by imco...@gmail.com on 7 Jan 2011 at 8:16