Commit b1645b79 authored by Matt Tucker's avatar Matt Tucker Committed by matt

Code cleanup and tweaks.

git-svn-id: http://svn.igniterealtime.org/svn/repos/messenger/trunk@3186 b35dd754-fafc-0310-a699-88a17e54d16e
parent 7b583b08
...@@ -170,7 +170,7 @@ public class AuditorImpl implements Auditor { ...@@ -170,7 +170,7 @@ public class AuditorImpl implements Auditor {
} }
} }
writer = new OutputStreamWriter(new FileOutputStream(currentAuditFile), "UTF-8"); writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(currentAuditFile), "UTF-8"));
writer.write("<jive xmlns=\"http://www.jivesoftware.org\">"); writer.write("<jive xmlns=\"http://www.jivesoftware.org\">");
xmlWriter = new org.jivesoftware.util.XMLWriter(writer); xmlWriter = new org.jivesoftware.util.XMLWriter(writer);
} }
......
...@@ -396,7 +396,7 @@ public class JiveGlobals { ...@@ -396,7 +396,7 @@ public class JiveGlobals {
* *
* @param propertyMap a map of properties, keyed on property name. * @param propertyMap a map of properties, keyed on property name.
*/ */
public static void setXMLProperties(Map propertyMap) { public static void setXMLProperties(Map<String, String> propertyMap) {
if (xmlProperties == null) { if (xmlProperties == null) {
loadSetupProperties(); loadSetupProperties();
} }
......
...@@ -117,7 +117,7 @@ public class XMLProperties { ...@@ -117,7 +117,7 @@ public class XMLProperties {
* @return the value of the specified property. * @return the value of the specified property.
*/ */
public synchronized String getProperty(String name) { public synchronized String getProperty(String name) {
String value = (String)propertyCache.get(name); String value = propertyCache.get(name);
if (value != null) { if (value != null) {
return value; return value;
} }
...@@ -182,7 +182,7 @@ public class XMLProperties { ...@@ -182,7 +182,7 @@ public class XMLProperties {
} }
// We found matching property, return names of children. // We found matching property, return names of children.
Iterator iter = element.elementIterator(propName[propName.length - 1]); Iterator iter = element.elementIterator(propName[propName.length - 1]);
ArrayList props = new ArrayList(); List<String> props = new ArrayList<String>();
String value; String value;
while (iter.hasNext()) { while (iter.hasNext()) {
// Empty strings are skipped. // Empty strings are skipped.
...@@ -192,7 +192,7 @@ public class XMLProperties { ...@@ -192,7 +192,7 @@ public class XMLProperties {
} }
} }
String[] childrenNames = new String[props.size()]; String[] childrenNames = new String[props.size()];
return (String[])props.toArray(childrenNames); return props.toArray(childrenNames);
} }
/** /**
...@@ -318,9 +318,9 @@ public class XMLProperties { ...@@ -318,9 +318,9 @@ public class XMLProperties {
saveProperties(); saveProperties();
// Generate event. // Generate event.
Map params = new HashMap(); Map<String, Object> params = new HashMap<String, Object>();
params.put("value", values); params.put("value", values);
PropertyEventDispatcher.dispatchEvent((String)name, PropertyEventDispatcher.dispatchEvent(name,
PropertyEventDispatcher.EventType.xml_property_set, params); PropertyEventDispatcher.EventType.xml_property_set, params);
} }
...@@ -387,9 +387,9 @@ public class XMLProperties { ...@@ -387,9 +387,9 @@ public class XMLProperties {
saveProperties(); saveProperties();
// Generate event. // Generate event.
Map params = new HashMap(); Map<String, String> params = new HashMap<String,String>();
params.put("value", value); params.put("value", value);
PropertyEventDispatcher.dispatchEvent((String)name, PropertyEventDispatcher.dispatchEvent(name,
PropertyEventDispatcher.EventType.xml_property_set, params); PropertyEventDispatcher.EventType.xml_property_set, params);
} }
...@@ -418,7 +418,7 @@ public class XMLProperties { ...@@ -418,7 +418,7 @@ public class XMLProperties {
saveProperties(); saveProperties();
// Generate event. // Generate event.
PropertyEventDispatcher.dispatchEvent((String)name, PropertyEventDispatcher.dispatchEvent(name,
PropertyEventDispatcher.EventType.xml_property_deleted, Collections.emptyMap()); PropertyEventDispatcher.EventType.xml_property_deleted, Collections.emptyMap());
} }
...@@ -452,8 +452,9 @@ public class XMLProperties { ...@@ -452,8 +452,9 @@ public class XMLProperties {
Writer writer = null; Writer writer = null;
try { try {
tempFile = new File(file.getParentFile(), file.getName() + ".tmp"); tempFile = new File(file.getParentFile(), file.getName() + ".tmp");
writer = new FileWriter(tempFile); writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(tempFile), "UTF-8"));
OutputFormat prettyPrinter = OutputFormat.createPrettyPrint(); OutputFormat prettyPrinter = OutputFormat.createPrettyPrint();
prettyPrinter.setEncoding("UTF-8");
XMLWriter xmlWriter = new XMLWriter(writer, prettyPrinter); XMLWriter xmlWriter = new XMLWriter(writer, prettyPrinter);
xmlWriter.write(document); xmlWriter.write(document);
} }
...@@ -506,20 +507,18 @@ public class XMLProperties { ...@@ -506,20 +507,18 @@ public class XMLProperties {
* @return an array representation of the given Jive property. * @return an array representation of the given Jive property.
*/ */
private String[] parsePropertyName(String name) { private String[] parsePropertyName(String name) {
List propName = new ArrayList(5); List<String> propName = new ArrayList<String>(5);
// Use a StringTokenizer to tokenize the property name. // Use a StringTokenizer to tokenize the property name.
StringTokenizer tokenizer = new StringTokenizer(name, "."); StringTokenizer tokenizer = new StringTokenizer(name, ".");
while (tokenizer.hasMoreTokens()) { while (tokenizer.hasMoreTokens()) {
propName.add(tokenizer.nextToken()); propName.add(tokenizer.nextToken());
} }
return (String[])propName.toArray(new String[propName.size()]); return propName.toArray(new String[propName.size()]);
} }
public void setProperties(Map propertyMap) { public void setProperties(Map<String, String> propertyMap) {
Iterator iter = propertyMap.keySet().iterator(); for (String propertyName : propertyMap.keySet()) {
while (iter.hasNext()) { String propertyValue = propertyMap.get(propertyName);
String propertyName = (String) iter.next();
String propertyValue = (String) propertyMap.get(propertyName);
setProperty(propertyName, propertyValue); setProperty(propertyName, propertyValue);
} }
} }
......
...@@ -212,7 +212,7 @@ ...@@ -212,7 +212,7 @@
<fmt:message key="audit.policy.log_directory" /> <fmt:message key="audit.policy.log_directory" />
</td> </td>
<td width="99%"> <td width="99%">
<input type="text" size="30" maxlength="150" name="logDir" <input type="text" size="50" maxlength="150" name="logDir"
value="<%= ((logDir != null) ? logDir : "") %>"> value="<%= ((logDir != null) ? logDir : "") %>">
<% if (errors.get("logDir") != null) { %> <% if (errors.get("logDir") != null) { %>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment