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 [2/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...
Modified: sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/ExportWizard.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/ExportWizard.java?rev=1706960&r1=1706959&r2=1706960&view=diff
==============================================================================
--- sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/ExportWizard.java (original)
+++ sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/ExportWizard.java Tue Oct 6 07:53:54 2015
@@ -105,15 +105,12 @@ public class ExportWizard extends Wizard
});
return true;
- } catch (RuntimeException e) {
+ } catch (RuntimeException | InterruptedException e) {
exportPage.setErrorMessage(e.getMessage());
return false;
} catch (InvocationTargetException e) {
exportPage.setErrorMessage(e.getCause().getMessage());
return false;
- } catch (InterruptedException e) {
- exportPage.setErrorMessage(e.getMessage());
- return false;
}
}
Modified: sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/ImportRepositoryContentAction.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/ImportRepositoryContentAction.java?rev=1706960&r1=1706959&r2=1706960&view=diff
==============================================================================
--- sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/ImportRepositoryContentAction.java (original)
+++ sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/ImportRepositoryContentAction.java Tue Oct 6 07:53:54 2015
@@ -98,7 +98,7 @@ public class ImportRepositoryContentActi
this.project = project;
this.serializationManager = serializationManager;
this.ignoredResources = new IgnoredResources();
- this.currentResources = new HashSet<IResource>();
+ this.currentResources = new HashSet<>();
}
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException,
@@ -261,7 +261,7 @@ public class ImportRepositoryContentActi
SerializationData serializationData = builder.buildSerializationData(contentSyncRoot, resource);
logger.trace("For resource at path {0} got serialization data {1}", resource.getPath(), serializationData);
- final List<ResourceProxy> resourceChildren = new LinkedList<ResourceProxy>(resource.getChildren());
+ final List<ResourceProxy> resourceChildren = new LinkedList<>(resource.getChildren());
if (serializationData != null) {
IPath serializationFolderPath = contentSyncRootDir.getProjectRelativePath().append(
@@ -388,15 +388,13 @@ public class ImportRepositoryContentActi
logger.trace("Found ignore file at {0}", vltIgnore.getFullPath());
- InputStream contents = ((IFile) vltIgnore).getContents();
- try {
+
+ try (InputStream contents = ((IFile) vltIgnore).getContents()) {
List<String> ignoreLines = IOUtils.readLines(contents);
for (String ignoreLine : ignoreLines) {
logger.trace("Registering ignore rule {0}:{1}", path, ignoreLine);
ignoredResources.registerRegExpIgnoreRule(path, ignoreLine);
}
- } finally {
- IOUtils.closeQuietly(contents);
}
}
}
Modified: sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/InstallEditorSection.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/InstallEditorSection.java?rev=1706960&r1=1706959&r2=1706960&view=diff
==============================================================================
--- sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/InstallEditorSection.java (original)
+++ sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/InstallEditorSection.java Tue Oct 6 07:53:54 2015
@@ -222,12 +222,9 @@ public class InstallEditorSection extend
message = "Bundle is already installed and up to date";
} else {
monitor.setTaskName("Installing bundle");
- InputStream contents = null;
- try {
- contents = supportBundle.openInputStream();
+
+ try (InputStream contents = supportBundle.openInputStream() ){
client.installBundle(contents, supportBundle.getName());
- } finally {
- IOUtils.closeQuietly(contents);
}
deployedVersion = embeddedVersion;
message = "Bundle version " + embeddedVersion + " installed";
@@ -252,11 +249,7 @@ public class InstallEditorSection extend
});
monitor.worked(1);
- } catch (OsgiClientException e) {
- throw new InvocationTargetException(e);
- } catch (URISyntaxException e) {
- throw new InvocationTargetException(e);
- } catch (IOException e) {
+ } catch (OsgiClientException | IOException | URISyntaxException e) {
throw new InvocationTargetException(e);
} finally {
monitor.done();
Modified: sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/SelectionUtils.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/SelectionUtils.java?rev=1706960&r1=1706959&r2=1706960&view=diff
==============================================================================
--- sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/SelectionUtils.java (original)
+++ sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/SelectionUtils.java Tue Oct 6 07:53:54 2015
@@ -51,7 +51,7 @@ public abstract class SelectionUtils {
if (project == null) {
return Collections.emptyList();
}
- List<IServer> servers = new ArrayList<IServer>();
+ List<IServer> servers = new ArrayList<>();
IModule[] modules = ServerUtil.getModules(project);
Modified: sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/ServersActionModeFiddlerActionDelegate.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/ServersActionModeFiddlerActionDelegate.java?rev=1706960&r1=1706959&r2=1706960&view=diff
==============================================================================
--- sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/ServersActionModeFiddlerActionDelegate.java (original)
+++ sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/ServersActionModeFiddlerActionDelegate.java Tue Oct 6 07:53:54 2015
@@ -54,8 +54,8 @@ public class ServersActionModeFiddlerAct
private IPropertyChangeListener debugTooltipListener;
private IPropertyChangeListener disconnectTooltipListener;
- private List<ActionContributionItem> prependedToolbarActions = new LinkedList<ActionContributionItem>();
- private List<ActionContributionItem> appendedToolbarActionContributionItems = new LinkedList<ActionContributionItem>();
+ private List<ActionContributionItem> prependedToolbarActions = new LinkedList<>();
+ private List<ActionContributionItem> appendedToolbarActionContributionItems = new LinkedList<>();
private IServer server;
private List<IModule[]> modules;
private Action cleanAction;
@@ -82,7 +82,7 @@ public class ServersActionModeFiddlerAct
modules = null;
if (iss.size()>1) {
// verify that all selected elements are of type IServer
- Iterator it = iss.iterator();
+ Iterator<?> it = iss.iterator();
it.next(); // skip the first, we have that above already
while(it.hasNext()) {
Object next = it.next();
@@ -94,14 +94,14 @@ public class ServersActionModeFiddlerAct
}
}
} else if (first instanceof IServerModule) {
- modules = new LinkedList<IModule[]>();
+ modules = new LinkedList<>();
IServerModule module = (IServerModule)first;
modules.add(module.getModule());
server = module.getServer();
if (iss.size()>1) {
// verify that all selected elements are of type IServerModule
// plus add the module[] to the modules list
- Iterator it = iss.iterator();
+ Iterator<?> it = iss.iterator();
it.next(); // skip the first, we have that above already
while(it.hasNext()) {
Object next = it.next();
@@ -141,8 +141,7 @@ public class ServersActionModeFiddlerAct
findWstPublishAction();
- for (Iterator it = appendedToolbarActionContributionItems.iterator(); it.hasNext();) {
- ActionContributionItem appendedAction = (ActionContributionItem) it.next();
+ for (ActionContributionItem appendedAction : appendedToolbarActionContributionItems) {
if (!contributionAdded(appendedAction)) {
actionBars.getToolBarManager().add(appendedAction);
}
@@ -212,8 +211,7 @@ public class ServersActionModeFiddlerAct
return;
}
IContributionItem[] items = actionBars.getToolBarManager().getItems();
- for (int i = 0; i < items.length; i++) {
- IContributionItem item = items[i];
+ for (IContributionItem item : items) {
if (item instanceof ActionContributionItem) {
ActionContributionItem actionItem = (ActionContributionItem) item;
IAction a = actionItem.getAction();
@@ -229,8 +227,7 @@ public class ServersActionModeFiddlerAct
private boolean contributionAdded(ActionContributionItem action) {
IContributionItem[] items = actionBars.getToolBarManager().getItems();
- for (int i = 0; i < items.length; i++) {
- IContributionItem iContributionItem = items[i];
+ for (IContributionItem iContributionItem : items) {
if (iContributionItem==action) {
return true;
}
@@ -243,8 +240,9 @@ public class ServersActionModeFiddlerAct
this.view = view;
actionBars = view.getViewSite().getActionBars();
initToolbarContributedActions();
- for (Iterator it = prependedToolbarActions.iterator(); it.hasNext();) {
- IAction action = (IAction) it.next();
+ for (ActionContributionItem actionContributionItem : prependedToolbarActions) {
+ // TODO - this looks wrong
+ IAction action = (IAction) actionContributionItem;
final ActionContributionItem contribution = new ActionContributionItem(action);
actionBars.getToolBarManager().add(contribution);
}
Modified: sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/console/SlingConsoleEventListener.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/console/SlingConsoleEventListener.java?rev=1706960&r1=1706959&r2=1706960&view=diff
==============================================================================
--- sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/console/SlingConsoleEventListener.java (original)
+++ sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/console/SlingConsoleEventListener.java Tue Oct 6 07:53:54 2015
@@ -122,8 +122,7 @@ public class SlingConsoleEventListener i
private void logEvent(Event event, MessageConsole console) {
- MessageConsoleStream messageStream = console.newMessageStream();
- try {
+ try (MessageConsoleStream messageStream = console.newMessageStream()) {
Long start = (Long) event.getProperty(CommandExecutionProperties.TIMESTAMP_START);
Long end = (Long) event.getProperty(CommandExecutionProperties.TIMESTAMP_END);
@@ -148,8 +147,6 @@ public class SlingConsoleEventListener i
}
} catch (IOException e) {
Activator.getDefault().getPluginLogger().warn("Failed writing to the console", e);
- } finally {
- IOUtils.closeQuietly(messageStream);
}
}
Modified: sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/nav/JcrContentContentProvider.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/nav/JcrContentContentProvider.java?rev=1706960&r1=1706959&r2=1706960&view=diff
==============================================================================
--- sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/nav/JcrContentContentProvider.java (original)
+++ sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/nav/JcrContentContentProvider.java Tue Oct 6 07:53:54 2015
@@ -58,7 +58,7 @@ public class JcrContentContentProvider i
return;
}
try {
- final Set<IProject> toBeRefreshed = new HashSet<IProject>();
+ final Set<IProject> toBeRefreshed = new HashSet<>();
event.getDelta().accept(new IResourceDeltaVisitor() {
@Override
@@ -243,7 +243,7 @@ public class JcrContentContentProvider i
if (aParent instanceof IProject) {
IProject project = (IProject)aParent;
if (ProjectHelper.isContentProject(project)) {
- for (Iterator it = theCurrentChildren.iterator(); it
+ for (Iterator<?> it = theCurrentChildren.iterator(); it
.hasNext();) {
Object aChild = (Object) it.next();
if (aChild instanceof IPackageFragmentRoot) {
Modified: sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/nav/Sorter.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/nav/Sorter.java?rev=1706960&r1=1706959&r2=1706960&view=diff
==============================================================================
--- sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/nav/Sorter.java (original)
+++ sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/nav/Sorter.java Tue Oct 6 07:53:54 2015
@@ -40,11 +40,10 @@ public class Sorter extends ViewerSorter
JcrNode node2 = (JcrNode) e2;
JcrNode parent = node1.getParent();
Object[] children = parent.getChildren(false);
- for (int i = 0; i < children.length; i++) {
- Object aChild = children[i];
- if (aChild==node1) {
+ for (Object child : children) {
+ if (child==node1) {
return -1;
- } else if (aChild==node2) {
+ } else if (child==node2) {
return 1;
}
}
Modified: sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/nav/model/DirNode.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/nav/model/DirNode.java?rev=1706960&r1=1706959&r2=1706960&view=diff
==============================================================================
--- sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/nav/model/DirNode.java (original)
+++ sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/nav/model/DirNode.java Tue Oct 6 07:53:54 2015
@@ -17,7 +17,6 @@
package org.apache.sling.ide.eclipse.ui.nav.model;
import java.util.HashSet;
-import java.util.Iterator;
import java.util.Set;
import org.eclipse.core.resources.IContainer;
@@ -122,9 +121,8 @@ public class DirNode extends JcrNode {
final DirNode dirNodeParent = (DirNode)nonDirNodeParent;
final String decodedParentName = dirNodeParent.getDecodedName();
- final Set<JcrNode> c = new HashSet<JcrNode>(nonDirNodeParent.parent.children);
- for (Iterator<JcrNode> it = c.iterator(); it.hasNext();) {
- final JcrNode node = it.next();
+ final Set<JcrNode> c = new HashSet<>(nonDirNodeParent.parent.children);
+ for (JcrNode node : c) {
if (node.getName().equals(decodedParentName)) {
nonDirNodeParent = node;
continue outerloop;
Modified: sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/nav/model/GenericJcrRootFile.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/nav/model/GenericJcrRootFile.java?rev=1706960&r1=1706959&r2=1706960&view=diff
==============================================================================
--- sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/nav/model/GenericJcrRootFile.java (original)
+++ sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/nav/model/GenericJcrRootFile.java Tue Oct 6 07:53:54 2015
@@ -55,12 +55,9 @@ public class GenericJcrRootFile extends
this.parent = parent;
this.domElement = null;
- InputStream in = file.getContents();
- try {
+ try (InputStream in = file.getContents()) {
this.document = TolerantXMLParser.parse(in, file.getFullPath().toOSString());
handleJcrRoot(this.document.getRootElement());
- } finally {
- IOUtils.closeQuietly(in);
}
}
@@ -153,9 +150,7 @@ public class GenericJcrRootFile extends
}
JcrNode childJcrNode = new JcrNode(parent, domNode, this, null);
handleProperties(domNode, childJcrNode.properties);
- List<Element> children = domNode.getChildren();
- for (Iterator<Element> it = children.iterator(); it.hasNext();) {
- Element element = it.next();
+ for (Element element : domNode.getChildren()) {
handleChild(childJcrNode, element);
}
}
Modified: sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/nav/model/JcrNode.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/nav/model/JcrNode.java?rev=1706960&r1=1706959&r2=1706960&view=diff
==============================================================================
--- sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/nav/model/JcrNode.java (original)
+++ sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/nav/model/JcrNode.java Tue Oct 6 07:53:54 2015
@@ -35,7 +35,6 @@ import javax.jcr.nodetype.NodeType;
import javax.jcr.nodetype.PropertyDefinition;
import javax.xml.parsers.ParserConfigurationException;
-import org.apache.commons.io.IOUtils;
import org.apache.jackrabbit.util.ISO9075;
import org.apache.sling.ide.eclipse.core.ProjectUtil;
import org.apache.sling.ide.eclipse.core.ServerUtil;
@@ -110,7 +109,7 @@ public class JcrNode implements IAdaptab
DirNode dirSibling;
- final List<JcrNode> children = new LinkedList<JcrNode>();
+ final List<JcrNode> children = new LinkedList<>();
Element domElement;
@@ -120,7 +119,7 @@ public class JcrNode implements IAdaptab
final ModifiableProperties properties = new ModifiableProperties(this);
- final Set<JcrNode> hiddenChildren = new HashSet<JcrNode>();
+ final Set<JcrNode> hiddenChildren = new HashSet<>();
JcrNode() {
// for subclass use only
@@ -222,8 +221,7 @@ public class JcrNode implements IAdaptab
if (!children.contains(jcrNode)) {
// check to see if there is a same-named node though
// that is the dom/resource case
- for (Iterator<JcrNode> it = children.iterator(); it.hasNext();) {
- JcrNode existingChild = it.next();
+ for (JcrNode existingChild : children) {
if (existingChild.getName().equals(jcrNode.getName())) {
// then merge the two
existingChild.setResource(jcrNode.resource);
@@ -267,10 +265,9 @@ public class JcrNode implements IAdaptab
}
Object[] filterHiddenChildren(final Collection<JcrNode> collection, boolean hideEmptyNodes) {
- final Collection<JcrNode> values = new LinkedList<JcrNode>(collection);
+ final Collection<JcrNode> values = new LinkedList<>(collection);
- for (Iterator<JcrNode> it = hiddenChildren.iterator(); it.hasNext();) {
- final JcrNode hiddenNode = it.next();
+ for (JcrNode hiddenNode : hiddenChildren) {
values.remove(hiddenNode);
}
if (hideEmptyNodes) {
@@ -328,7 +325,7 @@ public class JcrNode implements IAdaptab
if (resourceChildrenAdded) {
throw new IllegalStateException("Children already loaded");
}
- Set<String> childrenNames = new HashSet<String>();
+ Set<String> childrenNames = new HashSet<>();
for (Iterator<JcrNode> it = children.iterator(); it.hasNext();) {
JcrNode node = it.next();
childrenNames.add(node.getName());
@@ -337,7 +334,7 @@ public class JcrNode implements IAdaptab
if (resource!=null && resource instanceof IFolder) {
IFolder folder = (IFolder)resource;
IResource[] members = folder.members();
- List<IResource> membersList = new LinkedList<IResource>(Arrays.asList(members));
+ List<IResource> membersList = new LinkedList<>(Arrays.asList(members));
outerLoop: while(membersList.size()>0) {
for (Iterator<IResource> it = membersList.iterator(); it.hasNext();) {
IResource iResource = it.next();
@@ -360,9 +357,7 @@ public class JcrNode implements IAdaptab
// as this might have added some new children, go through the children again and
// add them if they're not already added
- for (Iterator<JcrNode> it3 = children.iterator(); it3
- .hasNext();) {
- JcrNode node = (JcrNode) it3.next();
+ for (JcrNode node : children) {
if (!childrenNames.contains(node.getName())) {
childrenNames.add(node.getName());
}
@@ -371,7 +366,7 @@ public class JcrNode implements IAdaptab
continue outerLoop;
}
}
- List<JcrNode> newNodes = new LinkedList<JcrNode>();
+ List<JcrNode> newNodes = new LinkedList<>();
for (Iterator<IResource> it = membersList.iterator(); it.hasNext();) {
IResource iResource = (IResource) it.next();
JcrNode node;
@@ -480,9 +475,8 @@ public class JcrNode implements IAdaptab
}
private String getJcrContentProperty(String propertyKey) {
- final Object[] chldrn = getChildren(false);
- for (int i = 0; i < chldrn.length; i++) {
- JcrNode jcrNode = (JcrNode) chldrn[i];
+ for (Object element : getChildren(false)) {
+ JcrNode jcrNode = (JcrNode) element;
if ("jcr:content".equals(jcrNode.getName())) {
return jcrNode.getProperty(propertyKey).getValueAsString();
}
@@ -776,10 +770,9 @@ public class JcrNode implements IAdaptab
}
JcrNode getChild(String name) {
- for (Iterator<JcrNode> it = children.iterator(); it.hasNext();) {
- JcrNode aChild = it.next();
- if (aChild.getName().equals(name)) {
- return aChild;
+ for (JcrNode child : children) {
+ if (child.getName().equals(name)) {
+ return child;
}
}
return null;
@@ -934,13 +927,12 @@ public class JcrNode implements IAdaptab
Document document = TolerantXMLParser.parse(xml, file.getFullPath().toOSString());
// add the attributes of content
List<Attribute> attributes = content.getAttributes();
- for (Iterator<Attribute> it = attributes.iterator(); it.hasNext();) {
- Attribute anAttribute = it.next();
- if (anAttribute.getName().equals("jcr:primaryType")) {
+ for (Attribute attribute : attributes) {
+ if (attribute.getName().equals("jcr:primaryType")) {
// skip this
continue;
}
- document.getRootElement().addAttribute(anAttribute);
+ document.getRootElement().addAttribute(attribute);
}
// then copy all the children
document.getRootElement().addNodes(content.getChildren());
@@ -999,7 +991,7 @@ public class JcrNode implements IAdaptab
if (nodeType!=null) {
element.addAttribute("jcr:primaryType", nodeType);
}
- StringBuffer indent = new StringBuffer();
+ StringBuilder indent = new StringBuilder();
Element parElement = domElement.getParentElement();
while(parElement!=null) {
indent.append(" ");
@@ -1392,9 +1384,7 @@ public class JcrNode implements IAdaptab
IFolder contentSyncRoot = ProjectUtil.getSyncDirectory(getProject());
IFile file = (IFile) u.file;
- InputStream contents = null;
- try{
- contents = file.getContents();
+ try (InputStream contents = file.getContents() ){
String resourceLocation = file.getFullPath().makeRelativeTo(contentSyncRoot.getFullPath())
.toPortableString();
ResourceProxy resourceProxy = Activator.getDefault()
@@ -1406,8 +1396,6 @@ public class JcrNode implements IAdaptab
return PropertyTypeSupport.propertyTypeOfString(rawValue);
} catch(Exception e) {
Activator.getDefault().getPluginLogger().warn("Exception occurred during analyzing propertyType ("+propertyName+") for "+this, e);
- } finally {
- IOUtils.closeQuietly(contents);
}
return -1;
}
@@ -1439,7 +1427,7 @@ public class JcrNode implements IAdaptab
if (nt0==null) {
return null;
}
- List<NodeType> nodeTypes = new LinkedList<NodeType>();
+ List<NodeType> nodeTypes = new LinkedList<>();
nodeTypes.add(nt0);
// add all supertypes
nodeTypes.addAll(Arrays.asList(nt0.getSupertypes()));
@@ -1534,7 +1522,7 @@ public class JcrNode implements IAdaptab
private IFolder prepareCreateFolderChild(final String childNodeName)
throws CoreException {
// 0) find base folder for creating new subfolders
- List<String> parentNames = new LinkedList<String>();
+ List<String> parentNames = new LinkedList<>();
JcrNode node = JcrNode.this;
while(!(node.resource instanceof IFolder) && !(node instanceof SyncDir)) {
parentNames.add(0, node.getJcrPathName());
@@ -1545,8 +1533,7 @@ public class JcrNode implements IAdaptab
}
IFolder folder = (IFolder) node.resource;
parentNames.add(childNodeName);
- for (Iterator<String> it = parentNames.iterator(); it
- .hasNext();) {
+ for (Iterator<String> it = parentNames.iterator(); it .hasNext();) {
String aParentName = it.next();
String encodedParentName = DirNode.encode(aParentName);
IResource member = folder.findMember(encodedParentName);
Modified: sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/nav/model/LinkHelper.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/nav/model/LinkHelper.java?rev=1706960&r1=1706959&r2=1706960&view=diff
==============================================================================
--- sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/nav/model/LinkHelper.java (original)
+++ sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/nav/model/LinkHelper.java Tue Oct 6 07:53:54 2015
@@ -109,9 +109,7 @@ public class LinkHelper implements ILink
return;
}
final IFile selectedFile = (IFile)resource;
- final IEditorReference[] editorReferences = aPage.getEditorReferences();
- for (int i = 0; i < editorReferences.length; i++) {
- final IEditorReference reference = editorReferences[i];
+ for (final IEditorReference reference : aPage.getEditorReferences()) {
if (reference==null) {
continue;
}
Modified: sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/nav/model/ModifiableProperties.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/nav/model/ModifiableProperties.java?rev=1706960&r1=1706959&r2=1706960&view=diff
==============================================================================
--- sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/nav/model/ModifiableProperties.java (original)
+++ sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/nav/model/ModifiableProperties.java Tue Oct 6 07:53:54 2015
@@ -18,10 +18,10 @@ package org.apache.sling.ide.eclipse.ui.
import java.util.Calendar;
import java.util.HashMap;
-import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
+import java.util.Map.Entry;
import javax.jcr.PropertyType;
@@ -44,8 +44,8 @@ import de.pdark.decentxml.Text;
public class ModifiableProperties implements IPropertySource {
- private Map<String, String> properties = new HashMap<String, String>();
- private List<String> propertiesOrder = new LinkedList<String>();
+ private Map<String, String> properties = new HashMap<>();
+ private List<String> propertiesOrder = new LinkedList<>();
private JcrNode node;
private Element domElement;
private GenericJcrRootFile genericJcrRootFile;
@@ -76,16 +76,15 @@ public class ModifiableProperties implem
@Override
public IPropertyDescriptor[] getPropertyDescriptors() {
- final Map<String,IPropertyDescriptor> conversionMap = new HashMap<String,IPropertyDescriptor>();
- for (Iterator<Map.Entry<String, String>> it = properties.entrySet().iterator(); it.hasNext();) {
- Map.Entry<String, String> entry = it.next();
+ final Map<String,IPropertyDescriptor> conversionMap = new HashMap<>();
+ for (Entry<String, String> entry : properties.entrySet()) {
TextPropertyDescriptor pd = new JcrTextPropertyDescriptor(entry, entry.getKey());
conversionMap.put(entry.getKey(), pd);
}
- final List<String> propertiesOrderCopy = new LinkedList<String>(propertiesOrder);
+ final List<String> propertiesOrderCopy = new LinkedList<>(propertiesOrder);
final String jcrPrimaryType = "jcr:primaryType";
if (!properties.containsKey(jcrPrimaryType)) {
- Map<String, String> pseudoMap = new HashMap<String, String>();
+ Map<String, String> pseudoMap = new HashMap<>();
pseudoMap.put(jcrPrimaryType, node.getPrimaryType());
final TextPropertyDescriptor pseudoPd = new JcrTextPropertyDescriptor(pseudoMap.entrySet().iterator().next(), jcrPrimaryType);
propertiesOrderCopy.add(0, jcrPrimaryType);
@@ -175,13 +174,12 @@ public class ModifiableProperties implem
this.domElement = domNode;
final List<Attribute> attributes = domNode.getAttributes();
if (attributes!=null) {
- for (Iterator<Attribute> it = attributes.iterator(); it.hasNext();) {
- final Attribute a = it.next();
- final String name = a.getName();
+ for (Attribute attribute : attributes) {
+ final String name = attribute.getName();
if (name.startsWith("xmlns:")) {
continue;
}
- properties.put(name, a.getValue());
+ properties.put(name, attribute.getValue());
propertiesOrder.add(name);
}
}
@@ -231,8 +229,7 @@ public class ModifiableProperties implem
// guestimate
correctPreSpace = NL + INDENT;
}
- for (Iterator it = list.iterator(); it.hasNext();) {
- Attribute attribute = (Attribute) it.next();
+ for (Attribute attribute : list) {
if (!attribute.getName().startsWith("xmlns:")) {
attribute.setPreSpace(correctPreSpace);
}
Modified: sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/nav/model/SyncDirManager.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/nav/model/SyncDirManager.java?rev=1706960&r1=1706959&r2=1706960&view=diff
==============================================================================
--- sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/nav/model/SyncDirManager.java (original)
+++ sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/nav/model/SyncDirManager.java Tue Oct 6 07:53:54 2015
@@ -18,7 +18,6 @@ package org.apache.sling.ide.eclipse.ui.
import java.util.ArrayList;
import java.util.HashMap;
-import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
@@ -36,8 +35,8 @@ import org.eclipse.core.resources.IFolde
*/
public class SyncDirManager {
- private static Map<IFolder,SyncDir> syncDirs = new HashMap<IFolder,SyncDir>();
- private static List<UpdateHandler> handlers = new LinkedList<UpdateHandler>();
+ private static Map<IFolder,SyncDir> syncDirs = new HashMap<>();
+ private static List<UpdateHandler> handlers = new LinkedList<>();
public static void registerNewSyncDir(SyncDir syncDir) {
syncDirs.put(syncDir.getFolder(), syncDir);
@@ -47,10 +46,9 @@ public class SyncDirManager {
public static void syncDirChanged(SyncDir syncDir) {
List<UpdateHandler> handlersCopy;
synchronized(handlers) {
- handlersCopy = new ArrayList<UpdateHandler>(handlers);
+ handlersCopy = new ArrayList<>(handlers);
}
- for (Iterator it = handlersCopy.iterator(); it.hasNext();) {
- UpdateHandler updateHandler = (UpdateHandler) it.next();
+ for (UpdateHandler updateHandler : handlersCopy) {
updateHandler.syncDirUpdated(syncDir);
}
}
Modified: sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/properties/JcrPropertiesSection.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/properties/JcrPropertiesSection.java?rev=1706960&r1=1706959&r2=1706960&view=diff
==============================================================================
--- sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/properties/JcrPropertiesSection.java (original)
+++ sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/properties/JcrPropertiesSection.java Tue Oct 6 07:53:54 2015
@@ -26,7 +26,6 @@ import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.views.properties.PropertySheetPage;
import org.eclipse.ui.views.properties.tabbed.AbstractPropertySection;
import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
Modified: sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/propertyPages/SlingProjectPropertyPage.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/propertyPages/SlingProjectPropertyPage.java?rev=1706960&r1=1706959&r2=1706960&view=diff
==============================================================================
--- sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/propertyPages/SlingProjectPropertyPage.java (original)
+++ sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/propertyPages/SlingProjectPropertyPage.java Tue Oct 6 07:53:54 2015
@@ -22,7 +22,6 @@ import org.apache.sling.ide.eclipse.core
import org.apache.sling.ide.eclipse.core.internal.Activator;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
Modified: sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/views/JcrEditingSupport.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/views/JcrEditingSupport.java?rev=1706960&r1=1706959&r2=1706960&view=diff
==============================================================================
--- sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/views/JcrEditingSupport.java (original)
+++ sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/views/JcrEditingSupport.java Tue Oct 6 07:53:54 2015
@@ -146,7 +146,7 @@ public class JcrEditingSupport extends E
final String oldKey = String.valueOf(getValue());
final String newKey = String.valueOf(value);
pd.setNewPropertyName(newKey);
- Map<String, String> pseudoMap = new HashMap<String, String>();
+ Map<String, String> pseudoMap = new HashMap<>();
final String propertyValue = jcrNode.getProperties().getValue(oldKey);
pseudoMap.put(newKey, propertyValue);
final Entry<String, String> mapEntry = pseudoMap.entrySet().iterator().next();
Modified: sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/views/MVPEditor.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/views/MVPEditor.java?rev=1706960&r1=1706959&r2=1706960&view=diff
==============================================================================
--- sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/views/MVPEditor.java (original)
+++ sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/views/MVPEditor.java Tue Oct 6 07:53:54 2015
@@ -54,7 +54,7 @@ import org.eclipse.ui.PlatformUI;
public class MVPEditor extends Dialog {
private final JcrProperty property;
- private java.util.List<Line> lines = new ArrayList<MVPEditor.Line>();
+ private java.util.List<Line> lines = new ArrayList<>();
private TableViewer viewer;
private final Color greyColor;
Modified: sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/views/PropertyTypeSupport.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/views/PropertyTypeSupport.java?rev=1706960&r1=1706959&r2=1706960&view=diff
==============================================================================
--- sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/views/PropertyTypeSupport.java (original)
+++ sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/views/PropertyTypeSupport.java Tue Oct 6 07:53:54 2015
@@ -46,7 +46,7 @@ public class PropertyTypeSupport {
static Map<String,Integer> propertyTypeIndices;
static{
- propertyTypeIndices = new HashMap<String,Integer>();
+ propertyTypeIndices = new HashMap<>();
for (int i = 0; i < PROPERTY_TYPES.length; i++) {
String aPropertyType = PROPERTY_TYPES[i];
propertyTypeIndices.put(aPropertyType, i);
Modified: sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/wizards/AbstractNewSlingApplicationWizard.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/wizards/AbstractNewSlingApplicationWizard.java?rev=1706960&r1=1706959&r2=1706960&view=diff
==============================================================================
--- sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/wizards/AbstractNewSlingApplicationWizard.java (original)
+++ sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/wizards/AbstractNewSlingApplicationWizard.java Tue Oct 6 07:53:54 2015
@@ -105,7 +105,7 @@ public abstract class AbstractNewSlingAp
try {
// create projects
- final List<IProject> createdProjects = new ArrayList<IProject>();
+ final List<IProject> createdProjects = new ArrayList<>();
getContainer().run(false, true, new WorkspaceModifyOperation() {
@Override
protected void execute(IProgressMonitor monitor) throws CoreException, InvocationTargetException,
@@ -172,7 +172,7 @@ public abstract class AbstractNewSlingAp
IServerWorkingCopy wc = server.createWorkingCopy();
// add the bundle and content projects, ie modules, to the server
- List<IModule> modules = new LinkedList<IModule>();
+ List<IModule> modules = new LinkedList<>();
for (IProject project : projects.getBundleProjects()) {
IModule module = ServerUtil.getModule(project);
if (module != null && shouldDeploy(module)) {
@@ -214,7 +214,7 @@ public abstract class AbstractNewSlingAp
if (setupServerWizardPage.getStartServer()) {
server.start(ILaunchManager.RUN_MODE, monitor);
}
- List<IModule[]> modules = new ArrayList<IModule[]>();
+ List<IModule[]> modules = new ArrayList<>();
for (IProject project : createdProjects) {
IModule module = ServerUtil.getModule(project);
if (module != null && shouldDeploy(module)) {
Modified: sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/wizards/ConvertProjectsPage.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/wizards/ConvertProjectsPage.java?rev=1706960&r1=1706959&r2=1706960&view=diff
==============================================================================
--- sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/wizards/ConvertProjectsPage.java (original)
+++ sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/wizards/ConvertProjectsPage.java Tue Oct 6 07:53:54 2015
@@ -89,7 +89,7 @@ public class ConvertProjectsPage extends
@SuppressWarnings("unchecked")
public boolean finish() {
- resultingSelection = new LinkedList<IProject>(
+ resultingSelection = new LinkedList<>(
(Collection<? extends IProject>) Arrays.asList(ctv.getCheckedElements()));
return true;
}
Modified: sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/wizards/ConvertToBundleAction.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/wizards/ConvertToBundleAction.java?rev=1706960&r1=1706959&r2=1706960&view=diff
==============================================================================
--- sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/wizards/ConvertToBundleAction.java (original)
+++ sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/wizards/ConvertToBundleAction.java Tue Oct 6 07:53:54 2015
@@ -62,19 +62,17 @@ public class ConvertToBundleAction imple
*/
public void run(IAction action) {
if (fSelection instanceof IStructuredSelection) {
- List<IProject> applicableProjects = new LinkedList<IProject>();
+ List<IProject> applicableProjects = new LinkedList<>();
IProject[] allProjects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
- for (int i = 0; i < allProjects.length; i++) {
- IProject p = allProjects[i];
- if (p.isOpen() && ProjectHelper.isPotentialBundleProject(p)) {
+ for (IProject p : allProjects) {
+ if (p.isOpen() && ProjectHelper.isPotentialBundleProject(p)) {
applicableProjects.add(p);
}
}
Object[] elems = ((IStructuredSelection) fSelection).toArray();
- List<IProject> initialSelection = new ArrayList<IProject>(elems.length);
+ List<IProject> initialSelection = new ArrayList<>(elems.length);
- for (int i = 0; i < elems.length; i++) {
- Object elem = elems[i];
+ for (Object elem : elems) {
IProject project = null;
if (elem instanceof IFile) {
@@ -115,10 +113,8 @@ public class ConvertToBundleAction imple
public void run(IProgressMonitor monitor) throws InvocationTargetException,
InterruptedException {
try {
- for (Iterator<IProject> it = selectedProjects.iterator(); it
- .hasNext();) {
- IProject project = it.next();
- ConfigurationHelper.convertToBundleProject(project);
+ for (IProject project : selectedProjects) {
+ ConfigurationHelper.convertToBundleProject(project);
}
} catch (CoreException e) {
e.printStackTrace();
Modified: sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/wizards/ImportWizard.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/wizards/ImportWizard.java?rev=1706960&r1=1706959&r2=1706960&view=diff
==============================================================================
--- sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/wizards/ImportWizard.java (original)
+++ sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/wizards/ImportWizard.java Tue Oct 6 07:53:54 2015
@@ -118,10 +118,7 @@ public class ImportWizard extends Wizard
+ " . Please see the error log for details.");
Activator.getDefault().getPluginLogger().error("Repository import failed", cause);
return false;
- } catch (OperationCanceledException e) {
- Thread.currentThread().interrupt();
- return false;
- } catch (InterruptedException e) {
+ } catch (OperationCanceledException | InterruptedException e) {
Thread.currentThread().interrupt();
return false;
}
Modified: sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/wizards/NewSlingContentProjectWizard.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/wizards/NewSlingContentProjectWizard.java?rev=1706960&r1=1706959&r2=1706960&view=diff
==============================================================================
--- sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/wizards/NewSlingContentProjectWizard.java (original)
+++ sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/wizards/NewSlingContentProjectWizard.java Tue Oct 6 07:53:54 2015
@@ -56,7 +56,7 @@ public class NewSlingContentProjectWizar
}
IProject project = page.getProjectHandle();
- List<Operation> ops = new ArrayList<Operation>();
+ List<Operation> ops = new ArrayList<>();
ops.add(new CreateProject(project));
ops.add(new OpenProject(project));
Modified: sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/wizards/Projects.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/wizards/Projects.java?rev=1706960&r1=1706959&r2=1706960&view=diff
==============================================================================
--- sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/wizards/Projects.java (original)
+++ sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/wizards/Projects.java Tue Oct 6 07:53:54 2015
@@ -23,8 +23,8 @@ import org.eclipse.core.resources.IProje
public class Projects {
- private List<IProject> bundleProjects = new ArrayList<IProject>();
- private List<IProject> contentProjects = new ArrayList<IProject>();
+ private List<IProject> bundleProjects = new ArrayList<>();
+ private List<IProject> contentProjects = new ArrayList<>();
private IProject reactorProject;
public List<IProject> getBundleProjects() {
Modified: sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/wizards/SetupServerWizardPage.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/wizards/SetupServerWizardPage.java?rev=1706960&r1=1706959&r2=1706960&view=diff
==============================================================================
--- sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/wizards/SetupServerWizardPage.java (original)
+++ sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/wizards/SetupServerWizardPage.java Tue Oct 6 07:53:54 2015
@@ -339,10 +339,9 @@ public class SetupServerWizardPage exten
@SuppressWarnings("unused")
IRuntime existingRuntime = null;//ServerCore.findRuntime("org.apache.sling.ide.launchpadRuntimeType");
IRuntime[] existingRuntimes = ServerCore.getRuntimes();
- for (int i = 0; i < existingRuntimes.length; i++) {
- IRuntime aRuntime = existingRuntimes[i];
- if (aRuntime.getRuntimeType().getId().equals("org.apache.sling.ide.launchpadRuntimeType")) {
- existingRuntime = aRuntime;
+ for (IRuntime runtime : existingRuntimes) {
+ if (runtime.getRuntimeType().getId().equals("org.apache.sling.ide.launchpadRuntimeType")) {
+ existingRuntime = runtime;
}
}
@@ -364,19 +363,11 @@ public class SetupServerWizardPage exten
if (installedVersion == null || ourVersion.compareTo(installedVersion) > 0) {
// then auto-install it if possible
try {
-
- InputStream contents = null;
- try {
- contents = toolingSupportBundle.openInputStream();
+ try (InputStream contents = toolingSupportBundle.openInputStream()) {
newOsgiClient().installBundle(contents, toolingSupportBundle.getName());
- } finally {
- IOUtils.closeQuietly(contents);
}
finalVersion = ourVersion;
- } catch (IOException e) {
- throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
- "Failed installing the tooling support bundle version", e));
- } catch (OsgiClientException e) {
+ } catch (IOException | OsgiClientException e) {
throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
"Failed installing the tooling support bundle version", e));
}
Modified: sling/trunk/tooling/ide/impl-resource-test/src/test/java/org/apache/sling/ide/impl/resource/serialization/SimpleXmlSerializationManagerTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/impl-resource-test/src/test/java/org/apache/sling/ide/impl/resource/serialization/SimpleXmlSerializationManagerTest.java?rev=1706960&r1=1706959&r2=1706960&view=diff
==============================================================================
--- sling/trunk/tooling/ide/impl-resource-test/src/test/java/org/apache/sling/ide/impl/resource/serialization/SimpleXmlSerializationManagerTest.java (original)
+++ sling/trunk/tooling/ide/impl-resource-test/src/test/java/org/apache/sling/ide/impl/resource/serialization/SimpleXmlSerializationManagerTest.java Tue Oct 6 07:53:54 2015
@@ -81,7 +81,7 @@ public class SimpleXmlSerializationManag
@Test
public void stringSerializedData() throws SerializationException, SAXException, IOException {
- Map<String, Object> data = new HashMap<String, Object>();
+ Map<String, Object> data = new HashMap<>();
data.put("jcr:createdBy", "admin");
data.put("jcr:lastModifiedBy", "author");
@@ -111,7 +111,7 @@ public class SimpleXmlSerializationManag
@Test
public void serializedDataIsEscaped() throws SerializationException, SAXException, IOException {
- Map<String, Object> data = new HashMap<String, Object>();
+ Map<String, Object> data = new HashMap<>();
data.put("jcr:description", "<p class=\"active\">Welcome</p>");
SerializationData serializationData = sm.newBuilder(null, null).buildSerializationData(null, newResourceWithProperties(data));
@@ -127,7 +127,7 @@ public class SimpleXmlSerializationManag
Map<String, Object> serializationData = sm
.readSerializationData(null, readSerializationDataFile("stringSerializedData")).getProperties();
- Map<String, Object> expected = new HashMap<String, Object>();
+ Map<String, Object> expected = new HashMap<>();
expected.put("jcr:createdBy", "admin");
expected.put("jcr:lastModifiedBy", "author");
Modified: sling/trunk/tooling/ide/impl-resource/src/org/apache/sling/ide/impl/resource/filer/SimpleFilter.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/impl-resource/src/org/apache/sling/ide/impl/resource/filer/SimpleFilter.java?rev=1706960&r1=1706959&r2=1706960&view=diff
==============================================================================
--- sling/trunk/tooling/ide/impl-resource/src/org/apache/sling/ide/impl/resource/filer/SimpleFilter.java (original)
+++ sling/trunk/tooling/ide/impl-resource/src/org/apache/sling/ide/impl/resource/filer/SimpleFilter.java Tue Oct 6 07:53:54 2015
@@ -34,22 +34,17 @@ public class SimpleFilter implements Fil
if (relativeFilePath.isEmpty() || relativeFilePath.charAt(0) != '/') {
relativeFilePath = '/' + relativeFilePath;
}
- System.out.println("SimpleFilter.filter(" + relativeFilePath + ")");
if (includedPathPrefixes.isEmpty()) {
- System.out.println(" -- no path prefixes -> " + FilterResult.ALLOW);
return FilterResult.ALLOW;
}
for (String includePath : includedPathPrefixes) {
- System.out.println(" -- checking with " + includePath);
if (relativeFilePath.startsWith(includePath)) {
- System.out.println(" --- found match -> " + FilterResult.ALLOW);
return FilterResult.ALLOW;
}
}
- System.out.println(" -- no match " + FilterResult.DENY);
return FilterResult.DENY;
}
}
Modified: sling/trunk/tooling/ide/impl-resource/src/org/apache/sling/ide/impl/resource/filer/SimpleFilterLocator.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/impl-resource/src/org/apache/sling/ide/impl/resource/filer/SimpleFilterLocator.java?rev=1706960&r1=1706959&r2=1706960&view=diff
==============================================================================
--- sling/trunk/tooling/ide/impl-resource/src/org/apache/sling/ide/impl/resource/filer/SimpleFilterLocator.java (original)
+++ sling/trunk/tooling/ide/impl-resource/src/org/apache/sling/ide/impl/resource/filer/SimpleFilterLocator.java Tue Oct 6 07:53:54 2015
@@ -52,7 +52,7 @@ public class SimpleFilterLocator impleme
@Override
public Filter loadFilter(InputStream filterFileContents) throws IOException {
- List<String> filters = new ArrayList<String>();
+ List<String> filters = new ArrayList<>();
if (filterFileContents != null) {
BufferedReader reader = new BufferedReader(new InputStreamReader(filterFileContents));
String line;
Modified: sling/trunk/tooling/ide/impl-resource/src/org/apache/sling/ide/impl/resource/serialization/SimpleXmlSerializationManager.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/impl-resource/src/org/apache/sling/ide/impl/resource/serialization/SimpleXmlSerializationManager.java?rev=1706960&r1=1706959&r2=1706960&view=diff
==============================================================================
--- sling/trunk/tooling/ide/impl-resource/src/org/apache/sling/ide/impl/resource/serialization/SimpleXmlSerializationManager.java (original)
+++ sling/trunk/tooling/ide/impl-resource/src/org/apache/sling/ide/impl/resource/serialization/SimpleXmlSerializationManager.java Tue Oct 6 07:53:54 2015
@@ -94,10 +94,7 @@ public class SimpleXmlSerializationManag
saxParser.parse(new InputSource(source), h);
return new ResourceProxy(filePath, h.getResult());
- } catch (ParserConfigurationException e) {
- // TODO proper exception handling
- throw new RuntimeException(e);
- } catch (SAXException e) {
+ } catch (ParserConfigurationException | SAXException e) {
// TODO proper exception handling
throw new RuntimeException(e);
}
@@ -136,7 +133,7 @@ public class SimpleXmlSerializationManag
handler.setResult(sr);
handler.startDocument();
startElement(handler, TAG_RESOURCE);
- Set<Entry<String, Object>> entrySet = new TreeMap<String, Object>(content).entrySet();
+ Set<Entry<String, Object>> entrySet = new TreeMap<>(content).entrySet();
for (Map.Entry<String, Object> property : entrySet) {
Object value = property.getValue();
if (value instanceof String) {
@@ -159,13 +156,7 @@ public class SimpleXmlSerializationManag
// TODO - also add the serialization type
return new SerializationData(resource.getPath(), CONTENT_XML, result.toByteArray(), null);
- } catch (TransformerConfigurationException e) {
- // TODO proper exception handling
- throw new RuntimeException(e);
- } catch (TransformerFactoryConfigurationError e) {
- // TODO proper exception handling
- throw new RuntimeException(e);
- } catch (SAXException e) {
+ } catch (TransformerConfigurationException | TransformerFactoryConfigurationError | SAXException e) {
// TODO proper exception handling
throw new RuntimeException(e);
}
@@ -203,7 +194,7 @@ public class SimpleXmlSerializationManag
@Override
public void startDocument() throws SAXException {
- result = new HashMap<String, Object>();
+ result = new HashMap<>();
}
@Override
Modified: sling/trunk/tooling/ide/impl-resource/src/org/apache/sling/ide/impl/resource/transport/AbstractResult.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/impl-resource/src/org/apache/sling/ide/impl/resource/transport/AbstractResult.java?rev=1706960&r1=1706959&r2=1706960&view=diff
==============================================================================
--- sling/trunk/tooling/ide/impl-resource/src/org/apache/sling/ide/impl/resource/transport/AbstractResult.java (original)
+++ sling/trunk/tooling/ide/impl-resource/src/org/apache/sling/ide/impl/resource/transport/AbstractResult.java Tue Oct 6 07:53:54 2015
@@ -23,12 +23,12 @@ public class AbstractResult<T> implement
public static <T> Result<T> success(T payload) {
- return new AbstractResult<T>(true, payload, null);
+ return new AbstractResult<>(true, payload, null);
}
public static <T> Result<T> failure(RepositoryException e) {
- return new AbstractResult<T>(false, null, e);
+ return new AbstractResult<>(false, null, e);
}
private final boolean success;
Modified: sling/trunk/tooling/ide/impl-resource/src/org/apache/sling/ide/impl/resource/transport/RepositoryImpl.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/impl-resource/src/org/apache/sling/ide/impl/resource/transport/RepositoryImpl.java?rev=1706960&r1=1706959&r2=1706960&view=diff
==============================================================================
--- sling/trunk/tooling/ide/impl-resource/src/org/apache/sling/ide/impl/resource/transport/RepositoryImpl.java (original)
+++ sling/trunk/tooling/ide/impl-resource/src/org/apache/sling/ide/impl/resource/transport/RepositoryImpl.java Tue Oct 6 07:53:54 2015
@@ -40,7 +40,7 @@ public class RepositoryImpl implements R
}
private <T> Command<T> wrap(AbstractCommand<T> command) {
- return new TracingCommand<T>(command, eventAdmin);
+ return new TracingCommand<>(command, eventAdmin);
}
@Override
Modified: sling/trunk/tooling/ide/impl-resource/src/org/apache/sling/ide/impl/resource/transport/UpdateContentCommand.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/impl-resource/src/org/apache/sling/ide/impl/resource/transport/UpdateContentCommand.java?rev=1706960&r1=1706959&r2=1706960&view=diff
==============================================================================
--- sling/trunk/tooling/ide/impl-resource/src/org/apache/sling/ide/impl/resource/transport/UpdateContentCommand.java (original)
+++ sling/trunk/tooling/ide/impl-resource/src/org/apache/sling/ide/impl/resource/transport/UpdateContentCommand.java Tue Oct 6 07:53:54 2015
@@ -51,7 +51,7 @@ class UpdateContentCommand extends Abstr
public Result<Void> execute() {
PostMethod post = new PostMethod(getPath());
try{
- List<Part> parts = new ArrayList<Part>();
+ List<Part> parts = new ArrayList<>();
for (Map.Entry<String, Object> property : properties.entrySet()) {
if (ProtectedNodes.exists(property.getKey())) {
continue;
Modified: sling/trunk/tooling/ide/impl-vlt-test/src/test/java/org/apache/sling/ide/impl/vlt/AddOrUpdateNodeCommandTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/impl-vlt-test/src/test/java/org/apache/sling/ide/impl/vlt/AddOrUpdateNodeCommandTest.java?rev=1706960&r1=1706959&r2=1706960&view=diff
==============================================================================
--- sling/trunk/tooling/ide/impl-vlt-test/src/test/java/org/apache/sling/ide/impl/vlt/AddOrUpdateNodeCommandTest.java (original)
+++ sling/trunk/tooling/ide/impl-vlt-test/src/test/java/org/apache/sling/ide/impl/vlt/AddOrUpdateNodeCommandTest.java Tue Oct 6 07:53:54 2015
@@ -428,15 +428,11 @@ public class AddOrUpdateNodeCommandTest
private void importNodeTypeDefinitions(Session session, String cndFile) throws InvalidNodeTypeDefinitionException,
NodeTypeExistsException, UnsupportedRepositoryOperationException, ParseException, RepositoryException,
IOException {
- InputStream cndInput = null;
- try {
- cndInput = getClass().getResourceAsStream(cndFile);
+ try ( InputStream cndInput = getClass().getResourceAsStream(cndFile) ) {
if (cndInput == null) {
throw new IllegalArgumentException("Unable to read classpath resource " + cndFile);
}
CndImporter.registerNodeTypes(new InputStreamReader(cndInput), session);
- } finally {
- IOUtils.closeQuietly(cndInput);
}
}
Modified: sling/trunk/tooling/ide/impl-vlt-test/src/test/java/org/apache/sling/ide/impl/vlt/ReorderChildNodesCommandTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/impl-vlt-test/src/test/java/org/apache/sling/ide/impl/vlt/ReorderChildNodesCommandTest.java?rev=1706960&r1=1706959&r2=1706960&view=diff
==============================================================================
--- sling/trunk/tooling/ide/impl-vlt-test/src/test/java/org/apache/sling/ide/impl/vlt/ReorderChildNodesCommandTest.java (original)
+++ sling/trunk/tooling/ide/impl-vlt-test/src/test/java/org/apache/sling/ide/impl/vlt/ReorderChildNodesCommandTest.java Tue Oct 6 07:53:54 2015
@@ -101,7 +101,7 @@ public class ReorderChildNodesCommandTes
session.refresh(false);
- finalOrder = new ArrayList<String>();
+ finalOrder = new ArrayList<>();
NodeIterator nodes = session.getNode("/content").getNodes();
while (nodes.hasNext()) {
Modified: sling/trunk/tooling/ide/impl-vlt-test/src/test/java/org/apache/sling/ide/impl/vlt/serialization/VltSerializationManagerTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/impl-vlt-test/src/test/java/org/apache/sling/ide/impl/vlt/serialization/VltSerializationManagerTest.java?rev=1706960&r1=1706959&r2=1706960&view=diff
==============================================================================
--- sling/trunk/tooling/ide/impl-vlt-test/src/test/java/org/apache/sling/ide/impl/vlt/serialization/VltSerializationManagerTest.java (original)
+++ sling/trunk/tooling/ide/impl-vlt-test/src/test/java/org/apache/sling/ide/impl/vlt/serialization/VltSerializationManagerTest.java Tue Oct 6 07:53:54 2015
@@ -80,13 +80,10 @@ public class VltSerializationManagerTest
public void getSerializationFilePath_FullCoverageAggerate() throws IOException {
File contentFile = trash.newFile("default.xml");
- InputStream in = getClass().getResourceAsStream("simple-content.xml");
- FileOutputStream out = new FileOutputStream(contentFile);
- try {
+
+ try (InputStream in = getClass().getResourceAsStream("simple-content.xml");
+ FileOutputStream out = new FileOutputStream(contentFile);) {
IOUtils.copy(in, out);
- } finally {
- IOUtils.closeQuietly(in);
- IOUtils.closeQuietly(out);
}
assertThat(serializationManager.getBaseResourcePath(contentFile.getAbsolutePath()),
@@ -97,13 +94,10 @@ public class VltSerializationManagerTest
public void getSerializationFilePath_XmlFile() throws IOException {
File contentFile = trash.newFile("file.xml");
- InputStream in = getClass().getResourceAsStream("file.xml");
- FileOutputStream out = new FileOutputStream(contentFile);
- try {
+
+ try (InputStream in = getClass().getResourceAsStream("file.xml");
+ FileOutputStream out = new FileOutputStream(contentFile)) {
IOUtils.copy(in, out);
- } finally {
- IOUtils.closeQuietly(in);
- IOUtils.closeQuietly(out);
}
assertThat(serializationManager.getBaseResourcePath(contentFile.getAbsolutePath()),
Modified: sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/Activator.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/Activator.java?rev=1706960&r1=1706959&r2=1706960&view=diff
==============================================================================
--- sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/Activator.java (original)
+++ sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/Activator.java Tue Oct 6 07:53:54 2015
@@ -53,7 +53,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/impl-vlt/src/org/apache/sling/ide/impl/vlt/AddOrUpdateNodeCommand.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/AddOrUpdateNodeCommand.java?rev=1706960&r1=1706959&r2=1706960&view=diff
==============================================================================
--- sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/AddOrUpdateNodeCommand.java (original)
+++ sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/AddOrUpdateNodeCommand.java Tue Oct 6 07:53:54 2015
@@ -125,8 +125,7 @@ public class AddOrUpdateNodeCommand exte
return;
}
- Map<String, ResourceProxy> resourceChildrenPaths = new HashMap<String, ResourceProxy>(
- resourceChildren.size());
+ Map<String, ResourceProxy> resourceChildrenPaths = new HashMap<>(resourceChildren.size());
for (ResourceProxy child : resourceChildren) {
resourceChildrenPaths.put(child.getPath(), child);
}
@@ -184,7 +183,7 @@ public class AddOrUpdateNodeCommand exte
updateFileLikeNodeTypes(node);
}
- Set<String> propertiesToRemove = new HashSet<String>();
+ Set<String> propertiesToRemove = new HashSet<>();
PropertyIterator properties = node.getProperties();
while (properties.hasNext()) {
Property property = properties.nextProperty();
@@ -330,7 +329,7 @@ public class AddOrUpdateNodeCommand exte
private void updateMixins(Node node, Object mixinValue) throws RepositoryException {
- List<String> newMixins = new ArrayList<String>();
+ List<String> newMixins = new ArrayList<>();
if (mixinValue instanceof String) {
newMixins.add((String) mixinValue);
@@ -338,14 +337,14 @@ public class AddOrUpdateNodeCommand exte
newMixins.addAll(Arrays.asList((String[]) mixinValue));
}
- List<String> oldMixins = new ArrayList<String>();
+ List<String> oldMixins = new ArrayList<>();
for (NodeType mixinNT : node.getMixinNodeTypes()) {
oldMixins.add(mixinNT.getName());
}
- List<String> mixinsToAdd = new ArrayList<String>(newMixins);
+ List<String> mixinsToAdd = new ArrayList<>(newMixins);
mixinsToAdd.removeAll(oldMixins);
- List<String> mixinsToRemove = new ArrayList<String>(oldMixins);
+ List<String> mixinsToRemove = new ArrayList<>(oldMixins);
mixinsToRemove.removeAll(newMixins);
for (String mixinToAdd : mixinsToAdd) {
@@ -384,20 +383,13 @@ public class AddOrUpdateNodeCommand exte
getLogger().trace("Updating {0} property on node at {1} ", JCR_DATA, contentNode.getPath());
- FileInputStream inputStream = new FileInputStream(file);
- try {
+
+ try (FileInputStream inputStream = new FileInputStream(file)) {
Binary binary = node.getSession().getValueFactory().createBinary(inputStream);
contentNode.setProperty(JCR_DATA, binary);
// TODO: might have to be done differently since the client and server's clocks can differ
// and the last_modified should maybe be taken from the server's time..
contentNode.setProperty(JCR_LASTMODIFIED, Calendar.getInstance());
-
- } finally {
- try {
- inputStream.close();
- } catch (IOException e) {
- // don't care
- }
}
}
Modified: sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/JcrResult.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/JcrResult.java?rev=1706960&r1=1706959&r2=1706960&view=diff
==============================================================================
--- sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/JcrResult.java (original)
+++ sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/JcrResult.java Tue Oct 6 07:53:54 2015
@@ -24,13 +24,13 @@ public class JcrResult<T> implements Res
public static <T> JcrResult<T> success(T payload) {
- return new JcrResult<T>(true, payload, null);
+ return new JcrResult<>(true, payload, null);
}
public static <T> JcrResult<T> failure(Throwable t) {
- return new JcrResult<T>(false, null, new RepositoryException(t));
+ return new JcrResult<>(false, null, new RepositoryException(t));
}
private final boolean success;
Modified: sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/ListTreeCommand.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/ListTreeCommand.java?rev=1706960&r1=1706959&r2=1706960&view=diff
==============================================================================
--- sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/ListTreeCommand.java (original)
+++ sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/ListTreeCommand.java Tue Oct 6 07:53:54 2015
@@ -83,7 +83,7 @@ public class ListTreeCommand extends Jcr
}
private void log(String text, long start, long end) {
- Map<String, Object> props = new HashMap<String, Object>();
+ Map<String, Object> props = new HashMap<>();
props.put(CommandExecutionProperties.RESULT_TEXT, text);
props.put(CommandExecutionProperties.RESULT_STATUS, Boolean.TRUE);
props.put(CommandExecutionProperties.ACTION_TYPE, getClass().getSimpleName());
Modified: sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/ReorderChildNodesCommand.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/ReorderChildNodesCommand.java?rev=1706960&r1=1706959&r2=1706960&view=diff
==============================================================================
--- sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/ReorderChildNodesCommand.java (original)
+++ sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/ReorderChildNodesCommand.java Tue Oct 6 07:53:54 2015
@@ -81,10 +81,10 @@ public class ReorderChildNodesCommand ex
return;
}
- Set<String> resourceChildNames = new HashSet<String>(children.size());
- Set<String> nodeChildNames = new HashSet<String>(children.size());
+ Set<String> resourceChildNames = new HashSet<>(children.size());
+ Set<String> nodeChildNames = new HashSet<>(children.size());
- List<Node> nodeChildren = new LinkedList<Node>();
+ List<Node> nodeChildren = new LinkedList<>();
NodeIterator nodeChildrenIt = nodeToReorder.getNodes();
while (nodeChildrenIt.hasNext()) {
Node node = nodeChildrenIt.nextNode();
Modified: sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/VltNodeType.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/VltNodeType.java?rev=1706960&r1=1706959&r2=1706960&view=diff
==============================================================================
--- sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/VltNodeType.java (original)
+++ sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/VltNodeType.java Tue Oct 6 07:53:54 2015
@@ -19,7 +19,6 @@ package org.apache.sling.ide.impl.vlt;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
-import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
@@ -48,7 +47,7 @@ public class VltNodeType implements Node
private PropertyDefinition[] propertyDefinitions;
private NodeType[] superTypes;
- private Set<VltNodeType> directChildTypes = new HashSet<VltNodeType>();
+ private Set<VltNodeType> directChildTypes = new HashSet<>();
private Set<String> allowedChildNodeTypes;
private ResourceProxy resourceProxy;
@@ -69,10 +68,9 @@ public class VltNodeType implements Node
}
Set<VltNodeType> getAllKnownChildTypes() {
- Set<VltNodeType> allKnownCTs = new HashSet<VltNodeType>();
+ Set<VltNodeType> allKnownCTs = new HashSet<>();
allKnownCTs.add(this);
- for (Iterator<VltNodeType> it = directChildTypes.iterator(); it.hasNext();) {
- VltNodeType simpleVltNodeType = it.next();
+ for (VltNodeType simpleVltNodeType : directChildTypes) {
allKnownCTs.addAll(simpleVltNodeType.getAllKnownChildTypes());
}
return allKnownCTs;
@@ -209,7 +207,7 @@ public class VltNodeType implements Node
@Override
public NodeDefinition[] getChildNodeDefinitions() {
- List<NodeDefinition> childNodeDefs = new LinkedList<NodeDefinition>();
+ List<NodeDefinition> childNodeDefs = new LinkedList<>();
childNodeDefs.addAll(Arrays.asList(getDeclaredChildNodeDefinitions()));
NodeType[] supers = getSupertypes();
if (supers!=null) {
Modified: sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/VltNodeTypeFactory.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/VltNodeTypeFactory.java?rev=1706960&r1=1706959&r2=1706960&view=diff
==============================================================================
--- sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/VltNodeTypeFactory.java (original)
+++ sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/VltNodeTypeFactory.java Tue Oct 6 07:53:54 2015
@@ -35,7 +35,7 @@ import org.apache.sling.ide.util.PathUti
public class VltNodeTypeFactory {
- private Map<String,VltNodeType> nodeTypes = new HashMap<String, VltNodeType>();
+ private Map<String,VltNodeType> nodeTypes = new HashMap<>();
Map<String, VltNodeType> getNodeTypes() {
return nodeTypes;
@@ -54,8 +54,7 @@ public class VltNodeTypeFactory {
nodeTypes.put(nt.getName(), nt);
}
// phase 2: init declared fields
- for (Iterator<VltNodeType> it = nodeTypes.values().iterator(); it.hasNext();) {
- VltNodeType nt = it.next();
+ for (VltNodeType nt : nodeTypes.values()) {
initDeclaredFields(nt);
}
@@ -65,22 +64,19 @@ public class VltNodeTypeFactory {
// phase 2: initialize the dependency tree (eg superTypes)
// - this is a separate phase to make sure, all VltNodeType objects have been created (above)
// hence initTypeDependencyTree can assume all nodetypes exist
- for (Iterator<VltNodeType> it = nodeTypes.values().iterator(); it.hasNext();) {
- VltNodeType nt = it.next();
+ for (VltNodeType nt : nodeTypes.values()) {
initTypeDependencyTree(nt);
}
// phase 3: init property definitions
- for (Iterator<VltNodeType> it = nodeTypes.values().iterator(); it.hasNext();) {
- VltNodeType nt = it.next();
+ for (VltNodeType nt : nodeTypes.values()) {
final ResourceProxy child = nt.getResourceProxy();
initPropertyDefinitions(nt);
initProperties(nt, child);
}
// phase 4: initialize the allowed primary childnodetypes
- for (Iterator<VltNodeType> it = nodeTypes.values().iterator(); it.hasNext();) {
- VltNodeType nt = it.next();
+ for (VltNodeType nt : nodeTypes.values()) {
initAllowedPrimaryChildNodeTypes(nt);
}
}
@@ -98,26 +94,19 @@ public class VltNodeTypeFactory {
nt.setDeclaredSupertypes(superTypes);
}
- Set<VltNodeDefinition> nds = new HashSet<VltNodeDefinition>();
- for (Iterator<ResourceProxy> it = child.getChildren().iterator(); it
- .hasNext();) {
- ResourceProxy ntChild = it.next();
+ Set<VltNodeDefinition> nds = new HashSet<>();
+ for (ResourceProxy ntChild : child.getChildren()) {
String ntChildName = PathUtil.getName(ntChild.getPath());
if (ntChildName.startsWith("jcr:childNodeDefinition")) {
VltNodeDefinition nd = handleChildNodeDefinition(ntChild);
nds.add(nd);
} else if (ntChildName.startsWith("rep:residualChildNodeDefinitions")) {
// go through children
- List<ResourceProxy> residualChildren = ntChild.getChildren();
- for (Iterator it2 = residualChildren.iterator(); it2
- .hasNext();) {
- ResourceProxy residualChild = (ResourceProxy) it2
- .next();
- VltNodeDefinition nd = handleChildNodeDefinition(residualChild);
- nds.add(nd);
+ for (ResourceProxy residualChild : ntChild.getChildren()) {
+ nds.add(handleChildNodeDefinition(residualChild));
}
}
- }
+ }
nt.setDeclaredChildNodeDefinitions(nds.toArray(new NodeDefinition[0]));
initDeclaredPropertyDefinitions(nt, child);
}
@@ -130,11 +119,10 @@ public class VltNodeTypeFactory {
}
private void initDeclaredPropertyDefinitions(VltNodeType nt, ResourceProxy child) {
- Map<String,VltPropertyDefinition> pds = new HashMap<String,VltPropertyDefinition>();
+ Map<String,VltPropertyDefinition> pds = new HashMap<>();
// load propertyDefinition children
- for (Iterator<ResourceProxy> it = child.getChildren().iterator(); it.hasNext();) {
- ResourceProxy aChild = it.next();
+ for (ResourceProxy aChild : child.getChildren()) {
String childName = PathUtil.getName(aChild.getPath());
if (childName.startsWith("jcr:propertyDefinition")) {
String jcrName = (String)aChild.getProperties().get("jcr:name");
@@ -235,7 +223,7 @@ public class VltNodeTypeFactory {
}
private void initPropertyDefinitions(VltNodeType nt) {
- Map<String,VltPropertyDefinition> pds = new HashMap<String,VltPropertyDefinition>();
+ Map<String,VltPropertyDefinition> pds = new HashMap<>();
PropertyDefinition[] declaredPds = nt.getDeclaredPropertyDefinitions();
if (declaredPds!=null) {
@@ -304,7 +292,7 @@ public class VltNodeTypeFactory {
return;
}
// collect all the supertype names
- Set<NodeType> allSuperTypes = new HashSet<NodeType>();
+ Set<NodeType> allSuperTypes = new HashSet<>();
initSuperTypes(allSuperTypes, nt);
nt.setSupertypes(allSuperTypes.toArray(new NodeType[0]));
}
@@ -324,7 +312,7 @@ public class VltNodeTypeFactory {
private void initAllowedPrimaryChildNodeTypes(VltNodeType nt0) throws RepositoryException {
NodeDefinition[] declaredCihldNodeDefinitions = nt0.getDeclaredChildNodeDefinitions();
- Set<String> allowedChildNodeTypes = new HashSet<String>();
+ Set<String> allowedChildNodeTypes = new HashSet<>();
if (declaredCihldNodeDefinitions!=null) {
for (int i = 0; i < declaredCihldNodeDefinitions.length; i++) {
NodeDefinition nodeDefinition = declaredCihldNodeDefinitions[i];
Modified: sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/VltNodeTypeRegistry.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/VltNodeTypeRegistry.java?rev=1706960&r1=1706959&r2=1706960&view=diff
==============================================================================
--- sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/VltNodeTypeRegistry.java (original)
+++ sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/VltNodeTypeRegistry.java Tue Oct 6 07:53:54 2015
@@ -32,7 +32,7 @@ import org.apache.sling.ide.transport.Re
public class VltNodeTypeRegistry implements NodeTypeRegistry {
- private Map<String,VltNodeType> nodeTypes = new HashMap<String, VltNodeType>();
+ private Map<String,VltNodeType> nodeTypes = new HashMap<>();
public VltNodeTypeRegistry(VltRepository repo) throws RepositoryException {
VltNodeTypeFactory factory = new VltNodeTypeFactory();
@@ -54,7 +54,7 @@ public class VltNodeTypeRegistry impleme
@Override
public List<NodeType> getNodeTypes() {
- List<NodeType> result = new LinkedList<NodeType>();
+ List<NodeType> result = new LinkedList<>();
for (Iterator<VltNodeType> it = nodeTypes.values().iterator(); it.hasNext();) {
VltNodeType nt = it.next();
result.add(nt);
Modified: sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/VltRepositoryFactory.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/VltRepositoryFactory.java?rev=1706960&r1=1706959&r2=1706960&view=diff
==============================================================================
--- sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/VltRepositoryFactory.java (original)
+++ sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/VltRepositoryFactory.java Tue Oct 6 07:53:54 2015
@@ -33,7 +33,7 @@ public class VltRepositoryFactory implem
private EventAdmin eventAdmin;
- private Map<String,VltRepository> repositoryMap = new HashMap<String,VltRepository>();
+ private Map<String,VltRepository> repositoryMap = new HashMap<>();
@Override
public Repository getRepository(RepositoryInfo repositoryInfo,
Modified: sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/serialization/ContentXmlHandler.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/serialization/ContentXmlHandler.java?rev=1706960&r1=1706959&r2=1706960&view=diff
==============================================================================
--- sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/serialization/ContentXmlHandler.java (original)
+++ sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/serialization/ContentXmlHandler.java Tue Oct 6 07:53:54 2015
@@ -37,7 +37,7 @@ public class ContentXmlHandler extends D
private static final String JCR_ROOT = "jcr:root";
private final ResourceProxy root;
- private final Deque<ResourceProxy> queue = new LinkedList<ResourceProxy>();
+ private final Deque<ResourceProxy> queue = new LinkedList<>();
public ContentXmlHandler(String rootResourcePath) {
root = new ResourceProxy(rootResourcePath);
@@ -263,7 +263,7 @@ public class ContentXmlHandler extends D
private static String[] splitValues(String rawValues) {
- List<String> values = new ArrayList<String>();
+ List<String> values = new ArrayList<>();
String[] firstPass = rawValues.split(",");
for ( int i = 0 ; i < firstPass.length; i++) {
Modified: sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/serialization/VltSerializationDataBuilder.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/serialization/VltSerializationDataBuilder.java?rev=1706960&r1=1706959&r2=1706960&view=diff
==============================================================================
--- sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/serialization/VltSerializationDataBuilder.java (original)
+++ sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/serialization/VltSerializationDataBuilder.java Tue Oct 6 07:53:54 2015
@@ -156,7 +156,7 @@ public class VltSerializationDataBuilder
private SerializationKind getSerializationKind(Aggregate aggregate) throws RepositoryException {
NodeType[] mixinNodeTypes = aggregate.getNode().getMixinNodeTypes();
- List<String> mixinNodeTypeNames = new ArrayList<String>(mixinNodeTypes.length);
+ List<String> mixinNodeTypeNames = new ArrayList<>(mixinNodeTypes.length);
for (NodeType nodeType : mixinNodeTypes)
mixinNodeTypeNames.add(nodeType.getName());
@@ -280,7 +280,7 @@ public class VltSerializationDataBuilder
if (parentFile != null) {
Aggregate parentAggregate = parentFile.getAggregate();
- ArrayList<Aggregate> parents = new ArrayList<Aggregate>();
+ ArrayList<Aggregate> parents = new ArrayList<>();
parents.add(parentAggregate);
List<Aggregate> chain = lookForAggregateInLeaves(resource, parentAggregate, parents);
if (chain != null) {