karakun / OpenWebStart

Run Web Start based applications after the release of Java 11
https://openwebstart.com
Other
418 stars 48 forks source link

IllegalArgumentException: '1.8.*' is not a valid version-string #60

Closed Horcrux7 closed 4 years ago

Horcrux7 commented 4 years ago

I use version 0.4 of OpenWebStart. The related JNLP entry look like:

<j2se version="1.8.*"/>

I can give you also a more complex JNLP file if you need it. I think this JNLP version entry it correct like the Spec. It has also ever work with the JavaWebStart. I receive the follow exception.:

net.sourceforge.jnlp.LaunchException: Fatal: Read Error: Could not read or parse the JNLP file. You can try to download this file manually and send it as bug report to IcedTea-Web team.
    at net.sourceforge.jnlp.Launcher.fromUrl(Launcher.java:370)
    at net.sourceforge.jnlp.Launcher.launch(Launcher.java:229)
    at net.sourceforge.jnlp.runtime.Boot.run(Boot.java:296)
    at net.sourceforge.jnlp.runtime.Boot.run(Boot.java:78)
    at java.security.AccessController.doPrivileged(Native Method)
    at net.sourceforge.jnlp.runtime.Boot.main(Boot.java:233)
    at com.openwebstart.launcher.PhaseTwoWebStartLauncher.main(PhaseTwoWebStartLauncher.java:45)
    at com.openwebstart.launcher.OpenWebStartLauncher.main(OpenWebStartLauncher.java:28)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at com.exe4j.runtime.LauncherEngine.launch(LauncherEngine.java:85)
    at com.exe4j.runtime.WinLauncher.main(WinLauncher.java:94)
    at com.install4j.runtime.launcher.WinLauncher.main(WinLauncher.java:25)
Caused by: java.lang.RuntimeException: java.lang.IllegalArgumentException: '1.8.*' is not a valid version-string according to JSR-56, Appendix A.
    at net.sourceforge.jnlp.JNLPFile.parse(JNLPFile.java:890)
    at net.sourceforge.jnlp.JNLPFile.<init>(JNLPFile.java:289)
    at net.sourceforge.jnlp.JNLPFile.<init>(JNLPFile.java:271)
    at net.sourceforge.jnlp.JNLPFile.<init>(JNLPFile.java:256)
    at net.sourceforge.jnlp.Launcher.fromUrl(Launcher.java:334)
    ... 14 more
hendrikebbers commented 4 years ago

@Horcrux7 can you try to use 1.8* as the version. That should solve the problem. @sclassen takes care of the version string parsing and I assume he can say if we will allow such string (1.8.*) in near future.

Horcrux7 commented 4 years ago

Yes, this work as a workaround.

sclassen commented 4 years ago

According to the specification

version-string ::=  version-range ( " " version-range) *
version-range  ::=  simple-range ( "&" simple-range) *
simple-range   ::=  version-id | version-id modifier
version-id     ::= string ( separator string ) *
string         ::= char ( char ) *
char           ::= any ASCII character except a space, an ampersand, a separator, or a modifier.
separator      ::= "." | "-" | "_"
modifier       ::=  "+" | "*"

Your value of 1.8.* is not valid. Would you expect this to be parsed as 1.8* ??

Horcrux7 commented 4 years ago

I read the spec and I find it confusing. If I understand the spec correctly then the problem with 1.8* is that it also match 1.81.foo. Of course this will never be a version number. But you have the same problem with 10* that match version 10 and version 100. And this can be possible in some years.

Would you expect this to be parsed as 1.8* ??

No, I would expect that 1.8* is parsed as "1", "8" and `1.8.` is parsed as "1", "8", "*".

sclassen commented 4 years ago

Here a quote from the JSR-56 Apendix A:

A.3 Prefix Match

Given two version-ids, (HA TA) and (HB TB), then first (HB TB) is padded with 0 (zero element) entries at the end so it is at least the same length as the (HA TA) tuple.

(HA TA) is a prefix match of (HB TB) if and only if:

  • HA is equal to HB, and
    • TA is empty, or
    • TA is a prefix match of TB

In other words, A is a prefix match of B if, when represented as tuples, the elements of A are the same as the first elements of B. The padding ensures that B has at least as many elements as A.

For example, given the above definition "1.2.1" will be a prefix match to "1.2.1-004", but not to "1.2.0" or "1.2.10". The padding step ensures that "1.2.0.0" is a prefix of "1.2". Note that prefix matching and ordering are distinct: "1.3" is greater than "1.2", and less than "1.4", but not a prefix of either.

It states explicitly "1.2.1" is NOT a prefix of "1.2.10"

Horcrux7 commented 4 years ago

Thank you for your explanation. We will remove the extra points. You can close this ticket.