Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sanitize maps and lists for JSONObject consumption #657

Merged
merged 4 commits into from
Oct 19, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions nab/src/org/labkey/nab/GetNabRunsAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import org.labkey.api.security.RequiresPermission;
import org.labkey.api.security.User;
import org.labkey.api.security.permissions.ReadPermission;
import org.labkey.api.util.JsonUtil;
import org.labkey.api.view.DataView;
import org.labkey.api.view.NotFoundException;
import org.springframework.validation.BindException;
Expand All @@ -49,12 +50,6 @@
import java.util.List;
import java.util.Map;

/*
* User: brittp
* Date: Dec 9, 2008
* Time: 5:13:30 PM
*/

@RequiresPermission(ReadPermission.class)
@ApiVersion(9.1)
public class GetNabRunsAction extends ReadOnlyApiAction<GetNabRunsAction.GetNabRunsForm>
Expand Down Expand Up @@ -208,6 +203,8 @@ public ApiResponse execute(GetNabRunsForm form, BindException errors) throws Exc
form.isIncludeStats(), form.isIncludeWells(), form.isCalculateNeut(), form.isIncludeFitParameters()));

}
// Recursively replace all +Infinity, -Infinity, and NaN values with JSON-legal values
JsonUtil.sanitizeMap(response);
return new ApiSimpleResponse(response);
}
}
8 changes: 2 additions & 6 deletions nab/src/org/labkey/nab/GetStudyNabRunsAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import org.labkey.api.security.permissions.ReadPermission;
import org.labkey.api.assay.AssayProvider;
import org.labkey.api.assay.AssayService;
import org.labkey.api.util.JsonUtil;
import org.labkey.api.util.Pair;
import org.springframework.validation.BindException;

Expand All @@ -37,12 +38,6 @@
import java.util.Map;
import java.util.Set;

/*
* User: brittp
* Date: March 4, 2010
* Time: 5:13:30 PM
*/

@RequiresPermission(ReadPermission.class)
@ApiVersion(10.1)
public class GetStudyNabRunsAction extends ReadOnlyApiAction<GetStudyNabRunsAction.GetStudyNabRunsForm>
Expand Down Expand Up @@ -86,6 +81,7 @@ public ApiResponse execute(GetStudyNabRunsForm form, BindException errors) throw
return null;
else
{
JsonUtil.sanitizeMap(properties);
return new ApiSimpleResponse(properties);
}
}
Expand Down
4 changes: 0 additions & 4 deletions nab/src/org/labkey/nab/NabRunPropertyMap.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,6 @@
import java.util.List;
import java.util.Map;

/**
* User: brittp
* Date: Mar 12, 2010 9:43:44 AM
*/
public class NabRunPropertyMap extends HashMap<String, Object>
{
private static class PropertyNameMap extends HashMap<String, Object>
Expand Down