Need to use doPrivileged when checking for the conf directory.
diff --git a/activation/src/main/java/javax/activation/MailcapCommandMap.java b/activation/src/main/java/javax/activation/MailcapCommandMap.java
index 7489f0a..0978617 100644
--- a/activation/src/main/java/javax/activation/MailcapCommandMap.java
+++ b/activation/src/main/java/javax/activation/MailcapCommandMap.java
@@ -43,6 +43,8 @@
import java.util.*;
import java.io.*;
import java.net.*;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
import com.sun.activation.registries.MailcapFile;
import com.sun.activation.registries.LogSupport;
@@ -145,13 +147,18 @@
static {
String dir = null;
try {
- String home = System.getProperty("java.home");
- String newdir = home + File.separator + "conf";
- File conf = new File(newdir);
- if (conf.exists())
- dir = newdir + File.separator;
- else
- dir = home + File.separator + "lib" + File.separator;
+ dir = (String)AccessController.doPrivileged(
+ new PrivilegedAction() {
+ public Object run() {
+ String home = System.getProperty("java.home");
+ String newdir = home + File.separator + "conf";
+ File conf = new File(newdir);
+ if (conf.exists())
+ return newdir + File.separator;
+ else
+ return home + File.separator + "lib" + File.separator;
+ }
+ });
} catch (Exception ex) {
// ignore any exceptions
}
@@ -180,12 +187,14 @@
} catch (SecurityException ex) {}
LogSupport.log("MailcapCommandMap: load SYS");
- if (confDir != null) {
+ try {
// check system's home
- mf = loadFile(confDir + "mailcap");
- if (mf != null)
- dbv.add(mf);
- }
+ if (confDir != null) {
+ mf = loadFile(confDir + "mailcap");
+ if (mf != null)
+ dbv.add(mf);
+ }
+ } catch (SecurityException ex) {}
LogSupport.log("MailcapCommandMap: load JAR");
// load from the app's jar file
diff --git a/activation/src/main/java/javax/activation/MimetypesFileTypeMap.java b/activation/src/main/java/javax/activation/MimetypesFileTypeMap.java
index 04af8ce..894a4bf 100644
--- a/activation/src/main/java/javax/activation/MimetypesFileTypeMap.java
+++ b/activation/src/main/java/javax/activation/MimetypesFileTypeMap.java
@@ -43,6 +43,8 @@
import java.io.*;
import java.net.*;
import java.util.*;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
import com.sun.activation.registries.MimeTypeFile;
import com.sun.activation.registries.LogSupport;
@@ -97,13 +99,18 @@
static {
String dir = null;
try {
- String home = System.getProperty("java.home");
- String newdir = home + File.separator + "conf";
- File conf = new File(newdir);
- if (conf.exists())
- dir = newdir + File.separator;
- else
- dir = home + File.separator + "lib" + File.separator;
+ dir = (String)AccessController.doPrivileged(
+ new PrivilegedAction() {
+ public Object run() {
+ String home = System.getProperty("java.home");
+ String newdir = home + File.separator + "conf";
+ File conf = new File(newdir);
+ if (conf.exists())
+ return newdir + File.separator;
+ else
+ return home + File.separator + "lib" + File.separator;
+ }
+ });
} catch (Exception ex) {
// ignore any exceptions
}
@@ -131,12 +138,14 @@
} catch (SecurityException ex) {}
LogSupport.log("MimetypesFileTypeMap: load SYS");
- if (confDir != null) {
+ try {
// check system's home
- mf = loadFile(confDir + "mime.types");
- if (mf != null)
- dbv.addElement(mf);
- }
+ if (confDir != null) {
+ mf = loadFile(confDir + "mime.types");
+ if (mf != null)
+ dbv.addElement(mf);
+ }
+ } catch (SecurityException ex) {}
LogSupport.log("MimetypesFileTypeMap: load JAR");
// load from the app's jar file