===================================================================== Found a 70 line (265 tokens) duplication in the following files: Starting at line 127 of /home/tom/pmd/pmd-web/src/jboss-common/src/main/org/jboss/util/MethodHashing.java Starting at line 55 of /home/tom/pmd/pmd-web/src/jboss-common/src/main/org/jboss/net/sockets/MethodHash.java } } return map; } static String getTypeString(Class cl) { if (cl == Byte.TYPE) { return "B"; } else if (cl == Character.TYPE) { return "C"; } else if (cl == Double.TYPE) { return "D"; } else if (cl == Float.TYPE) { return "F"; } else if (cl == Integer.TYPE) { return "I"; } else if (cl == Long.TYPE) { return "J"; } else if (cl == Short.TYPE) { return "S"; } else if (cl == Boolean.TYPE) { return "Z"; } else if (cl == Void.TYPE) { return "V"; } else if (cl.isArray()) { return "["+getTypeString(cl.getComponentType()); } else { return "L"+cl.getName().replace('.','/')+";"; } } /* * The use of hashCode is not enough to differenciate methods * we override the hashCode * * The hashes are cached in a static for efficiency * RO: WeakHashMap needed to support undeploy */ public static long calculateHash(Method method) { Map methodHashes = (Map)hashMap.get(method.getDeclaringClass()); if (methodHashes == null) { methodHashes = getInterfaceHashes(method.getDeclaringClass()); // Copy and add WeakHashMap newHashMap = new WeakHashMap(); newHashMap.putAll(hashMap); newHashMap.put(method.getDeclaringClass(), methodHashes); hashMap = newHashMap; } return ((Long)methodHashes.get(method.toString())).longValue(); } } ===================================================================== Found a 62 line (258 tokens) duplication in the following files: Starting at line 73 of /home/tom/pmd/pmd-web/src/jboss-common/src/main/org/jboss/logging/util/LoggerStream.java Starting at line 74 of /home/tom/pmd/pmd-web/src/jboss-common/src/main/org/jboss/logging/util/CategoryStream.java } public void println(String msg) { if( msg == null ) msg = "null"; byte[] bytes = msg.getBytes(); write(bytes, 0, bytes.length); } public void println(Object msg) { if( msg == null ) msg = "null"; byte[] bytes = msg.toString().getBytes(); write(bytes, 0, bytes.length); } public void write(byte b) { byte[] bytes = {b}; write(bytes, 0, 1); } private ThreadLocal recursiveCheck = new ThreadLocal(); public void write(byte[] b, int off, int len) { Boolean recursed = (Boolean)recursiveCheck.get(); if (recursed != null && recursed.equals(Boolean.TRUE)) { /* There is a configuration error that is causing looping. Most likely there are two console appenders so just return to prevent spinning. */ if( issuedWarning == false ) { String msg = "ERROR: invalid console appender config detected, console stream is looping"; try { out.write(msg.getBytes()); } catch(IOException ignore) { } issuedWarning = true; } return; } // Remove the end of line chars while( len > 0 && (b[len-1] == '\n' || b[len-1] == '\r') && len > off ) len --; // HACK, something is logging exceptions line by line (including // blanks), but I can't seem to find it, so for now just ignore // empty lines... they aren't very useful. if (len != 0) { String msg = new String(b, off, len); recursiveCheck.set(Boolean.TRUE); if (TRACE) { ===================================================================== Found a 68 line (142 tokens) duplication in the following files: Starting at line 66 of /home/tom/pmd/pmd-web/src/jboss-common/src/main/org/jboss/util/AbstractNestedThrowable.java Starting at line 66 of /home/tom/pmd/pmd-web/src/jboss-common/src/main/org/jboss/util/NestedRuntimeException.java Starting at line 66 of /home/tom/pmd/pmd-web/src/jboss-common/src/main/org/jboss/util/NestedError.java Starting at line 66 of /home/tom/pmd/pmd-web/src/jboss-common/src/main/org/jboss/util/NestedException.java public NestedException() { super(); this.nested = null; } /** * Return the nested Throwable. * * @return Nested Throwable. */ public Throwable getNested() { return nested; } /** * Return the nested Throwable. * *
For JDK 1.4 compatibility. * * @return Nested Throwable. */ public Throwable getCause() { return nested; } /** * Returns the composite throwable message. * * @return The composite throwable message. */ public String getMessage() { return NestedThrowable.Util.getMessage(super.getMessage(), nested); } /** * Prints the composite message and the embedded stack trace to the * specified print stream. * * @param stream Stream to print to. */ public void printStackTrace(final PrintStream stream) { if (nested == null || NestedThrowable.PARENT_TRACE_ENABLED) { super.printStackTrace(stream); } NestedThrowable.Util.print(nested, stream); } /** * Prints the composite message and the embedded stack trace to the * specified print writer. * * @param writer Writer to print to. */ public void printStackTrace(final PrintWriter writer) { if (nested == null || NestedThrowable.PARENT_TRACE_ENABLED) { super.printStackTrace(writer); } NestedThrowable.Util.print(nested, writer); } /** * Prints the composite message and the embedded stack trace to * System.err. */ public void printStackTrace() { printStackTrace(System.err); } } ===================================================================== Found a 67 line (137 tokens) duplication in the following files: Starting at line 67 of /home/tom/pmd/pmd-web/src/jboss-common/src/main/org/jboss/util/AbstractNestedThrowable.java Starting at line 84 of /home/tom/pmd/pmd-web/src/jboss-common/src/main/org/jboss/util/NestedSQLException.java super(msg, state, code); this.nested = null; } /** * Return the nested Throwable. * * @return Nested Throwable. */ public Throwable getNested() { return nested; } /** * Return the nested Throwable. * *
For JDK 1.4 compatibility.
*
* @return Nested Throwable.
*/
public Throwable getCause() {
return nested;
}
/**
* Returns the composite throwable message.
*
* @return The composite throwable message.
*/
public String getMessage() {
return NestedThrowable.Util.getMessage(super.getMessage(), nested);
}
/**
* Prints the composite message and the embedded stack trace to the
* specified print stream.
*
* @param stream Stream to print to.
*/
public void printStackTrace(final PrintStream stream) {
if (nested == null || NestedThrowable.PARENT_TRACE_ENABLED) {
super.printStackTrace(stream);
}
NestedThrowable.Util.print(nested, stream);
}
/**
* Prints the composite message and the embedded stack trace to the
* specified print writer.
*
* @param writer Writer to print to.
*/
public void printStackTrace(final PrintWriter writer) {
if (nested == null || NestedThrowable.PARENT_TRACE_ENABLED) {
super.printStackTrace(writer);
}
NestedThrowable.Util.print(nested, writer);
}
/**
* Prints the composite message and the embedded stack trace to
* System.err.
*/
public void printStackTrace() {
printStackTrace(System.err);
}
}
=====================================================================
Found a 34 line (133 tokens) duplication in the following files:
Starting at line 442 of /home/tom/pmd/pmd-web/src/jboss-common/src/main/org/jboss/xml/binding/metadata/unmarshalling/impl/XsdBinder.java
Starting at line 537 of /home/tom/pmd/pmd-web/src/jboss-common/src/main/org/jboss/xml/binding/metadata/unmarshalling/impl/XsdBinder.java
}
protected Class getJavaTypeLocal()
{
if(javaType == null)
{
init();
}
return javaType;
}
protected ElementBinding getElementLocal(QName elementName)
{
return (ElementBinding)children.get(elementName);
}
protected AttributeBinding getAttributeLocal(QName attributeName)
{
String fieldName = Util.xmlNameToClassName(attributeName.getLocalPart(), true);
fieldName = Character.toLowerCase(fieldName.charAt(0)) + fieldName.substring(1);
return new AttributeBindingImpl(attributeName, null, getJavaType(), fieldName);
}
protected XmlValueBinding getValueLocal()
{
// todo: implement getValueLocal
throw new UnsupportedOperationException("getValueLocal is not implemented.");
}
public void addChild(BasicElementBinding child)
{
children.put(child.getName(), child);
}
}
=====================================================================
Found a 93 line (131 tokens) duplication in the following files:
Starting at line 202 of /home/tom/pmd/pmd-web/src/jboss-common/src/main/org/jboss/util/MuFloat.java
Starting at line 202 of /home/tom/pmd/pmd-web/src/jboss-common/src/main/org/jboss/util/MuDouble.java
return Primitives.equals(value, ((MuDouble)obj).doubleValue());
}
return false;
}
/**
* Return a cloned copy of this mutable double.
*
* @return Cloaned mutable double.
*/
public Object clone() {
try {
return super.clone();
}
catch (CloneNotSupportedException e) {
throw new InternalError();
}
}
/////////////////////////////////////////////////////////////////////////
// Number Support //
/////////////////////////////////////////////////////////////////////////
/**
* Return the byte value of this object.
*
* @return byte value.
*/
public byte byteValue() {
return (byte)value;
}
/**
* Return the short value of this object.
*
* @return short value.
*/
public short shortValue() {
return (short)value;
}
/**
* Return the int value of this object.
*
* @return int value.
*/
public int intValue() {
return (int)value;
}
/**
* Return the long value of this object.
*
* @return long value.
*/
public long longValue() {
return (long)value;
}
/**
* Return the float value of this object.
*
* @return float value.
*/
public float floatValue() {
return (float)value;
}
/**
* Return the double value of this object.
*
* @return double value.
*/
public double doubleValue() {
return (double)value;
}
/////////////////////////////////////////////////////////////////////////
// Mutable Support //
/////////////////////////////////////////////////////////////////////////
/**
* Set the value of this mutable double.
*
* @param obj Object to convert to a double value.
*
* @throws NotCoercibleException Can not convert to double.
*/
public void setValue(Object obj) {
if (obj instanceof Number) {
value = ((Number)obj).doubleValue();
=====================================================================
Found a 93 line (130 tokens) duplication in the following files:
Starting at line 296 of /home/tom/pmd/pmd-web/src/jboss-common/src/main/org/jboss/util/MuShort.java
Starting at line 296 of /home/tom/pmd/pmd-web/src/jboss-common/src/main/org/jboss/util/MuByte.java
Starting at line 275 of /home/tom/pmd/pmd-web/src/jboss-common/src/main/org/jboss/util/MuInteger.java
return value == ((MuInteger)obj).intValue();
}
return false;
}
/**
* Return a cloned copy of this mutable integer.
*
* @return Cloned mutable integer.
*/
public Object clone() {
try {
return super.clone();
}
catch (CloneNotSupportedException e) {
throw new InternalError();
}
}
/////////////////////////////////////////////////////////////////////////
// Number Support //
/////////////////////////////////////////////////////////////////////////
/**
* Return the byte value of this object.
*
* @return byte value.
*/
public byte byteValue() {
return (byte)value;
}
/**
* Return the short value of this object.
*
* @return short value.
*/
public short shortValue() {
return (short)value;
}
/**
* Return the int value of this object.
*
* @return int value.
*/
public int intValue() {
return (int)value;
}
/**
* Return the long value of this object.
*
* @return long value.
*/
public long longValue() {
return (long)value;
}
/**
* Return the float value of this object.
*
* @return float value.
*/
public float floatValue() {
return (float)value;
}
/**
* Return the double value of this object.
*
* @return double value.
*/
public double doubleValue() {
return (double)value;
}
/////////////////////////////////////////////////////////////////////////
// Mutable Support //
/////////////////////////////////////////////////////////////////////////
/**
* Set the value of this mutable integer.
*
* @param value Object to convert to an integer value.
*
* @throws NotCoercibleException Can not convert to int.
*/
public void setValue(Object obj) {
if (obj instanceof Number) {
value = ((Number)obj).intValue();
=====================================================================
Found a 94 line (129 tokens) duplication in the following files:
Starting at line 296 of /home/tom/pmd/pmd-web/src/jboss-common/src/main/org/jboss/util/MuShort.java
Starting at line 202 of /home/tom/pmd/pmd-web/src/jboss-common/src/main/org/jboss/util/MuFloat.java
return Primitives.equals(value, ((MuFloat)obj).floatValue());
}
return false;
}
/**
* Return a cloned copy of this mutable float.
*
* @return Cloaned mutable float.
*/
public Object clone() {
try {
return super.clone();
}
catch (CloneNotSupportedException e) {
throw new InternalError();
}
}
/////////////////////////////////////////////////////////////////////////
// Number Support //
/////////////////////////////////////////////////////////////////////////
/**
* Return the byte value of this object.
*
* @return byte value.
*/
public byte byteValue() {
return (byte)value;
}
/**
* Return the short value of this object.
*
* @return short value.
*/
public short shortValue() {
return (short)value;
}
/**
* Return the int value of this object.
*
* @return int value.
*/
public int intValue() {
return (int)value;
}
/**
* Return the long value of this object.
*
* @return long value.
*/
public long longValue() {
return (long)value;
}
/**
* Return the float value of this object.
*
* @return float value.
*/
public float floatValue() {
return (float)value;
}
/**
* Return the double value of this object.
*
* @return double value.
*/
public double doubleValue() {
return (double)value;
}
/////////////////////////////////////////////////////////////////////////
// Mutable Support //
/////////////////////////////////////////////////////////////////////////
/**
* Set the value of this mutable float.
*
* @param obj Object to convert to a float value.
*
* @throws NotCoercibleException Can not convert to float.
*/
public void setValue(Object obj) {
if (obj instanceof Number) {
value = ((Number)obj).floatValue();
=====================================================================
Found a 32 line (126 tokens) duplication in the following files:
Starting at line 1645 of /home/tom/pmd/pmd-web/src/jboss-common/src/main/org/jboss/xml/binding/SimpleTypeBindings.java
Starting at line 1719 of /home/tom/pmd/pmd-web/src/jboss-common/src/main/org/jboss/xml/binding/SimpleTypeBindings.java
result += marshalInt(value.get(Calendar.HOUR_OF_DAY), 2);
result += ':';
result += marshalInt(value.get(Calendar.MINUTE), 2);
result += ':';
result += marshalInt(value.get(Calendar.SECOND), 2);
result += '.';
int millis = value.get(Calendar.MILLISECOND);
if(millis > 99)
{
result += String.valueOf(millis);
}
else if(millis > 9)
{
result += "0" + String.valueOf(millis);
}
else
{
result += "00" + String.valueOf(millis);
}
result += marshalTimeZone(value.getTimeZone());
return result;
}
/**
* Converts hexBinary value into byte array by encoding two subsequent hexadecimal digits into one byte.
*
* @param value
* @return
*/
public static byte[] unmarshalHexBinary(String value)
=====================================================================
Found a 35 line (120 tokens) duplication in the following files:
Starting at line 748 of /home/tom/pmd/pmd-web/src/jboss-common/src/main/org/jboss/util/collection/WeakIdentityHashMap.java
Starting at line 796 of /home/tom/pmd/pmd-web/src/jboss-common/src/main/org/jboss/util/collection/WeakIdentityHashMap.java
}
public void clear() {
WeakIdentityHashMap.this.clear();
}
public Object[] toArray() {
Collection c = new ArrayList(size());
for (Iterator i = iterator(); i.hasNext(); )
c.add(i.next());
return c.toArray();
}
public Object[] toArray(Object a[]) {
Collection c = new ArrayList(size());
for (Iterator i = iterator(); i.hasNext(); )
c.add(i.next());
return c.toArray(a);
}
}
/**
* Returns a collection view of the mappings contained in this map. Each
* element in the returned collection is a Map.Entry. The
* collection is backed by the map, so changes to the map are reflected in
* the collection, and vice-versa. The collection supports element
* removal, which removes the corresponding mapping from the map, via the
* Iterator.remove, Collection.remove,
* removeAll, retainAll, and clear operations.
* It does not support the add or addAll operations.
*
* @return a collection view of the mappings contained in this map.
* @see java.util.Map.Entry
*/
public Set entrySet() {
=====================================================================
Found a 21 line (117 tokens) duplication in the following files:
Starting at line 292 of /home/tom/pmd/pmd-web/src/jboss-common/src/main/org/jboss/xml/binding/metadata/unmarshalling/impl/XsdBinder.java
Starting at line 493 of /home/tom/pmd/pmd-web/src/jboss-common/src/main/org/jboss/xml/binding/metadata/unmarshalling/impl/XsdBinder.java
DocumentBinding doc = ns.getDocument();
// first try to use XSD type
XSTypeDefinition typeDef = elementDecl.getTypeDefinition();
String typeBasedClsName = null;
if("http://www.w3.org/2001/XMLSchema".equals(typeDef.getNamespace()))
{
javaType = SimpleTypeBindings.classForType(typeDef.getName());
}
else if(typeDef.getName() != null)
{
NamespaceBinding ns = doc.getNamespace(typeDef.getNamespace());
typeBasedClsName = ns.getJavaPackage() + "." + Util.xmlNameToClassName(typeDef.getName(), true);
try
{
javaType = Thread.currentThread().getContextClassLoader().loadClass(typeBasedClsName);
}
catch(ClassNotFoundException e)
{
}
}
=====================================================================
Found a 29 line (114 tokens) duplication in the following files:
Starting at line 191 of /home/tom/pmd/pmd-web/src/jboss-common/src/main/org/jboss/xml/binding/metadata/unmarshalling/impl/XsdBinder.java
Starting at line 210 of /home/tom/pmd/pmd-web/src/jboss-common/src/main/org/jboss/xml/binding/sunday/unmarshalling/XsdBinder.java
XSImplementation impl = getXSImplementation();
XSLoader schemaLoader = impl.createXSLoader(null);
XSModel model = schemaLoader.loadURI(xsdURL);
if(model == null)
{
throw new IllegalArgumentException("Invalid URI for schema: " + xsdURL);
}
return model;
}
private static XSImplementation getXSImplementation()
{
// Get DOM Implementation using DOM Registry
System.setProperty(DOMImplementationRegistry.PROPERTY, "org.apache.xerces.dom.DOMXSImplementationSourceImpl");
XSImplementation impl;
try
{
DOMImplementationRegistry registry = DOMImplementationRegistry.newInstance();
impl = (XSImplementation)registry.getDOMImplementation("XS-Loader");
}
catch(Exception e)
{
log.error("Failed to create schema loader.", e);
throw new IllegalStateException("Failed to create schema loader: " + e.getMessage());
}
return impl;
}
=====================================================================
Found a 52 line (112 tokens) duplication in the following files:
Starting at line 198 of /home/tom/pmd/pmd-web/src/jboss-common/src/main/org/jboss/xml/binding/metadata/unmarshalling/impl/RuntimeDocumentBinding.java
Starting at line 404 of /home/tom/pmd/pmd-web/src/jboss-common/src/main/org/jboss/xml/binding/metadata/unmarshalling/impl/XsdBinder.java
);
}
}
protected Field getFieldLocal()
{
if(javaType == null)
{
init();
}
return field;
}
protected Method getGetterLocal()
{
if(javaType == null)
{
init();
}
return getter;
}
protected Method getSetterLocal()
{
if(javaType == null)
{
init();
}
return setter;
}
protected Class getFieldTypeLocal()
{
if(javaType == null)
{
init();
}
return fieldType;
}
protected Class getJavaTypeLocal()
{
if(javaType == null)
{
init();
}
return javaType;
}
protected ElementBinding getElementLocal(QName elementName)
{
return (ElementBinding)children.get(elementName);
=====================================================================
Found a 24 line (109 tokens) duplication in the following files:
Starting at line 444 of /home/tom/pmd/pmd-web/src/jboss-common/src/main/org/jboss/xml/binding/metadata/unmarshalling/impl/DocumentBindingFactoryImpl.java
Starting at line 594 of /home/tom/pmd/pmd-web/src/jboss-common/src/main/org/jboss/xml/binding/metadata/unmarshalling/impl/DocumentBindingFactoryImpl.java
try
{
tmpField = parentType.getField(fieldName);
tmpFieldType = tmpField.getType();
}
catch(NoSuchFieldException e)
{
String baseMethodName = Character.toUpperCase(fieldName.charAt(0)) + fieldName.substring(1);
try
{
tmpGetter = parentType.getMethod("get" + baseMethodName, null);
tmpFieldType = tmpGetter.getReturnType();
try
{
tmpSetter = parentType.getMethod("set" + baseMethodName, new Class[]{tmpGetter.getReturnType()});
}
catch(NoSuchMethodException nosetter)
{
// this one is immutable
}
}
catch(NoSuchMethodException e1)
{
throw new JBossXBRuntimeException("Failed to bind value of " +
=====================================================================
Found a 84 line (108 tokens) duplication in the following files:
Starting at line 296 of /home/tom/pmd/pmd-web/src/jboss-common/src/main/org/jboss/util/MuShort.java
Starting at line 275 of /home/tom/pmd/pmd-web/src/jboss-common/src/main/org/jboss/util/MuLong.java
return value == ((MuLong)obj).longValue();
}
return false;
}
/**
* Return a cloned copy of this mutable long.
*
* @return Cloaned mutable long.
*/
public Object clone() {
try {
return super.clone();
}
catch (CloneNotSupportedException e) {
throw new InternalError();
}
}
/////////////////////////////////////////////////////////////////////////
// Number Support //
/////////////////////////////////////////////////////////////////////////
/**
* Return the byte value of this object.
*
* @return byte value.
*/
public byte byteValue() {
return (byte)value;
}
/**
* Return the short value of this object.
*
* @return short value.
*/
public short shortValue() {
return (short)value;
}
/**
* Return the int value of this object.
*
* @return int value.
*/
public int intValue() {
return (int)value;
}
/**
* Return the long value of this object.
*
* @return long value.
*/
public long longValue() {
return (long)value;
}
/**
* Return the float value of this object.
*
* @return float value.
*/
public float floatValue() {
return (float)value;
}
/**
* Return the double value of this object.
*
* @return double value.
*/
public double doubleValue() {
return (double)value;
}
/**
* Set the value of this mutable long integer.
*
* @param value The new value.
*/
public void set(long value)
=====================================================================
Found a 92 line (107 tokens) duplication in the following files:
Starting at line 275 of /home/tom/pmd/pmd-web/src/jboss-common/src/main/org/jboss/util/MuLong.java
Starting at line 202 of /home/tom/pmd/pmd-web/src/jboss-common/src/main/org/jboss/util/MuFloat.java
return Primitives.equals(value, ((MuFloat)obj).floatValue());
}
return false;
}
/**
* Return a cloned copy of this mutable float.
*
* @return Cloaned mutable float.
*/
public Object clone() {
try {
return super.clone();
}
catch (CloneNotSupportedException e) {
throw new InternalError();
}
}
/////////////////////////////////////////////////////////////////////////
// Number Support //
/////////////////////////////////////////////////////////////////////////
/**
* Return the byte value of this object.
*
* @return byte value.
*/
public byte byteValue() {
return (byte)value;
}
/**
* Return the short value of this object.
*
* @return short value.
*/
public short shortValue() {
return (short)value;
}
/**
* Return the int value of this object.
*
* @return int value.
*/
public int intValue() {
return (int)value;
}
/**
* Return the long value of this object.
*
* @return long value.
*/
public long longValue() {
return (long)value;
}
/**
* Return the float value of this object.
*
* @return float value.
*/
public float floatValue() {
return (float)value;
}
/**
* Return the double value of this object.
*
* @return double value.
*/
public double doubleValue() {
return (double)value;
}
/////////////////////////////////////////////////////////////////////////
// Mutable Support //
/////////////////////////////////////////////////////////////////////////
/**
* Set the value of this mutable float.
*
* @param obj Object to convert to a float value.
*
* @throws NotCoercibleException Can not convert to float.
*/
public void setValue(Object obj) {
=====================================================================
Found a 35 line (103 tokens) duplication in the following files:
Starting at line 22 of /home/tom/pmd/pmd-web/src/jboss-common/src/main/org/jboss/xml/binding/metadata/XmlAttributeImpl.java
Starting at line 22 of /home/tom/pmd/pmd-web/src/jboss-common/src/main/org/jboss/xml/binding/metadata/XmlElementImpl.java
public XmlElementImpl(XmlNamespace ns, String name, XmlType type)
{
this.ns = ns;
this.name = name;
this.type = type;
this.javaValue = (JavaValue)type.getJavaValue().clone();
}
public XmlNamespace getNamespace()
{
return ns;
}
public String getName()
{
return name;
}
public XmlType getType()
{
return type;
}
public JavaValue getJavaValue()
{
return javaValue;
}
public boolean equals(Object o)
{
if(this == o)
{
return true;
}
if(!(o instanceof XmlElementImpl))
=====================================================================
Found a 35 line (100 tokens) duplication in the following files:
Starting at line 468 of /home/tom/pmd/pmd-web/src/jboss-common/src/main/org/jboss/xml/binding/metadata/unmarshalling/impl/DocumentBindingFactoryImpl.java
Starting at line 618 of /home/tom/pmd/pmd-web/src/jboss-common/src/main/org/jboss/xml/binding/metadata/unmarshalling/impl/DocumentBindingFactoryImpl.java
container.getName() +
" to field " +
fieldName +
" in " +
parentType +
": neither field nor getter/setter were found."
);
}
}
field = tmpField;
getter = tmpGetter;
setter = tmpSetter;
fieldType = tmpFieldType;
}
if(fieldType == null)
{
this.javaType = javaType == null ? String.class : javaType;
}
else
{
if(javaType == null)
{
this.javaType = fieldType;
}
else if(Collection.class == fieldType ||
Collection.class.isAssignableFrom(fieldType) ||
fieldType.isAssignableFrom(javaType))
{
this.javaType = javaType;
}
else
{
throw new JBossXBRuntimeException("Failed to bind value of " +
=====================================================================
Found a 35 line (100 tokens) duplication in the following files:
Starting at line 177 of /home/tom/pmd/pmd-web/src/jboss-common/src/main/org/jboss/util/LongCounter.java
Starting at line 176 of /home/tom/pmd/pmd-web/src/jboss-common/src/main/org/jboss/util/Counter.java
public synchronized int getCount() {
return this.counter.getCount();
}
public synchronized void reset() {
this.counter.reset();
}
public synchronized int hashCode() {
return this.counter.hashCode();
}
public synchronized boolean equals(final Object obj) {
return this.counter.equals(obj);
}
public synchronized String toString() {
return this.counter.toString();
}
public synchronized Object clone() {
return this.counter.clone();
}
};
}
/**
* Returns a directional counter.
*
* @param counter Counter to make directional.
* @param increasing True to create an increasing only
* or false to create a decreasing only.
* @return A directional counter.
*/
public static Counter makeDirectional(final Counter counter,