auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void earlyStartup() { if (isPlatformKeybindingBug517068Fixed()) { return; } IBindingService service = PlatformUI.getWorkbench().getService(IBindingService.class); if (service != null) { List<Binding> newBindings = new ArrayList<>(); Binding[] bindings = service.getBindings(); for (Binding binding : bindings) { String commandId = null; if (binding != null && binding.getParameterizedCommand() != null && binding.getParameterizedCommand().getCommand() != null) { commandId = binding.getParameterizedCommand().getCommand().getId(); } if (commandId == null || !commandId.equals(OPEN_SYMBOL_IN_WORKSPACE_COMMAND_ID)) { newBindings.add(binding); } } PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() { @Override public void run() { try { service.savePreferences(service.getActiveScheme(), newBindings.toArray(new Binding[newBindings.size()])); } catch (IOException e) { e.printStackTrace(); } } }); } }

Target:
public void earlyStartup() { if (isPlatformKeybindingBug517068Fixed()) { return; } IBindingService service = PlatformUI.getWorkbench().getService(IBindingService.class); if (service != null) { List<Binding> newBindings = new ArrayList<>(); Binding[] bindings = service.getBindings(); for (Binding binding : bindings) { String commandId = null; if (binding != null && binding.getParameterizedCommand() != null && binding.getParameterizedCommand().getCommand() != null) { commandId = binding.getParameterizedCommand().getCommand().getId(); if (commandId == null) { newBindings.add(binding); } else if (!commandId.startsWith(LSP4E_COMMAND_ID_PREFIX)) { newBindings.add(binding); } else { Collection<?> conflicts = service.getConflictsFor(binding.getTriggerSequence()); if (conflicts == null || conflicts.size() == 0) { newBindings.add(binding); } } } else { newBindings.add(binding); } } PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() { @Override public void run() { try { service.savePreferences(service.getActiveScheme(), newBindings.toArray(new Binding[newBindings.size()])); } catch (IOException e) { e.printStackTrace(); } } }); } }
Source:
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { this.applicationContext = (ConfigurableApplicationContext) applicationContext; Map<String, StreamListenerArgumentAdapter> streamListenerArgumentHandlerMap = this.applicationContext.getBeansOfType( StreamListenerArgumentAdapter.class); for (Map.Entry<String, StreamListenerArgumentAdapter> entry : streamListenerArgumentHandlerMap.entrySet()) { this.streamListenerArgumentAdapters.add(entry.getValue()); } Map<String, StreamListenerResultAdapter> stringStreamListenerResultHandlerMap = applicationContext.getBeansOfType( StreamListenerResultAdapter.class); this.streamListenerResultAdapters.add(new MessageChannelStreamListenerResultAdapter()); for (StreamListenerResultAdapter streamListenerResultAdapter : stringStreamListenerResultHandlerMap.values()) { this.streamListenerResultAdapters.add(streamListenerResultAdapter); } }

Target:
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { this.applicationContext = (ConfigurableApplicationContext) applicationContext; Map<String, StreamListenerParameterAdapter> streamListenerArgumentHandlerMap = this.applicationContext.getBeansOfType( StreamListenerParameterAdapter.class); for (StreamListenerParameterAdapter streamListenerParameterAdapter : streamListenerArgumentHandlerMap .values()) { this.streamListenerParameterAdapters.add(streamListenerParameterAdapter); } Map<String, StreamListenerResultAdapter> stringStreamListenerResultHandlerMap = applicationContext.getBeansOfType( StreamListenerResultAdapter.class); this.streamListenerResultAdapters.add(new MessageChannelStreamListenerResultAdapter()); for (StreamListenerResultAdapter streamListenerResultAdapter : stringStreamListenerResultHandlerMap.values()) { this.streamListenerResultAdapters.add(streamListenerResultAdapter); } }
Source:
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); }

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:
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 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" ); } }

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:
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 be found on [%s]", getExceptionString()); } return toReturn; }

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:
public Optional<MapVersion> findMapByFolderName(String folderName) { List<MapVersion> maps = getMany("/data/mapVersion", 1, ImmutableMap.of( "filter", MessageFormat.format("filename==\"*{0}*\"", folderName), "include", "map,map.statistics,reviews")); if (maps.isEmpty()) { return Optional.empty(); } return Optional.ofNullable(maps.get(0)); }

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:
public void testHasNhinTargetHomeCommunityId() { StandardOutboundDocSubmissionDeferredRequest entityOrch = createDocSubmissionDeferredRequestOrchImpl(); boolean hasTargets = entityOrch.hasNhinTargetHomeCommunityId(null); 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); }

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:
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 { 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); } }

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:
public void testReadDoubles() { class DoublesSliceInputTester 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)); }

Target:
public void testReadDoubles() { testSliceInput(new DoublesSliceInputTester(1)); testSliceInput(new DoublesSliceInputTester(4)); testSliceInput(new DoublesSliceInputTester(13)); }
Source:
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)); return; } 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); } }

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:
public ProjectReference(final String reference) throws URISyntaxException, IllegalArgumentException { 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]; }

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:
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 (!workflowIds.isEmpty()); log.info("Archiving finished. Archived workflows in seconds.", archivedWorkflowsTotal, stopWatch.getTime() / 1000); return archivedWorkflowsTotal; }

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:
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) { System.err.println("Cannot parse load value: " + result.trim()); } return load; }

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:
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 if (value.get() != null) { env.flop("Expected no element but got end-of-stream"); } }

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:
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("latest") ? HIT_RATIO_AVG : HIT_RATIO_AVG_BEFORE_24, 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 ); }

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:
public void testJoinWithStatefulFilterFunction() { super.testJoinWithStatefulFilterFunction(); Session session = Session.builder(getSession()) .setSystemProperty(SystemSessionProperties.JOIN_DISTRIBUTION_TYPE, FeaturesConfig.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)); }

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:
void setAppendingSegment(SegmentWithState appendingSegment) { Preconditions.checkState(this.appendingSegment == null); this.appendingSegment = appendingSegment; }

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:
public void setUserActivationKey(User user) { log.info("Setting activationKey for " + user.getUsername()); int validTime = 10*60*1000; String token = RandomStringUtils.randomAlphanumeric(20); long time = System.currentTimeMillis() + validTime; String hashedKey = Security.encodeString(token); String activationKey = hashedKey+":"+time; dao.createActivationKey(user, activationKey); }

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:
static public void checkAccessPermission(Method method) { checkAccessPermission(method.getDeclaringClass(), method.getModifiers(), method.isAccessible() ); }

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

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:
private String bypassRootElement() throws IOException { String name = jsonReader.nextName(); if(!"request_box".equalsIgnoreCase(name)) { if (!schemaList.isEmpty()) { JsonObject jsonObject = schemaList.get(0); if (JsonState.StartState == state || JSONType.NESTED_ARRAY.equals(jsonObject.getType())) { name = jsonObject.getName(); } } } return name; }

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:
public void testStaffListFetch() { final List<HashMap> responseWithoutStatus = StaffHelper.getStaffList(requestSpec, responseSpec); final List<HashMap> responseAll = (List<HashMap>) StaffHelper.getStaffListWithState(requestSpec, responseSpec, "all"); 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); }

Target:
public void testStaffListFetch() { StaffHelper.getStaffList(requestSpec, responseSpec); }
Source:
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 = 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; }

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:
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.getValue() != null) { regionID.setStoredValue(customRegionID.getStoredValue()); } if (!useCustomRegion.getValue() && !SnowflakeRegion.AWS_US_WEST.equals(region.getValue())) { regionID.setValue("\"" + region.getValue().getRegionID() + "\""); } migrated = true; } return migrated; }

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:
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); }

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:
public static Long parseToEpochMs(String epoch) { 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; }

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:
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.factory = factory; }

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:
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()); try { ruleEntityService.expire(id, assertedExpiryDate); } catch (NoSuchElementException | IllegalArgumentException ex) { throw new NotFoundException(ex.getMessage()); } }

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:
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.writeCsv(System.out); }

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:
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) { } 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."); }

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:
@Override public Response execute(Request request) throws IOException { HttpUriRequest apacheRequest = createRequest(request); HttpResponse apacheResponse = execute(client, apacheRequest); String url = request.getUrl(); if (this.redirectHandler != null && this.redirectHandler.finalUri != null) { url = this.redirectHandler.finalUri.toString(); } return parseResponse(url, apacheResponse); }

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:
boolean uploadFormDataToServer(List<FormData> allFormData, boolean result) throws IOException { for (FormData formData : allFormData) { String rawPayload = formData.getJsonPayload(); System.out.println(rawPayload); 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; }

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:
protected void updateComboTooltip() { if (fBuildConfigCombo != null && fBuildConfigCombo.getSelectionIndex() > 0) { 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); } }

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:
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()); }

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:
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(); assertEquals(allLeases.size(), addedLeases.size()); assertThat(addedLeases.values().containsAll(allLeases), equalTo(true)); }

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:
public void simpleFeatureSearch() throws AvroRemoteException { SearchGenotypePhenotypeRequest request = SearchGenotypePhenotypeRequest.newBuilder().build(); request.setFeature("KIT *wild"); SearchGenotypePhenotypeResponse response = client.genotypePhenotype.searchGenotypePhenotype(request); assertThat(response).isNotNull(); assertThat(response.getAssociations()).isNotNull() ; assertThat(response.getAssociations().get(0)).isNotNull() ; }

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:
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())) .findFirst() .map(p -> PatronAccess.valueOf(p.getValue())) .orElse(PatronAccess.parent); }

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:
private List<AccountExternalId.Key> filterKeysByScheme( String keyScheme, ResultSet<AccountExternalId> externalIds) { List<AccountExternalId.Key> filteredExternalIds = Lists.newArrayList(); for (AccountExternalId accountExternalId : externalIds) { if (accountExternalId.isScheme(keyScheme)) { filteredExternalIds.add(accountExternalId.getKey()); } } return filteredExternalIds; }

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:
public static FileBasedInfinitestConfigurationSource createFromWorkingDirectory(File workingDirectory) { File configFile = new File(workingDirectory, "infinitest.filters"); return new FileBasedInfinitestConfigurationSource(configFile); }

Target:
public static FileBasedInfinitestConfigurationSource createFromWorkingDirectory(File workingDirectory) { File configFile = new File(workingDirectory, INFINITEST_FILTERS_FILE_NAME); return new FileBasedInfinitestConfigurationSource(configFile); }
Source:
public FastaReferenceWriterBuilder setFastaOutput(final OutputStream fastaOutput) { this.fastaOutput = fastaOutput; this.fastaFile = null; this.makeGziOutput = false; return this; }

Target:
public FastaReferenceWriterBuilder setFastaOutput(final OutputStream fastaOutput) { this.fastaOutput = fastaOutput; this.fastaFile = null; this.gzippedFastaFile = false; this.makeGziOutput = false; return this; }
Source:
public void updateFirstShouldDoNothingWhenCalledForEntitiesThatDoNotExist() { Query q = query(where("id").is(Long.MIN_VALUE)); assumeThat(template.findOne(q, VersionedPerson.class), nullValue()); template.updateFirst(q, Update.update("lastname", "supercalifragilisticexpialidocious"), VersionedPerson.class); assertThat(template.findOne(q, VersionedPerson.class), nullValue()); }

Target:
public void updateFirstShouldDoNothingWhenCalledForEntitiesThatDoNotExist() { Query q = query(where("id").is(Long.MIN_VALUE)); template.updateFirst(q, Update.update("lastname", "supercalifragilisticexpialidocious"), VersionedPerson.class); assertThat(template.findOne(q, VersionedPerson.class), nullValue()); }