Fix HTTP resource leaks, header inconsistencies, and add test coverage
- Close CloseableHttpResponse via try-with-resources in BaseService and
  OauthService (previously only httpClient was closed, leaking response
  entity streams on every call)
- Replace BufferedReader line-by-line read with IOUtils.toString to stop
  silently dropping line breaks when reading HTTP response bodies
- Collapse identical OK/INVALID_REQUEST branches in BaseService.createResponse
- Extract duplicated header-builder logic from TrackingService/RateService
  into BaseService.generateBearerHeaders, and apply it to AddressService
  (which was missing the transId/transactionSrc headers the other two send)
- Add UNAUTHORIZED/FORBIDDEN/NOT_FOUND to HttpStatusCode so common UPS
  error codes get a real description instead of null
- Fix CodeUtils.shippingServiceCodeToString(null) throwing NPE instead of
  returning "Unknown" (Map.ofEntries rejects null key lookups)
- Guard AddressKeyFormat against a null postal code
- Remove pom.xml's pluginManagement override that hardcoded the compiler
  to source/target 1.8, contradicting the Java 17 properties from the
  prior upgrade commit and silently blocking newer language features
- Add Mockito-based unit tests for BaseService, OauthService,
  TrackingService, RateService, AddressService, UpsApi, and CodeUtils
  (test count: 3 -> 20)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 8175731 commit 582acd1032965ea8385e7275301c9cb4b432f1d2
@Your Name Your Name authored on 18 Jun
Showing 16 changed files
View
pom.xml
View
src/main/java/io/ljunggren/ups/api/model/HttpStatusCode.java
View
src/main/java/io/ljunggren/ups/api/model/validate/request/AddressKeyFormat.java
View
src/main/java/io/ljunggren/ups/api/service/AddressService.java
View
src/main/java/io/ljunggren/ups/api/service/BaseService.java
View
src/main/java/io/ljunggren/ups/api/service/OauthService.java
View
src/main/java/io/ljunggren/ups/api/service/RateService.java
View
src/main/java/io/ljunggren/ups/api/service/TrackingService.java
View
src/main/java/io/ljunggren/ups/api/util/CodeUtils.java
View
src/test/java/io/ljunggren/ups/api/UpsApiTest.java 0 → 100644
View
src/test/java/io/ljunggren/ups/api/service/AddressServiceTest.java 0 → 100644
View
src/test/java/io/ljunggren/ups/api/service/BaseServiceTest.java 0 → 100644
View
src/test/java/io/ljunggren/ups/api/service/OauthServiceTest.java 0 → 100644
View
src/test/java/io/ljunggren/ups/api/service/RateServiceTest.java 0 → 100644
View
src/test/java/io/ljunggren/ups/api/service/TrackingServiceTest.java 0 → 100644
View
src/test/java/io/ljunggren/ups/api/util/CodeUtilsTest.java 0 → 100644