diff options
author | 2020-04-08 14:02:26 +0900 | |
---|---|---|
committer | 2020-08-27 18:45:59 +0900 | |
commit | c7cdb80d8e7ac1ea8aaaa9e5875ad1071af07440 (patch) | |
tree | 8ee901992cf44a33040e4ff6732fb2fe5156a5fa /ecomp-sdk/epsdk-analytics/src | |
parent | 23b262748c6fc10ddc8eb55036b82be7f71e120b (diff) |
NPE issue fix
Fix A "NullPointerException" could be thrown
Either log or rethrow this exception
Issue-ID: PORTAL-562
Change-Id: Iaaba9f5db6a82655739ebb96dddad928ac864b09
Signed-off-by: Parshad Patel <pars.patel@samsung.com>
Diffstat (limited to 'ecomp-sdk/epsdk-analytics/src')
2 files changed, 21 insertions, 14 deletions
diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/base/ReportWrapper.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/base/ReportWrapper.java index c5bb9c5b..27ad62f9 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/base/ReportWrapper.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/base/ReportWrapper.java @@ -183,10 +183,9 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject imp protected String reportSQLOnlyFirstPart = null; - - public ReportWrapper() { - super(); - } + public ReportWrapper() { + super(); + } private ReportWrapper(CustomReportType cr, String reportID, ReportSecurity reportSecurity) { super(); @@ -246,7 +245,8 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject imp reportSecurity = new ReportSecurity(reportID, ownerID, createID, createDate, updateID, updateDate, cr.isPublic()); - } + } // ReportWrapper + public CustomReportType getCustomReport() { return cr; } @@ -1281,7 +1281,7 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject imp if (cr.getDashBoardReportsNew() == null) addDashboardReportsNew(new ObjectFactory()); } catch (RaptorException ex) { - ex.printStackTrace(); + logger.error(EELFLoggerDelegate.debugLogger, "Exception occured in getDashBoardReportsNew ", ex); } return cr.getDashBoardReportsNew(); } @@ -1940,7 +1940,6 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject imp String chartGroup = chartGroupName.substring(0, chartGroupName.lastIndexOf("|")); int flag = 0; for (Iterator iter = reportCols.iterator(); iter.hasNext();) { - flag = 0; DataColumnType dc = (DataColumnType) iter.next(); flag = getDependsOnFormFieldFlag(dc, formValues); @@ -3169,14 +3168,19 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject imp } } } - if (nvl(fieldValue).length() == 0) + + // End + if (nvl(fieldValue).length() == 0) { + // Does not append filter with missing form + // field argument applyFilter = false; - else if (isMultiValue || "IN".equals(nvl(cf.getExpression())) - || "NOT IN".equals(nvl(cf.getExpression()))) + } else if (isMultiValue || "IN".equals(nvl(cf.getExpression())) + || "NOT IN".equals(nvl(cf.getExpression()))) { curFilter.append(formatListValue(fieldValue, dc, true, usePipeDelimiterOnly)); - else - curFilter.append(formatValue(fieldValue, dc, true, null, fft)); + } else { + curFilter.append(formatValue(fieldValue, dc, true, getColumnTableById(dc.getColId()), fft)); + } } // else curFilter.append(nvl(cf.getCloseBrackets())); @@ -4281,6 +4285,7 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject imp DataSourceList dataSourceList = objFactory.createDataSourceList(); cr.setDataSourceList(dataSourceList); } catch (DatatypeConfigurationException ex) { + logger.error(EELFLoggerDelegate.debugLogger, "Exception occured in createBlankCR ", ex); throw new RaptorException(ex.getMessage(), ex.getCause()); } return cr; diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/ReportDefinition.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/ReportDefinition.java index 16129b98..8b1cc8cb 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/ReportDefinition.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/ReportDefinition.java @@ -332,7 +332,7 @@ public class ReportDefinition extends ReportWrapper implements Serializable { DbUtils.commitTransaction(connection); } catch (RaptorException e) { - e.printStackTrace(); + logger.debug(EELFLoggerDelegate.errorLogger, "RaptorException in persistReport", e); DbUtils.rollbackTransaction(connection); throw e; } finally { @@ -664,6 +664,7 @@ public class ReportDefinition extends ReportWrapper implements Serializable { try { dct.getColFilterList().getColFilter().remove(filterPos); } catch (IndexOutOfBoundsException e) { + logger.debug(EELFLoggerDelegate.errorLogger, "IndexOutOfBoundsException in removeColumnFilter", e); } resetCache(true); @@ -796,6 +797,7 @@ public class ReportDefinition extends ReportWrapper implements Serializable { sem.setSemaphoreId(generateNewSemaphoreId()); sem.setSemaphoreName(semaphoreName); } catch (JAXBException ex) { + logger.debug(EELFLoggerDelegate.errorLogger, "JAXBException in addSemaphore", ex); throw new RaptorException(ex.getMessage(), ex.getCause()); } @@ -941,7 +943,7 @@ public class ReportDefinition extends ReportWrapper implements Serializable { fft.setRangeStartDate(DatatypeFactory.newInstance() .newXMLGregorianCalendar(rangeEndDate.YEAR, rangeEndDate.MONTH, rangeEndDate.DAY_OF_WEEK, rangeEndDate.HOUR, rangeEndDate.MINUTE, rangeEndDate.SECOND, rangeEndDate.MILLISECOND, rangeEndDate.ZONE_OFFSET)); } catch (DatatypeConfigurationException ex) { - + logger.debug(EELFLoggerDelegate.errorLogger, "DatatypeConfigurationException in addFormFieldType", ex); } fft.setRangeStartDateSQL(rangeStartDateSQL); |