Skip to content

Commit

Permalink
Merge pull request #277 from qorelanguage/feature/276_FixedLengthUtil…
Browse files Browse the repository at this point in the history
…_param_checking

refs #276 added additional parameter checking to FixedLengthAbstractI…
  • Loading branch information
pvanek committed Dec 16, 2015
2 parents 2f1dcf3 + 32a093f commit ccedf75
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions qlib/FixedLengthUtil.qm
Expand Up @@ -237,6 +237,8 @@ public class FixedLengthUtil::FixedLengthAbstractIterator {
/**
@param spec Fixed-length line specification; see @ref fixedlengthspec for more information
@param opts Global options; see @ref fixedlengthglobals for more information

@throw FIXED-LENGTH-UTIL-INVALID-SPEC invalid record specification; invalid type or missing field length
*/
constructor(hash spec, *hash opts) {
m_specs = spec;
Expand All @@ -245,6 +247,8 @@ public class FixedLengthUtil::FixedLengthAbstractIterator {
# Determine line lengths of each spec, for use by the default identifyType() method. We do this by building a reverse length -> type table.
m_line_lengths = hash();
foreach string k in (m_specs.keyIterator()) {
if (m_specs{k}.typeCode() != NT_HASH)
throw "FIXED-LENGTH-UTIL-INVALID-SPEC", sprintf("expecting a record description hash assigned to record key %y; got type %y instead (value: %y)", k, m_specs{k}.type(), m_specs{k});
int len = 0;
foreach string c in (m_specs{k}.keyIterator()) {
if (!m_specs{k}{c}.length)
Expand Down

0 comments on commit ccedf75

Please sign in to comment.