git: 860aa846f7d9 - main - textproc/xincluder: Fix processing using JDOM
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 22 Jul 2023 11:26:07 UTC
The branch main has been updated by fernape: URL: https://cgit.FreeBSD.org/ports/commit/?id=860aa846f7d9b756fc020b7efa4ed086d9675c21 commit 860aa846f7d9b756fc020b7efa4ed086d9675c21 Author: Marcin Cieślak <saper@saper.info> AuthorDate: 2023-07-21 14:59:58 +0000 Commit: Fernando Apesteguía <fernape@FreeBSD.org> CommitDate: 2023-07-22 11:25:48 +0000 textproc/xincluder: Fix processing using JDOM JDOM could not be used due to mismatch with the included JDOM. PR: 272559 Reported by: saper@saper.info --- textproc/xincluder/Makefile | 18 +++++++++++++--- ...-src_com_elharo_xml_xinclude_JDOMXIncluder.java | 24 ++++++++++++++++++++++ 2 files changed, 39 insertions(+), 3 deletions(-) diff --git a/textproc/xincluder/Makefile b/textproc/xincluder/Makefile index d882781a5a81..247ce5c9a7df 100644 --- a/textproc/xincluder/Makefile +++ b/textproc/xincluder/Makefile @@ -1,6 +1,6 @@ PORTNAME= xincluder PORTVERSION= 1.0.d11 -PORTREVISION= 6 +PORTREVISION= 7 CATEGORIES= textproc java MASTER_SITES= ftp://ftp.ibiblio.org/pub/languages/java/javafaq/ DISTNAME= ${PORTNAME}-1.0d11 @@ -12,22 +12,34 @@ WWW= http://xincluder.sourceforge.net/ LICENSE= LGPL21 LICENSE_FILE= ${WRKSRC}/lgpl.txt +BUILD_DEPENDS= ${JAVALIBDIR}/jdom.jar:java/jdom \ + ${JAVALIBDIR}/xercesImpl.jar:textproc/xerces-j RUN_DEPENDS= ${JAVALIBDIR}/jdom.jar:java/jdom \ ${JAVALIBDIR}/xercesImpl.jar:textproc/xerces-j USE_JAVA= yes -NO_BUILD= yes +USE_ANT= yes +ALL_TARGET= clean jar NO_ARCH= yes WRKSRC= ${WRKDIR}/${PORTNAME} SUFFIXES= -sax -dom -jdom -PLIST_FILES= %%JAVAJARDIR%%/${PORTNAME}.jar bin/xincluder ${SUFFIXES:S,^,bin/xincluder,} +PLIST_FILES= ${JAVAJARDIR}/${PORTNAME}.jar bin/xincluder ${SUFFIXES:S,^,bin/xincluder,} PORTDOCS= apidoc index.html SUB_FILES= xincluder.sh OPTIONS_DEFINE= DOCS +post-patch: + @${REINPLACE_CMD} \ + -e "s,\./lib/jdom-1.0b9rc.jar,${JAVAJARDIR}/jdom.jar," \ + -e "s,\./lib/xercesImpl-2.0.2.jar,${JAVAJARDIR}/xercesImpl.jar," \ + -e "s,\./lib/xmlParserAPIs-2.0.2.jar,${JAVAJARDIR}/xml-apis.jar," \ + -e 's,<javac srcdir,<javac source="1.8" target="1.8" debug="true" \ + includeantruntime="false" srcdir,' \ + ${WRKSRC}/build.xml + do-install: @${MKDIR} ${STAGEDIR}${JAVAJARDIR} ${INSTALL_DATA} ${WRKSRC}/${PORTNAME}.jar ${STAGEDIR}${JAVAJARDIR}/ diff --git a/textproc/xincluder/files/patch-src_com_elharo_xml_xinclude_JDOMXIncluder.java b/textproc/xincluder/files/patch-src_com_elharo_xml_xinclude_JDOMXIncluder.java new file mode 100644 index 000000000000..6f0ff222e753 --- /dev/null +++ b/textproc/xincluder/files/patch-src_com_elharo_xml_xinclude_JDOMXIncluder.java @@ -0,0 +1,24 @@ +--- src/com/elharo/xml/xinclude/JDOMXIncluder.java.orig 2003-03-09 16:01:34 UTC ++++ src/com/elharo/xml/xinclude/JDOMXIncluder.java +@@ -54,6 +54,7 @@ import org.jdom.CDATA; + import org.jdom.Namespace; + import org.jdom.Comment; + import org.jdom.CDATA; ++import org.jdom.DocType; + import org.jdom.Text; + import org.jdom.JDOMException; + import org.jdom.Attribute; +@@ -404,6 +405,13 @@ public class JDOMXIncluder { + // I need to return the full document child list including comments and PIs, + // not just the resolved root + List topLevelNodes = doc.getContent(); ++ for (int i = 0; i < topLevelNodes.size(); i++) { ++ Object o = topLevelNodes.get(i); ++ if (o instanceof DocType) { ++ DocType docType = (DocType) o; ++ docType.detach(); ++ } ++ } + int rootPosition = topLevelNodes.indexOf(root); + List beforeRoot = topLevelNodes.subList(0, rootPosition); + List afterRoot = topLevelNodes.subList(rootPosition+1, topLevelNodes.size());