Added guard to avoid to lose data in case of problems

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/accounting/accounting-aggregator-se-plugin@154623 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Luca Frosini 2017-09-26 14:55:39 +00:00
parent f01c2b819c
commit f954b7ff03
1 changed files with 6 additions and 0 deletions

View File

@ -64,6 +64,12 @@ public abstract class DocumentElaboration {
int elaboratedPercentage = elaborated*100/rowToBeElaborated;
logger.info("{} - Elaborated {} rows of {} (about {}%)", aggregationStatus.getAggregationInfo(), elaborated, rowToBeElaborated, elaboratedPercentage);
}
if(elaborated>rowToBeElaborated){
br.close();
in.close();
fstream.close();
throw new Exception("File line " + elaborated + " > " + rowToBeElaborated + ". This is really starnge and should not occur. Stopping execution");
}
}
logger.info("{} - Elaborated {} rows of {} ({}%)", aggregationStatus.getAggregationInfo(), elaborated, rowToBeElaborated, 100);