Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace Deprecated Calls #21

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open

Conversation

SethSmucker
Copy link
Collaborator

Replace several straightforward deprecated calls with their suggested replacements.

part of NationalSecurityAgency/datawave#2443

@SethSmucker SethSmucker self-assigned this Sep 24, 2024
@@ -127,7 +128,7 @@ protected boolean principalChanged(HttpServletRequest request, Authentication cu
}

protected List<SubjectIssuerDNPair> getSubjectIssuerDNPairs(String proxiedSubjects, String proxiedIssuers) {
if (StringUtils.isEmpty(proxiedSubjects)) {
if (ObjectUtils.isEmpty(proxiedSubjects)) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using this method has overhead as it has to do isInstanceOf checks. I would prefer to use !StringUtils.hasLength(proxiedSubjects)

ScheduledReporter reporter = factory.forRegistry(metricRegistry).convertRatesTo(TimeUnit.SECONDS).convertDurationsTo(TimeUnit.MILLISECONDS)
.build(configProps.getHost(), configProps.getPort());
registerReporter(reporter).start(configProps.getInterval(), configProps.getIntervalUnit());
} catch (InstantiationException | IllegalAccessException e) {
throw new RuntimeException("Unable to instantiate metrics reporter factory class " + configProps.getFactoryClass() + ": " + e.getMessage(), e);
} catch (InvocationTargetException e) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you could have simply added these addition exceptions to the previous catch clause.

throw new HttpMessageNotReadableException("Unable to read protostuff message: " + e.getMessage(), e, inputMessage);
} catch (InvocationTargetException e) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer adding this exception to the previous clause instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants