antonio 2004/04/17 04:32:24
Modified: src/blocks/scratchpad/java/org/apache/cocoon/ant
AntBuildGenerator.java CocoonTask.java
Log:
Using commons.lang
Revision Changes Path
1.3 +15 -16
cocoon-2.1/src/blocks/scratchpad/java/org/apache/cocoon/ant/AntBuildGenerator.java
Index: AntBuildGenerator.java
===================================================================
RCS file:
/home/cvs//cocoon-2.1/src/blocks/scratchpad/java/org/apache/cocoon/ant/AntBuildGenerator.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- AntBuildGenerator.java 5 Mar 2004 10:07:25 -0000 1.2
+++ AntBuildGenerator.java 17 Apr 2004 11:32:24 -0000 1.3
@@ -15,7 +15,6 @@
*/
package org.apache.cocoon.ant;
-
import java.io.File;
import java.io.IOException;
import java.util.Map;
@@ -37,6 +36,7 @@
import org.apache.cocoon.environment.http.HttpContext;
import org.apache.cocoon.generation.Generator;
import org.apache.cocoon.xml.XMLConsumer;
+import org.apache.commons.lang.StringUtils;
import org.apache.tools.ant.BuildEvent;
import org.apache.tools.ant.BuildListener;
import org.apache.tools.ant.Project;
@@ -77,15 +77,14 @@
private static final String VERBOSE = "verbose";
private static final String DEBUG = "debug";
private static final String CDATA = "CDATA";
- private static final String EMPTY_STRING = "";
/** Attributes stuff for output */
private static final AttributesImpl EMPTY_ATTRS = new AttributesImpl();
private static final AttributesImpl MSSG_ATTRS = new AttributesImpl();
private static final AttributesImpl NAME_ATTRS = new AttributesImpl();
static {
- MSSG_ATTRS.addAttribute(EMPTY_STRING, PRIORITY, PRIORITY, CDATA,
null);
- NAME_ATTRS.addAttribute(EMPTY_STRING, NAME, NAME, CDATA, null);
+ MSSG_ATTRS.addAttribute(StringUtils.EMPTY, PRIORITY, PRIORITY,
CDATA, null);
+ NAME_ATTRS.addAttribute(StringUtils.EMPTY, NAME, NAME, CDATA, null);
}
/** the build file */
@@ -182,7 +181,7 @@
}
String target =
ObjectModelHelper.getRequest(aMap).getParameter(TARGET);
if (target == null) {
- target = EMPTY_STRING;
+ target = StringUtils.EMPTY;
}
myThreadTarget.set(target);
myThreadPriorityLevel.set(new Integer(priorityLevel));
@@ -209,7 +208,7 @@
theProject.init();
ProjectHelper helper = ProjectHelper.getProjectHelper();
helper.parse(theProject, myBuildFile);
- if (target.equals(EMPTY_STRING)) {
+ if (target.equals(StringUtils.EMPTY)) {
target = theProject.getDefaultTarget();
}
if (getLogger().isDebugEnabled()) {
@@ -221,7 +220,7 @@
getLogger().error(e.getMessage(), e);
while (!myStack.isEmpty()) {
String tag = (String) myStack.pop();
- myConsumer.endElement(EMPTY_STRING, tag, tag);
+ myConsumer.endElement(StringUtils.EMPTY, tag, tag);
}
} finally {
myConsumer.endDocument();
@@ -234,7 +233,7 @@
*/
public void buildStarted(BuildEvent anEvent) {
try {
- myConsumer.startElement(EMPTY_STRING, BUILD, BUILD, EMPTY_ATTRS);
+ myConsumer.startElement(StringUtils.EMPTY, BUILD, BUILD,
EMPTY_ATTRS);
} catch (SAXException e) {
getLogger().error(e.getMessage(), e);
if (mySAXException == null) {
@@ -251,7 +250,7 @@
*/
public void buildFinished(BuildEvent anEvent) {
try {
- myConsumer.endElement(EMPTY_STRING, BUILD, BUILD);
+ myConsumer.endElement(StringUtils.EMPTY, BUILD, BUILD);
} catch (SAXException e) {
getLogger().error(e.getMessage(), e);
if (mySAXException == null) {
@@ -271,7 +270,7 @@
}
try {
NAME_ATTRS.setValue(0, anEvent.getTarget().getName());
- myConsumer.startElement(EMPTY_STRING, TARGET, TARGET,
NAME_ATTRS);
+ myConsumer.startElement(StringUtils.EMPTY, TARGET, TARGET,
NAME_ATTRS);
} catch (SAXException e) {
getLogger().error(e.getMessage(), e);
if (mySAXException == null) {
@@ -289,7 +288,7 @@
return;
}
try {
- myConsumer.endElement(EMPTY_STRING, TARGET, TARGET);
+ myConsumer.endElement(StringUtils.EMPTY, TARGET, TARGET);
} catch (SAXException e) {
getLogger().error(e.getMessage(), e);
if (mySAXException == null) {
@@ -309,7 +308,7 @@
}
try {
NAME_ATTRS.setValue(0, anEvent.getTask().getTaskName());
- myConsumer.startElement(EMPTY_STRING, TASK, TASK, NAME_ATTRS);
+ myConsumer.startElement(StringUtils.EMPTY, TASK, TASK,
NAME_ATTRS);
} catch (SAXException e) {
getLogger().error(e.getMessage(), e);
if (mySAXException == null) {
@@ -327,7 +326,7 @@
return;
}
try {
- myConsumer.endElement(EMPTY_STRING, TASK, TASK);
+ myConsumer.endElement(StringUtils.EMPTY, TASK, TASK);
} catch (SAXException e) {
getLogger().error(e.getMessage(), e);
if (mySAXException == null) {
@@ -362,11 +361,11 @@
MSSG_ATTRS.setValue(0, value);
String message = anEvent.getMessage();
try {
- myConsumer.startElement(EMPTY_STRING, MESSAGE, MESSAGE,
MSSG_ATTRS);
+ myConsumer.startElement(StringUtils.EMPTY, MESSAGE, MESSAGE,
MSSG_ATTRS);
myConsumer.startCDATA();
myConsumer.characters(message.toCharArray(), 0,
message.length());
myConsumer.endCDATA();
- myConsumer.endElement(EMPTY_STRING, MESSAGE, MESSAGE);
+ myConsumer.endElement(StringUtils.EMPTY, MESSAGE, MESSAGE);
} catch (SAXException e) {
getLogger().error(e.getMessage(), e);
if (mySAXException == null) {
1.8 +4 -5
cocoon-2.1/src/blocks/scratchpad/java/org/apache/cocoon/ant/CocoonTask.java
Index: CocoonTask.java
===================================================================
RCS file:
/home/cvs//cocoon-2.1/src/blocks/scratchpad/java/org/apache/cocoon/ant/CocoonTask.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- CocoonTask.java 5 Mar 2004 10:07:25 -0000 1.7
+++ CocoonTask.java 17 Apr 2004 11:32:24 -0000 1.8
@@ -45,6 +45,7 @@
import org.apache.cocoon.Constants;
import org.apache.cocoon.environment.commandline.CommandLineContext;
import org.apache.cocoon.util.IOUtils;
+import org.apache.commons.lang.SystemUtils;
import org.apache.log.Hierarchy;
import org.apache.log.Priority;
@@ -105,7 +106,6 @@
private String acceptHeader;
private String agentHeader;
- //private Boolean preCompileOnly;
private Boolean followLinks;
/**
@@ -123,7 +123,7 @@
this.logkitXconf = null;
this.destDir = null;
- File workDirParent = new File(System.getProperty("java.io.tmpdir",
"."));
+ File workDirParent = new File(SystemUtils.JAVA_IO_TMPDIR != null ?
SystemUtils.JAVA_IO_TMPDIR : ".");
this.workDir = new File(workDirParent, "work");
this.contextDir = null;
@@ -131,7 +131,6 @@
this.logger = "cocoon";
this.acceptHeader = DEFAULT_ACCEPT;
this.agentHeader = DEFAULT_USER_AGENT;
- //this.preCompileOnly = Boolean.FALSE;
this.followLinks = Boolean.TRUE;
this.targets = new ArrayList();
}
@@ -723,7 +722,7 @@
}
buildClassPath.append(File.pathSeparatorChar)
- .append(System.getProperty("java.class.path"));
+ .append(SystemUtils.JAVA_CLASS_PATH);
if (getLogger().isDebugEnabled()) {
getLogger().debug("Context classpath: " +
buildClassPath.toString());