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
b70d0dd5
Commit
b70d0dd5
authored
Aug 28, 2020
by
Scott Frederick
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '2.3.x'
Closes gh-23134
parents
ccabc1a4
bc1834bf
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
1 deletion
+11
-1
LayerId.java
...ramework/boot/buildpack/platform/docker/type/LayerId.java
+1
-1
LayerIdTests.java
...ork/boot/buildpack/platform/docker/type/LayerIdTests.java
+10
-0
No files found.
spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/type/LayerId.java
View file @
b70d0dd5
...
@@ -98,7 +98,7 @@ public final class LayerId {
...
@@ -98,7 +98,7 @@ public final class LayerId {
Assert
.
notNull
(
digest
,
"Digest must not be null"
);
Assert
.
notNull
(
digest
,
"Digest must not be null"
);
Assert
.
isTrue
(
digest
.
length
==
32
,
"Digest must be exactly 32 bytes"
);
Assert
.
isTrue
(
digest
.
length
==
32
,
"Digest must be exactly 32 bytes"
);
String
algorithm
=
"sha256"
;
String
algorithm
=
"sha256"
;
String
hash
=
String
.
format
(
"%
32
x"
,
new
BigInteger
(
1
,
digest
));
String
hash
=
String
.
format
(
"%
064
x"
,
new
BigInteger
(
1
,
digest
));
return
new
LayerId
(
algorithm
+
":"
+
hash
,
algorithm
,
hash
);
return
new
LayerId
(
algorithm
+
":"
+
hash
,
algorithm
,
hash
);
}
}
...
...
spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/test/java/org/springframework/boot/buildpack/platform/docker/type/LayerIdTests.java
View file @
b70d0dd5
...
@@ -18,6 +18,7 @@ package org.springframework.boot.buildpack.platform.docker.type;
...
@@ -18,6 +18,7 @@ package org.springframework.boot.buildpack.platform.docker.type;
import
java.nio.charset.StandardCharsets
;
import
java.nio.charset.StandardCharsets
;
import
java.security.MessageDigest
;
import
java.security.MessageDigest
;
import
java.util.Arrays
;
import
org.junit.jupiter.api.Test
;
import
org.junit.jupiter.api.Test
;
...
@@ -67,6 +68,15 @@ class LayerIdTests {
...
@@ -67,6 +68,15 @@ class LayerIdTests {
assertThat
(
id
.
toString
()).
isEqualTo
(
"sha256:9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08"
);
assertThat
(
id
.
toString
()).
isEqualTo
(
"sha256:9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08"
);
}
}
@Test
void
ofSha256DigestWithZeroPadding
()
{
byte
[]
digest
=
new
byte
[
32
];
Arrays
.
fill
(
digest
,
(
byte
)
127
);
digest
[
0
]
=
1
;
LayerId
id
=
LayerId
.
ofSha256Digest
(
digest
);
assertThat
(
id
.
toString
()).
isEqualTo
(
"sha256:017f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f"
);
}
@Test
@Test
void
ofSha256DigestWhenNullThrowsException
()
{
void
ofSha256DigestWhenNullThrowsException
()
{
assertThatIllegalArgumentException
().
isThrownBy
(()
->
LayerId
.
ofSha256Digest
((
byte
[])
null
))
assertThatIllegalArgumentException
().
isThrownBy
(()
->
LayerId
.
ofSha256Digest
((
byte
[])
null
))
...
...
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