Skip to content

Commit e25745a

Browse files
committed
Resync the jdk1.3 cert-path overlays (mirroring the jdk1.4 sync) and fix the resulting build-lw/build-pkix/build-pg/build-test rot: regenerate PKIXCertPathValidatorSpi/CertPathValidatorUtilities/RFC3280CertPathUtilities/x509 CertPathValidatorUtilities against current base (ReasonsMask rename, PKIXPolicyNode/PKIXPolicyTreeUtil extraction, dropping the unused Ext*Exception classes), regenerate stale core/pg test overlays from base (CipherTest, RomulusTest, RSABlindSignatureTest, ArmoredOutputStream's String.split call sites, StreamUtil's missing writeSeconds/readSeconds), fix jdk1.3 field-hiding compile errors (explicit this. qualifiers in JceCMSContentEncryptorBuilder and BcPGPKeyPairGeneratorProvider), and add/sync jdk1.3-overlay AllTests.java suite files (cms, pkcs, pkix, i18n, jce/provider, mail/smime) so they stop referencing test classes ant/jdk13.xml now excludes for post-1.3 JDK APIs. Also mirror the build-jdk13-docker skill's ORO_JAR pattern to mount an ant TrAX Xalan (real JDK 1.3.1 predates JAXP, so ant's own <junitreport> XSLT step and the forked <junit> XML formatter both need an external Xerces/Xalan) and to mount bc-test-data into the container, since build-test now compiles 100% cleanly across the whole jdk1.3 distribution.
1 parent 4b840f9 commit e25745a

38 files changed

Lines changed: 6107 additions & 1813 deletions

File tree

.claude/skills/build-jdk13-docker/build-jdk13.sh

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ JDK_HOST=${JDK_HOST:-$(readlink -f /opt/jdk1.3.1)}
2424
ANT_HOST=${ANT_HOST:-/opt/apache-ant-1.6.5}
2525
MAIL_HOST=${MAIL_HOST:-/opt/javamail-1.3.1}
2626
JAF_HOST=${JAF_HOST:-/opt/jaf-1.0.2}
27+
BC_TEST_DATA=${BC_TEST_DATA:-$(dirname "$BC_JAVA")/bc-test-data}
2728
IMAGE=${IMAGE:-bc-jdk13:etch}
2829

2930
# ORO impl for ant's <replaceregexp> (JDK 1.3 has no java.util.regex). Not
@@ -37,15 +38,52 @@ if [ -z "$ORO_JAR" ]; then
3738
done
3839
fi
3940

41+
# Real JDK 1.3.1 predates JAXP (added in J2SE 1.4): its rt.jar has no
42+
# org.w3c.dom / javax.xml.transform at all. ant's own JVM needs a TrAX Xalan
43+
# for the "test" target's <junitreport> XSLT step (else
44+
# TransformerFactoryConfigurationError: Provider
45+
# org.apache.xalan.processor.TransformerFactoryImpl not found) -- mounted here
46+
# via ANT_ARGS="-lib /opt/extralib" below, same mechanism as ORO_JAR. The
47+
# forked-JVM <junit> classpath still needs its own xercesImpl/xml-apis copy
48+
# (for the XML result formatter's org.w3c.dom.Node) dropped into
49+
# build/artifacts/jdk1.3/jars/ alongside the built module jars -- see the
50+
# "Iterating fast" section of this skill's README.
51+
if [ -z "$XALAN_JAR" ]; then
52+
for c in /home/dgh/.m2/repository/xalan/xalan/2.7.2/xalan-2.7.2.jar \
53+
/home/dgh/.m2/repository/xalan/xalan/2.7.1/xalan-2.7.1.jar; do
54+
[ -e "$c" ] && { XALAN_JAR=$c; break; }
55+
done
56+
fi
57+
if [ -z "$SERIALIZER_JAR" ]; then
58+
for c in /home/dgh/.m2/repository/xalan/serializer/2.7.2/serializer-2.7.2.jar \
59+
/home/dgh/.m2/repository/xalan/serializer/2.7.1/serializer-2.7.1.jar; do
60+
[ -e "$c" ] && { SERIALIZER_JAR=$c; break; }
61+
done
62+
fi
63+
4064
for p in "$BC_JAVA/build1-3" "$JDK_HOST/bin/.java_wrapper" "$ANT_HOST/bin/ant" \
4165
"$MAIL_HOST/mail.jar" "$JAF_HOST/activation.jar" "$ORO_JAR" \
66+
"$XALAN_JAR" "$SERIALIZER_JAR" \
4267
"$SCRIPT_DIR/Dockerfile" "$SCRIPT_DIR/jvm.cfg"; do
4368
[ -n "$p" ] && [ -e "$p" ] || {
44-
echo "ERROR: missing required path: ${p:-<ORO_JAR unset: set ORO_JAR=/path/to/oro-2.0.x.jar>}" >&2
69+
echo "ERROR: missing required path: ${p:-<unset: set ORO_JAR/XALAN_JAR/SERIALIZER_JAR explicitly>}" >&2
4570
exit 1
4671
}
4772
done
4873

74+
# bc-test-data is optional -- most SimpleTest/JUnit fixtures need it, but its
75+
# absence should degrade (FileNotFoundException per test) rather than block
76+
# the build. TestResourceFinder's walk-up starts from the forked <junit>'s
77+
# cwd ("${build.dir}/${target.prefix}" = /work/build/jdk13) and climbs one
78+
# path segment at a time; /work/bc-test-data is the candidate it actually
79+
# reaches (its final, root-level candidate collapses to a relative path
80+
# against the JVM's real cwd due to a File("", child) edge case, so mounting
81+
# at the container's true "/" does not work).
82+
BC_TEST_DATA_MOUNT=""
83+
if [ -n "$BC_TEST_DATA" ] && [ -d "$BC_TEST_DATA" ]; then
84+
BC_TEST_DATA_MOUNT="-v $BC_TEST_DATA:/work/bc-test-data:ro"
85+
fi
86+
4987
# --- build the (tiny) image once ---------------------------------------------
5088
if ! docker image inspect "$IMAGE" >/dev/null 2>&1; then
5189
echo ">> building $IMAGE"
@@ -84,6 +122,9 @@ exec docker run --rm $TTY --platform linux/386 \
84122
-v "$SCRIPT_DIR/jvm.cfg":/opt/jdk1.3.1/jre/lib/jvm.cfg:ro \
85123
-v "$ANT_HOST":/opt/ant:ro \
86124
-v "$ORO_JAR":/opt/extralib/oro.jar:ro \
125+
-v "$XALAN_JAR":/opt/extralib/xalan.jar:ro \
126+
-v "$SERIALIZER_JAR":/opt/extralib/serializer.jar:ro \
87127
-v "$MAIL_HOST":/opt/javamail-1.3.1:ro \
88128
-v "$JAF_HOST":/opt/jaf-1.0.2:ro \
129+
$BC_TEST_DATA_MOUNT \
89130
"$IMAGE" /bin/sh -c "$RUNCMD"

ant/jdk13.xml

Lines changed: 111 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,16 @@
1515
<property name="javadoc.args" value="-protected" />
1616
<property name="junit.maxmemory" value="1536m" />
1717

18+
<!-- bc-build.properties' mail.jar.home/activation.jar.home point at the repo-bundled
19+
javax.mail-1.4.7.jar/activation-1.1.1.jar, both Java 1.4 class files (major version 48),
20+
which is fine for the jdk1.4/jdk15to18 legacy builds but rejected outright by real 1.3
21+
javac (needs major version <= 47). Overriding them here to the 1.3-appropriate jars the
22+
build-jdk13-docker container mounts (JavaMail 1.3.1 / JAF 1.0.2, both major version 45)
23+
wins over bc-build.properties' values since Ant properties are first-set. -->
24+
<property environment="env" />
25+
<property name="mail.jar.home" value="${env.JAVA_MAIL_HOME}/mail.jar" />
26+
<property name="activation.jar.home" value="${env.JAVA_ACTIVATION_HOME}/activation.jar" />
27+
1828
<target name="init">
1929
<mkdir dir="${src.dir}" />
2030
<mkdir dir="${artifacts.dir}" />
@@ -217,6 +227,14 @@
217227
<fileset dir="pg/src/main/java">
218228
<exclude name="**/keybox/*.java" />
219229
<exclude name="**/keybox/**/*.java" />
230+
<!-- org.bouncycastle.openpgp.api uses enhanced-for loops and an enum
231+
(EncryptedDataPacketType) throughout, Java 5+ constructs the preprocessor
232+
cannot rewrite, spanning thousands of lines across ~49 files. Mirrors the
233+
ant/jdk14.xml exclude of the same package (jdk13.xml had never been synced
234+
with it); nothing outside this package depends on it structurally
235+
(PGPPublicKey.java's only reference is a Javadoc {@link}). -->
236+
<exclude name="**/api/*.java"/>
237+
<exclude name="**/api/**/*.java"/>
220238
</fileset>
221239
<fileset dir="mail/src/main/java">
222240
<exclude name="**/ValidateSignedMail.java" />
@@ -301,6 +319,25 @@
301319
<exclude name="**/crypto/test/ECCSISignerTest.java" />
302320
<exclude name="**/pqc/crypto/test/MLDSATest.java" />
303321
<exclude name="**/pqc/crypto/test/PqcMalformedInputTest.java" />
322+
<!-- synced from ant/jdk14.xml's core/src/test/java fileset -->
323+
<exclude name="**/i18n/**/*.java" />
324+
<exclude name="**/pqc/rainbow/*.java" />
325+
<exclude name="**/pqc/gemss/*.java" />
326+
<exclude name="**/pqc/math/**/*.java" />
327+
<exclude name="**/pqc/**/HRSS*.java" />
328+
<exclude name="**/pqc/**/HPS*.java" />
329+
<exclude name="**/pqc/**/PolynomialTest.java" />
330+
<exclude name="**/pqc/crypto/test/AllTestsCMCE.java" />
331+
<exclude name="**/pqc/crypto/test/AllTestsFaest.java" />
332+
<exclude name="**/pqc/crypto/test/AllTestsHawk.java" />
333+
<exclude name="**/pqc/crypto/test/AllTestsMQOM.java" />
334+
<exclude name="**/pqc/crypto/test/AllTestsQRUOV.java" />
335+
<exclude name="**/pqc/crypto/test/AllTestsSLHDSA.java" />
336+
<exclude name="**/pqc/crypto/test/AllTestsSnova.java" />
337+
<exclude name="**/pqc/crypto/test/AllTestsXMSS.java" />
338+
<exclude name="**/crypto/test/AllTestsSlow.java" />
339+
<exclude name="**/crypto/test/AllTestsOpenBSDBCrypt.java" />
340+
<exclude name="**/crypto/test/AllTestsArgon.java" />
304341
</fileset>
305342
<fileset dir="prov/src/test/java">
306343
<exclude name="**/GOST3410KeyPairTest.java" />
@@ -351,6 +388,24 @@
351388
<exclude name="**/jce/provider/test/AEADTest.java" />
352389
<exclude name="**/jce/provider/test/ECEncodingTest.java" />
353390
<exclude name="**/jce/provider/test/CertLocaleTest.java" />
391+
<!-- synced from ant/jdk14.xml's prov/src/test/java fileset -->
392+
<exclude name="**/jce/provider/test/JcajceParameterSpecTest.java" />
393+
<exclude name="**/jce/provider/test/XChaCha20Poly1305Test.java" />
394+
<exclude name="**/jce/provider/test/PKCS12SecretKeyStoreTest.java" />
395+
<exclude name="**/jce/provider/test/SM9KEMTest.java" />
396+
<exclude name="**/X509StoreTest.java" />
397+
<exclude name="**/pem/AllTests.java" />
398+
<exclude name="**/jce/**/DSTU*.java" />
399+
<exclude name="**/PQCDHTest.java" />
400+
<!-- test files using java.net.URI / getCause() / Java 1.4+ crypto spec APIs -->
401+
<exclude name="**/jce/provider/CrlCacheTest.java" />
402+
<exclude name="**/jce/provider/MultiValuedRDNEmailTest.java" />
403+
<exclude name="**/jce/provider/test/CrlReasonsMaskTest.java" />
404+
<exclude name="**/jce/provider/test/DHIESTest.java" />
405+
<exclude name="**/jce/provider/test/ECIESTest.java" />
406+
<exclude name="**/jce/provider/test/PBETest.java" />
407+
<exclude name="**/jce/provider/test/SM9SignatureTest.java" />
408+
<exclude name="**/jce/provider/test/XIESTest.java" />
354409
</fileset>
355410
<fileset dir="pkix/src/test/java">
356411
<exclude name="**/pkix/jcajce/*.java"/>
@@ -372,12 +427,45 @@
372427
<exclude name="**/bouncycastle/cms/test/GOSTR3410_2012_256CmsSignVerifyDetached.java"/>
373428
<exclude name="**/bouncycastle/cert/test/GOSTR3410_2012_256GenerateCertificate.java"/>
374429
<exclude name="**/its/**" />
430+
<!-- parity with ant/jdk14.xml: the cades main-source excludes above (CAdESLevel*,
431+
CAdESLongTermValuesUtil, CAdESArchiveTimestampUtil) leave org.bouncycastle.cades
432+
unable to compile at all, so these tests (and the AllTests that would reference
433+
them, itself unreferenced from anywhere else) cannot compile either -->
434+
<exclude name="**/cades/test/CAdESTTest.java"/>
435+
<exclude name="**/cades/test/CAdESLTTest.java"/>
436+
<exclude name="**/cades/test/CAdESLTATest.java"/>
437+
<exclude name="**/cades/test/AllTests.java"/>
438+
<!-- synced from ant/jdk14.xml's pkix/src/test/java fileset: jdk13.xml had never
439+
picked up these, all test files using post-1.3/1.4 JDK APIs -->
440+
<exclude name="**/tsp/test/ERSTest.java"/>
441+
<exclude name="**/pkix/test/PKIXCertPathReviewerPolicyTreeTest.java"/>
442+
<exclude name="**/cms/test/NewSignedDataStreamTest.java"/>
443+
<exclude name="**/cms/test/DefiniteLengthLargeDataTest.java"/>
444+
<exclude name="**/cert/ocsp/test/AllTests.java"/>
445+
<exclude name="**/cert/plants/**/*.java"/>
446+
<exclude name="**/cert/test/X509CertificateReviewerTest.java"/>
447+
<exclude name="**/pkix/test/QcStatementReviewerTest.java"/>
448+
<exclude name="**/cert/ocsp/test/OCSPExceptionalSignatureRejectionTest.java"/>
449+
<exclude name="**/cert/ocsp/test/PKIXOcspRevocationCheckerTest.java"/>
450+
<exclude name="**/pkcs/test/PBETest.java"/>
451+
<exclude name="**/pkix/test/PKIXCertPathReviewerCrlReasonTest.java"/>
452+
<!-- test files using X500Principal / getIssuerX500Principal / getCause() / Java
453+
1.4+ CertPath APIs (java.security.cert.TrustAnchor, CollectionCertStoreParameters) -->
454+
<exclude name="**/cert/test/PQCCertTest.java"/>
455+
<exclude name="**/cert/test/PQCPKCS10Test.java"/>
456+
<exclude name="**/cms/test/NewAuthEnvelopedDataStreamTest.java"/>
457+
<exclude name="**/cms/test/NewSignedDataTest.java"/>
458+
<exclude name="**/pkcs/test/PKCS12UtilTest.java"/>
459+
<exclude name="**/pkix/test/IDPRelativeNameTest.java"/>
375460
</fileset>
376461
<fileset dir="mail/src/test/java">
377462
<exclude name="**/MailGeneralTest.java" />
378463
<exclude name="**/SignedMailValidatorTest.java" />
379464
<exclude name="**/DummyCertPathReviewer.java" />
380465
<exclude name="**/JournalingSecureRandomEncryptTest.java"/>
466+
<exclude name="**/mail/smime/test/NewSMIMEAuthEnvelopedTest.java"/>
467+
<exclude name="**/mail/smime/test/NewSMIMESignedTest.java"/>
468+
<exclude name="**/mail/smime/test/PipedStreamThreadStuckTest.java"/>
381469
</fileset>
382470
<fileset dir="mail/src/test/resources" />
383471
<fileset dir="prov/src/main/resources" includes="**/*.properties" />
@@ -404,22 +492,43 @@
404492
</fileset>
405493
<fileset dir="pkix/src/main/jdk1.4" includes="**/*.java" />
406494
<fileset dir="util/src/main/jdk1.4" includes="**/*.java" />
407-
<fileset dir="pg/src/main/jdk1.5" includes="**/*.java" />
495+
<fileset dir="pg/src/main/jdk1.5" includes="**/*.java">
496+
<!-- the pg/src/main/jdk1.5 overlay is written for the jdk15to18 (Java 5) floor and
497+
is itself not 1.3/1.4-clean (e.g. OpenPGPDefaultPolicy.java uses enhanced-for);
498+
openpgp.api is excluded from these legacy distributions entirely, see the
499+
pg/src/main/java fileset exclude above (mirrors ant/jdk14.xml's identical
500+
exclude on this same jdk1.5 fileset). -->
501+
<exclude name="**/api/**/*.java"/>
502+
</fileset>
408503
<fileset dir="core/src/test/jdk1.4" includes="**/*.java" />
409504
</copy>
410505
<copy todir="${src.dir}" overwrite="true">
411506
<fileset dir="pg/src/main/jdk1.4" includes="**/*.java" />
507+
</copy>
508+
<!-- kept as a separate, later copy task (not just another fileset in the one above): when
509+
the jdk1.4 and jdk1.3 overlays of the SAME file (e.g. ArmoredOutputStream.java) were
510+
both filesets of one copy task, the jdk1.3 version was not reliably ending up as the
511+
final staged content. Splitting into sequential tasks (matching how core/prov/pkix
512+
stage their own jdk1.4-then-jdk1.3 overlays further below) makes the jdk1.3 copy
513+
unambiguously the later, winning write. -->
514+
<copy todir="${src.dir}" overwrite="true">
412515
<fileset dir="pg/src/main/jdk1.3" includes="**/*.java" />
413516
</copy>
414517
<copy todir="${src.dir}" overwrite="true">
415518
<fileset dir="prov/src/test/jdk1.4" includes="**/*.java" >
416519
<exclude name="**/NistCertPathReviewerTest.java" />
520+
<!-- jdk1.4 overlay reintroduces ECIESTest, which the base fileset above already
521+
excludes for jdk1.3 (getCause(), post-1.3 API) -->
522+
<exclude name="**/jce/provider/test/ECIESTest.java" />
417523
</fileset>
418524
<fileset dir="pkix/src/test/jdk1.4" includes="**/*.java" >
419525
<exclude name="**/mime/test/*.java" />
420526
</fileset>
421527
<fileset dir="mail/src/test/jdk1.4" includes="**/*.java" >
422528
<exclude name="**/SignedMailValidatorTest.java" />
529+
<!-- jdk1.4 overlay reintroduces PipedStreamThreadStuckTest, which the base
530+
fileset above already excludes for jdk1.3 (javax.mail.util.ByteArrayDataSource) -->
531+
<exclude name="**/PipedStreamThreadStuckTest.java" />
423532
</fileset>
424533
</copy>
425534
<copy todir="${src.dir}" overwrite="true">
@@ -429,6 +538,7 @@
429538
<fileset dir="core/src/test/jdk1.3" includes="**/*.java" />
430539
<fileset dir="prov/src/test/jdk1.3" includes="**/*.java" />
431540
<fileset dir="pkix/src/test/jdk1.3" includes="**/*.java" />
541+
<fileset dir="mail/src/test/jdk1.3" includes="**/*.java" />
432542
</copy>
433543
<copy todir="${src.dir}">
434544
<fileset dir="jce/src" includes="**/*.java" />
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package org.bouncycastle.asn1.x509;
2+
3+
// NOTE: jdk1.3 overlay. Exception(String, Throwable) is a Java 1.4 constructor absent on JDK 1.3
4+
// (Throwable gained the two-arg constructor and initCause()/getCause() together in 1.4), so the
5+
// base class will not compile here. No 1.3 caller can observe a dropped cause: the two-arg
6+
// constructor keeps the message verbatim and discards the cause. Keep both signatures in lockstep
7+
// with the base CRLValidatorException so callers compile unchanged.
8+
public class CRLValidatorException
9+
extends Exception
10+
{
11+
public CRLValidatorException(String msg)
12+
{
13+
super(msg);
14+
}
15+
16+
public CRLValidatorException(String msg, Throwable cause)
17+
{
18+
super(msg);
19+
}
20+
}

0 commit comments

Comments
 (0)