auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void setParentNames(String names) { <START> parents = new ArrayList<NameKey>(); <END> for (String n : names) parents.add(new NameKey(n)); }</code><technical_language>new ArrayList<NameKey>(names.length)</technical_language>

Target:
public void setParentNames(String names) { parents = new ArrayList<NameKey>(names.length); for (String n : names) { parents.add(new NameKey(n)); } }
Source:
<code>public String getCallbackAddress() { String addr = this.getCallbackParam().getRemoteAddress(); boolean isSecure = this.getCallbackParam().isSecure(); <START> String schema = isSecure ? "https" : "http"; <END> if (addr.contains(":")) { return schema + "://[" + addr + "]:" + actualPort + "/"; } return schema + "://" + addr + ":" + actualPort + "/"; }</code><technical_language>scheme</technical_language>

Target:
public String getCallbackAddress() { String addr = this.getCallbackParam().getRemoteAddress(); boolean ipv6 = addr.contains(":"); String hostname = ipv6 ? "[" + addr + "]" : addr; boolean isSecure = this.getCallbackParam().isSecure(); String scheme = isSecure ? "https" : "http"; return scheme + "://" + hostname + ":" + actualPort + "/"; }
Source:
<code>protected Object readResolve() { <START> buildLock = new ReentrantReadWriteLock(); <END> return this; }</code><technical_language>ReentrantLock suffice do protest writing</technical_language>

Target:
protected Object readResolve() { buildLock = new ReentrantLock(); return this; }
Source:
<code>private static BatteryField getMjBattery (Class c) { if (!MjBatteries.containsKey(c)) { for (Field f : c.getDeclaredFields()) { MjBattery battery = f.getAnnotation (MjBattery.class); if (battery != null) { try{ c.getMethod(f.getName() + "_$eq", double.class); <START> f.setAccessible(true); END> }catch(NoSuchMethodException e){ } if (!f.isAccessible()) { continue; } BatteryField bField = new BatteryField(); bField.field = f; bField.battery = battery; if (f.getType().equals(double.class)) { bField.kind = BatteryKind.Value; } else if (f.getType().isPrimitive()) { throw new RuntimeException( "MJ battery needs to be object or double type"); } else { bField.kind = BatteryKind.Container; } MjBatteries.put(c, bField); return bField; } } MjBatteries.put(c, null); return null; } else { return MjBatteries.get(c); } }</code><technical_language>fix accessibility of field. Creating private fields for storing energy is a common mistake anyway. top of this, avoiding "expected" exceptions possible</technical_language>

Target:
private static BatteryField getMjBattery (Class c) { if (!MjBatteries.containsKey(c)) { for (Field f : c.getDeclaredFields()) { MjBattery battery = f.getAnnotation (MjBattery.class); if (battery != null) { for (Method method : c.getMethods()) { if (method.getName().equals(f.getName() + "_$eq")) { f.setAccessible(true); break; } } if (f.isAccessible() || Modifier.isPublic(f.getModifiers())) { BatteryField bField = new BatteryField(); bField.field = f; bField.battery = battery; if (f.getType().equals(double.class)) { bField.kind = BatteryKind.Value; } else if (f.getType().isPrimitive()) { throw new RuntimeException( "MJ battery needs to be object or double type"); } else { bField.kind = BatteryKind.Container; } MjBatteries.put(c, bField); return bField; } } } MjBatteries.put(c, null); return null; } else { return MjBatteries.get(c); } }
Source:
<code>private void purgeObjectContentAndDb(RepoObject repoObject, ElementFilter elementFilter) throws RepoException { try { try (InputStream content = getObjectInputStream(repoObject)){ if (content == null){ throw new RepoException(RepoException.Type.ObjectNotFound); } } catch (IOException e) { throw new RepoException(e); } <START> if (sqlService.markObjectPurged(repoObject.getKey(), repoObject.getBucketName(), elementFilter.getVersion(), elementFilter.getVersionChecksum(), elementFilter.getTag()) == 0 ){ <END> throw new RepoException(RepoException.Type.ObjectNotFound); } if (sqlService.countUsedAndDeletedObjectsReference(repoObject.getBucketName(), repoObject.getChecksum()) == 0 ){ Boolean removed = objectStore.deleteObject(repoObject); if (Boolean.FALSE.equals(removed)){ throw new RepoException(RepoException.Type.ObjectNotFound); } } } catch (SQLException e) { throw new RepoException(e); } }</code><technical_language>above, extract long method call</technical_language>

Target:
private void purgeObjectContentAndDb(RepoObject repoObject, ElementFilter elementFilter) throws RepoException { try { try (InputStream content = getObjectInputStream(repoObject)){ if (content == null){ throw new RepoException(RepoException.Type.ObjectNotFound); } } catch (IOException e) { throw new RepoException(e); } int objectPurged = sqlService.markObjectPurged(repoObject.getKey(), repoObject.getBucketName(), elementFilter.getVersion(), elementFilter.getVersionChecksum(), elementFilter.getTag()); if (objectPurged == 0){ throw new RepoException(RepoException.Type.ObjectNotFound); } if (sqlService.countUsedAndDeletedObjectsReference(repoObject.getBucketName(), repoObject.getChecksum()) == 0 ){ Boolean removed = objectStore.deleteObject(repoObject); if (!removed){ throw new RepoException(RepoException.Type.ObjectNotFound); } } } catch (SQLException e) { throw new RepoException(e); } }
Source:
<code>public void manipulateTaskDataConcurrently() throws Exception { File file = newTaskDataZipFile(); TaskData data = newTaskData(); <START> List<Throwable> failures = runConcurrently( END> store -> store.getTaskDataState(file), store -> store.discardEdits(file), store -> store.putEdits(file, data), store -> store.putTaskData(file, data, true, true), store -> store.setTaskData(file, data), store -> store.putTaskData(file, TEST_STATE), store -> store.deleteTaskData(file)); assertNoFailures(failures); }</code><technical_language>run this multiple times increase chance of a conflict</technical_language>

Target:
public void manipulateTaskDataConcurrently() throws Exception { File file = newTaskDataZipFile(); for (int i = 0; i <= 10; i++) { List<Throwable> failures = runConcurrently( getTaskDataState(file), discardEdits(file), putEdits(file), putTaskData(file), setTaskData(file), putTaskDataState(file), deleteTaskData(file)); assertNoFailures(failures); } }
Source:
<code>public AuditLogType getAuditLogTypeValue() { <START> return getSucceeded() ? AuditLogType.USER_UPDATED_MOM_POLICIES : null; <END> }</code><technical_language>audit log for failures</technical_language>

Target:
public AuditLogType getAuditLogTypeValue() { return getSucceeded() ? AuditLogType.USER_UPDATED_MOM_POLICIES : AuditLogType.USER_FAILED_TO_UPDATE_MOM_POLICIES; }
Source:
<code>public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) { switch (requestCode) { case RequestCodes.CRED_HINT: if (resultCode == Activity.RESULT_OK) { handleCredential((Credential) data.getParcelableExtra(Credential.EXTRA_KEY)); } else { startAuthMethodChoice(); } break; case RequestCodes.AUTH_PICKER_FLOW: case RequestCodes.EMAIL_FLOW: case RequestCodes.PHONE_FLOW: case RequestCodes.PROVIDER_FLOW: IdpResponse response = IdpResponse.fromResultIntent(data); if (response == null) { setResult(Resource.<IdpResponse>forFailure(new UserCancellationException())); } else if (response.isSuccessful()) { setResult(Resource.forSuccess(response)); } else { <START> if (response.getError().getErrorCode() == <END> ErrorCodes.ANONYMOUS_UPGRADE_MERGE_CONFLICT) { setResult(Resource.<IdpResponse>forFailure(new FirebaseAuthAnonymousUpgradeException( ErrorCodes.ANONYMOUS_UPGRADE_MERGE_CONFLICT, response))); } else { setResult(Resource.<IdpResponse>forFailure(response.getError())); } } } }</code><technical_language>nit: than: else { if { } else { } } another else if a final else</technical_language>

Target:
public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) { switch (requestCode) { case RequestCodes.CRED_HINT: if (resultCode == Activity.RESULT_OK) { handleCredential((Credential) data.getParcelableExtra(Credential.EXTRA_KEY)); } else { startAuthMethodChoice(); } break; case RequestCodes.AUTH_PICKER_FLOW: case RequestCodes.EMAIL_FLOW: case RequestCodes.PHONE_FLOW: case RequestCodes.PROVIDER_FLOW: IdpResponse response = IdpResponse.fromResultIntent(data); if (response == null) { setResult(Resource.<IdpResponse>forFailure(new UserCancellationException())); } else if (response.isSuccessful()) { setResult(Resource.forSuccess(response)); } else if (response.getError().getErrorCode() == ErrorCodes.ANONYMOUS_UPGRADE_MERGE_CONFLICT) { handleMergeFailure(response); } else { setResult(Resource.<IdpResponse>forFailure(response.getError())); } } }
Source:
<code>public void put(@Nonnull User user, @Nonnull String accessToken) { Log.debug("Populating the cache for username: " + user.getId()); try { user.addProperty(new GithubAccessTokenProperty(accessToken)); } catch (IOException e) { <START> throw new RuntimeException(e); <END> } }</code><technical_language>log proceed I guess</technical_language>

Target:
public static void put(@Nonnull User user, @Nonnull String accessToken) { Log.debug("Populating the cache for username: " + user.getId()); try { user.addProperty(new GithubAccessTokenProperty(accessToken)); } catch (IOException e) { Log.warn("Received an exception when trying to add the GitHub access token to the user: " + user.getId(), e); } }
Source:
<code>private void initDimensionHandlers() { for (String dim : availableDimensions) { if (Strings.isNullOrEmpty(dim)) { continue; <START> } <END> ColumnCapabilities capabilities = getColumn(dim).getCapabilities(); DimensionHandler handler = DimensionHandlerUtils.getHandlerFromCapabilities(dim, capabilities, null); dimensionHandlers.put(dim, handler); } }</code><technical_language>This is needed if availableDimensions filtered</technical_language>

Target:
private void initDimensionHandlers() { for (String dim : availableDimensions) { ColumnCapabilities capabilities = getColumn(dim).getCapabilities(); DimensionHandler handler = DimensionHandlerUtils.getHandlerFromCapabilities(dim, capabilities, null); dimensionHandlers.put(dim, handler); } }
Source:
<code>private List<ResponseOutput> buildResponses( List<FeedbackResponseAttributes> responses, FeedbackSessionResultsBundle bundle) { Map<String, List<FeedbackResponseAttributes>> responsesMap = new HashMap<>(); for (FeedbackResponseAttributes response : responses) { responsesMap.computeIfAbsent(response.recipient, k -> new ArrayList<>()).add(response); } List<ResponseOutput> output = new ArrayList<>(); responsesMap.forEach((recipient, responsesForRecipient) -> { String recipientName = removeAnonymousHash(bundle.getNameForEmail(recipient)); String recipientTeam = bundle.getTeamNameForEmail(recipient); for (FeedbackResponseAttributes response : responsesForRecipient) { String giverName = removeAnonymousHash(bundle.getGiverNameForResponse(response)); String giverEmail = response.giverEmail; String giverTeam = bundle.getTeamNameForEmail(response.giver); <START> output.add(new ResponseOutput(giverName, giverTeam, giverEmail, response.giverSection, <END> recipientName, recipientTeam, response.recipientSection, response.responseDetails)); } }); return output; }</code><technical_language>proceed, explain approach deal situations: happen giverEmail field? - Response is anonymous, a student/instructor - Response is anonymous, a team - Response is anonymous, student/instructor/team I if entity is team, calling giverEmail is anymore</technical_language>

Target:
private List<ResponseOutput> buildResponses( List<FeedbackResponseAttributes> responses, FeedbackSessionResultsBundle bundle) { Map<String, List<FeedbackResponseAttributes>> responsesMap = new HashMap<>(); for (FeedbackResponseAttributes response : responses) { responsesMap.computeIfAbsent(response.recipient, k -> new ArrayList<>()).add(response); } List<ResponseOutput> output = new ArrayList<>(); responsesMap.forEach((recipient, responsesForRecipient) -> { String recipientName = removeAnonymousHash(bundle.getNameForEmail(recipient)); String recipientTeam = bundle.getTeamNameForEmail(recipient); for (FeedbackResponseAttributes response : responsesForRecipient) { String giverName = removeAnonymousHash(bundle.getGiverNameForResponse(response)); Map<String, Set<String>> teamNameToMembersEmailTable = bundle.rosterTeamNameMembersTable; String relatedGiverEmail = teamNameToMembersEmailTable.containsKey(response.giver) ? teamNameToMembersEmailTable.get(response.giver).iterator().next() : response.giver; String giverTeam = bundle.getTeamNameForEmail(response.giver); output.add(new ResponseOutput(giverName, giverTeam, relatedGiverEmail, response.giverSection, recipientName, recipientTeam, response.recipientSection, response.responseDetails)); } }); return output; }
Source:
<code>public static List<Query> createProvidedQueriesForBusinessObject(final BusinessObject businessObject) { final List<Query> queries = new ArrayList<Query>(); final Set<String> queryNames = new HashSet<String>(); <START> if (!containsQuertWithName(businessObject, getQueryName(Field.PERSISTENCE_ID))) { <END> final Query query = createQueryForPersistenceId(businessObject); queries.add(query); queryNames.add(query.getName()); } for (final UniqueConstraint uc : businessObject.getUniqueConstraints()) { final Query query = createQueryForUniqueConstraint(businessObject, uc); queryNames.add(query.getName()); queries.add(query); } for (final Field f : businessObject.getFields()) { if (f instanceof SimpleField) { if (f.isCollection() == null || !f.isCollection()) { final String potentialConflictingQueryName = createQueryNameForField(f); if (!queryNames.contains(potentialConflictingQueryName)) { final Query query = createQueryForField(businessObject, f); queries.add(query); } } } } queries.add(createSelectAllQueryForBusinessObject(businessObject)); return queries; }</code><technical_language>typo "quert" => query</technical_language>

Target:
public static List<Query> createProvidedQueriesForBusinessObject(final BusinessObject businessObject) { final List<Query> queries = new ArrayList<Query>(); final Set<String> queryNames = new HashSet<String>(); if (!containsQueryWithName(businessObject, getQueryName(Field.PERSISTENCE_ID))) { final Query query = createQueryForPersistenceId(businessObject); queries.add(query); queryNames.add(query.getName()); } for (final UniqueConstraint uc : businessObject.getUniqueConstraints()) { final Query query = createQueryForUniqueConstraint(businessObject, uc); queryNames.add(query.getName()); queries.add(query); } for (final Field f : businessObject.getFields()) { if (f instanceof SimpleField) { if (f.isCollection() == null || !f.isCollection()) { final String potentialConflictingQueryName = createQueryNameForField(f); if (!queryNames.contains(potentialConflictingQueryName)) { final Query query = createQueryForField(businessObject, f); queries.add(query); } } } } queries.add(createSelectAllQueryForBusinessObject(businessObject)); return queries; }
Source:
<code>public void testOTAForFactoryClockSyncIssueNoPillsHighUptime() { BaseResourceTestHelper.stubGetClientDetails(this.oAuthTokenStore, Optional.of(BaseResourceTestHelper.getAccessToken())); BaseResourceTestHelper.stubKeyFromKeyStore(this.keyStore, SENSE_ID, Optional.of(KEY)); BaseResourceTestHelper.stubGetHeader(this.httpServletRequest, HelloHttpHeader.SENSE_ID, SENSE_ID); stubGetUserInfo(this.mergedUserInfoDynamoDB, userInfoList); stubGetOTAWindowStart(otaConfiguration, 11); stubGetOTAWindowEnd(otaConfiguration, 20); stubGetPopulatedFirmwareFileListForGroup(this.firmwareUpdateStore, FeatureFlipper.OTA_RELEASE, FW_VERSION_0_9_22_RC7, fileList); final List<String> groups = Lists.newArrayList(); <START> groups.add(FeatureFlipper.OTA_RELEASE); <END> stubGetGroups(groupFlipper, groups); stubGetFeatureActive(featureFlipper, FeatureFlipper.ENABLE_OTA_UPDATES, groups, true); stubGetFeatureActive(featureFlipper, FeatureFlipper.OTA_RELEASE, groups, true); final byte[] data = this.receiveResource.receiveBatchSenseData(generateValidProtobufWithSignature(KEY, 3600, FW_VERSION_0_9_22_RC7, FUTURE_UNIX_TIMESTAMP)); final byte[] protobufBytes = Arrays.copyOfRange(data, 16 + 32, data.length); final OutputProtos.SyncResponse syncResponse; try { syncResponse = OutputProtos.SyncResponse.parseFrom(protobufBytes); assertThat(syncResponse.hasResetMcu(), is(true)); assertThat(syncResponse.getResetMcu(), is(false)); assertThat(syncResponse.getFilesCount(), is(1)); } catch (InvalidProtocolBufferException e) { e.printStackTrace(); assertThat(true, is(false)); } }</code><technical_language>above, cam pass element of list newArrayList(x,x,x); method</technical_language>

Target:
public void testOTAForFactoryClockSyncIssueNoPillsHighUptime() { BaseResourceTestHelper.stubGetClientDetails(oAuthTokenStore, Optional.of(BaseResourceTestHelper.getAccessToken())); BaseResourceTestHelper.stubKeyFromKeyStore(keyStore, SENSE_ID, Optional.of(KEY)); BaseResourceTestHelper.stubGetHeader(httpServletRequest, HelloHttpHeader.SENSE_ID, SENSE_ID); stubGetUserInfo(mergedUserInfoDynamoDB, userInfoList); stubGetOTAWindowStart(otaConfiguration, 11); stubGetOTAWindowEnd(otaConfiguration, 20); stubGetPopulatedFirmwareFileListForGroup(firmwareUpdateStore, FeatureFlipper.OTA_RELEASE, FW_VERSION_0_9_22_RC7, fileList); final List<String> groups = Lists.newArrayList(FeatureFlipper.OTA_RELEASE); stubGetGroups(groupFlipper, groups); stubGetFeatureActive(featureFlipper, FeatureFlipper.ENABLE_OTA_UPDATES, groups, true); stubGetFeatureActive(featureFlipper, FeatureFlipper.OTA_RELEASE, groups, true); final byte[] data = receiveResource.receiveBatchSenseData(generateValidProtobufWithSignature(KEY, 3600, FW_VERSION_0_9_22_RC7, FUTURE_UNIX_TIMESTAMP)); final byte[] protobufBytes = Arrays.copyOfRange(data, 16 + 32, data.length); final OutputProtos.SyncResponse syncResponse; try { syncResponse = OutputProtos.SyncResponse.parseFrom(protobufBytes); assertThat(syncResponse.hasResetMcu(), is(true)); assertThat(syncResponse.getResetMcu(), is(false)); assertThat(syncResponse.getFilesCount(), is(1)); } catch (InvalidProtocolBufferException e) { e.printStackTrace(); assertThat(true, is(false)); } }
Source:
<code>private EquivalenceUpdater<Container> rteVodContainerUpdater(Set<Publisher> acceptablePublishers) { return ContentEquivalenceUpdater.<Container> builder() .withExcludedUris(excludedUrisFromProperties()) <START> .withGenerator(TitleSearchGenerator.create(searchResolver, Container.class, acceptablePublishers, DEFAULT_EXACT_TITLE_MATCH_SCORE) <END> ) .withScorers(ImmutableSet.of( new TitleMatchingContainerScorer(DEFAULT_EXACT_TITLE_MATCH_SCORE), new ContainerHierarchyMatchingScorer( contentResolver, Score.negativeOne(), new SubscriptionCatchupBrandDetector(contentResolver) ) )) .withCombiner(new RequiredScoreFilteringCombiner<Container>( new NullScoreAwareAveragingCombiner<Container>(), TitleMatchingContainerScorer.NAME, ScoreThreshold.greaterThanOrEqual(DEFAULT_EXACT_TITLE_MATCH_SCORE)) ) .withFilter(this.filtersForRTE()) .withExtractor(PercentThresholdAboveNextBestMatchEquivalenceExtractor.atLeastNTimesGreater(1.5)) .withHandler(containerResultHandlers(acceptablePublishers)) .build(); }</code><technical_language>Line length</technical_language>

Target:
private EquivalenceUpdater<Container> rteVodContainerUpdater( Set<Publisher> acceptablePublishers ) { return ContentEquivalenceUpdater.<Container> builder() .withExcludedUris(excludedUrisFromProperties()) .withGenerator(TitleSearchGenerator.create( searchResolver, Container.class, acceptablePublishers, DEFAULT_EXACT_TITLE_MATCH_SCORE ) ) .withScorers(ImmutableSet.of( new TitleMatchingContainerScorer(DEFAULT_EXACT_TITLE_MATCH_SCORE), new ContainerHierarchyMatchingScorer( contentResolver, Score.negativeOne(), new SubscriptionCatchupBrandDetector(contentResolver) ) )) .withCombiner(new RequiredScoreFilteringCombiner<Container>( new NullScoreAwareAveragingCombiner<Container>(), TitleMatchingContainerScorer.NAME, ScoreThreshold.greaterThanOrEqual(DEFAULT_EXACT_TITLE_MATCH_SCORE)) ) .withFilter(filtersForRTE()) .withExtractor( PercentThresholdAboveNextBestMatchEquivalenceExtractor .atLeastNTimesGreater(1.5) ) .withHandler(containerResultHandlers(acceptablePublishers)) .build(); }
Source:
<code>protected synchronized long generateTime() { Logger.d(TAG, "Generating a time for schedule of MQ"); fixNowAndGetAllowedWindow(); Calendar startIfToday = (Calendar) now.clone(); startIfToday.set(Calendar.HOUR_OF_DAY, startAllowedHour); Calendar startIfTodayLast = (Calendar) startIfToday.clone(); <START> startIfToday.add(Calendar.HOUR_OF_DAY, -3); <END> startIfToday.set(Calendar.MINUTE, startAllowedMinute); Calendar startIfTomorrow = (Calendar) startIfToday.clone(); startIfTomorrow.add(Calendar.DAY_OF_YEAR, 1); long scheduledTime; if (now.before(startIfToday)) { Logger.d(TAG, "now < morning time today - 3 -> scheduling today"); scheduledTime = startIfToday.getTimeInMillis(); } else if (now.after(startIfToday) && now.before(startIfTodayLast) && statusManager.isLastMQNotifLongAgo()) { Logger.d(TAG, "morning time today > now > morning time today - 3 -> scheduling today and now"); scheduledTime = now.getTimeInMillis(); } else { Logger.d(TAG, "now > morning time today -> scheduling tomorrow"); scheduledTime = startIfTomorrow.getTimeInMillis(); } long delay = scheduledTime - now.getTimeInMillis(); logDelay(delay); return nowUpTime + delay; }</code><technical_language>Add here: // Notify 3 hours opening of bother window startIfTodayLast.add(Calendar.HOUR_OF_DAY, 3); 24h - 3h - 3h = 18h</technical_language>

Target:
protected synchronized long generateTime() { Logger.d(TAG, "Generating a time for schedule of MQ"); fixNowAndGetAllowedWindow(); Calendar startIfToday = (Calendar) now.clone(); startIfToday.set(Calendar.HOUR_OF_DAY, startAllowedHour); Calendar startIfTodayLast = (Calendar) startIfToday.clone(); startIfTodayLast.add(Calendar.HOUR_OF_DAY, 3); startIfToday.add(Calendar.HOUR_OF_DAY, -3); startIfToday.set(Calendar.MINUTE, startAllowedMinute); Calendar startIfTomorrow = (Calendar) startIfToday.clone(); startIfTomorrow.add(Calendar.DAY_OF_YEAR, 1); long scheduledTime; if (now.before(startIfToday)) { Logger.d(TAG, "now < morning time today - 3 -> scheduling today"); scheduledTime = startIfToday.getTimeInMillis(); } else if (now.after(startIfToday) && now.before(startIfTodayLast) && statusManager.isLastMQNotifLongAgo()) { Logger.d(TAG, "morning time today + 3 > now > morning time today - 3 -> scheduling today and now"); scheduledTime = now.getTimeInMillis() + 10 * 1000; } else { Logger.d(TAG, "now > morning time today + 3 -> scheduling tomorrow"); scheduledTime = startIfTomorrow.getTimeInMillis(); } long delay = scheduledTime - now.getTimeInMillis(); logDelay(delay); return nowUpTime + delay; }
Source:
<code>public void testGraphQLTimeZoneDeserialize() { TimeZone expectedTz = TimeZone.getTimeZone("EST"); String input = "EST"; <START> TimeZoneSerde timeZoneScalar = new TimeZoneSerde(); <END> SerdeCoercing timeZoneSerde = new SerdeCoercing("", timeZoneScalar); Object actualTz = timeZoneSerde.parseLiteral(new StringValue(input)); assertEquals(expectedTz, actualTz); }</code><technical_language>rename this variable serde</technical_language>

Target:
public void testGraphQLTimeZoneDeserialize() { TimeZone expectedTz = TimeZone.getTimeZone("EST"); String input = "EST"; TimeZoneSerde timeZoneSerde = new TimeZoneSerde(); SerdeCoercing serdeCoercing = new SerdeCoercing("", timeZoneSerde); Object actualTz = serdeCoercing.parseLiteral(new StringValue(input)); assertEquals(expectedTz, actualTz); }
Source:
<code>public void getEnrichedHosts() throws Exception { System.out.println(CLASS_NAME + "getEnrichedHosts"); createdHost = facilitiesManagerEntry.addHosts(sess, hosts, facility).get(0); hostsForDeletion.add(hosts.get(0)); Attribute attr = new Attribute(); attr.setNamespace("urn:perun:host:attribute-def:opt"); attr.setFriendlyName("host-test-for-list-of-names-attribute"); attr.setType(String.class.getName()); attr.setValue("HostAttributeForList"); perun.getAttributesManagerBl().createAttribute(sess, attr); perun.getAttributesManagerBl().setAttribute(sess, createdHost, attr); List<String> attrNames = new ArrayList<>(); attrNames.add(attr.getName()); List<Attribute> hostAttributes = new ArrayList<>(); hostAttributes.add(attr); EnrichedHost actualEnrichedHost = new EnrichedHost(createdHost, hostAttributes); List<EnrichedHost> expectedEnrichedHosts = facilitiesManagerEntry.getEnrichedHosts(sess, facility, attrNames); EnrichedHost expectedHost = expectedEnrichedHosts.get(0); <START> assertEquals("Created and returned enrichedHost should be the same", expectedHost, actualEnrichedHost); <END> }</code><technical_language>changed logic. need check if expected attributes manually</technical_language>

Target:
public void getEnrichedHosts() throws Exception { System.out.println(CLASS_NAME + "getEnrichedHosts"); createdHost = facilitiesManagerEntry.addHosts(sess, hosts, facility).get(0); hostsForDeletion.add(hosts.get(0)); Attribute attr = new Attribute(); attr.setNamespace("urn:perun:host:attribute-def:opt"); attr.setFriendlyName("host-test-for-list-of-names-attribute"); attr.setType(String.class.getName()); attr.setValue("HostAttributeForList"); perun.getAttributesManagerBl().createAttribute(sess, attr); perun.getAttributesManagerBl().setAttribute(sess, createdHost, attr); List<String> attrNames = new ArrayList<>(); attrNames.add(attr.getName()); List<Attribute> hostAttributes = new ArrayList<>(); hostAttributes.add(attr); EnrichedHost actualEnrichedHost = new EnrichedHost(createdHost, hostAttributes); List<EnrichedHost> expectedEnrichedHosts = facilitiesManagerEntry.getEnrichedHosts(sess, facility, attrNames); EnrichedHost expectedEnrichedHost = expectedEnrichedHosts.get(0); assertEquals("Created and returned enrichedHost should be the same", expectedEnrichedHost, actualEnrichedHost); assertEquals("Number of attributes should be same", expectedEnrichedHost.getHostAttributes().size(), actualEnrichedHost.getHostAttributes().size()); assertTrue("Returned enrichedHost should have all the desired attributes", expectedEnrichedHost.getHostAttributes().containsAll(hostAttributes)); }
Source:
<code>public CompletableFuture<String> gets(String row, Column column, String defaultValue) { AsyncGet curAsyncGet = new AsyncGet(row, column, defaultValue); getsQueue.add(curAsyncGet); executorService.submit(() -> { <START> int i = 0; <END> Collection<RowColumn> rowColumns = new HashSet<>(); for (AsyncGet asyncGet : getsQueue) { rowColumns.add(asyncGet.rc); } Map<RowColumn, Bytes> getsMap = tx.get(rowColumns); while (!getsQueue.isEmpty()) { AsyncGet asyncGet = getsQueue.poll(); Bytes bytesRes = getsMap.get(asyncGet.rc); asyncGet.res.complete(bytesRes == null ? defaultValue : bytesRes.toString()); } }); return curAsyncGet.res; }</code><technical_language>In face of concurrency this lambda is correct. I recommend I try explain why. java //use arraylist instead of hashset performance need for unique List <AsyncGet> = new ArrayList(); asyncGets.drainTo(gets); //not if I syntax correct, I Guava this method Collection<RowColumn> rowColumns = Collections2.transform(gets, ag -> ag.rc); Map<RowColumn, Bytes> getsMap = tx.get(rowColumns); //process drained queue... do want touch queue new added. for(AsyncGet asynGet : gets) { Bytes result = getsMap.get(asyncGet.rc); asyncGet.res.complete(result); //TODO handle default } current code if execservice multiple threads multiple threads process AsyncGet request. drainTo LinkedBlockingQueue avoids this. This is true for collections, this collection impl a lock in drainTo</technical_language>

Target:
public CompletableFuture<String> gets(String row, Column column, String defaultValue) { Bytes defaultValueBytes = defaultValue == null ? new Bytes() : Bytes.of(defaultValue); return get(Bytes.of(row), column, defaultValueBytes).thenApply(b -> b.toString()); }
Source:
<code>private static int addToDatabase(Connection sql, User user, Course course, String title, String description, Date creationDate, String tag, String extension) throws ServiceException { OMUtil.sqlCheck(sql); OMUtil.nullCheck(user); OMUtil.nullCheck(course); OMUtil.nullCheck(title); OMUtil.nullCheck(description); <START> OMUtil.nullCheck(tag); <END> OMUtil.nullCheck(extension); if (title.length() < MIN_TITLE || title.length() > MAX_TITLE) { throw new ServiceException(ServiceStatus.APP_INVALID_TITLE_LENGTH); } if (description.length() < MIN_DESCRIPTION || description.length() > MAX_DESCRIPTION) { throw new ServiceException(ServiceStatus.APP_INVALID_DESCRIPTION_LENGTH); } if (extension.length() < MIN_EXTENSION || extension.length() > MAX_EXTENSION) { throw new ServiceException(ServiceStatus.APP_INVALID_EXTENSION_LENGTH); } return FileMetadataTable.insertFileData(sql, user.getID(), course.getID(), title, description, creationDate, tag, extension); }</code><technical_language>allow a file tagged, nullChecking tag problems</technical_language>

Target:
private static int addToDatabase(Connection sql, User user, Course course, String title, String description, Date creationDate, String tag, String extension) throws ServiceException { OMUtil.sqlCheck(sql); OMUtil.nullCheck(user); OMUtil.nullCheck(course); OMUtil.nullCheck(title); OMUtil.nullCheck(description); OMUtil.nullCheck(extension); if (title.length() < MIN_TITLE || title.length() > MAX_TITLE) { throw new ServiceException(ServiceStatus.APP_INVALID_TITLE_LENGTH); } if (description.length() < MIN_DESCRIPTION || description.length() > MAX_DESCRIPTION) { throw new ServiceException(ServiceStatus.APP_INVALID_DESCRIPTION_LENGTH); } if (extension.length() < MIN_EXTENSION || extension.length() > MAX_EXTENSION) { throw new ServiceException(ServiceStatus.APP_INVALID_EXTENSION_LENGTH); } return FileMetadataTable.insertFileData(sql, user.getID(), course.getID(), title, description, creationDate, tag, extension); }
Source:
<code>public String getFileAsString(String filename) throws Exception { File fileToRead = new File(filename); if (!fileToRead.exists()) { LOGGER.finest( "Absolute file " + filename + " does not exist - checking relative to git dir"); fileToRead = repo.getWorkTree(); fileToRead = new File(fileToRead, filename); } <START> LOGGER.finer("Reading commit message from " + fileToRead.getPath()); <END> return Files.toString(fileToRead, Charsets.UTF_8); }</code><technical_language>slf4j parameterized logging for performance: <LINK_0></technical_language>

Target:
public String getFileAsString(String filename) throws Exception { File fileToRead = new File(filename); if (!fileToRead.exists()) { LOGGER.finest( "Absolute file " + filename + " does not exist - checking relative to git dir"); fileToRead = repo.getWorkTree(); fileToRead = new File(fileToRead, filename); } LOGGER.log(Level.FINER, "Reading commit message from {0}", fileToRead.getPath()); return Files.toString(fileToRead, Charsets.UTF_8); }
Source:
<code>public LatLng getGoogleMapsLocation() { <START> ParseGeoPoint pGP = (ParseGeoPoint) getClient().get("location"); <END> return new LatLng(pGP.getLatitude(), pGP.getLongitude()); }</code><technical_language>here...one noticed is if location == null NPE exceptions get thrown. check null here</technical_language>

Target:
public LatLng getGoogleMapsLocation() { return getClient().getGoogleMapsLocation(); }
Source:
<code>public void read(InputStream input, Schema inputSchema, InputBuilder messageBuilder) throws ReaderException { this.messageBuilder = messageBuilder; this.inputSchema = inputSchema; OMXMLParserWrapper parserWrapper = OMXMLBuilderFactory.createOMBuilder(input); OMElement root = parserWrapper.getDocumentElement(); this.jsonSchema = getInputSchema().getSchemaMap(); try { XMLTraverse(root, null, jsonSchema); jsonBuilder.writeEndObject(); writeTerminateElement(); <START> } catch (IOException e) { <END> throw new ReaderException("IO Error while parsing xml input stream. " + e.getMessage()); } catch (JSException e) { throw new ReaderException("JSException while parsing xml input stream. " + e.getMessage()); } catch (SchemaException e) { throw new ReaderException("SchemaException while parsing xml input stream. " + e.getMessage()); } catch (InvalidPayloadException e) { throw new ReaderException("InvalidPayLoad while parsing xml input stream. " + e.getMessage()); } }</code><technical_language>a single catch clause</technical_language>

Target:
public void read(InputStream input, Schema inputSchema, InputBuilder messageBuilder) throws ReaderException { this.messageBuilder = messageBuilder; this.inputSchema = inputSchema; OMXMLParserWrapper parserWrapper = OMXMLBuilderFactory.createOMBuilder(input); OMElement root = parserWrapper.getDocumentElement(); this.jsonSchema = getInputSchema().getSchemaMap(); try { XMLTraverse(root, null, jsonSchema); jsonBuilder.writeEndObject(); writeTerminateElement(); } catch (IOException | JSException | SchemaException | InvalidPayloadException e) { throw new ReaderException("Error while parsing XML input stream. " + e.getMessage()); } }
Source:
<code>public void testIntervals() throws Exception { final File inputSam = new File("testdata/picard/sam/viewsam_intervals_test.sam"); final File inputIntervalsFile = new File("testdata/picard/sam/viewsam_intervals_test.interval_list"); final File viewSamOutputFile = File.createTempFile("ViewSamTest.output.", ".sam"); viewSamOutputFile.deleteOnExit(); final String[] args = new String[] { "INPUT=" + inputSam.getAbsolutePath(), "INTERVAL_LIST=" + inputIntervalsFile.getAbsolutePath(), }; final PrintStream viewSamPrintStream = new PrintStream(viewSamOutputFile); Assert.assertEquals(runViewSamAsCmdLine(viewSamPrintStream, args), 0); viewSamPrintStream.close(); final IntervalList inputIntervalsList = IntervalList.fromFile(inputIntervalsFile); final List<Interval> intervals = inputIntervalsList.uniqued().getIntervals(); final SamReader samReader = SamReaderFactory.makeDefault().open(viewSamOutputFile); boolean foundMatches = false; for (SAMRecord samRecord : samReader) { <START> Interval samRecordInterval = new Interval(samRecord.getContig(), samRecord.getStart(), samRecord.getEnd()); <END> boolean samRecordIntervalOverlaps = false; for (Interval interval : intervals) { if (interval.intersects(samRecordInterval)) { samRecordIntervalOverlaps = true; foundMatches = true; break; } } Assert.assertTrue(samRecordIntervalOverlaps, "SAM record written out was not overlapped by an interval."); } Assert.assertTrue(foundMatches, "No SAM records overlapped the given intervals."); }</code><technical_language>final</technical_language>

Target:
public void testIntervals() throws Exception { final File inputSam = new File("testdata/picard/sam/viewsam_intervals_test.sam"); final File inputIntervalsFile = new File("testdata/picard/sam/viewsam_intervals_test.interval_list"); final File viewSamOutputFile = File.createTempFile("ViewSamTest.output.", ".sam"); viewSamOutputFile.deleteOnExit(); final ViewSam viewSam = new ViewSam(); viewSam.INPUT = inputSam.getAbsolutePath(); viewSam.INTERVAL_LIST = inputIntervalsFile; final PrintStream viewSamPrintStream = new PrintStream(viewSamOutputFile); Assert.assertEquals(viewSam.writeSamText(viewSamPrintStream), 0); viewSamPrintStream.close(); final IntervalList inputIntervalsList = IntervalList.fromFile(inputIntervalsFile); final List<Interval> intervals = inputIntervalsList.uniqued().getIntervals(); final SamReader samReader = SamReaderFactory.makeDefault().open(viewSamOutputFile); boolean foundMatches = false; for (final SAMRecord samRecord : samReader) { final Interval samRecordInterval = new Interval(samRecord.getContig(), samRecord.getStart(), samRecord.getEnd()); boolean samRecordIntervalOverlaps = false; for (final Interval interval : intervals) { if (interval.intersects(samRecordInterval)) { samRecordIntervalOverlaps = true; foundMatches = true; break; } } Assert.assertTrue(samRecordIntervalOverlaps, "SAM record written out was not overlapped by an interval."); } Assert.assertTrue(foundMatches, "No SAM records overlapped the given intervals."); }
Source:
<code>private Map<Thread.State, Integer> getThreadStateCountMap() { ThreadInfo[] allThreads = threadBean.getThreadInfo(threadBean.getAllThreadIds(), StackTraceDepth); HashMap<Thread.State, Integer> threadCounts = new HashMap<Thread.State, Integer>(); for (ThreadInfo curThread : allThreads) { if (curThread != null) { Thread.State threadState = curThread.getThreadState(); if (threadCounts.containsKey(threadState)) { threadCounts.put(threadState, threadCounts.get(threadState) + 1); } else { threadCounts.put(threadState, 1); } <START> } <END> } return threadCounts; }</code><technical_language>timeseries present, create states in advance</technical_language>

Target:
private Map<Thread.State, Integer> getThreadStateCountMap() { ThreadInfo[] allThreads = threadBean.getThreadInfo(threadBean.getAllThreadIds(), 0); HashMap<Thread.State, Integer> threadCounts = new HashMap<Thread.State, Integer>(); for (Thread.State state : Thread.State.values()) { threadCounts.put(state, 0); } for (ThreadInfo curThread : allThreads) { if (curThread != null) { Thread.State threadState = curThread.getThreadState(); threadCounts.put(threadState, threadCounts.get(threadState) + 1); } } return threadCounts; }
Source:
<code>public void onComplete(Exception e) { logger.trace("Firing onComplete() for listeners"); synchronized (listeners) { exception = e; <START> if (operationComplete.compareAndSet(false, true)) { <END> for (RestRequestInfoEventListener listener : listeners) { try { listener.onHandlingComplete(this, e); } catch (Exception ee) { logger.error("Swallowing onComplete listener exception", ee); } } } else { logger.error("onComplete for RestRequestInfo has already been fired. Ignoring current invocation"); } } }</code><technical_language>Yes, I meant 'if'</technical_language>

Target:
public void onComplete(Exception e) { if (operationComplete.compareAndSet(false, true)) { logger.trace("Firing onComplete() for listeners"); exception = e; synchronized (listeners) { for (RestRequestInfoEventListener listener : listeners) { try { listener.onHandlingComplete(this, e); } catch (Exception ee) { logger.error("Swallowing onComplete listener exception", ee); } } } } else { logger.error("onComplete for RestRequestInfo has already been fired. Ignoring current invocation"); } }
Source:
<code>private void removeDomainModelChangeListener(T rule) { <START> final Set<VDomainModelReference> dmrs = new LinkedHashSet<VDomainModelReference>(dmrsToRules.keySet()); for (final VDomainModelReference dmr : dmrs) { dmrsToRules.get(dmr).remove(rule); } <END> }</code><technical_language>making a copy of keys in case of keys get garbage collected while iterating. end a NPE in this case, dmrsToRules.get(dmr) null</technical_language>

Target:
private void removeDomainModelChangeListener(T rule) { final Set<VDomainModelReference> dmrs = new LinkedHashSet<VDomainModelReference>(dmrsToRules.keySet()); for (final VDomainModelReference dmr : dmrs) { final Set<T> rules = dmrsToRules.get(dmr); if (rules != null) { rules.remove(rule); } } }
Source:
<code>public String toString() { <START> return String.format("raw type (%s): %d bytes", (mimeType != null) ? mimeType : "unknown", bytes.length); <END> }</code><technical_language>unknown is a valid media type. [below](<LINK_0> empty string mimeType is null, [this](<LINK_1> is text/plain</technical_language>

Target:
public String toString() { return String.format("raw type (%s): %d bytes", mimeType, bytes.length); }
Source:
<code>protected KafkaLogTailer(Codec<M> codec, KafkaNamespace ns, String group, Properties consumerProps) { if (codec == null) { <START> this.codec = new SerializableCodec<>(); <END> } else { this.codec = codec; } Objects.requireNonNull(group); this.ns = ns; this.group = group; consumerProps.put(ConsumerConfig.GROUP_ID_CONFIG, ns.getKafkaGroup(group)); this.consumer = new KafkaConsumer<>(consumerProps); }</code><technical_language>put new SerializableCodec<>() in a static final constant instantiate time</technical_language>

Target:
protected KafkaLogTailer(Codec<M> codec, KafkaNamespace ns, String group, Properties consumerProps) { this.codec = codec; if (NO_CODEC.equals(codec)) { this.decodeCodec = new SerializableCodec<>(); } else { this.decodeCodec = codec; } Objects.requireNonNull(group); this.ns = ns; this.group = group; consumerProps.put(ConsumerConfig.GROUP_ID_CONFIG, ns.getKafkaGroup(group)); this.consumer = new KafkaConsumer<>(consumerProps); }
Source:
<code>public MVCCEntry wrapEntryForPut(InvocationContext ctx, Object key, InternalCacheEntry icEntry, boolean undeleteIfNeeded, FlagAffectedCommand cmd, boolean skipRead) { if (icEntry != null) { <START> throw new IllegalArgumentException("Only addMissingValue can handle external entries"); <END> } MVCCEntry mvccEntry = wrapEntryForWriting(ctx, key, Wrap.WRAP_ALL, skipRead, false); if (trace) { log.tracef("Wrap %s for put. Entry=%s", key, mvccEntry); } return mvccEntry; }</code><technical_language>wrong method name</technical_language>

Target:
public MVCCEntry wrapEntryForPut(InvocationContext ctx, Object key, InternalCacheEntry icEntry, boolean undeleteIfNeeded, FlagAffectedCommand cmd, boolean skipRead) { if (icEntry != null) { throw new IllegalArgumentException("Only addMissingValue can handle external entries"); } return wrapEntryForWriting(ctx, key, Wrap.WRAP_ALL, skipRead, false); }
Source:
<code>public Response logout() { JsonResponse response; Subject currentUser = org.apache.shiro.SecurityUtils.getSubject(); currentUser.logout(); Map<String, String> data = new HashMap<>(); <START> data.put("principal", "anonymous"); <END> data.put("roles", ""); data.put("ticket", "anonymous"); data.put("WWW-Authenticate", "Basic realm=\"Login required\""); response = new JsonResponse(Response.Status.UNAUTHORIZED, "", data); LOG.warn(response.toString()); return response.build(); }</code><technical_language>send data, in front</technical_language>

Target:
public Response logout() { JsonResponse response; Subject currentUser = org.apache.shiro.SecurityUtils.getSubject(); currentUser.logout(); response = new JsonResponse(Response.Status.UNAUTHORIZED, "", ""); LOG.warn(response.toString()); return response.build(); }
Source:
<code>public byte[] call(final byte[] memento) throws Exception { <START> final PerOpTimeInEpoch perOpTimeInEpoch = new PerOpTimeInEpoch(); <END> LOG.log(Level.INFO, "{0} starting...", taskId); trainingDataProvider.loadData(); trainer.initGlobalSettings(); workerGlobalBarrier.await(); for (int epochIdx = 0; epochIdx < maxNumEpochs; ++epochIdx) { LOG.log(Level.INFO, "Starting epoch {0}", epochIdx); final long epochStartTime = System.currentTimeMillis(); trainingDataProvider.prepareDataForEpoch(); final Collection<V> epochData = new LinkedList<>(); int miniBatchIdx = 0; while (true) { final Collection<V> miniBatchData = trainingDataProvider.getNextBatchData().values(); if (miniBatchData.isEmpty()) { break; } final long miniBatchStartTime = System.currentTimeMillis(); final MiniBatchResult miniBatchResult = trainer.runMiniBatch(miniBatchData); final double miniBatchElapsedTime = (System.currentTimeMillis() - miniBatchStartTime) / 1000.0D; sendBatchMetrics(miniBatchResult, epochIdx, miniBatchIdx, miniBatchData.size(), miniBatchElapsedTime, perOpTimeInEpoch); epochData.addAll(miniBatchData); miniBatchIdx++; } final EpochResult epochResult = trainer.onEpochFinished(epochData, epochIdx); final double epochElapsedTime = (System.currentTimeMillis() - epochStartTime) / 1000.0D; sendEpochMetrics(epochResult, epochIdx, miniBatchIdx, epochData.size(), epochElapsedTime, perOpTimeInEpoch); } workerGlobalBarrier.await(); trainer.cleanup(); return null; }</code><technical_language>meant place in epoch loop L74</technical_language>

Target:
public byte[] call(final byte[] memento) throws Exception { LOG.log(Level.INFO, "{0} starting...", taskId); trainingDataProvider.loadData(); trainer.initGlobalSettings(); workerGlobalBarrier.await(); for (int epochIdx = 0; epochIdx < maxNumEpochs; ++epochIdx) { LOG.log(Level.INFO, "Starting epoch {0}", epochIdx); final long epochStartTime = System.currentTimeMillis(); final PerOpTimeInEpoch perOpTimeInEpoch = new PerOpTimeInEpoch(); trainingDataProvider.prepareDataForEpoch(); final Collection<V> epochData = new LinkedList<>(); int miniBatchIdx = 0; while (true) { final Collection<V> miniBatchData = trainingDataProvider.getNextBatchData().values(); if (miniBatchData.isEmpty()) { break; } final long miniBatchStartTime = System.currentTimeMillis(); final MiniBatchResult miniBatchResult = trainer.runMiniBatch(miniBatchData); final double miniBatchElapsedTime = (System.currentTimeMillis() - miniBatchStartTime) / 1000.0D; sendBatchMetrics(miniBatchResult, epochIdx, miniBatchIdx, miniBatchData.size(), miniBatchElapsedTime); perOpTimeInEpoch.accumulate(miniBatchResult.getComputeTime(), miniBatchResult.getAvgPullTime(), miniBatchResult.getAvgPushTime()); epochData.addAll(miniBatchData); miniBatchIdx++; } final EpochResult epochResult = trainer.onEpochFinished(epochData, epochIdx); final double epochElapsedTime = (System.currentTimeMillis() - epochStartTime) / 1000.0D; sendEpochMetrics(epochResult, epochIdx, miniBatchIdx, epochData.size(), epochElapsedTime, perOpTimeInEpoch); } workerGlobalBarrier.await(); trainer.cleanup(); return null; }
Source:
<code>public Message getCommittedMessage(TopicPartition topicPartition) throws Exception { SimpleConsumer consumer = null; try { long committedOffset = mZookeeperConnector.getCommittedOffsetCount(topicPartition) - 1; if (committedOffset < 0) { return null; } consumer = createConsumer(topicPartition); return getMessage(topicPartition, committedOffset, consumer); } catch (MessageDoesNotExistException e) { <START> return null; <END> } finally { if (consumer != null) { consumer.close(); } } }</code><technical_language>I fine way. caller needs deal special exception check null return value</technical_language>

Target:
public Message getCommittedMessage(TopicPartition topicPartition) throws Exception { SimpleConsumer consumer = null; try { long committedOffset = mZookeeperConnector.getCommittedOffsetCount(topicPartition) - 1; if (committedOffset < 0) { return null; } consumer = createConsumer(topicPartition); return getMessage(topicPartition, committedOffset, consumer); } catch (MessageDoesNotExistException e) { LOG.warn("no committed message for topic partition {}", topicPartition.getTopic(), topicPartition.getPartition()); return null; } finally { if (consumer != null) { consumer.close(); } } }
Source:
<code>public BufferedRestClient(Settings settings) { this.settings = settings; this.client = new RestClient(settings); String tempIndex = settings.getTargetResource(); if (tempIndex == null) { tempIndex = ""; } this.index = tempIndex; this.resource = new Resource(index); <START> if (this.settings.getParentIdPath() != null) <END> enableParentChildIndex = true; else enableParentChildIndex = false; trace = log.isTraceEnabled(); }</code><technical_language>enableParentChildIndex = ( this.settings.getParentIdPath() != null ) ? true: false;</technical_language>

Target:
public BufferedRestClient(Settings settings) { this.settings = settings; this.client = new RestClient(settings); String tempIndex = settings.getTargetResource(); if (tempIndex == null) { tempIndex = ""; } this.index = tempIndex; this.resource = new Resource(index); enableParentChildIndex = (this.settings.getParentIdPath() != null); trace = log.isTraceEnabled(); }
Source:
<code>public CjkBigramTokenFilter setIgnoreScripts(CjkBigramTokenFilterScripts... ignoreScripts) { <START> this.ignoreScripts = Arrays.asList(ignoreScripts); <END> return this; }</code><technical_language>This a null check. Update this in other places too. suggestion this.ignoreScripts = ignoreScripts == null ? null : Arrays.asList(ignoreScripts);</technical_language>

Target:
public CjkBigramTokenFilter setIgnoreScripts(CjkBigramTokenFilterScripts... ignoreScripts) { this.ignoreScripts = (ignoreScripts == null) ? null : Arrays.asList(ignoreScripts); return this; }
Source:
<code>public void parseAssociatedNames(Job<?, ?> job, Collection<GitHubRepositoryName> result) { <START> ParameterizedJobMixIn.ParameterizedJob p = (ParameterizedJobMixIn.ParameterizedJob) job; <END> for (GitHubTrigger ght : Util.filter(p.getTriggers().values(),GitHubTrigger.class)) { result.addAll(ght.getGitHubRepositories()); } }</code><technical_language>a type-check first</technical_language>

Target:
public void parseAssociatedNames(Job<?, ?> job, Collection<GitHubRepositoryName> result) { if (job instanceof ParameterizedJobMixIn.ParameterizedJob) { ParameterizedJobMixIn.ParameterizedJob p = (ParameterizedJobMixIn.ParameterizedJob) job; for (GitHubTrigger ght : Util.filter(p.getTriggers().values(),GitHubTrigger.class)) { result.addAll(ght.getGitHubRepositories()); } } }