Hi Craig,

you need to login into github in order to see the error messages Tobias
mentioned.

Checking the code formatting is a separate task from running the TCK
with Java 8, Java 11 and Java 17. The code formatting check task uses
Java 11 to run the code formatter. So this action never runs into the
error message saying you are using the wrong Java version.

Both profiles verify-format and format check the Java Version that is
use when running the profile and both fail when using Java 8. Actually
the message "Detected JDK Version: 1.8.0-331 is not in the allowed range
[11,)" comes from this check.

You got two different errors with github and locally: with github
checking the code format complaint about PropertyUtils.java and locally
you run into the issue that the code formatter does not work with Java 8.

Regards
Michael

Hi Craig,

I am not sure what you mean. When I look at the GitHub action, the formatting 
job fails as expected. It tells you which fails are formatted incorrectly. Here 
is the excerpt from the GitHub action logs for your PR:

Error:  Found 1 non-complying files, failing build
Error:  To fix formatting errors, run "mvn 
com.spotify.fmt:fmt-maven-plugin:format"
Error:  Non complying file: 
/home/runner/work/db-jdo/db-jdo/exectck/src/main/java/org/apache/jdo/exectck/PropertyUtils.java

Best regards,
Tobias


On 4 April 2023 16:02:13 CEST, Craig Russell<apache....@gmail.com>  wrote:
Hi Michael,


On Apr 4, 2023, at 01:50, Michael Bouschen<m...@apache.org>  wrote:

Hi Craig,

the maven plugin running the formatter requires Java 11 or higher:
   Detected JDK Version: 1.8.0-331 is not in the allowed range [11,)

So if you want to check the formatting or want to reformat the code you need to 
install Java 11.
I agree that this is the solution for running locally. But couldn't we 
configure mvn to *not* run this task if java 8 is detected, rather than run the 
tool and fail the build?
We discussed this (the formatter needs Javav 11 or higher) when I introduced 
the profile running the formatter and agrred this is not a problem.
The GitHub action still fails with no report of what the problem is. Is there 
any way except to run locally to figure out what its complaint is?

Thanks,
Craig
Regards
Michael

Hi Tobias,

Thanks for the hint. I changed the javadoc for the two methods and tried again.

The error message wasn't helpful but I ran mvn locally and now get:

org.apache.maven.enforcer.rule.api.EnforcerRuleException: Detected JDK Version: 
1.8.0-331 is not in the allowed range [11,).
     I have 1.8.361 installed according to the Java control panel (last updated 
today).
But my env has
JAVA_HOME /Library/Java/JavaVirtualMachines/jdk1.8.0_331.jdk/Contents/Home

I looked in my /Library/Java/JavaVirtualMachines and there is only the one VM 
installed there.

But that's just on my local machine. What is the problem with the GitHub runner?

I also found this from stackOverflow:

  clr% /usr/libexec/java_home -V
Matching Java Virtual Machines (2):
     1.8.361.09 (x86_64) "Oracle Corporation" - "Java" /Library/Internet 
Plug-Ins/JavaAppletPlugin.plugin/Contents/Home
     1.8.0_331 (x86_64) "Oracle Corporation" - "Java SE 8" 
/Library/Java/JavaVirtualMachines/jdk1.8.0_331.jdk/Contents/Home
/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home

Any ideas?
Thanks,
Craig

On Apr 3, 2023, at 14:17, Tobias 
Bouschen<tobias.bousc...@googlemail.com.INVALID>  wrote:

Hi Craig,

the instructions on how to run the format jobs are given in the 
readme:https://github.com/apache/db-jdo#formatting-using-maven

GJF also formats javadoc. So my guess would be that the new javadoc is not formatted 
correctly. The issue is probably that the javadoc has a linebreak even though the 
character limit is not reached on the first line. If you want the second line to 
actually be printed as a second line in the javadoc, you have to add '<p>' 
between the two lines. If you just add a blank line between the two javadoc lines, 
the formatter should do this for you.

Best regards,
Tobias

On 03/04/2023 22:25, Craig Russell wrote:
So the code format check failed. I cannot see anything wrong with the changes I 
made.

https://github.com/apache/db-jdo/actions/runs/4591159720/jobs/8107138939?pr=73

Error:  To fix formatting errors, run "mvn 
com.spotify.fmt:fmt-maven-plugin:format"
8275
  
<https://github.com/apache/db-jdo/actions/runs/4591159720/jobs/8107138939?pr=73#step:3:8276>Error:
  Non complying file: 
/home/runner/work/db-jdo/db-jdo/exectck/src/main/java/org/apache/jdo/exectck/PropertyUtils.java
While I try to figure out how to run com.spotify.fmt could anyone just tell me 
what the problem is?

Thanks,
Craig

Begin forwarded message:

From:c...@apache.org
Subject: [db-jdo] 01/01: Update PropertyUtils.java
Date: April 2, 2023 at 15:28:40 PDT
To:"jdo-comm...@db.apache.org"  <jdo-comm...@db.apache.org>
Reply-To:jdo-dev@db.apache.org

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

clr pushed a commit to branch clr-apache-array-copy
in repositoryhttps://gitbox.apache.org/repos/asf/db-jdo.git

commit 034060cb69ad0a10f9bdf5aca4d5a0c9c9c11e8c
Author: Craig L Russell<apache....@gmail.com>
AuthorDate: Sun Apr 2 15:28:34 2023 -0700

    Update PropertyUtils.java

    JDO-819 Fix code smells
    Use "Arrays.copyOf", "Arrays.asList", "Collections.addAll" or 
"System.arraycopy" instead.
---
.../java/org/apache/jdo/exectck/PropertyUtils.java | 23 ++++++++++------------
1 file changed, 10 insertions(+), 13 deletions(-)

diff --git a/exectck/src/main/java/org/apache/jdo/exectck/PropertyUtils.java 
b/exectck/src/main/java/org/apache/jdo/exectck/PropertyUtils.java
index 07473bce..eef6d73c 100644
--- a/exectck/src/main/java/org/apache/jdo/exectck/PropertyUtils.java
+++ b/exectck/src/main/java/org/apache/jdo/exectck/PropertyUtils.java
@@ -16,6 +16,7 @@ package org.apache.jdo.exectck;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
+import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.Properties;
@@ -28,31 +29,27 @@ public class PropertyUtils {
   }

   /**
-   * Separates white space separated items from a String into Collection 
entries Used to collect
-   * command line argument lists into a Collection
+   * Separates white space separated items from a String into a Set
+   * Used to collect command line arguments
    *
    * @param names String of white space separated items
-   * @param list HashSet to contain String items
+   * @param set Set to contain String items
    */
-  public static void string2Set(String names, Collection<String> list) {
+  public static void string2Set(String names, Collection<String> set) {
     String[] items = names.split("[ \t\n]");
-    for (String s : items) {
-      list.add(s);
-    }
+    set.addAll(Arrays.asList(items));
   }

   /**
-   * Separates white space separated items from a String into HashSet entries 
Used to collect
-   * command line argument lists into a Collection
+   * Separates white space separated items from a String into a List
+   * Used to collect command line arguments
    *
    * @param names String of white space separated items
-   * @param list HashSet to contain String items
+   * @param list List to contain String items
    */
   public static void string2List(String names, List<String> list) {
     String[] items = names.split("[ \t\n]");
-    for (String s : items) {
-      list.add(s);
-    }
+    list.addAll(Arrays.asList(items));
   }

   /**

Craig L Russell
c...@apache.org


Craig L Russell
c...@apache.org


Craig L Russell
c...@apache.org


--
Michael Bouschen
akquinet tech@spree GmbH
Bülowstraße 66 • D-10783 Berlin
Tel:   +49 30 235520-33
Fax:  +49 30 217520-12

E-Mail: michael.bousc...@akquinet.de
Web: www.akquinet.de <http://www.akquinet.de/>

Geschäftsführung: Dr. Torsten Fink, Heinz Wilming
Amtsgericht Berlin HRB 86780 • USt.-Id. Nr.: DE 225 964 680

[Facebook] <http://www.facebook.com/akquinet> [XING]
<https://www.xing.com/companies/akquinetag> [LinkedIn]
<https://www.linkedin.com/company/akquinet-ag> [Twitter]
<https://twitter.com/akquinet>

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to