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
29e38f4a
Commit
29e38f4a
authored
Aug 13, 2018
by
Andy Wilkinson
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '1.5.x' into 2.0.x
parents
f4b01016
384cfd2a
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
2 deletions
+26
-2
Handler.java
...ain/java/org/springframework/boot/loader/jar/Handler.java
+9
-1
HandlerTests.java
...ava/org/springframework/boot/loader/jar/HandlerTests.java
+17
-1
No files found.
spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/Handler.java
View file @
29e38f4a
...
...
@@ -211,7 +211,15 @@ public class Handler extends URLStreamHandler {
}
private
void
setFile
(
URL
context
,
String
file
)
{
setURL
(
context
,
JAR_PROTOCOL
,
null
,
-
1
,
null
,
null
,
normalize
(
file
),
null
,
null
);
String
path
=
normalize
(
file
);
String
query
=
null
;
int
queryIndex
=
path
.
lastIndexOf
(
'?'
);
if
(
queryIndex
!=
-
1
)
{
query
=
path
.
substring
(
queryIndex
+
1
);
path
=
path
.
substring
(
0
,
queryIndex
);
}
setURL
(
context
,
JAR_PROTOCOL
,
null
,
-
1
,
null
,
null
,
path
,
query
,
context
.
getRef
());
}
private
String
normalize
(
String
file
)
{
...
...
spring-boot-project/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/jar/HandlerTests.java
View file @
29e38f4a
/*
* Copyright 2012-201
7
the original author or authors.
* Copyright 2012-201
8
the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
...
...
@@ -158,12 +158,28 @@ public class HandlerTests {
"./folderB/./b.xsd"
);
}
@Test
public
void
urlWithRef
()
throws
MalformedURLException
{
assertStandardAndCustomHandlerUrlsAreEqual
(
"file:/test.jar!/BOOT-INF/classes"
,
"!/foo.txt#alpha"
);
}
@Test
public
void
urlWithQuery
()
throws
MalformedURLException
{
assertStandardAndCustomHandlerUrlsAreEqual
(
"file:/test.jar!/BOOT-INF/classes"
,
"!/foo.txt?alpha"
);
}
private
void
assertStandardAndCustomHandlerUrlsAreEqual
(
String
context
,
String
spec
)
throws
MalformedURLException
{
URL
standardUrl
=
new
URL
(
new
URL
(
"jar:"
+
context
),
spec
);
URL
customHandlerUrl
=
new
URL
(
new
URL
(
"jar"
,
null
,
-
1
,
context
,
this
.
handler
),
spec
);
assertThat
(
customHandlerUrl
.
toString
()).
isEqualTo
(
standardUrl
.
toString
());
assertThat
(
customHandlerUrl
.
getFile
()).
isEqualTo
(
standardUrl
.
getFile
());
assertThat
(
customHandlerUrl
.
getPath
()).
isEqualTo
(
standardUrl
.
getPath
());
assertThat
(
customHandlerUrl
.
getQuery
()).
isEqualTo
(
standardUrl
.
getQuery
());
assertThat
(
customHandlerUrl
.
getRef
()).
isEqualTo
(
standardUrl
.
getRef
());
}
private
URL
createUrl
(
String
file
)
throws
MalformedURLException
{
...
...
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