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
764a0a9a
Commit
764a0a9a
authored
Jul 06, 2013
by
Phillip Webb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor change to code formatting
parent
a6341dc0
Changes
84
Show whitespace changes
Inline
Side-by-side
Showing
84 changed files
with
391 additions
and
214 deletions
+391
-214
org.eclipse.jdt.core.prefs
eclipse/org.eclipse.jdt.core.prefs
+4
-4
AuditEvent.java
...va/org/springframework/zero/actuate/audit/AuditEvent.java
+2
-1
EndpointWebMvcAutoConfiguration.java
...ctuate/autoconfigure/EndpointWebMvcAutoConfiguration.java
+4
-2
ManagementServerPropertiesAutoConfiguration.java
...onfigure/ManagementServerPropertiesAutoConfiguration.java
+1
-1
MetricFilterAutoConfiguration.java
.../actuate/autoconfigure/MetricFilterAutoConfiguration.java
+6
-3
SecurityAutoConfiguration.java
...zero/actuate/autoconfigure/SecurityAutoConfiguration.java
+3
-3
ShutdownEndpoint.java
...ringframework/zero/actuate/endpoint/ShutdownEndpoint.java
+2
-1
EndpointHandlerAdapter.java
...ork/zero/actuate/endpoint/mvc/EndpointHandlerAdapter.java
+4
-2
DefaultCounterService.java
...framework/zero/actuate/metrics/DefaultCounterService.java
+2
-1
DefaultGaugeService.java
...ngframework/zero/actuate/metrics/DefaultGaugeService.java
+2
-1
InMemoryMetricRepository.java
...mework/zero/actuate/metrics/InMemoryMetricRepository.java
+4
-2
AuthenticationAuditListener.java
...rk/zero/actuate/security/AuthenticationAuditListener.java
+4
-2
AuthorizationAuditListener.java
...ork/zero/actuate/security/AuthorizationAuditListener.java
+2
-1
WebRequestTraceFilter.java
...ngframework/zero/actuate/trace/WebRequestTraceFilter.java
+4
-2
BasicErrorController.java
...pringframework/zero/actuate/web/BasicErrorController.java
+6
-3
EndpointWebMvcAutoConfigurationTests.java
...e/autoconfigure/EndpointWebMvcAutoConfigurationTests.java
+6
-3
AutoConfigurationUtils.java
...gframework/zero/autoconfigure/AutoConfigurationUtils.java
+4
-2
BasicDataSourceConfiguration.java
...zero/autoconfigure/jdbc/BasicDataSourceConfiguration.java
+2
-1
JpaAutoConfiguration.java
...work/zero/autoconfigure/orm/jpa/JpaAutoConfiguration.java
+4
-2
ThymeleafAutoConfiguration.java
...o/autoconfigure/thymeleaf/ThymeleafAutoConfiguration.java
+2
-1
WebMvcAutoConfiguration.java
...ework/zero/autoconfigure/web/WebMvcAutoConfiguration.java
+1
-1
AutoConfigurationSorter.java
...work/zero/context/annotation/AutoConfigurationSorter.java
+2
-1
ComponentScanDetector.java
...mework/zero/context/annotation/ComponentScanDetector.java
+4
-2
EnableAutoConfigurationImportSelector.java
...ext/annotation/EnableAutoConfigurationImportSelector.java
+2
-1
Spring.java
...e/src/main/java/org/springframework/zero/main/Spring.java
+6
-3
ServerPropertiesAutoConfigurationTests.java
...configure/web/ServerPropertiesAutoConfigurationTests.java
+10
-10
SpringZeroCli.java
...main/java/org/springframework/zero/cli/SpringZeroCli.java
+10
-9
SpringZeroCliException.java
.../org/springframework/zero/cli/SpringZeroCliException.java
+1
-2
CleanCommand.java
...va/org/springframework/zero/cli/command/CleanCommand.java
+7
-4
OptionHandler.java
...a/org/springframework/zero/cli/command/OptionHandler.java
+2
-1
ScriptCommand.java
...a/org/springframework/zero/cli/command/ScriptCommand.java
+22
-11
DependencyCustomizer.java
...ringframework/zero/cli/compiler/DependencyCustomizer.java
+8
-4
GroovyCompiler.java
...org/springframework/zero/cli/compiler/GroovyCompiler.java
+5
-4
SpringMvcCompilerAutoConfiguration.java
...ler/autoconfigure/SpringMvcCompilerAutoConfiguration.java
+3
-3
SpringZeroCompilerAutoConfiguration.java
...er/autoconfigure/SpringZeroCompilerAutoConfiguration.java
+2
-1
SpringZeroRunner.java
...org/springframework/zero/cli/runner/SpringZeroRunner.java
+16
-8
GroovyTemplate.java
...org/springframework/zero/cli/template/GroovyTemplate.java
+4
-2
BeanDefinitionLoader.java
...n/java/org/springframework/zero/BeanDefinitionLoader.java
+2
-1
SpringApplication.java
...main/java/org/springframework/zero/SpringApplication.java
+16
-8
CustomPropertyConstructor.java
.../springframework/zero/bind/CustomPropertyConstructor.java
+2
-1
InetAddressEditor.java
...java/org/springframework/zero/bind/InetAddressEditor.java
+2
-1
PropertiesConfigurationFactory.java
...ngframework/zero/bind/PropertiesConfigurationFactory.java
+8
-4
PropertySourcesPropertyValues.java
...ingframework/zero/bind/PropertySourcesPropertyValues.java
+2
-1
RelaxedDataBinder.java
...java/org/springframework/zero/bind/RelaxedDataBinder.java
+4
-2
YamlConfigurationFactory.java
...g/springframework/zero/bind/YamlConfigurationFactory.java
+2
-1
JacksonJsonParser.java
...va/org/springframework/zero/config/JacksonJsonParser.java
+4
-2
SimpleJsonParser.java
...ava/org/springframework/zero/config/SimpleJsonParser.java
+8
-4
YamlMapFactoryBean.java
...a/org/springframework/zero/config/YamlMapFactoryBean.java
+2
-1
YamlProcessor.java
...n/java/org/springframework/zero/config/YamlProcessor.java
+16
-8
AbstractOnBeanCondition.java
...work/zero/context/annotation/AbstractOnBeanCondition.java
+6
-3
ConfigurationPropertiesBindingConfiguration.java
...notation/ConfigurationPropertiesBindingConfiguration.java
+6
-3
PropertySourcesBindingPostProcessor.java
...ntext/annotation/PropertySourcesBindingPostProcessor.java
+4
-2
AbstractEmbeddedServletContainerFactory.java
...ext/embedded/AbstractEmbeddedServletContainerFactory.java
+2
-1
EmbeddedWebApplicationContext.java
.../zero/context/embedded/EmbeddedWebApplicationContext.java
+10
-5
FilterRegistrationBean.java
...amework/zero/context/embedded/FilterRegistrationBean.java
+2
-1
JettyEmbeddedServletContainer.java
...context/embedded/jetty/JettyEmbeddedServletContainer.java
+6
-3
JettyEmbeddedServletContainerFactory.java
.../embedded/jetty/JettyEmbeddedServletContainerFactory.java
+6
-3
ServletContextInitializerLifecycleListener.java
...ed/tomcat/ServletContextInitializerLifecycleListener.java
+2
-1
TomcatEmbeddedServletContainer.java
...ntext/embedded/tomcat/TomcatEmbeddedServletContainer.java
+6
-3
TomcatEmbeddedServletContainerFactory.java
...mbedded/tomcat/TomcatEmbeddedServletContainerFactory.java
+4
-2
ConfigFileApplicationContextInitializer.java
.../initializer/ConfigFileApplicationContextInitializer.java
+6
-3
ContextIdApplicationContextInitializer.java
...t/initializer/ContextIdApplicationContextInitializer.java
+2
-1
EnvironmentDelegateApplicationContextInitializer.java
...zer/EnvironmentDelegateApplicationContextInitializer.java
+2
-1
LoggingApplicationContextInitializer.java
...ext/initializer/LoggingApplicationContextInitializer.java
+4
-2
VcapApplicationContextInitializer.java
...ontext/initializer/VcapApplicationContextInitializer.java
+10
-5
JavaLoggerConfigurer.java
...rg/springframework/zero/logging/JavaLoggerConfigurer.java
+6
-3
LogbackConfigurer.java
...a/org/springframework/zero/logging/LogbackConfigurer.java
+2
-1
SpringServletInitializer.java
...rg/springframework/zero/web/SpringServletInitializer.java
+2
-1
SpringApplicationTests.java
...java/org/springframework/zero/SpringApplicationTests.java
+2
-1
AbstractEmbeddedServletContainerFactoryTests.java
...mbedded/AbstractEmbeddedServletContainerFactoryTests.java
+6
-3
EmbeddedServletContainerMvcIntegrationTests.java
...embedded/EmbeddedServletContainerMvcIntegrationTests.java
+4
-2
MockEmbeddedServletContainerFactory.java
...context/embedded/MockEmbeddedServletContainerFactory.java
+2
-1
Launcher.java
...main/java/org/springframework/zero/launcher/Launcher.java
+2
-1
MainMethodRunner.java
...a/org/springframework/zero/launcher/MainMethodRunner.java
+2
-1
WarLauncher.java
...n/java/org/springframework/zero/launcher/WarLauncher.java
+2
-1
RandomAccessDataFile.java
...ingframework/zero/launcher/data/RandomAccessDataFile.java
+10
-5
RandomAccessJarFile.java
...pringframework/zero/launcher/jar/RandomAccessJarFile.java
+8
-4
RandomAccessDataZipInputStreamTest.java
...zero/launcher/jar/RandomAccessDataZipInputStreamTest.java
+4
-2
RandomAccessJarFileTest.java
...gframework/zero/launcher/jar/RandomAccessJarFileTest.java
+2
-1
AbstractExecutableArchiveMojo.java
...ngframework/zero/maven/AbstractExecutableArchiveMojo.java
+8
-4
MainClassFinder.java
.../java/org/springframework/zero/maven/MainClassFinder.java
+4
-2
MainClassFinderTests.java
.../org/springframework/zero/maven/MainClassFinderTests.java
+2
-1
SampleProfileApplicationTests.java
...rk/zero/sample/profile/SampleProfileApplicationTests.java
+2
-1
SampleSimpleApplicationTests.java
...work/zero/sample/simple/SampleSimpleApplicationTests.java
+2
-1
No files found.
eclipse/org.eclipse.jdt.core.prefs
View file @
764a0a9a
...
...
@@ -193,11 +193,11 @@ org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=
do not
insert
org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=insert
org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=
do not
insert
org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=
do not
insert
org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=
do not
insert
org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=insert
org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=insert
org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
...
...
spring-zero-actuator/src/main/java/org/springframework/zero/actuate/audit/AuditEvent.java
View file @
764a0a9a
...
...
@@ -93,7 +93,8 @@ public class AuditEvent implements Serializable {
if
(
entry
.
contains
(
"="
))
{
int
index
=
entry
.
indexOf
(
"="
);
result
.
put
(
entry
.
substring
(
0
,
index
),
entry
.
substring
(
index
+
1
));
}
else
{
}
else
{
result
.
put
(
entry
,
null
);
}
}
...
...
spring-zero-actuator/src/main/java/org/springframework/zero/actuate/autoconfigure/EndpointWebMvcAutoConfiguration.java
View file @
764a0a9a
...
...
@@ -140,7 +140,8 @@ public class EndpointWebMvcAutoConfiguration implements ApplicationContextAware,
ServerProperties
serverProperties
;
try
{
serverProperties
=
beanFactory
.
getBean
(
ServerProperties
.
class
);
}
catch
(
NoSuchBeanDefinitionException
ex
)
{
}
catch
(
NoSuchBeanDefinitionException
ex
)
{
serverProperties
=
new
ServerProperties
();
}
...
...
@@ -148,7 +149,8 @@ public class EndpointWebMvcAutoConfiguration implements ApplicationContextAware,
try
{
managementServerProperties
=
beanFactory
.
getBean
(
ManagementServerProperties
.
class
);
}
catch
(
NoSuchBeanDefinitionException
ex
)
{
}
catch
(
NoSuchBeanDefinitionException
ex
)
{
managementServerProperties
=
new
ManagementServerProperties
();
}
...
...
spring-zero-actuator/src/main/java/org/springframework/zero/actuate/autoconfigure/ManagementServerPropertiesAutoConfiguration.java
View file @
764a0a9a
spring-zero-actuator/src/main/java/org/springframework/zero/actuate/autoconfigure/MetricFilterAutoConfiguration.java
View file @
764a0a9a
...
...
@@ -83,7 +83,8 @@ public class MetricFilterAutoConfiguration {
&&
(
response
instanceof
HttpServletResponse
))
{
doFilter
((
HttpServletRequest
)
request
,
(
HttpServletResponse
)
response
,
chain
);
}
else
{
}
else
{
chain
.
doFilter
(
request
,
response
);
}
}
...
...
@@ -96,7 +97,8 @@ public class MetricFilterAutoConfiguration {
stopWatch
.
start
();
try
{
chain
.
doFilter
(
request
,
response
);
}
finally
{
}
finally
{
stopWatch
.
stop
();
String
gaugeKey
=
getKey
(
"response"
+
suffix
);
MetricFilterAutoConfiguration
.
this
.
gaugeService
.
set
(
gaugeKey
,
...
...
@@ -109,7 +111,8 @@ public class MetricFilterAutoConfiguration {
private
int
getStatus
(
HttpServletResponse
response
)
{
try
{
return
response
.
getStatus
();
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
return
UNDEFINED_HTTP_STATUS
;
}
}
...
...
spring-zero-actuator/src/main/java/org/springframework/zero/actuate/autoconfigure/SecurityAutoConfiguration.java
View file @
764a0a9a
spring-zero-actuator/src/main/java/org/springframework/zero/actuate/endpoint/ShutdownEndpoint.java
View file @
764a0a9a
...
...
@@ -61,7 +61,8 @@ public class ShutdownEndpoint extends AbstractEndpoint<Map<String, Object>> impl
public
void
run
()
{
try
{
Thread
.
sleep
(
500L
);
}
catch
(
InterruptedException
e
)
{
}
catch
(
InterruptedException
e
)
{
}
ShutdownEndpoint
.
this
.
context
.
close
();
}
...
...
spring-zero-actuator/src/main/java/org/springframework/zero/actuate/endpoint/mvc/EndpointHandlerAdapter.java
View file @
764a0a9a
...
...
@@ -112,7 +112,8 @@ public class EndpointHandlerAdapter implements HandlerAdapter {
}
}
throw
new
HttpMediaTypeNotAcceptableException
(
this
.
allSupportedMediaTypes
);
}
finally
{
}
finally
{
outputMessage
.
close
();
}
}
...
...
@@ -179,7 +180,8 @@ public class EndpointHandlerAdapter implements HandlerAdapter {
if
(
mediaType
.
isConcrete
())
{
selectedMediaType
=
mediaType
;
break
;
}
else
if
(
mediaType
.
equals
(
MediaType
.
ALL
)
}
else
if
(
mediaType
.
equals
(
MediaType
.
ALL
)
||
mediaType
.
equals
(
MEDIA_TYPE_APPLICATION
))
{
selectedMediaType
=
MediaType
.
APPLICATION_OCTET_STREAM
;
break
;
...
...
spring-zero-actuator/src/main/java/org/springframework/zero/actuate/metrics/DefaultCounterService.java
View file @
764a0a9a
...
...
@@ -54,7 +54,8 @@ public class DefaultCounterService implements CounterService {
private
String
wrap
(
String
metricName
)
{
if
(
metricName
.
startsWith
(
"counter"
))
{
return
metricName
;
}
else
{
}
else
{
return
"counter."
+
metricName
;
}
}
...
...
spring-zero-actuator/src/main/java/org/springframework/zero/actuate/metrics/DefaultGaugeService.java
View file @
764a0a9a
...
...
@@ -43,7 +43,8 @@ public class DefaultGaugeService implements GaugeService {
private
String
wrap
(
String
metricName
)
{
if
(
metricName
.
startsWith
(
"gauge"
))
{
return
metricName
;
}
else
{
}
else
{
return
"gauge."
+
metricName
;
}
}
...
...
spring-zero-actuator/src/main/java/org/springframework/zero/actuate/metrics/InMemoryMetricRepository.java
View file @
764a0a9a
...
...
@@ -37,7 +37,8 @@ public class InMemoryMetricRepository implements MetricRepository {
Metric
metric
=
current
.
getMetric
();
this
.
metrics
.
replace
(
metricName
,
current
,
new
Measurement
(
timestamp
,
metric
.
increment
(
amount
)));
}
else
{
}
else
{
this
.
metrics
.
putIfAbsent
(
metricName
,
new
Measurement
(
timestamp
,
new
Metric
(
metricName
,
amount
)));
}
...
...
@@ -50,7 +51,8 @@ public class InMemoryMetricRepository implements MetricRepository {
Metric
metric
=
current
.
getMetric
();
this
.
metrics
.
replace
(
metricName
,
current
,
new
Measurement
(
timestamp
,
metric
.
set
(
value
)));
}
else
{
}
else
{
this
.
metrics
.
putIfAbsent
(
metricName
,
new
Measurement
(
timestamp
,
new
Metric
(
metricName
,
value
)));
}
...
...
spring-zero-actuator/src/main/java/org/springframework/zero/actuate/security/AuthenticationAuditListener.java
View file @
764a0a9a
...
...
@@ -48,9 +48,11 @@ public class AuthenticationAuditListener implements
public
void
onApplicationEvent
(
AbstractAuthenticationEvent
event
)
{
if
(
event
instanceof
AbstractAuthenticationFailureEvent
)
{
onAuthenticationFailureEvent
((
AbstractAuthenticationFailureEvent
)
event
);
}
else
if
(
event
instanceof
AuthenticationSwitchUserEvent
)
{
}
else
if
(
event
instanceof
AuthenticationSwitchUserEvent
)
{
onAuthenticationSwitchUserEvent
((
AuthenticationSwitchUserEvent
)
event
);
}
else
{
}
else
{
onAuthenticationEvent
(
event
);
}
}
...
...
spring-zero-actuator/src/main/java/org/springframework/zero/actuate/security/AuthorizationAuditListener.java
View file @
764a0a9a
...
...
@@ -48,7 +48,8 @@ public class AuthorizationAuditListener implements
public
void
onApplicationEvent
(
AbstractAuthorizationEvent
event
)
{
if
(
event
instanceof
AuthenticationCredentialsNotFoundEvent
)
{
onAuthenticationCredentialsNotFoundEvent
((
AuthenticationCredentialsNotFoundEvent
)
event
);
}
else
if
(
event
instanceof
AuthorizationFailureEvent
)
{
}
else
if
(
event
instanceof
AuthorizationFailureEvent
)
{
onAuthorizationFailureEvent
((
AuthorizationFailureEvent
)
event
);
}
}
...
...
spring-zero-actuator/src/main/java/org/springframework/zero/actuate/trace/WebRequestTraceFilter.java
View file @
764a0a9a
...
...
@@ -101,7 +101,8 @@ public class WebRequestTraceFilter implements Filter, Ordered {
.
get
(
"headers"
);
this
.
logger
.
trace
(
"Headers: "
+
this
.
objectMapper
.
writeValueAsString
(
headers
));
}
catch
(
JsonProcessingException
e
)
{
}
catch
(
JsonProcessingException
e
)
{
throw
new
IllegalStateException
(
"Cannot create JSON"
,
e
);
}
}
...
...
@@ -121,7 +122,8 @@ public class WebRequestTraceFilter implements Filter, Ordered {
Object
value
=
values
;
if
(
values
.
size
()
==
1
)
{
value
=
values
.
get
(
0
);
}
else
if
(
values
.
isEmpty
())
{
}
else
if
(
values
.
isEmpty
())
{
value
=
""
;
}
map
.
put
(
name
,
value
);
...
...
spring-zero-actuator/src/main/java/org/springframework/zero/actuate/web/BasicErrorController.java
View file @
764a0a9a
...
...
@@ -76,7 +76,8 @@ public class BasicErrorController implements ErrorController {
if
(
obj
!=
null
)
{
status
=
(
Integer
)
obj
;
map
.
put
(
"error"
,
HttpStatus
.
valueOf
(
status
).
getReasonPhrase
());
}
else
{
}
else
{
map
.
put
(
"error"
,
"None"
);
}
map
.
put
(
"status"
,
status
);
...
...
@@ -94,12 +95,14 @@ public class BasicErrorController implements ErrorController {
map
.
put
(
"trace"
,
stackTrace
.
toString
());
}
this
.
logger
.
error
(
error
);
}
else
{
}
else
{
Object
message
=
request
.
getAttribute
(
"javax.servlet.error.message"
);
map
.
put
(
"message"
,
message
==
null
?
"No message available"
:
message
);
}
return
map
;
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
map
.
put
(
"error"
,
e
.
getClass
().
getName
());
map
.
put
(
"message"
,
e
.
getMessage
());
this
.
logger
.
error
(
e
);
...
...
spring-zero-actuator/src/test/java/org/springframework/zero/actuate/autoconfigure/EndpointWebMvcAutoConfigurationTests.java
View file @
764a0a9a
...
...
@@ -61,7 +61,8 @@ public class EndpointWebMvcAutoConfigurationTests {
public
void
close
()
{
try
{
this
.
applicationContext
.
close
();
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
}
}
...
...
@@ -168,10 +169,12 @@ public class EndpointWebMvcAutoConfigurationTests {
String
actual
=
StreamUtils
.
copyToString
(
response
.
getBody
(),
Charset
.
forName
(
"UTF-8"
));
assertThat
(
actual
,
equalTo
(
expected
));
}
finally
{
}
finally
{
response
.
close
();
}
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
if
(
expected
==
null
)
{
if
(
SocketException
.
class
.
isInstance
(
ex
)
||
FileNotFoundException
.
class
.
isInstance
(
ex
))
{
...
...
spring-zero-autoconfigure/src/main/java/org/springframework/zero/autoconfigure/AutoConfigurationUtils.java
View file @
764a0a9a
...
...
@@ -40,7 +40,8 @@ public abstract class AutoConfigurationUtils {
public
static
List
<
String
>
getBasePackages
(
BeanFactory
beanFactory
)
{
try
{
return
beanFactory
.
getBean
(
BASE_PACKAGES_BEAN
,
List
.
class
);
}
catch
(
NoSuchBeanDefinitionException
e
)
{
}
catch
(
NoSuchBeanDefinitionException
e
)
{
return
Collections
.
emptyList
();
}
}
...
...
@@ -50,7 +51,8 @@ public abstract class AutoConfigurationUtils {
if
(!
beanFactory
.
containsBean
(
BASE_PACKAGES_BEAN
))
{
beanFactory
.
registerSingleton
(
BASE_PACKAGES_BEAN
,
new
ArrayList
<
String
>(
basePackages
));
}
else
{
}
else
{
List
<
String
>
packages
=
getBasePackages
(
beanFactory
);
for
(
String
pkg
:
basePackages
)
{
if
(
packages
.
contains
(
pkg
))
{
...
...
spring-zero-autoconfigure/src/main/java/org/springframework/zero/autoconfigure/jdbc/BasicDataSourceConfiguration.java
View file @
764a0a9a
...
...
@@ -58,7 +58,8 @@ public class BasicDataSourceConfiguration extends AbstractDataSourceConfiguratio
if
(
this
.
pool
!=
null
)
{
try
{
this
.
pool
.
close
();
}
catch
(
SQLException
e
)
{
}
catch
(
SQLException
e
)
{
throw
new
DataAccessResourceFailureException
(
"Could not close data source"
,
e
);
}
...
...
spring-zero-autoconfigure/src/main/java/org/springframework/zero/autoconfigure/orm/jpa/JpaAutoConfiguration.java
View file @
764a0a9a
...
...
@@ -78,7 +78,8 @@ public abstract class JpaAutoConfiguration implements BeanFactoryAware {
.
getBeanDefinition
(
"dataSource"
);
return
EmbeddedDatabaseConfiguration
.
class
.
getName
().
equals
(
beanDefinition
.
getFactoryBeanName
());
}
catch
(
NoSuchBeanDefinitionException
e
)
{
}
catch
(
NoSuchBeanDefinitionException
e
)
{
return
false
;
}
}
...
...
@@ -89,7 +90,8 @@ public abstract class JpaAutoConfiguration implements BeanFactoryAware {
protected
DataSource
getDataSource
()
{
try
{
return
this
.
beanFactory
.
getBean
(
"dataSource"
,
DataSource
.
class
);
}
catch
(
RuntimeException
e
)
{
}
catch
(
RuntimeException
e
)
{
return
this
.
beanFactory
.
getBean
(
DataSource
.
class
);
}
}
...
...
spring-zero-autoconfigure/src/main/java/org/springframework/zero/autoconfigure/thymeleaf/ThymeleafAutoConfiguration.java
View file @
764a0a9a
...
...
@@ -84,7 +84,8 @@ public class ThymeleafAutoConfiguration {
try
{
return
DefaultTemplateResolverConfiguration
.
this
.
resourceLoader
.
getResource
(
resourceName
).
getInputStream
();
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
return
null
;
}
}
...
...
spring-zero-autoconfigure/src/main/java/org/springframework/zero/autoconfigure/web/WebMvcAutoConfiguration.java
View file @
764a0a9a
spring-zero-autoconfigure/src/main/java/org/springframework/zero/context/annotation/AutoConfigurationSorter.java
View file @
764a0a9a
...
...
@@ -143,7 +143,8 @@ class AutoConfigurationSorter {
if
(
this
.
after
==
null
)
{
if
(
this
.
afterAnnotation
==
null
)
{
this
.
after
=
Collections
.
emptyList
();
}
else
{
}
else
{
this
.
after
=
new
ArrayList
<
AutoConfigurationClass
>();
for
(
String
afterClass
:
(
String
[])
this
.
afterAnnotation
.
get
(
"value"
))
{
this
.
after
.
add
(
new
AutoConfigurationClass
(
afterClass
));
...
...
spring-zero-autoconfigure/src/main/java/org/springframework/zero/context/annotation/ComponentScanDetector.java
View file @
764a0a9a
...
...
@@ -70,7 +70,8 @@ class ComponentScanDetector implements ImportBeanDefinitionRegistrar, BeanFactor
private
void
storeComponentScanBasePackages
()
{
if
(
this
.
beanFactory
instanceof
ConfigurableListableBeanFactory
)
{
storeComponentScanBasePackages
((
ConfigurableListableBeanFactory
)
this
.
beanFactory
);
}
else
{
}
else
{
if
(
this
.
logger
.
isWarnEnabled
())
{
this
.
logger
.
warn
(
"Unable to read @ComponentScan annotations for auto-configure"
);
...
...
@@ -109,7 +110,8 @@ class ComponentScanDetector implements ImportBeanDefinitionRegistrar, BeanFactor
MetadataReader
metadataReader
=
this
.
metadataReaderFactory
.
getMetadataReader
(
className
);
return
metadataReader
.
getAnnotationMetadata
();
}
catch
(
IOException
ex
)
{
}
catch
(
IOException
ex
)
{
if
(
this
.
logger
.
isDebugEnabled
())
{
this
.
logger
.
debug
(
"Could not find class file for introspecting @ComponentScan classes: "
...
...
spring-zero-autoconfigure/src/main/java/org/springframework/zero/context/annotation/EnableAutoConfigurationImportSelector.java
View file @
764a0a9a
...
...
@@ -69,7 +69,8 @@ class EnableAutoConfigurationImportSelector implements DeferredImportSelector,
factories
.
add
(
0
,
ComponentScanDetector
.
class
.
getName
());
return
factories
.
toArray
(
new
String
[
factories
.
size
()]);
}
catch
(
IOException
ex
)
{
}
catch
(
IOException
ex
)
{
throw
new
IllegalStateException
(
ex
);
}
}
...
...
spring-zero-autoconfigure/src/main/java/org/springframework/zero/main/Spring.java
View file @
764a0a9a
...
...
@@ -70,11 +70,14 @@ public class Spring {
for
(
String
arg
:
args
)
{
if
(
ClassUtils
.
isPresent
(
arg
,
null
))
{
sources
.
add
(
ClassUtils
.
forName
(
arg
,
null
));
}
else
if
(
arg
.
endsWith
(
".xml"
))
{
}
else
if
(
arg
.
endsWith
(
".xml"
))
{
sources
.
add
(
arg
);
}
else
if
(!
scanner
.
findCandidateComponents
(
arg
).
isEmpty
())
{
}
else
if
(!
scanner
.
findCandidateComponents
(
arg
).
isEmpty
())
{
sources
.
add
(
arg
);
}
else
{
}
else
{
strings
.
add
(
arg
);
}
}
...
...
spring-zero-autoconfigure/src/test/java/org/springframework/zero/autoconfigure/web/ServerPropertiesAutoConfigurationTests.java
View file @
764a0a9a
...
...
@@ -56,8 +56,8 @@ public class ServerPropertiesAutoConfigurationTests {
@Before
public
void
init
()
{
containerFactory
=
Mockito
.
mock
(
ConfigurableEmbeddedServletContainerFactory
.
class
);
containerFactory
=
Mockito
.
mock
(
ConfigurableEmbeddedServletContainerFactory
.
class
);
}
@After
...
...
@@ -70,8 +70,8 @@ public class ServerPropertiesAutoConfigurationTests {
@Test
public
void
createFromConfigClass
()
throws
Exception
{
this
.
context
=
new
AnnotationConfigEmbeddedWebApplicationContext
();
this
.
context
.
register
(
Config
.
class
,
ServerPropertiesAutoConfiguration
.
class
,
PropertyPlaceholderAutoConfiguration
.
class
);
this
.
context
.
register
(
Config
.
class
,
ServerPropertiesAutoConfiguration
.
class
,
PropertyPlaceholderAutoConfiguration
.
class
);
TestUtils
.
addEnviroment
(
this
.
context
,
"server.port:9000"
);
this
.
context
.
refresh
();
ServerProperties
server
=
this
.
context
.
getBean
(
ServerProperties
.
class
);
...
...
@@ -84,8 +84,8 @@ public class ServerPropertiesAutoConfigurationTests {
public
void
tomcatProperties
()
throws
Exception
{
containerFactory
=
Mockito
.
mock
(
TomcatEmbeddedServletContainerFactory
.
class
);
this
.
context
=
new
AnnotationConfigEmbeddedWebApplicationContext
();
this
.
context
.
register
(
Config
.
class
,
ServerPropertiesAutoConfiguration
.
class
,
PropertyPlaceholderAutoConfiguration
.
class
);
this
.
context
.
register
(
Config
.
class
,
ServerPropertiesAutoConfiguration
.
class
,
PropertyPlaceholderAutoConfiguration
.
class
);
TestUtils
.
addEnviroment
(
this
.
context
,
"server.tomcat.basedir:target/foo"
);
this
.
context
.
refresh
();
ServerProperties
server
=
this
.
context
.
getBean
(
ServerProperties
.
class
);
...
...
@@ -97,8 +97,9 @@ public class ServerPropertiesAutoConfigurationTests {
@Test
public
void
testAccidentalMultipleServerPropertiesBeans
()
throws
Exception
{
this
.
context
=
new
AnnotationConfigEmbeddedWebApplicationContext
();
this
.
context
.
register
(
Config
.
class
,
MutiServerPropertiesBeanConfig
.
class
,
ServerPropertiesAutoConfiguration
.
class
,
PropertyPlaceholderAutoConfiguration
.
class
);
this
.
context
.
register
(
Config
.
class
,
MutiServerPropertiesBeanConfig
.
class
,
ServerPropertiesAutoConfiguration
.
class
,
PropertyPlaceholderAutoConfiguration
.
class
);
this
.
thrown
.
expectCause
(
Matchers
.<
Throwable
>
instanceOf
(
NoUniqueBeanDefinitionException
.
class
));
this
.
context
.
refresh
();
...
...
@@ -113,8 +114,7 @@ public class ServerPropertiesAutoConfigurationTests {
}
@Bean
public
EmbeddedServletContainerCustomizerBeanPostProcessor
embeddedServletContainerCustomizerBeanPostProcessor
()
{
public
EmbeddedServletContainerCustomizerBeanPostProcessor
embeddedServletContainerCustomizerBeanPostProcessor
()
{
return
new
EmbeddedServletContainerCustomizerBeanPostProcessor
();
}
...
...
spring-zero-cli/src/main/java/org/springframework/zero/cli/SpringZeroCli.java
View file @
764a0a9a
...
...
@@ -24,9 +24,9 @@ import java.util.ServiceLoader;
import
java.util.Set
;
/**
* Spring Zero Command Line Interface. This is the main entry-point for the Spring
*
Zero command line application. This class will parse input arguments and delegate
*
to a
suitable {@link Command} implementation based on the first argument.
* Spring Zero Command Line Interface. This is the main entry-point for the Spring
Zero
*
command line application. This class will parse input arguments and delegate to a
* suitable {@link Command} implementation based on the first argument.
*
* <p>
* The '-d' and '--debug' switches are handled by this class, however, most argument
...
...
@@ -47,8 +47,7 @@ public class SpringZeroCli {
private
List
<
Command
>
commands
;
/**
* Create a new {@link SpringZeroCli} implementation with the default set of
* commands.
* Create a new {@link SpringZeroCli} implementation with the default set of commands.
*/
public
SpringZeroCli
()
{
setCommands
(
ServiceLoader
.
load
(
CommandFactory
.
class
,
getClass
().
getClassLoader
()));
...
...
@@ -87,10 +86,12 @@ public class SpringZeroCli {
try
{
run
(
argsWithoutDebugFlags
);
return
0
;
}
catch
(
NoArgumentsException
ex
)
{
}
catch
(
NoArgumentsException
ex
)
{
showUsage
();
return
1
;
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
Set
<
SpringZeroCliException
.
Option
>
options
=
NO_EXCEPTION_OPTIONS
;
if
(
ex
instanceof
SpringZeroCliException
)
{
options
=
((
SpringZeroCliException
)
ex
).
getOptions
();
...
...
spring-zero-cli/src/main/java/org/springframework/zero/cli/SpringZeroCliException.java
View file @
764a0a9a
...
...
@@ -70,8 +70,7 @@ public class SpringZeroCliException extends RuntimeException {
}
/**
* Returns options a set of options that are understood by the
* {@link SpringZeroCli}.
* Returns options a set of options that are understood by the {@link SpringZeroCli}.
*/
public
Set
<
Option
>
getOptions
()
{
return
Collections
.
unmodifiableSet
(
this
.
options
);
...
...
spring-zero-cli/src/main/java/org/springframework/zero/cli/command/CleanCommand.java
View file @
764a0a9a
...
...
@@ -102,7 +102,8 @@ public class CleanCommand extends OptionParsingCommand {
||
group
.
equals
(
"org.springframework.zero"
))
{
System
.
out
.
println
(
"Deleting: "
+
file
);
FileUtil
.
forceDelete
(
file
);
}
else
{
}
else
{
for
(
Object
obj
:
FileUtil
.
listAll
(
file
,
Collections
.
emptyList
()))
{
File
candidate
=
(
File
)
obj
;
if
(
candidate
.
getName
().
contains
(
"SNAPSHOT"
))
{
...
...
@@ -119,7 +120,8 @@ public class CleanCommand extends OptionParsingCommand {
File
parent
=
root
;
if
(
layout
==
Layout
.
IVY
)
{
parent
=
new
File
(
parent
,
group
);
}
else
{
}
else
{
for
(
String
path
:
group
.
split
(
"\\."
))
{
parent
=
new
File
(
parent
,
path
);
}
...
...
@@ -140,7 +142,8 @@ public class CleanCommand extends OptionParsingCommand {
if
(
dir
==
null
||
!
new
File
(
dir
).
exists
())
{
dir
=
userdir
;
home
=
new
File
(
dir
,
".groovy"
);
}
else
{
}
else
{
home
=
new
File
(
dir
);
}
if
(
dir
==
null
||
!
new
File
(
dir
).
exists
())
{
...
...
spring-zero-cli/src/main/java/org/springframework/zero/cli/command/OptionHandler.java
View file @
764a0a9a
...
...
@@ -77,7 +77,8 @@ public class OptionHandler {
OutputStream
out
=
new
ByteArrayOutputStream
();
try
{
getParser
().
printHelpOn
(
out
);
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
return
"Help not available"
;
}
return
out
.
toString
();
...
...
spring-zero-cli/src/main/java/org/springframework/zero/cli/command/ScriptCommand.java
View file @
764a0a9a
...
...
@@ -91,13 +91,17 @@ public class ScriptCommand implements Command {
private
void
run
(
Object
main
,
String
[]
args
)
throws
Exception
{
if
(
main
instanceof
Command
)
{
((
Command
)
main
).
run
(
args
);
}
else
if
(
main
instanceof
OptionHandler
)
{
}
else
if
(
main
instanceof
OptionHandler
)
{
((
OptionHandler
)
getMain
()).
run
(
args
);
}
else
if
(
main
instanceof
Closure
)
{
}
else
if
(
main
instanceof
Closure
)
{
((
Closure
<?>)
main
).
call
((
Object
[])
args
);
}
else
if
(
main
instanceof
Runnable
)
{
}
else
if
(
main
instanceof
Runnable
)
{
((
Runnable
)
main
).
run
();
}
else
if
(
main
instanceof
Script
)
{
}
else
if
(
main
instanceof
Script
)
{
Script
script
=
(
Script
)
this
.
main
;
script
.
setProperty
(
"args"
,
args
);
if
(
this
.
main
instanceof
GroovyObjectSupport
)
{
...
...
@@ -135,13 +139,15 @@ public class ScriptCommand implements Command {
if
(
this
.
main
==
null
)
{
try
{
this
.
main
=
getMainClass
().
newInstance
();
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
throw
new
IllegalStateException
(
"Cannot create main class: "
+
this
.
name
,
e
);
}
if
(
this
.
main
instanceof
OptionHandler
)
{
((
OptionHandler
)
this
.
main
).
options
();
}
else
if
(
this
.
main
instanceof
GroovyObjectSupport
)
{
}
else
if
(
this
.
main
instanceof
GroovyObjectSupport
)
{
GroovyObjectSupport
object
=
(
GroovyObjectSupport
)
this
.
main
;
MetaClass
metaClass
=
object
.
getMetaClass
();
MetaMethod
options
=
metaClass
.
getMetaMethod
(
"options"
,
null
);
...
...
@@ -160,9 +166,11 @@ public class ScriptCommand implements Command {
Class
<?>[]
classes
;
try
{
classes
=
compiler
.
compile
(
source
);
}
catch
(
CompilationFailedException
e
)
{
}
catch
(
CompilationFailedException
e
)
{
throw
new
IllegalStateException
(
"Could not compile script"
,
e
);
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
throw
new
IllegalStateException
(
"Could not compile script"
,
e
);
}
this
.
mainClass
=
classes
[
0
];
...
...
@@ -185,18 +193,21 @@ public class ScriptCommand implements Command {
if
(
url
!=
null
)
{
if
(
url
.
toString
().
startsWith
(
"file:"
))
{
file
=
new
File
(
url
.
toString
().
substring
(
"file:"
.
length
()));
}
else
{
}
else
{
// probably in JAR file
try
{
file
=
File
.
createTempFile
(
name
,
".groovy"
);
file
.
deleteOnExit
();
FileUtil
.
copy
(
url
,
file
,
null
);
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
throw
new
IllegalStateException
(
"Could not create temp file for source: "
+
name
);
}
}
}
else
{
}
else
{
String
home
=
System
.
getProperty
(
"SPRING_HOME"
,
System
.
getenv
(
"SPRING_HOME"
));
if
(
home
==
null
)
{
home
=
"."
;
...
...
spring-zero-cli/src/main/java/org/springframework/zero/cli/compiler/DependencyCustomizer.java
View file @
764a0a9a
...
...
@@ -72,7 +72,8 @@ public class DependencyCustomizer {
for
(
String
classname
:
classNames
)
{
try
{
DependencyCustomizer
.
this
.
loader
.
loadClass
(
classname
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
return
true
;
}
}
...
...
@@ -95,7 +96,8 @@ public class DependencyCustomizer {
try
{
DependencyCustomizer
.
this
.
loader
.
loadClass
(
classname
);
return
false
;
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
}
}
return
DependencyCustomizer
.
this
.
canAdd
();
...
...
@@ -119,7 +121,8 @@ public class DependencyCustomizer {
return
false
;
}
return
true
;
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
}
}
return
DependencyCustomizer
.
this
.
canAdd
();
...
...
@@ -143,7 +146,8 @@ public class DependencyCustomizer {
return
true
;
}
return
false
;
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
}
}
return
DependencyCustomizer
.
this
.
canAdd
();
...
...
spring-zero-cli/src/main/java/org/springframework/zero/cli/compiler/GroovyCompiler.java
View file @
764a0a9a
...
...
@@ -88,7 +88,8 @@ public class GroovyCompiler {
for
(
File
file
:
files
)
{
if
(
file
.
getName
().
endsWith
(
".groovy"
)
||
file
.
getName
().
endsWith
(
".java"
))
{
compilables
.
add
(
file
);
}
else
{
}
else
{
others
.
add
(
file
);
}
}
...
...
spring-zero-cli/src/main/java/org/springframework/zero/cli/compiler/autoconfigure/SpringMvcCompilerAutoConfiguration.java
View file @
764a0a9a
...
...
@@ -58,8 +58,8 @@ public class SpringMvcCompilerAutoConfiguration extends CompilerAutoConfiguratio
imports
.
addStarImports
(
"org.springframework.web.bind.annotation"
,
"org.springframework.web.servlet.config.annotation"
,
"org.springframework.http"
);
imports
.
addStaticImport
(
"
org.springframework.zero.cli.template.GroovyTemplate"
,
"
template"
);
imports
.
addStaticImport
(
"org.springframework.zero.cli.template.GroovyTemplate"
,
"template"
);
}
}
spring-zero-cli/src/main/java/org/springframework/zero/cli/compiler/autoconfigure/SpringZeroCompilerAutoConfiguration.java
View file @
764a0a9a
...
...
@@ -100,7 +100,8 @@ public class SpringZeroCompilerAutoConfiguration extends CompilerAutoConfigurati
AnnotationNode
annotationNode
=
new
AnnotationNode
(
new
ClassNode
(
annotationClass
));
classNode
.
addAnnotation
(
annotationNode
);
}
catch
(
ClassNotFoundException
e
)
{
}
catch
(
ClassNotFoundException
e
)
{
throw
new
IllegalStateException
(
e
);
}
}
...
...
spring-zero-cli/src/main/java/org/springframework/zero/cli/runner/SpringZeroRunner.java
View file @
764a0a9a
...
...
@@ -92,10 +92,12 @@ public class SpringZeroRunner {
this
.
fileWatchThread
.
start
();
}
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
if
(
this
.
fileWatchThread
==
null
)
{
throw
ex
;
}
else
{
}
else
{
ex
.
printStackTrace
();
}
}
...
...
@@ -132,7 +134,8 @@ public class SpringZeroRunner {
String
[].
class
);
this
.
applicationContext
=
method
.
invoke
(
null
,
this
.
sources
,
SpringZeroRunner
.
this
.
args
);
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
ex
.
printStackTrace
();
}
}
...
...
@@ -145,11 +148,14 @@ public class SpringZeroRunner {
try
{
Method
method
=
this
.
applicationContext
.
getClass
().
getMethod
(
"close"
);
method
.
invoke
(
this
.
applicationContext
);
}
catch
(
NoSuchMethodException
ex
)
{
}
catch
(
NoSuchMethodException
ex
)
{
// Not an application context that we can close
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
ex
.
printStackTrace
();
}
finally
{
}
finally
{
this
.
applicationContext
=
null
;
}
}
...
...
@@ -186,9 +192,11 @@ public class SpringZeroRunner {
compileAndRun
();
}
}
}
catch
(
InterruptedException
ex
)
{
}
catch
(
InterruptedException
ex
)
{
Thread
.
currentThread
().
interrupt
();
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
// Swallow, will be reported by compileAndRun
}
}
...
...
spring-zero-cli/src/main/java/org/springframework/zero/cli/template/GroovyTemplate.java
View file @
764a0a9a
...
...
@@ -48,10 +48,12 @@ public class GroovyTemplate {
Template
template
;
if
(
file
.
exists
())
{
template
=
engine
.
createTemplate
(
file
);
}
else
{
}
else
{
if
(
resource
!=
null
)
{
template
=
engine
.
createTemplate
(
resource
);
}
else
{
}
else
{
template
=
engine
.
createTemplate
(
name
);
}
}
...
...
spring-zero-core/src/main/java/org/springframework/zero/BeanDefinitionLoader.java
View file @
764a0a9a
...
...
@@ -138,7 +138,8 @@ class BeanDefinitionLoader {
if
(
source
instanceof
CharSequence
)
{
try
{
return
load
(
Class
.
forName
(
source
.
toString
()));
}
catch
(
ClassNotFoundException
e
)
{
}
catch
(
ClassNotFoundException
e
)
{
}
Resource
loadedResource
=
(
this
.
resourceLoader
!=
null
?
this
.
resourceLoader
...
...
spring-zero-core/src/main/java/org/springframework/zero/SpringApplication.java
View file @
764a0a9a
...
...
@@ -270,7 +270,8 @@ public class SpringApplication {
contextClass
=
Class
.
forName
(
this
.
webEnvironment
?
DEFAULT_WEB_CONTEXT_CLASS
:
DEFAULT_CONTEXT_CLASS
);
}
catch
(
ClassNotFoundException
ex
)
{
}
catch
(
ClassNotFoundException
ex
)
{
throw
new
IllegalStateException
(
"Unable create a default ApplicationContext, "
+
"please specify an ApplicationContextClass"
,
ex
);
...
...
@@ -344,14 +345,16 @@ public class SpringApplication {
for
(
String
arg
:
defaults
)
{
if
(
isOptionArg
(
arg
))
{
addOptionArg
(
options
,
arg
);
}
else
{
}
else
{
nonopts
.
add
(
arg
);
}
}
for
(
String
arg
:
args
)
{
if
(
isOptionArg
(
arg
))
{
addOptionArg
(
options
,
arg
);
}
else
if
(!
nonopts
.
contains
(
arg
))
{
}
else
if
(!
nonopts
.
contains
(
arg
))
{
nonopts
.
add
(
arg
);
}
}
...
...
@@ -376,7 +379,8 @@ public class SpringApplication {
optionName
=
optionText
.
substring
(
0
,
optionText
.
indexOf
(
"="
));
optionValue
=
optionText
.
substring
(
optionText
.
indexOf
(
"="
)
+
1
,
optionText
.
length
());
}
else
{
}
else
{
optionName
=
optionText
;
}
if
(
optionName
.
isEmpty
())
{
...
...
@@ -434,7 +438,8 @@ public class SpringApplication {
for
(
CommandLineRunner
runner
:
runners
)
{
try
{
runner
.
run
(
args
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
throw
new
IllegalStateException
(
"Failed to execute CommandLineRunner"
,
e
);
}
}
...
...
@@ -606,11 +611,13 @@ public class SpringApplication {
generators
.
addAll
(
context
.
getBeansOfType
(
ExitCodeGenerator
.
class
)
.
values
());
exitCode
=
getExitCode
(
generators
);
}
finally
{
}
finally
{
close
(
context
);
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
exitCode
=
(
exitCode
==
0
?
1
:
exitCode
);
}
...
...
@@ -625,7 +632,8 @@ public class SpringApplication {
if
(
value
>
0
&&
value
>
exitCode
||
value
<
0
&&
value
<
exitCode
)
{
exitCode
=
value
;
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
exitCode
=
(
exitCode
==
0
?
1
:
exitCode
);
e
.
printStackTrace
();
}
...
...
spring-zero-core/src/main/java/org/springframework/zero/bind/CustomPropertyConstructor.java
View file @
764a0a9a
...
...
@@ -74,7 +74,8 @@ public class CustomPropertyConstructor extends Constructor {
try
{
typeMap
.
put
(
alias
,
this
.
propertyUtils
.
getProperty
(
type
,
name
));
}
catch
(
IntrospectionException
e
)
{
}
catch
(
IntrospectionException
e
)
{
throw
new
RuntimeException
(
e
);
}
}
...
...
spring-zero-core/src/main/java/org/springframework/zero/bind/InetAddressEditor.java
View file @
764a0a9a
...
...
@@ -37,7 +37,8 @@ public class InetAddressEditor extends PropertyEditorSupport implements Property
public
void
setAsText
(
String
text
)
throws
IllegalArgumentException
{
try
{
setValue
(
InetAddress
.
getByName
(
text
));
}
catch
(
UnknownHostException
e
)
{
}
catch
(
UnknownHostException
e
)
{
throw
new
IllegalArgumentException
(
"Cannot locate host"
,
e
);
}
}
...
...
spring-zero-core/src/main/java/org/springframework/zero/bind/PropertiesConfigurationFactory.java
View file @
764a0a9a
...
...
@@ -172,7 +172,8 @@ public class PropertiesConfigurationFactory<T> implements FactoryBean<T>,
try
{
if
(
this
.
properties
!=
null
)
{
logger
.
trace
(
"Properties:\n"
+
this
.
properties
);
}
else
{
}
else
{
logger
.
trace
(
"Property Sources: "
+
this
.
propertySources
);
}
this
.
initialized
=
true
;
...
...
@@ -180,7 +181,8 @@ public class PropertiesConfigurationFactory<T> implements FactoryBean<T>,
RelaxedDataBinder
dataBinder
;
if
(
this
.
targetName
!=
null
)
{
dataBinder
=
new
RelaxedDataBinder
(
this
.
configuration
,
this
.
targetName
);
}
else
{
}
else
{
dataBinder
=
new
RelaxedDataBinder
(
this
.
configuration
);
}
if
(
this
.
validator
!=
null
)
{
...
...
@@ -195,7 +197,8 @@ public class PropertiesConfigurationFactory<T> implements FactoryBean<T>,
PropertyValues
pvs
;
if
(
this
.
properties
!=
null
)
{
pvs
=
new
MutablePropertyValues
(
this
.
properties
);
}
else
{
}
else
{
pvs
=
new
PropertySourcesPropertyValues
(
this
.
propertySources
);
}
dataBinder
.
bind
(
pvs
);
...
...
@@ -219,7 +222,8 @@ public class PropertiesConfigurationFactory<T> implements FactoryBean<T>,
}
}
}
}
catch
(
BindException
e
)
{
}
catch
(
BindException
e
)
{
if
(
this
.
exceptionIfInvalid
)
{
throw
e
;
}
...
...
spring-zero-core/src/main/java/org/springframework/zero/bind/PropertySourcesPropertyValues.java
View file @
764a0a9a
...
...
@@ -98,7 +98,8 @@ public class PropertySourcesPropertyValues implements PropertyValues {
PropertyValue
pvOld
=
old
.
getPropertyValue
(
newPv
.
getName
());
if
(
pvOld
==
null
)
{
changes
.
addPropertyValue
(
newPv
);
}
else
if
(!
pvOld
.
equals
(
newPv
))
{
}
else
if
(!
pvOld
.
equals
(
newPv
))
{
// it's changed
changes
.
addPropertyValue
(
newPv
);
}
...
...
spring-zero-core/src/main/java/org/springframework/zero/bind/RelaxedDataBinder.java
View file @
764a0a9a
...
...
@@ -157,7 +157,8 @@ public class RelaxedDataBinder extends DataBinder {
Map
<
String
,
Object
>
existing
=
(
Map
<
String
,
Object
>)
target
.
getPropertyValue
(
base
);
nested
=
existing
;
}
else
{
}
else
{
target
.
setPropertyValue
(
base
,
nested
);
}
modifyPopertiesForMap
(
nested
,
propertyValues
,
index
,
base
);
...
...
@@ -196,7 +197,8 @@ public class RelaxedDataBinder extends DataBinder {
if
(
target
.
getPropertyType
(
prefix
+
candidate
)
!=
null
)
{
return
candidate
;
}
}
catch
(
InvalidPropertyException
ex
)
{
}
catch
(
InvalidPropertyException
ex
)
{
}
}
}
...
...
spring-zero-core/src/main/java/org/springframework/zero/bind/YamlConfigurationFactory.java
View file @
764a0a9a
...
...
@@ -158,7 +158,8 @@ public class YamlConfigurationFactory<T> implements FactoryBean<T>, MessageSourc
}
}
}
}
catch
(
YAMLException
e
)
{
}
catch
(
YAMLException
e
)
{
if
(
this
.
exceptionIfInvalid
)
{
throw
e
;
}
...
...
spring-zero-core/src/main/java/org/springframework/zero/config/JacksonJsonParser.java
View file @
764a0a9a
...
...
@@ -34,7 +34,8 @@ public class JacksonJsonParser implements JsonParser {
@SuppressWarnings
(
"unchecked"
)
Map
<
String
,
Object
>
map
=
new
ObjectMapper
().
readValue
(
json
,
Map
.
class
);
return
map
;
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
throw
new
IllegalArgumentException
(
"Cannot parse JSON"
,
e
);
}
}
...
...
@@ -45,7 +46,8 @@ public class JacksonJsonParser implements JsonParser {
@SuppressWarnings
(
"unchecked"
)
List
<
Object
>
list
=
new
ObjectMapper
().
readValue
(
json
,
List
.
class
);
return
list
;
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
throw
new
IllegalArgumentException
(
"Cannot parse JSON"
,
e
);
}
}
...
...
spring-zero-core/src/main/java/org/springframework/zero/config/SimpleJsonParser.java
View file @
764a0a9a
...
...
@@ -39,7 +39,8 @@ public class SimpleJsonParser implements JsonParser {
public
Map
<
String
,
Object
>
parseMap
(
String
json
)
{
if
(
json
.
startsWith
(
"{"
))
{
return
parseMapInternal
(
json
);
}
else
if
(
json
.
trim
().
equals
(
""
))
{
}
else
if
(
json
.
trim
().
equals
(
""
))
{
return
new
HashMap
<
String
,
Object
>();
}
return
null
;
...
...
@@ -49,7 +50,8 @@ public class SimpleJsonParser implements JsonParser {
public
List
<
Object
>
parseList
(
String
json
)
{
if
(
json
.
startsWith
(
"["
))
{
return
parseListInternal
(
json
);
}
else
if
(
json
.
trim
().
equals
(
""
))
{
}
else
if
(
json
.
trim
().
equals
(
""
))
{
return
new
ArrayList
<
Object
>();
}
return
null
;
...
...
@@ -104,7 +106,8 @@ public class SimpleJsonParser implements JsonParser {
trimTrailingCharacter
(
values
[
1
],
'"'
),
'"'
);
if
(
string
.
startsWith
(
"{"
)
&&
string
.
endsWith
(
"}"
))
{
value
=
parseInternal
(
string
);
}
else
{
}
else
{
value
=
string
;
}
}
...
...
@@ -129,7 +132,8 @@ public class SimpleJsonParser implements JsonParser {
if
(
current
==
','
&&
inObject
==
0
)
{
list
.
add
(
build
.
toString
());
build
.
setLength
(
0
);
}
else
{
}
else
{
build
.
append
(
current
);
}
index
++;
...
...
spring-zero-core/src/main/java/org/springframework/zero/config/YamlMapFactoryBean.java
View file @
764a0a9a
...
...
@@ -99,7 +99,8 @@ public class YamlMapFactoryBean extends YamlProcessor implements
(
Map
)
existing
);
merge
(
result
,
(
Map
)
value
);
output
.
put
(
key
,
result
);
}
else
{
}
else
{
output
.
put
(
key
,
value
);
}
}
...
...
spring-zero-core/src/main/java/org/springframework/zero/config/YamlProcessor.java
View file @
764a0a9a
...
...
@@ -179,14 +179,16 @@ public class YamlProcessor {
// No need to load any more resources
break
;
}
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
if
(
this
.
resolutionMethod
==
ResolutionMethod
.
FIRST_FOUND
||
this
.
resolutionMethod
==
ResolutionMethod
.
OVERRIDE_AND_IGNORE
)
{
if
(
logger
.
isWarnEnabled
())
{
logger
.
warn
(
"Could not load map from "
+
resource
+
": "
+
e
.
getMessage
());
}
}
else
{
}
else
{
throw
new
IllegalStateException
(
e
);
}
}
...
...
@@ -199,7 +201,8 @@ public class YamlProcessor {
if
(
this
.
documentMatchers
.
isEmpty
())
{
logger
.
debug
(
"Merging document (no matchers set)"
+
map
);
callback
.
process
(
properties
,
map
);
}
else
{
}
else
{
boolean
valueFound
=
false
;
MatchStatus
result
=
MatchStatus
.
ABSTAIN
;
for
(
DocumentMatcher
matcher
:
this
.
documentMatchers
)
{
...
...
@@ -216,7 +219,8 @@ public class YamlProcessor {
if
(
result
==
MatchStatus
.
ABSTAIN
&&
this
.
matchDefault
)
{
logger
.
debug
(
"Matched document with default matcher: "
+
map
);
callback
.
process
(
properties
,
map
);
}
else
if
(!
valueFound
)
{
}
else
if
(!
valueFound
)
{
logger
.
debug
(
"Unmatched document"
);
return
false
;
}
...
...
@@ -231,19 +235,22 @@ public class YamlProcessor {
if
(
StringUtils
.
hasText
(
path
))
{
if
(
key
.
startsWith
(
"["
))
{
key
=
path
+
key
;
}
else
{
}
else
{
key
=
path
+
"."
+
key
;
}
}
Object
value
=
entry
.
getValue
();
if
(
value
instanceof
String
)
{
properties
.
put
(
key
,
value
);
}
else
if
(
value
instanceof
Map
)
{
}
else
if
(
value
instanceof
Map
)
{
// Need a compound key
@SuppressWarnings
(
"unchecked"
)
Map
<
String
,
Object
>
map
=
(
Map
<
String
,
Object
>)
value
;
assignProperties
(
properties
,
map
,
key
);
}
else
if
(
value
instanceof
Collection
)
{
}
else
if
(
value
instanceof
Collection
)
{
// Need a compound key
@SuppressWarnings
(
"unchecked"
)
Collection
<
Object
>
collection
=
(
Collection
<
Object
>)
value
;
...
...
@@ -254,7 +261,8 @@ public class YamlProcessor {
assignProperties
(
properties
,
Collections
.
singletonMap
(
"["
+
(
count
++)
+
"]"
,
object
),
key
);
}
}
else
{
}
else
{
properties
.
put
(
key
,
value
==
null
?
""
:
value
);
}
}
...
...
spring-zero-core/src/main/java/org/springframework/zero/context/annotation/AbstractOnBeanCondition.java
View file @
764a0a9a
...
...
@@ -78,7 +78,8 @@ abstract class AbstractOnBeanCondition implements ConfigurationCondition {
}
}
});
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
}
}
}
...
...
@@ -116,7 +117,8 @@ abstract class AbstractOnBeanCondition implements ConfigurationCondition {
if
(
beans
.
length
!=
0
)
{
beanClassesFound
.
add
(
beanClass
);
}
}
catch
(
ClassNotFoundException
ex
)
{
}
catch
(
ClassNotFoundException
ex
)
{
}
}
for
(
String
beanName
:
beanNames
)
{
...
...
@@ -142,7 +144,8 @@ abstract class AbstractOnBeanCondition implements ConfigurationCondition {
+
candidates
);
if
(
found
.
isEmpty
())
{
this
.
logger
.
debug
(
prefix
+
"Found no beans"
);
}
else
{
}
else
{
this
.
logger
.
debug
(
prefix
+
"Found beans with "
+
type
+
": "
+
found
);
}
}
...
...
spring-zero-core/src/main/java/org/springframework/zero/context/annotation/ConfigurationPropertiesBindingConfiguration.java
View file @
764a0a9a
...
...
@@ -77,10 +77,12 @@ public class ConfigurationPropertiesBindingConfiguration {
if
(
this
.
configurer
!=
null
)
{
propertySources
=
extractPropertySources
(
this
.
configurer
);
}
else
if
(
this
.
environment
instanceof
ConfigurableEnvironment
)
{
}
else
if
(
this
.
environment
instanceof
ConfigurableEnvironment
)
{
propertySources
=
flattenPropertySources
(((
ConfigurableEnvironment
)
this
.
environment
)
.
getPropertySources
());
}
else
{
}
else
{
// empty, so not very useful, but fulfils the contract
propertySources
=
new
MutablePropertySources
();
}
...
...
@@ -121,7 +123,8 @@ public class ConfigurationPropertiesBindingConfiguration {
for
(
PropertySource
<?>
childSource
:
environment
.
getPropertySources
())
{
flattenPropertySources
(
childSource
,
result
);
}
}
else
{
}
else
{
result
.
addLast
(
propertySource
);
}
}
...
...
spring-zero-core/src/main/java/org/springframework/zero/context/annotation/PropertySourcesBindingPostProcessor.java
View file @
764a0a9a
...
...
@@ -113,9 +113,11 @@ public class PropertySourcesBindingPostProcessor implements BeanPostProcessor,
factory
.
setTargetName
(
targetName
);
try
{
target
=
factory
.
getObject
();
// throwaway
}
catch
(
BeansException
e
)
{
}
catch
(
BeansException
e
)
{
throw
e
;
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
throw
new
BeanCreationException
(
beanName
,
"Could not bind"
,
e
);
}
}
...
...
spring-zero-core/src/main/java/org/springframework/zero/context/embedded/AbstractEmbeddedServletContainerFactory.java
View file @
764a0a9a
...
...
@@ -378,7 +378,8 @@ public abstract class AbstractEmbeddedServletContainerFactory implements
path
=
path
.
substring
(
0
,
path
.
indexOf
(
"!/"
));
}
return
new
File
(
path
);
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
return
null
;
}
}
...
...
spring-zero-core/src/main/java/org/springframework/zero/context/embedded/EmbeddedWebApplicationContext.java
View file @
764a0a9a
...
...
@@ -131,10 +131,12 @@ public class EmbeddedWebApplicationContext extends GenericWebApplicationContext
EmbeddedServletContainerFactory
containerFactory
=
getEmbeddedServletContainerFactory
();
this
.
embeddedServletContainer
=
containerFactory
.
getEmbeddedServletContainer
(
getSelfInitializer
());
}
else
if
(
getServletContext
()
!=
null
)
{
}
else
if
(
getServletContext
()
!=
null
)
{
try
{
getSelfInitializer
().
onStartup
(
getServletContext
());
}
catch
(
ServletException
e
)
{
}
catch
(
ServletException
e
)
{
throw
new
ApplicationContextException
(
"Cannot initialize servlet context"
,
e
);
}
...
...
@@ -280,12 +282,14 @@ public class EmbeddedWebApplicationContext extends GenericWebApplicationContext
logger
.
info
(
"Root WebApplicationContext: initialization completed in "
+
elapsedTime
+
" ms"
);
}
}
catch
(
RuntimeException
ex
)
{
}
catch
(
RuntimeException
ex
)
{
logger
.
error
(
"Context initialization failed"
,
ex
);
servletContext
.
setAttribute
(
WebApplicationContext
.
ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE
,
ex
);
throw
ex
;
}
catch
(
Error
err
)
{
}
catch
(
Error
err
)
{
logger
.
error
(
"Context initialization failed"
,
err
);
servletContext
.
setAttribute
(
WebApplicationContext
.
ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE
,
err
);
...
...
@@ -312,7 +316,8 @@ public class EmbeddedWebApplicationContext extends GenericWebApplicationContext
try
{
this
.
embeddedServletContainer
.
stop
();
this
.
embeddedServletContainer
=
null
;
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
throw
new
IllegalStateException
(
ex
);
}
}
...
...
spring-zero-core/src/main/java/org/springframework/zero/context/embedded/FilterRegistrationBean.java
View file @
764a0a9a
...
...
@@ -244,7 +244,8 @@ public class FilterRegistrationBean extends RegistrationBean {
if
(
servletNames
.
isEmpty
()
&&
this
.
urlPatterns
.
isEmpty
())
{
registration
.
addMappingForUrlPatterns
(
dispatcherTypes
,
this
.
matchAfter
,
DEFAULT_URL_MAPPINGS
);
}
else
{
}
else
{
if
(
servletNames
.
size
()
>
0
)
{
registration
.
addMappingForServletNames
(
dispatcherTypes
,
this
.
matchAfter
,
servletNames
.
toArray
(
new
String
[
servletNames
.
size
()]));
...
...
spring-zero-core/src/main/java/org/springframework/zero/context/embedded/jetty/JettyEmbeddedServletContainer.java
View file @
764a0a9a
...
...
@@ -46,7 +46,8 @@ public class JettyEmbeddedServletContainer implements EmbeddedServletContainer {
private
synchronized
void
start
()
{
try
{
this
.
server
.
start
();
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
throw
new
EmbeddedServletContainerException
(
"Unable to start embedded Jetty servlet container"
,
ex
);
}
...
...
@@ -56,10 +57,12 @@ public class JettyEmbeddedServletContainer implements EmbeddedServletContainer {
public
synchronized
void
stop
()
{
try
{
this
.
server
.
stop
();
}
catch
(
InterruptedException
ex
)
{
}
catch
(
InterruptedException
ex
)
{
Thread
.
currentThread
().
interrupt
();
// No drama
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
throw
new
EmbeddedServletContainerException
(
"Unable to stop embedded Jetty servlet container"
,
ex
);
}
...
...
spring-zero-core/src/main/java/org/springframework/zero/context/embedded/jetty/JettyEmbeddedServletContainerFactory.java
View file @
764a0a9a
...
...
@@ -132,7 +132,8 @@ public class JettyEmbeddedServletContainerFactory extends
if
(
root
!=
null
)
{
try
{
handler
.
setBaseResource
(
Resource
.
newResource
(
root
));
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
throw
new
IllegalStateException
(
ex
);
}
}
...
...
@@ -270,11 +271,13 @@ public class JettyEmbeddedServletContainerFactory extends
if
(
errorPage
.
isGlobal
())
{
handler
.
addErrorPage
(
ErrorPageErrorHandler
.
GLOBAL_ERROR_PAGE
,
errorPage
.
getPath
());
}
else
{
}
else
{
if
(
errorPage
.
getExceptionName
()
!=
null
)
{
handler
.
addErrorPage
(
errorPage
.
getExceptionName
(),
errorPage
.
getPath
());
}
else
{
}
else
{
handler
.
addErrorPage
(
errorPage
.
getStatusCode
(),
errorPage
.
getPath
());
}
...
...
spring-zero-core/src/main/java/org/springframework/zero/context/embedded/tomcat/ServletContextInitializerLifecycleListener.java
View file @
764a0a9a
...
...
@@ -52,7 +52,8 @@ public class ServletContextInitializerLifecycleListener implements LifecycleList
for
(
ServletContextInitializer
initializer
:
this
.
initializers
)
{
try
{
initializer
.
onStartup
(
standardContext
.
getServletContext
());
}
catch
(
ServletException
ex
)
{
}
catch
(
ServletException
ex
)
{
throw
new
IllegalStateException
(
ex
);
}
}
...
...
spring-zero-core/src/main/java/org/springframework/zero/context/embedded/tomcat/TomcatEmbeddedServletContainer.java
View file @
764a0a9a
...
...
@@ -57,7 +57,8 @@ public class TomcatEmbeddedServletContainer implements EmbeddedServletContainer
};
awaitThread
.
setDaemon
(
false
);
awaitThread
.
start
();
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
throw
new
EmbeddedServletContainerException
(
"Unable to start embdedded Tomcat"
,
ex
);
}
...
...
@@ -68,10 +69,12 @@ public class TomcatEmbeddedServletContainer implements EmbeddedServletContainer
try
{
try
{
this
.
tomcat
.
stop
();
}
catch
(
LifecycleException
e
)
{
}
catch
(
LifecycleException
e
)
{
}
this
.
tomcat
.
destroy
();
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
throw
new
EmbeddedServletContainerException
(
"Unable to stop embdedded Tomcat"
,
ex
);
}
...
...
spring-zero-core/src/main/java/org/springframework/zero/context/embedded/tomcat/TomcatEmbeddedServletContainerFactory.java
View file @
764a0a9a
...
...
@@ -118,7 +118,8 @@ public class TomcatEmbeddedServletContainerFactory extends
this
.
connector
.
setPort
(
getPort
());
this
.
tomcat
.
getService
().
addConnector
(
this
.
connector
);
this
.
tomcat
.
setConnector
(
this
.
connector
);
}
else
{
}
else
{
Connector
connector
=
new
Connector
(
"org.apache.coyote.http11.Http11NioProtocol"
);
customizeConnector
(
connector
);
...
...
@@ -246,7 +247,8 @@ public class TomcatEmbeddedServletContainerFactory extends
tempFolder
.
mkdir
();
tempFolder
.
deleteOnExit
();
return
tempFolder
;
}
catch
(
IOException
ex
)
{
}
catch
(
IOException
ex
)
{
throw
new
EmbeddedServletContainerException
(
"Unable to create Tomcat tempdir"
,
ex
);
}
...
...
spring-zero-core/src/main/java/org/springframework/zero/context/initializer/ConfigFileApplicationContextInitializer.java
View file @
764a0a9a
...
...
@@ -194,11 +194,13 @@ public class ConfigFileApplicationContextInitializer implements
new
PropertiesPropertySource
(
resource
.
getDescription
(),
properties
));
}
else
{
}
else
{
propertySources
.
addFirst
(
new
PropertiesPropertySource
(
resource
.
getDescription
(),
properties
));
}
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
throw
new
IllegalStateException
(
"Could not load properties file from "
+
resource
,
e
);
}
...
...
@@ -252,7 +254,8 @@ public class ConfigFileApplicationContextInitializer implements
}
// matches default profile
return
MatchStatus
.
FOUND
;
}
else
{
}
else
{
return
MatchStatus
.
NOT_FOUND
;
}
}
...
...
spring-zero-core/src/main/java/org/springframework/zero/context/initializer/ContextIdApplicationContextInitializer.java
View file @
764a0a9a
...
...
@@ -77,7 +77,8 @@ public class ContextIdApplicationContextInitializer implements
index
=
environment
.
getProperty
(
"spring.application.index"
,
Integer
.
class
,
index
);
if
(
index
>=
0
)
{
name
=
name
+
":"
+
index
;
}
else
{
}
else
{
// FIXME do we want this
String
profiles
=
StringUtils
.
arrayToCommaDelimitedString
(
environment
.
getActiveProfiles
());
...
...
spring-zero-core/src/main/java/org/springframework/zero/context/initializer/EnvironmentDelegateApplicationContextInitializer.java
View file @
764a0a9a
...
...
@@ -95,7 +95,8 @@ public class EnvironmentDelegateApplicationContextInitializer implements
"class ["
+
className
+
"] must implement ApplicationContextInitializer"
);
classes
.
add
((
Class
<
ApplicationContextInitializer
<
ConfigurableApplicationContext
>>)
clazz
);
}
catch
(
ClassNotFoundException
ex
)
{
}
catch
(
ClassNotFoundException
ex
)
{
throw
new
ApplicationContextException
(
"Failed to load context initializer class ["
+
className
+
"]"
,
ex
);
...
...
spring-zero-core/src/main/java/org/springframework/zero/context/initializer/LoggingApplicationContextInitializer.java
View file @
764a0a9a
...
...
@@ -170,9 +170,11 @@ public class LoggingApplicationContextInitializer implements
String
configLocation
=
getConfigLocation
(
applicationContext
);
try
{
doInit
(
applicationContext
,
configLocation
);
}
catch
(
RuntimeException
ex
)
{
}
catch
(
RuntimeException
ex
)
{
throw
ex
;
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
throw
new
IllegalStateException
(
"Cannot initialize logging from "
+
configLocation
,
ex
);
}
...
...
spring-zero-core/src/main/java/org/springframework/zero/context/initializer/VcapApplicationContextInitializer.java
View file @
764a0a9a
...
...
@@ -121,7 +121,8 @@ public class VcapApplicationContextInitializer implements
CommandLinePropertySource
.
COMMAND_LINE_PROPERTY_SOURCE_NAME
,
new
PropertiesPropertySource
(
"vcap"
,
properties
));
}
else
{
}
else
{
propertySources
.
addFirst
(
new
PropertiesPropertySource
(
"vcap"
,
properties
));
}
...
...
@@ -168,19 +169,22 @@ public class VcapApplicationContextInitializer implements
if
(
StringUtils
.
hasText
(
path
))
{
if
(
key
.
startsWith
(
"["
))
{
key
=
path
+
key
;
}
else
{
}
else
{
key
=
path
+
"."
+
key
;
}
}
Object
value
=
entry
.
getValue
();
if
(
value
instanceof
String
)
{
properties
.
put
(
key
,
value
);
}
else
if
(
value
instanceof
Map
)
{
}
else
if
(
value
instanceof
Map
)
{
// Need a compound key
@SuppressWarnings
(
"unchecked"
)
Map
<
String
,
Object
>
map
=
(
Map
<
String
,
Object
>)
value
;
flatten
(
properties
,
map
,
key
);
}
else
if
(
value
instanceof
Collection
)
{
}
else
if
(
value
instanceof
Collection
)
{
// Need a compound key
@SuppressWarnings
(
"unchecked"
)
Collection
<
Object
>
collection
=
(
Collection
<
Object
>)
value
;
...
...
@@ -191,7 +195,8 @@ public class VcapApplicationContextInitializer implements
flatten
(
properties
,
Collections
.
singletonMap
(
"["
+
(
count
++)
+
"]"
,
object
),
key
);
}
}
else
{
}
else
{
properties
.
put
(
key
,
value
==
null
?
""
:
value
);
}
}
...
...
spring-zero-core/src/main/java/org/springframework/zero/logging/JavaLoggerConfigurer.java
View file @
764a0a9a
...
...
@@ -40,11 +40,14 @@ public abstract class JavaLoggerConfigurer {
try
{
LogManager
.
getLogManager
().
readConfiguration
(
ResourceUtils
.
getURL
(
resolvedLocation
).
openStream
());
}
catch
(
FileNotFoundException
e
)
{
}
catch
(
FileNotFoundException
e
)
{
throw
e
;
}
catch
(
RuntimeException
e
)
{
}
catch
(
RuntimeException
e
)
{
throw
e
;
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
throw
new
IllegalArgumentException
(
"Could not initialize logging from "
+
location
,
e
);
}
...
...
spring-zero-core/src/main/java/org/springframework/zero/logging/LogbackConfigurer.java
View file @
764a0a9a
...
...
@@ -47,7 +47,8 @@ public abstract class LogbackConfigurer {
context
.
stop
();
try
{
new
ContextInitializer
(
context
).
configureByResource
(
url
);
}
catch
(
JoranException
e
)
{
}
catch
(
JoranException
e
)
{
throw
new
IllegalArgumentException
(
"Could not initialize logging from "
+
location
,
e
);
}
...
...
spring-zero-core/src/main/java/org/springframework/zero/web/SpringServletInitializer.java
View file @
764a0a9a
...
...
@@ -42,7 +42,8 @@ public abstract class SpringServletInitializer implements WebApplicationInitiali
// no-op because the application context is already initialized
}
});
}
else
{
}
else
{
this
.
logger
.
debug
(
"No ContextLoaderListener registered, as "
+
"createRootApplicationContext() did not return an application context"
);
...
...
spring-zero-core/src/test/java/org/springframework/zero/SpringApplicationTests.java
View file @
764a0a9a
...
...
@@ -361,7 +361,8 @@ public class SpringApplicationTests {
this
.
sources
=
sources
;
if
(
this
.
useMockLoader
)
{
this
.
loader
=
mock
(
BeanDefinitionLoader
.
class
);
}
else
{
}
else
{
this
.
loader
=
spy
(
super
.
createBeanDefinitionLoader
(
registry
,
sources
));
}
return
this
.
loader
;
...
...
spring-zero-core/src/test/java/org/springframework/zero/context/embedded/AbstractEmbeddedServletContainerFactoryTests.java
View file @
764a0a9a
...
...
@@ -79,7 +79,8 @@ public abstract class AbstractEmbeddedServletContainerFactoryTests {
if
(
this
.
container
!=
null
)
{
try
{
this
.
container
.
stop
();
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
}
}
}
...
...
@@ -156,7 +157,8 @@ public abstract class AbstractEmbeddedServletContainerFactoryTests {
try
{
Thread
.
sleep
(
500
);
date
[
0
]
=
new
Date
();
}
catch
(
InterruptedException
ex
)
{
}
catch
(
InterruptedException
ex
)
{
throw
new
ServletException
(
ex
);
}
}
...
...
@@ -249,7 +251,8 @@ public abstract class AbstractEmbeddedServletContainerFactoryTests {
ClientHttpResponse
response
=
request
.
execute
();
try
{
return
StreamUtils
.
copyToString
(
response
.
getBody
(),
Charset
.
forName
(
"UTF-8"
));
}
finally
{
}
finally
{
response
.
close
();
}
}
...
...
spring-zero-core/src/test/java/org/springframework/zero/context/embedded/EmbeddedServletContainerMvcIntegrationTests.java
View file @
764a0a9a
...
...
@@ -55,7 +55,8 @@ public class EmbeddedServletContainerMvcIntegrationTests {
public
void
closeContext
()
{
try
{
this
.
context
.
close
();
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
}
}
...
...
@@ -90,7 +91,8 @@ public class EmbeddedServletContainerMvcIntegrationTests {
String
actual
=
StreamUtils
.
copyToString
(
response
.
getBody
(),
Charset
.
forName
(
"UTF-8"
));
assertThat
(
actual
,
equalTo
(
"Hello World"
));
}
finally
{
}
finally
{
response
.
close
();
}
}
...
...
spring-zero-core/src/test/java/org/springframework/zero/context/embedded/MockEmbeddedServletContainerFactory.java
View file @
764a0a9a
...
...
@@ -132,7 +132,8 @@ public class MockEmbeddedServletContainerFactory extends
for
(
ServletContextInitializer
initializer
:
this
.
initializers
)
{
initializer
.
onStartup
(
this
.
servletContext
);
}
}
catch
(
ServletException
ex
)
{
}
catch
(
ServletException
ex
)
{
throw
new
RuntimeException
(
ex
);
}
}
...
...
spring-zero-launcher/src/main/java/org/springframework/zero/launcher/Launcher.java
View file @
764a0a9a
...
...
@@ -55,7 +55,8 @@ public abstract class Launcher {
public
void
launch
(
String
[]
args
)
{
try
{
launch
(
args
,
getClass
().
getProtectionDomain
());
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
System
.
exit
(
1
);
}
...
...
spring-zero-launcher/src/main/java/org/springframework/zero/launcher/MainMethodRunner.java
View file @
764a0a9a
...
...
@@ -51,7 +51,8 @@ public class MainMethodRunner implements Runnable {
+
" does not have a main method"
);
}
mainMethod
.
invoke
(
null
,
new
Object
[]
{
args
});
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
System
.
exit
(
1
);
}
...
...
spring-zero-launcher/src/main/java/org/springframework/zero/launcher/WarLauncher.java
View file @
764a0a9a
...
...
@@ -36,7 +36,8 @@ public class WarLauncher extends Launcher {
protected
boolean
isNestedJarFile
(
JarEntry
jarEntry
)
{
if
(
jarEntry
.
isDirectory
())
{
return
jarEntry
.
getName
().
equals
(
"WEB-INF/classes/"
);
}
else
{
}
else
{
return
jarEntry
.
getName
().
startsWith
(
"WEB-INF/lib/"
)
||
jarEntry
.
getName
().
startsWith
(
"WEB-INF/lib-provided/"
);
}
...
...
spring-zero-launcher/src/main/java/org/springframework/zero/launcher/data/RandomAccessDataFile.java
View file @
764a0a9a
...
...
@@ -163,10 +163,12 @@ public class RandomAccessDataFile implements RandomAccessData {
int
rtn
=
file
.
read
();
moveOn
(
rtn
==
-
1
?
0
:
1
);
return
rtn
;
}
else
{
}
else
{
return
(
int
)
moveOn
(
file
.
read
(
b
,
off
,
(
int
)
cap
(
len
)));
}
}
finally
{
}
finally
{
RandomAccessDataFile
.
this
.
filePool
.
release
(
file
);
}
}
...
...
@@ -222,7 +224,8 @@ public class RandomAccessDataFile implements RandomAccessData {
RandomAccessFile
file
=
this
.
files
.
poll
();
return
(
file
==
null
?
new
RandomAccessFile
(
RandomAccessDataFile
.
this
.
file
,
"r"
)
:
file
);
}
catch
(
InterruptedException
e
)
{
}
catch
(
InterruptedException
e
)
{
throw
new
IOException
(
e
);
}
}
...
...
@@ -241,10 +244,12 @@ public class RandomAccessDataFile implements RandomAccessData {
file
.
close
();
file
=
files
.
poll
();
}
}
finally
{
}
finally
{
this
.
available
.
release
(
size
);
}
}
catch
(
InterruptedException
e
)
{
}
catch
(
InterruptedException
e
)
{
throw
new
IOException
(
e
);
}
}
...
...
spring-zero-launcher/src/main/java/org/springframework/zero/launcher/jar/RandomAccessJarFile.java
View file @
764a0a9a
...
...
@@ -127,7 +127,8 @@ public class RandomAccessJarFile extends JarFile {
((
Entry
)
containedEntry
).
configure
(
this
.
manifest
);
}
}
}
finally
{
}
finally
{
inputStream
.
close
();
}
}
...
...
@@ -220,7 +221,8 @@ public class RandomAccessJarFile extends JarFile {
return
new
RandomAccessJarFile
(
this
.
rootJarFile
,
getName
()
+
"!/"
+
directoryName
.
substring
(
0
,
directoryName
.
length
()
-
1
),
this
.
data
,
filtersToUse
);
}
else
{
}
else
{
if
(
ze
.
getMethod
()
!=
ZipEntry
.
STORED
)
{
throw
new
IllegalStateException
(
"Unable to open nested compressed entry "
+
ze
.
getName
());
...
...
@@ -411,7 +413,8 @@ public class RandomAccessJarFile extends JarFile {
connect
();
return
(
int
)
(
this
.
jarEntry
==
null
?
this
.
jarFile
.
size
()
:
this
.
jarEntry
.
getSize
());
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
return
-
1
;
}
}
...
...
@@ -453,7 +456,8 @@ public class RandomAccessJarFile extends JarFile {
protected
void
fill
()
throws
IOException
{
try
{
super
.
fill
();
}
catch
(
EOFException
ex
)
{
}
catch
(
EOFException
ex
)
{
if
(
this
.
extraBytesWritten
)
{
throw
ex
;
}
...
...
spring-zero-launcher/src/test/java/org/springframework/zero/launcher/jar/RandomAccessDataZipInputStreamTest.java
View file @
764a0a9a
...
...
@@ -54,7 +54,8 @@ public class RandomAccessDataZipInputStreamTest {
try
{
writeDataEntry
(
zipOutputStream
,
"a"
,
new
byte
[
10
]);
writeDataEntry
(
zipOutputStream
,
"b"
,
new
byte
[
20
]);
}
finally
{
}
finally
{
zipOutputStream
.
close
();
}
}
...
...
@@ -85,7 +86,8 @@ public class RandomAccessDataZipInputStreamTest {
assertThat
(
entry2
.
getName
(),
equalTo
(
"b"
));
assertThat
(
entry2
.
getData
().
getSize
(),
equalTo
(
20L
));
assertThat
(
z
.
getNextEntry
(),
nullValue
());
}
finally
{
}
finally
{
z
.
close
();
}
}
...
...
spring-zero-launcher/src/test/java/org/springframework/zero/launcher/jar/RandomAccessJarFileTest.java
View file @
764a0a9a
...
...
@@ -93,7 +93,8 @@ public class RandomAccessJarFileTest {
jarOutputStream
.
putNextEntry
(
nestedEntry
);
jarOutputStream
.
write
(
nestedJarData
);
jarOutputStream
.
closeEntry
();
}
finally
{
}
finally
{
jarOutputStream
.
close
();
}
this
.
jarFile
=
new
RandomAccessJarFile
(
this
.
rootJarFile
);
...
...
spring-zero-maven-plugin/src/main/java/org/springframework/zero/maven/AbstractExecutableArchiveMojo.java
View file @
764a0a9a
...
...
@@ -187,7 +187,8 @@ public abstract class AbstractExecutableArchiveMojo extends AbstractMojo {
File
archiveFile
=
createArchive
();
if
(
this
.
classifier
==
null
||
this
.
classifier
.
isEmpty
())
{
this
.
project
.
getArtifact
().
setFile
(
archiveFile
);
}
else
{
}
else
{
this
.
projectHelper
.
attachArtifact
(
this
.
project
,
getType
(),
this
.
classifier
,
archiveFile
);
}
...
...
@@ -209,10 +210,12 @@ public abstract class AbstractExecutableArchiveMojo extends AbstractMojo {
try
{
archiver
.
createArchive
(
this
.
session
,
this
.
project
,
this
.
archive
);
return
archiveFile
;
}
finally
{
}
finally
{
zipFile
.
close
();
}
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
throw
new
MojoExecutionException
(
"Error assembling archive"
,
ex
);
}
}
...
...
@@ -306,7 +309,8 @@ public abstract class AbstractExecutableArchiveMojo extends AbstractMojo {
throw
new
MojoExecutionException
(
"Unable to resolve launcher classes"
);
}
return
addLauncherClasses
(
archiver
,
artifactResult
.
getArtifact
().
getFile
());
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
if
(
ex
instanceof
MojoExecutionException
)
{
throw
(
MojoExecutionException
)
ex
;
}
...
...
spring-zero-maven-plugin/src/main/java/org/springframework/zero/maven/MainClassFinder.java
View file @
764a0a9a
...
...
@@ -101,10 +101,12 @@ class MainClassFinder {
MainMethodFinder
mainMethodFinder
=
new
MainMethodFinder
();
classReader
.
accept
(
mainMethodFinder
,
ClassReader
.
SKIP_CODE
);
return
mainMethodFinder
.
isFound
();
}
finally
{
}
finally
{
inputStream
.
close
();
}
}
catch
(
IOException
ex
)
{
}
catch
(
IOException
ex
)
{
return
false
;
}
}
...
...
spring-zero-maven-plugin/src/test/java/org/springframework/zero/maven/MainClassFinderTests.java
View file @
764a0a9a
...
...
@@ -87,7 +87,8 @@ public class MainClassFinderTests {
OutputStream
outputStream
=
new
FileOutputStream
(
file
);
try
{
IOUtil
.
copy
(
inputStream
,
outputStream
);
}
finally
{
}
finally
{
outputStream
.
close
();
}
return
file
;
...
...
spring-zero-samples/spring-zero-sample-profile/src/test/java/org/springframework/zero/sample/profile/SampleProfileApplicationTests.java
View file @
764a0a9a
...
...
@@ -34,7 +34,8 @@ public class SampleProfileApplicationTests {
public
void
after
()
{
if
(
this
.
profiles
!=
null
)
{
System
.
setProperty
(
"spring.profiles.active"
,
this
.
profiles
);
}
else
{
}
else
{
System
.
clearProperty
(
"spring.profiles.active"
);
}
}
...
...
spring-zero-samples/spring-zero-sample-simple/src/test/java/org/springframework/zero/sample/simple/SampleSimpleApplicationTests.java
View file @
764a0a9a
...
...
@@ -35,7 +35,8 @@ public class SampleSimpleApplicationTests {
public
void
after
()
{
if
(
this
.
profiles
!=
null
)
{
System
.
setProperty
(
"spring.profiles.active"
,
this
.
profiles
);
}
else
{
}
else
{
System
.
clearProperty
(
"spring.profiles.active"
);
}
System
.
setOut
(
this
.
savedOutput
);
...
...
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