{"action":"created","issue":{"url":"https://api.github.com/repos/jmrozanec/cron-utils/issues/89","repository_url":"https://api.github.com/repos/jmrozanec/cron-utils","labels_url":"https://api.github.com/repos/jmrozanec/cron-utils/issues/89/labels{/name}","comments_url":"https://api.github.com/repos/jmrozanec/cron-utils/issues/89/comments","events_url":"https://api.github.com/repos/jmrozanec/cron-utils/issues/89/events","html_url":"https://github.com/jmrozanec/cron-utils/issues/89","id":156761086,"number":89,"title":"[4.0.0] regression - NumberFormatException: For input string: \"$\"","user":{"login":"francisdb","id":161305,"avatar_url":"https://avatars.githubusercontent.com/u/161305?v=3","gravatar_id":"","url":"https://api.github.com/users/francisdb","html_url":"https://github.com/francisdb","followers_url":"https://api.github.com/users/francisdb/followers","following_url":"https://api.github.com/users/francisdb/following{/other_user}","gists_url":"https://api.github.com/users/francisdb/gists{/gist_id}","starred_url":"https://api.github.com/users/francisdb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/francisdb/subscriptions","organizations_url":"https://api.github.com/users/francisdb/orgs","repos_url":"https://api.github.com/users/francisdb/repos","events_url":"https://api.github.com/users/francisdb/events{/privacy}","received_events_url":"https://api.github.com/users/francisdb/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/jmrozanec/cron-utils/labels/bug","name":"bug","color":"fc2929"},{"url":"https://api.github.com/repos/jmrozanec/cron-utils/labels/helpwanted","name":"helpwanted","color":"0052cc"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-05-25T14:11:54Z","updated_at":"2016-05-25T16:27:04Z","closed_at":null,"body":"We have a test like this\r\n\r\n```scala\r\n  \"throw an exception for invalid cron expression with unknown char\" in {\r\n      parse(\"* * * * $ ?\") must throwA[IllegalArgumentException](\r\n        Pattern.quote(\"Invalid chars in expression! Expression: $ Invalid chars: $\")\r\n      )\r\n    }\r\n```\r\n\r\nbut with 4.0.0 this now fails with a IllegalArgumentException with message `java.lang.NumberFormatException: For input string: \"$\"'`\r\nThis is way to technical to show to an enduser\r\n\r\nthis seems to be a regression from #11 where this was fixed:\r\nhttps://github.com/jmrozanec/cron-utils/commit/7bb8f323d09a47776ae30a372ab721c32be80708#diff-6effbc1e4c5d8c95168d63f715564b44R149\r\n\r\nMost of the tests only test for exceptions thrown without validating messages:\r\nhttps://github.com/jmrozanec/cron-utils/commit/7bb8f323d09a47776ae30a372ab721c32be80708#diff-b9ebcbf03bf1827c5a96cb483e84ea62R37\r\n"},"comment":{"url":"https://api.github.com/repos/jmrozanec/cron-utils/issues/comments/221630446","html_url":"https://github.com/jmrozanec/cron-utils/issues/89#issuecomment-221630446","issue_url":"https://api.github.com/repos/jmrozanec/cron-utils/issues/89","id":221630446,"user":{"login":"francisdb","id":161305,"avatar_url":"https://avatars.githubusercontent.com/u/161305?v=3","gravatar_id":"","url":"https://api.github.com/users/francisdb","html_url":"https://github.com/francisdb","followers_url":"https://api.github.com/users/francisdb/followers","following_url":"https://api.github.com/users/francisdb/following{/other_user}","gists_url":"https://api.github.com/users/francisdb/gists{/gist_id}","starred_url":"https://api.github.com/users/francisdb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/francisdb/subscriptions","organizations_url":"https://api.github.com/users/francisdb/orgs","repos_url":"https://api.github.com/users/francisdb/repos","events_url":"https://api.github.com/users/francisdb/events{/privacy}","received_events_url":"https://api.github.com/users/francisdb/received_events","type":"User","site_admin":false},"created_at":"2016-05-25T16:27:04Z","updated_at":"2016-05-25T16:27:04Z","body":"just pasting this blob, we have a wrapper class we use\r\n\r\n```scala\r\n \"Validating a cron expression\" should {\r\n\r\n    \"succeed for a valid cron expression 0 0/15 * * * ?\" in {\r\n      CronUtil.validateCronExpression(\"0 0/15 * * * ?\", true)\r\n      success\r\n    }\r\n\r\n    \"throw an exception when given an invalid cron expression for quartz\" in {\r\n      CronUtil.validateCronExpression(\"0 30 17 4 1 * 2016\", false) must throwA[IllegalArgumentException](\r\n        Pattern.quote(\"Both, a day-of-week AND a day-of-month parameter, are not supported.\")\r\n      )\r\n    }\r\n\r\n    \"throw an exception for invalid cron expression with unknown char\" in {\r\n      CronUtil.validateCronExpression(\"* * * * $ ?\", false) must throwA[IllegalArgumentException](\r\n        // TODO should be better with https://github.com/jmrozanec/cron-utils/issues/89\r\n        Pattern.quote(\"\"\"java.lang.NumberFormatException: For input string: \"$\"\"\"\")\r\n      )\r\n    }\r\n\r\n    \"for an invalid quartz cron expression throw an exception with message containing the actual expression\" in {\r\n      skipped(\"https://github.com/jmrozanec/cron-utils/issues/90\")\r\n      CronUtil.validateCronExpression(\"0/1 * * * * *\", false) must throwA[IllegalArgumentException](\r\n        Pattern.quote(\"\"\"Invalid cron expression: 0/1 * * * * *. Both, a day-of-week AND a day-of-month parameter, are not supported.\"\"\")\r\n      )\r\n    }\r\n  }\r\n\r\n  \"Calculating the minimum interval for a cron expression\" should {\r\n\r\n    \"be 1 for * * * * * ?\" in {\r\n      CronUtil.getShortestPeriodSeconds(\"* * * * * ?\", Duration.ZERO) must be equalTo Duration.ofSeconds(1)\r\n    }\r\n\r\n    \"be 1 for *   *    *  *       * ? (ignore whitespace)\" in {\r\n      CronUtil.getShortestPeriodSeconds(\"* * * * * ?\", Duration.ZERO) must be equalTo Duration.ofSeconds(1)\r\n    }\r\n\r\n    \"be 1 for 0/1 * * * * ?\" in {\r\n      CronUtil.getShortestPeriodSeconds(\"0/1 * * * * ?\", Duration.ZERO) must be equalTo Duration.ofSeconds(1)\r\n    }\r\n\r\n    \"be 1 for */1 * * * * ?\" in {\r\n      CronUtil.getShortestPeriodSeconds(\"*/1 * * * * ?\", Duration.ZERO) must be equalTo Duration.ofSeconds(1)\r\n    }\r\n\r\n    \"be 60 for 0 * * * * ?\" in {\r\n      CronUtil.getShortestPeriodSeconds(\"0 * * * * ?\", Duration.ZERO) must be equalTo Duration.ofMinutes(1)\r\n    }\r\n\r\n    \"be 60 for 0 */1 * * * ?\" in {\r\n      CronUtil.getShortestPeriodSeconds(\"0 */1 * * * ?\", Duration.ZERO) must be equalTo Duration.ofMinutes(1)\r\n    }\r\n\r\n    \"be 300 for 0 */5 * * * ?\" in {\r\n      CronUtil.getShortestPeriodSeconds(\"0 */5 * * * ?\", Duration.ZERO) must be equalTo Duration.ofMinutes(5)\r\n    }\r\n\r\n    \"be 3600 for 0 0 * * * ?\" in {\r\n      CronUtil.getShortestPeriodSeconds(\"0 0 * * * ?\", Duration.ZERO) must be equalTo Duration.ofHours(1)\r\n    }\r\n\r\n    \"be 10800 for 0 0 */3 * * ?\" in {\r\n      CronUtil.getShortestPeriodSeconds(\"0 0 */3 * * ?\", Duration.ZERO) must be equalTo Duration.ofHours(3)\r\n    }\r\n\r\n    \"be 86400 for 0 0 0 * * ?\" in {\r\n      CronUtil.getShortestPeriodSeconds(\"0 0 0 * * ?\", Duration.ofDays(1)) must be equalTo Duration.ofDays(1)\r\n    }\r\n\r\n    \"throw an exception for invalid cron expression * *\" in {\r\n      CronUtil.getShortestPeriodSeconds(\"* *\", Duration.ZERO) must throwA[IllegalArgumentException](\r\n        Pattern.quote(\"Cron expression contains 2 parts but we expect one of [6, 7]\")\r\n      )\r\n    }\r\n\r\n    \"throw an exception for invalid cron expression */ * * * * ?\" in {\r\n      CronUtil.getShortestPeriodSeconds(\"*/ * * * * ?\", Duration.ZERO) must throwA[IllegalArgumentException](\r\n        Pattern.quote(\"Missing steps for expression: */\")\r\n      )\r\n    }\r\n\r\n    \"throw an exception for invalid cron expression with unknown char\" in {\r\n      CronUtil.getShortestPeriodSeconds(\"* * * * $ ?\", Duration.ZERO) must throwA[IllegalArgumentException](\r\n        // TODO should be better with https://github.com/jmrozanec/cron-utils/issues/89\r\n        Pattern.quote(\"\"\"java.lang.NumberFormatException: For input string: \"$\"\"\"\")\r\n      )\r\n    }\r\n```"}}
{"actor":{"display_login":"francisdb"}}