MCPcopy Index your code
hub / github.com/jgraph/drawio / checkPatch

Method checkPatch

src/main/java/com/mxgraph/online/AbsCache.java:259–290  ·  view source on GitHub ↗

Removes the given patch if the secret does not match.

(String id, String current, String secret)

Source from the content-addressed store, hash-verified

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)

Callers 1

addPatchMethod · 0.95

Calls 9

createLastVersionKeyMethod · 0.95
createCacheEntryKeyMethod · 0.95
getSecretMethod · 0.95
debugMethod · 0.95
removeMethod · 0.45
toStringMethod · 0.45
getMethod · 0.45
equalsMethod · 0.45
putMethod · 0.45

Tested by

no test coverage detected