@@ -19,15 +19,34 @@ public class FacebookAccessTokenErrorResponse extends OAuthException {
1919 private static final long serialVersionUID = -1277129766099856895L ;
2020
2121 private final String type ;
22- private final String code ;
22+ private final int codeInt ;
2323 private final String fbtraceId ;
2424 private final String rawResponse ;
2525
26+ /**
27+ * @param message message
28+ * @param type type
29+ * @param code code
30+ * @param fbtraceId fbtraceId
31+ * @param rawResponse rawResponse
32+ * @deprecated use {@link #FacebookAccessTokenErrorResponse(java.lang.String, java.lang.String, int,
33+ * java.lang.String, java.lang.String)}
34+ */
35+ @ Deprecated
2636 public FacebookAccessTokenErrorResponse (String message , String type , String code , String fbtraceId ,
2737 String rawResponse ) {
2838 super (message );
2939 this .type = type ;
30- this .code = code ;
40+ this .codeInt = Integer .parseInt (code );
41+ this .fbtraceId = fbtraceId ;
42+ this .rawResponse = rawResponse ;
43+ }
44+
45+ public FacebookAccessTokenErrorResponse (String message , String type , int code , String fbtraceId ,
46+ String rawResponse ) {
47+ super (message );
48+ this .type = type ;
49+ this .codeInt = code ;
3150 this .fbtraceId = fbtraceId ;
3251 this .rawResponse = rawResponse ;
3352 }
@@ -36,8 +55,17 @@ public String getType() {
3655 return type ;
3756 }
3857
58+ /**
59+ * @return code
60+ * @deprecated use {@link #getCodeInt() }
61+ */
62+ @ Deprecated
3963 public String getCode () {
40- return code ;
64+ return Integer .toString (codeInt );
65+ }
66+
67+ public int getCodeInt () {
68+ return codeInt ;
4169 }
4270
4371 public String getFbtraceId () {
@@ -54,7 +82,7 @@ public int hashCode() {
5482 hash = 83 * hash + Objects .hashCode (rawResponse );
5583 hash = 83 * hash + Objects .hashCode (getMessage ());
5684 hash = 83 * hash + Objects .hashCode (type );
57- hash = 83 * hash + Objects .hashCode (code );
85+ hash = 83 * hash + Objects .hashCode (codeInt );
5886 hash = 83 * hash + Objects .hashCode (fbtraceId );
5987 return hash ;
6088 }
@@ -80,15 +108,15 @@ public boolean equals(Object obj) {
80108 if (!Objects .equals (type , other .getType ())) {
81109 return false ;
82110 }
83- if (! Objects . equals ( code , other .getCode () )) {
111+ if (codeInt != other .getCodeInt ( )) {
84112 return false ;
85113 }
86114 return Objects .equals (fbtraceId , other .getFbtraceId ());
87115 }
88116
89117 @ Override
90118 public String toString () {
91- return "FacebookAccessTokenErrorResponse{'type'='" + type + "', 'code '='" + code
119+ return "FacebookAccessTokenErrorResponse{'type'='" + type + "', 'codeInt '='" + codeInt
92120 + "', 'fbtraceId'='" + fbtraceId + "', 'rawResponse'='" + rawResponse
93121 + "', 'message'='" + getMessage () + "'}" ;
94122 }
0 commit comments