mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
+3
-3
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
package org.jetbrains.idea.maven.model;
|
||||
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.util.text.StringUtilRt;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -36,8 +36,8 @@ public class MavenArchetype implements Serializable {
|
||||
this.groupId = groupId;
|
||||
this.artifactId = artifactId;
|
||||
this.version = version;
|
||||
this.repository = StringUtil.isEmptyOrSpaces(repository) ? null : repository;
|
||||
this.description = StringUtil.isEmptyOrSpaces(description) ? null : description;
|
||||
this.repository = StringUtilRt.isEmptyOrSpaces(repository) ? null : repository;
|
||||
this.description = StringUtilRt.isEmptyOrSpaces(description) ? null : description;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+13
-13
@@ -17,8 +17,8 @@
|
||||
package org.jetbrains.idea.maven.model;
|
||||
|
||||
import com.intellij.openapi.util.Comparing;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.util.io.FileUtilRt;
|
||||
import com.intellij.openapi.util.text.StringUtilRt;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -151,7 +151,7 @@ public class MavenArtifact implements Serializable, MavenCoordinate {
|
||||
}
|
||||
|
||||
public String getPath() {
|
||||
return FileUtil.toSystemIndependentName(myFile.getPath());
|
||||
return FileUtilRt.toSystemIndependentName(myFile.getPath());
|
||||
}
|
||||
|
||||
public String getRelativePath() {
|
||||
@@ -196,7 +196,7 @@ public class MavenArtifact implements Serializable, MavenCoordinate {
|
||||
|
||||
@Nullable
|
||||
public String getFullClassifier(@Nullable String extraClassifier) {
|
||||
if (StringUtil.isEmptyOrSpaces(extraClassifier)) {
|
||||
if (StringUtilRt.isEmptyOrSpaces(extraClassifier)) {
|
||||
return myClassifier;
|
||||
}
|
||||
|
||||
@@ -204,10 +204,10 @@ public class MavenArtifact implements Serializable, MavenCoordinate {
|
||||
if (MavenConstants.TYPE_TEST_JAR.equals(myType) || "tests".equals(myClassifier)) {
|
||||
result += "test";
|
||||
}
|
||||
if (!StringUtil.isEmptyOrSpaces(extraClassifier)) {
|
||||
if (!StringUtilRt.isEmptyOrSpaces(extraClassifier)) {
|
||||
result += (!result.isEmpty() ? "-" + extraClassifier : extraClassifier);
|
||||
}
|
||||
return StringUtil.isEmptyOrSpaces(result) ? null : result;
|
||||
return StringUtilRt.isEmptyOrSpaces(result) ? null : result;
|
||||
}
|
||||
|
||||
public String getPathForExtraArtifact(@Nullable String extraArtifactClassifier, @Nullable String customExtension) {
|
||||
@@ -276,7 +276,7 @@ public class MavenArtifact implements Serializable, MavenCoordinate {
|
||||
MavenId.append(builder, myGroupId);
|
||||
MavenId.append(builder, myArtifactId);
|
||||
MavenId.append(builder, myType);
|
||||
if (!StringUtil.isEmptyOrSpaces(myClassifier)) MavenId.append(builder, myClassifier);
|
||||
if (!StringUtilRt.isEmptyOrSpaces(myClassifier)) MavenId.append(builder, myClassifier);
|
||||
MavenId.append(builder, myVersion);
|
||||
|
||||
return builder.toString();
|
||||
@@ -288,9 +288,9 @@ public class MavenArtifact implements Serializable, MavenCoordinate {
|
||||
MavenId.append(builder, myGroupId);
|
||||
MavenId.append(builder, myArtifactId);
|
||||
MavenId.append(builder, myType);
|
||||
if (!StringUtil.isEmptyOrSpaces(myClassifier)) MavenId.append(builder, myClassifier);
|
||||
if (!StringUtilRt.isEmptyOrSpaces(myClassifier)) MavenId.append(builder, myClassifier);
|
||||
MavenId.append(builder, myVersion);
|
||||
if (!StringUtil.isEmptyOrSpaces(myScope)) MavenId.append(builder, myScope);
|
||||
if (!StringUtilRt.isEmptyOrSpaces(myScope)) MavenId.append(builder, myScope);
|
||||
|
||||
return builder.toString();
|
||||
}
|
||||
@@ -303,11 +303,11 @@ public class MavenArtifact implements Serializable, MavenCoordinate {
|
||||
MavenId.append(builder, myGroupId);
|
||||
MavenId.append(builder, myArtifactId);
|
||||
|
||||
if (!StringUtil.isEmptyOrSpaces(myType) && !MavenConstants.TYPE_JAR.equals(myType)) MavenId.append(builder, myType);
|
||||
if (!StringUtil.isEmptyOrSpaces(myClassifier)) MavenId.append(builder, myClassifier);
|
||||
if (!StringUtilRt.isEmptyOrSpaces(myType) && !MavenConstants.TYPE_JAR.equals(myType)) MavenId.append(builder, myType);
|
||||
if (!StringUtilRt.isEmptyOrSpaces(myClassifier)) MavenId.append(builder, myClassifier);
|
||||
|
||||
String version = !StringUtil.isEmptyOrSpaces(myBaseVersion) ? myBaseVersion : myVersion;
|
||||
if (!StringUtil.isEmptyOrSpaces(version)) MavenId.append(builder, version);
|
||||
String version = !StringUtilRt.isEmptyOrSpaces(myBaseVersion) ? myBaseVersion : myVersion;
|
||||
if (!StringUtilRt.isEmptyOrSpaces(version)) MavenId.append(builder, version);
|
||||
|
||||
builder.insert(0, MAVEN_LIB_PREFIX);
|
||||
|
||||
|
||||
+2
-2
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
package org.jetbrains.idea.maven.model;
|
||||
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.util.text.StringUtilRt;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@@ -93,7 +93,7 @@ public class MavenArtifactInfo implements Serializable {
|
||||
MavenId.append(builder, myGroupId);
|
||||
MavenId.append(builder, myArtifactId);
|
||||
MavenId.append(builder, myPackaging);
|
||||
if (!StringUtil.isEmptyOrSpaces(myClassifier)) MavenId.append(builder, myClassifier);
|
||||
if (!StringUtilRt.isEmptyOrSpaces(myClassifier)) MavenId.append(builder, myClassifier);
|
||||
MavenId.append(builder, myVersion);
|
||||
MavenId.append(builder, myRepositoryId);
|
||||
|
||||
|
||||
+2
-2
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
package org.jetbrains.idea.maven.model;
|
||||
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.util.text.StringUtilRt;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.io.Serializable;
|
||||
@@ -104,7 +104,7 @@ public class MavenArtifactNode implements Serializable {
|
||||
}
|
||||
|
||||
public static String formatNodesList(List<MavenArtifactNode> nodes) {
|
||||
return StringUtil.join(nodes, StringUtil.createToStringFunction(MavenArtifactNode.class), ",");
|
||||
return StringUtilRt.join(nodes, StringUtilRt.createToStringFunction(), ",");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,107 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package org.jetbrains.idea.maven.model;
|
||||
|
||||
import com.intellij.openapi.util.Comparing;
|
||||
import com.intellij.openapi.util.text.StringUtilRt;
|
||||
import org.jdom.Attribute;
|
||||
import org.jdom.Content;
|
||||
import org.jdom.Element;
|
||||
import org.jdom.Text;
|
||||
import org.jdom.filter.Filter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Methods in this class are copied from {@link com.intellij.openapi.util.JDOMUtil} to avoid dependency on 'intellij.platform.util' module
|
||||
* in Maven server classes.
|
||||
*
|
||||
* @author nik
|
||||
*/
|
||||
class MavenJDOMUtil {
|
||||
public static boolean areElementsEqual(@Nullable Element e1, @Nullable Element e2) {
|
||||
if (e1 == null && e2 == null) return true;
|
||||
if (e1 == null || e2 == null) return false;
|
||||
|
||||
return Comparing.equal(e1.getName(), e2.getName())
|
||||
&& isAttributesEqual(e1.getAttributes(), e2.getAttributes())
|
||||
&& contentListsEqual(e1.getContent(CONTENT_FILTER), e2.getContent(CONTENT_FILTER));
|
||||
}
|
||||
private static boolean contentListsEqual(final List c1, final List c2) {
|
||||
if (c1 == null && c2 == null) return true;
|
||||
if (c1 == null || c2 == null) return false;
|
||||
|
||||
Iterator l1 = c1.listIterator();
|
||||
Iterator l2 = c2.listIterator();
|
||||
while (l1.hasNext() && l2.hasNext()) {
|
||||
if (!contentsEqual((Content)l1.next(), (Content)l2.next())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return l1.hasNext() == l2.hasNext();
|
||||
}
|
||||
|
||||
private static boolean contentsEqual(Content c1, Content c2) {
|
||||
if (!(c1 instanceof Element) && !(c2 instanceof Element)) {
|
||||
return c1.getValue().equals(c2.getValue());
|
||||
}
|
||||
|
||||
return c1 instanceof Element && c2 instanceof Element && areElementsEqual((Element)c1, (Element)c2);
|
||||
}
|
||||
|
||||
private static boolean isAttributesEqual(@NotNull List<Attribute> l1, @NotNull List<Attribute> l2) {
|
||||
if (l1.size() != l2.size()) return false;
|
||||
for (int i = 0; i < l1.size(); i++) {
|
||||
if (!attEqual(l1.get(i), l2.get(i))) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private static boolean attEqual(@NotNull Attribute a1, @NotNull Attribute a2) {
|
||||
return a1.getName().equals(a2.getName()) && a1.getValue().equals(a2.getValue());
|
||||
}
|
||||
|
||||
|
||||
private static final EmptyTextFilter CONTENT_FILTER = new EmptyTextFilter();
|
||||
|
||||
|
||||
public static int getTreeHash(@NotNull Element root) {
|
||||
return addToHash(0, root);
|
||||
}
|
||||
|
||||
private static int addToHash(int i, @NotNull Element element) {
|
||||
i = addToHash(i, element.getName());
|
||||
|
||||
for (Attribute attribute : element.getAttributes()) {
|
||||
i = addToHash(i, attribute.getName());
|
||||
i = addToHash(i, attribute.getValue());
|
||||
}
|
||||
|
||||
for (Content child : element.getContent()) {
|
||||
if (child instanceof Element) {
|
||||
i = addToHash(i, (Element)child);
|
||||
}
|
||||
else if (child instanceof Text) {
|
||||
String text = ((Text)child).getText();
|
||||
if (!StringUtilRt.isEmptyOrSpaces((CharSequence)text)) {
|
||||
i = addToHash(i, text);
|
||||
}
|
||||
}
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
private static int addToHash(int i, @NotNull String s) {
|
||||
return i * 31 + s.hashCode();
|
||||
}
|
||||
|
||||
private static class EmptyTextFilter implements Filter {
|
||||
@Override
|
||||
public boolean matches(Object obj) {
|
||||
return !(obj instanceof Text) || !StringUtilRt.isEmptyOrSpaces(((Text)obj).getText());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
package org.jetbrains.idea.maven.model;
|
||||
|
||||
import com.intellij.openapi.util.JDOMUtil;
|
||||
import org.jdom.Element;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -147,7 +146,7 @@ public class MavenPlugin implements Serializable {
|
||||
if (myGroupId != null ? !myGroupId.equals(that.myGroupId) : that.myGroupId != null) return false;
|
||||
if (myArtifactId != null ? !myArtifactId.equals(that.myArtifactId) : that.myArtifactId != null) return false;
|
||||
if (myVersion != null ? !myVersion.equals(that.myVersion) : that.myVersion != null) return false;
|
||||
if (!JDOMUtil.areElementsEqual(myConfiguration, that.myConfiguration)) return false;
|
||||
if (!MavenJDOMUtil.areElementsEqual(myConfiguration, that.myConfiguration)) return false;
|
||||
if (myExecutions != null ? !myExecutions.equals(that.myExecutions) : that.myExecutions != null) return false;
|
||||
if (myDependencies != null ? !myDependencies.equals(that.myDependencies) : that.myDependencies != null) return false;
|
||||
|
||||
@@ -161,7 +160,7 @@ public class MavenPlugin implements Serializable {
|
||||
result = 31 * result + (myGroupId != null ? myGroupId.hashCode() : 0);
|
||||
result = 31 * result + (myArtifactId != null ? myArtifactId.hashCode() : 0);
|
||||
result = 31 * result + (myVersion != null ? myVersion.hashCode() : 0);
|
||||
result = 31 * result + (myConfiguration != null ? JDOMUtil.getTreeHash(myConfiguration) : 0);
|
||||
result = 31 * result + (myConfiguration != null ? MavenJDOMUtil.getTreeHash(myConfiguration) : 0);
|
||||
result = 31 * result + (myExecutions != null ? myExecutions.hashCode() : 0);
|
||||
result = 31 * result + (myDependencies != null ? myDependencies.hashCode() : 0);
|
||||
return result;
|
||||
@@ -211,7 +210,7 @@ public class MavenPlugin implements Serializable {
|
||||
if (!myGoals.equals(that.myGoals)) return false;
|
||||
if (myExecutionId != null ? !myExecutionId.equals(that.myExecutionId) : that.myExecutionId != null) return false;
|
||||
if (myPhase != null ? !myPhase.equals(that.myPhase) : that.myPhase != null) return false;
|
||||
if (!JDOMUtil.areElementsEqual(myConfiguration, that.myConfiguration)) return false;
|
||||
if (!MavenJDOMUtil.areElementsEqual(myConfiguration, that.myConfiguration)) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
+2
-2
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
package org.jetbrains.idea.maven.server.embedder;
|
||||
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.util.io.FileUtilRt;
|
||||
import gnu.trove.THashMap;
|
||||
import org.apache.maven.artifact.Artifact;
|
||||
import org.apache.maven.artifact.handler.ArtifactHandler;
|
||||
@@ -119,7 +119,7 @@ public class CustomArtifact implements Artifact {
|
||||
return;
|
||||
}
|
||||
|
||||
f = FileUtil.createTempFile("idea.maven.stub", ".pom");
|
||||
f = FileUtilRt.createTempFile("idea.maven.stub", ".pom");
|
||||
f.deleteOnExit();
|
||||
|
||||
FileOutputStream s = new FileOutputStream(f);
|
||||
|
||||
+7
-7
@@ -17,10 +17,10 @@ package org.jetbrains.idea.maven.server.embedder;
|
||||
|
||||
import com.intellij.openapi.progress.ProcessCanceledException;
|
||||
import com.intellij.openapi.util.Ref;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.util.ExceptionUtil;
|
||||
import com.intellij.openapi.util.text.StringUtilRt;
|
||||
import com.intellij.util.ExceptionUtilRt;
|
||||
import com.intellij.util.Function;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.containers.ContainerUtilRt;
|
||||
import gnu.trove.THashMap;
|
||||
import gnu.trove.THashSet;
|
||||
import org.apache.maven.artifact.Artifact;
|
||||
@@ -100,7 +100,7 @@ public class Maven2ServerEmbedderImpl extends MavenRemoteObject implements Maven
|
||||
List<String> commandLineOptions = new ArrayList<String>();
|
||||
String mavenEmbedderCliOptions = System.getProperty(MavenServerEmbedder.MAVEN_EMBEDDER_CLI_ADDITIONAL_ARGS);
|
||||
if (mavenEmbedderCliOptions != null) {
|
||||
commandLineOptions.addAll(StringUtil.splitHonorQuotes(mavenEmbedderCliOptions, ' '));
|
||||
commandLineOptions.addAll(StringUtilRt.splitHonorQuotes(mavenEmbedderCliOptions, ' '));
|
||||
}
|
||||
|
||||
settings.setConfigurator(new PlexusComponentConfigurator() {
|
||||
@@ -295,7 +295,7 @@ public class Maven2ServerEmbedderImpl extends MavenRemoteObject implements Maven
|
||||
@NotNull final Collection<String> inactiveProfiles)
|
||||
throws MavenServerProcessCanceledException, RemoteException {
|
||||
|
||||
return ContainerUtil.mapNotNull(files, new Function<File, MavenServerExecutionResult>() {
|
||||
return ContainerUtilRt.mapNotNull(files, new Function<File, MavenServerExecutionResult>() {
|
||||
@Override
|
||||
public MavenServerExecutionResult fun(final File file) {
|
||||
try {
|
||||
@@ -311,10 +311,10 @@ public class Maven2ServerEmbedderImpl extends MavenRemoteObject implements Maven
|
||||
});
|
||||
}
|
||||
catch (MavenServerProcessCanceledException e) {
|
||||
ExceptionUtil.rethrowAllAsUnchecked(e);
|
||||
ExceptionUtilRt.rethrowAllAsUnchecked(e);
|
||||
}
|
||||
catch (RemoteException e) {
|
||||
ExceptionUtil.rethrowAllAsUnchecked(e);
|
||||
ExceptionUtilRt.rethrowAllAsUnchecked(e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
+2
-2
@@ -17,7 +17,7 @@ package org.jetbrains.idea.maven.server.embedder;
|
||||
|
||||
import com.intellij.openapi.progress.ProcessCanceledException;
|
||||
import com.intellij.openapi.util.ShutDownTracker;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.util.text.StringUtilRt;
|
||||
import gnu.trove.THashSet;
|
||||
import gnu.trove.TIntObjectHashMap;
|
||||
import org.apache.lucene.document.Document;
|
||||
@@ -220,7 +220,7 @@ public class Maven2ServerIndexerImpl extends MavenRemoteObject implements MavenS
|
||||
Document doc = r.document(i);
|
||||
String uinfo = doc.get(ArtifactInfo.UINFO);
|
||||
if (uinfo == null) continue;
|
||||
List<String> uInfoParts = StringUtil.split(uinfo, ArtifactInfo.FS);
|
||||
List<String> uInfoParts = StringUtilRt.split(uinfo, ArtifactInfo.FS);
|
||||
String groupId = uInfoParts.get(0);
|
||||
String artifactId = uInfoParts.get(1);
|
||||
String version = uInfoParts.get(2);
|
||||
|
||||
+5
-5
@@ -16,8 +16,7 @@
|
||||
package org.jetbrains.idea.maven.server.embedder;
|
||||
|
||||
import com.intellij.openapi.progress.ProcessCanceledException;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.openapi.util.text.StringUtilRt;
|
||||
import org.apache.maven.wagon.events.TransferEvent;
|
||||
import org.apache.maven.wagon.events.TransferListener;
|
||||
import org.jetbrains.idea.maven.server.Maven2ServerGlobals;
|
||||
@@ -27,10 +26,11 @@ import org.jetbrains.idea.maven.server.MavenServerProgressIndicator;
|
||||
import java.rmi.RemoteException;
|
||||
import java.text.MessageFormat;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
public class TransferListenerAdapter implements TransferListener {
|
||||
protected final MavenServerProgressIndicator myIndicator;
|
||||
private final Map<String, DownloadData> myDownloads = ContainerUtil.newConcurrentMap();
|
||||
private final Map<String, DownloadData> myDownloads = new ConcurrentHashMap<String, DownloadData>();
|
||||
|
||||
public TransferListenerAdapter(MavenServerProgressIndicator indicator) {
|
||||
myIndicator = indicator;
|
||||
@@ -111,9 +111,9 @@ public class TransferListenerAdapter implements TransferListener {
|
||||
|
||||
String sizeInfo;
|
||||
if (data.finished || data.failed || data.total <= 0) {
|
||||
sizeInfo = StringUtil.formatFileSize(data.downloaded);
|
||||
sizeInfo = StringUtilRt.formatFileSize(data.downloaded);
|
||||
} else {
|
||||
sizeInfo = ((int)100f * data.downloaded / data.total) + "% of " + StringUtil.formatFileSize(data.total);
|
||||
sizeInfo = ((int)100f * data.downloaded / data.total) + "% of " + StringUtilRt.formatFileSize(data.total);
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
+10
-11
@@ -16,11 +16,10 @@
|
||||
package org.jetbrains.idea.maven.server;
|
||||
|
||||
import com.intellij.openapi.util.io.StreamUtil;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.vfs.CharsetToolkit;
|
||||
import com.intellij.openapi.util.text.StringUtilRt;
|
||||
import com.intellij.util.Function;
|
||||
import com.intellij.util.SmartList;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.containers.ContainerUtilRt;
|
||||
import com.intellij.util.execution.ParametersListUtil;
|
||||
import org.apache.log4j.BasicConfigurator;
|
||||
import org.apache.log4j.Level;
|
||||
@@ -122,12 +121,12 @@ public abstract class Maven3ServerEmbedder extends MavenRemoteObject implements
|
||||
artifact,
|
||||
getLocalRepository(),
|
||||
convertRepositories(remoteRepositories));
|
||||
return ContainerUtil.map(versions, new Function<ArtifactVersion, String>() {
|
||||
@Override
|
||||
public String fun(ArtifactVersion version) {
|
||||
return version.toString();
|
||||
}
|
||||
});
|
||||
return ContainerUtilRt.map2List(versions, new Function<ArtifactVersion, String>() {
|
||||
@Override
|
||||
public String fun(ArtifactVersion version) {
|
||||
return version.toString();
|
||||
}
|
||||
});
|
||||
}
|
||||
catch (Exception e) {
|
||||
Maven3ServerGlobals.getLogger().info(e);
|
||||
@@ -297,10 +296,10 @@ public abstract class Maven3ServerEmbedder extends MavenRemoteObject implements
|
||||
try {
|
||||
InputStream in = new FileInputStream(configFile);
|
||||
try {
|
||||
for (String parameter : ParametersListUtil.parse(StreamUtil.readText(in, CharsetToolkit.UTF8))) {
|
||||
for (String parameter : ParametersListUtil.parse(StreamUtil.readText(in, "UTF-8"))) {
|
||||
Matcher matcher = PROPERTY_PATTERN.matcher(parameter);
|
||||
if (matcher.matches()) {
|
||||
result.put(matcher.group(1), StringUtil.notNullize(matcher.group(2), ""));
|
||||
result.put(matcher.group(1), StringUtilRt.notNullize(matcher.group(2), ""));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -17,7 +17,7 @@ package org.jetbrains.idea.maven.server;
|
||||
|
||||
import com.intellij.openapi.progress.ProcessCanceledException;
|
||||
import com.intellij.openapi.util.ShutDownTracker;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.util.text.StringUtilRt;
|
||||
import gnu.trove.THashSet;
|
||||
import gnu.trove.TIntObjectHashMap;
|
||||
import org.apache.lucene.document.Document;
|
||||
@@ -240,7 +240,7 @@ public abstract class Maven3ServerIndexerImpl extends MavenRemoteObject implemen
|
||||
Document doc = r.document(i);
|
||||
String uinfo = doc.get(ArtifactInfo.UINFO);
|
||||
if (uinfo == null) continue;
|
||||
List<String> uInfoParts = StringUtil.split(uinfo, ArtifactInfoRecord.FS);
|
||||
List<String> uInfoParts = StringUtilRt.split(uinfo, ArtifactInfoRecord.FS);
|
||||
String groupId = uInfoParts.get(0);
|
||||
String artifactId = uInfoParts.get(1);
|
||||
String version = uInfoParts.get(2);
|
||||
|
||||
+5
-5
@@ -16,18 +16,18 @@
|
||||
package org.jetbrains.idea.maven.server;
|
||||
|
||||
import com.intellij.openapi.progress.ProcessCanceledException;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.openapi.util.text.StringUtilRt;
|
||||
import org.apache.maven.wagon.events.TransferEvent;
|
||||
import org.apache.maven.wagon.events.TransferListener;
|
||||
|
||||
import java.rmi.RemoteException;
|
||||
import java.text.MessageFormat;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
public class WagonTransferListenerAdapter implements TransferListener {
|
||||
protected final MavenServerProgressIndicator myIndicator;
|
||||
private final Map<String, DownloadData> myDownloads = ContainerUtil.newConcurrentMap();
|
||||
private final Map<String, DownloadData> myDownloads = new ConcurrentHashMap<String, DownloadData>();
|
||||
|
||||
public WagonTransferListenerAdapter(MavenServerProgressIndicator indicator) {
|
||||
myIndicator = indicator;
|
||||
@@ -107,9 +107,9 @@ public class WagonTransferListenerAdapter implements TransferListener {
|
||||
|
||||
String sizeInfo;
|
||||
if (data.finished || data.failed || data.total <= 0) {
|
||||
sizeInfo = StringUtil.formatFileSize(data.downloaded);
|
||||
sizeInfo = StringUtilRt.formatFileSize(data.downloaded);
|
||||
} else {
|
||||
sizeInfo = ((int)100f * data.downloaded / data.total) + "% of " + StringUtil.formatFileSize(data.total);
|
||||
sizeInfo = ((int)100f * data.downloaded / data.total) + "% of " + StringUtilRt.formatFileSize(data.total);
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
+2
-2
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
package org.jetbrains.idea.maven.server.embedder;
|
||||
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.util.io.FileUtilRt;
|
||||
import gnu.trove.THashMap;
|
||||
import org.apache.maven.artifact.Artifact;
|
||||
import org.apache.maven.artifact.handler.ArtifactHandler;
|
||||
@@ -119,7 +119,7 @@ public class CustomMaven3Artifact implements Artifact {
|
||||
return;
|
||||
}
|
||||
|
||||
f = FileUtil.createTempFile("idea.maven.stub", ".pom");
|
||||
f = FileUtilRt.createTempFile("idea.maven.stub", ".pom");
|
||||
f.deleteOnExit();
|
||||
|
||||
FileOutputStream s = new FileOutputStream(f);
|
||||
|
||||
+3
-3
@@ -16,7 +16,7 @@
|
||||
package org.jetbrains.idea.maven.server.embedder;
|
||||
|
||||
import com.intellij.openapi.util.Condition;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.containers.ContainerUtilRt;
|
||||
import org.apache.maven.model.Model;
|
||||
import org.apache.maven.project.ProjectBuilderConfiguration;
|
||||
import org.apache.maven.project.interpolation.ModelInterpolationException;
|
||||
@@ -43,7 +43,7 @@ public class CustomMaven3ModelInterpolator extends StringSearchModelInterpolator
|
||||
@Override
|
||||
public Model interpolate(Model model, File projectDir, ProjectBuilderConfiguration config, boolean debugEnabled)
|
||||
throws ModelInterpolationException {
|
||||
this.interpolateObject(ContainerUtil.ar(model.getParent(), model), model, projectDir, config, debugEnabled);
|
||||
this.interpolateObject(ContainerUtilRt.ar(model.getParent(), model), model, projectDir, config, debugEnabled);
|
||||
return model;
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ public class CustomMaven3ModelInterpolator extends StringSearchModelInterpolator
|
||||
protected List<ValueSource> createValueSources(Model model, File projectDir, ProjectBuilderConfiguration config) {
|
||||
List<ValueSource> sources = super.createValueSources(model, projectDir, config);
|
||||
|
||||
int firstMapIndex = ContainerUtil.indexOf(sources, new Condition<ValueSource>() {
|
||||
int firstMapIndex = ContainerUtilRt.indexOf(sources, new Condition<ValueSource>() {
|
||||
@Override
|
||||
public boolean value(ValueSource source) {
|
||||
return source instanceof MapBasedValueSource;
|
||||
|
||||
+2
-1
@@ -17,6 +17,7 @@ package org.jetbrains.idea.maven.server.embedder;
|
||||
|
||||
import com.intellij.openapi.util.Condition;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.containers.ContainerUtilRt;
|
||||
import org.apache.maven.model.Model;
|
||||
import org.apache.maven.model.building.ModelBuildingRequest;
|
||||
import org.apache.maven.model.building.ModelProblemCollector;
|
||||
@@ -60,7 +61,7 @@ public class CustomMaven3ModelInterpolator2 extends StringSearchModelInterpolato
|
||||
res.add(new SingleResponseValueSource("settings.localRepository", localRepository));
|
||||
}
|
||||
|
||||
int firstMapIndex = ContainerUtil.indexOf(res, new Condition<ValueSource>() {
|
||||
int firstMapIndex = ContainerUtilRt.indexOf(res, new Condition<ValueSource>() {
|
||||
@Override
|
||||
public boolean value(ValueSource source) {
|
||||
return source instanceof MapBasedValueSource;
|
||||
|
||||
+2
-2
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
package org.jetbrains.idea.maven.server;
|
||||
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.util.Comparing;
|
||||
import gnu.trove.THashMap;
|
||||
import org.apache.maven.RepositoryUtils;
|
||||
import org.apache.maven.artifact.Artifact;
|
||||
@@ -100,7 +100,7 @@ public class Maven3AetherModelConverter extends MavenModelConverter {
|
||||
Artifact winnerArtifact = toArtifact(winnerNode.getDependency());
|
||||
relatedArtifact = convertArtifact(winnerArtifact, nativeToConvertedMap, localRepository);
|
||||
nativeToConvertedMap.put(a, relatedArtifact);
|
||||
if (!StringUtil.equals(each.getVersion().toString(), winnerNode.getVersion().toString())) {
|
||||
if (!Comparing.equal(each.getVersion().toString(), winnerNode.getVersion().toString())) {
|
||||
state = MavenArtifactState.CONFLICT;
|
||||
}
|
||||
else {
|
||||
|
||||
+11
-11
@@ -16,13 +16,13 @@
|
||||
package org.jetbrains.idea.maven.server;
|
||||
|
||||
import com.intellij.openapi.util.Comparing;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.util.io.FileUtilRt;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.util.ExceptionUtil;
|
||||
import com.intellij.openapi.util.text.StringUtilRt;
|
||||
import com.intellij.util.ExceptionUtilRt;
|
||||
import com.intellij.util.Function;
|
||||
import com.intellij.util.ReflectionUtil;
|
||||
import com.intellij.util.SystemProperties;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.containers.ContainerUtilRt;
|
||||
import gnu.trove.THashMap;
|
||||
import gnu.trove.THashSet;
|
||||
import org.apache.maven.*;
|
||||
@@ -209,7 +209,7 @@ public class Maven3ServerEmbedderImpl extends Maven3ServerEmbedder {
|
||||
|
||||
String mavenEmbedderCliOptions = System.getProperty(MavenServerEmbedder.MAVEN_EMBEDDER_CLI_ADDITIONAL_ARGS);
|
||||
if (mavenEmbedderCliOptions != null) {
|
||||
commandLineOptions.addAll(StringUtil.splitHonorQuotes(mavenEmbedderCliOptions, ' '));
|
||||
commandLineOptions.addAll(StringUtilRt.splitHonorQuotes(mavenEmbedderCliOptions, ' '));
|
||||
}
|
||||
if (commandLineOptions.contains("-U") || commandLineOptions.contains("--update-snapshots")) {
|
||||
myAlwaysUpdateSnapshots = true;
|
||||
@@ -286,7 +286,7 @@ public class Maven3ServerEmbedderImpl extends Maven3ServerEmbedder {
|
||||
}
|
||||
|
||||
if (result.getLocalRepository() == null) {
|
||||
result.setLocalRepository(new File(SystemProperties.getUserHome(), ".m2/repository").getPath());
|
||||
result.setLocalRepository(new File(System.getProperty("user.home"), ".m2/repository").getPath());
|
||||
}
|
||||
|
||||
return result;
|
||||
@@ -593,14 +593,14 @@ public class Maven3ServerEmbedderImpl extends Maven3ServerEmbedder {
|
||||
Collection<MavenExecutionResult> results =
|
||||
doResolveProject(files, new ArrayList<String>(activeProfiles), new ArrayList<String>(inactiveProfiles),
|
||||
Collections.<ResolutionListener>singletonList(listener));
|
||||
return ContainerUtil.mapNotNull(results, new Function<MavenExecutionResult, MavenServerExecutionResult>() {
|
||||
return ContainerUtilRt.mapNotNull(results, new Function<MavenExecutionResult, MavenServerExecutionResult>() {
|
||||
@Override
|
||||
public MavenServerExecutionResult fun(MavenExecutionResult result) {
|
||||
try {
|
||||
return createExecutionResult(result.getPomFile(), result, listener.getRootNode());
|
||||
}
|
||||
catch (RemoteException e) {
|
||||
ExceptionUtil.rethrowAllAsUnchecked(e);
|
||||
ExceptionUtilRt.rethrowAllAsUnchecked(e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -655,7 +655,7 @@ public class Maven3ServerEmbedderImpl extends Maven3ServerEmbedder {
|
||||
|
||||
request.setUpdateSnapshots(myAlwaysUpdateSnapshots);
|
||||
|
||||
final Collection<MavenExecutionResult> executionResults = ContainerUtil.newArrayList();
|
||||
final Collection<MavenExecutionResult> executionResults = ContainerUtilRt.newArrayList();
|
||||
|
||||
executeWithMavenSession(request, new Runnable() {
|
||||
@Override
|
||||
@@ -917,7 +917,7 @@ public class Maven3ServerEmbedderImpl extends Maven3ServerEmbedder {
|
||||
try {
|
||||
File mavenMultiModuleProjectDirectory;
|
||||
if (file == null) {
|
||||
mavenMultiModuleProjectDirectory = new File(FileUtil.getTempDirectory());
|
||||
mavenMultiModuleProjectDirectory = new File(FileUtilRt.getTempDirectory());
|
||||
}
|
||||
else {
|
||||
mavenMultiModuleProjectDirectory = MavenServerUtil.findMavenBasedir(file);
|
||||
@@ -1148,7 +1148,7 @@ public class Maven3ServerEmbedderImpl extends Maven3ServerEmbedder {
|
||||
inputOptions.put(ModelProcessor.SOURCE, new FileModelSource(file));
|
||||
|
||||
ModelReader reader = null;
|
||||
if (!StringUtil.endsWithIgnoreCase(file.getName(), "xml")) {
|
||||
if (!StringUtilRt.endsWithIgnoreCase(file.getName(), "xml")) {
|
||||
try {
|
||||
Object polyglotManager = myContainer.lookup("org.sonatype.maven.polyglot.PolyglotModelManager");
|
||||
if (polyglotManager != null) {
|
||||
|
||||
+4
-4
@@ -16,7 +16,7 @@
|
||||
package org.jetbrains.idea.maven.server;
|
||||
|
||||
import com.intellij.openapi.progress.ProcessCanceledException;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.util.text.StringUtilRt;
|
||||
import org.eclipse.aether.transfer.TransferCancelledException;
|
||||
import org.eclipse.aether.transfer.TransferEvent;
|
||||
import org.eclipse.aether.transfer.TransferListener;
|
||||
@@ -76,9 +76,9 @@ public class TransferListenerAdapter implements TransferListener {
|
||||
|
||||
String sizeInfo;
|
||||
if (totalLength <= 0) {
|
||||
sizeInfo = StringUtil.formatFileSize(event.getTransferredBytes()) + " / ?";
|
||||
sizeInfo = StringUtilRt.formatFileSize(event.getTransferredBytes()) + " / ?";
|
||||
} else {
|
||||
sizeInfo = StringUtil.formatFileSize(event.getTransferredBytes()) + " / " + StringUtil.formatFileSize(totalLength);
|
||||
sizeInfo = StringUtilRt.formatFileSize(event.getTransferredBytes()) + " / " + StringUtilRt.formatFileSize(totalLength);
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -110,7 +110,7 @@ public class TransferListenerAdapter implements TransferListener {
|
||||
@Override
|
||||
public void transferSucceeded(TransferEvent event) {
|
||||
try {
|
||||
myIndicator.setText2("Finished (" + StringUtil.formatFileSize(event.getTransferredBytes()) + ") " + formatResourceName(event));
|
||||
myIndicator.setText2("Finished (" + StringUtilRt.formatFileSize(event.getTransferredBytes()) + ") " + formatResourceName(event));
|
||||
myIndicator.setIndeterminate(true);
|
||||
|
||||
Maven3ServerGlobals.getDownloadListener().artifactDownloaded(event.getResource().getFile(), event.getResource().getResourceName());
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ import org.apache.maven.model.validation.ModelValidator;
|
||||
import org.codehaus.plexus.component.annotations.Component;
|
||||
import org.codehaus.plexus.component.annotations.Requirement;
|
||||
|
||||
import static com.intellij.openapi.util.text.StringUtil.notNullize;
|
||||
import static com.intellij.openapi.util.text.StringUtilRt.notNullize;
|
||||
|
||||
/**
|
||||
* @author ibessonov
|
||||
|
||||
+8
-9
@@ -16,12 +16,11 @@
|
||||
package org.jetbrains.idea.maven.server;
|
||||
|
||||
import com.intellij.openapi.util.Comparing;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.util.ExceptionUtil;
|
||||
import com.intellij.openapi.util.text.StringUtilRt;
|
||||
import com.intellij.util.ExceptionUtilRt;
|
||||
import com.intellij.util.Function;
|
||||
import com.intellij.util.ReflectionUtil;
|
||||
import com.intellij.util.SystemProperties;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.containers.ContainerUtilRt;
|
||||
import gnu.trove.THashMap;
|
||||
import gnu.trove.THashSet;
|
||||
import org.apache.maven.*;
|
||||
@@ -185,7 +184,7 @@ public class Maven30ServerEmbedderImpl extends Maven3ServerEmbedder {
|
||||
|
||||
String mavenEmbedderCliOptions = System.getProperty(MavenServerEmbedder.MAVEN_EMBEDDER_CLI_ADDITIONAL_ARGS);
|
||||
if (mavenEmbedderCliOptions != null) {
|
||||
commandLineOptions.addAll(StringUtil.splitHonorQuotes(mavenEmbedderCliOptions, ' '));
|
||||
commandLineOptions.addAll(StringUtilRt.splitHonorQuotes(mavenEmbedderCliOptions, ' '));
|
||||
}
|
||||
if (commandLineOptions.contains("-U") || commandLineOptions.contains("--update-snapshots")) {
|
||||
myAlwaysUpdateSnapshots = true;
|
||||
@@ -260,7 +259,7 @@ public class Maven30ServerEmbedderImpl extends Maven3ServerEmbedder {
|
||||
}
|
||||
|
||||
if (result.getLocalRepository() == null) {
|
||||
result.setLocalRepository(new File(SystemProperties.getUserHome(), ".m2/repository").getPath());
|
||||
result.setLocalRepository(new File(System.getProperty("user.home"), ".m2/repository").getPath());
|
||||
}
|
||||
|
||||
return result;
|
||||
@@ -574,14 +573,14 @@ public class Maven30ServerEmbedderImpl extends Maven3ServerEmbedder {
|
||||
Collection<MavenExecutionResult> results =
|
||||
doResolveProject(files, new ArrayList<String>(activeProfiles), new ArrayList<String>(inactiveProfiles),
|
||||
Collections.<ResolutionListener>singletonList(listener));
|
||||
return ContainerUtil.mapNotNull(results, new Function<MavenExecutionResult, MavenServerExecutionResult>() {
|
||||
return ContainerUtilRt.mapNotNull(results, new Function<MavenExecutionResult, MavenServerExecutionResult>() {
|
||||
@Override
|
||||
public MavenServerExecutionResult fun(MavenExecutionResult result) {
|
||||
try {
|
||||
return createExecutionResult(result.getPomFile(), result, listener.getRootNode());
|
||||
}
|
||||
catch (RemoteException e) {
|
||||
ExceptionUtil.rethrowAllAsUnchecked(e);
|
||||
ExceptionUtilRt.rethrowAllAsUnchecked(e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -636,7 +635,7 @@ public class Maven30ServerEmbedderImpl extends Maven3ServerEmbedder {
|
||||
|
||||
request.setUpdateSnapshots(myAlwaysUpdateSnapshots);
|
||||
|
||||
final Collection<MavenExecutionResult> executionResults = ContainerUtil.newArrayList();
|
||||
final Collection<MavenExecutionResult> executionResults = ContainerUtilRt.newArrayList();
|
||||
|
||||
executeWithMavenSession(request, new Runnable() {
|
||||
@Override
|
||||
|
||||
+4
-4
@@ -16,7 +16,7 @@
|
||||
package org.jetbrains.idea.maven.server;
|
||||
|
||||
import com.intellij.openapi.progress.ProcessCanceledException;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.util.text.StringUtilRt;
|
||||
import org.sonatype.aether.transfer.TransferCancelledException;
|
||||
import org.sonatype.aether.transfer.TransferEvent;
|
||||
import org.sonatype.aether.transfer.TransferListener;
|
||||
@@ -79,9 +79,9 @@ public class Maven30TransferListenerAdapter implements TransferListener {
|
||||
|
||||
String sizeInfo;
|
||||
if (totalLength <= 0) {
|
||||
sizeInfo = StringUtil.formatFileSize(event.getTransferredBytes()) + " / ?";
|
||||
sizeInfo = StringUtilRt.formatFileSize(event.getTransferredBytes()) + " / ?";
|
||||
} else {
|
||||
sizeInfo = StringUtil.formatFileSize(event.getTransferredBytes()) + " / " + StringUtil.formatFileSize(totalLength);
|
||||
sizeInfo = StringUtilRt.formatFileSize(event.getTransferredBytes()) + " / " + StringUtilRt.formatFileSize(totalLength);
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -113,7 +113,7 @@ public class Maven30TransferListenerAdapter implements TransferListener {
|
||||
@Override
|
||||
public void transferSucceeded(TransferEvent event) {
|
||||
try {
|
||||
myIndicator.setText2("Finished (" + StringUtil.formatFileSize(event.getTransferredBytes()) + ") " + formatResourceName(event));
|
||||
myIndicator.setText2("Finished (" + StringUtilRt.formatFileSize(event.getTransferredBytes()) + ") " + formatResourceName(event));
|
||||
myIndicator.setIndeterminate(true);
|
||||
}
|
||||
catch (RemoteException e) {
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ import org.apache.maven.model.validation.ModelValidator;
|
||||
import org.codehaus.plexus.component.annotations.Component;
|
||||
import org.codehaus.plexus.component.annotations.Requirement;
|
||||
|
||||
import static com.intellij.openapi.util.text.StringUtil.notNullize;
|
||||
import static com.intellij.openapi.util.text.StringUtilRt.notNullize;
|
||||
|
||||
/**
|
||||
* @author ibessonov
|
||||
|
||||
Reference in New Issue
Block a user