From 8fa6abf69759470fb414a0c80afdefad27d59a78 Mon Sep 17 00:00:00 2001 From: lasanthaDLPDS Date: Thu, 4 Apr 2019 08:37:48 +0530 Subject: [PATCH] Fix h2 SQL syntax errors --- .../application/mgt/core/dao/common/Util.java | 2 +- .../GenericApplicationDAOImpl.java | 6 +++--- .../mgt/core/impl/ApplicationManagerImpl.java | 20 ++++++++++--------- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/common/Util.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/common/Util.java index bc564ca7e1..bb1fc705eb 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/common/Util.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/common/Util.java @@ -151,7 +151,7 @@ public class Util { appRelease.setScreenshotName2("RELEASE_SC2"); appRelease.setScreenshotName3("RELEASE_SC3"); appRelease.setPrice(rs.getDouble(" RELEASE_PRICE")); - appRelease.setMetaData(rs.getString("RELEASE.META_INFO")); + appRelease.setMetaData(rs.getString("RELEASE_META_INFO")); appRelease.setSupportedOsVersions(rs.getString("RELEASE_SUP_OS_VERSIONS")); appRelease.setRating(rs.getDouble("RELEASE_RATING")); appRelease.setCurrentState(rs.getString("RELEASE_CURRENT_STATE")); diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/application/GenericApplicationDAOImpl.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/application/GenericApplicationDAOImpl.java index 5b7ba8c60e..213926a6c5 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/application/GenericApplicationDAOImpl.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/application/GenericApplicationDAOImpl.java @@ -268,16 +268,16 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic + "AP_APP_RELEASE.SC_2_LOCATION AS AP_RELEASE_SC2, " + "AP_APP_RELEASE.SC_3_LOCATION AS AP_RELEASE_SC3, " + "AP_APP_RELEASE.APP_PRICE AS RELEASE_PRICE, " - + "AP_APP_RELEASE.APP_META_INFO AS RELEASE.META_INFO, " + + "AP_APP_RELEASE.APP_META_INFO AS RELEASE_META_INFO, " + "AP_APP_RELEASE.SUPPORTED_OS_VERSIONS AS RELEASE_SUP_OS_VERSIONS, " + "AP_APP_RELEASE.RATING AS RELEASE_RATING, " + "AP_APP_RELEASE.CURRENT_STATE AS RELEASE_CURRENT_STATE, " + "AP_APP_RELEASE.RATED_USERS AS RATED_USER_COUNT " + "FROM AP_APP " + "INNER JOIN AP_APP_RELEASE ON " - + "APP_APP.ID = APP_APP_RELEASE.AP_APP_ID AND " + + "AP_APP.ID = AP_APP_RELEASE.AP_APP_ID AND " + "AP_APP.TENANT_ID = ? AND " - + "AP_APP.TENANT_ID = APP_APP_RELEASE.TENANT_ID"; + + "AP_APP.TENANT_ID = AP_APP_RELEASE.TENANT_ID"; if (filter == null) { throw new ApplicationManagementDAOException("Filter need to be instantiated"); diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/ApplicationManagerImpl.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/ApplicationManagerImpl.java index 0b1298e4dd..527e08b352 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/ApplicationManagerImpl.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/ApplicationManagerImpl.java @@ -155,19 +155,21 @@ public class ApplicationManagerImpl implements ApplicationManager { applicationReleaseEntity.setBannerName(applicationArtifact.getBannername()); Map screenshots = applicationArtifact.getScreenshots(); - List scrrenshotnames = new ArrayList<>(screenshots.keySet()); + List screenshotNames = new ArrayList<>(screenshots.keySet()); - for (int i = 1; i <= scrrenshotnames.size(); i++) { - if (i == 1) { - applicationReleaseEntity.setScreenshotName1(scrrenshotnames.get(i)); - } else if (i == 2) { - applicationReleaseEntity.setScreenshotName2(scrrenshotnames.get(i)); - - } else if (i == 3) { - applicationReleaseEntity.setScreenshotName3(scrrenshotnames.get(i)); + int counter = 1; + for (String scName : screenshotNames) { + if (counter == 1) { + applicationReleaseEntity.setScreenshotName1(scName); + } else if (counter == 2) { + applicationReleaseEntity.setScreenshotName2(scName); + } else if (counter == 3) { + applicationReleaseEntity.setScreenshotName3(scName); } + counter++; } + // Upload images applicationReleaseEntity = applicationStorageManager .uploadImageArtifacts(applicationReleaseEntity, applicationArtifact.getIconStream(),