Skip to content

PayrollParser parseAll returning RuntimeException #18

@lopezavila85

Description

@lopezavila85

Hello,

I have run the PayrollUseCases example ("The Parthenon Architecture" section).
However, the toDeduction method throws a

java.lang.RuntimeException: No result when parsing failed

I suspect it could be due to the locale on my computer (ES, Spanish), as the decimal places are separated with a comma, not a point. The rule String passed to the toDeduction method is:

biweekly {
      federal tax          20,000000  percent,
      state tax            5,000000  percent,
      insurance premiums   200,000000  dollars,
      retirement savings   5,000000  percent
    }

So the parseAll method does not retrieve anything at all. The full stack trace:

java.lang.RuntimeException: No result when parsing failed at scala.sys.package$.error(package.scala:27) at scala.util.parsing.combinator.Parsers$NoSuccess.get(Parsers.scala:176) at scala.util.parsing.combinator.Parsers$NoSuccess.get(Parsers.scala:162) at progscala2.appdesign.parthenon.PayrollParthenon$.progscala2$appdesign$parthenon$PayrollParthenon$$toDeduction(PayrollUseCases.scala:33) at progscala2.appdesign.parthenon.PayrollParthenon$$anonfun$processRules$2.apply(PayrollUseCases.scala:42) at progscala2.appdesign.parthenon.PayrollParthenon$$anonfun$processRules$2.apply(PayrollUseCases.scala:41) at scala.collection.TraversableLike$WithFilter$$anonfun$map$2.apply(TraversableLike.scala:728) at scala.collection.Iterator$class.foreach(Iterator.scala:742) at scala.collection.AbstractIterator.foreach(Iterator.scala:1194) at scala.collection.IterableLike$class.foreach(IterableLike.scala:72) at scala.collection.AbstractIterable.foreach(Iterable.scala:54) at scala.collection.TraversableLike$WithFilter.map(TraversableLike.scala:727) at progscala2.appdesign.parthenon.PayrollParthenon$.processRules(PayrollUseCases.scala:41) at progscala2.appdesign.parthenon.PayrollParthenon$.main(PayrollUseCases.scala:72) at progscala2.appdesign.parthenon.PayrollParthenon.main(PayrollUseCases.scala) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) [trace] Stack trace suppressed: run last compile:runMain for the full output.

Regards,

Álvaro López

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions