11package com .github .scribejava .apis .facebook ;
22
33import com .github .scribejava .core .exceptions .OAuthException ;
4+ import com .github .scribejava .core .model .Response ;
5+ import java .io .IOException ;
46import java .util .Objects ;
57
68/**
@@ -21,15 +23,32 @@ public class FacebookAccessTokenErrorResponse extends OAuthException {
2123 private final String type ;
2224 private final int codeInt ;
2325 private final String fbtraceId ;
24- private final String rawResponse ;
26+ private final Response response ;
2527
2628 public FacebookAccessTokenErrorResponse (String message , String type , int code , String fbtraceId ,
27- String rawResponse ) {
29+ Response response ) {
2830 super (message );
2931 this .type = type ;
3032 this .codeInt = code ;
3133 this .fbtraceId = fbtraceId ;
32- this .rawResponse = rawResponse ;
34+ this .response = response ;
35+ }
36+
37+ /**
38+ *
39+ * @param message message
40+ * @param type type
41+ * @param code code
42+ * @param fbtraceId fbtraceId
43+ * @param rawResponse rawResponse
44+ * @deprecated use {@link #FacebookAccessTokenErrorResponse(java.lang.String, java.lang.String,
45+ * int, java.lang.String, com.github.scribejava.core.model.Response)
46+ * }
47+ */
48+ @ Deprecated
49+ public FacebookAccessTokenErrorResponse (String message , String type , int code , String fbtraceId ,
50+ String rawResponse ) {
51+ this (message , type , code , fbtraceId , new Response (-1 , null , null , rawResponse ));
3352 }
3453
3554 public String getType () {
@@ -44,14 +63,25 @@ public String getFbtraceId() {
4463 return fbtraceId ;
4564 }
4665
47- public String getRawResponse () {
48- return rawResponse ;
66+ /**
67+ *
68+ * @return body of response
69+ * @throws IOException IOException
70+ * @deprecated use {@link #getResponse()} and then {@link Response#getBody()}
71+ */
72+ @ Deprecated
73+ public String getRawResponse () throws IOException {
74+ return response .getBody ();
75+ }
76+
77+ public Response getResponse () {
78+ return response ;
4979 }
5080
5181 @ Override
5282 public int hashCode () {
5383 int hash = 5 ;
54- hash = 83 * hash + Objects .hashCode (rawResponse );
84+ hash = 83 * hash + Objects .hashCode (response );
5585 hash = 83 * hash + Objects .hashCode (getMessage ());
5686 hash = 83 * hash + Objects .hashCode (type );
5787 hash = 83 * hash + Objects .hashCode (codeInt );
@@ -71,7 +101,7 @@ public boolean equals(Object obj) {
71101 return false ;
72102 }
73103 final FacebookAccessTokenErrorResponse other = (FacebookAccessTokenErrorResponse ) obj ;
74- if (!Objects .equals (rawResponse , other .getRawResponse ())) {
104+ if (!Objects .equals (response , other .getResponse ())) {
75105 return false ;
76106 }
77107 if (!Objects .equals (getMessage (), other .getMessage ())) {
@@ -89,7 +119,7 @@ public boolean equals(Object obj) {
89119 @ Override
90120 public String toString () {
91121 return "FacebookAccessTokenErrorResponse{'type'='" + type + "', 'codeInt'='" + codeInt
92- + "', 'fbtraceId'='" + fbtraceId + "', 'rawResponse '='" + rawResponse
122+ + "', 'fbtraceId'='" + fbtraceId + "', 'response '='" + response
93123 + "', 'message'='" + getMessage () + "'}" ;
94124 }
95125}
0 commit comments