Code with Misuse: |
class RepositoryConfigurationParser { /** * Parses cluster configuration. Cluster configuration uses the following format: * <pre> * <Cluster> * <Journal ...> * </Journal> * </pre> * <p/> * <code>Cluster</code> is a {@link #parseBeanConfig(Element,String) bean configuration} * element. * <p/> * Clustering is an optional feature. If the cluster element is not found, then this * method returns <code>null</code>. * * @param parent parent of the <code>Journal</code> element * @return journal configuration, or <code>null</code> * @throws ConfigurationException if the configuration is broken */ protected ClusterConfig parseClusterConfig(Element parent) throws ConfigurationException {
NodeList children = parent.getChildNodes(); for (int i = 0; i < children.getLength(); i++) { Node child = children.item(i); if (child.getNodeType() == Node.ELEMENT_NODE && CLUSTER_ELEMENT.equals(child.getNodeName())) { Element element = (Element) child;
String id = getAttribute(element, ID_ATTRIBUTE, null); long syncDelay = Long.parseLong( getAttribute(element, SYNC_DELAY_ATTRIBUTE, DEFAULT_SYNC_DELAY));
JournalConfig jc = parseJournalConfig(element); return new ClusterConfig(id, syncDelay, jc); } } return null; }
}
|
Code with Pattern(s): |
class ReplaceVariablesInLongAttribute extends RepositoryConfigurationParser {
ReplaceVariablesInLongAttribute() {
super(null);
}
void pattern(Element element) throws ConfigurationException {
String value = getAttribute(element, SYNC_DELAY_ATTRIBUTE, DEFAULT_SYNC_DELAY);
Long.parseLong(replaceVariables(value));
}
}
|