1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
|
Description: Use public API in MimeTable for Java 25 compatibility
MimeTable.findByFileName is no longer public in MimeTable.
MimeTable has no public methods to access MimeEntry.
Use public API to get the content type and compose icon file
name based on the content type.
Author: Vladimir Petko <vladimir.petko@canonical.com>
Origin: upstream, https://github.com/raisercostin/yanfs/pull/13
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1108584
Last-Update: 2026-02-09
diff --git a/src/main/java/com/sun/xhandler/NfsURLConnection.java b/src/main/java/com/sun/xhandler/NfsURLConnection.java
index b6aec88..c90afc6 100644
--- a/src/main/java/com/sun/xhandler/NfsURLConnection.java
+++ b/src/main/java/com/sun/xhandler/NfsURLConnection.java
@@ -231,9 +231,11 @@ public InputStream getInputStream() throws IOException {
String imageFileName = MimeEntry_defaultImagePath + "/file.gif";
// Find the file image to use using the file's .suffix
- entry = mt.findByFileName(dirList[i]);
- if (entry != null) {
- String realImageName = entry.getImageFileName();
+ String mimeType = mt.getContentTypeFor(dirList[i]);
+
+ if (mimeType != null) {
+ String realImageName = MimeEntry_defaultImagePath +
+ "/" + mimeType.replace('/', '-') + ".gif";
if (realImageName != null) {
imageFileName = realImageName;
}
@@ -267,9 +269,9 @@ public InputStream getInputStream() throws IOException {
} else {
// Mark the input stream we return as containing a certain file type
// by looking up the file name in the mimetable
- entry = mt.findByFileName(path);
- if (entry != null) {
- props.add("content-type", entry.getType());
+ String contentType = mt.getContentTypeFor(path);
+ if (contentType != null) {
+ props.add("content-type", contentType);
}
setProperties(props);
|