@Test public void testArrayToHashtableNull() { JNDIUtil.arrayToHashtable(null, null); String[] entries2 = {}; JNDIUtil.arrayToHashtable(entries2, null); String[] entries3 = { null, null }; JNDIUtil.arrayToHashtable(entries3, null); String[] entries4 = { "", " " }; JNDIUtil.arrayToHashtable(entries4, null); }
public static Hashtable<String, String> arrayToHashtable(String[] entries, ConnectorMessages messages) { Hashtable<String, String> result = new Hashtable<String, String>(); if (entries != null) { for (String entry : entries) { if (StringUtil.isNotBlank(entry)) { int firstEq = entry.indexOf('='); if (firstEq == -1) { throwFormatException(messages, entry, "Invalid value in JNDI entry"); } if (firstEq == 0) { throwFormatException(messages, entry, "First character cannot be ="); } final String key = entry.substring(0, firstEq); final String value = firstEq == entry.length() - 1 ? null : entry.substring(firstEq + 1); result.put(key, value); } } } return result; }
JNDIUtil { public static Hashtable<String, String> arrayToHashtable(String[] entries, ConnectorMessages messages) { Hashtable<String, String> result = new Hashtable<String, String>(); if (entries != null) { for (String entry : entries) { if (StringUtil.isNotBlank(entry)) { int firstEq = entry.indexOf('='); if (firstEq == -1) { throwFormatException(messages, entry, "Invalid value in JNDI entry"); } if (firstEq == 0) { throwFormatException(messages, entry, "First character cannot be ="); } final String key = entry.substring(0, firstEq); final String value = firstEq == entry.length() - 1 ? null : entry.substring(firstEq + 1); result.put(key, value); } } } return result; } }
JNDIUtil { public static Hashtable<String, String> arrayToHashtable(String[] entries, ConnectorMessages messages) { Hashtable<String, String> result = new Hashtable<String, String>(); if (entries != null) { for (String entry : entries) { if (StringUtil.isNotBlank(entry)) { int firstEq = entry.indexOf('='); if (firstEq == -1) { throwFormatException(messages, entry, "Invalid value in JNDI entry"); } if (firstEq == 0) { throwFormatException(messages, entry, "First character cannot be ="); } final String key = entry.substring(0, firstEq); final String value = firstEq == entry.length() - 1 ? null : entry.substring(firstEq + 1); result.put(key, value); } } } return result; } private  JNDIUtil(); }
JNDIUtil { public static Hashtable<String, String> arrayToHashtable(String[] entries, ConnectorMessages messages) { Hashtable<String, String> result = new Hashtable<String, String>(); if (entries != null) { for (String entry : entries) { if (StringUtil.isNotBlank(entry)) { int firstEq = entry.indexOf('='); if (firstEq == -1) { throwFormatException(messages, entry, "Invalid value in JNDI entry"); } if (firstEq == 0) { throwFormatException(messages, entry, "First character cannot be ="); } final String key = entry.substring(0, firstEq); final String value = firstEq == entry.length() - 1 ? null : entry.substring(firstEq + 1); result.put(key, value); } } } return result; } private  JNDIUtil(); static Hashtable<String, String> arrayToHashtable(String[] entries,
            ConnectorMessages messages); }
JNDIUtil { public static Hashtable<String, String> arrayToHashtable(String[] entries, ConnectorMessages messages) { Hashtable<String, String> result = new Hashtable<String, String>(); if (entries != null) { for (String entry : entries) { if (StringUtil.isNotBlank(entry)) { int firstEq = entry.indexOf('='); if (firstEq == -1) { throwFormatException(messages, entry, "Invalid value in JNDI entry"); } if (firstEq == 0) { throwFormatException(messages, entry, "First character cannot be ="); } final String key = entry.substring(0, firstEq); final String value = firstEq == entry.length() - 1 ? null : entry.substring(firstEq + 1); result.put(key, value); } } } return result; } private  JNDIUtil(); static Hashtable<String, String> arrayToHashtable(String[] entries,
            ConnectorMessages messages); static final String INVALID_JNDI_ENTRY; }