Skip to content

Commit 846c831

Browse files
committed
Lint Fixes
1 parent bde3ccd commit 846c831

File tree

7 files changed

+13
-13
lines changed

7 files changed

+13
-13
lines changed

library/src/main/java/com/loopj/android/http/Base64OutputStream.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public class Base64OutputStream extends FilterOutputStream {
2727
private byte[] buffer = null;
2828
private int bpos = 0;
2929

30-
private static byte[] EMPTY = new byte[0];
30+
private static final byte[] EMPTY = new byte[0];
3131

3232
/**
3333
* Performs Base64 encoding on the data written to the stream, writing the encoded data to

library/src/main/java/com/loopj/android/http/MySSLSocketFactory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
* certificate validation on every device, use with caution
5757
*/
5858
public class MySSLSocketFactory extends SSLSocketFactory {
59-
SSLContext sslContext = SSLContext.getInstance("TLS");
59+
final SSLContext sslContext = SSLContext.getInstance("TLS");
6060

6161
/**
6262
* Creates a new SSL Socket Factory with the given KeyStore.

library/src/main/java/com/loopj/android/http/SimpleMultipartEntity.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
import java.io.OutputStream;
3939
import java.util.ArrayList;
4040
import java.util.List;
41-
import java.util.Random;
41+
import java.security.SecureRandom;
4242

4343
/**
4444
* Simplified multipart entity mainly used for sending one or more files.
@@ -74,7 +74,7 @@ class SimpleMultipartEntity implements HttpEntity {
7474

7575
public SimpleMultipartEntity(ResponseHandlerInterface progressHandler) {
7676
final StringBuilder buf = new StringBuilder();
77-
final Random rand = new Random();
77+
final SecureRandom rand = new SecureRandom();
7878
for (int i = 0; i < 30; i++) {
7979
buf.append(MULTIPART_CHARS[rand.nextInt(MULTIPART_CHARS.length)]);
8080
}
@@ -171,8 +171,8 @@ private void updateProgress(long count) {
171171
}
172172

173173
private class FilePart {
174-
public File file;
175-
public byte[] header;
174+
public final File file;
175+
public final byte[] header;
176176

177177
public FilePart(String key, File file, String type, String customFileName) {
178178
header = createHeader(key, TextUtils.isEmpty(customFileName) ? file.getName() : customFileName, type);

sample/src/main/java/com/loopj/android/http/sample/AsyncBackgroundThreadSample.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
public class AsyncBackgroundThreadSample extends SampleParentActivity {
4141
private static final String LOG_TAG = "AsyncBackgroundThreadSample";
4242

43-
private ExecutorService executor = Executors.newSingleThreadExecutor();
43+
private final ExecutorService executor = Executors.newSingleThreadExecutor();
4444

4545
@Override
4646
public void onStop()

sample/src/main/java/com/loopj/android/http/sample/SampleParentActivity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ public void onCancelButtonPressed() {
225225
asyncHttpClient.cancelRequests(SampleParentActivity.this, true);
226226
}
227227

228-
protected View.OnClickListener onClickListener = new View.OnClickListener() {
228+
protected final View.OnClickListener onClickListener = new View.OnClickListener() {
229229
@Override
230230
public void onClick(View v) {
231231
switch (v.getId()) {

sample/src/main/java/com/loopj/android/http/sample/SaxSample.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public ResponseHandlerInterface getResponseHandler() {
4040
return saxAsyncHttpResponseHandler;
4141
}
4242

43-
private SaxAsyncHttpResponseHandler saxAsyncHttpResponseHandler = new SaxAsyncHttpResponseHandler<SAXTreeStructure>(new SAXTreeStructure()) {
43+
private final SaxAsyncHttpResponseHandler saxAsyncHttpResponseHandler = new SaxAsyncHttpResponseHandler<SAXTreeStructure>(new SAXTreeStructure()) {
4444
@Override
4545
public void onStart() {
4646
clearOutputs();
@@ -93,8 +93,8 @@ public RequestHandle executeSample(AsyncHttpClient client, String URL, Header[]
9393
}
9494

9595
private class Tuple {
96-
public Integer color;
97-
public String text;
96+
public final Integer color;
97+
public final String text;
9898

9999
public Tuple(int _color, String _text) {
100100
this.color = _color;
@@ -104,7 +104,7 @@ public Tuple(int _color, String _text) {
104104

105105
private class SAXTreeStructure extends DefaultHandler {
106106

107-
public List<Tuple> responseViews = new ArrayList<Tuple>();
107+
public final List<Tuple> responseViews = new ArrayList<Tuple>();
108108

109109
public void startElement(String namespaceURI, String localName,
110110
String rawName, Attributes atts) {

sample/src/main/java/com/loopj/android/http/sample/services/ExampleIntentService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public class ExampleIntentService extends IntentService {
2121
public static final String INTENT_DATA = "INTENT_DATA";
2222
public static final String INTENT_THROWABLE = "INTENT_THROWABLE";
2323

24-
private AsyncHttpClient aClient = new SyncHttpClient();
24+
private final AsyncHttpClient aClient = new SyncHttpClient();
2525

2626
public ExampleIntentService() {
2727
super("ExampleIntentService");

0 commit comments

Comments
 (0)