|
|
@@ -299,7 +299,7 @@ public class CrystalToJasper {
|
|
|
// XPath格式为:/*[name()='Meta']
|
|
|
Node node = document.selectSingleNode("//*[name()='Title']");
|
|
|
String text = node.getText();
|
|
|
- text = text.substring(0, text.length() - ".RPT".length());
|
|
|
+ text = text.endsWith(".RPT") ? text.substring(0, text.length() - ".RPT".length()) : text;
|
|
|
return text;
|
|
|
}
|
|
|
|
|
|
@@ -485,16 +485,22 @@ public class CrystalToJasper {
|
|
|
if (sortTypeElement != null) {
|
|
|
sortType = sortTypeElement.attributeValue("value");
|
|
|
}
|
|
|
- Sort sort = new Sort(field, getSortType(sortType));
|
|
|
- sorts.add(sort);
|
|
|
+ SortType sortType2 = getSortType(sortType);
|
|
|
+ if (sortType2 != null) {
|
|
|
+ Sort sort = new Sort(field, sortType2);
|
|
|
+ sorts.add(sort);
|
|
|
+ }
|
|
|
}
|
|
|
// 普通排序字段
|
|
|
List<Element> sortElements = document.selectNodes("//SortFields/Field");
|
|
|
for (Element element : sortElements) {
|
|
|
String field = element.element("Name").attributeValue("value");
|
|
|
String sortType = element.element("Operation").attributeValue("value");
|
|
|
- Sort sort = new Sort(field, getSortType(sortType));
|
|
|
- sorts.add(sort);
|
|
|
+ SortType sortType2 = getSortType(sortType);
|
|
|
+ if (sortType2 != null) {
|
|
|
+ Sort sort = new Sort(field, getSortType(sortType));
|
|
|
+ sorts.add(sort);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
return getQueryString(columnNames, tableNames, joins, sorts);
|
|
|
@@ -538,7 +544,8 @@ public class CrystalToJasper {
|
|
|
} else if ("1".equalsIgnoreCase(type)) {
|
|
|
return SortType.DESC;
|
|
|
} else {
|
|
|
- throw new ReportException("无法解析sort类型:" + type);
|
|
|
+ logger.error("无法解析sort类型:" + type);
|
|
|
+ return null;
|
|
|
}
|
|
|
}
|
|
|
|