1. Igor Baidiuk
  2. ant-events

Commits

Igor Baidiuk  committed 03bb212 Draft

Extracted private method for sorting event list

  • Participants
  • Parent commits e23ae2e
  • Branches default

Comments (0)

Files changed (1)

File src/org/antcontrib/events/FireEvent.java

View file
  • Ignore whitespace
 		this.header = header;
 	}
 	
-	public void execute()
+	private void sortEvents(List events)
 	{
-		if (name == null || name.isEmpty())
-			throw new BuildException("Event list name must be a nonempty string");
-		
 		if (order == null)
 			order = "";
 		
-		List events = EventList.get(getProject(), name).getEvents();
-		
 		if (order.equals("ascending"))
 		{
 			Collections.sort(events, new Comparator()
 			throw new BuildException("Order must be either 'unordered', 'ascending' or 'descending'");
 		}
 		
+	}
+	
+	public void execute()
+	{
+		if (name == null || name.isEmpty())
+			throw new BuildException("Event list name must be a nonempty string");
+		
+		List events = EventList.get(getProject(), name).getEvents();
+		sortEvents(events);
+		
 		for (Iterator i = events.iterator(); i.hasNext(); )
 			((Event)i.next()).performTasks();
 	}