From 761c7a4727e5cbb293e3db1f52cd0fd714574ebe Mon Sep 17 00:00:00 2001 From: simon-liubin Date: Tue, 3 Jun 2014 14:17:44 +0800 Subject: [PATCH 01/12] =?UTF-8?q?=204M=208M=20=E4=B8=B4=E7=95=8C=E7=82=B9b?= =?UTF-8?q?lock=E4=B8=AA=E6=95=B0=E8=AE=A1=E7=AE=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/com/qiniu/resumableio/ResumableIO.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/com/qiniu/resumableio/ResumableIO.java b/src/com/qiniu/resumableio/ResumableIO.java index 67ca5eec8..ca8ff4b90 100644 --- a/src/com/qiniu/resumableio/ResumableIO.java +++ b/src/com/qiniu/resumableio/ResumableIO.java @@ -63,7 +63,7 @@ public void onFailure(Exception ex) { } public int put(final String key, final InputStreamAt input, final PutExtra extra, final JSONObjectRet ret) { - final int blkCount = (int) (input.length() / BLOCK_SIZE) + 1; + final int blkCount = (int) ((input.length() + BLOCK_SIZE - 1) / BLOCK_SIZE); if (extra.processes == null) extra.processes = new PutRet[blkCount]; extra.totalSize = input.length(); final int[] success = new int[] {0}; From 7508e5032ca6b3e817cf4643b87c557240a82add Mon Sep 17 00:00:00 2001 From: simon-liubin Date: Fri, 6 Jun 2014 14:10:32 +0800 Subject: [PATCH 02/12] test --- AndroidManifest.xml | 8 +- src/test/com/qiniu/test/UploadTest.java | 191 ++++++++++++++++++++++++ 2 files changed, 198 insertions(+), 1 deletion(-) create mode 100644 src/test/com/qiniu/test/UploadTest.java diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 212678a98..fd17e6719 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -18,7 +18,13 @@ - + + + + + diff --git a/src/test/com/qiniu/test/UploadTest.java b/src/test/com/qiniu/test/UploadTest.java new file mode 100644 index 000000000..0ba332312 --- /dev/null +++ b/src/test/com/qiniu/test/UploadTest.java @@ -0,0 +1,191 @@ +package com.qiniu.test; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.util.HashMap; +import java.util.UUID; + +import junit.framework.Assert; + +import org.json.JSONException; +import org.json.JSONObject; + +import com.qiniu.auth.JSONObjectRet; +import com.qiniu.io.IO; +import com.qiniu.resumableio.ResumableIO; + +import android.content.Context; +import android.net.Uri; +import android.test.AndroidTestCase; +import android.test.suitebuilder.annotation.MediumTest; +import android.test.suitebuilder.annotation.SmallTest; +import android.util.Log; + +public class UploadTest extends AndroidTestCase { + private String uptoken = "acmKu7Hie1OQ3t31bAovR6JORFX72MMpTicc2xje:n6I4SuMAxBgZ6o3qh8z1bMWqKow=:eyJzY29wZSI6ImFhYTUiLCJyZXR1cm5Cb2R5Ijoie1wiaGFzaFwiOlwiJChldGFnKVwiLFwia2V5XCI6XCIkKGtleSlcIixcImZuYW1lXCI6XCIgJChmbmFtZSkgXCIsXCJmc2l6ZVwiOlwiJChmc2l6ZSlcIixcImF2aW5mb1wiOlwiJChhdmluZm8pXCIsXCJ4OnRlc3RfbmFtZVwiOlwiJCh4OnRlc3RfbmFtZSlcIixcIm5vbnh0ZXN05Lit5paHX25hbWVcIjpcIiQobm9ueHRlc3TkuK3mlodfbmFtZSlcIn0iLCJkZWFkbGluZSI6MTQzMjg2ODA3NH0="; + + private File file; + + private boolean uploading; + private boolean success; + private JSONObjectRet jsonRet; + private JSONObject resp; + private Exception e; + + private Context context; + private Uri uri; + private com.qiniu.io.PutExtra extra; + private String key = IO.UNDEFINED_KEY; + + private com.qiniu.resumableio.PutExtra rextra; + + public void setUp() throws Exception { + key = UUID.randomUUID().toString(); + uploading = true; + success = false; + + extra = new com.qiniu.io.PutExtra(); + extra.params = new HashMap(); + extra.params.put("x:a", "测试中文信息"); + + rextra = new com.qiniu.resumableio.PutExtra(); + rextra.params = new HashMap(); + rextra.params.put("x:a", "测试中文信息"); + + context = this.getContext(); + jsonRet = new JSONObjectRet() { + @Override + public void onProcess(long current, long total) { + Log.d("UploadTest", current + "/" + total); + // Assert.assertEquals(file.length(), total); // 内部实现原因,可能不相等 + } + + @Override + public void onSuccess(JSONObject res) { + uploading = false; + success = true; + resp = res; + Log.d("UploadTest", "上传成功! " + resp.toString()); + } + + @Override + public void onFailure(Exception ex) { + uploading = false; + success = false; + e = ex; + Log.d("UploadTest", "上传失败! " + ex.getMessage()); + } + }; + } + + + public void tearDown() throws Exception { + if(file != null){ + file.delete(); + } + } + + @SmallTest + public void testS() throws IOException, JSONException { + file = createFile(0.2, ".test"); + uri = Uri.fromFile(file); + IO.putFile(context, uptoken, key, uri, extra, jsonRet); + sleepLimit(60); + successCheck(); + } + + @MediumTest + public void testM() throws IOException, JSONException { + file = createFile(4, ".test"); + uri = Uri.fromFile(file); + IO.putFile(context, uptoken, key, uri, extra, jsonRet); + sleepLimit(60 * 5); + successCheck(); + } + + @SmallTest + public void testRS() throws IOException, JSONException { + file = createFile(0.2, ".test"); + uri = Uri.fromFile(file); + ResumableIO.putFile(context, uptoken, key, uri, rextra, jsonRet); + sleepLimit(60); + successCheck(); + } + + @MediumTest + public void testRM() throws IOException, JSONException { + file = createFile(4, ".test"); + uri = Uri.fromFile(file); + ResumableIO.putFile(context, uptoken, key, uri, rextra, jsonRet); + sleepLimit(60 * 5); + successCheck(); + } + + @MediumTest + public void testRL() throws IOException, JSONException { + file = createFile(8.6, ".test"); + uri = Uri.fromFile(file); + ResumableIO.putFile(context, uptoken, key, uri, rextra, jsonRet); + sleepLimit(60 * 5); + successCheck(); + } + + + private void successCheck() throws JSONException{ + Assert.assertTrue(success); + Assert.assertNotNull(resp.optString("hash")); + Assert.assertEquals(file.length(), resp.getLong("fsize")); + } + + private void sleepLimit(int limit){ + int t = 5; + while(uploading && t < limit){ + try { + t += 5; + Thread.sleep(1000 * 5); + } catch (InterruptedException e) { + + } + } + } + + private File createFile(double fileSize, String suf) throws IOException { + FileOutputStream fos = null; + try{ + long size = (long)(1024 * 1024 * fileSize); + File f = File.createTempFile("qiniu_", suf); + f.createNewFile(); + fos = new FileOutputStream(f); + byte [] b = getByte(); + long s = 0; + while(s < size){ + int l = (int)Math.min(b.length, size - s); + fos.write(b, 0, l); + s += l; + } + fos.flush(); + return f; + }finally{ + if(fos != null){ + try { + fos.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + } + + private byte[] getByte(){ + byte [] b = new byte[1024 * 4]; + b[0] = 'A'; + for(int i=1; i < 1024 * 4 ; i++){ + b[i] = 'b'; + } + b[1024 * 4 - 2] = '\r'; + b[1024 * 4 - 1] = '\n'; + return b; + } + +} From fad98911c1e4f2aecad1ae5ceca223fece189320 Mon Sep 17 00:00:00 2001 From: simon-liubin Date: Fri, 13 Jun 2014 11:44:41 +0800 Subject: [PATCH 03/12] file://path --- src/com/qiniu/io/IO.java | 17 +++++++---------- src/com/qiniu/resumableio/ResumableIO.java | 13 +++++-------- 2 files changed, 12 insertions(+), 18 deletions(-) diff --git a/src/com/qiniu/io/IO.java b/src/com/qiniu/io/IO.java index 506279dc4..ce035016e 100644 --- a/src/com/qiniu/io/IO.java +++ b/src/com/qiniu/io/IO.java @@ -94,18 +94,15 @@ public void onFailure(Exception ex) { */ public void putFile(Context mContext, String key, Uri uri, PutExtra extra, final JSONObjectRet ret) { if (!uri.toString().startsWith("file")) uri = convertFileUri(mContext, uri); - try { - File file = new File(new URI(uri.toString())); - if (file.exists()) { - putAndClose(key, InputStreamAt.fromFile(file), extra, ret); - return; - } - ret.onFailure(new Exception("file not exist: " + uri.toString())); - } catch (URISyntaxException e) { - e.printStackTrace(); - ret.onFailure(e); + + File file = new File(uri.getEncodedPath()); + if (file.exists()) { + putAndClose(key, InputStreamAt.fromFile(file), extra, ret); + return; } + ret.onFailure(new Exception("file not exist: " + uri.toString())); } + public void putFile(String key, File file, PutExtra extra, JSONObjectRet callback) { putAndClose(key, InputStreamAt.fromFile(file), extra, callback); } diff --git a/src/com/qiniu/resumableio/ResumableIO.java b/src/com/qiniu/resumableio/ResumableIO.java index 95c480b05..f89089df6 100644 --- a/src/com/qiniu/resumableio/ResumableIO.java +++ b/src/com/qiniu/resumableio/ResumableIO.java @@ -149,14 +149,11 @@ public int putFile(String key, File file, PutExtra extra, final JSONObjectRet re public int putFile(Context mContext, String key, Uri uri, PutExtra extra, final JSONObjectRet ret) { if (!uri.toString().startsWith("file")) uri = convertFileUri(mContext, uri); - try { - File file = new File(new URI(uri.toString())); - if (file.exists()) return putAndClose(key, InputStreamAt.fromFile(file), extra, ret); - ret.onFailure(new Exception("file not exist: " + uri.toString())); - } catch (URISyntaxException e) { - e.printStackTrace(); - ret.onFailure(e); - } + + File file = new File(uri.getEncodedPath()); + if (file.exists()) return putAndClose(key, InputStreamAt.fromFile(file), extra, ret); + ret.onFailure(new Exception("file not exist: " + uri.toString())); + return -1; } From f3194de124c9c2eab3ae29021ba259d7fa4dbcec Mon Sep 17 00:00:00 2001 From: simon-liubin Date: Thu, 19 Jun 2014 10:06:41 +0800 Subject: [PATCH 04/12] trauis untest --- .gitignore | 31 +++++++++++++----- .travis.yml | 1 + build.gradle | 7 ++++ .../src}/com/qiniu/test/UploadTest.java | 32 +++++++++---------- 4 files changed, 47 insertions(+), 24 deletions(-) rename {src/test => tests/src}/com/qiniu/test/UploadTest.java (98%) diff --git a/.gitignore b/.gitignore index c41efc45a..6176cc099 100644 --- a/.gitignore +++ b/.gitignore @@ -1,10 +1,25 @@ -# Gradle -build/ -.gradle +# built application files +*.apk +*.ap_ + +# files for the dex VM +*.dex + +# Java class files +*.class -#Java -.class +# generated files +bin/ +gen/ -#Android -.apk -.dex +# Local configuration file (sdk path, etc) +local.properties + +# Eclipse project files +.classpath +.project +.settings + +# Gradle +.gradle +build/ \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index 725fdac18..96b345f7c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -33,3 +33,4 @@ before_script: script: - ./gradlew build + - ./gradlew connectedInstrumentTest diff --git a/build.gradle b/build.gradle index 0a0000a2f..8f0332ae7 100644 --- a/build.gradle +++ b/build.gradle @@ -25,9 +25,16 @@ android { } instrumentTest.setRoot('tests') + instrumentTest { + java.srcDirs = ['tests/src'] + res.srcDirs = ['res'] + assets.srcDirs = ['assets'] + resources.srcDirs = ['tests/src'] + } } dependencies { compile fileTree(dir: 'libs', include: '*.jar') } } +// if don't find sdk, please set the local.properties \ No newline at end of file diff --git a/src/test/com/qiniu/test/UploadTest.java b/tests/src/com/qiniu/test/UploadTest.java similarity index 98% rename from src/test/com/qiniu/test/UploadTest.java rename to tests/src/com/qiniu/test/UploadTest.java index 0ba332312..fdd556f13 100644 --- a/src/test/com/qiniu/test/UploadTest.java +++ b/tests/src/com/qiniu/test/UploadTest.java @@ -24,35 +24,35 @@ public class UploadTest extends AndroidTestCase { private String uptoken = "acmKu7Hie1OQ3t31bAovR6JORFX72MMpTicc2xje:n6I4SuMAxBgZ6o3qh8z1bMWqKow=:eyJzY29wZSI6ImFhYTUiLCJyZXR1cm5Cb2R5Ijoie1wiaGFzaFwiOlwiJChldGFnKVwiLFwia2V5XCI6XCIkKGtleSlcIixcImZuYW1lXCI6XCIgJChmbmFtZSkgXCIsXCJmc2l6ZVwiOlwiJChmc2l6ZSlcIixcImF2aW5mb1wiOlwiJChhdmluZm8pXCIsXCJ4OnRlc3RfbmFtZVwiOlwiJCh4OnRlc3RfbmFtZSlcIixcIm5vbnh0ZXN05Lit5paHX25hbWVcIjpcIiQobm9ueHRlc3TkuK3mlodfbmFtZSlcIn0iLCJkZWFkbGluZSI6MTQzMjg2ODA3NH0="; - + private File file; - + private boolean uploading; private boolean success; private JSONObjectRet jsonRet; private JSONObject resp; private Exception e; - + private Context context; private Uri uri; private com.qiniu.io.PutExtra extra; private String key = IO.UNDEFINED_KEY; - + private com.qiniu.resumableio.PutExtra rextra; public void setUp() throws Exception { key = UUID.randomUUID().toString(); uploading = true; success = false; - + extra = new com.qiniu.io.PutExtra(); extra.params = new HashMap(); extra.params.put("x:a", "测试中文信息"); - + rextra = new com.qiniu.resumableio.PutExtra(); rextra.params = new HashMap(); rextra.params.put("x:a", "测试中文信息"); - + context = this.getContext(); jsonRet = new JSONObjectRet() { @Override @@ -94,16 +94,16 @@ public void testS() throws IOException, JSONException { sleepLimit(60); successCheck(); } - + @MediumTest public void testM() throws IOException, JSONException { - file = createFile(4, ".test"); + file = createFile(4, "--—— 地 方.test"); uri = Uri.fromFile(file); IO.putFile(context, uptoken, key, uri, extra, jsonRet); sleepLimit(60 * 5); successCheck(); } - + @SmallTest public void testRS() throws IOException, JSONException { file = createFile(0.2, ".test"); @@ -112,7 +112,7 @@ public void testRS() throws IOException, JSONException { sleepLimit(60); successCheck(); } - + @MediumTest public void testRM() throws IOException, JSONException { file = createFile(4, ".test"); @@ -121,7 +121,7 @@ public void testRM() throws IOException, JSONException { sleepLimit(60 * 5); successCheck(); } - + @MediumTest public void testRL() throws IOException, JSONException { file = createFile(8.6, ".test"); @@ -130,14 +130,14 @@ public void testRL() throws IOException, JSONException { sleepLimit(60 * 5); successCheck(); } - + private void successCheck() throws JSONException{ Assert.assertTrue(success); Assert.assertNotNull(resp.optString("hash")); Assert.assertEquals(file.length(), resp.getLong("fsize")); } - + private void sleepLimit(int limit){ int t = 5; while(uploading && t < limit){ @@ -149,7 +149,7 @@ private void sleepLimit(int limit){ } } } - + private File createFile(double fileSize, String suf) throws IOException { FileOutputStream fos = null; try{ @@ -188,4 +188,4 @@ private byte[] getByte(){ return b; } -} +} \ No newline at end of file From fb7c70211f37bc480193e4281a77c706681aee13 Mon Sep 17 00:00:00 2001 From: simon-liubin Date: Thu, 19 Jun 2014 12:13:35 +0800 Subject: [PATCH 05/12] reset token --- tests/src/com/qiniu/test/UploadTest.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/src/com/qiniu/test/UploadTest.java b/tests/src/com/qiniu/test/UploadTest.java index fdd556f13..eebb0db73 100644 --- a/tests/src/com/qiniu/test/UploadTest.java +++ b/tests/src/com/qiniu/test/UploadTest.java @@ -23,7 +23,7 @@ import android.util.Log; public class UploadTest extends AndroidTestCase { - private String uptoken = "acmKu7Hie1OQ3t31bAovR6JORFX72MMpTicc2xje:n6I4SuMAxBgZ6o3qh8z1bMWqKow=:eyJzY29wZSI6ImFhYTUiLCJyZXR1cm5Cb2R5Ijoie1wiaGFzaFwiOlwiJChldGFnKVwiLFwia2V5XCI6XCIkKGtleSlcIixcImZuYW1lXCI6XCIgJChmbmFtZSkgXCIsXCJmc2l6ZVwiOlwiJChmc2l6ZSlcIixcImF2aW5mb1wiOlwiJChhdmluZm8pXCIsXCJ4OnRlc3RfbmFtZVwiOlwiJCh4OnRlc3RfbmFtZSlcIixcIm5vbnh0ZXN05Lit5paHX25hbWVcIjpcIiQobm9ueHRlc3TkuK3mlodfbmFtZSlcIn0iLCJkZWFkbGluZSI6MTQzMjg2ODA3NH0="; + private String uptoken = "anEC5u_72gw1kZPSy3Dsq1lo_DPXyvuPDaj4ePkN:zmaikrTu1lgLb8DTvKQbuFZ5ai0=:eyJzY29wZSI6ImFuZHJvaWRzZGsiLCJyZXR1cm5Cb2R5Ijoie1wiaGFzaFwiOlwiJChldGFnKVwiLFwia2V5XCI6XCIkKGtleSlcIixcImZuYW1lXCI6XCIgJChmbmFtZSkgXCIsXCJmc2l6ZVwiOlwiJChmc2l6ZSlcIixcIm1pbWVUeXBlXCI6XCIkKG1pbWVUeXBlKVwiLFwieDphXCI6XCIkKHg6YSlcIn0iLCJkZWFkbGluZSI6MTQ2NjIyMjcwMX0="; private File file; @@ -47,11 +47,11 @@ public void setUp() throws Exception { extra = new com.qiniu.io.PutExtra(); extra.params = new HashMap(); - extra.params.put("x:a", "测试中文信息"); + extra.params.put("x:a", "测试中文 信息"); rextra = new com.qiniu.resumableio.PutExtra(); rextra.params = new HashMap(); - rextra.params.put("x:a", "测试中文信息"); + rextra.params.put("x:a", "测试中文 信息"); context = this.getContext(); jsonRet = new JSONObjectRet() { From a25c2bf7d2c39a9605d6853d8f876f703ad3a349 Mon Sep 17 00:00:00 2001 From: simon-liubin Date: Thu, 19 Jun 2014 13:01:28 +0800 Subject: [PATCH 06/12] travis --- build.gradle | 2 ++ tests/src/com/qiniu/test/UploadTest.java | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 8f0332ae7..50ac05585 100644 --- a/build.gradle +++ b/build.gradle @@ -26,11 +26,13 @@ android { instrumentTest.setRoot('tests') instrumentTest { + manifest.srcFile 'AndroidManifest.xml' java.srcDirs = ['tests/src'] res.srcDirs = ['res'] assets.srcDirs = ['assets'] resources.srcDirs = ['tests/src'] } + } dependencies { diff --git a/tests/src/com/qiniu/test/UploadTest.java b/tests/src/com/qiniu/test/UploadTest.java index eebb0db73..acb44f7d7 100644 --- a/tests/src/com/qiniu/test/UploadTest.java +++ b/tests/src/com/qiniu/test/UploadTest.java @@ -57,7 +57,7 @@ public void setUp() throws Exception { jsonRet = new JSONObjectRet() { @Override public void onProcess(long current, long total) { - Log.d("UploadTest", current + "/" + total); + //Log.d("UploadTest", current + "/" + total); // Assert.assertEquals(file.length(), total); // 内部实现原因,可能不相等 } From e3dd0265b10d7deda90d11bacd69b11fe1d325dd Mon Sep 17 00:00:00 2001 From: simon-liubin Date: Thu, 19 Jun 2014 13:15:58 +0800 Subject: [PATCH 07/12] travis --- .travis.yml | 2 +- tests/src/com/qiniu/test/UploadTest.java | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 96b345f7c..42a67eb09 100644 --- a/.travis.yml +++ b/.travis.yml @@ -32,5 +32,5 @@ before_script: - adb shell input keyevent 82 & script: - - ./gradlew build + #- ./gradlew build - ./gradlew connectedInstrumentTest diff --git a/tests/src/com/qiniu/test/UploadTest.java b/tests/src/com/qiniu/test/UploadTest.java index acb44f7d7..a09704055 100644 --- a/tests/src/com/qiniu/test/UploadTest.java +++ b/tests/src/com/qiniu/test/UploadTest.java @@ -67,6 +67,7 @@ public void onSuccess(JSONObject res) { success = true; resp = res; Log.d("UploadTest", "上传成功! " + resp.toString()); + System.out.println("上传成功! " + resp.toString()); } @Override @@ -75,6 +76,7 @@ public void onFailure(Exception ex) { success = false; e = ex; Log.d("UploadTest", "上传失败! " + ex.getMessage()); + System.out.println("上传失败! " + ex.getMessage()); } }; } From cd544bc93f6cf78d35b515ef4caf89b979551da8 Mon Sep 17 00:00:00 2001 From: simon-liubin Date: Thu, 19 Jun 2014 13:24:52 +0800 Subject: [PATCH 08/12] travis --- tests/src/com/qiniu/test/UploadTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/src/com/qiniu/test/UploadTest.java b/tests/src/com/qiniu/test/UploadTest.java index a09704055..d556bfa87 100644 --- a/tests/src/com/qiniu/test/UploadTest.java +++ b/tests/src/com/qiniu/test/UploadTest.java @@ -137,7 +137,7 @@ public void testRL() throws IOException, JSONException { private void successCheck() throws JSONException{ Assert.assertTrue(success); Assert.assertNotNull(resp.optString("hash")); - Assert.assertEquals(file.length(), resp.getLong("fsize")); + Assert.assertEquals(file.length(), 1); } private void sleepLimit(int limit){ From e5e5f89ec9b5450fe2029e035e0052118375d576 Mon Sep 17 00:00:00 2001 From: simon-liubin Date: Thu, 19 Jun 2014 13:33:58 +0800 Subject: [PATCH 09/12] travis --- tests/src/com/qiniu/test/UploadTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/src/com/qiniu/test/UploadTest.java b/tests/src/com/qiniu/test/UploadTest.java index d556bfa87..a09704055 100644 --- a/tests/src/com/qiniu/test/UploadTest.java +++ b/tests/src/com/qiniu/test/UploadTest.java @@ -137,7 +137,7 @@ public void testRL() throws IOException, JSONException { private void successCheck() throws JSONException{ Assert.assertTrue(success); Assert.assertNotNull(resp.optString("hash")); - Assert.assertEquals(file.length(), 1); + Assert.assertEquals(file.length(), resp.getLong("fsize")); } private void sleepLimit(int limit){ From 7ad04f99d85146696d2621ac120538f4fd9b33f7 Mon Sep 17 00:00:00 2001 From: simon-liubin Date: Fri, 4 Jul 2014 16:17:29 +0800 Subject: [PATCH 10/12] if(); -< if(){} --- src/com/qiniu/resumableio/ResumableIO.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/com/qiniu/resumableio/ResumableIO.java b/src/com/qiniu/resumableio/ResumableIO.java index f89089df6..4b4eb2902 100644 --- a/src/com/qiniu/resumableio/ResumableIO.java +++ b/src/com/qiniu/resumableio/ResumableIO.java @@ -151,7 +151,9 @@ public int putFile(Context mContext, String key, Uri uri, PutExtra extra, final if (!uri.toString().startsWith("file")) uri = convertFileUri(mContext, uri); File file = new File(uri.getEncodedPath()); - if (file.exists()) return putAndClose(key, InputStreamAt.fromFile(file), extra, ret); + if (file.exists()) { + return putAndClose(key, InputStreamAt.fromFile(file), extra, ret); + } ret.onFailure(new Exception("file not exist: " + uri.toString())); return -1; From 7cb3435827a32c040db0d90eb10d131278514ba1 Mon Sep 17 00:00:00 2001 From: xuzhaokui Date: Wed, 9 Jul 2014 11:34:51 +0800 Subject: [PATCH 11/12] #9891 --- src/com/qiniu/conf/Conf.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/com/qiniu/conf/Conf.java b/src/com/qiniu/conf/Conf.java index 46f31c7b0..e5cb9cf3b 100644 --- a/src/com/qiniu/conf/Conf.java +++ b/src/com/qiniu/conf/Conf.java @@ -2,5 +2,5 @@ public class Conf { public static final String USER_AGENT = "qiniu android-sdk v6.0.0"; - public static final String UP_HOST = "http://up.qiniu.com"; + public static final String UP_HOST = "http://upload.qiniu.com"; } From e24831cf5ee2634127a53a6f1495aa8cd62bead7 Mon Sep 17 00:00:00 2001 From: Bai Long Date: Fri, 11 Jul 2014 15:01:34 +0800 Subject: [PATCH 12/12] Update CHANGELOG.md --- CHANGELOG.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5410a93c4..227392d89 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ ## CHANGE LOG + +### v6.0.3 +2014-07-11 issue [#49](https://github.com/qiniu/android-sdk/pull/49) + +- [#45] block count 计数修正 +- [#47] file Uri 修正 +- [#48] 调整上传默认为upload.qiniu.com + ### v6.0.2 2014-04-15 issue [#43](https://github.com/qiniu/android-sdk/pull/43)