Checkstyle fix

This commit is contained in:
Jindra Petřík
2025-08-10 18:54:00 +02:00
parent 2df87d1a0a
commit b5da99a984
8 changed files with 49 additions and 39 deletions

View File

@@ -565,7 +565,7 @@ public class FrameExporter {
File f = new File(foutdir + File.separator + fileNum + ".webp");
BufferedImage img = frameImages.next();
if (img != null) {
try(FileOutputStream fos = new FileOutputStream(f)) {
try (FileOutputStream fos = new FileOutputStream(f)) {
fos.write(WebPCodec.encodeImage(img, 100f));
}
}

View File

@@ -111,11 +111,11 @@ public class ImageExporter {
if (settings.mode == ImageExportMode.BMP) {
fileFormat = ImageFormat.BMP;
}
if (settings.mode == ImageExportMode.WEBP) {
fileFormat = ImageFormat.WEBP;
}
final File file = new File(outdir + File.separator + Helper.makeFileName(imageTag.getCharacterExportFileName() + "." + ImageHelper.getImageFormatString(fileFormat)));
final ImageFormat ffileFormat = fileFormat;

View File

@@ -181,7 +181,7 @@ public class MorphShapeExporter {
if (settings.mode == MorphShapeExportMode.PNG_START_END) {
ImageHelper.write(img.getBufferedImage(), ImageFormat.PNG, fileStart);
} else if (settings.mode == MorphShapeExportMode.WEBP_START_END) {
try(FileOutputStream fos = new FileOutputStream(fileStart)) {
try (FileOutputStream fos = new FileOutputStream(fileStart)) {
fos.write(WebPCodec.encodeImage(img.getBufferedImage(), 100f));
}
} else {
@@ -208,7 +208,7 @@ public class MorphShapeExporter {
if (settings.mode == MorphShapeExportMode.PNG_START_END) {
ImageHelper.write(img.getBufferedImage(), ImageFormat.PNG, fileEnd);
} else if (settings.mode == MorphShapeExportMode.WEBP_START_END) {
try(FileOutputStream fos = new FileOutputStream(fileEnd)) {
try (FileOutputStream fos = new FileOutputStream(fileEnd)) {
fos.write(WebPCodec.encodeImage(img.getBufferedImage(), 100f));
}
} else {

View File

@@ -140,7 +140,7 @@ public class ShapeExporter {
if (settings.mode == ShapeExportMode.PNG) {
ImageHelper.write(img.getBufferedImage(), ImageFormat.PNG, file);
} else if (settings.mode == ShapeExportMode.WEBP) {
try(FileOutputStream fos = new FileOutputStream(file)) {
try (FileOutputStream fos = new FileOutputStream(file)) {
fos.write(WebPCodec.encodeImage(img.getBufferedImage(), 100f));
}
} else {

View File

@@ -54,6 +54,7 @@ public class ImageImporter extends TagImporter {
/**
* Imports image.
*
* @param it Image tag
* @param newData New data
* @return Imported tag
@@ -65,6 +66,7 @@ public class ImageImporter extends TagImporter {
/**
* Imports image.
*
* @param it Image tag
* @param newData New data
* @param tagType 0 = can change for defineBits, -1 = detect based on data
@@ -78,12 +80,12 @@ public class ImageImporter extends TagImporter {
ImageHelper.write(b, ImageFormat.PNG, baos);
newData = baos.toByteArray();
}
if (newData.length >= 4
if (newData.length >= 4
&& newData[0] == 'R'
&& newData[1] == 'I'
&& newData[2] == 'F'
&& newData[3] == 'F')
{
&& newData[3] == 'F'
) {
if (!ImageFormat.WEBP.available()) {
throw new RuntimeException("WEBP format is not supported on your platform");
}
@@ -162,6 +164,7 @@ public class ImageImporter extends TagImporter {
/**
* Imports image alpha.
*
* @param it Image tag
* @param newData New data
* @return Imported tag
@@ -197,6 +200,7 @@ public class ImageImporter extends TagImporter {
/**
* Converts image.
*
* @param it Image tag
* @param tagType 0 = can change for defineBits, -1 = detect based on data
* @throws IOException On I/O error
@@ -207,6 +211,7 @@ public class ImageImporter extends TagImporter {
/**
* Gets image tag type.
*
* @param format Format
* @return Image tag type
*/
@@ -235,6 +240,7 @@ public class ImageImporter extends TagImporter {
/**
* Bulk import images.
*
* @param imagesDir Images directory
* @param swf SWF
* @param printOut Print out

View File

@@ -63,6 +63,7 @@ public class ShapeImporter {
/**
* Imports an image to a shape tag.
*
* @param st Shape tag
* @param newData New image data
* @return Imported tag
@@ -74,6 +75,7 @@ public class ShapeImporter {
/**
* Imports an image to a morph shape tag.
*
* @param mst Morph shape tag
* @param newData New image data
* @return Imported tag
@@ -85,6 +87,7 @@ public class ShapeImporter {
/**
* Imports an image to morph shape tag.
*
* @param mst Morph shape tag
* @param newData New image data
* @param tagType Tag type
@@ -98,6 +101,7 @@ public class ShapeImporter {
/**
* Imports an image to shape tag.
*
* @param st Shape tag
* @param newData New image data
* @param tagType Tag type
@@ -164,13 +168,13 @@ public class ShapeImporter {
ImageHelper.write(b, ImageFormat.PNG, baos);
newData = baos.toByteArray();
}
if (newData.length >= 4
if (newData.length >= 4
&& newData[0] == 'R'
&& newData[1] == 'I'
&& newData[2] == 'F'
&& newData[3] == 'F')
{
&& newData[3] == 'F'
) {
if (!ImageFormat.WEBP.available()) {
throw new RuntimeException("WEBP format is not supported on your platform");
}
@@ -225,6 +229,7 @@ public class ShapeImporter {
/**
* Gets the shape tag type.
*
* @param format Format
* @return Shape tag type
*/
@@ -250,6 +255,7 @@ public class ShapeImporter {
/**
* Bulk import shapes.
*
* @param shapesDir Shapes directory
* @param swf SWF
* @param noFill No fill flag