git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@274781 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -63,8 +63,8 @@ import java.util.Hashtable; | |||||
| import java.util.List; | import java.util.List; | ||||
| import java.util.Locale; | import java.util.Locale; | ||||
| import java.util.Map; | import java.util.Map; | ||||
| import java.util.NoSuchElementException; | |||||
| import org.apache.tools.ant.util.CollectionUtils; | |||||
| import org.xml.sax.AttributeList; | import org.xml.sax.AttributeList; | ||||
| import org.xml.sax.helpers.AttributeListImpl; | import org.xml.sax.helpers.AttributeListImpl; | ||||
| @@ -236,17 +236,7 @@ public class RuntimeConfigurable implements Serializable { | |||||
| if (children != null) { | if (children != null) { | ||||
| return Collections.enumeration(children); | return Collections.enumeration(children); | ||||
| } else { | } else { | ||||
| return new EmptyEnumeration(); | |||||
| } | |||||
| } | |||||
| static final class EmptyEnumeration implements Enumeration { | |||||
| public EmptyEnumeration() {} | |||||
| public boolean hasMoreElements() { | |||||
| return false; | |||||
| } | |||||
| public Object nextElement() throws NoSuchElementException { | |||||
| throw new NoSuchElementException(); | |||||
| return new CollectionUtils.EmptyEnumeration(); | |||||
| } | } | ||||
| } | } | ||||
| @@ -61,6 +61,8 @@ import java.util.Iterator; | |||||
| import java.util.List; | import java.util.List; | ||||
| import java.util.StringTokenizer; | import java.util.StringTokenizer; | ||||
| import org.apache.tools.ant.util.CollectionUtils; | |||||
| /** | /** | ||||
| * Class to implement a target object with required parameters. | * Class to implement a target object with required parameters. | ||||
| * | * | ||||
| @@ -222,7 +224,7 @@ public class Target implements TaskContainer { | |||||
| if (dependencies != null) { | if (dependencies != null) { | ||||
| return Collections.enumeration(dependencies); | return Collections.enumeration(dependencies); | ||||
| } else { | } else { | ||||
| return new RuntimeConfigurable.EmptyEnumeration(); | |||||
| return new CollectionUtils.EmptyEnumeration(); | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,7 +1,7 @@ | |||||
| /* | /* | ||||
| * The Apache Software License, Version 1.1 | * 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. | * reserved. | ||||
| * | * | ||||
| * Redistribution and use in source and binary forms, with or without | * Redistribution and use in source and binary forms, with or without | ||||
| @@ -55,6 +55,7 @@ package org.apache.tools.ant.util; | |||||
| import java.util.Dictionary; | import java.util.Dictionary; | ||||
| import java.util.Enumeration; | import java.util.Enumeration; | ||||
| import java.util.NoSuchElementException; | |||||
| import java.util.Vector; | import java.util.Vector; | ||||
| /** | /** | ||||
| @@ -146,4 +147,18 @@ public class CollectionUtils { | |||||
| m1.put(key, m2.get(key)); | m1.put(key, m2.get(key)); | ||||
| } | } | ||||
| } | } | ||||
| /** | |||||
| * @since Ant 1.6 | |||||
| */ | |||||
| public static final class EmptyEnumeration implements Enumeration { | |||||
| public EmptyEnumeration() {} | |||||
| public boolean hasMoreElements() { | |||||
| return false; | |||||
| } | |||||
| public Object nextElement() throws NoSuchElementException { | |||||
| throw new NoSuchElementException(); | |||||
| } | |||||
| } | |||||
| } | } | ||||