Author: damjan
Date: Wed Sep 26 19:24:48 2012
New Revision: 1390688
URL: http://svn.apache.org/viewvc?rev=1390688&view=rev
Log:
A few more PMD warnings.
Modified:
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/rgbe/RgbeInfo.java
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/xpm/XpmImageParser.java
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/palette/PaletteFactory.java
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/util/IoUtils.java
Modified:
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/rgbe/RgbeInfo.java
URL:
http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/rgbe/RgbeInfo.java?rev=1390688&r1=1390687&r2=1390688&view=diff
==============================================================================
---
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/rgbe/RgbeInfo.java
(original)
+++
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/rgbe/RgbeInfo.java
Wed Sep 26 19:24:48 2012
@@ -115,12 +115,10 @@ class RgbeInfo extends BinaryFileFunctio
String variable = info.substring(0, equals);
String value = info.substring(equals + 1);
- if ("FORMAT".equals(value)) {
- if (!"32-bit_rle_rgbe".equals(value)) {
- throw new ImageReadException(
- "Only 32-bit_rle_rgbe images are supported,
trying to read "
- + value);
- }
+ if ("FORMAT".equals(value) &&
!"32-bit_rle_rgbe".equals(value)) {
+ throw new ImageReadException(
+ "Only 32-bit_rle_rgbe images are supported, trying
to read " +
+ value);
}
metadata.add(variable, value);
Modified:
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/xpm/XpmImageParser.java
URL:
http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/xpm/XpmImageParser.java?rev=1390688&r1=1390687&r2=1390688&view=diff
==============================================================================
---
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/xpm/XpmImageParser.java
(original)
+++
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/xpm/XpmImageParser.java
Wed Sep 26 19:24:48 2012
@@ -381,11 +381,11 @@ public class XpmImageParser extends Imag
for (int j = 0; j < tokens.length; j++) {
String token = tokens[j];
boolean isKey = false;
- if (previousKeyIndex < (j - 1)) {
- if (token.equals("m") || token.equals("g4")
- || token.equals("g") || token.equals("c")
- || token.equals("s"))
- isKey = true;
+ if (previousKeyIndex < (j - 1) &&
+ token.equals("m") || token.equals("g4") ||
+ token.equals("g") || token.equals("c") ||
+ token.equals("s")) {
+ isKey = true;
}
if (isKey) {
if (previousKeyIndex >= 0) {
Modified:
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/palette/PaletteFactory.java
URL:
http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/palette/PaletteFactory.java?rev=1390688&r1=1390687&r2=1390688&view=diff
==============================================================================
---
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/palette/PaletteFactory.java
(original)
+++
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/palette/PaletteFactory.java
Wed Sep 26 19:24:48 2012
@@ -418,10 +418,8 @@ public class PaletteFactory {
int argb = src.getRGB(x, y);
int rgb = 0xffffff & argb;
- if (rgbs.add(rgb)) {
- if (rgbs.size() > max) {
- return null;
- }
+ if (rgbs.add(rgb) && rgbs.size() > max) {
+ return null;
}
}
}
Modified:
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/util/IoUtils.java
URL:
http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/util/IoUtils.java?rev=1390688&r1=1390687&r2=1390688&view=diff
==============================================================================
---
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/util/IoUtils.java
(original)
+++
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/util/IoUtils.java
Wed Sep 26 19:24:48 2012
@@ -122,11 +122,10 @@ public class IoUtils implements ImagingC
FileOutputStream stream = null;
try {
- if (file.getParentFile() != null &&
!file.getParentFile().exists()) {
- if (!file.getParentFile().mkdirs()) {
- throw new IOException(
- "Could not create directory for file " + file);
- }
+ if (file.getParentFile() != null && !file.getParentFile().exists()
&&
+ !file.getParentFile().mkdirs()) {
+ throw new IOException(
+ "Could not create directory for file " + file);
}
stream = new FileOutputStream(file);