X-Git-Url: https://code.wpia.club/?p=gigi.git;a=blobdiff_plain;f=util%2Fclub%2Fwpia%2Fgigi%2Futil%2FHighFinancialValueFetcherAlexa.java;fp=util%2Fclub%2Fwpia%2Fgigi%2Futil%2FHighFinancialValueFetcherAlexa.java;h=398bde2006a15972b3b3ba268bcc8ce13353ab1d;hp=ae3ef536b524ef6801af274cb1d974f40d73c4ab;hb=08f5408ab4af277f5c9b84cbe0d2500b14609e6b;hpb=5e75c08b32119d8b45ed0a1d900ad523f4503bb3 diff --git a/util/club/wpia/gigi/util/HighFinancialValueFetcherAlexa.java b/util/club/wpia/gigi/util/HighFinancialValueFetcherAlexa.java index ae3ef536..398bde20 100644 --- a/util/club/wpia/gigi/util/HighFinancialValueFetcherAlexa.java +++ b/util/club/wpia/gigi/util/HighFinancialValueFetcherAlexa.java @@ -12,8 +12,16 @@ public class HighFinancialValueFetcherAlexa extends HighFinancialValueFetcher { @Override public void handle(String line, PrintWriter fos) { String[] parts = line.split(","); + // Assert that the value before the "," is an integer - Integer.parseInt(parts[0]); + try { + if (Integer.parseInt(parts[0]) < 1) { + throw new NumberFormatException("We expect a number greater then zero for the first column."); + } + } catch (NumberFormatException nfe) { + // Bail on lines with invalid first field + throw new Error("Invalid format of first column.", nfe); + } emit(fos, parts[1]); System.out.println(parts[1]);