Skip to content

Commit f899488

Browse files
committed
#769 Fix PR nitpick suggestions from CoPilot PR review.
1 parent 64a2658 commit f899488

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

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

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -86,34 +86,36 @@ class Copybook(val ast: CopybookAST) extends Logging with Serializable {
8686
val ast = getFieldByName(fieldName)
8787
ast match {
8888
case s: Primitive => extractPrimitiveField(s, recordBytes, startOffset)
89-
case _ => throw new IllegalStateException(s"$fieldName is not a primitive field, cannot extract it's value.")
89+
case _ => throw new IllegalStateException(s"$fieldName is not a primitive field, cannot extract its value.")
9090
}
9191
}
9292

9393
/**
94-
* Set value of a field of the copybook record by name
94+
* Sets the value of a copybook record field specified by name.
9595
*
9696
* Nested field names can contain '.' to identify the exact field.
97-
* If the field name is unique '.' is not required.
97+
* If the field name is unique, '.' is not required.
98+
*
99+
* This method modifies the record in place and does not return a value.
98100
*
99101
* @param fieldName A field name
100102
* @param recordBytes Binary encoded data of the record
101-
* @param startOffset An offset where the record starts in the data (in bytes).
102-
* @return The value of the field
103+
* @param value The value to set
104+
* @param startOffset An offset where the record starts in the data (in bytes)
103105
*/
104-
def setFieldValueByName(fieldName: String, recordBytes: Array[Byte], value: Any, startOffset: Int = 0): Any = {
106+
def setFieldValueByName(fieldName: String, recordBytes: Array[Byte], value: Any, startOffset: Int = 0): Unit = {
105107
val ast = getFieldByName(fieldName)
106108
ast match {
107109
case s: Primitive => setPrimitiveField(s, recordBytes, value, startOffset)
108-
case _ => throw new IllegalStateException(s"$fieldName is not a primitive field, cannot set it's value.")
110+
case _ => throw new IllegalStateException(s"$fieldName is not a primitive field, cannot set its value.")
109111
}
110112
}
111113

112114
/**
113115
* Get the AST object of a field by name.
114116
*
115117
* Nested field names can contain '.' to identify the exact field.
116-
* If the field name is unique '.' is not required.
118+
* If the field name is unique, '.' is not required.
117119
*
118120
* @param fieldName A field name
119121
* @return An AST object of the field. Throws an IllegalStateException if not found of found multiple.

cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/processor/RecordProcessorBuilder.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ class RecordProcessorBuilder(copybookContents: String) {
104104
CobolParametersParser.getReaderProperties(cobolParameters, None)
105105
}
106106

107-
private[processor] def getRecordExtractor[T: ClassTag](readerParameters: ReaderParameters, inputStream: SimpleStream): RawRecordExtractor = {
107+
private[processor] def getRecordExtractor(readerParameters: ReaderParameters, inputStream: SimpleStream): RawRecordExtractor = {
108108
val dataStream = inputStream.copyStream()
109109
val headerStream = inputStream.copyStream()
110110

cobol-parser/src/test/scala/za/co/absa/cobrix/cobol/mock/ByteStreamMock.scala

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,7 @@
1616

1717
package za.co.absa.cobrix.cobol.mock
1818

19-
import za.co.absa.cobrix.cobol.reader.stream.{FSStream, SimpleStream}
20-
21-
import java.io.FileNotFoundException
19+
import za.co.absa.cobrix.cobol.reader.stream.SimpleStream
2220

2321
class ByteStreamMock(bytes: Array[Byte]) extends SimpleStream{
2422

0 commit comments

Comments
 (0)