mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-07-05 00:56:58 +08:00
Minor change to code formatting
This commit is contained in:
parent
a6341dc0af
commit
764a0a9af8
@ -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
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
@ -27,7 +27,7 @@ import org.springframework.zero.context.annotation.EnableConfigurationProperties
|
||||
/**
|
||||
* {@link EnableAutoConfiguration Auto-configuration} for the
|
||||
* {@link ManagementServerPropertiesAutoConfiguration} bean.
|
||||
*
|
||||
*
|
||||
* @author Dave Syer
|
||||
*/
|
||||
@Configuration
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -58,12 +58,12 @@ import org.springframework.zero.context.annotation.EnableConfigurationProperties
|
||||
* password=password)</code> but can easily be customized by providing a bean definition
|
||||
* of type {@link AuthenticationManager}. Also provides audit logging of authentication
|
||||
* events.
|
||||
*
|
||||
*
|
||||
* <p>
|
||||
* The framework {@link Endpoint}s (used to expose application information to operations)
|
||||
* include a {@link Endpoint#isSensitive() sensitive} configuration option which will be
|
||||
* used as a security hint by the filter created here.
|
||||
*
|
||||
*
|
||||
* <p>
|
||||
* Some common simple customizations:
|
||||
* <ul>
|
||||
@ -75,7 +75,7 @@ import org.springframework.zero.context.annotation.EnableConfigurationProperties
|
||||
* <li>Add form login for user facing resources: add a
|
||||
* {@link WebSecurityConfigurerAdapter} and use {@link HttpSecurity#formLogin()}</li>
|
||||
* </ul>
|
||||
*
|
||||
*
|
||||
* @author Dave Syer
|
||||
*/
|
||||
@Configuration
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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)));
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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)) {
|
||||
|
@ -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)) {
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -84,7 +84,8 @@ public class ThymeleafAutoConfiguration {
|
||||
try {
|
||||
return DefaultTemplateResolverConfiguration.this.resourceLoader
|
||||
.getResource(resourceName).getInputStream();
|
||||
} catch (IOException e) {
|
||||
}
|
||||
catch (IOException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ import org.springframework.zero.context.annotation.EnableAutoConfiguration;
|
||||
|
||||
/**
|
||||
* {@link EnableAutoConfiguration Auto-configuration} for {@link EnableWebMvc Web MVC}.
|
||||
*
|
||||
*
|
||||
* @author Phillip Webb
|
||||
* @author Dave Syer
|
||||
*/
|
||||
|
@ -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));
|
||||
|
@ -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: "
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
@ -24,14 +24,14 @@ 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
|
||||
* parsing is left to the {@link Command} implementation.
|
||||
*
|
||||
*
|
||||
* @author Phillip Webb
|
||||
* @see #main(String...)
|
||||
* @see SpringZeroCliException
|
||||
@ -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();
|
||||
|
@ -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);
|
||||
|
@ -29,7 +29,7 @@ import org.springframework.zero.cli.Command;
|
||||
/**
|
||||
* {@link Command} to 'clean' up grapes, removing cached dependencies and forcing a
|
||||
* download on the next attempt to resolve.
|
||||
*
|
||||
*
|
||||
* @author Dave Syer
|
||||
*/
|
||||
public class CleanCommand extends OptionParsingCommand {
|
||||
@ -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()) {
|
||||
|
@ -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();
|
||||
|
@ -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 = ".";
|
||||
|
@ -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();
|
||||
|
@ -47,13 +47,13 @@ import org.codehaus.groovy.control.customizers.ImportCustomizer;
|
||||
* <li>{@link CompilerAutoConfiguration} strategies will be read from
|
||||
* <code>META-INF/services/org.springframework.zero.cli.compiler.CompilerAutoConfiguration</code>
|
||||
* (per the standard java {@link ServiceLoader} contract) and applied during compilation</li>
|
||||
*
|
||||
*
|
||||
* <li>Multiple classes can be returned if the Groovy source defines more than one Class</li>
|
||||
*
|
||||
*
|
||||
* <li>Generated class files can also be loaded using
|
||||
* {@link ClassLoader#getResource(String)}</li>
|
||||
* <ul>
|
||||
*
|
||||
*
|
||||
* @author Phillip Webb
|
||||
* @author Dave Syer
|
||||
*/
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ import org.springframework.zero.cli.compiler.DependencyCustomizer;
|
||||
|
||||
/**
|
||||
* {@link CompilerAutoConfiguration} for Spring MVC.
|
||||
*
|
||||
*
|
||||
* @author Dave Syer
|
||||
* @author Phillip Webb
|
||||
*/
|
||||
@ -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");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -158,7 +158,8 @@ public class YamlConfigurationFactory<T> implements FactoryBean<T>, MessageSourc
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (YAMLException e) {
|
||||
}
|
||||
catch (YAMLException e) {
|
||||
if (this.exceptionIfInvalid) {
|
||||
throw e;
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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++;
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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()]));
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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());
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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());
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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");
|
||||
|
@ -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;
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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/");
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -87,7 +87,8 @@ public class MainClassFinderTests {
|
||||
OutputStream outputStream = new FileOutputStream(file);
|
||||
try {
|
||||
IOUtil.copy(inputStream, outputStream);
|
||||
} finally {
|
||||
}
|
||||
finally {
|
||||
outputStream.close();
|
||||
}
|
||||
return file;
|
||||
|
@ -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");
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user