akvo / akvo-flow-services

Akvo Flow service applications for reporting, bulk uploads and others
Other
4 stars 1 forks source link

java.lang.IllegalStateException: Cannot get a text value from a numeric cell #223

Closed dlebrero closed 4 years ago

dlebrero commented 6 years ago

https://sentry.io/akvo-foundation/flow-services/issues/612532827/

java.lang.IllegalStateException: Cannot get a text value from a numeric cell
  File "XSSFCell.java", line 845, in org.apache.poi.xssf.usermodel/typeMismatch
  File "XSSFCell.java", line 294, in org.apache.poi.xssf.usermodel/getRichStringCellValue
  File "XSSFCell.java", line 246, in org.apache.poi.xssf.usermodel/getStringCellValue
  ?, in sun.reflect/invoke
  File "DelegatingMethodAccessorImpl.java", line 43, in sun.reflect/invoke
...
(37 additional frame(s) were not displayed)

Job (DEFAULT.6E7A8201-687C-4A31-9AA6-3C5764D869E2 threw an exception.
stellanl commented 6 years ago

This one is really hard to track down without those 37 additional stack frames... I have found 4 instances of this error as Info-level log lines in the live server, but apart from a the URL being /upload not a hint about which instance/survey/etc it was processing at the time.

dlebrero commented 6 years ago

Added some additional logging at https://github.com/akvo/akvo-flow-services/issues/224

stellanl commented 6 years ago

The longer stacktrace (in Sentry) looks like this: XSSFCell.java in org.apache.poi.xssf.usermodel/typeMismatch at line 845 XSSFCell.java in org.apache.poi.xssf.usermodel/getRichStringCellValue at line 294 XSSFCell.java in org.apache.poi.xssf.usermodel/getStringCellValue at line 246 sun.reflect/invoke DelegatingMethodAccessorImpl.java in sun.reflect/invoke at line 43 Method.java in java.lang.reflect/invoke at line 498 Reflector.java in clojure.lang/invokeMatchingMethod at line 93 Reflector.java in clojure.lang/invokeNoArgInstanceMember at line 313 uploader.clj in akvo.flow-services.uploader/[fn] at line 127

Nothing I can do, since I don't know Clojure.

dlebrero commented 6 years ago

@stellanl happy to help but I would need to know what flow-services is supposed to do

stellanl commented 6 years ago

AFAIK, it's supposed to

  1. Check that the question numbers in the column headers all match questions in the survey(form) This has recently gotten more complicated since the repeatable groups moved to separate sheets. Sheets named "Group n" should be checked as well as the sheet named "Raw data". The relevant column headers have moved down from the first row to the second. For a column titled "nnn|foo" there may now also be one titled "nnn|foo--OTHER--"
  2. Call the verify() method which checks repeat counts etc.
  3. Call the executeImport() method.
dlebrero commented 6 years ago

Sorry, do not follow.

This particular issue is that the code is assuming that all the cells in the first row in the first sheet are Strings, but it seems that sometimes that it not the case.

I am going to change the code so that if the cell is a number, it will assume the number is the questionId.

I will also change the code so that any uncaught exception will result in the user being notified that the upload failed and a sentry alert to be sent.

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.