Fixed empty image for bug reading in Java.

This commit is contained in:
Christian P. MOMON 2020-09-29 23:14:58 +02:00
parent 87a219c49f
commit 4aa9e13abd
10 changed files with 4 additions and 3 deletions

View file

@ -261,7 +261,7 @@ public final class CatGeneratorCLI
catch (IOException exception) catch (IOException exception)
{ {
logger.error("Error detected: {}", exception.getMessage()); logger.error("Error detected: {}", exception.getMessage());
// exception.printStackTrace(); exception.printStackTrace();
} }
// //

View file

@ -149,7 +149,7 @@ public class BirdGenerator
drawImage(grapher, "hoop", generator.nextInt(10) + 1); drawImage(grapher, "hoop", generator.nextInt(10) + 1);
drawImage(grapher, "body", generator.nextInt(9) + 1); drawImage(grapher, "body", generator.nextInt(9) + 1);
drawImage(grapher, "wing", generator.nextInt(9) + 1); drawImage(grapher, "wing", generator.nextInt(9) + 1);
drawImage(grapher, "eye", generator.nextInt(9) + 1); drawImage(grapher, "eyes", generator.nextInt(9) + 1);
drawImage(grapher, "bec", generator.nextInt(9) + 1); drawImage(grapher, "bec", generator.nextInt(9) + 1);
drawImage(grapher, "accessorie", generator.nextInt(20) + 1); drawImage(grapher, "accessorie", generator.nextInt(20) + 1);
@ -266,7 +266,8 @@ public class BirdGenerator
*/ */
private static void drawImage(final Graphics2D grapher, final String name, final int index) throws IOException private static void drawImage(final Graphics2D grapher, final String name, final int index) throws IOException
{ {
URL url = BirdGenerator.class.getResource("/fr/devinsy/catgenerator/core/images/bird/" + name + "_" + index + ".png"); String fileName = "/fr/devinsy/catgenerator/core/images/bird/" + name + "_" + index + ".png";
URL url = BirdGenerator.class.getResource(fileName);
BufferedImage part = ImageIO.read(url); BufferedImage part = ImageIO.read(url);
grapher.drawImage(part, null, 0, 0); grapher.drawImage(part, null, 0, 0);
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 298 B

After

Width:  |  Height:  |  Size: 187 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 298 B

After

Width:  |  Height:  |  Size: 187 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 298 B

After

Width:  |  Height:  |  Size: 187 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 298 B

After

Width:  |  Height:  |  Size: 187 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 298 B

After

Width:  |  Height:  |  Size: 187 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 298 B

After

Width:  |  Height:  |  Size: 187 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 298 B

After

Width:  |  Height:  |  Size: 187 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 298 B

After

Width:  |  Height:  |  Size: 187 B