Description
mreutegg, while working on OAK-9343 i noticed that JcrLastModifiedConflictHandler is prone to NPE as ISO8601.parse may return null. the return values however are passed to the 'pick' method which doesn't handle a potential null value... a similar problem was spotted with ExternalIdentityConflictHandler (see also OAK-8700).
private static void merge(@NotNull NodeBuilder parent, @NotNull PropertyState ours, @NotNull PropertyState theirs) { Calendar o = parse(ours.getValue(Type.DATE)); Calendar t = parse(theirs.getValue(Type.DATE)); if (JCR_CREATED.equals(ours.getName())) { parent.setProperty(ours.getName(), pick(o, t, true)); } else { parent.setProperty(ours.getName(), pick(o, t, false)); } } private static Calendar pick(Calendar a, Calendar b, boolean jcrCreated) { if (a.before(b)) { return jcrCreated ? a : b; } else { return jcrCreated ? b : a; } }
Attachments
Attachments
Issue Links
- relates to
-
OAK-9343 Missing NotNull annotations with implementations of ThreeWayConflictHandler
- Closed