From 753a414987966e136dc41431b25cadd61f99b107 Mon Sep 17 00:00:00 2001 From: Gabor Szarnyas Date: Mon, 3 Feb 2020 18:11:26 +0100 Subject: [PATCH] Throw RuntimeExceptions to fail as early as possible The previous version called printStackTrace() and kept running until causing another exception such as an NPE --- src/main/java/ldbc/snb/datagen/LdbcDatagen.java | 1 - .../ldbc/snb/datagen/dictionary/BrowserDictionary.java | 2 +- .../ldbc/snb/datagen/dictionary/CompanyDictionary.java | 2 +- .../java/ldbc/snb/datagen/dictionary/EmailDictionary.java | 2 +- .../ldbc/snb/datagen/dictionary/IPAddressDictionary.java | 2 +- .../ldbc/snb/datagen/dictionary/LanguageDictionary.java | 2 +- .../java/ldbc/snb/datagen/dictionary/NamesDictionary.java | 4 ++-- .../java/ldbc/snb/datagen/dictionary/PlaceDictionary.java | 6 +++--- .../snb/datagen/dictionary/PopularPlacesDictionary.java | 2 +- .../java/ldbc/snb/datagen/dictionary/TagDictionary.java | 2 +- src/main/java/ldbc/snb/datagen/dictionary/TagMatrix.java | 2 +- .../ldbc/snb/datagen/dictionary/TagTextDictionary.java | 2 +- .../ldbc/snb/datagen/dictionary/UniversityDictionary.java | 2 +- .../ldbc/snb/datagen/dictionary/UserAgentDictionary.java | 2 +- .../generator/distribution/EmpiricalDistribution.java | 5 ++--- .../distribution/FacebookDegreeDistribution.java | 4 ++-- .../generator/generators/PersonActivityGenerator.java | 1 - .../generators/knowsgenerators/BterKnowsGenerator.java | 2 +- .../datagen/hadoop/generator/HadoopKnowsGenerator.java | 2 +- .../hadoop/generator/HadoopPersonActivityGenerator.java | 5 ++--- .../datagen/hadoop/generator/HadoopPersonGenerator.java | 4 ++-- .../ldbc/snb/datagen/hadoop/miscjob/HadoopFileRanker.java | 8 ++++---- .../hadoop/miscjob/HadoopMergeFriendshipFiles.java | 2 +- .../hadoop/miscjob/keychanger/HadoopFileKeyChanger.java | 6 +++--- .../datagen/hadoop/serializer/HadoopPersonSerializer.java | 2 +- .../hadoop/serializer/HadoopPersonSortAndSerializer.java | 2 +- .../datagen/hadoop/serializer/HadoopStaticSerializer.java | 2 +- .../hadoop/serializer/HadoopUpdateStreamSerializer.java | 2 +- .../java/ldbc/snb/datagen/hadoop/writer/HdfsWriter.java | 4 ++-- src/main/java/ldbc/snb/datagen/util/ConfigParser.java | 3 +-- src/main/java/ldbc/snb/datagen/util/Distribution.java | 2 +- src/main/java/ldbc/snb/datagen/util/DistributionKey.java | 2 +- src/main/java/ldbc/snb/datagen/util/FactorTable.java | 5 ++--- src/test/java/ldbc/snb/datagen/test/LdbcDatagenTest.java | 1 - 34 files changed, 45 insertions(+), 52 deletions(-) diff --git a/src/main/java/ldbc/snb/datagen/LdbcDatagen.java b/src/main/java/ldbc/snb/datagen/LdbcDatagen.java index 84c91a86f..e450e9184 100644 --- a/src/main/java/ldbc/snb/datagen/LdbcDatagen.java +++ b/src/main/java/ldbc/snb/datagen/LdbcDatagen.java @@ -348,7 +348,6 @@ public static void main(String[] args) throws Exception { } catch (Exception e) { System.err.println("Error during execution"); System.err.println(e.getMessage()); - e.printStackTrace(); throw e; } } diff --git a/src/main/java/ldbc/snb/datagen/dictionary/BrowserDictionary.java b/src/main/java/ldbc/snb/datagen/dictionary/BrowserDictionary.java index fe3d16240..1af25e6b2 100644 --- a/src/main/java/ldbc/snb/datagen/dictionary/BrowserDictionary.java +++ b/src/main/java/ldbc/snb/datagen/dictionary/BrowserDictionary.java @@ -73,7 +73,7 @@ private void load(String fileName) { } dictionary.close(); } catch (IOException e) { - e.printStackTrace(); + throw new RuntimeException(e); } } diff --git a/src/main/java/ldbc/snb/datagen/dictionary/CompanyDictionary.java b/src/main/java/ldbc/snb/datagen/dictionary/CompanyDictionary.java index 866ed19f6..df1880d8d 100644 --- a/src/main/java/ldbc/snb/datagen/dictionary/CompanyDictionary.java +++ b/src/main/java/ldbc/snb/datagen/dictionary/CompanyDictionary.java @@ -114,7 +114,7 @@ private void load(String fileName) { } dictionary.close(); } catch (IOException e) { - e.printStackTrace(); + throw new RuntimeException(e); } } diff --git a/src/main/java/ldbc/snb/datagen/dictionary/EmailDictionary.java b/src/main/java/ldbc/snb/datagen/dictionary/EmailDictionary.java index e02656f45..22858e67a 100644 --- a/src/main/java/ldbc/snb/datagen/dictionary/EmailDictionary.java +++ b/src/main/java/ldbc/snb/datagen/dictionary/EmailDictionary.java @@ -86,7 +86,7 @@ private void load(String fileName) { } emailDictionary.close(); } catch (IOException e) { - e.printStackTrace(); + throw new RuntimeException(e); } } diff --git a/src/main/java/ldbc/snb/datagen/dictionary/IPAddressDictionary.java b/src/main/java/ldbc/snb/datagen/dictionary/IPAddressDictionary.java index c11e2674c..8f6cfda7d 100644 --- a/src/main/java/ldbc/snb/datagen/dictionary/IPAddressDictionary.java +++ b/src/main/java/ldbc/snb/datagen/dictionary/IPAddressDictionary.java @@ -119,7 +119,7 @@ private void load(String mappingFileName, String baseIPdir) { ipZoneFile.close(); } } catch (IOException e) { - e.printStackTrace(); + throw new RuntimeException(e); } } diff --git a/src/main/java/ldbc/snb/datagen/dictionary/LanguageDictionary.java b/src/main/java/ldbc/snb/datagen/dictionary/LanguageDictionary.java index 8e73e90ab..7888b6828 100644 --- a/src/main/java/ldbc/snb/datagen/dictionary/LanguageDictionary.java +++ b/src/main/java/ldbc/snb/datagen/dictionary/LanguageDictionary.java @@ -124,7 +124,7 @@ private void load(String fileName) { } dictionary.close(); } catch (IOException e) { - e.printStackTrace(); + throw new RuntimeException(e); } } diff --git a/src/main/java/ldbc/snb/datagen/dictionary/NamesDictionary.java b/src/main/java/ldbc/snb/datagen/dictionary/NamesDictionary.java index 9a10ec57c..64c615923 100644 --- a/src/main/java/ldbc/snb/datagen/dictionary/NamesDictionary.java +++ b/src/main/java/ldbc/snb/datagen/dictionary/NamesDictionary.java @@ -110,7 +110,7 @@ public void extractSurNames() { surnameDictionary.close(); System.out.println("Done ... " + totalSurNames + " surnames were extracted "); } catch (IOException e) { - e.printStackTrace(); + throw new RuntimeException(e); } } @@ -140,7 +140,7 @@ public void extractGivenNames() { givennameDictionary.close(); System.out.println("Done ... " + totalGivenNames + " given names were extracted "); } catch (IOException e) { - e.printStackTrace(); + throw new RuntimeException(e); } } diff --git a/src/main/java/ldbc/snb/datagen/dictionary/PlaceDictionary.java b/src/main/java/ldbc/snb/datagen/dictionary/PlaceDictionary.java index 02c0484aa..60b8d41a2 100644 --- a/src/main/java/ldbc/snb/datagen/dictionary/PlaceDictionary.java +++ b/src/main/java/ldbc/snb/datagen/dictionary/PlaceDictionary.java @@ -291,7 +291,7 @@ private void readCities(String fileName) { } dictionary.close(); } catch (IOException e) { - e.printStackTrace(); + throw new RuntimeException(e); } } @@ -331,7 +331,7 @@ private void readCountries(String fileName) { cumulativeDistribution = new Float[temporalCumulative.size()]; cumulativeDistribution = temporalCumulative.toArray(cumulativeDistribution); } catch (IOException e) { - e.printStackTrace(); + throw new RuntimeException(e); } } @@ -372,7 +372,7 @@ private void readContinents(String fileName) { } dictionary.close(); } catch (IOException e) { - e.printStackTrace(); + throw new RuntimeException(e); } } diff --git a/src/main/java/ldbc/snb/datagen/dictionary/PopularPlacesDictionary.java b/src/main/java/ldbc/snb/datagen/dictionary/PopularPlacesDictionary.java index 38451e551..9ca482178 100644 --- a/src/main/java/ldbc/snb/datagen/dictionary/PopularPlacesDictionary.java +++ b/src/main/java/ldbc/snb/datagen/dictionary/PopularPlacesDictionary.java @@ -107,7 +107,7 @@ private void load(String fileName) { } dicPopularPlace.close(); } catch (IOException e) { - e.printStackTrace(); + throw new RuntimeException(e); } } diff --git a/src/main/java/ldbc/snb/datagen/dictionary/TagDictionary.java b/src/main/java/ldbc/snb/datagen/dictionary/TagDictionary.java index 49c9ba21d..45c04898f 100644 --- a/src/main/java/ldbc/snb/datagen/dictionary/TagDictionary.java +++ b/src/main/java/ldbc/snb/datagen/dictionary/TagDictionary.java @@ -227,7 +227,7 @@ private void load(String tagsFileName, String popularTagByCountryFileName, Strin dictionary.close(); } catch (IOException e) { - e.printStackTrace(); + throw new RuntimeException(e); } } diff --git a/src/main/java/ldbc/snb/datagen/dictionary/TagMatrix.java b/src/main/java/ldbc/snb/datagen/dictionary/TagMatrix.java index b5fb88fb5..ad4f54645 100644 --- a/src/main/java/ldbc/snb/datagen/dictionary/TagMatrix.java +++ b/src/main/java/ldbc/snb/datagen/dictionary/TagMatrix.java @@ -95,7 +95,7 @@ private void load(String tagMatrixFileName) { } dictionary.close(); } catch (Exception e) { - e.printStackTrace(); + throw new RuntimeException(e); } } diff --git a/src/main/java/ldbc/snb/datagen/dictionary/TagTextDictionary.java b/src/main/java/ldbc/snb/datagen/dictionary/TagTextDictionary.java index 5d0e7a3fa..b3e9d59b9 100644 --- a/src/main/java/ldbc/snb/datagen/dictionary/TagTextDictionary.java +++ b/src/main/java/ldbc/snb/datagen/dictionary/TagTextDictionary.java @@ -83,7 +83,7 @@ private void load(String fileName) { } dictionary.close(); } catch (Exception e) { - e.printStackTrace(); + throw new RuntimeException(e); } } diff --git a/src/main/java/ldbc/snb/datagen/dictionary/UniversityDictionary.java b/src/main/java/ldbc/snb/datagen/dictionary/UniversityDictionary.java index 885820f87..c02ee1d2e 100644 --- a/src/main/java/ldbc/snb/datagen/dictionary/UniversityDictionary.java +++ b/src/main/java/ldbc/snb/datagen/dictionary/UniversityDictionary.java @@ -135,7 +135,7 @@ private void load(String fileName) { } dicAllInstitutes.close(); } catch (IOException e) { - e.printStackTrace(); + throw new RuntimeException(e); } } diff --git a/src/main/java/ldbc/snb/datagen/dictionary/UserAgentDictionary.java b/src/main/java/ldbc/snb/datagen/dictionary/UserAgentDictionary.java index bf0396169..8316f041a 100644 --- a/src/main/java/ldbc/snb/datagen/dictionary/UserAgentDictionary.java +++ b/src/main/java/ldbc/snb/datagen/dictionary/UserAgentDictionary.java @@ -77,7 +77,7 @@ private void load(String fileName) { } agentFile.close(); } catch (IOException e) { - e.printStackTrace(); + throw new RuntimeException(e); } } diff --git a/src/main/java/ldbc/snb/datagen/generator/distribution/EmpiricalDistribution.java b/src/main/java/ldbc/snb/datagen/generator/distribution/EmpiricalDistribution.java index b3103e559..71774809b 100644 --- a/src/main/java/ldbc/snb/datagen/generator/distribution/EmpiricalDistribution.java +++ b/src/main/java/ldbc/snb/datagen/generator/distribution/EmpiricalDistribution.java @@ -64,10 +64,9 @@ public List getBuckets(Configuration conf) { reader.close(); return Bucket.bucketizeHistogram(histogram, 1000); } catch (IOException e) { - e.printStackTrace(); + throw new RuntimeException(e); } catch (Exception e) { - e.printStackTrace(); + throw new RuntimeException(e); } - return null; } } diff --git a/src/main/java/ldbc/snb/datagen/generator/distribution/FacebookDegreeDistribution.java b/src/main/java/ldbc/snb/datagen/generator/distribution/FacebookDegreeDistribution.java index dddc6a8eb..d9c92364b 100644 --- a/src/main/java/ldbc/snb/datagen/generator/distribution/FacebookDegreeDistribution.java +++ b/src/main/java/ldbc/snb/datagen/generator/distribution/FacebookDegreeDistribution.java @@ -83,9 +83,9 @@ public void loadFBBuckets() { } fbDataReader.close(); } catch (IOException e) { - e.printStackTrace(); + throw new RuntimeException(e); } catch (Exception e) { - e.printStackTrace(); + throw new RuntimeException(e); } } diff --git a/src/main/java/ldbc/snb/datagen/generator/generators/PersonActivityGenerator.java b/src/main/java/ldbc/snb/datagen/generator/generators/PersonActivityGenerator.java index f2d8c3793..11a40d391 100644 --- a/src/main/java/ldbc/snb/datagen/generator/generators/PersonActivityGenerator.java +++ b/src/main/java/ldbc/snb/datagen/generator/generators/PersonActivityGenerator.java @@ -98,7 +98,6 @@ private void generateActivity(Person person, List block) throws Assertio } catch (AssertionError e) { System.out.println("Assertion error when generating activity!"); System.out.println(e.getMessage()); - e.printStackTrace(); throw e; } } diff --git a/src/main/java/ldbc/snb/datagen/generator/generators/knowsgenerators/BterKnowsGenerator.java b/src/main/java/ldbc/snb/datagen/generator/generators/knowsgenerators/BterKnowsGenerator.java index 80d0d78c7..afb4f1608 100644 --- a/src/main/java/ldbc/snb/datagen/generator/generators/knowsgenerators/BterKnowsGenerator.java +++ b/src/main/java/ldbc/snb/datagen/generator/generators/knowsgenerators/BterKnowsGenerator.java @@ -183,7 +183,7 @@ public void generateKnows(List persons, int seed, List percentage } reader.close(); } catch (IOException e) { - e.printStackTrace(); + throw new RuntimeException(e); } p[0] = 0.0; diff --git a/src/main/java/ldbc/snb/datagen/hadoop/generator/HadoopKnowsGenerator.java b/src/main/java/ldbc/snb/datagen/hadoop/generator/HadoopKnowsGenerator.java index 4f4a70ab2..d36e08bf4 100644 --- a/src/main/java/ldbc/snb/datagen/hadoop/generator/HadoopKnowsGenerator.java +++ b/src/main/java/ldbc/snb/datagen/hadoop/generator/HadoopKnowsGenerator.java @@ -105,7 +105,7 @@ protected void setup(Context context) { .newInstance(); } catch (Exception e) { System.out.println(e.getMessage()); - e.printStackTrace(); + throw new RuntimeException(e); } } diff --git a/src/main/java/ldbc/snb/datagen/hadoop/generator/HadoopPersonActivityGenerator.java b/src/main/java/ldbc/snb/datagen/hadoop/generator/HadoopPersonActivityGenerator.java index 40ad89ff0..74ed30ecb 100644 --- a/src/main/java/ldbc/snb/datagen/hadoop/generator/HadoopPersonActivityGenerator.java +++ b/src/main/java/ldbc/snb/datagen/hadoop/generator/HadoopPersonActivityGenerator.java @@ -107,7 +107,7 @@ protected void setup(Context context) { } catch (Exception e) { System.err.println(e.getMessage()); - e.printStackTrace(); + throw new RuntimeException(e); } } @@ -148,7 +148,6 @@ protected void cleanup(Context context) { personFactors_.close(); friends_.close(); } catch (IOException e) { - e.printStackTrace(); throw new RuntimeException(e); } dynamicActivitySerializer_.close(); @@ -217,7 +216,7 @@ public void run(String inputFileName) throws AssertionError, Exception { fs.delete(new Path(conf.get("ldbc.snb.datagen.serializer.hadoopDir") + "/aux"), true); } catch (IOException e) { System.err.println(e.getMessage()); - e.printStackTrace(); + throw new RuntimeException(e); } } diff --git a/src/main/java/ldbc/snb/datagen/hadoop/generator/HadoopPersonGenerator.java b/src/main/java/ldbc/snb/datagen/hadoop/generator/HadoopPersonGenerator.java index 1cfcbf735..85e14a778 100644 --- a/src/main/java/ldbc/snb/datagen/hadoop/generator/HadoopPersonGenerator.java +++ b/src/main/java/ldbc/snb/datagen/hadoop/generator/HadoopPersonGenerator.java @@ -77,7 +77,7 @@ public void map(LongWritable key, Text value, Context context) } catch (Exception e) { System.err.println("Error when setting key setter"); System.err.println(e.getMessage()); - e.printStackTrace(); + throw new RuntimeException(e); } int threadId = Integer.parseInt(value.toString()); @@ -135,7 +135,7 @@ private static void writeToOutputFile(String filename, int numMaps, Configuratio output.write((new String(i + "\n").getBytes())); output.close(); } catch (IOException e) { - e.printStackTrace(); + throw new RuntimeException(e); } } diff --git a/src/main/java/ldbc/snb/datagen/hadoop/miscjob/HadoopFileRanker.java b/src/main/java/ldbc/snb/datagen/hadoop/miscjob/HadoopFileRanker.java index 18f6ae449..98c9419ba 100644 --- a/src/main/java/ldbc/snb/datagen/hadoop/miscjob/HadoopFileRanker.java +++ b/src/main/java/ldbc/snb/datagen/hadoop/miscjob/HadoopFileRanker.java @@ -90,13 +90,13 @@ public void setup(Context context) { keySetter = (HadoopFileKeyChanger.KeySetter) Class.forName(className).newInstance(); } catch (ClassNotFoundException e) { System.out.print(e.getMessage()); - e.printStackTrace(); + throw new RuntimeException(e); } catch (IllegalAccessException e) { System.out.print(e.getMessage()); - e.printStackTrace(); + throw new RuntimeException(e); } catch (InstantiationException e) { System.out.print(e.getMessage()); - e.printStackTrace(); + throw new RuntimeException(e); } } @@ -194,7 +194,7 @@ public void setup(Context context) { } } catch (IOException e) { System.err.println(e.getMessage()); - e.printStackTrace(); + throw new RuntimeException(e); } counters[0] = 0; diff --git a/src/main/java/ldbc/snb/datagen/hadoop/miscjob/HadoopMergeFriendshipFiles.java b/src/main/java/ldbc/snb/datagen/hadoop/miscjob/HadoopMergeFriendshipFiles.java index 8e4401fea..4ece13ff8 100644 --- a/src/main/java/ldbc/snb/datagen/hadoop/miscjob/HadoopMergeFriendshipFiles.java +++ b/src/main/java/ldbc/snb/datagen/hadoop/miscjob/HadoopMergeFriendshipFiles.java @@ -75,7 +75,7 @@ protected void setup(Context context) { .newInstance(); } catch (Exception e) { System.out.println(e.getMessage()); - e.printStackTrace(); + throw new RuntimeException(e); } } diff --git a/src/main/java/ldbc/snb/datagen/hadoop/miscjob/keychanger/HadoopFileKeyChanger.java b/src/main/java/ldbc/snb/datagen/hadoop/miscjob/keychanger/HadoopFileKeyChanger.java index 3f4485846..7f24541d5 100644 --- a/src/main/java/ldbc/snb/datagen/hadoop/miscjob/keychanger/HadoopFileKeyChanger.java +++ b/src/main/java/ldbc/snb/datagen/hadoop/miscjob/keychanger/HadoopFileKeyChanger.java @@ -77,13 +77,13 @@ public void setup(Context context) { keySetter = (HadoopFileKeyChanger.KeySetter) Class.forName(className).newInstance(); } catch (ClassNotFoundException e) { System.out.print(e.getMessage()); - e.printStackTrace(); + throw new RuntimeException(e); } catch (IllegalAccessException e) { System.out.print(e.getMessage()); - e.printStackTrace(); + throw new RuntimeException(e); } catch (InstantiationException e) { System.out.print(e.getMessage()); - e.printStackTrace(); + throw new RuntimeException(e); } } diff --git a/src/main/java/ldbc/snb/datagen/hadoop/serializer/HadoopPersonSerializer.java b/src/main/java/ldbc/snb/datagen/hadoop/serializer/HadoopPersonSerializer.java index f2aa54acb..a94cf6580 100644 --- a/src/main/java/ldbc/snb/datagen/hadoop/serializer/HadoopPersonSerializer.java +++ b/src/main/java/ldbc/snb/datagen/hadoop/serializer/HadoopPersonSerializer.java @@ -88,7 +88,7 @@ protected void setup(Context context) { } } catch (Exception e) { System.err.println(e.getMessage()); - e.printStackTrace(); + throw new RuntimeException(e); } } diff --git a/src/main/java/ldbc/snb/datagen/hadoop/serializer/HadoopPersonSortAndSerializer.java b/src/main/java/ldbc/snb/datagen/hadoop/serializer/HadoopPersonSortAndSerializer.java index bbdef28eb..e054532b0 100644 --- a/src/main/java/ldbc/snb/datagen/hadoop/serializer/HadoopPersonSortAndSerializer.java +++ b/src/main/java/ldbc/snb/datagen/hadoop/serializer/HadoopPersonSortAndSerializer.java @@ -94,7 +94,7 @@ protected void setup(Context context) { } } catch (Exception e) { System.err.println(e.getMessage()); - e.printStackTrace(); + throw new RuntimeException(e); } } diff --git a/src/main/java/ldbc/snb/datagen/hadoop/serializer/HadoopStaticSerializer.java b/src/main/java/ldbc/snb/datagen/hadoop/serializer/HadoopStaticSerializer.java index 5db28c3a3..0d4e19b22 100644 --- a/src/main/java/ldbc/snb/datagen/hadoop/serializer/HadoopStaticSerializer.java +++ b/src/main/java/ldbc/snb/datagen/hadoop/serializer/HadoopStaticSerializer.java @@ -75,7 +75,7 @@ public void run() throws Exception { } } catch (Exception e) { System.err.println(e.getMessage()); - e.printStackTrace(); + throw new RuntimeException(e); } exportPlaces(); diff --git a/src/main/java/ldbc/snb/datagen/hadoop/serializer/HadoopUpdateStreamSerializer.java b/src/main/java/ldbc/snb/datagen/hadoop/serializer/HadoopUpdateStreamSerializer.java index 24aca422d..a18221d26 100644 --- a/src/main/java/ldbc/snb/datagen/hadoop/serializer/HadoopUpdateStreamSerializer.java +++ b/src/main/java/ldbc/snb/datagen/hadoop/serializer/HadoopUpdateStreamSerializer.java @@ -77,7 +77,7 @@ protected void setup(Context context) { } } catch (Exception e) { System.err.println(e.getMessage()); - e.printStackTrace(); + throw new RuntimeException(e); } } diff --git a/src/main/java/ldbc/snb/datagen/hadoop/writer/HdfsWriter.java b/src/main/java/ldbc/snb/datagen/hadoop/writer/HdfsWriter.java index 72d538742..39374371e 100644 --- a/src/main/java/ldbc/snb/datagen/hadoop/writer/HdfsWriter.java +++ b/src/main/java/ldbc/snb/datagen/hadoop/writer/HdfsWriter.java @@ -81,7 +81,7 @@ public void write(String entry) { currentPartition = ++currentPartition % numPartitions; } catch (IOException e) { System.out.println("Cannot write to output file "); - e.printStackTrace(); + throw new RuntimeException(e); } } @@ -92,7 +92,7 @@ public void writeAllPartitions(String entry) { } } catch (IOException e) { System.out.println("Cannot write to output file "); - e.printStackTrace(); + throw new RuntimeException(e); } } diff --git a/src/main/java/ldbc/snb/datagen/util/ConfigParser.java b/src/main/java/ldbc/snb/datagen/util/ConfigParser.java index 98407fe3d..0f999feca 100644 --- a/src/main/java/ldbc/snb/datagen/util/ConfigParser.java +++ b/src/main/java/ldbc/snb/datagen/util/ConfigParser.java @@ -162,8 +162,7 @@ public static Configuration readConfig(Configuration conf, InputStream paramStre } } catch (Exception e) { System.err.println(e.getMessage()); - e.printStackTrace(); - System.exit(-1); + throw new RuntimeException(e); } return conf; } diff --git a/src/main/java/ldbc/snb/datagen/util/Distribution.java b/src/main/java/ldbc/snb/datagen/util/Distribution.java index 655904fce..ed5e7b613 100644 --- a/src/main/java/ldbc/snb/datagen/util/Distribution.java +++ b/src/main/java/ldbc/snb/datagen/util/Distribution.java @@ -70,7 +70,7 @@ public void initialize() { ++index; } } catch (IOException e) { - e.printStackTrace(); + throw new RuntimeException(e); } } diff --git a/src/main/java/ldbc/snb/datagen/util/DistributionKey.java b/src/main/java/ldbc/snb/datagen/util/DistributionKey.java index ad8c81a15..1401ad53d 100644 --- a/src/main/java/ldbc/snb/datagen/util/DistributionKey.java +++ b/src/main/java/ldbc/snb/datagen/util/DistributionKey.java @@ -94,7 +94,7 @@ public void initialize() { } } catch (IOException e) { - e.printStackTrace(); + throw new RuntimeException(e); } } diff --git a/src/main/java/ldbc/snb/datagen/util/FactorTable.java b/src/main/java/ldbc/snb/datagen/util/FactorTable.java index 05fb6325a..537607220 100644 --- a/src/main/java/ldbc/snb/datagen/util/FactorTable.java +++ b/src/main/java/ldbc/snb/datagen/util/FactorTable.java @@ -403,11 +403,11 @@ public void writePersonFactors(OutputStream writer) { } catch (AssertionError e) { System.err.println("Unable to write parameter counts"); System.err.println(e.getMessage()); - e.printStackTrace(); + throw new RuntimeException(e); } catch (IOException e) { System.err.println("Unable to write parameter counts"); System.err.println(e.getMessage()); - e.printStackTrace(); + throw new RuntimeException(e); } } @@ -474,7 +474,6 @@ public void writeActivityFactors(OutputStream writer) throws IOException { } catch (IOException e) { System.err.println("Unable to write parameter counts"); System.err.println(e.getMessage()); - e.printStackTrace(); throw e; } } diff --git a/src/test/java/ldbc/snb/datagen/test/LdbcDatagenTest.java b/src/test/java/ldbc/snb/datagen/test/LdbcDatagenTest.java index 98af64281..ec711d95f 100644 --- a/src/test/java/ldbc/snb/datagen/test/LdbcDatagenTest.java +++ b/src/test/java/ldbc/snb/datagen/test/LdbcDatagenTest.java @@ -41,7 +41,6 @@ public static void generateData() throws Exception { LdbcDatagen datagen = new LdbcDatagen(); datagen.runGenerateJob(conf); } catch (Exception e) { - e.printStackTrace(); throw e; } }