Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Johnston2016-08-03 20:56:10 +0000
committerJeff Johnston2016-08-03 22:05:01 +0000
commitdf0303e4b4dd0338287f7ca5ed40d2a976bed652 (patch)
treea5da2d654a71c7cde46543e6d214b640db6bb30e
parentc504b640d9bf21e3fc91a443b017dc9a152ee415 (diff)
downloadorg.eclipse.linuxtools-df0303e4b4dd0338287f7ca5ed40d2a976bed652.tar.gz
org.eclipse.linuxtools-df0303e4b4dd0338287f7ca5ed40d2a976bed652.tar.xz
org.eclipse.linuxtools-df0303e4b4dd0338287f7ca5ed40d2a976bed652.zip
Bug 499131 - NullPointerException below ManParser.getRawManPage
- add check for getManPage() returning null in getRawManPage() try statement Change-Id: I75e63b628d10a7f1f05bd70ec99e52ae437aa66e Reviewed-on: https://git.eclipse.org/r/78414 Tested-by: Hudson CI Reviewed-by: Jeff Johnston <jjohnstn@redhat.com>
-rw-r--r--man/org.eclipse.linuxtools.man.core/src/org/eclipse/linuxtools/internal/man/parser/ManParser.java13
1 files changed, 8 insertions, 5 deletions
diff --git a/man/org.eclipse.linuxtools.man.core/src/org/eclipse/linuxtools/internal/man/parser/ManParser.java b/man/org.eclipse.linuxtools.man.core/src/org/eclipse/linuxtools/internal/man/parser/ManParser.java
index c64c0d72b8..c232a2a285 100644
--- a/man/org.eclipse.linuxtools.man.core/src/org/eclipse/linuxtools/internal/man/parser/ManParser.java
+++ b/man/org.eclipse.linuxtools.man.core/src/org/eclipse/linuxtools/internal/man/parser/ManParser.java
@@ -135,11 +135,14 @@ public class ManParser {
public StringBuilder getRawManPage(String manPage) {
StringBuilder sb = new StringBuilder();
try (InputStream manContent = getManPage(manPage, false);
- BufferedReader reader = new BufferedReader(
- new InputStreamReader(manContent))) {
- String line = null;
- while ((line = reader.readLine()) != null) {
- sb.append(line + "\n"); //$NON-NLS-1$
+ BufferedReader reader = manContent != null
+ ? new BufferedReader(new InputStreamReader(manContent))
+ : null) {
+ if (reader != null) {
+ String line = null;
+ while ((line = reader.readLine()) != null) {
+ sb.append(line + "\n"); //$NON-NLS-1$
+ }
}
} catch (IOException e) {
Bundle bundle = FrameworkUtil.getBundle(this.getClass());

Back to the top