Merge branch 'stable-6.10'

* stable-6.10:
  AmazonS3: Ensure SAXParserFactory sets valid/expected input params
  LockFile: Retry lock creation if parent dirs were removed

Change-Id: I599f698f812e11ae37843cac2333c9971ec30dd8
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/LockFile.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/LockFile.java
index a2d8bd0..1983541 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/LockFile.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/LockFile.java
@@ -24,6 +24,7 @@
 import java.nio.channels.Channels;
 import java.nio.channels.FileChannel;
 import java.nio.file.Files;
+import java.nio.file.NoSuchFileException;
 import java.nio.file.StandardCopyOption;
 import java.nio.file.attribute.FileTime;
 import java.text.MessageFormat;
@@ -141,9 +142,8 @@ public boolean lock() throws IOException {
 			throw new IllegalStateException(
 					MessageFormat.format(JGitText.get().lockAlreadyHeld, ref));
 		}
-		FileUtils.mkdirs(lck.getParentFile(), true);
 		try {
-			token = FS.DETECTED.createNewFileAtomic(lck);
+			token = createLockFileWithRetry();
 		} catch (IOException e) {
 			LOG.error(JGitText.get().failedCreateLockFile, lck, e);
 			throw e;
@@ -160,6 +160,19 @@ public boolean lock() throws IOException {
 		return obtainedLock;
 	}
 
+	private FS.LockToken createLockFileWithRetry() throws IOException {
+		try {
+			return createLockFile();
+		} catch (NoSuchFileException e) {
+			return createLockFile();
+		}
+	}
+
+	private FS.LockToken createLockFile() throws IOException {
+		FileUtils.mkdirs(lck.getParentFile(), true);
+		return FS.DETECTED.createNewFileAtomic(lck);
+	}
+
 	/**
 	 * Try to establish the lock for appending.
 	 *
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/AmazonS3.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/AmazonS3.java
index b873925..aaf9f8a 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/AmazonS3.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/AmazonS3.java
@@ -757,8 +757,10 @@ void list() throws IOException {
 
 					final XMLReader xr;
 					try {
-						xr = SAXParserFactory.newInstance().newSAXParser()
-								.getXMLReader();
+						SAXParserFactory saxParserFactory = SAXParserFactory
+								.newInstance();
+						saxParserFactory.setNamespaceAware(true);
+						xr = saxParserFactory.newSAXParser().getXMLReader();
 					} catch (SAXException | ParserConfigurationException e) {
 						throw new IOException(
 								JGitText.get().noXMLParserAvailable, e);