IF Statement in Coldfusion [closed] - stored-procedures

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 8 years ago.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Improve this question
I have a form in coldfusion file and I want to put in a if statement to check that some fields have text in them before they get sent into a stored procedure. So an if statement to check form fields are not null, if they are then some sort of text to say "please enter data"...
I want to put the if statement around this block of code...
<CFSTOREDPROC PROCEDURE="InsertOfficeLocation" DATASOURCE="#application.servernamesql02#">
<CFPROCPARAM VALUE="#country#" TYPE="IN" CFSQLTYPE="cf_sql_varchar" VARIABLE="#Country">
<CFPROCPARAM VALUE="#address#" TYPE="IN" CFSQLTYPE="cf_sql_varchar" VARIABLE="#Address">
<CFPROCPARAM VALUE="#address2#" TYPE="IN" CFSQLTYPE="cf_sql_varchar" VARIABLE="#Address2">
<CFPROCPARAM VALUE="#address3#" TYPE="IN" CFSQLTYPE="cf_sql_varchar" VARIABLE="#Address3">
<CFPROCPARAM VALUE="#address4#" TYPE="IN" CFSQLTYPE="cf_sql_varchar" VARIABLE="#Address4">
<CFPROCPARAM VALUE="#city#" TYPE="IN" CFSQLTYPE="cf_sql_varchar" VARIABLE="#City">
<CFPROCPARAM VALUE="#postcode#" TYPE="IN" CFSQLTYPE="cf_sql_varchar" VARIABLE="#PostCode">
<CFPROCPARAM VALUE="#receptionnumber#" TYPE="IN" CFSQLTYPE="cf_sql_varchar" VARIABLE="#ReceptionNumber">
<CFPROCPARAM VALUE="#mainnumber#" TYPE="IN" CFSQLTYPE="cf_sql_varchar" VARIABLE="#MainNumber">
<CFPROCPARAM VALUE="#faxnumber#" TYPE="IN" CFSQLTYPE="cf_sql_varchar" VARIABLE="#FaxNumber">
<CFPROCPARAM VALUE="#username#" TYPE="IN" CFSQLTYPE="cf_sql_varchar" VARIABLE="#Username">
<CFPROCPARAM VALUE="#timestamp#" TYPE="IN" CFSQLTYPE="cf_sql_varchar" VARIABLE="#Timestamp">
</CFSTOREDPROC>

As it stands with the code you've shown us so far and how you've phrased your question, you should only need to do something like:
<cfif len(form.country) AND len(form.address) ...>
<cfstoredproc >...</cfstoredproc>
<cfelse>
Please enter all fields
</cfif>
Although I'd probably want to do something better than that, e.g. different error messages for each field. Or using the NULL attribute on the cfprocparam to pass through null values for empty fields for instance.
Also you say these are form values; it's a good idea to scope your variables with the relevant scope.
PS: you only need to specify the variable attribute on <cfprocparam> when the type is OUT or INOUT

Related

Neo4j 2.1.6: Fixing corrupted relationships and nodes

I realize the db is old and this is a long shot...
I've got an older project that has been running on Neo4j 2.1.6 with no issues. Yesterday I started getting [{Neo.DatabaseError.Statement.ExecutionFailure }] errors when I try to make updates to the graph using Cypher via the transaction endpoint.
I finally tracked down the problem to a couple of relationships attached to a couple of nodes that seem to be corrupted/invalid. Trying to delete them on the console just returns 'null' and trying to delete them via the transaction endpoint leads to:
{"code":"Neo.DatabaseError.Statement.ExecutionFailure","message":null,"stackTrace":"java.lang.NullPointerException
org.neo4j.kernel.impl.nioneo.xa.RelationshipDeleter.updateNodesForDeletedRelationship(RelationshipDeleter.java:187)
org.neo4j.kernel.impl.nioneo.xa.RelationshipDeleter.relDelete(RelationshipDeleter.java:67)
org.neo4j.kernel.impl.nioneo.xa.NeoStoreTransactionContext.relationshipDelete(NeoStoreTransactionContext.java:85)
org.neo4j.kernel.impl.nioneo.xa.NeoStoreTransaction.relDelete(NeoStoreTransaction.java:818)
org.neo4j.kernel.impl.persistence.PersistenceManager.relDelete(PersistenceManager.java:140)
org.neo4j.kernel.impl.core.NodeManager.deleteRelationship(NodeManager.java:780)
org.neo4j.kernel.impl.api.state.OldTxStateBridgeImpl.deleteRelationship(OldTxStateBridgeImpl.java:164)
org.neo4j.kernel.impl.api.state.TxStateImpl.relationshipDoDelete(TxStateImpl.java:439)
org.neo4j.kernel.impl.api.StateHandlingStatementOperations$1.visit(StateHandlingStatementOperations.java:138)
org.neo4j.kernel.impl.api.store.CacheLayer.visit(CacheLayer.java:476)
org.neo4j.kernel.impl.api.StateHandlingStatementOperations.relationshipDelete(StateHandlingStatementOperations.java:133)
org.neo4j.kernel.impl.api.ConstraintEnforcingEntityOperations.relationshipDelete(ConstraintEnforcingEntityOperations.java:159)
org.neo4j.kernel.impl.api.LockingStatementOperations.relationshipDelete(LockingStatementOperations.java:231)
org.neo4j.kernel.impl.api.OperationsFacade.relationshipDelete(OperationsFacade.java:528)
org.neo4j.cypher.internal.spi.v2_1.TransactionBoundQueryContext$RelationshipOperations.delete(TransactionBoundQueryContext.scala:180)
org.neo4j.cypher.internal.spi.v2_1.TransactionBoundQueryContext$RelationshipOperations.delete(TransactionBoundQueryContext.scala:178)
org.neo4j.cypher.internal.compiler.v2_1.spi.DelegatingOperations.delete(DelegatingQueryContext.scala:110)
org.neo4j.cypher.internal.compiler.v2_1.spi.ExceptionTranslatingQueryContext$ExceptionTranslatingOperations.org$neo4j$cypher$internal$compiler$v2_1$spi$ExceptionTranslatingQueryContext$ExceptionTranslatingOperations$$super$delete(ExceptionTranslatingQueryContext.scala:118)
org.neo4j.cypher.internal.compiler.v2_1.spi.ExceptionTranslatingQueryContext$ExceptionTranslatingOperations$$anonfun$delete$1.apply$mcV$sp(ExceptionTranslatingQueryContext.scala:118)
org.neo4j.cypher.internal.compiler.v2_1.spi.ExceptionTranslatingQueryContext$ExceptionTranslatingOperations$$anonfun$delete$1.apply(ExceptionTranslatingQueryContext.scala:118)
org.neo4j.cypher.internal.compiler.v2_1.spi.ExceptionTranslatingQueryContext$ExceptionTranslatingOperations$$anonfun$delete$1.apply(ExceptionTranslatingQueryContext.scala:118)
org.neo4j.cypher.internal.compiler.v2_1.spi.ExceptionTranslatingQueryContext.org$neo4j$cypher$internal$compiler$v2_1$spi$ExceptionTranslatingQueryContext$$translateException(ExceptionTranslatingQueryContext.scala:152)
org.neo4j.cypher.internal.compiler.v2_1.spi.ExceptionTranslatingQueryContext$ExceptionTranslatingOperations.delete(ExceptionTranslatingQueryContext.scala:118)
org.neo4j.cypher.internal.compiler.v2_1.spi.UpdateCountingQueryContext$CountingOps.delete(UpdateCountingQueryContext.scala:120)
org.neo4j.cypher.internal.compiler.v2_1.mutation.DeleteEntityAction.org$neo4j$cypher$internal$compiler$v2_1$mutation$DeleteEntityAction$$delete(DeleteEntityAction.scala:51)
org.neo4j.cypher.internal.compiler.v2_1.mutation.DeleteEntityAction.exec(DeleteEntityAction.scala:37)
org.neo4j.cypher.internal.compiler.v2_1.pipes.ExecuteUpdateCommandsPipe.org$neo4j$cypher$internal$compiler$v2_1$pipes$ExecuteUpdateCommandsPipe$$exec(ExecuteUpdateCommandsPipe.scala:57)
org.neo4j.cypher.internal.compiler.v2_1.pipes.ExecuteUpdateCommandsPi$$$$1019fdff8b266d7d9d5647386930b3d8$$$$ands$1$$anonfun$apply$2.apply(ExecuteUpdateCommandsPipe.scala:46)
org.neo4j.cypher.internal.compiler.v2_1.pipes.ExecuteUpdateCommandsPi$$$$1019fdff8b266d7d9d5647386930b3d8$$$$ands$1$$anonfun$apply$2.apply(ExecuteUpdateCommandsPipe.scala:46)
scala.collection.Iterator$$anon$13.hasNext(Iterator.scala:371)
scala.collection.Iterator$$anon$13.hasNext(Iterator.scala:371)
org.neo4j.cypher.internal.compiler.v2_1.pipes.EmptyResultPipe.internalCreateResults(EmptyResultPipe.scala:29)
org.neo4j.cypher.internal.compiler.v2_1.pipes.PipeWithSource.createResults(Pipe.scala:105)
org.neo4j.cypher.internal.compiler.v2_1.executionplan.ExecutionPlanBuilder$$anonfun$getExecutionPlanFunction$1$$anonfun$apply$2.apply(ExecutionPlanBuilder.scala:120)
org.neo4j.cypher.internal.compiler.v2_1.executionplan.ExecutionPlanBuilder$$anonfun$getExecutionPlanFunction$1$$anonfun$apply$2.apply(ExecutionPlanBuilder.scala:119)
org.neo4j.cypher.internal.compiler.v2_1.executionplan.ExecutionWorkflowBuilder.runWithQueryState(ExecutionPlanBuilder.scala:168)
org.neo4j.cypher.internal.compiler.v2_1.executionplan.ExecutionPlanBuilder$$anonfun$getExecutionPlanFunction$1.apply(ExecutionPlanBuilder.scala:118)
org.neo4j.cypher.internal.compiler.v2_1.executionplan.ExecutionPlanBuilder$$anonfun$getExecutionPlanFunction$1.apply(ExecutionPlanBuilder.scala:103)
org.neo4j.cypher.internal.compiler.v2_1.executionplan.ExecutionPlanBuilder$$anon$1.execute(ExecutionPlanBuilder.scala:68)
org.neo4j.cypher.internal.compiler.v2_1.executionplan.ExecutionPlanBuilder$$anon$1.execute(ExecutionPlanBuilder.scala:67)
org.neo4j.cypher.internal.ExecutionPlanWrapperForV2_1.execute(CypherCompiler.scala:159)
org.neo4j.cypher.ExecutionEngine.execute(ExecutionEngine.scala:76)
org.neo4j.cypher.ExecutionEngine.execute(ExecutionEngine.scala:71)
org.neo4j.cypher.javacompat.ExecutionEngine.execute(ExecutionEngine.java:84)
org.neo4j.server.rest.transactional.TransactionHandle.executeStatements(TransactionHandle.java:277)
org.neo4j.server.rest.transactional.TransactionHandle.commit(TransactionHandle.java:139)
org.neo4j.server.rest.web.TransactionalService$2.write(TransactionalService.java:194)
com.sun.jersey.core.impl.provider.entity.StreamingOutputProvider.writeTo(StreamingOutputProvider.java:71)
com.sun.jersey.core.impl.provider.entity.StreamingOutputProvider.writeTo(StreamingOutputProvider.java:57)
com.sun.jersey.spi.container.ContainerResponse.write(ContainerResponse.java:306)
com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1437)
com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1349)
com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1339)
com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:416)
com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:537)
com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:699)
javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:698)
org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1506)
org.neo4j.server.guard.GuardingRequestFilter.doFilter(GuardingRequestFilter.java:68)
org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1477)
ch.qos.logback.access.servlet.TeeFilter.doFilter(TeeFilter.java:55)
org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1477)
org.neo4j.server.guard.GuardingRequestFilter.doFilter(GuardingRequestFilter.java:68)
org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1477)
org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:503)
org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:211)
org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1096)
org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:432)
org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:175)
org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1030)
org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:136)
org.eclipse.jetty.server.handler.HandlerList.handle(HandlerList.java:52)
org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
org.eclipse.jetty.server.handler.RequestLogHandler.handle(RequestLogHandler.java:92)
org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
org.eclipse.jetty.server.Server.handle(Server.java:445)
org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:268)
org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:229)
org.eclipse.jetty.io.AbstractConnection$ReadCallback.run(AbstractConnection.java:358)
org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:601)
org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:532)
java.lang.Thread.run(Thread.java:745)\n"
Is there anyway to nuke these relationships? Looks like the first one was corrupted two days ago and I'd prefer not to lose two days of data if at all possible.
Just in case anybody else finds their way here, Michael Hunger wrote a tool that will copy a database and skip anything that is broken which is exactly what I needed. You can find it at https://github.com/jexp/store-utils/tree/21.
Turns out all of my issues were due to one relationship attached to a NULL node... Ran the tool, copied over the fixed up database and everything is working perfectly again.

syntax error, unexpected kEND [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 7 years ago.
Improve this question
def read_dbf(paste)
#Lendo a pasta
Dir.foreach(paste) { |name|
if(File.directory?(name))
pasteSub = paste+"/"+name
Dir.foreach(pasteSub) { |subname|
puts "Pasta: #{pasteSub}"
puts subname }
end
end
}
end
end
Error: syntax error, unexpected kEND
I tried to create a block within a block and I think given problem. I am listing the contents of the folder and case folder for the content they access and read the contents of the folder as well.
Problem happened when I put the "if"
Yes, you add if and miss some end there. Try to use some editor for show you unexpected end.
def read_dbf(paste)
#Lendo a pasta
Dir.foreach(paste) {|name|
if File.directory?(name)
pasteSub = paste+"/"+name
Dir.foreach(pasteSub) {|subname|
puts "Pasta: #{pasteSub}"
puts subname
}
end
}
end

Disabling XML validation in WebHarvest

I have a mobile application already published in the Apple's app store.
This SPI client app uses a Rest API in the server side to retrieve real time information regarding buses arrivals in a specific bus stop.
The app was working like a charm for 6 months.
The Rest API uses WebHarvest to scrap the real data information from a website (for instance: http://www.metlink.org.nz/stop/4912/departures).
Few days ago the HTML page scraped from my server side code has changed by adding the following line:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
Since than, my app has stopped working.
I know I can strip the line above using regExp but I would like to know if there is a way to inform WebHarvest to disable the XML validation. Disabling XML validation, I don't need to go in every configuration that I have and change my xpath expression to a regExp to strip the line above.
Here is my configuration file:
<config charset="UTF-8">
<var-def name="pageContentStr">
<html-to-xml>
<http url="http://www.metlink.org.nz/stop/${stationID.toString()}/departures" />
</html-to-xml>
</var-def>
<var-def name="serverTime">
<xpath expression="/html/body/ul/li/span/text()">
<var name="pageContentStr" />
</xpath>
</var-def>
<var-def name="busRTI">
<xpath expression="//tbody/tr[#data-code]/concat(td[1]/a[starts-with(#href,'timetables/')]/span/text(),'::',td[1]/a[starts-with(#href,'timetables/bus/')]/span/attribute::style,'::',td[2]/span/text(),'::',td[3]/span/text())">
<var name="pageContentStr" />
</xpath>
</var-def>
</config>
The config file inserted above is working fine if I run it inside WebHarvest GUI (weird). However, I receive an error when running it inside my Rest API. Here is the error that I receive:
exception
org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.webharvest.exception.ScraperXPathException: Error parsing XPath expression (XPath = [/html/body/ul/li/span/text()])!
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:948)
org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:827)
javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:812)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
root cause
org.webharvest.exception.ScraperXPathException: Error parsing XPath expression (XPath = [/html/body/ul/li/span/text()])!
org.webharvest.runtime.processors.XPathProcessor.execute(XPathProcessor.java:70)
org.webharvest.runtime.processors.BaseProcessor.run(BaseProcessor.java:115)
org.webharvest.runtime.processors.BodyProcessor.execute(BodyProcessor.java:25)
org.webharvest.runtime.processors.VarDefProcessor.execute(VarDefProcessor.java:59)
org.webharvest.runtime.processors.BaseProcessor.run(BaseProcessor.java:115)
org.webharvest.runtime.Scraper.execute(Scraper.java:166)
org.webharvest.runtime.Scraper.execute(Scraper.java:179)
com.didibaba.services.adapters.metlink.MetLinkAdapterImpl.scrapeBusesForStation(MetLinkAdapterImpl.java:147)
com.didibaba.services.adapters.metlink.MetLinkAdapterImpl.getStationBuses(MetLinkAdapterImpl.java:118)
com.didibaba.services.BusStationServiceImpl.getBusStationInfoByName(BusStationServiceImpl.java:80)
com.didibaba.web.controllers.BusStationController.getBusStationInfo(BusStationController.java:36)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:606)
org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:219)
org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132)
org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104)
org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:745)
org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:686)
org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80)
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:925)
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:856)
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:936)
org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:827)
javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:812)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
root cause
net.sf.saxon.trans.XPathException: org.xml.sax.SAXParseExceptionpublicId: -//W3C//DTD HTML 4.0 Transitional//EN; systemId: `http://www.w3.org/TR/REC-html40/loose.dtd`; lineNumber: 31; columnNumber: 3; The declaration for the entity "HTML.Version" must end with '>'.
net.sf.saxon.event.Sender.sendSAXSource(Sender.java:420)
net.sf.saxon.event.Sender.send(Sender.java:169)
net.sf.saxon.Configuration.buildDocument(Configuration.java:3346)
net.sf.saxon.Configuration.buildDocument(Configuration.java:3288)
net.sf.saxon.query.StaticQueryContext.buildDocument(StaticQueryContext.java:327)
org.webharvest.utils.XmlUtil.evaluateXPath(XmlUtil.java:77)
org.webharvest.runtime.processors.XPathProcessor.execute(XPathProcessor.java:68)
org.webharvest.runtime.processors.BaseProcessor.run(BaseProcessor.java:115)
org.webharvest.runtime.processors.BodyProcessor.execute(BodyProcessor.java:25)
org.webharvest.runtime.processors.VarDefProcessor.execute(VarDefProcessor.java:59)
org.webharvest.runtime.processors.BaseProcessor.run(BaseProcessor.java:115)
org.webharvest.runtime.Scraper.execute(Scraper.java:166)
org.webharvest.runtime.Scraper.execute(Scraper.java:179)
com.didibaba.services.adapters.metlink.MetLinkAdapterImpl.scrapeBusesForStation(MetLinkAdapterImpl.java:147)
com.didibaba.services.adapters.metlink.MetLinkAdapterImpl.getStationBuses(MetLinkAdapterImpl.java:118)
com.didibaba.services.BusStationServiceImpl.getBusStationInfoByName(BusStationServiceImpl.java:80)
com.didibaba.web.controllers.BusStationController.getBusStationInfo(BusStationController.java:36)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:606)
org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:219)
org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132)
org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104)
org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:745)
org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:686)
org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80)
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:925)
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:856)
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:936)
org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:827)
javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:812)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
root cause
org.xml.sax.SAXParseExceptionpublicId: -//W3C//DTD HTML 4.0 Transitional//EN; systemId: http://www.w3.org/TR/REC-html40/loose.dtd; lineNumber: 31; columnNumber: 3; The declaration for the entity "HTML.Version" must end with '>'.
com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:198)
com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:177)
com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:441)
com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:368)
com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1388)
com.sun.org.apache.xerces.internal.impl.XMLDTDScannerImpl.scanEntityDecl(XMLDTDScannerImpl.java:1562)
com.sun.org.apache.xerces.internal.impl.XMLDTDScannerImpl.scanDecls(XMLDTDScannerImpl.java:1964)
com.sun.org.apache.xerces.internal.impl.XMLDTDScannerImpl.scanDTDExternalSubset(XMLDTDScannerImpl.java:297)
com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$DTDDriver.dispatch(XMLDocumentScannerImpl.java:1162)
com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$DTDDriver.next(XMLDocumentScannerImpl.java:1049)
com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:962)
com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:607)
com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:116)
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:489)
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:835)
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:123)
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1210)
com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:568)
net.sf.saxon.event.Sender.sendSAXSource(Sender.java:396)
net.sf.saxon.event.Sender.send(Sender.java:169)
net.sf.saxon.Configuration.buildDocument(Configuration.java:3346)
net.sf.saxon.Configuration.buildDocument(Configuration.java:3288)
net.sf.saxon.query.StaticQueryContext.buildDocument(StaticQueryContext.java:327)
org.webharvest.utils.XmlUtil.evaluateXPath(XmlUtil.java:77)
org.webharvest.runtime.processors.XPathProcessor.execute(XPathProcessor.java:68)
org.webharvest.runtime.processors.BaseProcessor.run(BaseProcessor.java:115)
org.webharvest.runtime.processors.BodyProcessor.execute(BodyProcessor.java:25)
org.webharvest.runtime.processors.VarDefProcessor.execute(VarDefProcessor.java:59)
org.webharvest.runtime.processors.BaseProcessor.run(BaseProcessor.java:115)
org.webharvest.runtime.Scraper.execute(Scraper.java:166)
org.webharvest.runtime.Scraper.execute(Scraper.java:179)
com.didibaba.services.adapters.metlink.MetLinkAdapterImpl.scrapeBusesForStation(MetLinkAdapterImpl.java:147)
com.didibaba.services.adapters.metlink.MetLinkAdapterImpl.getStationBuses(MetLinkAdapterImpl.java:118)
com.didibaba.services.BusStationServiceImpl.getBusStationInfoByName(BusStationServiceImpl.java:80)
com.didibaba.web.controllers.BusStationController.getBusStationInfo(BusStationController.java:36)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:606)
org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:219)
org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132)
org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104)
org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:745)
org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:686)
org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80)
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:925)
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:856)
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:936)
org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:827)
javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:812)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
Thanks in advance.
you could try using a omithtmlenvelope="true" in your html-to-xml call.
<var-def name="pageContentStr">
<html-to-xml omithtmlenvelope="true">
<http url="http://www.metlink.org.nz/stop/${stationID.toString()}/departures" />
</html-to-xml>
</var-def>
However, unfortunately, as you said I cannot reproduce the error you are getting, and cannot test the result...
Had a similar issue with the xpath evaluator throwing an org.xml.sax.SAXParseException
White spaces are required between publicId and systemId.
When you can change the origin xml, the solution for this problem is already solved here.
Webharvest uses html cleaner under the hood. I use the Complete Web-Harvest project and so could prevent adding the doctype-tag on the html-to-xml.
I use html cleaner version 2.6.1., and modified org.webharvest.runtime.processors.HtmlToXmlProcessor to support this newer version
HtmlCleaner cleaner = new HtmlCleaner( );
CleanerProperties cleanerProperties = cleaner.getProperties();
As html cleaner supports an omitDoctypeDeclaration - parameter ommiting the doctype at all, I added that (in future that might be done via an extra attribute with the scraper xml).
cleanerProperties.setOmitDoctypeDeclaration(true);
Hope it helps, and thanks to the creator of webharvest, it is a great and pretty reliable tool!

tfs2013 - exportprocessconfig produces invalid xml [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 5 years ago.
Improve this question
TFS2013
Edit: Additional info as per comment:
I'm trying to add a "blocked" swim lane to my task board.
So as per instructions I run:
witadmin.exe exportprocessconfig /collection:http://{my collection} /p:{my project} /f:config.xml
It generates the XML as expected
If I immediately run (without editing the xml):
witadmin.exe importprocessconfig /collection:http://{my collection} /p:{my project} /f:config.xml /v
I get:
Line: 3 Position: 4 - The required attribute `pluralName` is missing.
So basically the XML generated by witadmin exportprocessconfig is invalid?!
exportprocessconfig creates a BROKEN xml file (according to importprocessconfig /v)
I amended line 3 from:
<BugWorkItems category="Microsoft.BugCategory" singularName="Bug">
To:
<BugWorkItems category="Microsoft.BugCategory" singularName="Bug" pluralName="Bugs">
then carried out my own changes and it worked.
Kinda sucks that the export is not compatible with the import on the same tool.

Symfony : I get a 500 instead of a 404 [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 9 years ago.
Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Improve this question
I've created custom 404 error pages for my symfony application, but they don't seem to work. In dev I see :
This request has been forwarded to a 404 error page by the action "blabla".
But in prod, the page is just blank; I get a 500 error.
In the logs, the error is :
PHP Parse error: syntax error, unexpected T_PUBLIC in /var/www/myproject/apps/myapp/modules/default/actions/actions.class.php on line 7
default/actions/actions.class.php is the following :
<?php
/**
* Error page for page not found (404) error
*
*/
public function executeError404()
{
}
public function executeSecure()
{
}
?>
I followed this tutorial on symfony-check.org
I found the answer all by myself :D
I'd forgotten part of the file :
class defaultActions extends sfActions
{
public function executeError404() {}
}

Resources