auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void testAddingMixedTypes(Version version, boolean addingMixedTypesShouldSucceed) { storagePool.setcompatibility_version(version); when(storagePoolDAO.getStorageTypesInPool(storagePool.getId())).thenReturn(Arrays.asList(StorageType.NFS)); StorageDomain domainToAttach = createValidStorageDomain(); domainToAttach.setStorageFormat(cmd.getSupportedStorageFormatSet(version).iterator().next()); initCommand(); assertTrue("Attaching an NFS domain to a pool with NFS domain with no mixed type allowed failed, version: " + version, cmd.checkDomainCanBeAttached(domainToAttach)); domainToAttach.setStorageType(StorageType.ISCSI); initCommand(); if (addingMixedTypesShouldSucceed) { assertTrue("Attaching an ISCSI domain to a pool with NFS domain with with mixed type allowed failed, version: " + version, cmd.checkDomainCanBeAttached(domainToAttach)); } else { assertFalse("Attaching an ISCSI domain to a pool with NFS domain with no mixed type allowed succeeded, version: " + version, cmd.checkDomainCanBeAttached(domainToAttach)); CanDoActionTestUtils.assertCanDoActionMessages("Attaching an ISCSI domain to a pool with NFS domain with no mixed type failed with the wrong message", cmd, VdcBllMessages.ACTION_TYPE_FAILED_MIXED_STORAGE_TYPES_NOT_ALLOWED); } }

Target:
private void testAddingMixedTypes(Version version, boolean addingMixedTypesShouldSucceed) { storagePool.setcompatibility_version(version); StorageDomain existingStorageDomain = createValidStorageDomain(); existingStorageDomain.setStorageType(StorageType.NFS); addDomainToPool(existingStorageDomain); StorageDomain domainToAttach = createValidStorageDomain(); domainToAttach.setStorageFormat(cmd.getSupportedStorageFormatSet(version).iterator().next()); existingStorageDomain.setStorageType(StorageType.NFS); initCommand(); assertTrue("Attaching an NFS domain to a pool with NFS domain with no mixed type allowed failed, version: " + version, cmd.checkDomainCanBeAttached(domainToAttach)); domainToAttach.setStorageType(StorageType.ISCSI); initCommand(); if (addingMixedTypesShouldSucceed) { assertTrue("Attaching an ISCSI domain to a pool with NFS domain with with mixed type allowed failed, version: " + version, cmd.checkDomainCanBeAttached(domainToAttach)); } else { assertFalse("Attaching an ISCSI domain to a pool with NFS domain with no mixed type allowed succeeded, version: " + version, cmd.checkDomainCanBeAttached(domainToAttach)); CanDoActionTestUtils.assertCanDoActionMessages("Attaching an ISCSI domain to a pool with NFS domain with no mixed type failed with the wrong message", cmd, VdcBllMessages.ACTION_TYPE_FAILED_MIXED_STORAGE_TYPES_NOT_ALLOWED); } }
Source:
public INDArray params(boolean backwardOnly) { if(backwardOnly) return params(); List<INDArray> params = new ArrayList<>(); for (Layer layer: getLayers()){ INDArray layerParams; if(layer instanceof BasePretrainNetwork) layerParams = ((BasePretrainNetwork) layer).paramsBackprop(); else layerParams = layer.params(); if(layerParams != null) params.add(layerParams); } return Nd4j.toFlattened('f', params); }

Target:
public INDArray params(boolean backwardOnly) { if(backwardOnly) return params(); List<INDArray> params = new ArrayList<>(); for (Layer layer: getLayers()){ INDArray layerParams = layer.params(); if(layerParams != null) params.add(layerParams); } return Nd4j.toFlattened('f', params); }
Source:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setTheme(new ThemeUtils(this).getSettingsTheme()); setTitle(R.string.general_preferences); if (savedInstanceState == null) { boolean adminMode = getIntent().getBooleanExtra(INTENT_KEY_ADMIN_MODE, false); boolean openMapsPrefs = getIntent().getBooleanExtra("openMapsPrefs", false); Fragment fragment = openMapsPrefs ? MapsPreferences.newInstance(adminMode) : GeneralPreferencesFragment.newInstance(adminMode); getFragmentManager() .beginTransaction() .add(android.R.id.content, fragment, TAG) .commit(); } }

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setTheme(new ThemeUtils(this).getSettingsTheme()); setTitle(R.string.general_preferences); if (savedInstanceState == null) { boolean adminMode = getIntent().getBooleanExtra(INTENT_KEY_ADMIN_MODE, false); Fragment fragment = GeneralPreferencesFragment.newInstance(adminMode); getFragmentManager() .beginTransaction() .add(android.R.id.content, fragment, TAG) .commit(); } }
Source:
public void setCurrentContainer(FormsContainer container) { this.container = container; }

Target:
void setCurrentContainer(FormsContainer container) { this.container = container; }
Source:
protected void handleRemoteBrowseSelected() { IHost currentConnectionSelected = getCurrentConnection(); SystemRemoteFileDialog dlg = new SystemRemoteFileDialog(getControl() .getShell(), Messages.RemoteCMainTab_Remote_Path_Browse_Button_Title, currentConnectionSelected); dlg.setBlockOnOpen(true); if (dlg.open() == Window.OK) { Object retObj = dlg.getSelectedObject(); if (retObj instanceof IRemoteFile) { IRemoteFile selectedFile = (IRemoteFile) retObj; String absPath = selectedFile.getAbsolutePath(); if (selectedFile.isDirectory()) { IPath appPath = new Path(fProgText.getText()); IPath remotePath = new Path(selectedFile.getAbsolutePath()).append(appPath.lastSegment()); absPath = remotePath.toPortableString(); } remoteProgText.setText(absPath); } } }

Target:
protected void handleRemoteBrowseSelected() { IHost currentConnectionSelected = getCurrentConnection(); SystemRemoteFileDialog dlg = new SystemRemoteFileDialog(getControl() .getShell(), Messages.RemoteCMainTab_Remote_Path_Browse_Button_Title, currentConnectionSelected); dlg.setBlockOnOpen(true); if (dlg.open() == Window.OK) { Object retObj = dlg.getSelectedObject(); if (retObj instanceof IRemoteFile) { IRemoteFile selectedFile = (IRemoteFile) retObj; String absPath = selectedFile.getAbsolutePath(); if (selectedFile.isDirectory()) { IPath appPath = new Path(fProgText.getText().trim()); String lastSegment = appPath.lastSegment(); if (lastSegment != null && lastSegment.trim().length() > 0) { IPath remotePath = new Path(selectedFile.getAbsolutePath()).append(lastSegment.trim()); absPath = remotePath.toOSString(); } } remoteProgText.setText(absPath); } } }
Source:
private void updateMenuItemVisibility() { if (mMenuAdd == null || mMenuEdit == null || mMenuSearch == null) { return; } if (getAdapter().getIsInSearchMode()) { mMenuEdit.setVisible(false); mMenuAdd.setVisible(false); } else { mMenuEdit.setVisible(mSiteStore.getSitesAccessedViaWPComRestCount() > 1); mMenuAdd.setVisible(true); } mMenuSearch.setVisible(mSiteStore.getSitesCount() > 1); invalidateOptionsMenu(); }

Target:
private void updateMenuItemVisibility() { if (mMenuAdd == null || mMenuEdit == null || mMenuSearch == null) { return; } if (getAdapter().getIsInSearchMode()) { mMenuEdit.setVisible(false); mMenuAdd.setVisible(false); } else { mMenuEdit.setVisible(mSiteStore.getSitesAccessedViaWPComRestCount() > 1); mMenuAdd.setVisible(true); } mMenuSearch.setVisible(mSiteStore.getSitesCount() > 1); }
Source:
public static ShipConfig load(HullConfigManager hullConfigs, JSONObject rootNode, ItemManager itemManager) { if (rootNode == null) { return null; } String hullName = rootNode.getString("hull"); HullConfig hull = hullConfigs.getConfig(hullName); ShipConfig guard; if (rootNode.has("guard")) { guard = load(hullConfigs, rootNode.has("guard") ? rootNode.getJSONObject("guard") : null, itemManager); } else { guard = null; } String items = rootNode.getString("items"); int money = rootNode.optInt("money", 0); float density = (float) rootNode.optDouble("density", -1); return new ShipConfig(hull, items, money, density, guard, itemManager); }

Target:
public static ShipConfig load(HullConfigManager hullConfigs, JSONObject rootNode, ItemManager itemManager) { if (rootNode == null) { return null; } String hullName = rootNode.getString("hull"); HullConfig hull = hullConfigs.getConfig(hullName); ShipConfig guard; if (rootNode.has("guard")) { guard = load(hullConfigs, rootNode.getJSONObject("guard"), itemManager); } else { guard = null; } String items = rootNode.getString("items"); int money = rootNode.optInt("money", 0); float density = (float) rootNode.optDouble("density", -1); return new ShipConfig(hull, items, money, density, guard, itemManager); }
Source:
public void configureOSPF(OSPFService ospfService) throws CapabilityException { IAction action = createActionAndCheckParams(OSPFActionSet.OSPF_CONFIGURE, ospfService); ospfService.setEnabledState(EnabledState.DISABLED); queueAction(action); }

Target:
public void configureOSPF(OSPFService ospfService) throws CapabilityException { ospfService.setEnabledState(EnabledState.DISABLED); IAction action = createActionAndCheckParams(OSPFActionSet.OSPF_CONFIGURE, ospfService); queueAction(action); }
Source:
public synchronized void start() { if (store != null) { store.start(); } else { LOG.warn("Store not initialized, so not starting the service"); } super.start(); }

Target:
public synchronized void start() { if (store != null) { store.start((com.inmobi.grill.server.api.events.GrillEventService) GrillServices.get().getService(EventServiceImpl.NAME)); } else { LOG.warn("Unable to start the LogStore."); } super.start(); }
Source:
private void traceContainers(String action, long start) { Long delta = Long.valueOf(System.currentTimeMillis() - start); Long length = Long.valueOf(getContainersFile().length()); String pattern = "{0} {1} bytes in containers.dat in {2}ms"; String message = NLS.bind(pattern, new Object[] { action, length, delta }); System.out.println(message); }

Target:
private void traceContainers(String action, long start) { Long delta = System.currentTimeMillis() - start; Long length = getContainersFile().length(); String pattern = "{0} {1} bytes in containers.dat in {2}ms"; String message = NLS.bind(pattern, new Object[] { action, length, delta }); System.out.println(message); }
Source:
public HandleJobsWithGroupNamePermission(Map<String, String> genericInformations) { super(DESCRIPTION); if (genericInformations.containsKey(GROUP)) { String bucketName = genericInformations.get(GROUP); this.allowedGroups = Collections.singleton(bucketName); } else { this.allowedGroups = Collections.EMPTY_SET; } }

Target:
public HandleJobsWithGroupNamePermission(Map<String, String> genericInformations) { super(DESCRIPTION); if (genericInformations.containsKey(GROUP)) { String groupName = genericInformations.get(GROUP); this.allowedGroups = Collections.singleton(groupName); } else { this.allowedGroups = Collections.EMPTY_SET; } }
Source:
public static String getExtension(final String filename) { if (filename == null) { throw new IllegalArgumentException("filename cannot be null"); } int lastDotIdx = filename.lastIndexOf("."); return lastDotIdx >= 0 ? filename.substring(lastDotIdx) : ""; }

Target:
public static String getExtension(final String filename) { Objects.requireNonNull(filename, "filename cannot be null"); int lastDotIdx = filename.lastIndexOf("."); return lastDotIdx >= 0 ? filename.substring(lastDotIdx) : ""; }
Source:
default boolean isHealthy() { if (getContainerId() == null) { return false; } try { InspectContainerResponse inspectContainerResponse = getCurrentContainerInfo(); HealthState health = inspectContainerResponse.getState().getHealth(); if (health == null) { throw new RuntimeException("Healthchecks not configured for this container"); } return STATE_HEALTHY.equals(health.getStatus()); } catch (DockerException e) { return false; } }

Target:
default boolean isHealthy() { if (getContainerId() == null) { return false; } try { InspectContainerResponse inspectContainerResponse = getCurrentContainerInfo(); HealthState health = inspectContainerResponse.getState().getHealth(); if (health == null) { throw new RuntimeException("This container's image does not have a healthcheck declared, so health cannot be determined. Either amend the image or use another approach to determine whether containers are healthy."); } return STATE_HEALTHY.equals(health.getStatus()); } catch (DockerException e) { return false; } }
Source:
private byte[] parseLine(String line) throws OpenEnergyMonitorException { logger.trace("Received line: {}", line); String[] bytes = line.toString().split(" "); ByteBuffer bytebuf = ByteBuffer.allocate(bytes.length); try { for (int j = 0; j < bytes.length; j++) { if (!bytes[j].isEmpty()) { byte b = (byte) Integer.parseInt(bytes[j]); bytebuf.put(b); } } } catch (NumberFormatException e) { throw new OpenEnergyMonitorException("Error occured while receiving data", e); } return bytebuf.array(); }

Target:
private byte[] parseLine(String line) throws OpenEnergyMonitorException { logger.trace("Received line: {}", line); String[] bytes = line.toString().split(" "); ByteBuffer bytebuf = ByteBuffer.allocate(bytes.length); try { for (int j = 0; j < bytes.length; j++) { if (!bytes[j].isEmpty()) { byte b = (byte) Integer.parseInt(bytes[j]); bytebuf.put(b); } } } catch (NumberFormatException e) { throw new OpenEnergyMonitorException("Error occurred while receiving data. ", e); } return bytebuf.array(); }
Source:
protected void onHandleIntent(@NonNull Intent intent) { List<ReadingListPageDiskRow> queue = new ArrayList<>(); Collection<ReadingListPageDiskRow> rows = dao.startDiskTransaction(); L.i("Syncing saved rlp pages with saved pages service"); for (final ReadingListPageDiskRow row : rows) { L.v("Found pending tx with status: " + row.status().name()); switch (row.status()) { case UNSAVED: case DELETED: String filename = row.filename(); if (filename != null) { FileUtil.delete(new File(filename), true); L.v("Deleted" + filename); continue; } L.e("Found row with null filename; skipping"); continue; case OUTDATED: queue.add(row); continue; case ONLINE: case SAVED: continue; default: throw new UnsupportedOperationException("Invalid disk row status: " + row.status().name()); } } saveNewEntries(queue); }

Target:
protected void onHandleIntent(@NonNull Intent intent) { List<ReadingListPageDiskRow> queue = new ArrayList<>(); Collection<ReadingListPageDiskRow> rows = dao.startDiskTransaction(); L.i("Syncing saved rlp pages with saved pages service"); for (final ReadingListPageDiskRow row : rows) { L.v("Found pending tx with status: " + row.status().name()); switch (row.status()) { case UNSAVED: case DELETED: String filename = row.filename(); if (filename != null) { FileUtil.delete(new File(filename), true); dao.completeDiskTransaction(row); L.v("Deleted" + filename); continue; } L.e("Found row with null filename; skipping"); continue; case OUTDATED: queue.add(row); continue; case ONLINE: case SAVED: L.w("Received row with unexpected status " + row.status() + ": " + row.toString()); continue; default: throw new UnsupportedOperationException("Invalid disk row status: " + row.status().name()); } } saveNewEntries(queue); }
Source:
public double isApplicable(VElement vElement, ViewModelContext viewModelContext) { if (classType == null) { return NOT_APPLICABLE; } if (selectSubclasses && !classType.isSuperTypeOf(vElement.eClass())) { return NOT_APPLICABLE; } else if (!selectSubclasses && !classType.equals(vElement.eClass())) { return NOT_APPLICABLE; } if (attribute != null) { final Object attrValue = vElement.eGet(attribute); if (attrValue == null) { return NOT_APPLICABLE; } if (!attrValue.equals(attributeValue)) { return NOT_APPLICABLE; } } if (attribute != null) { return 6; } return 5; }

Target:
public double isApplicable(VElement vElement, ViewModelContext viewModelContext) { if (classType == null) { return NOT_APPLICABLE; } if (selectSubclasses && !classType.isSuperTypeOf(vElement.eClass())) { return NOT_APPLICABLE; } else if (!selectSubclasses && !classType.equals(vElement.eClass())) { return NOT_APPLICABLE; } if (attribute != null) { final Object attrValue = vElement.eGet(attribute); if (attrValue == null) { return NOT_APPLICABLE; } if (!attrValue.equals(attributeValue)) { return NOT_APPLICABLE; } return 6; } return 5; }
Source:
public void testPostConent() throws Exception { ITask task = harness.createTask("GetContent"); File file = File.createTempFile("attachment", null); file.deleteOnExit(); try (OutputStream out = new BufferedOutputStream(new FileOutputStream(file))) { out.write("Mylar".getBytes()); } attachmentHandler.postContent(repository, task, new FileTaskAttachmentSource(file), "comment", null, null); ITracClient client = connector.getClientManager().getTracClient(repository); try (InputStream in = client.getAttachmentData(Integer.parseInt(task.getTaskId()), file.getName(), null)) { byte[] result = new byte[5]; in.read(result); assertEquals("Mylar", new String(result)); } }

Target:
public void testPostConent() throws Exception { ITask task = harness.createTask("GetContent"); File file = File.createTempFile("attachment", null); file.deleteOnExit(); try (OutputStream out = new FileOutputStream(file)) { out.write("Mylar".getBytes()); } attachmentHandler.postContent(repository, task, new FileTaskAttachmentSource(file), "comment", null, null); ITracClient client = connector.getClientManager().getTracClient(repository); try (InputStream in = client.getAttachmentData(Integer.parseInt(task.getTaskId()), file.getName(), null)) { byte[] result = new byte[5]; in.read(result); assertEquals("Mylar", new String(result)); } }
Source:
public static String rangeParser(List<String> values) { if (values == null) { return "0"; } return String.valueOf(ThreadLocalRandom.current().nextInt(Integer.valueOf(values.get(0)), Integer.valueOf(values.get(1))) ); }

Target:
public static String rangeParser(List<String> values) { String warnMessage = "skip and parse 0, please review applicaion.conf"; try { return String.valueOf(ThreadLocalRandom.current().nextInt(Integer.valueOf(values.get(0)), Integer.valueOf(values.get(1)))); } catch (NullPointerException e) { log.warn("range values must be set", warnMessage); return "0"; } catch (IllegalArgumentException e) { log.warn("bad range values were found {}", warnMessage); return "0"; } }
Source:
protected void testExecute_nonExistingEmail() { ______TS("Typical case: non-existing email address"); String[] nonExistingParam = new String[] { Const.ParamsNames.SESSION_LINKS_RECOVERY_EMAIL, "non-existent email address", }; SessionLinksRecoveryAction a = getAction(nonExistingParam); JsonResult result = getJsonResult(a); SessionLinksRecoveryResponseData output = (SessionLinksRecoveryResponseData) result.getOutput(); assertEquals("The recovery links for your feedback sessions have been sent to " + "the specified email address: non-existent email address", output.getMessage()); assertEquals(HttpStatus.SC_OK, result.getStatusCode()); verifyNumberOfEmailsSent(a, 1); EmailWrapper emailSent = a.getEmailSender().getEmailsSent().get(0); assertEquals(EmailType.SESSION_LINKS_RECOVERY.getSubject(), emailSent.getSubject()); assertEquals("non-existent email address", emailSent.getRecipient()); assertEquals(Templates.populateTemplate( Templates.EmailTemplates.SESSION_LINKS_RECOVERY_EMAIL_NOT_FOUND, "${userEmail}", SanitizationHelper.sanitizeForHtml("non-existent email address"), "${supportEmail}", Config.SUPPORT_EMAIL, "${teammateHomePageLink}", Config.APP_URL), emailSent.getContent()); }

Target:
protected void testExecute_nonExistingEmail() { ______TS("Typical case: non-existent email address"); String[] nonExistingParam = new String[] { Const.ParamsNames.SESSION_LINKS_RECOVERY_EMAIL, "non-existent@abc.com", }; SessionLinksRecoveryAction a = getAction(nonExistingParam); JsonResult result = getJsonResult(a); SessionLinksRecoveryResponseData output = (SessionLinksRecoveryResponseData) result.getOutput(); assertEquals("The recovery links for your feedback sessions have been sent to " + "the specified email address: non-existent@abc.com", output.getMessage()); assertEquals(HttpStatus.SC_OK, result.getStatusCode()); verifyNumberOfEmailsSent(a, 1); EmailWrapper emailSent = a.getEmailSender().getEmailsSent().get(0); assertEquals(EmailType.SESSION_LINKS_RECOVERY.getSubject(), emailSent.getSubject()); assertEquals("non-existent@abc.com", emailSent.getRecipient()); }
Source:
protected String reformat( String message ) { if ( channel == null ) { return message; } String localChannelId = getLocalChannelId(); String dbConnectionId = getDbConnectionId(); if ( localChannelId != null && dbConnectionId != null ) { return format( "[0x%s][%s] %s", localChannelId, dbConnectionId, message ); } return format( "[0x%s][] %s", localChannelId, message ); }

Target:
protected String reformat( String message ) { if ( channel == null ) { return message; } String dbConnectionId = getDbConnectionId(); if ( localChannelId != null && dbConnectionId != null ) { return format( "[0x%s][%s] %s", localChannelId, dbConnectionId, message ); } return format( "[0x%s][] %s", localChannelId, message ); }
Source:
public static void runPigJob(String[] args) throws Exception { PigStats stats = PigUtil.runPigJob(args, props); PigUtil.dumpHadoopCounters(stats, props); if (stats.isSuccessful()) { return; } if (pigLogFile != null) { handleError(pigLogFile); } if (isTuningError && jobTryCount <= maxJobRetry) { throw new RuntimeException("Pig job failed."); } PigUtil.selfKill(); }

Target:
public static void runPigJob(String[] args) throws Exception { PigStats stats = PigUtil.runPigJob(args, props); PigUtil.dumpHadoopCounters(stats, props); if (stats.isSuccessful()) { return; } if (pigLogFile != null) { handleError(pigLogFile); } PigUtil.selfKill(); }
Source:
public CompositeDisposable(@NonNull Disposable... disposables) { ObjectHelper.requireNonNull(disposables, "Disposables are null"); this.resources = new OpenHashSet<Disposable>(disposables.length + 1); for (Disposable d : disposables) { ObjectHelper.requireNonNull(d, "Disposable item in Disposables is null"); this.resources.add(d); } }

Target:
public CompositeDisposable(@NonNull Disposable... disposables) { ObjectHelper.requireNonNull(disposables, "disposables is null"); this.resources = new OpenHashSet<Disposable>(disposables.length + 1); for (Disposable d : disposables) { ObjectHelper.requireNonNull(d, "A Disposable in the disposables array is null"); this.resources.add(d); } }
Source:
private boolean canEvict(final int refCount, boolean writer) { if (refCount == 0 && storage != null) { if (backPressureEnabled) { if (!writer) { boolean evict = true; int blocks = 0; for (Block temp = this.prev; (blocks < (MAX_COUNT_OF_INMEM_BLOCKS - 1)) && (temp != null); temp = temp.prev, ++blocks) { if (temp.refCount.get() != 0) { evict = false; break; } } logger.debug("Block evict {}", this, evict); return evict; } else { return false; } } else { return true; } } else { if (storage != null) { logger.debug("Holding in memory due to references.", this, refCount); } else { logger.debug("Holding in memory as spooling is disabled"); } return false; } }

Target:
private boolean canEvict(final int refCount, boolean writer) { if (refCount == 0) { if (backPressureEnabled) { if (!writer) { boolean evict = true; synchronized (this) { for (Block temp = this.prev; temp != null; temp = temp.prev) { if (temp.refCount.get() != 0) { evict = false; break; } } } logger.debug("Block evict {}", this, evict); return evict; } else { return false; } } else { return true; } } logger.debug("Not evicting due to references.", this, refCount); return false; }
Source:
public boolean equals(Object object) { if (this == object) return true; if (object == null || getClass() != object.getClass()) return false; if (!super.equals(object)) return false; GetObjectRequest that = (GetObjectRequest) object; if (isRequesterPays() != that.isRequesterPays()) return false; if (!s3ObjectIdBuilder.equals(that.s3ObjectIdBuilder)) return false; if (!java.util.Arrays.equals(getRange(), that.getRange())) return false; if (!getMatchingETagConstraints().equals(that.getMatchingETagConstraints())) return false; if (!nonmatchingEtagConstraints.equals(that.nonmatchingEtagConstraints)) return false; if (getUnmodifiedSinceConstraint() != null ? !getUnmodifiedSinceConstraint().equals(that.getUnmodifiedSinceConstraint()) : that.getUnmodifiedSinceConstraint() != null) return false; if (getModifiedSinceConstraint() != null ? !getModifiedSinceConstraint().equals(that.getModifiedSinceConstraint()) : that.getModifiedSinceConstraint() != null) return false; if (getResponseHeaders() != null ? !getResponseHeaders().equals(that.getResponseHeaders()) : that.getResponseHeaders() != null) return false; if (sseCustomerKey != null ? !sseCustomerKey.equals(that.sseCustomerKey) : that.sseCustomerKey != null) return false; if (getPartNumber() != null ? !getPartNumber().equals(that.getPartNumber()) : that.getPartNumber() != null) return false; return true; }

Target:
public boolean equals(Object object) { if (this == object) return true; if (object == null || object instanceof GetObjectRequest == false) return false; if (!super.equals(object)) return false; GetObjectRequest that = (GetObjectRequest) object; if (isRequesterPays() != that.isRequesterPays()) return false; if (!s3ObjectIdBuilder.equals(that.s3ObjectIdBuilder)) return false; if (!java.util.Arrays.equals(getRange(), that.getRange())) return false; if (getMatchingETagConstraints() != null ? !getMatchingETagConstraints().equals(that.getMatchingETagConstraints()) : that.getMatchingETagConstraints() != null) return false; if (getNonmatchingETagConstraints() != null ? !getNonmatchingETagConstraints().equals(that.getNonmatchingETagConstraints()) : that.getNonmatchingETagConstraints() != null) return false; if (getUnmodifiedSinceConstraint() != null ? !getUnmodifiedSinceConstraint().equals(that.getUnmodifiedSinceConstraint()) : that.getUnmodifiedSinceConstraint() != null) return false; if (getModifiedSinceConstraint() != null ? !getModifiedSinceConstraint().equals(that.getModifiedSinceConstraint()) : that.getModifiedSinceConstraint() != null) return false; if (getResponseHeaders() != null ? !getResponseHeaders().equals(that.getResponseHeaders()) : that.getResponseHeaders() != null) return false; if (getSSECustomerKey() != null ? !getSSECustomerKey().equals(that.getSSECustomerKey()) : that.getSSECustomerKey() != null) return false; if (getPartNumber() != null ? !getPartNumber().equals(that.getPartNumber()) : that.getPartNumber() != null) return false; return true; }
Source:
private void showPantsMakeTaskMessage(String message, ConsoleViewContentType type, Project project) { ConsoleView executionConsole = PantsConsoleManager.getOrMakeNewConsole(project); Filter filter = new Filter() { @Nullable @Override public Result applyFilter(String line, int entireLength) { Optional<ParseResult> result = ParseResult.parseErrorLocation(line, ERROR_TAG); if (result.isPresent()) { OpenFileHyperlinkInfo linkInfo = new OpenFileHyperlinkInfo( project, result.get().getFile(), result.get().lineNumber - 1, result.get().columnNumber - 1 ); int startHyperlink = entireLength - line.length() + line.indexOf(ERROR_TAG); return new Result( startHyperlink, entireLength, linkInfo, null ); } return null; } }; ApplicationManager.getApplication().invokeLater(new Runnable() { @Override public void run() { executionConsole.addMessageFilter(filter); executionConsole.print(message, type); } }, ModalityState.NON_MODAL); }

Target:
private void showPantsMakeTaskMessage(String message, ConsoleViewContentType type, Project project) { ConsoleView executionConsole = PantsConsoleManager.getOrMakeNewConsole(project); Filter filter = new Filter() { @Nullable @Override public Result applyFilter(String line, int entireLength) { Optional<ParseResult> result = ParseResult.parseErrorLocation(line, ERROR_TAG); if (result.isPresent()) { OpenFileHyperlinkInfo linkInfo = new OpenFileHyperlinkInfo( project, result.get().getFile(), result.get().getLineNumber() - 1, result.get().getColumnNumber() - 1 ); int startHyperlink = entireLength - line.length() + line.indexOf(ERROR_TAG); return new Result( startHyperlink, entireLength, linkInfo, null ); } return null; } }; ApplicationManager.getApplication().invokeLater(new Runnable() { @Override public void run() { executionConsole.addMessageFilter(filter); executionConsole.print(message, type); } }, ModalityState.NON_MODAL); }
Source:
public void startHistoryWithPrice(String symbol, Double newPrice) throws StockMarketExpection { if (!marketHistory.containsKey(symbol)) { List<Double> priceList = new ArrayList<Double>(); priceList.add(newPrice); marketHistory.put(symbol, priceList); } }

Target:
public void startHistoryWithPrice(String symbol, Double newPrice) throws StockMarketExpection { if (!marketHistory.containsKey(symbol)) { List<Double> price = new ArrayList<Double>(); priceList.add(newPrice); marketHistory.put(symbol, price); } }
Source:
public static EventService getAnalyticsRest(@NonNull StreamConfig streamConfig) { DestinationEventService destinationEventService = streamConfig.getDestinationEventService(); if (destinationEventService == null) { destinationEventService = DestinationEventService.ANALYTICS; } EventService s; if (ANALYTICS_REST_SERVICE_CACHE.get(destinationEventService.getId()) != null) { s = ANALYTICS_REST_SERVICE_CACHE.get(destinationEventService.getId()); if (s != null) { return s; } } String intakeBaseUriOverride = getEventPlatformIntakeUriOverride(); Retrofit r = createRetrofit(WikiSite.forLanguageCode(WikipediaApp.getInstance().getAppOrSystemLanguageCode()), intakeBaseUriOverride != null ? intakeBaseUriOverride : destinationEventService.getBaseUri()); s = r.create(EventService.class); ANALYTICS_REST_SERVICE_CACHE.put(destinationEventService.getId(), s); return s; }

Target:
public static EventService getAnalyticsRest(@NonNull StreamConfig streamConfig) { DestinationEventService destinationEventService = streamConfig.getDestinationEventService(); if (destinationEventService == null) { destinationEventService = DestinationEventService.ANALYTICS; } EventService s; if (ANALYTICS_REST_SERVICE_CACHE.get(destinationEventService.getId()) != null) { s = ANALYTICS_REST_SERVICE_CACHE.get(destinationEventService.getId()); if (s != null) { return s; } } String intakeBaseUriOverride = getEventPlatformIntakeUriOverride(); Retrofit r = createRetrofit(null, StringUtils.defaultString(intakeBaseUriOverride, destinationEventService.getBaseUri())); s = r.create(EventService.class); ANALYTICS_REST_SERVICE_CACHE.put(destinationEventService.getId(), s); return s; }
Source:
public static String keyWithResourceNameAndSuffix(String resourceName, String suffix) { return String.format("%s.%s.%s", EXTERNAL_RESOURCE_PREFIX, resourceName, suffix); }

Target:
private static String keyWithResourceNameAndSuffix(String resourceName, String suffix) { return String.format("%s.%s.%s", EXTERNAL_RESOURCE_PREFIX, Preconditions.checkNotNull(resourceName), Preconditions.checkNotNull(suffix)); }
Source:
public static Takes make(final Base base) throws IOException { final Takes fork = new TsFork( new FkParams( PsByFlag.class.getSimpleName(), Pattern.compile(".+"), new TkRedirect() ), new FkRegex( "/xsl/.*", new TsWithType(new TsClasspath(), "text/xsl") ), new FkRegex( "/css/.*", new TsWithType( new TsFork( new FkHitRefresh( new File("./src/main/scss"), new Runnable() { @Override public void run() { new VerboseProcess( new ProcessBuilder( "mvn", "sass:update-stylesheets", "minify:minify" ) ).stdout(); } }, new TsFiles("./target/classes") ), new FkFixed(new TsClasspath()) ), "text/css" ) ), new FkRegex("/images/.*", new TsClasspath()), new FkRegex("/robots.txt", ""), new FkRegex( "/", new TsFork( new FkAuthenticated( new Target<Request>() { @Override public Take route(final Request req) throws IOException { return new TkDocs( base.user( new RqAuth(req).identity().urn() ), req ); } } ), new FkAnonymous( new Target<Request>() { @Override public Take route(final Request req) { return new TkIndex(req); } } ) ) ), new FkRegex( "/doc/.*", new TsSecure(new TsGreedy(new TsDoc(base))) ) ); return TsApp.fallback( new TsVerbose(new TsFlash(TsApp.auth(fork))) ); }

Target:
public static Takes make(final Base base) throws IOException { final Takes fork = new TsFork( new FkParams( PsByFlag.class.getSimpleName(), Pattern.compile(".+"), new TkRedirect() ), new FkRegex( "/xsl/.*", new TsWithType(new TsClasspath(), "text/xsl") ), new FkRegex( "/css/.*", new TsWithType( new TsFork( new FkHitRefresh( new File("./src/main/scss"), new Runnable() { @Override public void run() { new VerboseProcess( new ProcessBuilder( "mvn", "sass:update-stylesheets", "minify:minify" ) ).stdout(); } }, new TsFiles("./target/classes") ), new FkFixed(new TsClasspath()) ), "text/css" ) ), new FkRegex( "/images/.*\\.png", new TsWithType(new TsClasspath(), MediaType.PNG.toString()) ), new FkRegex("/robots.txt", ""), new FkRegex( "/", new TsFork( new FkAuthenticated( new Target<Request>() { @Override public Take route(final Request req) throws IOException { return new TkDocs( base.user( new RqAuth(req).identity().urn() ), req ); } } ), new FkAnonymous( new Target<Request>() { @Override public Take route(final Request req) { return new TkIndex(req); } } ) ) ), new FkRegex( "/doc/.*", new TsSecure(new TsGreedy(new TsDoc(base))) ) ); return TsApp.fallback( new TsVerbose(new TsFlash(TsApp.auth(fork))) ); }
Source:
public void testNoTaskJobLauncher() { String[] enabledArgs = new String[] { "--spring.cloud.task.batch.failOnJobFailure=true", "--spring.cloud.task.batch.failOnJobFailurePollInterval=500", "--spring.batch.job.enabled=false" }; this.applicationContext = SpringApplication.run(new Class[] { TaskJobLauncherCommandLineRunnerTests.JobWithFailureConfiguration.class }, enabledArgs); }

Target:
public void testNoTaskJobLauncher() { String[] enabledArgs = new String[] { "--spring.cloud.task.batch.failOnJobFailure=true", "--spring.cloud.task.batch.failOnJobFailurePollInterval=500", "--spring.batch.job.enabled=false" }; this.applicationContext = SpringApplication.run(new Class[] { TaskJobLauncherCommandLineRunnerTests.JobWithFailureConfiguration.class }, enabledArgs); JobExplorer jobExplorer = this.applicationContext.getBean(JobExplorer.class); assertThat(jobExplorer.getJobNames().size()).isEqualTo(0); }
Source:
public WikiBasePageObject(WebDriver driver) { super(driver); this.globalNav = new GlobalNavPageObject(driver); }

Target:
public WikiBasePageObject(WebDriver driver) { super(driver); PageFactory.initElements(driver, this); }
Source:
void addChild(ObjectId repoId, ObjectId cacheId, String path) throws IOException { String[] entrys = path.split("/"); String pathKey = entrys[0]; IPath fullPath = getLocation().append(pathKey); if (entrys.length > 1) { GitModelCacheTree cacheEntry = (GitModelCacheTree) cacheTreeMap .get(pathKey); if (cacheEntry == null) { cacheEntry = new GitModelCacheTree(this, baseCommit, repoId, cacheId, fullPath, factory); cacheTreeMap.put(pathKey, cacheEntry); } cacheEntry.addChild(repoId, cacheId, path.substring(path.indexOf('/') + 1)); } else cacheTreeMap.put(pathKey, factory.createFileModel(this, baseCommit, repoId, cacheId, fullPath)); }

Target:
void addChild(ObjectId repoId, ObjectId cacheId, String path) throws IOException { String pathKey; int firstSlash = path.indexOf("/"); if (firstSlash > -1) pathKey = path.substring(0, firstSlash); else pathKey = path; IPath fullPath = getLocation().append(pathKey); if (path.contains("/")) { GitModelCacheTree cacheEntry = (GitModelCacheTree) cacheTreeMap .get(pathKey); if (cacheEntry == null) { cacheEntry = new GitModelCacheTree(this, baseCommit, repoId, cacheId, fullPath, factory); cacheTreeMap.put(pathKey, cacheEntry); } cacheEntry.addChild(repoId, cacheId, path.substring(firstSlash + 1)); } else cacheTreeMap.put(pathKey, factory.createFileModel(this, baseCommit, repoId, cacheId, fullPath)); }
Source:
public void testFindDistinctChromosomesByStudyId() { List<String> chromosomeList = variantEntityRepository.findDistinctChromosomes(); List<String> expectedChromosomeList = new ArrayList<>(); expectedChromosomeList.add("11"); assertEquals(expectedChromosomeList, chromosomeList); }

Target:
public void testFindDistinctChromosomesByStudyId() { List<String> chromosomeList = variantEntityRepository.findDistinctChromosomes(); List<String> expectedChromosomeList = new ArrayList<>(); expectedChromosomeList.add("11"); expectedChromosomeList.add("9"); expectedChromosomeList.add("2"); assertEquals(expectedChromosomeList, chromosomeList); }
Source:
public ObjectStat statObject(String bucketName, String objectName, ServerSideEncryption sse) throws InvalidBucketNameException, NoSuchAlgorithmException, InsufficientDataException, IOException, InvalidKeyException, NoResponseException, XmlPullParserException, ErrorResponseException, InternalException, InvalidArgumentException { if ((sse.getType().toString().equals("SSE_S3")) || (sse.getType().toString().equals("SSE_KMS"))) { throw new InvalidArgumentException("Encryption type is not supported for this operation."); } else if ((sse.getType().toString().equals("SSE_C")) && (!this.baseUrl.isHttps())) { throw new InvalidArgumentException("SSE_C provided keys must be made over a secure connection."); } else { Map<String, String> headers = new HashMap<>(); sse.marshal(headers); HttpResponse response = executeHead(bucketName, objectName, headers); ResponseHeader header = response.header(); Map<String,List<String>> httpHeaders = response.httpHeaders(); ObjectStat objectStat = new ObjectStat(bucketName, objectName, header, httpHeaders); return objectStat; } }

Target:
public ObjectStat statObject(String bucketName, String objectName, ServerSideEncryption sse) throws InvalidBucketNameException, NoSuchAlgorithmException, InsufficientDataException, IOException, InvalidKeyException, NoResponseException, XmlPullParserException, ErrorResponseException, InternalException, InvalidArgumentException { if ((sse.getType() == ServerSideEncryption.Type.SSE_S3) || (sse.getType() == ServerSideEncryption.Type.SSE_KMS)) { throw new InvalidArgumentException("StatObject doesn't support encryption type " + sse.getType()); } else if ((sse.getType() == ServerSideEncryption.Type.SSE_C) && (!this.baseUrl.isHttps())) { throw new InvalidArgumentException("SSE_C operations must be performed over a secure connection."); } Map<String, String> headers = new HashMap<>(); sse.marshal(headers); HttpResponse response = executeHead(bucketName, objectName, headers); ResponseHeader header = response.header(); Map<String,List<String>> httpHeaders = response.httpHeaders(); ObjectStat objectStat = new ObjectStat(bucketName, objectName, header, httpHeaders); return objectStat; }
Source:
public void addMetacardType(MetacardType metacardType) { metacardType .getAttributeDescriptors() .forEach( attribute -> { countedFieldsCache .computeIfAbsent(attribute.getName(), key -> new AtomicInteger(0)) .incrementAndGet(); addToFieldsCache(attribute); }); metacardType .getAttributeDescriptors() .stream() .filter(descriptor -> BasicTypes.STRING_TYPE.equals(descriptor.getType())) .map(stringDescriptor -> stringDescriptor.getName() + SchemaFields.TEXT_SUFFIX) .forEach(fieldName -> anyTextFieldsCache.add(fieldName)); }

Target:
public void addMetacardType(MetacardType metacardType) { metacardType.getAttributeDescriptors().forEach(this::addToFieldsCache); metacardType .getAttributeDescriptors() .stream() .filter(descriptor -> BasicTypes.STRING_TYPE.equals(descriptor.getType())) .map(stringDescriptor -> stringDescriptor.getName() + SchemaFields.TEXT_SUFFIX) .forEach(fieldName -> anyTextFieldsCache.add(fieldName)); }
Source:
public StateDescriptionFragment build() { return new StateDescriptionFragment() { @Override public @Nullable BigDecimal getMinimum() { return minimum; } @Override public @Nullable BigDecimal getMaximum() { return maximum; } @Override public @Nullable BigDecimal getStep() { return step; } @Override public @Nullable String getPattern() { return pattern; } @Override public @Nullable Boolean isReadOnly() { return readOnly; } @Override public @Nullable List<StateOption> getOptions() { return options; } @Override public @Nullable StateDescription toStateDescription() { if (minimum == null && maximum == null && step == null && pattern == null && options == null) { return null; } final Boolean ro = readOnly; return new StateDescription(minimum, maximum, step, pattern, ro == null ? false : ro.booleanValue(), options); } }; }

Target:
public StateDescriptionFragment build() { return new StateDescriptionFragmentImpl(fragment); }
Source:
private Map<String, Set<String>> gatherHostGroupBindings(ClusterTopology clusterTopology) { Map<String, Set<String>> hgBindngs = Maps.newHashMap(); for (Map.Entry<String, HostGroupInfo> hgEnrty: clusterTopology.getHostGroupInfo().entrySet()) { hgBindngs.put(hgEnrty.getKey(), Sets.newCopyOnWriteArraySet(hgEnrty.getValue().getHostNames())); } return hgBindngs; }

Target:
private Map<String, Set<String>> gatherHostGroupBindings(ClusterTopology clusterTopology) { Map<String, Set<String>> hgBindings = Maps.newHashMap(); for (Map.Entry<String, HostGroupInfo> hgEnrty: clusterTopology.getHostGroupInfo().entrySet()) { hgBindings.put(hgEnrty.getKey(), Sets.newCopyOnWriteArraySet(hgEnrty.getValue().getHostNames())); } return hgBindings; }
Source:
public Future<Void> start() { logger.info("Starting LaunchDarkly polling client with interval: " + config.pollingIntervalMillis + " milliseconds"); final VeryBasicFuture initFuture = new VeryBasicFuture(); scheduler = Executors.newScheduledThreadPool(1); scheduler.scheduleAtFixedRate(new Runnable() { @Override public void run() { try { store.init(requestor.makeAllRequest(true)); if (!initialized) { logger.info("Initialized LaunchDarkly client."); initialized = true; initFuture.completed(null); } } catch (IOException e) { logger.error("Encountered exception in LaunchDarkly client when retrieving update", e); } } }, 0L, config.pollingIntervalMillis, TimeUnit.MILLISECONDS); return initFuture; }

Target:
public Future<Void> start() { logger.info("Starting LaunchDarkly polling client with interval: " + config.pollingIntervalMillis + " milliseconds"); final VeryBasicFuture initFuture = new VeryBasicFuture(); ThreadFactory threadFactory = new ThreadFactoryBuilder() .setNameFormat("LaunchDarkly-PollingProcessor-%d") .build(); scheduler = Executors.newScheduledThreadPool(1, threadFactory); scheduler.scheduleAtFixedRate(new Runnable() { @Override public void run() { try { store.init(requestor.makeAllRequest(true)); if (!initialized.getAndSet(true)) { logger.info("Initialized LaunchDarkly client."); initFuture.completed(null); } } catch (IOException e) { logger.error("Encountered exception in LaunchDarkly client when retrieving update", e); } } }, 0L, config.pollingIntervalMillis, TimeUnit.MILLISECONDS); return initFuture; }
Source:
public void testNewLease() { SimpleArrayAllocator allocator = new SimpleArrayAllocator(5); Deque<int[]> arrayList = new ArrayDeque<>(); for (int i = 0; i < 5; i++) { arrayList.push(allocator.borrowIntArray(10)); } assertEquals(allocator.getBorrowedArrays(), 5); assertEquals(allocator.getEstimatedSizeInBytes(), 280); for (int i = 0; i < 5; i++) { allocator.returnArray(arrayList.pop()); } assertEquals(allocator.getBorrowedArrays(), 0); assertEquals(allocator.getEstimatedSizeInBytes(), sizeOfIntArray(10) * 5); int[] borrowed = allocator.borrowIntArray(101); assertEquals(allocator.getEstimatedSizeInBytes(), sizeOfIntArray(101)); allocator.returnArray(borrowed); assertEquals(allocator.getEstimatedSizeInBytes(), sizeOfIntArray(101)); }

Target:
public void testNewLease() { SimpleArrayAllocator allocator = new SimpleArrayAllocator(5); Deque<int[]> arrayList = new ArrayDeque<>(); for (int i = 0; i < 5; i++) { arrayList.push(allocator.borrowIntArray(10)); } assertEquals(allocator.getBorrowedArrayCount(), 5); assertEquals(allocator.getEstimatedSizeInBytes(), sizeOfIntArray(10) * 5); for (int i = 0; i < 5; i++) { allocator.returnArray(arrayList.pop()); } assertEquals(allocator.getBorrowedArrayCount(), 0); assertEquals(allocator.getEstimatedSizeInBytes(), sizeOfIntArray(10) * 5); int[] borrowed = allocator.borrowIntArray(101); assertEquals(allocator.getEstimatedSizeInBytes(), sizeOfIntArray(101)); allocator.returnArray(borrowed); assertEquals(allocator.getEstimatedSizeInBytes(), sizeOfIntArray(101)); }
Source:
public Req understand(final Comment.Smart comment, final URI home) throws IOException { final String prefix = String.format("@%s ", this.login); final Req req; if (comment.body().trim().startsWith(prefix)) { req = this.origin.understand(comment, home); } else if (comment.body().trim().contains(prefix)) { new Answer(comment).post( String.format( QnReferredTo.PHRASES.getString("QnReferredTo.mentioned"), prefix ) ); Logger.info(this, "mention found in #%d", comment.issue().number()); req = Req.DONE; } else { Logger.info( this, "comment #%d in %s#%d is not for me (no \"%s\" prefix)", comment.number(), comment.issue().repo().coordinates(), comment.issue().number(), prefix ); req = Req.EMPTY; } return req; }

Target:
public Req understand(final Comment.Smart comment, final URI home) throws IOException { final String prefix = String.format("@%s ", this.login); final Req req; if (comment.body().trim().startsWith(prefix)) { req = this.origin.understand(comment, home); } else if (comment.body().contains(prefix)) { new Answer(comment).post( String.format( QnReferredTo.PHRASES.getString("QnReferredTo.mentioned"), prefix ) ); Logger.info(this, "mention found in #%d", comment.issue().number()); req = Req.DONE; } else { Logger.info( this, "comment #%d in %s#%d is not for me (no \"%s\" prefix)", comment.number(), comment.issue().repo().coordinates(), comment.issue().number(), prefix ); req = Req.EMPTY; } return req; }
Source:
private RevCommit getRevCommit(IFileRevision revision) { if (revision instanceof CommitFileRevision) { return ((CommitFileRevision) revision).getRevCommit(); } IResourceVariant variant = Adapters.adapt((revision), IResourceVariant.class); if (variant instanceof GitRemoteResource) { final RevCommit commit = ((GitRemoteResource) variant) .getCommitId(); try { return walk.parseCommit(commit); } catch (IOException e) { Activator .logError( NLS.bind(CoreText.GitFileHistory_invalidCommit, commit.getName(), resource.getName()), e); } } return null; }

Target:
private RevCommit getRevCommit(IFileRevision revision) { if (revision instanceof CommitFileRevision) { return ((CommitFileRevision) revision).getRevCommit(); } IResourceVariant variant = Adapters.adapt(revision, IResourceVariant.class); if (variant instanceof GitRemoteResource) { final RevCommit commit = ((GitRemoteResource) variant) .getCommitId(); try { return walk.parseCommit(commit); } catch (IOException e) { Activator .logError( NLS.bind(CoreText.GitFileHistory_invalidCommit, commit.getName(), resource.getName()), e); } } return null; }