Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: src/org/adblockplus/libadblockplus/ServerResponse.java

Issue 5697499218051072: Usage of new API, cleanups (reduced) (Closed)
Patch Set: Even more review issues fixed. Created April 28, 2014, 10:18 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/org/adblockplus/libadblockplus/ServerResponse.java
diff --git a/src/org/adblockplus/libadblockplus/ServerResponse.java b/src/org/adblockplus/libadblockplus/ServerResponse.java
index 4a55332c642b128d6ad176755e529f97ab2bd025..aa7088e4b91a27a9067fb4602ce91717fe3072e1 100644
--- a/src/org/adblockplus/libadblockplus/ServerResponse.java
+++ b/src/org/adblockplus/libadblockplus/ServerResponse.java
@@ -21,16 +21,14 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
-import com.github.rjeschke.neetutils.collections.Tuple;
-
-public class ServerResponse
+public final class ServerResponse
{
public static enum NsStatus
{
OK(0), ERROR_FAILURE(0x80004005), ERROR_OUT_OF_MEMORY(0x8007000e), ERROR_MALFORMED_URI(0x804b000a), ERROR_CONNECTION_REFUSED(0x804b000d), ERROR_NET_TIMEOUT(
0x804b000e), ERROR_NO_CONTENT(0x804b0011), ERROR_UNKNOWN_PROTOCOL(0x804b0012), ERROR_NET_RESET(0x804b0014), ERROR_UNKNOWN_HOST(0x804b001e), ERROR_REDIRECT_LOOP(
- 0x804b001f), ERROR_UNKNOWN_PROXY_HOST(0x804b002a), ERROR_NET_INTERRUPT(0x804b0047), ERROR_UNKNOWN_PROXY_CONNECTION_REFUSED(0x804b0048), CUSTOM_ERROR_BASE(
- 0x80850000), ERROR_NOT_INITIALIZED(0xc1f30001);
+ 0x804b001f), ERROR_UNKNOWN_PROXY_HOST(0x804b002a), ERROR_NET_INTERRUPT(0x804b0047), ERROR_UNKNOWN_PROXY_CONNECTION_REFUSED(0x804b0048), CUSTOM_ERROR_BASE(
+ 0x80850000), ERROR_NOT_INITIALIZED(0xc1f30001);
private final long statusCode;
private final static HashMap<Long, NsStatus> ENUM_MAP = new HashMap<Long, ServerResponse.NsStatus>();
@@ -45,12 +43,12 @@ public class ServerResponse
private NsStatus(final long value)
{
- statusCode = value;
+ this.statusCode = value;
}
public long getStatusCode()
{
- return statusCode;
+ return this.statusCode;
}
public static NsStatus fromStatusCode(final long code)
@@ -97,22 +95,22 @@ public class ServerResponse
this.response = response;
}
- public List<Tuple<String, String>> getResponseHeaders()
+ public List<HeaderEntry> getResponseHeaders()
{
- final ArrayList<Tuple<String, String>> ret = new ArrayList<Tuple<String, String>>();
+ final ArrayList<HeaderEntry> ret = new ArrayList<HeaderEntry>();
if (this.headers != null)
{
for (int i = 0; i < this.headers.length; i += 2)
{
- ret.add(Tuple.of(this.headers[i], this.headers[i + 1]));
+ ret.add(HeaderEntry.of(this.headers[i], this.headers[i + 1]));
}
}
return ret;
}
- public void setReponseHeaders(final List<Tuple<String, String>> headers)
+ public void setReponseHeaders(final List<HeaderEntry> headers)
{
if (headers.isEmpty())
{
@@ -123,10 +121,10 @@ public class ServerResponse
this.headers = new String[headers.size() * 2];
int i = 0;
- for (final Tuple<String, String> e : headers)
+ for (final HeaderEntry e : headers)
{
- this.headers[i] = e.a;
- this.headers[i + 1] = e.b;
+ this.headers[i] = e.getKey();
+ this.headers[i + 1] = e.getValue();
i += 2;
}
}
« no previous file with comments | « src/org/adblockplus/libadblockplus/JsValue.java ('k') | src/org/adblockplus/libadblockplus/Subscription.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld