You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by co...@apache.org on 2020/01/03 11:12:14 UTC
[directory-kerby] 01/02: Fixing indentation
This is an automated email from the ASF dual-hosted git repository.
coheigea pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/directory-kerby.git
commit 39bd0fcbf297b139e5974be2870b96c39a3207aa
Author: Colm O hEigeartaigh <co...@apache.org>
AuthorDate: Fri Jan 3 11:00:17 2020 +0000
Fixing indentation
---
.../src/main/java/org/apache/kerby/KOptions.java | 56 +++++++++++-----------
1 file changed, 28 insertions(+), 28 deletions(-)
diff --git a/kerby-common/kerby-util/src/main/java/org/apache/kerby/KOptions.java b/kerby-common/kerby-util/src/main/java/org/apache/kerby/KOptions.java
index d564f43..03ab1ed 100644
--- a/kerby-common/kerby-util/src/main/java/org/apache/kerby/KOptions.java
+++ b/kerby-common/kerby-util/src/main/java/org/apache/kerby/KOptions.java
@@ -90,36 +90,36 @@ public class KOptions {
return true;
}
- public static int parseDuration(String strValue) {
- int duration;
- Matcher matcherColon = Pattern.compile("\\d+(?::\\d+){0,2}").matcher(strValue);
- Matcher matcherWord = Pattern.compile("(?:(\\d+)D)?(?:(\\d+)H)?(?:(\\d+)M)?(?:(\\d+)S)?",
- Pattern.CASE_INSENSITIVE).matcher(strValue);
- if (matcherColon.matches()) {
- String[] durations = strValue.split(":");
- if (durations.length == 1) {
- duration = Integer.parseInt(durations[0]);
- } else if (durations.length == 2) {
- duration = Integer.parseInt(durations[0]) * 3600 + Integer.parseInt(durations[1]) * 60;
- } else {
- duration = Integer.parseInt(durations[0]) * 3600 + Integer.parseInt(durations[1]) * 60;
- duration += Integer.parseInt(durations[2]);
- }
- } else if (matcherWord.matches()) {
- int[] durations = new int[4];
- for (int i = 0; i < 4; i++) {
- String durationMatch = matcherWord.group(i + 1);
- if (durationMatch != null) {
- durations[i] = Integer.parseInt(durationMatch);
- }
+ public static int parseDuration(String strValue) {
+ int duration;
+ Matcher matcherColon = Pattern.compile("\\d+(?::\\d+){0,2}").matcher(strValue);
+ Matcher matcherWord = Pattern.compile("(?:(\\d+)D)?(?:(\\d+)H)?(?:(\\d+)M)?(?:(\\d+)S)?",
+ Pattern.CASE_INSENSITIVE).matcher(strValue);
+ if (matcherColon.matches()) {
+ String[] durations = strValue.split(":");
+ if (durations.length == 1) {
+ duration = Integer.parseInt(durations[0]);
+ } else if (durations.length == 2) {
+ duration = Integer.parseInt(durations[0]) * 3600 + Integer.parseInt(durations[1]) * 60;
+ } else {
+ duration = Integer.parseInt(durations[0]) * 3600 + Integer.parseInt(durations[1]) * 60;
+ duration += Integer.parseInt(durations[2]);
+ }
+ } else if (matcherWord.matches()) {
+ int[] durations = new int[4];
+ for (int i = 0; i < 4; i++) {
+ String durationMatch = matcherWord.group(i + 1);
+ if (durationMatch != null) {
+ durations[i] = Integer.parseInt(durationMatch);
+ }
+ }
+ duration = durations[0] * 86400 + durations[1] * 3600 + durations[2] * 60 + durations[3];
+ } else {
+ throw new IllegalArgumentException("Text can't be parsed to a Duration: " + strValue);
}
- duration = durations[0] * 86400 + durations[1] * 3600 + durations[2] * 60 + durations[3];
- } else {
- throw new IllegalArgumentException("Text can't be parsed to a Duration: " + strValue);
- }
- return duration;
- }
+ return duration;
+ }
public void add(KOption option) {
if (option != null) {