CPD Results

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

Duplications

FileLine
jfp/qualitas/exceptions/HandlerTypeCategoriser.java71
jfp/qualitas/exceptions/ThrowTypeCategoriser.java103
				"C-system", "C-base", "C-library");
	}

	private void incrementCountFor(String className, String systemCounter,
			String baseCounter, String libraryCounter) {
		if (relevanceChecker.isRelevantClass(className)) {
			perMethod.incrementCount(systemCounter);
		} else if (isBaseExceptionType(className)) {
			perMethod.incrementCount(baseCounter);
		} else {
			perMethod.incrementCount(libraryCounter);
		}
	}

	private boolean isBaseExceptionType(String className) {
		String dotClassName = className.replace(File.separatorChar, '.');
		return dotClassName.equals("java.lang.Exception")
				|| dotClassName.equals("java.lang.Error")
				|| dotClassName.equals("java.lang.Throwable");

	}

	@Override
	public void processNode() {
		CounterData perClass = new CounterData();
		for (MethodNode mn : methods) {
			if (!wantToCount(mn.access, mn.name)) {
				continue;
			}
			perMethod.reset();
FileLine
ie/nuim/cs/pop/metrics/LCC.java49
ie/nuim/cs/pop/metrics/LCOM3.java40
public class LCC implements ModuleMetric {

	@Override
	public Number value(int moduleId) {
		Graph<Method> graph = new UndirectedGraph<Method>();

		Session session = HibernateUtils.getSessionFactory()
				.getCurrentSession();
		Transaction transaction = session.beginTransaction();

		@SuppressWarnings("unchecked")
		Collection<Method> methods = session
				.createQuery("from Method where scope_id = :scope_id")
				.setParameter("scope_id", moduleId).list();

		for (Method method : methods) {
			graph.addNode(method);
		}

		for (Method method1 : methods) {
			for (Method method2 : methods) {
				if (method1 != method2
						&& method1.getMethodBody().shareAccessToAField(
								method2.getMethodBody())) {
					graph.addEdge(method1, method2);
				}
			}
		}
FileLine
ie/nuim/cs/pop/metrics/LCC.java49
ie/nuim/cs/pop/metrics/LCOM3.java40
ie/nuim/cs/pop/metrics/LCOM4.java40
public class LCC implements ModuleMetric {

	@Override
	public Number value(int moduleId) {
		Graph<Method> graph = new UndirectedGraph<Method>();

		Session session = HibernateUtils.getSessionFactory()
				.getCurrentSession();
		Transaction transaction = session.beginTransaction();

		@SuppressWarnings("unchecked")
		Collection<Method> methods = session
				.createQuery("from Method where scope_id = :scope_id")
				.setParameter("scope_id", moduleId).list();

		for (Method method : methods) {
			graph.addNode(method);
		}

		for (Method method1 : methods) {
			for (Method method2 : methods) {
				if (method1 != method2
						&& method1.getMethodBody().shareAccessToAField(
FileLine
ie/nuim/cs/pop/importers/JarImporter.java109
ie/nuim/cs/pop/importers/JarImporter.java229
	private void addDeclaredPackagesToSystem(ZipFile jar) throws IOException {
		Enumeration<? extends ZipEntry> jarEntries = jar.entries();
		while (jarEntries.hasMoreElements()) {
			ZipEntry jarEntry = jarEntries.nextElement();

			if (jarEntry.getName().endsWith(CLASS_FILE_SUFFIX)) {
				ClassNode classNode = new ClassNode(ASM4);

				try {
					new ClassReader(jar.getInputStream(jarEntry)).accept(
							classNode, 0);
				} catch (IOException e) {
					e.printStackTrace();
				}

				String packageName = ancestorName(classNode.name);

				if (packageName != null) {