Browse Source

Style

Submitted by: Larry Shatzer (larry dot shatzer at spirent dot com)


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@275272 13f79535-47bb-0310-9956-ffa450edef68
master
Antoine Levy-Lambert 22 years ago
parent
commit
962a59d64f
26 changed files with 129 additions and 139 deletions
  1. +1
    -1
      src/main/org/apache/tools/ant/PropertyHelper.java
  2. +8
    -8
      src/main/org/apache/tools/ant/taskdefs/Exit.java
  3. +2
    -2
      src/main/org/apache/tools/ant/taskdefs/Java.java
  4. +2
    -2
      src/main/org/apache/tools/ant/taskdefs/RecorderEntry.java
  5. +3
    -5
      src/main/org/apache/tools/ant/taskdefs/condition/Socket.java
  6. +1
    -2
      src/main/org/apache/tools/ant/taskdefs/email/EmailTask.java
  7. +2
    -2
      src/main/org/apache/tools/ant/taskdefs/optional/dotnet/DotnetCompile.java
  8. +29
    -29
      src/main/org/apache/tools/ant/taskdefs/optional/dotnet/Ildasm.java
  9. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/dotnet/NetCommand.java
  10. +2
    -3
      src/main/org/apache/tools/ant/taskdefs/optional/extension/resolvers/AntResolver.java
  11. +9
    -6
      src/main/org/apache/tools/ant/taskdefs/optional/j2ee/AbstractHotDeploymentTool.java
  12. +2
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/j2ee/GenericHotDeploymentTool.java
  13. +7
    -7
      src/main/org/apache/tools/ant/taskdefs/optional/javacc/JJDoc.java
  14. +4
    -4
      src/main/org/apache/tools/ant/taskdefs/optional/javacc/JJTree.java
  15. +4
    -4
      src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestRunner.java
  16. +4
    -8
      src/main/org/apache/tools/ant/taskdefs/optional/net/SetProxy.java
  17. +2
    -3
      src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Submit.java
  18. +5
    -5
      src/main/org/apache/tools/ant/types/Assertions.java
  19. +5
    -5
      src/main/org/apache/tools/ant/types/Commandline.java
  20. +13
    -13
      src/main/org/apache/tools/ant/types/CommandlineJava.java
  21. +8
    -11
      src/main/org/apache/tools/ant/types/optional/image/Scale.java
  22. +2
    -4
      src/main/org/apache/tools/ant/types/resolver/ApacheCatalogResolver.java
  23. +1
    -1
      src/main/org/apache/tools/ant/types/selectors/MappingSelector.java
  24. +2
    -2
      src/main/org/apache/tools/ant/util/FileUtils.java
  25. +2
    -2
      src/main/org/apache/tools/ant/util/JAXPUtils.java
  26. +8
    -8
      src/main/org/apache/tools/bzip2/CBZip2OutputStream.java

+ 1
- 1
src/main/org/apache/tools/ant/PropertyHelper.java View File

@@ -156,7 +156,7 @@ public class PropertyHelper {
*
* @return the project's property helper.
*/
public synchronized static
public static synchronized
PropertyHelper getPropertyHelper(Project project) {
PropertyHelper helper
= (PropertyHelper) project.getReference("ant.PropertyHelper");


+ 8
- 8
src/main/org/apache/tools/ant/taskdefs/Exit.java View File

@@ -117,24 +117,24 @@ public class Exit extends Task {
*/
public void execute() throws BuildException {
if (testIfCondition() && testUnlessCondition()) {
String text=null;
String text = null;
if (message != null && message.length() > 0) {
text=message;
text = message;
} else {

if(getProject().getProperty(ifCondition) != null) {
text="if="+ifCondition;
if (getProject().getProperty(ifCondition) != null) {
text = "if=" + ifCondition;
}
if (unlessCondition!=null && unlessCondition.length()>0
if (unlessCondition != null && unlessCondition.length() > 0
&& getProject().getProperty(unlessCondition) == null) {
if (text == null) {
text = "";
} else {
text+=" and ";
text += " and ";
}
text+="unless="+unlessCondition;
text += "unless=" + unlessCondition;
} else {
if(text==null) {
if (text == null) {
text = "No message";
}
}


+ 2
- 2
src/main/org/apache/tools/ant/taskdefs/Java.java View File

@@ -157,8 +157,8 @@ public class Java extends Task {
+ "not compatible with spawn");
}
if (fork) {
if(perm != null) {
log("Permissions can not be set this way in forked mode.",Project.MSG_WARN);
if (perm != null) {
log("Permissions can not be set this way in forked mode.", Project.MSG_WARN);
}
log(cmdl.describeCommand(), Project.MSG_VERBOSE);
} else {


+ 2
- 2
src/main/org/apache/tools/ant/taskdefs/RecorderEntry.java View File

@@ -1,7 +1,7 @@
/*
* The Apache Software License, Version 1.1
*
* Copyright (c) 2001-2002 The Apache Software Foundation. All rights
* Copyright (c) 2001-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -82,7 +82,7 @@ public class RecorderEntry implements BuildLogger {
/** The output PrintStream to record to. */
private PrintStream out = null;
/** The start time of the last know target. */
private long targetStartTime = 0l;
private long targetStartTime = 0L;
/** Strip task banners if true. */
private boolean emacsMode = false;



+ 3
- 5
src/main/org/apache/tools/ant/taskdefs/condition/Socket.java View File

@@ -108,13 +108,11 @@ public class Socket extends ProjectComponent implements Condition {
s = new java.net.Socket(server, port);
} catch (IOException e) {
return false;
}
finally {
if (s != null){
} finally {
if (s != null) {
try {
s.close();
}
catch (IOException ioe){
} catch (IOException ioe) {
// Intentionally left blank
}
}


+ 1
- 2
src/main/org/apache/tools/ant/taskdefs/email/EmailTask.java View File

@@ -602,8 +602,7 @@ public class EmailTask
if (failOnError) {
throw e;
}
}
catch (Exception e) {
} catch (Exception e) {
log("Failed to send email", Project.MSG_WARN);
if (failOnError) {
throw new BuildException(e);


+ 2
- 2
src/main/org/apache/tools/ant/taskdefs/optional/dotnet/DotnetCompile.java View File

@@ -394,7 +394,7 @@ public abstract class DotnetCompile
*@return The Parameter to CSC
*/
protected String getIncludeDefaultReferencesParameter() {
if(standardLib==null) {
if (standardLib == null) {
return "/nostdlib" + (includeDefaultReferences ? "-" : "+");
} else {
return null;
@@ -868,7 +868,7 @@ public abstract class DotnetCompile
if (outputFile != null && outputFile.isDirectory()) {
throw new BuildException("destFile cannot be a directory");
}
if(getExecutable()==null) {
if (getExecutable() == null) {
throw new BuildException("There is no executable defined for this task");
}
}


+ 29
- 29
src/main/org/apache/tools/ant/taskdefs/optional/dotnet/Ildasm.java View File

@@ -105,7 +105,7 @@ public class Ildasm extends Task {
/**
* progress bar switch
*/
private boolean progressBar=false;
private boolean progressBar = false;

/**
* what is our encoding
@@ -116,45 +116,45 @@ public class Ildasm extends Task {
* /bytes flag for byte markup
*/

private boolean bytes=false;
private boolean bytes = false;

/**
* line numbers? /linenum
*/
private boolean linenumbers=false;
private boolean linenumbers = false;

/**
* /raweh flag for raw exception handling
*/
private boolean rawExceptionHandling=false;
private boolean rawExceptionHandling = false;

/**
* show the source; /source
*/
private boolean showSource=false;
private boolean showSource = false;

/**
* /quoteallnames to quote all names
*/
private boolean quoteallnames=false;
private boolean quoteallnames = false;

/**
* /header for header information
*/
private boolean header=false;
private boolean header = false;

/**
* when false, sets the /noil attribute
* to suppress assembly info
*/
private boolean assembler=true;
private boolean assembler = true;

/**
* include metadata
* /tokens
*/

private boolean metadata=false;
private boolean metadata = false;

/**
* what visibility do we want.
@@ -171,7 +171,7 @@ public class Ildasm extends Task {
/**
* override for the executable
*/
private String executable="ildasm";
private String executable = "ildasm";

/**
* name of the directory for resources to be created. We cannot control
@@ -338,13 +338,13 @@ public class Ildasm extends Task {
* verify that source and dest are ok
*/
private void validate() {
if(sourceFile==null || !sourceFile.exists() || !sourceFile.isFile()) {
if (sourceFile == null || !sourceFile.exists() || !sourceFile.isFile()) {
throw new BuildException("invalid source");
}
if(destFile==null || destFile.isDirectory()) {
if (destFile == null || destFile.isDirectory()) {
throw new BuildException("invalid dest");
}
if(resourceDir!=null
if (resourceDir != null
&& (!resourceDir.exists() || !resourceDir.isDirectory())) {
throw new BuildException("invalid resource directory");
}
@@ -355,13 +355,13 @@ public class Ildasm extends Task {
* @return
*/
private boolean isDisassemblyNeeded() {
if(!destFile.exists()) {
if (!destFile.exists()) {
return true;
}
long sourceTime=sourceFile.lastModified();
long destTime=destFile.lastModified();
return sourceTime>(destTime+ FileUtils.newFileUtils().getFileTimestampGranularity());
long sourceTime = sourceFile.lastModified();
long destTime = destFile.lastModified();
return sourceTime > (destTime + FileUtils.newFileUtils().getFileTimestampGranularity());
}
/**
* do the work
@@ -373,11 +373,11 @@ public class Ildasm extends Task {
command.setFailOnError(true);
//fill in args
command.addArgument("/text");
command.addArgument("/out="+destFile.toString());
if(!progressBar) {
command.addArgument("/out=" + destFile.toString());
if (!progressBar) {
command.addArgument("/nobar");
}
if(linenumbers) {
if (linenumbers) {
command.addArgument("/linenum");
}
if (showSource) {
@@ -395,7 +395,7 @@ public class Ildasm extends Task {
if (metadata) {
command.addArgument("/tokens");
}
command.addArgument("/item:",item);
command.addArgument("/item:", item);
if (rawExceptionHandling) {
command.addArgument("/raweh");
}
@@ -403,16 +403,16 @@ public class Ildasm extends Task {
if (bytes) {
command.addArgument("/bytes");
}
command.addArgument("/vis:",visibility);
command.addArgument("/vis:", visibility);

//add the source file
command.addArgument(sourceFile.getAbsolutePath());

//determine directory: resourceDir if set,
//the dir of the destFile if not
File execDir=resourceDir;
if(execDir==null) {
execDir=destFile.getParentFile();
File execDir = resourceDir;
if (execDir == null) {
execDir = destFile.getParentFile();
}
command.setDirectory(execDir);

@@ -421,7 +421,7 @@ public class Ildasm extends Task {
command.runCommand();
} catch (BuildException e) {
//forcibly delete the output file in case of trouble
if(destFile.exists()) {
if (destFile.exists()) {
destFile.delete();
}
//then rethrow the exception
@@ -434,7 +434,7 @@ public class Ildasm extends Task {
* encoding options; the default is ascii
*/
public static class EncodingTypes extends EnumeratedAttribute {
public final static String UNICODE= "unicode";
public final static String UNICODE = "unicode";
public final static String UTF8 = "utf8";
public final static String ASCII = "ascii";
public String[] getValues() {
@@ -451,7 +451,7 @@ public class Ildasm extends Task {
* @return
*/
public static String getEncodingOption(String enumValue) {
if(UNICODE.equals(enumValue)) {
if (UNICODE.equals(enumValue)) {
return "/unicode";
}
if (UTF8.equals(enumValue)) {


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/optional/dotnet/NetCommand.java View File

@@ -244,7 +244,7 @@ public class NetCommand {
}
File dir = owner.getProject().getBaseDir();
if (directory != null) {
dir=directory;
dir = directory;
}

ExecuteStreamHandler handler = new LogStreamHandler(owner,


+ 2
- 3
src/main/org/apache/tools/ant/taskdefs/optional/extension/resolvers/AntResolver.java View File

@@ -1,7 +1,7 @@
/*
* The Apache Software License, Version 1.1
*
* Copyright (c) 2002 The Apache Software Foundation. All rights
* Copyright (c) 2002-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -99,8 +99,7 @@ public class AntResolver
final File dir =
m_antfile.getParentFile().getCanonicalFile();
ant.setDir(dir);
}
catch (final IOException ioe) {
} catch (final IOException ioe) {
throw new BuildException(ioe.getMessage(), ioe);
}



+ 9
- 6
src/main/org/apache/tools/ant/taskdefs/optional/j2ee/AbstractHotDeploymentTool.java View File

@@ -1,7 +1,7 @@
/*
* The Apache Software License, Version 1.1
*
* Copyright (c) 2002 The Apache Software Foundation. All rights
* Copyright (c) 2002-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -101,9 +101,9 @@ public abstract class AbstractHotDeploymentTool implements HotDeploymentTool {
* @return A Path object representing the classpath to be used.
*/
public Path createClasspath() {
if (classpath == null)
if (classpath == null) {
classpath = new Path(task.getProject());
}
return classpath.createPath();
}

@@ -126,14 +126,17 @@ public abstract class AbstractHotDeploymentTool implements HotDeploymentTool {
* @exception org.apache.tools.ant.BuildException if the attributes are invalid or incomplete.
*/
public void validateAttributes() throws BuildException {
if (task.getAction() == null)
if (task.getAction() == null) {
throw new BuildException("The \"action\" attribute must be set");
}

if (!isActionValid())
if (!isActionValid()) {
throw new BuildException("Invalid action \"" + task.getAction() + "\" passed");
}

if (classpath == null)
if (classpath == null) {
throw new BuildException("The classpath attribute must be set");
}
}

/**


+ 2
- 1
src/main/org/apache/tools/ant/taskdefs/optional/j2ee/GenericHotDeploymentTool.java View File

@@ -144,8 +144,9 @@ public class GenericHotDeploymentTool extends AbstractHotDeploymentTool {
public void validateAttributes() throws BuildException {
super.validateAttributes();

if (className == null)
if (className == null) {
throw new BuildException("The classname attribute must be set");
}
}

/**


+ 7
- 7
src/main/org/apache/tools/ant/taskdefs/optional/javacc/JJDoc.java View File

@@ -73,7 +73,7 @@ import org.apache.tools.ant.util.JavaEnvUtils;
*
* @author Jene Jasper <a href="mailto:jjasper@abz.nl">jjasper@abz.nl</a>
* @author thomas.haas@softwired-inc.com
* @author Michael Saunders
* @author Michael Saunders
* <a href="mailto:michael@amtec.com">michael@amtec.com</a>
*/
public class JJDoc extends Task {
@@ -156,12 +156,12 @@ public class JJDoc extends Task {
}

if (outputFile != null) {
cmdl.createArgument() .setValue("-" + OUTPUT_FILE + ":"
cmdl.createArgument() .setValue("-" + OUTPUT_FILE + ":"
+ outputFile.replace('\\', '/'));
}

// use the directory containing the target as the output directory
File javaFile = new File(createOutputFileName(target, outputFile,
File javaFile = new File(createOutputFileName(target, outputFile,
plainText));

if (javaFile.exists()
@@ -173,7 +173,7 @@ public class JJDoc extends Task {

cmdl.createArgument().setValue(target.getAbsolutePath());

cmdl.setClassname(JavaCC.getMainClass(javaccHome,
cmdl.setClassname(JavaCC.getMainClass(javaccHome,
JavaCC.TASKDEF_TYPE_JJDOC));

final Path classpath = cmdl.createClasspath(getProject());
@@ -205,7 +205,7 @@ public class JJDoc extends Task {
private String createOutputFileName(File target, String optionalOutputFile,
boolean plainText) {
String suffix = DEFAULT_SUFFIX_HTML;
String javaccFile = target.getAbsolutePath().replace('\\','/');
String javaccFile = target.getAbsolutePath().replace('\\', '/');

if (plainText) {
suffix = DEFAULT_SUFFIX_TEXT;
@@ -228,12 +228,12 @@ public class JJDoc extends Task {
if (currentSuffix.equals(suffix)) {
optionalOutputFile = javaccFile + suffix;
} else {
optionalOutputFile = javaccFile.substring(0, suffixPos)
optionalOutputFile = javaccFile.substring(0, suffixPos)
+ suffix;
}
}
} else {
optionalOutputFile = optionalOutputFile.replace('\\','/');
optionalOutputFile = optionalOutputFile.replace('\\', '/');
}

return (getProject().getBaseDir() + "/" + optionalOutputFile)


+ 4
- 4
src/main/org/apache/tools/ant/taskdefs/optional/javacc/JJTree.java View File

@@ -308,7 +308,7 @@ public class JJTree extends Task {
String outputDirectory) {
optionalOutputFile = validateOutputFile(optionalOutputFile,
outputDirectory);
String jjtreeFile = target.getAbsolutePath().replace('\\','/');
String jjtreeFile = target.getAbsolutePath().replace('\\', '/');

if ((optionalOutputFile == null) || optionalOutputFile.equals("")) {
int filePos = jjtreeFile.lastIndexOf("/");
@@ -340,7 +340,7 @@ public class JJTree extends Task {
return (outputDirectory + "/" + optionalOutputFile).replace('\\', '/');
}

/*
/*
* Not used anymore
private boolean isAbsolute(String fileName) {
return (fileName.startsWith("/") || (new File(fileName).isAbsolute()));
@@ -357,8 +357,8 @@ public class JJTree extends Task {
* @return
* @throws BuildException
*/
private String validateOutputFile(String outputFile,
String outputDirectory)
private String validateOutputFile(String outputFile,
String outputDirectory)
throws BuildException {
if (outputFile == null) {
return null;


+ 4
- 4
src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestRunner.java View File

@@ -318,16 +318,16 @@ public class JUnitTestRunner implements TestListener {
}
perm = null;
} else {
if(perm != null) {
if (perm != null) {
perm.setSecurityManager();
}
}

try {
suite.run(res);
} finally {
if(perm != null) {
if (perm != null) {
perm.restoreSecurityManager();
}
if (savedOut != null) {
@@ -413,7 +413,7 @@ public class JUnitTestRunner implements TestListener {
res.stop();
}
}
/**
* Permissions for the test run.
* @since Ant 1.6


+ 4
- 8
src/main/org/apache/tools/ant/taskdefs/optional/net/SetProxy.java View File

@@ -301,17 +301,13 @@ public class SetProxy extends Task {
Method reset = c.getMethod("resetProperties", null);
reset.invoke(null, null);
return true;
}
catch (ClassNotFoundException cnfe) {
} catch (ClassNotFoundException cnfe) {
return false;
}
catch (NoSuchMethodException e) {
} catch (NoSuchMethodException e) {
return false;
}
catch (IllegalAccessException e) {
} catch (IllegalAccessException e) {
return false;
}
catch (InvocationTargetException e) {
} catch (InvocationTargetException e) {
return false;
}
}


+ 2
- 3
src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Submit.java View File

@@ -136,9 +136,8 @@ public class P4Submit extends P4Base {
found = true;
}
}
}
// NumberFormatException or ArrayOutOfBondsException could happen here
catch (Exception e) {
// NumberFormatException or ArrayOutOfBondsException could happen here
} catch (Exception e) {
String msg = "Failed to parse " + line + "\n"
+ " due to " + e.getMessage();
throw new BuildException(msg, e, getLocation());


+ 5
- 5
src/main/org/apache/tools/ant/types/Assertions.java View File

@@ -187,7 +187,7 @@ public class Assertions extends DataType {
* @return
*/
private int getFinalSize() {
return assertionList.size()+ (enableSystemAssertions!=null?1:0);
return assertionList.size() + (enableSystemAssertions != null ? 1 : 0);
}

/**
@@ -254,16 +254,16 @@ public class Assertions extends DataType {
* @throws CloneNotSupportedException
*/
protected Object clone() throws CloneNotSupportedException {
Assertions that=(Assertions) super.clone();
that.assertionList=(ArrayList) assertionList.clone();
return that;
Assertions that = (Assertions) super.clone();
that.assertionList = (ArrayList) assertionList.clone();
return that;
}

/**
* base class for our assertion elements.
*/

public static abstract class BaseAssertion {
public abstract static class BaseAssertion {
private String packageName;
private String className;



+ 5
- 5
src/main/org/apache/tools/ant/types/Commandline.java View File

@@ -303,11 +303,11 @@ public class Commandline implements Cloneable {
* Returns the executable and all defined arguments.
*/
public String[] getCommandline() {
List commands=new LinkedList();
List commands = new LinkedList();
ListIterator list = commands.listIterator();
addCommandToList(list);
final String[] result = new String[commands.size()];
return (String[])commands.toArray(result);
return (String[]) commands.toArray(result);
}

/**
@@ -316,7 +316,7 @@ public class Commandline implements Cloneable {
* @since Ant 1.6
*/
public void addCommandToList(ListIterator list) {
if(executable!=null) {
if (executable != null) {
list.add(executable);
}
addArgumentsToList(list);
@@ -331,7 +331,7 @@ public class Commandline implements Cloneable {
List result = new ArrayList(arguments.size() * 2);
addArgumentsToList(result.listIterator());
String [] res = new String[result.size()];
return (String[])result.toArray(res);
return (String[]) result.toArray(res);
}

/**
@@ -374,7 +374,7 @@ public class Commandline implements Cloneable {
if (argument.indexOf("\"") > -1) {
if (argument.indexOf("\'") > -1) {
throw new BuildException("Can\'t handle single and double"
+" quotes in same argument");
+ " quotes in same argument");
} else {
return '\'' + argument + '\'';
}


+ 13
- 13
src/main/org/apache/tools/ant/types/CommandlineJava.java View File

@@ -96,13 +96,13 @@ public class CommandlineJava implements Cloneable {
/**
* any assertions to make? Currently only supported in forked JVMs
*/
private Assertions assertions=null;
private Assertions assertions = null;

/**
* Indicate whether it will execute a jar file or not, in this case
* the first vm option must be a -jar and the 'executable' is a jar file.
*/
private boolean executeJar = false;
private boolean executeJar = false;

/**
* Specialized Environment class for System properties
@@ -119,13 +119,13 @@ public class CommandlineJava implements Cloneable {
*/
public String[] getVariables() throws BuildException {

List definitions=new LinkedList();
ListIterator list=definitions.listIterator();
List definitions = new LinkedList();
ListIterator list = definitions.listIterator();
addDefinitionsToList(list);
if(definitions.size()==0) {
if (definitions.size() == 0) {
return null;
} else {
return (String[])definitions.toArray(new String[0]);
return (String[]) definitions.toArray(new String[0]);
}
}

@@ -135,8 +135,8 @@ public class CommandlineJava implements Cloneable {
*/
public void addDefinitionsToList(ListIterator listIt) {
String[] props = super.getVariables();
if(props!=null) {
for (int i=0; i < props.length; i++) {
if (props != null) {
for (int i = 0; i < props.length; i++) {
listIt.add("-D" + props[i]);
}
}
@@ -379,12 +379,12 @@ public class CommandlineJava implements Cloneable {
*/
public String[] getCommandline() {
//create the list
List commands=new LinkedList();
List commands = new LinkedList();
final ListIterator listIterator = commands.listIterator();
//fill it
addCommandsToList(listIterator);
//convert to an array
return (String[])commands.toArray(new String[0]);
return (String[]) commands.toArray(new String[0]);
}

/**
@@ -503,8 +503,8 @@ public class CommandlineJava implements Cloneable {
size++;
}
//assertions take up space too
if(getAssertions()!=null) {
size+=getAssertions().size();
if (getAssertions() != null) {
size += getAssertions().size();
}
return size;
}
@@ -582,7 +582,7 @@ public class CommandlineJava implements Cloneable {
if (bootclasspath != null) {
c.bootclasspath = (Path) bootclasspath.clone();
}
if( assertions != null ) {
if (assertions != null) {
c.assertions = (Assertions) assertions.clone();
}
return c;


+ 8
- 11
src/main/org/apache/tools/ant/types/optional/image/Scale.java View File

@@ -83,7 +83,7 @@ public class Scale extends TransformOperation implements DrawOperation {
/**
* Sets the behaviour regarding the image proportions.
*/
public void setProportions(ProportionsAttribute pa){
public void setProportions(ProportionsAttribute pa) {
proportions = pa.getValue();
}

@@ -139,23 +139,20 @@ public class Scale extends TransformOperation implements DrawOperation {
y_fl = (y_fl / image.getHeight());
}

if("width".equals(proportions)){
if ("width".equals(proportions)) {
y_fl = x_fl;
}
else if("height".equals(proportions)){
} else if ("height".equals(proportions)) {
x_fl = y_fl;
}
else if("fit".equals(proportions)){
x_fl = y_fl = Math.min(x_fl,y_fl);
}
else if("cover".equals(proportions)){
x_fl = y_fl = Math.max(x_fl,y_fl);
} else if ("fit".equals(proportions)) {
x_fl = y_fl = Math.min(x_fl, y_fl);
} else if ("cover".equals(proportions)) {
x_fl = y_fl = Math.max(x_fl, y_fl);
}

pb.add(new Float(x_fl));
pb.add(new Float(y_fl));

log("\tScaling to " + (x_fl*100) + "% x " + (y_fl*100)+ "%");
log("\tScaling to " + (x_fl * 100) + "% x " + (y_fl * 100) + "%");

return JAI.create("scale", pb);
}


+ 2
- 4
src/main/org/apache/tools/ant/types/resolver/ApacheCatalogResolver.java View File

@@ -145,11 +145,9 @@ public class ApacheCatalogResolver extends CatalogResolver {

try {
catalog.parseCatalog(file);
}
catch (MalformedURLException ex) {
} catch (MalformedURLException ex) {
throw new BuildException(ex);
}
catch (IOException ex) {
} catch (IOException ex) {
throw new BuildException(ex);
}
}


+ 1
- 1
src/main/org/apache/tools/ant/types/selectors/MappingSelector.java View File

@@ -78,7 +78,7 @@ public abstract class MappingSelector extends BaseSelector {
*
*/
public MappingSelector() {
granularity=(int) FileUtils.newFileUtils().getFileTimestampGranularity();
granularity = (int) FileUtils.newFileUtils().getFileTimestampGranularity();
}




+ 2
- 2
src/main/org/apache/tools/ant/util/FileUtils.java View File

@@ -114,7 +114,7 @@ public class FileUtils {
/**
* the granularity of timestamps under FAT
*/
public static final long FAT_FILE_TIMESTAMP_GRANULARITY=2000;
public static final long FAT_FILE_TIMESTAMP_GRANULARITY = 2000;


// stolen from FilePathToURI of the Xerces-J team
@@ -1334,7 +1334,7 @@ public class FileUtils {
}

public long getFileTimestampGranularity() {
if(Os.isFamily("dos")) {
if (Os.isFamily("dos")) {
return FAT_FILE_TIMESTAMP_GRANULARITY;
} else {
return 0;


+ 2
- 2
src/main/org/apache/tools/ant/util/JAXPUtils.java View File

@@ -106,7 +106,7 @@ public class JAXPUtils {
*
* @since Ant 1.5
*/
public synchronized static SAXParserFactory getParserFactory()
public static synchronized SAXParserFactory getParserFactory()
throws BuildException {

if (parserFactory == null) {
@@ -123,7 +123,7 @@ public class JAXPUtils {
*
* @since Ant 1.6
*/
public synchronized static SAXParserFactory getNSParserFactory()
public static synchronized SAXParserFactory getNSParserFactory()
throws BuildException {

if (nsParserFactory == null) {


+ 8
- 8
src/main/org/apache/tools/bzip2/CBZip2OutputStream.java View File

@@ -204,10 +204,10 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants {

weight[nNodes] = ((weight[n1] & 0xffffff00)
+ (weight[n2] & 0xffffff00))
| (1 + (((weight[n1] & 0x000000ff) >
(weight[n2] & 0x000000ff)) ?
(weight[n1] & 0x000000ff) :
(weight[n2] & 0x000000ff)));
| (1 + (((weight[n1] & 0x000000ff)
> (weight[n2] & 0x000000ff))
? (weight[n1] & 0x000000ff)
: (weight[n2] & 0x000000ff)));

parent[nNodes] = -1;
nHeap++;
@@ -1246,8 +1246,8 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants {
vv = runningOrder[i];
j = i;
while ((ftab[((runningOrder[j - h]) + 1) << 8]
- ftab[(runningOrder[j - h]) << 8]) >
(ftab[((vv) + 1) << 8] - ftab[(vv) << 8])) {
- ftab[(runningOrder[j - h]) << 8])
> (ftab[((vv) + 1) << 8] - ftab[(vv) << 8])) {
runningOrder[j] = runningOrder[j - h];
j = j - h;
if (j <= (h - 1)) {
@@ -1535,9 +1535,9 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants {
because the number of elems to sort is
usually small, typically <= 20.
*/
private int[] incs = { 1, 4, 13, 40, 121, 364, 1093, 3280,
private int[] incs = {1, 4, 13, 40, 121, 364, 1093, 3280,
9841, 29524, 88573, 265720,
797161, 2391484 };
797161, 2391484};

private void allocateCompressStructures () {
int n = baseBlockSize * blockSize100k;


Loading…
Cancel
Save