Quantcast
Channel: Pentaho Community Forums
Viewing all articles
Browse latest Browse all 16689

Java Methode call doesn't work with string parameters

$
0
0
Hello,


i have trouble using the Java Methode Call Data Source. I found some posts related to this, but nothing realy helped.


My Java code is simply:
Code:



public class Java2Pentaho {


package de.spektra.infraview.statistics;


import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableModel;


public class Java2Pentaho {


    public static TableModel getTable(String hello, String world) {


        if (hello == null || world == null) {
            throw new NullPointerException("hello: " + hello + " world: " + world);
        }
       
        Object[] header = new Object[]{hello};
        Object[][]values = new Object[][]{{world}};
       
        return new DefaultTableModel(values, header);
    }
}


My Query in the Java Methode call window is:
de.spektra.infraview.statistics.Java2Pentaho#getTable("Hello","World")


The response is
java.lang.NullPointerException: hello: null world: null


So the problem is that i don't receive any parameters.




I also tried to generate pentaho parameters and pass them into the query:
Add Parameter:
- Name: var1
- Value Type: String
- Default Value: Hello
Add Parameter:
- Name: var2
- Value Type: String
- Default Value: World

query: de.spektra.infraview.statistics.Java2Pentaho#getTable(var1,var2)

i also tried with ""s around the values and with hidden parameters. Nothing seems to work.


Any help would be appreciated!

Viewing all articles
Browse latest Browse all 16689

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>