Skip to content

Commit

Permalink
Minor change to code formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
philwebb committed Jul 8, 2013
1 parent a6341dc commit 764a0a9
Show file tree
Hide file tree
Showing 84 changed files with 391 additions and 214 deletions.
8 changes: 4 additions & 4 deletions eclipse/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ private static Map<String, Object> convert(String[] data) {
if (entry.contains("=")) {
int index = entry.indexOf("=");
result.put(entry.substring(0, index), entry.substring(index + 1));
} else {
}
else {
result.put(entry, null);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,15 +140,17 @@ public static ManagementServerPort get(BeanFactory beanFactory) {
ServerProperties serverProperties;
try {
serverProperties = beanFactory.getBean(ServerProperties.class);
} catch (NoSuchBeanDefinitionException ex) {
}
catch (NoSuchBeanDefinitionException ex) {
serverProperties = new ServerProperties();
}

ManagementServerProperties managementServerProperties;
try {
managementServerProperties = beanFactory
.getBean(ManagementServerProperties.class);
} catch (NoSuchBeanDefinitionException ex) {
}
catch (NoSuchBeanDefinitionException ex) {
managementServerProperties = new ManagementServerProperties();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
/**
* {@link EnableAutoConfiguration Auto-configuration} for the
* {@link ManagementServerPropertiesAutoConfiguration} bean.
*
*
* @author Dave Syer
*/
@Configuration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ public void doFilter(ServletRequest request, ServletResponse response,
&& (response instanceof HttpServletResponse)) {
doFilter((HttpServletRequest) request, (HttpServletResponse) response,
chain);
} else {
}
else {
chain.doFilter(request, response);
}
}
Expand All @@ -96,7 +97,8 @@ public void doFilter(HttpServletRequest request, HttpServletResponse response,
stopWatch.start();
try {
chain.doFilter(request, response);
} finally {
}
finally {
stopWatch.stop();
String gaugeKey = getKey("response" + suffix);
MetricFilterAutoConfiguration.this.gaugeService.set(gaugeKey,
Expand All @@ -109,7 +111,8 @@ public void doFilter(HttpServletRequest request, HttpServletResponse response,
private int getStatus(HttpServletResponse response) {
try {
return response.getStatus();
} catch (Exception e) {
}
catch (Exception e) {
return UNDEFINED_HTTP_STATUS;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,12 @@
* 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>
Expand All @@ -75,7 +75,7 @@
* <li>Add form login for user facing resources: add a
* {@link WebSecurityConfigurerAdapter} and use {@link HttpSecurity#formLogin()}</li>
* </ul>
*
*
* @author Dave Syer
*/
@Configuration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ public Map<String, Object> invoke() {
public void run() {
try {
Thread.sleep(500L);
} catch (InterruptedException e) {
}
catch (InterruptedException e) {
}
ShutdownEndpoint.this.context.close();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@ private void handle(HttpServletRequest request, HttpServletResponse response,
}
}
throw new HttpMediaTypeNotAcceptableException(this.allSupportedMediaTypes);
} finally {
}
finally {
outputMessage.close();
}
}
Expand Down Expand Up @@ -179,7 +180,8 @@ private MediaType selectMediaType(List<MediaType> mediaTypes) {
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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ public void reset(String metricName) {
private String wrap(String metricName) {
if (metricName.startsWith("counter")) {
return metricName;
} else {
}
else {
return "counter." + metricName;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ public void set(String metricName, double value) {
private String wrap(String metricName) {
if (metricName.startsWith("gauge")) {
return metricName;
} else {
}
else {
return "gauge." + metricName;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ public void increment(String metricName, int amount, Date timestamp) {
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)));
}
Expand All @@ -50,7 +51,8 @@ public void set(String metricName, double value, Date timestamp) {
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)));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,11 @@ public void setApplicationEventPublisher(ApplicationEventPublisher publisher) {
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);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ public void setApplicationEventPublisher(ApplicationEventPublisher publisher) {
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);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@ public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain)
.get("headers");
this.logger.trace("Headers: "
+ this.objectMapper.writeValueAsString(headers));
} catch (JsonProcessingException e) {
}
catch (JsonProcessingException e) {
throw new IllegalStateException("Cannot create JSON", e);
}
}
Expand All @@ -121,7 +122,8 @@ protected Map<String, Object> getTrace(HttpServletRequest request) {
Object value = values;
if (values.size() == 1) {
value = values.get(0);
} else if (values.isEmpty()) {
}
else if (values.isEmpty()) {
value = "";
}
map.put(name, value);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ public Map<String, Object> error(HttpServletRequest request) {
if (obj != null) {
status = (Integer) obj;
map.put("error", HttpStatus.valueOf(status).getReasonPhrase());
} else {
}
else {
map.put("error", "None");
}
map.put("status", status);
Expand All @@ -94,12 +95,14 @@ public Map<String, Object> error(HttpServletRequest request) {
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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ public class EndpointWebMvcAutoConfigurationTests {
public void close() {
try {
this.applicationContext.close();
} catch (Exception ex) {
}
catch (Exception ex) {
}
}

Expand Down Expand Up @@ -168,10 +169,12 @@ public void assertContent(String url, int port, Object expected) throws Exceptio
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)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
Expand All @@ -50,7 +51,8 @@ public static void storeBasePackages(ConfigurableListableBeanFactory beanFactory
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)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ public void close() {
if (this.pool != null) {
try {
this.pool.close();
} catch (SQLException e) {
}
catch (SQLException e) {
throw new DataAccessResourceFailureException(
"Could not close data source", e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ protected boolean isAutoConfiguredDataSource() {
.getBeanDefinition("dataSource");
return EmbeddedDatabaseConfiguration.class.getName().equals(
beanDefinition.getFactoryBeanName());
} catch (NoSuchBeanDefinitionException e) {
}
catch (NoSuchBeanDefinitionException e) {
return false;
}
}
Expand All @@ -89,7 +90,8 @@ protected boolean isAutoConfiguredDataSource() {
protected DataSource getDataSource() {
try {
return this.beanFactory.getBean("dataSource", DataSource.class);
} catch (RuntimeException e) {
}
catch (RuntimeException e) {
return this.beanFactory.getBean(DataSource.class);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ public InputStream getResourceAsStream(
try {
return DefaultTemplateResolverConfiguration.this.resourceLoader
.getResource(resourceName).getInputStream();
} catch (IOException e) {
}
catch (IOException e) {
return null;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@

/**
* {@link EnableAutoConfiguration Auto-configuration} for {@link EnableWebMvc Web MVC}.
*
*
* @author Phillip Webb
* @author Dave Syer
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,8 @@ public List<AutoConfigurationClass> getAfter() throws IOException {
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));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata,
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");
Expand Down Expand Up @@ -109,7 +110,8 @@ private AnnotationMetadata getMetadata(BeanDefinition beanDefinition) {
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: "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ public String[] selectImports(AnnotationMetadata metadata) {
factories.add(0, ComponentScanDetector.class.getName());

return factories.toArray(new String[factories.size()]);
} catch (IOException ex) {
}
catch (IOException ex) {
throw new IllegalStateException(ex);
}
}
Expand Down
Loading

0 comments on commit 764a0a9

Please sign in to comment.