Permalink
Browse files

Fixed NPE in MAQL generator

  • Loading branch information...
1 parent 0782eaa commit 91184047da1a8f73c57941e78528fcad9c5f7b31 @zsvoboda zsvoboda committed Jun 21, 2012
Showing with 18 additions and 12 deletions.
  1. +18 −12 backend/src/main/java/com/gooddata/modeling/generator/MaqlGenerator.java
@@ -266,19 +266,25 @@ private String generateFoldersMaqlDdl(List<SourceColumn> columns) {
for (SourceColumn column : columns) {
String folder = column.getFolder();
if (folder != null && folder.length() > 0) {
- if (column.getLdmType().equalsIgnoreCase(SourceColumn.LDM_TYPE_ATTRIBUTE) ||
- column.getLdmType().equalsIgnoreCase(SourceColumn.LDM_TYPE_LABEL) ||
- column.getLdmType().equalsIgnoreCase(SourceColumn.LDM_TYPE_HYPERLINK) ||
- column.getLdmType().equalsIgnoreCase(SourceColumn.LDM_TYPE_CONNECTION_POINT) ||
- column.getLdmType().equalsIgnoreCase(SourceColumn.LDM_TYPE_REFERENCE) ||
- column.getLdmType().equalsIgnoreCase(SourceColumn.LDM_TYPE_DATE)) {
- if (!attributeFolders.contains(folder))
- attributeFolders.add(folder);
+ String ldmType = column.getLdmType();
+ if(ldmType != null && ldmType.length()>0) {
+ if (column.getLdmType().equalsIgnoreCase(SourceColumn.LDM_TYPE_ATTRIBUTE) ||
+ column.getLdmType().equalsIgnoreCase(SourceColumn.LDM_TYPE_LABEL) ||
+ column.getLdmType().equalsIgnoreCase(SourceColumn.LDM_TYPE_HYPERLINK) ||
+ column.getLdmType().equalsIgnoreCase(SourceColumn.LDM_TYPE_CONNECTION_POINT) ||
+ column.getLdmType().equalsIgnoreCase(SourceColumn.LDM_TYPE_REFERENCE) ||
+ column.getLdmType().equalsIgnoreCase(SourceColumn.LDM_TYPE_DATE)) {
+ if (!attributeFolders.contains(folder))
+ attributeFolders.add(folder);
+ }
+ if (column.getLdmType().equalsIgnoreCase(SourceColumn.LDM_TYPE_FACT) ||
+ column.getLdmType().equalsIgnoreCase(SourceColumn.LDM_TYPE_DATE)) {
+ if (!factFolders.contains(folder))
+ factFolders.add(folder);
+ }
}
- if (column.getLdmType().equalsIgnoreCase(SourceColumn.LDM_TYPE_FACT) ||
- column.getLdmType().equalsIgnoreCase(SourceColumn.LDM_TYPE_DATE)) {
- if (!factFolders.contains(folder))
- factFolders.add(folder);
+ else {
+ throw new IllegalArgumentException("Column " + column.getName()+ " doesn't contain the LDM type specification.");
}
}
}

0 comments on commit 9118404

Please sign in to comment.