Skip to content
This repository has been archived by the owner on Apr 5, 2022. It is now read-only.

Commit

Permalink
Merge pull request #5 from nebhale/java-6-compatible
Browse files Browse the repository at this point in the history
Make source code Java 6 compatible
  • Loading branch information
jbrisbin committed Oct 24, 2012
2 parents 5bfcc3b + c279f39 commit f8ca4df
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 29 deletions.
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ configurations {
compile.extendsFrom providedCompile
}
[compileJava, compileTestJava]*.options*.compilerArgs = ["-Xlint:unchecked"]
project.sourceCompatibility = 1.7
project.targetCompatibility = 1.7
project.sourceCompatibility = 1.6
project.targetCompatibility = 1.6

// Repositories
repositories {
Expand Down Expand Up @@ -115,4 +115,4 @@ idea {
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public class ContextCommands implements CommandMarker, InitializingBean {
private static final PropertyAccessor ENV_ACCESSOR = new EnvironmentAccessor();
private static final Environment ENV = new StandardEnvironment();

final Map<String, Object> variables = new HashMap<>();
final Map<String, Object> variables = new HashMap<String, Object>();
StandardEvaluationContext evalCtx;

private final SpelExpressionParser parser = new SpelExpressionParser();
Expand Down Expand Up @@ -179,7 +179,7 @@ public String evalAsString(String expr) {

private void setup() {
evalCtx = new StandardEvaluationContext(variables);
List<PropertyAccessor> accessors = new ArrayList<>();
List<PropertyAccessor> accessors = new ArrayList<PropertyAccessor>();
accessors.add(MAP_ACCESOR);
accessors.add(BEAN_ACCESOR);
accessors.add(ENV_ACCESSOR);
Expand All @@ -188,4 +188,4 @@ private void setup() {
variables.put("env", ENV);
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public class DiscoveryCommands implements CommandMarker, ApplicationEventPublish
private RestTemplate client = new RestTemplate();
@Autowired(required = false)
private ObjectMapper mapper = new ObjectMapper();
private Map<String, String> resources = new HashMap<>();
private Map<String, String> resources = new HashMap<String, String>();

@Override public void setApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher) {
this.ctx = applicationEventPublisher;
Expand Down Expand Up @@ -226,7 +226,7 @@ private class ExtractLinksHelper implements RequestCallback, ResponseExtractor<L
}

@Override public List<Link> extractData(ClientHttpResponse response) throws IOException {
List<Link> links = new ArrayList<>();
List<Link> links = new ArrayList<Link>();

MediaType ct = response.getHeaders().getContentType();
if(null != ct && ct.getSubtype().endsWith("json")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,8 @@ public class HierarchyCommands implements CommandMarker {

@CliAvailabilityIndicator({"up"})
public boolean isHierarchyAvailable() {
switch(configCmds.getBaseUri().getPath()) {
case "":
case "/":
return false;
default:
return true;
}
String path = configCmds.getBaseUri().getPath();
return !("".equals(path) || "/".equals(path));
}

/**
Expand All @@ -46,15 +41,10 @@ public void up() throws URISyntaxException {

URI baseUri = configCmds.getBaseUri();
String path = baseUri.getPath();
switch(path) {
case "":
case "/":
return;
default: {
int idx = path.lastIndexOf("/");
String newPath = path.substring(0, idx);
configCmds.setBaseUri(UriComponentsBuilder.fromUri(baseUri).replacePath(newPath).build().toUriString());
}
if (!("".equals(path) || "/".equals(path))) {
int idx = path.lastIndexOf("/");
String newPath = path.substring(0, idx);
configCmds.setBaseUri(UriComponentsBuilder.fromUri(baseUri).replacePath(newPath).build().toUriString());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class HistoryCommands implements CommandMarker, ApplicationListener<BaseU

@Autowired
private ConfigurationCommands configCmds;
private List<URI> baseUris = new ArrayList<>();
private List<URI> baseUris = new ArrayList<URI>();

@Override public void onApplicationEvent(BaseUriChangedEvent event) {
baseUris.add(event.getBaseUri());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -493,8 +493,8 @@ private class RequestHelper implements RequestCallback,

private Object body;
private MediaType contentType;
private HttpMessageConverterExtractor<String> extractor = new HttpMessageConverterExtractor<>(String.class,
restTemplate.getMessageConverters());
private HttpMessageConverterExtractor<String> extractor = new HttpMessageConverterExtractor<String>(String.class,
restTemplate.getMessageConverters());
private ObjectMapper mapper = new ObjectMapper();

{
Expand Down Expand Up @@ -565,7 +565,7 @@ private RequestHelper(Object body, MediaType contentType) {
body = sw.toString();
}

return new ResponseEntity<>(body, response.getHeaders(), response.getStatusCode());
return new ResponseEntity<String>(body, response.getHeaders(), response.getStatusCode());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
public class Links {

private final PropertyAccessor propertyAccessor = new Accessor();
private final List<Link> links = new ArrayList<>();
private final List<Link> links = new ArrayList<Link>();

public Links() {
}
Expand Down

0 comments on commit f8ca4df

Please sign in to comment.