Browse Source

checkstyle

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@475075 13f79535-47bb-0310-9956-ffa450edef68
master
Peter Reilly 18 years ago
parent
commit
b1885e4435
1 changed files with 13 additions and 6 deletions
  1. +13
    -6
      src/main/org/apache/tools/ant/taskdefs/optional/image/Image.java

+ 13
- 6
src/main/org/apache/tools/ant/taskdefs/optional/image/Image.java View File

@@ -51,18 +51,25 @@ import java.util.Vector;
* @see org.apache.tools.ant.types.DataType * @see org.apache.tools.ant.types.DataType
*/ */
public class Image extends MatchingTask { public class Image extends MatchingTask {
// CheckStyle:VisibilityModifier OFF - bc
protected Vector instructions = new Vector(); protected Vector instructions = new Vector();
protected boolean overwrite = false; protected boolean overwrite = false;
protected Vector filesets = new Vector(); protected Vector filesets = new Vector();
protected File srcDir = null; protected File srcDir = null;
protected File destDir = null; protected File destDir = null;


// CheckStyle:MemberNameCheck OFF - bc

//cannot remove underscores due to protected visibility >:( //cannot remove underscores due to protected visibility >:(
protected String str_encoding = "JPEG"; protected String str_encoding = "JPEG";
protected boolean garbage_collect = false; protected boolean garbage_collect = false;


private boolean failonerror = true; private boolean failonerror = true;


// CheckStyle:MemberNameCheck ON

// CheckStyle:VisibilityModifier ON

/** /**
* Add a set of files to be deleted. * Add a set of files to be deleted.
* @param set the FileSet to add. * @param set the FileSet to add.
@@ -198,12 +205,12 @@ public class Image extends MatchingTask {
if (destDir == null) { if (destDir == null) {
destDir = srcDir; destDir = srcDir;
} }
File new_file = new File(destDir, file.getName());
File newFile = new File(destDir, file.getName());


if ((overwrite && new_file.exists()) && (!new_file.equals(file))) {
new_file.delete();
if ((overwrite && newFile.exists()) && (!newFile.equals(file))) {
newFile.delete();
} }
FileOutputStream stream = new FileOutputStream(new_file);
FileOutputStream stream = new FileOutputStream(newFile);


JAI.create("encode", image, stream, str_encoding.toUpperCase(), JAI.create("encode", image, stream, str_encoding.toUpperCase(),
null); null);
@@ -261,8 +268,8 @@ public class Image extends MatchingTask {
ArrayList filesToRemove = new ArrayList(); ArrayList filesToRemove = new ArrayList();
for (Iterator i = filesList.iterator(); i.hasNext();) { for (Iterator i = filesList.iterator(); i.hasNext();) {
File f = (File) i.next(); File f = (File) i.next();
File new_file = new File(destDir, f.getName());
if (new_file.exists()) {
File newFile = new File(destDir, f.getName());
if (newFile.exists()) {
filesToRemove.add(f); filesToRemove.add(f);
} }
} }


Loading…
Cancel
Save