Skip to content

Commit

Permalink
Merge branch 'develop' of github.com:yukuku/lombapemilu into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
andreaswong committed Mar 25, 2014
2 parents c984b99 + e048ab5 commit e1894cc
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 14 deletions.
4 changes: 2 additions & 2 deletions android/LombaApp/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.thnkld.calegstore.app"
android:versionCode="8"
android:versionName="2.2.1">
android:versionCode="9"
android:versionName="2.2.2">
<uses-sdk android:minSdkVersion="14"
android:targetSdkVersion="18"/>
<uses-permission android:name="android.permission.INTERNET"/>
Expand Down
30 changes: 18 additions & 12 deletions android/LombaApp/src/lomba/app/rpc/Papi.java
Original file line number Diff line number Diff line change
Expand Up @@ -204,9 +204,13 @@ public void run() {
byte[] responseBody = null;
boolean error = false;
try {
final int code = conn.getResponseCode();
conn.getResponseCode(); // trigger io
stream = conn.getInputStream();

if (stream == null) {
throw new IOException("no input stream");
}

ByteArrayOutputStream os = new ByteArrayOutputStream();
byte[] buf = new byte[1024];
while (true) {
Expand All @@ -222,25 +226,27 @@ public void run() {
stream = conn.getErrorStream();
}

try {
ByteArrayOutputStream os = new ByteArrayOutputStream();
byte[] buf = new byte[1024];
while (true) {
final int read = stream.read(buf);
if (read < 0) break;
os.write(buf, 0, read);
if (stream != null) {
try {
ByteArrayOutputStream os = new ByteArrayOutputStream();
byte[] buf = new byte[1024];
while (true) {
final int read = stream.read(buf);
if (read < 0) break;
os.write(buf, 0, read);
}
responseBody = os.toByteArray();
} catch (IOException e2) {
Log.e(TAG, "still error, oh no", e);
}
responseBody = os.toByteArray();
} catch (IOException e2) {
// still error, oh no
}
}

if (!error) {
String response = null;
try {
if (saklar.cancelled) return;
response = getResponseString(responseBody, "utf-8");
if (saklar.cancelled) return;
final String responsefinal = response;
mainHandler.post(new Runnable() {
@Override
Expand Down

0 comments on commit e1894cc

Please sign in to comment.