You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2015/10/06 09:53:56 UTC
svn commit: r1706960 [1/3] - in /sling/trunk/tooling/ide:
api/src/org/apache/sling/ide/filter/ api/src/org/apache/sling/ide/osgi/impl/
api/src/org/apache/sling/ide/serialization/
api/src/org/apache/sling/ide/transport/ api/src/org/apache/sling/ide/tran...
Author: rombert
Date: Tue Oct 6 07:53:54 2015
New Revision: 1706960
URL: http://svn.apache.org/viewvc?rev=1706960&view=rev
Log:
Code cleanups after Java 7 move
- try-with-resources
- diamond operator
- foreach loop
- some other trivial cleanups
Removed:
sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/Constants.java
Modified:
sling/trunk/tooling/ide/api/src/org/apache/sling/ide/filter/IgnoredResources.java
sling/trunk/tooling/ide/api/src/org/apache/sling/ide/osgi/impl/HttpOsgiClient.java
sling/trunk/tooling/ide/api/src/org/apache/sling/ide/osgi/impl/TracingOsgiClient.java
sling/trunk/tooling/ide/api/src/org/apache/sling/ide/serialization/SerializationKindManager.java
sling/trunk/tooling/ide/api/src/org/apache/sling/ide/transport/FallbackNodeTypeRegistry.java
sling/trunk/tooling/ide/api/src/org/apache/sling/ide/transport/ProtectedNodes.java
sling/trunk/tooling/ide/api/src/org/apache/sling/ide/transport/ResourceProxy.java
sling/trunk/tooling/ide/api/src/org/apache/sling/ide/transport/TracingCommand.java
sling/trunk/tooling/ide/api/src/org/apache/sling/ide/transport/impl/DefaultBatcher.java
sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/ProjectUtil.java
sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/ServerUtil.java
sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/debug/PluginLoggerRegistrar.java
sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/internal/Activator.java
sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/internal/BundleStateHelper.java
sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/internal/JVMDebuggerConnection.java
sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/internal/JarBuilder.java
sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/internal/ResourceChangeCommandFactory.java
sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/internal/ServerBehaviourDelegateWithModulePublishSupport.java
sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/internal/SlingBundleModuleFactory.java
sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/internal/SlingContentModuleFactory.java
sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/internal/SlingLaunchpadBehaviour.java
sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/internal/validation/ServiceComponentHeaderValidator.java
sling/trunk/tooling/ide/eclipse-m2e-ui/src/org/apache/sling/ide/eclipse/m2e/EmbeddedArchetypeInstaller.java
sling/trunk/tooling/ide/eclipse-m2e-ui/src/org/apache/sling/ide/eclipse/m2e/internal/Activator.java
sling/trunk/tooling/ide/eclipse-m2e-ui/src/org/apache/sling/ide/eclipse/ui/wizards/np/ChooseArchetypeWizardPage.java
sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/Activator.java
sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/ResourceChangeCommandFactoryTest.java
sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/helpers/AbstractFailOnUnexpectedEventsRule.java
sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/helpers/ExternalSlingLaunchpad.java
sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/helpers/HasFileMatcher.java
sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/helpers/OsgiBundleManifest.java
sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/helpers/Poller.java
sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/helpers/ProjectAdapter.java
sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/helpers/RepositoryAccessor.java
sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/helpers/SpyRepository.java
sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/helpers/jcr/ChildrenNameMatcher.java
sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/actions/JcrNewNodeAction.java
sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/actions/NewNodeDialog.java
sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/dnd/assistant/StatusLineUtils.java
sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/Activator.java
sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/ConnectionEditorSection.java
sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/ExportWizard.java
sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/ImportRepositoryContentAction.java
sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/InstallEditorSection.java
sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/SelectionUtils.java
sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/ServersActionModeFiddlerActionDelegate.java
sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/console/SlingConsoleEventListener.java
sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/nav/JcrContentContentProvider.java
sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/nav/Sorter.java
sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/nav/model/DirNode.java
sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/nav/model/GenericJcrRootFile.java
sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/nav/model/JcrNode.java
sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/nav/model/LinkHelper.java
sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/nav/model/ModifiableProperties.java
sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/nav/model/SyncDirManager.java
sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/properties/JcrPropertiesSection.java
sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/propertyPages/SlingProjectPropertyPage.java
sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/views/JcrEditingSupport.java
sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/views/MVPEditor.java
sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/views/PropertyTypeSupport.java
sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/wizards/AbstractNewSlingApplicationWizard.java
sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/wizards/ConvertProjectsPage.java
sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/wizards/ConvertToBundleAction.java
sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/wizards/ImportWizard.java
sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/wizards/NewSlingContentProjectWizard.java
sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/wizards/Projects.java
sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/wizards/SetupServerWizardPage.java
sling/trunk/tooling/ide/impl-resource-test/src/test/java/org/apache/sling/ide/impl/resource/serialization/SimpleXmlSerializationManagerTest.java
sling/trunk/tooling/ide/impl-resource/src/org/apache/sling/ide/impl/resource/filer/SimpleFilter.java
sling/trunk/tooling/ide/impl-resource/src/org/apache/sling/ide/impl/resource/filer/SimpleFilterLocator.java
sling/trunk/tooling/ide/impl-resource/src/org/apache/sling/ide/impl/resource/serialization/SimpleXmlSerializationManager.java
sling/trunk/tooling/ide/impl-resource/src/org/apache/sling/ide/impl/resource/transport/AbstractResult.java
sling/trunk/tooling/ide/impl-resource/src/org/apache/sling/ide/impl/resource/transport/RepositoryImpl.java
sling/trunk/tooling/ide/impl-resource/src/org/apache/sling/ide/impl/resource/transport/UpdateContentCommand.java
sling/trunk/tooling/ide/impl-vlt-test/src/test/java/org/apache/sling/ide/impl/vlt/AddOrUpdateNodeCommandTest.java
sling/trunk/tooling/ide/impl-vlt-test/src/test/java/org/apache/sling/ide/impl/vlt/ReorderChildNodesCommandTest.java
sling/trunk/tooling/ide/impl-vlt-test/src/test/java/org/apache/sling/ide/impl/vlt/serialization/VltSerializationManagerTest.java
sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/Activator.java
sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/AddOrUpdateNodeCommand.java
sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/JcrResult.java
sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/ListTreeCommand.java
sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/ReorderChildNodesCommand.java
sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/VltNodeType.java
sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/VltNodeTypeFactory.java
sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/VltNodeTypeRegistry.java
sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/VltRepositoryFactory.java
sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/serialization/ContentXmlHandler.java
sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/serialization/VltSerializationDataBuilder.java
sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/serialization/VltSerializationManager.java
sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/jcr/RepositoryUtils.java
Modified: sling/trunk/tooling/ide/api/src/org/apache/sling/ide/filter/IgnoredResources.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/api/src/org/apache/sling/ide/filter/IgnoredResources.java?rev=1706960&r1=1706959&r2=1706960&view=diff
==============================================================================
--- sling/trunk/tooling/ide/api/src/org/apache/sling/ide/filter/IgnoredResources.java (original)
+++ sling/trunk/tooling/ide/api/src/org/apache/sling/ide/filter/IgnoredResources.java Tue Oct 6 07:53:54 2015
@@ -25,7 +25,7 @@ import java.util.regex.Pattern;
*/
public class IgnoredResources {
- private List<Pattern> patterns = new ArrayList<Pattern>();
+ private List<Pattern> patterns = new ArrayList<>();
public void registerRegExpIgnoreRule(String root, String pattern) {
Modified: sling/trunk/tooling/ide/api/src/org/apache/sling/ide/osgi/impl/HttpOsgiClient.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/api/src/org/apache/sling/ide/osgi/impl/HttpOsgiClient.java?rev=1706960&r1=1706959&r2=1706960&view=diff
==============================================================================
--- sling/trunk/tooling/ide/api/src/org/apache/sling/ide/osgi/impl/HttpOsgiClient.java (original)
+++ sling/trunk/tooling/ide/api/src/org/apache/sling/ide/osgi/impl/HttpOsgiClient.java Tue Oct 6 07:53:54 2015
@@ -65,7 +65,6 @@ public class HttpOsgiClient implements O
GetMethod method = new GetMethod(repositoryInfo.appendPath("system/console/bundles.json"));
HttpClient client = getHttpClient();
- InputStream input = null;
try {
int result = client.executeMethod(method);
@@ -73,30 +72,26 @@ public class HttpOsgiClient implements O
throw new HttpException("Got status code " + result + " for call to " + method.getURI());
}
- input = method.getResponseBodyAsStream();
+ try ( InputStream input = method.getResponseBodyAsStream() ) {
- JSONObject object = new JSONObject(new JSONTokener(new InputStreamReader(input)));
-
- JSONArray bundleData = object.getJSONArray("data");
- for (int i = 0; i < bundleData.length(); i++) {
- JSONObject bundle = bundleData.getJSONObject(i);
- String remotebundleSymbolicName = bundle.getString("symbolicName");
- Version bundleVersion = new Version(bundle.getString("version"));
-
- if (bundleSymbolicName.equals(remotebundleSymbolicName)) {
- return bundleVersion;
+ JSONObject object = new JSONObject(new JSONTokener(new InputStreamReader(input)));
+
+ JSONArray bundleData = object.getJSONArray("data");
+ for (int i = 0; i < bundleData.length(); i++) {
+ JSONObject bundle = bundleData.getJSONObject(i);
+ String remotebundleSymbolicName = bundle.getString("symbolicName");
+ Version bundleVersion = new Version(bundle.getString("version"));
+
+ if (bundleSymbolicName.equals(remotebundleSymbolicName)) {
+ return bundleVersion;
+ }
}
+
+ return null;
}
-
- return null;
- } catch (HttpException e) {
- throw new OsgiClientException(e);
- } catch (IOException e) {
- throw new OsgiClientException(e);
- } catch (JSONException e) {
+ } catch (IOException | JSONException e) {
throw new OsgiClientException(e);
} finally {
- IOUtils.closeQuietly(input);
method.releaseConnection();
}
}
@@ -132,7 +127,7 @@ public class HttpOsgiClient implements O
// set referrer
filePost.setRequestHeader("referer", "about:blank");
- List<Part> partList = new ArrayList<Part>();
+ List<Part> partList = new ArrayList<>();
partList.add(new StringPart("action", "install"));
partList.add(new StringPart("_noredir_", "_noredir_"));
ByteArrayOutputStream baos = new ByteArrayOutputStream();
Modified: sling/trunk/tooling/ide/api/src/org/apache/sling/ide/osgi/impl/TracingOsgiClient.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/api/src/org/apache/sling/ide/osgi/impl/TracingOsgiClient.java?rev=1706960&r1=1706959&r2=1706960&view=diff
==============================================================================
--- sling/trunk/tooling/ide/api/src/org/apache/sling/ide/osgi/impl/TracingOsgiClient.java (original)
+++ sling/trunk/tooling/ide/api/src/org/apache/sling/ide/osgi/impl/TracingOsgiClient.java Tue Oct 6 07:53:54 2015
@@ -59,7 +59,7 @@ public class TracingOsgiClient implement
private void logInstallLocalBundle(InputStream input, String explodedBundleLocation) throws OsgiClientException {
- Map<String, Object> props = new HashMap<String, Object>();
+ Map<String, Object> props = new HashMap<>();
long start = System.currentTimeMillis();
if (input != null) {
props.put(CommandExecutionProperties.ACTION_TYPE, "InstallJarredBundle");
Modified: sling/trunk/tooling/ide/api/src/org/apache/sling/ide/serialization/SerializationKindManager.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/api/src/org/apache/sling/ide/serialization/SerializationKindManager.java?rev=1706960&r1=1706959&r2=1706960&view=diff
==============================================================================
--- sling/trunk/tooling/ide/api/src/org/apache/sling/ide/serialization/SerializationKindManager.java (original)
+++ sling/trunk/tooling/ide/api/src/org/apache/sling/ide/serialization/SerializationKindManager.java Tue Oct 6 07:53:54 2015
@@ -34,9 +34,9 @@ import org.apache.sling.ide.transport.Re
*/
public class SerializationKindManager {
- private final Set<String> fullMetadataNodeTypes = new HashSet<String>();
- private final Set<String> fileNodeTypes = new HashSet<String>();
- private final Set<String> folderNodeTypes = new HashSet<String>();
+ private final Set<String> fullMetadataNodeTypes = new HashSet<>();
+ private final Set<String> fileNodeTypes = new HashSet<>();
+ private final Set<String> folderNodeTypes = new HashSet<>();
public void init(Repository repository) throws RepositoryException {
Modified: sling/trunk/tooling/ide/api/src/org/apache/sling/ide/transport/FallbackNodeTypeRegistry.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/api/src/org/apache/sling/ide/transport/FallbackNodeTypeRegistry.java?rev=1706960&r1=1706959&r2=1706960&view=diff
==============================================================================
--- sling/trunk/tooling/ide/api/src/org/apache/sling/ide/transport/FallbackNodeTypeRegistry.java (original)
+++ sling/trunk/tooling/ide/api/src/org/apache/sling/ide/transport/FallbackNodeTypeRegistry.java Tue Oct 6 07:53:54 2015
@@ -52,7 +52,7 @@ public class FallbackNodeTypeRegistry im
}
- private final List<NodeType> nodeTypes = new ArrayList<NodeType>();
+ private final List<NodeType> nodeTypes = new ArrayList<>();
@Override
public boolean isAllowedPrimaryChildNodeType(String parentNodeType, String childNodeType)
Modified: sling/trunk/tooling/ide/api/src/org/apache/sling/ide/transport/ProtectedNodes.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/api/src/org/apache/sling/ide/transport/ProtectedNodes.java?rev=1706960&r1=1706959&r2=1706960&view=diff
==============================================================================
--- sling/trunk/tooling/ide/api/src/org/apache/sling/ide/transport/ProtectedNodes.java (original)
+++ sling/trunk/tooling/ide/api/src/org/apache/sling/ide/transport/ProtectedNodes.java Tue Oct 6 07:53:54 2015
@@ -24,8 +24,7 @@ public enum ProtectedNodes {
JCR_CREATED(Repository.JCR_CREATED),JCR_CREATED_BY(Repository.JCR_CREATED_BY),JCR_PRIMARY_TYPE(Repository.JCR_PRIMARY_TYPE);
- private static final Map<String, ProtectedNodes> nameToValueMap =
- new HashMap<String, ProtectedNodes>();
+ private static final Map<String, ProtectedNodes> nameToValueMap = new HashMap<>();
static {
for (ProtectedNodes value : EnumSet.allOf(ProtectedNodes.class)) {
Modified: sling/trunk/tooling/ide/api/src/org/apache/sling/ide/transport/ResourceProxy.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/api/src/org/apache/sling/ide/transport/ResourceProxy.java?rev=1706960&r1=1706959&r2=1706960&view=diff
==============================================================================
--- sling/trunk/tooling/ide/api/src/org/apache/sling/ide/transport/ResourceProxy.java (original)
+++ sling/trunk/tooling/ide/api/src/org/apache/sling/ide/transport/ResourceProxy.java Tue Oct 6 07:53:54 2015
@@ -43,8 +43,8 @@ public class ResourceProxy {
private final String path;
private final Map<String, Object> properties;
- private final List<ResourceProxy> children = new ArrayList<ResourceProxy>();
- private final Map<Class<?>, Object> adapted = new HashMap<Class<?>, Object>(1);
+ private final List<ResourceProxy> children = new ArrayList<>();
+ private final Map<Class<?>, Object> adapted = new HashMap<>(1);
public ResourceProxy(String path) {
this(path, new HashMap<String, Object>());
@@ -99,7 +99,7 @@ public class ResourceProxy {
public List<ResourceProxy> getCoveredChildren() {
- List<ResourceProxy> coveredChildren = new ArrayList<ResourceProxy>();
+ List<ResourceProxy> coveredChildren = new ArrayList<>();
for (ResourceProxy child : getChildren()) {
if (child.getProperties().isEmpty()) {
continue;
Modified: sling/trunk/tooling/ide/api/src/org/apache/sling/ide/transport/TracingCommand.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/api/src/org/apache/sling/ide/transport/TracingCommand.java?rev=1706960&r1=1706959&r2=1706960&view=diff
==============================================================================
--- sling/trunk/tooling/ide/api/src/org/apache/sling/ide/transport/TracingCommand.java (original)
+++ sling/trunk/tooling/ide/api/src/org/apache/sling/ide/transport/TracingCommand.java Tue Oct 6 07:53:54 2015
@@ -27,7 +27,7 @@ import org.osgi.service.event.EventAdmin
public class TracingCommand<T> implements Command<T> {
public static <T> TracingCommand<T> wrap(Command<T> command, EventAdmin eventAdmin) {
- return new TracingCommand<T>(command, eventAdmin);
+ return new TracingCommand<>(command, eventAdmin);
}
private final Command<T> command;
@@ -46,7 +46,7 @@ public class TracingCommand<T> implement
long end = System.currentTimeMillis();
if (eventAdmin != null) {
- Map<String, Object> props = new HashMap<String, Object>();
+ Map<String, Object> props = new HashMap<>();
props.put(CommandExecutionProperties.RESULT_TEXT, result.toString());
props.put(CommandExecutionProperties.RESULT_STATUS, result.isSuccess());
try {
Modified: sling/trunk/tooling/ide/api/src/org/apache/sling/ide/transport/impl/DefaultBatcher.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/api/src/org/apache/sling/ide/transport/impl/DefaultBatcher.java?rev=1706960&r1=1706959&r2=1706960&view=diff
==============================================================================
--- sling/trunk/tooling/ide/api/src/org/apache/sling/ide/transport/impl/DefaultBatcher.java (original)
+++ sling/trunk/tooling/ide/api/src/org/apache/sling/ide/transport/impl/DefaultBatcher.java Tue Oct 6 07:53:54 2015
@@ -26,7 +26,7 @@ import org.apache.sling.ide.util.PathUti
public class DefaultBatcher implements Batcher {
- private List<Command<?>> queue = new ArrayList<Command<?>>();
+ private List<Command<?>> queue = new ArrayList<>();
@Override
public void add(Command<?> command) {
@@ -37,7 +37,7 @@ public class DefaultBatcher implements B
public List<Command<?>> get() {
LinkedCommands batched = new LinkedCommands();
- List<Command<?>> result = new ArrayList<Command<?>>();
+ List<Command<?>> result = new ArrayList<>();
for ( Command<?> cmd : queue) {
boolean accepted = batched.addLinked(cmd);
@@ -63,9 +63,9 @@ public class DefaultBatcher implements B
private static class LinkedCommands {
- private List<Command<?>> deletes = new ArrayList<Command<?>>();
- private List<Command<?>> updates = new ArrayList<Command<?>>();
- private List<Command<?>> reorders = new ArrayList<Command<?>>();
+ private List<Command<?>> deletes = new ArrayList<>();
+ private List<Command<?>> updates = new ArrayList<>();
+ private List<Command<?>> reorders = new ArrayList<>();
public boolean addLinked(Command<?> newCmd) {
Modified: sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/ProjectUtil.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/ProjectUtil.java?rev=1706960&r1=1706959&r2=1706960&view=diff
==============================================================================
--- sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/ProjectUtil.java (original)
+++ sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/ProjectUtil.java Tue Oct 6 07:53:54 2015
@@ -181,15 +181,12 @@ public abstract class ProjectUtil {
IFile filterFile = ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(filterPath);
Filter filter = null;
if (filterFile != null && filterFile.exists()) {
- InputStream contents = filterFile.getContents();
- try {
+ try ( InputStream contents = filterFile.getContents() ) {
filter = filterLocator.loadFilter(contents);
} catch (IOException e) {
throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
"Failed loading filter file for project " + project.getName()
+ " from location " + filterFile, e));
- } finally {
- IOUtils.closeQuietly(contents);
}
}
return filter;
Modified: sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/ServerUtil.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/ServerUtil.java?rev=1706960&r1=1706959&r2=1706960&view=diff
==============================================================================
--- sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/ServerUtil.java (original)
+++ sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/ServerUtil.java Tue Oct 6 07:53:54 2015
@@ -19,7 +19,6 @@ package org.apache.sling.ide.eclipse.cor
import java.net.URI;
import java.net.URISyntaxException;
import java.util.HashSet;
-import java.util.Iterator;
import java.util.Set;
import org.apache.sling.ide.eclipse.core.internal.Activator;
@@ -60,11 +59,7 @@ public abstract class ServerUtil {
try {
RepositoryInfo repositoryInfo = getRepositoryInfo(server, new NullProgressMonitor());
return repository.getRepository(repositoryInfo, true);
- } catch (URISyntaxException e) {
- throw new CoreException(new Status(Status.ERROR, Activator.PLUGIN_ID, e.getMessage(), e));
- } catch (RuntimeException e) {
- throw new CoreException(new Status(Status.ERROR, Activator.PLUGIN_ID, e.getMessage(), e));
- } catch (RepositoryException e) {
+ } catch (URISyntaxException | RuntimeException | RepositoryException e) {
throw new CoreException(new Status(Status.ERROR, Activator.PLUGIN_ID, e.getMessage(), e));
}
} catch (CoreException e) {
@@ -107,7 +102,7 @@ public abstract class ServerUtil {
// is what we need to create a RepositoryInfo
return null;
}
- Set<IServer> result = new HashSet<IServer>();
+ Set<IServer> result = new HashSet<>();
IServer defaultServer = ServerCore.getDefaultServer(module);
if (defaultServer!=null) {
result.add(defaultServer);
@@ -139,11 +134,7 @@ public abstract class ServerUtil {
try {
RepositoryInfo repositoryInfo = getRepositoryInfo(server, monitor);
return repository.getRepository(repositoryInfo, false);
- } catch (URISyntaxException e) {
- throw new CoreException(new Status(Status.ERROR, Activator.PLUGIN_ID, e.getMessage(), e));
- } catch (RuntimeException e) {
- throw new CoreException(new Status(Status.ERROR, Activator.PLUGIN_ID, e.getMessage(), e));
- } catch (RepositoryException e) {
+ } catch (RuntimeException | URISyntaxException | RepositoryException e) {
throw new CoreException(new Status(Status.ERROR, Activator.PLUGIN_ID, e.getMessage(), e));
}
}
@@ -153,11 +144,7 @@ public abstract class ServerUtil {
try {
RepositoryInfo repositoryInfo = getRepositoryInfo(server, monitor);
return repository.connectRepository(repositoryInfo);
- } catch (URISyntaxException e) {
- throw new CoreException(new Status(Status.ERROR, Activator.PLUGIN_ID, e.getMessage(), e));
- } catch (RuntimeException e) {
- throw new CoreException(new Status(Status.ERROR, Activator.PLUGIN_ID, e.getMessage(), e));
- } catch (RepositoryException e) {
+ } catch (RuntimeException | URISyntaxException | RepositoryException e) {
throw new CoreException(new Status(Status.ERROR, Activator.PLUGIN_ID, e.getMessage(), e));
}
}
@@ -167,9 +154,7 @@ public abstract class ServerUtil {
try {
RepositoryInfo repositoryInfo = getRepositoryInfo(server, monitor);
repository.disconnectRepository(repositoryInfo);
- } catch (URISyntaxException e) {
- throw new CoreException(new Status(Status.ERROR, Activator.PLUGIN_ID, e.getMessage(), e));
- } catch (RuntimeException e) {
+ } catch (RuntimeException | URISyntaxException e) {
throw new CoreException(new Status(Status.ERROR, Activator.PLUGIN_ID, e.getMessage(), e));
}
}
@@ -207,14 +192,13 @@ public abstract class ServerUtil {
if (monitorOrNull==null) {
monitorOrNull = new NullProgressMonitor();
}
- for (Iterator it = servers.iterator(); it.hasNext();) {
- IServer aServer = (IServer) it.next();
- if (aServer!=null) {
- int autoPublishSetting = aServer.getAttribute(PROP_AUTO_PUBLISH_SETTING, AUTO_PUBLISH_RESOURCE);
- int autoPublishTime = aServer.getAttribute(PROP_AUTO_PUBLISH_TIME, 15);
+ for (IServer server : servers) {
+ if (server!=null) {
+ int autoPublishSetting = server.getAttribute(PROP_AUTO_PUBLISH_SETTING, AUTO_PUBLISH_RESOURCE);
+ int autoPublishTime = server.getAttribute(PROP_AUTO_PUBLISH_TIME, 15);
if (autoPublishSetting==AUTO_PUBLISH_RESOURCE) {
//TODO: ignoring the autoPublishTime - SLING-3587
- aServer.publish(IServer.PUBLISH_INCREMENTAL, monitorOrNull);
+ server.publish(IServer.PUBLISH_INCREMENTAL, monitorOrNull);
}
}
}
Modified: sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/debug/PluginLoggerRegistrar.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/debug/PluginLoggerRegistrar.java?rev=1706960&r1=1706959&r2=1706960&view=diff
==============================================================================
--- sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/debug/PluginLoggerRegistrar.java (original)
+++ sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/debug/PluginLoggerRegistrar.java Tue Oct 6 07:53:54 2015
@@ -41,7 +41,7 @@ public class PluginLoggerRegistrar {
*/
public static ServiceRegistration<?> register(Plugin plugin) {
- Dictionary<String, Object> props = new Hashtable<String, Object>();
+ Dictionary<String, Object> props = new Hashtable<>();
props.put(DebugOptions.LISTENER_SYMBOLICNAME, plugin.getBundle().getSymbolicName());
BundleContext ctx = plugin.getBundle().getBundleContext();
return ctx.registerService(new String[] { DebugOptionsListener.class.getName(), Logger.class.getName() },
Modified: sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/internal/Activator.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/internal/Activator.java?rev=1706960&r1=1706959&r2=1706960&view=diff
==============================================================================
--- sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/internal/Activator.java (original)
+++ sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/internal/Activator.java Tue Oct 6 07:53:54 2015
@@ -26,7 +26,6 @@ import org.apache.sling.ide.filter.Filte
import org.apache.sling.ide.log.Logger;
import org.apache.sling.ide.osgi.OsgiClientFactory;
import org.apache.sling.ide.serialization.SerializationManager;
-import org.apache.sling.ide.transport.Batcher;
import org.apache.sling.ide.transport.BatcherFactory;
import org.apache.sling.ide.transport.CommandExecutionProperties;
import org.apache.sling.ide.transport.RepositoryFactory;
@@ -71,35 +70,32 @@ public class Activator extends Plugin {
tracerRegistration = PluginLoggerRegistrar.register(this);
- eventAdmin = new ServiceTracker<EventAdmin, EventAdmin>(context, EventAdmin.class,
- null);
+ eventAdmin = new ServiceTracker<>(context, EventAdmin.class, null);
eventAdmin.open();
- repositoryFactory = new ServiceTracker<RepositoryFactory, RepositoryFactory>(context, RepositoryFactory.class,
+ repositoryFactory = new ServiceTracker<>(context, RepositoryFactory.class,
null);
repositoryFactory.open();
- serializationManager = new ServiceTracker<SerializationManager, SerializationManager>(context,
- SerializationManager.class, null);
+ serializationManager = new ServiceTracker<>(context, SerializationManager.class, null);
serializationManager.open();
- filterLocator = new ServiceTracker<FilterLocator, FilterLocator>(context, FilterLocator.class, null);
+ filterLocator = new ServiceTracker<>(context, FilterLocator.class, null);
filterLocator.open();
- osgiClientFactory = new ServiceTracker<OsgiClientFactory, OsgiClientFactory>(context, OsgiClientFactory.class,
+ osgiClientFactory = new ServiceTracker<>(context, OsgiClientFactory.class,
null);
osgiClientFactory.open();
- artifactLocator = new ServiceTracker<EmbeddedArtifactLocator, EmbeddedArtifactLocator>(context,
- EmbeddedArtifactLocator.class, null);
+ artifactLocator = new ServiceTracker<>(context, EmbeddedArtifactLocator.class, null);
artifactLocator.open();
// ugh
ServiceReference<Object> reference = (ServiceReference<Object>) tracerRegistration.getReference();
- tracer = new ServiceTracker<Object, Object>(context, reference, null);
+ tracer = new ServiceTracker<>(context, reference, null);
tracer.open();
- batcherFactoryLocator = new ServiceTracker<BatcherFactory, BatcherFactory>(context, BatcherFactory.class, null);
+ batcherFactoryLocator = new ServiceTracker<>(context, BatcherFactory.class, null);
batcherFactoryLocator.open();
}
@@ -167,7 +163,7 @@ public class Activator extends Plugin {
*/
@Deprecated
public void issueConsoleLog(String actionType, String path, String message) {
- Map<String, Object> props = new HashMap<String, Object>();
+ Map<String, Object> props = new HashMap<>();
props.put(CommandExecutionProperties.RESULT_TEXT, message);
props.put(CommandExecutionProperties.ACTION_TYPE, actionType);
props.put(CommandExecutionProperties.ACTION_TARGET, path);
Modified: sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/internal/BundleStateHelper.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/internal/BundleStateHelper.java?rev=1706960&r1=1706959&r2=1706960&view=diff
==============================================================================
--- sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/internal/BundleStateHelper.java (original)
+++ sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/internal/BundleStateHelper.java Tue Oct 6 07:53:54 2015
@@ -91,8 +91,6 @@ public class BundleStateHelper {
private static Object doRecalcDecorationState(IServer server, IProject project) {
- InputStream input = null;
-
try {
if (!ProjectHelper.isBundleProject(project)) {
return EMPTY_STATE;
@@ -129,17 +127,15 @@ public class BundleStateHelper {
return " ["+resultCode+"]";
}
- input = method.getResponseBodyAsStream();
-
- JSONObject result = new JSONObject(new JSONTokener(new InputStreamReader(input)));
- JSONArray dataArray = (JSONArray) result.get("data");
- JSONObject firstElement = (JSONObject) dataArray.get(0);
- return " ["+firstElement.get("state")+"]";
+ try ( InputStream input = method.getResponseBodyAsStream(); ) {
+ JSONObject result = new JSONObject(new JSONTokener(new InputStreamReader(input)));
+ JSONArray dataArray = (JSONArray) result.get("data");
+ JSONObject firstElement = (JSONObject) dataArray.get(0);
+ return " ["+firstElement.get("state")+"]";
+ }
} catch (Exception e) {
e.printStackTrace();
return e.getMessage();
- } finally {
- IOUtils.closeQuietly(input);
}
}
Modified: sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/internal/JVMDebuggerConnection.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/internal/JVMDebuggerConnection.java?rev=1706960&r1=1706959&r2=1706960&view=diff
==============================================================================
--- sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/internal/JVMDebuggerConnection.java (original)
+++ sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/internal/JVMDebuggerConnection.java Tue Oct 6 07:53:54 2015
@@ -71,7 +71,7 @@ public class JVMDebuggerConnection {
"debug port not configured"));
}
- Map<String, String> connectMap = new HashMap<String, String>();
+ Map<String, String> connectMap = new HashMap<>();
connectMap.put("hostname", iServer.getHost());
connectMap.put("port", String.valueOf(debugPort));
@@ -87,7 +87,7 @@ public class JVMDebuggerConnection {
.setSourcePathComputer(DebugPlugin.getDefault().getLaunchManager()
.getSourcePathComputer(
"org.eclipse.jdt.launching.sourceLookup.javaSourcePathComputer")); //$NON-NLS-1$
- List<ISourceContainer> l = new LinkedList<ISourceContainer>();
+ List<ISourceContainer> l = new LinkedList<>();
IJavaProject[] javaProjects = ProjectHelper.getAllJavaProjects();
if (javaProjects!=null) {
for (int i = 0; i < javaProjects.length; i++) {
Modified: sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/internal/JarBuilder.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/internal/JarBuilder.java?rev=1706960&r1=1706959&r2=1706960&view=diff
==============================================================================
--- sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/internal/JarBuilder.java (original)
+++ sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/internal/JarBuilder.java Tue Oct 6 07:53:54 2015
@@ -27,7 +27,6 @@ import java.util.zip.Deflater;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
-import org.apache.commons.io.IOUtils;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IResource;
@@ -44,21 +43,20 @@ public class JarBuilder {
public InputStream buildJar(final IFolder sourceDir) throws CoreException {
ByteArrayOutputStream store = new ByteArrayOutputStream();
+
+ IResource manifestResource = sourceDir.findMember(JarFile.MANIFEST_NAME);
+ if (manifestResource == null || manifestResource.getType() != IResource.FILE) {
+ throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "No file named "
+ + JarFile.MANIFEST_NAME + " found under " + sourceDir));
+ }
- JarOutputStream zos = null;
- InputStream manifestInput = null;
- try {
- IResource manifestResource = sourceDir.findMember(JarFile.MANIFEST_NAME);
- if (manifestResource == null || manifestResource.getType() != IResource.FILE) {
- throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "No file named "
- + JarFile.MANIFEST_NAME + " found under " + sourceDir));
- }
+
+
+ try ( JarOutputStream zos = new JarOutputStream(store);
+ InputStream manifestInput = ((IFile) manifestResource).getContents() ) {
- manifestInput = ((IFile) manifestResource).getContents();
-
Manifest manifest = new Manifest(manifestInput);
- zos = new JarOutputStream(store);
zos.setLevel(Deflater.NO_COMPRESSION);
// manifest first
final ZipEntry anEntry = new ZipEntry(JarFile.MANIFEST_NAME);
@@ -68,9 +66,6 @@ public class JarBuilder {
zipDir(sourceDir, zos, "");
} catch (IOException e) {
throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.getMessage(), e));
- } finally {
- IOUtils.closeQuietly(zos);
- IOUtils.closeQuietly(manifestInput);
}
return new ByteArrayInputStream(store.toByteArray());
@@ -89,8 +84,7 @@ public class JarBuilder {
if (JarFile.MANIFEST_NAME.equals(entry)) {
continue;
}
- final InputStream fis = ((IFile) f).getContents();
- try {
+ try ( InputStream fis = ((IFile) f).getContents() ) {
final byte[] readBuffer = new byte[8192];
int bytesIn = 0;
final ZipEntry anEntry = new ZipEntry(entry);
@@ -98,8 +92,6 @@ public class JarBuilder {
while ((bytesIn = fis.read(readBuffer)) != -1) {
zos.write(readBuffer, 0, bytesIn);
}
- } finally {
- IOUtils.closeQuietly(fis);
}
}
}
Modified: sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/internal/ResourceChangeCommandFactory.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/internal/ResourceChangeCommandFactory.java?rev=1706960&r1=1706959&r2=1706960&view=diff
==============================================================================
--- sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/internal/ResourceChangeCommandFactory.java (original)
+++ sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/internal/ResourceChangeCommandFactory.java Tue Oct 6 07:53:54 2015
@@ -64,7 +64,7 @@ import org.eclipse.ui.statushandlers.Sta
*/
public class ResourceChangeCommandFactory {
- private final Set<String> ignoredFileNames = new HashSet<String>();
+ private final Set<String> ignoredFileNames = new HashSet<>();
{
ignoredFileNames.add(".vlt");
ignoredFileNames.add(".vltignore");
@@ -144,10 +144,8 @@ public class ResourceChangeCommandFactor
ResourceProxy resourceProxy = null;
if (serializationManager.isSerializationFile(resource.getLocation().toOSString())) {
- InputStream contents = null;
- try {
- IFile file = (IFile) resource;
- contents = file.getContents();
+ IFile file = (IFile) resource;
+ try (InputStream contents = file.getContents()) {
String resourceLocation = file.getFullPath().makeRelativeTo(syncDirectory.getFullPath())
.toPortableString();
resourceProxy = serializationManager.readSerializationData(resourceLocation, contents);
@@ -179,8 +177,6 @@ public class ResourceChangeCommandFactor
+ resource.getFullPath(), e);
StatusManager.getManager().handle(s, StatusManager.LOG | StatusManager.SHOW);
return null;
- } finally {
- IOUtils.closeQuietly(contents);
}
} else {
@@ -368,13 +364,11 @@ public class ResourceChangeCommandFactor
continue;
}
- InputStream contents = possibleSerializationFile.getContents();
+
ResourceProxy serializationData;
- try {
+ try (InputStream contents = possibleSerializationFile.getContents()) {
serializationData = serializationManager.readSerializationData(
parentSerializationFilePath.toPortableString(), contents);
- } finally {
- IOUtils.closeQuietly(contents);
}
String repositoryPath = serializationManager.getRepositoryPath(resourceLocation);
@@ -401,17 +395,14 @@ public class ResourceChangeCommandFactor
IFolder syncDirectory, String fallbackPrimaryType, Repository repository) throws CoreException, IOException {
if (serializationResource instanceof IFile) {
IFile serializationFile = (IFile) serializationResource;
- InputStream contents = null;
- try {
- contents = serializationFile.getContents();
+ try (InputStream contents = serializationFile.getContents() ) {
+
String serializationFilePath = serializationResource.getFullPath()
.makeRelativeTo(syncDirectory.getFullPath()).toPortableString();
ResourceProxy resourceProxy = serializationManager.readSerializationData(serializationFilePath, contents);
normaliseResourceChildren(serializationFile, resourceProxy, syncDirectory, repository);
return resourceProxy;
- } finally {
- IOUtils.closeQuietly(contents);
}
}
@@ -452,7 +443,7 @@ public class ResourceChangeCommandFactor
IPath serializationDirectoryPath = serializationFile.getFullPath().removeLastSegments(1);
Iterator<ResourceProxy> childIterator = resourceProxy.getChildren().iterator();
- Map<String, IResource> extraChildResources = new HashMap<String, IResource>();
+ Map<String, IResource> extraChildResources = new HashMap<>();
for (IResource member : serializationFile.getParent().members()) {
if (member.equals(serializationFile)) {
continue;
Modified: sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/internal/ServerBehaviourDelegateWithModulePublishSupport.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/internal/ServerBehaviourDelegateWithModulePublishSupport.java?rev=1706960&r1=1706959&r2=1706960&view=diff
==============================================================================
--- sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/internal/ServerBehaviourDelegateWithModulePublishSupport.java (original)
+++ sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/internal/ServerBehaviourDelegateWithModulePublishSupport.java Tue Oct 6 07:53:54 2015
@@ -50,14 +50,14 @@ public abstract class ServerBehaviourDel
public void publish(int kind, List<IModule[]> modules,
IProgressMonitor monitor, IAdaptable info) throws CoreException {
info3 = info;
- modules3 = modules==null ? null : new LinkedList<IModule[]>(modules);
+ modules3 = modules==null ? null : new LinkedList<>(modules);
super.publish(kind, modules, monitor, info);
}
// from WST's ServerBehavior
private List<Integer> computeDelta(final List<IModule[]> moduleList) {
- final List<Integer> deltaKindList = new ArrayList<Integer>();
+ final List<Integer> deltaKindList = new ArrayList<>();
final Iterator<IModule[]> iterator = moduleList.iterator();
while (iterator.hasNext()) {
IModule[] module = iterator.next();
@@ -89,7 +89,7 @@ public abstract class ServerBehaviourDel
if (getServer().getServerType().hasRuntime() && getServer().getRuntime() == null)
return new Status(IStatus.ERROR, Activator.PLUGIN_ID, 0, "No runtime available", null);
- final List<IModule[]> moduleList = modules3==null ? getAllModules() : new LinkedList<IModule[]>(modules3);//getAllModules();
+ final List<IModule[]> moduleList = modules3==null ? getAllModules() : new LinkedList<>(modules3);//getAllModules();
List<Integer> deltaKindList = computeDelta(moduleList);
PublishOperation[] tasks = getTasks(kind, moduleList, deltaKindList);
Modified: sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/internal/SlingBundleModuleFactory.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/internal/SlingBundleModuleFactory.java?rev=1706960&r1=1706959&r2=1706960&view=diff
==============================================================================
--- sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/internal/SlingBundleModuleFactory.java (original)
+++ sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/internal/SlingBundleModuleFactory.java Tue Oct 6 07:53:54 2015
@@ -127,9 +127,9 @@ public class SlingBundleModuleFactory ex
@Override
public IModuleResource[] members() throws CoreException {
final IJavaProject javaProject = ProjectHelper.asJavaProject(getProject());
- final List<IModuleResource> resources = new ArrayList<IModuleResource>();
+ final List<IModuleResource> resources = new ArrayList<>();
- final Set<String> filteredLocations = new HashSet<String>();
+ final Set<String> filteredLocations = new HashSet<>();
final IJavaProject jp = javaProject;
final IClasspathEntry[] rawCp = jp.getRawClasspath();
Modified: sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/internal/SlingContentModuleFactory.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/internal/SlingContentModuleFactory.java?rev=1706960&r1=1706959&r2=1706960&view=diff
==============================================================================
--- sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/internal/SlingContentModuleFactory.java (original)
+++ sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/internal/SlingContentModuleFactory.java Tue Oct 6 07:53:54 2015
@@ -106,7 +106,7 @@ public class SlingContentModuleFactory e
@Override
public IModuleResource[] members() throws CoreException {
- final List<IModuleResource> resources = new ArrayList<IModuleResource>();
+ final List<IModuleResource> resources = new ArrayList<>();
final IFolder syncFolder = ProjectUtil.getSyncDirectory(getProject());
if (syncFolder == null || !syncFolder.exists()) {
Modified: sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/internal/SlingLaunchpadBehaviour.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/internal/SlingLaunchpadBehaviour.java?rev=1706960&r1=1706959&r2=1706960&view=diff
==============================================================================
--- sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/internal/SlingLaunchpadBehaviour.java (original)
+++ sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/internal/SlingLaunchpadBehaviour.java Tue Oct 6 07:53:54 2015
@@ -126,12 +126,8 @@ public class SlingLaunchpadBehaviour ext
ISlingLaunchpadServer launchpadServer = (ISlingLaunchpadServer) getServer().loadAdapter(SlingLaunchpadServer.class,
monitor);
if (remoteVersion == null || remoteVersion.compareTo(embeddedVersion) < 0) {
- InputStream contents = null;
- try {
- contents = supportBundle.openInputStream();
+ try ( InputStream contents = supportBundle.openInputStream() ){
client.installBundle(contents, supportBundle.getName());
- } finally {
- IOUtils.closeQuietly(contents);
}
remoteVersion = embeddedVersion;
@@ -381,9 +377,9 @@ public class SlingLaunchpadBehaviour ext
// the behaviour for resources being filtered out is deletion, and that
// would be an incorrect ( or at least suprising ) behaviour at development time
- List<IModuleResource> addedOrUpdatedResources = new ArrayList<IModuleResource>();
+ List<IModuleResource> addedOrUpdatedResources = new ArrayList<>();
IModuleResource[] allResources = getResources(module);
- Set<IPath> handledPaths = new HashSet<IPath>();
+ Set<IPath> handledPaths = new HashSet<>();
switch (deltaKind) {
case ServerBehaviourDelegate.CHANGED:
Modified: sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/internal/validation/ServiceComponentHeaderValidator.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/internal/validation/ServiceComponentHeaderValidator.java?rev=1706960&r1=1706959&r2=1706960&view=diff
==============================================================================
--- sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/internal/validation/ServiceComponentHeaderValidator.java (original)
+++ sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/internal/validation/ServiceComponentHeaderValidator.java Tue Oct 6 07:53:54 2015
@@ -23,7 +23,6 @@ import java.util.Collections;
import java.util.List;
import java.util.jar.Manifest;
-import org.apache.commons.io.IOUtils;
import org.apache.sling.ide.eclipse.core.internal.Activator;
import org.apache.sling.ide.eclipse.core.internal.ProjectHelper;
import org.apache.sling.ide.log.Logger;
@@ -64,10 +63,9 @@ public class ServiceComponentHeaderValid
return Collections.emptyList();
}
- List<IFile> missingDescriptors = new ArrayList<IFile>();
+ List<IFile> missingDescriptors = new ArrayList<>();
- InputStream contents = manifest.getContents();
- try {
+ try (InputStream contents = manifest.getContents();) {
Manifest mf = new Manifest(contents);
String serviceComponentHeader = mf.getMainAttributes().getValue("Service-Component");
if (serviceComponentHeader != null) {
@@ -95,8 +93,6 @@ public class ServiceComponentHeaderValid
} catch (IOException e) {
throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Unable to access "
+ manifest.getFullPath(), e));
- } finally {
- IOUtils.closeQuietly(contents);
}
return missingDescriptors;
Modified: sling/trunk/tooling/ide/eclipse-m2e-ui/src/org/apache/sling/ide/eclipse/m2e/EmbeddedArchetypeInstaller.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-m2e-ui/src/org/apache/sling/ide/eclipse/m2e/EmbeddedArchetypeInstaller.java?rev=1706960&r1=1706959&r2=1706960&view=diff
==============================================================================
--- sling/trunk/tooling/ide/eclipse-m2e-ui/src/org/apache/sling/ide/eclipse/m2e/EmbeddedArchetypeInstaller.java (original)
+++ sling/trunk/tooling/ide/eclipse-m2e-ui/src/org/apache/sling/ide/eclipse/m2e/EmbeddedArchetypeInstaller.java Tue Oct 6 07:53:54 2015
@@ -68,7 +68,7 @@ public class EmbeddedArchetypeInstaller
private final String artifactId;
private final String version;
- private final Map<String,InputStream> origins = new HashMap<String,InputStream>();
+ private final Map<String,InputStream> origins = new HashMap<>();
public EmbeddedArchetypeInstaller(final String groupId,
final String artifactId,
@@ -129,11 +129,11 @@ public class EmbeddedArchetypeInstaller
for (Iterator<Entry<String, InputStream>> it = entries.iterator(); it.hasNext();) {
final Entry<String, InputStream> entry = it.next();
final String fileExtension = entry.getKey();
- final InputStream in = entry.getValue();
File tmpFile = File.createTempFile("slingClipseTmp", fileExtension);
- FileOutputStream fos = new FileOutputStream(tmpFile);
+
- try {
+ try (InputStream in = entry.getValue();
+ FileOutputStream fos = new FileOutputStream(tmpFile)) {
IOUtils.copy(in, fos);
// the below code uses the fileExtension as a type. Most of the time this is correct
// and should be fine for our usage
@@ -141,8 +141,6 @@ public class EmbeddedArchetypeInstaller
new DefaultArtifactHandler(fileExtension));
dai.install(tmpFile, jarArtifact, maven.getLocalRepository());
} finally {
- IOUtils.closeQuietly(in);
- IOUtils.closeQuietly(fos);
FileUtils.deleteQuietly(tmpFile);
}
}
@@ -153,9 +151,7 @@ public class EmbeddedArchetypeInstaller
archetype.setVersion(version);
org.apache.maven.archetype.Archetype archetyper = MavenPluginActivator.getDefault().getArchetype();
archetyper.updateLocalCatalog(archetype);
- } catch (CoreException e) {
- throw e;
- } catch (RuntimeException e) {
+ } catch (CoreException | RuntimeException e) {
throw e;
} catch (Exception e) {
throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.getMessage(), e));
@@ -206,7 +202,7 @@ public class EmbeddedArchetypeInstaller
private Class<?>[] getClasses(Object repositorySession) {
- List<Class<?>> accu = new ArrayList<Class<?>>();
+ List<Class<?>> accu = new ArrayList<>();
Class<? extends Object> klazz = repositorySession.getClass();
getClasses(klazz, accu);
Modified: sling/trunk/tooling/ide/eclipse-m2e-ui/src/org/apache/sling/ide/eclipse/m2e/internal/Activator.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-m2e-ui/src/org/apache/sling/ide/eclipse/m2e/internal/Activator.java?rev=1706960&r1=1706959&r2=1706960&view=diff
==============================================================================
--- sling/trunk/tooling/ide/eclipse-m2e-ui/src/org/apache/sling/ide/eclipse/m2e/internal/Activator.java (original)
+++ sling/trunk/tooling/ide/eclipse-m2e-ui/src/org/apache/sling/ide/eclipse/m2e/internal/Activator.java Tue Oct 6 07:53:54 2015
@@ -48,10 +48,10 @@ public class Activator extends Plugin {
INSTANCE = this;
- artifactLocator = new ServiceTracker<EmbeddedArtifactLocator, EmbeddedArtifactLocator>(context, EmbeddedArtifactLocator.class, null);
+ artifactLocator = new ServiceTracker<>(context, EmbeddedArtifactLocator.class, null);
artifactLocator.open();
- osgiClientFactory = new ServiceTracker<OsgiClientFactory, OsgiClientFactory>(context, OsgiClientFactory.class,
+ osgiClientFactory = new ServiceTracker<>(context, OsgiClientFactory.class,
null);
osgiClientFactory.open();
@@ -59,7 +59,7 @@ public class Activator extends Plugin {
// ugh
ServiceReference<Object> reference = (ServiceReference<Object>) tracerRegistration.getReference();
- tracer = new ServiceTracker<Object, Object>(context, reference, null);
+ tracer = new ServiceTracker<>(context, reference, null);
tracer.open();
}
Modified: sling/trunk/tooling/ide/eclipse-m2e-ui/src/org/apache/sling/ide/eclipse/ui/wizards/np/ChooseArchetypeWizardPage.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-m2e-ui/src/org/apache/sling/ide/eclipse/ui/wizards/np/ChooseArchetypeWizardPage.java?rev=1706960&r1=1706959&r2=1706960&view=diff
==============================================================================
--- sling/trunk/tooling/ide/eclipse-m2e-ui/src/org/apache/sling/ide/eclipse/ui/wizards/np/ChooseArchetypeWizardPage.java (original)
+++ sling/trunk/tooling/ide/eclipse-m2e-ui/src/org/apache/sling/ide/eclipse/ui/wizards/np/ChooseArchetypeWizardPage.java Tue Oct 6 07:53:54 2015
@@ -103,7 +103,7 @@ public class ChooseArchetypeWizardPage e
private static final String LOADING_PLEASE_WAIT = "loading, please wait...";
private Combo knownArchetypes;
- private Map<String, Archetype> archetypesMap = new TreeMap<String, Archetype>(ARTIFACT_KEY_COMPARATOR);
+ private Map<String, Archetype> archetypesMap = new TreeMap<>(ARTIFACT_KEY_COMPARATOR);
private Button useDefaultWorkspaceLocationButton;
private Label locationLabel;
private Combo locationCombo;
@@ -345,7 +345,7 @@ public class ChooseArchetypeWizardPage e
Collection<ArchetypeCatalogFactory> archetypeCatalogs = manager.getArchetypeCatalogs();
monitor.worked(2);
- ArrayList<Archetype> candidates = new ArrayList<Archetype>();
+ ArrayList<Archetype> candidates = new ArrayList<>();
for (ArchetypeCatalogFactory catalogFactory : archetypeCatalogs) {
try {
ArchetypeCatalog catalog = catalogFactory.getArchetypeCatalog();
Modified: sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/Activator.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/Activator.java?rev=1706960&r1=1706959&r2=1706960&view=diff
==============================================================================
--- sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/Activator.java (original)
+++ sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/Activator.java Tue Oct 6 07:53:54 2015
@@ -38,16 +38,13 @@ public class Activator extends Plugin {
public void start(BundleContext context) throws Exception {
super.start(context);
- artifactLocator = new ServiceTracker<EmbeddedArtifactLocator, EmbeddedArtifactLocator>(context,
- EmbeddedArtifactLocator.class, null);
+ artifactLocator = new ServiceTracker<>(context, EmbeddedArtifactLocator.class, null);
artifactLocator.open();
- osgiClientFactory = new ServiceTracker<OsgiClientFactory, OsgiClientFactory>(context, OsgiClientFactory.class,
- null);
+ osgiClientFactory = new ServiceTracker<>(context, OsgiClientFactory.class, null);
osgiClientFactory.open();
- serializationManager = new ServiceTracker<SerializationManager, SerializationManager>(context,
- SerializationManager.class, null);
+ serializationManager = new ServiceTracker<>(context, SerializationManager.class, null);
serializationManager.open();
INSTANCE = this;
Modified: sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/ResourceChangeCommandFactoryTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/ResourceChangeCommandFactoryTest.java?rev=1706960&r1=1706959&r2=1706960&view=diff
==============================================================================
--- sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/ResourceChangeCommandFactoryTest.java (original)
+++ sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/ResourceChangeCommandFactoryTest.java Tue Oct 6 07:53:54 2015
@@ -99,7 +99,7 @@ public class ResourceChangeCommandFactor
SpyCommand<?> command = (SpyCommand<?>) factory.newCommandForAddedOrUpdated(spyRepo,
contentProject.findMember("jcr_root/content/test-root/nested"));
- Map<String, Object> props = new HashMap<String, Object>();
+ Map<String, Object> props = new HashMap<>();
props.put("jcr:primaryType", "sling:Folder");
props.put("jcr:title", "Some Folder");
Modified: sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/helpers/AbstractFailOnUnexpectedEventsRule.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/helpers/AbstractFailOnUnexpectedEventsRule.java?rev=1706960&r1=1706959&r2=1706960&view=diff
==============================================================================
--- sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/helpers/AbstractFailOnUnexpectedEventsRule.java (original)
+++ sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/helpers/AbstractFailOnUnexpectedEventsRule.java Tue Oct 6 07:53:54 2015
@@ -41,7 +41,7 @@ public abstract class AbstractFailOnUnex
private static final int SETTLE_TIMEOUT_MILLIS = 500;
private ServiceRegistration<EventHandler> registration;
- private final List<Event> unexpectedEvents = new CopyOnWriteArrayList<Event>();
+ private final List<Event> unexpectedEvents = new CopyOnWriteArrayList<>();
public Statement apply(Statement base, Description description) {
return statement(base);
@@ -63,7 +63,7 @@ public abstract class AbstractFailOnUnex
protected void before() {
- Dictionary<String, Object> props = new Hashtable<String, Object>();
+ Dictionary<String, Object> props = new Hashtable<>();
props.put("event.topics", "org/apache/sling/ide/transport");
registration = Activator.getDefault().getBundle().getBundleContext()
.registerService(EventHandler.class, this, props);
Modified: sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/helpers/ExternalSlingLaunchpad.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/helpers/ExternalSlingLaunchpad.java?rev=1706960&r1=1706959&r2=1706960&view=diff
==============================================================================
--- sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/helpers/ExternalSlingLaunchpad.java (original)
+++ sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/helpers/ExternalSlingLaunchpad.java Tue Oct 6 07:53:54 2015
@@ -60,7 +60,7 @@ public class ExternalSlingLaunchpad exte
long cutoff = System.currentTimeMillis() + MAX_WAIT_TIME_MS;
- List<SlingReadyRule> rules = new ArrayList<SlingReadyRule>();
+ List<SlingReadyRule> rules = new ArrayList<>();
rules.add(new StartLevelSlingReadyRule(client));
rules.add(new ActiveBundlesSlingReadyRule(client));
@@ -109,27 +109,22 @@ public class ExternalSlingLaunchpad exte
int status = client.executeMethod(httpMethod);
debug("vmstat http call got return code " + status);
- InputStream input = null;
- try {
- if (status == 200) {
-
- String responseBody = IOUtils.toString(httpMethod.getResponseBodyAsStream(),
- httpMethod.getResponseCharSet());
-
- Matcher m = STARTLEVEL_JSON_SNIPPET.matcher(responseBody);
- if (m.find()) {
- int startLevel = Integer.parseInt(m.group(1));
- debug("vmstat http call got startLevel " + startLevel);
- if (startLevel >= EXPECTED_START_LEVEL) {
- debug("current startLevel " + startLevel + " >= " + EXPECTED_START_LEVEL
- + ", we are done here");
- return true;
- }
- }
+ if (status == 200) {
+
+ String responseBody = IOUtils.toString(httpMethod.getResponseBodyAsStream(),
+ httpMethod.getResponseCharSet());
+ Matcher m = STARTLEVEL_JSON_SNIPPET.matcher(responseBody);
+ if (m.find()) {
+ int startLevel = Integer.parseInt(m.group(1));
+ debug("vmstat http call got startLevel " + startLevel);
+ if (startLevel >= EXPECTED_START_LEVEL) {
+ debug("current startLevel " + startLevel + " >= " + EXPECTED_START_LEVEL
+ + ", we are done here");
+ return true;
+ }
}
- } finally {
- IOUtils.closeQuietly(input);
+
}
return false;
}
@@ -148,30 +143,29 @@ public class ExternalSlingLaunchpad exte
public boolean evaluate() throws Exception {
int status = client.executeMethod(httpMethod);
debug("bundles http call got return code " + status);
+
+ if ( status != 200) {
+ return false;
+ }
- InputStream input = null;
- try {
- if (status == 200) {
- input = httpMethod.getResponseBodyAsStream();
- JSONObject obj = new JSONObject(new JSONTokener(new InputStreamReader(input)));
-
- JSONArray bundleStatus = obj.getJSONArray("s");
-
- int total = bundleStatus.getInt(0);
- int active = bundleStatus.getInt(1);
- int fragment = bundleStatus.getInt(2);
-
- debug("bundle http call status: total = " + total + ", active = " + active + ", fragment = " + fragment);
-
- if (total == active + fragment) {
- debug("All bundles are started, we are done here");
- return true;
- }
+ try ( InputStream input = httpMethod.getResponseBodyAsStream()) {
+
+ JSONObject obj = new JSONObject(new JSONTokener(new InputStreamReader(input)));
+
+ JSONArray bundleStatus = obj.getJSONArray("s");
+
+ int total = bundleStatus.getInt(0);
+ int active = bundleStatus.getInt(1);
+ int fragment = bundleStatus.getInt(2);
+
+ debug("bundle http call status: total = " + total + ", active = " + active + ", fragment = " + fragment);
+
+ if (total == active + fragment) {
+ debug("All bundles are started, we are done here");
+ return true;
}
- } finally {
- IOUtils.closeQuietly(input);
}
-
+
return false;
}
}
Modified: sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/helpers/HasFileMatcher.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/helpers/HasFileMatcher.java?rev=1706960&r1=1706959&r2=1706960&view=diff
==============================================================================
--- sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/helpers/HasFileMatcher.java (original)
+++ sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/helpers/HasFileMatcher.java Tue Oct 6 07:53:54 2015
@@ -75,17 +75,10 @@ public class HasFileMatcher extends Type
IFile file = (IFile) maybeFile;
ByteArrayOutputStream out = new ByteArrayOutputStream();
- InputStream in = null;
- try {
- in = file.getContents();
-
+ try ( InputStream in = file.getContents()) {
IOUtils.copy(in, out);
- } catch (CoreException e) {
- throw new RuntimeException(e);
- } catch (IOException e) {
+ } catch (CoreException | IOException e) {
throw new RuntimeException(e);
- } finally {
- IOUtils.closeQuietly(in);
}
return Arrays.equals(out.toByteArray(), contents);
Modified: sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/helpers/OsgiBundleManifest.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/helpers/OsgiBundleManifest.java?rev=1706960&r1=1706959&r2=1706960&view=diff
==============================================================================
--- sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/helpers/OsgiBundleManifest.java (original)
+++ sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/helpers/OsgiBundleManifest.java Tue Oct 6 07:53:54 2015
@@ -28,7 +28,7 @@ public class OsgiBundleManifest {
return new OsgiBundleManifest(symbolicName);
}
- private final Map<String, String> attributes = new LinkedHashMap<String, String>();
+ private final Map<String, String> attributes = new LinkedHashMap<>();
public OsgiBundleManifest(String symbolicName) {
attributes.put(Attributes.Name.MANIFEST_VERSION.toString(), "1.0");
Modified: sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/helpers/Poller.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/helpers/Poller.java?rev=1706960&r1=1706959&r2=1706960&view=diff
==============================================================================
--- sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/helpers/Poller.java (original)
+++ sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/helpers/Poller.java Tue Oct 6 07:53:54 2015
@@ -40,13 +40,7 @@ public class Poller {
try {
r.run();
break;
- } catch (RuntimeException e) {
- lastError = e;
- // skip
- } catch (AssertionFailedError e) {
- lastError = e;
- // skip
- } catch (AssertionError e) {
+ } catch (RuntimeException| AssertionError e) {
lastError = e;
// skip
}
Modified: sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/helpers/ProjectAdapter.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/helpers/ProjectAdapter.java?rev=1706960&r1=1706959&r2=1706960&view=diff
==============================================================================
--- sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/helpers/ProjectAdapter.java (original)
+++ sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/helpers/ProjectAdapter.java Tue Oct 6 07:53:54 2015
@@ -82,7 +82,7 @@ public class ProjectAdapter {
// get dependency to required artifacts
- List<Artifact> resolvedArtifacts = new ArrayList<Artifact>(dependencies.length);
+ List<Artifact> resolvedArtifacts = new ArrayList<>(dependencies.length);
for (MavenDependency d : dependencies) {
resolvedArtifacts.add(MavenPlugin.getMaven().resolve(d.getGroupId(), d.getArtifactId(), d.getVersion(),
"jar", "", MavenPlugin.getMaven().getArtifactRepositories(), new NullProgressMonitor()));
@@ -90,7 +90,7 @@ public class ProjectAdapter {
// create java project
javaProject = JavaCore.create(project);
- Set<IClasspathEntry> entries = new HashSet<IClasspathEntry>();
+ Set<IClasspathEntry> entries = new HashSet<>();
entries.add(JavaRuntime.getDefaultJREContainerEntry());
for (Artifact artifact : resolvedArtifacts) {
entries.add(JavaCore.newLibraryEntry(Path.fromOSString(artifact.getFile().getAbsolutePath()), null, null));
Modified: sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/helpers/RepositoryAccessor.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/helpers/RepositoryAccessor.java?rev=1706960&r1=1706959&r2=1706960&view=diff
==============================================================================
--- sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/helpers/RepositoryAccessor.java (original)
+++ sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/helpers/RepositoryAccessor.java Tue Oct 6 07:53:54 2015
@@ -63,19 +63,18 @@ public class RepositoryAccessor {
public void assertGetIsSuccessful(String path, String expectedResult) throws HttpException, IOException {
GetMethod m = new GetMethod(config.getUrl() + path);
- InputStream input = null;
try {
int result = client.executeMethod(m);
assertThat("Unexpected status call for " + m.getURI(), result, CoreMatchers.equalTo(200));
- input = m.getResponseBodyAsStream();
- String responseBody = IOUtils.toString(input, m.getRequestCharSet());
-
- assertThat("Unexpected response for " + m.getURI(), responseBody,
- CoreMatchers.equalTo(expectedResult));
+ try ( InputStream input = m.getResponseBodyAsStream() ) {
+ String responseBody = IOUtils.toString(input, m.getRequestCharSet());
+
+ assertThat("Unexpected response for " + m.getURI(), responseBody,
+ CoreMatchers.equalTo(expectedResult));
+ }
} finally {
- IOUtils.closeQuietly(input);
m.releaseConnection();
}
}
Modified: sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/helpers/SpyRepository.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/helpers/SpyRepository.java?rev=1706960&r1=1706959&r2=1706960&view=diff
==============================================================================
--- sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/helpers/SpyRepository.java (original)
+++ sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/helpers/SpyRepository.java Tue Oct 6 07:53:54 2015
@@ -41,7 +41,7 @@ public class SpyRepository implements Re
public Command<Void> newAddOrUpdateNodeCommand(CommandContext context, FileInfo fileInfo, ResourceProxy resourceProxy,
CommandExecutionFlag... flags) {
- return new SpyCommand<Void>(resourceProxy, fileInfo, null, SpyCommand.Kind.ADD_OR_UPDATE, flags);
+ return new SpyCommand<>(resourceProxy, fileInfo, null, SpyCommand.Kind.ADD_OR_UPDATE, flags);
}
@Override
Modified: sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/helpers/jcr/ChildrenNameMatcher.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/helpers/jcr/ChildrenNameMatcher.java?rev=1706960&r1=1706959&r2=1706960&view=diff
==============================================================================
--- sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/helpers/jcr/ChildrenNameMatcher.java (original)
+++ sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/helpers/jcr/ChildrenNameMatcher.java Tue Oct 6 07:53:54 2015
@@ -67,7 +67,7 @@ public class ChildrenNameMatcher extends
private List<String> childrenNames(NodeIterator nodes) throws RepositoryException {
- List<String> names = new ArrayList<String>();
+ List<String> names = new ArrayList<>();
while (nodes.hasNext()) {
names.add(nodes.nextNode().getName());
}
Modified: sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/actions/JcrNewNodeAction.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/actions/JcrNewNodeAction.java?rev=1706960&r1=1706959&r2=1706960&view=diff
==============================================================================
--- sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/actions/JcrNewNodeAction.java (original)
+++ sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/actions/JcrNewNodeAction.java Tue Oct 6 07:53:54 2015
@@ -33,7 +33,6 @@ import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IObjectActionDelegate;
import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.wst.server.ui.internal.Messages;
public class JcrNewNodeAction implements IObjectActionDelegate {
Modified: sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/actions/NewNodeDialog.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/actions/NewNodeDialog.java?rev=1706960&r1=1706959&r2=1706960&view=diff
==============================================================================
--- sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/actions/NewNodeDialog.java (original)
+++ sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/actions/NewNodeDialog.java Tue Oct 6 07:53:54 2015
@@ -64,7 +64,7 @@ public class NewNodeDialog extends Input
this.parentNodeType = node.getPrimaryType();
this.ntManager = ntManager;
if (ntManager!=null) {
- final LinkedList<String> ac = new LinkedList<String>(ntManager.getAllowedPrimaryChildNodeTypes(parentNodeType));
+ final LinkedList<String> ac = new LinkedList<>(ntManager.getAllowedPrimaryChildNodeTypes(parentNodeType));
final NodeType parentNt = ntManager.getNodeType(parentNodeType);
allChildNodeDefs = parentNt.getChildNodeDefinitions();
Collections.sort(ac);
@@ -203,8 +203,7 @@ public class NewNodeDialog extends Input
return;
}
StringBuffer details = new StringBuffer();
- for (int i = 0; i < allChildNodeDefs.length; i++) {
- NodeDefinition aChildNodeDef = allChildNodeDefs[i];
+ for (NodeDefinition aChildNodeDef : allChildNodeDefs) {
if (details.length()!=0) {
details.append(", ");
}
Modified: sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/dnd/assistant/StatusLineUtils.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/dnd/assistant/StatusLineUtils.java?rev=1706960&r1=1706959&r2=1706960&view=diff
==============================================================================
--- sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/dnd/assistant/StatusLineUtils.java (original)
+++ sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/dnd/assistant/StatusLineUtils.java Tue Oct 6 07:53:54 2015
@@ -61,8 +61,7 @@ public class StatusLineUtils {
}
IViewReference[] viewRefs = activePage.getViewReferences();
if (viewRefs!=null) {
- for (int i = 0; i < viewRefs.length; i++) {
- IViewReference aViewRef = viewRefs[i];
+ for (IViewReference aViewRef : viewRefs) {
IViewPart view = aViewRef.getView(false);
if (view!=null) {
return view.getViewSite().getActionBars().getStatusLineManager();
@@ -71,8 +70,7 @@ public class StatusLineUtils {
}
IEditorReference[] editorRefs = activePage.getEditorReferences();
if (editorRefs!=null) {
- for (int i = 0; i < editorRefs.length; i++) {
- IEditorReference anEditorRef = editorRefs[i];
+ for (IEditorReference anEditorRef : editorRefs) {
IEditorPart editor = anEditorRef.getEditor(false);
if (editor!=null) {
return editor.getEditorSite().getActionBars().getStatusLineManager();
Modified: sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/Activator.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/Activator.java?rev=1706960&r1=1706959&r2=1706960&view=diff
==============================================================================
--- sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/Activator.java (original)
+++ sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/Activator.java Tue Oct 6 07:53:54 2015
@@ -55,27 +55,26 @@ public class Activator extends AbstractU
tracerRegistration = PluginLoggerRegistrar.register(this);
- serializationManager = new ServiceTracker<SerializationManager, SerializationManager>(context,
- SerializationManager.class, null);
+ serializationManager = new ServiceTracker<>(context, SerializationManager.class, null);
serializationManager.open();
- filterLocator = new ServiceTracker<FilterLocator, FilterLocator>(context, FilterLocator.class, null);
+ filterLocator = new ServiceTracker<>(context, FilterLocator.class, null);
filterLocator.open();
- eventAdmin = new ServiceTracker<EventAdmin, EventAdmin>(context, EventAdmin.class, null);
+ eventAdmin = new ServiceTracker<>(context, EventAdmin.class, null);
eventAdmin.open();
- artifactLocator = new ServiceTracker<EmbeddedArtifactLocator, EmbeddedArtifactLocator>(context,
+ artifactLocator = new ServiceTracker<>(context,
EmbeddedArtifactLocator.class, null);
artifactLocator.open();
- osgiClientFactory = new ServiceTracker<OsgiClientFactory, OsgiClientFactory>(context, OsgiClientFactory.class,
+ osgiClientFactory = new ServiceTracker<>(context, OsgiClientFactory.class,
null);
osgiClientFactory.open();
// ugh
ServiceReference<Object> reference = (ServiceReference<Object>) tracerRegistration.getReference();
- tracer = new ServiceTracker<Object, Object>(context, reference, null);
+ tracer = new ServiceTracker<>(context, reference, null);
tracer.open();
INSTANCE = this;
Modified: sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/ConnectionEditorSection.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/ConnectionEditorSection.java?rev=1706960&r1=1706959&r2=1706960&view=diff
==============================================================================
--- sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/ConnectionEditorSection.java (original)
+++ sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/ConnectionEditorSection.java Tue Oct 6 07:53:54 2015
@@ -134,17 +134,28 @@ public class ConnectionEditorSection ext
}
updating = true;
try{
- if (ISlingLaunchpadServer.PROP_PORT.equals(evt.getPropertyName())) {
- portText.setText(((Integer) evt.getNewValue()).toString());
- } else if (ISlingLaunchpadServer.PROP_DEBUG_PORT.equals(evt.getPropertyName())) {
- debugPortText.setText(((Integer) evt.getNewValue()).toString());
- } else if (ISlingLaunchpadServer.PROP_CONTEXT_PATH.equals(evt.getPropertyName())) {
- contextPathText.setText((String) evt.getNewValue());
- } else if (ISlingLaunchpadServer.PROP_USERNAME.equals(evt.getPropertyName())) {
- usernameText.setText((String) evt.getNewValue());
- } else if (ISlingLaunchpadServer.PROP_PASSWORD.equals(evt.getPropertyName())) {
- passwordText.setText((String) evt.getNewValue());
- }
+ switch ( evt.getPropertyName()) {
+ case ISlingLaunchpadServer.PROP_PORT:
+ portText.setText(((Integer) evt.getNewValue()).toString());
+ break;
+
+ case ISlingLaunchpadServer.PROP_DEBUG_PORT:
+ debugPortText.setText(((Integer) evt.getNewValue()).toString());
+ break;
+
+ case ISlingLaunchpadServer.PROP_CONTEXT_PATH:
+ contextPathText.setText((String) evt.getNewValue());
+ break;
+
+ case ISlingLaunchpadServer.PROP_USERNAME:
+ usernameText.setText((String) evt.getNewValue());
+ break;
+
+ case ISlingLaunchpadServer.PROP_PASSWORD:
+ passwordText.setText((String) evt.getNewValue());
+ break;
+
+ }
} finally {
updating = false;
}