auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void runOnMainThreadLater(DaemonManager dm, final Runnable r) { if(!CommandHelperPlugin.self.isEnabled()) { <START> throw new CancelCommandException("CommandHelper tried to schedule a task while the plugin was disabled (is the server shutting down?).", Target.UNKNOWN); <END> } Bukkit.getServer().getScheduler().callSyncMethod(CommandHelperPlugin.self, new Callable<Object>() { @Override public Object call() throws Exception { r.run(); return null; } }); }</code><technical_language>Implementation.GetServerType().getBranding() instead of hard coding string "CommandHelper". This applies in places</technical_language>

Target:
public void runOnMainThreadLater(DaemonManager dm, final Runnable r) { if(!CommandHelperPlugin.self.isEnabled()) { throw new CancelCommandException(Implementation.GetServerType().getBranding() + " tried to schedule a task while the plugin was disabled (is the server shutting down?).", Target.UNKNOWN); } Bukkit.getServer().getScheduler().callSyncMethod(CommandHelperPlugin.self, new Callable<Object>() { @Override public Object call() throws Exception { r.run(); return null; } }); }
Source:
<code><START> public <T> CodeWriter writeArray(String delimiter, List<T> l, Function<T, String> map) { <END> if (l.size() == 0) return this; int i = 0; for (; i < l.size() - 1; i++) { write(map.apply(l.get(i)) + delimiter); } write(map.apply(l.get(i))); return this; }</code><technical_language>remove map <T> Stream<String> I people transform List<T> Stream<String> easily java, i.e writeArray(String delimiter, list.stream().map(f));</technical_language>

Target:
public <T> CodeWriter writeArray(String delimiter, List<T> l, Function<T, String> map) { return writeArray(delimiter, l.stream().map(map)); }
Source:
<code>private void initLabel(PatchSetPublishDetail r, String labelName, Panel body) { JsArrayString nativeValues = change.permitted_values(labelName); if (nativeValues == null || nativeValues.length() == 0) { return; } List<String> values = new ArrayList<String>(nativeValues.length()); for (int i = 0; i < nativeValues.length(); i++) { values.add(nativeValues.get(i)); } Collections.reverse(values); LabelInfo label = change.label(labelName); body.add(new SmallHeading(label.name() + ":")); VerticalPanel vp = new VerticalPanel(); vp.setStyleName(Gerrit.RESOURCES.css().approvalCategoryList()); Short prior = null; <START> for (ApprovalInfo app : label.all().asList()) { <END> if (app._account_id() == Gerrit.getUserAccount().getId().get()) { prior = app.value(); break; } } for (String value : values) { ValueRadioButton b = new ValueRadioButton(label, value); SafeHtml buf = new SafeHtmlBuilder().append(b.format()); buf = CommentLinkProcessor.apply(buf); SafeHtml.set(b, buf); if (lastState != null && patchSetId.equals(lastState.patchSetId) && lastState.approvals.containsKey(label.name())) { b.setValue(lastState.approvals.get(label.name()) == value); } else { b.setValue(b.parseValue() == (prior != null ? prior : 0)); } approvalButtons.add(b); vp.add(b); } body.add(vp); }</code><technical_language>This fails compile. I guess Natives.asList(label.all())</technical_language>

Target:
private void initLabel(PatchSetPublishDetail r, String labelName, Panel body) { JsArrayString nativeValues = change.permitted_values(labelName); if (nativeValues == null || nativeValues.length() == 0) { return; } List<String> values = new ArrayList<String>(nativeValues.length()); for (int i = 0; i < nativeValues.length(); i++) { values.add(nativeValues.get(i)); } Collections.reverse(values); LabelInfo label = change.label(labelName); body.add(new SmallHeading(label.name() + ":")); VerticalPanel vp = new VerticalPanel(); vp.setStyleName(Gerrit.RESOURCES.css().approvalCategoryList()); Short prior = null; for (ApprovalInfo app : Natives.asList(label.all())) { if (app._account_id() == Gerrit.getUserAccount().getId().get()) { prior = app.value(); break; } } for (String value : values) { ValueRadioButton b = new ValueRadioButton(label, value); SafeHtml buf = new SafeHtmlBuilder().append(b.format()); buf = CommentLinkProcessor.apply(buf); SafeHtml.set(b, buf); if (lastState != null && patchSetId.equals(lastState.patchSetId) && lastState.approvals.containsKey(label.name())) { b.setValue(lastState.approvals.get(label.name()) == value); } else { b.setValue(b.parseValue() == (prior != null ? prior : 0)); } approvalButtons.add(b); vp.add(b); } body.add(vp); }
Source:
<code>protected GoVisitor buildGoVisitor(@NotNull final ProblemsHolder holder, @NotNull LocalInspectionToolSession session) { return new GoVisitor() { @Override public void visitCompositeLit(@NotNull GoCompositeLit o) { super.visitCompositeLit(o); if (PsiTreeUtil.getParentOfType(o, GoReturnStatement.class, GoShortVarDeclaration.class, GoAssignmentStatement.class) == null) return; GoType type = o.getType(); if (!(type instanceof GoStructType) && !(GoPsiImplUtil.findBaseTypeFromRef(o.getTypeReferenceExpression()) instanceof GoSpecType)) { return; } for (GoElement element : o.getLiteralValue().getElementList()) { if (element.getKey() == null) { <START> holder.registerProblem(o, "Structure has unnamed field initialization", ProblemHighlightType.GENERIC_ERROR_OR_WARNING); <END> return; } } } }; }</code><technical_language>highlight element key instead of composite literal? do think? Also, quickfix useful here? E.g. add key based field order</technical_language>

Target:
protected GoVisitor buildGoVisitor(@NotNull final ProblemsHolder holder, @NotNull LocalInspectionToolSession session) { return new GoVisitor() { @Override public void visitCompositeLit(@NotNull GoCompositeLit o) { super.visitCompositeLit(o); if (PsiTreeUtil.getParentOfType(o, GoReturnStatement.class, GoShortVarDeclaration.class, GoAssignmentStatement.class) == null) return; GoType type = o.getType(); if (!(type instanceof GoStructType) && !(GoPsiImplUtil.findBaseTypeFromRef(o.getTypeReferenceExpression()) instanceof GoSpecType)) { return; } for (GoElement element : o.getLiteralValue().getElementList()) { if (element.getKey() == null) { holder.registerProblem(element, "Unnamed field initialization", ProblemHighlightType.GENERIC_ERROR_OR_WARNING); } } } }; }
Source:
<code>public void testlogAllRefUpdates() throws Exception { long commitTime = 1154236443000L; int tz = -4 * 60; assertTrue(db.getReflogReader(Constants.HEAD).getReverseEntries() .isEmpty()); final FileBasedConfig cfg = db.getConfig(); cfg.setBoolean("core", null, "logallrefupdates", false); cfg.save(); commit("A Commit\n", commitTime, tz); commitTime += 60 * 1000; assertTrue("Reflog for HEAD still contains no entry", db .getReflogReader(Constants.HEAD).getReverseEntries().isEmpty()); cfg.setBoolean("core", null, "logallrefupdates", true); cfg.save(); assertTrue(cfg.get(CoreConfig.KEY).isLogAllRefUpdates()); commit("A Commit\n", commitTime, tz); commitTime += 60 * 1000; <START> assertTrue("Reflog for HEAD should contain one entry", <END> db.getReflogReader(Constants.HEAD).getReverseEntries() .size() == 1); cfg.setBoolean("core", null, "logallrefupdates", false); cfg.save(); assertFalse(cfg.get(CoreConfig.KEY).isLogAllRefUpdates()); commit("A Commit\n", commitTime, tz); assertTrue("Reflog for HEAD should contain two entries", db.getReflogReader(Constants.HEAD).getReverseEntries() .size() == 2); }</code><technical_language>unrelated formatting change</technical_language>

Target:
public void testlogAllRefUpdates() throws Exception { long commitTime = 1154236443000L; int tz = -4 * 60; assertTrue(db.getReflogReader(Constants.HEAD).getReverseEntries() .isEmpty()); final FileBasedConfig cfg = db.getConfig(); cfg.setBoolean("core", null, "logallrefupdates", false); cfg.save(); commit("A Commit\n", commitTime, tz); commitTime += 60 * 1000; assertTrue("Reflog for HEAD still contain no entry", db .getReflogReader(Constants.HEAD).getReverseEntries().isEmpty()); cfg.setBoolean("core", null, "logallrefupdates", true); cfg.save(); assertTrue(cfg.get(CoreConfig.KEY).isLogAllRefUpdates()); commit("A Commit\n", commitTime, tz); commitTime += 60 * 1000; assertTrue( "Reflog for HEAD should contain one entry", db.getReflogReader(Constants.HEAD).getReverseEntries().size() == 1); cfg.setBoolean("core", null, "logallrefupdates", false); cfg.save(); assertFalse(cfg.get(CoreConfig.KEY).isLogAllRefUpdates()); commit("A Commit\n", commitTime, tz); assertTrue( "Reflog for HEAD should contain two entries", db.getReflogReader(Constants.HEAD).getReverseEntries().size() == 2); }
Source:
<code>private void onDebugInitialized(Debugger debugger) { Storage localStorage = Storage.getLocalStorageIfSupported(); if (localStorage == null) { return; } String data = localStorage.getItem(LOCAL_STORAGE_BREAKPOINTS_KEY); if (data == null || data.isEmpty()) { return; } List<BreakpointDto> allDtoBreakpoints = dtoFactory.createListDtoFromJson(data, BreakpointDto.class); for (final BreakpointDto dto : allDtoBreakpoints) { VirtualFileInfo virtualFileInfo = VirtualFileInfo.newBuilder() .setPath(dto.getPath()) .setMediaType(dto.getFileMediaType()) <START> .setProject(new HasProjectConfig() { <END> @Override public ProjectConfigDto getProjectConfig() { return dto.getFileProjectConfig(); } @Override public void setProjectConfig( ProjectConfigDto projectConfig) { } }) .build(); VirtualFile file = new VirtualFileImpl(virtualFileInfo); if (dto.getType() == Type.CURRENT) { doSetCurrentBreakpoint(file, dto.getLineNumber()); } else { addBreakpoint(file, debugger, dto.getLineNumber()); } } }</code><technical_language>Create default implementation of HasProjectConfig iterface</technical_language>

Target:
private void onDebugInitialized(Debugger debugger) { Storage localStorage = Storage.getLocalStorageIfSupported(); if (localStorage == null) { return; } String data = localStorage.getItem(LOCAL_STORAGE_BREAKPOINTS_KEY); if (data == null || data.isEmpty()) { return; } List<BreakpointDto> allDtoBreakpoints = dtoFactory.createListDtoFromJson(data, BreakpointDto.class); for (final BreakpointDto dto : allDtoBreakpoints) { VirtualFileInfo virtualFileInfo = VirtualFileInfo.newBuilder() .setPath(dto.getPath()) .setMediaType(dto.getFileMediaType()) .setProject(new ProjectConfig(dto.getFileProjectConfig())) .build(); VirtualFile file = new VirtualFileImpl(virtualFileInfo); if (dto.getType() == Type.CURRENT) { doSetCurrentBreakpoint(file, dto.getLineNumber()); } else { addBreakpoint(file, debugger, dto.getLineNumber()); } } }
Source:
<code>public DataStore getDataStore() { <START> MetaDataStore metaDataStore = new MetaDataStore(ClassScanner.getAnnotatedClasses(METADATA_STORE_ANNOTATIONS)); <END> QueryEngine sqlQueryEngine = new SQLQueryEngine(metaDataStore, entityManagerFactory); AggregationDataStore aggregationDataStore = new AggregationDataStore(sqlQueryEngine); DataStore jpaStore = new JpaDataStore( () -> entityManagerFactory.createEntityManager(), NonJtaTransaction::new ); return new MultiplexManager(jpaStore, metaDataStore, aggregationDataStore); }</code><technical_language>a default constructor class Scan another constructor allows a set of classes provided</technical_language>

Target:
public DataStore getDataStore() { MetaDataStore metaDataStore = new MetaDataStore(); QueryEngine sqlQueryEngine = new SQLQueryEngine(metaDataStore, entityManagerFactory); AggregationDataStore aggregationDataStore = new AggregationDataStore(sqlQueryEngine); DataStore jpaStore = new JpaDataStore( () -> entityManagerFactory.createEntityManager(), NonJtaTransaction::new ); return new MultiplexManager(jpaStore, metaDataStore, aggregationDataStore); }
Source:
<code>public ActionForward replaceToken(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { Object question = request.getParameter(KFSConstants.QUESTION_INST_ATTRIBUTE_NAME); boolean revokeOldToken; if (ObjectUtils.isNull(question)) { <START> if (getConcurAccessTokenService().currentAccessTokenExists()) { <END> String questionText = getConfigurationService().getPropertyValueAsString(ConcurKeyConstants.MESSAGE_CONCUR_TOKEN_REPLACE_QUESTION); return performQuestionWithoutInput(mapping, form, request, response, ConcurConstants.REPLACE_ACCESS_TOKEN_QUESTION, questionText, KFSConstants.CONFIRMATION_QUESTION, ConcurConstants.REPLACE_TOKEN_METHOD_TO_CALL, StringUtils.EMPTY); } else { revokeOldToken = false; } } else { Object buttonClicked = request.getParameter(KFSConstants.QUESTION_CLICKED_BUTTON); revokeOldToken = userClickedYes(buttonClicked); } if (revokeOldToken) { getConcurAccessTokenService().revokeAndReplaceAccessToken(); GlobalVariables.getMessageMap().putInfo(KFSConstants.GLOBAL_MESSAGES, ConcurKeyConstants.MESSAGE_CONCUR_TOKEN_REVOKE_AND_REPLACE_SUCCESS); } else { getConcurAccessTokenService().requestNewAccessToken(); GlobalVariables.getMessageMap().putInfo(KFSConstants.GLOBAL_MESSAGES, ConcurKeyConstants.MESSAGE_CONCUR_TOKEN_REPLACE_SUCCESS); } return mapping.findForward(KFSConstants.MAPPING_BASIC); }</code><technical_language>Do want give user option request a new access token revoking one? is revoked in case? leaving access token longer controlling</technical_language>

Target:
public ActionForward replaceToken(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { if (getConcurAccessTokenService().currentAccessTokenExists()) { getConcurAccessTokenService().revokeAndReplaceAccessToken(); GlobalVariables.getMessageMap().putInfo(KFSConstants.GLOBAL_MESSAGES, ConcurKeyConstants.MESSAGE_CONCUR_TOKEN_REVOKE_AND_REPLACE_SUCCESS); } else { getConcurAccessTokenService().requestNewAccessToken(); GlobalVariables.getMessageMap().putInfo(KFSConstants.GLOBAL_MESSAGES, ConcurKeyConstants.MESSAGE_CONCUR_TOKEN_REPLACE_SUCCESS); } return mapping.findForward(KFSConstants.MAPPING_BASIC); }
Source:
<code>private void showCheckBoxes(List<T> seletedItems) { for (Entry<T, CheckBox> currentEntry : checkBoxes.entrySet()) { wrapperPanel.add(currentEntry.getValue()); if (seletedItems.contains(currentEntry.getKey())) { <START> currentEntry.getValue().setValue(true, false); <END> } } }</code><technical_language>simply do currentEntry.getValue().setValue(true)</technical_language>

Target:
private void showCheckBoxes(List<T> seletedItems) { for (Entry<T, CheckBox> currentEntry : checkBoxes.entrySet()) { wrapperPanel.add(currentEntry.getValue()); if (seletedItems.contains(currentEntry.getKey())) { currentEntry.getValue().setValue(true); } } }
Source:
<code>boolean validateComitter(Job job){ String ignoreComitters = job.getIgnoreComitters(); if(ignoreComitters.isEmpty()){ return true; } else{ <START> String[] ignoreComitterList = job.getIgnoreComitters().toLowerCase().split(","); <END> CommitRequest commitRequest = new CommitRequest.Builder( repository, refChange.getToHash()).build(); String author = commitService.getCommit(commitRequest).getAuthor().getName(); boolean authorIgnored = Arrays.stream(ignoreComitterList).anyMatch(t -> t.equals(author.toLowerCase())); return !authorIgnored; } }</code><technical_language>Unfortunately, Bitbucket usernames commas in them. In fact, usernames characters newlines work. recommend splitting newlines instead</technical_language>

Target:
boolean validateComitter(Job job){ String ignoreComitters = job.getIgnoreComitters(); if(ignoreComitters.isEmpty()){ return true; } else{ String[] ignoreComitterList = job.getIgnoreComitters().toLowerCase().split("\\r?\\n"); CommitRequest commitRequest = new CommitRequest.Builder( repository, refChange.getToHash()).build(); String author = commitService.getCommit(commitRequest).getAuthor().getName(); boolean authorIgnored = Arrays.stream(ignoreComitterList).anyMatch(t -> t.equals(author.toLowerCase())); return !authorIgnored; } }
Source:
<code><START> public static <END> TransferDiskImageParameters createInitParams(DiskImage diskImage) { TransferDiskImageParameters parameters = new TransferDiskImageParameters(); parameters.setTransferType(TransferType.Download); parameters.setImageGroupID(diskImage.getId()); String fileExtension = diskImage.getVolumeFormat() == VolumeFormat.COW ? ".qcow2" : ".raw"; parameters.setDownloadFilename(diskImage.getDiskAlias() + fileExtension); parameters.setTransferSize(diskImage.getActualSizeInBytes()); parameters.setTransferringViaBrowser(true); return parameters; }</code><technical_language>worth doing, usage is "DownloadImageManager" (that is in package), is remove "public"</technical_language>

Target:
static TransferDiskImageParameters createInitParams(DiskImage diskImage) { TransferDiskImageParameters parameters = new TransferDiskImageParameters(); parameters.setTransferType(TransferType.Download); parameters.setImageGroupID(diskImage.getId()); String fileExtension = diskImage.getVolumeFormat() == VolumeFormat.COW ? ".qcow2" : ".raw"; parameters.setDownloadFilename(diskImage.getDiskAlias() + fileExtension); parameters.setTransferSize(diskImage.getActualSizeInBytes()); parameters.setTransferringViaBrowser(true); return parameters; }
Source:
<code>public void onSuccess(final LoginResult loginResult) { GraphRequest request = GraphRequest.newMeRequest( loginResult.getAccessToken(), new GraphRequest.GraphJSONObjectCallback() { @Override public void onCompleted(JSONObject object, GraphResponse response) { FacebookRequestError requestError = response.getError(); if (requestError != null) { Log.e(TAG, "Received Facebook error: " + requestError.getErrorMessage()); onFailure(new Bundle()); return; } if (object == null) { Log.w(TAG, "Received null response from Facebook GraphRequest"); onFailure(new Bundle()); } else { try { String email = object.getString("email"); <START> FacebookProvider.this.onSuccess(email, loginResult); <END> } catch (JSONException e) { Log.e(TAG, "JSON Exception reading from Facebook GraphRequest", e); onFailure(new Bundle()); } } } }); Bundle parameters = new Bundle(); parameters.putString("fields", "id,name,email"); request.setParameters(parameters); request.executeAsync(); }</code><technical_language>reason this branch FacebookProvider.this failure branch not</technical_language>

Target:
public void onSuccess(final LoginResult loginResult) { GraphRequest request = GraphRequest.newMeRequest( loginResult.getAccessToken(), new GraphRequest.GraphJSONObjectCallback() { @Override public void onCompleted(JSONObject object, GraphResponse response) { FacebookRequestError requestError = response.getError(); if (requestError != null) { Log.e(TAG, "Received Facebook error: " + requestError.getErrorMessage()); onFailure(new Bundle()); return; } if (object == null) { Log.w(TAG, "Received null response from Facebook GraphRequest"); onFailure(new Bundle()); } else { try { String email = object.getString("email"); onSuccess(email, loginResult); } catch (JSONException e) { Log.e(TAG, "JSON Exception reading from Facebook GraphRequest", e); onFailure(new Bundle()); } } } }); Bundle parameters = new Bundle(); parameters.putString("fields", "id,name,email"); request.setParameters(parameters); request.executeAsync(); }
Source:
<code>public static IProject getLastActiveEditorProject() { final IEditorPart editor = getLastActiveEditor(); if (editor == null) return null; final IEditorInput editorInput = editor.getEditorInput(); if (editorInput instanceof IFileEditorInput) { final IFileEditorInput input = (IFileEditorInput) editorInput; return input.getFile().getProject(); } else if (editorInput instanceof URIEditorInput) { final URI uri = ((URIEditorInput) editorInput).getURI(); if (uri.isPlatformResource()) { <START> final String segment = uri.segment(1); <END> final IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(segment); if (project.exists()) { return project; } } } return null; }</code><technical_language>if segment(1) is project name. This is map URI IFile in other places if(uri.isPlatformResource()) { String platformString = uri.toPlatformString(true); return ResourcesPlugin.getWorkspace().getRoot().findMember(platformString).getProject(); }</technical_language>

Target:
public static IProject getLastActiveEditorProject() { final IEditorPart editor = getLastActiveEditor(); if (editor == null) return null; final IEditorInput editorInput = editor.getEditorInput(); if (editorInput instanceof IFileEditorInput) { final IFileEditorInput input = (IFileEditorInput) editorInput; return input.getFile().getProject(); } else if (editorInput instanceof URIEditorInput) { final URI uri = ((URIEditorInput) editorInput).getURI(); if (uri.isPlatformResource()) { final String platformString = uri.toPlatformString(true); return ResourcesPlugin.getWorkspace().getRoot().findMember(platformString).getProject(); } } return null; }
Source:
<code>public HdfsDataInputSource( DataInputSourceId id, FSDataInputStream inputStream, long size) { this.id = requireNonNull(id, "id is null"); this.inputStream = requireNonNull(inputStream, "inputStream is null"); <START> this.size = requireNonNull(size, "size is null"); <END> }</code><technical_language>nan</technical_language>

Target:
public HdfsDataInputSource( DataInputSourceId id, FSDataInputStream inputStream, long size) { this.id = requireNonNull(id, "id is null"); this.inputStream = requireNonNull(inputStream, "inputStream is null"); this.size = size; }
Source:
<code>private ObjectId insertMergeResult(MergeResult<RawText> result) throws IOException { TemporaryBuffer.LocalFile buf = new TemporaryBuffer.LocalFile( db != null ? nonNullRepo().getDirectory() : null, <START> inCoreLimit << 20); <END> try { new MergeFormatter().formatMerge(buf, result, Arrays.asList(commitNames), CHARACTER_ENCODING); buf.close(); try (InputStream in = buf.openInputStream()) { return getObjectInserter().insert(OBJ_BLOB, buf.length(), in); } } finally { buf.destroy(); } }</code><technical_language>inCoreLimit here. convert units MiBs</technical_language>

Target:
private ObjectId insertMergeResult(MergeResult<RawText> result) throws IOException { TemporaryBuffer.LocalFile buf = new TemporaryBuffer.LocalFile( db != null ? nonNullRepo().getDirectory() : null, inCoreLimit); try { new MergeFormatter().formatMerge(buf, result, Arrays.asList(commitNames), CHARACTER_ENCODING); buf.close(); try (InputStream in = buf.openInputStream()) { return getObjectInserter().insert(OBJ_BLOB, buf.length(), in); } } finally { buf.destroy(); } }
Source:
<code>WindowsShareCopyConfig(String netBiosDomainName, String netBiosHostname, String netBiosUsername, String netBiosPassword, String netBiosSharename, String sourceDirectory, String destinationDirectory, Integer bufferSize, Integer numThreads, String overwrite) { this.netBiosDomainName = netBiosDomainName; this.netBiosHostname = netBiosHostname; this.netBiosUsername = netBiosUsername; this.netBiosPassword = netBiosPassword; this.netBiosSharename = netBiosSharename; this.sourceDirectory = sourceDirectory; this.destinationDirectory = destinationDirectory; <START> this.bufferSize = (bufferSize == null) && (bufferSize < MIN_BUFFER_SIZE) ? MIN_BUFFER_SIZE : bufferSize; <END> this.numThreads = (numThreads == null) && (numThreads < MIN_NUM_THREADS) ? MIN_NUM_THREADS : numThreads; this.overwrite = !("false".equals(overwrite)); }</code><technical_language>this means ? part of && is checking buffersize == null && if null right hand side evaluated camping null < MIN_BUFFER_SIZE</technical_language>

Target:
WindowsShareCopyConfig(String netBiosDomainName, String netBiosHostname, String netBiosUsername, String netBiosPassword, String netBiosSharename, String sourceDirectory, String destinationDirectory, Integer bufferSize, Integer numThreads, String overwrite) { this.netBiosDomainName = netBiosDomainName; this.netBiosHostname = netBiosHostname; this.netBiosUsername = netBiosUsername; this.netBiosPassword = netBiosPassword; this.netBiosSharename = netBiosSharename; this.sourceDirectory = sourceDirectory; this.destinationDirectory = destinationDirectory; this.bufferSize = bufferSize; this.numThreads = numThreads; this.overwrite = !("false".equals(overwrite)); }
Source:
<code>public SpringSecurityPasswordEncoder(final org.springframework.security.crypto.password.PasswordEncoder delegate) { <START> this.delegate = delegate; <END> }</code><technical_language>add a CommonHelper.assertNotNull("delegate", delegate); check</technical_language>

Target:
public SpringSecurityPasswordEncoder(final org.springframework.security.crypto.password.PasswordEncoder delegate) { CommonHelper.assertNotNull("delegate", delegate); this.delegate = delegate; }
Source:
<code>public void testCallPublicMethodWithUUIDParams(String containerType, String endpoint) { <START> UUID value = UUID.randomUUID(); <END> performActionForUUID(containerType, endpoint, PUBLIC_WITH_UUID_PARAM_ACTION, value, new Param(PARAM_NAME, value)); }</code><technical_language>final</technical_language>

Target:
public void testCallPublicMethodWithUUIDParams(String containerType, String endpoint) { final UUID value = UUID.randomUUID(); performActionForUUID(containerType, endpoint, PUBLIC_WITH_UUID_PARAM_ACTION, value, new Param(PARAM_NAME, value)); }
Source:
<code>public String getTheme() { <START> return mSharedPreferences.getString(Pref.THEME, "light"); <END> }</code><technical_language>Please put "dark" "light" public static final..</technical_language>

Target:
public String getTheme() { return mSharedPreferences.getString(Pref.THEME, Pref.Theme.LIGHT); }
Source:
<code>private static byte[] withCorrectBlockSize(final byte[] key) { if (key.length != CcAes.BLOCK) { throw new IllegalArgumentException( String.format( <START> "the length of the AES key must be exactly %d asBytes", <END> CcAes.BLOCK ) ); } return key; }</code><technical_language>@iinozemtsev This text changed</technical_language>

Target:
private static byte[] withCorrectBlockSize(final byte[] key) { if (key.length != CcAes.BLOCK) { throw new IllegalArgumentException( String.format( "the length of the AES key must be exactly %d bytes", CcAes.BLOCK ) ); } return key; }
Source:
<code>private Object getBuildConfigValue(Context context, String fieldName) { try { Class<?> clazz = Class.forName(context.getPackageName() + ".BuildConfig"); Field field = clazz.getField(fieldName); return field.get(null); } catch (ClassNotFoundException e) { <START> e.printStackTrace(); <END> } catch (NoSuchFieldException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } return null; }</code><technical_language>replace SalesforceSDKLogger.e(...) calls</technical_language>

Target:
private Object getBuildConfigValue(Context context, String fieldName) { try { Class<?> clazz = Class.forName(context.getPackageName() + ".BuildConfig"); Field field = clazz.getField(fieldName); return field.get(null); } catch (ClassNotFoundException e) { SalesforceSDKLogger.e(TAG, "getBuildConfigValue failed", e); } catch (NoSuchFieldException e) { SalesforceSDKLogger.e(TAG, "getBuildConfigValue failed", e); } catch (IllegalAccessException e) { SalesforceSDKLogger.e(TAG, "getBuildConfigValue failed", e); } return null; }
Source:
<code>private boolean verify(HttpServletRequest req, HttpServletResponseWrapper rsp) throws IOException { <START> if (!authConfig.isTrustContainerAuth()) <END> return true; final String username = req.getRemoteUser(); final AccountState who = accountCache.getByUsername(username); if (who == null || ! who.getAccount().isActive()) { rsp.sendError(SC_UNAUTHORIZED); return false; } session.get().setUserAccountId(who.getAccount().getId()); return true; }</code><technical_language>Style nit: brackets for single statement ifs</technical_language>

Target:
private boolean verify(HttpServletRequest req, HttpServletResponseWrapper rsp) throws IOException { final String username = req.getRemoteUser(); final AccountState who = (username == null) ? null : accountCache.getByUsername(username); if (who == null || !who.getAccount().isActive()) { rsp.sendError(SC_UNAUTHORIZED); return false; } session.get().setUserAccountId(who.getAccount().getId()); return true; }
Source:
<code>public static SpectraUser createUser(final Ds3Client client, final String username) throws IOException { <START> DelegateCreateUserSpectraS3Response response <END> = client.delegateCreateUserSpectraS3(new DelegateCreateUserSpectraS3Request(username)); return response.getSpectraUserResult(); }</code><technical_language>Missing final</technical_language>

Target:
public static SpectraUser createUser(final Ds3Client client, final String username) throws IOException { final DelegateCreateUserSpectraS3Response response = client.delegateCreateUserSpectraS3(new DelegateCreateUserSpectraS3Request(username)); return response.getSpectraUserResult(); }
Source:
<code>public void edit(final GridBodyCellEditContext context) { if (readOnly) { <START> return; <END> } if (!isEditingMode) { factory.attachDomElement(context, (e) -> { e.getWidget().setText(getTitle()); if (e instanceof ScenarioHeaderTextAreaDOMElement) { ((ScenarioHeaderTextAreaDOMElement) e).setScenarioHeaderMetaData(this); } }, (e) -> e.getWidget().setFocus(true)); isEditingMode = true; } }</code><technical_language>@jomarko @manstis @ederign reason I throw exception is method invoked if readOnly flag is true, control caller code **before** invoking this one. Wording differently, is meant raise exception developer aware is error in flow. Replacing "return" "hide" error of implementations. Please restore exception eventually manage needed</technical_language>

Target:
public void edit(final GridBodyCellEditContext context) { if (readOnly) { throw new IllegalStateException("A read only header cannot be edited"); } if (!isEditingMode) { factory.attachDomElement(context, (e) -> { e.getWidget().setText(getTitle()); if (e instanceof ScenarioHeaderTextAreaDOMElement) { ((ScenarioHeaderTextAreaDOMElement) e).setScenarioHeaderMetaData(this); } }, (e) -> e.getWidget().setFocus(true)); isEditingMode = true; } }
Source:
<code>public void innerStaticInGenericType() throws Exception { Method staticInGeneric = getClass().getDeclaredMethod("testNestedNonGeneric"); TypeName.get(staticInGeneric.getReturnType()); <START> TypeName.get(staticInGeneric.getGenericReturnType()); <END> }</code><technical_language>Filed <LINK_0></technical_language>

Target:
@Test public void innerStaticInGenericType() throws Exception { Method staticInGeneric = getClass().getDeclaredMethod("testNestedNonGeneric"); TypeName.get(staticInGeneric.getReturnType()); TypeName typeName = TypeName.get(staticInGeneric.getGenericReturnType()); assertThat(typeName.toString()).doesNotContain("<"); }
Source:
<code>protected void doExecute() { BasicCompartment compartmentComment = helper.getStereotypeCompartment(appliedStereotypeComment, originalCompartment.getElement()); if (helper.isStereotypeCompartment(originalCompartment)) { if (compartmentComment == null) { boolean visibility = !isCommentEmpty((BasicCompartment) originalCompartment); BasicCompartment compartmentCopy = EcoreUtil.copy((BasicCompartment) originalCompartment); compartmentCopy.setVisible(visibility); ViewUtil.insertChildView(appliedStereotypeComment, compartmentCopy, ViewUtil.APPEND, true); } else { } } else { if (compartmentComment != null) { <START> Activator.log.warn("The Node " + compartmentComment.toString() + " : wouldn't exist"); <END> } } }</code><technical_language>Messages.format(String,String....)</technical_language>

Target:
protected void doExecute() { BasicCompartment compartmentComment = helper.getStereotypeCompartment(appliedStereotypeComment, originalCompartment.getElement()); if (helper.isStereotypeCompartment(originalCompartment)) { if (compartmentComment == null) { boolean visibility = !isCommentEmpty((BasicCompartment) originalCompartment); BasicCompartment compartmentCopy = EcoreUtil.copy((BasicCompartment) originalCompartment); compartmentCopy.setVisible(visibility); ViewUtil.insertChildView(appliedStereotypeComment, compartmentCopy, ViewUtil.APPEND, true); } } }
Source:
<code>private Object tryFindValue(String expr, Class asType) throws OgnlException { Object value = null; try { expr = lookupForOverrides(expr); value = getValue(expr, asType); if (value == null) { value = findInContext(expr); <START> final XWorkConverter conv = ((Container)getContext().get(ActionContext.CONTAINER)).getInstance(XWorkConverter.class); <END> return conv.convertValue(getContext(), value, asType); } } finally { context.remove(THROW_EXCEPTION_ON_FAILURE); } return value; }</code><technical_language>do for Converter instead of @Inject it? inject java private XWorkConverter conv; @Inject public void setXWorkConverter(XWorkConverter conv) { this.conv = conv; }</technical_language>

Target:
private Object tryFindValue(String expr, Class asType) throws OgnlException { Object value = null; try { expr = lookupForOverrides(expr); value = getValue(expr, asType); if (value == null) { value = findInContext(expr); return converter.convertValue(getContext(), value, asType); } } finally { context.remove(THROW_EXCEPTION_ON_FAILURE); } return value; }
Source:
<code>public void setNum(UniqueID id) { if (uID.equals(id)) { return; } try { boolean fullReset = uID.pokeNum != id.pokeNum; uID = id; if (fullReset) { nick = PokemonInfo.name(id); shiny = false; item = 15; } if (id.pokeNum == 487) { item = (short) (id.subNum == 1 ? 213 : 15); } else if (id.pokeNum == 493) { item = id.subNum != 0 ? ItemInfo.plateForType(id.subNum) : 15; } else if (id.pokeNum == 773) { item = id.subNum != 0 ? ItemInfo.memoryChipForType(id.subNum) : 15; } if (fullReset) { gender = 1; nature = 0; } if (gen.num > 2) { ability = PokemonInfo.abilities(id, gen.num)[0]; } if (fullReset) { happiness = 0; <START> hiddenPowerType = 16; <END> level = 100; moves[0] = new TeamMove(0); moves[1] = new TeamMove(0); moves[2] = new TeamMove(0); moves[3] = new TeamMove(0); if (gen.num > 2) { DVs[0] = DVs[1] = DVs[2] = DVs[3] = DVs[4] = DVs[5] = 31; } else { DVs[0] = DVs[1] = DVs[2] = DVs[3] = DVs[4] = DVs[5] = 15; } if (gen.num > 2) { EVs[0] = EVs[1] = EVs[2] = EVs[3] = EVs[4] = EVs[5] = 0; } else { EVs[0] = EVs[1] = EVs[2] = EVs[3] = EVs[4] = EVs[5] = (byte) 252; } } } catch (Exception e) { reset(); } }</code><technical_language>enum</technical_language>

Target:
public void setNum(UniqueID id) { if (uID.equals(id)) { return; } try { boolean fullReset = uID.pokeNum != id.pokeNum; uID = id; if (fullReset) { nick = PokemonInfo.name(id); shiny = false; item = 15; } if (id.pokeNum == 487) { item = (short) (id.subNum == 1 ? 213 : 15); } else if (id.pokeNum == 493) { item = id.subNum != 0 ? ItemInfo.plateForType(id.subNum) : 15; } else if (id.pokeNum == 773) { item = id.subNum != 0 ? ItemInfo.memoryChipForType(id.subNum) : 15; } if (fullReset) { gender = 1; nature = 0; } if (gen.num > 2) { ability = PokemonInfo.abilities(id, gen.num)[0]; } if (fullReset) { happiness = 0; hiddenPowerType = (byte)TypeInfo.Type.Dark.ordinal(); level = 100; moves[0] = new TeamMove(0); moves[1] = new TeamMove(0); moves[2] = new TeamMove(0); moves[3] = new TeamMove(0); if (gen.num > 2) { DVs[0] = DVs[1] = DVs[2] = DVs[3] = DVs[4] = DVs[5] = 31; } else { DVs[0] = DVs[1] = DVs[2] = DVs[3] = DVs[4] = DVs[5] = 15; } if (gen.num > 2) { EVs[0] = EVs[1] = EVs[2] = EVs[3] = EVs[4] = EVs[5] = 0; } else { EVs[0] = EVs[1] = EVs[2] = EVs[3] = EVs[4] = EVs[5] = (byte) 252; } } } catch (Exception e) { reset(); } }
Source:
<code>private void onError(Throwable t) { try { <START> session.onError(t).get(5, TimeUnit.MINUTES); <END> } catch (Exception e) { } }</code><technical_language>do a 5 minute timeout? pull this out a constant</technical_language>

Target:
private void onError(Throwable t) { try { session.onError(t).get(DEFAULT_CLOSE_WAIT_IN_MILLIS, TimeUnit.MILLISECONDS); } catch (Exception e) { } }
Source:
<code>public void run() { debug(String.format("Thread %s is starting new connection", getName())); Session prevSession; while(!closed()) { prevSession = session; session = server.getNextSession(session); if (session == null) close(); if (closed()) break; if (session != prevSession) { initializeForSession(); } try { long timeStart = System.currentTimeMillis(); switch (session.state) { case Session.INIT: sessionInitialState(); if (session == null) break; case Session.ATTEXC: case Session.SECACC: case Session.CHKSEC: long currentTimeSlice; do { try { processCommands(); } catch (DRDASocketTimeoutException ste) { } currentTimeSlice = getTimeSlice(); } while ((currentTimeSlice <= 0) || (System.currentTimeMillis() - timeStart < currentTimeSlice)); break; default: agentError("Session in invalid state:" + session.state); } } catch (Exception e) { if (e instanceof DRDAProtocolException && ((DRDAProtocolException)e).isDisconnectException()) { debug("client went away"); closeSession(); } else { handleException(e); } } catch (Error error) { try { <START> debug("encountered error " + error.getMessage()); <END> error.printStackTrace(server.logWriter); closeSession(); } catch (Throwable t) { try { session.clientSocket.close(); } catch (IOException ioe) { } } finally { throw error; } } } debug(String.format("Ending connection thread %s", getName())); server.removeThread(this); }</code><technical_language>LOG.debug(message, error). print error.getMessage() stack trace</technical_language>

Target:
public void run() { if(LOG.isDebugEnabled()) { LOG.debug(String.format("Thread %s is starting new connection", getName())); } Session prevSession; while(!closed()) { prevSession = session; session = server.getNextSession(session); if (session == null) close(); if (closed()) break; if (session != prevSession) { initializeForSession(); } try { long timeStart = System.currentTimeMillis(); switch (session.state) { case Session.INIT: sessionInitialState(); if (session == null) break; case Session.ATTEXC: case Session.SECACC: case Session.CHKSEC: long currentTimeSlice; do { try { processCommands(); } catch (DRDASocketTimeoutException ste) { } currentTimeSlice = getTimeSlice(); } while ((currentTimeSlice <= 0) || (System.currentTimeMillis() - timeStart < currentTimeSlice)); break; default: agentError("Session in invalid state:" + session.state); } } catch (Exception e) { if (e instanceof DRDAProtocolException && ((DRDAProtocolException)e).isDisconnectException()) { if(LOG.isDebugEnabled()) { LOG.debug("client went away"); } closeSession(); } else { handleException(e); } } catch (Error error) { try { if(LOG.isDebugEnabled()) { LOG.debug("encountered error", error); } error.printStackTrace(server.logWriter); closeSession(); } catch (Throwable t) { try { session.clientSocket.close(); } catch (IOException ioe) { } } finally { throw error; } } } if(LOG.isDebugEnabled()) { LOG.debug(String.format("Ending connection thread %s", getName())); } server.removeThread(this); }
Source:
<code>public LockFactory createLockFactory(File indexDir, Properties dirConfiguration) { String defaultStrategy = indexDir == null ? "single" : "native"; String lockFactoryName = dirConfiguration.getProperty( Environment.LOCKING_STRATEGY, defaultStrategy ); if ( "simple".equals( lockFactoryName ) ) { if ( indexDir == null ) { <START> throw new SearchException( "To use \"simple\" as a LockFactory strategy an indexBase path must be set" ); <END> } return new SimpleFSLockFactory( indexDir ); } else if ( "native".equals( lockFactoryName ) ) { if ( indexDir == null ) { throw new SearchException( "To use \"native\" as a LockFactory strategy an indexBase path must be set" ); } return new NativeFSLockFactory( indexDir ); } else if ( "single".equals( lockFactoryName ) ) { return new SingleInstanceLockFactory(); } else if ( "none".equals( lockFactoryName ) ) { return NoLockFactory.getNoLockFactory(); } else { LockFactoryProvider lockFactoryFactory = ClassLoaderHelper.instanceFromName( LockFactoryProvider.class, lockFactoryName, Environment.LOCKING_STRATEGY, serviceManager ); return lockFactoryFactory.createLockFactory( indexDir, dirConfiguration ); } }</code><technical_language>JBoss logger</technical_language>

Target:
public LockFactory createLockFactory(File indexDir, Properties dirConfiguration) { String defaultStrategy = indexDir == null ? "single" : "native"; String lockFactoryName = dirConfiguration.getProperty( Environment.LOCKING_STRATEGY, defaultStrategy ); if ( "simple".equals( lockFactoryName ) ) { if ( indexDir == null ) { throw LOG.indexBasePathRequiredForLockingStrategy( "simple" ); } return new SimpleFSLockFactory( indexDir ); } else if ( "native".equals( lockFactoryName ) ) { if ( indexDir == null ) { throw LOG.indexBasePathRequiredForLockingStrategy( "native" ); } return new NativeFSLockFactory( indexDir ); } else if ( "single".equals( lockFactoryName ) ) { return new SingleInstanceLockFactory(); } else if ( "none".equals( lockFactoryName ) ) { return NoLockFactory.getNoLockFactory(); } else { LockFactoryProvider lockFactoryFactory = ClassLoaderHelper.instanceFromName( LockFactoryProvider.class, lockFactoryName, Environment.LOCKING_STRATEGY, serviceManager ); return lockFactoryFactory.createLockFactory( indexDir, dirConfiguration ); } }
Source:
<code>private String buildMessage(int from, int to, int total) { if (total > 0) { return messages.fromIndexToIndexOfTotalCount(from, to, total); <START> } else { <END> return messages.fromIndexToIndex(from, to); } }</code><technical_language>removed</technical_language>

Target:
private String buildMessage(int from, int to, int total) { if (total > 0) { return messages.fromIndexToIndexOfTotalCount(from, to, total); } return messages.fromIndexToIndex(from, to); }
Source:
<code>public void handle(PodEvent event) { final String podName = event.getPodName(); try { for (Entry<String, KubernetesMachineImpl> entry : machines.getMachines(getContext().getIdentity()).entrySet()) { final KubernetesMachineImpl machine = entry.getValue(); <START> if (podName.startsWith(machine.getPodName())) { <END> eventPublisher.sendMachineLogEnvent( entry.getKey(), event.getMessage(), event.getCreationTimeStamp(), getContext().getIdentity()); return; } } } catch (InfrastructureException e) { LOG.error("Error while machine fetching for logs publishing. Cause: {}", e.getMessage()); } }</code><technical_language><LINK_0> I equals fine here. Correct if wrong. Sorry, if clear beginning</technical_language>

Target:
public void handle(PodEvent event) { final String podName = event.getPodName(); try { for (Entry<String, KubernetesMachineImpl> entry : machines.getMachines(getContext().getIdentity()).entrySet()) { final KubernetesMachineImpl machine = entry.getValue(); if (machine.getPodName().equals(podName)) { eventPublisher.sendMachineLogEnvent( entry.getKey(), event.getMessage(), event.getCreationTimeStamp(), getContext().getIdentity()); return; } } } catch (InfrastructureException e) { LOG.error("Error while machine fetching for logs publishing. Cause: {}", e.getMessage()); } }
Source:
<code>private void thawVm() { if (!shouldFreezeOrThawVm()) { return; } VDSReturnValue returnValue = null; boolean allowInconsistent = Config.<Boolean>getValue(ConfigValues.LiveSnapshotAllowInconsistent); try { returnValue = runVdsCommand(VDSCommandType.Thaw, new VdsAndVmIDVDSParametersBase( getVds().getId(), getVmId())); } catch (EngineException e) { <START> if (!allowInconsistent) { <END> handleThawVmFailure(e); return; } } if (returnValue != null && !returnValue.getSucceeded() && allowInconsistent) { handleThawVmFailure(new EngineException(EngineError.thawErr)); } }</code><technical_language>do want restrict it? error messsage is harmless alter flow</technical_language>

Target:
private void thawVm() { if (!shouldFreezeOrThawVm()) { return; } VDSReturnValue returnValue = null; boolean allowInconsistent = Config.<Boolean>getValue(ConfigValues.LiveSnapshotAllowInconsistent); try { returnValue = runVdsCommand(VDSCommandType.Thaw, new VdsAndVmIDVDSParametersBase( getVds().getId(), getVmId())); } catch (EngineException e) { if (!allowInconsistent) { handleThawVmFailure(e); return; } } if (returnValue != null && !returnValue.getSucceeded() && !allowInconsistent) { handleThawVmFailure(new EngineException(EngineError.thawErr)); } }
Source:
<code>private void waitMasterHandover(final Entity oldMaster, final Entity newMaster) { boolean masterChanged = Repeater.create() .backoff(Duration.millis(500), 1.2, Duration.FIVE_SECONDS) .limitTimeTo(Duration.ONE_MINUTE) .until(new Callable<Boolean>() { @Override public Boolean call() throws Exception { Entity master = getMasterNode(); <START> return master != oldMaster && master != null; <END> } }) .run(); if (!masterChanged) { LOG.warn("Timeout waiting for node to become master: " + newMaster + "."); } }</code><technical_language>I this is safe (because get dynamic proxy), prefer a .equals() Objects.equal() ==</technical_language>

Target:
private void waitMasterHandover(final Entity oldMaster, final Entity newMaster) { boolean masterChanged = Repeater.create() .backoff(Duration.millis(50), 1.5, Duration.FIVE_SECONDS) .limitTimeTo(Duration.ONE_MINUTE) .until(new Callable<Boolean>() { @Override public Boolean call() throws Exception { Entity master = getMasterNode(); return !Objects.equal(master, oldMaster) && master != null; } }) .run(); if (!masterChanged) { LOG.warn("Timeout waiting for node to become master: " + newMaster + "."); } }
Source:
<code>public void removeViewInLayout(@NonNull View view) { <START> if (view.getAnimation() != null || (mTransitioningFragmentViews != <END> null && mTransitioningFragmentViews.contains(view))) { addDisappearingFragmentView(view); } super.removeViewInLayout(view); }</code><technical_language>this part factored out is in overrides</technical_language>

Target:
public void removeViewInLayout(@NonNull View view) { if (view != mHoldView) { addDisappearingFragmentView(view); super.removeViewInLayout(view); } }
Source:
<code>public <T> T setupClient(BiFunction<String, String, T> clientBuilder) { <START> if (ImplUtils.isNullOrEmpty(azureStorageConnectionString) || ImplUtils.isNullOrEmpty(azureStorageFileEndpoint)) { <END> logger.asWarning().log("Connection string and endpoint must be set to build the testing client"); fail(); return null; } return clientBuilder.apply(azureStorageConnectionString, azureStorageFileEndpoint); }</code><technical_language>PR validation tests failing is playback dummy values, issue PRs initially well. Check playback status if is playback dummy values put in</technical_language>

Target:
public <T> T setupClient(BiFunction<String, String, T> clientBuilder) { if (ImplUtils.isNullOrEmpty(azureStorageConnectionString) && ImplUtils.isNullOrEmpty(azureStorageFileEndpoint)) { logger.asWarning().log("Connection string and endpoint must be set to build the testing client"); fail(); return null; } return clientBuilder.apply(azureStorageConnectionString, azureStorageFileEndpoint); }