ActiveObject framework does not handle new MySQL reserved keywords

Christian Stichweh April 13, 2021

Steps to reproduce the bug.
1. Take any Jira server/DC with following DB setup:
8.0.22-0ubuntu0.20.04.3
MySQL Connector/J mysql-connector-java-8.0.21 (Revision: 33f65445a1bcc544eb0120491926484da168f199)
utf8mb4_bin
All these are btw supported on your web
2. Install SoftComply Risk Manager app and you will see errors in log:
2021-01-18 17:50:08,807+0000 active-objects-init-JiraTenantImpl{id=‘system’}-0 ERROR CStichweh [n.java.ao.sql] Exception executing SQL update <CREATE TABLE AO_0EF072_RMCELL_AO (
COLUMN INTEGER,
ID INTEGER AUTO_INCREMENT NOT NULL,
RISK_CLASS_ID INTEGER,
RISK_MATRIX_ID INTEGER,
ROW INTEGER,
CONSTRAINT fk_ao_0ef072_rmcell_ao_risk_class_id FOREIGN KEY (RISK_CLASS_ID) REFERENCES AO_0EF072_RISK_CLASS_AO(ID),
CONSTRAINT fk_ao_0ef072_rmcell_ao_risk_matrix_id FOREIGN KEY (RISK_MATRIX_ID) REFERENCES AO_0EF072_RISK_MATRIX_AO(ID),
PRIMARY KEY(ID)
) ENGINE=InnoDB>
java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘ROW INTEGER,
CONSTRAINT fk_ao_0ef072_rmcell_ao_risk_class_id FOREIGN KEY (RI’ at line 6

We have a table with column names “ROW” and “COLUMN”. Both are reserved keywords in MySQL and should be handled properly (i.e. escaped). Now COLUMN is reserved word for a long time, but ROW is reserved only recently (https://dev.mysql.com/doc/refman/8.0/en/keywords.html)

Now if the Atlassian framework creates table, it first created SQL from our Java object, and then executes it. What happens now is that the SQL is generated with not the latest information.

You can see below that on line 2 the COLUMN is handled properly, but on line 6 ROW is not surrounded with quotes. And that causes error.

Expected Result
App works and reserved keywords are escaped properly by AO framework

Actual Result
Error in SQL

1 answer

0 votes
Jack Nolddor _Sweet Bananas_
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
April 14, 2021

Try to ask at Dev Community:

https://community.developer.atlassian.com/

Christian Stichweh April 14, 2021

The request was posted there on March 11 and remains there nicely unnoticed, unread and unprocessed. 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
TAGS
AUG Leaders

Atlassian Community Events