@@ -49,6 +49,7 @@ public OperationManager(Auth auth, Configuration cfg) {
4949 public OperationManager (Auth auth , Client client ) {
5050 this .auth = auth ;
5151 this .client = client ;
52+ this .configuration = new Configuration ();
5253 }
5354
5455 /**
@@ -84,7 +85,11 @@ public String pfop(String bucket, String key, String fops, StringMap params) thr
8485 String url = configuration .apiHost (auth .accessKey , bucket ) + "/pfop/" ;
8586 StringMap headers = auth .authorization (url , data , Client .FormMime );
8687 Response response = client .post (url , data , headers , Client .FormMime );
88+ if (!response .isOK ()) {
89+ throw new QiniuException (response );
90+ }
8791 PfopResult status = response .jsonToObject (PfopResult .class );
92+ response .close ();
8893 if (status != null ) {
8994 return status .persistentId ;
9095 }
@@ -167,6 +172,11 @@ public <T> T prefop(String persistentId, Class<T> retClass) throws QiniuExceptio
167172 byte [] data = StringUtils .utf8Bytes (params .formString ());
168173 String url = String .format ("%s/status/get/prefop" , configuration .apiHost ());
169174 Response response = this .client .post (url , data , null , Client .FormMime );
170- return response .jsonToObject (retClass );
175+ if (!response .isOK ()) {
176+ throw new QiniuException (response );
177+ }
178+ T object = response .jsonToObject (retClass );
179+ response .close ();
180+ return object ;
171181 }
172182}
0 commit comments