"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "spring-boot-project/spring-boot/src/main/java/org/springframework/boot/convert/PeriodStyle.java" between
spring-boot-2.7.3.tar.gz and spring-boot-2.7.4.tar.gz

About: Spring Boot helps to create Spring-powered, production-grade applications and services.

PeriodStyle.java  (spring-boot-2.7.3):PeriodStyle.java  (spring-boot-2.7.4)
/* /*
* Copyright 2002-2020 the original author or authors. * Copyright 2002-2022 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* https://www.apache.org/licenses/LICENSE-2.0 * https://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
skipping to change at line 32 skipping to change at line 32
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import org.springframework.util.Assert; import org.springframework.util.Assert;
/** /**
* A standard set of {@link Period} units. * A standard set of {@link Period} units.
* *
* @author Eddú Meléndez * @author Eddú Meléndez
* @author Edson Chávez * @author Edson Chávez
* @author Valentine Wu
* @since 2.3.0 * @since 2.3.0
* @see Period * @see Period
*/ */
public enum PeriodStyle { public enum PeriodStyle {
/** /**
* Simple formatting, for example '1d'. * Simple formatting, for example '1d'.
*/ */
SIMPLE("^" + "(?:([-+]?[0-9]+)Y)?" + "(?:([-+]?[0-9]+)M)?" + "(?:([-+]?[0 -9]+)W)?" + "(?:([-+]?[0-9]+)D)?" + "$", SIMPLE("^" + "(?:([-+]?[0-9]+)Y)?" + "(?:([-+]?[0-9]+)M)?" + "(?:([-+]?[0 -9]+)W)?" + "(?:([-+]?[0-9]+)D)?" + "$",
Pattern.CASE_INSENSITIVE) { Pattern.CASE_INSENSITIVE) {
skipping to change at line 105 skipping to change at line 106
if (!unit.isZero(value)) { if (!unit.isZero(value)) {
result.append(unit.print(value)); result.append(unit.print(value));
} }
} }
}, },
/** /**
* ISO-8601 formatting. * ISO-8601 formatting.
*/ */
ISO8601("^[+-]?P.*$", 0) { ISO8601("^[+-]?P.*$", Pattern.CASE_INSENSITIVE) {
@Override @Override
public Period parse(String value, ChronoUnit unit) { public Period parse(String value, ChronoUnit unit) {
try { try {
return Period.parse(value); return Period.parse(value);
} }
catch (Exception ex) { catch (Exception ex) {
throw new IllegalArgumentException("'" + value + "' is not a valid ISO-8601 period", ex); throw new IllegalArgumentException("'" + value + "' is not a valid ISO-8601 period", ex);
} }
} }
 End of changes. 3 change blocks. 
2 lines changed or deleted 3 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)