Missing Input Quotation
Description
Acceptance / Success Criteria
Lucidchart Diagrams
Activity

Matt Brozowski January 17, 2012 at 4:41 PM

Matt Brozowski January 17, 2012 at 4:41 PM
Dr it hurts when I do this.

Daniel Hammon December 21, 2011 at 12:00 PM
OK, I have this node in my database:
[ RECORD 1 ]----+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
nodeid | 5555
dpname | localhost
nodecreatetime | 2010-12-17 12:18:06.538+01
nodeparentid |
nodetype | A
nodesysoid | .1.3.6.1.4.1.9.1.283
nodesysname | nodelabe.domain.tld
nodesysdescription | Cisco Internetwork Operating System Software ..IOS (tm) s72033_rp Software (s72033_rp-IPSERVICESK9-M), Version 12.2(18)SXF16, RELEASE SOFTWARE (fc2)..Technical Support: http://www.cisco.com/techsupport..Copyright (c) 1986-2009 by cisco Systems, Inc...Comp
nodesyslocation | DF/RZ/PM3
nodesyscontact | someone
nodelabel | nodelabel'
I go to Reports -> Online Reports and select "Response Time Summary for node - This Month".
As a result I receive this exception in the webui:
net.sf.jasperreports.engine.JRException
at net.sf.jasperreports.engine.query.JRJdbcQueryExecuter.createDatasource(JRJdbcQueryExecuter.java:143)
at net.sf.jasperreports.engine.fill.JRFillDataset.createQueryDatasource(JRFillDataset.java:684)
at net.sf.jasperreports.engine.fill.JRFillDataset.initDatasource(JRFillDataset.java:605)
at net.sf.jasperreports.engine.fill.JRBaseFiller.setParameters(JRBaseFiller.java:1281)
at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:901)
at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:845)
at net.sf.jasperreports.engine.fill.JRFillSubreport.fillSubreport(JRFillSubreport.java:609)
at net.sf.jasperreports.engine.fill.JRSubreportRunnable.run(JRSubreportRunnable.java:59)
at net.sf.jasperreports.engine.fill.JRThreadSubreportRunner.run(JRThreadSubreportRunner.java:205)
at java.lang.Thread.run(Thread.java:662)
And this in the report.log:
2011-12-21 17:54:29,403 ERROR [45155723@qtp-552119045-7622] JRFillSubreport: Fill 632708594: exception
net.sf.jasperreports.engine.JRException: Error executing SQL statement for : ResponseTimeSummary_subreport
at net.sf.jasperreports.engine.query.JRJdbcQueryExecuter.createDatasource(JRJdbcQueryExecuter.java:143)
at net.sf.jasperreports.engine.fill.JRFillDataset.createQueryDatasource(JRFillDataset.java:684)
at net.sf.jasperreports.engine.fill.JRFillDataset.initDatasource(JRFillDataset.java:605)
at net.sf.jasperreports.engine.fill.JRBaseFiller.setParameters(JRBaseFiller.java:1281)
at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:901)
at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:845)
at net.sf.jasperreports.engine.fill.JRFillSubreport.fillSubreport(JRFillSubreport.java:609)
at net.sf.jasperreports.engine.fill.JRSubreportRunnable.run(JRSubreportRunnable.java:59)
at net.sf.jasperreports.engine.fill.JRThreadSubreportRunner.run(JRThreadSubreportRunner.java:205)
at java.lang.Thread.run(Thread.java:662)
Caused by: org.postgresql.util.PSQLException: ERROR: unterminated quoted string at or near "'DFSK01'')
AS
active_nodes
ON
(outages_scope.nodeid = active_nodes.nodeid))
AS
node_outages
GROUP BY
node_outages.categoryname,
node_outages.nodelabel,
node_outages.nodesyslocation,
node_outages.nodesysdescription,
node_outages.avail_total
ORDER BY
node_outages.categoryname ASC,
node_outages.nodelabel"
Position: 2221
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2102)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1835)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257)
at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:500)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:388)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:273)
at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeQuery(NewProxyPreparedStatement.java:76)
at net.sf.jasperreports.engine.query.JRJdbcQueryExecuter.createDatasource(JRJdbcQueryExecuter.java:137)
... 9 more
Hope that helps.

Donald Desloge December 20, 2011 at 3:32 PM
So, you have a node in the database with a single quote in it like nodelabel's and its causing an exception in the ResponseTimeSummary_subreport.
I have not been able to reproduce this error. I've added a node into OpenNMS name NodeLabel's and the report seems to fun fine when that node is in the set of nodes used for the report. If this is not what's happening please reply with how you are able to reproduce this issue to better help me.
I have a node in my database calle nodelabel' with a single quote appended.
Now I see a log entry in misc.log log saying it can´t query the database becouse of a quoting issue.
The input "nodelabel" is not quotet or encoded.
Here is the Stack Trace.
2011-12-05 16:31:33,395 WARN [databaseReport_Worker-1] LoggingJobHistoryPlugin: Job DEFAULT.batchReportJobDetail execution failed at 16:31:33 12/05/2011 and reports: org.quartz.SchedulerException: Job threw an unhandled exception. [See nested exception: net.sf.jasperreports.engine.JRRuntimeException: net.sf.jasperreports.engine.JRException: Error executing SQL statement for : ResponseTimeSummary_subreport]
org.quartz.JobExecutionException: org.quartz.SchedulerException: Job threw an unhandled exception. [See nested exception: net.sf.jasperreports.engine.JRRuntimeException: net.sf.jasperreports.engine.JRException: Error executing SQL statement for : ResponseTimeSummary_subreport] [See nested exception: org.quartz.SchedulerException: Job threw an unhandled exception. [See nested exception: net.sf.jasperreports.engine.JRRuntimeException: net.sf.jasperreports.engine.JRException: Error executing SQL statement for : ResponseTimeSummary_subreport]]
at org.quartz.core.JobRunShell.run(JobRunShell.java:219)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:525)
Caused by: org.quartz.SchedulerException: Job threw an unhandled exception. [See nested exception: net.sf.jasperreports.engine.JRRuntimeException: net.sf.jasperreports.engine.JRException: Error executing SQL statement for : ResponseTimeSummary_subreport]
at org.quartz.core.JobRunShell.run(JobRunShell.java:213)
... 1 more
Caused by: net.sf.jasperreports.engine.JRRuntimeException: net.sf.jasperreports.engine.JRException: Error executing SQL statement for : ResponseTimeSummary_subreport
at net.sf.jasperreports.engine.fill.JRFillSubreport.prepare(JRFillSubreport.java:711)
at net.sf.jasperreports.engine.fill.JRFillElementContainer.prepareElements(JRFillElementContainer.java:329)
at net.sf.jasperreports.engine.fill.JRFillBand.fill(JRFillBand.java:419)
at net.sf.jasperreports.engine.fill.JRFillBand.fill(JRFillBand.java:378)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillColumnBand(JRVerticalFiller.java:2035)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillGroupFooter(JRVerticalFiller.java:925)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillGroupFooters(JRVerticalFiller.java:791)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportContent(JRVerticalFiller.java:281)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:132)
at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:946)
at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:845)
at net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:58)
at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:417)
at net.sf.jasperreports.engine.JasperFillManager.fillReportToFile(JasperFillManager.java:199)
at org.opennms.reporting.jasperreports.svclayer.JasperReportService.run(JasperReportService.java:386)
at org.opennms.reporting.core.svclayer.support.DefaultReportWrapperService.run(DefaultReportWrapperService.java:185)
at org.opennms.reporting.core.BatchReportJob.executeInternal(BatchReportJob.java:80)
at org.springframework.scheduling.quartz.QuartzJobBean.execute(QuartzJobBean.java:86)
at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
... 1 more
Caused by: net.sf.jasperreports.engine.JRException: Error executing SQL statement for : ResponseTimeSummary_subreport
at net.sf.jasperreports.engine.query.JRJdbcQueryExecuter.createDatasource(JRJdbcQueryExecuter.java:143)
at net.sf.jasperreports.engine.fill.JRFillDataset.createQueryDatasource(JRFillDataset.java:684)
at net.sf.jasperreports.engine.fill.JRFillDataset.initDatasource(JRFillDataset.java:605)
at net.sf.jasperreports.engine.fill.JRBaseFiller.setParameters(JRBaseFiller.java:1281)
at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:901)
at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:845)
at net.sf.jasperreports.engine.fill.JRFillSubreport.fillSubreport(JRFillSubreport.java:609)
at net.sf.jasperreports.engine.fill.JRSubreportRunnable.run(JRSubreportRunnable.java:59)
at net.sf.jasperreports.engine.fill.JRThreadSubreportRunner.run(JRThreadSubreportRunner.java:205)
at java.lang.Thread.run(Thread.java:662)
Caused by: org.postgresql.util.PSQLException: ERROR: unterminated quoted string at or near "'nodelabel'')
AS
active_nodes
ON
(outages_scope.nodeid = active_nodes.nodeid))
AS
node_outages
GROUP BY
node_outages.categoryname,
node_outages.nodelabel,
node_outages.nodesyslocation,
node_outages.nodesysdescription,
node_outages.avail_total
ORDER BY
node_outages.categoryname ASC,
node_outages.nodelabel"
Position: 2221
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2102)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1835)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257)
at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:500)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:388)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:273)
at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeQuery(NewProxyPreparedStatement.java:76)
at net.sf.jasperreports.engine.query.JRJdbcQueryExecuter.createDatasource(JRJdbcQueryExecuter.java:137)
... 9 more