Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Vogel2016-02-21 19:47:42 +0000
committerLars Vogel2016-02-21 19:56:31 +0000
commit69f16f0f17aa8eca62bd1e432803dacecf3841ca (patch)
tree032eb333a6e33762ae624a3586de967b0e786083
parent1b943355ba4222083f4f397a526c172c1eb5d6b2 (diff)
downloadeclipse.pde.ui-69f16f0f17aa8eca62bd1e432803dacecf3841ca.tar.gz
eclipse.pde.ui-69f16f0f17aa8eca62bd1e432803dacecf3841ca.tar.xz
eclipse.pde.ui-69f16f0f17aa8eca62bd1e432803dacecf3841ca.zip
Bug 488057 - Update org.eclipse.pde.ua.ui to Java 1.8 to use default
methods of IContentProvider Change-Id: Ic7e501740686ed52c4b903f6687cff1089ee3c85 Signed-off-by: Lars Vogel <Lars.Vogel@vogella.com>
-rwxr-xr-xua/org.eclipse.pde.ua.ui/src/org/eclipse/pde/internal/ua/ui/editor/toc/TocHTMLTitleUtil.java14
1 files changed, 7 insertions, 7 deletions
diff --git a/ua/org.eclipse.pde.ua.ui/src/org/eclipse/pde/internal/ua/ui/editor/toc/TocHTMLTitleUtil.java b/ua/org.eclipse.pde.ua.ui/src/org/eclipse/pde/internal/ua/ui/editor/toc/TocHTMLTitleUtil.java
index 24ea8eb9e8..e5b2a8ef9f 100755
--- a/ua/org.eclipse.pde.ua.ui/src/org/eclipse/pde/internal/ua/ui/editor/toc/TocHTMLTitleUtil.java
+++ b/ua/org.eclipse.pde.ua.ui/src/org/eclipse/pde/internal/ua/ui/editor/toc/TocHTMLTitleUtil.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008 IBM Corporation and others.
+ * Copyright (c) 2008, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -7,6 +7,7 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * Lars Vogel <Lars.Vogel@vogella.com> - Bug 488057
*******************************************************************************/
package org.eclipse.pde.internal.ua.ui.editor.toc;
@@ -48,23 +49,22 @@ public class TocHTMLTitleUtil {
if (titlePattern == null) {
initPattern();
}
+ String title = null;
- try {
- FileChannel fc = new FileInputStream(f).getChannel();
-
+ try (FileInputStream inputStream = new FileInputStream(f)) {
+ FileChannel fc = inputStream.getChannel();
MappedByteBuffer bb = fc.map(FileChannel.MapMode.READ_ONLY, 0, fc.size());
CharBuffer cb = Charset.forName("8859_1").newDecoder().decode(bb); //$NON-NLS-1$
Matcher m = titlePattern.matcher(cb);
- String title = null;
+
if (m.find()) {
title = m.group(1);
}
-
- return title;
} catch (IOException e) {
return null;
}
+ return title;
}
}

Back to the top