[JBoss JIRA] (ROASTER-107) Problems with generic types in MethodSource.setReturnType
by Kevin Mian Kraiker (JIRA)
[ https://issues.jboss.org/browse/ROASTER-107?page=com.atlassian.jira.plugi... ]
Kevin Mian Kraiker commented on ROASTER-107:
--------------------------------------------
JavaClassSource.toString() uses correct formatting (TreeMap<String, Object>), hence the note on inconsistency.
> Problems with generic types in MethodSource.setReturnType
> ---------------------------------------------------------
>
> Key: ROASTER-107
> URL: https://issues.jboss.org/browse/ROASTER-107
> Project: Roaster
> Issue Type: Bug
> Components: API, Formatter
> Affects Versions: 2.18.7.Final
> Reporter: Kevin Mian Kraiker
> Assignee: George Gastaldi
> Fix For: 2.19.0.Final
>
>
> When trying to set a method's return type, if there's a space between two generic types (for example as in TreeMap<String, Object>), an IllegalArgumentExeption gets thrown saying the identifier for the second type is invalid (because it includes the space character as part of it). If there's none, then the final formatted code has one, although the non-formatted one hasn't, which is inconsistent...
> {code:java}
> @Test
> public void throwsException() {
> JavaClassSource classSource = Roaster.create(JavaClassSource.class);
> MethodSource<JavaClassSource> newMethod = classSource.addMethod()
> .setName("tstMethod")
> .setPublic();
> newMethod.setReturnType("java.util.TreeMap<java.util.String, java.util.Object>"); // Counts space as part of the second type's name
> newMethod.setBody("return new TreeMap<String, Object>();");
> assertTrue(newMethod.getReturnType().toString().equals("TreeMap<String, Object>")); // If the exception wasn't thrown, this should pass.
> // Also, if there's no space - as in 'java.util.TreeMap<java.util.String,java.util.Object>', the class' formatted code has one but the above test would fail.
> }
> {code}
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)
8 years, 6 months
[JBoss JIRA] (ROASTER-107) Problems with generic types in MethodSource.setReturnType
by George Gastaldi (JIRA)
[ https://issues.jboss.org/browse/ROASTER-107?page=com.atlassian.jira.plugi... ]
George Gastaldi closed ROASTER-107.
-----------------------------------
Fix Version/s: 2.19.0.Final
Assignee: George Gastaldi
Resolution: Done
Fixed. Thank you!
> Problems with generic types in MethodSource.setReturnType
> ---------------------------------------------------------
>
> Key: ROASTER-107
> URL: https://issues.jboss.org/browse/ROASTER-107
> Project: Roaster
> Issue Type: Bug
> Components: API, Formatter
> Affects Versions: 2.18.7.Final
> Reporter: Kevin Mian Kraiker
> Assignee: George Gastaldi
> Fix For: 2.19.0.Final
>
>
> When trying to set a method's return type, if there's a space between two generic types (for example as in TreeMap<String, Object>), an IllegalArgumentExeption gets thrown saying the identifier for the second type is invalid (because it includes the space character as part of it). If there's none, then the final formatted code has one, although the non-formatted one hasn't, which is inconsistent...
> {code:java}
> @Test
> public void throwsException() {
> JavaClassSource classSource = Roaster.create(JavaClassSource.class);
> MethodSource<JavaClassSource> newMethod = classSource.addMethod()
> .setName("tstMethod")
> .setPublic();
> newMethod.setReturnType("java.util.TreeMap<java.util.String, java.util.Object>"); // Counts space as part of the second type's name
> newMethod.setBody("return new TreeMap<String, Object>();");
> assertTrue(newMethod.getReturnType().toString().equals("TreeMap<String, Object>")); // If the exception wasn't thrown, this should pass.
> // Also, if there's no space - as in 'java.util.TreeMap<java.util.String,java.util.Object>', the class' formatted code has one but the above test would fail.
> }
> {code}
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)
8 years, 6 months
[JBoss JIRA] (ROASTER-107) Problems with generic types in MethodSource.setReturnType
by George Gastaldi (JIRA)
[ https://issues.jboss.org/browse/ROASTER-107?page=com.atlassian.jira.plugi... ]
George Gastaldi commented on ROASTER-107:
-----------------------------------------
The {{toString}} for {{MethodSource}} and related objects may not be accurate. The output of {{JavaClassSource.toString()}} must be.
What is the output of {{JavaClassSource.toString()}} ?
Thank You
> Problems with generic types in MethodSource.setReturnType
> ---------------------------------------------------------
>
> Key: ROASTER-107
> URL: https://issues.jboss.org/browse/ROASTER-107
> Project: Roaster
> Issue Type: Bug
> Components: API, Formatter
> Affects Versions: 2.18.7.Final
> Reporter: Kevin Mian Kraiker
>
> When trying to set a method's return type, if there's a space between two generic types (for example as in TreeMap<String, Object>), an IllegalArgumentExeption gets thrown saying the identifier for the second type is invalid (because it includes the space character as part of it). If there's none, then the final formatted code has one, although the non-formatted one hasn't, which is inconsistent...
> {code:java}
> @Test
> public void throwsException() {
> JavaClassSource classSource = Roaster.create(JavaClassSource.class);
> MethodSource<JavaClassSource> newMethod = classSource.addMethod()
> .setName("tstMethod")
> .setPublic();
> newMethod.setReturnType("java.util.TreeMap<java.util.String, java.util.Object>"); // Counts space as part of the second type's name
> newMethod.setBody("return new TreeMap<String, Object>();");
> assertTrue(newMethod.getReturnType().toString().equals("TreeMap<String, Object>")); // If the exception wasn't thrown, this should pass.
> // Also, if there's no space - as in 'java.util.TreeMap<java.util.String,java.util.Object>', the class' formatted code has one but the above test would fail.
> }
> {code}
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)
8 years, 6 months
[JBoss JIRA] (ROASTER-107) Problems with generic types in MethodSource.setReturnType
by Kevin Mian Kraiker (JIRA)
Kevin Mian Kraiker created ROASTER-107:
------------------------------------------
Summary: Problems with generic types in MethodSource.setReturnType
Key: ROASTER-107
URL: https://issues.jboss.org/browse/ROASTER-107
Project: Roaster
Issue Type: Bug
Components: API, Formatter
Affects Versions: 2.18.7.Final
Reporter: Kevin Mian Kraiker
When trying to set a method's return type, if there's a space between two generic types (for example as in TreeMap<String, Object>), an IllegalArgumentExeption gets thrown saying the identifier for the second type is invalid (because it includes the space character as part of it). If there's none, then the final formatted code has one, although the non-formatted one hasn't, which is inconsistent...
{code:java}
@Test
public void throwsException() {
JavaClassSource classSource = Roaster.create(JavaClassSource.class);
MethodSource<JavaClassSource> newMethod = classSource.addMethod()
.setName("tstMethod")
.setPublic();
newMethod.setReturnType("java.util.TreeMap<java.util.String, java.util.Object>"); // Counts space as part of the second type's name
newMethod.setBody("return new TreeMap<String, Object>();");
assertTrue(newMethod.getReturnType().toString().equals("TreeMap<String, Object>")); // If the exception wasn't thrown, this should pass.
// Also, if there's no space - as in 'java.util.TreeMap<java.util.String,java.util.Object>', the class' formatted code has one but the above test would fail.
}
{code}
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)
8 years, 6 months
[JBoss JIRA] (FORGE-2636) No specified tables error
by George Gastaldi (JIRA)
[ https://issues.jboss.org/browse/FORGE-2636?page=com.atlassian.jira.plugin... ]
George Gastaldi commented on FORGE-2636:
----------------------------------------
Your JDBC url is also wrong, can you paste the command you executed? It does not look like the one I specified in https://issues.jboss.org/browse/FORGE-2636?focusedCommentId=13254791&page...
> No specified tables error
> -------------------------
>
> Key: FORGE-2636
> URL: https://issues.jboss.org/browse/FORGE-2636
> Project: Forge
> Issue Type: Bug
> Components: Database Tools, UI - Shell
> Affects Versions: 3.0.1.Final, 3.2.2.Final
> Environment: Windows 10, x64, Fedora 23
> Reporter: John Spencer
> Assignee: George Gastaldi
> Fix For: 3.x Future
>
>
> When I try to execute jpa-generate-entities-from-tables, using:
> Using windows 10 + mysql:
> {code:java}
> jpa-generate-entities-from-tables --database-tables * --jdbc-url "jdbc:mysql://localhost:3306/validDB" --user-name root --user-password 1234 --driver-location "validpath\mysql-connector-java-5.1.6-bin.jar" --driver-class com.mysql.jdbc.Driver;
> {code}
> Using fedora 23 + postgres:
> {code}
> jpa-generate-entities-from-tables --database-tables * --user-name validuser --user-password validpassword --jdbc-url jdbc:postgresql://localhost:5432/validDB --driver-location validpath/postgresql-9.4-1201-jdbc4.jar --verify-connection y --save-user-password y --driver-class 0 --hibernate-dialect 9
> {code}
> Forge asks me again to enter all of information specified in the command, I do so, and then says "At least one database table must be specified".
> Also the "--database-tables" parameter does not show up in the list of available parameters when pressing tab after having specified a connection profile and/or specifying connection parameters. This might possibly be related to this [issue] (https://issues.jboss.org/projects/FORGE/issues/FORGE-2635?filter=allopeni...).
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)
8 years, 6 months
[JBoss JIRA] (FORGE-2636) No specified tables error
by John Spencer (JIRA)
[ https://issues.jboss.org/browse/FORGE-2636?page=com.atlassian.jira.plugin... ]
John Spencer commented on FORGE-2636:
-------------------------------------
I transcribed it wrong but I used it correctly in my commands, I've been using --hibernate-dialect org.hibernate.dialect.H2Dialect and --driver-class org.h2.Driver as you specified.
> No specified tables error
> -------------------------
>
> Key: FORGE-2636
> URL: https://issues.jboss.org/browse/FORGE-2636
> Project: Forge
> Issue Type: Bug
> Components: Database Tools, UI - Shell
> Affects Versions: 3.0.1.Final, 3.2.2.Final
> Environment: Windows 10, x64, Fedora 23
> Reporter: John Spencer
> Assignee: George Gastaldi
> Fix For: 3.x Future
>
>
> When I try to execute jpa-generate-entities-from-tables, using:
> Using windows 10 + mysql:
> {code:java}
> jpa-generate-entities-from-tables --database-tables * --jdbc-url "jdbc:mysql://localhost:3306/validDB" --user-name root --user-password 1234 --driver-location "validpath\mysql-connector-java-5.1.6-bin.jar" --driver-class com.mysql.jdbc.Driver;
> {code}
> Using fedora 23 + postgres:
> {code}
> jpa-generate-entities-from-tables --database-tables * --user-name validuser --user-password validpassword --jdbc-url jdbc:postgresql://localhost:5432/validDB --driver-location validpath/postgresql-9.4-1201-jdbc4.jar --verify-connection y --save-user-password y --driver-class 0 --hibernate-dialect 9
> {code}
> Forge asks me again to enter all of information specified in the command, I do so, and then says "At least one database table must be specified".
> Also the "--database-tables" parameter does not show up in the list of available parameters when pressing tab after having specified a connection profile and/or specifying connection parameters. This might possibly be related to this [issue] (https://issues.jboss.org/projects/FORGE/issues/FORGE-2635?filter=allopeni...).
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)
8 years, 6 months
[JBoss JIRA] (FORGE-2636) No specified tables error
by George Gastaldi (JIRA)
[ https://issues.jboss.org/browse/FORGE-2636?page=com.atlassian.jira.plugin... ]
George Gastaldi edited comment on FORGE-2636 at 6/21/16 10:11 AM:
------------------------------------------------------------------
Hi John, Why are you saying that the driver class is the H2Dialect class? That does not make sense. It should point to the JDBC driver class.
See my last comment with the correct values for the option names.
was (Author: gastaldi):
Hi John, Why are you saying that the driver class is the H2Dialect class? That does not mae sense.
See my last comment with the correct values for the option names.
> No specified tables error
> -------------------------
>
> Key: FORGE-2636
> URL: https://issues.jboss.org/browse/FORGE-2636
> Project: Forge
> Issue Type: Bug
> Components: Database Tools, UI - Shell
> Affects Versions: 3.0.1.Final, 3.2.2.Final
> Environment: Windows 10, x64, Fedora 23
> Reporter: John Spencer
> Assignee: George Gastaldi
> Fix For: 3.x Future
>
>
> When I try to execute jpa-generate-entities-from-tables, using:
> Using windows 10 + mysql:
> {code:java}
> jpa-generate-entities-from-tables --database-tables * --jdbc-url "jdbc:mysql://localhost:3306/validDB" --user-name root --user-password 1234 --driver-location "validpath\mysql-connector-java-5.1.6-bin.jar" --driver-class com.mysql.jdbc.Driver;
> {code}
> Using fedora 23 + postgres:
> {code}
> jpa-generate-entities-from-tables --database-tables * --user-name validuser --user-password validpassword --jdbc-url jdbc:postgresql://localhost:5432/validDB --driver-location validpath/postgresql-9.4-1201-jdbc4.jar --verify-connection y --save-user-password y --driver-class 0 --hibernate-dialect 9
> {code}
> Forge asks me again to enter all of information specified in the command, I do so, and then says "At least one database table must be specified".
> Also the "--database-tables" parameter does not show up in the list of available parameters when pressing tab after having specified a connection profile and/or specifying connection parameters. This might possibly be related to this [issue] (https://issues.jboss.org/projects/FORGE/issues/FORGE-2635?filter=allopeni...).
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)
8 years, 6 months
[JBoss JIRA] (FORGE-2636) No specified tables error
by George Gastaldi (JIRA)
[ https://issues.jboss.org/browse/FORGE-2636?page=com.atlassian.jira.plugin... ]
George Gastaldi commented on FORGE-2636:
----------------------------------------
Hi John, Why are you saying that the driver class is the H2Dialect class? That does not mae sense.
See my last comment with the correct values for the option names.
> No specified tables error
> -------------------------
>
> Key: FORGE-2636
> URL: https://issues.jboss.org/browse/FORGE-2636
> Project: Forge
> Issue Type: Bug
> Components: Database Tools, UI - Shell
> Affects Versions: 3.0.1.Final, 3.2.2.Final
> Environment: Windows 10, x64, Fedora 23
> Reporter: John Spencer
> Assignee: George Gastaldi
> Fix For: 3.x Future
>
>
> When I try to execute jpa-generate-entities-from-tables, using:
> Using windows 10 + mysql:
> {code:java}
> jpa-generate-entities-from-tables --database-tables * --jdbc-url "jdbc:mysql://localhost:3306/validDB" --user-name root --user-password 1234 --driver-location "validpath\mysql-connector-java-5.1.6-bin.jar" --driver-class com.mysql.jdbc.Driver;
> {code}
> Using fedora 23 + postgres:
> {code}
> jpa-generate-entities-from-tables --database-tables * --user-name validuser --user-password validpassword --jdbc-url jdbc:postgresql://localhost:5432/validDB --driver-location validpath/postgresql-9.4-1201-jdbc4.jar --verify-connection y --save-user-password y --driver-class 0 --hibernate-dialect 9
> {code}
> Forge asks me again to enter all of information specified in the command, I do so, and then says "At least one database table must be specified".
> Also the "--database-tables" parameter does not show up in the list of available parameters when pressing tab after having specified a connection profile and/or specifying connection parameters. This might possibly be related to this [issue] (https://issues.jboss.org/projects/FORGE/issues/FORGE-2635?filter=allopeni...).
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)
8 years, 6 months
[JBoss JIRA] (FORGE-2636) No specified tables error
by John Spencer (JIRA)
[ https://issues.jboss.org/browse/FORGE-2636?page=com.atlassian.jira.plugin... ]
John Spencer commented on FORGE-2636:
-------------------------------------
I'm having trouble connecting to the db you provided, if I try:
cd ~/Downloads/sakila-h2-master
forge
project-new --named sample-project
jpa-setup
jpa-generate-entities-from-tables -jdbc-url jdbc:h2:tcp://localhost/~/sakila.h2.db --driver-location ~/sakila-h2-master/h2-1.4.192.jar --driver-class org.hibernate.dialect.H2Dialect
For some reason forge assumes ~/sakila-h2-master/h2-1.4.192.jar=/home/myUser/Downloads/sakila-h2-master/~/sakila-h2-master/h2-1.4.192.jar'
* Driver Location (The location of the jar file that contains the JDBC driver) [/home/myUser/Downloads/sakila-h2-master/~/sakila-h2-master/h2-1.4.192.jar]:
And I get:
***ERROR*** The location '/home/myUser/Downloads/sakila-h2-master/~/sakila-h2-master/h2-1.4.192.jar' does not exist
***ERROR*** Driver Class must be specified.
However if remove the ~ and just assume my working directory will be added to the path:
jpa-generate-entities-from-tables -jdbc-url sakila.h2.db --driver-location h2-1.4.192.jar --driver-class org.hibernate.dialect.H2Dialect
I get:
***ERROR*** Could not connect to database: JDBC URL [sakila.h2.db] is not compatible with the selected driver [org.h2.Driver].
So instead if I use:
jpa-generate-entities-from-tables -jdbc-url jdbc:h2:tcp://localhost/~/sakila.h2.db --driver-location h2-1.4.192.jar --driver-class org.hibernate.dialect.H2Dialect
I get:
***ERROR*** Could not connect to database: Connection refused
> No specified tables error
> -------------------------
>
> Key: FORGE-2636
> URL: https://issues.jboss.org/browse/FORGE-2636
> Project: Forge
> Issue Type: Bug
> Components: Database Tools, UI - Shell
> Affects Versions: 3.0.1.Final, 3.2.2.Final
> Environment: Windows 10, x64, Fedora 23
> Reporter: John Spencer
> Assignee: George Gastaldi
> Fix For: 3.x Future
>
>
> When I try to execute jpa-generate-entities-from-tables, using:
> Using windows 10 + mysql:
> {code:java}
> jpa-generate-entities-from-tables --database-tables * --jdbc-url "jdbc:mysql://localhost:3306/validDB" --user-name root --user-password 1234 --driver-location "validpath\mysql-connector-java-5.1.6-bin.jar" --driver-class com.mysql.jdbc.Driver;
> {code}
> Using fedora 23 + postgres:
> {code}
> jpa-generate-entities-from-tables --database-tables * --user-name validuser --user-password validpassword --jdbc-url jdbc:postgresql://localhost:5432/validDB --driver-location validpath/postgresql-9.4-1201-jdbc4.jar --verify-connection y --save-user-password y --driver-class 0 --hibernate-dialect 9
> {code}
> Forge asks me again to enter all of information specified in the command, I do so, and then says "At least one database table must be specified".
> Also the "--database-tables" parameter does not show up in the list of available parameters when pressing tab after having specified a connection profile and/or specifying connection parameters. This might possibly be related to this [issue] (https://issues.jboss.org/projects/FORGE/issues/FORGE-2635?filter=allopeni...).
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)
8 years, 6 months
[JBoss JIRA] (FORGE-2636) No specified tables error
by John Spencer (JIRA)
[ https://issues.jboss.org/browse/FORGE-2636?page=com.atlassian.jira.plugin... ]
John Spencer edited comment on FORGE-2636 at 6/20/16 5:00 PM:
--------------------------------------------------------------
>From IDEA, I've managed to successfully generate the entities from the table using the same settings as I was using before and selecting the tables on the second page of the wizard. I also tried creating a connection profile and managed to successfully generate the entities from the table again, by using forge's UI inside intellij. I then proceeded to use that same profile from the command line and failed with the same "At least one database table must be specified" error. This leads me to believe that the bug simply lays in that forge fails to ask (or take in as a param) for the tables from the command line and thus attempts to generate the entities without having any tables specified.
I haven't installed the h2 database you proposed but if the error is unreproduceable using that database then I suspect thats due to h2's nature (or actually, maybe not). I'll try to reproduce the error with the conditions you proposed and get back to you, as soon as I have the time.
was (Author: misterdee):
>From IDEA, I've managed to successfully generate the entities from the table using the same settings as I was using before and selecting the tables on the second page of the wizard. I also tried creating a connection profile and managed to successfully generate the entities from the table again, by using forge's UI inside intellij. I then proceeded to use that same profile from the command line and failed with the same "At least one database table must be specified" error. This leads me to believe that the bug simply lays in that forge fails to ask (or take in as a param) for the tables from the command line and thus attempts to generate the entities without having any tables specified.
I haven't installed the h2 database you proposed but if the error is unreproduceable using that database then I suspect thats due to h2's in-memory nature. I'll try to reproduce the error with the conditions you proposed and get back to you, as soon as I have the time.
> No specified tables error
> -------------------------
>
> Key: FORGE-2636
> URL: https://issues.jboss.org/browse/FORGE-2636
> Project: Forge
> Issue Type: Bug
> Components: Database Tools, UI - Shell
> Affects Versions: 3.0.1.Final, 3.2.2.Final
> Environment: Windows 10, x64, Fedora 23
> Reporter: John Spencer
> Assignee: George Gastaldi
> Fix For: 3.x Future
>
>
> When I try to execute jpa-generate-entities-from-tables, using:
> Using windows 10 + mysql:
> {code:java}
> jpa-generate-entities-from-tables --database-tables * --jdbc-url "jdbc:mysql://localhost:3306/validDB" --user-name root --user-password 1234 --driver-location "validpath\mysql-connector-java-5.1.6-bin.jar" --driver-class com.mysql.jdbc.Driver;
> {code}
> Using fedora 23 + postgres:
> {code}
> jpa-generate-entities-from-tables --database-tables * --user-name validuser --user-password validpassword --jdbc-url jdbc:postgresql://localhost:5432/validDB --driver-location validpath/postgresql-9.4-1201-jdbc4.jar --verify-connection y --save-user-password y --driver-class 0 --hibernate-dialect 9
> {code}
> Forge asks me again to enter all of information specified in the command, I do so, and then says "At least one database table must be specified".
> Also the "--database-tables" parameter does not show up in the list of available parameters when pressing tab after having specified a connection profile and/or specifying connection parameters. This might possibly be related to this [issue] (https://issues.jboss.org/projects/FORGE/issues/FORGE-2635?filter=allopeni...).
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)
8 years, 6 months