diff options
author | Caolán McNamara <caolanm@redhat.com> | 2016-03-01 10:22:08 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2016-03-01 10:22:08 +0000 |
commit | d112040b7f91415a4f58b9e1a7bd84bd5c914c81 (patch) | |
tree | b8069b61bdbd328b2f14a32b498aa705218264d2 /xmerge | |
parent | c900c820a054ff0e8cb45cc7064716f3e53432b8 (diff) |
coverity#1326444 Dereference null return value
Change-Id: I0163b298a3c3359b0f035515408f2a81ef405377
Diffstat (limited to 'xmerge')
-rw-r--r-- | xmerge/source/xmerge/java/org/openoffice/xmerge/util/registry/ConverterInfoMgr.java | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/util/registry/ConverterInfoMgr.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/util/registry/ConverterInfoMgr.java index 019beaf97ed4..9cea2df38289 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/util/registry/ConverterInfoMgr.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/util/registry/ConverterInfoMgr.java @@ -262,6 +262,14 @@ public final class ConverterInfoMgr { return null; } + static String readLine(BufferedReader br) throws IOException{ + String ret = br.readLine(); + if (ret == null) { + throw new IOException("short read"); + } + return ret; + } + /** * Main to let the user specify what plug-ins to register from jarfiles and * to display the currently registered plug-ins. @@ -290,7 +298,7 @@ public final class ConverterInfoMgr { System.out.println("(Q)uit\n"); try { - c = br.readLine().toUpperCase().trim().charAt(0); + c = readLine(br).toUpperCase().trim().charAt(0); } catch(Exception e) { System.out.println("Invalid entry"); System.out.println("Error msg: " + e.getMessage()); @@ -308,7 +316,7 @@ public final class ConverterInfoMgr { System.out.println("Enter path to jarfile: "); try { - String jarname = br.readLine().trim(); + String jarname = readLine(br).trim(); cir = new ConverterInfoReader(jarname,validate); } catch (RegistryException e) { System.out.println("Cannot load plug-in ConverterFactory implementation."); @@ -346,7 +354,7 @@ public final class ConverterInfoMgr { } try { - String name = br.readLine().trim(); + String name = readLine(br).trim(); boolean rc = false; if (c == 'D') { @@ -380,7 +388,7 @@ public final class ConverterInfoMgr { } try { - findMimeOne = br.readLine().trim(); + findMimeOne = readLine(br).trim(); } catch (Exception e) { System.out.println("Error adding data to registry"); System.out.println("Error msg: " + e.getMessage()); @@ -393,7 +401,7 @@ public final class ConverterInfoMgr { } try { - findMimeTwo = br.readLine().trim(); + findMimeTwo = readLine(br).trim(); } catch (Exception e) { System.out.println("Error adding data to registry"); System.out.println("Error msg: " + e.getMessage()); |