Skip to content

Commit 8997831

Browse files
committed
Tidy up the code a bit.
1 parent 4b141ef commit 8997831

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

spark-cobol/src/main/scala/za/co/absa/cobrix/spark/cobol/parameters/CobolParametersParser.scala

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,8 @@ object CobolParametersParser extends Logging {
113113
val PARAM_RHP_ADDITIONAL_INFO = "rhp_additional_info"
114114
val PARAM_RE_ADDITIONAL_INFO = "re_additional_info"
115115
val PARAM_INPUT_FILE_COLUMN = "with_input_file_name_col"
116+
val PARAM_SEGMENT_REDEFINE_PREFIX = "redefine_segment_id_map"
117+
val PARAM_SEGMENT_REDEFINE_PREFIX_ALT = "redefine-segment-id-map"
116118

117119
// Indexed multisegment file processing
118120
val PARAM_ENABLE_INDEXES = "enable_indexes"
@@ -637,12 +639,12 @@ object CobolParametersParser extends Logging {
637639
params.getMap.flatMap {
638640
case (k, v) =>
639641
val keyNoCase = k.toLowerCase
640-
if (keyNoCase.startsWith("redefine-segment-id-map") ||
641-
keyNoCase.startsWith("redefine_segment_id_map")) {
642+
if (keyNoCase.startsWith(PARAM_SEGMENT_REDEFINE_PREFIX) ||
643+
keyNoCase.startsWith(PARAM_SEGMENT_REDEFINE_PREFIX_ALT)) {
642644
params.markUsed(k)
643645
val splitVal = v.split("\\=\\>")
644646
if (splitVal.lengthCompare(2) != 0) {
645-
throw new IllegalArgumentException(s"Illegal argument for the 'redefine-segment-id-map' option: '$v'.")
647+
throw new IllegalArgumentException(s"Illegal argument for the '$PARAM_SEGMENT_REDEFINE_PREFIX_ALT' option: '$v'.")
646648
}
647649
val redefine = splitVal(0).trim
648650
val segmentIds = splitVal(1).split(',').map(_.trim)

0 commit comments

Comments
 (0)