Skip to content
This repository has been archived by the owner on Jun 7, 2022. It is now read-only.

Removing the manuell download links and replacing them with an automatic system #348

Open
wants to merge 4 commits into
base: development
Choose a base branch
from

Conversation

DerEingerostete
Copy link

This pull request includes:

  • breaking changes
  • no breaking changes

Changes made to the repository:

I removed the manuell download links for GetBukkit.org and replaced them with a system that automaticaly gets all versions that can be downloaded from GetBukkit.org.

Documentation of test results:

Just tested if the funktion works as intended and if performance is okay (it worked and I improved performance after testing)

Related issues/discussions:

No related issues

@DerEingerostete DerEingerostete changed the title Development Removing the manuell download links and replacing them with an automatic system Mar 28, 2021
@ghost
Copy link

ghost commented Mar 29, 2021

DeepCode's analysis on #4e8f8e found:

  • 1 critical issue, ℹ️ 1 minor issue. 👇

Top issues

Description Example fixes
Unsanitized input from data from a remote resource flows into openConnection, where it is used as an URL to perform a request. This may result in a Server-Side Request Forgery vulnerability. Occurrences: 🔧 Example fixes
Printing the stack trace of java.io.IOException. Production code should not use printStackTrace. Occurrences: 🔧 Example fixes

👉 View analysis in DeepCode’s Dashboard | Configure the bot

HashMap<String, GetBukkitVersion> versionsMap = new HashMap<>();
for (GetBukkitVersion version : versions)
versionsMap.put(version.getVersion(), version);

while (true) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you improve this loop based on the result of "test"

URL url = version.getDownloadURL();
return download.test(url.toString());
} catch (IOException exception) {
exception.printStackTrace();
Copy link
Contributor

Choose a reason for hiding this comment

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

Handle the exception

short searchFor = 0; //0 -> "Version" Text; 1 -> Actual Version; 2 -> Download Link

String line;
while ((line = reader.readLine()) != null) {
Copy link
Contributor

Choose a reason for hiding this comment

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

make you condition right and you need no break!

Copy link
Member

Choose a reason for hiding this comment

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

Whilst I appreciate your help, please give more constructive feedback.
What would be the correct condition to check for?

InputStream input = connection.getInputStream();
try (BufferedReader reader = new BufferedReader(new InputStreamReader(input))) {
String line;
while ((line = reader.readLine()) != null) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Make the conndition right and move the return value into a temp variable

Copy link
Member

Choose a reason for hiding this comment

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

Whilst I appreciate your help, please give more constructive feedback.
What would be the correct condition to check for?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants