You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by su...@apache.org on 2022/12/14 17:59:52 UTC

[groovy] branch danielsun/jdk20-20221215 updated (1da27cda89 -> e307a29522)

This is an automated email from the ASF dual-hosted git repository.

sunlan pushed a change to branch danielsun/jdk20-20221215
in repository https://gitbox.apache.org/repos/asf/groovy.git


 discard 1da27cda89 Build with JDK20 ea
     new e307a29522 Build with JDK20 ea

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (1da27cda89)
            \
             N -- N -- N   refs/heads/danielsun/jdk20-20221215 (e307a29522)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../org/apache/groovy/groovysh/commands/DocCommand.groovy | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)


[groovy] 01/01: Build with JDK20 ea

Posted by su...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

sunlan pushed a commit to branch danielsun/jdk20-20221215
in repository https://gitbox.apache.org/repos/asf/groovy.git

commit e307a2952251b82e3033743dfedcf6825692acec
Author: Daniel Sun <su...@apache.org>
AuthorDate: Thu Dec 15 01:19:15 2022 +0800

    Build with JDK20 ea
---
 .github/workflows/groovy-build-test-ea.yml                |  2 +-
 .../org/apache/groovy/groovysh/commands/DocCommand.groovy | 15 +++++++++++----
 2 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/.github/workflows/groovy-build-test-ea.yml b/.github/workflows/groovy-build-test-ea.yml
index d4a86698fd..715edac4f6 100644
--- a/.github/workflows/groovy-build-test-ea.yml
+++ b/.github/workflows/groovy-build-test-ea.yml
@@ -28,7 +28,7 @@ jobs:
         os: [ubuntu-20.04]
         java: [17]
         # The jdk links of "install-jdk.sh" are sometimes outdated, so we have to download openjdk releases from https://jdk.java.net/ by ourselves.
-        jdk: ["https://download.java.net/java/GA/jdk19/877d6127e982470ba2a7faa31cc93d04/36/GPL/openjdk-19_linux-x64_bin.tar.gz"]
+        jdk: ["https://download.java.net/java/early_access/jdk20/27/GPL/openjdk-20-ea+27_linux-x64_bin.tar.gz"]
     runs-on: ${{ matrix.os }}
     steps:
       - name: Download JDK ${{ matrix.jdk }}
diff --git a/subprojects/groovy-groovysh/src/main/groovy/org/apache/groovy/groovysh/commands/DocCommand.groovy b/subprojects/groovy-groovysh/src/main/groovy/org/apache/groovy/groovysh/commands/DocCommand.groovy
index 2f1bfb337a..7230b5c809 100644
--- a/subprojects/groovy-groovysh/src/main/groovy/org/apache/groovy/groovysh/commands/DocCommand.groovy
+++ b/subprojects/groovy-groovysh/src/main/groovy/org/apache/groovy/groovysh/commands/DocCommand.groovy
@@ -155,7 +155,8 @@ class DocCommand extends CommandSupport {
         // Java SE includes non-java(x) packages such as org.w3m.*, org.omg.*. org.xml.* for now
         // and new packages might be added in the future.
         def url = new URL("https://docs.oracle.com/${versionPrefix(module)}/$path")
-        if (sendHEADRequest(url, path)) {
+        if (sendHEADRequest(url, path)
+            || sendHEADRequest(url = new URL("https://download.java.net/java/early_access/${versionPrefix(module, true)}/$path"), path)) {
             urls << url
         } else if (!module) {
             // if no module specified, fall back to JDK8 if java.base url wasn't found
@@ -176,20 +177,22 @@ class DocCommand extends CommandSupport {
         urls
     }
 
-    private static versionPrefix(String module) {
+    private static versionPrefix(String module, boolean ea = false) {
         String javaVersion = System.getProperty('java.version')
         if (javaVersion.startsWith('1.')) {
             'javase/' + javaVersion.split(/\./)[1] + '/docs/api'
         } else {
             // java 9 and above
             def mod = module ?: 'java.base'
-            'en/java/javase/' + javaVersion.replaceAll(/-.*/, '').split(/\./)[0] + "/docs/api/$mod"
+            def ver = javaVersion.replaceAll(/-.*/, '').split(/\./)[0]
+            "${(ea ? '' : 'en/java/javase/')}$ver/docs/api/$mod"
         }
     }
 
     protected boolean sendHEADRequest(URL url, String path = null) {
+        HttpURLConnection conn = null
         try {
-            HttpURLConnection conn = url.openConnection() as HttpURLConnection
+            conn = url.openConnection() as HttpURLConnection
             conn.requestMethod = 'HEAD'
             conn.connectTimeout = TIMEOUT_CONN
             conn.readTimeout = TIMEOUT_READ
@@ -201,6 +204,10 @@ class DocCommand extends CommandSupport {
             return code == 200 && successfulRedirect
         } catch (IOException e) {
             fail "Sending a HEAD request to $url failed (${e}). Please check your network settings."
+        } finally {
+            if (null != conn) {
+                conn.disconnect()
+            }
         }
     }