[ 
https://issues.apache.org/jira/browse/HADOOP-12031?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14562491#comment-14562491
 ] 

Kengo Seki commented on HADOOP-12031:
-------------------------------------

Thank you very much, [~aw] [~busbey]. Thanks to your comments, I realize we can 
use Java's scripting feature to make the plugin more simple and platform 
independent. I tried this idea on OpenJDK 1.6 and 1.7, and it seems to work 
fine.

{code}
# cat a.xml
<configuration/>
# cat b.xml
<configuration>
# /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.35.x86_64/bin/jrunscript -e 
'XMLDocument(arguments[0])' a.xml
# echo $?
0
# /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.35.x86_64/bin/jrunscript -e 
'XMLDocument(arguments[0])' b.xml
[Fatal Error] b.xml:2:1: XML document structures must start and end within the 
same entity.
script error: sun.org.mozilla.javascript.WrappedException: Wrapped 
org.xml.sax.SAXParseException; systemId: file:///tmp/b.xml; lineNumber: 2; 
columnNumber: 1; XML document structures must start and end within the same 
entity. (<system-init>#714) in <system-init> at line number 714
# echo $?
10
# /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.79.x86_64/bin/jrunscript -e 
'XMLDocument(arguments[0])' a.xml
# echo $?
0
# /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.79.x86_64/bin/jrunscript -e 
'XMLDocument(arguments[0])' b.xml
[Fatal Error] b.xml:2:1: XML document structures must start and end within the 
same entity.
script error: sun.org.mozilla.javascript.WrappedException: Wrapped 
org.xml.sax.SAXParseException; systemId: file:///tmp/b.xml; lineNumber: 2; 
columnNumber: 1; XML document structures must start and end within the same 
entity. (<system-init>#714) in <system-init> at line number 714
# echo $?
10
{code}

Since Java 8 replaced jrunscript with jjs, I must do some work such as version 
detection, but it is not difficult.

Other comments also make sense to me. I'll fix them.

> test-patch.sh should have an xml plugin
> ---------------------------------------
>
>                 Key: HADOOP-12031
>                 URL: https://issues.apache.org/jira/browse/HADOOP-12031
>             Project: Hadoop Common
>          Issue Type: Test
>          Components: build
>            Reporter: Allen Wittenauer
>            Assignee: Kengo Seki
>              Labels: newbie, test-patch
>         Attachments: HADOOP-12031.001.patch, HADOOP-12031.002.patch, 
> HADOOP-12031.003.patch
>
>
> HADOOP-11178 demonstrates why there is a need to verify xml files on a patch 
> change.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to