Hi.
I have problem generating Javadoc on JDK 25:
```
netbeans$ JAVA_HOME=/jdk-25/ ant -q -f ide/projectapi javadoc
Trying to override old definition of task javac
Trying to override old definition of task java
Trying to override old definition of task javadoc
Trying to override old definition of task junit
     [echo] Build number : 20261001-e3c161964007
Trying to override old definition of task custom-javac

BUILD FAILED
/home/devel/NetBeansProjects/netbeans/nbbuild/templates/projectized.xml:409:
The following error occurred while executing this line:
/home/devel/NetBeansProjects/netbeans/nbbuild/javadoctools/links.xml:229:
JAXP00010004: The accumulated size of entities is "100 001" that
exceeded the "100 000" limit set by "jdk.xml.totalEntitySizeLimit".
```

Just trying: `JAVA_HOME=/jdk-25/ ant
-Djdk.xml.totalEntitySizeLimit=200000 -q -f ide/projectapi javadoc`
doesn't help.

I had to create a special task to `System.setProperty`. What do you
think about such a fix? Shall I create a PR?
-jt

```diff
diff --git nbbuild/antsrc/org/netbeans/nbbuild/SysProperty.java
nbbuild/antsrc/org/netbeans/nbbuild/SysProperty.java
new file mode 100644
index 000000000000..97f5c63045fe
--- /dev/null
+++ nbbuild/antsrc/org/netbeans/nbbuild/SysProperty.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.nbbuild;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Task;
+
+/** Sets a system property in the running JVM. Use with care. Needed to
+ * increase XML entities parsing limit before processing out Javadoc with
+ * {@code <ant file="template.xml" .../>}.
+ */
+public final class SysProperty extends Task {
+    private String name;
+    private String value;
+
+    public void setProperty(String name) {
+        this.name = name;
+    }
+
+    public void setValue(String value) {
+        this.value = value;
+    }
+
+    @Override
+    public void execute() throws BuildException {
+        System.setProperty(name, value);
+    }
+}
diff --git nbbuild/default.xml nbbuild/default.xml
index f72c31f2b2d3..e9a0d5c27f9c 100644
--- nbbuild/default.xml
+++ nbbuild/default.xml
@@ -116,6 +116,7 @@
     <taskdef name="subant-junit"
classname="org.netbeans.nbbuild.SubAntJUnitReport"
classpath="${nbantext.jar}"/>
     <taskdef name="resolvelist"
classname="org.netbeans.nbbuild.ResolveList"
classpath="${nbantext.jar}"/>
     <taskdef name="checkmoduleconfigs"
classname="org.netbeans.nbbuild.CheckModuleConfigs"
classpath="${nbantext.jar}"/>
+    <taskdef name="sysproperty"
classname="org.netbeans.nbbuild.SysProperty"
classpath="${nbantext.jar}"/>
     <property name="tasks-already-set" value="true"/>
   </target>

diff --git nbbuild/templates/projectized.xml nbbuild/templates/projectized.xml
index 56a3a700cd19..487200a87a0a 100644
--- nbbuild/templates/projectized.xml
+++ nbbuild/templates/projectized.xml
@@ -405,6 +405,7 @@

     <target name="javadoc" depends="build-init,-javadoc-init">
         <path id="javadoc.classpath" refid="processor.cp"/> <!-- #157320 -->
+        <sysproperty property="jdk.xml.totalEntitySizeLimit" value="200000"/>
         <!-- This should become an import at some point, perhaps: -->
         <ant dir="${nb_all}/nbbuild/javadoctools"
antfile="template.xml" target="javadoc">
             <property name="javadoc.base" location="."/>
@@ -412,6 +413,7 @@
             <property name="javadoc.packages"
value="${module.javadoc.packages}"/>
             <property name="javadoc.classpath" refid="javadoc.classpath"/>
             <property name="javadoc.project" location="nbproject/project.xml"/>
+            <property name="jdk.xml.totalEntitySizeLimit" value="200000"/>
         </ant>
     </target>
```

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists



Reply via email to