diff --git a/README.md b/README.md
index 9e192903..2dfa8932 100644
--- a/README.md
+++ b/README.md
@@ -24,7 +24,7 @@ The recommended way to use the Aliyun OSS SDK for Java in your project is to con
com.aliyun.oss
aliyun-sdk-oss
- 2.8.2
+ 2.8.3
```
diff --git a/pom.xml b/pom.xml
index e3626be6..6b90ead8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -11,7 +11,7 @@
com.aliyun.oss
aliyun-sdk-oss
- 2.8.2
+ 2.8.3
jar
Aliyun OSS SDK for Java
The Aliyun OSS SDK for Java used for accessing Aliyun Object Storage Service
@@ -30,10 +30,16 @@
1.1
- net.sf.json-lib
- json-lib
- 2.4
- jdk15
+ com.sun.jersey
+ jersey-json
+ 1.9
+ test
+
+
+ stax
+ stax-api
+
+
junit
diff --git a/src/test/java/com/aliyun/oss/integrationtests/ImageProcessTest.java b/src/test/java/com/aliyun/oss/integrationtests/ImageProcessTest.java
index 43194229..b61548fe 100644
--- a/src/test/java/com/aliyun/oss/integrationtests/ImageProcessTest.java
+++ b/src/test/java/com/aliyun/oss/integrationtests/ImageProcessTest.java
@@ -26,9 +26,9 @@
import java.util.Date;
import junit.framework.Assert;
-import net.sf.json.JSONObject;
-import org.apache.commons.beanutils.PropertyUtils;
+import org.codehaus.jettison.json.JSONException;
+import org.codehaus.jettison.json.JSONObject;
import org.junit.Test;
import com.aliyun.oss.HttpMethod;
@@ -264,7 +264,7 @@ public void testGeneratePresignedUrlWithProcess() {
}
}
- private static ImageInfo getImageInfo(final String bucket, final String image) throws IOException, IllegalAccessException, InvocationTargetException, NoSuchMethodException {
+ private static ImageInfo getImageInfo(final String bucket, final String image) throws IOException, IllegalAccessException, InvocationTargetException, NoSuchMethodException, JSONException {
GetObjectRequest request = new GetObjectRequest(bucketName, image);
request.setProcess("image/info");
OSSObject ossObject = ossClient.getObject(request);
@@ -272,14 +272,12 @@ private static ImageInfo getImageInfo(final String bucket, final String image) t
String jsonStr = IOUtils.readStreamAsString(ossObject.getObjectContent(), "UTF-8");
ossObject.getObjectContent().close();
- JSONObject jsonObject = JSONObject.fromObject(jsonStr);
- Object bean = JSONObject.toBean(jsonObject);
-
- long height = Long.parseLong((String) PropertyUtils.getProperty(PropertyUtils.getProperty(bean, "ImageHeight"), "value"));
- long width = Long.parseLong((String) PropertyUtils.getProperty(PropertyUtils.getProperty(bean, "ImageWidth"), "value"));
- long size = Long.parseLong((String) PropertyUtils.getProperty(PropertyUtils.getProperty(bean, "FileSize"), "value"));
- String format = (String) PropertyUtils.getProperty(PropertyUtils.getProperty(bean, "Format"), "value");
-
+ JSONObject jsonObject = new JSONObject(jsonStr);
+
+ long height = jsonObject.getJSONObject("ImageHeight").getLong("value");
+ long width = jsonObject.getJSONObject("ImageWidth").getLong("value");
+ long size = jsonObject.getJSONObject("FileSize").getLong("value");
+ String format = jsonObject.getJSONObject("Format").getString("value");
return new ImageInfo(height, width, size, format);
}
diff --git a/src/test/java/com/aliyun/oss/integrationtests/SecurityTokenTest.java b/src/test/java/com/aliyun/oss/integrationtests/SecurityTokenTest.java
index c198f1b8..1e3f9df0 100644
--- a/src/test/java/com/aliyun/oss/integrationtests/SecurityTokenTest.java
+++ b/src/test/java/com/aliyun/oss/integrationtests/SecurityTokenTest.java
@@ -32,6 +32,7 @@
import junit.framework.Assert;
+import org.codehaus.jettison.json.JSONException;
import org.junit.Ignore;
import org.junit.Test;
@@ -72,7 +73,7 @@ public class SecurityTokenTest {
@SuppressWarnings("deprecation")
@Test
- public void testBucketOperationsWithToken() {
+ public void testBucketOperationsWithToken() throws JSONException {
List actions = new ArrayList();
actions.add("oss:ListBuckets");
List resources = new ArrayList();
@@ -417,7 +418,7 @@ public void testBucketOperationsWithToken() {
}
@Test
- public void testObjectOperationsWithToken() {
+ public void testObjectOperationsWithToken() throws JSONException {
List actions = new ArrayList();
List resources = new ArrayList();
diff --git a/src/test/java/com/aliyun/oss/integrationtests/TestUtils.java b/src/test/java/com/aliyun/oss/integrationtests/TestUtils.java
index ba5aaa5f..a8fc81f0 100644
--- a/src/test/java/com/aliyun/oss/integrationtests/TestUtils.java
+++ b/src/test/java/com/aliyun/oss/integrationtests/TestUtils.java
@@ -43,8 +43,6 @@
import javax.net.ssl.X509TrustManager;
import junit.framework.Assert;
-import net.sf.json.JSONArray;
-import net.sf.json.JSONObject;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
@@ -65,6 +63,9 @@
import com.aliyun.oss.model.InitiateMultipartUploadRequest;
import com.aliyun.oss.model.InitiateMultipartUploadResult;
import com.aliyun.oss.model.PartETag;
+import org.codehaus.jettison.json.JSONArray;
+import org.codehaus.jettison.json.JSONException;
+import org.codehaus.jettison.json.JSONObject;
@SuppressWarnings("deprecation")
public class TestUtils {
@@ -342,21 +343,21 @@ public void setSecurityToken(String securityToken) {
}
}
- public static OSSClient createSessionClient(List actions, List resources) {
+ public static OSSClient createSessionClient(List actions, List resources) throws JSONException {
String tokenPolicy = jsonizeTokenPolicy(actions, resources, true);
StsToken token = getStsToken("", "", 3600, tokenPolicy);
return new OSSClient(OSS_TEST_ENDPOINT, token.accessKeyId, token.secretAccessKey, token.securityToken,
new ClientConfiguration().setSupportCname(false));
}
- public static String jsonizeTokenPolicy(List actions, List resources, boolean allow) {
+ public static String jsonizeTokenPolicy(List actions, List resources, boolean allow) throws JSONException {
JSONObject stmtJsonObject = new JSONObject();
stmtJsonObject.put("Action", actions);
stmtJsonObject.put("Resource", resources);
stmtJsonObject.put("Effect", allow ? "Allow" : "Deny");
JSONArray stmtJsonArray = new JSONArray();
- stmtJsonArray.add(0, stmtJsonObject);
+ stmtJsonArray.put(0, stmtJsonObject);
JSONObject policyJsonObject = new JSONObject();
policyJsonObject.put("Version", "1");
@@ -401,7 +402,7 @@ public static StsToken getStsToken(String grantor, String grantee,
System.out.println(line);
}
- JSONObject tokenJsonObject = JSONObject.fromObject(tokenString.toString());
+ JSONObject tokenJsonObject = new JSONObject(tokenString.toString());
JSONObject credsJsonObjson = tokenJsonObject.getJSONObject("Credentials");
String accessKeyId = credsJsonObjson.getString("AccessKeyId");
String secretAccessKey = credsJsonObjson.getString("AccessKeySecret");