Bug 499717 - Update to Ant 1.10.1

Change-Id: I3d51947e9be335d6edc01f6e689537c96c4c5780
diff --git a/ant/org.eclipse.ant.core/src/org/eclipse/ant/core/AntCorePreferences.java b/ant/org.eclipse.ant.core/src/org/eclipse/ant/core/AntCorePreferences.java
index 8714549..53453cb 100644
--- a/ant/org.eclipse.ant.core/src/org/eclipse/ant/core/AntCorePreferences.java
+++ b/ant/org.eclipse.ant.core/src/org/eclipse/ant/core/AntCorePreferences.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2013 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 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
@@ -272,7 +272,7 @@
 
 	private void restoreAntHomeEntries() {
 		String entries = Platform.getPreferencesService().getString(AntCorePlugin.PI_ANTCORE, "ant_urls", //$NON-NLS-1$
-		null, null); // old constant
+				null, null); // old constant
 		if (entries == null || IAntCoreConstants.EMPTY_STRING.equals(entries)) {
 			entries = Platform.getPreferencesService().getString(AntCorePlugin.PI_ANTCORE, IAntCoreConstants.PREFERENCE_ANT_HOME_ENTRIES, null, null);
 		} else {
@@ -299,7 +299,7 @@
 
 	private void restoreAdditionalEntries() {
 		String entries = Platform.getPreferencesService().getString(AntCorePlugin.PI_ANTCORE, "urls", //$NON-NLS-1$
-		null, null); // old constant
+				null, null); // old constant
 		if (entries == null || IAntCoreConstants.EMPTY_STRING.equals(entries)) {
 			entries = Platform.getPreferencesService().getString(AntCorePlugin.PI_ANTCORE, IAntCoreConstants.PREFERENCE_ADDITIONAL_ENTRIES, null, null);
 		} else {
@@ -372,7 +372,7 @@
 	public String getDefaultAntHome() {
 		IAntClasspathEntry[] entries = getDefaultAntHomeEntries();
 		if (entries.length > 0) {
-			URL antjar = entries[0].getEntryURL();
+			URL antjar = entries[1].getEntryURL(); // first entry is .
 			IPath antHomePath = new Path(antjar.getFile());
 			// parent directory of the lib directory
 			antHomePath = antHomePath.removeLastSegments(2);
@@ -723,7 +723,8 @@
 
 		String library = element.getAttribute(AntCorePlugin.LIBRARY);
 		if (library == null) {
-			IStatus status = new Status(IStatus.ERROR, AntCorePlugin.PI_ANTCORE, AntCorePlugin.ERROR_LIBRARY_NOT_SPECIFIED, NLS.bind(InternalCoreAntMessages.AntCorePreferences_Library_not_specified_for___0__4, new String[] { objectName }), null);
+			IStatus status = new Status(IStatus.ERROR, AntCorePlugin.PI_ANTCORE, AntCorePlugin.ERROR_LIBRARY_NOT_SPECIFIED, NLS.bind(InternalCoreAntMessages.AntCorePreferences_Library_not_specified_for___0__4, new String[] {
+					objectName }), null);
 			AntCorePlugin.getPlugin().getLog().log(status);
 			return false;
 		}
@@ -1182,7 +1183,8 @@
 					prereqs.add(new Relation(currentFrag, hostWires.get(0).getProvider()));
 				}
 			} else {
-				AntCorePlugin.getPlugin().getLog().log(new Status(IStatus.ERROR, AntCorePlugin.PI_ANTCORE, AntCorePlugin.ERROR_MALFORMED_URL, NLS.bind(InternalCoreAntMessages.AntCorePreferences_1, new String[] { currentFrag.getSymbolicName() }), null));
+				AntCorePlugin.getPlugin().getLog().log(new Status(IStatus.ERROR, AntCorePlugin.PI_ANTCORE, AntCorePlugin.ERROR_MALFORMED_URL, NLS.bind(InternalCoreAntMessages.AntCorePreferences_1, new String[] {
+						currentFrag.getSymbolicName() }), null));
 			}
 		}
 
@@ -1687,8 +1689,8 @@
 		for (int i = 0; i < customTasks.length; i++) {
 			tasks.append(customTasks[i].getTaskName());
 			tasks.append(',');
-			prefs.setValue(IAntCoreConstants.PREFIX_TASK + customTasks[i].getTaskName(), customTasks[i].getClassName()
-					+ "," + customTasks[i].getLibraryEntry().getLabel()); //$NON-NLS-1$
+			prefs.setValue(IAntCoreConstants.PREFIX_TASK + customTasks[i].getTaskName(), customTasks[i].getClassName() + "," //$NON-NLS-1$
+					+ customTasks[i].getLibraryEntry().getLabel());
 		}
 		prefs.setValue(IAntCoreConstants.PREFERENCE_TASKS, tasks.toString());
 	}
@@ -1710,8 +1712,8 @@
 		for (int i = 0; i < customTypes.length; i++) {
 			types.append(customTypes[i].getTypeName());
 			types.append(',');
-			prefs.setValue(IAntCoreConstants.PREFIX_TYPE + customTypes[i].getTypeName(), customTypes[i].getClassName()
-					+ "," + customTypes[i].getLibraryEntry().getLabel()); //$NON-NLS-1$
+			prefs.setValue(IAntCoreConstants.PREFIX_TYPE + customTypes[i].getTypeName(), customTypes[i].getClassName() + "," //$NON-NLS-1$
+					+ customTypes[i].getLibraryEntry().getLabel());
 		}
 		prefs.setValue(IAntCoreConstants.PREFERENCE_TYPES, types.toString());
 	}
@@ -1739,7 +1741,7 @@
 	}
 
 	protected void updateAdditionalEntries(Preferences prefs) {
-		prefs.setValue("urls", IAntCoreConstants.EMPTY_STRING); //old constant removed  //$NON-NLS-1$
+		prefs.setValue("urls", IAntCoreConstants.EMPTY_STRING); // old constant removed //$NON-NLS-1$
 		String serialized = IAntCoreConstants.EMPTY_STRING;
 		IAntClasspathEntry toolsJarEntry = getToolsJarEntry();
 		List<IAntClasspathEntry> userLibs = getUserLibraries();
@@ -1778,7 +1780,7 @@
 	}
 
 	protected void updateAntHomeEntries(Preferences prefs) {
-		prefs.setValue("ant_urls", IAntCoreConstants.EMPTY_STRING); //old constant removed  //$NON-NLS-1$
+		prefs.setValue("ant_urls", IAntCoreConstants.EMPTY_STRING); // old constant removed //$NON-NLS-1$
 
 		// see if the custom entries are just the default entries
 		IAntClasspathEntry[] defaultEntries = getDefaultAntHomeEntries();
diff --git a/ant/org.eclipse.ant.tests.ui/Ant Tests/org/eclipse/ant/tests/ui/separateVM/SeparateVMTests.java b/ant/org.eclipse.ant.tests.ui/Ant Tests/org/eclipse/ant/tests/ui/separateVM/SeparateVMTests.java
index 27c25e3..224fdde 100644
--- a/ant/org.eclipse.ant.tests.ui/Ant Tests/org/eclipse/ant/tests/ui/separateVM/SeparateVMTests.java
+++ b/ant/org.eclipse.ant.tests.ui/Ant Tests/org/eclipse/ant/tests/ui/separateVM/SeparateVMTests.java
@@ -247,7 +247,7 @@
 	public void testAntHome() throws CoreException {
 		launch("environmentVar"); //$NON-NLS-1$
 		assertLines(6);
-		String message = ConsoleLineTracker.getMessage(2);
+		String message = ConsoleLineTracker.getMessage(1);
 		assertTrue("Incorrect message. Should end with org.apache.ant [" + message + "]", checkAntHomeMessage(message)); //$NON-NLS-1$ //$NON-NLS-2$
 		message = ConsoleLineTracker.getMessage(2);
 		assertTrue("Incorrect message. Should end with org.apache.ant. Message: " + message, checkAntHomeMessage(message)); //$NON-NLS-1$