Skip to content

Commit 82080f9

Browse files
committed
#813 Fix PR suggestions.
1 parent 4a63b30 commit 82080f9

File tree

4 files changed

+26
-26
lines changed

4 files changed

+26
-26
lines changed

cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/decoders/DecoderSelector.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ object DecoderSelector {
217217
StringDecoders.decodeAsciiInt(_, !isSigned, isSigned || !strictSignOverpunch, !strictSignOverpunch, improvedNullDetection)
218218
} else if (integralType.precision <= Constants.maxLongPrecision) {
219219
if (isEbcidic)
220-
StringDecoders.decodeEbcdicLong(_, !isSigned, isSigned || !strictSignOverpunch, improvedNullDetection, !strictSignOverpunch)
220+
StringDecoders.decodeEbcdicLong(_, !isSigned, isSigned || !strictSignOverpunch, !strictSignOverpunch, improvedNullDetection)
221221
else
222222
StringDecoders.decodeAsciiLong(_, !isSigned, isSigned || !strictSignOverpunch, !strictSignOverpunch, improvedNullDetection)
223223
} else {

cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/decoders/StringDecoders.scala

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ object StringDecoders {
162162
* @param bytes A byte array that represents the binary data
163163
* @param isUnsigned If true, negative numbers will be considered invalid and return null
164164
* @param allowSignOverpunch If true, sign overpunching is allowed
165-
* @param relaxedOvepunch If true, multiple published signs are allowed. The last is going to be effective
165+
* @param relaxedOvepunch If true, multiple sign overpunching characters are allowed. The last one is going to be effective
166166
* @param improvedNullDetection If true, return null if all bytes are zero
167167
* @return A string representation of the binary data
168168
*/
@@ -235,7 +235,7 @@ object StringDecoders {
235235
* @param bytes A byte array that represents the binary data
236236
* @param isUnsigned If true, negative numbers will be considered invalid and return null
237237
* @param allowSignOverpunch If true, sign overpunching is allowed in first or last position
238-
* @param relaxedOvepunch If true, multiple published signs are allowed. The last is going to be effective
238+
* @param relaxedOvepunch If true, multiple sign overpunching characters are allowed. The last one is going to be effective
239239
* @param improvedNullDetection If true, return null if all bytes are zero
240240
* @return A string representation of the binary data
241241
*/
@@ -303,7 +303,7 @@ object StringDecoders {
303303
* @param bytes A byte array that represents the binary data
304304
* @param isUnsigned If true, negative numbers will be considered invalid and return null
305305
* @param allowSignOverpunch If true, sign overpunching is allowed
306-
* @param relaxedOvepunch If true, multiple published signs are allowed. The last is going to be effective
306+
* @param relaxedOvepunch If true, multiple sign overpunching characters are allowed. The last one is going to be effective
307307
* @param improvedNullDetection If true, return null if all bytes are zero
308308
* @return A boxed integer
309309
*/
@@ -321,7 +321,7 @@ object StringDecoders {
321321
* @param bytes A byte array that represents the binary data
322322
* @param isUnsigned If true, negative numbers will be considered invalid and return null
323323
* @param allowSignOverpunch If true, sign overpunching is allowed in first or last position
324-
* @param relaxedOvepunch If true, multiple published signs are allowed. The last is going to be effective
324+
* @param relaxedOvepunch If true, multiple sign overpunching characters are allowed. The last one is going to be effective
325325
* @param improvedNullDetection If true, return null if all bytes are zero
326326
* @return A boxed integer
327327
*/
@@ -339,11 +339,11 @@ object StringDecoders {
339339
* @param bytes A byte array that represents the binary data
340340
* @param isUnsigned If true, negative numbers will be considered invalid and return null
341341
* @param allowSignOverpunch If true, sign overpunching is allowed
342+
* @param relaxedOvepunch If true, multiple sign overpunching characters are allowed. The last one is going to be effective
342343
* @param improvedNullDetection If true, return null if all bytes are zero
343-
* @param relaxedOvepunch If true, multiple published signs are allowed. The last is going to be effective
344344
* @return A boxed long
345345
*/
346-
final def decodeEbcdicLong(bytes: Array[Byte], isUnsigned: Boolean, allowSignOverpunch: Boolean, improvedNullDetection: Boolean, relaxedOvepunch: Boolean): java.lang.Long = {
346+
final def decodeEbcdicLong(bytes: Array[Byte], isUnsigned: Boolean, allowSignOverpunch: Boolean, relaxedOvepunch: Boolean, improvedNullDetection: Boolean): java.lang.Long = {
347347
try {
348348
decodeEbcdicNumber(bytes, isUnsigned, allowSignOverpunch, relaxedOvepunch, improvedNullDetection).toLong
349349
} catch {
@@ -357,7 +357,7 @@ object StringDecoders {
357357
* @param bytes A byte array that represents the binary data
358358
* @param isUnsigned If true, negative numbers will be considered invalid and return null
359359
* @param allowSignOverpunch If true, sign overpunching is allowed in first or last position
360-
* @param relaxedOvepunch If true, multiple published signs are allowed. The last is going to be effective
360+
* @param relaxedOvepunch If true, multiple sign overpunching characters are allowed. The last one is going to be effective
361361
* @param improvedNullDetection If true, return null if all bytes are zero
362362
* @return A boxed long
363363
*/
@@ -375,7 +375,7 @@ object StringDecoders {
375375
* @param bytes A byte array that represents the binary data
376376
* @param isUnsigned If true, negative numbers will be considered invalid and return null
377377
* @param allowSignOverpunch If true, sign overpunching is allowed
378-
* @param relaxedOvepunch If true, multiple published signs are allowed. The last is going to be effective
378+
* @param relaxedOvepunch If true, multiple sign overpunching characters are allowed. The last one is going to be effective
379379
* @param improvedNullDetection If true, return null if all bytes are zero
380380
* @param scale A decimal scale in case decimal number with implicit decimal point is expected
381381
* @param scaleFactor Additional zeros to be added before of after the decimal point
@@ -395,7 +395,7 @@ object StringDecoders {
395395
* @param bytes A byte array that represents the binary data
396396
* @param isUnsigned If true, negative numbers will be considered invalid and return null
397397
* @param allowSignOverpunch If true, sign overpunching is allowed in first or last position
398-
* @param relaxedOvepunch If true, multiple published signs are allowed. The last is going to be effective
398+
* @param relaxedOvepunch If true, multiple sign overpunching characters are allowed. The last one is going to be effective
399399
* @param improvedNullDetection If true, return null if all bytes are zero
400400
* @param scale A decimal scale in case decimal number with implicit decimal point is expected
401401
* @param scaleFactor Additional zeros to be added before of after the decimal point
@@ -416,7 +416,7 @@ object StringDecoders {
416416
* @param bytes A byte array that represents the binary data
417417
* @param isUnsigned If true, negative numbers will be considered invalid and return null
418418
* @param allowSignOverpunch If true, sign overpunching is allowed in first or last position
419-
* @param relaxedOvepunch If true, multiple published signs are allowed. The last is going to be effective
419+
* @param relaxedOvepunch If true, multiple sign overpunching characters are allowed. The last one is going to be effective
420420
* @param improvedNullDetection If true, return null if all bytes are zero
421421
* @return A big decimal containing a big integral number
422422
*/
@@ -435,7 +435,7 @@ object StringDecoders {
435435
* @param bytes A byte array that represents the binary data
436436
* @param isUnsigned If true, negative numbers will be considered invalid and return null
437437
* @param allowSignOverpunch If true, sign overpunching is allowed in first or last position
438-
* @param relaxedOvepunch If true, multiple published signs are allowed. The last is going to be effective
438+
* @param relaxedOvepunch If true, multiple sign overpunching characters are allowed. The last one is going to be effective
439439
* @param improvedNullDetection If true, return null if all bytes are zero
440440
* @return A big decimal containing a big integral number
441441
*/

cobol-parser/src/test/scala/za/co/absa/cobrix/cobol/parser/decoders/StringDecodersSpec.scala

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -785,28 +785,28 @@ class StringDecodersSpec extends AnyWordSpec {
785785

786786
"decodeEbcdicLong()" should {
787787
"decode parsable longs" in {
788-
assert(decodeEbcdicLong(toEbcdic("+1000000000000000"), isUnsigned = false, allowSignOverpunch = true, improvedNullDetection = false, relaxedOvepunch = false) == 1000000000000000L)
789-
assert(decodeEbcdicLong(toEbcdic("1000000000000000+"), isUnsigned = false, allowSignOverpunch = true, improvedNullDetection = false, relaxedOvepunch = false) == 1000000000000000L)
790-
assert(decodeEbcdicLong(toEbcdic("-1000000000000000"), isUnsigned = false, allowSignOverpunch = true, improvedNullDetection = false, relaxedOvepunch = false) == -1000000000000000L)
791-
assert(decodeEbcdicLong(toEbcdic("1000000000000000-"), isUnsigned = false, allowSignOverpunch = true, improvedNullDetection = false, relaxedOvepunch = false) == -1000000000000000L)
788+
assert(decodeEbcdicLong(toEbcdic("+1000000000000000"), isUnsigned = false, allowSignOverpunch = true, relaxedOvepunch = false, improvedNullDetection = false) == 1000000000000000L)
789+
assert(decodeEbcdicLong(toEbcdic("1000000000000000+"), isUnsigned = false, allowSignOverpunch = true, relaxedOvepunch = false, improvedNullDetection = false) == 1000000000000000L)
790+
assert(decodeEbcdicLong(toEbcdic("-1000000000000000"), isUnsigned = false, allowSignOverpunch = true, relaxedOvepunch = false, improvedNullDetection = false) == -1000000000000000L)
791+
assert(decodeEbcdicLong(toEbcdic("1000000000000000-"), isUnsigned = false, allowSignOverpunch = true, relaxedOvepunch = false, improvedNullDetection = false) == -1000000000000000L)
792792
}
793793

794794
"decode unsigned numbers with sign" in {
795-
assert(decodeEbcdicLong(toEbcdic("+1000000000000000"), isUnsigned = true, allowSignOverpunch = true, improvedNullDetection = false, relaxedOvepunch = false) == 1000000000000000L)
796-
assert(decodeEbcdicLong(toEbcdic("1000000000000000+"), isUnsigned = true, allowSignOverpunch = true, improvedNullDetection = false, relaxedOvepunch = false) == 1000000000000000L)
797-
assert(decodeEbcdicLong(toEbcdic("-1000000000000000"), isUnsigned = true, allowSignOverpunch = true, improvedNullDetection = false, relaxedOvepunch = false) == null)
798-
assert(decodeEbcdicLong(toEbcdic("1000000000000000-"), isUnsigned = true, allowSignOverpunch = true, improvedNullDetection = false, relaxedOvepunch = false) == null)
795+
assert(decodeEbcdicLong(toEbcdic("+1000000000000000"), isUnsigned = true, allowSignOverpunch = true, relaxedOvepunch = false, improvedNullDetection = false) == 1000000000000000L)
796+
assert(decodeEbcdicLong(toEbcdic("1000000000000000+"), isUnsigned = true, allowSignOverpunch = true, relaxedOvepunch = false, improvedNullDetection = false) == 1000000000000000L)
797+
assert(decodeEbcdicLong(toEbcdic("-1000000000000000"), isUnsigned = true, allowSignOverpunch = true, relaxedOvepunch = false, improvedNullDetection = false) == null)
798+
assert(decodeEbcdicLong(toEbcdic("1000000000000000-"), isUnsigned = true, allowSignOverpunch = true, relaxedOvepunch = false, improvedNullDetection = false) == null)
799799
}
800800

801801
"return null on non-ints longs" in {
802-
assert(decodeEbcdicLong(toEbcdic("+1000000000000000,0"), isUnsigned = true, allowSignOverpunch = true, improvedNullDetection = false, relaxedOvepunch = false) == null)
803-
assert(decodeEbcdicLong(toEbcdic("1000000000000000.00+"), isUnsigned = false, allowSignOverpunch = true, improvedNullDetection = false, relaxedOvepunch = false) == null)
804-
assert(decodeEbcdicLong(toEbcdic("-1000000000000000,000"), isUnsigned = false, allowSignOverpunch = true, improvedNullDetection = false, relaxedOvepunch = false) == null)
805-
assert(decodeEbcdicLong(toEbcdic("1000000000000000.000-"), isUnsigned = false, allowSignOverpunch = true, improvedNullDetection = false, relaxedOvepunch = false) == null)
802+
assert(decodeEbcdicLong(toEbcdic("+1000000000000000,0"), isUnsigned = true, allowSignOverpunch = true, relaxedOvepunch = false, improvedNullDetection = false) == null)
803+
assert(decodeEbcdicLong(toEbcdic("1000000000000000.00+"), isUnsigned = false, allowSignOverpunch = true, relaxedOvepunch = false, improvedNullDetection = false) == null)
804+
assert(decodeEbcdicLong(toEbcdic("-1000000000000000,000"), isUnsigned = false, allowSignOverpunch = true, relaxedOvepunch = false, improvedNullDetection = false) == null)
805+
assert(decodeEbcdicLong(toEbcdic("1000000000000000.000-"), isUnsigned = false, allowSignOverpunch = true, relaxedOvepunch = false, improvedNullDetection = false) == null)
806806
}
807807

808808
"return null on unparsable longs" in {
809-
assert(decodeEbcdicLong(toEbcdic("AAA"), isUnsigned = false, allowSignOverpunch = true, improvedNullDetection = false, relaxedOvepunch = false) == null)
809+
assert(decodeEbcdicLong(toEbcdic("AAA"), isUnsigned = false, allowSignOverpunch = true, relaxedOvepunch = false, improvedNullDetection = false) == null)
810810
}
811811

812812
}

spark-cobol/src/test/scala/za/co/absa/cobrix/spark/cobol/source/regression/Test19SignOverpunching.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ class Test19SignOverpunching extends AnyWordSpec with SparkTestBase with BinaryF
168168
}
169169
}
170170

171-
"Test relaxed overpunchiung" when {
171+
"Test relaxed sign overpunching" when {
172172
val copybook =
173173
""" 01 R.
174174
05 A PIC S9(5)V9.

0 commit comments

Comments
 (0)