Removes the given patch if the secret does not match.
(String id, String current, String secret)
| 257 | * Removes the given patch if the secret does not match. |
| 258 | */ |
| 259 | protected void checkPatch(String id, String current, String secret) |
| 260 | { |
| 261 | Object lastVersion = cache.remove(createLastVersionKey(id, current)); |
| 262 | |
| 263 | if (lastVersion != null) |
| 264 | { |
| 265 | String key = createCacheEntryKey(id, lastVersion.toString()); |
| 266 | CacheEntry entry = (CacheEntry) cache.get(key); |
| 267 | |
| 268 | if (entry != null) |
| 269 | { |
| 270 | if (entry.getSecret() == null || !entry.getSecret().equals(secret)) |
| 271 | { |
| 272 | cache.remove(key); |
| 273 | debug("patch removed id=" + id + " from=" + lastVersion |
| 274 | + " to=" + current); |
| 275 | |
| 276 | // Marks the chain as incomplete |
| 277 | cache.put(key, new CacheEntry(null, null, null)); |
| 278 | } |
| 279 | else |
| 280 | { |
| 281 | debug("patch checked id=" + id + " from=" + lastVersion |
| 282 | + " to=" + current); |
| 283 | } |
| 284 | } |
| 285 | } |
| 286 | else |
| 287 | { |
| 288 | debug("check patch no last version for id=" + id + " current=" + current); |
| 289 | } |
| 290 | } |
| 291 | |
| 292 | /** |
| 293 | * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) |
no test coverage detected