From d9feb905939424d7162a178c90779fe220d0b8e8 Mon Sep 17 00:00:00 2001 From: Jesse Wilson Date: Sun, 31 Oct 2010 04:58:23 +0000 Subject: [PATCH] Small cleanup of exception conversion. --- gson/src/main/java/com/google/gson/Streams.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/gson/src/main/java/com/google/gson/Streams.java b/gson/src/main/java/com/google/gson/Streams.java index 59eb8a02..79c3ba2b 100644 --- a/gson/src/main/java/com/google/gson/Streams.java +++ b/gson/src/main/java/com/google/gson/Streams.java @@ -17,6 +17,7 @@ package com.google.gson; import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonSyntaxException; import com.google.gson.stream.JsonWriter; import java.io.EOFException; @@ -68,10 +69,11 @@ final class Streams { default: throw new IllegalArgumentException(); } + } catch (EOFException e) { + return JsonNull.createJsonNull(); + } catch (JsonSyntaxException e) { + throw new JsonParseException(e); } catch (IOException e) { - if (e instanceof EOFException) { - return JsonNull.createJsonNull(); - } throw new JsonIOException(e); } catch (NumberFormatException e) { throw new JsonParseException(e);