Fix string validity check

This commit is contained in:
Louis Calas
2019-10-10 09:30:35 +02:00
parent cb5cb37bf0
commit 71e626c054
5 changed files with 78 additions and 55 deletions

View File

@@ -65,11 +65,11 @@ public class Read implements Callable <Void> {
public Read(PrintStream out) {
}
// public boolean isCsv(String file) {
// return file.endsWith(".csv");
//
// }
// Check de l'extension csv (à améliorer)
public boolean isCsv(String file) {
return file.endsWith(".csv");
}
@Override
@@ -138,7 +138,10 @@ public class Read implements Callable <Void> {
logger.debug("Source : "+source_path);
if (!isCsv(result_name)) {
result_name = result_name+".csv";
logger.info("Result file name changed to '"+result_name+"'");
}
@@ -147,9 +150,9 @@ public class Read implements Callable <Void> {
String filePath = new File("").getAbsolutePath();
// Instantie l'OCR
GestionnaireCopies ocr = new GestionnaireCopies("../"+directory_name);
// Instantie l'ocr
logger.debug("CSV initialized with : "+ocr.createHashMapforCSV()+" , "+config.getParam().get("Code")+" , "+result_name);

View File

@@ -36,7 +36,7 @@ public class GenerateCSV {
int nb = Character.getNumericValue(s.charAt(i));
if (nb <= 0 || nb >= 9) {
if (nb < 0 || nb > 9) {
logger.fatal("Student id's characters are not recognized");
return false;
@@ -72,12 +72,12 @@ public class GenerateCSV {
// Si etudiant HashMap est null, pas ecrit
if (etud != null) {
//if (this.isValid(etud)) {
if (this.isValid(etud)) {
writer.write(etud + ";" + etudiants.get(etud) + System.getProperty("line.separator"));
//}
// else {
// logger.debug("Invalid id not added to csv");
// }
}
else {
logger.debug("Invalid id not added to csv");
}
} else {