Skip to content

Conversation

Copy link

Copilot AI commented Jan 21, 2026

Summary

ClassifiedListingEventDeserializer had unguarded Integer.parseInt() and Long.parseLong() calls that could throw uncaught exceptions on malformed JSON input.

Type of change

  • fix - Bug fix (non-breaking)

What changed?

Added fail-fast validation and exception handling:

String kindValue = generalMap.get("kind");
String createdAtValue = generalMap.get("created_at");

try {
  if (kindValue == null) {
    throw new IOException("Missing required field 'kind' in ClassifiedListingEvent");
  }
  if (createdAtValue == null) {
    throw new IOException("Missing required field 'created_at' in ClassifiedListingEvent");
  }
  
  int kindInt = Integer.parseInt(kindValue);
  long createdAt = Long.parseLong(createdAtValue);
  // ... rest of deserialization
} catch (NumberFormatException ex) {
  throw new IOException(
    String.format(
      "Failed to parse numeric field in ClassifiedListingEvent - kind='%s', created_at='%s': %s",
      kindValue, createdAtValue, ex.getMessage()),
    ex);
}

Changes:

  • Null checks for required fields before parsing
  • NumberFormatExceptionIOException with field context
  • Error messages include field names and values for debugging

Breaking changes

None.

Testing

  • Unit tests pass: mvn test
  • Integration tests pass: mvn verify (requires Docker)
  • CodeQL security scan: 0 alerts

Review focus

Error message format provides sufficient context for debugging malformed events?

Checklist

  • PR title follows conventional commits: type(scope): description
  • Changes are focused and under 300 lines (or stacked PRs)
  • Tests added/updated for new functionality
  • No new compiler warnings introduced
  • CHANGELOG.md updated (for user-facing changes)

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 3 commits January 21, 2026 13:32
Co-authored-by: tcheeric <6341500+tcheeric@users.noreply.github.com>
…Deserializer

Co-authored-by: tcheeric <6341500+tcheeric@users.noreply.github.com>
…erializer

Co-authored-by: tcheeric <6341500+tcheeric@users.noreply.github.com>
Copilot AI changed the title [WIP] WIP addressing feedback for Release v1.2.1 adjustments fix: handle NumberFormatException in ClassifiedListingEventDeserializer Jan 21, 2026
Copilot AI requested a review from tcheeric January 21, 2026 13:41
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