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
ca0a12ce
Commit
ca0a12ce
authored
Mar 18, 2014
by
Phillip Webb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Polish
parent
f55ca992
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
49 additions
and
78 deletions
+49
-78
ExplodedArchive.java
.../springframework/boot/loader/archive/ExplodedArchive.java
+12
-1
ExplodedArchiveTests.java
...ngframework/boot/loader/archive/ExplodedArchiveTests.java
+28
-1
SpecialArchiveTests.java
...ingframework/boot/loader/archive/SpecialArchiveTests.java
+0
-66
application.xml
...r/src/test/resources/root/META-INF/spring/application.xml
+0
-1
SpringApplication.java
...main/java/org/springframework/boot/SpringApplication.java
+1
-1
StartupInfoLogger.java
...main/java/org/springframework/boot/StartupInfoLogger.java
+4
-5
LoggingApplicationListener.java
...ingframework/boot/logging/LoggingApplicationListener.java
+2
-1
LogbackLoggingSystem.java
...gframework/boot/logging/logback/LogbackLoggingSystem.java
+2
-2
No files found.
spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/archive/ExplodedArchive.java
View file @
ca0a12ce
/*
* Copyright 2012-201
3
the original author or authors.
* Copyright 2012-201
4
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.
...
...
@@ -58,10 +58,21 @@ public class ExplodedArchive extends Archive {
private
boolean
recursive
=
true
;
/**
* Create a new {@link ExplodedArchive} instance.
* @param root the root folder
*/
public
ExplodedArchive
(
File
root
)
{
this
(
root
,
true
);
}
/**
* Create a new {@link ExplodedArchive} instance.
* @param root the root folder
* @param recursive if recursive searching should be used to locate the manifest.
* Defaults to {@code true}, folders with a large tree might want to set this to {code
* false}.
*/
public
ExplodedArchive
(
File
root
,
boolean
recursive
)
{
if
(!
root
.
exists
()
||
!
root
.
isDirectory
())
{
throw
new
IllegalArgumentException
(
"Invalid source folder "
+
root
);
...
...
spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/archive/ExplodedArchiveTests.java
View file @
ca0a12ce
/*
* Copyright 2012-201
3
the original author or authors.
* Copyright 2012-201
4
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.
...
...
@@ -38,13 +38,16 @@ import org.springframework.boot.loader.archive.Archive.Entry;
import
org.springframework.boot.loader.util.AsciiBytes
;
import
static
org
.
hamcrest
.
Matchers
.
equalTo
;
import
static
org
.
hamcrest
.
Matchers
.
greaterThan
;
import
static
org
.
hamcrest
.
Matchers
.
nullValue
;
import
static
org
.
junit
.
Assert
.
assertNotNull
;
import
static
org
.
junit
.
Assert
.
assertThat
;
/**
* Tests for {@link ExplodedArchive}.
*
* @author Phillip Webb
* @author Dave Syer
*/
public
class
ExplodedArchiveTests
{
...
...
@@ -145,6 +148,30 @@ public class ExplodedArchiveTests {
assertThat
(
classLoader
.
getResourceAsStream
(
"2.dat"
),
nullValue
());
}
@Test
public
void
getNonRecursiveEntriesForRoot
()
throws
Exception
{
ExplodedArchive
archive
=
new
ExplodedArchive
(
new
File
(
"/"
),
false
);
Map
<
String
,
Archive
.
Entry
>
entries
=
getEntriesMap
(
archive
);
assertThat
(
entries
.
size
(),
greaterThan
(
1
));
}
@Test
public
void
getNonRecursiveManifest
()
throws
Exception
{
ExplodedArchive
archive
=
new
ExplodedArchive
(
new
File
(
"src/test/resources/root"
));
assertNotNull
(
archive
.
getManifest
());
Map
<
String
,
Archive
.
Entry
>
entries
=
getEntriesMap
(
archive
);
assertThat
(
entries
.
size
(),
equalTo
(
4
));
}
@Test
public
void
getNonRecursiveManifestEvenIfNonRecursive
()
throws
Exception
{
ExplodedArchive
archive
=
new
ExplodedArchive
(
new
File
(
"src/test/resources/root"
),
false
);
assertNotNull
(
archive
.
getManifest
());
Map
<
String
,
Archive
.
Entry
>
entries
=
getEntriesMap
(
archive
);
assertThat
(
entries
.
size
(),
equalTo
(
3
));
}
private
Map
<
String
,
Archive
.
Entry
>
getEntriesMap
(
Archive
archive
)
{
Map
<
String
,
Archive
.
Entry
>
entries
=
new
HashMap
<
String
,
Archive
.
Entry
>();
for
(
Archive
.
Entry
entry
:
archive
.
getEntries
())
{
...
...
spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/archive/SpecialArchiveTests.java
deleted
100644 → 0
View file @
f55ca992
/*
* Copyright 2012-2013 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org
.
springframework
.
boot
.
loader
.
archive
;
import
java.io.File
;
import
java.util.HashMap
;
import
java.util.Map
;
import
org.junit.Test
;
import
static
org
.
hamcrest
.
Matchers
.
equalTo
;
import
static
org
.
hamcrest
.
Matchers
.
greaterThan
;
import
static
org
.
junit
.
Assert
.
assertNotNull
;
import
static
org
.
junit
.
Assert
.
assertThat
;
/**
* @author Dave Syer
*/
public
class
SpecialArchiveTests
{
@Test
public
void
getEntriesForRoot
()
throws
Exception
{
ExplodedArchive
archive
=
new
ExplodedArchive
(
new
File
(
"/"
),
false
);
Map
<
String
,
Archive
.
Entry
>
entries
=
getEntriesMap
(
archive
);
assertThat
(
entries
.
size
(),
greaterThan
(
1
));
}
@Test
public
void
getManifest
()
throws
Exception
{
ExplodedArchive
archive
=
new
ExplodedArchive
(
new
File
(
"src/test/resources/root"
));
assertNotNull
(
archive
.
getManifest
());
Map
<
String
,
Archive
.
Entry
>
entries
=
getEntriesMap
(
archive
);
assertThat
(
entries
.
size
(),
equalTo
(
4
));
}
@Test
public
void
getManifestEvenIfNonRecursive
()
throws
Exception
{
ExplodedArchive
archive
=
new
ExplodedArchive
(
new
File
(
"src/test/resources/root"
),
false
);
assertNotNull
(
archive
.
getManifest
());
Map
<
String
,
Archive
.
Entry
>
entries
=
getEntriesMap
(
archive
);
assertThat
(
entries
.
size
(),
equalTo
(
3
));
}
private
Map
<
String
,
Archive
.
Entry
>
getEntriesMap
(
Archive
archive
)
{
Map
<
String
,
Archive
.
Entry
>
entries
=
new
HashMap
<
String
,
Archive
.
Entry
>();
for
(
Archive
.
Entry
entry
:
archive
.
getEntries
())
{
entries
.
put
(
entry
.
getName
().
toString
(),
entry
);
}
return
entries
;
}
}
spring-boot-tools/spring-boot-loader/src/test/resources/root/META-INF/spring/application.xml
View file @
ca0a12ce
...
...
@@ -3,5 +3,4 @@
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"
>
</beans>
spring-boot/src/main/java/org/springframework/boot/SpringApplication.java
View file @
ca0a12ce
...
...
@@ -285,7 +285,7 @@ public class SpringApplication {
try
{
context
.
registerShutdownHook
();
}
catch
(
AccessControlException
e
)
{
catch
(
AccessControlException
e
x
)
{
// Not allowed in some environments.
}
}
...
...
spring-boot/src/main/java/org/springframework/boot/StartupInfoLogger.java
View file @
ca0a12ce
...
...
@@ -88,14 +88,13 @@ class StartupInfoLogger {
message
.
append
(
getApplicationName
());
message
.
append
(
" in "
);
message
.
append
(
stopWatch
.
getTotalTimeSeconds
());
message
.
append
(
" seconds (JVM running for "
);
try
{
message
.
append
(
ManagementFactory
.
getRuntimeMXBean
().
getUptime
()
/
1000.0
);
double
uptime
=
ManagementFactory
.
getRuntimeMXBean
().
getUptime
()
/
1000.0
;
message
.
append
(
" seconds (JVM running for "
+
uptime
+
")"
);
}
catch
(
Throwable
e
)
{
message
.
append
(
"?"
);
catch
(
Throwable
e
x
)
{
// No JVM time available
}
message
.
append
(
")"
);
return
message
;
}
...
...
spring-boot/src/main/java/org/springframework/boot/logging/LoggingApplicationListener.java
View file @
ca0a12ce
...
...
@@ -197,7 +197,8 @@ public class LoggingApplicationListener implements SmartApplicationListener {
return
name
.
split
(
"@"
)[
0
];
}
}
catch
(
Throwable
e
)
{
catch
(
Throwable
ex
)
{
// Ignore
}
return
"????"
;
}
...
...
spring-boot/src/main/java/org/springframework/boot/logging/logback/LogbackLoggingSystem.java
View file @
ca0a12ce
/*
* Copyright 2012-201
3
the original author or authors.
* Copyright 2012-201
4
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.
...
...
@@ -79,7 +79,7 @@ public class LogbackLoggingSystem extends AbstractLoggingSystem {
SLF4JBridgeHandler
.
install
();
}
}
catch
(
Throwable
e
)
{
catch
(
Throwable
e
x
)
{
// Ignore. No java.util.logging bridge is installed.
}
}
...
...
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