sureshanaparti commented on code in PR #12605:
URL: https://github.com/apache/cloudstack/pull/12605#discussion_r2781874788


##########
engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade42020to42030.java:
##########
@@ -51,6 +55,44 @@ public InputStream[] getPrepareScripts() {
 
     @Override
     public void performDataMigration(Connection conn) {
+        unhideJsInterpretationEnabled(conn);
+    }
+
+    protected void unhideJsInterpretationEnabled(Connection conn) {
+        String value = getJsInterpretationEnabled(conn);
+        if (value != null) {
+            updateJsInterpretationEnabledFields(conn, value);
+        }
+    }
+
+    protected String getJsInterpretationEnabled(Connection conn) {
+        String query = "SELECT value FROM cloud.configuration WHERE name = 
'js.interpretation.enabled' AND category = 'Hidden';";
+
+        try (PreparedStatement pstmt = conn.prepareStatement(query)) {
+            ResultSet rs = pstmt.executeQuery();
+            if (rs.next()) {
+                return rs.getString("value");
+            }
+            logger.debug("Unable to retrieve value of hidden configuration 
'js.interpretation.enabled'. The configuration may already be unhidden.");
+            return null;
+        } catch (SQLException e) {
+            throw new CloudRuntimeException("Error while retrieving value of 
hidden configuration 'js.interpretation.enabled'.", e);
+        }
+    }
+
+    protected void updateJsInterpretationEnabledFields(Connection conn, String 
encryptedValue) {
+        String query = "UPDATE cloud.configuration SET value = ?, category = 
'System' WHERE name = 'js.interpretation.enabled';";

Review Comment:
   ```suggestion
           String query = "UPDATE cloud.configuration SET value = ?, category = 
'System' WHERE name = 'js.interpretation.enabled' AND category = 'Hidden';";
   ```
   
   to be specific



-- 
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]

Reply via email to