Open quadrophobiac opened 9 years ago
The error is caused by nil being passed to self.validate
for $arg io
This results in
validator = Csvlint::Validator.new( io, dialect, schema && schema.fields.empty? ? nil : schema )
receiving io as nil, which results in the@source
instance variable within CSVLint Gem > validate.rb, causing the method validate
to return the errors which are at the root of this issue
Comparison backtraces
#0 Csvlint::Validator.parse_extension(source#Tempfile) at /Users/stephenfortune/Documents/csvlint.rb/lib/csvlint/validate.rb:252
#1 Csvlint::Validator.initialize(source#Tempfile, dialect#Hash, schema#NilClass, options#Hash) at /Users/stephenfortune/Documents/csvlint.rb/lib/csvlint/validate.rb:34
#2 Class.new(*args) at /Users/stephenfortune/Documents/csvlint/app/models/validation.rb:35
#3 #<Class:Validation>.validate(io#Tempfile, schema_url#NilClass, schema#NilClass, dialect#Hash) at /Users/stephenfortune/Documents/csvlint/app/models/validation.rb:35
#4 Validation.update_validation(dialect#Hash) at /Users/stephenfortune/Documents/csvlint/app/models/validation.rb:158
#5 ValidationController.update at /Users/stephenfortune/Documents/csvlint/app/controllers/validation_controller.rb:37
at this point self has a self.csv parameter
press revalidate button again crash
#0 Csvlint::Validator.parse_extension(source#NilClass) at /Users/stephenfortune/Documents/csvlint.rb/lib/csvlint/validate.rb:252
#1 Csvlint::Validator.initialize(source#NilClass, dialect#Hash, schema#NilClass, options#Hash) at /Users/stephenfortune/Documents/csvlint.rb/lib/csvlint/validate.rb:34
#2 Class.new(*args) at /Users/stephenfortune/Documents/csvlint/app/models/validation.rb:35
#3 #<Class:Validation>.validate(io#NilClass, schema_url#NilClass, schema#NilClass, dialect#Hash) at /Users/stephenfortune/Documents/csvlint/app/models/validation.rb:35
#4 Validation.update_validation(dialect#Hash) at /Users/stephenfortune/Documents/csvlint/app/models/validation.rb:158
#5 ValidationController.update at /Users/stephenfortune/Documents/csvlint/app/controllers/validation_controller.rb:37
Frame 5 is in validation controller, and in this state the csv_id
has been set to nil either because it doesn't retreive the Mongo record correctly or the Validation object has been shorn of its csv_id
parameter
Upon uploading CSV for validation (e.g. fixtures/revalidate.csv)
Stack trace reveals that on the three steps pass a different argument to the CSVlint Gem on each pass
Csvlint::Validator.parse_extension(source#StringIO)
Csvlint::Validator.initialize(source#StringIO, dialect#NilClass, schema#NilClass, options#Hash)
Csvlint::Validator.parse_extension(source#Tempfile)
Csvlint::Validator.initialize(source#Tempfile, dialect#Hash, schema#NilClass, options#Hash)
`Csvlint::Validator.initialize(source#NilClass, dialect#Hash, schema#NilClass, options#Hash)
Csvlint::Validator.parse_extension(source#NilClass)
likely cause of fault is
returning nil for both self.url and self.csv and the subsequent Validation.validate method having no rescue for it's io parameter equallying nil