Skip to content

Commit d33aebc

Browse files
author
Open Lowcode SAS
committed
Close #266
1 parent 1e5fcab commit d33aebc

File tree

2 files changed

+20
-19
lines changed

2 files changed

+20
-19
lines changed

src/org/openlowcode/server/data/loader/FlatFileLoader.java

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ public static boolean hasdata(Object[] parsedcsvline) {
133133
public static String buildExceptionMessage(Throwable t) {
134134
if (t == null)
135135
return "Null Exception (this is not normal)";
136-
return "Error: " + t.getClass().getName() + " - " + t.getMessage() + " @ " + t.getStackTrace()[0];
136+
return "Error: " + (t.getClass()!=null?t.getClass().getName():"Null Class") + " - " + t.getMessage() + " @ " + (t.getStackTrace()!=null?(t.getStackTrace().length>0?t.getStackTrace()[0]:"No element stack trace"):"Null Stack Trace");
137137
}
138138

139139
private FlatFileLoaderReport load(
@@ -156,8 +156,8 @@ private FlatFileLoaderReport load(
156156
ArrayList<FlatFileLoaderColumn<E>> loadercolumns = new ArrayList<FlatFileLoaderColumn<E>>();
157157
// custom loader helpers sorted by classname.
158158
HashMap<
159-
String,
160-
CustomloaderHelper<E>> activecustomloaderhelper = new HashMap<String, CustomloaderHelper<E>>();
159+
String,
160+
CustomloaderHelper<E>> activecustomloaderhelper = new HashMap<String, CustomloaderHelper<E>>();
161161
// line preparator is the column used to define if insert or update. There can
162162
// be zero or 1 column like that
163163
int linepreparatorindex = -1;
@@ -192,7 +192,7 @@ private FlatFileLoaderReport load(
192192
logger.severe(" "+thisalias+" - "+aliassolved);
193193
}
194194
logger.severe("-------------------------------------------------------------------------");
195-
195+
196196
throw new RuntimeException("Did not find any element for column '" + headlineelement + "' "
197197
+ (alias != null ? "(Alias '" + alias + "')" : ""));
198198
}
@@ -232,9 +232,9 @@ private FlatFileLoaderReport load(
232232
logger.info(
233233
" --- starting static preprocessing for object '" + objectdefinition.getName() + "' - ");
234234
ArrayList<
235-
HashMap<
236-
String,
237-
String>> uniquevaluesforstaticprocessing = new ArrayList<HashMap<String, String>>();
235+
HashMap<
236+
String,
237+
String>> uniquevaluesforstaticprocessing = new ArrayList<HashMap<String, String>>();
238238
for (int i = 0; i < columnswithstaticprocessing.size(); i++)
239239
uniquevaluesforstaticprocessing.add(new HashMap<String, String>());
240240
Object[] data = parser.parseOneLine();
@@ -275,7 +275,7 @@ private FlatFileLoaderReport load(
275275
}
276276
}
277277
logger.info(" --- finished static preprocessing for for object '" + objectdefinition.getName()
278-
+ "' - , read " + firstpass + " lines in file");
278+
+ "' - , read " + firstpass + " lines in file");
279279
}
280280
Object[] dataforloading = parser.parseOneLine();
281281
// ---- loop on data
@@ -298,9 +298,9 @@ private FlatFileLoaderReport load(
298298
boolean contentupdated = false;
299299
// adds criteria for selection
300300
ArrayList<
301-
FlatFileLoaderColumn.LinePreparationExtra<
302-
E>> linepreparatorextracriterias = new ArrayList<
303-
FlatFileLoaderColumn.LinePreparationExtra<E>>();
301+
FlatFileLoaderColumn.LinePreparationExtra<
302+
E>> linepreparatorextracriterias = new ArrayList<
303+
FlatFileLoaderColumn.LinePreparationExtra<E>>();
304304
for (int i = 0; i < linepreparatorextraindex.size(); i++) {
305305
FlatFileLoaderColumn<E> thiscolumn = loadercolumns.get(linepreparatorextraindex.get(i));
306306
linepreparatorextracriterias.add(thiscolumn
@@ -317,7 +317,7 @@ private FlatFileLoaderReport load(
317317
if (dataforloading.length <= linepreparatorindex)
318318
throw new RuntimeException(
319319
"loooking for line preparator index at index = " + linepreparatorindex
320-
+ " but line only has length = " + dataforloading.length);
320+
+ " but line only has length = " + dataforloading.length);
321321
FlatFileLoaderColumn<E> thiscolumn = loadercolumns.get(linepreparatorindex);
322322
LinePreparation<E> thislineprep = thiscolumn.LinePreparation(
323323
dataforloading[linepreparatorindex], linepreparatorextracriterias);
@@ -386,7 +386,7 @@ private FlatFileLoaderReport load(
386386

387387
// ---------- runs multi-field checks and constraints
388388
objectforprocessing.getDefinitionFromObject()
389-
.checkMultiFieldConstraints(objectforprocessing);
389+
.checkMultiFieldConstraints(objectforprocessing);
390390

391391
if (thislineupdate)
392392
if (contentupdated) {
@@ -709,7 +709,7 @@ public static String parseObject(Object object, String context) {
709709
return value;
710710
}
711711
throw new RuntimeException("For " + context + ", received an object of unsupported type = " + object.getClass()
712-
+ " value = " + object);
712+
+ " value = " + object);
713713

714714
}
715715

@@ -728,7 +728,7 @@ public static String parseStringStrict(Object object, String context) {
728728
return value;
729729
}
730730
throw new RuntimeException("For " + context + ", received an object of unsupported type = " + value.getClass()
731-
+ " value = " + value);
731+
+ " value = " + value);
732732

733733
}
734734

@@ -776,7 +776,7 @@ public static Date parseDate(Object object, String context, boolean timeedit, Da
776776

777777
}
778778
throw new RuntimeException("For " + context + ", received an object of unsupported type = " + object.getClass()
779-
+ " value = " + object);
779+
+ " value = " + object);
780780

781781
}
782782

@@ -806,7 +806,7 @@ public static Integer parseInteger(Object object, String context) {
806806
}
807807
// --------------------- Else return error
808808
throw new RuntimeException("For " + context + ", received an object of unsupported type = " + object.getClass()
809-
+ " value = " + object);
809+
+ " value = " + object);
810810
}
811811

812812
/**
@@ -847,7 +847,7 @@ public static BigDecimal parseDecimal(
847847
if (parsedbigdecimal.precision() > precision)
848848
throw new RuntimeException(
849849
"Trying to load a number with a precision too big " + parsedbigdecimal.precision()
850-
+ ", authorized precision = " + precision + ", number = " + parsedbigdecimal);
850+
+ ", authorized precision = " + precision + ", number = " + parsedbigdecimal);
851851
return parsedbigdecimal;
852852
}
853853
if (object instanceof String) {
@@ -864,7 +864,7 @@ public static BigDecimal parseDecimal(
864864
return parsedbigdecimal;
865865
}
866866
throw new RuntimeException("For " + context + ", received an object of unsupported type = " + object.getClass()
867-
+ " value = " + object);
867+
+ " value = " + object);
868868
}
869869

870870
/**

src/org/openlowcode/server/data/properties/HasmultidimensionalchildFlatFileLoaderHelper.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,7 @@ public boolean generateNewRowForContext(
326326
String value = secondaryvalues.get(i);
327327
logger.fine(" > Evaluating value "+value);
328328
MultichildValueHelper<F, ?, E> helper = secondvaluehelpers.get(i);
329+
helper.setContext(parent);
329330
boolean valid = helper.isTextValid(value, applocale, extraattributes);
330331
if (!valid) {
331332
logger.fine(" !!! INVALID !!! ");

0 commit comments

Comments
 (0)