This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-vfs.git

commit bb4cbe60c0b4d6340f6ea38d7fc366d8c187dabc
Author: Gary Gregory <[email protected]>
AuthorDate: Sat Mar 13 22:48:28 2021 -0500

    Fix failure on Linux and Macos in HttpProviderTestCase:
    org.apache.commons.vfs2.FileSystemException: GET method failed for
    "http://localhost:37637/read-tests/file1.txt"; range "10" with HTTP
    status 200.
    
    Works fine on Windows. The test server or test likely needs work.
    The HC 4 version of this test did not have this content type code
    anyway, so we are closer to the HC 4 implementation.
---
 .../apache/commons/vfs2/util/NHttpFileServer.java  | 25 ++++++++++++----------
 1 file changed, 14 insertions(+), 11 deletions(-)

diff --git 
a/commons-vfs2/src/test/java/org/apache/commons/vfs2/util/NHttpFileServer.java 
b/commons-vfs2/src/test/java/org/apache/commons/vfs2/util/NHttpFileServer.java
index a9c3863..984d2af 100644
--- 
a/commons-vfs2/src/test/java/org/apache/commons/vfs2/util/NHttpFileServer.java
+++ 
b/commons-vfs2/src/test/java/org/apache/commons/vfs2/util/NHttpFileServer.java
@@ -127,18 +127,21 @@ public class NHttpFileServer {
 
             } else {
 
-                final ContentType contentType;
+                ContentType contentType;
                 final String filename = 
file.getName().toLowerCase(Locale.ROOT);
-                if (filename.endsWith(".txt")) {
-                    contentType = ContentType.TEXT_PLAIN;
-                } else if (filename.endsWith(".html") || 
filename.endsWith(".htm")) {
-                    contentType = ContentType.TEXT_HTML;
-                } else if (filename.endsWith(".xml")) {
-                    contentType = ContentType.TEXT_XML;
-                } else {
-                    contentType = ContentType.DEFAULT_BINARY;
-                }
-
+// The following causes a failure on Linux and Macos in HttpProviderTestCase:
+// org.apache.commons.vfs2.FileSystemException: GET method failed for 
"http://localhost:37637/read-tests/file1.txt"; range "10" with HTTP status 200.
+//                at 
org.apache.commons.vfs2.provider.http.HttpRandomAccessContent.getDataInputStream(HttpRandomAccessContent.java:80)
                
+//                if (filename.endsWith(".txt")) {
+//                    contentType = ContentType.TEXT_PLAIN;
+//                } else if (filename.endsWith(".html") || 
filename.endsWith(".htm") || file.isDirectory()) {
+//                    contentType = ContentType.TEXT_HTML;
+//                } else if (filename.endsWith(".xml")) {
+//                    contentType = ContentType.TEXT_XML;
+//                } else {
+//                    contentType = ContentType.DEFAULT_BINARY;
+//                }
+                contentType = ContentType.TEXT_HTML;
                 final HttpCoreContext coreContext = 
HttpCoreContext.adapt(context);
                 final EndpointDetails endpoint = 
coreContext.getEndpointDetails();
 

Reply via email to