Skip to content

Commit 90f94f6

Browse files
committed
WW-5455 Uses defaultDelimiter as more meaningful name
1 parent 5d19ccb commit 90f94f6

File tree

5 files changed

+16
-12
lines changed

5 files changed

+16
-12
lines changed

plugins/jasperreports7/src/main/java/org/apache/struts2/views/jasperreports7/JasperReport7Aware.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,16 @@ public interface JasperReport7Aware {
3131
*
3232
* @param invocation current {@link ActionInvocation}
3333
*/
34-
void beforeReportGeneration(ActionInvocation invocation) throws StrutsException;
34+
default void beforeReportGeneration(ActionInvocation invocation) throws StrutsException {
35+
}
3536

3637
/**
3738
* Used to perform an action before report is going to be generated
3839
*
3940
* @param invocation current {@link ActionInvocation}
4041
*/
41-
void afterReportGeneration(ActionInvocation invocation, JasperReport jasperReport) throws StrutsException;
42+
default void afterReportGeneration(ActionInvocation invocation, JasperReport jasperReport) throws StrutsException {
43+
}
4244

4345
/**
4446
* Allows to specify action specific CSV delimiter, if returns null,
@@ -51,7 +53,8 @@ default String getCsvDelimiter(ActionInvocation invocation) {
5153
}
5254

5355
/**
54-
* Allows to specify different local than used by framework or action
56+
* Allows to specify different local than used by the framework or an action
57+
*
5558
* @param invocation current {@link ActionInvocation}
5659
* @return locale or null
5760
*/

plugins/jasperreports7/src/main/java/org/apache/struts2/views/jasperreports7/JasperReport7Constants.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public interface JasperReport7Constants {
5353
/**
5454
* Allows to define a custom default delimiter when exporting report into CSV file
5555
*/
56-
String STRUTS_JASPER_REPORT_CSV_DELIMITER = "struts.jasperReport7.csv.delimiter";
56+
String STRUTS_JASPER_REPORT_CSV_DELIMITER = "struts.jasperReport7.csv.defaultDelimiter";
5757

5858
/**
5959
* Allows to define a custom url to image servlet used when exporting report into HTML

plugins/jasperreports7/src/main/java/org/apache/struts2/views/jasperreports7/JasperReport7Result.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,7 @@ protected void applyTimeZone(ActionInvocation invocation, Map<String, Object> pa
257257
}
258258
}
259259

260+
@SuppressWarnings("unchecked")
260261
protected void applyCustomParameters(ValueStack stack, Map<String, Object> parameters) {
261262
boolean evaluated = parsedReportParameters != null && !parsedReportParameters.equals(reportParameters);
262263
boolean reevaluate = !evaluated || isAcceptableExpression(parsedReportParameters);

plugins/jasperreports7/src/main/java/org/apache/struts2/views/jasperreports7/export/JasperReport7CsvExporterProvider.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,18 +44,18 @@ public class JasperReport7CsvExporterProvider implements JasperReport7ExporterPr
4444
/**
4545
* A delimiter used when generating CSV report. By default, "," is used.
4646
*/
47-
private String delimiter = ",";
47+
private String defaultDelimiter = ",";
4848

4949
public JasperReport7CsvExporterProvider() {
5050
}
5151

5252
public JasperReport7CsvExporterProvider(
5353
@Inject(value = JasperReport7Constants.STRUTS_JASPER_REPORT_CSV_DELIMITER, required = false)
54-
String delimiter
54+
String defaultDelimiter
5555
) {
56-
if (StringUtils.isNoneEmpty(delimiter)) {
57-
LOG.debug("Using custom delimiter [{}]", delimiter);
58-
this.delimiter = delimiter;
56+
if (StringUtils.isNoneEmpty(defaultDelimiter)) {
57+
LOG.debug("Using custom delimiter [{}]", defaultDelimiter);
58+
this.defaultDelimiter = defaultDelimiter;
5959
}
6060
}
6161

@@ -72,8 +72,8 @@ public JRCsvExporter createExporter(ActionInvocation invocation, JasperPrint jas
7272
if (invocation.getAction() instanceof JasperReport7Aware action) {
7373
reportDelimiter = action.getCsvDelimiter(invocation);
7474
}
75-
if (reportDelimiter == null) {
76-
reportDelimiter = delimiter;
75+
if (StringUtils.isEmpty(reportDelimiter)) {
76+
reportDelimiter = defaultDelimiter;
7777
}
7878
LOG.debug("Using delimiter: [{}]", reportDelimiter);
7979

plugins/jasperreports7/src/main/resources/struts-plugin.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"https://struts.apache.org/dtds/struts-6.0.dtd">
2525

2626
<struts>
27-
<constant name="struts.jasperReport7.csv.delimiter" value=","/>
27+
<constant name="struts.jasperReport7.csv.defaultDelimiter" value=","/>
2828

2929
<bean name="pdf"
3030
class="org.apache.struts2.views.jasperreports7.export.JasperReport7PdfExporterProvider"

0 commit comments

Comments
 (0)