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

fix(deps): update dependency minecraft-data to v3.83.1 #282

Open
wants to merge 1 commit into
base: alpha
Choose a base branch
from

fix(deps): update dependency minecraft-data to v3.83.1

436d365
Select commit
Loading
Failed to load commit list.
Sign in for the full log view
Open

fix(deps): update dependency minecraft-data to v3.83.1 #282

fix(deps): update dependency minecraft-data to v3.83.1
436d365
Select commit
Loading
Failed to load commit list.
GitHub Actions / spotbugs completed Jan 11, 2025 in 0s

SpotBugs Source Code Analyzer report

203 violation(s) found

Annotations

Check warning on line 42 in src/main/java/me/romvnly/TownyPlus/Database.java

See this annotation in the file changed.

@github-actions github-actions / spotbugs

CT_CONSTRUCTOR_THROW

Exception thrown in class me.romvnly.TownyPlus.Database at new me.romvnly.TownyPlus.Database() will leave the constructor. The object under construction remains partially initialized and may be vulnerable to Finalizer attacks.
Raw output
Classes that throw exceptions in their constructors are vulnerable to Finalizer attacks

A finalizer attack can be prevented, by declaring the class final, using an empty finalizer declared as final, or by a clever use of a private constructor.

See SEI CERT Rule OBJ-11 [https://wiki.sei.cmu.edu/confluence/display/java/OBJ11-J.+Be+wary+of+letting+constructors+throw+exceptions] for more information.

Check warning on line 104 in src/main/java/me/romvnly/TownyPlus/Database.java

See this annotation in the file changed.

@github-actions github-actions / spotbugs

OBL_UNSATISFIED_OBLIGATION

me.romvnly.TownyPlus.Database.findCodeByString(String) may fail to clean up java.sql.Statement
Raw output
This method may fail to clean up (close, dispose of) a stream, database object, or other resource requiring an explicit cleanup operation.

In general, if a method opens a stream or other resource, the method should use a try/finally block to ensure that the stream or resource is cleaned up before the method returns.

This bug pattern is essentially the same as the OS_OPEN_STREAM and ODR_OPEN_DATABASE_RESOURCE bug patterns, but is based on a different (and hopefully better) static analysis technique. We are interested is getting feedback about the usefulness of this bug pattern. For sending feedback, check:

 * contributing guideline [https://github.com/spotbugs/spotbugs/blob/master/.github/CONTRIBUTING.md]
 * mailinglist [https://github.com/spotbugs/discuss/issues?q=]

In particular, the false-positive suppression heuristics for this bug pattern have not been extensively tuned, so reports about false positives are helpful to us.

See Weimer and Necula, Finding and Preventing Run-Time Error Handling Mistakes (PDF [https://people.eecs.berkeley.edu/~necula/Papers/rte_oopsla04.pdf]), for a description of the analysis technique.

Check warning on line 99 in src/main/java/me/romvnly/TownyPlus/Database.java

See this annotation in the file changed.

@github-actions github-actions / spotbugs

OBL_UNSATISFIED_OBLIGATION

me.romvnly.TownyPlus.Database.findTownByDiscordServerId(String) may fail to clean up java.sql.Statement
Raw output
This method may fail to clean up (close, dispose of) a stream, database object, or other resource requiring an explicit cleanup operation.

In general, if a method opens a stream or other resource, the method should use a try/finally block to ensure that the stream or resource is cleaned up before the method returns.

This bug pattern is essentially the same as the OS_OPEN_STREAM and ODR_OPEN_DATABASE_RESOURCE bug patterns, but is based on a different (and hopefully better) static analysis technique. We are interested is getting feedback about the usefulness of this bug pattern. For sending feedback, check:

 * contributing guideline [https://github.com/spotbugs/spotbugs/blob/master/.github/CONTRIBUTING.md]
 * mailinglist [https://github.com/spotbugs/discuss/issues?q=]

In particular, the false-positive suppression heuristics for this bug pattern have not been extensively tuned, so reports about false positives are helpful to us.

See Weimer and Necula, Finding and Preventing Run-Time Error Handling Mistakes (PDF [https://people.eecs.berkeley.edu/~necula/Papers/rte_oopsla04.pdf]), for a description of the analysis technique.

Check warning on line 94 in src/main/java/me/romvnly/TownyPlus/Database.java

See this annotation in the file changed.

@github-actions github-actions / spotbugs

OBL_UNSATISFIED_OBLIGATION

me.romvnly.TownyPlus.Database.findTownByName(String) may fail to clean up java.sql.Statement
Raw output
This method may fail to clean up (close, dispose of) a stream, database object, or other resource requiring an explicit cleanup operation.

In general, if a method opens a stream or other resource, the method should use a try/finally block to ensure that the stream or resource is cleaned up before the method returns.

This bug pattern is essentially the same as the OS_OPEN_STREAM and ODR_OPEN_DATABASE_RESOURCE bug patterns, but is based on a different (and hopefully better) static analysis technique. We are interested is getting feedback about the usefulness of this bug pattern. For sending feedback, check:

 * contributing guideline [https://github.com/spotbugs/spotbugs/blob/master/.github/CONTRIBUTING.md]
 * mailinglist [https://github.com/spotbugs/discuss/issues?q=]

In particular, the false-positive suppression heuristics for this bug pattern have not been extensively tuned, so reports about false positives are helpful to us.

See Weimer and Necula, Finding and Preventing Run-Time Error Handling Mistakes (PDF [https://people.eecs.berkeley.edu/~necula/Papers/rte_oopsla04.pdf]), for a description of the analysis technique.

Check warning on line 109 in src/main/java/me/romvnly/TownyPlus/Database.java

See this annotation in the file changed.

@github-actions github-actions / spotbugs

OBL_UNSATISFIED_OBLIGATION

me.romvnly.TownyPlus.Database.findTownByTownChatId(String) may fail to clean up java.sql.Statement
Raw output
This method may fail to clean up (close, dispose of) a stream, database object, or other resource requiring an explicit cleanup operation.

In general, if a method opens a stream or other resource, the method should use a try/finally block to ensure that the stream or resource is cleaned up before the method returns.

This bug pattern is essentially the same as the OS_OPEN_STREAM and ODR_OPEN_DATABASE_RESOURCE bug patterns, but is based on a different (and hopefully better) static analysis technique. We are interested is getting feedback about the usefulness of this bug pattern. For sending feedback, check:

 * contributing guideline [https://github.com/spotbugs/spotbugs/blob/master/.github/CONTRIBUTING.md]
 * mailinglist [https://github.com/spotbugs/discuss/issues?q=]

In particular, the false-positive suppression heuristics for this bug pattern have not been extensively tuned, so reports about false positives are helpful to us.

See Weimer and Necula, Finding and Preventing Run-Time Error Handling Mistakes (PDF [https://people.eecs.berkeley.edu/~necula/Papers/rte_oopsla04.pdf]), for a description of the analysis technique.

Check warning on line 189 in src/main/java/me/romvnly/TownyPlus/Database.java

See this annotation in the file changed.

@github-actions github-actions / spotbugs

OBL_UNSATISFIED_OBLIGATION

me.romvnly.TownyPlus.Database.getTownChatChannelId(String) may fail to clean up java.sql.ResultSet
Raw output
This method may fail to clean up (close, dispose of) a stream, database object, or other resource requiring an explicit cleanup operation.

In general, if a method opens a stream or other resource, the method should use a try/finally block to ensure that the stream or resource is cleaned up before the method returns.

This bug pattern is essentially the same as the OS_OPEN_STREAM and ODR_OPEN_DATABASE_RESOURCE bug patterns, but is based on a different (and hopefully better) static analysis technique. We are interested is getting feedback about the usefulness of this bug pattern. For sending feedback, check:

 * contributing guideline [https://github.com/spotbugs/spotbugs/blob/master/.github/CONTRIBUTING.md]
 * mailinglist [https://github.com/spotbugs/discuss/issues?q=]

In particular, the false-positive suppression heuristics for this bug pattern have not been extensively tuned, so reports about false positives are helpful to us.

See Weimer and Necula, Finding and Preventing Run-Time Error Handling Mistakes (PDF [https://people.eecs.berkeley.edu/~necula/Papers/rte_oopsla04.pdf]), for a description of the analysis technique.

Check warning on line 187 in src/main/java/me/romvnly/TownyPlus/Database.java

See this annotation in the file changed.

@github-actions github-actions / spotbugs

OBL_UNSATISFIED_OBLIGATION

me.romvnly.TownyPlus.Database.getTownChatChannelId(String) may fail to clean up java.sql.Statement
Raw output
This method may fail to clean up (close, dispose of) a stream, database object, or other resource requiring an explicit cleanup operation.

In general, if a method opens a stream or other resource, the method should use a try/finally block to ensure that the stream or resource is cleaned up before the method returns.

This bug pattern is essentially the same as the OS_OPEN_STREAM and ODR_OPEN_DATABASE_RESOURCE bug patterns, but is based on a different (and hopefully better) static analysis technique. We are interested is getting feedback about the usefulness of this bug pattern. For sending feedback, check:

 * contributing guideline [https://github.com/spotbugs/spotbugs/blob/master/.github/CONTRIBUTING.md]
 * mailinglist [https://github.com/spotbugs/discuss/issues?q=]

In particular, the false-positive suppression heuristics for this bug pattern have not been extensively tuned, so reports about false positives are helpful to us.

See Weimer and Necula, Finding and Preventing Run-Time Error Handling Mistakes (PDF [https://people.eecs.berkeley.edu/~necula/Papers/rte_oopsla04.pdf]), for a description of the analysis technique.

Check warning on line 153 in src/main/java/me/romvnly/TownyPlus/Database.java

See this annotation in the file changed.

@github-actions github-actions / spotbugs

OBL_UNSATISFIED_OBLIGATION

me.romvnly.TownyPlus.Database.getTownDiscordRoles(String) may fail to clean up java.sql.ResultSet
Raw output
This method may fail to clean up (close, dispose of) a stream, database object, or other resource requiring an explicit cleanup operation.

In general, if a method opens a stream or other resource, the method should use a try/finally block to ensure that the stream or resource is cleaned up before the method returns.

This bug pattern is essentially the same as the OS_OPEN_STREAM and ODR_OPEN_DATABASE_RESOURCE bug patterns, but is based on a different (and hopefully better) static analysis technique. We are interested is getting feedback about the usefulness of this bug pattern. For sending feedback, check:

 * contributing guideline [https://github.com/spotbugs/spotbugs/blob/master/.github/CONTRIBUTING.md]
 * mailinglist [https://github.com/spotbugs/discuss/issues?q=]

In particular, the false-positive suppression heuristics for this bug pattern have not been extensively tuned, so reports about false positives are helpful to us.

See Weimer and Necula, Finding and Preventing Run-Time Error Handling Mistakes (PDF [https://people.eecs.berkeley.edu/~necula/Papers/rte_oopsla04.pdf]), for a description of the analysis technique.

Check warning on line 151 in src/main/java/me/romvnly/TownyPlus/Database.java

See this annotation in the file changed.

@github-actions github-actions / spotbugs

OBL_UNSATISFIED_OBLIGATION

me.romvnly.TownyPlus.Database.getTownDiscordRoles(String) may fail to clean up java.sql.Statement
Raw output
This method may fail to clean up (close, dispose of) a stream, database object, or other resource requiring an explicit cleanup operation.

In general, if a method opens a stream or other resource, the method should use a try/finally block to ensure that the stream or resource is cleaned up before the method returns.

This bug pattern is essentially the same as the OS_OPEN_STREAM and ODR_OPEN_DATABASE_RESOURCE bug patterns, but is based on a different (and hopefully better) static analysis technique. We are interested is getting feedback about the usefulness of this bug pattern. For sending feedback, check:

 * contributing guideline [https://github.com/spotbugs/spotbugs/blob/master/.github/CONTRIBUTING.md]
 * mailinglist [https://github.com/spotbugs/discuss/issues?q=]

In particular, the false-positive suppression heuristics for this bug pattern have not been extensively tuned, so reports about false positives are helpful to us.

See Weimer and Necula, Finding and Preventing Run-Time Error Handling Mistakes (PDF [https://people.eecs.berkeley.edu/~necula/Papers/rte_oopsla04.pdf]), for a description of the analysis technique.

Check warning on line 217 in src/main/java/me/romvnly/TownyPlus/Database.java

See this annotation in the file changed.

@github-actions github-actions / spotbugs

OBL_UNSATISFIED_OBLIGATION_EXCEPTION_EDGE

me.romvnly.TownyPlus.Database.createCode(SavedCode) may fail to clean up java.sql.Statement on checked exception
Raw output
This method may fail to clean up (close, dispose of) a stream, database object, or other resource requiring an explicit cleanup operation.

In general, if a method opens a stream or other resource, the method should use a try/finally block to ensure that the stream or resource is cleaned up before the method returns.

This bug pattern is essentially the same as the OS_OPEN_STREAM and ODR_OPEN_DATABASE_RESOURCE bug patterns, but is based on a different (and hopefully better) static analysis technique. We are interested is getting feedback about the usefulness of this bug pattern. For sending feedback, check:

 * contributing guideline [https://github.com/spotbugs/spotbugs/blob/master/.github/CONTRIBUTING.md]
 * mailinglist [https://github.com/spotbugs/discuss/issues?q=]

In particular, the false-positive suppression heuristics for this bug pattern have not been extensively tuned, so reports about false positives are helpful to us.

See Weimer and Necula, Finding and Preventing Run-Time Error Handling Mistakes (PDF [https://people.eecs.berkeley.edu/~necula/Papers/rte_oopsla04.pdf]), for a description of the analysis technique.

Check warning on line 120 in src/main/java/me/romvnly/TownyPlus/Database.java

See this annotation in the file changed.

@github-actions github-actions / spotbugs

OBL_UNSATISFIED_OBLIGATION_EXCEPTION_EDGE

me.romvnly.TownyPlus.Database.createTownData(SavedTownData) may fail to clean up java.sql.Statement on checked exception
Raw output
This method may fail to clean up (close, dispose of) a stream, database object, or other resource requiring an explicit cleanup operation.

In general, if a method opens a stream or other resource, the method should use a try/finally block to ensure that the stream or resource is cleaned up before the method returns.

This bug pattern is essentially the same as the OS_OPEN_STREAM and ODR_OPEN_DATABASE_RESOURCE bug patterns, but is based on a different (and hopefully better) static analysis technique. We are interested is getting feedback about the usefulness of this bug pattern. For sending feedback, check:

 * contributing guideline [https://github.com/spotbugs/spotbugs/blob/master/.github/CONTRIBUTING.md]
 * mailinglist [https://github.com/spotbugs/discuss/issues?q=]

In particular, the false-positive suppression heuristics for this bug pattern have not been extensively tuned, so reports about false positives are helpful to us.

See Weimer and Necula, Finding and Preventing Run-Time Error Handling Mistakes (PDF [https://people.eecs.berkeley.edu/~necula/Papers/rte_oopsla04.pdf]), for a description of the analysis technique.

Check warning on line 225 in src/main/java/me/romvnly/TownyPlus/Database.java

See this annotation in the file changed.

@github-actions github-actions / spotbugs

OBL_UNSATISFIED_OBLIGATION_EXCEPTION_EDGE

me.romvnly.TownyPlus.Database.deleteCode(SavedCode) may fail to clean up java.sql.Statement on checked exception
Raw output
This method may fail to clean up (close, dispose of) a stream, database object, or other resource requiring an explicit cleanup operation.

In general, if a method opens a stream or other resource, the method should use a try/finally block to ensure that the stream or resource is cleaned up before the method returns.

This bug pattern is essentially the same as the OS_OPEN_STREAM and ODR_OPEN_DATABASE_RESOURCE bug patterns, but is based on a different (and hopefully better) static analysis technique. We are interested is getting feedback about the usefulness of this bug pattern. For sending feedback, check:

 * contributing guideline [https://github.com/spotbugs/spotbugs/blob/master/.github/CONTRIBUTING.md]
 * mailinglist [https://github.com/spotbugs/discuss/issues?q=]

In particular, the false-positive suppression heuristics for this bug pattern have not been extensively tuned, so reports about false positives are helpful to us.

See Weimer and Necula, Finding and Preventing Run-Time Error Handling Mistakes (PDF [https://people.eecs.berkeley.edu/~necula/Papers/rte_oopsla04.pdf]), for a description of the analysis technique.

Check warning on line 113 in src/main/java/me/romvnly/TownyPlus/Database.java

See this annotation in the file changed.

@github-actions github-actions / spotbugs

OBL_UNSATISFIED_OBLIGATION_EXCEPTION_EDGE

me.romvnly.TownyPlus.Database.deleteTownData(String) may fail to clean up java.sql.Statement on checked exception
Raw output
This method may fail to clean up (close, dispose of) a stream, database object, or other resource requiring an explicit cleanup operation.

In general, if a method opens a stream or other resource, the method should use a try/finally block to ensure that the stream or resource is cleaned up before the method returns.

This bug pattern is essentially the same as the OS_OPEN_STREAM and ODR_OPEN_DATABASE_RESOURCE bug patterns, but is based on a different (and hopefully better) static analysis technique. We are interested is getting feedback about the usefulness of this bug pattern. For sending feedback, check:

 * contributing guideline [https://github.com/spotbugs/spotbugs/blob/master/.github/CONTRIBUTING.md]
 * mailinglist [https://github.com/spotbugs/discuss/issues?q=]

In particular, the false-positive suppression heuristics for this bug pattern have not been extensively tuned, so reports about false positives are helpful to us.

See Weimer and Necula, Finding and Preventing Run-Time Error Handling Mistakes (PDF [https://people.eecs.berkeley.edu/~necula/Papers/rte_oopsla04.pdf]), for a description of the analysis technique.

Check warning on line 199 in src/main/java/me/romvnly/TownyPlus/Database.java

See this annotation in the file changed.

@github-actions github-actions / spotbugs

OBL_UNSATISFIED_OBLIGATION_EXCEPTION_EDGE

me.romvnly.TownyPlus.Database.getSavedCode(String, PreparedStatement) may fail to clean up java.sql.ResultSet on checked exception
Raw output
This method may fail to clean up (close, dispose of) a stream, database object, or other resource requiring an explicit cleanup operation.

In general, if a method opens a stream or other resource, the method should use a try/finally block to ensure that the stream or resource is cleaned up before the method returns.

This bug pattern is essentially the same as the OS_OPEN_STREAM and ODR_OPEN_DATABASE_RESOURCE bug patterns, but is based on a different (and hopefully better) static analysis technique. We are interested is getting feedback about the usefulness of this bug pattern. For sending feedback, check:

 * contributing guideline [https://github.com/spotbugs/spotbugs/blob/master/.github/CONTRIBUTING.md]
 * mailinglist [https://github.com/spotbugs/discuss/issues?q=]

In particular, the false-positive suppression heuristics for this bug pattern have not been extensively tuned, so reports about false positives are helpful to us.

See Weimer and Necula, Finding and Preventing Run-Time Error Handling Mistakes (PDF [https://people.eecs.berkeley.edu/~necula/Papers/rte_oopsla04.pdf]), for a description of the analysis technique.

Check warning on line 169 in src/main/java/me/romvnly/TownyPlus/Database.java

See this annotation in the file changed.

@github-actions github-actions / spotbugs

OBL_UNSATISFIED_OBLIGATION_EXCEPTION_EDGE

me.romvnly.TownyPlus.Database.getSavedTownData(String, PreparedStatement) may fail to clean up java.sql.ResultSet on checked exception
Raw output
This method may fail to clean up (close, dispose of) a stream, database object, or other resource requiring an explicit cleanup operation.

In general, if a method opens a stream or other resource, the method should use a try/finally block to ensure that the stream or resource is cleaned up before the method returns.

This bug pattern is essentially the same as the OS_OPEN_STREAM and ODR_OPEN_DATABASE_RESOURCE bug patterns, but is based on a different (and hopefully better) static analysis technique. We are interested is getting feedback about the usefulness of this bug pattern. For sending feedback, check:

 * contributing guideline [https://github.com/spotbugs/spotbugs/blob/master/.github/CONTRIBUTING.md]
 * mailinglist [https://github.com/spotbugs/discuss/issues?q=]

In particular, the false-positive suppression heuristics for this bug pattern have not been extensively tuned, so reports about false positives are helpful to us.

See Weimer and Necula, Finding and Preventing Run-Time Error Handling Mistakes (PDF [https://people.eecs.berkeley.edu/~necula/Papers/rte_oopsla04.pdf]), for a description of the analysis technique.

Check warning on line 75 in src/main/java/me/romvnly/TownyPlus/Database.java

See this annotation in the file changed.

@github-actions github-actions / spotbugs

OBL_UNSATISFIED_OBLIGATION_EXCEPTION_EDGE

me.romvnly.TownyPlus.Database.initializeDatabase() may fail to clean up java.sql.Statement on checked exception
Raw output
This method may fail to clean up (close, dispose of) a stream, database object, or other resource requiring an explicit cleanup operation.

In general, if a method opens a stream or other resource, the method should use a try/finally block to ensure that the stream or resource is cleaned up before the method returns.

This bug pattern is essentially the same as the OS_OPEN_STREAM and ODR_OPEN_DATABASE_RESOURCE bug patterns, but is based on a different (and hopefully better) static analysis technique. We are interested is getting feedback about the usefulness of this bug pattern. For sending feedback, check:

 * contributing guideline [https://github.com/spotbugs/spotbugs/blob/master/.github/CONTRIBUTING.md]
 * mailinglist [https://github.com/spotbugs/discuss/issues?q=]

In particular, the false-positive suppression heuristics for this bug pattern have not been extensively tuned, so reports about false positives are helpful to us.

See Weimer and Necula, Finding and Preventing Run-Time Error Handling Mistakes (PDF [https://people.eecs.berkeley.edu/~necula/Papers/rte_oopsla04.pdf]), for a description of the analysis technique.

Check warning on line 187 in src/main/java/me/romvnly/TownyPlus/Database.java

See this annotation in the file changed.

@github-actions github-actions / spotbugs

ODR_OPEN_DATABASE_RESOURCE

me.romvnly.TownyPlus.Database.getTownChatChannelId(String) may fail to close PreparedStatement
Raw output
The method creates a database resource (such as a database connection or row set), does not assign it to any fields, pass it to other methods, or return it, and does not appear to close the object on all paths out of the method.  Failure to close database resources on all paths out of a method may result in poor performance, and could cause the application to have problems communicating with the database.

Check warning on line 151 in src/main/java/me/romvnly/TownyPlus/Database.java

See this annotation in the file changed.

@github-actions github-actions / spotbugs

ODR_OPEN_DATABASE_RESOURCE

me.romvnly.TownyPlus.Database.getTownDiscordRoles(String) may fail to close PreparedStatement
Raw output
The method creates a database resource (such as a database connection or row set), does not assign it to any fields, pass it to other methods, or return it, and does not appear to close the object on all paths out of the method.  Failure to close database resources on all paths out of a method may result in poor performance, and could cause the application to have problems communicating with the database.

Check warning on line 48 in src/main/java/me/romvnly/TownyPlus/Database.java

See this annotation in the file changed.

@github-actions github-actions / spotbugs

PA_PUBLIC_PRIMITIVE_ATTRIBUTE

Primitive field me.romvnly.TownyPlus.Database.connection is public and set from inside the class, which makes it too exposed. Consider making it private to limit external accessibility.
Raw output
SEI CERT rule OBJ01-J [https://wiki.sei.cmu.edu/confluence/display/java/OBJ01-J.+Limit+accessibility+of+fields] requires that accessibility to fields must be limited. Otherwise, the values of the fields may be manipulated from outside the class, which may be unexpected or undesired behaviour. In general, requiring that no fields are allowed to be public is overkill and unrealistic. Even the rule mentions that final fields may be public. Besides final fields, there may be other usages for public fields: some public fields may serve as "flags" that affect the behavior of the class. Such flag fields are expected to be read by the current instance (or the current class, in case of static fields), but written by others. If a field is both written by the methods of the current instance (or the current class, in case of static fields) and from the outside, the code is suspicious. Consider making these fields private and provide appropriate setters, if necessary. Please note that constructors, initializers and finalizers are exceptions, if only they write the field inside the class, the field is not considered as written by the class itself.

Check warning on line 40 in src/main/java/me/romvnly/TownyPlus/Database.java

See this annotation in the file changed.

@github-actions github-actions / spotbugs

PA_PUBLIC_PRIMITIVE_ATTRIBUTE

Primitive field me.romvnly.TownyPlus.Database.dateString is public and set from inside the class, which makes it too exposed. Consider making it private to limit external accessibility.
Raw output
SEI CERT rule OBJ01-J [https://wiki.sei.cmu.edu/confluence/display/java/OBJ01-J.+Limit+accessibility+of+fields] requires that accessibility to fields must be limited. Otherwise, the values of the fields may be manipulated from outside the class, which may be unexpected or undesired behaviour. In general, requiring that no fields are allowed to be public is overkill and unrealistic. Even the rule mentions that final fields may be public. Besides final fields, there may be other usages for public fields: some public fields may serve as "flags" that affect the behavior of the class. Such flag fields are expected to be read by the current instance (or the current class, in case of static fields), but written by others. If a field is both written by the methods of the current instance (or the current class, in case of static fields) and from the outside, the code is suspicious. Consider making these fields private and provide appropriate setters, if necessary. Please note that constructors, initializers and finalizers are exceptions, if only they write the field inside the class, the field is not considered as written by the class itself.

Check warning on line 70 in src/main/java/me/romvnly/TownyPlus/Database.java

See this annotation in the file changed.

@github-actions github-actions / spotbugs

PA_PUBLIC_PRIMITIVE_ATTRIBUTE

Primitive field me.romvnly.TownyPlus.Database.dbType is public and set from inside the class, which makes it too exposed. Consider making it private to limit external accessibility.
Raw output
SEI CERT rule OBJ01-J [https://wiki.sei.cmu.edu/confluence/display/java/OBJ01-J.+Limit+accessibility+of+fields] requires that accessibility to fields must be limited. Otherwise, the values of the fields may be manipulated from outside the class, which may be unexpected or undesired behaviour. In general, requiring that no fields are allowed to be public is overkill and unrealistic. Even the rule mentions that final fields may be public. Besides final fields, there may be other usages for public fields: some public fields may serve as "flags" that affect the behavior of the class. Such flag fields are expected to be read by the current instance (or the current class, in case of static fields), but written by others. If a field is both written by the methods of the current instance (or the current class, in case of static fields) and from the outside, the code is suspicious. Consider making these fields private and provide appropriate setters, if necessary. Please note that constructors, initializers and finalizers are exceptions, if only they write the field inside the class, the field is not considered as written by the class itself.

Check warning on line 45 in src/main/java/me/romvnly/TownyPlus/Database.java

See this annotation in the file changed.

@github-actions github-actions / spotbugs

PA_PUBLIC_PRIMITIVE_ATTRIBUTE

Primitive field me.romvnly.TownyPlus.Database.ds is public and set from inside the class, which makes it too exposed. Consider making it private to limit external accessibility.
Raw output
SEI CERT rule OBJ01-J [https://wiki.sei.cmu.edu/confluence/display/java/OBJ01-J.+Limit+accessibility+of+fields] requires that accessibility to fields must be limited. Otherwise, the values of the fields may be manipulated from outside the class, which may be unexpected or undesired behaviour. In general, requiring that no fields are allowed to be public is overkill and unrealistic. Even the rule mentions that final fields may be public. Besides final fields, there may be other usages for public fields: some public fields may serve as "flags" that affect the behavior of the class. Such flag fields are expected to be read by the current instance (or the current class, in case of static fields), but written by others. If a field is both written by the methods of the current instance (or the current class, in case of static fields) and from the outside, the code is suspicious. Consider making these fields private and provide appropriate setters, if necessary. Please note that constructors, initializers and finalizers are exceptions, if only they write the field inside the class, the field is not considered as written by the class itself.

Check warning on line 217 in src/main/java/me/romvnly/TownyPlus/Database.java

See this annotation in the file changed.

@github-actions github-actions / spotbugs

SQL_INJECTION_JDBC

This use of java/sql/Connection.prepareStatement(Ljava/lang/String;)Ljava/sql/PreparedStatement; can be vulnerable to SQL injection (with JDBC)
Raw output
The input values included in SQL queries need to be passed in safely. Bind variables in prepared statements can be used to easily mitigate the risk of SQL injection.

Vulnerable Code:


Connection conn = [...];
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery("update COFFEES set SALES = "+nbSales+" where COF_NAME = '"+coffeeName+"'");



Solution:


Connection conn = [...];
conn.prepareStatement("update COFFEES set SALES = ? where COF_NAME = ?");
updateSales.setInt(1, nbSales);
updateSales.setString(2, coffeeName);




References (JDBC)
Oracle Documentation: The Java Tutorials > Prepared Statements [https://docs.oracle.com/javase/tutorial/jdbc/basics/prepared.html]
References (SQL injection)
WASC-19: SQL Injection [http://projects.webappsec.org/w/page/13246963/SQL%20Injection]
CAPEC-66: SQL Injection [https://capec.mitre.org/data/definitions/66.html]
CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') [https://cwe.mitre.org/data/definitions/89.html]
OWASP: Top 10 2013-A1-Injection [https://www.owasp.org/index.php/Top_10_2013-A1-Injection]
OWASP: SQL Injection Prevention Cheat Sheet [https://www.owasp.org/index.php/SQL_Injection_Prevention_Cheat_Sheet]
OWASP: Query Parameterization Cheat Sheet [https://www.owasp.org/index.php/Query_Parameterization_Cheat_Sheet]


Check warning on line 120 in src/main/java/me/romvnly/TownyPlus/Database.java

See this annotation in the file changed.

@github-actions github-actions / spotbugs

SQL_INJECTION_JDBC

This use of java/sql/Connection.prepareStatement(Ljava/lang/String;)Ljava/sql/PreparedStatement; can be vulnerable to SQL injection (with JDBC)
Raw output
The input values included in SQL queries need to be passed in safely. Bind variables in prepared statements can be used to easily mitigate the risk of SQL injection.

Vulnerable Code:


Connection conn = [...];
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery("update COFFEES set SALES = "+nbSales+" where COF_NAME = '"+coffeeName+"'");



Solution:


Connection conn = [...];
conn.prepareStatement("update COFFEES set SALES = ? where COF_NAME = ?");
updateSales.setInt(1, nbSales);
updateSales.setString(2, coffeeName);




References (JDBC)
Oracle Documentation: The Java Tutorials > Prepared Statements [https://docs.oracle.com/javase/tutorial/jdbc/basics/prepared.html]
References (SQL injection)
WASC-19: SQL Injection [http://projects.webappsec.org/w/page/13246963/SQL%20Injection]
CAPEC-66: SQL Injection [https://capec.mitre.org/data/definitions/66.html]
CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') [https://cwe.mitre.org/data/definitions/89.html]
OWASP: Top 10 2013-A1-Injection [https://www.owasp.org/index.php/Top_10_2013-A1-Injection]
OWASP: SQL Injection Prevention Cheat Sheet [https://www.owasp.org/index.php/SQL_Injection_Prevention_Cheat_Sheet]
OWASP: Query Parameterization Cheat Sheet [https://www.owasp.org/index.php/Query_Parameterization_Cheat_Sheet]


Check warning on line 225 in src/main/java/me/romvnly/TownyPlus/Database.java

See this annotation in the file changed.

@github-actions github-actions / spotbugs

SQL_INJECTION_JDBC

This use of java/sql/Connection.prepareStatement(Ljava/lang/String;)Ljava/sql/PreparedStatement; can be vulnerable to SQL injection (with JDBC)
Raw output
The input values included in SQL queries need to be passed in safely. Bind variables in prepared statements can be used to easily mitigate the risk of SQL injection.

Vulnerable Code:


Connection conn = [...];
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery("update COFFEES set SALES = "+nbSales+" where COF_NAME = '"+coffeeName+"'");



Solution:


Connection conn = [...];
conn.prepareStatement("update COFFEES set SALES = ? where COF_NAME = ?");
updateSales.setInt(1, nbSales);
updateSales.setString(2, coffeeName);




References (JDBC)
Oracle Documentation: The Java Tutorials > Prepared Statements [https://docs.oracle.com/javase/tutorial/jdbc/basics/prepared.html]
References (SQL injection)
WASC-19: SQL Injection [http://projects.webappsec.org/w/page/13246963/SQL%20Injection]
CAPEC-66: SQL Injection [https://capec.mitre.org/data/definitions/66.html]
CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') [https://cwe.mitre.org/data/definitions/89.html]
OWASP: Top 10 2013-A1-Injection [https://www.owasp.org/index.php/Top_10_2013-A1-Injection]
OWASP: SQL Injection Prevention Cheat Sheet [https://www.owasp.org/index.php/SQL_Injection_Prevention_Cheat_Sheet]
OWASP: Query Parameterization Cheat Sheet [https://www.owasp.org/index.php/Query_Parameterization_Cheat_Sheet]