auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void addSegment(File indexDir, IndexLoadingConfig indexLoadingConfig) throws Exception { super.addSegment(indexDir, indexLoadingConfig); try { loadLookupTable(); <START> _logger.info("Successfully loaded lookup table for {}", getTableName()); <END> } catch (Exception e) { throw new RuntimeException( String.format("Error loading lookup table: %s", getTableName()),e); } }</code><technical_language>(nit) suggestion _logger.info("Successfully loaded lookup table: {}", getTableName());</technical_language>

Target:
public void addSegment(File indexDir, IndexLoadingConfig indexLoadingConfig) throws Exception { super.addSegment(indexDir, indexLoadingConfig); try { loadLookupTable(); _logger.info("Successfully added segment and loaded lookup table: {}", indexDir.getName(), getTableName()); } catch (Exception e) { throw new RuntimeException(String.format("Error loading lookup table: %s", getTableName()), e); } }
Source:
<code>public static String sepConvBlock(ComputationGraphConfiguration.GraphBuilder graphBuilder, int filters, int kernelSize, int stride, String blockId, String input) { String prefix = "sepConvBlock"+blockId; graphBuilder .addLayer(prefix+"_act", new ActivationLayer(Activation.RELU), input) .addLayer(prefix+"_sepconv1", new SeparableConvolution2D.Builder(kernelSize, kernelSize).stride(stride, stride).nOut(filters).hasBias(false) .convolutionMode(ConvolutionMode.Same).build(), prefix+"_act") <START> .addLayer(prefix+"_conv1_bn", new BatchNormalization.Builder().eps(1e-3).build(), prefix+"_sepconv1") <END> .addLayer(prefix+"_act2", new ActivationLayer(Activation.RELU), prefix+"_conv1_bn") .addLayer(prefix+"_sepconv2", new SeparableConvolution2D.Builder(kernelSize, kernelSize).stride(stride, stride).nOut(filters).hasBias(false) .convolutionMode(ConvolutionMode.Same).build(), prefix+"_act2") .addLayer(prefix+"_conv2_bn", new BatchNormalization.Builder().eps(1e-3).build(), prefix+"_sepconv2"); return prefix+"_conv2_bn"; }</code><technical_language>Add gamma/momentum</technical_language>

Target:
public static String sepConvBlock(ComputationGraphConfiguration.GraphBuilder graphBuilder, int filters, int kernelSize, int stride, String blockId, String input) { String prefix = "sepConvBlock"+blockId; graphBuilder .addLayer(prefix+"_act", new ActivationLayer(Activation.RELU), input) .addLayer(prefix+"_sepconv1", new SeparableConvolution2D.Builder(kernelSize, kernelSize).stride(stride, stride).nOut(filters).hasBias(false) .convolutionMode(ConvolutionMode.Same).build(), prefix+"_act") .addLayer(prefix+"_conv1_bn", new BatchNormalization.Builder().eps(1e-3).gamma(0.9997).build(), prefix+"_sepconv1") .addLayer(prefix+"_act2", new ActivationLayer(Activation.RELU), prefix+"_conv1_bn") .addLayer(prefix+"_sepconv2", new SeparableConvolution2D.Builder(kernelSize, kernelSize).stride(stride, stride).nOut(filters).hasBias(false) .convolutionMode(ConvolutionMode.Same).build(), prefix+"_act2") .addLayer(prefix+"_conv2_bn", new BatchNormalization.Builder().eps(1e-3).gamma(0.9997).build(), prefix+"_sepconv2"); return prefix+"_conv2_bn"; }
Source:
<code>public boolean forceServicePropagation(PerunSession sess, Facility facility, Service service) throws PrivilegeException { <START> if (!AuthzResolver.isAuthorized(sess, Role.FACILITYADMIN, facility) && <END> !AuthzResolver.isAuthorized(sess, Role.PERUNOBSERVER)) { throw new PrivilegeException(sess, "forceServicePropagation"); } return getServicesManagerBl().forceServicePropagation(sess, facility, service); }</code><technical_language>Please remove PERUNOBSERVER plan/forceServicePropagation() methods (it is state changing operation) add ENGINE is called gen scripts engine</technical_language>

Target:
public boolean forceServicePropagation(PerunSession sess, Facility facility, Service service) throws PrivilegeException { if (!AuthzResolver.isAuthorized(sess, Role.FACILITYADMIN, facility) && !AuthzResolver.isAuthorized(sess, Role.ENGINE)) { throw new PrivilegeException(sess, "forceServicePropagation"); } return getServicesManagerBl().forceServicePropagation(sess, facility, service); }
Source:
<code>private void vmUpdateStatus(final VM vm, final VM.VMStatus status, final long delay, final String msg, final boolean removeClient) throws InterruptedException { ExecutorService <START> executor = <END> Executors.newFixedThreadPool(5); Future<Void> future = (Future<Void>) executor.submit(() -> { try { TimeUnit.MILLISECONDS.sleep(delay); vm.setStatus(status); sendNotification(msg, vm.getId(), removeClient); log.info("VM set to {}", vm.getId(), msg); if (isUpdateRequired(status)) { VdsmManager.getInstance().updateHost(vm.getHost()); } } catch (Exception e) { e.printStackTrace(); } }); try { future.get(); } catch (ExecutionException e) { e.printStackTrace(); } }</code><technical_language>code create ExecutorService pool (object) time run vmUpdateStatus. reason I created 1 pool object, handle event for client</technical_language>

Target:
private void vmUpdateStatus(final VM vm, final VM.VMStatus status, final long delay, final String msg, final boolean removeClient) throws InterruptedException { ScheduledFuture<Void> future = (ScheduledFuture<Void>) scheduledExecutorService.submit(() -> { try { TimeUnit.MILLISECONDS.sleep(delay); vm.setStatus(status); sendNotification(msg, vm.getId(), removeClient); log.info("VM set to {}", vm.getId(), msg); if (isUpdateRequired(status)) { VdsmManager.getInstance().updateHost(vm.getHost()); } } catch (Exception e) { e.printStackTrace(); } }); try { future.get(); } catch (ExecutionException e) { e.printStackTrace(); } }
Source:
<code>protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model) throws OperationFailedException { IdentityService identityService = new IdentityService(); ServiceBuilder<Function<SecurityIdentity, Set<SecurityIdentity>>> serviceBuilder = context.getServiceTarget() .addService(IDENTITY_RUNTIME_CAPABILITY.getCapabilityServiceName(), identityService) .setInitialMode(Mode.ACTIVE); for (String outflowSecurityDomain : outflowSecurityDomains) { serviceBuilder.addDependency(context.getCapabilityServiceName( <START> buildDynamicCapabilityName(SECURITY_DOMAIN_CAPABILITY, outflowSecurityDomain), SecurityDomain.class), <END> SecurityDomain.class, identityService.createOutflowSecurityDomainInjector()); } serviceBuilder.install(); }</code><technical_language>This context.getCapabilityServiceName(SECURITY_DOMAIN_CAPABILITY, outflowSecurityDomain, SecurityDomain.class) works, critical need fix it, if changing this class for other more robust OperationContext do yourself</technical_language>

Target:
protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model) throws OperationFailedException { IdentityService identityService = new IdentityService(); ServiceBuilder<Function<SecurityIdentity, Set<SecurityIdentity>>> serviceBuilder = context.getServiceTarget() .addService(IDENTITY_RUNTIME_CAPABILITY.getCapabilityServiceName(), identityService) .setInitialMode(Mode.ACTIVE); for (String outflowSecurityDomain : outflowSecurityDomains) { serviceBuilder.addDependency(context.getCapabilityServiceName( SECURITY_DOMAIN_CAPABILITY, outflowSecurityDomain, SecurityDomain.class), SecurityDomain.class, identityService.createOutflowSecurityDomainInjector()); } serviceBuilder.install(); }
Source:
<code>public void testInMultiplePackages() { <START> DefaultClasspathScanner scanner = new DefaultClasspathScanner("com.canoo.impl.server.classpathscan.documented", "com.canoo.impl.server.classpathscan.resource"); <END> assertForAnnotation(scanner); }</code><technical_language>final & static field for strings</technical_language>

Target:
public void testInMultiplePackages() { final DefaultClasspathScanner scanner = new DefaultClasspathScanner("com.canoo.impl.server.classpathscan.documented", "com.canoo.impl.server.classpathscan.resource"); assertForAnnotation(scanner); }
Source:
<code>private boolean isHost(final Permissionable permissionable) { return permissionable instanceof Host || <START> (permissionable instanceof Contentlet && Host.class.getSimpleName().equals(((Contentlet) permissionable).getContentType().name())) || <END> (null != permissionable && permissionable instanceof PermissionableProxy && Host.class.getName().equals(PermissionableProxy.class.cast(permissionable).getType())); }</code><technical_language>I contentlet.isHost() method recreating</technical_language>

Target:
private boolean isHost(final Permissionable permissionable) { return permissionable instanceof Host || (permissionable instanceof Contentlet && ((Contentlet) permissionable).isHost()) || (null != permissionable && permissionable instanceof PermissionableProxy && Host.class.getName().equals(PermissionableProxy.class.cast(permissionable).getType())); }
Source:
<code>public <C> C getCredential(Class<C> credentialType) throws RealmUnavailableException { for (QueryConfiguration configuration : JdbcSecurityRealm.this.queryConfiguration) { for (KeyMapper keyMapper : configuration.getColumnMappers(KeyMapper.class)) { if (keyMapper.getKeyType().isAssignableFrom(credentialType)) { <START> return executePrincipalQuery(configuration, resultSet -> (C) keyMapper.map(resultSet)); <END> } } } return null; }</code><technical_language>I missed this earlier, this unsafe cast. safe replacing (C) blah credentialType.cast(blah)</technical_language>

Target:
public <C> C getCredential(Class<C> credentialType) throws RealmUnavailableException { for (QueryConfiguration configuration : JdbcSecurityRealm.this.queryConfiguration) { for (KeyMapper keyMapper : configuration.getColumnMappers(KeyMapper.class)) { if (keyMapper.getKeyType().isAssignableFrom(credentialType)) { return executePrincipalQuery(configuration, resultSet -> credentialType.cast(keyMapper.map(resultSet))); } } } return null; }
Source:
<code>public void sendTeamPacket(Player recipient, Team team) { <START> } <END></code><technical_language>prefer backport anyway</technical_language>

Target:
public void sendTeamPacket(Player recipient, Team team) { Preconditions.checkNotNull(recipient); Preconditions.checkNotNull(team); if (TEAM_FIELD == null) { TEAM_FIELD = NMS.getGetter(team.getClass(), "team"); } try { ScoreboardTeam nmsTeam = (ScoreboardTeam) TEAM_FIELD.invoke(team); sendPacket(recipient, new PacketPlayOutScoreboardTeam(nmsTeam, 0)); } catch (Throwable e) { e.printStackTrace(); } }
Source:
<code>public void testRotate() throws Exception { final Calendar cal = Calendar.getInstance(); <START> final String rotatedPath = BASE_LOG_DIR.toString() + "/" + FILENAME + rotateFormatter.format(cal.getTime()); <END> File rotatedFile = new File(rotatedPath); testRotate(cal, rotatedFile); }</code><technical_language>java.io.File.separator</technical_language>

Target:
public void testRotate() throws Exception { final Calendar cal = Calendar.getInstance(); final String rotatedPath = BASE_LOG_DIR.toString() + File.separator + FILENAME + rotateFormatter.format(cal.getTime()); File rotatedFile = new File(rotatedPath); testRotate(cal, rotatedFile); }
Source:
<code>private void deleteProcess(List<Process> processes, boolean contentOnly) { for (Process process : processes) { String title = process.getTitle(); if (contentOnly) { try { URI ocr = fileService.getOcrDirectory(process); if (fileService.fileExist(ocr)) { fileService.delete(ocr); } URI images = fileService.getImagesDirectory(process); if (fileService.fileExist(images)) { fileService.delete(images); } Helper.setMeldung("Content deleted for " + title); } catch (Exception e) { <START> logger.error(e.getMessage(), e); <END> Helper.setFehlerMeldung("Can not delete content for " + title, e); } } if (!contentOnly) { try { deleteMetadataDirectory(process); serviceManager.getProcessService().remove(process); Helper.setMeldung("Process " + title + " deleted."); } catch (DataException | IOException e) { logger.error(e.getMessage(), e); Helper.setFehlerMeldung("could not delete process " + title, e); } } } }</code><technical_language>setErrorMessage</technical_language>

Target:
private void deleteProcess(List<Process> processes, boolean contentOnly) { for (Process process : processes) { String title = process.getTitle(); if (contentOnly) { try { URI ocr = fileService.getOcrDirectory(process); if (fileService.fileExist(ocr)) { fileService.delete(ocr); } URI images = fileService.getImagesDirectory(process); if (fileService.fileExist(images)) { fileService.delete(images); } Helper.setMeldung("Content deleted for " + title); } catch (IOException | RuntimeException e) { Helper.setErrorMessage("Can not delete content for " + title, logger, e); } } if (!contentOnly) { try { deleteMetadataDirectory(process); serviceManager.getProcessService().remove(process); Helper.setMeldung("Process " + title + " deleted."); } catch (DataException | IOException e) { Helper.setErrorMessage("could not delete process " + title, logger, e); } } } }
Source:
<code>public void onResume() { super.onResume(); getResumePauseDisposable().add(mUser .observeOn(AndroidSchedulers.mainThread()) .subscribe(user -> updateUserViewContent())); getResumePauseDisposable().add(mFeedbacks .observeOn(AndroidSchedulers.mainThread()) .subscribe(feedbacks -> updateFeedbacksViewContent())); getResumePauseDisposable().add(mFavorite .observeOn(AndroidSchedulers.mainThread()) .subscribe(isFavorite -> { saveUserIfFavorite(); mCkbFavorite.setChecked(isFavorite); mImgFavorite.setColorFilter(isFavorite ? mFavoritedColor : mNonFavoritedColor); })); getResumePauseDisposable().add(mLastUserInfoLoadResult .filter(result -> !result.isHandled) .observeOn(AndroidSchedulers.mainThread()) .subscribe(result -> { result.isHandled = true; mDownloadUserInfoProgressDisposable.dispose(); if (result.throwable != null) { HttpErrorHelper.showErrorToast(getContext(), result.throwable); <START> getFragmentManager().popBackStack(); <END> } })); }</code><technical_language>This pops stack in case a (favorite) user in db e.g. network is currently off. This is bad enough data show user - outdated. Please, add a check mUser.getValue() is null pop in case. Eventually, user fragment show a connection error allow user reload information soon resolved issue</technical_language>

Target:
public void onResume() { super.onResume(); getResumePauseDisposable().add(mUser .observeOn(AndroidSchedulers.mainThread()) .subscribe(user -> updateUserViewContent())); getResumePauseDisposable().add(mFeedbacks .observeOn(AndroidSchedulers.mainThread()) .subscribe(feedbacks -> updateFeedbacksViewContent())); getResumePauseDisposable().add(mFavorite .observeOn(AndroidSchedulers.mainThread()) .subscribe(isFavorite -> { saveUserIfFavorite(); mCkbFavorite.setChecked(isFavorite); mImgFavorite.setColorFilter(isFavorite ? mFavoritedColor : mNonFavoritedColor); })); getResumePauseDisposable().add(mLastUserInfoLoadResult .filter(result -> !result.isHandled) .observeOn(AndroidSchedulers.mainThread()) .subscribe(result -> { result.isHandled = true; mDownloadUserInfoProgressDisposable.dispose(); if (result.throwable != null) { HttpErrorHelper.showErrorToast(getContext(), result.throwable); if (mUser.getValue() == null) { getFragmentManager().popBackStack(); } } })); }
Source:
<code>public void makeBucket(MakeBucketArgs args) throws ErrorResponseException, IllegalArgumentException, InsufficientDataException, InternalException, InvalidBucketNameException, InvalidKeyException, InvalidResponseException, IOException, NoSuchAlgorithmException, RegionConflictException, ServerException, XmlParserException { checkArgs(args); String region = args.region(); if (this.region != null && !this.region.isEmpty()) { if (region != null && !region.equals(this.region)) { throw new IllegalArgumentException( "region must be " + this.region + ", but passed " + region); } region = this.region; } if (region == null) { region = US_EAST_1; } Multimap<String, String> headers = args.objectLock() ? newMultimap("x-amz-bucket-object-lock-enabled", "true") : null; try (Response response = execute( Method.PUT, args.bucket(), null, region, merge(args.extraHeaders(), headers), args.extraQueryParams(), <START> (!region.equals(US_EAST_1)) ? new CreateBucketConfiguration(region) : null, <END> 0)) { if (isAwsHost) { AwsRegionCache.INSTANCE.set(args.bucket(), region); } } }</code><technical_language>suggestion region.equals(US_EAST_1) ? null : new CreateBucketConfiguration(region), This simpler</technical_language>

Target:
public void makeBucket(MakeBucketArgs args) throws ErrorResponseException, IllegalArgumentException, InsufficientDataException, InternalException, InvalidBucketNameException, InvalidKeyException, InvalidResponseException, IOException, NoSuchAlgorithmException, RegionConflictException, ServerException, XmlParserException { checkArgs(args); String region = args.region(); if (this.region != null && !this.region.isEmpty()) { if (region != null && !region.equals(this.region)) { throw new IllegalArgumentException( "region must be " + this.region + ", but passed " + region); } region = this.region; } if (region == null) { region = US_EAST_1; } Multimap<String, String> headers = args.objectLock() ? newMultimap("x-amz-bucket-object-lock-enabled", "true") : null; try (Response response = execute( Method.PUT, args.bucket(), null, region, merge(args.extraHeaders(), headers), args.extraQueryParams(), region.equals(US_EAST_1) ? null : new CreateBucketConfiguration(region), 0)) { if (isAwsHost) { AwsRegionCache.INSTANCE.set(args.bucket(), region); } } }
Source:
<code>public URLParams and(final String key, final long value) { <START> map.put(key, "" + value); <END> return this; }</code><technical_language>I prefer String.valueOf(value)</technical_language>

Target:
public URLParams and(final String key, final long value) { map.put(key, String.valueOf(value)); return this; }
Source:
<code><START> public List<HttpPipelinePolicy> getPolicies() { <END> return this.policies; }</code><technical_language>public getter methods in Builder class. Is a reason for this getter</technical_language>

Target:
List<HttpPipelinePolicy> getPolicies() { return this.policies; }
Source:
<code>public void testCreateNewRepos_MissingPermissions() throws Exception { File wcTree = new File("target/gen/CreateNewRepositoryTest_testCreateNewRepos"); Git git = null; try { git = Git.init().setBare(false).setDirectory(new File(wcTree.getAbsolutePath())).call(); } finally { if (git != null) { git.close(); } <START> FileUtils.deleteDirectory(wcTree); <END> } assertEquals("", errorOutputWriter.toString()); }</code><technical_language>deleting test resources happen in tearDown method annotated @After, RepositoryTestCase</technical_language>

Target:
public void testCreateNewRepos_MissingPermissions() throws Exception { File wcTree = new File(getTemporaryDirectory(), "CreateNewRepositoryTest_testCreateNewRepos"); Git git = Git.init().setBare(false) .setDirectory(new File(wcTree.getAbsolutePath())).call(); addRepoToClose(git.getRepository()); assertEquals("", errorOutputWriter.toString()); }
Source:
<code>} catch (IOException e) { <START> System.out.println("Properties cannot be readed."); <END> e.printStackTrace(); }</code><technical_language>I this error. this a fatal error - pretty happen. I re-throw exception (wrapped in some kind of RuntimeException) rest-driver start</technical_language>

Target:
} catch (IOException e) { throw new RuntimeConfigurationException(e); }
Source:
<code>public PropertiesConfigurationProvider(Properties properties, Map<String, String> variableValues) { <START> this(properties, variableValues, new ObjectMapper()); <END> }</code><technical_language>Pass 'null' for ObjectMapper create a default in AbstractObjectConfigurationProvider</technical_language>

Target:
public PropertiesConfigurationProvider(Properties properties, Map<String, String> variableValues) { this(properties, variableValues, null); }
Source:
<code>public ExprEval apply(final List<Expr> args, final Expr.ObjectBinding bindings) { END if (args.size() < 2) { <START> throw new IAE("'%s' must have at least 2 arguments"); <END> } for (int i = 0; i < args.size(); i += 2) { if (i == args.size() - 1) { return args.get(i).eval(bindings); } else if (args.get(i).eval(bindings).asBoolean()) { return args.get(i + 1).eval(bindings); } } return ExprEval.of(null); }</code><technical_language>%s param is unsatisfied. [%s] in Druid</technical_language>

Target:
public ExprEval apply(final List<Expr> args, final Expr.ObjectBinding bindings) { if (args.size() < 2) { throw new IAE("Function[%s] must have at least 2 arguments", name()); } for (int i = 0; i < args.size(); i += 2) { if (i == args.size() - 1) { return args.get(i).eval(bindings); } else if (args.get(i).eval(bindings).asBoolean()) { return args.get(i + 1).eval(bindings); } } return ExprEval.of(null); }
Source:
<code>public void newTagPage(String tagName, MarkedText about){ if(!validator.validateCreationWithTag(tagName)) return; Tag tag = tags.findBySluggedName(tagName); TagPage tagPage = new TagPage(tag, about); if(!validator.validate(tagPage)){ validator.onErrorRedirectTo(TagPageController.class).tagPageForm(tagPage.getTag().getUriName()); return; } tagPages.save(tagPage); <START> result.redirectTo(this).showTagPage(tagPage.getTag().getUriName()); <END> }</code><technical_language>need tagPage.getTag().getUriName() get uri, encapsulate this tagPage. tagPage.getTagUriName() a name :P</technical_language>

Target:
public void newTagPage(String tagName, MarkedText about){ if(!validator.validateCreationWithTag(tagName)) return; Tag tag = tags.findByUriName(tagName); TagPage tagPage = new TagPage(tag, about); if(!validator.validate(tagPage)){ validator.onErrorRedirectTo(TagPageController.class).tagPageForm(tagPage.getTagUriName()); return; } tagPages.save(tagPage); result.redirectTo(this).showTagPage(tagPage.getTagUriName()); }
Source:
<code>public ByteBuf getChunk(int length) throws IOException { if (file == null || length == 0) { return EMPTY_BUFFER; } if (fileChannel == null) { RandomAccessFile accessFile = new RandomAccessFile(file, "r"); fileChannel = accessFile.getChannel(); } int read = 0; ByteBuffer byteBuffer = ByteBuffer.allocate(length); while (read < length) { int readnow=-1; try { readnow = fileChannel.read(byteBuffer); }catch (IOException e){ logger.warn("Failed to read a file.", e); } finally { <START> fileChannel.close(); <END> } if (readnow == -1) { fileChannel.close(); fileChannel = null; break; } else { read += readnow; } } if (read == 0) { return EMPTY_BUFFER; } byteBuffer.flip(); ByteBuf buffer = wrappedBuffer(byteBuffer); buffer.readerIndex(0); buffer.writerIndex(read); return buffer; }</code><technical_language>this try finally englobing while loop? there, read operation valid once, failed closed iteration..</technical_language>

Target:
public ByteBuf getChunk(int length) throws IOException { if (file == null || length == 0) { return EMPTY_BUFFER; } if (fileChannel == null) { RandomAccessFile accessFile = new RandomAccessFile(file, "r"); fileChannel = accessFile.getChannel(); } int read = 0; ByteBuffer byteBuffer = ByteBuffer.allocate(length); try { while (read < length) { int readnow = fileChannel.read(byteBuffer); if (readnow == -1) { break; } read += readnow; } } finally { fileChannel.close(); fileChannel = null; } if (read == 0) { return EMPTY_BUFFER; } byteBuffer.flip(); ByteBuf buffer = wrappedBuffer(byteBuffer); buffer.readerIndex(0); buffer.writerIndex(read); return buffer; }
Source:
<code>private void doAddReviewer() { final String nameEmail = addMemberBox.getText(); if (nameEmail.length() == 0) { return; } addMemberBox.setEnabled(false); <START> final List<String> reviewers = Arrays.asList(nameEmail.split(";")); <END> PatchUtil.DETAIL_SVC.addReviewers(changeId, reviewers, new GerritCallback<VoidResult>() { public void onSuccess(final VoidResult result) { addMemberBox.setEnabled(true); addMemberBox.setText(""); } @Override public void onFailure(final Throwable caught) { addMemberBox.setEnabled(true); super.onFailure(caught); } }); }</code><technical_language>Cute. support this else. whack line, a change adds multiple name support AddMemberBox in group management code too</technical_language>

Target:
private void doAddReviewer() { final List<String> reviewers = addMemberBox.getNamesOrEmails(); if( reviewers == null || reviewers.size() == 0 ) { return; } addMemberBox.setEnabled(false); PatchUtil.DETAIL_SVC.addReviewers(changeId, reviewers, new GerritCallback<VoidResult>() { public void onSuccess(final VoidResult result) { addMemberBox.setEnabled(true); addMemberBox.setText(""); } @Override public void onFailure(final Throwable caught) { addMemberBox.setEnabled(true); super.onFailure(caught); } }); }
Source:
<code>private void log(String tag, String message, String additionalMessage, LogLevel logLevel, ADALError errorCode, Throwable throwable) { if (logLevel.compareTo(mLogLevel) > 0) { return; } final StringBuilder logMessage = new StringBuilder(); if (errorCode != null) { logMessage.append(getCodeName(errorCode)).append(':'); } if (message != null) { logMessage.append(' ').append(addMoreInfo(message)); } <START> if (throwable != null) { <END> logMessage.append(' ').append(Log.getStackTraceString(throwable)); } if (additionalMessage != null && mEnablePII) { logMessage.append(' ').append(additionalMessage); } if (mLogcatLogEnabled) { sendLogcatLogs(tag, logLevel, logMessage.toString()); } if (mExternalLogger.get() != null) { try { mExternalLogger.get().Log(tag, message, "", logLevel, errorCode); } catch (Exception e) { Log.w(tag, String.format(CUSTOM_LOG_ERROR, message)); } } }</code><technical_language>add a PII check this</technical_language>

Target:
private void log(String tag, String message, String additionalMessage, LogLevel logLevel, ADALError errorCode, Throwable throwable) { if (logLevel.compareTo(mLogLevel) > 0) { return; } final StringBuilder logMessage = new StringBuilder(); if (errorCode != null) { logMessage.append(getCodeName(errorCode)).append(':'); } logMessage.append(addMoreInfo(message)); if (!StringExtensions.isNullOrBlank(additionalMessage) && mEnablePII) { logMessage.append(' ').append(additionalMessage); } if (throwable != null) { logMessage.append('\n').append(Log.getStackTraceString(throwable)); } if (mAndroidLogEnabled) { sendLogcatLogs(tag, logLevel, logMessage.toString()); } if (mExternalLogger != null) { try { if (!StringExtensions.isNullOrBlank(additionalMessage) && mEnablePII) { mExternalLogger.Log(tag, addMoreInfo(message), additionalMessage + (throwable == null ? "" : Log.getStackTraceString(throwable)), logLevel, errorCode); } else { mExternalLogger.Log(tag, addMoreInfo(message), throwable == null ? null : Log.getStackTraceString(throwable), logLevel, errorCode); } } catch (Exception e) { Log.w(tag, String.format(CUSTOM_LOG_ERROR, message)); } } }
Source:
<code>public boolean match(final ChangeData object) throws OrmException { <START> for (PatchLineComment c : object.comments()) { <END> if (c.getStatus() == PatchLineComment.Status.DRAFT && c.getAuthor().equals(accountId)) { return true; } } return false; }</code><technical_language>Good plan</technical_language>

Target:
public boolean match(final ChangeData object) throws OrmException { if (!args.plcUtil .draftByChangeAuthor(args.db.get(), object.notes(), accountId) .isEmpty()) { return true; } return false; }
Source:
<code>void complete(BitmapHunter hunter) { Action single = hunter.getAction(); List<Action> joined = hunter.getActions(); boolean hasMultiple = joined != null && !joined.isEmpty(); boolean shouldDeliver = single != null || hasMultiple; if (!shouldDeliver) { return; } Uri uri = hunter.getData().uri; Exception exception = hunter.getException(); Bitmap result = hunter.getResult(); LoadedFrom from = hunter.getLoadedFrom(); if (single != null) { deliverAction(result, from, single); if (!hasMultiple) { <START> return; <END> } } for (int i = 0, n = joined.size(); i < n; i++) { Action join = joined.get(i); deliverAction(result, from, join); } if (listener != null && exception != null) { listener.onImageLoadFailed(this, uri, exception); } }</code><technical_language>break early here. Wrap next loop in a null check instead</technical_language>

Target:
void complete(BitmapHunter hunter) { Action single = hunter.getAction(); List<Action> joined = hunter.getActions(); boolean hasMultiple = joined != null && !joined.isEmpty(); boolean shouldDeliver = single != null || hasMultiple; if (!shouldDeliver) { return; } Uri uri = hunter.getData().uri; Exception exception = hunter.getException(); Bitmap result = hunter.getResult(); LoadedFrom from = hunter.getLoadedFrom(); if (single != null) { deliverAction(result, from, single); } if (hasMultiple) { for (int i = 0, n = joined.size(); i < n; i++) { Action join = joined.get(i); deliverAction(result, from, join); } } if (listener != null && exception != null) { listener.onImageLoadFailed(this, uri, exception); } }
Source:
<code>void streamsReturnedByProvidersAreClosedWhenCallingProvide() { ExtensionContext extensionContext = getExtensionContextReturningSingleMethod( new TestCaseWithArgumentSourceAnnotatedMethod()); Stream<TestTemplateInvocationContext> stream = this.parameterizedTestExtension.provideTestTemplateInvocationContexts( extensionContext); <START> long unused = stream.count(); <END> assertTrue(streamWasClosed); }</code><technical_language>Hmmmm.... warnings unused variable _unused_</technical_language>

Target:
void streamsReturnedByProvidersAreClosedWhenCallingProvide() { ExtensionContext extensionContext = getExtensionContextReturningSingleMethod( new TestCaseWithArgumentSourceAnnotatedMethod()); Stream<TestTemplateInvocationContext> stream = this.parameterizedTestExtension.provideTestTemplateInvocationContexts( extensionContext); stream.count(); assertTrue(streamWasClosed); }
Source:
<code>public void onUpdate() { <START> getPlayer().getWorld().spawnParticle(Particle.PORTAL, getPlayer().getLocation().add(0, 1, 0), 3, 0.2D, 0.01D, 0.2D); <END> }</code><technical_language>1.13 compatible. [UtilParticles](<LINK_0> class. suggestion Particles.PORTAL.display(0.2F, 0.01F, 0.02F, 0, 3, getPlayer().getLocation().add(0, 1, 0), 128);</technical_language>

Target:
public void onUpdate() { Particles.PORTAL.display(0.2F, 0.01F, 0.02F, 0, 3, getPlayer().getLocation().add(0, 1, 0), 128); }
Source:
<code>protected void init() { if (ds != null) { addFields(); <START> addActionListener(new ActionListener() { <END> @Override public void actionPerformed(ActionEvent e) { updateField((String) ((WideComboBox) e.getSource()) .getSelectedItem()); } }); String field = getLegend().getLookupFieldName(); if (field != null && !field.isEmpty()) { setSelectedItem(field); } updateField((String) getSelectedItem()); } else { LOGGER.error("Cannot construct the field combo box because the " + "DataSource is null."); } }</code><technical_language>done EventHandler ? EventHandler.create(ActionListener.class, this, "updateField", "source.selectedItem"); tested yet, though, guessing/asking ;-)</technical_language>

Target:
protected void init() { addFields(); addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { updateField((String) ((WideComboBox) e.getSource()) .getSelectedItem()); } }); String field = getLegend().getLookupFieldName(); if (field != null && !field.isEmpty()) { setSelectedItem(field); } updateField((String) getSelectedItem()); }
Source:
<code>public static BranchEntity fromEntity(Entity e) { if (!e.getKind().equals(KIND) || e.getKey().getName() == null) { logger.log(Level.WARNING, "Missing <START> test attributes <END> in entity: " + e.toString()); return null; } String branchName = e.getKey().getName(); return new BranchEntity(branchName); }</code><technical_language>Branch KIND some other specific term</technical_language>

Target:
public static BranchEntity fromEntity(Entity e) { if (!e.getKind().equals(KIND) || e.getKey().getName() == null) { logger.log(Level.WARNING, "Missing branch attributes in entity: " + e.toString()); return null; } String branchName = e.getKey().getName(); return new BranchEntity(branchName); }
Source:
<code>protected int getObjectId() { <START> return 60; <END> }</code><technical_language>Get rid of this object ID stuff define here: <LINK_0></technical_language>

Target:
protected int getObjectId() { return SpawnObjectMessage.ARROW; }
Source:
<code>public MessageWithMetadata unwrapContent(byte[] data) { BinaryDecoder binaryDecoder = DecoderFactory.get().binaryDecoder(data, null); try { return new MessageWithMetadata( new MessageMetadata(binaryDecoder.readLong(), binaryDecoder.readString()), <START> binaryDecoder.readBytes(null).array()); <END> } catch (IOException exception) { throw new UnwrappingException("Could not read hermes avro message", exception); } }</code><technical_language>explain this expression is doing: binaryDecoder.readBytes(null).array()</technical_language>

Target:
public UnwrappedMessageContent unwrapContent(byte[] data) { BinaryDecoder binaryDecoder = DecoderFactory.get().binaryDecoder(data, null); try { return new UnwrappedMessageContent( new MessageMetadata(binaryDecoder.readLong(), binaryDecoder.readString()), binaryDecoder.readBytes(null).array()); } catch (IOException exception) { throw new UnwrappingException("Could not read hermes avro message", exception); } }
Source:
<code>public Result call() { if (transactionTemplate != null) { return transactionTemplate.execute((status) -> doCallInTransaction()); } else { <START> return doCallInTransaction(); <END> } }</code><technical_language>call in a transaction here? a bit confused</technical_language>

Target:
public Result call() { final SecurityContext originalContext = SecurityContextHolder.getContext(); try { SecurityContextHolder.setContext(SecurityContextHolder.createEmptyContext()); SecurityContextHolder.getContext().setAuthentication(authentication); return authenticatedCall(); } finally { SecurityContextHolder.setContext(originalContext); } }
Source:
<code>public Result getMostRecentMessage(String userId) { UserSession session = getAuthenticatedSession(Roles.ADMIN); Study study = studyService.getStudy(session.getStudyIdentifier()); <START> SmsMessage message = smsService.getMostRecentMessage(study, userId); <END> return okResult(message); }</code><technical_language>I feel this cleaner if ParticipantService, retrieved account, called SmsService expects Accounts? SmsService need reference ParticipantService that. E.g. SmsService. getMostRecentMessage() a phone number point</technical_language>

Target:
public Result getMostRecentMessage(String userId) { UserSession session = getAuthenticatedSession(Roles.ADMIN); Study study = studyService.getStudy(session.getStudyIdentifier()); StudyParticipant participant = participantService.getParticipant(study, userId, false); if (participant.getPhone() == null) { throw new BadRequestException("participant has no phone number"); } SmsMessage message = smsService.getMostRecentMessage(participant.getPhone().getNumber()); return okResult(message); }
Source:
<code><START> public void buttonContinueOpensProjectActivity() throws ClassNotFoundException, <END> NoSuchMethodException, NoSuchFieldException, InvocationTargetException, IllegalAccessException { onView(withId(R.id.main_menu_button_continue)) .perform(click()); onView(withId(R.id.fragment_sprites_list)) .check(matches(isDisplayed())); }</code><technical_language>list of exceptions</technical_language>

Target:
public void buttonContinueOpensProjectActivity() { onView(withId(R.id.main_menu_button_continue)) .perform(click()); onView(withId(R.id.fragment_sprites_list)) .check(matches(isDisplayed())); }
Source:
<code>private int readAllNulls(int[] positions, int positionCount) <START> throws IOException <END> { if (nonDeterministicFilter) { outputPositionCount = 0; for (int i = 0; i < positionCount; i++) { if (filter.testNull()) { outputPositionCount++; } else { outputPositionCount -= filter.getPrecedingPositionsToFail(); i += filter.getSucceedingPositionsToFail(); } } } else if (nullsAllowed) { outputPositionCount = positionCount; } else { outputPositionCount = 0; } allNulls = true; return positions[positionCount - 1] + 1; }</code><technical_language>throws IOException is needed; remove</technical_language>

Target:
private int readAllNulls(int[] positions, int positionCount) { if (nonDeterministicFilter) { outputPositionCount = 0; for (int i = 0; i < positionCount; i++) { if (filter.testNull()) { outputPositionCount++; } else { outputPositionCount -= filter.getPrecedingPositionsToFail(); i += filter.getSucceedingPositionsToFail(); } } } else if (nullsAllowed) { outputPositionCount = positionCount; } else { outputPositionCount = 0; } allNulls = true; return positions[positionCount - 1] + 1; }
Source:
<code>private ValuesReader readPageV1(DataPageV1 page) { ValuesReader rlReader = page.getRepetitionLevelEncoding().getValuesReader(columnDescriptor, REPETITION_LEVEL); ValuesReader dlReader = page.getDefinitionLevelEncoding().getValuesReader(columnDescriptor, DEFINITION_LEVEL); repetitionReader = new LevelValuesReader(rlReader); definitionReader = new LevelValuesReader(dlReader); try { byte[] bytes = page.getSlice().getBytes(); <START> final ByteBufferInputStream bufferInputStream = ByteBufferInputStream.wrap(ByteBuffer.wrap(bytes)); <END> rlReader.initFromPage(page.getValueCount(), bufferInputStream); int offset = bytes.length - bufferInputStream.available(); final ByteBufferInputStream dlbyteBufferInputStream = ByteBufferInputStream.wrap(ByteBuffer.wrap(bytes, offset, bytes.length - offset)); dlReader.initFromPage(page.getValueCount(), dlbyteBufferInputStream); offset = bytes.length - dlbyteBufferInputStream.available(); return initDataReader(page.getValueEncoding(), ByteBufferInputStream.wrap(ByteBuffer.wrap(bytes, offset, bytes.length - offset)), page.getValueCount()); } catch (IOException e) { throw new ParquetDecodingException("Error reading parquet page " + page + " in column " + columnDescriptor, e); } }</code><technical_language>remove final modifiers</technical_language>

Target:
private ValuesReader readPageV1(DataPageV1 page) { ValuesReader repetitionLevelReader = page.getRepetitionLevelEncoding().getValuesReader(columnDescriptor, REPETITION_LEVEL); ValuesReader definitionLevelReader = page.getDefinitionLevelEncoding().getValuesReader(columnDescriptor, DEFINITION_LEVEL); repetitionReader = new LevelValuesReader(repetitionLevelReader); definitionReader = new LevelValuesReader(definitionLevelReader); try { byte[] bytes = page.getSlice().getBytes(); ByteBufferInputStream bufferInputStream = ByteBufferInputStream.wrap(ImmutableList.of(ByteBuffer.wrap(bytes))); repetitionLevelReader.initFromPage(page.getValueCount(), bufferInputStream); int offset = bytes.length - bufferInputStream.available(); ByteBuffer definitionLevelByteBuffer = ByteBuffer.wrap(bytes, offset, bytes.length - offset); ByteBufferInputStream definitionLevelInputStream = ByteBufferInputStream.wrap(ImmutableList.of(definitionLevelByteBuffer)); definitionLevelReader.initFromPage(page.getValueCount(), definitionLevelInputStream); offset = bytes.length - definitionLevelInputStream.available(); ByteBuffer byteBuffer = ByteBuffer.wrap(bytes, offset, bytes.length - offset); return initDataReader(page.getValueEncoding(), ByteBufferInputStream.wrap(ImmutableList.of(byteBuffer)), page.getValueCount()); } catch (IOException e) { throw new ParquetDecodingException("Error reading parquet page " + page + " in column " + columnDescriptor, e); } }
Source:
<code>private void watchLogsIfDebugEnabled(Map<String, String> startOptions) throws InfrastructureException { if (LogWatcher.shouldWatchLogs(startOptions)) { <START> logWatcherMetrics.workspaceStartedInStartDebugMode(); <END> LOG.info( "Debug workspace startup. Will watch the logs of '{}'", getContext().getIdentity().getWorkspaceId()); Set<String> podNames = machines .getMachines(getContext().getIdentity()) .values() .stream() .filter(Objects::nonNull) .map(KubernetesMachineImpl::getPodName) .filter(Objects::nonNull) .collect(Collectors.toSet()); LOG.debug( "Watch '{}' pods in workspace '{}'", podNames, getContext().getIdentity().getWorkspaceId()); namespace .deployments() .watchLogs( new PodLogToEventPublisher(this.eventPublisher, this.getContext().getIdentity()), LogWatchTimeouts.DEFAULT, podNames, LogWatcher.getLogLimitBytes(startOptions)); } }</code><technical_language>base counter logic Events? In this way, need inject additional classes KubernetesInternalRuntime.java</technical_language>

Target:
private void watchLogsIfDebugEnabled(Map<String, String> startOptions) throws InfrastructureException { if (LogWatcher.shouldWatchLogs(startOptions)) { LOG.info( "Debug workspace startup. Will watch the logs of '{}'", getContext().getIdentity().getWorkspaceId()); Set<String> podNames = machines .getMachines(getContext().getIdentity()) .values() .stream() .filter(Objects::nonNull) .map(KubernetesMachineImpl::getPodName) .filter(Objects::nonNull) .collect(Collectors.toSet()); LOG.debug( "Watch '{}' pods in workspace '{}'", podNames, getContext().getIdentity().getWorkspaceId()); namespace .deployments() .watchLogs( new PodLogToEventPublisher(this.eventPublisher, this.getContext().getIdentity()), LogWatchTimeouts.DEFAULT, podNames, LogWatcher.getLogLimitBytes(startOptions)); } }
Source:
<code>public GetBulkResult call() throws Exception { final Ds3ClientHelpers.ObjectChannelBuilder getter; if (checksum) { throw new RuntimeException("Checksumming is currently not implemented."); } else { getter = new FileObjectGetter(this.outputPath); } if (sync) { <START> if (this.prefix == null) { <END> LOG.info("Syncing all objects from " + this.bucketName); } else { LOG.info("Syncing only those objects that start with " + this.prefix); } return new GetBulkResult(restoreSome(getter)); } if (this.prefix == null) { LOG.info("Getting all objects from " + this.bucketName); return new GetBulkResult(restoreAll(getter)); } LOG.info("Getting only those objects that start with " + this.prefix); return new GetBulkResult(restoreSome(getter)); }</code><technical_language>This this.prefix == null || this.prefix.isEmpty() new Guard method Guard.isStringNullOrEmpty(this.prefix)</technical_language>

Target:
public GetBulkResult call() throws Exception { final Ds3ClientHelpers.ObjectChannelBuilder getter; if (checksum) { throw new RuntimeException("Checksumming is currently not implemented."); } else { getter = new FileObjectGetter(this.outputPath); } if (sync) { if (this.prefix == null || this.prefix.isEmpty()) { LOG.info("Syncing all objects from " + this.bucketName); } else { LOG.info("Syncing only those objects that start with " + this.prefix); } return new GetBulkResult(restoreSome(getter)); } if (this.prefix == null) { LOG.info("Getting all objects from " + this.bucketName); return new GetBulkResult(restoreAll(getter)); } LOG.info("Getting only those objects that start with " + this.prefix); return new GetBulkResult(restoreSome(getter)); }
Source:
<code>public static NearestMatchFinder get(ResourceInfo info, DimensionInfo dimensionInfo, String dimensionName) throws IOException { Class dataType = getDataTypeFromDimension(info, dimensionName); try { AcceptableRange acceptableRange = AcceptableRange.getAcceptableRange(dimensionInfo.getAcceptableInterval (), dataType); if (info instanceof FeatureTypeInfo) { FeatureTypeInfo featureType = (FeatureTypeInfo) info; return new Vector(featureType, dimensionInfo.getAttribute(), dimensionInfo.getEndAttribute(), acceptableRange, dataType); } else if (info instanceof CoverageInfo) { GridCoverageReader reader = ((CoverageInfo) info).getGridCoverageReader(null, null); if (reader instanceof StructuredGridCoverage2DReader && ENABLE_STRUCTURED_READER_SUPPORT) { StructuredGridCoverage2DReader structured = (StructuredGridCoverage2DReader) reader; DimensionDescriptor dd = getDimensionDescriptor(structured, dimensionName); return new StructuredReader(structured, dd.getStartAttribute(), dd.getEndAttribute(), acceptableRange, dataType); } else if (reader instanceof GridCoverage2DReader) { return new Reader((GridCoverage2DReader) reader, acceptableRange, dimensionName, dataType); } } } catch (ParseException e) { <START> throw new ServiceException("Failed to apply nearest match search", e); <END> } throw new IllegalArgumentException("No nearest match support for " + info); }</code><technical_language>Adding info message contextualize</technical_language>

Target:
public static NearestMatchFinder get(ResourceInfo info, DimensionInfo dimensionInfo, String dimensionName) throws IOException { Class dataType = getDataTypeFromDimension(info, dimensionName); try { AcceptableRange acceptableRange = AcceptableRange.getAcceptableRange(dimensionInfo.getAcceptableInterval (), dataType); if (info instanceof FeatureTypeInfo) { FeatureTypeInfo featureType = (FeatureTypeInfo) info; return new Vector(featureType, dimensionInfo.getAttribute(), dimensionInfo.getEndAttribute(), acceptableRange, dataType); } else if (info instanceof CoverageInfo) { GridCoverageReader reader = ((CoverageInfo) info).getGridCoverageReader(null, null); if (reader instanceof StructuredGridCoverage2DReader && ENABLE_STRUCTURED_READER_SUPPORT) { StructuredGridCoverage2DReader structured = (StructuredGridCoverage2DReader) reader; DimensionDescriptor dd = getDimensionDescriptor(structured, dimensionName); return new StructuredReader(structured, dd.getStartAttribute(), dd.getEndAttribute(), acceptableRange, dataType); } else if (reader instanceof GridCoverage2DReader) { return new Reader((GridCoverage2DReader) reader, acceptableRange, dimensionName, dataType); } } } catch (ParseException e) { throw new ServiceException("Failed to apply nearest match search on " + info.prefixedName(), e); } throw new IllegalArgumentException("No nearest match support for " + info); }
Source:
<code>private IPFSClient ipfs() { <START> IPFSClient client = getComponent().getIPFSClient(); <END> if (!client.hasConnection()) client.connect(); return client; }</code><technical_language>this is self-heal reconnect. Fix checkstyle issue however</technical_language>

Target:
private IPFSClient ipfs() { if (!client.hasConnection()) { client.connect(); } return client; }
Source:
<code>public CorfuLogReplicationRuntime(LogReplicationRuntimeParameters parameters, LogReplicationMetadataManager metadataManager) { this.remoteClusterId = parameters.getRemoteClusterDescriptor().getClusterId(); this.metadataManager = metadataManager; this.router = new LogReplicationClientRouter(parameters, this); this.router.addClient(new LogReplicationHandler()); this.sourceManager = new LogReplicationSourceManager(parameters, new LogReplicationClient(router, remoteClusterId), metadataManager); this.connectedEndpoints = new HashSet<>(); this.communicationFSMWorkers = new ThreadPoolExecutor(1, 1, 0L, <START> TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>()); <END> this.communicationFSMConsumer = Executors.newSingleThreadExecutor(new ThreadFactoryBuilder().setNameFormat("runtime-fsm-consumer").build()); initializeStates(); this.state = states.get(LogReplicationRuntimeStateType.WAITING_FOR_CONNECTIVITY); log.info("Log Replication Runtime State Machine initialized"); }</code><technical_language>Do need set thread name a threadFactory</technical_language>

Target:
public CorfuLogReplicationRuntime(LogReplicationRuntimeParameters parameters, LogReplicationMetadataManager metadataManager) { this.remoteClusterId = parameters.getRemoteClusterDescriptor().getClusterId(); this.metadataManager = metadataManager; this.router = new LogReplicationClientRouter(parameters, this); this.router.addClient(new LogReplicationHandler()); this.sourceManager = new LogReplicationSourceManager(parameters, new LogReplicationClient(router, remoteClusterId), metadataManager); this.connectedEndpoints = new HashSet<>(); ThreadFactory threadFactory = new ThreadFactoryBuilder().setNameFormat("runtime-fsm-worker").build(); this.communicationFSMWorkers = new ThreadPoolExecutor(1, 1, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>(), threadFactory); this.communicationFSMConsumer = Executors.newSingleThreadExecutor(new ThreadFactoryBuilder().setNameFormat("runtime-fsm-consumer").build()); initializeStates(); this.state = states.get(LogReplicationRuntimeStateType.WAITING_FOR_CONNECTIVITY); log.info("Log Replication Runtime State Machine initialized"); }