Jean-Francois Leveque

Correction étourderie (NPE), traces supplémentaires et logger.error à la place de printStackTrace

......@@ -68,12 +68,11 @@ public class PostprocessingApplication {
sampleItemIds.add(itemId);
sampleUserIds.add(userId);
if (!sampleItemUserIds.containsKey(itemId)) {
Set<Long> set = sampleItemUserIds.get(itemId);
// NPE !!!
Set<Long> set = new HashSet<>();
set.add(userId);
sampleItemUserIds.put(itemId, set);
} else {
Set<Long> set = new HashSet<>();
Set<Long> set = sampleItemUserIds.get(itemId);
set.add(userId);
sampleItemUserIds.put(itemId, set);
}
......@@ -87,10 +86,10 @@ public class PostprocessingApplication {
}
logger.trace("Nombre de couples item-user dans l'échantillon {}", sampleCoupleCount);
logger.trace("Nombre de couples item-user recommandables {}", sampleItemIds.size() * sampleUserIds.size() - sampleCoupleCount);
} catch (IOException e) {
//fixme use logger instead of e.printStackTrace() !!!
e.printStackTrace();
logger.error("analyzeSample IOException : {}", e.getStackTrace());
}
}
......@@ -112,8 +111,6 @@ public class PostprocessingApplication {
void loadParametersProperties() {
//fixme use logger instead of e.printStackTrace() !!!
Properties properties = new Properties();
InputStream in = null;
try {
......@@ -122,9 +119,9 @@ public class PostprocessingApplication {
properties.load(in);
in.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
logger.error("analyzeSample FileNotFoundException : {}", e.getStackTrace());
} catch (IOException e) {
e.printStackTrace();
logger.error("analyzeSample IOException : {}", e.getStackTrace());
}
this.properties = properties;
......