Bug 94466 - Problems using <input> and Ant 1.5.4
diff --git a/ant/org.eclipse.ant.core/src_ant/org/eclipse/ant/internal/core/ant/FailInputHandler.java b/ant/org.eclipse.ant.core/src_ant/org/eclipse/ant/internal/core/ant/FailInputHandler.java
new file mode 100644
index 0000000..52155b3
--- /dev/null
+++ b/ant/org.eclipse.ant.core/src_ant/org/eclipse/ant/internal/core/ant/FailInputHandler.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.ant.internal.core.ant;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+import org.apache.tools.ant.input.DefaultInputHandler;
+
+public class FailInputHandler extends DefaultInputHandler {
+
+ protected InputStream getInputStream() {
+ //ensure any attempts to read input fail
+ return new InputStream(){
+ public int read() throws IOException {
+ throw new IOException();
+ }
+ };
+ }
+}
diff --git a/ant/org.eclipse.ant.core/src_ant/org/eclipse/ant/internal/core/ant/InternalAntRunner.java b/ant/org.eclipse.ant.core/src_ant/org/eclipse/ant/internal/core/ant/InternalAntRunner.java
index 2a03f8b..81befe0 100644
--- a/ant/org.eclipse.ant.core/src_ant/org/eclipse/ant/internal/core/ant/InternalAntRunner.java
+++ b/ant/org.eclipse.ant.core/src_ant/org/eclipse/ant/internal/core/ant/InternalAntRunner.java
@@ -31,6 +31,7 @@
import java.util.Map;
import java.util.Properties;
import java.util.Vector;
+
import org.apache.tools.ant.AntTypeDefinition;
import org.apache.tools.ant.BuildEvent;
import org.apache.tools.ant.BuildException;
@@ -378,7 +379,7 @@
}
setProperties(antProject, false);
- if (isVersionCompatible("1.6")) { //$NON-NLS-1$
+ if (isVersionCompatible("1.5")) { //$NON-NLS-1$
new InputHandlerSetter().setInputHandler(antProject, "org.eclipse.ant.internal.core.ant.NullInputHandler"); //$NON-NLS-1$
}
parseBuildFile(antProject);
@@ -659,6 +660,10 @@
//set the system property that any input handler
//can check to see if handling input is allowed
System.setProperty("eclipse.ant.noInput", "true"); //$NON-NLS-1$//$NON-NLS-2$
+ if (isVersionCompatible("1.5")) { //$NON-NLS-1$
+ InputHandlerSetter setter= new InputHandlerSetter();
+ setter.setInputHandler(getCurrentProject(), "org.eclipse.ant.internal.core.ant.FailInputHandler"); //$NON-NLS-1$
+ }
}
getCurrentProject().log(MessageFormat.format(InternalAntMessages.InternalAntRunner_Build_file___0__1, new String[]{getBuildFileLocation()})); //$NON-NLS-1$
diff --git a/ant/org.eclipse.ant.ui/Remote Ant Support/org/eclipse/ant/internal/ui/antsupport/InternalAntRunner.java b/ant/org.eclipse.ant.ui/Remote Ant Support/org/eclipse/ant/internal/ui/antsupport/InternalAntRunner.java
index 80cd4fc..535fb8d 100644
--- a/ant/org.eclipse.ant.ui/Remote Ant Support/org/eclipse/ant/internal/ui/antsupport/InternalAntRunner.java
+++ b/ant/org.eclipse.ant.ui/Remote Ant Support/org/eclipse/ant/internal/ui/antsupport/InternalAntRunner.java
@@ -380,6 +380,10 @@
//set the system property that any input handler
//can check to see if handling input is allowed
System.setProperty("eclipse.ant.noInput", "true"); //$NON-NLS-1$//$NON-NLS-2$
+ if (isVersionCompatible("1.5")) { //$NON-NLS-1$
+ InputHandlerSetter setter= new InputHandlerSetter();
+ setter.setInputHandler(getCurrentProject(), "org.eclipse.ant.internal.ui.antsupport.inputhandler.FailInputHandler"); //$NON-NLS-1$
+ }
}
getCurrentProject().log(MessageFormat.format(RemoteAntMessages.getString("InternalAntRunner.Build_file__{0}_1"), new String[]{getBuildFileLocation()})); //$NON-NLS-1$
diff --git a/ant/org.eclipse.ant.ui/Remote Ant Support/org/eclipse/ant/internal/ui/antsupport/inputhandler/FailInputHandler.java b/ant/org.eclipse.ant.ui/Remote Ant Support/org/eclipse/ant/internal/ui/antsupport/inputhandler/FailInputHandler.java
new file mode 100644
index 0000000..474fbdd
--- /dev/null
+++ b/ant/org.eclipse.ant.ui/Remote Ant Support/org/eclipse/ant/internal/ui/antsupport/inputhandler/FailInputHandler.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.ant.internal.ui.antsupport.inputhandler;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+import org.apache.tools.ant.input.DefaultInputHandler;
+
+public class FailInputHandler extends DefaultInputHandler {
+
+ protected InputStream getInputStream() {
+ //ensure any attempts to read input fail
+ return new InputStream(){
+ public int read() throws IOException {
+ throw new IOException();
+ }
+ };
+ }
+}