aubi opened a new issue, #7225: URL: https://github.com/apache/netbeans/issues/7225
### Apache NetBeans version Apache NetBeans 21 ### What happened I'm trying to create entities from a database (PostgreSQL). I have a defined Payara server, so NetBeans also try to load data sources from it. Unfortunately if fails to initialize. I can choose data sources, but it displays no tables. Netbeans log shows (unexpected) exception. I have a datasource, which defines properties: ``` serverName databaseName user password ``` The driver creates the URL itself and normally connects. On the other hand, Netbeans obviously expects URL, as in [DatabaseTablesPanel.java:352](https://github.com/apache/netbeans/blob/905ff7ef8344e372318751f6e93082a35da3b87f/java/j2ee.persistence/src/org/netbeans/modules/j2ee/persistence/wizard/fromdb/DatabaseTablesPanel.java#L352): ``` String databaseUrl = datasource.getUrl(); String user = datasource.getUsername(); for (DatabaseConnection dbconn : ConnectionManager.getDefault().getConnections()) { if (databaseUrl.equals(dbconn.getDatabaseURL())) { result.add(dbconn); } } ``` The line with `if(databaseUrl.equals...` throws NullPointerException. If I specify `url`, the wizard normally loads and displays content of the database. ### Language / Project Type / NetBeans Component Java Maven Web application project ### How to reproduce Connect Payara, create a datasource with `serverName`, `databaseName`, `user`, and `password`. Create a new Jakarta EE project, try _New_ -> _Entity Classes from Database_, select any data source -- no tables are displayed, Netbeans show "Unexpected error" in the `Notification`s tab. ### Did this work correctly in an earlier version? No / Don't know ### Operating System Linux, Debian/testing ### JDK OpenJDK 11 ### Apache NetBeans packaging Apache NetBeans Snap Package ### Anything else If it is an acceptable solution, it would be great to compose url from the parts. If not, just showing an error, what's wrong, is enough (so the user can fix it). And make the code resistant, so it doesn't break the whole functionality (it would be possible to load the tables from _Local Data Source_, but the current state breaks whole functionality. And honestly -- this is VERY useful feature! ### Are you willing to submit a pull request? Yes -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected] For further information about the NetBeans mailing lists, visit: https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
