Giter Club home page Giter Club logo

os-platform-finder's People

Contributors

aurbroszniowski avatar c0d3rk1d avatar dependabot[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

os-platform-finder's Issues

Error: generics are not supported in -source 1.3 while executing mvn clean package

The current pom.xml does not include the maven-compiler-plugin configuration.

Executing the 'mvn clean package' goal gives an error:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.0.2:compile (default-compile) on project os-platform-finder: Compilation failure: Compilation failure:
[ERROR] /home/cromine/Downloads/os-platform-finder-master/src/main/java/org/jsoftbiz/utils/OS.java:[62,26] error: generics are not supported in -source 1.3
[ERROR]
[ERROR](use -source 5 or higher to enable generics)
[ERROR] /home/cromine/Downloads/os-platform-finder-master/src/main/java/org/jsoftbiz/utils/OS.java:[114,28] error: enhanced for loops are not supported in -source 1.3

To fix, add the following:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <configuration>
        <source>1.6</source>
        <target>1.6</target>
    </configuration>
</plugin>

error: Source option 6 is no longer supported. Use 7 or later.

mvn clean package fails to build with error:

[INFO] Compiling 2 source files to /home/netikras/workspace/os-platform-finder/target/classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] Failure executing javac, but could not parse the error:
warning: [options] bootstrap class path not set in conjunction with -source 6
error: Source option 6 is no longer supported. Use 7 or later.
error: Target option 6 is no longer supported. Use 7 or later.

[INFO] 1 error
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  6.647 s
[INFO] Finished at: 2021-11-04T09:46:56+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project os-platform-finder: Compilation failure
[ERROR] Failure executing javac, but could not parse the error:
[ERROR] warning: [options] bootstrap class path not set in conjunction with -source 6
[ERROR] error: Source option 6 is no longer supported. Use 7 or later.
[ERROR] error: Target option 6 is no longer supported. Use 7 or later.
[ERROR] 
[ERROR] 
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

Please either update README.md with maven version required or adjust the java version requirements accordingly.

netikras@netikras-xps:~/workspace/os-platform-finder$ mvn -v
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: /usr/lib/maven/apache-maven-3.6.3
Java version: 14.0.1, vendor: Oracle Corporation, runtime: /usr/lib/jvm/jdk-14.0.1
Default locale: lt_LT, platform encoding: UTF-8
OS name: "linux", version: "5.7.9-050709-generic", arch: "amd64", family: "unix"
netikras@netikras-xps:~/workspace/os-platform-finder$ java --version
openjdk 14.0.1 2020-04-14
OpenJDK Runtime Environment (build 14.0.1+7)
OpenJDK 64-Bit Server VM (build 14.0.1+7, mixed mode, sharing)
netikras@netikras-xps:~/workspace/os-platform-finder$ 

Read VERSION_ID from /etc/os-release

Both the VERSION and VERSION_ID (and VERSION_CODENAME) fields are optional in /etc/os-release according to https://www.freedesktop.org/software/systemd/man/os-release.html, but os-platform-finder only checks for VERSION.

VERSION is defined as "A string identifying the operating system version, excluding any OS name information, possibly including a release code name, and suitable for presentation to the user." (Emphasis mine.)

VERSION_ID is defined as "A lower-case string (mostly numeric, no spaces or other characters outside of 0โ€“9, aโ€“z, ".", "_" and "-") identifying the operating system version, excluding any OS name information or release code name, and suitable for processing by scripts or usage in generated filenames." (Emphasis mine.)

In the samples below I found that in practice VERSION_ID is used most, so it would be nice to read that value, either as a fallback, or as the preferred value. Notably Alpine Linux doesn't set VERSION, but does set VERSION_ID.

Alpine Linux:

% docker run --rm alpine cat /etc/os-release | grep ^VERSION
VERSION_ID=3.13.5

Debian:

% docker run --rm debian cat /etc/os-release | grep ^VERSION
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster

Ubuntu:

% docker run --rm ubuntu cat /etc/os-release | grep ^VERSION
VERSION="20.04.2 LTS (Focal Fossa)"
VERSION_ID="20.04"
VERSION_CODENAME=focal

Fedora:

% docker run --rm fedora cat /etc/os-release | grep ^VERSION
VERSION="34 (Container Image)"
VERSION_ID=34
VERSION_CODENAME=""

CentOS:

% docker run --rm centos cat /etc/os-release | grep ^VERSION
VERSION="8"
VERSION_ID="8"

Cheetah and Yosemite have same version

Cheetah is 10.1, Yosemite is 10.10, both are the same number. I'm surprised your IDE didn't pick this up.

It's never a good idea to use the inherently inaccurate double for comparing exact values. It's the reason everyone always says not to use double values for financial calculations.

The easiest solution I can come up with is replacing the double with a string. The thing you're comparing it to is the osVersion, which is a string anyway. You just need to take the first two numbers. I don't know if the OSX osVersion has more than two parts as I don't use OSX (Apparently it does), and I can't find test cases for it, so I'm checking for it and extracting them. This lead me to the next bug: If the osVersion happens to contain one part (and no dot) your routine crashes. So I also fixed this for Darwin. Furthermore, when the version is not in the map, "null" was silently inserted in the resulting string. It might not be the best solution, but I replaced it by "unknown".

Apparently adding a diff or pull request without a fork is not possible so I'm just posting the patch. And as the patch extension is not allowed I zipped it too.
OS.java.fix.zip

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.