Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRené Purrio2018-01-17 08:03:49 +0000
committerRené Purrio2018-01-17 08:03:49 +0000
commitedb01a788585e35cb247f67161b4944a9d1be364 (patch)
treec05cafa5ce06eb2fb37e580594334e9005d39a99 /org.eclipse.ua.tests/help
parenta0bbfb0b2a5a40b73eaeabdf3221f079e7ef38f7 (diff)
downloadeclipse.platform.ua-edb01a788585e35cb247f67161b4944a9d1be364.tar.gz
eclipse.platform.ua-edb01a788585e35cb247f67161b4944a9d1be364.tar.xz
eclipse.platform.ua-edb01a788585e35cb247f67161b4944a9d1be364.zip
Change-Id: Iddfb24c63e3454c3de9e539db25c379c7775f06c Signed-off-by: René Purrio <rpurrio@itemis.de>
Diffstat (limited to 'org.eclipse.ua.tests/help')
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/dynamic/DynamicXHTMLProcessorTest.java7
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/dynamic/XMLProcessorTest.java14
2 files changed, 18 insertions, 3 deletions
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/dynamic/DynamicXHTMLProcessorTest.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/dynamic/DynamicXHTMLProcessorTest.java
index 8baec7e6a..176f6bbdd 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/dynamic/DynamicXHTMLProcessorTest.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/dynamic/DynamicXHTMLProcessorTest.java
@@ -15,6 +15,7 @@ import static org.junit.Assert.assertTrue;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
+import java.net.URL;
import java.nio.charset.StandardCharsets;
import javax.xml.parsers.ParserConfigurationException;
@@ -48,7 +49,11 @@ public class DynamicXHTMLProcessorTest {
protected InputStream getProcessedInput(String path, Bundle bundle)
throws IOException, SAXException, ParserConfigurationException,
TransformerException, TransformerConfigurationException {
- try (InputStream in = bundle.getEntry(path).openStream()) {
+ URL url = bundle.getEntry(path);
+ if(url == null ) {
+ throw new IOException("No entry to '"+path+"' could be found or caller does not have the appropriate permissions.");//$NON-NLS-1$ //$NON-NLS-2$
+ }
+ try (InputStream in = url.openStream()) {
String href = '/' + bundle.getBundleId() + path;
return DynamicXHTMLProcessor.process(href, in, "en", true);
}
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/dynamic/XMLProcessorTest.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/dynamic/XMLProcessorTest.java
index c146999c1..0628d7026 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/dynamic/XMLProcessorTest.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/dynamic/XMLProcessorTest.java
@@ -10,7 +10,9 @@
*******************************************************************************/
package org.eclipse.ua.tests.help.dynamic;
+import java.io.IOException;
import java.io.InputStream;
+import java.net.URL;
import org.eclipse.core.runtime.Platform;
import org.eclipse.help.internal.base.HelpEvaluationContext;
@@ -45,8 +47,16 @@ public class XMLProcessorTest {
};
XMLProcessor processor = new XMLProcessor(handlers);
Bundle bundle = UserAssistanceTestPlugin.getDefault().getBundle();
- try (InputStream in = bundle.getEntry(FileUtil.getResultFile(path)).openStream();
- InputStream in2 = processor.process(bundle.getEntry(path).openStream(),
+ URL url1 = bundle.getEntry(FileUtil.getResultFile(path));
+ if(url1 == null) {
+ throw new IOException("No entry to '"+FileUtil.getResultFile(path)+"' could be found or caller does not have the appropriate permissions.");//$NON-NLS-1$ //$NON-NLS-2$
+ }
+ URL url2 = bundle.getEntry(path);
+ if(url2 == null) {
+ throw new IOException("No entry to '"+path+"' could be found or caller does not have the appropriate permissions.");//$NON-NLS-1$ //$NON-NLS-2$
+ }
+ try (InputStream in = url1.openStream();
+ InputStream in2 = processor.process(url2.openStream(),
'/' + bundle.getSymbolicName() + '/' + path, "UTF-8")) {
XMLUtil.assertXMLEquals("XML content was not processed correctly: " + path, in, in2);
}

Back to the top