Skip to content
Snippets Groups Projects
Commit ef1f342d authored by Piotr Gawron's avatar Piotr Gawron
Browse files

fix on processing dates when date is invalid (too short)

parent 1c8487ac
No related branches found
No related tags found
1 merge request!1Appointments dev
......@@ -212,6 +212,9 @@ public abstract class SubjectParser {
result = result.replaceAll("cot", "08");
result = result.replaceAll("sep", "09");
result = result.replaceAll("oct", "10");
if (result.length() < 10) {
result = defaultDateString;
}
if (result.indexOf("/") >= 0) {
String tmp[] = result.split("/");
result = tmp[2] + "-" + tmp[1] + "-" + tmp[0];
......@@ -220,9 +223,6 @@ public abstract class SubjectParser {
String tmp[] = result.split("-");
result = tmp[2] + "-" + tmp[1] + "-" + tmp[0];
}
if (result.length() < 10) {
result = defaultDateString;
}
return result;
}
......
......@@ -74,6 +74,7 @@ public class LihControlMappingParserTest extends TestBase {
DATE_FORMATTER.parse(processor.fixDate("2016-aou-26"));
DATE_FORMATTER.parse(processor.fixDate("2016-avr-14"));
DATE_FORMATTER.parse(processor.fixDate("2016-fev-03"));
DATE_FORMATTER.parse(processor.fixDate("-","2016-01-01"));
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment