Skip to content

First draft for a buffered writing of files #37

First draft for a buffered writing of files

First draft for a buffered writing of files #37

GitHub Actions / SpotBugs failed May 29, 2024 in 0s

SpotBugs Source Code Analyzer report

7 violation(s) found

Annotations

Check warning on line 73 in gama.extension.image/src/gama/extension/image/ImageSaver.java

See this annotation in the file changed.

@github-actions github-actions / SpotBugs

RV_RETURN_VALUE_IGNORED_BAD_PRACTICE

Exceptional return value of java.io.File.delete() ignored in gama.extension.image.ImageSaver.save(IScope, IExpression, File, String, boolean, String, Object, WriteController$BufferingStrategies)
Raw output
This method returns a value that is not checked. The return value should be checked since it can indicate an unusual or unexpected function execution. For example, the File.delete() method returns false if the file could not be successfully deleted (rather than throwing an Exception). If you don't check the result, you won't notice if the method invocation signals unexpected behavior by returning an atypical return value.

Check warning on line 86 in gama.core/src/gama/core/runtime/concurrent/WriteController.java

See this annotation in the file changed.

@github-actions github-actions / SpotBugs

DM_DEFAULT_ENCODING

Found reliance on default encoding in gama.core.runtime.concurrent.WriteController.directWrite(String, CharSequence, boolean): new java.io.FileWriter(File, boolean)
Raw output
Found a call to a method which will perform a byte to String (or String to byte) conversion, and will assume that the default platform encoding is suitable. This will cause the application behavior to vary between platforms. Use an alternative API and specify a charset name or Charset object explicitly.

Check warning on line 86 in gama.core/src/gama/core/runtime/concurrent/WriteController.java

See this annotation in the file changed.

@github-actions github-actions / SpotBugs

OBL_UNSATISFIED_OBLIGATION_EXCEPTION_EDGE

gama.core.runtime.concurrent.WriteController.directWrite(String, CharSequence, boolean) may fail to clean up java.io.Writer 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 65 in gama.core/src/gama/gaml/statements/save/ASCSaver.java

See this annotation in the file changed.

@github-actions github-actions / SpotBugs

DM_DEFAULT_ENCODING

Found reliance on default encoding in gama.gaml.statements.save.ASCSaver.save(IScope, IExpression, File, String, boolean, String, Object, WriteController$BufferingStrategies): new java.io.FileWriter(File)
Raw output
Found a call to a method which will perform a byte to String (or String to byte) conversion, and will assume that the default platform encoding is suitable. This will cause the application behavior to vary between platforms. Use an alternative API and specify a charset name or Charset object explicitly.

Check warning on line 60 in gama.core/src/gama/gaml/statements/save/ASCSaver.java

See this annotation in the file changed.

@github-actions github-actions / SpotBugs

RV_RETURN_VALUE_IGNORED_BAD_PRACTICE

Exceptional return value of java.io.File.delete() ignored in gama.gaml.statements.save.ASCSaver.save(IScope, IExpression, File, String, boolean, String, Object, WriteController$BufferingStrategies)
Raw output
This method returns a value that is not checked. The return value should be checked since it can indicate an unusual or unexpected function execution. For example, the File.delete() method returns false if the file could not be successfully deleted (rather than throwing an Exception). If you don't check the result, you won't notice if the method invocation signals unexpected behavior by returning an atypical return value.

Check warning on line 68 in gama.core/src/gama/gaml/statements/save/GeoTiffSaver.java

See this annotation in the file changed.

@github-actions github-actions / SpotBugs

RV_RETURN_VALUE_IGNORED_BAD_PRACTICE

Exceptional return value of java.io.File.delete() ignored in gama.gaml.statements.save.GeoTiffSaver.save(IScope, IExpression, File, String, boolean, String, Object, WriteController$BufferingStrategies)
Raw output
This method returns a value that is not checked. The return value should be checked since it can indicate an unusual or unexpected function execution. For example, the File.delete() method returns false if the file could not be successfully deleted (rather than throwing an Exception). If you don't check the result, you won't notice if the method invocation signals unexpected behavior by returning an atypical return value.

Check warning on line 37 in gama.core/src/gama/gaml/statements/save/JsonSaver.java

See this annotation in the file changed.

@github-actions github-actions / SpotBugs

DM_DEFAULT_ENCODING

Found reliance on default encoding in gama.gaml.statements.save.JsonSaver.save(IScope, IExpression, File, String, boolean, String, Object, WriteController$BufferingStrategies): new java.io.FileWriter(File, boolean)
Raw output
Found a call to a method which will perform a byte to String (or String to byte) conversion, and will assume that the default platform encoding is suitable. This will cause the application behavior to vary between platforms. Use an alternative API and specify a charset name or Charset object explicitly.