Skip to content

Commit c4e7810

Browse files
authored
RowsResponse: stash _requiredVersion before data fixup (#49)
1 parent 2d3370c commit c4e7810

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

CHANGELOG.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33
## version 5.1.0-SNAPSHOT
44
*Released*: TBD
55

6+
## version 5.0.1
7+
*Released*: 30 January 2023
8+
* Fix regression introduced in 5.0.0: `RowsResponse.fixupParsedData()` was called before `_requiredVersion` was set. This caused
9+
the fixup method to skip `BigDecimal` to `Double` conversions in the returned data maps.
10+
611
## version 5.0.0
712
*Released*: 24 January 2023
813
* Refactor the `Command` class hierarchy:
@@ -23,7 +28,7 @@
2328
* Introduce `HasRequiredVersion` interface and use it when instantiating `CommandResponse` subclasses that need required version
2429
* Remove all `Command` copy constructors. Same rationale as the earlier removal of `copy` methods.
2530
* Switch `SelectRowsCommand` and `NAbRunsCommand` to post their parameters as JSON
26-
* Fix NAbReplicate to handle `"NaN"` values
31+
* Fix `NAbReplicate` to handle `"NaN"` values
2732
* Remove `CommandException` from `getHttpRequest()` throws list
2833
* Adjust the `Demo.java` and `Test.java` tests to match current sample data and `Command` hierarchy changes
2934

gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ artifactory_contextUrl=https://labkey.jfrog.io/artifactory
77
sourceCompatibility=17
88
targetCompatibility=17
99

10-
gradlePluginsVersion=1.39.0
10+
gradlePluginsVersion=1.39.1
1111

1212
commonsCodecVersion=1.15
1313
commonsLoggingVersion=1.2
1414

1515
hamcrestVersion=1.3
1616

1717
httpclient5Version=5.2.1
18-
httpcore5Version=5.2
18+
httpcore5Version=5.2.1
1919

2020
jsonObjectVersion=20220924
2121

src/org/labkey/remoteapi/query/RowsResponse.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,17 @@ abstract class RowsResponse extends CommandResponse
4747
RowsResponse(String text, int statusCode, String contentType, JSONObject json, HasRequiredVersion hasRequiredVersion)
4848
{
4949
super(text, statusCode, contentType, json);
50-
fixupParsedData();
51-
caseInsensitizeRowMaps();
5250
_requiredVersion = hasRequiredVersion.getRequiredVersion();
51+
fixupParsedData(_requiredVersion);
52+
caseInsensitizeRowMaps();
5353
}
5454

5555
/**
5656
* Returns the API version number required by the source command. This response returns data in a different format
5757
* depending on the required version
5858
* @return the requested API version number
5959
*/
60+
@Deprecated // Just needed for fixup -- exposing this outside the class seems unnecessary. TODO: Remove this in v6.0.0
6061
public double getRequiredVersion()
6162
{
6263
return _requiredVersion;
@@ -83,7 +84,7 @@ public List<Map<String, Object>> getRows()
8384
/**
8485
* Fixes up the parsed data. Currently, this converts string-based date literals into real Java Date objects.
8586
*/
86-
private void fixupParsedData()
87+
private void fixupParsedData(double requiredVersion)
8788
{
8889
if (null == getParsedData())
8990
return;
@@ -124,7 +125,7 @@ else if ("int".equalsIgnoreCase(type))
124125
// date classes. If this format ever changes, we'll need to change the format string used here.
125126
// CONSIDER: use a library like ConvertUtils to avoid this dependency?
126127
DateParser dateFormat = new DateParser();
127-
boolean expandedFormat = getRequiredVersion() == 9.1;
128+
boolean expandedFormat = requiredVersion == 9.1;
128129

129130
for (Map<String, Object> row : rows)
130131
{

0 commit comments

Comments
 (0)