Skip to content
This repository has been archived by the owner on Aug 10, 2022. It is now read-only.

Exception when accessing CSV file. #38

Open
fringefilmsoz opened this issue Jun 24, 2021 · 8 comments
Open

Exception when accessing CSV file. #38

fringefilmsoz opened this issue Jun 24, 2021 · 8 comments

Comments

@fringefilmsoz
Copy link

Receiving an error when attempting to open a rather large CSV file in either explorer or ARFF viewer. This is causing the conversion to fail.

Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: class javax.swing.plaf.basic.BasicFileChooserUI$AcceptAllFileFilter cannot be cast to class weka.gui.ExtensionFileFilterWithClass (javax.swing.plaf.basic.BasicFileChooserUI$AcceptAllFileFilter is in module java.desktop of loader 'bootstrap'; weka.gui.ExtensionFileFilterWithClass is in unnamed module of loader 'app')
        weka.gui.ConverterFileChooser.configureCurrentConverter(ConverterFileChooser.java:743)
        weka.gui.ConverterFileChooser.showOpenDialog(ConverterFileChooser.java:553)
        weka.gui.arffviewer.ArffViewerMainPanel.loadFile(ArffViewerMainPanel.java:659)
        weka.gui.arffviewer.ArffViewerMainPanel.actionPerformed(ArffViewerMainPanel.java:1069)
        java.desktop/javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
        java.desktop/javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
        java.desktop/javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
        java.desktop/javax.swing.DefaultButtonModel.setPressed(Unknown Source)
        java.desktop/javax.swing.AbstractButton.doClick(Unknown Source)
        java.desktop/javax.swing.plaf.basic.BasicMenuItemUI.doClick(Unknown Source)
        java.desktop/javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(Unknown Source)
        java.desktop/java.awt.Component.processMouseEvent(Unknown Source)
        java.desktop/javax.swing.JComponent.processMouseEvent(Unknown Source)
        java.desktop/java.awt.Component.processEvent(Unknown Source)
        java.desktop/java.awt.Container.processEvent(Unknown Source)
        java.desktop/java.awt.Component.dispatchEventImpl(Unknown Source)
        java.desktop/java.awt.Container.dispatchEventImpl(Unknown Source)
        java.desktop/java.awt.Component.dispatchEvent(Unknown Source)
        java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
        java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
        java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
        java.desktop/java.awt.Container.dispatchEventImpl(Unknown Source)
        java.desktop/java.awt.Window.dispatchEventImpl(Unknown Source)
        java.desktop/java.awt.Component.dispatchEvent(Unknown Source)
        java.desktop/java.awt.EventQueue.dispatchEventImpl(Unknown Source)
        java.desktop/java.awt.EventQueue$4.run(Unknown Source)
        java.desktop/java.awt.EventQueue$4.run(Unknown Source)
        java.base/java.security.AccessController.doPrivileged(Native Method)
        java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
        java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
        java.desktop/java.awt.EventQueue$5.run(Unknown Source)
        java.desktop/java.awt.EventQueue$5.run(Unknown Source)
        java.base/java.security.AccessController.doPrivileged(Native Method)
        java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
        java.desktop/java.awt.EventQueue.dispatchEvent(Unknown Source)
        java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
        java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
        java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
        java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
        java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
        java.desktop/java.awt.EventDispatchThread.run(Unknown Source)

        at weka.gui.ConverterFileChooser.configureCurrentConverter(ConverterFileChooser.java:743)
        at weka.gui.ConverterFileChooser.showOpenDialog(ConverterFileChooser.java:553)
        at weka.gui.arffviewer.ArffViewerMainPanel.loadFile(ArffViewerMainPanel.java:659)
        at weka.gui.arffviewer.ArffViewerMainPanel.actionPerformed(ArffViewerMainPanel.java:1069)
        at java.desktop/javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
        at java.desktop/javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
        at java.desktop/javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
        at java.desktop/javax.swing.DefaultButtonModel.setPressed(Unknown Source)
        at java.desktop/javax.swing.AbstractButton.doClick(Unknown Source)
        at java.desktop/javax.swing.plaf.basic.BasicMenuItemUI.doClick(Unknown Source)
        at java.desktop/javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(Unknown Source)
        at java.desktop/java.awt.Component.processMouseEvent(Unknown Source)
        at java.desktop/javax.swing.JComponent.processMouseEvent(Unknown Source)
        at java.desktop/java.awt.Component.processEvent(Unknown Source)
        at java.desktop/java.awt.Container.processEvent(Unknown Source)
        at java.desktop/java.awt.Component.dispatchEventImpl(Unknown Source)
        at java.desktop/java.awt.Container.dispatchEventImpl(Unknown Source)
        at java.desktop/java.awt.Component.dispatchEvent(Unknown Source)
        at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
        at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
        at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
        at java.desktop/java.awt.Container.dispatchEventImpl(Unknown Source)
        at java.desktop/java.awt.Window.dispatchEventImpl(Unknown Source)
        at java.desktop/java.awt.Component.dispatchEvent(Unknown Source)
        at java.desktop/java.awt.EventQueue.dispatchEventImpl(Unknown Source)
        at java.desktop/java.awt.EventQueue$4.run(Unknown Source)
        at java.desktop/java.awt.EventQueue$4.run(Unknown Source)
        at java.base/java.security.AccessController.doPrivileged(Native Method)
        at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
        at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
        at java.desktop/java.awt.EventQueue$5.run(Unknown Source)
        at java.desktop/java.awt.EventQueue$5.run(Unknown Source)
        at java.base/java.security.AccessController.doPrivileged(Native Method)
        at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
        at java.desktop/java.awt.EventQueue.dispatchEvent(Unknown Source)
        at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
        at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
        at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
        at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
        at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
        at java.desktop/java.awt.EventDispatchThread.run(Unknown Source)
@fracpete
Copy link
Member

What Java version are you using? 16? If so, try using below 16, with 11 recommended.

@fringefilmsoz
Copy link
Author

I have a suspicion this is an issue with the CSV file. It has a text field which contained a ' as in O'Brien.

@fracpete
Copy link
Member

You can try the unofficial common-csv-weka-package instead of Weka's own CSVLoader for loading that CSV file.

@fringefilmsoz
Copy link
Author

@fracpete I've installed. Do i run from simpleCLI like so?
image

@fracpete
Copy link
Member

Personally, I'd use the loader in the Weka Explorer rather than in the SimpleCLI (makes it also easier to tweak options for the loader). The full classname is:

weka.core.converters.CommonCSVLoader <file.csv>

It's possible that you can also use partial classnames (not verified, I don't use the SimpleCLI):

.CommonCSVLoader <file.csv>

@fringefilmsoz
Copy link
Author

Continue to receive errors on attempting to import a file.

These are very large files.

Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: class javax.swing.plaf.basic.BasicFileChooserUI$AcceptAllFileFilter cannot be cast to class weka.gui.ExtensionFileFilterWithClass (javax.swing.plaf.basic.BasicFileChooserUI$AcceptAllFileFilter is in module java.desktop of loader 'bootstrap'; weka.gui.ExtensionFileFilterWithClass is in unnamed module of loader 'app')
weka.gui.ConverterFileChooser.configureCurrentConverter(ConverterFileChooser.java:743)
weka.gui.ConverterFileChooser.showOpenDialog(ConverterFileChooser.java:553)
weka.gui.explorer.PreprocessPanel.setInstancesFromFileQ(PreprocessPanel.java:1004)
weka.gui.explorer.PreprocessPanel$5.actionPerformed(PreprocessPanel.java:341)
java.desktop/javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
java.desktop/javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
java.desktop/javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
java.desktop/javax.swing.DefaultButtonModel.setPressed(Unknown Source)
java.desktop/javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
java.desktop/java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
java.desktop/java.awt.Component.processMouseEvent(Unknown Source)
java.desktop/javax.swing.JComponent.processMouseEvent(Unknown Source)
java.desktop/java.awt.Component.processEvent(Unknown Source)
java.desktop/java.awt.Container.processEvent(Unknown Source)
java.desktop/java.awt.Component.dispatchEventImpl(Unknown Source)
java.desktop/java.awt.Container.dispatchEventImpl(Unknown Source)
java.desktop/java.awt.Component.dispatchEvent(Unknown Source)
java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
java.desktop/java.awt.Container.dispatchEventImpl(Unknown Source)
java.desktop/java.awt.Window.dispatchEventImpl(Unknown Source)
java.desktop/java.awt.Component.dispatchEvent(Unknown Source)
java.desktop/java.awt.EventQueue.dispatchEventImpl(Unknown Source)
java.desktop/java.awt.EventQueue$4.run(Unknown Source)
java.desktop/java.awt.EventQueue$4.run(Unknown Source)
java.base/java.security.AccessController.doPrivileged(Native Method)
java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
java.desktop/java.awt.EventQueue$5.run(Unknown Source)
java.desktop/java.awt.EventQueue$5.run(Unknown Source)
java.base/java.security.AccessController.doPrivileged(Native Method)
java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
java.desktop/java.awt.EventQueue.dispatchEvent(Unknown Source)
java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
java.desktop/java.awt.EventDispatchThread.run(Unknown Source)

    at weka.gui.ConverterFileChooser.configureCurrentConverter(ConverterFileChooser.java:743)
    at weka.gui.ConverterFileChooser.showOpenDialog(ConverterFileChooser.java:553)
    at weka.gui.explorer.PreprocessPanel.setInstancesFromFileQ(PreprocessPanel.java:1004)
    at weka.gui.explorer.PreprocessPanel$5.actionPerformed(PreprocessPanel.java:341)
    at java.desktop/javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
    at java.desktop/javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
    at java.desktop/javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
    at java.desktop/javax.swing.DefaultButtonModel.setPressed(Unknown Source)
    at java.desktop/javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
    at java.desktop/java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
    at java.desktop/java.awt.Component.processMouseEvent(Unknown Source)
    at java.desktop/javax.swing.JComponent.processMouseEvent(Unknown Source)
    at java.desktop/java.awt.Component.processEvent(Unknown Source)
    at java.desktop/java.awt.Container.processEvent(Unknown Source)
    at java.desktop/java.awt.Component.dispatchEventImpl(Unknown Source)
    at java.desktop/java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.desktop/java.awt.Component.dispatchEvent(Unknown Source)
    at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
    at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
    at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
    at java.desktop/java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.desktop/java.awt.Window.dispatchEventImpl(Unknown Source)
    at java.desktop/java.awt.Component.dispatchEvent(Unknown Source)
    at java.desktop/java.awt.EventQueue.dispatchEventImpl(Unknown Source)
    at java.desktop/java.awt.EventQueue$4.run(Unknown Source)
    at java.desktop/java.awt.EventQueue$4.run(Unknown Source)
    at java.base/java.security.AccessController.doPrivileged(Native Method)
    at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
    at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
    at java.desktop/java.awt.EventQueue$5.run(Unknown Source)
    at java.desktop/java.awt.EventQueue$5.run(Unknown Source)
    at java.base/java.security.AccessController.doPrivileged(Native Method)
    at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
    at java.desktop/java.awt.EventQueue.dispatchEvent(Unknown Source)
    at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.desktop/java.awt.EventDispatchThread.run(Unknown Source)

@fracpete
Copy link
Member

I'm not sure why you are getting the java.lang.ClassCastException. Have you tried using the CSV loader directly from the terminal rather than the GUI? What version of Java are you using? I recommend using 11.

@fringefilmsoz
Copy link
Author

fringefilmsoz commented Jun 29, 2021

I'm using the default Java that comes with the install, which the documentation indicates is JDK 11.

I'll try direct csv loading if i can work out the syntax.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants