View | Details | Raw Unified | Return to bug 31610
Collapse All | Expand All

(-)src/main/org/apache/tools/ant/taskdefs/SubAnt.java (+25 lines)
Lines 68-73 Link Here
68
    private boolean inheritAll = false;
68
    private boolean inheritAll = false;
69
    private boolean inheritRefs = false;
69
    private boolean inheritRefs = false;
70
    private boolean failOnError = true;
70
    private boolean failOnError = true;
71
    private String errorProperty = null;
71
    private String output  = null;
72
    private String output  = null;
72
73
73
    private Vector properties = new Vector();
74
    private Vector properties = new Vector();
Lines 245-250 Link Here
245
                throws BuildException {
246
                throws BuildException {
246
        if (!file.exists() || file.isDirectory() || !file.canRead()) {
247
        if (!file.exists() || file.isDirectory() || !file.canRead()) {
247
            String msg = "Invalid file: " + file;
248
            String msg = "Invalid file: " + file;
249
            if (errorProperty != null) {
250
                getProject().setNewProperty(errorProperty, "true");
251
            }
248
            if (failOnError) {
252
            if (failOnError) {
249
                throw new BuildException(msg);
253
                throw new BuildException(msg);
250
            }
254
            }
Lines 257-262 Link Here
257
        try {
261
        try {
258
            antfilename = file.getCanonicalPath();
262
            antfilename = file.getCanonicalPath();
259
        } catch (IOException e) {
263
        } catch (IOException e) {
264
            if (errorProperty != null) {
265
                getProject().setNewProperty(errorProperty, "true");
266
            }
260
            throw new BuildException(e);
267
            throw new BuildException(e);
261
        }
268
        }
262
269
Lines 264-269 Link Here
264
        try {
271
        try {
265
            ant.execute();
272
            ant.execute();
266
        } catch (BuildException e) {
273
        } catch (BuildException e) {
274
            if (errorProperty != null) {
275
                getProject().setNewProperty(errorProperty, "true");
276
            }
267
            if (failOnError) {
277
            if (failOnError) {
268
                throw e;
278
                throw e;
269
            }
279
            }
Lines 271-276 Link Here
271
               + "' of: " +  antfilename + "\n"
281
               + "' of: " +  antfilename + "\n"
272
               + e.getMessage(), Project.MSG_WARN);
282
               + e.getMessage(), Project.MSG_WARN);
273
        } catch (Throwable e) {
283
        } catch (Throwable e) {
284
            if (errorProperty != null) {
285
                getProject().setNewProperty(errorProperty, "true");
286
            }
274
            if (failOnError) {
287
            if (failOnError) {
275
                throw new BuildException(e);
288
                throw new BuildException(e);
276
            }
289
            }
Lines 316-321 Link Here
316
     */
329
     */
317
    public void setFailonerror(boolean failOnError) {
330
    public void setFailonerror(boolean failOnError) {
318
        this.failOnError = failOnError;
331
        this.failOnError = failOnError;
332
    }
333
334
    /**
335
     * Property to set to "true" if there is a error in a sub-build.
336
     *
337
     * @param propertyName the name of the property to set in the
338
     * event of an error.
339
     *
340
     * @since Ant 1.7?
341
     */
342
    public void setErrorProperty(String propertyName) {
343
        this.errorProperty = propertyName;
319
    }
344
    }
320
345
321
    /**
346
    /**

Return to bug 31610