Menu

#31 Excel Import fails for non-convertible fields

open-fixed
Bro
5
2007-06-17
2007-05-09
No

Forum entry: http://sourceforge.net/forum/forum.php?thread_id=1729680&forum_id=285354

1) The xls import fails (see output below), e.g. due to a non-convertible field (e.g. I tried to assign my running time to "Duration". It worked for fields specified in minutes, but it broke for fields specified as hh:mm:ss. Or when I forget to remove the header, it fails to assign the file size: the import aborts because it couldn't convert "Filesize" to a number.

Btw, what is the unit of "Duration"? Seconds? Minutes? it should assume Minutes, not seconds, by default.

I think, it should also recognize the "(h)h:mm:ss" format.

2) The import also failed for empty fields that needed conversion (e.g. I don't have duration entries in every field)

The expected behaviour in both cases would be, that Import leaves this one field empty and continue with the remaining fields in this entry. But instead, it aborts and throws an Exception.

Matthias

Discussion

  • Bro

    Bro - 2007-06-05
    • assigned_to: nobody --> bro3
    • status: open --> pending-fixed
     
  • Bro

    Bro - 2007-06-05

    Logged In: YES
    user_id=840074
    Originator: NO

    I'll update CVS with a fix shortly.

    It does not recognize formats such as "(h)h:mm:ss".

    It no longer fails on fields that must be converted.

     
  • Matthias Ihmig

    Matthias Ihmig - 2007-06-17

    Logged In: YES
    user_id=921651
    Originator: YES

    1) Import does not fail anymore, so I guess this is solved. I thought about creating a feature Request for the (h)h:mm:s import format, but I think right now, this is not of high importance. It should be enough if the required format in "Minutes" is documented somewhere...

    2) Empty fields work now, but there is one remaining problem:
    Import breaks, when one integer has only text (such as "unknown").
    Or I forgot to remove the first (index) line.
    (see output below for an example what happens in that case)
    (I tried to fix this myself, but I am a little confused how the importing is distributed over the java files and thus actually done, so I have to leave this to you.)

    3) Would it be possible to output the Conversion warnings not just to the console but also also into the Import Progress Dialog during import? this would be helpful to see why some numbers are not as expected.

    4) CVS Import works nicely, but I noticed that the header line is not visible (like it is when importing xls). this would be quite useful to make assigning the correct fields easier, and then let the user remove it.

    Thanks,

    Matthias

    ---------
    DEBUG ActionPerformed: Import
    DEBUG ActionPerformed: DialogAddMultipleMovies - Add Movies
    DEBUG ActionPerformed: DialogAddMultipleMovies - Add Movies
    DEBUG ActionPerformed: Start
    WARN net.sf.xmm.moviemanager.DialogImportTable$FieldModel.validateValue(DialogImportTable.java:549)
    Value:02:34:00 is not a integer as it should be.
    WARN net.sf.xmm.moviemanager.DialogImportTable$FieldModel.validateValue(DialogImportTable.java:551)
    Value trimmed to:023400
    WARN net.sf.xmm.moviemanager.DialogImportTable$FieldModel.validateValue(DialogImportTable.java:549)
    Value:01:23:00 is not a integer as it should be.
    WARN net.sf.xmm.moviemanager.DialogImportTable$FieldModel.validateValue(DialogImportTable.java:551)
    Value trimmed to:012300
    WARN net.sf.xmm.moviemanager.DialogImportTable$FieldModel.validateValue(DialogImportTable.java:549)
    Value:unbekannt is not a integer as it should be.
    WARN net.sf.xmm.moviemanager.DialogImportTable$FieldModel.validateValue(DialogImportTable.java:551)
    Value trimmed to:
    ERROR net.sf.xmm.moviemanager.DatabaseImporter$Importer.getMovieList(DatabaseImporter.java:442)

    java.lang.NumberFormatException: For input string: ""
    at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
    at java.lang.Integer.parseInt(Integer.java:468)
    at java.lang.Integer.parseInt(Integer.java:497)
    at net.sf.xmm.moviemanager.DialogImportTable$FieldModel.validateValue(DialogImportTable.java:558)
    at net.sf.xmm.moviemanager.DatabaseImporter$Importer.getMovieList(DatabaseImporter.java:426)
    at net.sf.xmm.moviemanager.DatabaseImporter$Importer.<init>(DatabaseImporter.java:150)
    at net.sf.xmm.moviemanager.DatabaseImporter$1.construct(DatabaseImporter.java:77)
    at net.sf.xmm.moviemanager.util.SwingWorker$2.run(SwingWorker.java:109)
    at java.lang.Thread.run(Thread.java:595)
    Exception occurred during event dispatching:
    java.lang.ArithmeticException: / by zero
    at net.sf.xmm.moviemanager.DialogDatabaseImporter$TimerListener.actionPerformed(DialogDatabaseImporter.java:143)
    at javax.swing.Timer.fireActionPerformed(Timer.java:271)
    at javax.swing.Timer$DoPostEvent.run(Timer.java:201)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:461)
    at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:153)
    at java.awt.Dialog$1.run(Dialog.java:525)
    at java.awt.Dialog$2.run(Dialog.java:553)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.awt.Dialog.show(Dialog.java:551)
    at java.awt.Component.show(Component.java:1300)
    at java.awt.Component.setVisible(Component.java:1253)
    at net.sf.xmm.moviemanager.util.GUIUtil$1.run(GUIUtil.java:38)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:461)
    at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
    DEBUG ActionPerformed: Cancel
    DEBUG ActionPerformed: Close

     
  • Matthias Ihmig

    Matthias Ihmig - 2007-06-17
    • status: pending-fixed --> open-fixed