auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public boolean removeVMFromBackupOffering(final VirtualMachine vm) { final VeeamClient client = getClient(vm.getDataCenterId()); final VmwareDatacenter vmwareDC = findVmwareDatacenterForVM(vm); try { if (!client.removeVMFromVeeamJob(vm.getBackupExternalId(), vm.getInstanceName(), vmwareDC.getVcenterHost())) { LOG.warn("Failed to remove VM from Veeam Job id: " + vm.getBackupExternalId()); } } catch (CloudRuntimeException e) { LOG.debug("VM was removed from the job so could not remove again, trying to delete the veeam job now.", e); } final String clonedJobName = getGuestBackupName(vm.getInstanceName(), vm.getUuid()); if (!client.deleteJobAndBackup(clonedJobName)) { LOG.warn("Failed to remove Veeam job and backup for job: " + clonedJobName); throw new CloudRuntimeException("Failed to delete Veeam B&R job and backup, an operation may be in progress. Please try again after some time."); } for (final Backup backup: backupDao.listByVmId(null, vm.getId())) { backupDao.remove(backup.getId()); } return true; }

Target:
public boolean removeVMFromBackupOffering(final VirtualMachine vm) { final VeeamClient client = getClient(vm.getDataCenterId()); final VmwareDatacenter vmwareDC = findVmwareDatacenterForVM(vm); try { if (!client.removeVMFromVeeamJob(vm.getBackupExternalId(), vm.getInstanceName(), vmwareDC.getVcenterHost())) { LOG.warn("Failed to remove VM from Veeam Job id: " + vm.getBackupExternalId()); } } catch (Exception e) { LOG.debug("VM was removed from the job so could not remove again, trying to delete the veeam job now.", e); } final String clonedJobName = getGuestBackupName(vm.getInstanceName(), vm.getUuid()); if (!client.deleteJobAndBackup(clonedJobName)) { LOG.warn("Failed to remove Veeam job and backup for job: " + clonedJobName); throw new CloudRuntimeException("Failed to delete Veeam B&R job and backup, an operation may be in progress. Please try again after some time."); } return true; }
Source:
private Optional<SystemTable> getPropertiesSystemTable(ConnectorSession connectorSession, SchemaTableName tableName, SchemaTableName sourceTableName) { Optional<Table> table = metastore.getTable(sourceTableName.getSchemaName(), sourceTableName.getTableName()); if (!table.isPresent() || table.get().getTableType().equals(TableType.VIRTUAL_VIEW.name())) { throw new TableNotFoundException(tableName); } Map<String, String> properties = table.get().getParameters(); List<ColumnMetadata> columns = properties.keySet().stream().map(key -> new ColumnMetadata(key, VarcharType.VARCHAR)).collect(toImmutableList()); ImmutableList<Type> types = columns.stream().map(columnMetadata -> columnMetadata.getType()).collect(toImmutableList()); Iterable<List<Object>> propertyValues = singletonList(ImmutableList.copyOf(properties.values())); SystemTable propertiesSystemTable = new SystemTable() { @Override public Distribution getDistribution() { return Distribution.SINGLE_COORDINATOR; } @Override public ConnectorTableMetadata getTableMetadata() { return new ConnectorTableMetadata(sourceTableName, columns); } @Override public RecordCursor cursor(ConnectorTransactionHandle transactionHandle, ConnectorSession session, TupleDomain<Integer> constraint) { return new InMemoryRecordSet(types, propertyValues).cursor(); } }; return Optional.of(propertiesSystemTable); }

Target:
private Optional<SystemTable> getPropertiesSystemTable(ConnectorSession connectorSession, SchemaTableName tableName, SchemaTableName sourceTableName) { Optional<Table> table = metastore.getTable(sourceTableName.getSchemaName(), sourceTableName.getTableName()); if (!table.isPresent() || table.get().getTableType().equals(TableType.VIRTUAL_VIEW.name())) { throw new TableNotFoundException(tableName); } List<Map.Entry<String, String>> sortedEntries = table.get().getParameters().entrySet().stream().sorted(Comparator.comparing(Map.Entry::getKey)).collect(toImmutableList()); List<ColumnMetadata> columns = sortedEntries.stream().map(Map.Entry::getKey).map(key -> new ColumnMetadata(key, VarcharType.VARCHAR)).collect(toImmutableList()); List<Type> types = columns.stream().map(ColumnMetadata::getType).collect(toImmutableList()); Iterable<List<Object>> propertyValues = ImmutableList.of(ImmutableList.copyOf(sortedEntries.stream().map(Map.Entry::getValue).collect(toImmutableList()))); SystemTable propertiesSystemTable = new SystemTable() { @Override public Distribution getDistribution() { return Distribution.SINGLE_COORDINATOR; } @Override public ConnectorTableMetadata getTableMetadata() { return new ConnectorTableMetadata(sourceTableName, columns); } @Override public RecordCursor cursor(ConnectorTransactionHandle transactionHandle, ConnectorSession session, TupleDomain<Integer> constraint) { return new InMemoryRecordSet(types, propertyValues).cursor(); } }; return Optional.of(propertiesSystemTable); }
Source:
public DatastreamTaskImpl() { _partitions = new ArrayList<>(); _partitionsV2 = new ArrayList<>(); _dependencies = new ArrayList<>(); computeHash(); }

Target:
public DatastreamTaskImpl() { _partitions = new ArrayList<>(); _partitionsV2 = new ArrayList<>(); _dependencies = new ArrayList<>(); }
Source:
public String getServerPublicKey(String serverName) { PublicKey pk = null; EngineSSHDialog dialog = getEngineSSHDialog(); try { dialog.setHost(serverName); dialog.connect(); dialog.useDefaultKeyPair(); PublicKey pk = dialog.getPublicKey } catch (Throwable e) { log.errorFormat("Could not ssh public key of host {0} with message: {1}", serverName, ExceptionUtils.getMessage(e) ); } finally { dialog.disconnect(); } return pk.toString(); }

Target:
public String getServerPublicKey(String serverName) { PublicKey pk = null; EngineSSHDialog dialog = getEngineSSHDialog(); try { dialog.setHost(serverName); dialog.connect(); dialog.useDefaultKeyPair(); pk = dialog.getPublicKey(); } catch (Throwable e) { log.errorFormat("Could not fetch ssh public key of host {0} with message: {1}", serverName, ExceptionUtils.getMessage(e) ); } finally { dialog.disconnect(); } return pk.toString(); }
Source:
public Integer getDistinctCount(SearchCriteria<T> sc, String[] distinctColumns) { String clause = sc != null ? sc.getWhereClause() : null; if (clause != null && clause.length() == 0) { clause = null; } final StringBuilder str = createDistinctSelect(sc, clause != null, distinctColumns); if (clause != null) { str.append(clause); } Collection<JoinBuilder<SearchCriteria<?>>> joins = null; if (sc != null) { joins = sc.getJoins(); if (joins != null) { addJoins(str, joins); } } final TransactionLegacy txn = TransactionLegacy.currentTxn(); final String sql = "SELECT COUNT(*) FROM (" + str.toString() + ") AS tmp"; PreparedStatement pstmt = null; try { pstmt = txn.prepareAutoCloseStatement(sql); int i = 1; if (clause != null) { for (final Pair<Attribute, Object> value : sc.getValues()) { prepareAttribute(i++, pstmt, value.first(), value.second()); } } if (joins != null) { i = addJoinAttributes(i, pstmt, joins); } final ResultSet rs = pstmt.executeQuery(); while (rs.next()) { return rs.getInt(1); } return 0; } catch (final SQLException e) { throw new CloudRuntimeException("DB Exception on: " + pstmt, e); } catch (final Throwable e) { throw new CloudRuntimeException("Caught: " + pstmt, e); } }

Target:
public Integer getDistinctCount(SearchCriteria<T> sc, String[] distinctColumns) { String clause = sc != null ? sc.getWhereClause() : null; if (Strings.isNullOrEmpty(clause)) { clause = null; } final StringBuilder str = createDistinctSelect(sc, clause != null, distinctColumns); if (clause != null) { str.append(clause); } Collection<JoinBuilder<SearchCriteria<?>>> joins = null; if (sc != null) { joins = sc.getJoins(); if (joins != null) { addJoins(str, joins); } } final TransactionLegacy txn = TransactionLegacy.currentTxn(); final String sql = "SELECT COUNT(*) FROM (" + str.toString() + ") AS tmp"; try (PreparedStatement pstmt = txn.prepareAutoCloseStatement(sql)) { int i = 1; if (clause != null) { for (final Pair<Attribute, Object> value : sc.getValues()) { prepareAttribute(i++, pstmt, value.first(), value.second()); } } if (joins != null) { i = addJoinAttributes(i, pstmt, joins); } final ResultSet rs = pstmt.executeQuery(); while (rs.next()) { return rs.getInt(1); } return 0; } catch (final SQLException e) { throw new CloudRuntimeException("DB Exception in executing: " + sql, e); } catch (final Throwable e) { throw new CloudRuntimeException("Caught exception in : " + sql, e); } }
Source:
public void testEventLookup() { assertTrue(fixture.hasEvent("sched_switch")); assertFalse(fixture.hasEvent("Sched_switch")); String[] events = {"sched_switch", "sched_wakeup", "timer_init"}; assertTrue(fixture.hasAllEvents(events)); assertTrue(fixture.hasEvents(events)); String[] names = {"inexistent", "sched_switch", "SomeThing"}; assertTrue(fixture.hasEvents(names)); assertFalse(fixture.hasAllEvents(names)); }

Target:
public void testEventLookup() { assertTrue(fixture.hasEvent("sched_switch")); assertFalse(fixture.hasEvent("Sched_switch")); String[] events = { "sched_switch", "sched_wakeup", "timer_init" }; assertTrue(fixture.hasAllEvents(events)); assertTrue(fixture.hasAtLeastOneOfEvents(events)); String[] names = { "inexistent", "sched_switch", "SomeThing" }; assertTrue(fixture.hasAtLeastOneOfEvents(names)); assertFalse(fixture.hasAllEvents(names)); }
Source:
private void highlightViewOnUiThread() { final View viewToHighlight = mViewToHighlight.getAndSet(null); if (viewToHighlight == mHighlightedView) { return; } if (mHighlightedView != null) { for (ColorDrawable drawable : mHighlightDrawables) { mHighlightedView.getOverlay().remove(drawable); } } if (viewToHighlight != null && viewToHighlight.getLayoutParams() instanceof ViewGroup.MarginLayoutParams) { mHighlightDrawables = newViewHighlightDrawablesArray(viewToHighlight); for (ColorDrawable drawable : mHighlightDrawables) { viewToHighlight.getOverlay().add(drawable); } mHighlightedView = viewToHighlight; } }

Target:
private void highlightViewOnUiThread() { final View viewToHighlight = mViewToHighlight.getAndSet(null); if (viewToHighlight == mHighlightedView) { return; } if (mHighlightedView != null) { mHighlightOverlays.removeHighlight(mHighlightedView); } if (viewToHighlight != null) { mHighlightOverlays.highlightView(viewToHighlight, mContentColor.get()); mHighlightedView = viewToHighlight; } }
Source:
public Publisher<Integer> createFlowPublisher(long elements) { return ReactiveStreamsFlowBridge.toFlow( new AsyncIterablePublisher<>(Collections.emptyList(), ex) ); }

Target:
public Publisher<Integer> createFlowPublisher(long elements) { return ReactiveStreamsFlowBridge.toFlowPublisher( new AsyncIterablePublisher<Integer>(Collections.<Integer>emptyList(), ex) ); }
Source:
public void testAlwaysHealthy() throws Exception { final AtomicLong successfulRuns = new AtomicLong(0); final List<Thread> taskThreads = Collections.synchronizedList(new ArrayList<>()); final DurableScheduledService service = new DurableScheduledService("testAlwaysHealthy", RUN_FREQUENCY, RUN_TIMEOUT, RUN_TIMEOUT) { @Override protected void startUp() { LOG.info(Thread.currentThread().getName() + " startUp"); } @Override protected void runOneIteration() { LOG.info(Thread.currentThread().getName() + " runOneIteration"); synchronized (taskThreads) { if (!taskThreads.contains(Thread.currentThread())) { taskThreads.add(Thread.currentThread()); } } successfulRuns.incrementAndGet(); } @Override protected void shutDown() { LOG.info(Thread.currentThread().getName() + " shutDown"); } }; service.startAsync().awaitRunning(); long numRuns = 10 * ((RUN_TIMEOUT.toMillis() / RUN_FREQUENCY.toMillis()) + 1); Duration runDuration = RESTART_TIMEOUT.multipliedBy(numRuns); Instant expiration = Instant.now().plus(runDuration); while (successfulRuns.get() < numRuns && Instant.now().isBefore(expiration)) { Thread.sleep(RUN_FREQUENCY.toMillis()); } service.stopAsync().awaitTerminated(); Assert.assertTrue(numRuns <= successfulRuns.get()); Assert.assertTrue(successfulRuns.get() - numRuns <= 1); Assert.assertTrue(taskThreads.stream().noneMatch(Thread::isAlive)); Assert.assertEquals(taskThreads.size(), 1); }

Target:
public void testAlwaysHealthy() throws Exception { final AtomicLong runsCompleted = new AtomicLong(0); final List<Thread> taskThreads = Collections.synchronizedList(new ArrayList<>()); final DurableScheduledService service = new DurableScheduledService("testAlwaysHealthy", RUN_FREQUENCY, RUN_TIMEOUT, RUN_TIMEOUT) { @Override protected void startUp() { LOG.info(Thread.currentThread().getName() + " startUp"); } @Override protected void runOneIteration() { LOG.info(Thread.currentThread().getName() + " runOneIteration"); synchronized (taskThreads) { if (!taskThreads.contains(Thread.currentThread())) { taskThreads.add(Thread.currentThread()); } } runsCompleted.incrementAndGet(); } @Override protected void shutDown() { LOG.info(Thread.currentThread().getName() + " shutDown"); } }; service.startAsync().awaitRunning(); long numRuns = 2 * ((RUN_TIMEOUT.toMillis() / RUN_FREQUENCY.toMillis()) + 1); Duration runDuration = RESTART_TIMEOUT.multipliedBy(numRuns); Instant expiration = Instant.now().plus(runDuration); while (runsCompleted.get() < numRuns && Instant.now().isBefore(expiration)) { Thread.sleep(RUN_FREQUENCY.toMillis()); } service.stopAsync().awaitTerminated(); Assert.assertTrue(numRuns <= runsCompleted.get()); Assert.assertTrue(taskThreads.stream().noneMatch(Thread::isAlive)); Assert.assertEquals(taskThreads.size(), 1); }
Source:
public static void main(String args[]) { try { VerifiableProperties verifiableProperties = StoreToolsUtil.getVerifiableProperties(args); DumpIndexTool dumpIndexTool = new DumpIndexTool(verifiableProperties); dumpIndexTool.doOperation(); } catch (Exception e) { logger.error("Closed with exception ", e); } }

Target:
public static void main(String args[]) throws Exception { VerifiableProperties verifiableProperties = StoreToolsUtil.getVerifiableProperties(args); DumpIndexTool dumpIndexTool = new DumpIndexTool(verifiableProperties); dumpIndexTool.doOperation(); }
Source:
public Domain updateDomain(UpdateDomainCmd cmd) { return _managementService.updateDomain(cmd); }

Target:
public Domain updateDomain(UpdateDomainCmd cmd) { return _domainMgr.updateDomain(cmd); }
Source:
private StreamExecutionEnvironment getExecutionEnvironment() { Configuration config = new Configuration(); config.set(ExecutionOptions.RUNTIME_MODE, RuntimeExecutionMode.BATCH); config.set(CoreOptions.DEFAULT_PARALLELISM, 1); config.set(ExecutionCheckpointingOptions.CHECKPOINTING_INTERVAL, Duration.ofMillis(42)); final StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment( config); env.setRestartStrategy(RestartStrategies.fixedDelayRestart(10, Time.milliseconds(1))); return env; }

Target:
private StreamExecutionEnvironment getExecutionEnvironment() { Configuration config = new Configuration(); config.set(ExecutionOptions.RUNTIME_MODE, RuntimeExecutionMode.BATCH); final StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment( config); env.setParallelism(1); env.enableCheckpointing(42); env.setRestartStrategy(RestartStrategies.fixedDelayRestart(10, Time.milliseconds(1))); return env; }
Source:
public Optional<String> getAgreementId() { return Optional.ofNullable(agreementId); }

Target:
public String getAgreementId() { return agreementId; }
Source:
public void init(Configuration conf) { String schemaFileType = conf.get( ScmConfigKeys.OZONE_SCM_NETWORK_TOPOLOGY_SCHEMA_FILE_TYPE); String schemaFile = conf.get( ScmConfigKeys.OZONE_SCM_NETWORK_TOPOLOGY_SCHEMA_FILE, ScmConfigKeys.OZONE_SCM_NETWORK_TOPOLOGY_SCHEMA_FILE_DEFAULT); NodeSchemaLoadResult result; try { if (schemaFileType.compareTo("yaml") == 0) { result = NodeSchemaLoader.getInstance().loadSchemaFromYaml(schemaFile); } else { result = NodeSchemaLoader.getInstance().loadSchemaFromFile(schemaFile); } allSchema = result.getSchemaList(); enforcePrefix = result.isEnforePrefix(); maxLevel = allSchema.size(); } catch (Throwable e) { String msg = "Fail to load schema file:" + schemaFile + ", error:" + e.getMessage(); LOG.error(msg); throw new RuntimeException(msg); } }

Target:
public void init(Configuration conf) { String schemaFileType = conf.get( ScmConfigKeys.OZONE_SCM_NETWORK_TOPOLOGY_SCHEMA_FILE_TYPE); String schemaFile = conf.get( ScmConfigKeys.OZONE_SCM_NETWORK_TOPOLOGY_SCHEMA_FILE, ScmConfigKeys.OZONE_SCM_NETWORK_TOPOLOGY_SCHEMA_FILE_DEFAULT); NodeSchemaLoadResult result; try { if (schemaFileType.toLowerCase().compareTo("yaml") == 0) { result = NodeSchemaLoader.getInstance().loadSchemaFromYaml(schemaFile); } else { result = NodeSchemaLoader.getInstance().loadSchemaFromXml(schemaFile); } allSchema = result.getSchemaList(); enforcePrefix = result.isEnforePrefix(); maxLevel = allSchema.size(); } catch (Throwable e) { String msg = "Fail to load schema file:" + schemaFile + ", error:" + e.getMessage(); LOG.error(msg); throw new RuntimeException(msg); } }
Source:
protected void processTuple(KeyValPair<byte[], byte[]> tuple) { if (ExeMode.UpdateAsync == exeMode) { updateAsync(tuple); return; } Slice key = new Slice(tuple.getKey()); if (ExeMode.UpdateSync == exeMode) { store.getSync(bucketId, key); } insertValueToStore(tuple); }

Target:
protected void processTuple(KeyValPair<byte[], byte[]> tuple) { switch (execMode) { case UPDATEASYNC: updateAsync(tuple); break; case UPDATESYNC: store.getSync(getTimeByKey(tuple.getKey()), new Slice(tuple.getKey())); insertValueToStore(tuple); break; default: insertValueToStore(tuple); } }
Source:
@Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_webview, container, false); webView = (WebView) view.findViewById(R.id.webview); mLayout = (ViewGroup) view; markers = new HashMap<>(); WebSettings webViewSettings = webView.getSettings(); webViewSettings.setSupportZoom(true); webViewSettings.setBuiltInZoomControls(false); webViewSettings.setJavaScriptEnabled(true); webViewSettings.setGeolocationEnabled(true); webView.setWebChromeClient(new GeoWebChromeClient()); AirMapType mapType = AirMapType.fromBundle(getArguments()); webView.loadDataWithBaseURL(mapType.getDomain(), mapType.getMapData(getResources()), "text/html", "base64", null); webView.addJavascriptInterface(new MapsJavaScriptInterface(), "AirMapView"); return view; }

Target:
@Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_webview, container, false); webView = (WebView) view.findViewById(R.id.webview); mLayout = (ViewGroup) view; WebSettings webViewSettings = webView.getSettings(); webViewSettings.setSupportZoom(true); webViewSettings.setBuiltInZoomControls(false); webViewSettings.setJavaScriptEnabled(true); webViewSettings.setGeolocationEnabled(true); webView.setWebChromeClient(new GeoWebChromeClient()); AirMapType mapType = AirMapType.fromBundle(getArguments()); webView.loadDataWithBaseURL(mapType.getDomain(), mapType.getMapData(getResources()), "text/html", "base64", null); webView.addJavascriptInterface(new MapsJavaScriptInterface(), "AirMapView"); return view; }
Source:
ParamDef mockParamDef(String name, String type) { ParamDef paramDef = mock(ParamDef.class); when(paramDef.getName()).thenReturn(name); when(paramDef.getType()).thenReturn(type); return paramDef; }

Target:
private ParamDef mockParamDef(String name, String type) { ParamDef paramDef = mock(ParamDef.class); when(paramDef.getName()).thenReturn(name); when(paramDef.getType()).thenReturn(type); return paramDef; }
Source:
public Object invoke(String currentPath, PathRef parent, Object model, EvaluationContext ctx, List<Parameter> parameters) { StringBuffer result = new StringBuffer(); if(ctx.configuration().jsonProvider().isArray(model)){ Iterable<?> objects = ctx.configuration().jsonProvider().toIterable(model); for (Object obj : objects) { if (obj instanceof String) { result.append(obj.toString()); } } } if (parameters != null) { for (Parameter param : parameters) { if (param.getValue() != null) { result.append(param.getValue().toString()); } } } return result.toString(); }

Target:
public Object invoke(String currentPath, PathRef parent, Object model, EvaluationContext ctx, List<Parameter> parameters) { StringBuffer result = new StringBuffer(); if(ctx.configuration().jsonProvider().isArray(model)){ Iterable<?> objects = ctx.configuration().jsonProvider().toIterable(model); for (Object obj : objects) { if (obj instanceof String) { result.append(obj.toString()); } } } if (parameters != null) { for (Parameter param : parameters) { Object value = param.getValue(); if (value != null) { result.append(value.toString()); } } } return result.toString(); }
Source:
public synchronized ListenableFuture<?> reserveRevocable(QueryId queryId, long bytes) { checkArgument(bytes >= 0, "bytes is negative"); ListenableFuture<?> result; if (bytes != 0) { queryMemoryRevocableReservations.merge(queryId, bytes, Long::sum); } reservedRevocableBytes += bytes; if (getFreeBytes() <= 0) { if (future == null) { future = NonCancellableMemoryFuture.create(); } checkState(!future.isDone(), "future is already completed"); result = future; } else { result = NOT_BLOCKED; } onMemoryReserved(); return result; }

Target:
public ListenableFuture<?> reserveRevocable(QueryId queryId, long bytes) { checkArgument(bytes >= 0, "bytes is negative"); ListenableFuture<?> result; if (bytes != 0) { queryMemoryRevocableReservations.merge(queryId, bytes, Long::sum); } synchronized (this) { reservedRevocableBytes += bytes; if (getFreeBytes() <= 0) { if (future == null) { future = NonCancellableMemoryFuture.create(); } checkState(!future.isDone(), "future is already completed"); result = future; } else { result = NOT_BLOCKED; } } onMemoryReserved(); return result; }
Source:
public int calcTotalPages(int totalResults) { int returnVal = (int) Math.ceil(totalResults / (double) this.getPageSize()); if (returnVal == 0) { returnVal = 1; } return returnVal; }

Target:
public int calcTotalPages(int totalResults) { int returnVal = (int) Math.ceil(totalResults / (double) this.getPageSize()); return Math.max(returnVal, 1); }
Source:
String readProcessorData(String fullPath) { try { return zkClient.readData(fullPath, false); } catch (Exception e) { String errorMsg = String.format("Cannot read ZK node: %s", fullPath); LOG.error(errorMsg, e); throw new SamzaException(errorMsg, e); } }

Target:
String readProcessorData(String fullPath) { try { String data = zkClient.readData(fullPath, false); metrics.reads.inc(); return data; } catch (Exception e) { throw new SamzaException(String.format("Cannot read ZK node: %s", fullPath), e); } }
Source:
private PokemonInfo getCurrentActivePokemon() { int idx = 0; PokemonInfo currentPokemon = null; for (PokemonInfo pokemonInfo : getPlayer1Team()) { if (pokemonInfo.isActive()) { if (idx == mCurrentActivePokemon) { currentPokemon = pokemonInfo; break; } else { idx++; } } } return currentPokemon; }

Target:
private PokemonInfo getCurrentActivePokemon() { return getPlayer1Team().get(mCurrentActivePokemon); }
Source:
public State convertToState(int[] data, ComfoAirCommandType commandType) { int[] get_reply_data_pos = commandType.getGetReplyDataPos(); int get_reply_data_bits = commandType.getGetReplyDataBits(); if (get_reply_data_pos[0] < data.length) { boolean result = (data[get_reply_data_pos[0]] & get_reply_data_bits) == get_reply_data_bits; return (result) ? new DecimalType(1) : new DecimalType(0); } else { return null; } }

Target:
public State convertToState(int[] data, ComfoAirCommandType commandType) { if (data == null || commandType == null) { logger.trace("\"DataTypeBoolean\" class \"convertToState\" method parameter: null"); return null; } else { int[] get_reply_data_pos = commandType.getGetReplyDataPos(); int get_reply_data_bits = commandType.getGetReplyDataBits(); if (get_reply_data_pos[0] < data.length) { boolean result = (data[get_reply_data_pos[0]] & get_reply_data_bits) == get_reply_data_bits; return (result) ? new DecimalType(1) : new DecimalType(0); } else { return null; } } }
Source:
public boolean isResourceExpired(SamzaResource resource) { return System.currentTimeMillis() - resource.getTimestamp() + Duration.ofMinutes(1).toMillis() > YarnConfiguration.DEFAULT_RM_CONTAINER_ALLOC_EXPIRY_INTERVAL_MS; }

Target:
public boolean isResourceExpired(SamzaResource resource) { Duration yarnAllocatedResourceExpiry = Duration.ofMinutes(YarnConfiguration.DEFAULT_RM_CONTAINER_ALLOC_EXPIRY_INTERVAL_MS) .minus(Duration.ofSeconds(30)); return System.currentTimeMillis() - resource.getTimestamp() > yarnAllocatedResourceExpiry.toMillis(); }
Source:
public ResultSet getUninterruptibly() { return null; }

Target:
public ResultSet getUninterruptibly() { try { return Uninterruptibles.getUninterruptibly(this); } catch (ExecutionException e) { throw DriverThrowables.propagateCause(e); } }
Source:
private static boolean checkArgumentIndex( @NotNull ProblemsHolder holder, @NotNull GoExpression placeholder, @NotNull GoCallExpr callExpr, @NotNull Placeholder fmtPlaceholder, int callArgsNum) { int argNum = fmtPlaceholder.getPosition(); if (argNum < 0) return false; if (argNum == 0) { holder.registerProblem(placeholder, "Index value [0] is not allowed", ProblemHighlightType.GENERIC_ERROR_OR_WARNING); return false; } if (argNum <= callArgsNum) return true; if (GoPsiImplUtil.hasVariadic(callExpr.getArgumentList())) return false; if (argNum <= callArgsNum) return true; int arg = fmtPlaceholder.getPosition(); String message = String.format("Got %d placeholder(s) for %d arguments(s)", arg, callArgsNum); holder.registerProblem(placeholder, message, ProblemHighlightType.GENERIC_ERROR_OR_WARNING); return false; }

Target:
private static boolean checkArgumentIndex(@NotNull ProblemsHolder holder, @NotNull GoExpression placeholder, @NotNull GoCallExpr callExpr, @NotNull Placeholder fmtPlaceholder, int callArgsNum) { int argNum = fmtPlaceholder.getPosition(); if (argNum < 0) return false; if (argNum == 0) { TextRange range = TextRange.create(fmtPlaceholder.getStartPos() + 3, fmtPlaceholder.getStartPos() + 4); holder.registerProblem(placeholder, "Index value [0] is not allowed #loc", ProblemHighlightType.GENERIC_ERROR_OR_WARNING, range); return false; } if (argNum < callArgsNum) return true; if (GoPsiImplUtil.hasVariadic(callExpr.getArgumentList())) return false; if (argNum == callArgsNum) return true; int arg = fmtPlaceholder.getPosition(); String message = String.format("Got %d placeholder(s) for %d arguments(s)", arg, callArgsNum); holder.registerProblem(placeholder, message, ProblemHighlightType.GENERIC_ERROR_OR_WARNING); return false; }
Source:
private void unpackAndValidateId(String keyId) { if (keyId != null && keyId.length() > 0) { try { URL url = new URL(keyId); String[] tokens = url.getPath().split("/"); String endpoint = url.getProtocol() + "://" + url.getHost(); String keyName = (tokens.length >= 3 ? tokens[2] : null); version = (tokens.length >= 4 ? tokens[3] : null); if(Strings.isNullOrEmpty(endpoint)) { throw new IllegalArgumentException("Key endpoint in key id is invalid"); } else if (Strings.isNullOrEmpty(keyName)) { throw new IllegalArgumentException("Key name in key id is invalid"); } else if(Strings.isNullOrEmpty(version)) { throw new IllegalArgumentException("Key version in key id is invalid"); } } catch (MalformedURLException e) { e.printStackTrace(); } } else { throw new IllegalArgumentException("Key Id is invalid"); } }

Target:
private void unpackAndValidateId(String keyId) { if (ImplUtils.isNullOrEmpty(keyId)) { throw new IllegalArgumentException("Key Id is invalid"); } try { URL url = new URL(keyId); String[] tokens = url.getPath().split("/"); String endpoint = url.getProtocol() + "://" + url.getHost(); String keyName = (tokens.length >= 3 ? tokens[2] : null); String version = (tokens.length >= 4 ? tokens[3] : null); if (Strings.isNullOrEmpty(endpoint)) { throw new IllegalArgumentException("Key endpoint in key id is invalid"); } else if (Strings.isNullOrEmpty(keyName)) { throw new IllegalArgumentException("Key name in key id is invalid"); } else if (Strings.isNullOrEmpty(version)) { throw new IllegalArgumentException("Key version in key id is invalid"); } } catch (MalformedURLException e) { throw new IllegalArgumentException("The key identifier is malformed", e); } }
Source:
public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; DefaultManagementRegistryConfiguration that = (DefaultManagementRegistryConfiguration) o; return Objects.equals(tags, that.tags) && Objects.equals(productInstanceId, that.productInstanceId) && Objects.equals(context, that.context) && Objects.equals(collectorExecutorAlias, that.collectorExecutorAlias); }

Target:
public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; DefaultManagementRegistryConfiguration that = (DefaultManagementRegistryConfiguration) o; return Objects.equals(tags, that.tags) && Objects.equals(instanceId, that.instanceId) && Objects.equals(context, that.context) && Objects.equals(collectorExecutorAlias, that.collectorExecutorAlias); }
Source:
Context prepareDefaultContext(boolean parseAsFlume) { Context context = new Context(); context.put(BOOTSTRAP_SERVERS_CONFIG, testUtil.getKafkaServerUrl()); context.put(PARSE_AS_FLUME_EVENT, String.valueOf(parseAsFlume)); context.put("offsets.topic.replication.factor", "1"); context.put(TOPIC_CONFIG, topic); return context; }

Target:
Context prepareDefaultContext(boolean parseAsFlume) { Context context = new Context(); context.put(BOOTSTRAP_SERVERS_CONFIG, testUtil.getKafkaServerUrl()); context.put(PARSE_AS_FLUME_EVENT, String.valueOf(parseAsFlume)); context.put(TOPIC_CONFIG, topic); return context; }
Source:
private void writeCacheInfo(PayloadOutputChannel payloadCh) { BinaryOutputStream out = payloadCh.out(); out.writeInt(cacheId); byte flags = keepBinary ? KEEP_BINARY_FLAG_MASK : 0; TcpClientTransaction tx = transactions.tx(); if (expiryPlc != null) { ProtocolContext protocolContext = payloadCh.clientChannel().protocolContext(); if (!protocolContext.isExpirationPolicySupported()) { throw new ClientProtocolError(String.format("Expire policies are not supported by the server " + "version %s, required version %s", protocolContext.version(), V1_6_0)); } flags |= WITH_EXPIRY_POLICY_FLAG_MASK; } if (tx != null) { if (tx.clientChannel() != payloadCh.clientChannel()) { throw new ClientException("Transaction context has been lost due to connection errors. " + "Cache operations are prohibited until current transaction closed."); } flags |= TRANSACTIONAL_FLAG_MASK; } out.writeByte(flags); if ((flags & WITH_EXPIRY_POLICY_FLAG_MASK) != 0) { out.writeLong(convertDuration(expiryPlc.getExpiryForCreation())); out.writeLong(convertDuration(expiryPlc.getExpiryForUpdate())); out.writeLong(convertDuration(expiryPlc.getExpiryForAccess())); } if ((flags & TRANSACTIONAL_FLAG_MASK) != 0) out.writeInt(tx.txId()); }

Target:
private void writeCacheInfo(PayloadOutputChannel payloadCh) { BinaryOutputStream out = payloadCh.out(); out.writeInt(cacheId); byte flags = keepBinary ? KEEP_BINARY_FLAG_MASK : 0; TcpClientTransaction tx = transactions.tx(); if (expiryPlc != null) { ProtocolContext protocolCtx = payloadCh.clientChannel().protocolCtx(); if (!protocolCtx.isFeatureSupported(EXPIRY_POLICY)) { throw new ClientProtocolError(String.format("Expire policies are not supported by the server " + "version %s, required version %s", protocolCtx.version(), EXPIRY_POLICY.verIntroduced())); } flags |= WITH_EXPIRY_POLICY_FLAG_MASK; } if (tx != null) { if (tx.clientChannel() != payloadCh.clientChannel()) { throw new ClientException("Transaction context has been lost due to connection errors. " + "Cache operations are prohibited until current transaction closed."); } flags |= TRANSACTIONAL_FLAG_MASK; } out.writeByte(flags); if ((flags & WITH_EXPIRY_POLICY_FLAG_MASK) != 0) { out.writeLong(convertDuration(expiryPlc.getExpiryForCreation())); out.writeLong(convertDuration(expiryPlc.getExpiryForUpdate())); out.writeLong(convertDuration(expiryPlc.getExpiryForAccess())); } if ((flags & TRANSACTIONAL_FLAG_MASK) != 0) out.writeInt(tx.txId()); }
Source:
public HaxeDocumentModel getDocument() { if (_document == null) _document = new HaxeDocumentModel(haxeClass); return _document; }

Target:
public HaxeDocumentModel getDocument() { return new HaxeDocumentModel(haxeClass); }
Source:
private <T extends Projectile> T launchProjectile(Class<? extends T> type, Location location, double x, double y, double z, float speed) { double magnitude = Math.sqrt(x * x + y * y + z * z); if (magnitude > 0) { x += (x * (speed - magnitude)) / magnitude; y += (y * (speed - magnitude)) / magnitude; z += (z * (speed - magnitude)) / magnitude; } location.add(location.getDirection()); location.setPitch(0); location.setYaw(0); T projectile = null; if (EntityRegistry.getEntity(type) != null) { projectile = EntityStorage.create(type, location); } else { throw new IllegalArgumentException("Could not find projectile of type '" + type.getSimpleName() + "'"); } ProjectileLaunchEvent launchEvent = EventFactory.getInstance() .callEvent(new ProjectileLaunchEvent(projectile)); if (launchEvent.isCancelled()) { projectile.remove();; } else { ((GlowWorld) location.getWorld()).spawn(location, (GlowProjectile) projectile, CreatureSpawnEvent.SpawnReason.CUSTOM); } projectile.setVelocity(new Vector(x, y, z)); ((GlowProjectile) projectile).setRawLocation(location); return projectile; }

Target:
private <T extends Projectile> T launchProjectile(Class<? extends T> type, Location location, double x, double y, double z, float speed) { double magnitude = Math.sqrt(x * x + y * y + z * z); if (magnitude > 0) { x += (x * (speed - magnitude)) / magnitude; y += (y * (speed - magnitude)) / magnitude; z += (z * (speed - magnitude)) / magnitude; } location.add(location.getDirection()); location.setPitch(0); location.setYaw(0); T projectile = ((GlowWorld) location.getWorld()).spawn(location, type); ProjectileLaunchEvent launchEvent = EventFactory.getInstance() .callEvent(new ProjectileLaunchEvent(projectile)); if (launchEvent.isCancelled()) { projectile.remove(); } projectile.setVelocity(new Vector(x, y, z)); ((GlowProjectile) projectile).setRawLocation(location); return projectile; }
Source:
private Set<String> jsonArrayToSet(JSONArray jsonArray) { if (jsonArray == null) { return null; } List<String> list = new ArrayList<>(); for (int i = 0;i < jsonArray.length(); i++) { list.add((String) jsonArray.get(i)); } return ImmutableSet.<String>builder().addAll(list).build(); }

Target:
private static Set<String> jsonArrayToSet(JSONArray jsonArray) { if (jsonArray == null) { return null; } Set<String> set = new HashSet<>(); for (int i = 0;i < jsonArray.length(); i++) { set.add((String) jsonArray.get(i)); } return set; }
Source:
public void updateModel(final OperationContext context, ModelNode model, AttributeDefinition attributeDefinition, ModelNode attribute) throws OperationFailedException { String key = KEY.resolveModelAttribute(context, model).asString(); context.getResult().set(attribute.get(key)); }

Target:
void updateModel(final OperationContext context, ModelNode model, AttributeDefinition attributeDefinition, ModelNode attribute) throws OperationFailedException { String key = KEY.resolveModelAttribute(context, model).asString(); context.getResult().set(attribute.get(key)); }
Source:
public int hashCode() { return clazz.hashCode(); }

Target:
public int hashCode() { return clazz.getCanonicalName().hashCode(); }
Source:
public static Comparator<FavouritePoint> getComparator() { final Collator collator = Collator.getInstance(); collator.setStrength(Collator.SECONDARY); Comparator<FavouritePoint> favoritesComparator = new Comparator<FavouritePoint>() { @Override public int compare(FavouritePoint o1, FavouritePoint o2) { String s1 = o1.getName(); String s2 = o2.getName(); int i1 = Algorithms.extractIntegerNumber(s1); int i2 = Algorithms.extractIntegerNumber(s2); String ot1 = Algorithms.extractIntegerPrefix(s1); String ot2 = Algorithms.extractIntegerPrefix(s2); if (ot1.length() == 0) { ot1 = s1; } if (ot2.length() == 0) { ot2 = s2; } int res = collator.compare(ot1, ot2); if (res == 0) { res = i1 - i2; } if (res == 0) { res = collator.compare(s1, s2); } if (s1.equals(WORK) && s2.equals(PARKING) && o1.getCategory().equals(PERSONAL) && o2.getCategory().equals(PERSONAL)) { res = -1; } if (s1.equals(PARKING) && s2.equals(WORK) && o1.getCategory().equals(PERSONAL) && o2.getCategory().equals(PERSONAL)) { res = 1; } return res; } }; return favoritesComparator; }

Target:
public static Comparator<FavouritePoint> getComparator() { final Collator collator = Collator.getInstance(); collator.setStrength(Collator.SECONDARY); Comparator<FavouritePoint> favoritesComparator = new Comparator<FavouritePoint>() { @Override public int compare(FavouritePoint o1, FavouritePoint o2) { String s1 = o1.getName(); String s2 = o2.getName(); int i1 = Algorithms.extractIntegerNumber(s1); int i2 = Algorithms.extractIntegerNumber(s2); String ot1 = Algorithms.extractIntegerPrefix(s1); String ot2 = Algorithms.extractIntegerPrefix(s2); if (ot1.length() == 0) { ot1 = s1; } if (ot2.length() == 0) { ot2 = s2; } int res = collator.compare(ot1, ot2); if (res == 0) { res = i1 - i2; } if (res == 0) { res = collator.compare(s1, s2); } if (s1.equals(PersonalPoint.WORK.name) && s2.equals(PersonalPoint.PARKING.name) && o1.getCategory().equals(PERSONAL_CATEGORY_NAME) && o2.getCategory().equals(PERSONAL_CATEGORY_NAME)) { res = -1; } if (s1.equals(PersonalPoint.PARKING.name) && s2.equals(PersonalPoint.WORK.name) && o1.getCategory().equals(PERSONAL_CATEGORY_NAME) && o2.getCategory().equals(PERSONAL_CATEGORY_NAME)) { res = 1; } return res; } }; return favoritesComparator; }
Source:
public java.util.Collection<Consumer> getConsumers() { return this.virtUuidToConsumerMap.values(); }

Target:
public Collection<Consumer> getConsumers() { return this.virtUuidToConsumerMap.values(); }
Source:
private IStatus saveImpl(IProgressMonitor monitor) { final BufferedWriter bw; try { bw = new BufferedWriter(new FileWriter(destination)); } catch (IOException _) { Status status = new Status(IStatus.ERROR, Activator.PLUGIN_ID, MessageFormat.format(Messages.ExportToTextJob_Unable_to_export_trace, destination), _); return status; } try { bw.write(Messages.ExportToTextJob_Header); return saveImpl(bw, monitor); } catch (IOException _) { Status status = new Status(IStatus.ERROR, Activator.PLUGIN_ID, MessageFormat.format(Messages.ExportToTextJob_Unable_to_export_trace, destination), _); return status; } finally { try { bw.close(); } catch (IOException e) { } } }

Target:
private IStatus saveImpl(IProgressMonitor monitor) { final BufferedWriter bw; try { bw = new BufferedWriter(new FileWriter(destination)); } catch (IOException ex) { Status status = new Status(IStatus.ERROR, Activator.PLUGIN_ID, MessageFormat.format(Messages.ExportToTextJob_Unable_to_export_trace, destination), ex); return status; } try { if (fHeader != null) { bw.write(fHeader); } return saveImpl(bw, monitor); } catch (IOException ex) { Status status = new Status(IStatus.ERROR, Activator.PLUGIN_ID, MessageFormat.format(Messages.ExportToTextJob_Unable_to_export_trace, destination), ex); return status; } finally { try { bw.close(); } catch (IOException e) { } } }
Source:
public String getTranslatorName() { final String result; if (this.translatorForeign != null) { result = this.translator; } else if (this.translator != null) { result = this.translator; } else { result = this.name; } return result; }

Target:
public String getTranslatorName() { final String result; if (this.translatorForeign != null) { result = this.translatorForeign; } else if (this.translator != null) { result = this.translator; } else { result = this.name; } return result; }
Source:
public synchronized Object clone() { if (isReference()) { return getRef(getProject()).clone(); } try { AbstractFileSet fs = (AbstractFileSet) super.clone(); fs.defaultPatterns = (PatternSet) defaultPatterns.clone(); fs.additionalPatterns = additionalPatterns.stream().map(PatternSet::clone) .map(PatternSet.class::cast).collect(Collectors.toList()); fs.selectors = new ArrayList<>(selectors); return fs; } catch (CloneNotSupportedException e) { throw new BuildException(e); } }

Target:
public synchronized Object clone() { if (isReference()) { return (getRef(getProject())).clone(); } try { AbstractFileSet fs = (AbstractFileSet) super.clone(); fs.defaultPatterns = (PatternSet) defaultPatterns.clone(); fs.additionalPatterns = additionalPatterns.stream().map(PatternSet::clone) .map(PatternSet.class::cast).collect(Collectors.toList()); fs.selectors = new ArrayList<>(selectors); return fs; } catch (CloneNotSupportedException e) { throw new BuildException(e); } }
Source:
public void truncateToSequenceNumber(final long truncationSeqNo) throws IOException { assert(m_memoryDeque.isEmpty()); m_persistentDeque.parseAndTruncate(new BinaryDequeTruncator() { @Override public TruncatorResponse parse(BBContainer bbc) { ByteBuffer b = bbc.b(); ByteOrder endianness = b.order(); b.order(ByteOrder.LITTLE_ENDIAN); try { final long startSequenceNumber = b.getLong(); if (startSequenceNumber > truncationSeqNo) { return PersistentBinaryDeque.fullTruncateResponse(); } final int tupleCountPos = b.position(); final int tupleCount = b.getInt(); final long lastSequenceNumber = startSequenceNumber + tupleCount - 1; if (lastSequenceNumber <= truncationSeqNo) { return null; } long uniqueId = b.getLong(); String uniqueIdString = UniqueIdGenerator.toString(uniqueId); int offset = 0; while (b.hasRemaining()) { if (startSequenceNumber + offset > truncationSeqNo) { b.limit(b.position()); b.putInt(tupleCountPos, offset - 1); b.position(0); return new ByteBufferTruncatorResponse(b); } offset++; final int rowLength = b.getInt(); if (b.position() + rowLength > b.limit()) { System.out.println(rowLength); } b.position(b.position() + rowLength); } return null; } finally { b.order(endianness); } } }); m_persistentDeque.close(); StreamTableSchemaSerializer ds = new StreamTableSchemaSerializer( VoltDB.instance().getCatalogContext(), m_streamName); m_persistentDeque = new PersistentBinaryDeque(m_nonce, ds, new VoltFile(m_path), exportLog); m_reader = m_persistentDeque.openForRead(m_nonce); exportLog.info("After truncate, PBD size is " + (m_reader.sizeInBytes() - (8 * m_reader.getNumObjects()))); }

Target:
public void truncateToSequenceNumber(final long truncationSeqNo) throws IOException { assert(m_memoryDeque.isEmpty()); m_persistentDeque.parseAndTruncate(new BinaryDequeTruncator() { @Override public TruncatorResponse parse(BBContainer bbc) { ByteBuffer b = bbc.b(); ByteOrder endianness = b.order(); b.order(ByteOrder.LITTLE_ENDIAN); try { final long startSequenceNumber = b.getLong(); if (startSequenceNumber > truncationSeqNo) { return PersistentBinaryDeque.fullTruncateResponse(); } final int tupleCountPos = b.position(); final int tupleCount = b.getInt(); final long lastSequenceNumber = startSequenceNumber + tupleCount - 1; if (lastSequenceNumber <= truncationSeqNo) { return null; } b.getLong(); int offset = 0; while (b.hasRemaining()) { if (startSequenceNumber + offset > truncationSeqNo) { b.limit(b.position()); b.putInt(tupleCountPos, offset - 1); b.position(0); return new ByteBufferTruncatorResponse(b); } offset++; final int rowLength = b.getInt(); b.position(b.position() + rowLength); } return null; } finally { b.order(endianness); } } }); m_persistentDeque.close(); StreamTableSchemaSerializer ds = new StreamTableSchemaSerializer( VoltDB.instance().getCatalogContext(), m_streamName); m_persistentDeque = new PersistentBinaryDeque(m_nonce, ds, new VoltFile(m_path), exportLog); m_reader = m_persistentDeque.openForRead(m_nonce); exportLog.info("After truncate, PBD size is " + (m_reader.sizeInBytes() - (8 * m_reader.getNumObjects()))); }
Source:
public void addClient(final Client client) { if(! client.isClosed() && client.getProtocol() == WireProtocol.TCP && isRunning()) { client.setClientsThreadExecutor(clientDistributer.getSubmitterForKey(client)); client.setClientsSocketExecuter(this); if(client.getChannel() != null && client.getChannel().isConnected()) { Client nc = clients.putIfAbsent(client.getChannel(), client); if(nc == null) { if(client.canRead()) { readScheduler.execute(new AddToSelector(client, readSelector, SelectionKey.OP_READ)); readSelector.wakeup(); } if(client.canWrite()) { writeScheduler.execute(new AddToSelector(client, writeSelector, SelectionKey.OP_WRITE)); writeSelector.wakeup(); } } } else { if(client.getChannel() == null) { client.connect(); } Client nc = clients.putIfAbsent(client.getChannel(), client); if(nc == null) { readScheduler.execute(new AddToSelector(client, readSelector, SelectionKey.OP_CONNECT)); readSelector.wakeup(); schedulerPool.schedule(new Runnable() { @Override public void run() { if(!client.hasConnectionTimedOut()) { SelectionKey sk = client.getChannel().keyFor(readSelector); if(sk != null) { sk.cancel(); } removeClient(client); client.close(); } }}, client.getTimeout()+10); } } } }

Target:
public void addClient(final Client client) { ArgumentVerifier.assertNotNull(client, "Client"); if(! client.isClosed() && client.getProtocol() == WireProtocol.TCP && isRunning()) { client.setClientsThreadExecutor(clientDistributer.getSubmitterForKey(client)); client.setClientsSocketExecuter(this); if(client.getChannel() != null && client.getChannel().isConnected()) { Client nc = clients.putIfAbsent(client.getChannel(), client); if(nc == null) { if(client.canRead()) { readScheduler.execute(new AddToSelector(client, readSelector, SelectionKey.OP_READ)); readSelector.wakeup(); } if(client.canWrite()) { writeScheduler.execute(new AddToSelector(client, writeSelector, SelectionKey.OP_WRITE)); writeSelector.wakeup(); } } } else { if(client.getChannel() == null) { client.connect(); } Client nc = clients.putIfAbsent(client.getChannel(), client); if(nc == null) { readScheduler.execute(new AddToSelector(client, readSelector, SelectionKey.OP_CONNECT)); readSelector.wakeup(); schedulerPool.schedule(new Runnable() { @Override public void run() { if(client.hasConnectionTimedOut()) { SelectionKey sk = client.getChannel().keyFor(readSelector); if(sk != null) { sk.cancel(); } removeClient(client); client.close(); client.setConnectionStatus(new TimeoutException("Timed out while connecting!")); } }}, client.getTimeout()+100); } } } }
Source:
public void run() { log.info("Starting cloud provider string migration"); for (Application a : applicationDAO.all()) { if (a.details().containsKey("accounts")) { migrate(a); } } }

Target:
public void run() { log.info("Starting account field removal migration"); for (Application a : applicationDAO.all()) { if (a.details().containsKey("accounts")) { migrate(a); } } }
Source:
private void resolvePatterns() { for ( final Pattern52 pattern52 : model.getPatterns() ) { final Pattern pattern = resolvePattern( rule, pattern52 ); new FieldConditionsBuilder( index, model, rule, row, utils, pattern ).buildConditions( pattern52.getChildColumns() ); } for ( final CompositeColumn<? extends BaseColumn> column : model.getConditions() ) { if ( column instanceof BRLConditionColumn ) { new BRLConditionsBuilder( index, model, rule, row, utils ).buildConditions( (( BRLConditionColumn ) column).getChildColumns() ); } } for ( final ActionCol52 actionCol52 : model.getActionCols() ) { new ActionBuilder( index, model, rule, row, utils, actionCol52 ).build(); } }

Target:
private void resolvePatterns() { for ( final CompositeColumn<? extends BaseColumn> column : model.getConditions() ) { if ( column instanceof Pattern52 ) { final Pattern pattern = resolvePattern( rule, ( Pattern52 ) column ); new FieldConditionsBuilder( index, model, rule, row, utils, pattern ).buildConditions( (( Pattern52 ) column).getChildColumns() ); } else if ( column instanceof BRLConditionColumn ) { new BRLConditionsBuilder( index, model, rule, row, utils ).buildConditions( (( BRLConditionColumn ) column).getChildColumns() ); } } for ( final ActionCol52 actionCol52 : model.getActionCols() ) { new ActionBuilder( index, model, rule, row, utils, actionCol52 ).build(); } }