CPD Results
The following document contains the results of PMD’s CPD 6.21.0.
Duplications
File | Line |
---|
org/apache/ibatis/executor/loader/cglib/CglibProxyFactory.java | 93 |
org/apache/ibatis/executor/loader/javassist/JavassistProxyFactory.java | 95 |
private static class EnhancedResultObjectProxyImpl implements MethodInterceptor {
private final Class<?> type; private final ResultLoaderMap lazyLoader; private final boolean aggressive; private final Set<String> lazyLoadTriggerMethods; private final ObjectFactory objectFactory; private final List<Class<?>> constructorArgTypes; private final List<Object> constructorArgs;
private EnhancedResultObjectProxyImpl(Class<?> type, ResultLoaderMap lazyLoader, Configuration configuration, ObjectFactory objectFactory, List<Class<?>> constructorArgTypes, List<Object> constructorArgs) { this.type = type; this.lazyLoader = lazyLoader; this.aggressive = configuration.isAggressiveLazyLoading(); this.lazyLoadTriggerMethods = configuration.getLazyLoadTriggerMethods(); this.objectFactory = objectFactory; this.constructorArgTypes = constructorArgTypes; this.constructorArgs = constructorArgs; }
public static Object createProxy(Object target, ResultLoaderMap lazyLoader, Configuration configuration, ObjectFactory objectFactory, List<Class<?>> constructorArgTypes, List<Object> constructorArgs) { final Class<?> type = target.getClass(); EnhancedResultObjectProxyImpl callback = new EnhancedResultObjectProxyImpl(type, lazyLoader, configuration, objectFactory, constructorArgTypes, constructorArgs); Object enhanced = crateProxy(type, callback, constructorArgTypes, constructorArgs); PropertyCopier.copyBeanProperties(type, target, enhanced); return enhanced; }
@Override public Object intercept(Object enhanced, Method method, Object[] args, MethodProxy methodProxy) throws Throwable {
|
File | Line |
---|
org/apache/ibatis/jdbc/SelectBuilder.java | 49 |
org/apache/ibatis/jdbc/SqlBuilder.java | 76 |
sql().SELECT_DISTINCT(columns); }
public static void FROM(String table) { sql().FROM(table); }
public static void JOIN(String join) { sql().JOIN(join); }
public static void INNER_JOIN(String join) { sql().INNER_JOIN(join); }
public static void LEFT_OUTER_JOIN(String join) { sql().LEFT_OUTER_JOIN(join); }
public static void RIGHT_OUTER_JOIN(String join) { sql().RIGHT_OUTER_JOIN(join); }
public static void OUTER_JOIN(String join) { sql().OUTER_JOIN(join); }
public static void WHERE(String conditions) { sql().WHERE(conditions); }
public static void OR() { sql().OR(); }
public static void AND() { sql().AND(); }
public static void GROUP_BY(String columns) { sql().GROUP_BY(columns); }
public static void HAVING(String conditions) { sql().HAVING(conditions); }
public static void ORDER_BY(String columns) { sql().ORDER_BY(columns); }
|
File | Line |
---|
org/apache/ibatis/type/ClobTypeHandler.java | 28 |
org/apache/ibatis/type/NClobTypeHandler.java | 28 |
public class ClobTypeHandler extends BaseTypeHandler<String> {
@Override public void setNonNullParameter(PreparedStatement ps, int i, String parameter, JdbcType jdbcType) throws SQLException { StringReader reader = new StringReader(parameter); ps.setCharacterStream(i, reader, parameter.length()); }
@Override public String getNullableResult(ResultSet rs, String columnName) throws SQLException { Clob clob = rs.getClob(columnName); return toString(clob); }
@Override public String getNullableResult(ResultSet rs, int columnIndex) throws SQLException { Clob clob = rs.getClob(columnIndex); return toString(clob); }
@Override public String getNullableResult(CallableStatement cs, int columnIndex) throws SQLException { Clob clob = cs.getClob(columnIndex); return toString(clob); }
private String toString(Clob clob) throws SQLException { return clob == null ? null : clob.getSubString(1, (int) clob.length()); }
}
|
File | Line |
---|
org/apache/ibatis/executor/loader/cglib/CglibProxyFactory.java | 162 |
org/apache/ibatis/executor/loader/javassist/JavassistProxyFactory.java | 164 |
private static class EnhancedDeserializationProxyImpl extends AbstractEnhancedDeserializationProxy implements MethodInterceptor {
private EnhancedDeserializationProxyImpl(Class<?> type, Map<String, ResultLoaderMap.LoadPair> unloadedProperties, ObjectFactory objectFactory, List<Class<?>> constructorArgTypes, List<Object> constructorArgs) { super(type, unloadedProperties, objectFactory, constructorArgTypes, constructorArgs); }
public static Object createProxy(Object target, Map<String, ResultLoaderMap.LoadPair> unloadedProperties, ObjectFactory objectFactory, List<Class<?>> constructorArgTypes, List<Object> constructorArgs) { final Class<?> type = target.getClass(); EnhancedDeserializationProxyImpl callback = new EnhancedDeserializationProxyImpl(type, unloadedProperties, objectFactory, constructorArgTypes, constructorArgs); Object enhanced = crateProxy(type, callback, constructorArgTypes, constructorArgs); PropertyCopier.copyBeanProperties(type, target, enhanced); return enhanced; }
@Override public Object intercept(Object enhanced, Method method, Object[] args, MethodProxy methodProxy) throws Throwable {
|
File | Line |
---|
org/apache/ibatis/executor/loader/cglib/CglibProxyFactory.java | 135 |
org/apache/ibatis/executor/loader/javassist/JavassistProxyFactory.java | 137 |
return new CglibSerialStateHolder(original, lazyLoader.getProperties(), objectFactory, constructorArgTypes, constructorArgs); } else { return original; } } else { if (lazyLoader.size() > 0 && !FINALIZE_METHOD.equals(methodName)) { if (aggressive || lazyLoadTriggerMethods.contains(methodName)) { lazyLoader.loadAll(); } else if (PropertyNamer.isSetter(methodName)) { final String property = PropertyNamer.methodToProperty(methodName); lazyLoader.remove(property); } else if (PropertyNamer.isGetter(methodName)) { final String property = PropertyNamer.methodToProperty(methodName); if (lazyLoader.hasLoader(property)) { lazyLoader.load(property); } } } } } return methodProxy.invokeSuper(enhanced, args);
|
File | Line |
---|
org/apache/ibatis/logging/commons/JakartaCommonsLoggingImpl.java | 29 |
org/apache/ibatis/logging/slf4j/Slf4jImpl.java | 47 |
log = LogFactory.getLog(clazz); }
@Override public boolean isDebugEnabled() { return log.isDebugEnabled(); }
@Override public boolean isTraceEnabled() { return log.isTraceEnabled(); }
@Override public void error(String s, Throwable e) { log.error(s, e); }
@Override public void error(String s) { log.error(s); }
@Override public void debug(String s) { log.debug(s); }
@Override public void trace(String s) { log.trace(s); }
@Override public void warn(String s) { log.warn(s); }
}
|
File | Line |
---|
org/apache/ibatis/logging/commons/JakartaCommonsLoggingImpl.java | 30 |
org/apache/ibatis/logging/log4j2/Log4j2Impl.java | 38 |
org/apache/ibatis/logging/slf4j/Slf4jImpl.java | 48 |
org/apache/ibatis/logging/slf4j/Slf4jLoggerImpl.java | 30 |
}
@Override public boolean isDebugEnabled() { return log.isDebugEnabled(); }
@Override public boolean isTraceEnabled() { return log.isTraceEnabled(); }
@Override public void error(String s, Throwable e) { log.error(s, e); }
@Override public void error(String s) { log.error(s); }
@Override public void debug(String s) { log.debug(s); }
@Override public void trace(String s) { log.trace(s); }
@Override public void warn(String s) { log.warn(s); }
}
|
File | Line |
---|
org/apache/ibatis/executor/loader/cglib/CglibProxyFactory.java | 54 |
org/apache/ibatis/executor/loader/javassist/JavassistProxyFactory.java | 53 |
throw new IllegalStateException(“Cannot enable lazy loading because CGLIB is not available. Add CGLIB to your classpath.”, e); } }
@Override public Object createProxy(Object target, ResultLoaderMap lazyLoader, Configuration configuration, ObjectFactory objectFactory, List<Class<?>> constructorArgTypes, List<Object> constructorArgs) { return EnhancedResultObjectProxyImpl.createProxy(target, lazyLoader, configuration, objectFactory, constructorArgTypes, constructorArgs); }
public Object createDeserializationProxy(Object target, Map<String, ResultLoaderMap.LoadPair> unloadedProperties, ObjectFactory objectFactory, List<Class<?>> constructorArgTypes, List<Object> constructorArgs) { return EnhancedDeserializationProxyImpl.createProxy(target, unloadedProperties, objectFactory, constructorArgTypes, constructorArgs); }
static Object crateProxy(Class<?> type, Callback callback, List<Class<?>> constructorArgTypes, List<Object> constructorArgs) {
|
File | Line |
---|
org/apache/ibatis/cache/decorators/SoftCache.java | 71 |
org/apache/ibatis/cache/decorators/WeakCache.java | 71 |
result = softReference.get(); if (result == null) { delegate.removeObject(key); } else { // See #586 (and #335) modifications need more than a read lock synchronized (hardLinksToAvoidGarbageCollection) { hardLinksToAvoidGarbageCollection.addFirst(result); if (hardLinksToAvoidGarbageCollection.size() > numberOfHardLinks) { hardLinksToAvoidGarbageCollection.removeLast(); } } } } return result; }
@Override public Object removeObject(Object key) { removeGarbageCollectedItems(); return delegate.removeObject(key); }
@Override public void clear() { synchronized (hardLinksToAvoidGarbageCollection) { hardLinksToAvoidGarbageCollection.clear(); } removeGarbageCollectedItems(); delegate.clear(); }
private void removeGarbageCollectedItems() {
|
File | Line |
---|
org/apache/ibatis/cache/decorators/SoftCache.java | 37 |
org/apache/ibatis/cache/decorators/WeakCache.java | 37 |
public SoftCache(Cache delegate) { this.delegate = delegate; this.numberOfHardLinks = 256; this.hardLinksToAvoidGarbageCollection = new LinkedList<>(); this.queueOfGarbageCollectedEntries = new ReferenceQueue<>(); }
@Override public String getId() { return delegate.getId(); }
@Override public int getSize() { removeGarbageCollectedItems(); return delegate.getSize(); }
public void setSize(int size) { this.numberOfHardLinks = size; }
@Override public void putObject(Object key, Object value) { removeGarbageCollectedItems(); delegate.putObject(key, new SoftEntry(key, value, queueOfGarbageCollectedEntries));
|