Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"3/4 5/6 7/8 9/2 10/2 ? 2017/2" throws UnknownFormatConversionException #300

Closed
Naxos84 opened this issue Dec 6, 2017 · 1 comment
Closed
Milestone

Comments

@Naxos84
Copy link
Contributor

Naxos84 commented Dec 6, 2017

public class TestDescriptor {

    // SoM MoH HoD D0M MoY  DoW Year
    // 3/4 5/6 7/8 9/2 10/2 ?   2017/2

    //Every 4 seconds starting at second 03,
    //every 6 minutes starting at minute :05,
    //every 8 hours starting at 07am,
    //every 2 days starting on the 9th,
    //every 2 months starting in October,
    //every 2 years starting in 2017
    @Test
    public void testFull() {
        final CronDefinition cronDefinition = CronDefinitionBuilder.instanceDefinitionFor(CronType.QUARTZ);
        final CronParser parser = new CronParser(cronDefinition);
        final Cron cron = parser.parse("3/4 5/6 7/8 9/2 10/2 ? 2017/2");
        System.out.println(CronDescriptor.instance().describe(cron));
    }

}

When running this I get the following Exception.

java.util.UnknownFormatConversionException: Conversion = 'p' at java.util.Formatter$FormatSpecifier.conversion(Formatter.java:2691) at java.util.Formatter$FormatSpecifier.<init>(Formatter.java:2720) at java.util.Formatter.parse(Formatter.java:2560) at java.util.Formatter.format(Formatter.java:2501) at java.util.Formatter.format(Formatter.java:2455) at java.lang.String.format(String.java:2940) at com.cronutils.descriptor.CronDescriptor.describeYear(CronDescriptor.java:152) at com.cronutils.descriptor.CronDescriptor.describe(CronDescriptor.java:69) at com.cronutils.utils.descriptor.TestDescriptor.testFull(TestDescriptor.java:28) ..........(skipped the rest)

The problem seems when describing the year.

String.format is called with "every 2%p", ["year"]

@jmrozanec jmrozanec added this to the 7.0.1 milestone Dec 6, 2017
@jmrozanec jmrozanec modified the milestones: 7.0.1, 7.0.2 Jan 6, 2018
@jmrozanec jmrozanec modified the milestones: 7.0.2, 7.0.3 Jun 2, 2018
@jmrozanec jmrozanec modified the milestones: 7.0.3, 7.0.4, 7.0.5 Aug 14, 2018
@jmrozanec jmrozanec modified the milestones: 7.0.5, next Aug 21, 2018
@jmrozanec jmrozanec modified the milestones: 7.0.6, next Oct 14, 2018
pangyikhei added a commit to pangyikhei/cron-utils that referenced this issue Oct 28, 2018
@jmrozanec
Copy link
Owner

@Naxos84 closed! Kudos to @pangyikhei!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants