CPD Results

The following document contains the results of PMD’s CPD 6.49.0.

Duplications

FileLine
org/apache/ibatis/executor/loader/cglib/CglibProxyFactory.java103
org/apache/ibatis/executor/loader/javassist/JavassistProxyFactory.java101
  1. private static class EnhancedResultObjectProxyImpl implements MethodInterceptor {
  2. private final Class<?> type;
  3. private final ResultLoaderMap lazyLoader;
  4. private final boolean aggressive;
  5. private final Set<String> lazyLoadTriggerMethods;
  6. private final ObjectFactory objectFactory;
  7. private final List<Class<?>> constructorArgTypes;
  8. private final List<Object> constructorArgs;
  9. private EnhancedResultObjectProxyImpl(Class<?> type, ResultLoaderMap lazyLoader, Configuration configuration,
  10. ObjectFactory objectFactory, List<Class<?>> constructorArgTypes, List<Object> constructorArgs) {
  11. this.type = type;
  12. this.lazyLoader = lazyLoader;
  13. this.aggressive = configuration.isAggressiveLazyLoading();
  14. this.lazyLoadTriggerMethods = configuration.getLazyLoadTriggerMethods();
  15. this.objectFactory = objectFactory;
  16. this.constructorArgTypes = constructorArgTypes;
  17. this.constructorArgs = constructorArgs;
  18. }
  19. public static Object createProxy(Object target, ResultLoaderMap lazyLoader, Configuration configuration,
  20. ObjectFactory objectFactory, List<Class<?>> constructorArgTypes, List<Object> constructorArgs) {
  21. final Class<?> type = target.getClass();
  22. EnhancedResultObjectProxyImpl callback = new EnhancedResultObjectProxyImpl(type, lazyLoader, configuration,
  23. objectFactory, constructorArgTypes, constructorArgs);
  24. Object enhanced = createStaticProxy(type, callback, constructorArgTypes, constructorArgs);
  25. PropertyCopier.copyBeanProperties(type, target, enhanced);
  26. return enhanced;
  27. }
  28. @Override
  29. public Object intercept(Object enhanced, Method method, Object[] args, MethodProxy methodProxy) throws Throwable {
FileLine
org/apache/ibatis/jdbc/SelectBuilder.java49
org/apache/ibatis/jdbc/SqlBuilder.java77
  1. sql().SELECT_DISTINCT(columns);
  2. }
  3. public static void FROM(String table) {
  4. sql().FROM(table);
  5. }
  6. public static void JOIN(String join) {
  7. sql().JOIN(join);
  8. }
  9. public static void INNER_JOIN(String join) {
  10. sql().INNER_JOIN(join);
  11. }
  12. public static void LEFT_OUTER_JOIN(String join) {
  13. sql().LEFT_OUTER_JOIN(join);
  14. }
  15. public static void RIGHT_OUTER_JOIN(String join) {
  16. sql().RIGHT_OUTER_JOIN(join);
  17. }
  18. public static void OUTER_JOIN(String join) {
  19. sql().OUTER_JOIN(join);
  20. }
  21. public static void WHERE(String conditions) {
  22. sql().WHERE(conditions);
  23. }
  24. public static void OR() {
  25. sql().OR();
  26. }
  27. public static void AND() {
  28. sql().AND();
  29. }
  30. public static void GROUP_BY(String columns) {
  31. sql().GROUP_BY(columns);
  32. }
  33. public static void HAVING(String conditions) {
  34. sql().HAVING(conditions);
  35. }
  36. public static void ORDER_BY(String columns) {
  37. sql().ORDER_BY(columns);
  38. }
FileLine
org/apache/ibatis/type/ClobTypeHandler.java28
org/apache/ibatis/type/NClobTypeHandler.java28
  1. public class ClobTypeHandler extends BaseTypeHandler<String> {
  2. @Override
  3. public void setNonNullParameter(PreparedStatement ps, int i, String parameter, JdbcType jdbcType)
  4. throws SQLException {
  5. StringReader reader = new StringReader(parameter);
  6. ps.setCharacterStream(i, reader, parameter.length());
  7. }
  8. @Override
  9. public String getNullableResult(ResultSet rs, String columnName) throws SQLException {
  10. Clob clob = rs.getClob(columnName);
  11. return toString(clob);
  12. }
  13. @Override
  14. public String getNullableResult(ResultSet rs, int columnIndex) throws SQLException {
  15. Clob clob = rs.getClob(columnIndex);
  16. return toString(clob);
  17. }
  18. @Override
  19. public String getNullableResult(CallableStatement cs, int columnIndex) throws SQLException {
  20. Clob clob = cs.getClob(columnIndex);
  21. return toString(clob);
  22. }
  23. private String toString(Clob clob) throws SQLException {
  24. return clob == null ? null : clob.getSubString(1, (int) clob.length());
  25. }
  26. }
FileLine
org/apache/ibatis/executor/loader/cglib/CglibProxyFactory.java176
org/apache/ibatis/executor/loader/javassist/JavassistProxyFactory.java174
  1. implements MethodInterceptor {
  2. private EnhancedDeserializationProxyImpl(Class<?> type, Map<String, ResultLoaderMap.LoadPair> unloadedProperties,
  3. ObjectFactory objectFactory, List<Class<?>> constructorArgTypes, List<Object> constructorArgs) {
  4. super(type, unloadedProperties, objectFactory, constructorArgTypes, constructorArgs);
  5. }
  6. public static Object createProxy(Object target, Map<String, ResultLoaderMap.LoadPair> unloadedProperties,
  7. ObjectFactory objectFactory, List<Class<?>> constructorArgTypes, List<Object> constructorArgs) {
  8. final Class<?> type = target.getClass();
  9. EnhancedDeserializationProxyImpl callback = new EnhancedDeserializationProxyImpl(type, unloadedProperties,
  10. objectFactory, constructorArgTypes, constructorArgs);
  11. Object enhanced = createStaticProxy(type, callback, constructorArgTypes, constructorArgs);
  12. PropertyCopier.copyBeanProperties(type, target, enhanced);
  13. return enhanced;
  14. }
  15. @Override
  16. public Object intercept(Object enhanced, Method method, Object[] args, MethodProxy methodProxy) throws Throwable {
FileLine
org/apache/ibatis/executor/loader/cglib/CglibProxyFactory.java148
org/apache/ibatis/executor/loader/javassist/JavassistProxyFactory.java146
  1. return new CglibSerialStateHolder(original, lazyLoader.getProperties(), objectFactory,
  2. constructorArgTypes, constructorArgs);
  3. } else {
  4. return original;
  5. }
  6. }
  7. if (lazyLoader.size() > 0 && !FINALIZE_METHOD.equals(methodName)) {
  8. if (aggressive || lazyLoadTriggerMethods.contains(methodName)) {
  9. lazyLoader.loadAll();
  10. } else if (PropertyNamer.isSetter(methodName)) {
  11. final String property = PropertyNamer.methodToProperty(methodName);
  12. lazyLoader.remove(property);
  13. } else if (PropertyNamer.isGetter(methodName)) {
  14. final String property = PropertyNamer.methodToProperty(methodName);
  15. if (lazyLoader.hasLoader(property)) {
  16. lazyLoader.load(property);
  17. }
  18. }
  19. }
  20. }
  21. return methodProxy.invokeSuper(enhanced, args);
FileLine
org/apache/ibatis/logging/commons/JakartaCommonsLoggingImpl.java29
org/apache/ibatis/logging/slf4j/Slf4jImpl.java48
  1. log = LogFactory.getLog(clazz);
  2. }
  3. @Override
  4. public boolean isDebugEnabled() {
  5. return log.isDebugEnabled();
  6. }
  7. @Override
  8. public boolean isTraceEnabled() {
  9. return log.isTraceEnabled();
  10. }
  11. @Override
  12. public void error(String s, Throwable e) {
  13. log.error(s, e);
  14. }
  15. @Override
  16. public void error(String s) {
  17. log.error(s);
  18. }
  19. @Override
  20. public void debug(String s) {
  21. log.debug(s);
  22. }
  23. @Override
  24. public void trace(String s) {
  25. log.trace(s);
  26. }
  27. @Override
  28. public void warn(String s) {
  29. log.warn(s);
  30. }
  31. }
FileLine
org/apache/ibatis/logging/commons/JakartaCommonsLoggingImpl.java30
org/apache/ibatis/logging/log4j2/Log4j2Impl.java38
org/apache/ibatis/logging/slf4j/Slf4jImpl.java49
org/apache/ibatis/logging/slf4j/Slf4jLoggerImpl.java30
  1. }
  2. @Override
  3. public boolean isDebugEnabled() {
  4. return log.isDebugEnabled();
  5. }
  6. @Override
  7. public boolean isTraceEnabled() {
  8. return log.isTraceEnabled();
  9. }
  10. @Override
  11. public void error(String s, Throwable e) {
  12. log.error(s, e);
  13. }
  14. @Override
  15. public void error(String s) {
  16. log.error(s);
  17. }
  18. @Override
  19. public void debug(String s) {
  20. log.debug(s);
  21. }
  22. @Override
  23. public void trace(String s) {
  24. log.trace(s);
  25. }
  26. @Override
  27. public void warn(String s) {
  28. log.warn(s);
  29. }
  30. }
FileLine
org/apache/ibatis/executor/loader/cglib/CglibProxyFactory.java58
org/apache/ibatis/executor/loader/javassist/JavassistProxyFactory.java54
  1. Cannot enable lazy loading because CGLIB is not available. Add CGLIB to your classpath.”, e);
  2. }
  3. }
  4. @Override
  5. public Object createProxy(Object target, ResultLoaderMap lazyLoader, Configuration configuration,
  6. ObjectFactory objectFactory, List<Class<?>> constructorArgTypes, List<Object> constructorArgs) {
  7. return EnhancedResultObjectProxyImpl.createProxy(target, lazyLoader, configuration, objectFactory,
  8. constructorArgTypes, constructorArgs);
  9. }
  10. public Object createDeserializationProxy(Object target, Map<String, ResultLoaderMap.LoadPair> unloadedProperties,
  11. ObjectFactory objectFactory, List<Class<?>> constructorArgTypes, List<Object> constructorArgs) {
  12. return EnhancedDeserializationProxyImpl.createProxy(target, unloadedProperties, objectFactory, constructorArgTypes,
  13. constructorArgs);
  14. }
  15. static Object createStaticProxy(Class<?> type, Callback callback, List<Class<?>> constructorArgTypes,
FileLine
org/apache/ibatis/cache/decorators/SoftCache.java38
org/apache/ibatis/cache/decorators/WeakCache.java38
  1. public SoftCache(Cache delegate) {
  2. this.delegate = delegate;
  3. this.numberOfHardLinks = 256;
  4. this.hardLinksToAvoidGarbageCollection = new LinkedList<>();
  5. this.queueOfGarbageCollectedEntries = new ReferenceQueue<>();
  6. }
  7. @Override
  8. public String getId() {
  9. return delegate.getId();
  10. }
  11. @Override
  12. public int getSize() {
  13. removeGarbageCollectedItems();
  14. return delegate.getSize();
  15. }
  16. public void setSize(int size) {
  17. this.numberOfHardLinks = size;
  18. }
  19. @Override
  20. public void putObject(Object key, Object value) {
  21. removeGarbageCollectedItems();
  22. delegate.putObject(key, new SoftEntry(key, value, queueOfGarbageCollectedEntries));