Skip to content

Commit a59c6bb

Browse files
DmitryLitvintsevmksahakyan
authored andcommitted
WLCG tape API: do not report empty fields in json responses
Motivation ---------- Commit 36d6a5e added reporting null and default value fields. Turns out FTS (CERN File Transfer Service), when it processes REST API Reponse checks the "error" field and considers request failed if the field is present (ignoring that it has null value) Modification ------------ Annotate classes used by WCLG tape API w/ @JsonInclude(JsonInclude.Include.NON_NULL) to skip null fields only for WCLC tape rest api Result ------ No null error is reported Acked-by: Chris Green Patch: https://rb.dcache.org/r/14512/ Target: trunk Request: 11.x, 10.x, 9.x Require-book: no Require-notes: yes
1 parent f20b403 commit a59c6bb

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

modules/dcache-frontend/src/main/java/org/dcache/restful/providers/tape/ArchiveInfo.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,16 @@ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
5959
*/
6060
package org.dcache.restful.providers.tape;
6161

62+
import com.fasterxml.jackson.annotation.JsonInclude;
6263
import diskCacheV111.util.FileLocality;
6364
import java.io.Serializable;
6465

6566
/**
6667
* Specialized for WLCG archiveinfo, encapsulates path, file locality and error message.
68+
* The JsonInclude(JsonInclude.Include.NON_NULL) is added to skip null fields that WLCG
69+
* REST API expects
6770
*/
71+
@JsonInclude(JsonInclude.Include.NON_NULL)
6872
public class ArchiveInfo implements Serializable {
6973

7074
private static final long serialVersionUID = 3273661715952056706L;

modules/dcache-frontend/src/main/java/org/dcache/restful/providers/tape/StageRequestInfo.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
5959
*/
6060
package org.dcache.restful.providers.tape;
6161

62+
import com.fasterxml.jackson.annotation.JsonInclude;
6263
import java.io.Serializable;
6364
import java.util.ArrayList;
6465
import java.util.List;
@@ -90,7 +91,12 @@ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
9091
* <td>The files that got submitted and their state/disk residency.</td>
9192
* </tr>
9293
* </table>
94+
*
95+
* The JsonInclude(JsonInclude.Include.NON_NULL) is added to skip null fields that WLCG
96+
* REST API expects
9397
*/
98+
99+
@JsonInclude(JsonInclude.Include.NON_NULL)
94100
public class StageRequestInfo implements Serializable {
95101

96102
private static final long serialVersionUID = 1269517713600606880L;

modules/dcache-frontend/src/main/java/org/dcache/restful/providers/tape/StagedFileInfo.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
5959
*/
6060
package org.dcache.restful.providers.tape;
6161

62+
import com.fasterxml.jackson.annotation.JsonInclude;
6263
import java.io.Serializable;
6364
import org.dcache.services.bulk.BulkRequestTargetInfo;
6465

@@ -96,7 +97,12 @@ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
9697
*
9798
* <p> From the above, it will be dCache policy always to return state and not onDisk unless
9899
* the former is not set.
100+
*
101+
* The JsonInclude(JsonInclude.Include.NON_NULL) is added to skip null fields that WLCG
102+
* REST API expects
99103
*/
104+
105+
@JsonInclude(JsonInclude.Include.NON_NULL)
100106
public class StagedFileInfo implements Serializable {
101107

102108
private static final long serialVersionUID = 7530936044659226339L;

0 commit comments

Comments
 (0)