diff options
author | Alexander Kurtakov | 2019-09-17 14:13:23 +0000 |
---|---|---|
committer | Alexander Kurtakov | 2019-09-17 15:28:44 +0000 |
commit | fc6f968616f9247866be50c9e5e62b1719d7275e (patch) | |
tree | 745bc1775a0a3a39fed88eb603247688604ddfee | |
parent | a404cbbc5c78cfa4abe1a405fa5dd4297b5a9385 (diff) | |
download | eclipse.platform.ua-fc6f968616f9247866be50c9e5e62b1719d7275e.tar.gz eclipse.platform.ua-fc6f968616f9247866be50c9e5e62b1719d7275e.tar.xz eclipse.platform.ua-fc6f968616f9247866be50c9e5e62b1719d7275e.zip |
Bug 546446 - buildhelpIndex ant task not reporting which file breaks
indexing
Make sure that IndexAssembler doesn't accept broken xml.
Change-Id: I67bdf6d9ceb3439a7f366a293548d5947162bad5
Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
4 files changed, 36 insertions, 3 deletions
diff --git a/org.eclipse.ua.tests/META-INF/MANIFEST.MF b/org.eclipse.ua.tests/META-INF/MANIFEST.MF index 548e7d38c..eede26513 100644 --- a/org.eclipse.ua.tests/META-INF/MANIFEST.MF +++ b/org.eclipse.ua.tests/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: User Assistance Test Bundle-SymbolicName: org.eclipse.ua.tests;singleton:=true -Bundle-Version: 3.4.500.qualifier +Bundle-Version: 3.4.600.qualifier Bundle-Activator: org.eclipse.ua.tests.plugin.UserAssistanceTestPlugin Require-Bundle: org.junit, org.eclipse.core.resources, diff --git a/org.eclipse.ua.tests/data/help/index/assembler/invalid.xml b/org.eclipse.ua.tests/data/help/index/assembler/invalid.xml new file mode 100644 index 000000000..9bb081cff --- /dev/null +++ b/org.eclipse.ua.tests/data/help/index/assembler/invalid.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Copyright (c) 2005, 2009 IBM Corporation and others. + + This program and the accompanying materials + are made available under the terms of the Eclipse Public License 2.0 + which accompanies this distribution, and is available at + https://www.eclipse.org/legal/epl-2.0/ + + SPDX-License-Identifier: EPL-2.0 + + Contributors: + IBM Corporation - initial API and implementation + --> + +<index> + <entry keyword="keyword1"> + <topic href="topic1.html" title="topic0"> + <topic href="topic2.html" label="topic1"/> + <topic href="topic3.html" title="topic2" label = "topic3"/> + </entry> +</index> diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/index/IndexAssemblerTest.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/index/IndexAssemblerTest.java index f5bd8b9a7..c96255e69 100644 --- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/index/IndexAssemblerTest.java +++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/index/IndexAssemblerTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2017 IBM Corporation and others. + * Copyright (c) 2006, 2019 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -38,6 +38,7 @@ import org.eclipse.help.internal.index.IndexFileParser; import org.eclipse.help.internal.index.IndexSee; import org.eclipse.ua.tests.plugin.UserAssistanceTestPlugin; import org.junit.Test; +import org.xml.sax.SAXParseException; public class IndexAssemblerTest { @Test @@ -102,6 +103,16 @@ public class IndexAssemblerTest { assertEquals("topic2", topics[2].getLabel()); } + @Test(expected = SAXParseException.class) + public void testInvalid() throws Exception { + IndexFileParser parser = new IndexFileParser(); + IndexContribution contrib = parser.parse( + new IndexFile(UserAssistanceTestPlugin.getPluginId(), "data/help/index/assembler/invalid.xml", "en")); + IndexAssembler assembler = new IndexAssembler(); + List<IndexContribution> contributions = new ArrayList<>(Arrays.asList(contrib)); + assembler.assemble(contributions, Platform.getNL()); + } + // Replaces white space between ">" and "<" by a single newline private String trimWhiteSpace(String input) { diff --git a/org.eclipse.ua.tests/pom.xml b/org.eclipse.ua.tests/pom.xml index 2fa6d6dfc..0913092e2 100644 --- a/org.eclipse.ua.tests/pom.xml +++ b/org.eclipse.ua.tests/pom.xml @@ -19,7 +19,7 @@ </parent> <groupId>org.eclipse.ua</groupId> <artifactId>org.eclipse.ua.tests</artifactId> - <version>3.4.500-SNAPSHOT</version> + <version>3.4.600-SNAPSHOT</version> <packaging>eclipse-test-plugin</packaging> <properties> |