auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public static PolicyUnit map(SchedulingPolicyUnit model, PolicyUnit template) { PolicyUnit entity = template != null ? template : new PolicyUnit(); if (model.isSetId()) { entity.setId(GuidUtils.asGuid(model.getId())); } if (model.isSetName()) { entity.setName(model.getName()); } if (model.isSetDescription()) { entity.setDescription(model.getDescription()); } if (model.isSetType()) { PolicyUnitType policyUnitType = null; switch (model.getType().toUpperCase()) { case FILTER: policyUnitType = PolicyUnitType.FILTER; break; case WEIGHT: policyUnitType = PolicyUnitType.WEIGHT; break; case LOAD_BALANCING: policyUnitType = PolicyUnitType.LOAD_BALANCING; break; default: assert (false) : "unknown Policy Unit Type value: " + model.toString(); return null; } entity.setPolicyUnitType(policyUnitType); } if (model.isSetEnabled()) { entity.setEnabled(model.isEnabled()); } if (model.isSetInternal()) { entity.setInternal(model.isInternal()); } if (model.isSetPropertiesMetaData()) { entity.setParameterRegExMap(CustomPropertiesParser.toMap(model.getPropertiesMetaData())); } return entity; }

Target:
public static PolicyUnit map(SchedulingPolicyUnit model, PolicyUnit template) { PolicyUnit entity = template != null ? template : new PolicyUnit(); if (model.isSetId()) { entity.setId(GuidUtils.asGuid(model.getId())); } if (model.isSetName()) { entity.setName(model.getName()); } if (model.isSetDescription()) { entity.setDescription(model.getDescription()); } if (model.isSetType()) { entity.setPolicyUnitType(map(org.ovirt.engine.api.model.PolicyUnitType.valueOf(model.getType() .toUpperCase()), null)); } if (model.isSetEnabled()) { entity.setEnabled(model.isEnabled()); } if (model.isSetInternal()) { entity.setInternal(model.isInternal()); } if (model.isSetPropertiesMetaData()) { entity.setParameterRegExMap(CustomPropertiesParser.toMap(model.getPropertiesMetaData())); } return entity; }
Source:
public void reduceHealth(Actor oreon, String cause) { OreonAttributeComponent oreonAttributeComponent = oreon.getComponent(OreonAttributeComponent.class); switch (cause) { case "hunger" : float lastHungerCheck = oreonAttributeComponent.lastHungerCheck; if (lastHungerCheck != 0 && time.getGameTime() - lastHungerCheck < MAX_DELAY) { return; } oreonAttributeComponent.health -= 10; String message = "We are losing health due to hunger."; delayedNotificationSystem.sendNotificationNow(message, notificationMessageEntity); oreonAttributeComponent.lastHungerCheck = time.getGameTime(); } oreon.save(oreonAttributeComponent); checkOreonHealth(oreon); }

Target:
public void reduceHealth(Actor oreon, String cause) { OreonAttributeComponent oreonAttributeComponent = oreon.getComponent(OreonAttributeComponent.class); switch (cause) { case "hunger" : float lastHungerCheck = oreonAttributeComponent.lastHungerCheck; if (lastHungerCheck != 0 && time.getGameTime() - lastHungerCheck < MAX_DELAY) { return; } oreonAttributeComponent.health -= 10; String message = "We are losing health due to hunger."; DisplayNameComponent displayNameComponent = notificationMessageEntity.getComponent(DisplayNameComponent.class); displayNameComponent.name = oreon.getComponent(NameTagComponent.class).text; notificationMessageEntity.saveComponent(displayNameComponent); delayedNotificationSystem.sendNotificationNow(message, notificationMessageEntity); oreonAttributeComponent.lastHungerCheck = time.getGameTime(); } oreon.save(oreonAttributeComponent); checkOreonHealth(oreon); }
Source:
public void undeleteShare() { ShareServiceAsyncClient fileServiceAsyncClient = createAsyncClientWithSASToken(); ListSharesOptions listSharesOptions = new ListSharesOptions(); listSharesOptions.setIncludeDeleted(true); fileServiceAsyncClient.listShares(listSharesOptions).flatMap( deletedShare -> { Mono<ShareAsyncClient> shareAsyncClient = fileServiceAsyncClient.undeleteShare( deletedShare.getName(), deletedShare.getVersion()); return shareAsyncClient; } ).then().block(); END: com.azure.storage.file.share.ShareServiceAsyncClient.undeleteShare#String-String }

Target:
public void undeleteShare() { ShareServiceAsyncClient fileServiceAsyncClient = createAsyncClientWithSASToken(); ListSharesOptions listSharesOptions = new ListSharesOptions(); listSharesOptions.setIncludeDeleted(true); fileServiceAsyncClient.listShares(listSharesOptions).flatMap( deletedShare -> { Mono<ShareAsyncClient> shareAsyncClient = fileServiceAsyncClient.undeleteShare( deletedShare.getName(), deletedShare.getVersion()); return shareAsyncClient; } ).blockFirst(); END: com.azure.storage.file.share.ShareServiceAsyncClient.undeleteShare#String-String }
Source:
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.search_users_groups_layout, container, false); SearchView searchView = (SearchView) view.findViewById(R.id.searchView); SearchManager searchManager = (SearchManager) getActivity().getSystemService(Context.SEARCH_SERVICE); searchView.setSearchableInfo(searchManager.getSearchableInfo( getActivity().getComponentName()) ); searchView.setIconifiedByDefault(false); searchView.setImeOptions(EditorInfo.IME_FLAG_NO_EXTRACT_UI); searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() { @Override public boolean onQueryTextSubmit(String query) { Log_OC.v(TAG, "onQueryTextSubmit intercepted, query: " + query); return true; } @Override public boolean onQueryTextChange(String newText) { return false; } }); view.setMinimumWidth(R.dimen.share_user_groups_width); return view; }

Target:
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.search_users_groups_layout, container, false); SearchView searchView = (SearchView) view.findViewById(R.id.searchView); SearchManager searchManager = (SearchManager) getActivity().getSystemService(Context.SEARCH_SERVICE); searchView.setSearchableInfo(searchManager.getSearchableInfo( getActivity().getComponentName()) ); searchView.setIconifiedByDefault(false); searchView.setImeOptions(EditorInfo.IME_FLAG_NO_EXTRACT_UI); searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() { @Override public boolean onQueryTextSubmit(String query) { Log_OC.v(TAG, "onQueryTextSubmit intercepted, query: " + query); return true; } @Override public boolean onQueryTextChange(String newText) { return false; } }); return view; }
Source:
private void doTest(final String inputBed, final String header) throws IOException { final File outputFile = File.createTempFile("bed_to_interval_list_test.", ".interval_list"); final BedToIntervalList program = new BedToIntervalList(); final File inputBedFile = new File(TEST_DATA_DIR, inputBed); program.INPUT = inputBedFile; program.SEQUENCE_DICTIONARY = new File(TEST_DATA_DIR, header); program.OUTPUT = outputFile; program.doWork(); Assert.assertEquals(getFileContentsAsString(new File(inputBedFile.getAbsolutePath() + ".interval_list")), getFileContentsAsString(outputFile)); Assert.assertEquals(outputFile.delete(), true); }

Target:
private void doTest(final String inputBed, final String header) throws IOException { final File outputFile = File.createTempFile("bed_to_interval_list_test.", ".interval_list"); outputFile.deleteOnExit(); final BedToIntervalList program = new BedToIntervalList(); final File inputBedFile = new File(TEST_DATA_DIR, inputBed); program.INPUT = inputBedFile; program.SEQUENCE_DICTIONARY = new File(TEST_DATA_DIR, header); program.OUTPUT = outputFile; program.doWork(); SAMException unexpectedException = null; try { IOUtil.assertFilesEqual(new File(inputBedFile.getAbsolutePath() + ".interval_list"), outputFile); } catch (final SAMException e) { unexpectedException = e; } Assert.assertEquals(unexpectedException, null); }
Source:
private List<Variable> evaluateVisibleMatches(IType expectedType, List<IBinding> suggestions) throws CModelException { Set<Variable> res = new HashSet<>(); int size = suggestions.size(); for (int i = 0; i < size; i++) { Variable variable = createVariable(suggestions.get(i), expectedType, i); if (variable != null) { if (fAlreadyMatchedNames.contains(variable.name)) { variable.alreadyMatched = true; } res.add(variable); } } return new ArrayList<Variable>(res); }

Target:
private Collection<Variable> evaluateVisibleMatches(IType expectedType, List<IBinding> suggestions) throws CModelException { Set<Variable> res = new HashSet<>(); int size = suggestions.size(); for (int i = 0; i < size; i++) { Variable variable = createVariable(suggestions.get(i), expectedType, i); if (variable != null) { if (fAlreadyMatchedNames.contains(variable.name)) { variable.alreadyMatched = true; } res.add(variable); } } return res; }
Source:
private void initVmTemplate() { VmTemplate vmFromConfiguration = null; OvfHelper ovfHelper = new OvfHelper(); ovfEntityData = getUnregisteredOVFDataDao().getByEntityIdAndStorageDomain(getParameters().getContainerId(), getParameters().getStorageDomainId()); if (ovfEntityData != null) { try { vmFromConfiguration = ovfHelper.readVmTemplateFromOvf(ovfEntityData.getOvfData()); } catch (OvfReaderException e) { log.errorFormat("failed to parse a given ovf configuration: \n" + ovfEntityData.getOvfData(), e); } vmFromConfiguration.setVdsGroupId(getParameters().getVdsGroupId()); setVmTemplate(vmFromConfiguration); getParameters().setVmTemplate(vmFromConfiguration); getParameters().setDestDomainId(ovfEntityData.getStorageDomainId()); getParameters().setSourceDomainId(ovfEntityData.getStorageDomainId()); } setVdsGroupId(getParameters().getVdsGroupId()); setStoragePoolId(getVdsGroup().getStoragePoolId()); }

Target:
private void initVmTemplate() { VmTemplate vmFromConfiguration = null; OvfHelper ovfHelper = new OvfHelper(); ovfEntityData = getUnregisteredOVFDataDao().getByEntityIdAndStorageDomain(getParameters().getContainerId(), getParameters().getStorageDomainId()); if (ovfEntityData != null) { try { vmFromConfiguration = ovfHelper.readVmTemplateFromOvf(ovfEntityData.getOvfData()); vmFromConfiguration.setVdsGroupId(getParameters().getVdsGroupId()); setVmTemplate(vmFromConfiguration); getParameters().setVmTemplate(vmFromConfiguration); getParameters().setDestDomainId(ovfEntityData.getStorageDomainId()); getParameters().setSourceDomainId(ovfEntityData.getStorageDomainId()); } catch (OvfReaderException e) { log.errorFormat("failed to parse a given ovf configuration: \n" + ovfEntityData.getOvfData(), e); } } setVdsGroupId(getParameters().getVdsGroupId()); setStoragePoolId(getVdsGroup().getStoragePoolId()); }
Source:
public void testMarkers() { QueueChannel outputChannel = new QueueChannel(); FileSplitter splitter = new FileSplitter(true, true); splitter.setOutputChannel(outputChannel); splitter.handleMessage(new GenericMessage<File>(file)); Message<?> received = outputChannel.receive(0); assertNull(received.getHeaders().get(IntegrationMessageHeaderAccessor.SEQUENCE_SIZE)); assertNotNull(received); assertThat(received.getPayload(), Matchers.instanceOf(FileSplitter.FileMarker.class)); FileMarker fileMarker = (FileSplitter.FileMarker) received.getPayload(); assertEquals(FileSplitter.FileMarker.Mark.START, fileMarker.getMark()); assertEquals(file.getAbsolutePath(), fileMarker.getFilePath()); assertNotNull(outputChannel.receive(0)); assertNotNull(outputChannel.receive(0)); received = outputChannel.receive(0); assertNotNull(received); assertThat(received.getPayload(), Matchers.instanceOf(FileSplitter.FileMarker.class)); fileMarker = (FileSplitter.FileMarker) received.getPayload(); assertEquals(FileSplitter.FileMarker.Mark.END, fileMarker.getMark()); assertEquals(file.getAbsolutePath(), fileMarker.getFilePath()); }

Target:
public void testMarkers() { QueueChannel outputChannel = new QueueChannel(); FileSplitter splitter = new FileSplitter(true, true); splitter.setOutputChannel(outputChannel); splitter.handleMessage(new GenericMessage<File>(file)); Message<?> received = outputChannel.receive(0); assertNotNull(received); assertNull(received.getHeaders().get(IntegrationMessageHeaderAccessor.SEQUENCE_SIZE)); assertThat(received.getPayload(), Matchers.instanceOf(FileSplitter.FileMarker.class)); FileMarker fileMarker = (FileSplitter.FileMarker) received.getPayload(); assertEquals(FileSplitter.FileMarker.Mark.START, fileMarker.getMark()); assertEquals(file.getAbsolutePath(), fileMarker.getFilePath()); assertNotNull(outputChannel.receive(0)); assertNotNull(outputChannel.receive(0)); received = outputChannel.receive(0); assertNotNull(received); assertThat(received.getPayload(), Matchers.instanceOf(FileSplitter.FileMarker.class)); fileMarker = (FileSplitter.FileMarker) received.getPayload(); assertEquals(FileSplitter.FileMarker.Mark.END, fileMarker.getMark()); assertEquals(file.getAbsolutePath(), fileMarker.getFilePath()); }
Source:
synchronized void stop() { handler.removeCallbacks(surveyRunner); resetSurvey(); if (surveySupportFragment != null) { surveySupportFragment.dismiss(); surveySupportFragment = null; } else if (surveyFragment != null) { surveyFragment.dismiss(); surveyFragment = null; } Log.d(Constants.TAG, "Survey stopped"); }

Target:
synchronized void stop() { handler.removeCallbacks(surveyRunner); if (surveySupportFragment != null) { surveySupportFragment.dismiss(); } else if (surveyFragment != null) { surveyFragment.dismiss(); } resetSurvey(); Log.d(Constants.TAG, "Survey stopped"); }
Source:
public CallBatcherImpl<W, E> withdefaultArgs(CallArgs args) { if(args == null) throw new IllegalArgumentException("CallArgs cannot be null."); CallArgsImpl callArgsImpl = (CallArgsImpl) args; if(callArgsImpl == null || ! (callArgsImpl instanceof CallArgsImpl)) throw new IllegalArgumentException("Illegal Argument."); if(callArgsImpl.getEndpoint().getEndpointPath()!= caller.getEndpointPath()) throw new IllegalArgumentException("Endpoints are different."); List<CallField> callFieldList = callArgsImpl.getCallFields(); callFieldList.forEach(p->p.toBuffered()); this.defaultArgs = callFieldList; return this; }

Target:
public CallBatcherImpl<W, E> withdefaultArgs(CallArgs args) { if(args == null) { this.defaultArgs = null; return this; } if(! (args instanceof CallArgsImpl)) throw new IllegalArgumentException("Illegal Argument."); CallArgsImpl callArgsImpl = (CallArgsImpl) args; if(callArgsImpl.getEndpoint().getEndpointPath()!= caller.getEndpointPath()) throw new IllegalArgumentException("Endpoints are different."); if(callArgsImpl.getCallFields() == null || callArgsImpl.getCallFields().size() == 0) { this.defaultArgs = null; return this; } List<CallField> callFieldList = callArgsImpl.getCallFields().stream().map(p->p.toBuffered()).collect(Collectors.toList()); this.defaultArgs = callFieldList; return this; }
Source:
public static boolean isWater(final Material material) { return material == Material.WATER || material == Material.SEAGRASS || material == Material.TALL_SEAGRASS || material == Material.KELP_PLANT; }

Target:
public static boolean isWater(final Material material) { return material == Material.WATER || material == Material.SEAGRASS || material == Material.TALL_SEAGRASS || material == Material.KELP_PLANT || material == Material.KELP || material == Material.BUBBLE_COLUMN; }
Source:
private boolean isSucceededWithReasonGiven(){ return isSucceededWithHA() && !StringUtils.isEmpty(getVds().getMaintenanceReason()); }

Target:
private boolean isSucceededWithReasonGiven(){ return isSucceededWithHA() && StringUtils.isNotEmpty(getVds().getMaintenanceReason()); }
Source:
private int findPrefixIndex(String value, int offset) { int prefixIndex = value.indexOf(PLACEHOLDER_PREFIX); if (prefixIndex == -1) { return -1; } if (prefixIndex != 0 && value.charAt(prefixIndex - 1) == '\\') { if (prefixIndex <= 1 || (prefixIndex > 1 && value.charAt(prefixIndex - 2) != '\\')) { int relativeOffset = prefixIndex + PLACEHOLDER_PREFIX.length(); return findPrefixIndex(value.substring(relativeOffset), offset + relativeOffset); } } return prefixIndex + offset; }

Target:
private int findPrefixIndex(String value, int offset) { int prefixIndex = value.indexOf(PLACEHOLDER_PREFIX); if (prefixIndex == -1) { return -1; } if (shouldResolvePlaceholder(value, prefixIndex)) { return prefixIndex + offset; } else { int relativeOffset = prefixIndex + PLACEHOLDER_PREFIX.length(); return findPrefixIndex(value.substring(relativeOffset), offset + relativeOffset); } }
Source:
public String getMessage(Bundle bundle, String value) { String result = value; if (bundle != null && result != null && result.startsWith(PERCENT)) { if (bundle != null && result != null && result.startsWith(PERCENT + PERCENT)) { return result.replaceFirst(PERCENT, EMPTY); } try { result = Platform.getResourceBundle(bundle).getString(result.substring(PERCENT.length())); } catch (MissingResourceException mre) { DslCommonPlugin.INSTANCE.log(new Status(IStatus.WARNING, bundle.getSymbolicName(), 0, "The key " + value + "has not been found in the properties file for label localization", mre)); } } return result; }

Target:
public String getMessage(Bundle bundle, String value) { String result = value; if (bundle != null && result != null && result.startsWith(PERCENT)) { if (bundle != null && result != null && result.startsWith(PERCENT + PERCENT)) { return result.replaceFirst(PERCENT, EMPTY); } try { result = Platform.getResourceBundle(bundle).getString(result.substring(PERCENT.length())); } catch (MissingResourceException mre) { String message = MessageFormat.format(Messages.MessageTranslator_missingResourceMessage1, value) + value + MessageFormat.format(Messages.MessageTranslator_missingResourceMessage2, value); DslCommonPlugin.INSTANCE.log(new Status(IStatus.WARNING, bundle.getSymbolicName(), 0, message, mre)); } } return result; }
Source:
private void tryToLoadWebview(WebView webView){ if ( callback != null ) callback.startProcess(); if ( unit != null) { if ( unit.isGraded() || unit.isGradedSubDAG() ){ getView().findViewById(R.id.webview_header_text).setVisibility(View.VISIBLE); } else { getView().findViewById(R.id.webview_header_text).setVisibility(View.GONE); } PrefManager pref = new PrefManager(getActivity(), PrefManager.Pref.LOGIN); AuthResponse auth = pref.getCurrentAuth(); Map<String, String> map = new HashMap<String, String>(); if (auth == null || !auth.isSuccess()) { String token = pref.getString(PrefManager.Key.AUTH_TOKEN_SOCIAL); if (token != null) { map.put("Authorization", token); } } else { map.put("Authorization", String.format("%s %s", auth.token_type, auth.access_token)); } Long lastRefresh = pref.getLong(PrefManager.Key.AUTH_ASSESSMENT_SESSION_ID_REFRESH_TIME); Long time = pref.getLong(PrefManager.Key.AUTH_ASSESSMENT_SESSION_EXPIRATION); String sessionid = pref.getString(PrefManager.Key.AUTH_ASSESSMENT_SESSION_ID); Long curTime = new Date().getTime(); webView.loadUrl(Api.getSessionTokenExchangeUrl(), map); if ( lastRefresh + 60000 > curTime) { map.put("Cookie", PrefManager.Key.SESSION_ID + "=" + sessionid ); webView.loadUrl(unit.getBlockUrl(), map); } else { if ( time < new Date().getTime() || TextUtils.isEmpty(sessionid) ){ pref.put(PrefManager.Key.AUTH_ASSESSMENT_SESSION_ID_REFRESH_TIME, curTime); webView.loadUrl(Api.getSessionTokenExchangeUrl(), map); } else { map.put("Cookie", PrefManager.Key.SESSION_ID + "=" + sessionid ); webView.loadUrl(unit.getBlockUrl(), map); } } } }

Target:
private void tryToLoadWebview(WebView webView){ if ( callback != null ) callback.startProcess(); if ( unit != null) { if ( unit.isGraded() || unit.isGradedSubDAG() ){ getView().findViewById(R.id.webview_header_text).setVisibility(View.VISIBLE); } else { getView().findViewById(R.id.webview_header_text).setVisibility(View.GONE); } PrefManager pref = new PrefManager(getActivity(), PrefManager.Pref.LOGIN); AuthResponse auth = pref.getCurrentAuth(); Map<String, String> map = new HashMap<String, String>(); if (auth == null || !auth.isSuccess()) { String token = pref.getString(PrefManager.Key.AUTH_TOKEN_SOCIAL); if (token != null) { map.put("Authorization", token); } } else { map.put("Authorization", String.format("%s %s", auth.token_type, auth.access_token)); } Long lastRefresh = pref.getLong(PrefManager.Key.AUTH_ASSESSMENT_SESSION_ID_REFRESH_TIME); Long sessionIdExpirationDate = pref.getLong(PrefManager.Key.AUTH_ASSESSMENT_SESSION_EXPIRATION); String sessionId = pref.getString(PrefManager.Key.AUTH_ASSESSMENT_SESSION_ID); Long curTime = new Date().getTime(); if ( lastRefresh + 60000 > curTime) { map.put("Cookie", PrefManager.Key.SESSION_ID + "=" + sessionId ); webView.loadUrl(unit.getBlockUrl(), map); } else { if ( sessionIdExpirationDate < curTime || TextUtils.isEmpty(sessionId) ){ pref.put(PrefManager.Key.AUTH_ASSESSMENT_SESSION_ID_REFRESH_TIME, curTime); webView.loadUrl(Api.getSessionTokenExchangeUrl(), map); } else { map.put("Cookie", PrefManager.Key.SESSION_ID + "=" + sessionId ); webView.loadUrl(unit.getBlockUrl(), map); } } } }
Source:
public void shouldBeEqualWhenBothObjectIdsAreTheSame() { Change c1 = new Change(); Change c2 = new Change(); c1.objectId = c2.objectId = ZERO_ID; boolean result = c1.equals(c2); assertTrue(result); assertTrue(c1.hashCode() == c2.hashCode()); }

Target:
public void shouldBeEqualWhenBothObjectIdsAreTheSame() { Change c1 = new Change(); Change c2 = new Change(); c1.objectId = c2.objectId = MISC_ID; boolean result = c1.equals(c2); assertTrue(result); assertTrue(c1.hashCode() == c2.hashCode()); }
Source:
protected void setQcowCompat(DiskImage diskImage) { diskImage.setQcowCompat(QcowCompat.QCOW2_V2); if (FeatureSupported.qcowCompatSupported(getStoragePool().getCompatibilityVersion())) { QemuImageInfo qemuImageInfo = ImagesHandler.getQemuImageInfoFromVdsm(diskImage.getStoragePoolId(), diskImage.getStorageIds().get(0), diskImage.getId(), diskImage.getImageId(), true); if (qemuImageInfo != null) { diskImage.setQcowCompat(qemuImageInfo.getQcowCompat()); } } }

Target:
protected void setQcowCompat(DiskImage diskImage) { diskImage.setQcowCompat(QcowCompat.QCOW2_V2); if (FeatureSupported.qcowCompatSupported(getStoragePool().getCompatibilityVersion())) { QemuImageInfo qemuImageInfo = ImagesHandler.getQemuImageInfoFromVdsm(diskImage.getStoragePoolId(), diskImage.getStorageIds().get(0), diskImage.getId(), diskImage.getImageId(), true); if (qemuImageInfo != null) { diskImage.setQcowCompat(qemuImageInfo.getQcowCompat()); } } imageDao.update(diskImage.getImage()); }
Source:
private synchronized void executeTask(ProcessRecordsInput input) { taskExecutionListener.onTaskBegin(currentState, shardInfo); ConsumerTask task = currentState.createTask(shardConsumerArgument, ShardConsumer.this, input); if (task != null) { taskDispatchedAt = Instant.now(); currentTask = task; taskIsRunning = true; TaskResult result; try { result = task.call(); } finally { taskIsRunning = false; } taskOutcome = resultToOutcome(result); } taskExecutionListener.onTaskEnd(currentState, shardInfo); }

Target:
private synchronized void executeTask(ProcessRecordsInput input) { TaskExecutionListenerInput taskExecutionListenerInput = TaskExecutionListenerInput.builder() .shardInfo(shardInfo) .taskType(currentState.taskType()) .build(); taskExecutionListener.beforeTaskExecution(taskExecutionListenerInput); ConsumerTask task = currentState.createTask(shardConsumerArgument, ShardConsumer.this, input); if (task != null) { taskDispatchedAt = Instant.now(); currentTask = task; taskIsRunning = true; TaskResult result; try { result = task.call(); } finally { taskIsRunning = false; } taskOutcome = resultToOutcome(result); taskExecutionListenerInput = taskExecutionListenerInput.toBuilder().taskOutcome(taskOutcome).build(); } taskExecutionListener.afterTaskExecution(taskExecutionListenerInput); }
Source:
protected GenericDatabaseDialect( AbstractConfig config, IdentifierRules defaultIdentifierRules ) { this.config = config; this.defaultIdentifierRules = defaultIdentifierRules; this.jdbcUrl = config.getString(JdbcSourceConnectorConfig.CONNECTION_URL_CONFIG); if (!(config instanceof JdbcSinkConfig)) { mapNumerics = config.getBoolean(JdbcSourceTaskConfig.NUMERIC_PRECISION_MAPPING_CONFIG); catalogPattern = config.getString(JdbcSourceTaskConfig.CATALOG_PATTERN_CONFIG); schemaPattern = config.getString(JdbcSourceTaskConfig.SCHEMA_PATTERN_CONFIG); tableTypes = new HashSet<>(config.getList(JdbcSourceTaskConfig.TABLE_TYPE_CONFIG)); } else { mapNumerics = JdbcSourceTaskConfig.NUMERIC_PRECISION_MAPPING_DEFAULT; catalogPattern = JdbcSourceTaskConfig.CATALOG_PATTERN_DEFAULT; schemaPattern = JdbcSourceTaskConfig.SCHEMA_PATTERN_DEFAULT; tableTypes = new HashSet<>(Arrays.asList(JdbcSourceTaskConfig.TABLE_TYPE_DEFAULT)); } }

Target:
protected GenericDatabaseDialect( AbstractConfig config, IdentifierRules defaultIdentifierRules ) { this.config = config; this.defaultIdentifierRules = defaultIdentifierRules; this.jdbcUrl = config.getString(JdbcSourceConnectorConfig.CONNECTION_URL_CONFIG); if (config instanceof JdbcSinkConfig) { catalogPattern = JdbcSourceTaskConfig.CATALOG_PATTERN_DEFAULT; schemaPattern = JdbcSourceTaskConfig.SCHEMA_PATTERN_DEFAULT; tableTypes = new HashSet<>(Arrays.asList(JdbcSourceTaskConfig.TABLE_TYPE_DEFAULT)); } else { catalogPattern = config.getString(JdbcSourceTaskConfig.CATALOG_PATTERN_CONFIG); schemaPattern = config.getString(JdbcSourceTaskConfig.SCHEMA_PATTERN_CONFIG); tableTypes = new HashSet<>(config.getList(JdbcSourceTaskConfig.TABLE_TYPE_CONFIG)); } if (config instanceof JdbcSourceConnectorConfig) { mapNumerics = ((JdbcSourceConnectorConfig)config).numericMapping(); } else { mapNumerics = NumericMapping.NONE; } }
Source:
public boolean isKeypairValid() { try { PrivateKey privateKeyObject = Utils.loadPrivateKey(getPrivateKey()); PublicKey publicKeyObject = Utils.loadPublicKey(getPublicKey()); return Utils.verifyKeyPair(privateKeyObject, publicKeyObject); } catch (Exception e) { return false; } }

Target:
public boolean isKeypairValid() { try { PrivateKey privateKeyObject = KeyUtils.loadPrivateKey(getPrivateKey()); PublicKey publicKeyObject = KeyUtils.loadPublicKey(getPublicKey()); return Utils.verifyKeyPair(privateKeyObject, publicKeyObject); } catch (Exception e) { return false; } }
Source:
@Test public void remoting() throws Exception { Assume.assumeTrue(ProcessTree.get()!=ProcessTree.DEFAULT); Tag t = channels.french.call(new MyCallable()); assertSame(t.p.getTree(), t.tree); t.p.getEnvironmentVariables(); assertEquals(t.id,t.p.getPid()); t.p.act(new ProcessCallableImpl()); }

Target:
@Test public void remoting() throws Exception { Assume.assumeFalse("on some platforms where we fail to list any processes", ProcessTree.get()==ProcessTree.DEFAULT); Tag t = channels.french.call(new MyCallable()); assertSame(t.p.getTree(), t.tree); t.p.getEnvironmentVariables(); assertEquals(t.id,t.p.getPid()); t.p.act(new ProcessCallableImpl()); }
Source:
public Collection<UberfireDock> provideDocks(final String perspectiveIdentifier) { placeManager.closePlace("org.kie.guvnor.TestResults"); List<UberfireDock> result = new ArrayList<>(); toolsDock = new UberfireDock(UberfireDockPosition.EAST, "INFO_CIRCLE", new DefaultPlaceRequest(RightPanelPresenter.IDENTIFIER), perspectiveIdentifier); result.add(toolsDock.withSize(450).withLabel(ScenarioSimulationEditorConstants.INSTANCE.testTools())); reportDock = new UberfireDock(UberfireDockPosition.EAST, "PLAY_CIRCLE", new DefaultPlaceRequest("org.kie.guvnor.TestResults"), perspectiveIdentifier); result.add(reportDock.withSize(450).withLabel(DefaultWorkbenchConstants.INSTANCE.TestReport())); return result; }

Target:
public Collection<UberfireDock> provideDocks(final String perspectiveIdentifier) { List<UberfireDock> result = new ArrayList<>(); settingsDock = new UberfireDock(UberfireDockPosition.EAST, "SLIDERS", new DefaultPlaceRequest(SettingsPresenter.IDENTIFIER), perspectiveIdentifier); result.add(settingsDock.withSize(450).withLabel(ScenarioSimulationEditorConstants.INSTANCE.settings())); toolsDock = new UberfireDock(UberfireDockPosition.EAST, "INFO_CIRCLE", new DefaultPlaceRequest(TestToolsPresenter.IDENTIFIER), perspectiveIdentifier); result.add(toolsDock.withSize(450).withLabel(ScenarioSimulationEditorConstants.INSTANCE.testTools())); cheatSheetDock = new UberfireDock(UberfireDockPosition.EAST, "FILE_TEXT", new DefaultPlaceRequest(CheatSheetPresenter.IDENTIFIER), perspectiveIdentifier); result.add(cheatSheetDock.withSize(450).withLabel(ScenarioSimulationEditorConstants.INSTANCE.scenarioCheatSheet())); reportDock = new UberfireDock(UberfireDockPosition.EAST, "PLAY_CIRCLE", new DockPlaceHolderPlace(TEST_RUNNER_REPORTING_PANEL), perspectiveIdentifier); result.add(reportDock.withSize(450).withLabel(DefaultWorkbenchConstants.INSTANCE.TestReport())); return result; }
Source:
public Jackson2Annotator(GenerationConfig generationConfig) { super(generationConfig); this.generationConfig = generationConfig; }

Target:
public Jackson2Annotator(GenerationConfig generationConfig) { super(generationConfig); }
Source:
public void dispose() { myRefsChangedHandle.remove(); planRegistry.remove(this.repository); planList.clear(); planChangeListeners.clear(); }

Target:
public void dispose() { myRefsChangedHandle.remove(); planRegistry.remove(this.repository.getDirectory()); planList.clear(); planChangeListeners.clear(); }
Source:
protected void templateValidate() { AsyncDataProvider.getAllVmTemplates(new AsyncQuery(getModel(), new INewAsyncCallback() { @Override public void onSuccess(Object model, Object returnValue) { List<VmTemplate> templates = (List<VmTemplate>) returnValue; if(templates.size() <= 1) { getModel().disableEditing(ConstantsManager.getInstance().getConstants().notAvailableWithNoTemplates()); } } }), false); }

Target:
private void templateValidate() { AsyncDataProvider.getAllVmTemplates(new AsyncQuery(getModel(), new INewAsyncCallback() { @Override public void onSuccess(Object model, Object returnValue) { List<VmTemplate> templates = (List<VmTemplate>) returnValue; if(templates.size() <= 1) { getModel().disableEditing(ConstantsManager.getInstance().getConstants().notAvailableWithNoTemplates()); } } }), false); }
Source:
public void testWaitForCompletionCancelled() { TestAnalysis module = setUpAnalysis(); ITmfTrace trace = TmfTestTrace.A_TEST_10K.getTrace(); try { module.setTrace(trace); } catch (TmfAnalysisException e) { fail(e.getMessage()); } module.setParameter(TestAnalysis.PARAM_TEST, 0); IStatus status = module.schedule(); assertEquals(Status.OK_STATUS, status); boolean completed = module.waitForCompletion(); assertFalse(completed); assertEquals(0, module.getAnalysisOutput()); }

Target:
public void testWaitForCompletionCancelled() { TestAnalysis module = setUpAnalysis(); ITmfTrace trace = TmfTestTrace.A_TEST_10K.getTrace(); try { module.setTrace(trace); } catch (TmfAnalysisException e) { fail(e.getMessage()); } module.setParameter(TestAnalysis.PARAM_TEST, 0); IStatus status = module.schedule(); assertEquals(Status.OK_STATUS, status); boolean completed = module.waitForCompletion(); assertFalse(completed); assertEquals(0, module.getAnalysisOutput()); module.dispose(); }
Source:
public void testBloomFilterNDVs(){ int ndv = 128 * 1024 * 1024 / 8; double fpp = 0.01; double numBits = -8 * ndv / Math.log(1 - Math.pow(0.01, 1.0 / 8)); int bytes = (int)numBits / 8; assertTrue(bytes < BlockSplitBloomFilter.UPPER_BOUND_BYTES); ndv = 128 * 1024 * 1024 / java.util.UUID.randomUUID().toString().length(); numBits = -8 * ndv / Math.log(1 - Math.pow(fpp, 1.0 / 8)); bytes = (int)numBits / 8; assertTrue(bytes < 5 * 1024 * 1024); }

Target:
public void testBloomFilterNDVs(){ int ndv = 128 * 1024 * 1024 / 8; double fpp = 0.01; double numBits = -8 * ndv / Math.log(1 - Math.pow(0.01, 1.0 / 8)); int bytes = (int)numBits / 8; assertTrue(bytes < 20 * 1024 * 1024); ndv = 128 * 1024 * 1024 / java.util.UUID.randomUUID().toString().length(); numBits = -8 * ndv / Math.log(1 - Math.pow(fpp, 1.0 / 8)); bytes = (int)numBits / 8; assertTrue(bytes < 5 * 1024 * 1024); }
Source:
public BsmAdminPageEditWindow addAttribute(String key, String value) throws InterruptedException { newAttributeWindow() .key(key) .value(value) .confirm(); wait.until(ExpectedConditions.elementToBeClickable(By.id("addAttributeButton"))); return this; }

Target:
public BsmAdminPageEditWindow addAttribute(String key, String value) throws InterruptedException { newAttributeWindow() .key(key) .value(value) .confirm(); return this; }
Source:
@Override public void setup(Context.OperatorContext context) { super.setup(context); try { loader = new FileLoader(filePath); reloadData(); lastScanTimeStamp = System.currentTimeMillis(); if (updateKeys != null) keyList = Lists.newArrayList(updateKeys.split(",")); } catch (IOException ex) { throw new RuntimeException("Failed to load mappings from the file."); } }

Target:
public void setup(Context.OperatorContext context) { super.setup(context); try { loader = new FileLoader(filePath, backupResource); reloadData(); lastScanTimeStamp = System.currentTimeMillis(); if (updateKeys != null) { keyList = Lists.newArrayList(updateKeys.split(",")); } } catch (IOException ex) { throw new RuntimeException("Failed to load mappings from the file."); } }
Source:
public LgtvConnection(String ip, int port, int localport, String pkey, String xmldf, int checkalive) { this.ip = ip; this.port = port; this.localport = port; this.checkalive = checkalive; try { connection = new LgTvInteractor(ip, port, localport, xmldf); connection.setpairkey(pkey); } catch (InterruptedException e) { e.printStackTrace(); } if (localport != 0 && reader == null) { reader = new LgTvMessageReader(localport); } if (connection != null) addEventListener(connection); if (reader != null) { connection.associatereader(reader); } }

Target:
public LgtvConnection(String ip, int port, int localport, String pkey, String xmldf, int checkalive) { this.ip = ip; this.port = port; this.localport = port; this.checkalive = checkalive; bundleContext = FrameworkUtil.getBundle(this.getClass()).getBundleContext(); try { connection = new LgTvInteractor(ip, port, localport, xmldf); connection.setpairkey(pkey); } catch (InterruptedException e) { logger.error("cannot create Interactor", e); } if (localport != 0 && reader == null) { reader = new LgTvMessageReader(localport); HttpService h=null; if (bundleContext!=null) { ServiceReference<?> serviceReference = bundleContext.getServiceReference(HttpService.class.getName()); if (serviceReference!=null) { h = (HttpService) bundleContext.getService(serviceReference); reader.setHttpService(h); }else logger.error("serviceRefeerence=null"); }else logger.error("bundleContext=null"); } if (connection != null) addEventListener(connection); if (reader != null) { connection.associatereader(reader); } }
Source:
public void register() { getChart().getPlotArea().addMouseTrackListener(this); fToolTipHandler.activateHoverHelp(getChart().getPlotArea()); }

Target:
public void register() { fToolTipHandler.activateHoverHelp(getChart().getPlotArea()); }
Source:
public String convert(ObjectValue source) { try { Map<String, Object> value = objectMapper.convertValue(source, Map.class); if (Map.class.isInstance(value.get("object"))) { Map<String, Object> object = objectMapper.convertValue(source.getObject(), Map.class); if (object.containsKey("@class")) { Map.class.cast(value.get("object")).put("@class", object.get("@class")); } } return objectMapper.writeValueAsString(value); } catch (Exception cause) { throw new RuntimeException(cause); } }

Target:
public String convert(ObjectValue source) { try { Map<String, Object> value = objectMapper.convertValue(source, Map.class); if (Map.class.isInstance(value.get(OBJECT_TYPE_KEY))) { Map<String, Object> object = objectMapper.convertValue(source.getObject(), Map.class); if (object.containsKey(CLASS)) { Map.class.cast(value.get(OBJECT_TYPE_KEY)).put(CLASS, object.get(CLASS)); } } return objectMapper.writeValueAsString(value); } catch (Exception cause) { throw new RuntimeException(cause); } }
Source:
protected List<OvfEntityData> getEntitiesFromStorageOvfDisk() { List<OvfEntityData> ovfEntitiesFromTar = new ArrayList<>(); List<Disk> unregisteredDisks = getBackend().runInternalQuery(VdcQueryType.GetUnregisteredDisks, new GetUnregisteredDisksQueryParameters(getParameters().getStorageDomainId(), getVds().getStoragePoolId())).getReturnValue(); Pair<DiskImage, Long> ovfDiskAndSize = getLatestOVFDisk(unregisteredDisks); DiskImage ovfDisk = ovfDiskAndSize.getFirst(); if (ovfDisk != null) { VDSReturnValue retrievedByteData = runVdsCommand(VDSCommandType.RetrieveImageData, new ImageHttpAccessVDSCommandParameters(getVdsId(), getParameters().getStoragePoolId(), getParameters().getStorageDomainId(), ovfDisk.getId(), ovfDisk.getImage().getId(), ovfDiskAndSize.getSecond())); if (retrievedByteData.getSucceeded()) { ovfEntitiesFromTar = OvfUtils.getOvfEntities((byte[]) retrievedByteData.getReturnValue(), getParameters().getStorageDomainId()); } } return ovfEntitiesFromTar; }

Target:
protected List<OvfEntityData> getEntitiesFromStorageOvfDisk() { List<OvfEntityData> ovfEntitiesFromTar = Collections.emptyList(); List<Disk> unregisteredDisks = getBackend().runInternalQuery(VdcQueryType.GetUnregisteredDisks, new GetUnregisteredDisksQueryParameters(getParameters().getStorageDomainId(), getVds().getStoragePoolId())).getReturnValue(); Pair<DiskImage, Long> ovfDiskAndSize = getLatestOVFDisk(unregisteredDisks); DiskImage ovfDisk = ovfDiskAndSize.getFirst(); if (ovfDisk != null) { VDSReturnValue retrievedByteData = runVdsCommand(VDSCommandType.RetrieveImageData, new ImageHttpAccessVDSCommandParameters(getVdsId(), getParameters().getStoragePoolId(), getParameters().getStorageDomainId(), ovfDisk.getId(), ovfDisk.getImage().getId(), ovfDiskAndSize.getSecond())); if (retrievedByteData.getSucceeded()) { ovfEntitiesFromTar = OvfUtils.getOvfEntities((byte[]) retrievedByteData.getReturnValue(), getParameters().getStorageDomainId()); } } return ovfEntitiesFromTar; }
Source:
public String getDisplayName() { return "Update all Environment Stacks configuration"; }

Target:
public String getDisplayName() { return "Update all Environment Clusters configuration"; }
Source:
public void processOutput(Iterable<ConfiguredTarget> partialResult) { for (ConfiguredTarget configuredTarget : partialResult) { BuildConfiguration config = skyframeExecutor.getConfiguration(eventHandler, configuredTarget.getConfigurationKey()); StringBuilder output = new StringBuilder(); if(showKind){ Target actualTarget = accessor.getTargetFromConfiguredTarget(configuredTarget); output = output .append(actualTarget.getTargetKind()) .append(" (") .append(config != null && config.isHostConfiguration() ? "HOST" : config) .append(")"); } else if(!showKind){ output = output .append(configuredTarget.getLabel()) .append(" (") .append(config != null && config.isHostConfiguration() ? "HOST" : config) .append(")"); } if (options.showRequiredConfigFragments != IncludeConfigFragmentsEnum.OFF) { RequiredConfigFragmentsProvider configFragmentsProvider = configuredTarget.getProvider(RequiredConfigFragmentsProvider.class); if (configFragmentsProvider != null) { output .append(" [") .append(String.join(", ", configFragmentsProvider.getRequiredConfigFragments())) .append("]"); } } addResult(output.toString()); } }

Target:
public void processOutput(Iterable<ConfiguredTarget> partialResult) { for (ConfiguredTarget configuredTarget : partialResult) { BuildConfiguration config = skyframeExecutor.getConfiguration(eventHandler, configuredTarget.getConfigurationKey()); StringBuilder output = new StringBuilder(); if(showKind){ Target actualTarget = accessor.getTargetFromConfiguredTarget(configuredTarget); output = output .append(actualTarget.getTargetKind()); } else if(!showKind){ output = output .append(configuredTarget.getLabel()); } output = output .append(" (") .append(config != null && config.isHostConfiguration() ? "HOST" : config) .append(")"); if (options.showRequiredConfigFragments != IncludeConfigFragmentsEnum.OFF) { RequiredConfigFragmentsProvider configFragmentsProvider = configuredTarget.getProvider(RequiredConfigFragmentsProvider.class); if (configFragmentsProvider != null) { output .append(" [") .append(String.join(", ", configFragmentsProvider.getRequiredConfigFragments())) .append("]"); } } addResult(output.toString()); } }
Source:
private static boolean hasWrapper(final Ds3Element ds3Element) { System.out.println(ds3Element.getName()); if (ds3Element.getName().endsWith("Jobs")) { return false; } return Ds3ElementUtil.hasWrapperAnnotations(ds3Element.getDs3Annotations()); }

Target:
private static boolean hasWrapper(final Ds3Element ds3Element) { if (ds3Element.getName().endsWith("Jobs")) { return false; } return Ds3ElementUtil.hasWrapperAnnotations(ds3Element.getDs3Annotations()); }
Source:
private List<ICommitMessageProvider> getCommitMessageProviders() throws CoreException { List<ICommitMessageProvider> providers = new ArrayList<>(); IExtensionRegistry registry = Platform.getExtensionRegistry(); IConfigurationElement[] configs = registry .getConfigurationElementsFor(COMMIT_MESSAGE_PROVIDER_ID); for (IConfigurationElement config : configs) { Object provider; String contributorName = "<unknown"; try { contributorName = config.getDeclaringExtension() .getContributor().getName(); provider = config.createExecutableExtension("class"); if (provider instanceof ICommitMessageProvider) { providers.add((ICommitMessageProvider) provider); } else { Activator.logError( UIText.CommitDialog_WrongTypeOfCommitMessageProvider, null); } } catch (CoreException | InvalidRegistryObjectException e) { Activator.logError( MessageFormat.format( UIText.CommitDialog_ErrorCreatingCommitMessageProvider, contributorName), e); } } return providers; }

Target:
List<ICommitMessageProvider> getCommitMessageProviders() throws CoreException { List<ICommitMessageProvider> providers = new ArrayList<>(); IExtensionRegistry registry = Platform.getExtensionRegistry(); IConfigurationElement[] configs = registry .getConfigurationElementsFor(COMMIT_MESSAGE_PROVIDER_ID); for (IConfigurationElement config : configs) { Object provider; String contributorName = "<unknown"; try { contributorName = config.getDeclaringExtension() .getContributor().getName(); provider = config.createExecutableExtension("class"); if (provider instanceof ICommitMessageProvider) { providers.add((ICommitMessageProvider) provider); } else { Activator.logError( UIText.CommitDialog_WrongTypeOfCommitMessageProvider, null); } } catch (CoreException | InvalidRegistryObjectException e) { Activator.logError( MessageFormat.format( UIText.CommitDialog_ErrorCreatingCommitMessageProvider, contributorName), e); } } return providers; }
Source:
public String getToken() throws Exception { if (!hasToken()) { token = flow.getToken(); } return token; }

Target:
public String getToken() throws OAuthSystemException, OAuthProblemException { if (flow == null) { throw new OAuthSystemException("Oauth flow is null"); } if (!hasToken()) { token = flow.getToken(); } return token; }
Source:
public Future<Map<String, Object>> setupNetworks(Map networks, Map bonding, Map options, final boolean isPolicyReset) { final JsonRpcRequest request = new RequestBuilder("Host.setupNetworks").withParameter("networks", networks) .withParameter("bondings", bonding) .withParameter("options", options) .build(); final ClientPolicy policy = client.getClientRetryPolicy(); final FutureCallable callable = new FutureCallable(new Callable<Map<String, Object>>() { @Override public Map<String, Object> call() throws Exception { if (isPolicyReset) { updateHeartbeatPolicy(policy.clone(), false); } return new FutureMap(client, request).withResponseKey("status"); } }); FutureTask<Map<String, Object>> future = new FutureTask<Map<String, Object>>(callable) { @Override public boolean isDone() { if (callable.isDone()) { if (isPolicyReset) { updateHeartbeatPolicy(policy, true); } return true; } return false; } }; ThreadPoolUtil.execute(future); return future; }

Target:
public Future<Map<String, Object>> setupNetworks(Map networks, Map bonding, Map options, final boolean isPolicyReset) { final JsonRpcRequest request = new RequestBuilder("Host.setupNetworks").withParameter("networks", networks) .withParameter("bondings", bonding) .withParameter("options", options) .build(); final FutureCallable callable = new FutureCallable(new Callable<Map<String, Object>>() { @Override public Map<String, Object> call() throws Exception { if (isPolicyReset) { updateHeartbeatPolicy(client.getClientRetryPolicy().clone(), false); } return new FutureMap(client, request).withResponseKey("status"); } }); FutureTask<Map<String, Object>> future = new FutureTask<Map<String, Object>>(callable) { @Override public boolean isDone() { if (callable.isDone()) { if (isPolicyReset) { updateHeartbeatPolicy(client.getClientRetryPolicy(), true); } return true; } return false; } }; ThreadPoolUtil.execute(future); return future; }
Source:
public void shouldCreateACombinedListenerForAllChildFactories() { final MutationResultListener listenerOne = mock(MutationResultListener.class); final MutationResultListener listenerTwo = mock(MutationResultListener.class); when(this.firstChild.getListener(isNull(), isNull())).thenReturn(listenerOne); when(this.secondChild.getListener(isNull(), isNull())).thenReturn(listenerTwo); this.testee.getListener(null, null).runStart(); verify(listenerOne, times(1)).runStart(); verify(listenerTwo, times(1)).runStart(); }

Target:
public void shouldCreateACombinedListenerForAllChildFactories() { final MutationResultListener listenerOne = mock(MutationResultListener.class); final MutationResultListener listenerTwo = mock(MutationResultListener.class); when( this.firstChild.getListener(any(Properties.class), any(ListenerArguments.class))).thenReturn(listenerOne); when( this.secondChild.getListener(any(Properties.class), any(ListenerArguments.class))).thenReturn(listenerTwo); this.testee.getListener(new Properties(), someArgs()).runStart(); verify(listenerOne, times(1)).runStart(); verify(listenerTwo, times(1)).runStart(); }
Source:
private static Integer validateValueIsPowerOfTwo(Object value, String property) { int intValue = ((Number) value).intValue(); if (Integer.bitCount(intValue) != 1) { throw new PrestoException( StandardErrorCode.INVALID_SESSION_PROPERTY, format("%s must be a power of 2: %s", property, intValue)); } return intValue; }

Target:
private static int validateValueIsPowerOfTwo(Object value, String property) { int intValue = ((Number) requireNonNull(value, "value is null")).intValue(); if (Integer.bitCount(intValue) != 1) { throw new PrestoException( StandardErrorCode.INVALID_SESSION_PROPERTY, format("%s must be a power of 2: %s", property, intValue)); } return intValue; }
Source:
public SetOp add(ByteArrayWrapper element) { this.adds.add(element); this.removes.remove(element); return this; }

Target:
public SetOp add(ByteArrayWrapper element) { this.adds.add(element); return this; }
Source:
private static ResultSet<Change> scanChanges(ReviewDb db, Repository repo) throws OrmException, IOException { Map<String, Ref> refs = repo.getRefDatabase().getRefs(RefNames.REFS_CHANGES); Set<Change.Id> ids = Sets.newHashSetWithExpectedSize(refs.size()); for (Ref r : refs.values()) { Change.Id id = Change.Id.fromRef(r.getName()); if (id != null) { ids.add(id); } } return db.changes().get(ids); }

Target:
private static List<Change> scanChanges(ReviewDb db, Repository repo) throws OrmException, IOException { Map<String, Ref> refs = repo.getRefDatabase().getRefs(RefNames.REFS_CHANGES); Set<Change.Id> ids = new LinkedHashSet<>(); for (Ref r : refs.values()) { Change.Id id = Change.Id.fromRef(r.getName()); if (id != null) { ids.add(id); } } List<Change> changes = new ArrayList<>(ids.size()); for (Change.Id id : ids) { changes.add(db.changes().get(id)); } return changes; }
Source:
public TestHiveClientGlueMetastore() { super("test_glue_" + new Random().nextInt(100000000)); }

Target:
public TestHiveClientGlueMetastore() { super("test_glue" + randomUUID().toString().toLowerCase(ENGLISH).replace("-", "")); }