Remove JDK 1.6 dependencies

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@13670 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Dave Ward
2009-03-18 14:53:37 +00:00
parent deef5d8e59
commit 44805a5075
3 changed files with 16 additions and 6 deletions

View File

@@ -27,6 +27,7 @@ package org.alfresco.repo.management;
import java.io.IOException; import java.io.IOException;
import java.io.PrintWriter; import java.io.PrintWriter;
import java.lang.reflect.Array; import java.lang.reflect.Array;
import java.util.Comparator;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.TreeMap; import java.util.TreeMap;
@@ -75,8 +76,16 @@ public class JmxDumpUtil
// Get all the object names // Get all the object names
Set<ObjectName> objectNames = connection.queryNames(null, null); Set<ObjectName> objectNames = connection.queryNames(null, null);
// Sort the names // Sort the names (don't assume ObjectName implements Comparable in JDK 1.5)
objectNames = new TreeSet<ObjectName>(objectNames); Set<ObjectName> newObjectNames = new TreeSet<ObjectName>(new Comparator<ObjectName>()
{
public int compare(ObjectName o1, ObjectName o2)
{
return o1.toString().compareTo(o2.toString());
}
});
newObjectNames.addAll(objectNames);
objectNames = newObjectNames;
// Dump each MBean // Dump each MBean
for (ObjectName objectName : objectNames) for (ObjectName objectName : objectNames)
@@ -148,10 +157,11 @@ public class JmxDumpUtil
* @throws IOException * @throws IOException
* Signals that an I/O exception has occurred. * Signals that an I/O exception has occurred.
*/ */
@SuppressWarnings("unchecked")
private static void printCompositeInfo(CompositeData composite, PrintWriter out, int nestLevel) throws IOException private static void printCompositeInfo(CompositeData composite, PrintWriter out, int nestLevel) throws IOException
{ {
Map<String, Object> attributes = new TreeMap<String, Object>(); Map<String, Object> attributes = new TreeMap<String, Object>();
for (String key : composite.getCompositeType().keySet()) for (String key : (Set<String>)composite.getCompositeType().keySet())
{ {
Object value; Object value;
try try

View File

@@ -530,7 +530,7 @@ public abstract class AbstractAuthenticationComponent implements AuthenticationC
public void setDefaultAdministratorUserNames(String defaultAdministratorUserNames) public void setDefaultAdministratorUserNames(String defaultAdministratorUserNames)
{ {
Set<String> nameSet = new TreeSet<String>(); Set<String> nameSet = new TreeSet<String>();
if (!defaultAdministratorUserNames.isEmpty()) if (defaultAdministratorUserNames.length() > 0)
{ {
nameSet.addAll(Arrays.asList(defaultAdministratorUserNames.split(","))); nameSet.addAll(Arrays.asList(defaultAdministratorUserNames.split(",")));
} }

View File

@@ -279,7 +279,7 @@ public class NTLMAuthenticationComponentImpl extends AbstractAuthenticationCompo
*/ */
@Managed(category="Security") @Managed(category="Security")
public void setDomain(String domain) { public void setDomain(String domain) {
if (!domain.isEmpty()) if (domain.length() > 0)
{ {
// Check if the passthru server list is already configured // Check if the passthru server list is already configured
@@ -306,7 +306,7 @@ public class NTLMAuthenticationComponentImpl extends AbstractAuthenticationCompo
*/ */
@Managed(category="Security") @Managed(category="Security")
public void setServers(String servers) { public void setServers(String servers) {
if (!servers.isEmpty()) if (servers.length() > 0)
{ {
// Check if the passthru server list is already configured // Check if the passthru server list is already configured