Liberty starter validation - #677
Conversation
| // Validate Group | ||
| String groupRaw = groupText.getText(); | ||
| String group = groupRaw.trim(); | ||
| String groupErrorMsg = "Valid characters for package names include a-z, A-Z, '_' and 0-9. Packages must be separated by '.'"; |
There was a problem hiding this comment.
This and other messages in this class also need to be translated.
| } | ||
|
|
||
| // Should not start or end with hyphen | ||
| if (artifact.startsWith("-") || artifact.endsWith("-")) { |
There was a problem hiding this comment.
I think this and the following check can be done more efficient with a regular expression. For example, what if the user enters --- or ----
| return false; | ||
| } | ||
|
|
||
| // Check for leading/trailing dots or consecutive dots |
There was a problem hiding this comment.
Same as previous comment. A regular expression would be better here to validate ending starting with ... or ...., etc.
Similarly with _ or -: here and in the previous case. do we allow users entering multiple _ or -?
| * @param mpVersion The MicroProfile version | ||
| * @return The highest compatible Jakarta EE version, or null if none found | ||
| */ | ||
| private String getFirstCompatibleEEVersion(String mpVersion) { |
There was a problem hiding this comment.
You might want to rename this method to getHighestCompatibleEEVersion. I was a bit confused about it until i read the content.
|
|
||
| // Add listeners to combo boxes. | ||
| SelectionListener comboListener = new SelectionAdapter() { | ||
| // javaSECombo validates page and also checks compatibility with current EE/MP selections. |
There was a problem hiding this comment.
Is this is still needed here? I am asking because a listener was already added and are doing the validation.
There was a problem hiding this comment.
Yes, this is needed. Unlike javaEECombo and microProfileCombo which have their own SelectionAdapters added in createVersionsSection(), javaSECombo(Called when user manually changes Java SE) only has this one listener. It calls checkAndUpdateJavaSE() to validate Java SE compatibility with current EE/MP selections and validatePage() for page completion tracking.
| * @param eeVersion The Jakarta EE version | ||
| * @param mpVersion The MicroProfile version | ||
| */ | ||
| private void checkAndUpdateJavaSE(String eeVersion, String mpVersion) { |
There was a problem hiding this comment.
Are we not getting the java SE validation data from the starter ... that is why you are manually verifying this?
If not, we need to take a different approach; otherwise, we will need to update this code every time a new compatibilities/versions are created.
There was a problem hiding this comment.
The Liberty Starter API (/api/start/info) does not provide Java SE compatibility constraints for Jakarta EE or MicroProfile versions ie it only provides EE↔MP compatibility via the constraints field under "e". Therefore, the Java SE validation rules are hardcoded based on the same logic used by the Liberty Starter website's frontend (builds.js). We are aware of this and will need to be updated when new versions are released, but there is no API-driven alternative currently available.
No description provided.