auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void registerOreDictionary() { ItemDictionary novaItemDictionary = Game.itemDictionary(); <START> novaItemDictionary.stream().forEach(entry -> entry.getValue().stream() <END> .map(ItemConverter.instance()::toNative) .filter(item -> !OreDictionary.getOres(entry.getKey()).contains(item)) .forEach(item -> OreDictionary.registerOre(entry.getKey(), item))); Arrays.stream(OreDictionary.getOreNames()).forEach(key -> OreDictionary.getOres(key).stream() .map(ItemConverter.instance()::getNovaItem) .filter(item -> !novaItemDictionary.get(key).contains(item)) .forEach(item -> novaItemDictionary.add(key, item))); novaItemDictionary.whenEntryAdded(this::onNovaAdded); novaItemDictionary.whenEntryRemoved(this::onNovaRemoved); MinecraftForge.EVENT_BUS.register(this); }</code><technical_language>unclear nested forEachs here, I suggest a -> block more explicit</technical_language>

Target:
public void registerOreDictionary() { ItemDictionary novaItemDictionary = Game.itemDictionary(); novaItemDictionary.stream().forEach(entry -> { entry.getValue().stream() .map(ItemConverter.instance()::toNative) .filter(item -> !OreDictionary.getOres(entry.getKey()).contains(item)) .forEach(item -> OreDictionary.registerOre(entry.getKey(), item)); }); Arrays.stream(OreDictionary.getOreNames()).forEach(key -> { OreDictionary.getOres(key).stream() .map(ItemConverter.instance()::getNovaItem) .filter(item -> !novaItemDictionary.get(key).contains(item)) .forEach(item -> novaItemDictionary.add(key, item)); }); novaItemDictionary.whenEntryAdded(this::onNovaAdded); novaItemDictionary.whenEntryRemoved(this::onNovaRemoved); MinecraftForge.EVENT_BUS.register(this); }
Source:
<code>public Object map( Object input ) { if ( input instanceof byte[] ) { return input; } <START> if ( input instanceof List ) <END> { List list = (List) input; byte[] bytes = new byte[list.size()]; for ( int a = 0; a < bytes.length; a++ ) { Object value = list.get( a ); if ( value instanceof Number ) { bytes[a] = ((Number) value).byteValue(); } else { throw new IllegalArgumentException( "Cannot convert " + value + " to byte for input to procedure" ); } } return bytes; } else { throw new IllegalArgumentException( "Cannot convert " + input.getClass().getSimpleName() + " to byte[] for input to procedure" ); } }</code><technical_language>want reduce warnings I List<?></technical_language>

Target:
public Object map( Object input ) { if ( input instanceof byte[] ) { return input; } if ( input instanceof List<?> ) { List list = (List) input; byte[] bytes = new byte[list.size()]; for ( int a = 0; a < bytes.length; a++ ) { Object value = list.get( a ); if ( value instanceof Byte ) { bytes[a] = (Byte) value; } else { throw new IllegalArgumentException( "Cannot convert " + value + " to byte for input to procedure" ); } } return bytes; } else { throw new IllegalArgumentException( "Cannot convert " + input.getClass().getSimpleName() + " to byte[] for input to procedure" ); } }
Source:
<code>public AttributeDoesNotExist createDoesNotExistException(AttributeTypeId type) { AttributeDoesNotExist toReturn; if (type != null) { toReturn = new AttributeDoesNotExist("Attribute of type [%s] could not be found on [%s]", type, getExceptionString()); } else { toReturn = new AttributeDoesNotExist("Attribute not <START> be found <END> on [%s]", getExceptionString()); } return toReturn; }</code><technical_language>code, this is funny</technical_language>

Target:
public AttributeDoesNotExist createDoesNotExistException(AttributeTypeId type) { AttributeDoesNotExist toReturn; if (type == null) { toReturn = new AttributeDoesNotExist("Attribute could not be found on [%s]", getExceptionString()); } else { toReturn = new AttributeDoesNotExist("Attribute of type [%s] could not be found on [%s]", type, getExceptionString()); } return toReturn; }
Source:
<code>public Optional<MapVersion> findMapByFolderName(String folderName) { List<MapVersion> maps = getMany("/data/mapVersion", 1, ImmutableMap.of( <START> "filter", MessageFormat.format("filename==\"*{0}*\"", folderName), <END> "include", "map,map.statistics,reviews")); if (maps.isEmpty()) { return Optional.empty(); } return Optional.ofNullable(maps.get(0)); }</code><technical_language>MessageFormat is for human-readable strings adds locale-specific separators in 1'000'000 1,000,000 such. It's, therefore, suitable for technical string building; "dumb" String.format() instead</technical_language>

Target:
public Optional<MapVersion> findMapByFolderName(String folderName) { List<MapVersion> maps = getMany("/data/mapVersion", 1, ImmutableMap.of( "filter", String.format("filename==\"*%s*\"", folderName), "include", "map,map.statistics,reviews")); if (maps.isEmpty()) { return Optional.empty(); } return Optional.ofNullable(maps.get(0)); }
Source:
<code>public void testHasNhinTargetHomeCommunityId() { StandardOutboundDocSubmissionDeferredRequest entityOrch = createDocSubmissionDeferredRequestOrchImpl(); <START> boolean hasTargets = entityOrch.hasNhinTargetHomeCommunityId(null); <END> assertFalse(hasTargets); RespondingGatewayProvideAndRegisterDocumentSetSecuredRequestType request = new RespondingGatewayProvideAndRegisterDocumentSetSecuredRequestType(); hasTargets = entityOrch.hasNhinTargetHomeCommunityId(request); assertFalse(hasTargets); NhinTargetCommunitiesType targetCommunities = new NhinTargetCommunitiesType(); request.setNhinTargetCommunities(targetCommunities); hasTargets = entityOrch.hasNhinTargetHomeCommunityId(request); assertFalse(hasTargets); request.getNhinTargetCommunities().getNhinTargetCommunity().add(null); request.setNhinTargetCommunities(targetCommunities); hasTargets = entityOrch.hasNhinTargetHomeCommunityId(request); assertFalse(hasTargets); targetCommunities = createNhinTargetCommunitiesType(receiverHCID); request.setNhinTargetCommunities(targetCommunities); hasTargets = entityOrch.hasNhinTargetHomeCommunityId(request); assertTrue(hasTargets); request.getNhinTargetCommunities().getNhinTargetCommunity().get(0).getHomeCommunity().setHomeCommunityId(null); hasTargets = entityOrch.hasNhinTargetHomeCommunityId(request); assertFalse(hasTargets); request.getNhinTargetCommunities().getNhinTargetCommunity().get(0).setHomeCommunity(null); hasTargets = entityOrch.hasNhinTargetHomeCommunityId(request); assertFalse(hasTargets); }</code><technical_language>"hasTargets" var is unnecessary, pass values assertFalse losing readability</technical_language>

Target:
public void testHasNhinTargetHomeCommunityId() { StandardOutboundDocSubmissionDeferredRequest entityOrch = createDocSubmissionDeferredRequestOrchImpl(); assertFalse(entityOrch.hasNhinTargetHomeCommunityId(null)); RespondingGatewayProvideAndRegisterDocumentSetSecuredRequestType request = new RespondingGatewayProvideAndRegisterDocumentSetSecuredRequestType(); assertFalse(entityOrch.hasNhinTargetHomeCommunityId(request)); NhinTargetCommunitiesType targetCommunities = new NhinTargetCommunitiesType(); request.setNhinTargetCommunities(targetCommunities); assertFalse(entityOrch.hasNhinTargetHomeCommunityId(request)); request.getNhinTargetCommunities().getNhinTargetCommunity().add(null); request.setNhinTargetCommunities(targetCommunities); assertFalse(entityOrch.hasNhinTargetHomeCommunityId(request)); targetCommunities = createNhinTargetCommunitiesType(RECEIVER_HCID); request.setNhinTargetCommunities(targetCommunities); assertTrue(entityOrch.hasNhinTargetHomeCommunityId(request)); request.getNhinTargetCommunities().getNhinTargetCommunity().get(0).getHomeCommunity().setHomeCommunityId(null); assertFalse(entityOrch.hasNhinTargetHomeCommunityId(request)); request.getNhinTargetCommunities().getNhinTargetCommunity().get(0).setHomeCommunity(null); assertFalse(entityOrch.hasNhinTargetHomeCommunityId(request)); }
Source:
<code>private void prepareClose(final boolean clean) { switch (state()) { case CREATED: scheduleCheckpoint(emptyMap()); break; case RUNNING: closeTopology(clean); if (clean) { stateMgr.flush(); recordCollector.flush(); scheduleCheckpoint(checkpointableOffsets()); } else { <START> executeAndMaybeSwallow(false, stateMgr::flush, "state manager flush", log); <END> } break; case RESTORING: executeAndMaybeSwallow(clean, stateMgr::flush, "state manager flush", log); scheduleCheckpoint(emptyMap()); break; case SUSPENDED: case CLOSED: break; default: throw new IllegalStateException("Unknown state " + state() + " while prepare closing active task " + id); } }</code><technical_language>Do need set checkpointNeeded = false here</technical_language>

Target:
private void prepareClose(final boolean clean) { checkpoint = null; switch (state()) { case CREATED: scheduleCheckpoint(emptyMap()); break; case RUNNING: closeTopology(clean); if (clean) { stateMgr.flush(); recordCollector.flush(); scheduleCheckpoint(checkpointableOffsets()); } else { executeAndMaybeSwallow(false, stateMgr::flush, "state manager flush", log); } break; case RESTORING: executeAndMaybeSwallow(clean, stateMgr::flush, "state manager flush", log); scheduleCheckpoint(emptyMap()); break; case SUSPENDED: case CLOSED: break; default: throw new IllegalStateException("Unknown state " + state() + " while prepare closing active task " + id); } }
Source:
<code>public void testReadDoubles() { <START> class DoublesSliceInputTester <END> extends ByteArraySliceInputTester { public DoublesSliceInputTester(int arrayLength) { super(SIZE_OF_DOUBLE, arrayLength); } @Override protected byte[] readActual(SliceInput input) { double[] doubles = input.readDoubles(arrayLength); ByteBuffer buffer = ByteBuffer.allocate(arrayLength * valueBytes); for (int i = 0; i < doubles.length; i++) { buffer.put(doubleToBytes(doubles[i])); } return buffer.array(); } @Override protected byte[] expectedByteArray(int valueIndex) { ByteBuffer buffer = ByteBuffer.allocate(arrayLength * valueBytes); for (int i = 0; i < arrayLength; i++) { byte[] bytes = doubleToBytes(valueIndex); buffer.put(bytes); } return buffer.array(); } private byte[] doubleToBytes(double value) { long bits = doubleToLongBits(value); return new byte[] { (byte) bits, (byte) (bits >> 8), (byte) (bits >> 16), (byte) (bits >> 24), (byte) (bits >> 32), (byte) (bits >> 40), (byte) (bits >> 48), (byte) (bits >> 56), }; } } testSliceInput(new DoublesSliceInputTester(1)); testSliceInput(new DoublesSliceInputTester(4)); testSliceInput(new DoublesSliceInputTester(13)); }</code><technical_language>try avoid method-local classes. code harder follow. Pull level</technical_language>

Target:
public void testReadDoubles() { testSliceInput(new DoublesSliceInputTester(1)); testSliceInput(new DoublesSliceInputTester(4)); testSliceInput(new DoublesSliceInputTester(13)); }
Source:
<code>public void scheduleRebalance(HelixManager manager, String resource, long startTime) { ScheduledTask existTask = _rebalanceTasks.get(resource); if (existTask != null && existTask.getStartTime() == startTime) { LOG.debug("Schedule timer for job: is up to date.", resource); return; } long delay = startTime - System.currentTimeMillis(); if (delay < 0) { LOG.debug(String.format("Delay time is %s, will not be scheduled", delay)); <START> return; <END> } LOG.info("Schedule rebalance for resource : at time: delay: {}", resource, startTime, delay); RebalanceInvoker rebalanceInvoker = new RebalanceInvoker(manager, resource); ScheduledFuture future = _rebalanceExecutor.schedule(rebalanceInvoker, delay, TimeUnit.MILLISECONDS); ScheduledTask prevTask = _rebalanceTasks.put(resource, new ScheduledTask(startTime, future)); if (prevTask != null && !prevTask.getFuture().isDone()) { if (!prevTask.getFuture().cancel(false)) { LOG.warn("Failed to cancel scheduled timer task for {}", resource); } LOG.info("Remove previously scheduled timer task for {}", resource); } }</code><technical_language>convinced this scheduled. I expected behavior is triggering rebalance immediately. In this case, fix log logic. Overall, if caller wants schedule a rebalance, done. is caller responsibility decide is necessary. scheduler ensure happens. Otherwise, miss event anything. a real bug</technical_language>

Target:
public void scheduleRebalance(HelixManager manager, String resource, long startTime) { ScheduledTask existTask = _rebalanceTasks.get(resource); if (existTask != null && existTask.getStartTime() == startTime) { LOG.debug("Schedule timer for job: is up to date.", resource); return; } long delay = startTime - System.currentTimeMillis(); if (delay < 0) { LOG.debug(String.format("Delay time is %s, will not be scheduled", delay)); } LOG.info("Schedule rebalance for resource : at time: delay: {}", resource, startTime, delay); RebalanceInvoker rebalanceInvoker = new RebalanceInvoker(manager, resource); ScheduledFuture future = _rebalanceExecutor.schedule(rebalanceInvoker, delay, TimeUnit.MILLISECONDS); ScheduledTask prevTask = _rebalanceTasks.put(resource, new ScheduledTask(startTime, future)); if (prevTask != null && !prevTask.getFuture().isDone()) { if (!prevTask.getFuture().cancel(false)) { LOG.warn("Failed to cancel scheduled timer task for {}", resource); } LOG.info("Remove previously scheduled timer task for {}", resource); } }
Source:
<code><START> public ProjectReference(final String reference) throws URISyntaxException, IllegalArgumentException { <END> final String[] tokens = reference.split(Pattern.quote(GitProjectSetCapability.SEPARATOR)); if (tokens.length != 4) throw new IllegalArgumentException(NLS.bind( CoreText.GitProjectSetCapability_InvalidTokensCount, new Object[] { 4, tokens.length, tokens })); this.version = tokens[0]; this.repository = new URIish(tokens[1]); if (!"".equals(tokens[2])) this.branch = tokens[2]; this.projectDir = tokens[3]; }</code><technical_language>able create a new instance of reference instead of GitProjectSetCapability? I package-level</technical_language>

Target:
public ProjectReference(final String reference) throws URISyntaxException, IllegalArgumentException { final String[] tokens = reference.split(Pattern.quote(ProjectReference.SEPARATOR)); if (tokens.length != 4) throw new IllegalArgumentException(NLS.bind( CoreText.ProjectReference_InvalidTokensCount, new Object[] { 4, tokens.length, tokens })); this.repository = new URIish(tokens[1]); if (!"".equals(tokens[2])) this.branch = tokens[2]; this.projectDir = tokens[3]; }
Source:
<code>public int archiveWorkflows(DateTime olderThan, int batchSize) { Assert.notNull(olderThan, "olderThan must not be null"); Assert.isTrue(batchSize > 0, "batchSize must be greater than 0"); archiveDao.ensureValidArchiveTablesExist(); log.info("Archiving starting. Archiving passive workflows older than {}, in batches of {}.", olderThan, batchSize); StopWatch stopWatch = new StopWatch(); stopWatch.start(); List<Integer> workflowIds; PeriodicLogger periodicLogger = new PeriodicLogger(log, 60); int archivedWorkflows = 0; int archivedWorkflowsTotal = 0; do { workflowIds = archiveDao.listArchivableWorkflows(olderThan, batchSize); if (workflowIds.isEmpty()) { break; } archivedWorkflows = archiveDao.archiveWorkflows(workflowIds); archivedWorkflowsTotal += archivedWorkflows; double timeDiff = max(stopWatch.getTime() / 1000.0, 0.000001); log.debug("Archived workflows. workflows / second. Workflow ids: {}. ", archivedWorkflows, archivedWorkflowsTotal / timeDiff, workflowIds); periodicLogger.log("Archived workflows. Archiving about workflows / second.", archivedWorkflows, archivedWorkflowsTotal / timeDiff); <START> } while (!workflowIds.isEmpty()); <END> log.info("Archiving finished. Archived workflows in seconds.", archivedWorkflowsTotal, stopWatch.getTime() / 1000); return archivedWorkflowsTotal; }</code><technical_language>hit this condition - I this a while (true) loop instead</technical_language>

Target:
public int archiveWorkflows(DateTime olderThan, int batchSize) { Assert.notNull(olderThan, "olderThan must not be null"); Assert.isTrue(batchSize > 0, "batchSize must be greater than 0"); archiveDao.ensureValidArchiveTablesExist(); log.info("Archiving starting. Archiving passive workflows older than {}, in batches of {}.", olderThan, batchSize); StopWatch stopWatch = new StopWatch(); stopWatch.start(); List<Integer> workflowIds; PeriodicLogger periodicLogger = new PeriodicLogger(log, 60); int archivedWorkflows = 0; int archivedWorkflowsTotal = 0; do { workflowIds = archiveDao.listArchivableWorkflows(olderThan, batchSize); if (workflowIds.isEmpty()) { break; } archivedWorkflows = archiveDao.archiveWorkflows(workflowIds); archivedWorkflowsTotal += archivedWorkflows; double timeDiff = max(stopWatch.getTime() / 1000.0, 0.000001); log.debug("Archived workflows. workflows / second. Workflow ids: {}. ", archivedWorkflows, archivedWorkflowsTotal / timeDiff, workflowIds); periodicLogger.log("Archived workflows. Archiving about workflows / second.", archivedWorkflows, archivedWorkflowsTotal / timeDiff); } while (true); log.info("Archiving finished. Archived workflows in seconds.", archivedWorkflowsTotal, stopWatch.getTime() / 1000); return archivedWorkflowsTotal; }
Source:
<code>public float getLoad() { String result = ExecutingCommand.getAnswerAt("wmic cpu get loadpercentage", 2); int load = 0; if (result != null && !result.isEmpty()) try { load = Integer.valueOf(result.trim()); } catch(NumberFormatException e) { <START> System.err.println("Cannot parse load value: " + result.trim()); <END> } return load; }</code><technical_language>re-raise exception raised. Applications wrong result in case of error, 0. expected wmic ... works 100% of time</technical_language>

Target:
public float getLoad() { String result = ExecutingCommand.getAnswerAt("wmic /locale:ms_409 cpu get loadpercentage", 2); if (result == null || result.isEmpty()) { throw new RuntimeException("CPU load could not be obtained from system"); } try { return Integer.valueOf(result.trim()); } catch (NumberFormatException e) { System.err.println("Cannot parse CPU load value: " + result.trim()); throw new RuntimeException("Cannot parse load value: " + result.trim()); } }
Source:
<code>void expectNone(long withinMillis, String errorMsgPrefix) throws InterruptedException { Thread.sleep(withinMillis); Optional<T> value = abq.poll(); if (value == null) { } else if (value.isDefined()) { env.flop(errorMsgPrefix + value.get()); <START> } else if (value.get() != null) { <END> env.flop("Expected no element but got end-of-stream"); } }</code><technical_language>get here</technical_language>

Target:
void expectNone(long withinMillis, String errorMsgPrefix) throws InterruptedException { Thread.sleep(withinMillis); Optional<T> value = abq.poll(); if (value == null) { } else if (value.isDefined()) { env.flop(errorMsgPrefix + value.get()); } else { env.flop("Expected no element but got end-of-stream"); } }
Source:
<code>private void checkCacheMetrics(final String builtInMetricsVersion) { final List<Metric> listMetricCache = new ArrayList<Metric>(kafkaStreams.metrics().values()).stream() .filter(m -> m.metricName().group().equals(STREAM_CACHE_NODE_METRICS)) .collect(Collectors.toList()); checkMetricByName( listMetricCache, <START> builtInMetricsVersion.equals("latest") ? HIT_RATIO_AVG : HIT_RATIO_AVG_BEFORE_24, <END> builtInMetricsVersion.equals("latest") ? 3 : 6 ); checkMetricByName( listMetricCache, builtInMetricsVersion.equals("latest") ? HIT_RATIO_MIN : HIT_RATIO_MIN_BEFORE_24, builtInMetricsVersion.equals("latest") ? 3 : 6 ); checkMetricByName( listMetricCache, builtInMetricsVersion.equals("latest") ? HIT_RATIO_MAX : HIT_RATIO_MAX_BEFORE_24, builtInMetricsVersion.equals("latest") ? 3 : 6 ); }</code><technical_language>I understand want hide built-in metrics, replacing METRICS_LATEST string value, want consider leaving METRICS_LATEST in? I missing here</technical_language>

Target:
private void checkCacheMetrics(final String builtInMetricsVersion) { final List<Metric> listMetricCache = new ArrayList<Metric>(kafkaStreams.metrics().values()).stream() .filter(m -> m.metricName().group().equals(STREAM_CACHE_NODE_METRICS)) .collect(Collectors.toList()); checkMetricByName( listMetricCache, builtInMetricsVersion.equals(StreamsMetricsImpl.METRICS_LATEST) ? HIT_RATIO_AVG : HIT_RATIO_AVG_BEFORE_24, builtInMetricsVersion.equals(StreamsMetricsImpl.METRICS_LATEST) ? 3 : 6 ); checkMetricByName( listMetricCache, builtInMetricsVersion.equals(StreamsMetricsImpl.METRICS_LATEST) ? HIT_RATIO_MIN : HIT_RATIO_MIN_BEFORE_24, builtInMetricsVersion.equals(StreamsMetricsImpl.METRICS_LATEST) ? 3 : 6 ); checkMetricByName( listMetricCache, builtInMetricsVersion.equals(StreamsMetricsImpl.METRICS_LATEST) ? HIT_RATIO_MAX : HIT_RATIO_MAX_BEFORE_24, builtInMetricsVersion.equals(StreamsMetricsImpl.METRICS_LATEST) ? 3 : 6 ); }
Source:
<code>public void testJoinWithStatefulFilterFunction() { super.testJoinWithStatefulFilterFunction(); Session session = Session.builder(getSession()) <START> .setSystemProperty(SystemSessionProperties.JOIN_DISTRIBUTION_TYPE, FeaturesConfig.JoinDistributionType.REPARTITIONED.toString()) <END> .build(); long joinOutputRowCount = 60175; assertQuery( session, format( "SELECT count(*) FROM lineitem l LEFT OUTER JOIN orders o ON l.orderkey = o.orderkey AND stateful_sleeping_sum(%s, 100, l.linenumber, o.shippriority) > 0", 10 * 1. / joinOutputRowCount), format("VALUES %s", joinOutputRowCount)); }</code><technical_language>Drop FeaturesConfig</technical_language>

Target:
public void testJoinWithStatefulFilterFunction() { super.testJoinWithStatefulFilterFunction(); Session session = Session.builder(getSession()) .setSystemProperty(SystemSessionProperties.JOIN_DISTRIBUTION_TYPE, JoinDistributionType.REPARTITIONED.toString()) .build(); long joinOutputRowCount = 60175; assertQuery( session, format( "SELECT count(*) FROM lineitem l LEFT OUTER JOIN orders o ON l.orderkey = o.orderkey AND stateful_sleeping_sum(%s, 100, l.linenumber, o.shippriority) > 0", 10 * 1. / joinOutputRowCount), format("VALUES %s", joinOutputRowCount)); }
Source:
<code>void setAppendingSegment(SegmentWithState appendingSegment) { <START> Preconditions.checkState(this.appendingSegment == null); <END> this.appendingSegment = appendingSegment; }</code><technical_language>Please include error message here. (Probably a "WTF?!" message if happen.)</technical_language>

Target:
void setAppendingSegment(SegmentWithState appendingSegment) { Preconditions.checkArgument( appendingSegment.getState() == SegmentState.APPENDING, "segment[%s] is not in the APPENDING state", appendingSegment.getSegmentIdentifier() ); Preconditions.checkState( this.appendingSegment == null, "WTF?! Current appendingSegment[%s] is not null. " + "Its state must be changed before setting a new appendingSegment[%s]", this.appendingSegment, appendingSegment ); this.appendingSegment = appendingSegment; }
Source:
<code>public void setUserActivationKey(User user) { log.info("Setting activationKey for " + user.getUsername()); <START> int validTime = 10*60*1000; END> String token = RandomStringUtils.randomAlphanumeric(20); long time = System.currentTimeMillis() + validTime; String hashedKey = Security.encodeString(token); String activationKey = hashedKey+":"+time; dao.createActivationKey(user, activationKey); }</code><technical_language>I thought this a GP</technical_language>

Target:
public User setUserActivationKey(User user) { String token = RandomStringUtils.randomAlphanumeric(20); long time = System.currentTimeMillis() + getValidTime(); String hashedKey = Security.encodeString(token); String activationKey = hashedKey+":"+time; LoginCredential credentials = dao.getLoginCredential(user); credentials.setActivationKey(activationKey); dao.setUserActivationKey(credentials); return user; }
Source:
<code><START> static public void checkAccessPermission(Method method) { <END> checkAccessPermission(method.getDeclaringClass(), method.getModifiers(), method.isAccessible() ); }</code><technical_language>public needed</technical_language>

Target:
static void checkAccessPermission(Method method) { try { checkAccessPermission(method.getDeclaringClass(), method.getModifiers(), method.isAccessible()); } catch (AccessControlException e) { throw createCacheAccessControlExceptionOf(method, e); } }
Source:
<code>public void setVisible(boolean visible) { throw new UnsupportedOperationException("Cannot change " + getClass().getSimpleName() <START> + " component visibiltiy because it doesn't " <END> + "represent an HTML Element but a text Node on the client side."); }</code><technical_language>Typo: "visibiltiy" -> "visibility"</technical_language>

Target:
public void setVisible(boolean visible) { throw new UnsupportedOperationException("Cannot change " + getClass().getSimpleName() + " component visibility because it doesn't " + "represent an HTML Element but a text Node on the client side."); }
Source:
<code>private String bypassRootElement() throws IOException { String name = jsonReader.nextName(); <START> if(!"request_box".equalsIgnoreCase(name)) { <END> if (!schemaList.isEmpty()) { JsonObject jsonObject = schemaList.get(0); if (JsonState.StartState == state || JSONType.NESTED_ARRAY.equals(jsonObject.getType())) { name = jsonObject.getName(); } } } return name; }</code><technical_language>"request_box" define constant</technical_language>

Target:
private String bypassRootElement() throws IOException { String name = jsonReader.nextName(); if (!("request_box".equalsIgnoreCase(name) && schemaList.isEmpty())) { JsonObject jsonObject = schemaList.get(0); if (JsonState.StartState == state || JSONType.NESTED_ARRAY.equals(jsonObject.getType())) { name = jsonObject.getName(); } } return name; }
Source:
<code>public void testStaffListFetch() { final List<HashMap> responseWithoutStatus = StaffHelper.getStaffList(requestSpec, responseSpec); <START> final List<HashMap> responseAll = (List<HashMap>) StaffHelper.getStaffListWithState(requestSpec, responseSpec, "all"); <END> final List<HashMap> responseActive = (List<HashMap>) StaffHelper.getStaffListWithState(requestSpec, responseSpec, "active"); final List<HashMap> responseInactive = (List<HashMap>) StaffHelper.getStaffListWithState(requestSpec, responseSpec, "inactive"); Assert.assertEquals(responseWithoutStatus.size(), responseAll.size()); Assert.assertEquals(responseAll.size(), responseActive.size() + responseInactive.size()); for(final HashMap staff : responseActive) { Assert.assertNotNull(staff.get("id")); Assert.assertEquals(staff.get("isActive"), true); Assert.assertTrue(responseAll.remove(staff)); } for(final HashMap staff : responseInactive) { Assert.assertNotNull(staff.get("id")); Assert.assertEquals(staff.get("isActive"), false); Assert.assertTrue(responseAll.remove(staff)); } Assert.assertEquals(responseAll.size(), 0); }</code><technical_language>please split methods</technical_language>

Target:
public void testStaffListFetch() { StaffHelper.getStaffList(requestSpec, responseSpec); }
Source:
<code>private boolean hasInvalidAnswers(boolean markCompleted) { <START> FormController formController = FormEntryActivity.mFormController; <END> FormIndex currentFormIndex = FormIndex.createBeginningOfFormIndex(); int event; while ((event = formController.getEvent(currentFormIndex)) != FormEntryController.EVENT_END_OF_FORM) { if (event == FormEntryController.EVENT_QUESTION) { int saveStatus = FormEntryActivity.mFormController.checkCurrentQuestionConstraint(); if (markCompleted && (saveStatus == FormEntryController.ANSWER_REQUIRED_BUT_EMPTY || saveStatus == FormEntryController.ANSWER_CONSTRAINT_VIOLATED)) { return true; } } currentFormIndex = formController.getNextFormIndex(currentFormIndex, FormEntryController.STEP_INTO_GROUP, true); } return false; }</code><technical_language>Is a reason changes needed</technical_language>

Target:
private boolean hasInvalidAnswers(boolean markCompleted) { FormController formController = FormEntryActivity.mFormController; FormIndex currentFormIndex = FormIndex.createBeginningOfFormIndex(); int event; while ((event = formController.getEvent(currentFormIndex)) != FormEntryController.EVENT_END_OF_FORM) { if (event == FormEntryController.EVENT_QUESTION) { int saveStatus = formController.checkCurrentQuestionConstraint(currentFormIndex); if (markCompleted && (saveStatus == FormEntryController.ANSWER_REQUIRED_BUT_EMPTY || saveStatus == FormEntryController.ANSWER_CONSTRAINT_VIOLATED)) { formController.jumpToIndex(currentFormIndex); return true; } } currentFormIndex = formController.getNextFormIndex(currentFormIndex, FormEntryController.STEP_INTO_GROUP, true); } return false; }
Source:
<code>public boolean postDeserialize(int version, PostDeserializeSetup setup, boolean persistent) { boolean migrated = super.postDeserialize(version, setup, persistent); if (version < SPECIFY_LOGIN_TIMEOUT_VERSION_NUMBER && loginTimeout.getValue() == null) { loginTimeout.setValue(DEFAULT_LOGIN_TIMEOUT); migrated = true; } if (version < 2 && region.getValue() != null) { <START> if (useCustomRegion.getValue() && customRegionID.getValue() != null) { <END> regionID.setStoredValue(customRegionID.getStoredValue()); } if (!useCustomRegion.getValue() && !SnowflakeRegion.AWS_US_WEST.equals(region.getValue())) { regionID.setValue("\"" + region.getValue().getRegionID() + "\""); } migrated = true; } return migrated; }</code><technical_language>getValue is real context case, for example : context.region is null in customer job, new regionID field empty context.region</technical_language>

Target:
public boolean postDeserialize(int version, PostDeserializeSetup setup, boolean persistent) { boolean migrated = super.postDeserialize(version, setup, persistent); if (version < SPECIFY_LOGIN_TIMEOUT_VERSION_NUMBER && loginTimeout.getValue() == null) { loginTimeout.setValue(DEFAULT_LOGIN_TIMEOUT); migrated = true; } if (version < 2 && region.getValue() != null) { if (useCustomRegion.getValue() && customRegionID.getStoredValue() != null) { regionID.setStoredValue(customRegionID.getStoredValue()); } if (!useCustomRegion.getValue() && !SnowflakeRegion.AWS_US_WEST.equals(region.getValue())) { regionID.setValue("\"" + region.getValue().getRegionID() + "\""); } migrated = true; } return migrated; }
Source:
<code>private void setRemoteConfigs() { remoteSelectionCombo.setItems(remoteConfigs); if (this.ref != null) { String branchName = Repository.shortenRefName(this.ref.getName()); String remoteName = repository.getConfig().getString( ConfigConstants.CONFIG_BRANCH_SECTION, branchName, ConfigConstants.CONFIG_KEY_REMOTE); if (remoteName != null) { for (RemoteConfig rc : remoteConfigs) { <START> if (remoteName.equals(rc.getName())) { <END> remoteSelectionCombo.setSelectedRemote(rc); } } } } remoteConfig = remoteSelectionCombo.getSelectedRemote(); setRefAssist(remoteConfig); }</code><technical_language>unrelated style nit: braces single line blocks</technical_language>

Target:
private void setRemoteConfigs() { remoteSelectionCombo.setItems(remoteConfigs); if (this.ref != null) { String branchName = Repository.shortenRefName(this.ref.getName()); String remoteName = repository.getConfig().getString( ConfigConstants.CONFIG_BRANCH_SECTION, branchName, ConfigConstants.CONFIG_KEY_REMOTE); if (remoteName != null) { for (RemoteConfig rc : remoteConfigs) { if (remoteName.equals(rc.getName())) remoteSelectionCombo.setSelectedRemote(rc); } } } remoteConfig = remoteSelectionCombo.getSelectedRemote(); setRefAssist(remoteConfig); }
Source:
<code><START> public static Long parseToEpochMs(String epoch) { <END> int dotPos = epoch.indexOf('.'); long epochMs = 0L; if (dotPos == -1) { epochMs = Long.parseLong(epoch); } else if (dotPos > 0) { epochMs = Long.parseLong(epoch.substring(0, dotPos)); } return epochMs; }</code><technical_language>return long? In case caller wants Long boxed efficiently caller's side. if caller wants long boxing unboxing</technical_language>

Target:
public static long parseToEpochMs(String epoch) { int dotPos = epoch.indexOf('.'); if (dotPos == -1) { return Long.parseLong(epoch); } else if (dotPos > 0) { return Long.parseLong(epoch.substring(0, dotPos)); } else { return 0L; } }
Source:
<code>public RemoteTaskRunnerFactory( final CuratorFramework curator, final RemoteTaskRunnerConfig remoteTaskRunnerConfig, final IndexerZkConfig zkPaths, final ObjectMapper jsonMapper, @Global final HttpClient httpClient, final Supplier<WorkerBehaviorConfig> workerConfigRef, <START> ScheduledExecutorFactory factory <END> ) { this.curator = curator; this.remoteTaskRunnerConfig = remoteTaskRunnerConfig; this.zkPaths = zkPaths; this.jsonMapper = jsonMapper; this.httpClient = httpClient; this.workerConfigRef = workerConfigRef; this.factory = factory; }</code><technical_language>this annotated other ScheduledExecutorFactories in future</technical_language>

Target:
public RemoteTaskRunnerFactory( final CuratorFramework curator, final RemoteTaskRunnerConfig remoteTaskRunnerConfig, final IndexerZkConfig zkPaths, final ObjectMapper jsonMapper, @Global final HttpClient httpClient, final Supplier<WorkerBehaviorConfig> workerConfigRef, ScheduledExecutorFactory factory ) { this.curator = curator; this.remoteTaskRunnerConfig = remoteTaskRunnerConfig; this.zkPaths = zkPaths; this.jsonMapper = jsonMapper; this.httpClient = httpClient; this.workerConfigRef = workerConfigRef; this.cleanupExec = factory.create(1,"RemoteTaskRunner-Scheduled-Cleanup--%d"); }
Source:
<code>public void expireWhitelistRule(@PathVariable("id") final Long id, @RequestParam(value = "expiryDate", required = false) @DateTimeFormat(iso = DATE_TIME) final DateTime expiryDate, @AuthenticationPrincipal(errorOnInvalidType = true) final String userId) throws ForbiddenException, NotFoundException { checkPermission(userId); <START> final DateTime assertedExpiryDate = ofNullable(expiryDate).orElse(DateTime.now()); <END> try { ruleEntityService.expire(id, assertedExpiryDate); } catch (NoSuchElementException | IllegalArgumentException ex) { throw new NotFoundException(ex.getMessage()); } }</code><technical_language>required is here? avoid change expiration now</technical_language>

Target:
public void expireWhitelistRule(@PathVariable("id") final Long id, @RequestParam(value = "expiryDate", required = false) @DateTimeFormat(iso = DATE_TIME) final DateTime expiryDate, @AuthenticationPrincipal(errorOnInvalidType = true) final String userId) throws ForbiddenException, NotFoundException { checkPermission(userId); final DateTime assertedExpiryDate = ofNullable(expiryDate).orElse(DateTime.now().plusMinutes(1)); try { ruleEntityService.expire(id, assertedExpiryDate); } catch (NoSuchElementException | IllegalArgumentException ex) { throw new NotFoundException(ex.getMessage()); } }
Source:
<code>public static void main(String[] args) { List<Trade> trades = createCdsTrades(); List<Column> columns = ImmutableList.of( Column.of(Measure.PRESENT_VALUE), Column.of(Measure.PAR_RATE), Column.of(Measure.RECOVERY01), Column.of(Measure.JUMP_TO_DEFAULT), Column.of(Measure.IR01_PARALLEL_PAR), Column.of(Measure.IR01_PARALLEL_ZERO), Column.of(Measure.CS01_PARALLEL_PAR), Column.of(Measure.CS01_PARALLEL_HAZARD), Column.of(Measure.IR01_BUCKETED_PAR), Column.of(Measure.IR01_BUCKETED_ZERO), Column.of(Measure.CS01_BUCKETED_PAR), Column.of(Measure.CS01_BUCKETED_HAZARD) ); MarketDataBuilder marketDataBuilder = ExampleMarketData.builder(); CalculationRules rules = CalculationRules.builder() .pricingRules(OpenGammaPricingRules.standard()) .marketDataRules(marketDataBuilder.rules()) .build(); LocalDate valuationDate = LocalDate.of(2014, 10, 16); BaseMarketData snapshot = marketDataBuilder.buildSnapshot(valuationDate); CalculationEngine engine = ExampleEngine.create(); Results results = engine.calculate(trades, columns, rules, snapshot); <START> ReportCalculationResults calculationResults = ReportCalculationResults.of( <END> valuationDate, trades, columns, results); TradeReportTemplate reportTemplate = ExampleData.loadTradeReportTemplate("cds-report-template"); TradeReport tradeReport = TradeReport.of(calculationResults, reportTemplate); tradeReport.writeCsv(System.out); }</code><technical_language>other examples ASCII table output - is a reason for switching CSV this left in testing</technical_language>

Target:
public static void main(String[] args) { List<Trade> trades = createCdsTrades(); List<Column> columns = ImmutableList.of( Column.of(Measure.PRESENT_VALUE), Column.of(Measure.PAR_RATE), Column.of(Measure.RECOVERY01), Column.of(Measure.JUMP_TO_DEFAULT), Column.of(Measure.IR01_PARALLEL_PAR), Column.of(Measure.IR01_PARALLEL_ZERO), Column.of(Measure.CS01_PARALLEL_PAR), Column.of(Measure.CS01_PARALLEL_HAZARD), Column.of(Measure.IR01_BUCKETED_PAR), Column.of(Measure.IR01_BUCKETED_ZERO), Column.of(Measure.CS01_BUCKETED_PAR), Column.of(Measure.CS01_BUCKETED_HAZARD) ); MarketDataBuilder marketDataBuilder = ExampleMarketData.builder(); CalculationRules rules = CalculationRules.builder() .pricingRules(OpenGammaPricingRules.standard()) .marketDataRules(marketDataBuilder.rules()) .build(); LocalDate valuationDate = LocalDate.of(2014, 10, 16); BaseMarketData snapshot = marketDataBuilder.buildSnapshot(valuationDate); CalculationEngine engine = ExampleEngine.create(); Results results = engine.calculate(trades, columns, rules, snapshot); ReportCalculationResults calculationResults = ReportCalculationResults.of( valuationDate, trades, columns, results); TradeReportTemplate reportTemplate = ExampleData.loadTradeReportTemplate("cds-report-template"); TradeReport tradeReport = TradeReport.of(calculationResults, reportTemplate); tradeReport.writeAsciiTable(System.out); }
Source:
<code>public SSLconnection(String host, int port) throws ConnectException, IOException, UnknownHostException { logger.debug("SSLconnection({},{}) called.", host, port); logger.info("Starting bridge connection.", VeluxBindingConstants.BINDING_ID); SSLContext ctx = null; try { ctx = SSLContext.getInstance("SSL"); ctx.init(null, trustAllCerts, null); <START> } catch (Exception e) { <END> } logger.trace("SSLconnection(): creating socket..."); socket = (SSLSocket) ctx.getSocketFactory().createSocket(host, port); logger.trace("SSLconnection(): starting SSL handshake..."); socket.startHandshake(); dOut = new DataOutputStream(socket.getOutputStream()); dIn = new DataInputStream(socket.getInputStream()); logger.trace("SSLconnection() finished."); }</code><technical_language>This trap needs a warning, least</technical_language>

Target:
public SSLconnection(String host, int port) throws ConnectException, IOException, UnknownHostException { logger.debug("SSLconnection({},{}) called.", host, port); logger.info("Starting bridge connection.", VeluxBindingConstants.BINDING_ID); SSLContext ctx = null; try { ctx = SSLContext.getInstance("SSL"); ctx.init(null, trustAllCerts, null); } catch (Exception e) { throw new IOException("create of an empty trust store failed."); } logger.trace("SSLconnection(): creating socket..."); socket = (SSLSocket) ctx.getSocketFactory().createSocket(host, port); logger.trace("SSLconnection(): starting SSL handshake..."); socket.startHandshake(); dOut = new DataOutputStream(socket.getOutputStream()); dIn = new DataInputStream(socket.getInputStream()); logger.trace("SSLconnection() finished."); }
Source:
<code>@Override public Response execute(Request request) throws IOException { HttpUriRequest apacheRequest = createRequest(request); HttpResponse apacheResponse = execute(client, apacheRequest); String url = request.getUrl(); <START> if (this.redirectHandler != null && this.redirectHandler.finalUri != null) { <END> url = this.redirectHandler.finalUri.toString(); } return parseResponse(url, apacheResponse); }</code><technical_language>Drop this lines down</technical_language>

Target:
@Override public Response execute(Request request) throws IOException { HttpUriRequest apacheRequest = createRequest(request); HttpResponse apacheResponse = execute(client, apacheRequest); String url = request.getUrl(); if (redirectHandler != null && redirectHandler.finalUri != null) { url = redirectHandler.finalUri.toString(); } return parseResponse(url, apacheResponse); }
Source:
<code>boolean uploadFormDataToServer(List<FormData> allFormData, boolean result) throws IOException { for (FormData formData : allFormData) { String rawPayload = formData.getJsonPayload(); <START> System.out.println(rawPayload); <END> formData = injectUuidToPayload(formData); formData = replaceMediaPathWithBase64String(formData); if (formService.syncFormData(formData)) { formData.setStatus(STATUS_UPLOADED); formData.setJsonPayload(rawPayload); formService.saveFormData(formData); } else { result = false; } } return result; }</code><technical_language>This is longer needed</technical_language>

Target:
boolean uploadFormDataToServer(List<FormData> allFormData, boolean result) throws IOException { for (FormData formData : allFormData) { String rawPayload = formData.getJsonPayload(); formData = injectUuidToPayload(formData); formData = replaceMediaPathWithBase64String(formData); if (formService.syncFormData(formData)) { formData.setStatus(STATUS_UPLOADED); formData.setJsonPayload(rawPayload); formService.saveFormData(formData); } else { result = false; } } return result; }
Source:
<code>protected void updateComboTooltip() { <START> if (fBuildConfigCombo != null && fBuildConfigCombo.getSelectionIndex() > 0) { <END> String configId = (String) fBuildConfigCombo.getData(Integer.toString(fBuildConfigCombo.getSelectionIndex())); String tooltip = EMPTY_STRING; if (configId.equals(AUTO_CONFIG)) { tooltip = LaunchMessages.CMainTab_Build_Config_Auto_tooltip; } else if (configId.equals(EMPTY_STRING)) { tooltip = LaunchMessages.CMainTab_Build_Config_Active_tooltip; } fBuildConfigCombo.setToolTipText(tooltip); } }</code><technical_language>selection index starts 0? Main tooltip for 0th element... need regular NPE protection if (configId==null) return;</technical_language>

Target:
protected void updateComboTooltip() { if (fBuildConfigCombo != null) { String configId = (String) fBuildConfigCombo.getData(Integer.toString(fBuildConfigCombo.getSelectionIndex())); String tooltip = EMPTY_STRING; if (configId != null) { if (configId.equals(AUTO_CONFIG)) { tooltip = LaunchMessages.CMainTab_Build_Config_Auto_tooltip; } else if (configId.equals(EMPTY_STRING)) { tooltip = LaunchMessages.CMainTab_Build_Config_Active_tooltip; } } fBuildConfigCombo.setToolTipText(tooltip); } }
Source:
<code>public static String SignCertificateRequest(String request, String label) throws IOException { File pkicertdir = new File(Config.resolveCABasePath(), "certs"); File pkireqdir = new File(Config.resolveCABasePath(), "requests"); String reqFileName = String.format("%1$sreq.pem", label); String certFileName = String.format("%1$scert.pem", label); OutputStream os = null; try { os = new FileOutputStream( new File( pkireqdir, reqFileName ) ); os.write(request.getBytes("UTF-8")); } finally { <START> if (os == null) { <END> try { os.close(); } catch (IOException e) { log.error("error during close", e); } } } if ( !new OpenSslCAWrapper().SignCertificateRequest( reqFileName, Config.<Integer> GetValue(ConfigValues.VdsCertificateValidityInYears) * 365, certFileName ) ) { throw new RuntimeException("Certificate enrollment failed"); } return FileUtil.readAllText(new File(pkicertdir, certFileName).getPath()); }</code><technical_language>(if os != null) ? NPE, IMHO</technical_language>

Target:
public static String SignCertificateRequest(String request, String label) throws IOException { File pkicertdir = new File(Config.resolveCABasePath(), "certs"); File pkireqdir = new File(Config.resolveCABasePath(), "requests"); String reqFileName = String.format("%1$sreq.pem", label); String certFileName = String.format("%1$scert.pem", label); OutputStream os = null; try { os = new FileOutputStream( new File( pkireqdir, reqFileName ) ); os.write(request.getBytes("UTF-8")); } finally { if (os != null) { try { os.close(); } catch (IOException e) { log.error("error during close", e); } } } if ( !new OpenSslCAWrapper().SignCertificateRequest( reqFileName, Config.<Integer> GetValue(ConfigValues.VdsCertificateValidityInYears) * 365, certFileName ) ) { throw new RuntimeException("Certificate enrollment failed"); } return FileUtil.readAllText(new File(pkicertdir, certFileName).getPath()); }
Source:
<code>public void testGetAllLeases() throws LeasingException { TestHarnessBuilder builder = new TestHarnessBuilder(leaseRefresher); Map<String, Lease> addedLeases = builder.withLease("1", "bar") .withLease("2", "bar") .withLease("3", "baz") .withLease("4", "baz") .withLease("5", "foo") .build(); assertEquals(taker.getAllLeases().size(), 0); taker.takeLeases(); Collection<Lease> allLeases = taker.getAllLeases(); <START> assertEquals(allLeases.size(), addedLeases.size()); <END> assertThat(addedLeases.values().containsAll(allLeases), equalTo(true)); }</code><technical_language>assertThat(..., equalTo)</technical_language>

Target:
public void testGetAllLeases() throws LeasingException { TestHarnessBuilder builder = new TestHarnessBuilder(leaseRefresher); Map<String, Lease> addedLeases = builder.withLease("1", "bar") .withLease("2", "bar") .withLease("3", "baz") .withLease("4", "baz") .withLease("5", "foo") .build(); assertThat(taker.allLeases().size(), equalTo(0)); taker.takeLeases(); Collection<Lease> allLeases = taker.allLeases(); assertThat(allLeases.size(), equalTo(addedLeases.size())); assertThat(addedLeases.values().containsAll(allLeases), equalTo(true)); }
Source:
<code>public void simpleFeatureSearch() throws AvroRemoteException { SearchGenotypePhenotypeRequest request = SearchGenotypePhenotypeRequest.newBuilder().build(); request.setFeature("KIT *wild"); SearchGenotypePhenotypeResponse response = client.genotypePhenotype.searchGenotypePhenotype(request); <START> assertThat(response).isNotNull(); <END> assertThat(response.getAssociations()).isNotNull() ; assertThat(response.getAssociations().get(0)).isNotNull() ; }</code><technical_language>response null, it? call searchGenotypePhenotype throw GAException return a valid SearchGenotypePhenotypeResponse</technical_language>

Target:
public void simpleFeatureSearch() throws AvroRemoteException { SearchGenotypePhenotypeRequest request = SearchGenotypePhenotypeRequest.newBuilder().build(); request.setFeature(TestData.FEATURE_NAME); SearchGenotypePhenotypeResponse response = client.genotypePhenotype.searchGenotypePhenotype(request); assertThat(response.getAssociations()).isNotNull() ; assertThat(response.getAssociations()).isNotEmpty() ; }
Source:
<code>public PatronAccess getPatronAccess(PID pid) { String pidString = pid.getRepositoryPath(); List<Entry<String, String>> objAcls = objAclCache.getUnchecked(pidString); String patronPropertyUri = CdrAcl.patronAccess.getURI(); return objAcls.stream() .filter(p -> patronPropertyUri.equals(p.getKey())) <START> .findFirst() <END> .map(p -> PatronAccess.valueOf(p.getValue())) .orElse(PatronAccess.parent); }</code><technical_language>is case for calling findFirst() here? I understand motivation for for embargo</technical_language>

Target:
public PatronAccess getPatronAccess(PID pid) { String patronPropertyUri = CdrAcl.patronAccess.getURI(); return getObjectAcls(pid).stream() .filter(p -> patronPropertyUri.equals(p.getKey())) .findFirst() .map(p -> PatronAccess.valueOf(p.getValue())) .orElse(PatronAccess.parent); }
Source:
<code>private List<AccountExternalId.Key> filterKeysByScheme( String keyScheme, ResultSet<AccountExternalId> externalIds) { List<AccountExternalId.Key> filteredExternalIds = <START> Lists.newArrayList(); <END> for (AccountExternalId accountExternalId : externalIds) { if (accountExternalId.isScheme(keyScheme)) { filteredExternalIds.add(accountExternalId.getKey()); } } return filteredExternalIds; }</code><technical_language>new ArrayList<>()</technical_language>

Target:
private List<AccountExternalId.Key> filterKeysByScheme( String keyScheme, ResultSet<AccountExternalId> externalIds) { List<AccountExternalId.Key> filteredExternalIds = new ArrayList<>(); for (AccountExternalId accountExternalId : externalIds) { if (accountExternalId.isScheme(keyScheme)) { filteredExternalIds.add(accountExternalId.getKey()); } } return filteredExternalIds; }
Source:
<code>public static FileBasedInfinitestConfigurationSource createFromWorkingDirectory(File workingDirectory) { <START> File configFile = new File(workingDirectory, "infinitest.filters"); <END> return new FileBasedInfinitestConfigurationSource(configFile); }</code><technical_language>infinitest.filters, i time now, a good thing. do extract in a constant? INFINITEST_FILTER_FILE_NAME</technical_language>

Target:
public static FileBasedInfinitestConfigurationSource createFromWorkingDirectory(File workingDirectory) { File configFile = new File(workingDirectory, INFINITEST_FILTERS_FILE_NAME); return new FileBasedInfinitestConfigurationSource(configFile); }