Skip to content

Commit ae02386

Browse files
committed
More strict subclassing
1 parent 280bcd0 commit ae02386

File tree

1 file changed

+54
-2
lines changed

1 file changed

+54
-2
lines changed

library/src/com/loopj/android/http/BaseJsonHttpResponseHandler.java

Lines changed: 54 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,64 @@ public BaseJsonHttpResponseHandler(String encoding) {
3838
super(encoding);
3939
}
4040

41-
public void onSuccess(int statusCode, Header[] headers, String rawResponse, JSON_TYPE response) {
41+
@Override
42+
public final void onSuccess(int statusCode, Header[] headers, byte[] responseBody) {
43+
// Disabling this method
44+
super.onSuccess(statusCode, headers, responseBody);
4245
}
4346

44-
public void onFailure(int statusCode, Header[] headers, Throwable e, String rawData, JSON_TYPE errorResponse) {
47+
@Override
48+
public final void onSuccess(String content) {
49+
// Disabling usage of this method, until removed from parent
50+
super.onSuccess(content);
4551
}
4652

53+
@Override
54+
public final void onSuccess(int statusCode, String content) {
55+
// Disabling usage of this method, until removed from parent
56+
super.onSuccess(statusCode, content);
57+
}
58+
59+
@Override
60+
public final void onFailure(String responseBody, Throwable error) {
61+
// Disabling usage of this method, until removed from parent
62+
super.onFailure(responseBody, error);
63+
}
64+
65+
@Override
66+
public final void onFailure(int statusCode, Header[] headers, byte[] responseBody, Throwable error) {
67+
//Disabling this method
68+
super.onFailure(statusCode, headers, responseBody, error);
69+
}
70+
71+
@Override
72+
public final void onFailure(Throwable error) {
73+
// Disabling usage of this method, until removed from parent
74+
super.onFailure(error);
75+
}
76+
77+
@Override
78+
public final void onFailure(Throwable error, String content) {
79+
// Disabling usage of this method, until removed from parent
80+
super.onFailure(error, content);
81+
}
82+
83+
@Override
84+
public final void onFailure(int statusCode, Throwable error, String content) {
85+
// Disabling usage of this method, until removed from parent
86+
super.onFailure(statusCode, error, content);
87+
}
88+
89+
@Override
90+
public final void onFailure(int statusCode, Header[] headers, Throwable error, String content) {
91+
// Disabling usage of this method, until removed from parent
92+
super.onFailure(statusCode, headers, error, content);
93+
}
94+
95+
public abstract void onSuccess(int statusCode, Header[] headers, String rawResponse, JSON_TYPE response);
96+
97+
public abstract void onFailure(int statusCode, Header[] headers, Throwable e, String rawData, JSON_TYPE errorResponse);
98+
4799
@Override
48100
public void onSuccess(final int statusCode, final Header[] headers, final String responseBody) {
49101
if (statusCode != HttpStatus.SC_NO_CONTENT) {

0 commit comments

Comments
 (0)