summaryrefslogtreecommitdiffstats
path: root/src/java/net
diff options
context:
space:
mode:
authormattinger <[email protected]>2006-08-22 19:04:21 +0000
committermattinger <[email protected]>2006-08-22 19:04:21 +0000
commit72638ea44a424eea066d2d7c5232938650dec5fd (patch)
tree225042358e82779ed12bae9730a2caeafea48e54 /src/java/net
parent044594c1987203ed042805b34ea341df5f93a701 (diff)
git-svn-id: file:///home/sven/projects/JOGL/temp/ant-contrib/svn/ant-contrib-code/trunk/ant-contrib@37 32d7a393-a5a9-423c-abd3-5d954feb1f2f
Diffstat (limited to 'src/java/net')
-rw-r--r--src/java/net/sf/antcontrib/net/httpclient/GetCookieTask.java46
1 files changed, 18 insertions, 28 deletions
diff --git a/src/java/net/sf/antcontrib/net/httpclient/GetCookieTask.java b/src/java/net/sf/antcontrib/net/httpclient/GetCookieTask.java
index 2ae509e..9287145 100644
--- a/src/java/net/sf/antcontrib/net/httpclient/GetCookieTask.java
+++ b/src/java/net/sf/antcontrib/net/httpclient/GetCookieTask.java
@@ -20,7 +20,6 @@ import org.apache.commons.httpclient.HttpState;
import org.apache.commons.httpclient.cookie.CookiePolicy;
import org.apache.commons.httpclient.cookie.CookieSpec;
import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.Project;
import org.apache.tools.ant.taskdefs.Property;
public class GetCookieTask
@@ -82,47 +81,38 @@ public class GetCookieTask
CookieSpec spec = CookiePolicy.getCookieSpec(cookiePolicy);
Cookie cookies[] = state.getCookies();
Cookie matches[] = spec.match(realm, port, path, secure, cookies);
+
+ if (name != null) {
+ Cookie c = findCookie(matches, name);
+ if (c != null) {
+ matches = new Cookie[] { c };
+ }
+ else {
+ matches = new Cookie[0];
+ }
+ }
+
if (property != null) {
if (matches != null && matches.length > 0) {
- Cookie toSet = matches[0];
- if (name != null) {
- toSet = findCookie(matches, name);
- }
-
- if (toSet != null) {
- Property p = (Property)getProject().createTask("property");
- p.setName(property);
- p.setValue(matches[0].getValue());
- p.perform();
- }
+ Property p = (Property)getProject().createTask("property");
+ p.setName(property);
+ p.setValue(matches[0].getValue());
+ p.perform();
}
}
else if (prefix != null) {
if (matches != null && matches.length > 0) {
- Cookie toSet[] = matches;
-
- if (name != null) {
- Cookie c = findCookie(matches, name);
- if (c == null) {
- toSet = new Cookie[0];
- }
- else {
- toSet = new Cookie[] { c };
- }
- }
-
- for (int i=0;i<toSet.length;i++) {
+ for (int i=0;i<matches.length;i++) {
String propName =
prefix +
- toSet[i].getName();
+ matches[i].getName();
Property p = (Property)getProject().createTask("property");
p.setName(propName);
- p.setValue(toSet[i].getValue());
+ p.setValue(matches[i].getValue());
p.perform();
}
}
-
}
else {
throw new BuildException("Nothing to set");