diff options
author | Tor Norbye <tnorbye@google.com> | 2013-07-08 11:26:24 -0700 |
---|---|---|
committer | Tor Norbye <tnorbye@google.com> | 2013-07-08 11:26:24 -0700 |
commit | c1ace1f7e1e49c81bb4b75377c99f07be340abfe (patch) | |
tree | 9d0db96bd3d86ddfec80e7e3554cad9dcc066553 /plugins/cvs | |
parent | c6218e46d5d2017e987ecdbd99b318a95c42abc0 (diff) | |
download | idea-c1ace1f7e1e49c81bb4b75377c99f07be340abfe.tar.gz |
Snapshot aea001abfc1b38fec3a821bcd5174cc77dc75787 from master branch of git://git.jetbrains.org/idea/community.git
Change-Id: Icdea2a2bd7ad43b4d05967b1f0479db3bda1c93c
Diffstat (limited to 'plugins/cvs')
14 files changed, 80 insertions, 50 deletions
diff --git a/plugins/cvs/cvs-core/src/com/intellij/cvsSupport2/config/ProxySettings.java b/plugins/cvs/cvs-core/src/com/intellij/cvsSupport2/config/ProxySettings.java index 4bf54fd55bdd..8f1c4f3f5263 100644 --- a/plugins/cvs/cvs-core/src/com/intellij/cvsSupport2/config/ProxySettings.java +++ b/plugins/cvs/cvs-core/src/com/intellij/cvsSupport2/config/ProxySettings.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2011 JetBrains s.r.o. + * Copyright 2000-2013 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,15 +26,16 @@ public class ProxySettings implements JDOMExternalizable, Cloneable { private static final Logger LOG = Logger.getInstance("#com.intellij.cvsSupport2.config.ConnectionSettingsImpl"); - public static int HTTP = 0; - public static int SOCKS4 = 1; - public static int SOCKS5 = 2; + public static final int HTTP = 0; + public static final int SOCKS4 = 1; + public static final int SOCKS5 = 2; public boolean USE_PROXY = false; public String PROXY_HOST = ""; public int PROXY_PORT = 8080; public int TYPE = HTTP; public String LOGIN = ""; + public String PASSWORD = ""; @Override public boolean equals(Object o) { @@ -66,8 +67,6 @@ public class ProxySettings implements JDOMExternalizable, Cloneable { return result; } - public String PASSWORD = ""; - @Override public void readExternal(Element element) throws InvalidDataException { DefaultJDOMExternalizer.readExternal(this, element); diff --git a/plugins/cvs/cvs-core/src/com/intellij/cvsSupport2/connections/ConnectionSettingsImpl.java b/plugins/cvs/cvs-core/src/com/intellij/cvsSupport2/connections/ConnectionSettingsImpl.java index abbe02fe6d0f..64dce4fb62e2 100644 --- a/plugins/cvs/cvs-core/src/com/intellij/cvsSupport2/connections/ConnectionSettingsImpl.java +++ b/plugins/cvs/cvs-core/src/com/intellij/cvsSupport2/connections/ConnectionSettingsImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2013 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -74,6 +74,9 @@ public class ConnectionSettingsImpl implements ConnectionSettings { } public int getProxyPort() { + if (myProxyPort < 0 || myProxyPort > 0xFFFF) { + return 80; + } return myProxyPort; } diff --git a/plugins/cvs/cvs-core/src/com/intellij/cvsSupport2/connections/ext/ExtConnection.java b/plugins/cvs/cvs-core/src/com/intellij/cvsSupport2/connections/ext/ExtConnection.java index f9b797cd1c58..dd15a20860ad 100644 --- a/plugins/cvs/cvs-core/src/com/intellij/cvsSupport2/connections/ext/ExtConnection.java +++ b/plugins/cvs/cvs-core/src/com/intellij/cvsSupport2/connections/ext/ExtConnection.java @@ -76,16 +76,15 @@ public class ExtConnection extends ConnectionOnProcess { private void check(ICvsCommandStopper stopper, String expectedResult) throws IOException, AuthenticationException { InputStreamWrapper streamWrapper = new InputStreamWrapper(myInputStream, stopper, new ReadWriteStatistics()); try { - int i; StringBuilder buffer = new StringBuilder(); while (true) { - i = streamWrapper.read(); + int i = streamWrapper.read(); if (i == -1 || i == '\n' || i == ' ' || i == '\r') break; buffer.append((char)i); } String read = buffer.toString().trim(); if (!expectedResult.equals(read)) { - if (StringUtil.startsWithConcatenationOf(read, myUserName + "@", myHost)) { + if (StringUtil.startsWithConcatenation(read, myUserName, "@", myHost)) { throw new AuthenticationException(CvsBundle.message("exception.text.ext.server.rejected.access"), null); } else { @@ -110,12 +109,12 @@ public class ExtConnection extends ConnectionOnProcess { command.addParameter("-l"); command.addParameter(userName); - if (config.PRIVATE_KEY_FILE.length() > 0) { + if (!config.PRIVATE_KEY_FILE.isEmpty()) { command.addParameter("-i"); command.addParameter(config.PRIVATE_KEY_FILE); } - if (config.ADDITIONAL_PARAMETERS.length() > 0) { + if (!config.ADDITIONAL_PARAMETERS.isEmpty()) { StringTokenizer parameters = new StringTokenizer(config.ADDITIONAL_PARAMETERS, " "); while (parameters.hasMoreTokens()) command.addParameter(parameters.nextToken()); } diff --git a/plugins/cvs/cvs-core/src/com/intellij/cvsSupport2/connections/ssh/SocksAuthenticatorManager.java b/plugins/cvs/cvs-core/src/com/intellij/cvsSupport2/connections/ssh/SocksAuthenticatorManager.java index e4ca2c4880f8..4a310d33d943 100644 --- a/plugins/cvs/cvs-core/src/com/intellij/cvsSupport2/connections/ssh/SocksAuthenticatorManager.java +++ b/plugins/cvs/cvs-core/src/com/intellij/cvsSupport2/connections/ssh/SocksAuthenticatorManager.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2013 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,6 +15,7 @@ */ package com.intellij.cvsSupport2.connections.ssh; +import com.intellij.cvsSupport2.config.ProxySettings; import com.intellij.openapi.components.ServiceManager; import com.intellij.openapi.util.KeyValue; import com.intellij.openapi.util.Pair; @@ -30,9 +31,9 @@ import java.util.List; import java.util.Map; public class SocksAuthenticatorManager { - private final static String SOCKS_REQUESTING_PROTOCOL = "SOCKS"; + private final Object myLock; - private CvsProxySelector mySelector; + private volatile CvsProxySelector mySelector; public static SocksAuthenticatorManager getInstance() { return ServiceManager.getService(SocksAuthenticatorManager.class); @@ -53,6 +54,9 @@ public class SocksAuthenticatorManager { public void unregister(final ConnectionSettings connectionSettings) { SshLogger.debug("unregister in authenticator"); + if (!connectionSettings.isUseProxy()) return; + final int proxyType = connectionSettings.getProxyType(); + if (proxyType != ProxySettings.SOCKS4 && proxyType != ProxySettings.SOCKS5) return; mySelector.unregister(connectionSettings.getHostName(), connectionSettings.getPort()); CommonProxy.getInstance().removeCustomAuth(getClass().getName()); } diff --git a/plugins/cvs/cvs-core/src/com/intellij/cvsSupport2/connections/ssh/SshProxyFactory.java b/plugins/cvs/cvs-core/src/com/intellij/cvsSupport2/connections/ssh/SshProxyFactory.java index 02611b0e74f1..097002545145 100644 --- a/plugins/cvs/cvs-core/src/com/intellij/cvsSupport2/connections/ssh/SshProxyFactory.java +++ b/plugins/cvs/cvs-core/src/com/intellij/cvsSupport2/connections/ssh/SshProxyFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2013 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,19 +26,18 @@ import java.io.IOException; import java.net.Socket; public class SshProxyFactory { - private SshProxyFactory() { - } + + private SshProxyFactory() {} @Nullable public static ProxyData createAndRegister(final ConnectionSettings connectionSettings) { - ProxyData result = null; - if (! connectionSettings.isUseProxy()) return null; + if (!connectionSettings.isUseProxy()) return null; final int type = connectionSettings.getProxyType(); - if ((ProxySettings.SOCKS4 == type) || (ProxySettings.SOCKS5 == type)) { + ProxyData result = null; + if (ProxySettings.SOCKS4 == type || ProxySettings.SOCKS5 == type) { result = new SocksProxyData(connectionSettings); SocksAuthenticatorManager.getInstance().register(connectionSettings); } else if (ProxySettings.HTTP == type) { - /*String proxyHost, int proxyPort, String proxyUser, String proxyPass*/ result = new HTTPProxyData(connectionSettings.getProxyHostName(), connectionSettings.getProxyPort(), connectionSettings.getProxyLogin(), connectionSettings.getProxyPassword()); } diff --git a/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/changeBrowser/CvsChangeList.java b/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/changeBrowser/CvsChangeList.java index e44cce9b7e5f..8227f8eba212 100644 --- a/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/changeBrowser/CvsChangeList.java +++ b/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/changeBrowser/CvsChangeList.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2011 JetBrains s.r.o. + * Copyright 2000-2013 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -148,7 +148,7 @@ public class CvsChangeList implements CommittedChangeList { final File localFile; if (myRootFile != null) { final String directorySuffix = myRootFile.isDirectory() ? "/" : ""; - if (StringUtil.startsWithConcatenationOf(path, myRootPath, directorySuffix)) { + if (StringUtil.startsWithConcatenation(path, myRootPath, directorySuffix)) { path = path.substring(myRootPath.length() + directorySuffix.length()); localFile = new File(myRootFile.getPresentableUrl(), path); } @@ -242,7 +242,7 @@ public class CvsChangeList implements CommittedChangeList { } public static boolean isAncestor(final String parent, final String child) { - return child.equals(parent) || StringUtil.startsWithConcatenationOf(child, parent, "/"); + return child.equals(parent) || StringUtil.startsWithConcatenation(child, parent, "/"); } public boolean equals(final Object o) { diff --git a/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/config/ui/Cvs2SettingsEditPanel.java b/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/config/ui/Cvs2SettingsEditPanel.java index 5766ea0aa7a4..480700068f81 100644 --- a/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/config/ui/Cvs2SettingsEditPanel.java +++ b/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/config/ui/Cvs2SettingsEditPanel.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2011 JetBrains s.r.o. + * Copyright 2000-2013 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -125,6 +125,7 @@ public class Cvs2SettingsEditPanel { public void addCvsRootChangeListener(CvsRootChangeListener cvsRootChangeListener) { myCvsRootConfigurationPanelView.addCvsRootChangeListener(cvsRootChangeListener); + myExtConnectionSettingsEditor.addCvsRootChangeListener(cvsRootChangeListener); } public void updateFrom(final CvsRootConfiguration configuration) { @@ -275,11 +276,17 @@ public class Cvs2SettingsEditPanel { } } - private static String getProxyPanelName(CvsRootData cvsRootData) { + private String getProxyPanelName(CvsRootData cvsRootData) { if (cvsRootData.METHOD == null) { return EMPTY; } - return cvsRootData.METHOD.supportsProxyConnection() ? NON_EMPTY_PROXY_SETTINGS : EMPTY; + if (cvsRootData.METHOD.supportsProxyConnection()) { + return NON_EMPTY_PROXY_SETTINGS; + } + if (cvsRootData.METHOD == CvsMethod.EXT_METHOD && myExtConnectionSettingsEditor.isUseInternalSshImplementation()) { + return NON_EMPTY_PROXY_SETTINGS; + } + return EMPTY; } private static String getSettingsPanelName(CvsRootData cvsRootData) { diff --git a/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/config/ui/CvsRootFieldByFieldConfigurationPanel.java b/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/config/ui/CvsRootFieldByFieldConfigurationPanel.java index 84faf4f5c28f..de9029dba74b 100644 --- a/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/config/ui/CvsRootFieldByFieldConfigurationPanel.java +++ b/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/config/ui/CvsRootFieldByFieldConfigurationPanel.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2011 JetBrains s.r.o. + * Copyright 2000-2013 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,6 +28,7 @@ import java.awt.event.ActionListener; * author: lesya */ public class CvsRootFieldByFieldConfigurationPanel { + private JComboBox myMethods; private JTextField myUser; private JTextField myHost; @@ -64,7 +65,7 @@ public class CvsRootFieldByFieldConfigurationPanel { } public String getSettings() { - final int port = FormUtils.getPositiveIntFieldValue(myPort, true, true); + final int port = FormUtils.getPositiveIntFieldValue(myPort, true, true, 0xFFFF); final CvsMethod cvsMethod = (CvsMethod)myMethods.getSelectedItem(); final String user = FormUtils.getFieldValue(myUser, cvsMethod.hasUserValue()); final String host = FormUtils.getFieldValue(myHost, cvsMethod.hasHostValue()); diff --git a/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/connections/ext/ExtConnectionCvsSettings.java b/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/connections/ext/ExtConnectionCvsSettings.java index c844efa05d2a..96f453216e9b 100644 --- a/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/connections/ext/ExtConnectionCvsSettings.java +++ b/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/connections/ext/ExtConnectionCvsSettings.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2011 JetBrains s.r.o. + * Copyright 2000-2013 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -118,9 +118,8 @@ public class ExtConnectionCvsSettings extends CvsConnectionSettings { if (!(sourceException instanceof IOException)) return t; String localizedMessage = t.getLocalizedMessage(); if (localizedMessage == null || !localizedMessage.startsWith(UNHANDLED_RESPONSE_PREFIX)) return t; - String response = localizedMessage.substring(UNHANDLED_RESPONSE_PREFIX.length(), - localizedMessage.length() - 1); - if (StringUtil.startsWithConcatenationOf(response, USER + "@", HOST)) { + String response = localizedMessage.substring(UNHANDLED_RESPONSE_PREFIX.length(), localizedMessage.length() - 1); + if (StringUtil.startsWithConcatenation(response, USER, "@", HOST)) { return new IOCommandException(new IOException(CvsBundle.message("exception.text.ext.server.rejected.access"))); } else { diff --git a/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/connections/ext/ui/ExtConnectionDualPanel.java b/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/connections/ext/ui/ExtConnectionDualPanel.java index aa53dec5e96a..ae5ac5cfe34b 100644 --- a/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/connections/ext/ui/ExtConnectionDualPanel.java +++ b/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/connections/ext/ui/ExtConnectionDualPanel.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2011 JetBrains s.r.o. + * Copyright 2000-2013 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,23 +19,27 @@ import com.intellij.CvsBundle; import com.intellij.cvsSupport2.config.ExtConfiguration; import com.intellij.cvsSupport2.config.SshSettings; import com.intellij.cvsSupport2.connections.ssh.ui.SshConnectionSettingsPanel; +import com.intellij.cvsSupport2.ui.CvsRootChangeListener; import com.intellij.openapi.project.Project; +import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NonNls; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import java.util.Collection; public class ExtConnectionDualPanel { private final ExtConnectionSettingsPanel myExtSettingsPanel; private final SshConnectionSettingsPanel mySshSettingsPanel; + private final Collection<CvsRootChangeListener> myCvsRootChangeListeners = ContainerUtil.createLockFreeCopyOnWriteList(); + private final JPanel myPanel = new JPanel(new BorderLayout()); private final JPanel myDualPanel = new JPanel(new CardLayout()); - private final JCheckBox myUseInternalImplementationCheckBox = - new JCheckBox(CvsBundle.message("checkbox.text.use.internal.ssh.implementation")); + private final JCheckBox myUseInternalImplementationCheckBox = new JCheckBox(CvsBundle.message("checkbox.text.use.internal.ssh.implementation")); @NonNls private static final String EXT = "EXT"; @NonNls private static final String SSH = "SSH"; @@ -52,12 +56,23 @@ public class ExtConnectionDualPanel { myUseInternalImplementationCheckBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { updatePage(); + notifyListeners(); } }); } + public void addCvsRootChangeListener(CvsRootChangeListener l) { + myCvsRootChangeListeners.add(l); + } + + private void notifyListeners() { + for (CvsRootChangeListener cvsRootChangeListener : myCvsRootChangeListeners) { + cvsRootChangeListener.onCvsRootChanged(); + } + } + private void updatePage() { - final CardLayout cardLayout = ((CardLayout)myDualPanel.getLayout()); + final CardLayout cardLayout = (CardLayout)myDualPanel.getLayout(); if (myUseInternalImplementationCheckBox.isSelected()){ cardLayout.show(myDualPanel, SSH); } else { @@ -91,4 +106,8 @@ public class ExtConnectionDualPanel { mySshSettingsPanel.saveTo(sshSettings); extConfiguration.USE_INTERNAL_SSH_IMPLEMENTATION = myUseInternalImplementationCheckBox.isSelected(); } + + public boolean isUseInternalSshImplementation() { + return myUseInternalImplementationCheckBox.isSelected(); + } } diff --git a/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/connections/ui/ProxySettingsPanel.java b/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/connections/ui/ProxySettingsPanel.java index 2cae92d30401..19fe241acd05 100644 --- a/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/connections/ui/ProxySettingsPanel.java +++ b/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/connections/ui/ProxySettingsPanel.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2011 JetBrains s.r.o. + * Copyright 2000-2013 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,6 +25,7 @@ import java.awt.event.ItemEvent; import java.awt.event.ItemListener; public class ProxySettingsPanel { + private JPanel myPanel; private JTextField myProxyPort; private JTextField myProxyHost; @@ -124,7 +125,7 @@ public class ProxySettingsPanel { } return myUseProxy.isSelected() == proxySettings.USE_PROXY && myProxyHost.getText().equals(proxySettings.PROXY_HOST) - && FormUtils.getPositiveIntFieldValue(myProxyPort, false, false) == proxySettings.PROXY_PORT + && FormUtils.getPositiveIntFieldValue(myProxyPort, false, false, 0xFFFF) == proxySettings.PROXY_PORT && getSelectedType() == proxySettings.getType() && myLogin.getText().equals(proxySettings.getLogin()) && new String(myPassword.getPassword()).equals(proxySettings.getPassword()); @@ -145,7 +146,7 @@ public class ProxySettingsPanel { public void saveTo(ProxySettings proxySettings) { proxySettings.USE_PROXY = myUseProxy.isSelected(); proxySettings.PROXY_HOST = FormUtils.getFieldValue(myProxyHost, proxySettings.USE_PROXY); - proxySettings.PROXY_PORT = FormUtils.getPositiveIntFieldValue(myProxyPort, true, false); + proxySettings.PROXY_PORT = FormUtils.getPositiveIntFieldValue(myProxyPort, true, false, 0xFFFF); proxySettings.TYPE = getSelectedType(); proxySettings.LOGIN = myLogin.getText(); proxySettings.PASSWORD = new String(myPassword.getPassword()); diff --git a/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/cvsoperations/cvsContent/DirectoryContentListener.java b/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/cvsoperations/cvsContent/DirectoryContentListener.java index 56a5136a02b2..197ca6ac0ebd 100644 --- a/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/cvsoperations/cvsContent/DirectoryContentListener.java +++ b/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/cvsoperations/cvsContent/DirectoryContentListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * Copyright 2000-2013 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -40,7 +40,7 @@ class DirectoryContentListener { } else if (fileMessage(message)) { String fileName = fileNameFromMessage(message); - if ((myModuleName != null) && StringUtil.startsWithConcatenationOf(fileName, myModuleName, "/")) { + if ((myModuleName != null) && StringUtil.startsWithConcatenation(fileName, myModuleName, "/")) { fileName = fileName.substring(myModuleName.length() + 1); } final int slashPos = fileName.indexOf('/'); diff --git a/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/history/CvsFileRevisionImpl.java b/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/history/CvsFileRevisionImpl.java index 96f2d6b72cba..b497dd4045e8 100644 --- a/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/history/CvsFileRevisionImpl.java +++ b/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/history/CvsFileRevisionImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2013 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -84,7 +84,7 @@ public class CvsFileRevisionImpl extends CvsFileContent implements CvsFileRevisi //noinspection unchecked final List<SymbolicName> symNames = myLogInformation.getAllSymbolicNames(); for (final SymbolicName symName : symNames) { - if (StringUtil.startsWithConcatenationOf(symName.getRevision(), myCvsRevision.getNumber(), ".") && + if (StringUtil.startsWithConcatenation(symName.getRevision(), myCvsRevision.getNumber(), ".") && !processedSymbolicNames.contains(symName)) { CvsRevisionNumber number = new CvsRevisionNumber(symName.getRevision().trim()); final int[] subRevisions = number.getSubRevisions(); diff --git a/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/ui/FormUtils.java b/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/ui/FormUtils.java index 7f668384e00e..865524ede23c 100644 --- a/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/ui/FormUtils.java +++ b/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/ui/FormUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2011 JetBrains s.r.o. + * Copyright 2011-2013 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,8 +23,7 @@ import javax.swing.*; public class FormUtils { - private FormUtils() { - } + private FormUtils() {} public static String getFieldValue(JTextField field, boolean check) { final String value = field.getText().trim(); @@ -51,7 +50,7 @@ public class FormUtils { return text; } - public static int getPositiveIntFieldValue(JTextField field, boolean check, boolean emptyAllowed) { + public static int getPositiveIntFieldValue(JTextField field, boolean check, boolean emptyAllowed, int max) { final String text = field.getText().trim(); if (text.isEmpty()) { if (check && !emptyAllowed) { @@ -62,7 +61,7 @@ public class FormUtils { else { try { final int intPort = Integer.parseInt(text); - if (check && intPort <= 0) { + if (check && (intPort <= 0 || intPort > max)) { throw new InputException(CvsBundle.message("error.message.invalid.value", getLabelText(field), text), field); } return intPort; |