"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/DurationStyle.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.

DurationStyle.java  (spring-boot-2.7.3):DurationStyle.java  (spring-boot-2.7.4)
/* /*
* Copyright 2012-2021 the original author or authors. * Copyright 2012-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;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
/** /**
* Duration format styles. * Duration format styles.
* *
* @author Phillip Webb * @author Phillip Webb
* @author Valentine Wu
* @since 2.0.0 * @since 2.0.0
*/ */
public enum DurationStyle { public enum DurationStyle {
/** /**
* Simple formatting, for example '1s'. * Simple formatting, for example '1s'.
*/ */
SIMPLE("^([+-]?\\d+)([a-zA-Z]{0,2})$") { SIMPLE("^([+-]?\\d+)([a-zA-Z]{0,2})$") {
@Override @Override
skipping to change at line 65 skipping to change at line 66
@Override @Override
public String print(Duration value, ChronoUnit unit) { public String print(Duration value, ChronoUnit unit) {
return Unit.fromChronoUnit(unit).print(value); return Unit.fromChronoUnit(unit).print(value);
} }
}, },
/** /**
* ISO-8601 formatting. * ISO-8601 formatting.
*/ */
ISO8601("^[+-]?P.*$") { ISO8601("^[+-]?[pP].*$") {
@Override @Override
public Duration parse(String value, ChronoUnit unit) { public Duration parse(String value, ChronoUnit unit) {
try { try {
return Duration.parse(value); return Duration.parse(value);
} }
catch (Exception ex) { catch (Exception ex) {
throw new IllegalArgumentException("'" + value + "' is not a valid ISO-8601 duration", ex); throw new IllegalArgumentException("'" + value + "' is not a valid ISO-8601 duration", 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)