From 4da62c1aff1bf99a61681714572a0f5571cfb8fc Mon Sep 17 00:00:00 2001 From: Joze Rozanec Date: Sun, 28 Jul 2019 12:04:00 +0200 Subject: [PATCH] #391: Fixes issue by replacing '%p'->'replace_plural' --- src/main/java/com/cronutils/descriptor/CronDescriptor.java | 4 ++-- .../java/com/cronutils/descriptor/DescriptionStrategy.java | 4 ++-- .../com/cronutils/descriptor/TimeDescriptionStrategy.java | 2 +- .../com/cronutils/descriptor/refactor/SecondsDescriptor.java | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/cronutils/descriptor/CronDescriptor.java b/src/main/java/com/cronutils/descriptor/CronDescriptor.java index c1bca5d1..2c380b8a 100755 --- a/src/main/java/com/cronutils/descriptor/CronDescriptor.java +++ b/src/main/java/com/cronutils/descriptor/CronDescriptor.java @@ -117,7 +117,7 @@ public String describeMonth(final Map fields) { private String addTimeExpressions(final String description, final String singular, final String plural) { return description .replaceAll("%s", singular) - .replaceAll("%p", plural); + .replaceAll("replace_plural", plural); } /** @@ -139,7 +139,7 @@ public String describeDayOfWeek(final Map fields, fina private String addExpressions(final String description, final String singular, final String plural) { return description .replaceAll("%s", singular) - .replaceAll("%p", plural); + .replaceAll("replace_plural", plural); } /** diff --git a/src/main/java/com/cronutils/descriptor/DescriptionStrategy.java b/src/main/java/com/cronutils/descriptor/DescriptionStrategy.java index a9d3cf1c..de5d2f12 100755 --- a/src/main/java/com/cronutils/descriptor/DescriptionStrategy.java +++ b/src/main/java/com/cronutils/descriptor/DescriptionStrategy.java @@ -119,7 +119,7 @@ protected String describe(final And and) { final StringBuilder builder = new StringBuilder(); if (!onExpressions.isEmpty()) { builder.append(bundle.getString("at")); - createAndDescription(builder, onExpressions).append(" %p"); + createAndDescription(builder, onExpressions).append(" replace_plural"); } if (!expressions.isEmpty()) { createAndDescription(builder, expressions); @@ -148,7 +148,7 @@ protected String describe(final Between between, final boolean and) { protected String describe(final Every every, final boolean and) { String description; if (every.getPeriod().getValue() > 1) { - description = String.format("%s %s ", bundle.getString(EVERY), nominalValue(every.getPeriod())) + " %p "; + description = String.format("%s %s ", bundle.getString(EVERY), nominalValue(every.getPeriod())) + " replace_plural "; } else { description = bundle.getString(EVERY) + " %s "; } diff --git a/src/main/java/com/cronutils/descriptor/TimeDescriptionStrategy.java b/src/main/java/com/cronutils/descriptor/TimeDescriptionStrategy.java index 98675e60..b292c136 100755 --- a/src/main/java/com/cronutils/descriptor/TimeDescriptionStrategy.java +++ b/src/main/java/com/cronutils/descriptor/TimeDescriptionStrategy.java @@ -102,7 +102,7 @@ public String describe() { private String addTimeExpressions(final String description, final String singular, final String plural) { return description .replaceAll("%s", singular) - .replaceAll("%p", plural); + .replaceAll("replace_plural", plural); } /** diff --git a/src/main/java/com/cronutils/descriptor/refactor/SecondsDescriptor.java b/src/main/java/com/cronutils/descriptor/refactor/SecondsDescriptor.java index ababc1b0..44356d95 100755 --- a/src/main/java/com/cronutils/descriptor/refactor/SecondsDescriptor.java +++ b/src/main/java/com/cronutils/descriptor/refactor/SecondsDescriptor.java @@ -207,7 +207,7 @@ public Between visit(final Between between) { public Every visit(final Every every) { String description; if (every.getPeriod().getValue() > 1) { - description = String.format("%s %s ", bundle.getString(EVERY), nominalValue(every.getPeriod())) + " %p "; + description = String.format("%s %s ", bundle.getString(EVERY), nominalValue(every.getPeriod())) + " replace_plural "; } else { description = bundle.getString(EVERY) + " %s "; }