[#10571] - Gllobal Properties not being set

Category:
Bug report
Priority:
Normal
Status:
New
Project: Severity:
Minor
Resolution:
Open
Component: Reproducibility:
N/A
Assigned to:
0

Code block 1
String dataSourceLocation = JRProperties.getProperty("datasource.file");
System.out.println("Reading datasource.file property, value: " + dataSourceLocation);

if(dataSourceLocation == null || dataSourceLocation.equals("")){
dsLocation = "D:\\temp\\datasource.xml";
System.out.println("No datasource specified in property \"datasource.file\" using default value: " + dataSourceLocation);
}

ds = new HubXmlFileDataSource(dataSourceLocation, new CustomXmlStaxParser());

//Code block 2
JasperReportsContext jasperReportsContext = DefaultJasperReportsContext.getInstance();
JRPropertiesUtil jasperPropertyUtil = JRPropertiesUtil.getInstance(jasperReportsContext);

String dataSourceLocation = jasperPropertyUtil.getProperty("datasource.file");

if(dataSourceLocation == null || dataSourceLocation.equals("")){
//Use the temp directory if no datasource property has been specified.
dataSourceLocation = "D:\\temp\\datasource.xml";
writer.write("No datasource specified in property \"datasource.file\" using default value: " + dsLocation + "\n\n");
}

ds = new HubXmlFileDataSource(dataSourceLocation, new CustomXmlStaxParser());

****************************************************************************************************************************************

Team,

I am currently trying to upgrade from iReports 3.7.6 to JasperStudio 6.5.1 using TIB_js-studiocomm_6.5.0.final_windows_x86_64.zip.

I am having the following problem:

1). In iReports we use a custom DataSource Adapter that reads a global JRProperty we add in iReports (the property name is datasource.file). This defines our datasource file location so we know which datasource file to read. The relevent code is shown in code block 1.

We can change the datasource file location by iReports by editing the property in the global property edditor panel.

2). The updated code that uses JasperReports.6.5.1 jar no longer uses JRProperties (it has been deprecated), so the new code uses JRPropertiesUtil - see code block 2:

What I am seing is that while I can add new properties/ edit existing properties in the Global Properties Panel they are not being saved or persisted. The getProperty method always return the default values or null for any new one I add (like datasource.file).

Can you please help me understand this issue.

Thanks team

cwilson_2's picture
Joined: Feb 28 2018 - 1:17pm
Last seen: 6 months 3 weeks ago
Feedback