[workspace model] IJPL-1113 Handle IllegalNameException from XML reading

GitOrigin-RevId: 0159ed2cd99655d448d499c3134889402751a1ee
This commit is contained in:
Mikhail Mazurkevich
2024-07-11 19:17:15 +04:00
committed by intellij-monorepo-bot
parent 6122138a6b
commit 0040e3f019
2 changed files with 13 additions and 4 deletions

View File

@@ -339,6 +339,15 @@ internal class JDOMUtilTest {
JDOMUtil.load(testRoot)
}
@Test(expected = JDOMException::class)
fun `handling of IllegalNameException for unsupported symbol`() {
JDOMUtil.load("<settings xmlns=\"\n" +
"http://maven.apache.org/SETTINGS/1.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n" +
" xsi:schemaLocation=\"http://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd\">\n" +
" <localRepository/>\n" +
"</settings>")
}
private fun assertElementText(actual: Element, expected: String) {
assertThat(JDOMUtil.writeElement(actual)).isEqualTo(expected)
}

View File

@@ -217,7 +217,7 @@ public final class JDOMUtil {
xmlStreamReader.close();
}
}
catch (XMLStreamException | UncheckedStreamException e) {
catch (XMLStreamException | UncheckedStreamException | IllegalNameException e) {
throw new JDOMException(e.getMessage(), e);
}
finally {
@@ -235,7 +235,7 @@ public final class JDOMUtil {
xmlStreamReader.close();
}
}
catch (XMLStreamException | UncheckedStreamException e) {
catch (XMLStreamException | UncheckedStreamException | IllegalNameException e) {
throw new JDOMException(e.getMessage(), e);
}
}
@@ -290,7 +290,7 @@ public final class JDOMUtil {
xmlStreamReader.close();
}
}
catch (XMLStreamException | UncheckedStreamException e) {
catch (XMLStreamException | UncheckedStreamException | IllegalNameException e) {
throw new JDOMException(e.getMessage(), e);
}
}
@@ -310,7 +310,7 @@ public final class JDOMUtil {
xmlStreamReader.close();
}
}
catch (XMLStreamException | UncheckedStreamException e) {
catch (XMLStreamException | UncheckedStreamException | IllegalNameException e) {
throw new JDOMException(e.getMessage(), e);
}
}