Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

941 ide urls with java #1000

Conversation

cinnamon-coder-hub
Copy link
Member

First draft with most of the main functionalities necessary regarding issue #941. This is no final version and further commits will be added soon to tackle the following remarks:

  • Will be done in the comming days: Adding the 'missing'-file functionality, as well as the 'manual'-file for blocking versions regarding automated updating of download-urls.
  • If wanted: I'll add a more detailed documentation to the methods and classes.
  • Exception handling will be changed, e.g. throws IOException instead of try-catch block, if no further feedback can be given to the user.
  • Some parts of the test are a bit unpleasant, as they print out debug-infos into the terminal. This will be changed, so that assume*-lines are used instead, if needed. Then the tests can be run in an automated way via github-actions.

@cinnamon-coder-hub cinnamon-coder-hub added the draft needs clarification or details, not ready for implementation label Dec 7, 2022
@github-actions github-actions bot added the bash related to bash shell or scripts label Dec 7, 2022
Copy link
Member

@hohwille hohwille left a comment

Choose a reason for hiding this comment

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

@cinnamon-coder-hub thanks. 👍
I left a little review comment for a small rework. Can you address this so I can merge and we can collaborate on this. If you have solved the IDE settings meanwhile you can also perform a CleanUp for the entire project in Eclipse to apply the code format. Thanks in advance.

urlUpdater/pom.xml Outdated Show resolved Hide resolved
@hohwille hohwille added this to the release:2022.12.001 milestone Dec 12, 2022
@hohwille
Copy link
Member

hohwille commented Jan 19, 2023

It seems as if the unresolved conversation (regarding the pom file) can be resolved now, ...

Done

Still the "CI Build PR" test fails ...

You or someone accidentally deleted the submodule settings in this feature-branch / PR.
Go to files tab and you will see this:

Submodule [settings](https://github.com/devonfw/ide-settings) deleted from a9f6a7

Simply revert this change to fix the build.

It would be good to hear your ideas regarding the epic 941 ...

It is no problem if the epic is not entirely resolved with this PR. That is the nature of Epics as they are too big.
All I care for is that we always have consistent code on master branch with high quality. So if the work from @Amueller36 is integrated, warnings resolved and JavaDoc is present, we can merge.
Please expect further finding when I will do the final reviews.
I wont merge hacks like this:

String pathToRepo ="I:\\UrlRepoTest";

Main class should have a resonable name, Java-conventions have to be met (package names have to be all lower-case - see Updater with captial U), etc. So we still have a road to go before we can merge this.
Thanks already for the great progress and state @cinnamon-coder-hub and @Amueller36.

Implemented Missing Crawlers.
Renamed package Updater to updater.
Updated Settings folder
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create(downloadUrl))
.method("HEAD", HttpRequest.BodyPublishers.noBody())
.timeout(java.time.Duration.ofSeconds(5))
Copy link

Choose a reason for hiding this comment

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

0% of developers fix this issue

UnnecessarilyFullyQualified: This fully qualified name is unambiguous to the compiler if imported.


Suggested change
.timeout(java.time.Duration.ofSeconds(5))
.timeout(Duration.ofSeconds(5))

ℹ️ Learn about @sonatype-lift commands

You can reply with the following commands. For example, reply with @sonatype-lift ignoreall to leave out all findings.

Command Usage
@sonatype-lift ignore Leave out the above finding from this PR
@sonatype-lift ignoreall Leave out all the existing findings from this PR
@sonatype-lift exclude <file|issue|path|tool> Exclude specified file|issue|path|tool from Lift findings by updating your config.toml file

Note: When talking to LiftBot, you need to refresh the page to see its response.
Click here to add LiftBot to another repo.


Was this a good recommendation?
[ 🙁 Not relevant ] - [ 😕 Won't fix ] - [ 😑 Not critical, will fix ] - [ 🙂 Critical, will fix ] - [ 😊 Critical, fixing now ]

Set<String> versions = new HashSet<>();
try {
String response = doGetResponseBody(url);
ObjectMapper mapper = new ObjectMapper().configure(com.fasterxml.jackson.databind.DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
Copy link

Choose a reason for hiding this comment

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

0% of developers fix this issue

UnnecessarilyFullyQualified: This fully qualified name is unambiguous to the compiler if imported.


Suggested change
ObjectMapper mapper = new ObjectMapper().configure(com.fasterxml.jackson.databind.DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
ObjectMapper mapper = new ObjectMapper().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);

ℹ️ Learn about @sonatype-lift commands

You can reply with the following commands. For example, reply with @sonatype-lift ignoreall to leave out all findings.

Command Usage
@sonatype-lift ignore Leave out the above finding from this PR
@sonatype-lift ignoreall Leave out all the existing findings from this PR
@sonatype-lift exclude <file|issue|path|tool> Exclude specified file|issue|path|tool from Lift findings by updating your config.toml file

Note: When talking to LiftBot, you need to refresh the page to see its response.
Click here to add LiftBot to another repo.


Was this a good recommendation?
[ 🙁 Not relevant ] - [ 😕 Won't fix ] - [ 😑 Not critical, will fix ] - [ 🙂 Critical, will fix ] - [ 😊 Critical, fixing now ]


public void createFile(String os) {

File f = new File(this.getPath() + File.separator + os + ".urls");
Copy link

Choose a reason for hiding this comment

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

7% of developers fix this issue

💬 3 similar findings have been found in this PR


PATH_TRAVERSAL_IN: This API (java/io/File.(Ljava/lang/String;)V) reads a file whose location might be specified by user input


🔎 Expand here to view all instances of this finding
File Path Line Number
url-updater/src/main/java/com/devonfw/tools/ide/url/folderhandling/UrlVersion.java 132
url-updater/src/main/java/com/devonfw/tools/ide/url/folderhandling/UrlVersion.java 154
url-updater/src/main/java/com/devonfw/tools/ide/url/folderhandling/UrlVersion.java 166

Visit the Lift Web Console to find more details in your report.


ℹ️ Learn about @sonatype-lift commands

You can reply with the following commands. For example, reply with @sonatype-lift ignoreall to leave out all findings.

Command Usage
@sonatype-lift ignore Leave out the above finding from this PR
@sonatype-lift ignoreall Leave out all the existing findings from this PR
@sonatype-lift exclude <file|issue|path|tool> Exclude specified file|issue|path|tool from Lift findings by updating your config.toml file

Note: When talking to LiftBot, you need to refresh the page to see its response.
Click here to add LiftBot to another repo.


Was this a good recommendation?
[ 🙁 Not relevant ] - [ 😕 Won't fix ] - [ 😑 Not critical, will fix ] - [ 🙂 Critical, will fix ] - [ 😊 Critical, fixing now ]

@sonatype-lift
Copy link

sonatype-lift bot commented Jan 19, 2023

🛠 Lift Auto-fix

Some of the Lift findings in this PR can be automatically fixed. You can download and apply these changes in your local project directory of your branch to review the suggestions before committing.1

# Download the patch
curl https://lift.sonatype.com/api/patch/github.com/devonfw/ide/1000.diff -o lift-autofixes.diff

# Apply the patch with git
git apply lift-autofixes.diff

# Review the changes
git diff

Want it all in a single command? Open a terminal in your project's directory and copy and paste the following command:

curl https://lift.sonatype.com/api/patch/github.com/devonfw/ide/1000.diff | git apply

Once you're satisfied commit and push your changes in your project.

Footnotes

  1. You can preview the patch by opening the patch URL in the browser.

Records caused the build pipeline to fail because needed target version is 16! So I refactored it to use POJO's
@Amueller36
Copy link
Contributor

It seems as if the unresolved conversation (regarding the pom file) can be resolved now, ...

Done

Still the "CI Build PR" test fails ...

You or someone accidentally deleted the submodule settings in this feature-branch / PR. Go to files tab and you will see this:

Submodule [settings](https://github.com/devonfw/ide-settings) deleted from a9f6a7

Simply revert this change to fix the build.

It would be good to hear your ideas regarding the epic 941 ...

It is no problem if the epic is not entirely resolved with this PR. That is the nature of Epics as they are too big. All I care for is that we always have consistent code on master branch with high quality. So if the work from @Amueller36 is integrated, warnings resolved and JavaDoc is present, we can merge. Please expect further finding when I will do the final reviews. I wont merge hacks like this:

String pathToRepo ="I:\\UrlRepoTest";

Main class should have a resonable name, Java-conventions have to be met (package names have to be all lower-case - see Updater with captial U), etc. So we still have a road to go before we can merge this. Thanks already for the great progress and state @cinnamon-coder-hub and @Amueller36.

The build went through now. I had to rewrite the records to pojos because the tests run on java 11. Records require java 16.
I am not sure yet what path I should insert in the Current main function then, should it be the relative path ("../../ide-urls")?
I cp the settings folder back in and commited it but I am not sure if that was correct because I see in other forks in github it is a link to the template and not a folder itself.

Changed to relative path.
Removed Double Slf4J dependency
Added method for updating only existing versions.
Added method for updating only existing versions.
@hohwille
Copy link
Member

This PR was IMHO replaced by PR #1040 that has already been merged. Hence, I am closing it.

@hohwille hohwille closed this Feb 13, 2023
@hohwille hohwille added this to the rejected milestone Feb 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bash related to bash shell or scripts draft needs clarification or details, not ready for implementation settings ide-settings repo and replated processes and features
Projects
None yet
Development

Successfully merging this pull request may close these issues.

create domain model for ide-urls New approach for ide-mirrors
3 participants