File tree Expand file tree Collapse file tree 1 file changed +23
-1
lines changed
auth/src/main/java/com/firebase/ui/auth Expand file tree Collapse file tree 1 file changed +23
-1
lines changed Original file line number Diff line number Diff line change 28
28
import com .google .firebase .auth .GoogleAuthProvider ;
29
29
import com .google .firebase .auth .TwitterAuthProvider ;
30
30
31
+ import java .io .ByteArrayOutputStream ;
32
+ import java .io .IOException ;
33
+ import java .io .ObjectOutputStream ;
34
+
31
35
/**
32
36
* A container that encapsulates the result of authenticating with an Identity Provider.
33
37
*/
@@ -195,7 +199,25 @@ public void writeToParcel(Parcel dest, int flags) {
195
199
dest .writeParcelable (mUser , flags );
196
200
dest .writeString (mToken );
197
201
dest .writeString (mSecret );
198
- dest .writeSerializable (mException );
202
+
203
+ ObjectOutputStream oos = null ;
204
+ try {
205
+ oos = new ObjectOutputStream (new ByteArrayOutputStream ());
206
+ oos .writeObject (mException );
207
+
208
+ // Success! The entire exception tree is serializable.
209
+ dest .writeSerializable (mException );
210
+ } catch (IOException e ) {
211
+ // Somewhere down the line, the exception is holding on to an object that isn't
212
+ // serializable so default to some exception. It's the best we can do in this case.
213
+ dest .writeSerializable (new FirebaseUiException (ErrorCodes .UNKNOWN_ERROR ));
214
+ } finally {
215
+ if (oos != null ) {
216
+ try {
217
+ oos .close ();
218
+ } catch (IOException ignored ) {}
219
+ }
220
+ }
199
221
}
200
222
201
223
@ Override
You can’t perform that action at this time.
0 commit comments