Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
8f793eaf
Commit
8f793eaf
authored
Dec 23, 2017
by
Stephane Nicoll
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #11362 from izeye:assert-state-supplier
* pr/11362: Use Supplier version of Assert.state()
parents
db2de631
e3228716
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
4 deletions
+8
-4
DurationConverter.java
...ot/context/properties/bind/convert/DurationConverter.java
+2
-2
SessionStoreDirectory.java
...mework/boot/web/servlet/server/SessionStoreDirectory.java
+6
-2
No files found.
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/convert/DurationConverter.java
View file @
8f793eaf
...
...
@@ -90,7 +90,7 @@ class DurationConverter implements GenericConverter {
return
Duration
.
parse
(
source
);
}
Matcher
matcher
=
SIMPLE
.
matcher
(
source
);
Assert
.
state
(
matcher
.
matches
(),
"'"
+
source
+
"' is not a valid duration"
);
Assert
.
state
(
matcher
.
matches
(),
()
->
"'"
+
source
+
"' is not a valid duration"
);
long
amount
=
Long
.
parseLong
(
matcher
.
group
(
1
));
ChronoUnit
unit
=
getUnit
(
matcher
.
group
(
2
),
defaultUnit
);
return
Duration
.
of
(
amount
,
unit
);
...
...
@@ -106,7 +106,7 @@ class DurationConverter implements GenericConverter {
return
(
defaultUnit
!=
null
?
defaultUnit
.
value
()
:
ChronoUnit
.
MILLIS
);
}
ChronoUnit
unit
=
UNITS
.
get
(
value
.
toLowerCase
());
Assert
.
state
(
unit
!=
null
,
"Unknown unit '"
+
value
+
"'"
);
Assert
.
state
(
unit
!=
null
,
()
->
"Unknown unit '"
+
value
+
"'"
);
return
unit
;
}
...
...
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/server/SessionStoreDirectory.java
View file @
8f793eaf
...
...
@@ -51,9 +51,13 @@ class SessionStoreDirectory {
if
(!
dir
.
exists
()
&&
mkdirs
)
{
dir
.
mkdirs
();
}
Assert
.
state
(!
mkdirs
||
dir
.
exists
(),
"Session dir "
+
dir
+
" does not exist"
);
Assert
.
state
(!
dir
.
isFile
(),
"Session dir "
+
dir
+
" points to a file"
);
assertDirectory
(
mkdirs
,
dir
);
return
dir
;
}
private
void
assertDirectory
(
boolean
mkdirs
,
File
dir
)
{
Assert
.
state
(!
mkdirs
||
dir
.
exists
(),
()
->
"Session dir "
+
dir
+
" does not exist"
);
Assert
.
state
(!
dir
.
isFile
(),
()
->
"Session dir "
+
dir
+
" points to a file"
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment