removed error message spam

This commit is contained in:
Sem van der Hoeven
2020-03-03 16:33:12 +01:00
parent 170dae5344
commit 38b0524b0d
2 changed files with 2 additions and 50 deletions

View File

@@ -39,7 +39,7 @@ public class CrawlBranch {
}
return true;
} catch (Exception e) {
System.out.println("ERROR -- error in out http request : " + e);
//System.out.println("ERROR -- error in out http request : " + e);
return false;
}
}
@@ -51,7 +51,7 @@ public class CrawlBranch {
*/
public int searchForWord(String word) {
if (this.htmlDocument == null){
System.out.println("ERROR -- call crawl before searhing");
//System.out.println("ERROR -- call crawl before searhing");
return -1;
}
System.out.printf("Searching for %s...", word);

View File

@@ -143,52 +143,4 @@ public class WebCrawler {
this.successPages = 0;
this.amountFound = 0;
}
// public static void main(String[] args) {
// Scanner input = new Scanner(System.in);
// System.out.println("Enter a URL : ");
// String urlInput = input.nextLine().trim();
// crawler(urlInput);
//
// }
//
// public static void crawler(String startUrl) {
// ArrayList<String> pending = new ArrayList<>();
// ArrayList<String> traversed = new ArrayList<>();
//
// pending.add(startUrl);
// while (!pending.isEmpty() && traversed.size() <= 100) {
// String tempUrl = pending.remove(0);
// if (!traversed.contains(tempUrl)) {
// traversed.add(tempUrl);
// System.out.println("crawling: " + tempUrl);
//
// for (String s : getSubURLs(tempUrl)) {
// if (!traversed.contains(s)) pending.add(s);
// }
// }
// }
// }
//
// public static ArrayList<String> getSubURLs(String urlString) {
// ArrayList<String> subUrls = new ArrayList<>();
//
// try {
// URL url = new URL(urlString);
// Scanner urlScanner = new Scanner(url.openStream());
// int cur = 0;
// while (urlScanner.hasNext()) {
// String input = urlScanner.nextLine();
// cur = input.indexOf("http:", cur);
// while (cur > 0) {
// int endIndex = input.indexOf("\"", cur);
// cur = endIndex > 0 ? input.indexOf("http:", endIndex) : -1;
// }
// }
// } catch (IOException e) {
// e.printStackTrace();
// }
//
// return subUrls;
// }
}