teragrep / cfe_31

0 stars 0 forks source link

Fix errorprone warnings from compiler #31

Open MoonBow-1 opened 6 months ago

MoonBow-1 commented 6 months ago

Description

There are 39 warnings about error-prone code, mostly NonApiType ArrayLists and missing locale declarations.

MoonBow-1 commented 6 months ago

Inconsistent capitalization found in:

Before:

public HostInterfacePayload(final String interfaceType, final int hostMetaID) {
    this.interfaceType = interfaceType;
    hostMetaId = hostMetaID;
}
public HostIPPayload(final String ipAddress, final int hostMetaID) {
    this.ipAddress = ipAddress;
    hostMetaId = hostMetaID;
}

After:

public HostInterfacePayload(final String interfaceType, final int hostMetaId) {
    this.interfaceType = interfaceType;
    this.hostMetaId = hostMetaId;
}
public HostIPPayload(final String ipAddress, final int hostMetaId) {
    this.ipAddress = ipAddress;
    this.hostMetaId = hostMetaId;
}
MoonBow-1 commented 6 months ago

StringCaseLocaleUsage fix:

Before:

.toLowerCase()

After:

.toLowerCase(Locale.forLanguageTag("fi"))

Uses IETF language tags

MoonBow-1 commented 6 months ago

NonApiType warnings fixed:

Before:

ArrayList<x> list = new ArrayList<>();

After:

List<x> list = new ArrayList<>();
MoonBow-1 commented 6 months ago

DefaultCharset warnings fixed:

Before:

string.getBytes();

After:

string.getBytes(StandardCharsets.UTF_8);
MoonBow-1 commented 6 months ago

ZonedDateTime warning fixed:

Before:

return ZonedDateTime
    .now()
    .format(DateTimeFormatter.ISO_INSTANT);

After:

return ZonedDateTime
    .now(ZoneId.systemDefault())
    .format(DateTimeFormatter.ISO_INSTANT);