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
7841af50
Commit
7841af50
authored
Aug 31, 2016
by
Andy Wilkinson
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '1.3.x'
parents
2a22a7af
20df899b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
1 deletion
+42
-1
JarFile.java
...ain/java/org/springframework/boot/loader/jar/JarFile.java
+1
-1
JarFileTests.java
...ava/org/springframework/boot/loader/jar/JarFileTests.java
+41
-0
No files found.
spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/JarFile.java
View file @
7841af50
...
...
@@ -376,7 +376,7 @@ public class JarFile extends java.util.jar.JarFile {
* {@link URLStreamHandler} will be located to deal with jar URLs.
*/
public
static
void
registerUrlProtocolHandler
()
{
String
handlers
=
System
.
getProperty
(
PROTOCOL_HANDLER
);
String
handlers
=
System
.
getProperty
(
PROTOCOL_HANDLER
,
""
);
System
.
setProperty
(
PROTOCOL_HANDLER
,
(
""
.
equals
(
handlers
)
?
HANDLERS_PACKAGE
:
handlers
+
"|"
+
HANDLERS_PACKAGE
));
resetCachedUrlHandlers
();
...
...
spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/jar/JarFileTests.java
View file @
7841af50
...
...
@@ -54,6 +54,9 @@ import static org.mockito.Mockito.verify;
* @author Andy Wilkinson
*/
public
class
JarFileTests
{
private
static
final
String
PROTOCOL_HANDLER
=
"java.protocol.handler.pkgs"
;
private
static
final
String
HANDLERS_PACKAGE
=
"org.springframework.boot.loader"
;
@Rule
public
ExpectedException
thrown
=
ExpectedException
.
none
();
...
...
@@ -420,4 +423,42 @@ public class JarFileTests {
url
.
openConnection
().
getInputStream
();
}
@Test
public
void
registerUrlProtocolHandlerWithNoExistingRegistration
()
{
String
original
=
System
.
getProperty
(
PROTOCOL_HANDLER
);
try
{
System
.
clearProperty
(
PROTOCOL_HANDLER
);
JarFile
.
registerUrlProtocolHandler
();
String
protocolHandler
=
System
.
getProperty
(
PROTOCOL_HANDLER
);
assertThat
(
protocolHandler
).
isEqualTo
(
HANDLERS_PACKAGE
);
}
finally
{
if
(
original
==
null
)
{
System
.
clearProperty
(
PROTOCOL_HANDLER
);
}
else
{
System
.
setProperty
(
PROTOCOL_HANDLER
,
original
);
}
}
}
@Test
public
void
registerUrlProtocolHandlerAddsToExistingRegistration
()
{
String
original
=
System
.
getProperty
(
PROTOCOL_HANDLER
);
try
{
System
.
setProperty
(
PROTOCOL_HANDLER
,
"com.example"
);
JarFile
.
registerUrlProtocolHandler
();
String
protocolHandler
=
System
.
getProperty
(
PROTOCOL_HANDLER
);
assertThat
(
protocolHandler
).
isEqualTo
(
"com.example|"
+
HANDLERS_PACKAGE
);
}
finally
{
if
(
original
==
null
)
{
System
.
clearProperty
(
PROTOCOL_HANDLER
);
}
else
{
System
.
setProperty
(
PROTOCOL_HANDLER
,
original
);
}
}
}
}
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