Skip to content

Liberty starter validation - #677

Open
malavikaharikumar23 wants to merge 7 commits into
OpenLiberty:devfrom
malavikaharikumar23:liberty-starter-validation
Open

Liberty starter validation#677
malavikaharikumar23 wants to merge 7 commits into
OpenLiberty:devfrom
malavikaharikumar23:liberty-starter-validation

Conversation

@malavikaharikumar23

Copy link
Copy Markdown

No description provided.

// 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 '.'";

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This and other messages in this class also need to be translated.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

}

// Should not start or end with hyphen
if (artifact.startsWith("-") || artifact.endsWith("-")) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this and the following check can be done more efficient with a regular expression. For example, what if the user enters --- or ----

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

return false;
}

// Check for leading/trailing dots or consecutive dots

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 -?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

* @param mpVersion The MicroProfile version
* @return The highest compatible Jakarta EE version, or null if none found
*/
private String getFirstCompatibleEEVersion(String mpVersion) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You might want to rename this method to getHighestCompatibleEEVersion. I was a bit confused about it until i read the content.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


// Add listeners to combo boxes.
SelectionListener comboListener = new SelectionAdapter() {
// javaSECombo validates page and also checks compatibility with current EE/MP selections.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this is still needed here? I am asking because a listener was already added and are doing the validation.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread bundles/io.openliberty.tools.eclipse.ui/pom.xml Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants