CPD Results

The following document contains the results of PMD's CPD 5.3.5.

Duplications

File Line
org/apache/johnzon/websocket/internal/TypeAwareDecoder.java 42
org/apache/johnzon/websocket/mapper/JohnzonTextDecoder.java 64
        if (type != null) {
            return;
        }

        if (ServerEndpointConfig.class.isInstance(endpointConfig)) {
            final Class<?> endpointClass = ServerEndpointConfig.class.cast(endpointConfig).getEndpointClass();
            for (final Method m : endpointClass.getMethods()) {
                if (Object.class == m.getDeclaringClass()) {
                    continue;
                }
                if (m.getAnnotation(OnMessage.class) != null) {
                    final Type[] genericParameterTypes = m.getGenericParameterTypes();
                    for (int i = 0; i < genericParameterTypes.length; i++) {
                        if (genericParameterTypes[i] == Session.class) {
                            continue;
                        }
                        boolean param = false;
                        for (final Annotation a : m.getParameterAnnotations()[i]) {
                            if (PathParam.class == a.annotationType()) {
                                param = true;
                                break;
                            }
                        }
                        if (!param) {
                            this.type = genericParameterTypes[i];
                            break;
                        }
                    }
                    break;
                }
            }
            if (type == null) {
                throw new IllegalArgumentException("didn't find @OnMessage in " + endpointClass);
            }
        } else {
            type = Type.class.cast(endpointConfig.getUserProperties().get("johnzon.websocket.message.type"));
            if (type == null) {
                throw new IllegalArgumentException("didn't find johnzon.websocket.message.type");
            }
        }
    }