question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Consider tightening `AuditEventRepository` contract

See original GitHub issue

AuditEventRepository exposes 3 operations for retrieving AuditEvents:

  • AuditEventRepository#find(java.util.Date)
  • AuditEventRepository#find(java.lang.String, java.util.Date)
  • AuditEventRepository#find(java.lang.String, java.util.Date, java.lang.String)

All of these operations allow their parameters to be null which IMO isn’t ideal, and is also somewhat confusing as all the retrieval options can actually be expressed using AuditEventRepository#find(java.lang.String, java.util.Date, java.lang.String).

Perhaps AuditEventRepository contract could be tightened so that it wouldn’t allow null parameters? This was actually proposed in #5854 as a part of improvements to AuditEventRepository however at the time the change wasn’t feasible due to backward compatibility considerations. The upcoming 2.0 could be the chance to revisit this.

It’s also worth noting that auditevents Endpoint already behaves inline with what’s proposed above as it requires the presence of after parameter.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
wilkinsonacommented, Jan 8, 2018

If we agree that after can be null, I’m not sure that the status quo is the ideal. I think we should consider either overloading the method with all possible combinations of the three parameters, or only offering a single find method that allows any of the parameters to be null. We currently seem to have an arbitrarily chosen set of overloads that leave us halfway between the two options.

0reactions
wilkinsonacommented, Jan 10, 2018

We’ve agreed to go with a single method that takes all three, possibly null parameters:

List<AuditEvent> find(String principal, Date after, String type)
Read more comments on GitHub >

github_iconTop Results From Across the Web

AuditEventRepository (Spring Boot 3.0.0 API)
Find audit events of specified type relating to the specified principal that occurred after the time provided. Parameters: principal - the principal name...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found