[jira] [Commented] (OFBIZ-10645) Empty entity name should not be allowed in entity definition

2018-12-19 Thread Aditya Sharma (JIRA)


[ 
https://issues.apache.org/jira/browse/OFBIZ-10645?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16724898#comment-16724898
 ] 

Aditya Sharma commented on OFBIZ-10645:
---

Thanks [~mthl] :) I will test with your changes and commit soon.

> Empty entity name should not be allowed in entity definition
> 
>
> Key: OFBIZ-10645
> URL: https://issues.apache.org/jira/browse/OFBIZ-10645
> Project: OFBiz
>  Issue Type: Bug
>  Components: framework
>Affects Versions: Trunk, Release Branch 16.11, Release Branch 17.12
>Reporter: Ashish Kumar Pandey
>Assignee: Aditya Sharma
>Priority: Trivial
> Attachments: EntityMaintError.png, OFBIZ-10645-alternate.patch, 
> OFBIZ-10645.patch, OFBIZ-10645.patch, OFBIZ-10645_Various-Improvements.patch
>
>
> Present system allows empty name in entity definition due to which there 
> SQLException in console log and error on Entity Mantainence page.
> {code:java}
> 2018-11-10 14:43:45,522 |OFBiz-batch-3    |DatabaseUtil  
> |I| Error getting primary key info from database with null tableName, will 
> try other means: java.sql.SQLException: Table name can not be null
> 2018-11-10 14:43:45,522 |OFBiz-batch-1    |DatabaseUtil  
> |I| Error getting primary key info from database with null tableName, will 
> try other means: java.sql.SQLException: Table name can not be null
> 2018-11-10 14:43:45,522 |OFBiz-batch-2    |DatabaseUtil  
> |I| Error getting primary key info from database with null tableName, will 
> try other means: java.sql.SQLException: Table name can not be null
> 2018-11-10 14:44:06,198 |OFBiz-batch-2    |DatabaseUtil  
> |W| Entity [] has no table in the database
> 2018-11-10 14:44:06,243 |pool-3-thread-1  |DatabaseUtil  
> |E| SQL Exception while executing the following:
> CREATE TABLE OFBIZ. (TEST_ID VARCHAR(20) NOT NULL, LAST_UPDATED_STAMP 
> TIMESTAMP, LAST_UPDATED_TX_STAMP TIMESTAMP, CREATED_STAMP TIMESTAMP, 
> CREATED_TX_STAMP TIMESTAMP,  PRIMARY KEY (TEST_ID))
> Error was: java.sql.SQLSyntaxErrorException: Syntax error: Encountered "(" at 
> line 1, column 21.
> java.sql.SQLSyntaxErrorException: Syntax error: Encountered "(" at line 1, 
> column 21.
>     at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source) 
> ~[derby-10.14.1.0.jar:?]
>     at 
> org.apache.derby.impl.jdbc.EmbedStatement.executeLargeUpdate(Unknown Source) 
> ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.impl.jdbc.EmbedStatement.executeUpdate(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at 
> org.apache.commons.dbcp2.DelegatingStatement.executeUpdate(DelegatingStatement.java:234)
>  ~[commons-dbcp2-2.1.1.jar:2.1.1]
>     at 
> org.apache.commons.dbcp2.DelegatingStatement.executeUpdate(DelegatingStatement.java:234)
>  ~[commons-dbcp2-2.1.1.jar:2.1.1]
>     at 
> org.apache.ofbiz.entity.jdbc.DatabaseUtil.createTable(DatabaseUtil.java:1677) 
> [ofbiz.jar:?]
>     at 
> org.apache.ofbiz.entity.jdbc.DatabaseUtil$CreateTableCallable.call(DatabaseUtil.java:1516)
>  [ofbiz.jar:?]
>     at 
> org.apache.ofbiz.entity.jdbc.DatabaseUtil$CreateTableCallable.call(DatabaseUtil.java:1502)
>  [ofbiz.jar:?]
>     at java.util.concurrent.FutureTask.run(FutureTask.java:266) 
> [?:1.8.0_66]
>     at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
>  [?:1.8.0_66]
>     at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
>  [?:1.8.0_66]
>     at java.lang.Thread.run(Thread.java:745) [?:1.8.0_66]
> Caused by: org.apache.derby.iapi.error.StandardException: Syntax error: 
> Encountered "(" at line 1, column 21.
>     at org.apache.derby.iapi.error.StandardException.newException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.iapi.error.StandardException.newException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at 
> org.apache.derby.impl.sql.compile.ParserImpl.parseStatementOrSearchCondition(Unknown
>  

[jira] [Commented] (OFBIZ-10645) Empty entity name should not be allowed in entity definition

2018-12-19 Thread Mathieu Lirzin (JIRA)


[ 
https://issues.apache.org/jira/browse/OFBIZ-10645?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16724886#comment-16724886
 ] 

Mathieu Lirzin commented on OFBIZ-10645:


Hello [~aditya.sharma],

I have done some (untested) readability improvements in the 
[^OFBIZ-10645_Various-Improvements.patch] patch which is meant to be applied on 
top of yours. Most improvements besides the use of the 
[{{Optional#ifPresent}}|https://docs.oracle.com/javase/8/docs/api/java/util/Optional.html#ifPresent-java.util.function.Consumer-]
 method are only related to pre-existing code around your changes.

Otherwise your patch looks good to me.

Thanks

> Empty entity name should not be allowed in entity definition
> 
>
> Key: OFBIZ-10645
> URL: https://issues.apache.org/jira/browse/OFBIZ-10645
> Project: OFBiz
>  Issue Type: Bug
>  Components: framework
>Affects Versions: Trunk, Release Branch 16.11, Release Branch 17.12
>Reporter: Ashish Kumar Pandey
>Assignee: Aditya Sharma
>Priority: Trivial
> Attachments: EntityMaintError.png, OFBIZ-10645-alternate.patch, 
> OFBIZ-10645.patch, OFBIZ-10645.patch, OFBIZ-10645_Various-Improvements.patch
>
>
> Present system allows empty name in entity definition due to which there 
> SQLException in console log and error on Entity Mantainence page.
> {code:java}
> 2018-11-10 14:43:45,522 |OFBiz-batch-3    |DatabaseUtil  
> |I| Error getting primary key info from database with null tableName, will 
> try other means: java.sql.SQLException: Table name can not be null
> 2018-11-10 14:43:45,522 |OFBiz-batch-1    |DatabaseUtil  
> |I| Error getting primary key info from database with null tableName, will 
> try other means: java.sql.SQLException: Table name can not be null
> 2018-11-10 14:43:45,522 |OFBiz-batch-2    |DatabaseUtil  
> |I| Error getting primary key info from database with null tableName, will 
> try other means: java.sql.SQLException: Table name can not be null
> 2018-11-10 14:44:06,198 |OFBiz-batch-2    |DatabaseUtil  
> |W| Entity [] has no table in the database
> 2018-11-10 14:44:06,243 |pool-3-thread-1  |DatabaseUtil  
> |E| SQL Exception while executing the following:
> CREATE TABLE OFBIZ. (TEST_ID VARCHAR(20) NOT NULL, LAST_UPDATED_STAMP 
> TIMESTAMP, LAST_UPDATED_TX_STAMP TIMESTAMP, CREATED_STAMP TIMESTAMP, 
> CREATED_TX_STAMP TIMESTAMP,  PRIMARY KEY (TEST_ID))
> Error was: java.sql.SQLSyntaxErrorException: Syntax error: Encountered "(" at 
> line 1, column 21.
> java.sql.SQLSyntaxErrorException: Syntax error: Encountered "(" at line 1, 
> column 21.
>     at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source) 
> ~[derby-10.14.1.0.jar:?]
>     at 
> org.apache.derby.impl.jdbc.EmbedStatement.executeLargeUpdate(Unknown Source) 
> ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.impl.jdbc.EmbedStatement.executeUpdate(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at 
> org.apache.commons.dbcp2.DelegatingStatement.executeUpdate(DelegatingStatement.java:234)
>  ~[commons-dbcp2-2.1.1.jar:2.1.1]
>     at 
> org.apache.commons.dbcp2.DelegatingStatement.executeUpdate(DelegatingStatement.java:234)
>  ~[commons-dbcp2-2.1.1.jar:2.1.1]
>     at 
> org.apache.ofbiz.entity.jdbc.DatabaseUtil.createTable(DatabaseUtil.java:1677) 
> [ofbiz.jar:?]
>     at 
> org.apache.ofbiz.entity.jdbc.DatabaseUtil$CreateTableCallable.call(DatabaseUtil.java:1516)
>  [ofbiz.jar:?]
>     at 
> org.apache.ofbiz.entity.jdbc.DatabaseUtil$CreateTableCallable.call(DatabaseUtil.java:1502)
>  [ofbiz.jar:?]
>     at java.util.concurrent.FutureTask.run(FutureTask.java:266) 
> [?:1.8.0_66]
>     at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
>  [?:1.8.0_66]
>     at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
>  [?:1.8.0_66]
>     at java.lang.Thread.run(Thread.java:745) [?:1.8.0_66]
> Caused by: 

[jira] [Commented] (OFBIZ-10645) Empty entity name should not be allowed in entity definition

2018-12-19 Thread Aditya Sharma (JIRA)


[ 
https://issues.apache.org/jira/browse/OFBIZ-10645?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16724878#comment-16724878
 ] 

Aditya Sharma commented on OFBIZ-10645:
---

I will commit in a day if no conflicts.

> Empty entity name should not be allowed in entity definition
> 
>
> Key: OFBIZ-10645
> URL: https://issues.apache.org/jira/browse/OFBIZ-10645
> Project: OFBiz
>  Issue Type: Bug
>  Components: framework
>Affects Versions: Trunk, Release Branch 16.11, Release Branch 17.12
>Reporter: Ashish Kumar Pandey
>Assignee: Aditya Sharma
>Priority: Trivial
> Attachments: EntityMaintError.png, OFBIZ-10645-alternate.patch, 
> OFBIZ-10645.patch, OFBIZ-10645.patch
>
>
> Present system allows empty name in entity definition due to which there 
> SQLException in console log and error on Entity Mantainence page.
> {code:java}
> 2018-11-10 14:43:45,522 |OFBiz-batch-3    |DatabaseUtil  
> |I| Error getting primary key info from database with null tableName, will 
> try other means: java.sql.SQLException: Table name can not be null
> 2018-11-10 14:43:45,522 |OFBiz-batch-1    |DatabaseUtil  
> |I| Error getting primary key info from database with null tableName, will 
> try other means: java.sql.SQLException: Table name can not be null
> 2018-11-10 14:43:45,522 |OFBiz-batch-2    |DatabaseUtil  
> |I| Error getting primary key info from database with null tableName, will 
> try other means: java.sql.SQLException: Table name can not be null
> 2018-11-10 14:44:06,198 |OFBiz-batch-2    |DatabaseUtil  
> |W| Entity [] has no table in the database
> 2018-11-10 14:44:06,243 |pool-3-thread-1  |DatabaseUtil  
> |E| SQL Exception while executing the following:
> CREATE TABLE OFBIZ. (TEST_ID VARCHAR(20) NOT NULL, LAST_UPDATED_STAMP 
> TIMESTAMP, LAST_UPDATED_TX_STAMP TIMESTAMP, CREATED_STAMP TIMESTAMP, 
> CREATED_TX_STAMP TIMESTAMP,  PRIMARY KEY (TEST_ID))
> Error was: java.sql.SQLSyntaxErrorException: Syntax error: Encountered "(" at 
> line 1, column 21.
> java.sql.SQLSyntaxErrorException: Syntax error: Encountered "(" at line 1, 
> column 21.
>     at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source) 
> ~[derby-10.14.1.0.jar:?]
>     at 
> org.apache.derby.impl.jdbc.EmbedStatement.executeLargeUpdate(Unknown Source) 
> ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.impl.jdbc.EmbedStatement.executeUpdate(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at 
> org.apache.commons.dbcp2.DelegatingStatement.executeUpdate(DelegatingStatement.java:234)
>  ~[commons-dbcp2-2.1.1.jar:2.1.1]
>     at 
> org.apache.commons.dbcp2.DelegatingStatement.executeUpdate(DelegatingStatement.java:234)
>  ~[commons-dbcp2-2.1.1.jar:2.1.1]
>     at 
> org.apache.ofbiz.entity.jdbc.DatabaseUtil.createTable(DatabaseUtil.java:1677) 
> [ofbiz.jar:?]
>     at 
> org.apache.ofbiz.entity.jdbc.DatabaseUtil$CreateTableCallable.call(DatabaseUtil.java:1516)
>  [ofbiz.jar:?]
>     at 
> org.apache.ofbiz.entity.jdbc.DatabaseUtil$CreateTableCallable.call(DatabaseUtil.java:1502)
>  [ofbiz.jar:?]
>     at java.util.concurrent.FutureTask.run(FutureTask.java:266) 
> [?:1.8.0_66]
>     at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
>  [?:1.8.0_66]
>     at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
>  [?:1.8.0_66]
>     at java.lang.Thread.run(Thread.java:745) [?:1.8.0_66]
> Caused by: org.apache.derby.iapi.error.StandardException: Syntax error: 
> Encountered "(" at line 1, column 21.
>     at org.apache.derby.iapi.error.StandardException.newException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.iapi.error.StandardException.newException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at 
> org.apache.derby.impl.sql.compile.ParserImpl.parseStatementOrSearchCondition(Unknown
>  Source) ~[derby-10.14.1.0.jar:?]
>     at 
> 

[jira] [Commented] (OFBIZ-10645) Empty entity name should not be allowed in entity definition

2018-12-17 Thread Aditya Sharma (JIRA)


[ 
https://issues.apache.org/jira/browse/OFBIZ-10645?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16722984#comment-16722984
 ] 

Aditya Sharma commented on OFBIZ-10645:
---

Thanks [~jacques.le.roux] for the review :) 

> Empty entity name should not be allowed in entity definition
> 
>
> Key: OFBIZ-10645
> URL: https://issues.apache.org/jira/browse/OFBIZ-10645
> Project: OFBiz
>  Issue Type: Bug
>  Components: framework
>Affects Versions: Trunk, Release Branch 16.11, Release Branch 17.12
>Reporter: Ashish Kumar Pandey
>Assignee: Aditya Sharma
>Priority: Trivial
> Attachments: EntityMaintError.png, OFBIZ-10645-alternate.patch, 
> OFBIZ-10645.patch, OFBIZ-10645.patch
>
>
> Present system allows empty name in entity definition due to which there 
> SQLException in console log and error on Entity Mantainence page.
> {code:java}
> 2018-11-10 14:43:45,522 |OFBiz-batch-3    |DatabaseUtil  
> |I| Error getting primary key info from database with null tableName, will 
> try other means: java.sql.SQLException: Table name can not be null
> 2018-11-10 14:43:45,522 |OFBiz-batch-1    |DatabaseUtil  
> |I| Error getting primary key info from database with null tableName, will 
> try other means: java.sql.SQLException: Table name can not be null
> 2018-11-10 14:43:45,522 |OFBiz-batch-2    |DatabaseUtil  
> |I| Error getting primary key info from database with null tableName, will 
> try other means: java.sql.SQLException: Table name can not be null
> 2018-11-10 14:44:06,198 |OFBiz-batch-2    |DatabaseUtil  
> |W| Entity [] has no table in the database
> 2018-11-10 14:44:06,243 |pool-3-thread-1  |DatabaseUtil  
> |E| SQL Exception while executing the following:
> CREATE TABLE OFBIZ. (TEST_ID VARCHAR(20) NOT NULL, LAST_UPDATED_STAMP 
> TIMESTAMP, LAST_UPDATED_TX_STAMP TIMESTAMP, CREATED_STAMP TIMESTAMP, 
> CREATED_TX_STAMP TIMESTAMP,  PRIMARY KEY (TEST_ID))
> Error was: java.sql.SQLSyntaxErrorException: Syntax error: Encountered "(" at 
> line 1, column 21.
> java.sql.SQLSyntaxErrorException: Syntax error: Encountered "(" at line 1, 
> column 21.
>     at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source) 
> ~[derby-10.14.1.0.jar:?]
>     at 
> org.apache.derby.impl.jdbc.EmbedStatement.executeLargeUpdate(Unknown Source) 
> ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.impl.jdbc.EmbedStatement.executeUpdate(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at 
> org.apache.commons.dbcp2.DelegatingStatement.executeUpdate(DelegatingStatement.java:234)
>  ~[commons-dbcp2-2.1.1.jar:2.1.1]
>     at 
> org.apache.commons.dbcp2.DelegatingStatement.executeUpdate(DelegatingStatement.java:234)
>  ~[commons-dbcp2-2.1.1.jar:2.1.1]
>     at 
> org.apache.ofbiz.entity.jdbc.DatabaseUtil.createTable(DatabaseUtil.java:1677) 
> [ofbiz.jar:?]
>     at 
> org.apache.ofbiz.entity.jdbc.DatabaseUtil$CreateTableCallable.call(DatabaseUtil.java:1516)
>  [ofbiz.jar:?]
>     at 
> org.apache.ofbiz.entity.jdbc.DatabaseUtil$CreateTableCallable.call(DatabaseUtil.java:1502)
>  [ofbiz.jar:?]
>     at java.util.concurrent.FutureTask.run(FutureTask.java:266) 
> [?:1.8.0_66]
>     at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
>  [?:1.8.0_66]
>     at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
>  [?:1.8.0_66]
>     at java.lang.Thread.run(Thread.java:745) [?:1.8.0_66]
> Caused by: org.apache.derby.iapi.error.StandardException: Syntax error: 
> Encountered "(" at line 1, column 21.
>     at org.apache.derby.iapi.error.StandardException.newException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.iapi.error.StandardException.newException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at 
> org.apache.derby.impl.sql.compile.ParserImpl.parseStatementOrSearchCondition(Unknown
>  Source) ~[derby-10.14.1.0.jar:?]
>     at 
> 

[jira] [Commented] (OFBIZ-10645) Empty entity name should not be allowed in entity definition

2018-12-16 Thread Aditya Sharma (JIRA)


[ 
https://issues.apache.org/jira/browse/OFBIZ-10645?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16722710#comment-16722710
 ] 

Aditya Sharma commented on OFBIZ-10645:
---

Hi [~jacques.le.roux] [~mthl] ,
I have updated the patch. Please have a look.

> Empty entity name should not be allowed in entity definition
> 
>
> Key: OFBIZ-10645
> URL: https://issues.apache.org/jira/browse/OFBIZ-10645
> Project: OFBiz
>  Issue Type: Bug
>  Components: framework
>Affects Versions: Trunk, Release Branch 16.11, Release Branch 17.12
>Reporter: Ashish Kumar Pandey
>Assignee: Aditya Sharma
>Priority: Trivial
> Attachments: EntityMaintError.png, OFBIZ-10645-alternate.patch, 
> OFBIZ-10645.patch, OFBIZ-10645.patch
>
>
> Present system allows empty name in entity definition due to which there 
> SQLException in console log and error on Entity Mantainence page.
> {code:java}
> 2018-11-10 14:43:45,522 |OFBiz-batch-3    |DatabaseUtil  
> |I| Error getting primary key info from database with null tableName, will 
> try other means: java.sql.SQLException: Table name can not be null
> 2018-11-10 14:43:45,522 |OFBiz-batch-1    |DatabaseUtil  
> |I| Error getting primary key info from database with null tableName, will 
> try other means: java.sql.SQLException: Table name can not be null
> 2018-11-10 14:43:45,522 |OFBiz-batch-2    |DatabaseUtil  
> |I| Error getting primary key info from database with null tableName, will 
> try other means: java.sql.SQLException: Table name can not be null
> 2018-11-10 14:44:06,198 |OFBiz-batch-2    |DatabaseUtil  
> |W| Entity [] has no table in the database
> 2018-11-10 14:44:06,243 |pool-3-thread-1  |DatabaseUtil  
> |E| SQL Exception while executing the following:
> CREATE TABLE OFBIZ. (TEST_ID VARCHAR(20) NOT NULL, LAST_UPDATED_STAMP 
> TIMESTAMP, LAST_UPDATED_TX_STAMP TIMESTAMP, CREATED_STAMP TIMESTAMP, 
> CREATED_TX_STAMP TIMESTAMP,  PRIMARY KEY (TEST_ID))
> Error was: java.sql.SQLSyntaxErrorException: Syntax error: Encountered "(" at 
> line 1, column 21.
> java.sql.SQLSyntaxErrorException: Syntax error: Encountered "(" at line 1, 
> column 21.
>     at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source) 
> ~[derby-10.14.1.0.jar:?]
>     at 
> org.apache.derby.impl.jdbc.EmbedStatement.executeLargeUpdate(Unknown Source) 
> ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.impl.jdbc.EmbedStatement.executeUpdate(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at 
> org.apache.commons.dbcp2.DelegatingStatement.executeUpdate(DelegatingStatement.java:234)
>  ~[commons-dbcp2-2.1.1.jar:2.1.1]
>     at 
> org.apache.commons.dbcp2.DelegatingStatement.executeUpdate(DelegatingStatement.java:234)
>  ~[commons-dbcp2-2.1.1.jar:2.1.1]
>     at 
> org.apache.ofbiz.entity.jdbc.DatabaseUtil.createTable(DatabaseUtil.java:1677) 
> [ofbiz.jar:?]
>     at 
> org.apache.ofbiz.entity.jdbc.DatabaseUtil$CreateTableCallable.call(DatabaseUtil.java:1516)
>  [ofbiz.jar:?]
>     at 
> org.apache.ofbiz.entity.jdbc.DatabaseUtil$CreateTableCallable.call(DatabaseUtil.java:1502)
>  [ofbiz.jar:?]
>     at java.util.concurrent.FutureTask.run(FutureTask.java:266) 
> [?:1.8.0_66]
>     at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
>  [?:1.8.0_66]
>     at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
>  [?:1.8.0_66]
>     at java.lang.Thread.run(Thread.java:745) [?:1.8.0_66]
> Caused by: org.apache.derby.iapi.error.StandardException: Syntax error: 
> Encountered "(" at line 1, column 21.
>     at org.apache.derby.iapi.error.StandardException.newException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.iapi.error.StandardException.newException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at 
> org.apache.derby.impl.sql.compile.ParserImpl.parseStatementOrSearchCondition(Unknown
>  Source) ~[derby-10.14.1.0.jar:?]

[jira] [Commented] (OFBIZ-10645) Empty entity name should not be allowed in entity definition

2018-11-12 Thread Jacques Le Roux (JIRA)


[ 
https://issues.apache.org/jira/browse/OFBIZ-10645?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16684046#comment-16684046
 ] 

Jacques Le Roux commented on OFBIZ-10645:
-

bq. So we can proceed with only checking entity-name
Yes
bq.  loading such entities seems to be futile with these inferences. 
not sure what you mean :)


> Empty entity name should not be allowed in entity definition
> 
>
> Key: OFBIZ-10645
> URL: https://issues.apache.org/jira/browse/OFBIZ-10645
> Project: OFBiz
>  Issue Type: Bug
>  Components: framework
>Affects Versions: Trunk, Release Branch 16.11, Release Branch 17.12
>Reporter: Ashish Kumar Pandey
>Assignee: Aditya Sharma
>Priority: Trivial
> Attachments: EntityMaintError.png, OFBIZ-10645-alternate.patch, 
> OFBIZ-10645.patch
>
>
> Present system allows empty name in entity definition due to which there 
> SQLException in console log and error on Entity Mantainence page.
> {code:java}
> 2018-11-10 14:43:45,522 |OFBiz-batch-3    |DatabaseUtil  
> |I| Error getting primary key info from database with null tableName, will 
> try other means: java.sql.SQLException: Table name can not be null
> 2018-11-10 14:43:45,522 |OFBiz-batch-1    |DatabaseUtil  
> |I| Error getting primary key info from database with null tableName, will 
> try other means: java.sql.SQLException: Table name can not be null
> 2018-11-10 14:43:45,522 |OFBiz-batch-2    |DatabaseUtil  
> |I| Error getting primary key info from database with null tableName, will 
> try other means: java.sql.SQLException: Table name can not be null
> 2018-11-10 14:44:06,198 |OFBiz-batch-2    |DatabaseUtil  
> |W| Entity [] has no table in the database
> 2018-11-10 14:44:06,243 |pool-3-thread-1  |DatabaseUtil  
> |E| SQL Exception while executing the following:
> CREATE TABLE OFBIZ. (TEST_ID VARCHAR(20) NOT NULL, LAST_UPDATED_STAMP 
> TIMESTAMP, LAST_UPDATED_TX_STAMP TIMESTAMP, CREATED_STAMP TIMESTAMP, 
> CREATED_TX_STAMP TIMESTAMP,  PRIMARY KEY (TEST_ID))
> Error was: java.sql.SQLSyntaxErrorException: Syntax error: Encountered "(" at 
> line 1, column 21.
> java.sql.SQLSyntaxErrorException: Syntax error: Encountered "(" at line 1, 
> column 21.
>     at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source) 
> ~[derby-10.14.1.0.jar:?]
>     at 
> org.apache.derby.impl.jdbc.EmbedStatement.executeLargeUpdate(Unknown Source) 
> ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.impl.jdbc.EmbedStatement.executeUpdate(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at 
> org.apache.commons.dbcp2.DelegatingStatement.executeUpdate(DelegatingStatement.java:234)
>  ~[commons-dbcp2-2.1.1.jar:2.1.1]
>     at 
> org.apache.commons.dbcp2.DelegatingStatement.executeUpdate(DelegatingStatement.java:234)
>  ~[commons-dbcp2-2.1.1.jar:2.1.1]
>     at 
> org.apache.ofbiz.entity.jdbc.DatabaseUtil.createTable(DatabaseUtil.java:1677) 
> [ofbiz.jar:?]
>     at 
> org.apache.ofbiz.entity.jdbc.DatabaseUtil$CreateTableCallable.call(DatabaseUtil.java:1516)
>  [ofbiz.jar:?]
>     at 
> org.apache.ofbiz.entity.jdbc.DatabaseUtil$CreateTableCallable.call(DatabaseUtil.java:1502)
>  [ofbiz.jar:?]
>     at java.util.concurrent.FutureTask.run(FutureTask.java:266) 
> [?:1.8.0_66]
>     at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
>  [?:1.8.0_66]
>     at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
>  [?:1.8.0_66]
>     at java.lang.Thread.run(Thread.java:745) [?:1.8.0_66]
> Caused by: org.apache.derby.iapi.error.StandardException: Syntax error: 
> Encountered "(" at line 1, column 21.
>     at org.apache.derby.iapi.error.StandardException.newException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.iapi.error.StandardException.newException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at 
> 

[jira] [Commented] (OFBIZ-10645) Empty entity name should not be allowed in entity definition

2018-11-12 Thread Aditya Sharma (JIRA)


[ 
https://issues.apache.org/jira/browse/OFBIZ-10645?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16683798#comment-16683798
 ] 

Aditya Sharma commented on OFBIZ-10645:
---

So we can proceed with only checking entity-name then, as loading such entities 
seems to be futile with these inferences. 

> Empty entity name should not be allowed in entity definition
> 
>
> Key: OFBIZ-10645
> URL: https://issues.apache.org/jira/browse/OFBIZ-10645
> Project: OFBiz
>  Issue Type: Bug
>  Components: framework
>Affects Versions: Trunk, Release Branch 16.11, Release Branch 17.12
>Reporter: Ashish Kumar Pandey
>Assignee: Aditya Sharma
>Priority: Trivial
> Attachments: EntityMaintError.png, OFBIZ-10645-alternate.patch, 
> OFBIZ-10645.patch
>
>
> Present system allows empty name in entity definition due to which there 
> SQLException in console log and error on Entity Mantainence page.
> {code:java}
> 2018-11-10 14:43:45,522 |OFBiz-batch-3    |DatabaseUtil  
> |I| Error getting primary key info from database with null tableName, will 
> try other means: java.sql.SQLException: Table name can not be null
> 2018-11-10 14:43:45,522 |OFBiz-batch-1    |DatabaseUtil  
> |I| Error getting primary key info from database with null tableName, will 
> try other means: java.sql.SQLException: Table name can not be null
> 2018-11-10 14:43:45,522 |OFBiz-batch-2    |DatabaseUtil  
> |I| Error getting primary key info from database with null tableName, will 
> try other means: java.sql.SQLException: Table name can not be null
> 2018-11-10 14:44:06,198 |OFBiz-batch-2    |DatabaseUtil  
> |W| Entity [] has no table in the database
> 2018-11-10 14:44:06,243 |pool-3-thread-1  |DatabaseUtil  
> |E| SQL Exception while executing the following:
> CREATE TABLE OFBIZ. (TEST_ID VARCHAR(20) NOT NULL, LAST_UPDATED_STAMP 
> TIMESTAMP, LAST_UPDATED_TX_STAMP TIMESTAMP, CREATED_STAMP TIMESTAMP, 
> CREATED_TX_STAMP TIMESTAMP,  PRIMARY KEY (TEST_ID))
> Error was: java.sql.SQLSyntaxErrorException: Syntax error: Encountered "(" at 
> line 1, column 21.
> java.sql.SQLSyntaxErrorException: Syntax error: Encountered "(" at line 1, 
> column 21.
>     at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source) 
> ~[derby-10.14.1.0.jar:?]
>     at 
> org.apache.derby.impl.jdbc.EmbedStatement.executeLargeUpdate(Unknown Source) 
> ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.impl.jdbc.EmbedStatement.executeUpdate(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at 
> org.apache.commons.dbcp2.DelegatingStatement.executeUpdate(DelegatingStatement.java:234)
>  ~[commons-dbcp2-2.1.1.jar:2.1.1]
>     at 
> org.apache.commons.dbcp2.DelegatingStatement.executeUpdate(DelegatingStatement.java:234)
>  ~[commons-dbcp2-2.1.1.jar:2.1.1]
>     at 
> org.apache.ofbiz.entity.jdbc.DatabaseUtil.createTable(DatabaseUtil.java:1677) 
> [ofbiz.jar:?]
>     at 
> org.apache.ofbiz.entity.jdbc.DatabaseUtil$CreateTableCallable.call(DatabaseUtil.java:1516)
>  [ofbiz.jar:?]
>     at 
> org.apache.ofbiz.entity.jdbc.DatabaseUtil$CreateTableCallable.call(DatabaseUtil.java:1502)
>  [ofbiz.jar:?]
>     at java.util.concurrent.FutureTask.run(FutureTask.java:266) 
> [?:1.8.0_66]
>     at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
>  [?:1.8.0_66]
>     at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
>  [?:1.8.0_66]
>     at java.lang.Thread.run(Thread.java:745) [?:1.8.0_66]
> Caused by: org.apache.derby.iapi.error.StandardException: Syntax error: 
> Encountered "(" at line 1, column 21.
>     at org.apache.derby.iapi.error.StandardException.newException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.iapi.error.StandardException.newException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at 
> org.apache.derby.impl.sql.compile.ParserImpl.parseStatementOrSearchCondition(Unknown
>  

[jira] [Commented] (OFBIZ-10645) Empty entity name should not be allowed in entity definition

2018-11-12 Thread Jacques Le Roux (JIRA)


[ 
https://issues.apache.org/jira/browse/OFBIZ-10645?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16683738#comment-16683738
 ] 

Jacques Le Roux commented on OFBIZ-10645:
-

Hi Aditya,
bq. I prefer the same but still couldn't understand as entity-name is the 
required field. How any operation can be performed for these tables without an 
entity-name?
That's a difficult question, I'll have a look...

> Empty entity name should not be allowed in entity definition
> 
>
> Key: OFBIZ-10645
> URL: https://issues.apache.org/jira/browse/OFBIZ-10645
> Project: OFBiz
>  Issue Type: Bug
>  Components: framework
>Affects Versions: Trunk, Release Branch 16.11, Release Branch 17.12
>Reporter: Ashish Kumar Pandey
>Assignee: Aditya Sharma
>Priority: Trivial
> Attachments: EntityMaintError.png, OFBIZ-10645-alternate.patch, 
> OFBIZ-10645.patch
>
>
> Present system allows empty name in entity definition due to which there 
> SQLException in console log and error on Entity Mantainence page.
> {code:java}
> 2018-11-10 14:43:45,522 |OFBiz-batch-3    |DatabaseUtil  
> |I| Error getting primary key info from database with null tableName, will 
> try other means: java.sql.SQLException: Table name can not be null
> 2018-11-10 14:43:45,522 |OFBiz-batch-1    |DatabaseUtil  
> |I| Error getting primary key info from database with null tableName, will 
> try other means: java.sql.SQLException: Table name can not be null
> 2018-11-10 14:43:45,522 |OFBiz-batch-2    |DatabaseUtil  
> |I| Error getting primary key info from database with null tableName, will 
> try other means: java.sql.SQLException: Table name can not be null
> 2018-11-10 14:44:06,198 |OFBiz-batch-2    |DatabaseUtil  
> |W| Entity [] has no table in the database
> 2018-11-10 14:44:06,243 |pool-3-thread-1  |DatabaseUtil  
> |E| SQL Exception while executing the following:
> CREATE TABLE OFBIZ. (TEST_ID VARCHAR(20) NOT NULL, LAST_UPDATED_STAMP 
> TIMESTAMP, LAST_UPDATED_TX_STAMP TIMESTAMP, CREATED_STAMP TIMESTAMP, 
> CREATED_TX_STAMP TIMESTAMP,  PRIMARY KEY (TEST_ID))
> Error was: java.sql.SQLSyntaxErrorException: Syntax error: Encountered "(" at 
> line 1, column 21.
> java.sql.SQLSyntaxErrorException: Syntax error: Encountered "(" at line 1, 
> column 21.
>     at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source) 
> ~[derby-10.14.1.0.jar:?]
>     at 
> org.apache.derby.impl.jdbc.EmbedStatement.executeLargeUpdate(Unknown Source) 
> ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.impl.jdbc.EmbedStatement.executeUpdate(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at 
> org.apache.commons.dbcp2.DelegatingStatement.executeUpdate(DelegatingStatement.java:234)
>  ~[commons-dbcp2-2.1.1.jar:2.1.1]
>     at 
> org.apache.commons.dbcp2.DelegatingStatement.executeUpdate(DelegatingStatement.java:234)
>  ~[commons-dbcp2-2.1.1.jar:2.1.1]
>     at 
> org.apache.ofbiz.entity.jdbc.DatabaseUtil.createTable(DatabaseUtil.java:1677) 
> [ofbiz.jar:?]
>     at 
> org.apache.ofbiz.entity.jdbc.DatabaseUtil$CreateTableCallable.call(DatabaseUtil.java:1516)
>  [ofbiz.jar:?]
>     at 
> org.apache.ofbiz.entity.jdbc.DatabaseUtil$CreateTableCallable.call(DatabaseUtil.java:1502)
>  [ofbiz.jar:?]
>     at java.util.concurrent.FutureTask.run(FutureTask.java:266) 
> [?:1.8.0_66]
>     at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
>  [?:1.8.0_66]
>     at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
>  [?:1.8.0_66]
>     at java.lang.Thread.run(Thread.java:745) [?:1.8.0_66]
> Caused by: org.apache.derby.iapi.error.StandardException: Syntax error: 
> Encountered "(" at line 1, column 21.
>     at org.apache.derby.iapi.error.StandardException.newException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.iapi.error.StandardException.newException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>  

[jira] [Commented] (OFBIZ-10645) Empty entity name should not be allowed in entity definition

2018-11-12 Thread Aditya Sharma (JIRA)


[ 
https://issues.apache.org/jira/browse/OFBIZ-10645?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16683597#comment-16683597
 ] 

Aditya Sharma commented on OFBIZ-10645:
---

Thanks  [~mthl] and [~jacques.le.roux] :). Makes sense. I will update the 
solution patch.
{quote}For the alternative patch, I prefer to check for {{"table-name"}} also.
{quote}
I prefer the same but still couldn't understand as entity-name is the required 
field. How any operation can be performed for these tables without an 
entity-name?
 

> Empty entity name should not be allowed in entity definition
> 
>
> Key: OFBIZ-10645
> URL: https://issues.apache.org/jira/browse/OFBIZ-10645
> Project: OFBiz
>  Issue Type: Bug
>  Components: framework
>Affects Versions: Trunk, Release Branch 16.11, Release Branch 17.12
>Reporter: Ashish Kumar Pandey
>Assignee: Aditya Sharma
>Priority: Trivial
> Attachments: EntityMaintError.png, OFBIZ-10645-alternate.patch, 
> OFBIZ-10645.patch
>
>
> Present system allows empty name in entity definition due to which there 
> SQLException in console log and error on Entity Mantainence page.
> {code:java}
> 2018-11-10 14:43:45,522 |OFBiz-batch-3    |DatabaseUtil  
> |I| Error getting primary key info from database with null tableName, will 
> try other means: java.sql.SQLException: Table name can not be null
> 2018-11-10 14:43:45,522 |OFBiz-batch-1    |DatabaseUtil  
> |I| Error getting primary key info from database with null tableName, will 
> try other means: java.sql.SQLException: Table name can not be null
> 2018-11-10 14:43:45,522 |OFBiz-batch-2    |DatabaseUtil  
> |I| Error getting primary key info from database with null tableName, will 
> try other means: java.sql.SQLException: Table name can not be null
> 2018-11-10 14:44:06,198 |OFBiz-batch-2    |DatabaseUtil  
> |W| Entity [] has no table in the database
> 2018-11-10 14:44:06,243 |pool-3-thread-1  |DatabaseUtil  
> |E| SQL Exception while executing the following:
> CREATE TABLE OFBIZ. (TEST_ID VARCHAR(20) NOT NULL, LAST_UPDATED_STAMP 
> TIMESTAMP, LAST_UPDATED_TX_STAMP TIMESTAMP, CREATED_STAMP TIMESTAMP, 
> CREATED_TX_STAMP TIMESTAMP,  PRIMARY KEY (TEST_ID))
> Error was: java.sql.SQLSyntaxErrorException: Syntax error: Encountered "(" at 
> line 1, column 21.
> java.sql.SQLSyntaxErrorException: Syntax error: Encountered "(" at line 1, 
> column 21.
>     at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source) 
> ~[derby-10.14.1.0.jar:?]
>     at 
> org.apache.derby.impl.jdbc.EmbedStatement.executeLargeUpdate(Unknown Source) 
> ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.impl.jdbc.EmbedStatement.executeUpdate(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at 
> org.apache.commons.dbcp2.DelegatingStatement.executeUpdate(DelegatingStatement.java:234)
>  ~[commons-dbcp2-2.1.1.jar:2.1.1]
>     at 
> org.apache.commons.dbcp2.DelegatingStatement.executeUpdate(DelegatingStatement.java:234)
>  ~[commons-dbcp2-2.1.1.jar:2.1.1]
>     at 
> org.apache.ofbiz.entity.jdbc.DatabaseUtil.createTable(DatabaseUtil.java:1677) 
> [ofbiz.jar:?]
>     at 
> org.apache.ofbiz.entity.jdbc.DatabaseUtil$CreateTableCallable.call(DatabaseUtil.java:1516)
>  [ofbiz.jar:?]
>     at 
> org.apache.ofbiz.entity.jdbc.DatabaseUtil$CreateTableCallable.call(DatabaseUtil.java:1502)
>  [ofbiz.jar:?]
>     at java.util.concurrent.FutureTask.run(FutureTask.java:266) 
> [?:1.8.0_66]
>     at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
>  [?:1.8.0_66]
>     at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
>  [?:1.8.0_66]
>     at java.lang.Thread.run(Thread.java:745) [?:1.8.0_66]
> Caused by: org.apache.derby.iapi.error.StandardException: Syntax error: 
> Encountered "(" at line 1, column 21.
>     at org.apache.derby.iapi.error.StandardException.newException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>  

[jira] [Commented] (OFBIZ-10645) Empty entity name should not be allowed in entity definition

2018-11-12 Thread Jacques Le Roux (JIRA)


[ 
https://issues.apache.org/jira/browse/OFBIZ-10645?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16683472#comment-16683472
 ] 

Jacques Le Roux commented on OFBIZ-10645:
-

Hi Aditya,

I'm all for returning Optionals instead of null values when possible. 
{{ModelReader::buildEntity }} is private an only used by 
{{ModelReader::getEntityCache}} at 
{code}ModelEntity modelEntity = buildEntity(entityResourceHandler, (Element) 
curChild, i, def);{code}
So I think it's possible to use optional there using Optional::isPresent when 
cheking for an empty ModelEntity object (disclaimer I did not try to refactor 
;))

For the alternative patch, I prefer to check for {{"table-name"}} also.

> Empty entity name should not be allowed in entity definition
> 
>
> Key: OFBIZ-10645
> URL: https://issues.apache.org/jira/browse/OFBIZ-10645
> Project: OFBiz
>  Issue Type: Bug
>  Components: framework
>Affects Versions: Trunk, Release Branch 16.11, Release Branch 17.12
>Reporter: Ashish Kumar Pandey
>Assignee: Aditya Sharma
>Priority: Trivial
> Attachments: EntityMaintError.png, OFBIZ-10645-alternate.patch, 
> OFBIZ-10645.patch
>
>
> Present system allows empty name in entity definition due to which there 
> SQLException in console log and error on Entity Mantainence page.
> {code:java}
> 2018-11-10 14:43:45,522 |OFBiz-batch-3    |DatabaseUtil  
> |I| Error getting primary key info from database with null tableName, will 
> try other means: java.sql.SQLException: Table name can not be null
> 2018-11-10 14:43:45,522 |OFBiz-batch-1    |DatabaseUtil  
> |I| Error getting primary key info from database with null tableName, will 
> try other means: java.sql.SQLException: Table name can not be null
> 2018-11-10 14:43:45,522 |OFBiz-batch-2    |DatabaseUtil  
> |I| Error getting primary key info from database with null tableName, will 
> try other means: java.sql.SQLException: Table name can not be null
> 2018-11-10 14:44:06,198 |OFBiz-batch-2    |DatabaseUtil  
> |W| Entity [] has no table in the database
> 2018-11-10 14:44:06,243 |pool-3-thread-1  |DatabaseUtil  
> |E| SQL Exception while executing the following:
> CREATE TABLE OFBIZ. (TEST_ID VARCHAR(20) NOT NULL, LAST_UPDATED_STAMP 
> TIMESTAMP, LAST_UPDATED_TX_STAMP TIMESTAMP, CREATED_STAMP TIMESTAMP, 
> CREATED_TX_STAMP TIMESTAMP,  PRIMARY KEY (TEST_ID))
> Error was: java.sql.SQLSyntaxErrorException: Syntax error: Encountered "(" at 
> line 1, column 21.
> java.sql.SQLSyntaxErrorException: Syntax error: Encountered "(" at line 1, 
> column 21.
>     at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source) 
> ~[derby-10.14.1.0.jar:?]
>     at 
> org.apache.derby.impl.jdbc.EmbedStatement.executeLargeUpdate(Unknown Source) 
> ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.impl.jdbc.EmbedStatement.executeUpdate(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at 
> org.apache.commons.dbcp2.DelegatingStatement.executeUpdate(DelegatingStatement.java:234)
>  ~[commons-dbcp2-2.1.1.jar:2.1.1]
>     at 
> org.apache.commons.dbcp2.DelegatingStatement.executeUpdate(DelegatingStatement.java:234)
>  ~[commons-dbcp2-2.1.1.jar:2.1.1]
>     at 
> org.apache.ofbiz.entity.jdbc.DatabaseUtil.createTable(DatabaseUtil.java:1677) 
> [ofbiz.jar:?]
>     at 
> org.apache.ofbiz.entity.jdbc.DatabaseUtil$CreateTableCallable.call(DatabaseUtil.java:1516)
>  [ofbiz.jar:?]
>     at 
> org.apache.ofbiz.entity.jdbc.DatabaseUtil$CreateTableCallable.call(DatabaseUtil.java:1502)
>  [ofbiz.jar:?]
>     at java.util.concurrent.FutureTask.run(FutureTask.java:266) 
> [?:1.8.0_66]
>     at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
>  [?:1.8.0_66]
>     at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
>  [?:1.8.0_66]
>     at java.lang.Thread.run(Thread.java:745) [?:1.8.0_66]
> Caused by: org.apache.derby.iapi.error.StandardException: 

[jira] [Commented] (OFBIZ-10645) Empty entity name should not be allowed in entity definition

2018-11-12 Thread Mathieu Lirzin (JIRA)


[ 
https://issues.apache.org/jira/browse/OFBIZ-10645?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16683456#comment-16683456
 ] 

Mathieu Lirzin commented on OFBIZ-10645:


What I mean is that you can use 
[{{Optional}}|https://docs.oracle.com/javase/8/docs/api/java/util/Optional.html]
 type as a return value of the {{buildEntity}} method. The idea it to be 
explicit about the potential absence of value, and let the type system know.

Consider this dummy example:
{code:java}
String producer() {
if (...) {
return null;
} else {
return "result";
}
}

void consumer() {
String res = producer();
if (res != null) {
System.out.print("success");
}
}
{code}
In the above code the fact that {{null}} represent an empty value is implicit 
and the compiler has no way to check that the empty case is properly handled. 
Now let's see how we could rewrite the code using {{Optional}}:
{code:java}
Optional producer() {
if (...) {
return Optional.empty();
} else {
return Optional.of("result");
}
}

void consumer() {
producer().ifPresent(System.out::println);
}
{code}
In the above code {{producer}} return value is explicit about the potential 
emptiness of its result, additionally the compiler helps you in ensuring that 
in {{consumer}} you are not calling a method on a {{null}} value.

Of course this example is trivial enough that the additional type safety it 
brings is overkill, however in real Java code this is really helpful. Does it 
make sense?

> Empty entity name should not be allowed in entity definition
> 
>
> Key: OFBIZ-10645
> URL: https://issues.apache.org/jira/browse/OFBIZ-10645
> Project: OFBiz
>  Issue Type: Bug
>  Components: framework
>Affects Versions: Trunk, Release Branch 16.11, Release Branch 17.12
>Reporter: Ashish Kumar Pandey
>Assignee: Aditya Sharma
>Priority: Trivial
> Attachments: EntityMaintError.png, OFBIZ-10645-alternate.patch, 
> OFBIZ-10645.patch
>
>
> Present system allows empty name in entity definition due to which there 
> SQLException in console log and error on Entity Mantainence page.
> {code:java}
> 2018-11-10 14:43:45,522 |OFBiz-batch-3    |DatabaseUtil  
> |I| Error getting primary key info from database with null tableName, will 
> try other means: java.sql.SQLException: Table name can not be null
> 2018-11-10 14:43:45,522 |OFBiz-batch-1    |DatabaseUtil  
> |I| Error getting primary key info from database with null tableName, will 
> try other means: java.sql.SQLException: Table name can not be null
> 2018-11-10 14:43:45,522 |OFBiz-batch-2    |DatabaseUtil  
> |I| Error getting primary key info from database with null tableName, will 
> try other means: java.sql.SQLException: Table name can not be null
> 2018-11-10 14:44:06,198 |OFBiz-batch-2    |DatabaseUtil  
> |W| Entity [] has no table in the database
> 2018-11-10 14:44:06,243 |pool-3-thread-1  |DatabaseUtil  
> |E| SQL Exception while executing the following:
> CREATE TABLE OFBIZ. (TEST_ID VARCHAR(20) NOT NULL, LAST_UPDATED_STAMP 
> TIMESTAMP, LAST_UPDATED_TX_STAMP TIMESTAMP, CREATED_STAMP TIMESTAMP, 
> CREATED_TX_STAMP TIMESTAMP,  PRIMARY KEY (TEST_ID))
> Error was: java.sql.SQLSyntaxErrorException: Syntax error: Encountered "(" at 
> line 1, column 21.
> java.sql.SQLSyntaxErrorException: Syntax error: Encountered "(" at line 1, 
> column 21.
>     at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source) 
> ~[derby-10.14.1.0.jar:?]
>     at 
> org.apache.derby.impl.jdbc.EmbedStatement.executeLargeUpdate(Unknown Source) 
> ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.impl.jdbc.EmbedStatement.executeUpdate(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at 
> org.apache.commons.dbcp2.DelegatingStatement.executeUpdate(DelegatingStatement.java:234)
>  ~[commons-dbcp2-2.1.1.jar:2.1.1]
>     at 
> 

[jira] [Commented] (OFBIZ-10645) Empty entity name should not be allowed in entity definition

2018-11-11 Thread Aditya Sharma (JIRA)


[ 
https://issues.apache.org/jira/browse/OFBIZ-10645?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16683234#comment-16683234
 ] 

Aditya Sharma commented on OFBIZ-10645:
---

Thanks [~mthl] for reviewing the patch.

Suggestion by you in groovy code seems more promising I will update the 
solution patch with those changes.

Can you elaborate more on the following statement:
{quote}I would suggest modifying {{buildEntity}} to return an 
{{Optional}} instead of a nullable value.
{quote}
If you intend to say we return an empty ModelEntity object, it will be 
difficult to identify empty/non-empty ModelEntity objects.

> Empty entity name should not be allowed in entity definition
> 
>
> Key: OFBIZ-10645
> URL: https://issues.apache.org/jira/browse/OFBIZ-10645
> Project: OFBiz
>  Issue Type: Bug
>  Components: framework
>Affects Versions: Trunk, Release Branch 16.11, Release Branch 17.12
>Reporter: Ashish Kumar Pandey
>Assignee: Aditya Sharma
>Priority: Trivial
> Attachments: EntityMaintError.png, OFBIZ-10645-alternate.patch, 
> OFBIZ-10645.patch
>
>
> Present system allows empty name in entity definition due to which there 
> SQLException in console log and error on Entity Mantainence page.
> {code:java}
> 2018-11-10 14:43:45,522 |OFBiz-batch-3    |DatabaseUtil  
> |I| Error getting primary key info from database with null tableName, will 
> try other means: java.sql.SQLException: Table name can not be null
> 2018-11-10 14:43:45,522 |OFBiz-batch-1    |DatabaseUtil  
> |I| Error getting primary key info from database with null tableName, will 
> try other means: java.sql.SQLException: Table name can not be null
> 2018-11-10 14:43:45,522 |OFBiz-batch-2    |DatabaseUtil  
> |I| Error getting primary key info from database with null tableName, will 
> try other means: java.sql.SQLException: Table name can not be null
> 2018-11-10 14:44:06,198 |OFBiz-batch-2    |DatabaseUtil  
> |W| Entity [] has no table in the database
> 2018-11-10 14:44:06,243 |pool-3-thread-1  |DatabaseUtil  
> |E| SQL Exception while executing the following:
> CREATE TABLE OFBIZ. (TEST_ID VARCHAR(20) NOT NULL, LAST_UPDATED_STAMP 
> TIMESTAMP, LAST_UPDATED_TX_STAMP TIMESTAMP, CREATED_STAMP TIMESTAMP, 
> CREATED_TX_STAMP TIMESTAMP,  PRIMARY KEY (TEST_ID))
> Error was: java.sql.SQLSyntaxErrorException: Syntax error: Encountered "(" at 
> line 1, column 21.
> java.sql.SQLSyntaxErrorException: Syntax error: Encountered "(" at line 1, 
> column 21.
>     at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source) 
> ~[derby-10.14.1.0.jar:?]
>     at 
> org.apache.derby.impl.jdbc.EmbedStatement.executeLargeUpdate(Unknown Source) 
> ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.impl.jdbc.EmbedStatement.executeUpdate(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at 
> org.apache.commons.dbcp2.DelegatingStatement.executeUpdate(DelegatingStatement.java:234)
>  ~[commons-dbcp2-2.1.1.jar:2.1.1]
>     at 
> org.apache.commons.dbcp2.DelegatingStatement.executeUpdate(DelegatingStatement.java:234)
>  ~[commons-dbcp2-2.1.1.jar:2.1.1]
>     at 
> org.apache.ofbiz.entity.jdbc.DatabaseUtil.createTable(DatabaseUtil.java:1677) 
> [ofbiz.jar:?]
>     at 
> org.apache.ofbiz.entity.jdbc.DatabaseUtil$CreateTableCallable.call(DatabaseUtil.java:1516)
>  [ofbiz.jar:?]
>     at 
> org.apache.ofbiz.entity.jdbc.DatabaseUtil$CreateTableCallable.call(DatabaseUtil.java:1502)
>  [ofbiz.jar:?]
>     at java.util.concurrent.FutureTask.run(FutureTask.java:266) 
> [?:1.8.0_66]
>     at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
>  [?:1.8.0_66]
>     at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
>  [?:1.8.0_66]
>     at java.lang.Thread.run(Thread.java:745) [?:1.8.0_66]
> Caused by: org.apache.derby.iapi.error.StandardException: Syntax error: 
> Encountered "(" at line 1, column 21.
>     at 

[jira] [Commented] (OFBIZ-10645) Empty entity name should not be allowed in entity definition

2018-11-11 Thread Mathieu Lirzin (JIRA)


[ 
https://issues.apache.org/jira/browse/OFBIZ-10645?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16682902#comment-16682902
 ] 

Mathieu Lirzin commented on OFBIZ-10645:


Hello [~aditya.sharma],

I would suggest modifying {{buildEntity}} to return an 
{{Optional}} instead of a nullable value.

Additionnally in the groovy script it would be more idiomatic to write:
{code}
entities.findAll()
.each { entityName -> ... }
{code}
which removes all the empty elements according to groovy truth.

Thanks.

> Empty entity name should not be allowed in entity definition
> 
>
> Key: OFBIZ-10645
> URL: https://issues.apache.org/jira/browse/OFBIZ-10645
> Project: OFBiz
>  Issue Type: Bug
>  Components: framework
>Affects Versions: Trunk, Release Branch 16.11, Release Branch 17.12
>Reporter: Ashish Kumar Pandey
>Assignee: Aditya Sharma
>Priority: Trivial
> Attachments: EntityMaintError.png, OFBIZ-10645-alternate.patch, 
> OFBIZ-10645.patch
>
>
> Present system allows empty name in entity definition due to which there 
> SQLException in console log and error on Entity Mantainence page.
> {code:java}
> 2018-11-10 14:43:45,522 |OFBiz-batch-3    |DatabaseUtil  
> |I| Error getting primary key info from database with null tableName, will 
> try other means: java.sql.SQLException: Table name can not be null
> 2018-11-10 14:43:45,522 |OFBiz-batch-1    |DatabaseUtil  
> |I| Error getting primary key info from database with null tableName, will 
> try other means: java.sql.SQLException: Table name can not be null
> 2018-11-10 14:43:45,522 |OFBiz-batch-2    |DatabaseUtil  
> |I| Error getting primary key info from database with null tableName, will 
> try other means: java.sql.SQLException: Table name can not be null
> 2018-11-10 14:44:06,198 |OFBiz-batch-2    |DatabaseUtil  
> |W| Entity [] has no table in the database
> 2018-11-10 14:44:06,243 |pool-3-thread-1  |DatabaseUtil  
> |E| SQL Exception while executing the following:
> CREATE TABLE OFBIZ. (TEST_ID VARCHAR(20) NOT NULL, LAST_UPDATED_STAMP 
> TIMESTAMP, LAST_UPDATED_TX_STAMP TIMESTAMP, CREATED_STAMP TIMESTAMP, 
> CREATED_TX_STAMP TIMESTAMP,  PRIMARY KEY (TEST_ID))
> Error was: java.sql.SQLSyntaxErrorException: Syntax error: Encountered "(" at 
> line 1, column 21.
> java.sql.SQLSyntaxErrorException: Syntax error: Encountered "(" at line 1, 
> column 21.
>     at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source) 
> ~[derby-10.14.1.0.jar:?]
>     at 
> org.apache.derby.impl.jdbc.EmbedStatement.executeLargeUpdate(Unknown Source) 
> ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.impl.jdbc.EmbedStatement.executeUpdate(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at 
> org.apache.commons.dbcp2.DelegatingStatement.executeUpdate(DelegatingStatement.java:234)
>  ~[commons-dbcp2-2.1.1.jar:2.1.1]
>     at 
> org.apache.commons.dbcp2.DelegatingStatement.executeUpdate(DelegatingStatement.java:234)
>  ~[commons-dbcp2-2.1.1.jar:2.1.1]
>     at 
> org.apache.ofbiz.entity.jdbc.DatabaseUtil.createTable(DatabaseUtil.java:1677) 
> [ofbiz.jar:?]
>     at 
> org.apache.ofbiz.entity.jdbc.DatabaseUtil$CreateTableCallable.call(DatabaseUtil.java:1516)
>  [ofbiz.jar:?]
>     at 
> org.apache.ofbiz.entity.jdbc.DatabaseUtil$CreateTableCallable.call(DatabaseUtil.java:1502)
>  [ofbiz.jar:?]
>     at java.util.concurrent.FutureTask.run(FutureTask.java:266) 
> [?:1.8.0_66]
>     at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
>  [?:1.8.0_66]
>     at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
>  [?:1.8.0_66]
>     at java.lang.Thread.run(Thread.java:745) [?:1.8.0_66]
> Caused by: org.apache.derby.iapi.error.StandardException: Syntax error: 
> Encountered "(" at line 1, column 21.
>     at org.apache.derby.iapi.error.StandardException.newException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     

[jira] [Commented] (OFBIZ-10645) Empty entity name should not be allowed in entity definition

2018-11-10 Thread Aditya Sharma (JIRA)


[ 
https://issues.apache.org/jira/browse/OFBIZ-10645?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16682367#comment-16682367
 ] 

Aditya Sharma commented on OFBIZ-10645:
---

I am adding 2 solution patches:

Added check in buildEntity() method of ModelReader class to return null if the 
name is missing and handled it in getEntityCache() method.

Added check in EntityMaint.groovy to skip entity with entity name missing.
 # When entity-name and table-name both are empty, the entity will not be 
processed. In buildEntity(), UtilXml.checkEmpty() method was used which ensured 
that empty string is assigned to the entity name if it is null/empty. It must 
have been done intentionally to fulfil some use case.
 # When entity-name is empty, the entity will not be processed.

> Empty entity name should not be allowed in entity definition
> 
>
> Key: OFBIZ-10645
> URL: https://issues.apache.org/jira/browse/OFBIZ-10645
> Project: OFBiz
>  Issue Type: Bug
>  Components: framework
>Affects Versions: Trunk, Release Branch 16.11, Release Branch 17.12
>Reporter: Ashish Kumar Pandey
>Assignee: Aditya Sharma
>Priority: Trivial
> Attachments: EntityMaintError.png, OFBIZ-10645-alternate.patch, 
> OFBIZ-10645.patch
>
>
> Present system allows empty name in entity definition due to which there 
> SQLException in console log and error on Entity Mantainence page.
> {code:java}
> 2018-11-10 14:43:45,522 |OFBiz-batch-3    |DatabaseUtil  
> |I| Error getting primary key info from database with null tableName, will 
> try other means: java.sql.SQLException: Table name can not be null
> 2018-11-10 14:43:45,522 |OFBiz-batch-1    |DatabaseUtil  
> |I| Error getting primary key info from database with null tableName, will 
> try other means: java.sql.SQLException: Table name can not be null
> 2018-11-10 14:43:45,522 |OFBiz-batch-2    |DatabaseUtil  
> |I| Error getting primary key info from database with null tableName, will 
> try other means: java.sql.SQLException: Table name can not be null
> 2018-11-10 14:44:06,198 |OFBiz-batch-2    |DatabaseUtil  
> |W| Entity [] has no table in the database
> 2018-11-10 14:44:06,243 |pool-3-thread-1  |DatabaseUtil  
> |E| SQL Exception while executing the following:
> CREATE TABLE OFBIZ. (TEST_ID VARCHAR(20) NOT NULL, LAST_UPDATED_STAMP 
> TIMESTAMP, LAST_UPDATED_TX_STAMP TIMESTAMP, CREATED_STAMP TIMESTAMP, 
> CREATED_TX_STAMP TIMESTAMP,  PRIMARY KEY (TEST_ID))
> Error was: java.sql.SQLSyntaxErrorException: Syntax error: Encountered "(" at 
> line 1, column 21.
> java.sql.SQLSyntaxErrorException: Syntax error: Encountered "(" at line 1, 
> column 21.
>     at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source) 
> ~[derby-10.14.1.0.jar:?]
>     at 
> org.apache.derby.impl.jdbc.EmbedStatement.executeLargeUpdate(Unknown Source) 
> ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.impl.jdbc.EmbedStatement.executeUpdate(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at 
> org.apache.commons.dbcp2.DelegatingStatement.executeUpdate(DelegatingStatement.java:234)
>  ~[commons-dbcp2-2.1.1.jar:2.1.1]
>     at 
> org.apache.commons.dbcp2.DelegatingStatement.executeUpdate(DelegatingStatement.java:234)
>  ~[commons-dbcp2-2.1.1.jar:2.1.1]
>     at 
> org.apache.ofbiz.entity.jdbc.DatabaseUtil.createTable(DatabaseUtil.java:1677) 
> [ofbiz.jar:?]
>     at 
> org.apache.ofbiz.entity.jdbc.DatabaseUtil$CreateTableCallable.call(DatabaseUtil.java:1516)
>  [ofbiz.jar:?]
>     at 
> org.apache.ofbiz.entity.jdbc.DatabaseUtil$CreateTableCallable.call(DatabaseUtil.java:1502)
>  [ofbiz.jar:?]
>     at java.util.concurrent.FutureTask.run(FutureTask.java:266) 
> [?:1.8.0_66]
>     at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
>  [?:1.8.0_66]
>     at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
>  [?:1.8.0_66]
>     at