From 1bbfa77f34459a7d368a1d49b61e99f10b17de48 Mon Sep 17 00:00:00 2001 From: Jeremy Long Date: Tue, 25 Sep 2012 21:03:12 -0400 Subject: [PATCH] minor bug fix in test Former-commit-id: 4e7cb9c7a500a48a96b929e84908058a79f8f464 --- .../org/codesecure/dependencycheck/data/cpe/CPEAnalyzer.java | 3 +++ .../org/codesecure/dependencycheck/data/cpe/IndexTest.java | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/codesecure/dependencycheck/data/cpe/CPEAnalyzer.java b/src/main/java/org/codesecure/dependencycheck/data/cpe/CPEAnalyzer.java index 921848306..7a9d8af63 100644 --- a/src/main/java/org/codesecure/dependencycheck/data/cpe/CPEAnalyzer.java +++ b/src/main/java/org/codesecure/dependencycheck/data/cpe/CPEAnalyzer.java @@ -231,6 +231,9 @@ public class CPEAnalyzer implements org.codesecure.dependencycheck.analyzer.Anal sb.append(txt); for (Evidence e : ec.iterator(confidenceFilter)) { String value = e.getValue(); + + //hack to get around the fact that lucene does a realy good job of recognizing domains and not + // splitting them. TODO - put together a better lucene analyzer specific to the domain. if (value.startsWith("http://")) { value = value.substring(7).replaceAll("\\.", " "); } diff --git a/src/test/java/org/codesecure/dependencycheck/data/cpe/IndexTest.java b/src/test/java/org/codesecure/dependencycheck/data/cpe/IndexTest.java index 8601fa471..ca94b99b8 100644 --- a/src/test/java/org/codesecure/dependencycheck/data/cpe/IndexTest.java +++ b/src/test/java/org/codesecure/dependencycheck/data/cpe/IndexTest.java @@ -4,6 +4,7 @@ */ package org.codesecure.dependencycheck.data.cpe; +import java.io.File; import org.codesecure.dependencycheck.data.lucene.BaseIndexTestCase; import java.io.IOException; import java.util.logging.Level; @@ -67,7 +68,8 @@ public class IndexTest extends BaseIndexTestCase { System.out.println("getDirectory"); Index index = new Index(); Directory result = index.getDirectory(); - String exp = "\\target\\store\\cpe"; + + String exp = File.separatorChar + "target" + File.separatorChar + "store" + File.separatorChar + "cpe"; // TODO review the generated test code and remove the default call to fail. assertTrue(result.toString().contains(exp)); }