Fix #122: Change transfer field getter/setter type from Long to Double#128
Open
namaskrutipal wants to merge 1 commit intojeevatkm:masterfrom
Open
Fix #122: Change transfer field getter/setter type from Long to Double#128namaskrutipal wants to merge 1 commit intojeevatkm:masterfrom
namaskrutipal wants to merge 1 commit intojeevatkm:masterfrom
Conversation
…to Double The DigitalOcean API returns decimal values for the transfer field (e.g., 0.5 TB), which was causing JsonSyntaxException when the getter/setter methods expected Long type. Updated getter and setter methods to use Double type to match the field declaration and properly handle both integer and decimal transfer values.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The DigitalOcean API returns decimal values for the transfer field (e.g., 0.5 TB), which was causing JsonSyntaxException when the getter/setter methods expected Long type. Updated getter and setter methods to use Double type to match the field declaration and properly handle both integer and decimal transfer values.
Problem
The
getAvailableSizes()method was throwingJsonSyntaxExceptionbecause thetransferfield getter and setter methods were defined asLong, while the field itself was already declared asDouble. The DigitalOcean API returns decimal values (e.g., 0.5 TB for smaller droplet sizes), causing a type mismatch during JSON deserialization.Solution
Updated the getter and setter methods for the
transferfield inSize.javato useDoubletype instead ofLong, matching the field declaration.Changes Made
Size.java:getTransfer()return type fromLongtoDoublesetTransfer(Long transfer)parameter type fromLongtoDoubleTesting
./mvnw verifysuccessfully./mvnw com.coveo:fmt-maven-plugin:formatAPI Response Example
The DigitalOcean API returns:
{ "transfer": 0.5, "price_monthly": 4, "price_hourly": 0.00595 }This change ensures the API response can be properly deserialized without exceptions.