auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void before() { final StateStoreProviderStub stubProviderOne = new StateStoreProviderStub(false); stubProviderTwo = new StateStoreProviderStub(false); stubOneUnderlying = newStoreInstance(); stubProviderOne.addStore(storeName, stubOneUnderlying); otherUnderlyingStore = newStoreInstance(); stubProviderOne.addStore("other-store", otherUnderlyingStore); theStore = new CompositeReadOnlyKeyValueStore<>( new WrappingStoreProvider(Arrays.<StateStoreProvider>asList(stubProviderOne, stubProviderTwo)), QueryableStoreTypes.<String, String>keyValueStore(), storeName, false); }

Target:
public void before() { final StateStoreProviderStub stubProviderOne = new StateStoreProviderStub(false); stubProviderTwo = new StateStoreProviderStub(false); stubOneUnderlying = newStoreInstance(); stubProviderOne.addStore(storeName, stubOneUnderlying); otherUnderlyingStore = newStoreInstance(); stubProviderOne.addStore("other-store", otherUnderlyingStore); theStore = new CompositeReadOnlyKeyValueStore<>( new WrappingStoreProvider(asList(stubProviderOne, stubProviderTwo), false), QueryableStoreTypes.keyValueStore(), storeName ); }
Source:
protected Function<GridCellValueTuple, Command> newCellHasValueCommand() { return (gcv) -> new SetCellValueCommand(gcv, () -> uiModelMapper, gridLayer::batch); }

Target:
protected Function<GridCellValueTuple, Command> newCellHasValueCommand() { return (gridCellValueTuple) -> new SetCellValueCommand(gridCellValueTuple, () -> uiModelMapper, gridLayer::batch); }
Source:
public boolean revertSnapshot(SnapshotInfo snapshot) { if (canHandle(snapshot,SnapshotOperation.REVERT) == StrategyPriority.CANT_HANDLE) { throw new UnsupportedOperationException("Reverting not supported. Create a template or volume based on the snapshot instead."); } SnapshotVO snapshotVO = _snapshotDao.acquireInLockTable(snapshot.getId()); if (snapshotVO == null) { throw new CloudRuntimeException("Failed to get lock on snapshot:" + snapshot.getId()); } try { VolumeInfo volumeInfo = snapshot.getBaseVolume(); StoragePool store = (StoragePool)volumeInfo.getDataStore(); if (store != null && store.getStatus() != StoragePoolStatus.Up) { snapshot.processEvent(Event.OperationFailed); throw new CloudRuntimeException("store is not in up state"); } volumeInfo.stateTransit(Volume.Event.RevertSnapshotRequested); boolean result = false; try { result = snapshotSvr.revertSnapshot(snapshot); if (!result) { s_logger.debug("Failed to revert snapshot: " + snapshot.getId()); throw new CloudRuntimeException("Failed to revert snapshot: " + snapshot.getId()); } } finally { if (result) { volumeInfo.stateTransit(Volume.Event.OperationSucceeded); } else { volumeInfo.stateTransit(Volume.Event.OperationFailed); } } return result; } finally { if (snapshotVO != null) { _snapshotDao.releaseFromLockTable(snapshot.getId()); } } }

Target:
public boolean revertSnapshot(SnapshotInfo snapshot) { if (canHandle(snapshot,SnapshotOperation.REVERT) == StrategyPriority.CANT_HANDLE) { throw new CloudRuntimeException("Reverting not supported. Create a template or volume based on the snapshot instead."); } SnapshotVO snapshotVO = snapshotDao.acquireInLockTable(snapshot.getId()); if (snapshotVO == null) { throw new CloudRuntimeException("Failed to get lock on snapshot:" + snapshot.getId()); } try { VolumeInfo volumeInfo = snapshot.getBaseVolume(); StoragePool store = (StoragePool)volumeInfo.getDataStore(); if (store != null && store.getStatus() != StoragePoolStatus.Up) { snapshot.processEvent(Event.OperationFailed); throw new CloudRuntimeException("store is not in up state"); } volumeInfo.stateTransit(Volume.Event.RevertSnapshotRequested); boolean result = false; try { result = snapshotSvr.revertSnapshot(snapshot); if (!result) { s_logger.debug("Failed to revert snapshot: " + snapshot.getId()); throw new CloudRuntimeException("Failed to revert snapshot: " + snapshot.getId()); } } finally { if (result) { volumeInfo.stateTransit(Volume.Event.OperationSucceeded); } else { volumeInfo.stateTransit(Volume.Event.OperationFailed); } } return result; } finally { if (snapshotVO != null) { snapshotDao.releaseFromLockTable(snapshot.getId()); } } }
Source:
public boolean isBootstrapInProgress() { throw new UnsupportedOperationException("Method not supported"); }

Target:
public boolean isBootstrapInProgress() { return false; }
Source:
public List<String> getBundleIds() { String query = QueryHelper.select(BundleInfo.TYPE_NAME, doc, NXQL.ECM_POS); DocumentModelList docs = getCoreSession().query(query); return docs.stream() .map(doc -> doc.getAdapter(BundleInfo.class)) .filter(Objects::nonNull) .filter(b -> !b.getId().equals(getId())) .map(BundleInfo::getId) .collect(Collectors.toList()); }

Target:
public List<String> getBundleIds() { String query = QueryHelper.select(BundleInfo.TYPE_NAME, doc, NXQL.ECM_POS); DocumentModelList docs = getCoreSession().query(query); return docs.stream() .map(doc -> doc.getAdapter(BundleInfo.class)) .filter(Objects::nonNull) .map(BundleInfo::getId) .filter(Predicate.not(Predicate.isEqual(getId()))) .collect(Collectors.toList()); }
Source:
public String getDisplayName() { StringBuilder transformedName = new StringBuilder(TestNameTransformer.getTransformedName(testName)); if (this.archiveId != null) { transformedName.insert(0, "[" + this.archiveId + "]"); } return transformedName.toString(); }

Target:
public String getDisplayName() { String archiveId = this.parent != null ? Util.fixEmptyAndTrim(parent.getArchiveId()) : null; if (archiveId == null) { return TestNameTransformer.getTransformedName(testName); } else { return "[" + archiveId + "] " + TestNameTransformer.getTransformedName(testName); } }
Source:
private void checkDelete() throws Exception { if (getRefCount() <= 0) { if (logger.isTraceEnabled()) { logger.trace("Deleting file " + file + " as the usage was complete"); } try { deleteFile(); } catch (Exception e) { ActiveMQServerLogger.LOGGER.failedToDeleteFile(e); } } }

Target:
private void checkDelete() throws Exception { if (getRefCount() <= 0) { if (logger.isTraceEnabled()) { logger.trace("Deleting file " + file + " as the usage was complete"); } try { deleteFile(); } catch (Exception e) { ActiveMQServerLogger.LOGGER.error(e.getMessage(), e); } } }
Source:
public boolean needsSpinnerWidget(EStructuralFeature eStructuralFeature) { boolean needsTextWidget = false; needsTextWidget = needsTextWidget || INT.equals(eStructuralFeature.getEType().getInstanceTypeName()); needsTextWidget = needsTextWidget || JAVA_LANG_INTEGER.equals(eStructuralFeature.getEType().getInstanceTypeName()); needsTextWidget = needsTextWidget || FLOAT.equals(eStructuralFeature.getEType().getInstanceTypeName()); needsTextWidget = needsTextWidget || JAVA_LANG_FLOAT.equals(eStructuralFeature.getEType().getInstanceTypeName()); needsTextWidget = needsTextWidget || DOUBLE.equals(eStructuralFeature.getEType().getInstanceTypeName()); needsTextWidget = needsTextWidget || JAVA_LANG_DOUBLE.equals(eStructuralFeature.getEType().getInstanceTypeName()); needsTextWidget = needsTextWidget || LONG.equals(eStructuralFeature.getEType().getInstanceTypeName()); needsTextWidget = needsTextWidget || JAVA_LANG_LONG.equals(eStructuralFeature.getEType().getInstanceTypeName()); needsTextWidget = needsTextWidget || SHORT.equals(eStructuralFeature.getEType().getInstanceTypeName()); needsTextWidget = needsTextWidget || JAVA_LANG_SHORT.equals(eStructuralFeature.getEType().getInstanceTypeName()); return needsTextWidget && !eStructuralFeature.isMany(); }

Target:
public boolean needsSpinnerWidget(EStructuralFeature eStructuralFeature) { boolean needsSpinnerWidget = false; needsSpinnerWidget = needsSpinnerWidget || INT.equals(eStructuralFeature.getEType().getInstanceTypeName()); needsSpinnerWidget = needsSpinnerWidget || JAVA_LANG_INTEGER.equals(eStructuralFeature.getEType().getInstanceTypeName()); needsSpinnerWidget = needsSpinnerWidget || FLOAT.equals(eStructuralFeature.getEType().getInstanceTypeName()); needsSpinnerWidget = needsSpinnerWidget || JAVA_LANG_FLOAT.equals(eStructuralFeature.getEType().getInstanceTypeName()); needsSpinnerWidget = needsSpinnerWidget || DOUBLE.equals(eStructuralFeature.getEType().getInstanceTypeName()); needsSpinnerWidget = needsSpinnerWidget || JAVA_LANG_DOUBLE.equals(eStructuralFeature.getEType().getInstanceTypeName()); needsSpinnerWidget = needsSpinnerWidget || LONG.equals(eStructuralFeature.getEType().getInstanceTypeName()); needsSpinnerWidget = needsSpinnerWidget || JAVA_LANG_LONG.equals(eStructuralFeature.getEType().getInstanceTypeName()); needsSpinnerWidget = needsSpinnerWidget || SHORT.equals(eStructuralFeature.getEType().getInstanceTypeName()); needsSpinnerWidget = needsSpinnerWidget || JAVA_LANG_SHORT.equals(eStructuralFeature.getEType().getInstanceTypeName()); return needsSpinnerWidget && !eStructuralFeature.isMany(); }
Source:
public void execute(IMacroPlaybackContext macroPlaybackContext) { IEditorPart activeEditor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage() .getActiveEditor(); Control control = activeEditor.getAdapter(Control.class); if (control instanceof StyledText) { StyledText styledText = (StyledText) control; styledText.notifyListeners(SWT.KeyDown, fEvent); Event keyUpEvent = new Event(); keyUpEvent.keyCode = fEvent.keyCode; keyUpEvent.stateMask = fEvent.stateMask; keyUpEvent.type = SWT.KeyUp; keyUpEvent.character = fEvent.character; styledText.notifyListeners(SWT.KeyUp, keyUpEvent); } }

Target:
public void execute(IMacroPlaybackContext macroPlaybackContext) { IWorkbenchWindow activeWorkbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); if (activeWorkbenchWindow == null) { return; } IWorkbenchPage activePage = activeWorkbenchWindow.getActivePage(); if (activePage == null) { return; } IEditorPart activeEditor = activePage.getActiveEditor(); if (activeEditor == null) { return; } Control control = activeEditor.getAdapter(Control.class); if (control instanceof StyledText) { StyledText styledText = (StyledText) control; styledText.notifyListeners(SWT.KeyDown, fEvent); Event keyUpEvent = new Event(); keyUpEvent.keyCode = fEvent.keyCode; keyUpEvent.stateMask = fEvent.stateMask; keyUpEvent.type = SWT.KeyUp; keyUpEvent.character = fEvent.character; styledText.notifyListeners(SWT.KeyUp, keyUpEvent); } }
Source:
public List<BasicQueryInfo> getAllQueryInfo(@QueryParam("state") String queryState) { return queryManager.getAllQueryInfo() .stream() .filter(queryInfo -> includeQueryInfo(queryInfo, queryState)) .map(BasicQueryInfo::new) .collect(toImmutableList()); }

Target:
public List<BasicQueryInfo> getAllQueryInfo(@QueryParam("state") String queryState) { ImmutableList.Builder<BasicQueryInfo> builder = new ImmutableList.Builder<>(); for (QueryInfo queryInfo : queryManager.getAllQueryInfo()) { if (queryState == null || queryInfo.getState().equals(QueryState.valueOf(queryState.toUpperCase(Locale.ENGLISH)))) { builder.add(new BasicQueryInfo(queryInfo)); } } return builder.build(); }
Source:
public void compute(final Vertex<Long, Long> vertex, final Iterable<Long> messages) { if (getSuperstep() == 0) { vertex.setValue(Long.MAX_VALUE); } Long minDist = sourceId.equals(vertex.getId()) ? 0L : Long.MAX_VALUE; for (final Long message : messages) { if (message < minDist) { minDist = message; } } if (minDist < vertex.getValue()) { vertex.setValue(minDist); for (final Edge edge : vertex.getEdges()) { final Long distance = minDist + (Long) edge.getValue(); getMsgFutureList().add(sendMessage(edge.getTargetVertexId(), distance)); } } vertex.voteToHalt(); }

Target:
public void compute(final Vertex<Long, Long> vertex, final Iterable<Long> messages) { if (getSuperstep() == 0) { vertex.setValue(Long.MAX_VALUE); } Long minDist = sourceId.equals(vertex.getId()) ? 0L : Long.MAX_VALUE; for (final Long message : messages) { if (message < minDist) { minDist = message; } } if (minDist < vertex.getValue()) { vertex.setValue(minDist); for (final Edge<Long> edge : vertex.getEdges()) { final Long distance = minDist + edge.getValue(); sendMessage(edge.getTargetVertexId(), distance); } } vertex.voteToHalt(); }
Source:
private void performSMSInstall(boolean installTriggeredManually){ String profileLink = null; try { profileLink = this.scanSMSLinks(); } catch(SignatureException e){ e.printStackTrace(); Toast.makeText(this, Localization.get("menu.sms.not.verified"), Toast.LENGTH_LONG).show(); } if (profileLink != null) { Log.v("install", "Performing SMS install with link : " + incomingRef); incomingRef = profileLink; if (installTriggeredManually) { startResourceInstall(); } else { uiState = UiState.READY_TO_INSTALL; Toast.makeText(this, Localization.get("menu.sms.ready"), Toast.LENGTH_LONG).show(); } } else if(installTriggeredManually) { Toast.makeText(this, Localization.get("menu.sms.not.found"), Toast.LENGTH_LONG).show(); } }

Target:
private void performSMSInstall(boolean installTriggeredManually){ this.scanSMSLinks(installTriggeredManually); }
Source:
private static int byteArrayCompare( byte[] a, byte[] b ) { assert a != null && b != null : "Null arrays not supported."; if ( a == b ) { return 0; } int length = Math.min( a.length, b.length ); for ( int i = 0; i < length; i++ ) { int compare = Byte.compare( a[i], b[i] ); if ( compare != 0 ) { return compare; } } if ( a.length < b.length ) { return -1; } if ( a.length > b.length ) { return 1; } return 0; }

Target:
private static int byteArrayCompare( byte[] a, byte[] b ) { assert a != null && b != null : "Null arrays not supported."; if ( a == b ) { return 0; } int length = Math.min( a.length, b.length ); for ( int i = 0; i < length; i++ ) { int compare = Byte.compare( a[i], b[i] ); if ( compare != 0 ) { return compare; } } return Integer.compare( a.length, b.length ); }
Source:
private void checkInvalidKeys(RefactoringStatus status) { for (NLSSubstitution fSubstitution : fSubstitutions) { if (!isKeyValid(fSubstitution, status)) { return; } } }

Target:
private void checkInvalidKeys(RefactoringStatus status) { for (NLSSubstitution substitution : fSubstitutions) { if (!isKeyValid(substitution, status)) { return; } } }
Source:
public boolean checkTrigger(GameEvent event, Game game) { if (!Objects.equals(this.getControllerId(), event.getTargetId())) { UUID sourceControllerId = game.getControllerId(event.getSourceId()); if (sourceControllerId != null && sourceControllerId.equals(this.getControllerId()) && this.getSourceId() != event.getSourceId() ) { return true; } } return false; }

Target:
public boolean checkTrigger(GameEvent event, Game game) { Player controller = game.getPlayer(this.getControllerId()); if(controller==null){return false;} if(controller.hasOpponent(event.getTargetId(),game)){ UUID sourceControllerId = game.getControllerId(event.getSourceId()); if (sourceControllerId != null && sourceControllerId.equals(this.getControllerId()) && this.getSourceId() != event.getSourceId() ) { return true; } } return false; }
Source:
private Group renderTrack() { Group result = new Group(); for (int i = 0; i < 100; i++) { for (int j = 0; j < 3; j++) { final Box trackPiece = new Box(1.5, 0, 1.5); trackPiece.setTranslateX(j - 1); trackPiece.setTranslateZ(i); trackPiece.setMaterial(Style.FLOOR); trackPiece.setCache(true); trackPiece.setCacheHint(CacheHint.SPEED); result.getChildren().add(trackPiece); } } return result; }

Target:
private Group renderTrack() { Group result = new Group(); final double trackBoxX = 1.5; final double trackBoxZ = 1.5; for (int i = 0; i < (int) Track.LENGTH; i++) { for (int j = 0; j < Track.WIDTH; j++) { final Box trackPiece = new Box( trackBoxX, 0, trackBoxZ); trackPiece.setTranslateX(j - 1); trackPiece.setTranslateZ(i); trackPiece.setMaterial(Style.FLOOR); trackPiece.setCache(true); trackPiece.setCacheHint(CacheHint.SPEED); result.getChildren().add(trackPiece); } } return result; }
Source:
public String toString() { return "ZtestPostAggregator{" + "name='" + name + '\'' + ", fields=" + fields + "}"; }

Target:
public String toString() { return "ZtestPostAggregator{" + "name='" + name + '\'' + ", successCount1='" + successCount1 + '\'' + ", sample1Size='" + sample1Size + '\'' + ", successCount2='" + successCount2 + '\'' + ", sample2size='" + sample2Size + '}'; }
Source:
private void updateSnapshotIdOnShareableChange(Disk oldDisk, Disk newDisk) { if (oldDisk.isShareable() != newDisk.isShareable() && oldDisk.getDiskStorageType() == DiskStorageType.IMAGE) { DiskImage diskImage = (DiskImage) oldDisk; Guid vmSnapshotId = isUpdatedToShareable(oldDisk, newDisk) ? null : getSnapshotDao().getId(getVmId(), SnapshotType.ACTIVE); diskImage.setVmSnapshotId(vmSnapshotId); } }

Target:
private void updateSnapshotIdOnShareableChange(Disk oldDisk, Disk newDisk) { if (oldDisk.isShareable() != newDisk.isShareable() && oldDisk.getDiskStorageType() == DiskStorageType.IMAGE) { DiskImage oldDiskImage = (DiskImage) oldDisk; Guid vmSnapshotId = isUpdatedToShareable(oldDisk, newDisk) ? null : getSnapshotDao().getId(getVmId(), SnapshotType.ACTIVE); oldDiskImage.setVmSnapshotId(vmSnapshotId); } }
Source:
void addPermGen(JvmElement jvmElement, List<String> command) { if (version >= 1.8f) return; String permgen = jvmElement.getPermgenSize(); String maxPermgen = jvmElement.getMaxPermgen(); if (maxPermgen == null && permgen != null) { maxPermgen = permgen; } if (permgen == null && maxPermgen != null) { permgen = maxPermgen; } if (permgen != null) { command.add("-XX:PermSize=" + permgen); } if (maxPermgen != null) { command.add("-XX:MaxPermSize=" + maxPermgen); } }

Target:
void addPermGen(JvmElement jvmElement, List<String> command) { if (JVM_MAJOR_VERSION >= 8) return; String permgen = jvmElement.getPermgenSize(); String maxPermgen = jvmElement.getMaxPermgen(); if (maxPermgen == null && permgen != null) { maxPermgen = permgen; } if (permgen == null && maxPermgen != null) { permgen = maxPermgen; } if (permgen != null) { command.add("-XX:PermSize=" + permgen); } if (maxPermgen != null) { command.add("-XX:MaxPermSize=" + maxPermgen); } }
Source:
public long takeSnapshot() throws IOException { TermIndex ti = getLastAppliedTermIndex(); long startTime = Time.monotonicNow(); if (!isStateMachineHealthy.get()) { String msg = "Failed to take snapshot " + " for " + gid + " as the stateMachine" + " is unhealthy. The last applied index is at " + ti; StateMachineException sme = new StateMachineException(msg); throw sme; } if (ti != null && ti.getIndex() != RaftLog.INVALID_LOG_INDEX) { final File snapshotFile = storage.getSnapshotFile(ti.getTerm(), ti.getIndex()); LOG.info("{}: Taking a snapshot at:{} file {}", gid, ti, snapshotFile); try (FileOutputStream fos = new FileOutputStream(snapshotFile)) { persistContainerSet(fos); fos.flush(); fos.getFD().sync(); } catch (IOException ioe) { LOG.error("{}: Failed to write snapshot at:{} file {}", gid, ti, snapshotFile); throw ioe; } LOG.info("{}: Finished taking a snapshot at:{} file:{} time:{}", gid, ti, snapshotFile, (Time.monotonicNow() - startTime)); return ti.getIndex(); } return -1; }

Target:
public long takeSnapshot() throws IOException { TermIndex ti = getLastAppliedTermIndex(); long startTime = Time.monotonicNow(); if (!isStateMachineHealthy.get()) { String msg = "Failed to take snapshot " + " for " + gid + " as the stateMachine" + " is unhealthy. The last applied index is at " + ti; StateMachineException sme = new StateMachineException(msg); LOG.error(msg); throw sme; } if (ti != null && ti.getIndex() != RaftLog.INVALID_LOG_INDEX) { final File snapshotFile = storage.getSnapshotFile(ti.getTerm(), ti.getIndex()); LOG.info("{}: Taking a snapshot at:{} file {}", gid, ti, snapshotFile); try (FileOutputStream fos = new FileOutputStream(snapshotFile)) { persistContainerSet(fos); fos.flush(); fos.getFD().sync(); } catch (IOException ioe) { LOG.error("{}: Failed to write snapshot at:{} file {}", gid, ti, snapshotFile); throw ioe; } LOG.info("{}: Finished taking a snapshot at:{} file:{} time:{}", gid, ti, snapshotFile, (Time.monotonicNow() - startTime)); return ti.getIndex(); } return -1; }
Source:
public ConfigMap get(String configMapName) throws InfrastructureException { return clientFactory .create(workspaceId) .configMaps() .inNamespace(namespace) .withName(configMapName) .get(); }

Target:
public Optional<ConfigMap> get(String configMapName) throws InfrastructureException { return Optional.ofNullable( clientFactory .create(workspaceId) .configMaps() .inNamespace(namespace) .withName(configMapName) .get()); }
Source:
public Span value(final byte[] value) { if (includeValues) { span.putAttribute("value_hex", stringAttributeValue(HEX.encode(value))); } span.putAttribute("value_size", longAttributeValue(value.length)); return this; }

Target:
public Span value(final byte[] value) { if (includeValues) { span.putAttribute("value_hex", stringAttributeValue(HEX.encode(value))); } span.putAttribute("value_size_bytes", longAttributeValue(value.length)); return this; }
Source:
public void handleRemoval() { if (connMan == null) { Configuration configuration = this.getConfig(); String[] loginConfig = getLoginConfig(configuration); this.connMan = new ConnectionManagerImpl(loginConfig[0], loginConfig[1], loginConfig[2], loginConfig[3], this); } if (connMan.removeApplicationToken()) { logger.debug("Application-Token deleated"); updateStatus(ThingStatus.REMOVED); } }

Target:
public void handleRemoval() { if (StringUtils.isNotBlank((String) super.getConfig().get(APPLICATION_TOKEN))) { if (connMan == null) { Config config = loadAndCheckConnectionData(this.getConfig()); if (config != null) { this.connMan = new ConnectionManagerImpl(config, null, false); } else { updateStatus(ThingStatus.REMOVED); return; } } if (connMan.removeApplicationToken()) { logger.debug("Application-Token deleted"); } } updateStatus(ThingStatus.REMOVED); }
Source:
public <T> CompletableFuture<T> send(final Request<T> request) { if (!tryIncrementPending()) { String disconnectReason = this.disconnectReason.get(); if (disconnectReason != null) { return newExceptionallyCompletedFuture(new MemcacheClosedException(disconnectReason)); } return newExceptionallyCompletedFuture(new MemcacheOverloadedException( "too many outstanding requests")); } if (request instanceof SetRequest) { SetRequest setRequest = (SetRequest) request; byte[] value = setRequest.getValue(); if (value.length > maxSetLength) { return (CompletableFuture<T>) newCompletedFuture(MemcacheStatus.VALUE_TOO_LARGE); } } channel.write(request, new RequestWritePromise(channel, request)); flusher.flush(); return onExecutor(request); }

Target:
public <T> CompletionStage<T> send(final Request<T> request) { if (!tryIncrementPending()) { String disconnectReason = this.disconnectReason.get(); if (disconnectReason != null) { return newExceptionallyCompletedFuture(new MemcacheClosedException(disconnectReason)); } return newExceptionallyCompletedFuture(new MemcacheOverloadedException( "too many outstanding requests")); } if (request instanceof SetRequest) { SetRequest setRequest = (SetRequest) request; byte[] value = setRequest.getValue(); if (value.length > maxSetLength) { return (CompletionStage<T>) newCompletedFuture(MemcacheStatus.VALUE_TOO_LARGE); } } channel.write(request, new RequestWritePromise(channel, request)); flusher.flush(); return onExecutor(request); }
Source:
private <T extends Number> ShouldBeEqualWithinPercentage(Number actual, Number expected, Percentage<T> percentage, double expectedPercentage) { super("%nExpecting:%n <%s>%nto be close to:%n <%s>%n" + "by less than <%s> percent but difference was <%s> percent.%n" + "(a difference of exactly <%s> being considered valid)", actual, expected, percentage.value, expectedPercentage, percentage.value); }

Target:
private <T extends Number> ShouldBeEqualWithinPercentage(Number actual, Number expected, Percentage<T> percentage, double expectedPercentage) { super("%nExpecting:%n <%s>%nto be close to:%n <%s>%n" + "by less than <%s>%% but difference was <%s>%%.%n" + "(a difference of exactly <%s> being considered valid)", actual, expected, percentage.value, expectedPercentage, percentage.value); }
Source:
public BasicQueryInfo getQueryInfo(QueryId queryId) { return getQuery(queryId).getBasicQueryInfo(); }

Target:
public BasicQueryInfo getQueryInfo(QueryId queryId) { return getQueryExecution(queryId).getBasicQueryInfo(); }
Source:
public InterpreterResult interpret(String cmd, InterpreterContext contextInterpreter) { this.context = contextInterpreter; if (cmd == null || cmd.isEmpty()) { return new InterpreterResult(Code.SUCCESS, ""); } String output = sendCommandToPython(cmd); InterpreterResult result; result = new InterpreterResult(Code.SUCCESS, output.replaceAll("\\.\\.\\.", "")); return result; }

Target:
public InterpreterResult interpret(String cmd, InterpreterContext contextInterpreter) { this.context = contextInterpreter; if (cmd == null || cmd.isEmpty()) { return new InterpreterResult(Code.SUCCESS, ""); } String output = sendCommandToPython(cmd); return new InterpreterResult(Code.SUCCESS, output.replaceAll("\\.\\.\\.", "")); }
Source:
public Response getPid(@QueryParam("persistentId") String persistentId) { try { User user = findUserOrDie(); if (!user.isSuperuser()) { return error(Response.Status.FORBIDDEN, BundleUtil.getStringFromBundle("admin.api.auth.mustBeSuperUser")); } } catch (WrappedResponse ex) { return error(Response.Status.FORBIDDEN, BundleUtil.getStringFromBundle("api.errors.invalidApiToken")); } String baseUrl = systemConfig.getDataCiteRestApiUrlString(); String username = System.getProperty("doi.username"); String password = System.getProperty("doi.password"); try { JsonObjectBuilder result = PidUtil.queryDoi(persistentId, baseUrl, username, password); return ok(result); } catch (Exception ex) { return error(Response.Status.BAD_REQUEST, ex.getLocalizedMessage()); } }

Target:
public Response getPid(@QueryParam("persistentId") String persistentId) { try { User user = findUserOrDie(); if (!user.isSuperuser()) { return error(Response.Status.FORBIDDEN, BundleUtil.getStringFromBundle("admin.api.auth.mustBeSuperUser")); } } catch (WrappedResponse ex) { return error(Response.Status.FORBIDDEN, BundleUtil.getStringFromBundle("api.errors.invalidApiToken")); } String baseUrl = systemConfig.getDataCiteRestApiUrlString(); String username = System.getProperty("doi.username"); String password = System.getProperty("doi.password"); try { JsonObjectBuilder result = PidUtil.queryDoi(persistentId, baseUrl, username, password); return ok(result); } catch (InternalServerErrorException ex) { return error(ex.getResponse().getStatusInfo().toEnum(), ex.getLocalizedMessage()); } }
Source:
private long getGraceTerminationPeriodSec(KubernetesEnvironment k8sEnv) { if (isEphemeral(k8sEnv.getAttributes()) && "true".equals(k8sEnv.getAttributes().get(ASYNC_PERSIST_ATTRIBUTE))) { return graceTerminationPeriodAsyncPvc; } return graceTerminationPeriodSec; }

Target:
private long getGraceTerminationPeriodSec(KubernetesEnvironment k8sEnv) { Map<String, String> attributes = k8sEnv.getAttributes(); if (isEphemeral(attributes) && parseBoolean(attributes.get(ASYNC_PERSIST_ATTRIBUTE))) { return GRACE_TERMINATION_PERIOD_ASYNC_STORAGE_WS_SEC; } return graceTerminationPeriodSec; }
Source:
public void init(){ EventLoops eventLoops; switch (args.eventLoopType) { default: case DIRECT_NIO: { eventLoops = new NioEventLoops(1); break; } case NETTY_NIO: { EventLoopGroup group = new NioEventLoopGroup(1); eventLoops = new NettyEventLoops(group); break; } case NETTY_EPOLL: { EventLoopGroup group = new EpollEventLoopGroup(1); eventLoops = new NettyEventLoops(group); break; } } try { ClientPolicy policy = new ClientPolicy(); policy.eventLoops = eventLoops; policy.user = args.user; policy.password = args.password; policy.authMode = args.authMode; policy.tlsPolicy = args.tlsPolicy; Host[] hosts = Host.parseHosts(args.host, args.port); client = new AerospikeClient(policy, hosts); this.reactorClient = new AerospikeReactorClient(client, eventLoops); try { args.setServerSpecific(client); } catch (Throwable re) { client.close(); throw re; } } catch (Throwable e) { eventLoops.close(); throw e; } }

Target:
public void init(){ switch (args.eventLoopType) { default: case DIRECT_NIO: { eventLoops = new NioEventLoops(1); break; } case NETTY_NIO: { EventLoopGroup group = new NioEventLoopGroup(1); eventLoops = new NettyEventLoops(group); break; } case NETTY_EPOLL: { EventLoopGroup group = new EpollEventLoopGroup(1); eventLoops = new NettyEventLoops(group); break; } } proxy = new TcpIpProxy(args.host, args.port); try { proxy.start(); ClientPolicy policy = new ClientPolicy(); policy.eventLoops = eventLoops; policy.user = args.user; policy.password = args.password; policy.authMode = args.authMode; policy.tlsPolicy = args.tlsPolicy; Host[] hosts = Host.parseHosts(proxy.getLocalAddress(), proxy.getLocalPort()); client = new AerospikeClient(policy, hosts); this.reactorClient = new AerospikeReactorClient(client, eventLoops); try { args.setServerSpecific(client); } catch (Throwable re) { client.close(); throw re; } } catch (Throwable e) { try { proxy.close(); } catch (Exception e1) { e1.printStackTrace(); } eventLoops.close(); throw new RuntimeException(e); } }
Source:
public BallColor getIconColor() { RunT lastBuild = getLastBuild(); while (lastBuild != null && lastBuild.hasntStartedYet()) lastBuild = lastBuild.getPreviousBuild(); if(DisableableJobMixIn.isDisabled(this)) return isBuilding() ? BallColor.DISABLED_ANIME : BallColor.DISABLED; else if (lastBuild != null) return lastBuild.getIconColor(); else return BallColor.NOTBUILT; }

Target:
public BallColor getIconColor() { RunT lastBuild = getLastBuild(); while (lastBuild != null && lastBuild.hasntStartedYet()) lastBuild = lastBuild.getPreviousBuild(); if(DisableableJobMixIn.isDisabled(this)) { return isBuilding() ? BallColor.DISABLED_ANIME : BallColor.DISABLED; } else if (lastBuild != null) { return lastBuild.getIconColor(); } else { return BallColor.NOTBUILT; } }
Source:
public void release() { RCLogger.i(TAG, "release()"); if (audioManager != null) { audioManager.close(); audioManager = null; } if (signalingClient != null) { signalingClient.close(); signalingClient = null; } state = DeviceState.OFFLINE; isServiceAttached = false; isServiceInitialized = false; if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) { stopForeground(true); } stopSelf(); }

Target:
public void release() { RCLogger.i(TAG, "release()"); if (audioManager != null) { audioManager.close(); audioManager = null; } if (signalingClient != null) { signalingClient.close(); signalingClient = null; } state = DeviceState.OFFLINE; isServiceAttached = false; isServiceInitialized = false; stopForeground(true); }
Source:
public BadgeBean(long userId) { populateBadges(userId); }

Target:
public BadgeBean(long userId) { badges = getBadges(userId); }
Source:
public static IOseeBranch getAtsBranch() { if (atsBranch == null) { if (atsBranch == null && AtsPreferencesService.isAvailable()) { try { String atsBranchUuid = AtsPreferencesService.get(ATS_BRANCH_UUID); setConfig(atsBranchUuid, AtsPreferencesService.get(ATS_BRANCH_NAME)); } catch (Exception ex) { OseeLog.log(AtsUtilCore.class, Level.SEVERE, "Error processing ats_branch.txt file.", ex); } } if (atsBranch == null) { String atsBranchUuid = System.getProperty(ATS_BRANCH_UUID); if (Strings.isValid(atsBranchUuid)) { setConfig(atsBranchUuid, System.getProperty(ATS_BRANCH_NAME)); } } if (atsBranch == null) { atsBranch = CoreBranches.COMMON; atsConfigName = CoreBranches.COMMON.getName(); } } return atsBranch; }

Target:
public synchronized static IOseeBranch getAtsBranch() { if (atsBranch == null) { if (atsBranch == null && AtsPreferencesService.isAvailable()) { try { String atsBranchUuid = AtsPreferencesService.get(ATS_BRANCH_UUID); setConfig(atsBranchUuid, AtsPreferencesService.get(ATS_BRANCH_NAME)); } catch (Exception ex) { OseeLog.log(AtsUtilCore.class, Level.SEVERE, "Error processing stored ATS Branch.", ex); } } if (atsBranch == null) { String atsBranchUuid = System.getProperty(ATS_BRANCH_UUID); if (Strings.isValid(atsBranchUuid)) { setConfig(atsBranchUuid, System.getProperty(ATS_BRANCH_NAME)); } } if (atsBranch == null) { atsBranch = CoreBranches.COMMON; atsConfigName = CoreBranches.COMMON.getName(); } } return atsBranch; }
Source:
public static String getStartedUrl() { try { String paHost = ProActiveInet.getInstance().getHostname(); Properties properties = readWebDeploymentProperties(); int httpPort = Integer.parseInt(properties.getProperty("ear.wrapper.target.server.http.port", "9080")); int httpsPort = Integer.parseInt(properties.getProperty("ear.wrapper.target.server.https.port", "9443")); boolean httpsEnabled = isHttpsEnabled(properties); int port = httpPort; String httpProtocol; if (httpsEnabled) { httpProtocol = "https"; port = httpsPort; } else { httpProtocol = "http"; } return httpProtocol + "://" + paHost + ":" + port; } catch (Exception e) { logger.warn("Could not find the getStarted URL", e); return null; } }

Target:
public static String getStartedUrl() { try { String paHost = ProActiveInet.getInstance().getHostname(); int port = WebProperties.WAR_WRAPPER_HTTP_PORT.getValueAsInt(); String contextRoot = WebProperties.WAR_WRAPPER_CONTEXT_ROOT.getValueAsString(); String httpProtocol; if (WebProperties.WAR_WRAPPER_HTTPS_ENABLED.getValueAsBoolean()) { httpProtocol = "https"; port = WebProperties.WAR_WRAPPER_HTTPS_PORT.getValueAsInt(); } else { httpProtocol = "http"; } return httpProtocol + "://" + paHost + ":" + port + contextRoot; } catch (Exception e) { logger.warn("Could not find the getStarted URL", e); return null; } }
Source:
public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } VdsStatistics other = (VdsStatistics) obj; return (ObjectUtils.objectsEqual(id, other.id) && ObjectUtils.bigDecimalEqual(cpu_idle, other.cpu_idle) && ObjectUtils.bigDecimalEqual(cpu_load, other.cpu_load) && ObjectUtils.bigDecimalEqual(cpu_sys, other.cpu_sys) && ObjectUtils.bigDecimalEqual(cpu_user, other.cpu_user) && ObjectUtils.objectsEqual(mem_available, other.mem_available) && ObjectUtils.objectsEqual(memFree, other.memFree) && ObjectUtils.objectsEqual(mem_shared, other.mem_shared) && ObjectUtils.objectsEqual(usage_cpu_percent, other.usage_cpu_percent) && ObjectUtils.objectsEqual(usage_network_percent, other.usage_network_percent) && ObjectUtils.objectsEqual(ksm_state, other.ksm_state) && ObjectUtils.objectsEqual(ksm_pages, other.ksm_pages) && ObjectUtils.objectsEqual(ksm_cpu_percent, other.ksm_cpu_percent) && ObjectUtils.objectsEqual(swap_total, other.swap_total) && ObjectUtils.objectsEqual(swap_free, other.swap_free) && ObjectUtils.objectsEqual(highlyAvailableScore, other.highlyAvailableScore) && ObjectUtils.objectsEqual(anonymousHugePages, other.anonymousHugePages)); }

Target:
public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } VdsStatistics other = (VdsStatistics) obj; return (ObjectUtils.objectsEqual(id, other.id) && ObjectUtils.bigDecimalEqual(cpu_idle, other.cpu_idle) && ObjectUtils.bigDecimalEqual(cpu_load, other.cpu_load) && ObjectUtils.bigDecimalEqual(cpu_sys, other.cpu_sys) && ObjectUtils.bigDecimalEqual(cpu_user, other.cpu_user) && ObjectUtils.objectsEqual(mem_available, other.mem_available) && ObjectUtils.objectsEqual(memFree, other.memFree) && ObjectUtils.objectsEqual(mem_shared, other.mem_shared) && ObjectUtils.objectsEqual(usage_cpu_percent, other.usage_cpu_percent) && ObjectUtils.objectsEqual(usage_network_percent, other.usage_network_percent) && ObjectUtils.objectsEqual(ksm_state, other.ksm_state) && ObjectUtils.objectsEqual(ksm_pages, other.ksm_pages) && ObjectUtils.objectsEqual(ksm_cpu_percent, other.ksm_cpu_percent) && ObjectUtils.objectsEqual(swap_total, other.swap_total) && ObjectUtils.objectsEqual(swap_free, other.swap_free) && ObjectUtils.objectsEqual(highlyAvailableScore, other.highlyAvailableScore) && (anonymousHugePages == other.anonymousHugePages)); }
Source:
private boolean verifyChangesInUI (boolean lastDisplayVisibility) { String lightboxHeaderDisplayValue = lightboxHeader.getCssValue("display"); String lightboxFooterDisplayValue = lightboxFooter.getCssValue("display"); boolean lightboxHeaderDisplay; boolean lightboxFooterDisplay; if (lightboxHeaderDisplayValue.contains("none")) { lightboxHeaderDisplay = false; } else { lightboxHeaderDisplay = true; } if (lightboxFooterDisplayValue.contains("none")) { lightboxFooterDisplay = false; } else { lightboxFooterDisplay = true; } if (lightboxHeaderDisplay == lastDisplayVisibility) { PageObjectLogging.log("verifyChangesInUI", "Lightbox header visibility didn't changed", false); } else { PageObjectLogging.log("verifyChangesInUI", "Lightbox header visibility changed", true); } if (lightboxFooterDisplay == lastDisplayVisibility) { PageObjectLogging.log("verifyChangesInUI", "Lightbox footer visibility didn't changed", false); } else { PageObjectLogging.log("verifyChangesInUI", "Lightbox footer visibility changed", true); } return !lastDisplayVisibility; }

Target:
private boolean verifyChangesInUI (boolean lastDisplayVisibility) { boolean lightboxHeaderDisplay = true; boolean lightboxFooterDisplay = true; if (lightboxHeader.getCssValue("display").contains("none")) { lightboxHeaderDisplay = false; } if (lightboxFooter.getCssValue("display").contains("none")) { lightboxFooterDisplay = false; } if (lightboxHeaderDisplay == lastDisplayVisibility) { PageObjectLogging.log("verifyChangesInUI", "Lightbox header visibility didn't changed", false); } else { PageObjectLogging.log("verifyChangesInUI", "Lightbox header visibility changed", true); } if (lightboxFooterDisplay == lastDisplayVisibility) { PageObjectLogging.log("verifyChangesInUI", "Lightbox footer visibility didn't changed", false); } else { PageObjectLogging.log("verifyChangesInUI", "Lightbox footer visibility changed", true); } return !lastDisplayVisibility; }
Source:
protected void accumulate(NodeValue nv, Binding binding, FunctionEnv functionEnv) { if ( DEBUG ) System.out.println("median: "+nv) ; if ( nv.isNumber() ) { count++ ; if ( total == noValuesToMedian ) total = nv ; else total = XSDFuncOp.numAdd(nv, total) ; collection.add(nv); } else { throw new ExprEvalException("median: not a number: "+nv) ; } if ( DEBUG ) System.out.println("median: ("+total+","+count+")") ; }

Target:
protected void accumulate(NodeValue nv, Binding binding, FunctionEnv functionEnv) { log.debug("median {}", nv); if ( nv.isNumber() ) { count++ ; collection.add(nv); } else { throw new ExprEvalException("median: not a number: "+nv) ; } log.debug("median count {}", count); }
Source:
public void start(Stage primaryStage) throws Exception { setupLayout(); primaryStage.getIcons().add(new Image("file:icon.png")); primaryStage.setTitle("SonarQube Java Analyzer - Viewer"); codeArea.insertText(0, defaultFileContent()); SplitPane splitPane = new SplitPane(); splitPane.getItems().addAll(verticalLayout, webView); webView.getEngine().load(Viewer.class.getResource("/viewer/viewer.html").toExternalForm()); primaryStage.setScene(new Scene(splitPane, 1200, 800)); primaryStage.show(); Timeline timeline = new Timeline(new KeyFrame(Duration.millis(500), ae -> checkForUpdate())); timeline.setCycleCount(Animation.INDEFINITE); timeline.play(); }

Target:
public void start(Stage primaryStage) throws Exception { setupLayout(); primaryStage.setTitle("SonarQube Java Analyzer - Viewer"); codeArea.insertText(0, defaultFileContent()); SplitPane splitPane = new SplitPane(); splitPane.getItems().addAll(verticalLayout, webView); webView.getEngine().load(Viewer.class.getResource("/viewer/viewer.html").toExternalForm()); primaryStage.setScene(new Scene(splitPane, 1200, 800)); primaryStage.show(); Timeline timeline = new Timeline(new KeyFrame(Duration.millis(500), ae -> checkForUpdate())); timeline.setCycleCount(Animation.INDEFINITE); timeline.play(); }
Source:
AnnotatedConnectException(ConnectException exception, SocketAddress remoteAddress) { super(exception.getMessage() + ": " + remoteAddress); initCause(exception); setStackTrace(EmptyArrays.EMPTY_STACK_TRACE); }

Target:
AnnotatedConnectException(ConnectException exception, SocketAddress remoteAddress) { super(exception.getMessage() + ": " + remoteAddress); initCause(exception); }
Source:
public void editLabel(AgentPrincipals agent, PID pid, String label) { FedoraTransaction tx = txManager.startTransaction(); try (Timer.Context context = timer.time()) { aclService.assertHasAccess( "User does not have permissions to edit labels", pid, agent.getPrincipals(), Permission.editDescription); RepositoryObject obj = repoObjLoader.getRepositoryObject(pid); Model objModel = obj.getModel(); Resource resc = objModel.getResource(obj.getUri().toString()); String oldLabel = replaceOldLabel(objModel, resc, label); repoObjFactory.createExclusiveRelationship(obj, DcElements.title, label); obj.getPremisLog() .buildEvent(Premis.Migration) .addImplementorAgent(agent.getUsernameUri()) .addEventDetail("Object renamed from " + oldLabel + " to " + label) .write(); } catch (Exception e) { tx.cancel(e); } finally { tx.close(); } operationsMessageSender.sendUpdateDescriptionOperation( agent.getUsername(), Arrays.asList(pid)); }

Target:
public void editLabel(AgentPrincipals agent, PID pid, String label) { FedoraTransaction tx = txManager.startTransaction(); try (Timer.Context context = timer.time()) { aclService.assertHasAccess( "User does not have permissions to edit labels", pid, agent.getPrincipals(), Permission.editDescription); RepositoryObject obj = repoObjLoader.getRepositoryObject(pid); String oldLabel = getOldLabel(obj); repoObjFactory.createExclusiveRelationship(obj, DcElements.title, label); obj.getPremisLog() .buildEvent(Premis.Migration) .addImplementorAgent(agent.getUsernameUri()) .addEventDetail("Object renamed from " + oldLabel + " to " + label) .write(); } catch (Exception e) { tx.cancel(e); } finally { tx.close(); } operationsMessageSender.sendUpdateDescriptionOperation( agent.getUsername(), Arrays.asList(pid)); }
Source:
protected T updateBasicField(U field, FieldMetaData fieldMetaData, T document, T documentAdditions, T documentDeletions) { switch (fieldMetaData.valueMetaData.type) { case TType.SET: Set<String> originalSet = document.getFieldValue(field)==null ? new HashSet<>() : (Set<String>) document.getFieldValue(field); removeAll(originalSet, (Set<String>) documentDeletions.getFieldValue(field)); addAll(originalSet,(Set<String>) documentAdditions.getFieldValue(field)); document.setFieldValue(field, originalSet); break; case TType.STRING: case TType.ENUM: document.setFieldValue(field, documentAdditions.getFieldValue(field)); break; case TType.I32: case TType.BOOL: if (documentAdditions.isSet(field)){ document.setFieldValue(field, documentAdditions.getFieldValue(field)); } break; case TType.MAP: if(isMapFieldMapOfStringSets(field, document, documentAdditions, documentDeletions, log)){ document.setFieldValue(field, updateCustomMap( (Map<String, Set<String>>) document.getFieldValue(field), (Map<String, Set<String>>) documentAdditions.getFieldValue(field), (Map<String, Set<String>>) documentDeletions.getFieldValue(field))); } else { try { document.setFieldValue(field, documentAdditions.getFieldValue(field)); } catch (ClassCastException e) { log.error("Cannot handle type of field in Moderator: " + field.getFieldName()); } } break; default: log.error("Unknown field in Moderator: " + field.getFieldName()); } return document; }

Target:
protected T updateBasicField(U field, FieldMetaData fieldMetaData, T document, T documentAdditions, T documentDeletions) { switch (fieldMetaData.valueMetaData.type) { case TType.SET: Set<String> originalSet = document.getFieldValue(field)==null ? new HashSet<>() : (Set<String>) document.getFieldValue(field); removeAll(originalSet, (Set<String>) documentDeletions.getFieldValue(field)); addAll(originalSet,(Set<String>) documentAdditions.getFieldValue(field)); document.setFieldValue(field, originalSet); break; case TType.STRING: case TType.ENUM: document.setFieldValue(field, documentAdditions.getFieldValue(field)); break; case TType.I32: case TType.BOOL: if (documentAdditions.isSet(field)){ document.setFieldValue(field, documentAdditions.getFieldValue(field)); } break; case TType.MAP: if(isMapFieldMapOfStringSets(field, document, documentAdditions, documentDeletions, log)){ document.setFieldValue(field, updateCustomMap( (Map<String, Set<String>>) document.getFieldValue(field), (Map<String, Set<String>>) documentAdditions.getFieldValue(field), (Map<String, Set<String>>) documentDeletions.getFieldValue(field))); } else { document.setFieldValue(field, documentAdditions.getFieldValue(field)); } break; default: log.error("Unknown field in Moderator: " + field.getFieldName()); } return document; }
Source:
static EsClient onAdd(final EsClientConfiguration configuration) { LOG.info("Connecting to Elasticsearch cluster at '{}'{}, connect timeout: ms, socket timeout: ms.", configuration.getClusterUrl(), configuration.isProtected() ? " using basic authentication" : "", configuration.getConnectTimeout(), configuration.getSocketTimeout()); if (configuration.isHttp()) { return new EsHttpClient(configuration); } else { checkState(configuration.isTcp(), "Only TCP and HTTP clients are supported"); HostAndPort hostAndPort = HostAndPort.fromString(configuration.getClusterUrl().replaceAll(EsClientConfiguration.TCP_SCHEME, "")); Settings settings = Settings.builder() .put("cluster.name", configuration.getClusterName()) .build(); return new EsTcpClient(new PreBuiltTransportClient(settings) .addTransportAddress(new TransportAddress(new InetSocketAddress(hostAndPort.getHostText(), hostAndPort.getPort())))); } }

Target:
static EsClient onAdd(final EsClientConfiguration configuration) { LOG.info("Connecting to Elasticsearch cluster at '{}'{}, connect timeout: ms, socket timeout: ms.", configuration.getClusterUrl(), configuration.isProtected() ? " using basic authentication" : "", configuration.getConnectTimeout(), configuration.getSocketTimeout()); if (configuration.isHttp()) { return new EsHttpClient(configuration); } else { checkState(configuration.isTcp(), "Only TCP and HTTP clients are supported"); checkState(!configuration.isProtected(), "TCP connection scheme does not yet support security configuration. Consider switching to HTTP instead."); HostAndPort hostAndPort = HostAndPort.fromString(configuration.getClusterUrl().replaceAll(EsClientConfiguration.TCP_SCHEME, "")); Settings settings = Settings.builder() .put("cluster.name", configuration.getClusterName()) .build(); return new EsTcpClient(new PreBuiltTransportClient(settings) .addTransportAddress(new TransportAddress(new InetSocketAddress(hostAndPort.getHostText(), hostAndPort.getPort())))); } }
Source:
public int reservePort() { int port = 0; int attempts = 0; boolean searchingForPort = true; synchronized (reservedPorts) { while (searchingForPort && ++attempts < 10) { port = findFreePort(); searchingForPort = !reservedPorts.add(port) || isBlocked(port); } } if (!(attempts < 10)) { throw new RuntimeException("Could not allocate a free port after " + attempts + " attempts."); } return port; }

Target:
public synchronized int reservePort() { int port = 0; int attempts = 0; boolean searchingForPort = true; while (searchingForPort && ++attempts < MAX_ATTEMPTS) { port = findFreePort(); searchingForPort = isBlocked(port) || !reservedPorts.add(port); } if (searchingForPort) { throw new RuntimeException("Could not allocate a free port after " + MAX_ATTEMPTS + " attempts."); } return port; }
Source:
private void recreateEmptyArea() { if (emptyArea != null) { emptyArea.dispose(); emptyArea = null; } if (images != null) { disposeImages(); images = new ArrayList<>(); } createEmptyArea(displayArea); switchTopControlRunnable.run(); }

Target:
private void recreateEmptyArea() { if (emptyArea != null) { emptyArea.dispose(); emptyArea = null; } disposeImages(); createEmptyArea(displayArea); switchTopControlRunnable.run(); }