synchronize with JDK changes
diff --git a/src/share/classes/javax/activation/CommandMap.java b/src/share/classes/javax/activation/CommandMap.java
index 79a2cbc..ab3c846 100644
--- a/src/share/classes/javax/activation/CommandMap.java
+++ b/src/share/classes/javax/activation/CommandMap.java
@@ -1,7 +1,7 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
- * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 1997-2015 Sun Microsystems, Inc. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
@@ -34,10 +34,6 @@
* holder.
*/
-/*
- * @(#)CommandMap.java 1.20 07/05/14
- */
-
package javax.activation;
import java.util.Map;
@@ -57,6 +53,7 @@
private static Map<ClassLoader,CommandMap> map =
new WeakHashMap<ClassLoader,CommandMap>();
+
/**
* Get the default CommandMap.
* <p>
@@ -106,10 +103,11 @@
// otherwise, we also allow it if this code and the
// factory come from the same (non-system) class loader (e.g.,
// the JAF classes were loaded with the applet classes).
- if (CommandMap.class.getClassLoader() == null ||
- CommandMap.class.getClassLoader() !=
- commandMap.getClass().getClassLoader())
+ ClassLoader cl = CommandMap.class.getClassLoader();
+ if (cl == null || cl.getParent() == null ||
+ cl != commandMap.getClass().getClassLoader()) {
throw ex;
+ }
}
}
// remove any per-thread-context-class-loader CommandMap
diff --git a/src/share/classes/javax/activation/DataHandler.java b/src/share/classes/javax/activation/DataHandler.java
index 22b941d..387912d 100644
--- a/src/share/classes/javax/activation/DataHandler.java
+++ b/src/share/classes/javax/activation/DataHandler.java
@@ -1,7 +1,7 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
- * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 1997-2015 Sun Microsystems, Inc. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
@@ -34,10 +34,6 @@
* holder.
*/
-/*
- * @(#)DataHandler.java 1.41 07/05/14
- */
-
package javax.activation;
import java.io.InputStream;
@@ -382,9 +378,9 @@
if (transferFlavors == emptyFlavors)
transferFlavors = getDataContentHandler().getTransferDataFlavors();
if (transferFlavors == emptyFlavors)
- return transferFlavors;
+ return transferFlavors; // no need to clone an empty array
else
- return (DataFlavor[])transferFlavors.clone();
+ return transferFlavors.clone();
}
/**
diff --git a/src/share/classes/javax/activation/FileTypeMap.java b/src/share/classes/javax/activation/FileTypeMap.java
index 9b18a28..fb36c08 100644
--- a/src/share/classes/javax/activation/FileTypeMap.java
+++ b/src/share/classes/javax/activation/FileTypeMap.java
@@ -1,7 +1,7 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
- * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 1997-2015 Sun Microsystems, Inc. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
@@ -34,10 +34,6 @@
* holder.
*/
-/*
- * @(#)FileTypeMap.java 1.9 07/05/14
- */
-
package javax.activation;
import java.io.File;
@@ -95,11 +91,11 @@
* Sets the default FileTypeMap for the system. This instance
* will be returned to callers of getDefaultFileTypeMap.
*
- * @param map The FileTypeMap.
+ * @param fileTypeMap The FileTypeMap.
* @exception SecurityException if the caller doesn't have permission
* to change the default
*/
- public static synchronized void setDefaultFileTypeMap(FileTypeMap map) {
+ public static synchronized void setDefaultFileTypeMap(FileTypeMap fileTypeMap) {
SecurityManager security = System.getSecurityManager();
if (security != null) {
try {
@@ -109,15 +105,15 @@
// otherwise, we also allow it if this code and the
// factory come from the same (non-system) class loader (e.g.,
// the JAF classes were loaded with the applet classes).
- if (FileTypeMap.class.getClassLoader() == null ||
- FileTypeMap.class.getClassLoader() !=
- map.getClass().getClassLoader())
+ ClassLoader cl = FileTypeMap.class.getClassLoader();
+ if (cl == null || cl.getParent() == null ||
+ cl != fileTypeMap.getClass().getClassLoader())
throw ex;
}
}
// remove any per-thread-context-class-loader FileTypeMap
map.remove(SecuritySupport.getContextClassLoader());
- defaultMap = map;
+ defaultMap = fileTypeMap;
}
/**