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 c63bb9f0395766656a1463d07dcb02f490e84831
Author: Gary Gregory <[email protected]>
AuthorDate: Wed Sep 20 08:22:48 2023 -0400

    Generics and reduce type casting
---
 .../vfs2/provider/webdav4/Webdav4FileContentInfoFactory.java      | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git 
a/commons-vfs2-jackrabbit2/src/main/java/org/apache/commons/vfs2/provider/webdav4/Webdav4FileContentInfoFactory.java
 
b/commons-vfs2-jackrabbit2/src/main/java/org/apache/commons/vfs2/provider/webdav4/Webdav4FileContentInfoFactory.java
index b99bcbd0..d759fd0b 100644
--- 
a/commons-vfs2-jackrabbit2/src/main/java/org/apache/commons/vfs2/provider/webdav4/Webdav4FileContentInfoFactory.java
+++ 
b/commons-vfs2-jackrabbit2/src/main/java/org/apache/commons/vfs2/provider/webdav4/Webdav4FileContentInfoFactory.java
@@ -16,6 +16,8 @@
  */
 package org.apache.commons.vfs2.provider.webdav4;
 
+import java.util.Objects;
+
 import org.apache.commons.vfs2.FileContent;
 import org.apache.commons.vfs2.FileContentInfo;
 import org.apache.commons.vfs2.FileContentInfoFactory;
@@ -45,13 +47,13 @@ public class Webdav4FileContentInfoFactory implements 
FileContentInfoFactory {
         nameSet.add(DavPropertyName.GETCONTENTTYPE);
         final DavPropertySet propertySet = 
file.getProperties((GenericURLFileName) file.getName(), nameSet, true);
 
-        DavProperty property = propertySet.get(DavPropertyName.GETCONTENTTYPE);
+        DavProperty<?> property = 
propertySet.get(DavPropertyName.GETCONTENTTYPE);
         if (property != null) {
-            contentType = (String) property.getValue();
+            contentType = Objects.toString(property.getValue(), null);
         }
         property = propertySet.get(Webdav4FileObject.RESPONSE_CHARSET);
         if (property != null) {
-            contentEncoding = (String) property.getValue();
+            contentEncoding = Objects.toString(property.getValue(), null);
         }
 
         return new DefaultFileContentInfo(contentType, contentEncoding);

Reply via email to