Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
285,300
String () { return myLiteralPort; }
getLiteralPort
285,301
void (@Nullable String portText) { myLiteralPort = StringUtil.notNullize(portText); myPort = StringUtil.parseInt(portText, 0); }
setLiteralPort
285,302
String () { return myUserName; }
getUserName
285,303
void (@Nullable String userName) { myUserName = StringUtil.notNullize(userName); }
setUserName
285,304
void (@Nullable String password) { myPassword = StringUtil.notNullize(password); }
setPassword
285,305
void (boolean storePassword) { myStorePassword = storePassword; }
setStorePassword
285,306
void (boolean storePassphrase) { myStorePassphrase = storePassphrase; }
setStorePassphrase
285,307
boolean () { return myStorePassword; }
isStorePassword
285,308
boolean () { return myStorePassphrase; }
isStorePassphrase
285,309
boolean () { return myUseOpenSSHConfig; }
isOpenSshConfigUsageForced
285,310
void (boolean useOpenSSHConfig) { myUseOpenSSHConfig = useOpenSSHConfig; }
setOpenSshConfigUsageForced
285,311
String () { return myPrivateKeyFile; }
getPrivateKeyFile
285,312
void (@Nullable String privateKeyFile) { myPrivateKeyFile = StringUtil.notNullize(privateKeyFile); }
setPrivateKeyFile
285,313
void (@Nullable String passphrase) { myPassphrase = StringUtil.notNullize(passphrase); }
setPassphrase
285,314
AuthType () { return myAuthType; }
getAuthType
285,315
void (@NotNull AuthType authType) { myAuthType = authType; }
setAuthType
285,316
SshConnectionConfigPatch () { return myConnectionConfigPatch; }
getConnectionConfigPatch
285,317
void (@Nullable SshConnectionConfigPatch patch) { myConnectionConfigPatch = patch; }
setConnectionConfigPatch
285,318
String () { return StringUtil.notNullize(myUserName); }
getSerializedUserName
285,319
void (@NonNls String userName) { if (StringUtil.isEmpty(userName)) { myUserName = null; } else { myUserName = userName; } }
setSerializedUserName
285,320
void (@NonNls @Nullable String serializedPassword) { if (!StringUtil.isEmpty(serializedPassword)) { //noinspection deprecation myPassword = PasswordUtil.decodePassword(serializedPassword); myStorePassword = true; } else { myPassword = null; } }
setSerializedPassword
285,321
void (@Nullable String serializedPassphrase) { if (!StringUtil.isEmpty(serializedPassphrase)) { //noinspection deprecation myPassphrase = PasswordUtil.decodePassword(serializedPassphrase); myStorePassphrase = true; } else { myPassphrase = ""; myStorePassphrase = false; } }
setSerializedPassphrase
285,322
void (@NotNull MutableRemoteCredentials to) { copyRemoteCredentials(this, to); }
copyRemoteCredentialsTo
285,323
void (@NotNull RemoteCredentials from) { copyRemoteCredentials(from, this); }
copyFrom
285,324
void (@NotNull RemoteCredentials from, @NotNull MutableRemoteCredentials to) { to.setHost(from.getHost()); to.setLiteralPort(from.getLiteralPort());//then port is copied to.setUserName(from.getUserName()); to.setPassword(from.getPassword()); to.setPassphrase(from.getPassphrase()); to.setAuthType(from.getAuthType()); to.setPrivateKeyFile(from.getPrivateKeyFile()); to.setStorePassword(from.isStorePassword()); to.setStorePassphrase(from.isStorePassphrase()); to.setOpenSshConfigUsageForced(from.isOpenSshConfigUsageForced()); to.setConnectionConfigPatch(from.getConnectionConfigPatch()); }
copyRemoteCredentials
285,325
void (Element element) { setHost(element.getAttributeValue(HOST)); setLiteralPort(element.getAttributeValue(PORT)); setSerializedUserName(element.getAttributeValue(USERNAME)); setSerializedPassword(element.getAttributeValue(PASSWORD)); setPrivateKeyFile(StringUtil.nullize(element.getAttributeValue(PRIVATE_KEY_FILE))); setSerializedPassphrase(element.getAttributeValue(PASSPHRASE)); // true by default for all IDEs except DataGrip due to historical reasons setOpenSshConfigUsageForced(Boolean.parseBoolean(StringUtil.defaultIfEmpty(element.getAttributeValue(USE_OPENSSH_CONFIG), String.valueOf(!PlatformUtils.isDataGrip())))); boolean useKeyPair = Boolean.parseBoolean(element.getAttributeValue(USE_KEY_PAIR)); boolean useAuthAgent = Boolean.parseBoolean(element.getAttributeValue(USE_AUTH_AGENT)); if (useKeyPair) { myAuthType = AuthType.KEY_PAIR; } else if (useAuthAgent) { // the old `USE_AUTH_AGENT` attribute is used to avoid settings migration myAuthType = AuthType.OPEN_SSH; } else { myAuthType = AuthType.PASSWORD; } // try to load credentials from PasswordSafe final CredentialAttributes attributes = createAttributes(false); final Credentials credentials = PasswordSafe.getInstance().get(attributes); if (credentials != null) { final boolean memoryOnly = PasswordSafe.getInstance().isPasswordStoredOnlyInMemory(attributes, credentials); if (myAuthType == AuthType.KEY_PAIR) { setPassword(null); setStorePassword(false); setPassphrase(credentials.getPasswordAsString()); setStorePassphrase(!memoryOnly); } else if (myAuthType == AuthType.PASSWORD) { setPassword(credentials.getPasswordAsString()); setStorePassword(!memoryOnly); setPassphrase(null); setStorePassphrase(false); } else { setOpenSshConfigUsageForced(true); setPassword(null); setStorePassword(false); setPassphrase(null); setStorePassphrase(false); } } boolean isAnonymous = Boolean.parseBoolean(element.getAttributeValue(ANONYMOUS)); if (isAnonymous) { setSerializedUserName("anonymous"); setSerializedPassword("user@example.com"); } }
load
285,326
void (Element rootElement) { rootElement.setAttribute(HOST, StringUtil.notNullize(getHost())); rootElement.setAttribute(PORT, StringUtil.notNullize(getLiteralPort())); rootElement.setAttribute(USERNAME, getSerializedUserName()); rootElement.setAttribute(PRIVATE_KEY_FILE, StringUtil.notNullize(getPrivateKeyFile())); rootElement.setAttribute(USE_KEY_PAIR, Boolean.toString(myAuthType == AuthType.KEY_PAIR)); rootElement.setAttribute(USE_OPENSSH_CONFIG, Boolean.toString(isOpenSshConfigUsageForced())); // the old `USE_AUTH_AGENT` attribute is used to avoid settings migration rootElement.setAttribute(USE_AUTH_AGENT, Boolean.toString(myAuthType == AuthType.OPEN_SSH)); boolean memoryOnly = (myAuthType == AuthType.KEY_PAIR && !isStorePassphrase()) || (myAuthType == AuthType.PASSWORD && !isStorePassword()) || myAuthType == AuthType.OPEN_SSH; String password; if (myAuthType == AuthType.KEY_PAIR) { password = getPassphrase(); } else if (myAuthType == AuthType.PASSWORD) { password = getPassword(); } else { password = null; } PasswordSafe.getInstance().set(createAttributes(memoryOnly), new Credentials(getUserName(), password)); // getConnectionConfigPatch() is omitted intentionally. // It's expected that the options will be set with SSH settings by one of `copyTo` calls. }
save
285,327
CredentialAttributes (boolean memoryOnly) { final String serviceName = SERVICE_NAME_PREFIX + getCredentialsString(this) + "(" + CREDENTIAL_ATTRIBUTES_QUALIFIERS.get(myAuthType) + ")"; return new CredentialAttributes(serviceName, getUserName(), null, memoryOnly); }
createAttributes
285,328
boolean (Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; RemoteCredentialsHolder holder = (RemoteCredentialsHolder)o; if (!myLiteralPort.equals(holder.myLiteralPort)) return false; if (myStorePassword != holder.myStorePassword) return false; if (myStorePassphrase != holder.myStorePassphrase) return false; if (!myHost.equals(holder.myHost)) return false; if (!Objects.equals(myUserName, holder.myUserName)) return false; if (!Objects.equals(myPassword, holder.myPassword)) return false; if (!myPrivateKeyFile.equals(holder.myPrivateKeyFile)) return false; if (!Objects.equals(myPassphrase, holder.myPassphrase)) return false; if (myUseOpenSSHConfig != holder.myUseOpenSSHConfig) return false; if (myAuthType != holder.myAuthType) return false; if (!Objects.equals(myConnectionConfigPatch, holder.myConnectionConfigPatch)) return false; return true; }
equals
285,329
int () { int result = myHost.hashCode(); result = 31 * result + myLiteralPort.hashCode(); result = 31 * result + (myUserName != null ? myUserName.hashCode() : 0); result = 31 * result + (myPassword != null ? myPassword.hashCode() : 0); result = 31 * result + myPrivateKeyFile.hashCode(); result = 31 * result + (myPassphrase != null ? myPassphrase.hashCode() : 0); result = 31 * result + (myStorePassword ? 1 : 0); result = 31 * result + (myStorePassphrase ? 1 : 0); result = 31 * result + (myUseOpenSSHConfig ? 1 : 0); result = 31 * result + myAuthType.hashCode(); result = 31 * result + (myConnectionConfigPatch != null ? myConnectionConfigPatch.hashCode() : 0); return result; }
hashCode
285,330
void () { if (!myProcess.killProcessTree()) { super.destroyProcessImpl(); } }
destroyProcessImpl
285,331
void (int exitCode) { if (myModality != ModalityState.nonModal()) { ProgressManager.getInstance().runProcess(() -> super.onOSProcessTerminated(exitCode), new EmptyProgressIndicator(myModality)); } else { super.onOSProcessTerminated(exitCode); } }
onOSProcessTerminated
285,332
void () { notifyTextAvailable(myCommandLine + '\n', ProcessOutputTypes.SYSTEM); addProcessListener(new ProcessAdapter() { @Override public void startNotified(@NotNull final ProcessEvent event) { try { final RemoteOutputReader stdoutReader = new RemoteOutputReader(myProcess.getInputStream(), getCharset(), myProcess, myCommandLine, readerOptions()) { @Override protected void onTextAvailable(@NotNull String text) { notifyTextAvailable(text, ProcessOutputTypes.STDOUT); } @NotNull @Override protected Future<?> executeOnPooledThread(@NotNull Runnable runnable) { return BaseRemoteProcessHandler.this.executeTask(runnable); } }; final RemoteOutputReader stderrReader = new RemoteOutputReader(myProcess.getErrorStream(), getCharset(), myProcess, myCommandLine, readerOptions()) { @Override protected void onTextAvailable(@NotNull String text) { notifyTextAvailable(text, ProcessOutputTypes.STDERR); } @NotNull @Override protected Future<?> executeOnPooledThread(@NotNull Runnable runnable) { return BaseRemoteProcessHandler.this.executeTask(runnable); } }; myWaitFor.setTerminationCallback(exitCode -> { try { try { stderrReader.waitFor(); stdoutReader.waitFor(); } catch (InterruptedException ignore) { } } finally { onOSProcessTerminated(exitCode); } }); } finally { removeProcessListener(this); } } }); super.startNotify(); }
startNotify
285,333
void (@NotNull final ProcessEvent event) { try { final RemoteOutputReader stdoutReader = new RemoteOutputReader(myProcess.getInputStream(), getCharset(), myProcess, myCommandLine, readerOptions()) { @Override protected void onTextAvailable(@NotNull String text) { notifyTextAvailable(text, ProcessOutputTypes.STDOUT); } @NotNull @Override protected Future<?> executeOnPooledThread(@NotNull Runnable runnable) { return BaseRemoteProcessHandler.this.executeTask(runnable); } }; final RemoteOutputReader stderrReader = new RemoteOutputReader(myProcess.getErrorStream(), getCharset(), myProcess, myCommandLine, readerOptions()) { @Override protected void onTextAvailable(@NotNull String text) { notifyTextAvailable(text, ProcessOutputTypes.STDERR); } @NotNull @Override protected Future<?> executeOnPooledThread(@NotNull Runnable runnable) { return BaseRemoteProcessHandler.this.executeTask(runnable); } }; myWaitFor.setTerminationCallback(exitCode -> { try { try { stderrReader.waitFor(); stdoutReader.waitFor(); } catch (InterruptedException ignore) { } } finally { onOSProcessTerminated(exitCode); } }); } finally { removeProcessListener(this); } }
startNotified
285,334
void (@NotNull String text) { notifyTextAvailable(text, ProcessOutputTypes.STDOUT); }
onTextAvailable
285,335
void (@NotNull String text) { notifyTextAvailable(text, ProcessOutputTypes.STDERR); }
onTextAvailable
285,336
void () { try { setClosed(false); while (true) { final boolean read = readAvailable(); if (myRemoteProcess.isDisconnected()) { myReader.close(); break; } if (isStopped) { break; } Thread.sleep(mySleepingPolicy.getTimeToSleep(read)); // give other threads a chance } } catch (InterruptedException ignore) { } catch (Exception e) { LOG.warn(e); } finally { setClosed(true); } }
doRun
285,337
String () { int ind = myPath.lastIndexOf(getSeparator(myWin)); if (ind != -1 && ind < myPath.length() - 1) { //not last char return myPath.substring(ind + 1); } else { return myPath; } }
getName
285,338
String (@NotNull String parent, @NotNull String child, boolean win) { String separator = getSeparator(win); String path; if (parent.endsWith(separator)) { path = parent + child; } else { path = parent + separator + child; } return path; }
resolveChild
285,339
String (boolean win) { String separator; if (win) { separator = "\\"; } else { separator = "/"; } return separator; }
getSeparator
285,340
String () { return myPath; }
getPath
285,341
boolean () { return isWindowsPath(myPath); }
isWin
285,342
boolean (@NotNull String path) { path = RemoteSdkCredentialsHolder.getInterpreterPathFromFullPath(path); return OSAgnosticPathUtil.startsWithWindowsDrive(path); }
isWindowsPath
285,343
String (@NotNull String path, boolean isWin) { char separator = isWin ? '\\' : '/'; return FileUtil.toSystemIndependentName(path).replace('/', separator); }
toSystemDependent
285,344
RemoteFileBuilder (@NotNull String path) { return new RemoteFileBuilder(isWindowsPath(path)); }
detectSystemByPath
285,345
RemoteFile (String path, String script) { return detectSystemByPath(path).createRemoteFile(path, script); }
createRemoteFile
285,346
RemoteFile (String path) { return detectSystemByPath(path).createRemoteFile(path); }
createRemoteFile
285,347
RemoteFile (final String path, final String script, final boolean isWindows) { return new RemoteFileBuilder(isWindows).createRemoteFile(path, script); }
createRemoteFile
285,348
RemoteFile (String path) { return new RemoteFile(path, isWin); }
createRemoteFile
285,349
RemoteFile (String path, String child) { return new RemoteFile(path, child, isWin); }
createRemoteFile
285,350
String (@NotNull RemoteSdkCredentials cred) { @NlsSafe StringBuilder builder = new StringBuilder(); if (cred.isRunAsRootViaSudo()) { builder.append("sudo+"); } return builder .append(getCredentialsString(cred)) .append(cred.getInterpreterPath()) .toString(); }
constructSshCredentialsSdkFullPath
285,351
String (String fullPath) { if (fullPath.startsWith(SSH_PREFIX)) { fullPath = fullPath.substring(SSH_PREFIX.length()); int index = fullPath.indexOf(":"); if (index != -1) { fullPath = fullPath.substring(index + 1); // it is like 8080/home/user or 8080C:\Windows index = 0; while (index < fullPath.length() && Character.isDigit(fullPath.charAt(index))) { index++; } if (index < fullPath.length()) { return fullPath.substring(index); } } } return fullPath; }
getInterpreterPathFromFullPath
285,352
RemoteSdkPropertiesHolder () { return myRemoteSdkProperties; }
getRemoteSdkProperties
285,353
String () { return myRemoteSdkProperties.getInterpreterPath(); }
getInterpreterPath
285,354
void (String interpreterPath) { myRemoteSdkProperties.setInterpreterPath(interpreterPath); }
setInterpreterPath
285,355
String () { return myRemoteSdkProperties.getHelpersPath(); }
getHelpersPath
285,356
void (String helpersPath) { myRemoteSdkProperties.setHelpersPath(helpersPath); }
setHelpersPath
285,357
String () { return myRemoteSdkProperties.getDefaultHelpersName(); }
getDefaultHelpersName
285,358
PathMappingSettings () { return myRemoteSdkProperties.getPathMappings(); }
getPathMappings
285,359
void (@Nullable PathMappingSettings pathMappings) { myRemoteSdkProperties.setPathMappings(pathMappings); }
setPathMappings
285,360
boolean () { return myRemoteSdkProperties.isHelpersVersionChecked(); }
isHelpersVersionChecked
285,361
void (boolean helpersVersionChecked) { myRemoteSdkProperties.setHelpersVersionChecked(helpersVersionChecked); }
setHelpersVersionChecked
285,362
String () { return constructSshCredentialsSdkFullPath(this); }
getFullInterpreterPath
285,363
void (String sdkId) { myRemoteSdkProperties.setSdkId(sdkId); }
setSdkId
285,364
String () { return myRemoteSdkProperties.getSdkId(); }
getSdkId
285,365
boolean () { return myRemoteSdkProperties.isValid(); }
isValid
285,366
void (boolean valid) { myRemoteSdkProperties.setValid(valid); }
setValid
285,367
boolean () { return myRemoteSdkProperties.isRunAsRootViaSudo(); }
isRunAsRootViaSudo
285,368
void (boolean runAsRootViaSudo) { myRemoteSdkProperties.setRunAsRootViaSudo(runAsRootViaSudo); }
setRunAsRootViaSudo
285,369
boolean (@Nullable String path) { if (path != null) { for (CredentialsType<?> type : CredentialsManager.getInstance().getAllTypes()) { if (type.hasPrefix(path)) { return true; } } } return false; }
isRemoteSdk
285,370
void (Element element) { super.load(element); myRemoteSdkProperties.load(element); }
load
285,371
void (Element rootElement) { super.save(rootElement); myRemoteSdkProperties.save(rootElement); }
save
285,372
boolean (Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; RemoteSdkCredentialsHolder holder = (RemoteSdkCredentialsHolder)o; if (!getLiteralPort().equals(holder.getLiteralPort())) return false; if (isStorePassphrase() != holder.isStorePassphrase()) return false; if (isStorePassword() != holder.isStorePassword()) return false; if (getAuthType() != holder.getAuthType()) return false; if (!getHost().equals(holder.getHost())) return false; if (getPassphrase() != null ? !getPassphrase().equals(holder.getPassphrase()) : holder.getPassphrase() != null) return false; if (getPassword() != null ? !getPassword().equals(holder.getPassword()) : holder.getPassword() != null) return false; if (!getPrivateKeyFile().equals(holder.getPrivateKeyFile())) { return false; } if (getUserName() != null ? !getUserName().equals(holder.getUserName()) : holder.getUserName() != null) return false; if (!myRemoteSdkProperties.equals(holder.myRemoteSdkProperties)) { return false; } return true; }
equals
285,373
int () { int result = getHost().hashCode(); result = 31 * result + getLiteralPort().hashCode(); result = 31 * result + (getUserName() != null ? getUserName().hashCode() : 0); result = 31 * result + (getPassword() != null ? getPassword().hashCode() : 0); result = 31 * result + getAuthType().hashCode(); result = 31 * result + getPrivateKeyFile().hashCode(); result = 31 * result + (getPassphrase() != null ? getPassphrase().hashCode() : 0); result = 31 * result + (isStorePassword() ? 1 : 0); result = 31 * result + (isStorePassphrase() ? 1 : 0); result = 31 * result + myRemoteSdkProperties.hashCode(); return result; }
hashCode
285,374
String () { return "RemoteSdkDataHolder" + "{getHost()='" + getHost() + '\'' + ", getLiteralPort()=" + getLiteralPort() + ", getUserName()='" + getUserName() + '\'' + ", myInterpreterPath='" + getInterpreterPath() + '\'' + ", isRunAsRootViaSudo=" + isRunAsRootViaSudo() + ", myHelpersPath='" + getHelpersPath() + '\'' + '}'; }
toString
285,375
void (RemoteSdkCredentialsHolder to) { super.copyRemoteCredentialsTo(to); myRemoteSdkProperties.copyTo(to.getRemoteSdkProperties()); }
copyRemoteSdkCredentialsTo
285,376
boolean () { return myId != null; }
hasId
285,377
boolean () { return myName != null; }
hasName
285,378
boolean (Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; PresentableId id = (PresentableId) o; return Objects.equals(myId, id.myId) && Objects.equals(myName, id.myName); }
equals
285,379
int () { return Objects.hash(myId, myName); }
hashCode
285,380
PresentableId () { try { return (PresentableId) super.clone(); } catch (CloneNotSupportedException e) { throw new RuntimeException(e); } }
clone
285,381
String () { return "PresentableId{" + "myId='" + myId + '\'' + ", myName='" + myName + '\'' + '}'; }
toString
285,382
Object () { return getCredentials(); }
getConnectionKey
285,383
void (final Element rootElement) { getTypeHandler().save(rootElement); }
save
285,384
IllegalStateException () { return new IllegalStateException("Unknown connection type"); //TODO }
unknownConnectionType
285,385
void (final RemoteConnectionCredentialsWrapper copy) { copy.myCredentialsTypeHolder = new UserDataHolderBase(); Pair<Object, CredentialsType> credentialsAndProvider = getCredentialsAndType(); credentialsAndProvider.getSecond().putCredentials(copy.myCredentialsTypeHolder, credentialsAndProvider.getFirst()); }
copyTo
285,386
String () { return getTypeHandler().getId(); }
getId
285,387
RemoteCredentialsHandler () { Pair<Object, CredentialsType> credentialsAndType = getCredentialsAndType(); return credentialsAndType.getSecond().getHandler(credentialsAndType.getFirst()); }
getTypeHandler
285,388
CredentialsType () { return getCredentialsAndType().getSecond(); }
getRemoteConnectionType
285,389
Object () { return getCredentialsAndType().getFirst(); }
getCredentials
285,390
void (CredentialsCase... cases) { Pair<Object, CredentialsType> credentialsAndType = getCredentialsAndType(); CredentialsType type = credentialsAndType.getSecond(); for (CredentialsCase credentialsCase : cases) { if (credentialsCase.getType() == type) { credentialsCase.process(credentialsAndType.getFirst()); return; } } }
switchType
285,391
boolean (Object obj) { if (obj instanceof RemoteConnectionCredentialsWrapper w) { try { Object credentials = getCredentials(); Object counterCredentials = w.getCredentials(); return credentials.equals(counterCredentials); } catch (IllegalStateException e) { return false; } } return false; }
equals
285,392
String (final String interpreterPath) { return getTypeHandler().getPresentableDetails(interpreterPath); }
getPresentableDetails
285,393
long () { return pid; }
pid
285,394
Key<UnknownCredentialsHolder> () { return UNKNOWN_CREDENTIALS; }
getCredentialsKey
285,395
RemoteCredentialsHandler (UnknownCredentialsHolder credentials) { return new UnknownTypeRemoteCredentialHandler(credentials); }
getHandler
285,396
UnknownCredentialsHolder () { return new UnknownCredentialsHolder(); }
createCredentials
285,397
T (UserDataHolderBase dataHolder) { return dataHolder.getUserData(getCredentialsKey()); }
getCredentials
285,398
void (UserDataHolderBase dataHolder, T credentials) { dataHolder.putUserData(getCredentialsKey(), credentials); }
putCredentials
285,399
boolean (String path) { return path.startsWith(myPrefix) || path.startsWith(mySystemDependentPrefix) || path.startsWith(mySystemIndependentPrefix); }
hasPrefix