Prevent nullpointerexception in printing SQL query with params with a (supposed) incorrect number of parameters