diff --git a/.idea/gradle.xml b/.idea/gradle.xml
index 087a809..ce85225 100644
--- a/.idea/gradle.xml
+++ b/.idea/gradle.xml
@@ -8,8 +8,8 @@
diff --git a/.idea/libraries/support_v4_21_0_3.xml b/.idea/libraries/support_v4_21_0_3.xml
index 90d704f..c12fb76 100644
--- a/.idea/libraries/support_v4_21_0_3.xml
+++ b/.idea/libraries/support_v4_21_0_3.xml
@@ -1,9 +1,9 @@
-
-
-
+
+
+
diff --git a/.idea/modules.xml b/.idea/modules.xml
index 13943e8..5c0189f 100644
--- a/.idea/modules.xml
+++ b/.idea/modules.xml
@@ -2,7 +2,8 @@
-
+
+
diff --git a/CrashReport.apk b/CrashReport.apk
index b571358..f39c649 100644
Binary files a/CrashReport.apk and b/CrashReport.apk differ
diff --git a/CrashReport.iml b/CrashReport.iml
new file mode 100644
index 0000000..2a02201
--- /dev/null
+++ b/CrashReport.iml
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/app.iml b/app/app.iml
index 63e502e..5e9dd44 100644
--- a/app/app.iml
+++ b/app/app.iml
@@ -1,5 +1,5 @@
-
+
@@ -100,8 +100,6 @@
-
-
diff --git a/app/src/main/java/org/tecrash/crashreport/DropboxUploadingJob.java b/app/src/main/java/org/tecrash/crashreport/DropboxUploadingJob.java
index 4e4f7d5..3b583d1 100644
--- a/app/src/main/java/org/tecrash/crashreport/DropboxUploadingJob.java
+++ b/app/src/main/java/org/tecrash/crashreport/DropboxUploadingJob.java
@@ -28,13 +28,12 @@
import android.os.DropBoxManager;
import android.os.SystemClock;
-import com.google.gson.JsonObject;
-import com.google.gson.JsonPrimitive;
import com.path.android.jobqueue.Job;
import com.path.android.jobqueue.Params;
import com.squareup.okhttp.OkHttpClient;
import org.tecrash.crashreport.api.IDropboxService;
+import org.tecrash.crashreport.data.ContentData;
import org.tecrash.crashreport.data.ReportDatas;
import org.tecrash.crashreport.util.Logger;
import org.tecrash.crashreport.util.Util;
@@ -68,8 +67,8 @@
public class DropboxUploadingJob extends Job {
static final long serialVersionUID = 0x2F3C0888L;
- static final int MAX_DIG_LEN = 2 * 1024;
- static Logger logger = Logger.getLogger();
+ private static final int MAX_DIG_LEN = 2 * 1024;
+ private static Logger logger = Logger.getLogger();
private long timestamp;
private String incremental;
@@ -158,12 +157,10 @@ public void onRun() throws Throwable {
ReportDatas.Entry data = datas.get(i);
if (result != null && result.dropbox_id != null && result.dropbox_id.length() > 0) {
DropBoxManager.Entry entry = dbm.getNextEntry(tags.get(i), timestamps.get(i));
- JsonObject content = new JsonObject();
- content.add("content", new JsonPrimitive(convertStreamToString(entry.getInputStream())));
service.updateContent(
Util.getKey(),
result.dropbox_id,
- content
+ new ContentData(convertStreamToString(entry.getInputStream()))
);
}
}
@@ -246,7 +243,7 @@ private String convertStreamToString(InputStream is)
String line;
while ((line = br.readLine()) != null) {
sb.append(line);
- sb.append(System.getProperty("line.separator"));
+ sb.append("\\n");
}
} catch (IOException e) {
} finally {
diff --git a/app/src/main/java/org/tecrash/crashreport/api/IDropboxService.java b/app/src/main/java/org/tecrash/crashreport/api/IDropboxService.java
index a5b8ca1..c7b2ec7 100644
--- a/app/src/main/java/org/tecrash/crashreport/api/IDropboxService.java
+++ b/app/src/main/java/org/tecrash/crashreport/api/IDropboxService.java
@@ -25,6 +25,7 @@
import com.google.gson.JsonObject;
+import org.tecrash.crashreport.data.ContentData;
import org.tecrash.crashreport.data.ReportDatas;
import retrofit.http.Body;
@@ -49,7 +50,7 @@ ReportDatas.ReportResults report(
JsonObject updateContent(
@Header("Authorization") String nsKey,
@Path("dropbox_id") String dbId,
- @Body JsonObject content
+ @Body ContentData content
);
@Multipart
diff --git a/app/src/main/java/org/tecrash/crashreport/data/ContentData.java b/app/src/main/java/org/tecrash/crashreport/data/ContentData.java
new file mode 100644
index 0000000..48713d8
--- /dev/null
+++ b/app/src/main/java/org/tecrash/crashreport/data/ContentData.java
@@ -0,0 +1,35 @@
+/*
+ * The MIT License (MIT)
+ * Copyright (c) 2014 He Xiaocong (xiaocong@gmail.com)
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
+ * OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+package org.tecrash.crashreport.data;
+
+/**
+ * Created by xiaocong on 29/12/14.
+ */
+public class ContentData {
+ String content;
+
+ public ContentData(String content) {
+ this.content = content;
+ }
+}
diff --git a/app/src/main/java/org/tecrash/crashreport/util/Logger.java b/app/src/main/java/org/tecrash/crashreport/util/Logger.java
index c3482c3..1fafa02 100644
--- a/app/src/main/java/org/tecrash/crashreport/util/Logger.java
+++ b/app/src/main/java/org/tecrash/crashreport/util/Logger.java
@@ -32,10 +32,10 @@
* Created by xiaocong on 14-11-21.
*/
public class Logger implements CustomLogger {
- static final String TAG = "CrashReport";
+ private static final String TAG = "CrashReport";
private static Logger logger;
- public static final Logger getLogger() {
+ public static Logger getLogger() {
if (logger == null) {
logger = new Logger();
}
diff --git a/app/src/main/java/org/tecrash/crashreport/util/Util.java b/app/src/main/java/org/tecrash/crashreport/util/Util.java
index 5c69959..27d78a7 100644
--- a/app/src/main/java/org/tecrash/crashreport/util/Util.java
+++ b/app/src/main/java/org/tecrash/crashreport/util/Util.java
@@ -48,12 +48,12 @@
*/
public class Util {
- final static String LOG_REG = "Log:\\s+([\\w\\-\\./:$#\\(\\)]+)";
- final static Pattern LOG_PATTERN = Pattern.compile(LOG_REG);
- final static String PROCESS_REG = "Process:\\s+([\\w\\-\\./:$#\\(\\)]+)";
- final static Pattern PROCESS_PATTERN = Pattern.compile(PROCESS_REG);
- final static String TOMBSTONE_REG = "pid:\\s*\\d+,\\s*tid:\\s*\\d+,\\s*name:.+?>>>\\s+([\\w\\-\\./:$#\\(\\)]+)\\s+<<<";
- final static Pattern TOMBSTONE_PATTERN = Pattern.compile(TOMBSTONE_REG);
+ private final static String LOG_REG = "Log:\\s+([\\w\\-\\./:$#\\(\\)]+)";
+ private final static Pattern LOG_PATTERN = Pattern.compile(LOG_REG);
+ private final static String PROCESS_REG = "Process:\\s+([\\w\\-\\./:$#\\(\\)]+)";
+ private final static Pattern PROCESS_PATTERN = Pattern.compile(PROCESS_REG);
+ private final static String TOMBSTONE_REG = "pid:\\s*\\d+,\\s*tid:\\s*\\d+,\\s*name:.+?>>>\\s+([\\w\\-\\./:$#\\(\\)]+)\\s+<<<";
+ private final static Pattern TOMBSTONE_PATTERN = Pattern.compile(TOMBSTONE_REG);
static Map tags = new HashMap();
static int MAX_LINES = 30;
diff --git a/app/src/main/res/values/strings_activity_settings.xml b/app/src/main/res/values/strings_activity_settings.xml
index 56bc0ed..20cfd84 100644
--- a/app/src/main/res/values/strings_activity_settings.xml
+++ b/app/src/main/res/values/strings_activity_settings.xml
@@ -38,7 +38,7 @@
- http://cr.ota.xinqitec.com/api/0
- - http://192.168.1.105:9000/api/0
+ - http://192.168.1.158:9000/api/0
pref_key_days_to_upload_log