[
https://issues.apache.org/jira/browse/GOBBLIN-2158?focusedWorklogId=935125&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-935125
]
ASF GitHub Bot logged work on GOBBLIN-2158:
-------------------------------------------
Author: ASF GitHub Bot
Created on: 18/Sep/24 05:34
Start Date: 18/Sep/24 05:34
Worklog Time Spent: 10m
Work Description: pratapaditya04 commented on PR #4057:
URL: https://github.com/apache/gobblin/pull/4057#issuecomment-2357539654
> @pratapaditya04 this is the default implementation of LONG_OR_DOUBLE enum
policy present in the library
>
> ```
> LONG_OR_DOUBLE {
> @Override public Number readNumber(JsonReader in) throws IOException,
JsonParseException {
> String value = in.nextString();
> try {
> return Long.parseLong(value);
> } catch (NumberFormatException longE) {
> try {
> Double d = Double.valueOf(value);
> if ((d.isInfinite() || d.isNaN()) && !in.isLenient()) {
> throw new MalformedJsonException("JSON forbids NaN and
infinities: " + d + "; at path " + in.getPath());
> }
> return d;
> } catch (NumberFormatException doubleE) {
> throw new JsonParseException("Cannot parse " + value + "; at path
" + in.getPath(), doubleE);
> }
> }
> }
> },
> ```
>
> I have tried to just add one more layer on top to parse Int that's why
exception and naming i have kept similar to library implementation
Hmmm, but still 3 layers of nesting impacts readability a lot, so breaking
down into smaller functions can be a possible alternative,but leaving it upto
you on how to handle it. Also naming exception variables var3, var2, doesn't
seem right.
Issue Time Tracking
-------------------
Worklog Id: (was: 935125)
Time Spent: 2h 10m (was: 2h)
> Upgrade GSON version to 2.8.9
> -----------------------------
>
> Key: GOBBLIN-2158
> URL: https://issues.apache.org/jira/browse/GOBBLIN-2158
> Project: Apache Gobblin
> Issue Type: Task
> Reporter: Vivek Rai
> Priority: Major
> Time Spent: 2h 10m
> Remaining Estimate: 0h
>
> Upgrade GSON version to 2.8.9 and add a custom ObjectToIntegerDeserialize
> policy to avoid getting integer converted to double or long while deserialize.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)