projects
/
zxing.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Possible small bug fix and cleanup of unneeded code
[zxing.git]
/
android
/
src
/
com
/
google
/
zxing
/
client
/
android
/
AndroidHttpClient.java
diff --git
a/android/src/com/google/zxing/client/android/AndroidHttpClient.java
b/android/src/com/google/zxing/client/android/AndroidHttpClient.java
index
522152c
..
d1e6895
100644
(file)
--- a/
android/src/com/google/zxing/client/android/AndroidHttpClient.java
+++ b/
android/src/com/google/zxing/client/android/AndroidHttpClient.java
@@
-16,7
+16,6
@@
package com.google.zxing.client.android;
package com.google.zxing.client.android;
-import android.util.Log;
import org.apache.http.Header;
import org.apache.http.HttpEntity;
import org.apache.http.HttpHost;
import org.apache.http.Header;
import org.apache.http.HttpEntity;
import org.apache.http.HttpHost;
@@
-69,9
+68,6
@@
public final class AndroidHttpClient implements HttpClient {
// Gzip of data shorter than this probably won't be worthwhile
private static final long DEFAULT_SYNC_MIN_GZIP_BYTES = 256;
// Gzip of data shorter than this probably won't be worthwhile
private static final long DEFAULT_SYNC_MIN_GZIP_BYTES = 256;
- private static final String TAG = "AndroidHttpClient";
-
-
/**
* Set if HTTP requests are blocked from being executed on this thread
*/
/**
* Set if HTTP requests are blocked from being executed on this thread
*/
@@
-129,8
+125,6
@@
public final class AndroidHttpClient implements HttpClient {
private final HttpClient delegate;
private final HttpClient delegate;
- private RuntimeException mLeakedException = new IllegalStateException(
- "AndroidHttpClient created and never closed");
private AndroidHttpClient(ClientConnectionManager ccm, HttpParams params) {
this.delegate = new DefaultHttpClient(ccm, params) {
private AndroidHttpClient(ClientConnectionManager ccm, HttpParams params) {
this.delegate = new DefaultHttpClient(ccm, params) {
@@
-155,15
+149,6
@@
public final class AndroidHttpClient implements HttpClient {
};
}
};
}
- @Override
- protected void finalize() throws Throwable {
- super.finalize();
- if (mLeakedException != null) {
- Log.e(TAG, "Leak found", mLeakedException);
- mLeakedException = null;
- }
- }
-
/**
* Block this thread from executing HTTP requests.
* Used to guard against HTTP requests blocking the main application thread.
/**
* Block this thread from executing HTTP requests.
* Used to guard against HTTP requests blocking the main application thread.
@@
-212,15
+197,8
@@
public final class AndroidHttpClient implements HttpClient {
return responseStream;
}
return responseStream;
}
- /**
- * Release resources associated with this client. You must call this,
- * or significant resources (sockets and memory) may be leaked.
- */
public void close() {
public void close() {
- if (mLeakedException != null) {
- getConnectionManager().shutdown();
- mLeakedException = null;
- }
+ // do nothing
}
public HttpParams getParams() {
}
public HttpParams getParams() {
@@
-279,7
+257,7
@@
public final class AndroidHttpClient implements HttpClient {
*/
public static AbstractHttpEntity getCompressedEntity(byte[] data) throws IOException {
AbstractHttpEntity entity;
*/
public static AbstractHttpEntity getCompressedEntity(byte[] data) throws IOException {
AbstractHttpEntity entity;
- if (data.length <
getMinGzipSize()
) {
+ if (data.length <
DEFAULT_SYNC_MIN_GZIP_BYTES
) {
entity = new ByteArrayEntity(data);
} else {
ByteArrayOutputStream arr = new ByteArrayOutputStream();
entity = new ByteArrayEntity(data);
} else {
ByteArrayOutputStream arr = new ByteArrayOutputStream();
@@
-295,11
+273,4
@@
public final class AndroidHttpClient implements HttpClient {
return entity;
}
return entity;
}
- /**
- * Retrieves the minimum size for compressing data.
- * Shorter data will not be compressed.
- */
- private static long getMinGzipSize() {
- return DEFAULT_SYNC_MIN_GZIP_BYTES;
- }
}
}