Skip to content

Commit 4d096f8

Browse files
committed
Fixed CI build to use JDK 8 and compilation nuances
1 parent 7c1e8ab commit 4d096f8

File tree

3 files changed

+21
-14
lines changed

3 files changed

+21
-14
lines changed

scripts/setup-workspace.sh

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env bash
22
###
3-
# Prepare Codename One workspace by installing Maven, provisioning JDK 11 and JDK 17,
3+
# Prepare Codename One workspace by installing Maven, provisioning JDK 8 and JDK 17,
44
# building core modules, and installing Maven archetypes.
55
###
66
set -euo pipefail
@@ -36,11 +36,12 @@ case "$arch_name" in
3636
esac
3737

3838
# Determine platform-specific JDK download URLs
39-
arch_jdk11="$arch"
39+
arch_jdk8="$arch"
4040
if [ "$os" = "mac" ] && [ "$arch" = "aarch64" ]; then
41-
arch_jdk11="x64"
41+
arch_jdk8="x64"
4242
fi
43-
JDK11_URL="https://github.com/adoptium/temurin11-binaries/releases/download/jdk-11.0.28%2B6/OpenJDK11U-jdk_${arch_jdk11}_${os}_hotspot_11.0.28_6.tar.gz"
43+
44+
JDK8_URL="https://github.com/adoptium/temurin8-binaries/releases/download/jdk8u462-b08/OpenJDK8U-jdk_${arch_jdk8}_${os}_hotspot_8u462b08.tar.gz"
4445
JDK17_URL="https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.16%2B8/OpenJDK17U-jdk_${arch}_${os}_hotspot_17.0.16_8.tar.gz"
4546
MAVEN_URL="https://archive.apache.org/dist/maven/maven-3/3.9.6/binaries/apache-maven-3.9.6-bin.tar.gz"
4647

@@ -60,12 +61,12 @@ install_jdk() {
6061
eval "$dest_var=\"$home\""
6162
}
6263

63-
log "Ensuring JDK 11 is available"
64-
if [ ! -x "${JAVA_HOME:-}/bin/java" ] || ! "${JAVA_HOME:-}/bin/java" -version 2>&1 | grep -q '11\.0'; then
65-
log "Provisioning JDK 11 (this may take a while)..."
66-
install_jdk "$JDK11_URL" JAVA_HOME
64+
log "Ensuring JDK 8 is available"
65+
if [ ! -x "${JAVA_HOME:-}/bin/java" ] || ! "${JAVA_HOME:-}/bin/java" -version 2>&1 | grep -q '8\.0'; then
66+
log "Provisioning JDK 8 (this may take a while)..."
67+
install_jdk "$JDK8_URL" JAVA_HOME
6768
else
68-
log "Using existing JDK 11 at $JAVA_HOME"
69+
log "Using existing JDK 8 at $JAVA_HOME"
6970
fi
7071

7172
log "Ensuring JDK 17 is available"
@@ -98,7 +99,7 @@ ENV
9899

99100
source "$ENV_DIR/env.sh"
100101

101-
log "JDK 11 version:"; "$JAVA_HOME/bin/java" -version
102+
log "JDK 8 version:"; "$JAVA_HOME/bin/java" -version
102103
log "JDK 17 version:"; "$JAVA_HOME_17/bin/java" -version
103104
log "Maven version:"; "$MAVEN_HOME/bin/mvn" -version
104105

vm/JavaAPI/src/java/io/ByteArrayOutputStream.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ public String toString(String charsetName) throws UnsupportedEncodingException {
192192
*/
193193
@Override
194194
public synchronized void write(byte[] buffer, int offset, int len) {
195-
Arrays.checkOffsetAndCount(buffer.length, offset, len);
195+
checkOffsetAndCount(buffer.length, offset, len);
196196
if (len == 0) {
197197
return;
198198
}
@@ -201,6 +201,12 @@ public synchronized void write(byte[] buffer, int offset, int len) {
201201
this.count += len;
202202
}
203203

204+
static void checkOffsetAndCount(int arrayLength, int offset, int count) {
205+
if ((offset | count) < 0 || offset > arrayLength || arrayLength - offset < count) {
206+
throw new ArrayIndexOutOfBoundsException(offset);
207+
}
208+
}
209+
204210
/**
205211
* Writes the specified byte {@code oneByte} to the OutputStream. Only the
206212
* low order byte of {@code oneByte} is written.

vm/JavaAPI/src/java/text/SimpleDateFormat.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ String format(Date source, StringBuffer toAppendTo) {
315315
if (names == null) {
316316
toAppendTo.append(calendar.getTimeZone().getID());
317317
} else {
318-
toAppendTo.append(names[DateFormatSymbols.ZONE_SHORTNAME]);
318+
toAppendTo.append(names[2 /*DateFormatSymbols.ZONE_SHORTNAME */]);
319319
}
320320
break;
321321
case TIMEZONE822_LETTER :
@@ -398,7 +398,7 @@ String format(Date source, StringBuffer toAppendTo) {
398398

399399
private String[] getTimeZoneDisplayNames(String id) {
400400
for (String zoneStrings[] : getDateFormatSymbols().getZoneStrings()) {
401-
if (zoneStrings[DateFormatSymbols.ZONE_ID].equalsIgnoreCase(id)) {
401+
if (zoneStrings[0 /*DateFormatSymbols.ZONE_ID*/].equalsIgnoreCase(id)) {
402402
return zoneStrings;
403403
}
404404
}
@@ -926,7 +926,7 @@ int parseTimeZone(String source, int ofs) throws ParseException {
926926
for (String timezone[] : getDateFormatSymbols().getZoneStrings()) {
927927
for (String z : timezone) {
928928
if (z.equalsIgnoreCase(source)) {
929-
TimeZone tz = TimeZone.getTimeZone(timezone[DateFormatSymbols.ZONE_ID]);
929+
TimeZone tz = TimeZone.getTimeZone(timezone[0 /*DateFormatSymbols.ZONE_ID*/]);
930930
return -(tz.getRawOffset() / MILLIS_TO_MINUTES);
931931
}
932932
}

0 commit comments

Comments
 (0)