Skip to content

Conversation

@ekagra1602
Copy link

Summary

Describe the goal of this PR. Mention any related Issue numbers.

This PR fixes issue #501 partially.

Fix Details

This PR addresses 30 low-risk Error Prone warnings throughout the codebase to improve code quality and prevent potential issues.

Changes Summary:

DefaultCharset Fixes (8)

  • Added explicit UTF-8 charset specification instead of using platform defaults in:
    • MetadataSerializer.java (toJsonStr, fromJsonStr)
    • BulkApiRequestParser.java (ByteString.copyFromUtf8)
    • SpanFormatter.java (ByteString conversion)
    • ChunkSchema.java (String constructor)
    • RedactionStoredFieldVisitor.java (getBytes)
    • JsonUtil.java (getBytes)

FutureReturnValueIgnored Fixes (7)

  • Added explicit handling for ignored Future return values by storing in var unused variables:
    • BulkIngestApi.java (thenRun)
    • CachingChunkManager.java (submit)
    • ReadOnlyChunkImpl.java (updateAssignmentState)
    • DiskOrMessageCountBasedRolloverStrategy.java (scheduleAtFixedRate)
    • LuceneIndexStoreImpl.java (scheduleWithFixedDelay - both instances)

EqualsGetClass Improvements (7)

  • Replaced getClass() comparison with more flexible instanceof pattern:
    • AstraMetadata.java
    • ChunkInfo.java
    • SearchResult.java
    • LuceneFieldDef.java
    • SearchMetadata.java
    • ChunkSchema.java
    • RecoveryNodeMetadata.java

Type Conversion Improvements (5)

  • Added explicit casts for numeric type conversions:
    • FieldType.java (int literals to 0L, 0.0f)
    • LuceneIndexStoreImpl.java (ramBufferSizeMb to double)
    • AstraMergeScheduler.java (long to double)
    • RecoveryService.java (two long calculations to double)
    • AstraKafkaConsumer.java (int multiplication to long - 3000L)

Other Fixes (3)

  • Fixed BadImport issue in LogIndexSearcherImpl.java (SortField.Type qualification)
  • Fixed PreconditionsExpensiveString in AstraKafkaConsumer.java (removed String.format)
  • Fixed NotJavadoc in ZipkinService.java (/** to /*)

Requirements

cc @baroquebobcat for review, please let me know if you'd like anything adjusted.

@ekagra1602 ekagra1602 requested a review from baroquebobcat June 11, 2025 18:18

public static ChunkSchema deserializeBytes(byte[] bytes) throws IOException {
return serDe.fromJsonStr(new String(bytes));
return serDe.fromJsonStr(new String(bytes, UTF_8));
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's make sure this change is backwards compatible. Ensure no serde warnings when we deploy.

@ekagra1602 ekagra1602 merged commit 9958d40 into upstream-master Jun 18, 2025
2 checks passed
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.

4 participants