auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code><START> private static void validateName(String name) { <END> if (name == null) { throw new IllegalArgumentException("null bucket name"); } if (name.length() < 3 || name.length() > 63) { throw new IllegalArgumentException( name + " : " + "bucket name must be at least 3 and no more than 63 characters long"); } if (name.contains("..")) { String msg = "bucket name cannot contain successive periods. For more information refer " + "<LINK_0>"; throw new IllegalArgumentException(name + " : " + msg); } if (!name.matches("^[a-z0-9][a-z0-9\\.\\-]+[a-z0-9]$")) { String msg = "bucket name does not follow Amazon S3 standards. For more information refer " + "<LINK_0>"; throw new IllegalArgumentException(name + " : " + msg); } }</code><technical_language>This method need static</technical_language>

Target:
private void validateName(String name) { if (name == null) { throw new IllegalArgumentException("null bucket name"); } if (name.length() < 3 || name.length() > 63) { throw new IllegalArgumentException( name + " : " + "bucket name must be at least 3 and no more than 63 characters long"); } if (name.contains("..")) { String msg = "bucket name cannot contain successive periods. For more information refer " + "<LINK_0>"; throw new IllegalArgumentException(name + " : " + msg); } if (!name.matches("^[a-z0-9][a-z0-9\\.\\-]+[a-z0-9]$")) { String msg = "bucket name does not follow Amazon S3 standards. For more information refer " + "<LINK_0>"; throw new IllegalArgumentException(name + " : " + msg); } }
Source:
<code>public boolean hasFullNumberPrecision() { return true; <START> } <END></code><technical_language>I failing tests this true. HashBasedIndex coerces numbers doubles, looses precision</technical_language>

Target:
public boolean hasFullNumberPrecision() { return false; }
Source:
<code>public boolean test() throws Exception { <START> ImageHelper blueish = ImageHelper.grabImage(fRect); <END> if (blueish == null) { fFailureMessage = "Image is null"; return false; } Multiset<RGB> histogram = blueish.getHistogram(); for (RGB rgb : fRgbs) { if (histogram.count(rgb) <= 0) { fFailureMessage = "Color not found: " + rgb; } } return true; }</code><technical_language>blueish more generic</technical_language>

Target:
public boolean test() throws Exception { ImageHelper image = ImageHelper.grabImage(fRect); if (image == null) { fFailureMessage = "Grabbed image is null"; return false; } Multiset<RGB> histogram = image.getHistogram(); for (RGB rgb : fRgbs) { if (histogram.count(rgb) <= 0) { fFailureMessage = "Color not found: " + rgb; return false; } } return true; }
Source:
<code>protected boolean isSatisfiedByInternal(final Assertion assertion) { if (assertion.getChainedAuthentications().size() > 0) { final int index = assertion.getChainedAuthentications().size() - 1; <START> final Authentication authToUse = assertion.getChainedAuthentications().get(index); <END> final String authnMethodUsed = (String) authToUse.getAttributes() .get(MultiFactorAuthenticationSupportingWebApplicationService.CONST_PARAM_AUTHN_METHOD); if (!StringUtils.isBlank(getAuthenticationMethod())) { if (StringUtils.isBlank(authnMethodUsed)) { final String msg = String.format("Requested authentication method [%s] is not available", getAuthenticationMethod()); logger.debug(msg); throw new UnacceptableMultiFactorAuthenticationMethodException("UNACCEPTABLE_AUTHENTICATION_METHOD", msg, getAuthenticationMethod()); } if (!authnMethodUsed.equals(getAuthenticationMethod())) { final String msg = String.format("Requested authentication method [%s] does not " + "match the authentication method used [%s]", getAuthenticationMethod(), authnMethodUsed); logger.debug(msg); throw new UnrecognizedMultiFactorAuthenticationMethodException("UNRECOGNIZED_AUTHENTICATION_METHOD", msg, getAuthenticationMethod()); } } return true; } logger.debug("No authentication context is available"); return false; }</code><technical_language>authToUse -- is meant use? auth stand for here? immediately relating this name, use, Authentication previously accomplished, it? call this authentication</technical_language>

Target:
protected boolean isSatisfiedByInternal(final Assertion assertion) { if (assertion.getChainedAuthentications().size() > 0) { final int index = assertion.getChainedAuthentications().size() - 1; final Authentication authentication = assertion.getChainedAuthentications().get(index); final String authnMethodUsed = (String) authentication.getAttributes() .get(MultiFactorAuthenticationSupportingWebApplicationService.CONST_PARAM_AUTHN_METHOD); if (!StringUtils.isBlank(getAuthenticationMethod())) { if (StringUtils.isBlank(authnMethodUsed)) { final String msg = String.format("Requested authentication method [%s] is not available", getAuthenticationMethod()); logger.debug(msg); throw new UnacceptableMultiFactorAuthenticationMethodException("UNACCEPTABLE_AUTHENTICATION_METHOD", msg, getAuthenticationMethod()); } if (!authnMethodUsed.equals(getAuthenticationMethod())) { final String msg = String.format("Requested authentication method [%s] does not " + "match the authentication method used [%s]", getAuthenticationMethod(), authnMethodUsed); logger.debug(msg); throw new UnrecognizedMultiFactorAuthenticationMethodException("UNRECOGNIZED_AUTHENTICATION_METHOD", msg, getAuthenticationMethod()); } } return true; } logger.debug("No authentication context is available"); return false; }
Source:
<code>onRadioAvailable() { PowerManager pm = (PowerManager)mContext.getSystemService(Context.POWER_SERVICE); boolean isScreenOn = pm.isScreenOn(); <START> sendScreenState(isScreenOn); <END> }</code><technical_language>Lets create a local variable just: sendScreenState(pm.isScreenOn());</technical_language>

Target:
onRadioAvailable() { PowerManager pm = (PowerManager)mContext.getSystemService(Context.POWER_SERVICE); sendScreenState(pm.isScreenOn()); }
Source:
<code><START> AsyncSession getSession() { <END> return AsyncSession.this; }</code><technical_language>Is a reason protected</technical_language>

Target:
protected AsyncSession getSession() { return AsyncSession.this; }
Source:
<code>public void setIpAddress( String ipAddress ) { if(! Utils.isEmptyOrWhitespaces(ipAddress)) this.ipAddress = ipAddress; <START> this.logger.finer( "New IP address set in the agent (if not empty): " + ipAddress ); <END> }</code><technical_language>Put logger invocation in "if" block. Otherwise, reading logs, able determine IP address updating not</technical_language>

Target:
public void setIpAddress( String ipAddress ) { if(! Utils.isEmptyOrWhitespaces(ipAddress)) { this.ipAddress = ipAddress; this.logger.finer( "New IP address set in the agent: " + ipAddress ); } }
Source:
<code>public void addUserClaimValues(String userName, ClaimValue[] claims, String profileName) throws UserStoreException { String userAttributeSeparator = ","; String claimSeparator = super.getUserRealm().getRealmConfiguration().getUserStoreProperty( MULTI_ATTRIBUTE_SEPARATOR); <START> if (claimSeparator != null && !claimSeparator.trim().isEmpty()) { <END> userAttributeSeparator = claimSeparator; } for (ClaimValue claim : claims) { String existingClaimValue = getUserStoreManager().getUserClaimValue(userName, claim.getClaimURI(), profileName); if (existingClaimValue == null) { existingClaimValue = ""; } if (claim.getValue() != null && !"".equals(claim.getValue())) { boolean claimValueAlreadyExists = false; if (existingClaimValue.contains(userAttributeSeparator)) { StringTokenizer st = new StringTokenizer(existingClaimValue, userAttributeSeparator); while (st.hasMoreElements()) { String existingValue = st.nextElement().toString(); if (existingValue.equalsIgnoreCase(claim.getValue())) { claimValueAlreadyExists = true; } } } else if(existingClaimValue.equalsIgnoreCase(claim.getValue())) { claimValueAlreadyExists = true; } if(!claimValueAlreadyExists) { String claimValue; if (!"".equals(existingClaimValue)) { claimValue = existingClaimValue + userAttributeSeparator + claim.getValue(); } else { claimValue = claim.getValue(); } getUserStoreManager().setUserClaimValue(userName, claim.getClaimURI(), claimValue, profileName); } } } }</code><technical_language>StringUtils.isNotBlank()</technical_language>

Target:
public void addUserClaimValues(String userName, ClaimValue[] claims, String profileName) throws UserStoreException { String userAttributeSeparator = ","; String claimSeparator = super.getUserRealm().getRealmConfiguration().getUserStoreProperty( MULTI_ATTRIBUTE_SEPARATOR); if (StringUtils.isNotBlank(claimSeparator)) { userAttributeSeparator = claimSeparator; } for (ClaimValue claim : claims) { String existingClaimValue = getUserStoreManager().getUserClaimValue(userName, claim.getClaimURI(), profileName); if (existingClaimValue == null) { existingClaimValue = ""; } if (StringUtils.isNotBlank(claim.getValue())) { boolean claimValueAlreadyExists = false; if (existingClaimValue.contains(userAttributeSeparator)) { StringTokenizer st = new StringTokenizer(existingClaimValue, userAttributeSeparator); while (st.hasMoreElements()) { String existingValue = st.nextElement().toString(); if (existingValue.equalsIgnoreCase(claim.getValue())) { claimValueAlreadyExists = true; } } } else if(existingClaimValue.equalsIgnoreCase(claim.getValue())) { claimValueAlreadyExists = true; } if(!claimValueAlreadyExists) { String claimValue; if (!"".equals(existingClaimValue)) { claimValue = existingClaimValue + userAttributeSeparator + claim.getValue(); } else { claimValue = claim.getValue(); } getUserStoreManager().setUserClaimValue(userName, claim.getClaimURI(), claimValue, profileName); } } } }
Source:
<code>protected Set<Sensor<?>> getSensorsToTrack() { return MutableSet.<Sensor<?>>builder() .addAll(getRequiredConfig(SENSORS_TO_TRACK)) .add(Attributes.SERVICE_UP) <START> .buildImmutable(); <END> }</code><technical_language>ImmutableSet builder instead? confusing build immutable set MutableSet builder, MutableSet#toImmutable() exists</technical_language>

Target:
protected Set<Sensor<?>> getSensorsToTrack() { return ImmutableSet.<Sensor<?>>builder() .addAll(getRequiredConfig(SENSORS_TO_TRACK)) .add(Attributes.SERVICE_UP) .build(); }
Source:
<code>private void deleteTableData(Path tablePath, boolean ifPurge, boolean shouldEnableCm) { if (tablePath != null) { try { wh.deleteDir(tablePath, true, ifPurge, shouldEnableCm); <START> } catch (MetaException e) { <END> LOG.error("Failed to delete table directory: " + tablePath + " " + e.getMessage()); } } }</code><technical_language>change exception ..including run time exception</technical_language>

Target:
private void deleteTableData(Path tablePath, boolean ifPurge, boolean shouldEnableCm) { if (tablePath != null) { try { if (shouldEnableCm) { FileStatus[] statuses = tablePath.getFileSystem(conf).listStatus(tablePath, ReplChangeManager.CMROOT_PATH_FILTER); for (final FileStatus status : statuses) { wh.deleteDir(status.getPath(), true, ifPurge, shouldEnableCm); } FileStatus[] statusWithoutFilter = tablePath.getFileSystem(conf).listStatus(tablePath); if (statusWithoutFilter.length == 0) { wh.deleteDir(tablePath, true, ifPurge, shouldEnableCm); } } else { wh.deleteDir(tablePath, true, ifPurge, shouldEnableCm); } } catch (Exception e) { LOG.error("Failed to delete table directory: " + tablePath + " " + e.getMessage()); } } }
Source:
<code>public void register(final TopicPartition partition, final ProcessorStateManager stateManager) { final StateStoreMetadata storeMetadata = stateManager.storeMetadata(partition); if (storeMetadata == null) { throw new IllegalStateException("Cannot find the corresponding state store metadata for changelog " + partition); } final ChangelogMetadata changelogMetadata = new ChangelogMetadata(storeMetadata, stateManager); if (stateManager.taskType() == Task.TaskType.STANDBY && stateManager.changelogAsSource(partition)) { changelogMetadata.restoreEndOffset = 0L; } if (changelogs.putIfAbsent(partition, changelogMetadata) != null) { throw new IllegalStateException("There is already a changelog registered for " + partition + ", this should not happen: " + changelogs); } <START> addChangelogsToRestoreConsumer(Collections.singleton(partition)); <END> pauseChangelogsFromRestoreConsumer(Collections.singleton(partition)); }</code><technical_language>reason I do this is in consumer, if a partition is paused, try fetch is fetching position in poll call if available. I defer this starting position initialize seek calls. thinking remove illegal-state check remoreFromRestoreConsumer call log a debug</technical_language>

Target:
public void register(final TopicPartition partition, final ProcessorStateManager stateManager) { final StateStoreMetadata storeMetadata = stateManager.storeMetadata(partition); if (storeMetadata == null) { throw new IllegalStateException("Cannot find the corresponding state store metadata for changelog " + partition); } final ChangelogMetadata changelogMetadata = new ChangelogMetadata(storeMetadata, stateManager); if (stateManager.taskType() == Task.TaskType.STANDBY && stateManager.changelogAsSource(partition)) { changelogMetadata.restoreEndOffset = 0L; } if (changelogs.putIfAbsent(partition, changelogMetadata) != null) { throw new IllegalStateException("There is already a changelog registered for " + partition + ", this should not happen: " + changelogs); } }
Source:
<code>OutputStream storeFileStream(String relPath) throws IOException; <START> default boolean features() throws IOException { <END> return false; }</code><technical_language>I get this method name</technical_language>

Target:
OutputStream storeFileStream(String relPath) throws IOException; default boolean getRemoteFtpFeatures() throws IOException { return false; }
Source:
<code>private List<BrickProfileDetails> prepareBrickProfileDetails(GlusterVolumeEntity volume, Object[] brickProfileDetails) { List<BrickProfileDetails> brickProfileDetailsList = new ArrayList<BrickProfileDetails>(); for (Object brickProfileObj : brickProfileDetails) { BrickProfileDetails brickProfileDetail = new BrickProfileDetails(); Map<String, Object> brickProfile = (Map<String, Object>) brickProfileObj; Guid brickId = GlusterCoreUtil.getBrickByQualifiedName(volume.getBricks(), (String) brickProfile.get(BRICK)) <START> .getId(); <END> if (brickId != null) { brickProfileDetail.setBrickId(brickId); } List<StatsInfo> statsInfo = new ArrayList<StatsInfo>(); statsInfo.add(getStatInfo((Map<String, Object>) brickProfile.get(CUMULATIVE_STATS), CUMULATIVE_STATS)); statsInfo.add(getStatInfo((Map<String, Object>) brickProfile.get(INTERVAL_STATS), INTERVAL_STATS)); brickProfileDetail.setStatsInfo(statsInfo); brickProfileDetailsList.add(brickProfileDetail); } return brickProfileDetailsList; }</code><technical_language>This throw NullPointerException if GlusterCoreUtil.getBrickByQualifiedName() returns null ! null check return of GlusterCoreUtil.getBrickByQualifiedName() getId()</technical_language>

Target:
private List<BrickProfileDetails> prepareBrickProfileDetails(GlusterVolumeEntity volume, Object[] brickProfileDetails) { List<BrickProfileDetails> brickProfileDetailsList = new ArrayList<BrickProfileDetails>(); for (Object brickProfileObj : brickProfileDetails) { BrickProfileDetails brickProfileDetail = new BrickProfileDetails(); Map<String, Object> brickProfile = (Map<String, Object>) brickProfileObj; GlusterBrickEntity brick = GlusterCoreUtil.getBrickByQualifiedName(volume.getBricks(), (String) brickProfile.get(BRICK)); if (brick != null) { brickProfileDetail.setBrickId(brick.getId()); } List<StatsInfo> statsInfo = new ArrayList<StatsInfo>(); statsInfo.add(getStatInfo((Map<String, Object>) brickProfile.get(CUMULATIVE_STATS), CUMULATIVE_STATS)); statsInfo.add(getStatInfo((Map<String, Object>) brickProfile.get(INTERVAL_STATS), INTERVAL_STATS)); brickProfileDetail.setStatsInfo(statsInfo); brickProfileDetailsList.add(brickProfileDetail); } return brickProfileDetailsList; }
Source:
<code>public CompletableFuture<Void> handleDefault(InvocationContext ctx, VisitableCommand command) throws Throwable { if (!ctx.isOriginLocal()) { return ctx.continueInvocation(); } Transaction tx; if (transactionManager.getTransaction() != null || (tx = batchContainer.getBatchTransaction()) == null) { return ctx.continueInvocation(); } try { transactionManager.resume(tx); InvocationContext invocationContext = ctx; if (!ctx.isInTxScope()) { log.tracef("Called with a non-tx invocation context: %s", ctx); invocationContext = invocationContextFactory.createInvocationContext(true, -1); } <START> return ctx.shortCircuit(invoker.invoke(invocationContext, command)); <END> } finally { if (transactionManager.getTransaction() != null && batchContainer.isSuspendTxAfterInvocation()) transactionManager.suspend(); } }</code><technical_language>invoker? do invocationContext.continueInvocation()</technical_language>

Target:
public CompletableFuture<Void> handleDefault(InvocationContext ctx, VisitableCommand command) throws Throwable { if (!ctx.isOriginLocal()) { return ctx.continueInvocation(); } Transaction tx; if (transactionManager.getTransaction() != null || (tx = batchContainer.getBatchTransaction()) == null) { return ctx.continueInvocation(); } try { transactionManager.resume(tx); InvocationContext txInvocationContext = ctx; if (!ctx.isInTxScope()) { log.tracef("Called with a non-tx invocation context: %s", ctx); txInvocationContext = invocationContextFactory.createInvocationContext(true, -1); } return ctx.shortCircuit(invoker.invoke(txInvocationContext, command)); } finally { if (transactionManager.getTransaction() != null && batchContainer.isSuspendTxAfterInvocation()) transactionManager.suspend(); } }
Source:
<code>public boolean getFlag(String flag) { String[] flags = getFlags(); for (String <START> flag2 : <END> flags) { if (flag2.equals(flag)) return true; } return false; }</code><technical_language>rename f</technical_language>

Target:
public boolean getFlag(String flag) { for (String f : getFlags()) { if (f.equals(flag)) return true; } return false; }
Source:
<code>protected RepositoryInfo createConfigGroup(String alias, Map<String, Object> env) { RepositoryConfiguration configuration = new RepositoryConfiguration(env); configuration.add(EnvironmentParameters.AVOID_INDEX, true); configuration.add(EnvironmentParameters.SPACE, <START> "system"); <END> RepositoryInfo repositoryConfig = new RepositoryInfo(alias, false, configuration); return repositoryConfig; }</code><technical_language>Constant</technical_language>

Target:
protected RepositoryInfo createConfigGroup(String alias, Map<String, Object> env) { RepositoryConfiguration configuration = new RepositoryConfiguration(env); configuration.add(EnvironmentParameters.AVOID_INDEX, true); configuration.add(EnvironmentParameters.SPACE, SYSTEM); RepositoryInfo repositoryConfig = new RepositoryInfo(alias, false, configuration); return repositoryConfig; }
Source:
<code>private void writeRawBodyToStream(Cursor cursor, SQLiteDatabase db, OutputStream outputStream) throws IOException, MessagingException { long partId = cursor.getLong(ATTACH_PART_ID_INDEX); String rootPart = cursor.getString(ATTACH_ROOT_INDEX); LocalMessage message = loadLocalMessageByRootPartId(db, rootPart); if (message == null) { throw new MessagingException("Unable to find message for attachment!"); } if (message.getMessagePartId() == partId) { message.writeTo(outputStream); } else if (MimeUtility.isMultipart(message.getMimeType())) { Part part = findPartById((Multipart) message.getBody(), partId); if (part == null) { throw new MessagingException("Unable to find attachment part in loaded message!"); } Body body = part.getBody(); if (body == null) { throw new MessagingException("Attachment part isn't available!"); } body.writeTo(outputStream); <START> } <END> }</code><technical_language>I guess message a message/rfc822 body contains wanted part. Also, quietly fail of if cases hit</technical_language>

Target:
private void writeRawBodyToStream(Cursor cursor, SQLiteDatabase db, OutputStream outputStream) throws IOException, MessagingException { long partId = cursor.getLong(ATTACH_PART_ID_INDEX); String rootPart = cursor.getString(ATTACH_ROOT_INDEX); LocalMessage message = loadLocalMessageByRootPartId(db, rootPart); if (message == null) { throw new MessagingException("Unable to find message for attachment!"); } Part part = findPartById(message, partId); if (part == null) { throw new MessagingException("Unable to find attachment part in associated message (db integrity error?)"); } Body body = part.getBody(); if (body == null) { throw new MessagingException("Attachment part isn't available!"); } body.writeTo(outputStream); }
Source:
<code>private void readExistingFile(Path path) { if (preferences != null) { throw new IllegalStateException("Preferences have already been initialized"); } try (Reader reader = Files.newBufferedReader(path, CHARSET)) { logger.debug("Reading preferences file {}", preferencesFilePath.toAbsolutePath()); preferences = gson.fromJson(reader, Preferences.class); } catch (Exception e) { logger.warn("Preferences file " + path.toAbsolutePath() + " could not be read", e); CountDownLatch waitForUser = new CountDownLatch(1); Platform.runLater(() -> { Alert errorReading = new Alert(AlertType.ERROR, "Error reading setting. Reset settings? ", ButtonType.YES, ButtonType.CANCEL); errorReading.showAndWait(); if (errorReading.getResult() == ButtonType.YES) { try { Files.delete(path); preferences = new Preferences(); waitForUser.countDown(); } catch (Exception ex) { <START> Alert errorDeleting = new Alert(AlertType.ERROR, "Error deleting setting. Please delete them yourself. You find them under C:\\Users\\[username]\\AppData\\Roaming\\Forged Alliance Forever\\client.prefs .", ButtonType.OK); <END> errorDeleting.showAndWait(); preferences = new Preferences(); waitForUser.countDown(); } } }); noCatch((NoCatchRunnable) waitForUser::await); } migratePreferences(preferences); }</code><technical_language>hardcode this path; preferencesFilePath.toAbsolutePath()</technical_language>

Target:
private void readExistingFile(Path path) { if (preferences != null) { throw new IllegalStateException("Preferences have already been initialized"); } try (Reader reader = Files.newBufferedReader(path, CHARSET)) { logger.debug("Reading preferences file {}", preferencesFilePath.toAbsolutePath()); preferences = gson.fromJson(reader, Preferences.class); } catch (Exception e) { logger.warn("Preferences file " + path.toAbsolutePath() + " could not be read", e); CountDownLatch waitForUser = new CountDownLatch(1); Platform.runLater(() -> { Alert errorReading = new Alert(AlertType.ERROR, "Error reading setting. Reset settings? ", ButtonType.YES, ButtonType.CANCEL); errorReading.showAndWait(); if (errorReading.getResult() == ButtonType.YES) { try { Files.delete(path); preferences = new Preferences(); waitForUser.countDown(); } catch (Exception ex) { logger.error("Error deleting settings file", ex); Alert errorDeleting = new Alert(AlertType.ERROR, MessageFormat.format("Error deleting setting. Please delete them yourself. You find them under .", preferencesFilePath.toAbsolutePath()), ButtonType.OK); errorDeleting.showAndWait(); preferences = new Preferences(); waitForUser.countDown(); } } }); noCatch((NoCatchRunnable) waitForUser::await); } migratePreferences(preferences); }
Source:
<code>public Map<String, ContextSensitiveTokenType> getAdditionalContextSensitiveKeywords() { <START> Map<String, ContextSensitiveTokenType> result = super.getAdditionalContextSensitiveKeywords(); <END> result.put(new String(GCCKeywords.cp__FINAL), ContextSensitiveTokenType.FINAL); return result; }</code><technical_language>Safer: new HashMap<>(super.getAdditionalContextSensitiveKeywords());</technical_language>

Target:
public Map<String, ContextSensitiveTokenType> getAdditionalContextSensitiveKeywords() { Map<String, ContextSensitiveTokenType> result = new HashMap<>(super.getAdditionalContextSensitiveKeywords()); result.put(GCCKeywords.__FINAL, ContextSensitiveTokenType.FINAL); return result; }
Source:
<code>public final Map<K, V> getAndPutAll(Map<? extends K, ? extends V> map) { <START> return getAndPutAll(map, defaultMetadata, EnumUtil.EMPTY_BIT_SET, () -> getInvocationContextWithImplicitTransaction(map.size())); <END> }</code><technical_language>I if sizing lookupEntries in context justifies this allocation enough - I drop create multi-key context time (and if want optimize single-key case supply proper method handle right - I unnecessary optimization)</technical_language>

Target:
public final Map<K, V> getAndPutAll(Map<? extends K, ? extends V> map) { return getAndPutAll(map, defaultMetadata, EnumUtil.EMPTY_BIT_SET, contextBuilder); }
Source:
<code>public void bind(UserFeed feed, String avatarUrl, boolean isFirst, boolean isLast) { setAvatar(avatarUrl); name.setText(feed.getLogin()); topLine.setVisibility(isFirst ? View.INVISIBLE : View.VISIBLE); bottomLine.setVisibility(isLast ? View.INVISIBLE : View.VISIBLE); divider.setVisibility(isLast ? View.GONE : View.VISIBLE); Action feedAction = feed.getAction(); <START> actionIcon.setImageResource(feedAction.getDrawableId()); <END> setActionIconBackground(itemView.getResources().getColor(feedAction.getColor())); switch (feedAction) { case WATCH: setWatchAction(feed); break; case NEW: setNewAction(feed); break; case WATCH_LATER: setWatchLaterAction(feed); break; case RATING: setRatingAction(feed); break; case STOP_WATCH: setStopWatchAction(feed); break; case ACHIEVEMENT: setAchievementAction(feed); break; } }</code><technical_language>potential NPE feed.getAction() return null. add @Nullable annotation this method</technical_language>

Target:
public void bind(UserFeed feed, String avatarUrl, boolean isFirst, boolean isLast) { setAvatar(avatarUrl); name.setText(feed.getLogin()); topLine.setVisibility(isFirst ? View.INVISIBLE : View.VISIBLE); bottomLine.setVisibility(isLast ? View.INVISIBLE : View.VISIBLE); divider.setVisibility(isLast ? View.GONE : View.VISIBLE); Action feedAction = feed.getAction(); actionIcon.setImageResource(feedAction.getDrawableId()); setActionIconBackground(resources.getColor(feedAction.getColor())); switch (feedAction) { case WATCH: setWatchAction(feed); break; case NEW: case WATCH_LATER: case RATING: case STOP_WATCH: case ACHIEVEMENT: } }
Source:
<code>public static EntityColumn from(Method getter) { checkGetter(getter); String nameForQuery = nameFromGetter(getter); Method annotatedVersion = retrieveAnnotatedVersion(getter); String nameForStore = nameFromAnnotation(annotatedVersion).or(nameForQuery); boolean nullable = getter.getAnnotatedReturnType() <START> .isAnnotationPresent(Nullable.class); <END> return new EntityColumn(getter, nameForQuery, nameForStore, nullable); }</code><technical_language>Please fix alignment</technical_language>

Target:
public static EntityColumn from(Method getter) { checkGetter(getter); Method annotatedVersion = retrieveAnnotatedVersion(getter); String nameForQuery = nameFromGetter(getter); String nameForStore = nameFromAnnotation(annotatedVersion).or(nameForQuery); boolean nullable = mayReturnNull(getter); return new EntityColumn(getter, nameForQuery, nameForStore, nullable); }
Source:
<code>private TaskLockPosse createOrFindLockPosse(Task task, TaskLock taskLock) { giant.lock(); try { Preconditions.checkArgument( task.getGroupId().equals(taskLock.getGroupId()), "lock groupId[%s] is different from task groupId[%s]", taskLock.getGroupId(), task.getGroupId() ); Preconditions.checkArgument( task.getDataSource().equals(taskLock.getDataSource()), "lock dataSource[%s] is different from task dataSource[%s]", taskLock.getDataSource(), task.getDataSource() ); final int priority; if (task.getPriority() == taskLock.getPriority()) { priority = task.getPriority(); } else { <START> if (task.getContextValue(Tasks.PRIORITY_KEY) == null && task.getDefaultPriority() == taskLock.getPriority()) { <END> log.warn("Task priority is missing. Using taskLock priority[%d] instead.", taskLock.getPriority()); priority = taskLock.getPriority(); } else { throw new ISE( "lock priority[%s] is different from task priority[%s]", taskLock.getPriority(), task.getPriority() ); } } return createOrFindLockPosse( taskLock.getType(), task.getId(), taskLock.getGroupId(), taskLock.getDataSource(), taskLock.getInterval(), taskLock.getVersion(), priority, taskLock.isRevoked() ); } finally { giant.unlock(); } }</code><technical_language>I understand this line. If a task lock saved earlier version of Druid missing priority (so 0 read DB) a task running priority specified, then: - task.getContextValue(Tasks.PRIORITY_KEY) is null - task.getDefaultPriority() is some default priority 75 - taskLock.getPriority() is 0 this expression is false, else block throw exception. problem mentioned in PR description is fixed? if unit tests pass, be</technical_language>

Target:
private TaskLockPosse createOrFindLockPosse(Task task, TaskLock taskLock) { giant.lock(); try { Preconditions.checkArgument( task.getGroupId().equals(taskLock.getGroupId()), "lock groupId[%s] is different from task groupId[%s]", taskLock.getGroupId(), task.getGroupId() ); Preconditions.checkArgument( task.getDataSource().equals(taskLock.getDataSource()), "lock dataSource[%s] is different from task dataSource[%s]", taskLock.getDataSource(), task.getDataSource() ); final int taskPriority = task.getPriority(); final int lockPriority = taskLock.getNonNullPriority(); Preconditions.checkArgument( lockPriority == taskPriority, "lock priority[%s] is different from task priority[%s]", lockPriority, taskPriority ); return createOrFindLockPosse( taskLock.getType(), task.getId(), taskLock.getGroupId(), taskLock.getDataSource(), taskLock.getInterval(), taskLock.getVersion(), taskPriority, taskLock.isRevoked() ); } finally { giant.unlock(); } }
Source:
<code>public String getFullDisplayName() { <START> StringBuilder transformedName = new StringBuilder(TestNameTransformer.getTransformedName(getFullName())); <END> if (this.archiveId != null) { transformedName.insert(0, "[" + this.archiveId + "]"); } return transformedName.toString(); }</code><technical_language>I prefer return this.archiveId == null ? TestNameTransformer.getTransformedName(getFullName()) : TestNameTransformer.getTransformedName(getFullName()) + "[" + this.archiveId + "]"; equivalent. allocating a StringBuilder for verbatim case</technical_language>

Target:
public String getFullDisplayName() { String archiveId = this.parent != null ? Util.fixEmptyAndTrim(parent.getArchiveId()) : null; if (archiveId == null) { return TestNameTransformer.getTransformedName(getFullName()); } else { return "[" + archiveId + "] " + TestNameTransformer.getTransformedName(getFullName()); } }
Source:
<code>public boolean equals(Object obj) { <START> if (this == obj) <END> return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; RMNodeData other = (RMNodeData) obj; return other.getName().equals(name) && other.getNodeUrl().equals(nodeUrl); }</code><technical_language>add curly brackets if calls</technical_language>

Target:
public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } if (obj instanceof RMNodeData) { RMNodeData other = (RMNodeData) obj; return other.getName().equals(name) && other.getNodeUrl().equals(nodeUrl); } else { return false; } }
Source:
<code>private void setWidgetsEnabled(final boolean enabled, final Control... controls) { for (Control control : controls) { control.setEnabled(enabled); } if (controls.length > 0 <START> && enabled) <END> { for (Control control : controls) { if (control instanceof Text) { control.setFocus(); break; } } } }</code><technical_language>This if (enable) for loop end gracefully > 0 not</technical_language>

Target:
private void setWidgetsEnabled(final boolean enabled, final Control... controls) { for (Control control : controls) { control.setEnabled(enabled); } if (enabled) { for (Control control : controls) { if (control instanceof Text) { control.setFocus(); break; } } } }
Source:
<code>public ActionResult execute() { String courseId = getNonNullRequestParamValue(Const.ParamsNames.COURSE_ID); InstructorAttributes instructorToAdd = extractCompleteInstructor(courseId); try { logic.createInstructor(instructorToAdd); taskQueuer.scheduleCourseRegistrationInviteToInstructor( userInfo.id, instructorToAdd.email, instructorToAdd.courseId, null, false); } catch (EntityAlreadyExistsException e) { return new JsonResult("An instructor with the same email address already exists in the course.", <START> HttpStatus.SC_BAD_REQUEST); <END> } catch (InvalidParametersException e) { return new JsonResult(e.getMessage(), HttpStatus.SC_BAD_REQUEST); } return new JsonResult("The instructor " + instructorToAdd.name + " has been added successfully. " + "An email containing how to 'join' this course will be sent to " + instructorToAdd.email + " in a few minutes.", HttpStatus.SC_OK); }</code><technical_language>HttpStatus.SC_CONFLICT</technical_language>

Target:
public ActionResult execute() { String courseId = getNonNullRequestParamValue(Const.ParamsNames.COURSE_ID); InstructorAttributes instructorToAdd = extractCompleteInstructor(courseId); try { logic.createInstructor(instructorToAdd); taskQueuer.scheduleCourseRegistrationInviteToInstructor( userInfo.id, instructorToAdd.email, instructorToAdd.courseId, null, false); } catch (EntityAlreadyExistsException e) { return new JsonResult("An instructor with the same email address already exists in the course.", HttpStatus.SC_CONFLICT); } catch (InvalidParametersException e) { return new JsonResult(e.getMessage(), HttpStatus.SC_BAD_REQUEST); } return new JsonResult("The instructor " + instructorToAdd.name + " has been added successfully. " + "An email containing how to 'join' this course will be sent to " + instructorToAdd.email + " in a few minutes.", HttpStatus.SC_OK); }
Source:
<code>public void zeroColOperations() { Table tableZeroCols = new Table(); try { tableZeroCols.add("val"); fail("No columns in table"); } catch (IndexOutOfBoundsException ignored) <START> try { tableZeroCols.addEmptyRow(true); fail("No columns in table"); } catch (IndexOutOfBoundsException ignored) <END> try { tableZeroCols.addEmptyRows(10); fail("No columns in table"); } catch (IndexOutOfBoundsException ignored) try { tableZeroCols.removeColumn(0); fail("No columns in table"); } catch (ArrayIndexOutOfBoundsException ignored) try { tableZeroCols.renameColumn(0, "newName"); fail("No columns in table"); } catch (ArrayIndexOutOfBoundsException ignored) try { tableZeroCols.removeColumn(10); fail("No columns in table"); } catch (ArrayIndexOutOfBoundsException ignored) try { tableZeroCols.renameColumn(10, "newName"); fail("No columns in table"); } catch (ArrayIndexOutOfBoundsException ignored) }</code><technical_language>please align fail() in other lines</technical_language>

Target:
public void zeroColOperations() { Table tableZeroCols = new Table(); try { tableZeroCols.add("val"); fail("No columns in table"); } catch (IndexOutOfBoundsException ignored) try { tableZeroCols.addEmptyRow(); fail("No columns in table"); } catch (IndexOutOfBoundsException ignored) try { tableZeroCols.addEmptyRows(10); fail("No columns in table"); } catch (IndexOutOfBoundsException ignored) try { tableZeroCols.removeColumn(0); fail("No columns in table"); } catch (ArrayIndexOutOfBoundsException ignored) try { tableZeroCols.renameColumn(0, "newName"); fail("No columns in table"); } catch (ArrayIndexOutOfBoundsException ignored) try { tableZeroCols.removeColumn(10); fail("No columns in table"); } catch (ArrayIndexOutOfBoundsException ignored) try { tableZeroCols.renameColumn(10, "newName"); fail("No columns in table"); } catch (ArrayIndexOutOfBoundsException ignored) }
Source:
<code>protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if(requestCode == CALLOUT_ZPL) { Intent response = new Intent(); if(resultCode != Activity.RESULT_CANCELED) { response.putExtra(IntentCallout.INTENT_RESULT_VALUE, ""); } this.setResult(resultCode, response); this.finish(); <START> return; <END> } }</code><technical_language>return is unneeded</technical_language>

Target:
protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if(requestCode == CALLOUT_ZPL) { Intent response = new Intent(); if(resultCode != Activity.RESULT_CANCELED) { response.putExtra(IntentCallout.INTENT_RESULT_VALUE, ""); } this.setResult(resultCode, response); this.finish(); } }
Source:
<code>private void setupTypesHyperlink() { this.fullListOfTypesHyperlink.setForeground(Color.BLUE.darker()); this.fullListOfTypesHyperlink.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); this.fullListOfTypesHyperlink.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { try { Desktop.getDesktop().browse(new URI(PHOTOREC_TYPES_URL)); } catch (IOException | URISyntaxException ex) { <START> logger.log(Level.WARNING, "There was an error going to types huperlink: " + PHOTOREC_TYPES_URL, ex); <END> } } }); }</code><technical_language>Typo - hyperlink</technical_language>

Target:
private void setupTypesHyperlink() { this.fullListOfTypesHyperlink.setForeground(Color.BLUE.darker()); this.fullListOfTypesHyperlink.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); this.fullListOfTypesHyperlink.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { try { Desktop.getDesktop().browse(new URI(PHOTOREC_TYPES_URL)); } catch (IOException | URISyntaxException ex) { logger.log(Level.WARNING, "There was an error going to types hyperlink: " + PHOTOREC_TYPES_URL, ex); } } }); }
Source:
<code>private void filterNestedTargetIgnores( Map<String, List<Mapping>> mappings) { <START> Set<String> ignoreList = new HashSet<String>(); <END> for ( Map.Entry<String, List<Mapping>> mappingEntry : mappings.entrySet() ) { Mapping mapping = first( mappingEntry.getValue() ); if ( mapping.isIgnored() && mapping.getTargetReference().isValid() ) { ignoreList.add( mapping.getTargetName() ); } } Set<String> removeList = new HashSet<String>(); for ( Map.Entry<String, List<Mapping>> mappingEntry : mappings.entrySet() ) { Mapping mapping = first( mappingEntry.getValue() ); TargetReference targetReference = mapping.getTargetReference(); if ( targetReference.isValid() && targetReference.getPropertyEntries().size() > 1 && ignoreList.contains( first( targetReference.getPropertyEntries() ).getName() ) ) { removeList.add( mappingEntry.getKey() ); } } for ( String entryToRemove : removeList ) { mappings.remove( entryToRemove ); } }</code><technical_language>rename this ignoreList removeList / toBeRemoved something? lists... :)</technical_language>

Target:
private void filterNestedTargetIgnores( Map<String, List<Mapping>> mappings) { Set<String> ignored = new HashSet<String>(); for ( Map.Entry<String, List<Mapping>> mappingEntry : mappings.entrySet() ) { Mapping mapping = first( mappingEntry.getValue() ); if ( mapping.isIgnored() && mapping.getTargetReference().isValid() ) { ignored.add( mapping.getTargetName() ); } } Set<String> toBeRemoved = new HashSet<String>(); for ( Map.Entry<String, List<Mapping>> mappingEntry : mappings.entrySet() ) { Mapping mapping = first( mappingEntry.getValue() ); TargetReference targetReference = mapping.getTargetReference(); if ( targetReference.isValid() && targetReference.getPropertyEntries().size() > 1 && ignored.contains( first( targetReference.getPropertyEntries() ).getName() ) ) { toBeRemoved.add( mappingEntry.getKey() ); } } mappings.keySet().removeAll( toBeRemoved ); }
Source:
<code><START> Pop3Connection(Pop3Settings settings, <END> TrustedSocketFactory trustedSocketFactory) throws MessagingException { try { this.settings = settings; SocketAddress socketAddress = new InetSocketAddress(settings.getHost(), settings.getPort()); if (settings.getConnectionSecurity() == ConnectionSecurity.SSL_TLS_REQUIRED) { socket = trustedSocketFactory.createSocket(null, settings.getHost(), settings.getPort(), settings.getClientCertificateAlias()); } else { socket = new Socket(); } socket.connect(socketAddress, RemoteStore.SOCKET_CONNECT_TIMEOUT); in = new BufferedInputStream(socket.getInputStream(), 1024); out = new BufferedOutputStream(socket.getOutputStream(), 512); socket.setSoTimeout(RemoteStore.SOCKET_READ_TIMEOUT); if (!isOpen()) { throw new MessagingException("Unable to connect socket"); } String serverGreeting = executeSimpleCommand(null); capabilities = getCapabilities(); if (settings.getConnectionSecurity() == ConnectionSecurity.STARTTLS_REQUIRED) { performStartTlsUpgrade(trustedSocketFactory, settings.getHost(), settings.getPort(), settings.getClientCertificateAlias()); } performAuthentication(settings.getAuthType(), serverGreeting); } catch (SSLException e) { if (e.getCause() instanceof CertificateException) { throw new CertificateValidationException(e.getMessage(), e); } else { throw new MessagingException("Unable to connect", e); } } catch (GeneralSecurityException gse) { throw new MessagingException( "Unable to open connection to POP server due to security error.", gse); } catch (IOException ioe) { throw new MessagingException("Unable to open connection to POP server.", ioe); } }</code><technical_language>constructor work possible. In ImapConnection open() for that</technical_language>

Target:
Pop3Connection(Pop3Settings settings, TrustedSocketFactory trustedSocketFactory) { this.settings = settings; this.trustedSocketFactory = trustedSocketFactory; }
Source:
<code>private static int zzUnpackAction() { <START> return new int[184]; <END> }</code><technical_language>This is super wrong. zzUnpackAction populates result</technical_language>

Target:
private static int zzUnpackAction() { int result = new int[184]; int offset = 0; offset = zzUnpackAction(ZZ_ACTION_PACKED_0, offset, result); return result; }
Source:
<code>public Object apply(GroupResource resource, PutMember.Input input) throws AuthException, BadRequestException, ResourceConflictException, <START> Exception { <END> return put.get().apply(resource, new PutMembers.Input(id)); }</code><technical_language>I avoid throwing Exception in newer implementations. I find ugly declare throw. I prefer declare apply throw. means deleting throws declaration letting Eclipse fill in throws</technical_language>

Target:
public Object apply(GroupResource resource, PutMember.Input input) throws AuthException, MethodNotAllowedException, BadRequestException, OrmException { PutMembers.Input in = new PutMembers.Input(); in._oneMember = id; return put.get().apply(resource, in); }
Source:
<code>public ReassignmentFinder(List<IdentifierTree> usages) { this.usages = usages; <START> this.reassignments = Lists.newLinkedList(); <END> }</code><technical_language>@m-g-sonar new LinkedList<>() thanks java 7</technical_language>

Target:
public ReassignmentFinder(List<IdentifierTree> usages) { this.usages = usages; this.reassignments = new LinkedList<>(); }
Source:
<code>private ViewInteraction onEmailView() { <START> return onView(withTagValue(Matchers.is((Object) "email"))); <END> }</code><technical_language>is() method statically imported, Matchers. class namespacing removed here, in other examples</technical_language>

Target:
private ViewInteraction onEmailView() { return onView(withTagValue(is((Object) "email"))); }
Source:
<code>public boolean equals(Object obj) { if (!(obj instanceof Cell)) { return false; } Cell other = (Cell) obj; <START> return hasEqualKeys(other) && <END> Objects.equal(value, other.value) && Objects.equal(labels, other.labels); }</code><technical_language>update class doc to: This class stores represents a single row. a flattened version of data of a * {@link Row} confirm change in this file is a no-op? introduced a concept of key in this class. mention this in class doc place is used</technical_language>

Target:
public boolean equals(Object obj) { if (!(obj instanceof Cell)) { return false; } Cell other = (Cell) obj; return equalFamilyQualifierAndTimestamp(other) && Objects.equal(value, other.value) && Objects.equal(labels, other.labels); }
Source:
<code>private static String transform(String value) { LOGGER.debug("Transforming tag key/value for GCP."); if (Crn.isCrn(value)) { try { Crn crn = Crn.fromString(value); value = crn == null ? value : crn.getResource(); } catch (Exception e) { LOGGER.debug("Ignoring CRN ({}) parse error during tag value generation : {}", value, e.getMessage()); } } String sanitized = value.split("@")[0].toLowerCase().replaceAll("[^\\w]", "-"); <START> return StringUtils.right(sanitized, GCP_MAX_TAG_LEN); <END> }</code><technical_language>I beneficial log generated</technical_language>

Target:
private static String transform(String value) { LOGGER.debug("Transforming tag key/value for GCP."); if (Crn.isCrn(value)) { try { Crn crn = Crn.fromString(value); value = crn == null ? value : crn.getResource(); } catch (Exception e) { LOGGER.debug("Ignoring CRN ({}) parse error during tag value generation : {}", value, e.getMessage()); } } String sanitized = value.split("@")[0].toLowerCase().replaceAll("[^\\w]", "-"); String shortenedValue = StringUtils.right(sanitized, GCP_MAX_TAG_LEN); LOGGER.debug("GCP label element has been transformed from '{}' to '{}'", value, shortenedValue); return shortenedValue; }
Source:
<code>private ResultScanner<Row> streamRows(ReadRowsRequest request) { expandPoolIfNecessary(this.bigtableOptions.getChannelCount()); ClientCall<ReadRowsRequest, ReadRowsResponse> readRowsCall = channelPool.newCall(BigtableServiceGrpc.METHOD_READ_ROWS, CallOptions.DEFAULT); CancellationToken cancellationToken = createCancellationToken(readRowsCall); int timeout = retryOptions.getReadPartialRowTimeoutMillis(); ResponseQueueReader responseQueueReader = new ResponseQueueReader(timeout); StreamingBigtableResultScanner resultScanner = <START> new StreamingBigtableResultScanner(responseQueueReader, cancellationToken); <END> ReadRowsResponseListener listener = new ReadRowsResponseListener(responseQueueReader, readRowsCall); asyncUtilities.asyncServerStreamingCall(readRowsCall, request, listener); return resultScanner; }</code><technical_language>options deprecated now</technical_language>

Target:
private ResultScanner<Row> streamRows(ReadRowsRequest request) { expandPoolIfNecessary(this.bigtableOptions.getChannelCount()); boolean isGet = request.getTargetCase() == ReadRowsRequest.TargetCase.ROW_KEY; int streamingBufferSize; int batchRequestSize; if (isGet) { batchRequestSize = 1; streamingBufferSize = 10; } else { batchRequestSize = retryOptions.getStreamingBatchSize(); streamingBufferSize = retryOptions.getStreamingBufferSize(); } ClientCall<ReadRowsRequest, ReadRowsResponse> readRowsCall = channelPool.newCall(BigtableServiceGrpc.METHOD_READ_ROWS, CallOptions.DEFAULT); int timeout = retryOptions.getReadPartialRowTimeoutMillis(); AtomicInteger outstandingRequestCount = new AtomicInteger(batchRequestSize); ResponseQueueReader responseQueueReader = new ResponseQueueReader(timeout, streamingBufferSize, outstandingRequestCount, batchRequestSize, readRowsCall); ReadRowsResponseListener listener = new ReadRowsResponseListener(responseQueueReader, outstandingRequestCount); asyncUtilities.asyncServerStreamingCall(readRowsCall, request, listener); CancellationToken cancellationToken = createCancellationToken(readRowsCall); return new StreamingBigtableResultScanner(responseQueueReader, cancellationToken); }