This repository was archived by the owner on Dec 6, 2024. It is now read-only.
File tree Expand file tree Collapse file tree
src/main/java/synapticloop/b2/response Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -76,11 +76,7 @@ public B2FileInfoResponse(final JSONObject response) throws B2ApiException {
7676 }
7777 catch (IllegalArgumentException e ) {
7878 LOGGER .warn ("Unknown action value " + action );
79- this .action = null ;
8079 }
81- } else {
82- // Default
83- this .action = Action .upload ;
8480 }
8581
8682 this .size = this .readLong (B2ResponseProperties .KEY_SIZE );
Original file line number Diff line number Diff line change 2424import org .slf4j .Logger ;
2525import org .slf4j .LoggerFactory ;
2626
27+ import synapticloop .b2 .Action ;
2728import synapticloop .b2 .exception .B2ApiException ;
2829
2930public class B2FileResponse extends BaseB2Response {
@@ -37,6 +38,7 @@ public class B2FileResponse extends BaseB2Response {
3738 private final String contentSha1 ;
3839 private final String contentType ;
3940 private final Map <String , String > fileInfo ;
41+ private Action action ;
4042
4143 /**
4244 * Instantiate a file response with the JSON response as a string from
@@ -69,6 +71,16 @@ public B2FileResponse(String json) throws B2ApiException {
6971 }
7072 }
7173
74+ String action = this .readString (B2ResponseProperties .KEY_ACTION );
75+ if (null != action ) {
76+ try {
77+ this .action = Action .valueOf (action );
78+ }
79+ catch (IllegalArgumentException e ) {
80+ LOGGER .warn ("Unknown action value " + action );
81+ }
82+ }
83+
7284 this .warnOnMissedKeys ();
7385 }
7486
Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ public class B2FinishLargeFileResponse extends BaseB2Response {
3838 private final String contentType ;
3939
4040 private final Map <String , String > fileInfo ;
41- private final Action action ;
41+ private Action action ;
4242
4343 public B2FinishLargeFileResponse (final String json ) throws B2ApiException {
4444 super (json );
@@ -63,10 +63,12 @@ public B2FinishLargeFileResponse(final String json) throws B2ApiException {
6363
6464 String action = this .readString (B2ResponseProperties .KEY_ACTION );
6565 if (null != action ) {
66- this .action = Action .valueOf (action );
67- } else {
68- // Default
69- this .action = Action .upload ;
66+ try {
67+ this .action = Action .valueOf (action );
68+ }
69+ catch (IllegalArgumentException e ) {
70+ LOGGER .warn ("Unknown action value " + action );
71+ }
7072 }
7173
7274 this .warnOnMissedKeys ();
You can’t perform that action at this time.
0 commit comments