jfmonteil / Pentaho-Google-Sheet-Plugin

Pentaho Google Sheet Plugin (API V4)
20 stars 17 forks source link

Pick Worksheet Id #2

Closed smalos closed 4 years ago

smalos commented 4 years ago

The plugin just works fine for me. Thanks a lot!

A small issue that already existed in previous versions. If you pick a Worksheet Id and cancel the dialog (without picking a value), an error is raised:

Argument cannot be null

You could try this fix: Add esd.open() !=null to check if the dialog was cancelled.

https://github.com/jfmonteil/Pentaho-Google-Sheet-Plugin/blob/0bf2ea63abf4dbf3b226b229d9ebec865e818764/src/main/java/org/pentaho/di/ui/trans/steps/pentahogooglesheets/PentahoGoogleSheetsPluginInputDialog.java#L515

if (esd.open() !=null) {
    if (esd.getSelectionIndeces().length > 0) {
        selectedSpreadsheet = esd.getSelectionIndeces()[0];
        File spreadsheet = spreadsheets.get(selectedSpreadsheet);
        spreadsheetKey.setText(spreadsheet.getId());
    } else {
        spreadsheetKey.setText("");
    }
}

The same goes for the Spreadsheet Key dialog.

jfmonteil commented 4 years ago

Thank you for your feedback, I have tryed applying the fix without success. Let me try again ;) Any more ideas welcome !

smalos commented 4 years ago

Just a shot in the dark: Check if selectedSpreadsheet !=null)

if (esd.open() !=null) {
    if (esd.getSelectionIndeces().length > 0) {
        selectedSpreadsheet = esd.getSelectionIndeces()[0];
                if (selectedSpreadsheet !=null){
            File spreadsheet = spreadsheets.get(selectedSpreadsheet);
           spreadsheetKey.setText(spreadsheet.getId());
                }
    } else {
        spreadsheetKey.setText("");
    }
}
jfmonteil commented 4 years ago

Fix delivered as 3.1, removing all depreciated classes seems to have had an effect

jfmonteil commented 4 years ago

3.1 available in 1 minute :)

smalos commented 4 years ago

Thanks, the error is gone with the latest update.