auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void execute() { final Setting setting = getActionContext().getSetting(); final EObject eObject = setting.getEObject(); final EStructuralFeature eStructuralFeature = setting.getEStructuralFeature(); final List<?> containments = (List<?>) eObject.eGet(eStructuralFeature, true); final List<?> moveDownList = Arrays.asList( ((IStructuredSelection) getTableViewer().getSelection()).toArray()); sortSelectionBasedOnIndex(moveDownList, containments); Collections.reverse(moveDownList); final int maxIndex = containments.size() - 1; final EditingDomain editingDomain = getActionContext().getEditingDomain(); for (final Object moveDownObject : moveDownList) { final int currentIndex = containments.indexOf(moveDownObject); if (currentIndex < 0 || currentIndex == maxIndex) { return; } editingDomain.getCommandStack() .execute( new MoveCommand( editingDomain, eObject, eStructuralFeature, currentIndex, currentIndex + 1)); } <START> } <END></code><technical_language>check in canExecute reached end of list</technical_language>

Target:
public void execute() { final List<?> containments = getContainments(); final List<?> moveDownList = Arrays.asList( ((IStructuredSelection) getTableViewer().getSelection()).toArray()); sortSelectionBasedOnIndex(moveDownList, containments); Collections.reverse(moveDownList); final int maxIndex = containments.size() - 1; final EditingDomain editingDomain = getActionContext().getEditingDomain(); final Setting setting = getActionContext().getSetting(); final EObject eObject = setting.getEObject(); final EStructuralFeature eStructuralFeature = setting.getEStructuralFeature(); for (final Object moveDownObject : moveDownList) { final int currentIndex = containments.indexOf(moveDownObject); if (currentIndex < 0 || currentIndex == maxIndex) { return; } editingDomain.getCommandStack() .execute( new MoveCommand( editingDomain, eObject, eStructuralFeature, currentIndex, currentIndex + 1)); } }
Source:
<code>private static TaskDeploymentDescriptor createTaskDeploymentDescriptor(JobID jobId) throws IOException { final ResultPartitionDeploymentDescriptor taskResultPartitionDescriptor = PartitionTestUtils.createPartitionDeploymentDescriptor(ResultPartitionType.BLOCKING); <START> return TaskExecutorSubmissionTest.createTaskDeploymentDescriptor( jobId, "job", taskResultPartitionDescriptor.getShuffleDescriptor().getResultPartitionID().getProducerId(), new SerializedValue<>(new ExecutionConfig()), "Sender", 1, 0, 1, 0, new Configuration(), new Configuration(), TestingInvokable.class.getName(), Collections.singletonList(taskResultPartitionDescriptor), Collections.emptyList(), Collections.emptyList(), Collections.emptyList(), 0); <END> }</code><technical_language>TaskDeploymentDescriptorBuilder here</technical_language>

Target:
private static TaskDeploymentDescriptor createTaskDeploymentDescriptor(JobID jobId) throws IOException { return TaskDeploymentDescriptorBuilder.newBuilder(jobId, TestingInvokable.class).build(); }
Source:
<code>public IServer[] getCompatibleServers(IModule module) { ArrayList<IServer> ret = new ArrayList<IServer>(); IServer[] servers = ServerCore.getServers(); IModuleType mt = module.getModuleType(); <START> if (servers != null) { <END> int size = servers.length; for (int i = 0; i < size; i++) { IRuntimeType rtt = servers[i].getServerType().getRuntimeType(); IModuleType[] stmt = rtt == null ? new IModuleType[0] : rtt.getModuleTypes(); if (ServerUtil.isSupportedModule(stmt, mt.getId(), null)) { ret.add(servers[i]); } } } return (IServer[]) ret.toArray(new IServer[ret.size()]); }</code><technical_language>instanciate ret mt if servers != null length > 0</technical_language>

Target:
public IServer[] getCompatibleServers(IModule module) { IServer[] servers = ServerCore.getServers(); IModuleType mt = module.getModuleType(); int size = servers.length; if (servers != null && size > 0) { ArrayList<IServer> ret = new ArrayList<IServer>(); for (int i = 0; i < size; i++) { IRuntimeType rtt = servers[i].getServerType().getRuntimeType(); IModuleType[] stmt = rtt == null ? new IModuleType[0] : rtt.getModuleTypes(); if (ServerUtil.isSupportedModule(stmt, mt.getId(), null)) { ret.add(servers[i]); } } return (IServer[]) ret.toArray(new IServer[ret.size()]); } return new IServer[0]; }
Source:
<code>private String decrypt(final String key, final String value) { if (StringExtensions.IsNullOrBlank(key)) { throw new IllegalArgumentException("key is null or blank"); } try { return getStorageHelper().decrypt(value); } catch (GeneralSecurityException | IOException e) { <START> Logger.e(TAG, "Decryption failure", "", ADALError.DECRYPTION_FAILED, e); <END> removeItem(key); Logger.v(TAG, String.format("Decryption error, item removed for key: '%s'", key)); } return null; }</code><technical_language>If get telemetry frequently this error occurs ClientAnalytics log this event information investigate happened</technical_language>

Target:
private String decrypt(final String key, final String value) { if (StringExtensions.IsNullOrBlank(key)) { throw new IllegalArgumentException("key is null or blank"); } try { return getStorageHelper().decrypt(value); } catch (GeneralSecurityException | IOException e) { ClientAnalytics.logEvent(new EncryptionDecryptionFailureEvent(new InstrumentationPropertiesBuilder(e), false)); Logger.e(TAG, "Decryption failure", "", ADALError.DECRYPTION_FAILED, e); removeItem(key); Logger.v(TAG, String.format("Decryption error, item removed for key: '%s'", key)); } return null; }
Source:
<code>public InputStream[] call(CallContext callContext, InputStream[] input) { checkAllowedArgs(callContext.getEndpointState(), callContext.getSessionState(), callContext.getWorkUnit()); return getCaller().arrayCall(getClient(), callContext.getEndpointState(), callContext.getSessionState(), <START> callContext.getWorkUnit(), input); <END> }</code><technical_language>noted above, set endpoint state in call context and, in deprecated method, get return endpoint state call context. want construct output array endpoint state construct a new array endpoint state. implies passing call context caller implementations callers set endpoint state. If change right, change consistently for callers</technical_language>

Target:
public InputStream[] call(CallContext callContext, InputStream[] input) { try { return getResponseData(callContext, input, false); } catch(Exception ex) { throw new InternalError("Exception occurred while fetching data"); } }
Source:
<code>public boolean onLongPressEvent(PointF point) { if (!view.getSettings().SCROLL_MAP_BY_GESTURES.get()) { if (!selectedObjects.isEmpty()) view.showMessage(activity.getNavigationHint(latLon)); return true; } <START> if(OsmandPlugin.getEnabledPlugin(PlanningPlugin.class) != null){ <END> if(OsmandPlugin.getEnabledPlugin(PlanningPlugin.class).getPlanningMode()) return false; } if(pressedInTextView(point.x, point.y) == 2){ setLocation(null, ""); view.refreshMap(); return true; } if(pressedInTextView(point.x, point.y) == 1) return false; LatLon pressedLoc = view.getLatLonFromScreenPoint(point.x, point.y); selectedObjects.clear(); List<Object> s = new ArrayList<Object>(); LatLon latLon = null; for(OsmandMapLayer l : view.getLayers()){ if(l instanceof ContextMenuLayer.IContextMenuProvider){ s.clear(); ((ContextMenuLayer.IContextMenuProvider) l).collectObjectsFromPoint(point, s); for(Object o : s) { selectedObjects.put(o, ((ContextMenuLayer.IContextMenuProvider) l)); if(latLon == null) { latLon = ((ContextMenuLayer.IContextMenuProvider) l).getObjectLocation(o); } } } } if(latLon == null) { latLon = pressedLoc; } String description = getSelectedObjectDescription(); setLocation(latLon, description); view.refreshMap(); return true; }</code><technical_language>This a bit specific plugin avoid. If mistaken catch onLongPressEvent in PlanningLayer propogate is processed pressed</technical_language>

Target:
public boolean onLongPressEvent(PointF point) { if ((Build.VERSION.SDK_INT < 14) && !view.getSettings().SCROLL_MAP_BY_GESTURES.get()) { if (!selectedObjects.isEmpty()) view.showMessage(activity.getNavigationHint(latLon)); return true; } if(OsmandPlugin.getEnabledPlugin(PlanningPlugin.class) != null){ if(OsmandPlugin.getEnabledPlugin(PlanningPlugin.class).getPlanningMode()) return false; } if(pressedInTextView(point.x, point.y) == 2){ setLocation(null, ""); view.refreshMap(); return true; } if(pressedInTextView(point.x, point.y) == 1) return false; LatLon pressedLoc = view.getLatLonFromScreenPoint(point.x, point.y); selectedObjects.clear(); List<Object> s = new ArrayList<Object>(); LatLon latLon = null; for(OsmandMapLayer l : view.getLayers()){ if(l instanceof ContextMenuLayer.IContextMenuProvider){ s.clear(); ((ContextMenuLayer.IContextMenuProvider) l).collectObjectsFromPoint(point, s); for(Object o : s) { selectedObjects.put(o, ((ContextMenuLayer.IContextMenuProvider) l)); if(latLon == null) { latLon = ((ContextMenuLayer.IContextMenuProvider) l).getObjectLocation(o); } } } } if(latLon == null) { latLon = pressedLoc; } String description = getSelectedObjectDescription(); setLocation(latLon, description); view.refreshMap(); return true; }
Source:
<code>public void testPublishFullPost() { String title = "Hello Espresso!"; String content = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod " + "tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud " + "exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat."; String category = "Android Test"; long now = Instant.now().toEpochMilli(); String tag = "Tag " + now; <START> loginIfNecessary(); <END> MasterbarComponent mb = new MasterbarComponent().goToMySitesTab(); sleep(); mb.clickBlogPosts(); new MySitesPage() .startNewPost(E2E_WP_COM_USER_SITE_ADDRESS); EditorPage editorPage = new EditorPage(); editorPage.enterTitle(title); editorPage.enterContent(content); editorPage.enterImage(); editorPage.openSettings(); editorPage.addACategory(category); editorPage.addATag(tag); editorPage.setFeaturedImage(); checkViewHasText(onView(withId(R.id.post_categories)), category); checkViewHasText(onView(withId(R.id.post_tags)), tag); waitForElementToNotBeDisplayed(onView(withText(R.string.post_settings_set_featured_image))); pressBack(); boolean isPublished = editorPage.publishPost(); assertTrue(isPublished); }</code><technical_language>safer for this be: logoutIfNecessary(); wpLogin(); loginIfNecessary() method verify logged in correct user. mocking, this is user matter. this change. do think</technical_language>

Target:
public void testPublishFullPost() { String title = "Hello Espresso!"; String content = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod " + "tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud " + "exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat."; String category = "Android Test"; long now = Instant.now().toEpochMilli(); String tag = "Tag " + now; MasterbarComponent mb = new MasterbarComponent().goToMySitesTab(); sleep(); mb.clickBlogPosts(); new MySitesPage() .startNewPost(E2E_WP_COM_USER_SITE_ADDRESS); EditorPage editorPage = new EditorPage(); editorPage.enterTitle(title); editorPage.enterContent(content); editorPage.enterImage(); editorPage.openSettings(); editorPage.addACategory(category); editorPage.addATag(tag); editorPage.setFeaturedImage(); checkViewHasText(onView(withId(R.id.post_categories)), category); checkViewHasText(onView(withId(R.id.post_tags)), tag); waitForElementToNotBeDisplayed(onView(withText(R.string.post_settings_set_featured_image))); pressBack(); boolean isPublished = editorPage.publishPost(); assertTrue(isPublished); }
Source:
<code>public void validateFolderName(final Folder folder) throws DotDataException { if (UtilMethods.isSet(folder.getParentPermissionable()) && folder.getParentPermissionable() instanceof Host && UtilMethods.isSet(folder.getName()) && reservedFolderNames.contains(folder.getName().toUpperCase())) { <START> throw new InvalidFolderNameException("Folder can't be saved. You entered a reserved folder name"); <END> } }</code><technical_language>Include name of invalid folder in error message</technical_language>

Target:
public void validateFolderName(final Folder folder) throws DotDataException { if (UtilMethods.isSet(folder.getParentPermissionable()) && folder.getParentPermissionable() instanceof Host && UtilMethods.isSet(folder.getName()) && reservedFolderNames.contains(folder.getName().toUpperCase())) { throw new InvalidFolderNameException("Folder can't be saved. You entered a reserved folder name: " + folder.getName()); } }
Source:
<code>public String toString() { <START> return "GameObject [body=" + body + ", physics=" + physics + ", health=" + health + ", weapon=" + weapon + ", id=" + id + "]"; <END> }</code><technical_language>String.format</technical_language>

Target:
public String toString() { return String.format("GameObject [body=%s, physics=%s, health=%s, weapon=%s, id=%s, destroyed=%s]", body, physics, health, weapon, id, destroyed); }
Source:
<code>void localize() { applicationTitle.setText(dynamicMessages.applicationTitle()); copyrightNotice.setText(dynamicMessages.copyRightNotice()); <START> versionLabel.setText(constants.versionAboutLabel()); <END> userNameLabel.setText(constants.userNameAboutLabel()); }</code><technical_language>set label test in ui binder file for versionLabel userNameLabel now</technical_language>

Target:
void localize() { applicationTitle.setText(dynamicMessages.applicationTitle()); copyrightNotice.setText(dynamicMessages.copyRightNotice()); }
Source:
<code>@Ignore @Test public void annotatedArrayTypeInVarargsParameter() { TypeName type = ArrayTypeName.of(ArrayTypeName.of(ClassName.get(Object.class)) .annotated(TYPE_USE_ANNOTATION)); MethodSpec varargsMethod = MethodSpec.methodBuilder("m") .addParameter( ParameterSpec.builder(type, "p") .build()) .varargs() .build(); assertThat(varargsMethod.toString()).isEqualTo("" + "void m(\n" <START> + " java.lang.Object[] @" + TUA + " ... p) {\n" <END> + "}\n"); }</code><technical_language>whoa</technical_language>

Target:
@Test public void annotatedArrayTypeInVarargsParameter() { TypeName type = ArrayTypeName.of(ArrayTypeName.of(ClassName.get(Object.class)) .annotated(TYPE_USE_ANNOTATION)); MethodSpec varargsMethod = MethodSpec.methodBuilder("m") .addParameter( ParameterSpec.builder(type, "p") .build()) .varargs() .build(); assertThat(varargsMethod.toString()).isEqualTo("" + "void m(java.lang.Object[] @" + TUA + " ... p) {\n" + "}\n"); }
Source:
<code>public void setGuideLayout(@Nonnull SlimefunGuideLayout layout) { <START> this.layout = layout; <END> }</code><technical_language>suggestion Validate.notNull(layout, "You a layout is not-null!"); this.layout = layout;</technical_language>

Target:
public void setGuideLayout(@Nonnull SlimefunGuideLayout layout) { Validate.notNull(layout, "You must specify a layout that is not-null!"); this.layout = layout; }
Source:
<code>private DruidPredicateFactory getPredicateFactory() { return new DruidPredicateFactory() { @Override public Predicate<String> makeStringPredicate() { if (extractionFn != null) { return new Predicate<String>() { @Override public boolean apply(String input) { return values.contains(Strings.nullToEmpty(extractionFn.apply(input))); } }; } else { return new Predicate<String>() { @Override public boolean apply(String input) { return values.contains(Strings.nullToEmpty(input)); } }; } } @Override public DruidLongPredicate makeLongPredicate() { if (extractionFn != null) { return new DruidLongPredicate() { @Override public boolean applyLong(long input) { return values.contains(extractionFn.apply(input)); } }; } else { return longPredicateSupplier.get(); } } @Override public DruidFloatPredicate makeFloatPredicate() { if (extractionFn != null) { return new DruidFloatPredicate() { @Override public boolean applyFloat(float input) { return values.contains(extractionFn.apply(input)); } }; } else { return floatPredicateSupplier.get(); } } @Override <START> public DruidDoublePredicate makeDoublePredicate() <END> { if (extractionFn != null) { return input -> values.contains(extractionFn.apply(input)); } return input -> floatPredicateSupplier.get().applyFloat((float) input); } }; }</code><technical_language>Please other methods in this class lambdas for consistency</technical_language>

Target:
private DruidPredicateFactory getPredicateFactory() { return new DruidPredicateFactory() { @Override public Predicate<String> makeStringPredicate() { if (extractionFn != null) { return input -> values.contains(Strings.nullToEmpty(extractionFn.apply(input))); } else { return input -> values.contains(Strings.nullToEmpty(input)); } } @Override public DruidLongPredicate makeLongPredicate() { if (extractionFn != null) { return input -> values.contains(extractionFn.apply(input)); } else { return longPredicateSupplier.get(); } } @Override public DruidFloatPredicate makeFloatPredicate() { if (extractionFn != null) { return input -> values.contains(extractionFn.apply(input)); } else { return floatPredicateSupplier.get(); } } @Override public DruidDoublePredicate makeDoublePredicate() { if (extractionFn != null) { return input -> values.contains(extractionFn.apply(input)); } return input -> doublePredicateSupplier.get().applyDouble(input); } }; }
Source:
<code>public void stopServerListRefreshing() { if (eurekaClientProvider != null) { EurekaClient eurekaClient = eurekaClientProvider.get(); if (eurekaClient != null) { eurekaClient.unregisterEventListener(updateListener); } } <START> serverListUpdateService.shutdown(); <END> }</code><technical_language>This end multiple shutdowns of shared executor (if used). want track a 'sharedExecutor' variable is null if sharedExecutor is used</technical_language>

Target:
public void stopServerListRefreshing() { if (eurekaClientProvider != null) { EurekaClient eurekaClient = eurekaClientProvider.get(); if (eurekaClient != null) { eurekaClient.unregisterEventListener(updateListener); } } }
Source:
<code>private void restoreState() { _isNewUI = _prefStore.getBoolean(ITourbookPreferences.IMPORT_IS_NEW_UI); _actionRemoveToursWhenClosed.setChecked(Util.getStateBoolean( _state, STATE_IS_REMOVE_TOURS_WHEN_VIEW_CLOSED, true)); final boolean isMergeTracks = _state.getBoolean(STATE_IS_MERGE_TRACKS); _rawDataMgr.setMergeTracks(isMergeTracks); final boolean isCreateTourIdWithTime = _state.getBoolean(STATE_IS_CREATE_TOUR_ID_WITH_TIME); _rawDataMgr.setState_CreateTourIdWithTime(isCreateTourIdWithTime); final boolean isIgnoreInvalidFile = _state.getBoolean(STATE_IS_IGNORE_INVALID_FILE); _rawDataMgr.setState_IsIgnoreInvalidFile(isIgnoreInvalidFile); <START> final boolean isSetBodyWeight = _state.getBoolean(STATE_IS_SET_BODY_WEIGHT); <END> _rawDataMgr.setState_IsSetBodyWeight(isSetBodyWeight); final boolean isAutoOpenLogView = Util.getStateBoolean(_state, STATE_IS_AUTO_OPEN_IMPORT_LOG_VIEW, RawDataView.STATE_IS_AUTO_OPEN_IMPORT_LOG_VIEW_DEFAULT); _rawDataMgr.setState_IsOpenImportLogView(isAutoOpenLogView); final boolean isValidation = _state.getBoolean(STATE_IS_CHECKSUM_VALIDATION); _rawDataMgr.setIsChecksumValidation(isValidation); updateToolTipState(); Display.getCurrent().asyncExec(new Runnable() { @Override public void run() { reimportAllImportFiles(true); } }); }</code><technical_language>_state.getBoolean(... returns false saved</technical_language>

Target:
private void restoreState() { _isNewUI = _prefStore.getBoolean(ITourbookPreferences.IMPORT_IS_NEW_UI); _actionRemoveToursWhenClosed.setChecked(Util.getStateBoolean( _state, STATE_IS_REMOVE_TOURS_WHEN_VIEW_CLOSED, true)); final boolean isMergeTracks = _state.getBoolean(STATE_IS_MERGE_TRACKS); _rawDataMgr.setMergeTracks(isMergeTracks); final boolean isCreateTourIdWithTime = _state.getBoolean(STATE_IS_CREATE_TOUR_ID_WITH_TIME); _rawDataMgr.setState_CreateTourIdWithTime(isCreateTourIdWithTime); final boolean isIgnoreInvalidFile = _state.getBoolean(STATE_IS_IGNORE_INVALID_FILE); _rawDataMgr.setState_IsIgnoreInvalidFile(isIgnoreInvalidFile); final boolean isSetBodyWeight = Util.getStateBoolean(_state, STATE_IS_SET_BODY_WEIGHT, STATE_IS_SET_BODY_WEIGHT_DEFAULT); _rawDataMgr.setState_IsSetBodyWeight(isSetBodyWeight); final boolean isAutoOpenLogView = Util.getStateBoolean(_state, STATE_IS_AUTO_OPEN_IMPORT_LOG_VIEW, RawDataView.STATE_IS_AUTO_OPEN_IMPORT_LOG_VIEW_DEFAULT); _rawDataMgr.setState_IsOpenImportLogView(isAutoOpenLogView); final boolean isValidation = _state.getBoolean(STATE_IS_CHECKSUM_VALIDATION); _rawDataMgr.setIsChecksumValidation(isValidation); updateToolTipState(); Display.getCurrent().asyncExec(new Runnable() { @Override public void run() { reimportAllImportFiles(true); } }); }
Source:
<code>boolean shouldRetryForGone(int statusCode, int subStatusCode) { if (statusCode == StatusCodes.GONE && (subStatusCode == SubStatusCodes.PARTITION_KEY_RANGE_GONE || subStatusCode == SubStatusCodes.NAME_CACHE_IS_STALE) <START> && this.attemptedRetries < MAX_RETRIES) { <END> this.attemptedRetries++; return true; } return false; }</code><technical_language>I questions here: 1. exceptions happens, main sink re-calculate partitionKeyRangeId, refreshing cache, get same/old partitionKeyRangeId back. cache is refreshed? 2. Currently check for PARTITION_KEY_RANGE_GONE NAME_CACHE_IS_STALE exception, COMPLETING_SPLIT etc</technical_language>

Target:
boolean shouldRetryForGone(int statusCode, int subStatusCode) { if (statusCode == StatusCodes.GONE && (subStatusCode == SubStatusCodes.PARTITION_KEY_RANGE_GONE || subStatusCode == SubStatusCodes.NAME_CACHE_IS_STALE || subStatusCode == SubStatusCodes.COMPLETING_SPLIT || subStatusCode == SubStatusCodes.COMPLETING_PARTITION_MIGRATION) && this.attemptedRetries < MAX_RETRIES) { this.attemptedRetries++; if (subStatusCode == SubStatusCodes.NAME_CACHE_IS_STALE) { refreshCollectionCache(); } return true; } return false; }
Source:
<code>public void cleanUp() throws Exception { File supportDir = new File(j.getInstance().getRootDir(), "support"); File cacheDir = new File(supportDir, "winsw"); DumbSlave slave1 = j.createOnlineSlave(); DumbSlave slave2 = j.createOnlineSlave(); generateBundle(); assertNotNull("The cache directory is empty", cacheDir.list()); for (int i = 0; i < 10; i++) { int cacheDirsCount = cacheDir.list().length; <START> if (cacheDir.list() != null && cacheDirsCount == 2) { <END> break; } else { Thread.sleep(1000 * 10); } } assertEquals(cacheDir.list().length, 2); j.getInstance().removeNode(slave2); generateBundle(); for (int i = 0; i < 10; i++) { int cacheDirsCount = cacheDir.list().length; if (cacheDir.list() != null && cacheDirsCount == 1) { break; } else { Thread.sleep(1000 * 10); } } assertEquals(cacheDir.list().length, 1); }</code><technical_language>skip nullability check previous assertion</technical_language>

Target:
public void cleanUp() throws Exception { File supportDir = new File(j.getInstance().getRootDir(), "support"); File cacheDir = new File(supportDir, "winsw"); DumbSlave slave1 = j.createOnlineSlave(); DumbSlave slave2 = j.createOnlineSlave(); generateBundle(); assertNotNull("The cache directory is empty", cacheDir.list()); for (int i = 0; i < 10; i++) { int cacheDirsCount = cacheDir.list().length; if (cacheDirsCount == 2) { break; } else { Thread.sleep(1000 * 10); } } assertEquals(cacheDir.list().length, 2); j.getInstance().removeNode(slave2); generateBundle(); for (int i = 0; i < 10; i++) { int cacheDirsCount = cacheDir.list().length; if (cacheDirsCount == 1) { break; } else { Thread.sleep(1000 * 10); } } assertEquals(cacheDir.list().length, 1); }
Source:
<code>protected void onSetUpBeforeClosingWelcomePage() throws Exception { String[] fileNames = { VSM, SESSION_FILE, ECORE_FILE }; for (final String fileName : fileNames) { <START> EclipseTestsSupportHelper.INSTANCE.copyFile(Activator.PLUGIN_ID, DATA_UNIT_DIR + fileName, getProjectName() + "/" + fileName); <END> } }</code><technical_language>call "copyFileToTestProject(Activator.PLUGIN_ID, DATA_UNIT_DIR, ECORE_FILE, SESSION_FILE, VSM);"</technical_language>

Target:
protected void onSetUpBeforeClosingWelcomePage() throws Exception { copyFileToTestProject(Activator.PLUGIN_ID, DATA_UNIT_DIR, ECORE_FILE, SESSION_FILE, VSM); }
Source:
<code>void processEntry(CanonicalTreeParser m, DirCacheBuildIterator i, WorkingTreeIterator f) throws IOException { if (m != null) { if (!isValidPath(m)) throw new InvalidPathException(m.getEntryPathString()); if (i == null) { if (f != null && !FileMode.TREE.equals(f.getEntryFileMode()) && !f.isEntryIgnored()) { conflicts.add(walk.getPathString()); } else update(m.getEntryPathString(), m.getEntryObjectId(), m.getEntryFileMode()); } else if (f == null || !m.idEqual(i)) { update(m.getEntryPathString(), m.getEntryObjectId(), m.getEntryFileMode()); } else if (i.getDirCacheEntry() != null) { if (f.isModified(i.getDirCacheEntry(), true) || i.getDirCacheEntry().getStage() != 0) update(m.getEntryPathString(), m.getEntryObjectId(), m.getEntryFileMode()); else <START> keep(i.getDirCacheEntry(), f); <END> } else keep(i.getDirCacheEntry(), null); } else { if (f != null) { if (walk.isDirectoryFileConflict()) { conflicts.add(walk.getPathString()); } else { if (i != null) { remove(i.getEntryPathString()); conflicts.remove(i.getEntryPathString()); } else { } } } else { } } }</code><technical_language>Great. I it. Yes, safe. file content index. safe copy files modification time index entry. I change signature this way. telling keep() want this entry entry reused unmodified. keep() telling want modify entry strange. instead simply update index entry give keep()? DirCacheEntry entry = i.getDirCacheEntry(); if (f != null && e.getLastModified() == 0) e.setLastModified(f.getEntryLastModified()); keep(entry); remove other modifications keep() keep()-callers. I ask myself: this explain a checkout head (e.g. rebase, clone, reset) reach a state modification timestamps 0. is initial problem find out why</technical_language>

Target:
void processEntry(CanonicalTreeParser m, DirCacheBuildIterator i, WorkingTreeIterator f) throws IOException { if (m != null) { if (!isValidPath(m)) throw new InvalidPathException(m.getEntryPathString()); if (i == null) { if (f != null && !FileMode.TREE.equals(f.getEntryFileMode()) && !f.isEntryIgnored()) { conflicts.add(walk.getPathString()); } else update(m.getEntryPathString(), m.getEntryObjectId(), m.getEntryFileMode()); } else if (f == null || !m.idEqual(i)) { update(m.getEntryPathString(), m.getEntryObjectId(), m.getEntryFileMode()); } else if (i.getDirCacheEntry() != null) { if (f.isModified(i.getDirCacheEntry(), true) || i.getDirCacheEntry().getStage() != 0) update(m.getEntryPathString(), m.getEntryObjectId(), m.getEntryFileMode()); else { DirCacheEntry entry = i.getDirCacheEntry(); if (entry.getLastModified() == 0) entry.setLastModified(f.getEntryLastModified()); keep(entry); } } else keep(i.getDirCacheEntry()); } else { if (f != null) { if (walk.isDirectoryFileConflict()) { conflicts.add(walk.getPathString()); } else { if (i != null) { remove(i.getEntryPathString()); conflicts.remove(i.getEntryPathString()); } else { } } } else { } } }
Source:
<code>public void testBlobIdIsEncrypted() throws Exception { <START> <END> }</code><technical_language>needs filling in :)</technical_language>

Target:
public void testBlobIdIsEncrypted() throws Exception { BlobId blobIdV1 = getRandomBlobId(BLOB_ID_V1); BlobId blobIdV2 = getRandomBlobId(BLOB_ID_V2); BlobId blobIdV3 = getRandomBlobId(BLOB_ID_V3); assertFalse("V1 encrypted bit should be false", BlobId.isEncrypted(blobIdV1.getID())); assertFalse("V2 encrypted bit should be false", BlobId.isEncrypted(blobIdV2.getID())); assertFalse("V3 encrypted bit should be false", BlobId.isEncrypted(blobIdV3.getID())); assertTrue("V3 should return true if blobIdString has encrypted bit", BlobId.isEncrypted("AAME")); assertTrue("V3 should return true if blobIdString has encrypted bit", BlobId.isEncrypted("AAMF")); assertFalse("V3 should return false if blobIdString has no encrypted", BlobId.isEncrypted("AAMA")); assertFalse("V3 should return false if blobIdString has no encrypted", BlobId.isEncrypted("AAMB")); boolean[] isEncryptedValues = {true, false}; for (boolean isEncrypted : isEncryptedValues) { BlobId blobIdV4 = new BlobId(BLOB_ID_V4, random.nextBoolean() ? BlobIdType.NATIVE : BlobIdType.CRAFTED, (byte) 1, (short) 1, (short) 1, referenceClusterMap.getWritablePartitionIds().get(random.nextInt(3)), isEncrypted); assertEquals("V4 should return true or false based on its encrypted bit", isEncrypted, BlobId.isEncrypted(blobIdV4.getID())); } }
Source:
<code>public Response sequenceGet(String apiName, String label, String apiId, MessageContext messageContext) { InMemoryAPIDeployer inMemoryApiDeployer = new InMemoryAPIDeployer(); GatewayAPIDTO gatewayAPIDTO = inMemoryApiDeployer.getAPIArtifact(apiId, label); JSONObject responseObj = new JSONObject(); JSONArray sequencesArray = new JSONArray(); if (gatewayAPIDTO != null) { if (gatewayAPIDTO.getSequenceToBeAdd() != null ) { SequenceAdminServiceProxy sequenceAdminServiceProxy = new SequenceAdminServiceProxy(gatewayAPIDTO.getTenantDomain()); for (GatewayContentDTO sequence : gatewayAPIDTO.getSequenceToBeAdd()) { try { if (sequenceAdminServiceProxy.isExistingSequence(sequence.getName())) { sequencesArray.put(sequenceAdminServiceProxy.getSequence(sequence.getName())); } else { <START> log.error(sequence.getName() + " was not deployed in the gateway"); <END> } } catch (AxisFault axisFault) { log.error("Error in fetching deployed sequences from Synapse Configuration." , axisFault); } } } responseObj.put("Sequence", sequencesArray); String responseStringObj = String.valueOf(responseObj); return Response.ok().entity(responseStringObj).build(); } else { responseObj.put("Message", "Error"); String responseStringObj = String.valueOf(responseObj); return Response.serverError().entity(responseStringObj).build(); } }</code><technical_language>this in response</technical_language>

Target:
public Response sequenceGet(String apiName, String label, String apiId, MessageContext messageContext) { InMemoryAPIDeployer inMemoryApiDeployer = new InMemoryAPIDeployer(); GatewayAPIDTO gatewayAPIDTO = inMemoryApiDeployer.getAPIArtifact(apiId, label); JSONObject responseObj = new JSONObject(); if (gatewayAPIDTO != null) { try { JSONArray sequencesArray = new JSONArray(); JSONArray undeployedsequencesArray = new JSONArray(); if (gatewayAPIDTO.getSequenceToBeAdd() != null ) { SequenceAdminServiceProxy sequenceAdminServiceProxy = new SequenceAdminServiceProxy(gatewayAPIDTO.getTenantDomain()); for (GatewayContentDTO sequence : gatewayAPIDTO.getSequenceToBeAdd()) { if(sequenceAdminServiceProxy.isExistingSequence(sequence.getName())) { sequencesArray.put(sequenceAdminServiceProxy.getSequence(sequence.getName())); } else { log.error(sequence.getName() + " was not deployed in the gateway"); undeployedsequencesArray.put(sequence.getContent()); } } } } catch (AxisFault e) { String errorMessage = "Error in fetching deployed artifacts from Synapse Configuration"; log.error(errorMessage, e); RestApiUtil.handleInternalServerError(errorMessage, e, log); } String responseStringObj = String.valueOf(responseObj); return Response.ok().entity(responseStringObj).build(); } else { responseObj.put("Message", "Error"); String responseStringObj = String.valueOf(responseObj); return Response.serverError().entity(responseStringObj).build(); } }
Source:
<code>public void saveNewCharge() { ChargesPayload chargesPayload = new ChargesPayload(); chargesPayload.setAmount(etAmoutDue.getEditableText().toString()); chargesPayload.setLocale(etChargeLocale.getEditableText().toString()); chargesPayload.setDueDate(duedateString); chargesPayload.setDateFormat("dd MMMM yyyy"); chargesPayload.setChargeId(chargeId); initiateChargesCreation(chargesPayload); <START> getDialog().dismiss(); <END> }</code><technical_language>No, This is right place dismiss dialog, do <LINK_0></technical_language>

Target:
public void saveNewCharge() { ChargesPayload chargesPayload = new ChargesPayload(); chargesPayload.setAmount(etAmoutDue.getEditableText().toString()); chargesPayload.setLocale(etChargeLocale.getEditableText().toString()); chargesPayload.setDueDate(duedateString); chargesPayload.setDateFormat("dd MMMM yyyy"); chargesPayload.setChargeId(chargeId); initiateChargesCreation(chargesPayload); }
Source:
<code>private void checkSplitOrStartNext() throws IOException { if (currentReader != null) { return; } final FileSourceSplit nextSplit = splits.poll(); if (nextSplit == null) { throw new IOException("Cannot fetch from another split - no split remaining"); } currentSplitId = nextSplit.splitId(); <START> currentReader = nextSplit.skippedRecordCount() == 0 ? <END> readerFactory.createReader(config, nextSplit.path(), nextSplit.offset(), nextSplit.length()) : readerFactory.createReader(config, nextSplit.path(), nextSplit.offset(), nextSplit.length(), nextSplit.skippedRecordCount()); }</code><technical_language>Nit: nextSplit.skippedRecordCount() here, currentReader = readerFactory.createReader(config, nextSplit.path(), nextSplit.offset(), nextSplit.length(), nextSplit.skippedRecordCount());</technical_language>

Target:
private void checkSplitOrStartNext() throws IOException { if (currentReader != null) { return; } final FileSourceSplit nextSplit = splits.poll(); if (nextSplit == null) { throw new IOException("Cannot fetch from another split - no split remaining"); } currentSplitId = nextSplit.splitId(); final Optional<CheckpointedPosition> position = nextSplit.getReaderPosition(); currentReader = position.isPresent() ? readerFactory.restoreReader(config, nextSplit.path(), nextSplit.offset(), nextSplit.length(), position.get()) : readerFactory.createReader(config, nextSplit.path(), nextSplit.offset(), nextSplit.length()); }
Source:
<code>protected void onEvent(final PluginsAddedEvent event) { if (instances == null) { initInstances(); return; } List<PT> list = new LinkedList<>(); event.getItems().forEach(info -> { try { PT instance = getPluginType().cast(pluginService() .createInstance(info)); list.add(instance); } catch (ClassCastException exc) { } }); filterInstances(list).forEach(instance -> { @SuppressWarnings("unchecked") final Class<? extends PT> ptClass = (Class<? extends PT>) instance .getClass(); <START> instanceMap.putIfAbsent(ptClass, instance); <END> if (!instances.contains(instance)) { instances.add(instance); } }); }</code><technical_language>If add a plugin exists, overwrite it? Naively, I vote yes. (Though I suppose remove readd it, otherwise-but separate events.) problems/skew if PluginIndex overwritten a new version of a class, SingletonServices new version one, no</technical_language>

Target:
protected void onEvent(final PluginsAddedEvent event) { if (instances == null) { initInstances(); return; } List<PT> list = new LinkedList<>(); event.getItems().forEach(info -> { try { PT instance = getPluginType().cast(pluginService() .createInstance(info)); list.add(instance); } catch (ClassCastException exc) { } }); filterInstances(list).forEach(instance -> { @SuppressWarnings("unchecked") final Class<? extends PT> ptClass = (Class<? extends PT>) instance .getClass(); PT oldInstance = instanceMap.get(ptClass); if (oldInstance != null) { instances.remove(oldInstance); } instanceMap.put(ptClass, instance); instances.add(instance); }); }
Source:
<code>public void testDeserialize() throws IOException, UndeclaredIdentifierException { final String IN_NODE_NAME = "in_node"; final String OUT_NODE_NAME = "out_node"; final String DIGITAL_IN_PORT_NAME = "digital_in"; final String DIGITAL_OUT_PORT_NAME = "digital_out"; URL url = Resources.getResource( "org/manifold/compiler/serialization/data/" + "deserialization-types-test.json"); JsonObject json = new JsonParser().parse( Resources.toString(url, Charsets.UTF_8)).getAsJsonObject(); Schematic sch = new SchematicDeserializer().deserialize(json); Map<String, PortTypeValue> outNodePorts = sch.getNodeType(OUT_NODE_NAME) .getPorts(); Map<String, PortTypeValue> inNodePorts = sch.getNodeType(IN_NODE_NAME) .getPorts(); PortTypeValue digitalIn = sch.getPortType(DIGITAL_IN_PORT_NAME); PortTypeValue digitalOut = sch.getPortType(DIGITAL_OUT_PORT_NAME); <START> assertEquals("dogematics", sch.getName()); <END> assertEquals(sch.getUserDefinedType("Int"), digitalIn.getAttributes().get( "width")); assertEquals(digitalIn, inNodePorts.get("in1")); assertEquals(digitalIn, inNodePorts.get("in2")); assertEquals(digitalOut, outNodePorts.get("out2")); assertEquals(digitalOut, outNodePorts.get("out2")); }</code><technical_language>this more robust TEST_SCHEMATIC_NAME</technical_language>

Target:
public void testDeserialize() throws IOException, UndeclaredIdentifierException { final String IN_NODE_NAME = "in_node"; final String OUT_NODE_NAME = "out_node"; final String DIGITAL_IN_PORT_NAME = "digital_in"; final String DIGITAL_OUT_PORT_NAME = "digital_out"; URL url = Resources.getResource( "org/manifold/compiler/serialization/data/" + "deserialization-types-test.json"); JsonObject json = new JsonParser().parse( Resources.toString(url, Charsets.UTF_8)).getAsJsonObject(); Schematic sch = new SchematicDeserializer().deserialize(json); Map<String, PortTypeValue> outNodePorts = sch.getNodeType(OUT_NODE_NAME) .getPorts(); Map<String, PortTypeValue> inNodePorts = sch.getNodeType(IN_NODE_NAME) .getPorts(); PortTypeValue digitalIn = sch.getPortType(DIGITAL_IN_PORT_NAME); PortTypeValue digitalOut = sch.getPortType(DIGITAL_OUT_PORT_NAME); assertEquals(TEST_SCHEMATIC_NAME, sch.getName()); assertEquals(sch.getUserDefinedType("Int"), digitalIn.getAttributes().get( "width")); assertEquals(digitalIn, inNodePorts.get("in1")); assertEquals(digitalIn, inNodePorts.get("in2")); assertEquals(digitalOut, outNodePorts.get("out2")); assertEquals(digitalOut, outNodePorts.get("out2")); }
Source:
<code>public String getDefaultLicenseInfoHeaderText() throws IOException { <START> String defaultLicenseInfoHeader = IOUtils.toString(this.getClass().getResourceAsStream(DEFAULT_LICENSE_INFO_HEADER_FILE), "UTF-8"); <END> defaultLicenseInfoHeader = defaultLicenseInfoHeader.replaceAll("(?m)^#.*\\n", ""); return defaultLicenseInfoHeader; }</code><technical_language>Please CommonUtils.loadResource(). allows overriding config files placing /etc/sw360</technical_language>

Target:
public String getDefaultLicenseInfoHeaderText() { return DEFAULT_LICENSE_INFO_TEXT; }
Source:
<code><START> public void runWithExpectedCount(int theExpectedCount, Runnable r) { <END> this.clear(); this.setExpectedCount(theExpectedCount); r.run(); try { this.awaitExpected(); } catch (InterruptedException theE) { ourLog.error("InterruptedException while awaiting invocation of {}", this.myPointcut.name()); theE.printStackTrace(); } }</code><technical_language>This is favourite part of this PR</technical_language>

Target:
public void runWithExpectedCount(int theExpectedCount, Runnable r) throws InterruptedException { this.setExpectedCount(theExpectedCount); r.run(); this.awaitExpected(); }
Source:
<code>public MotechUserProfile changeExpiredPassword(String userName, String oldPassword, String newPassword) { MotechUser motechUser = allMotechUsers.findByUserName(userName); validatePassword(newPassword); if (motechUser != null && UserStatus.MUST_CHANGE_PASSWORD.equals(motechUser.getUserStatus()) && passwordEncoder.isPasswordValid(motechUser.getPassword(), oldPassword)) { if (passwordEncoder.isPasswordValid(motechUser.getPassword(), newPassword)) { return null; } motechUser.setPassword(passwordEncoder.encodePassword(newPassword)); motechUser.setUserStatus(UserStatus.ACTIVE); allMotechUsers.update(motechUser); return new MotechUserProfile(motechUser); } <START> incrementFailureLogin(motechUser); <END> return null; }</code><technical_language>put lines in else for clarity</technical_language>

Target:
public MotechUserProfile changeExpiredPassword(String userName, String oldPassword, String newPassword) { MotechUser motechUser = allMotechUsers.findByUserName(userName); validatePassword(newPassword); if (motechUser != null && UserStatus.MUST_CHANGE_PASSWORD.equals(motechUser.getUserStatus()) && passwordEncoder.isPasswordValid(motechUser.getPassword(), oldPassword)) { if (passwordEncoder.isPasswordValid(motechUser.getPassword(), newPassword)) { return null; } motechUser.setPassword(passwordEncoder.encodePassword(newPassword)); motechUser.setUserStatus(UserStatus.ACTIVE); allMotechUsers.update(motechUser); return new MotechUserProfile(motechUser); } else { incrementFailureLoginCount(motechUser); } return null; }
Source:
<code>public PartitionKey(final Object key) { <START> if (!(key instanceof PartitionKey)) { <END> this.internalPartitionKey = PartitionKeyInternal.fromObjectArray(new Object[] {key}, true); } else{ this.internalPartitionKey = ((PartitionKey) key).internalPartitionKey; } }</code><technical_language>if intention is capture PartitionKey.None do PartitionKey.None == key instead. other case other PartitionKey.None get covered here</technical_language>

Target:
public PartitionKey(final Object key) { this.internalPartitionKey = PartitionKeyInternal.fromObjectArray(new Object[] {key}, true); }
Source:
<code>public InstanceId deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { JsonObject o = json.getAsJsonObject(); return new InstanceId( <START> InstanceId.Status.parse(getString(o, MEMBER_STATUS)), <END> Error.parse(getString(o, MEMBER_ERROR)), getString(o, MEMBER_INSTANCE_ID)); }</code><technical_language>Shoud replaced getMandatoryString</technical_language>

Target:
public InstanceId deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { JsonObject o = json.getAsJsonObject(); return new InstanceId( InstanceId.Status.parse(getMandatoryString(o, MEMBER_STATUS)), Error.parse(getString(o, MEMBER_ERROR)), getString(o, MEMBER_INSTANCE_ID)); }
Source:
<code>public void onReceive(Context context, Intent intent) { <START> final String registrationId = intent.getStringExtra("registration_id"); <END> if (!SwrveHelper.isNullOrEmpty(registrationId)) { workaroundRegistrationId = registrationId; } ComponentName comp = new ComponentName(context.getPackageName(), intentServiceClass.getName()); startWakefulService(context, (intent.setComponent(comp))); if (!intent.hasExtra(SwrveGcmNotification.GCM_BUNDLE)) { setResultCode(Activity.RESULT_OK); } }</code><technical_language>~ leave null check in case wrong call</technical_language>

Target:
public void onReceive(Context context, Intent intent) { if (intent != null) { final String registrationId = intent.getStringExtra("registration_id"); if (!SwrveHelper.isNullOrEmpty(registrationId)) { workaroundRegistrationId = registrationId; } ComponentName comp = new ComponentName(context.getPackageName(), intentServiceClass.getName()); startWakefulService(context, (intent.setComponent(comp))); if (!intent.hasExtra(SwrveGcmNotification.GCM_BUNDLE)) { setResultCode(Activity.RESULT_OK); } } }
Source:
<code>private void generateAddSignature(Method method) { generateDoc(method); Parameter mainParameter = JaxrsGeneratorUtils.getMainAddParameter(method); if (mainParameter == null) { <START> System.err.println("Method \"" + method + "\" doesn't have any struct parameter"); <END> return; } Type mainType = mainParameter.getType(); JavaTypeReference mainTypeReference = schemaNames.getXjcTypeReference(mainType); String parameterName = javaNames.getJavaMemberStyleName(mainParameter.getName()); String methodName = concatenateName(method, method.getBase().getName()); javaBuffer.addLine("default Response " + methodName + "(%s %s) {", mainTypeReference.getText(), parameterName); javaBuffer.addLine("throw new UnsupportedOperationException();"); javaBuffer.addLine("}"); javaBuffer.addLine(); }</code><technical_language>Throw exception here: throw new IllegalStateException("Method ..</technical_language>

Target:
private void generateAddSignature(Method method) { generateDoc(method); Parameter mainParameter = jaxrsGeneratorUtils.getMainAddParameter(method); if (mainParameter == null) { throw new IllegalStateException("Method \"" + method + "\" doesn't have any struct parameter"); } Type mainType = mainParameter.getType(); JavaTypeReference mainTypeReference = schemaNames.getXjcTypeReference(mainType); javaBuffer.addImports(mainTypeReference.getImports()); String parameterName = javaNames.getJavaMemberStyleName(mainParameter.getName()); String methodName = javaNames.getJavaMemberStyleName(names.concatenate(method.getBase().getName(), method.getName())); javaBuffer.addLine("default Response %s(%s %s) {", methodName, mainTypeReference.getText(), parameterName); javaBuffer.addLine("throw new UnsupportedOperationException();"); javaBuffer.addLine("}"); javaBuffer.addLine(); }
Source:
<code>public void onAccountChanged(OnAccountChanged event) { if (!isAdded()) { return; } if (mChangePasswordProgressDialog != null) { showChangePasswordProgressDialog(false); if (event.isError()) { ToastUtils.showToast(getActivity(), event.error.message, ToastUtils.Duration.LONG); AppLog.e(T.SETTINGS, event.error.message); } else { ToastUtils.showToast(getActivity(), R.string.change_password_confirmation, ToastUtils.Duration.LONG); refreshAccountDetails(); } } else { <START> showChangePasswordProgressDialog(false); <END> if (event.isError()) { switch (event.error.type) { case SETTINGS_FETCH_ERROR: ToastUtils.showToast(getActivity(), R.string.error_fetch_account_settings, ToastUtils.Duration.LONG); break; case SETTINGS_POST_ERROR: ToastUtils.showToast(getActivity(), R.string.error_post_account_settings, ToastUtils.Duration.LONG); checkIfEmailChangeIsPending(); break; } } else { refreshAccountDetails(); } } }</code><technical_language>Do need hide password change progress dialog here? If understanding this correctly, mChangePasswordProgressDialog null in this case</technical_language>

Target:
public void onAccountChanged(OnAccountChanged event) { if (!isAdded()) { return; } if (mChangePasswordProgressDialog != null) { showChangePasswordProgressDialog(false); if (event.isError()) { ToastUtils.showToast(getActivity(), event.error.message, ToastUtils.Duration.LONG); AppLog.e(T.SETTINGS, event.error.message); } else { ToastUtils.showToast(getActivity(), R.string.change_password_confirmation, ToastUtils.Duration.LONG); refreshAccountDetails(); } } else { if (event.isError()) { switch (event.error.type) { case SETTINGS_FETCH_ERROR: ToastUtils.showToast(getActivity(), R.string.error_fetch_account_settings, ToastUtils.Duration.LONG); break; case SETTINGS_POST_ERROR: ToastUtils.showToast(getActivity(), R.string.error_post_account_settings, ToastUtils.Duration.LONG); checkIfEmailChangeIsPending(); break; } } else { refreshAccountDetails(); } } }
Source:
<code><START> public Constraints add(int index, Actor actor) { <END> return add(index, actor, 0); }</code><technical_language>this return TrackConstraints</technical_language>

Target:
public TrackConstraints add(int index, Actor actor) { return add(index, actor, 0); }
Source:
<code><START> public synchronized byte[] generate(long position) { <END> random.setSeed(seed + position); int randPercent = random.nextInt(100); int curPercent = 0; RandomGeneratorConfig gen = components.get(0); for (RandomGeneratorConfig generator : components) { curPercent += generator.percent(); if (curPercent > randPercent) { gen = generator; break; } } return gen.component().generate(position); }</code><technical_language>need lock for setting seed calling random.nextInt, right? for rest of function avoid holding lock iterating immutable list change calling stuff is threadsafe</technical_language>

Target:
public byte[] generate(long position) { int randPercent; synchronized (random) { random.setSeed(seed + position); randPercent = random.nextInt(100); } int curPercent = 0; RandomComponent com = components.get(0); for (RandomComponent component : components) { curPercent += component.percent(); if (curPercent > randPercent) { com = component; break; } } return com.component().generate(position); }