auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public SentimentSample(String sentiment, String[] sentence, boolean clearAdaptiveData) { if (sentiment == null) { throw new IllegalArgumentException("sentiment must not be null"); } if (sentence == null) { throw new IllegalArgumentException("sentence must not be null"); } this.sentiment = sentiment; this.sentence = Collections .unmodifiableList(new ArrayList<String>(Arrays.asList(sentence))); this.isClearAdaptiveData = clearAdaptiveData; }

Target:
public SentimentSample(String sentiment, String[] sentence, boolean clearAdaptiveData) { this.sentiment = Objects.requireNonNull(sentiment, "sentiment must not be null"); Objects.requireNonNull(sentence, "sentence must not be null"); this.sentence = Collections.unmodifiableList(Arrays.asList(sentence)); this.isClearAdaptiveData = clearAdaptiveData; }
Source:
public byte[] toBytes(Schema toSchema, Object o) { if (toSchema != null && toSchema.getType() == Type.UNION) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); org.apache.avro.io.BinaryEncoder avroEncoder = EncoderFactory.get().binaryEncoder(baos, null); int unionIndex = 0; try { if (o == null) { unionIndex = firstNullSchemaTypeIndex(toSchema); avroEncoder.writeIndex(unionIndex); avroEncoder.writeNull(); } else { unionIndex = firstNotNullSchemaTypeIndex(toSchema); avroEncoder.writeIndex(unionIndex); avroEncoder.writeBytes(toBytes(o)); } avroEncoder.flush(); return baos.toByteArray(); } catch (IOException e) { return toBytes(o); } } else { return toBytes(o); } }

Target:
public byte[] toBytes(Schema toSchema, Object o) { if (toSchema != null && toSchema.getType() == Type.UNION) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); org.apache.avro.io.BinaryEncoder avroEncoder = EncoderFactory.get().binaryEncoder(baos, null); int unionIndex = 0; try { if (o == null) { unionIndex = firstNullSchemaTypeIndex(toSchema); avroEncoder.writeIndex(unionIndex); avroEncoder.writeNull(); } else { unionIndex = firstNotNullSchemaTypeIndex(toSchema); avroEncoder.writeIndex(unionIndex); avroEncoder.writeBytes(toBytes(o)); } avroEncoder.flush(); return baos.toByteArray(); } catch (IOException e) { LOG.error(e.getMessage()); return toBytes(o); } } else { return toBytes(o); } }
Source:
protected ClearcutClient(String url) { boolean isExternalUser = !isInternalUser(); if (isExternalUser) { mLogSource = EXTERNAL_LOG_SOURCE; } else { mLogSource = INTERNAL_LOG_SOURCE; } if (url == null) { mUrl = CLEARCUT_PROD_URL; } else { mUrl = url; } mRunId = UUID.randomUUID().toString(); if (isExternalUser) { mUserType = UserType.EXTERNAL; } else { mUserType = UserType.GOOGLE; } mExternalEventQueue = new ArrayList<>(); mDisabled = isClearcutDisabled(); if (mDisabled) { return; } System.out.println(NoticeMessageUtil.getNoticeMessage(mUserType)); mExecutor = new ScheduledThreadPoolExecutor(1); Runnable command = new Runnable() { @Override public void run() { flushEvents(); } }; mExecutor.scheduleAtFixedRate( command, SCHEDULER_INITIAL_DELAY_SECONDS, SCHEDULER_PERDIOC_SECONDS, TimeUnit.SECONDS); }

Target:
protected ClearcutClient(String url) { if (isInternalUser()) { mLogSource = INTERNAL_LOG_SOURCE; mUserType = UserType.GOOGLE; } else { mLogSource = EXTERNAL_LOG_SOURCE; mUserType = UserType.EXTERNAL; } if (url == null) { mUrl = CLEARCUT_PROD_URL; } else { mUrl = url; } mRunId = UUID.randomUUID().toString(); mExternalEventQueue = new ArrayList<>(); mDisabled = isClearcutDisabled(); if (mDisabled) { return; } System.out.println(NoticeMessageUtil.getNoticeMessage(mUserType)); mExecutor = new ScheduledThreadPoolExecutor(1); Runnable command = new Runnable() { @Override public void run() { flushEvents(); } }; mExecutor.scheduleAtFixedRate( command, SCHEDULER_INITIAL_DELAY_SECONDS, SCHEDULER_PERDIOC_SECONDS, TimeUnit.SECONDS); }
Source:
public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); menu.add(0, MODE_ARCHIVE, 0, Localization.get("menu.archive")).setIcon(android.R.drawable.ic_menu_upload); menu.add(0, MODE_SMS, 1, Localization.get("menu.sms")).setIcon(android.R.drawable.ic_menu_upload); return true; }

Target:
public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); menu.add(0, MODE_ARCHIVE, 0, Localization.get("menu.archive")).setIcon(android.R.drawable.ic_menu_upload); menu.add(0, MODE_SMS, 1, Localization.get("menu.sms")).setIcon(android.R.drawable.stat_notify_chat); return true; }
Source:
public static void deIdentifyWithMasking(String projectId, String textToDeIdentify) throws IOException { try (DlpServiceClient dlp = DlpServiceClient.create()) { ContentItem contentItem = ContentItem.newBuilder().setValue(textToDeIdentify).build(); List<InfoType> infoTypes = Stream.of("US_SOCIAL_SECURITY_NUMBER") .map(it -> InfoType.newBuilder().setName(it).build()) .collect(Collectors.toList()); InspectConfig inspectConfig = InspectConfig.newBuilder().addAllInfoTypes(infoTypes).build(); CharacterMaskConfig characterMaskConfig = CharacterMaskConfig.newBuilder() .setMaskingCharacter("X") .setNumberToMask(5) .build(); PrimitiveTransformation primitiveTransformation = PrimitiveTransformation.newBuilder() .setReplaceWithInfoTypeConfig(ReplaceWithInfoTypeConfig.getDefaultInstance()) .build(); InfoTypeTransformation infoTypeTransformation = InfoTypeTransformation.newBuilder() .setPrimitiveTransformation(primitiveTransformation) .build(); InfoTypeTransformations transformations = InfoTypeTransformations.newBuilder().addTransformations(infoTypeTransformation).build(); DeidentifyConfig deidentifyConfig = DeidentifyConfig.newBuilder().setInfoTypeTransformations(transformations).build(); DeidentifyContentRequest request = DeidentifyContentRequest.newBuilder() .setParent(ProjectName.of(projectId).toString()) .setItem(contentItem) .setInspectConfig(inspectConfig) .setDeidentifyConfig(deidentifyConfig) .build(); DeidentifyContentResponse response = dlp.deidentifyContent(request); System.out.println("Text after masking: " + response.getItem().getValue()); } }

Target:
public static void deIdentifyWithMasking(String projectId, String textToDeIdentify) throws IOException { try (DlpServiceClient dlp = DlpServiceClient.create()) { ContentItem contentItem = ContentItem.newBuilder().setValue(textToDeIdentify).build(); InfoType infoType = InfoType.newBuilder().setName("US_SOCIAL_SECURITY_NUMBER").build(); InspectConfig inspectConfig = InspectConfig.newBuilder().addAllInfoTypes(Arrays.asList(infoType)).build(); CharacterMaskConfig characterMaskConfig = CharacterMaskConfig.newBuilder() .setMaskingCharacter("X") .setNumberToMask(5) .build(); PrimitiveTransformation primitiveTransformation = PrimitiveTransformation.newBuilder() .setReplaceWithInfoTypeConfig(ReplaceWithInfoTypeConfig.getDefaultInstance()) .build(); InfoTypeTransformation infoTypeTransformation = InfoTypeTransformation.newBuilder() .setPrimitiveTransformation(primitiveTransformation) .build(); InfoTypeTransformations transformations = InfoTypeTransformations.newBuilder().addTransformations(infoTypeTransformation).build(); DeidentifyConfig deidentifyConfig = DeidentifyConfig.newBuilder().setInfoTypeTransformations(transformations).build(); DeidentifyContentRequest request = DeidentifyContentRequest.newBuilder() .setParent(ProjectName.of(projectId).toString()) .setItem(contentItem) .setInspectConfig(inspectConfig) .setDeidentifyConfig(deidentifyConfig) .build(); DeidentifyContentResponse response = dlp.deidentifyContent(request); System.out.println("Text after masking: " + response.getItem().getValue()); } }
Source:
public IntegrationFlow lines() { return f -> f.enrichHeaders(h -> h.headerExpression( FileHeaders.FILENAME, "payload.substring(1, 4) + '.txt'", true)) .handle(Files.outboundAdapter("'/tmp/out'") .appendNewLine(true) .fileExistsMode(FileExistsMode.APPEND_NO_FLUSH), e -> e.id("fileOut")); }

Target:
public IntegrationFlow lines() { return f -> f.handle(fileOut()); }
Source:
private boolean updateLeaseInfoIfNeeded() { boolean updateLeaseInfo = false; Guid SnapshotLeaseDomainId = null; if (isLeaseInfoUpdateNeeded(activeBeforeSnapshotLeaseDomainId, previewedSnapshotLeaseDomainId)) { updateLeaseInfo = true; SnapshotLeaseDomainId = getParameters().getSnapshotAction() == SnapshotActionEnum.UNDO ? activeBeforeSnapshotLeaseDomainId : previewedSnapshotLeaseDomainId; } else if (getParameters().getSnapshotAction() == SnapshotActionEnum.RESTORE_STATELESS && previewedSnapshotLeaseDomainId != null) { updateLeaseInfo = true; SnapshotLeaseDomainId = activeBeforeSnapshotLeaseDomainId; } return !updateLeaseInfo || updateLeaseInfo(SnapshotLeaseDomainId); }

Target:
private boolean updateLeaseInfoIfNeeded() { if (isLeaseInfoUpdateNeeded(activeBeforeSnapshotLeaseDomainId, previewedSnapshotLeaseDomainId)) { Guid snapshotLeaseDomainId = getParameters().getSnapshotAction() != SnapshotActionEnum.COMMIT ? activeBeforeSnapshotLeaseDomainId : previewedSnapshotLeaseDomainId; return updateLeaseInfo(snapshotLeaseDomainId); } return true; }
Source:
private String fieldTypeUnwrapped() { if (fieldDMNType.isCollection()) { String typeName = index.asJava(fieldDMNType.getBaseType()); return typeName; } throw new IllegalArgumentException(); }

Target:
private String fieldTypeUnwrapped() { if (fieldDMNType.isCollection()) { return index.asJava(fieldDMNType.getBaseType()); } throw new IllegalArgumentException(); }
Source:
public void deliverMessages() { delivering = true; for (Tuple group : queue.keySet()) { DefaultMailbox mailbox = queue.get(group); Map<Tuple, Integer> contents = mailbox.getQueue(); List<Tuple> keys = new ArrayList<Tuple>(contents.keySet()); int i = 0; boolean monotoneChange; while (i < keys.size()) { monotoneChange = false; Tuple current = keys.get(i); int currentCount = contents.get(current); Tuple next = (i + 1 < keys.size()) ? keys.get(i + 1) : null; if (next != null) { int nextCount = contents.get(next); if (currentCount == -1 && nextCount == 1) { Tuple currentComputed = receiver.getPosetMask().transform(current); Tuple nextComputed = receiver.getPosetMask().transform(next); monotoneChange = receiver.getPosetComparator().isLessOrEqual(currentComputed, nextComputed); } } if (monotoneChange) { assert next != null; receiver.update(Direction.REVOKE, current, true); receiver.update(Direction.INSERT, next, true); i += 2; } else { Direction direction = currentCount < 0 ? Direction.REVOKE : Direction.INSERT; for (int j = 0; j < Math.abs(currentCount); j++) { receiver.update(direction, current); } i++; } } } delivering = false; Map<Tuple, DefaultMailbox> tmp = queue; queue = buffer; buffer = tmp; buffer.clear(); }

Target:
public void deliverMessages() { delivering = true; for (Tuple group : queue.keySet()) { DefaultMailbox mailbox = queue.get(group); Map<Tuple, Integer> contents = mailbox.getQueue(); List<Tuple> keys = new ArrayList<Tuple>(contents.keySet()); int i = 0; boolean monotoneChange; while (i < keys.size()) { monotoneChange = false; Tuple current = keys.get(i); int currentCount = contents.get(current); Tuple next = (i + 1 < keys.size()) ? keys.get(i + 1) : null; if (next != null) { int nextCount = contents.get(next); if (currentCount < 0 && nextCount > 0 && -currentCount == nextCount) { Tuple currentComputed = receiver.getPosetMask().transform(current); Tuple nextComputed = receiver.getPosetMask().transform(next); monotoneChange = receiver.getPosetComparator().isLessOrEqual(currentComputed, nextComputed); } } if (monotoneChange) { assert next != null; for (int j = 0; j < -currentCount; j++) { receiver.update(Direction.REVOKE, current, true); } for (int j = 0; j < -currentCount; j++) { receiver.update(Direction.INSERT, next, true); } i += 2; } else { Direction direction = currentCount < 0 ? Direction.REVOKE : Direction.INSERT; for (int j = 0; j < Math.abs(currentCount); j++) { receiver.update(direction, current); } i++; } } } delivering = false; Map<Tuple, DefaultMailbox> tmp = queue; queue = buffer; buffer = tmp; buffer.clear(); }
Source:
private void createVolume() { populateDiskSnapshotsInfoFromStorage(); CreateVolumeContainerCommandParameters parameters = new CreateVolumeContainerCommandParameters( getParameters().getStoragePoolId(), getParameters().getDestDomain(), getParameters().getDestImageGroupId(), getParameters().getDestinationImageId(), getParameters().getImageGroupID(), getParameters().getImageId(), getParameters().getDestinationFormat(), getParameters().getDescription(), getDiskImage().getSize(), ImagesHandler.determineImageInitialSize(getDiskImage().getImage(), getParameters().getDestinationFormat(), getParameters().getStoragePoolId(), getParameters() .getSrcDomain(), getParameters().getDestDomain(), getParameters().getImageGroupID())); parameters.setCreateImage(true); parameters.setParentCommand(getActionType()); parameters.setParentParameters(getParameters()); parameters.setEndProcedure(EndProcedure.COMMAND_MANAGED); runInternalAction(VdcActionType.CreateVolumeContainer, parameters); }

Target:
private void createVolume() { populateDiskSnapshotsInfoFromStorage(); CreateVolumeContainerCommandParameters parameters = new CreateVolumeContainerCommandParameters( getParameters().getStoragePoolId(), getParameters().getDestDomain(), getParameters().getImageGroupID(), getParameters().getImageId(), getParameters().getDestImageGroupId(), getParameters().getDestinationImageId(), getParameters().getDestinationFormat(), getParameters().getDescription(), getDiskImage().getSize(), ImagesHandler.determineImageInitialSize(getDiskImage().getImage(), getParameters().getDestinationFormat(), getParameters().getStoragePoolId(), getParameters() .getSrcDomain(), getParameters().getDestDomain(), getParameters().getImageGroupID())); parameters.setParentCommand(getActionType()); parameters.setParentParameters(getParameters()); parameters.setEndProcedure(EndProcedure.COMMAND_MANAGED); runInternalAction(VdcActionType.CreateVolumeContainer, parameters); }
Source:
public void testBootstrapFromFile() throws IOException { LookupExtractorFactory lookupExtractorFactory = new LookupExtractorFactoryMock("data"); mapper.registerSubtypes(LookupExtractorFactoryMock.class); lookupReferencesManager.put("testMockForBootstrap",lookupExtractorFactory); lookupReferencesManager.stop(); lookupReferencesManager.start(); Assert.assertEquals(lookupExtractorFactory, lookupReferencesManager.get("testMockForBootstrap")); }

Target:
public void testBootstrapFromFile() throws IOException { LookupExtractorFactory lookupExtractorFactory = new LookupExtractorFactoryMock("data"); lookupReferencesManager.put("testMockForBootstrap",lookupExtractorFactory); lookupReferencesManager.stop(); lookupReferencesManager.start(); Assert.assertEquals(lookupExtractorFactory, lookupReferencesManager.get("testMockForBootstrap")); }
Source:
public LatLngBounds getBounds() { if (_map == null) { LatLng center = _initialCamera.build().target; return new LatLngBounds.Builder() .include(center) .include(center) .build(); } return _map.getProjection().getVisibleRegion().latLngBounds; }

Target:
public LatLngBounds getBounds() { if (_map == null) { throw new JSApplicationIllegalArgumentException( "Calling getBounds is not allowed until map is ready. " + "Pass function as onFinishLoadingMap prop to get notified " + "when map is ready."); } return _map.getProjection().getVisibleRegion().latLngBounds; }
Source:
public void startup(Application application, ComponentStartupStatus ss) { Properties properties = new Properties(); properties.put("java.naming.factory.initial", factoryInitial); properties.put("java.naming.provider.url", providerURL); String[] destinationParts = brokerDestination.split("/"); String destinationBinding = String.format("%s.%s", destinationParts[0], brokerDestination); String destinationName = destinationParts[1]; properties.put(destinationBinding, destinationName); try { InitialContext ic = new InitialContext(properties); ConnectionFactory cf = (ConnectionFactory) ic.lookup(connectionFactory); destination = (Destination) ic.lookup(brokerDestination); connection = cf.createConnection(brokerUsername, brokerPassword); session = connection.createSession(Session.AUTO_ACKNOWLEDGE); producer = session.createProducer(destination); log.info(String.format("Message producer connected to %s at %s", brokerDestination, providerURL)); } catch (NamingException | JMSException e) { log.error(e, e); } }

Target:
public void startup(Application application, ComponentStartupStatus ss) { Properties properties = new Properties(); properties.put("java.naming.factory.initial", factoryInitial); properties.put("java.naming.provider.url", providerURL); String[] destinationParts = brokerDestination.split("/"); String destinationBinding = String.format("%s.%s", destinationParts[0], brokerDestination); String destinationName = destinationParts[1]; properties.put(destinationBinding, destinationName); try { InitialContext ic = new InitialContext(properties); ConnectionFactory cf = (ConnectionFactory) ic.lookup(connectionFactory); Destination destination = (Destination) ic.lookup(brokerDestination); Connection connection = cf.createConnection(brokerUsername, brokerPassword); session = connection.createSession(Session.AUTO_ACKNOWLEDGE); producer = session.createProducer(destination); ss.info(String.format("Message producer connected to %s at %s", brokerDestination, providerURL)); } catch (NamingException | JMSException e) { ss.warning(e.getMessage(), e); } }
Source:
public Integer map(Tuple3<Integer, Long, Integer> element) throws Exception { int addedInteger = element.f0 * producerParallelism + element.f2; System.out.println("<" + element.f0 + "," + element.f2 + "> " + addedInteger); return addedInteger; }

Target:
public Integer map(Tuple3<Integer, Long, Integer> element) throws Exception { return element.f0 * producerParallelism + element.f2; }
Source:
public byte[] getCacheKey() { byte[] fieldNameBytes = StringUtils.toUtf8(fieldName); return ByteBuffer.allocate(2 + fieldNameBytes.length) .put(CACHE_TYPE_ID) .put(variancePop ? (byte)1 : 0) .put(fieldNameBytes).array(); }

Target:
public byte[] getCacheKey() { byte[] fieldNameBytes = StringUtils.toUtf8(fieldName); byte[] inputTypeBytes = StringUtils.toUtf8(inputType); return ByteBuffer.allocate(2 + fieldNameBytes.length + 1 + inputTypeBytes.length) .put(CACHE_TYPE_ID) .put(isVariancePop ? (byte) 1 : 0) .put(fieldNameBytes) .put((byte) 0xFF) .put(inputTypeBytes) .array(); }
Source:
public ExpectedIssueCollector(File expectedIssuesFile) throws IOException { this.writer = new FileWriter(expectedIssuesFile); this.expectedIssuesFile = expectedIssuesFile; }

Target:
public ExpectedIssueCollector(File expectedIssuesFile) throws IOException { this.writer = new OutputStreamWriter(new FileOutputStream(expectedIssuesFile), "UTF-8"); this.expectedIssuesFile = expectedIssuesFile; }
Source:
protected boolean post_default_network_rules(final Connect conn, final String vmName, final NicTO nic, final Long vmId, final InetAddress dhcpServerIp, final String hostIp, final String hostMacAddr) { if (!_canBridgeFirewall) { return false; } final List<InterfaceDef> intfs = getInterfaces(conn, vmName); if (intfs.size() < nic.getDeviceId()) { return false; } final InterfaceDef intf = intfs.get(nic.getDeviceId()); final String brname = intf.getBrName(); final String vif = intf.getDevName(); final Script cmd = new Script(_securityGroupPath, _timeout.getMillis(), s_logger); cmd.add("post_default_network_rules"); cmd.add("--vmname", vmName); cmd.add("--vmid", vmId.toString()); cmd.add("--vmip", nic.getIp()); cmd.add("--vmmac", nic.getMac()); cmd.add("--vif", vif); cmd.add("--brname", brname); if (dhcpServerIp != null) { cmd.add("--dhcpSvr", dhcpServerIp.getHostAddress()); } cmd.add("--hostIp", hostIp); cmd.add("--hostMacAddr", hostMacAddr); final String result = cmd.execute(); if (result != null) { return false; } return true; }

Target:
protected boolean post_default_network_rules(final Connect conn, final String vmName, final NicTO nic, final Long vmId, final InetAddress dhcpServerIp, final String hostIp, final String hostMacAddr) { if (!_canBridgeFirewall) { return false; } final List<InterfaceDef> intfs = getInterfaces(conn, vmName); if (intfs.size() < nic.getDeviceId()) { return false; } final InterfaceDef intf = intfs.get(nic.getDeviceId()); final String brname = intf.getBrName(); final String vif = intf.getDevName(); final Script cmd = new Script(_securityGroupPath, _timeout, s_logger); cmd.add("post_default_network_rules"); cmd.add("--vmname", vmName); cmd.add("--vmid", vmId.toString()); cmd.add("--vmip", nic.getIp()); cmd.add("--vmmac", nic.getMac()); cmd.add("--vif", vif); cmd.add("--brname", brname); if (dhcpServerIp != null) { cmd.add("--dhcpSvr", dhcpServerIp.getHostAddress()); } cmd.add("--hostIp", hostIp); cmd.add("--hostMacAddr", hostMacAddr); final String result = cmd.execute(); if (result != null) { return false; } return true; }
Source:
public Object compute(final Map<String, Object> combinedAggregators) { final ArrayOfDoublesSketch[] sketches = new ArrayOfDoublesSketch[getFields().size()]; for (int i = 0; i < sketches.length; i++) { sketches[i] = (ArrayOfDoublesSketch) getFields().get(i).compute(combinedAggregators); } final ArrayOfDoublesSketch sketch1 = (ArrayOfDoublesSketch) getFields().get(0).compute(combinedAggregators); final ArrayOfDoublesSketch sketch2 = (ArrayOfDoublesSketch) getFields().get(1).compute(combinedAggregators); if (sketch1.getNumValues() != sketch2.getNumValues()) { throw new IAE("Sketches have different number of values: " + sketch1.getNumValues() + " and " + sketch2.getNumValues()); } final SummaryStatistics[] stats1 = getStats(sketch1); final SummaryStatistics[] stats2 = getStats(sketch2); final int numberOfValues = sketch1.getNumValues(); final double[] pValues = new double[numberOfValues]; final TTest test = new TTest(); for (int i = 0; i < pValues.length; i++) { pValues[i] = test.tTest(stats1[i], stats2[i]); } return pValues; }

Target:
public double[] compute(final Map<String, Object> combinedAggregators) { final ArrayOfDoublesSketch sketch1 = (ArrayOfDoublesSketch) getFields().get(0).compute(combinedAggregators); final ArrayOfDoublesSketch sketch2 = (ArrayOfDoublesSketch) getFields().get(1).compute(combinedAggregators); if (sketch1.getNumValues() != sketch2.getNumValues()) { throw new IAE( "Sketches have different number of values: %d and %d", sketch1.getNumValues(), sketch2.getNumValues() ); } final SummaryStatistics[] stats1 = getStats(sketch1); final SummaryStatistics[] stats2 = getStats(sketch2); final int numberOfValues = sketch1.getNumValues(); final double[] pValues = new double[numberOfValues]; final TTest test = new TTest(); for (int i = 0; i < pValues.length; i++) { pValues[i] = test.tTest(stats1[i], stats2[i]); } return pValues; }
Source:
public @ResponseBody boolean setAcceptFreeAgents( @PathVariable int id, @RequestParam(value = "acceptFreeAgents") boolean acceptFreeAgents) { TeamDao teamDao = new TeamDao(); Team team = teamDao.getTeamById(id, false, false, false); team.setAcceptFreeAgents(acceptFreeAgents); teamDao.saveTeam(team); return false; }

Target:
public @ResponseBody boolean setAcceptFreeAgents( @PathVariable int id, @RequestParam(value = "acceptFreeAgents") boolean acceptFreeAgents) { TeamDao teamDao = new TeamDao(); Team team = teamDao.getTeamById(id, false, false, false); team.setAcceptFreeAgents(acceptFreeAgents); teamDao.saveTeam(team); return true; }
Source:
private void handleTransferring(final StateContext context) { if (context.iterationTimestamp >= getParameters().getSessionExpiration() - getHostTicketRefreshAllowance()) { log.info("Renewing transfer ticket for {}", getTransferDescription()); boolean extendSucceeded = extendImageTransferSession(context.entity); if (!extendSucceeded) { log.info("Failed to renew transfer ticket for {}", getTransferDescription()); if (getParameters().isExtendTicketFailed()) { updateEntityPhase(ImageTransferPhase.PAUSED_SYSTEM); getParameters().setExtendTicketFailed(false); } else { getParameters().setExtendTicketFailed(true); } } } else { log.debug("Not yet renewing transfer ticket for {}", getTransferDescription()); } resetPeriodicPauseLogTime(0); }

Target:
private void handleTransferring(final StateContext context) { if (context.iterationTimestamp >= getParameters().getSessionExpiration() - getHostTicketRefreshAllowance()) { log.info("Renewing transfer ticket for {}", getTransferDescription()); boolean extendSucceeded = extendImageTransferSession(context.entity); if (!extendSucceeded) { log.warn("Failed to renew transfer ticket for {}", getTransferDescription()); if (!getParameters().isRetryExtendTicket()) { updateEntityPhase(ImageTransferPhase.PAUSED_SYSTEM); getParameters().setRetryExtendTicket(true); } else { getParameters().setRetryExtendTicket(false); } } } else { log.debug("Not yet renewing transfer ticket for {}", getTransferDescription()); } resetPeriodicPauseLogTime(0); }
Source:
protected Type _deserialize(String value, DeserializationContext context) { Type type = metadata.getType(parseTypeSignature(value)); if (type == null) { throw new IllegalArgumentException(String.valueOf("Unknown type " + value)); } return type; }

Target:
protected Type _deserialize(String value, DeserializationContext context) { Type type = metadata.getType(parseTypeSignature(value)); if (type == null) { throw new IllegalArgumentException("Unknown type: " + value); } return type; }
Source:
public DBObject convert(Variant variant) { Assert.notNull(variant, "Variant should not be null. Please provide a valid Variant object"); logger.trace("Convert variant into mongo object", variant); variant.setAnnotation(null); VariantSourceEntry variantSourceEntry = variant.getSourceEntries().entrySet().iterator().next().getValue(); BasicDBObject addToSet = new BasicDBObject().append(DBObjectToVariantConverter.FILES_FIELD, sourceEntryConverter.convertToStorageType(variantSourceEntry)); if (includeStats) { List<DBObject> sourceEntryStats = statsConverter.convertCohortsToStorageType(variantSourceEntry.getCohortStats(), variantSourceEntry.getStudyId(), variantSourceEntry.getFileId()); addToSet.put(DBObjectToVariantConverter.STATS_FIELD, new BasicDBObject("$each", sourceEntryStats)); } if (variant.getIds() != null && !variant.getIds().isEmpty()) { addToSet.put(DBObjectToVariantConverter.IDS_FIELD, new BasicDBObject("$each", variant.getIds())); } BasicDBObject update = new BasicDBObject(); update.append("$addToSet", addToSet).append("$setOnInsert", variantConverter.convertToStorageType(variant)); return update; }

Target:
public DBObject convert(Variant variant) { Assert.notNull(variant, "Variant should not be null. Please provide a valid Variant object"); logger.trace("Convert variant into mongo object", variant); variant.setAnnotation(null); VariantSourceEntry variantSourceEntry = variant.getSourceEntries().values().iterator().next(); BasicDBObject addToSet = new BasicDBObject().append(VariantToDBObjectConverter.FILES_FIELD, sourceEntryConverter.convert(variantSourceEntry)); if (includeStats) { List<DBObject> sourceEntryStats = statsConverter.convert(variantSourceEntry); addToSet.put(VariantToDBObjectConverter.STATS_FIELD, new BasicDBObject("$each", sourceEntryStats)); } if (variant.getIds() != null && !variant.getIds().isEmpty()) { addToSet.put(VariantToDBObjectConverter.IDS_FIELD, new BasicDBObject("$each", variant.getIds())); } BasicDBObject update = new BasicDBObject(); update.append("$addToSet", addToSet).append("$setOnInsert", variantConverter.convert(variant)); return update; }
Source:
private Response toOkhttpResponse(org.asynchttpclient.Response asyncHttpClientResponse) { val rspBuilder = new Response.Builder() .request(request()) .protocol(Protocol.HTTP_1_1) .code(asyncHttpClientResponse.getStatusCode()) .message(asyncHttpClientResponse.getStatusText()); if (asyncHttpClientResponse.hasResponseHeaders()) { asyncHttpClientResponse.getHeaders().forEach(e -> rspBuilder.header(e.getKey(), e.getValue())); } if (asyncHttpClientResponse.hasResponseBody()) { val contentType = asyncHttpClientResponse.getContentType() == null ? null : MediaType.parse(asyncHttpClientResponse.getContentType()); val okHttpBody = ResponseBody.create(contentType, asyncHttpClientResponse.getResponseBodyAsBytes()); rspBuilder.body(okHttpBody); } else { rspBuilder.body(ResponseBody.create(null, "")); } return rspBuilder.build(); }

Target:
private Response toOkhttpResponse(org.asynchttpclient.Response asyncHttpClientResponse) { val rspBuilder = new Response.Builder() .request(request()) .protocol(Protocol.HTTP_1_1) .code(asyncHttpClientResponse.getStatusCode()) .message(asyncHttpClientResponse.getStatusText()); if (asyncHttpClientResponse.hasResponseHeaders()) { asyncHttpClientResponse.getHeaders().forEach(e -> rspBuilder.header(e.getKey(), e.getValue())); } if (asyncHttpClientResponse.hasResponseBody()) { val contentType = asyncHttpClientResponse.getContentType() == null ? null : MediaType.parse(asyncHttpClientResponse.getContentType()); val okHttpBody = ResponseBody.create(contentType, asyncHttpClientResponse.getResponseBodyAsBytes()); rspBuilder.body(okHttpBody); } else { rspBuilder.body(EMPTY_BODY); } return rspBuilder.build(); }
Source:
public <T> T retryWithHandle( HandleCallback<T> callback, Predicate<Throwable> myShouldRetry ) { try { return RetryUtils.retry(() -> getDBI().withHandle(callback), myShouldRetry, MAX_RETRIES); } catch (Exception e) { throw Throwables.propagate(e); } }

Target:
public <T> T retryWithHandle( HandleCallback<T> callback, Predicate<Throwable> myShouldRetry ) { try { return RetryUtils.retry(() -> getDBI().withHandle(callback), myShouldRetry, MAX_RETRIES); } catch (Exception e) { throw new RuntimeException(e); } }
Source:
public TexParserResult parse(List<Path> texFiles) { List<Path> referencedFiles = new ArrayList<>(); if (result.getFileList().isEmpty()) { result.getFileList().addAll(texFiles); } else { result.getNestedFiles().addAll(texFiles); } for (int fileIndex = 0; fileIndex < texFiles.size(); fileIndex++) { Path file = texFiles.get(fileIndex); try (LineNumberReader lnr = new LineNumberReader(Files.newBufferedReader(file))) { for (String line = lnr.readLine(); line != null; line = lnr.readLine()) { if (line.startsWith("%")) { continue; } matchCitation(file, lnr.getLineNumber(), line); matchNestedFile(file, texFiles, referencedFiles, line); } } catch (IOException e) { LOGGER.warn("Error opening the TEX file", e); } } if (!referencedFiles.isEmpty()) { parse(referencedFiles); } return result; }

Target:
public TexParserResult parse(List<Path> texFiles) { List<Path> referencedFiles = new ArrayList<>(); result.addFiles(texFiles); for (Path file : texFiles) { try (LineNumberReader lnr = new LineNumberReader(Files.newBufferedReader(file))) { for (String line = lnr.readLine(); line != null; line = lnr.readLine()) { if (line.isEmpty() || line.charAt(0) == '%') { continue; } matchCitation(file, lnr.getLineNumber(), line); matchNestedFile(file, texFiles, referencedFiles, line); } } catch (IOException e) { LOGGER.warn("Error opening the TEX file", e); } } if (!referencedFiles.isEmpty()) { parse(referencedFiles); } return result; }
Source:
public DeleteResult performDelete(@NonNull StorIOSQLite storIOSQLite, @NonNull Person person) { storIOSQLite.internal().beginTransaction(); storIOSQLite .internal() .delete(DeleteQuery.builder() .table(PersonsTable.TABLE) .where(PersonsTable.COLUMN_ID + " = ?") .whereArgs(person.getId()) .build()); storIOSQLite .delete() .objects(person.getCars()) .prepare() .executeAsBlocking(); storIOSQLite.internal().endTransaction(); final Set<String> affectedTables = new HashSet<String>(2); affectedTables.add(PersonsTable.TABLE); affectedTables.add(CarsTable.TABLE); return DeleteResult.newInstance(2, affectedTables); }

Target:
public DeleteResult performDelete(@NonNull StorIOSQLite storIOSQLite, @NonNull Person person) { storIOSQLite.internal().beginTransaction(); try { storIOSQLite .internal() .delete(DeleteQuery.builder() .table(PersonsTable.TABLE_NAME) .where(PersonsTable.COLUMN_UUID) .whereArgs(person.uuid()) .build() ); final Set<String> affectedTables = new HashSet<>(2); affectedTables.add(PersonsTable.TABLE_NAME); if (!person.cars().isEmpty()) { storIOSQLite .delete() .objects(person.cars()) .prepare() .executeAsBlocking(); affectedTables.add(CarsTable.TABLE_NAME); } storIOSQLite.internal().setTransactionSuccessful(); return DeleteResult.newInstance(1, affectedTables); } finally { storIOSQLite.internal().endTransaction(); } }
Source:
public void binderDied() { if (DBG) { Slog.d(TAG, "Binder is dead - unregister " + mPackageName); } for (Map.Entry<IBinder, ClientDeathRecipient> entry : mBleApps.entrySet()) { IBinder token = entry.getKey(); ClientDeathRecipient deathRec = entry.getValue(); if (deathRec.equals(this)) { if (DBG) { Slog.d(TAG, "Remove this BLE app " + mPackageName); } mBleApps.remove(token); break; } } if (isBleAppPresent()) { return; } if (DBG) { Slog.d(TAG, "Disabling LE only mode after application crash"); } try { mBluetoothLock.readLock().lock(); if (mBluetooth != null && mBluetooth.getState() == BluetoothAdapter.STATE_BLE_ON) { mEnable = false; mBluetooth.onBrEdrDown(); } } catch (RemoteException e) { Slog.e(TAG, "Unable to call onBrEdrDown", e); } finally { mBluetoothLock.readLock().unlock(); } }

Target:
public void binderDied() { if (DBG) { Slog.d(TAG, "Binder is dead - unregister " + mPackageName); } for (Map.Entry<IBinder, ClientDeathRecipient> entry : mBleApps.entrySet()) { IBinder token = entry.getKey(); ClientDeathRecipient deathRec = entry.getValue(); if (deathRec.equals(this)) { if (DBG) { Slog.d(TAG, "Removing BLE application " + mPackageName); } mBleApps.remove(token); break; } } if (isBleAppPresent()) { return; } if (DBG) { Slog.d(TAG, "Disabling LE only mode after application crash"); } try { mBluetoothLock.readLock().lock(); if (mBluetooth != null && mBluetooth.getState() == BluetoothAdapter.STATE_BLE_ON) { mEnable = false; mBluetooth.onBrEdrDown(); } } catch (RemoteException e) { Slog.e(TAG, "Unable to call onBrEdrDown", e); } finally { mBluetoothLock.readLock().unlock(); } }
Source:
protected void init() { super.init(); if (getCluster() != null) { setStoragePoolId(getCluster().getStoragePoolId()); } if (isVmExist() && isCompatibilityVersionSupportedByCluster(getEffectiveCompatibilityVersion())) { Version compatibilityVersion = getEffectiveCompatibilityVersion(); getVmPropertiesUtils().separateCustomPropertiesToUserAndPredefined( compatibilityVersion, getParameters().getVmStaticData()); getVmPropertiesUtils().separateCustomPropertiesToUserAndPredefined( compatibilityVersion, getVm().getStaticData()); } vmHandler.updateDefaultTimeZone(getParameters().getVmStaticData()); vmHandler.autoSelectUsbPolicy(getParameters().getVmStaticData()); vmHandler.autoSelectResumeBehavior(getParameters().getVmStaticData(), getCluster().getCompatibilityVersion()); vmHandler.autoSelectDefaultDisplayType(getVmId(), getParameters().getVmStaticData(), getCluster(), getParameters().getGraphicsDevices()); updateParametersVmFromInstanceType(); if (!getParameters().isUpdateNuma()) { getParameters().getVm().setvNumaNodeList(vmNumaNodeDao.getAllVmNumaNodeByVmId(getParameters().getVmId())); } if (getParameters().getVmStaticData().getDefaultDisplayType() == DisplayType.none && !getParameters().isConsoleEnabled()) { getParameters().getVmStaticData().setUsbPolicy(UsbPolicy.DISABLED); } }

Target:
protected void init() { super.init(); if (getCluster() != null) { setStoragePoolId(getCluster().getStoragePoolId()); } if (isVmExist() && isCompatibilityVersionSupportedByCluster(getEffectiveCompatibilityVersion())) { Version compatibilityVersion = getEffectiveCompatibilityVersion(); getVmPropertiesUtils().separateCustomPropertiesToUserAndPredefined( compatibilityVersion, getParameters().getVmStaticData()); getVmPropertiesUtils().separateCustomPropertiesToUserAndPredefined( compatibilityVersion, getVm().getStaticData()); } vmHandler.updateDefaultTimeZone(getParameters().getVmStaticData()); vmHandler.autoSelectUsbPolicy(getParameters().getVmStaticData()); vmHandler.autoSelectResumeBehavior(getParameters().getVmStaticData(), getCluster()); vmHandler.autoSelectDefaultDisplayType(getVmId(), getParameters().getVmStaticData(), getCluster(), getParameters().getGraphicsDevices()); updateParametersVmFromInstanceType(); if (!getParameters().isUpdateNuma()) { getParameters().getVm().setvNumaNodeList(vmNumaNodeDao.getAllVmNumaNodeByVmId(getParameters().getVmId())); } if (getParameters().getVmStaticData().getDefaultDisplayType() == DisplayType.none && !getParameters().isConsoleEnabled()) { getParameters().getVmStaticData().setUsbPolicy(UsbPolicy.DISABLED); } }
Source:
private synchronized FileState getFileState(final File fileToWriteTo, boolean isString) throws FileNotFoundException { String absolutePath = fileToWriteTo.getAbsolutePath(); FileState state; boolean appendNoFlush = FileExistsMode.APPEND_NO_FLUSH.equals(this.fileExistsMode); if (appendNoFlush) { state = this.fileStates.get(absolutePath); if (state != null && ((isString && state.stream != null) || (!isString && state.writer != null))) { state.close(); state = null; this.fileStates.remove(fileToWriteTo); } if (state == null) { if (isString) { state = new FileState(createWriter(fileToWriteTo, true)); } else { state = new FileState(createOutputStream(fileToWriteTo, true)); } this.fileStates.put(absolutePath, state); } state.lastWrite = Long.MAX_VALUE; } else { state = null; } return state; }

Target:
private synchronized FileState getFileState(final File fileToWriteTo, boolean isString) throws FileNotFoundException { String absolutePath = fileToWriteTo.getAbsolutePath(); FileState state; boolean appendNoFlush = FileExistsMode.APPEND_NO_FLUSH.equals(this.fileExistsMode); if (appendNoFlush) { state = this.fileStates.get(absolutePath); if (state != null && ((isString && state.stream != null) || (!isString && state.writer != null))) { state.close(); state = null; this.fileStates.remove(absolutePath); } if (state == null) { if (isString) { state = new FileState(createWriter(fileToWriteTo, true)); } else { state = new FileState(createOutputStream(fileToWriteTo, true)); } this.fileStates.put(absolutePath, state); } state.lastWrite = Long.MAX_VALUE; } else { state = null; } return state; }
Source:
public void testActions() { final Command okCommand = mock(Command.class); final Command overrideCommand = mock(Command.class); final GAV gav = mock(GAV.class); final Set<MavenRepositoryMetadata> metadata = new HashSet<MavenRepositoryMetadata>(); final Set<Role> roles = new HashSet<Role>() {{ add(new RoleImpl(AppRoles.ADMIN.getName())); }}; when(user.getRoles()).thenReturn(roles); presenter.setContent(gav, metadata, okCommand, overrideCommand); presenter.override(); verify(view).hide(); verify(overrideCommand).execute(); presenter.hide(); verify(view, times(2)).hide(); verify(okCommand).execute(); }

Target:
public void testActions() { final Command okCommand = mock(Command.class); final Command overrideCommand = mock(Command.class); final GAV gav = mock(GAV.class); final Set<MavenRepositoryMetadata> metadata = new HashSet<MavenRepositoryMetadata>(); final Set<Role> roles = Collections.singleton(new RoleImpl(AppRoles.ADMIN.getName())); when(user.getRoles()).thenReturn(roles); presenter.setContent(gav, metadata, okCommand, overrideCommand); presenter.override(); verify(view).hide(); verify(overrideCommand).execute(); presenter.hide(); verify(view, times(2)).hide(); verify(okCommand).execute(); }
Source:
public void showReviewImageInfo() { DialogUtil.showAlertDialog(ReviewActivity.this, getString(R.string.review_image), getString(R.string.review_image_explanation), getString(R.string.about_translate_proceed), getString(R.string.go_back_button_text), null, () -> onBackPressed()); }

Target:
public void showReviewImageInfo() { DialogUtil.showAlertDialog(ReviewActivity.this, getString(R.string.title_activity_review), getString(R.string.review_image_explanation), getString(android.R.string.ok), "", null, null); }
Source:
public RevCommit tryFastForward(RevCommit newCommit) throws IOException, JGitInternalException, GitAPIException { Ref head = repo.getRef(Constants.HEAD); if (head == null || head.getObjectId() == null) throw new RefNotFoundException(MessageFormat.format( JGitText.get().refNotResolved, Constants.HEAD)); ObjectId headId = head.getObjectId(); if (headId == null) throw new RefNotFoundException(MessageFormat.format( JGitText.get().refNotResolved, Constants.HEAD)); RevCommit headCommit = walk.lookupCommit(headId); if (walk.isMergedInto(newCommit, headCommit)) return newCommit; String headName; if (head.isSymbolic()) headName = head.getTarget().getName(); else headName = "detached HEAD"; return tryFastForward(headName, headCommit, newCommit); }

Target:
public RevCommit tryFastForward(RevCommit newCommit) throws IOException, GitAPIException { Ref head = repo.getRef(Constants.HEAD); if (head == null || head.getObjectId() == null) throw new RefNotFoundException(MessageFormat.format( JGitText.get().refNotResolved, Constants.HEAD)); ObjectId headId = head.getObjectId(); if (headId == null) throw new RefNotFoundException(MessageFormat.format( JGitText.get().refNotResolved, Constants.HEAD)); RevCommit headCommit = walk.lookupCommit(headId); if (walk.isMergedInto(newCommit, headCommit)) return newCommit; String headName; if (head.isSymbolic()) headName = head.getTarget().getName(); else headName = "detached HEAD"; return tryFastForward(headName, headCommit, newCommit); }
Source:
protected static Date calculateFilterDate(int calendarUnit, int amount) { Calendar cal = Calendar.getInstance(); cal.setTime(new Date()); cal.add(calendarUnit, -(amount)); Date filterDate = cal.getTime(); log.debug("FilterDateFormatted = {}", filterDate); return filterDate; }

Target:
public Date calculateFilterDate(int calendarUnit, int amount) { Calendar cal = Calendar.getInstance(); cal.setTime(new Date()); cal.add(calendarUnit, -(amount)); Date filterDate = cal.getTime(); log.debug("FilterDateFormatted = {}", filterDate); return filterDate; }
Source:
public void testUserWithNoAccessToDocument() { String username = "foo"; DocumentModelResolver resolver = new DocumentModelResolver(); Map<String, String> params = new LinkedHashMap<>(); params.put(PARAM_STORE, STORE_ID_REF); resolver.configure(params); DocumentModel adminDoc = resolver.fetch(DocumentModel.class, idRef); assertNotNull(adminDoc); ClientLoginModule.getThreadLocalLogin().push(new UserPrincipal(username, Collections.emptyList(), false, false), null, null); DocumentModel doc = resolver.fetch(DocumentModel.class, idRef); assertNull(doc); ClientLoginModule.getThreadLocalLogin().pop(); }

Target:
public void testUserWithNoAccessToDocument() { String username = "foo"; DocumentModelResolver resolver = new DocumentModelResolver(); Map<String, String> params = Collections.singletonMap(PARAM_STORE, STORE_ID_REF); resolver.configure(params); DocumentModel adminDoc = resolver.fetch(DocumentModel.class, idRef); assertNotNull(adminDoc); try { ClientLoginModule.getThreadLocalLogin().push(new UserPrincipal(username, Collections.emptyList(), false, false), null, null); DocumentModel doc = resolver.fetch(DocumentModel.class, idRef); assertNull(doc); } finally { ClientLoginModule.getThreadLocalLogin().pop(); } }
Source:
final int drainTasks() { int numTasks = 0; for (;;) { Runnable runnable = taskQueue.poll(); if (runnable == null) { break; } if (AbstractScheduledEventExecutor.WAKEUP_TASK != runnable) { numTasks++; } } return numTasks; }

Target:
final int drainTasks() { int numTasks = 0; for (;;) { Runnable runnable = taskQueue.poll(); if (runnable == null) { break; } if (WAKEUP_TASK != runnable) { numTasks++; } } return numTasks; }
Source:
private boolean checkCompatibility() { String wdName = workingDirText.getText().trim(); String progName = fProgText.getText().trim(); URI wdURI; URI progURI; try { wdURI = new URI(wdName); progURI = new URI(progName); } catch (URISyntaxException e) { System.err.println("internal error. URI syntax error in working directory or program"); return false; } String wdScheme = wdURI.getScheme(); String progScheme = progURI.getScheme(); if (wdScheme == null && progScheme == null) { setErrorMessage(null); return true; } if (!equal(wdScheme, progScheme)) { setErrorMessage(ProxyLaunchMessages.scheme_of_working_directory_and_program_do_not_match); return false; } String wdAuth = wdURI.getAuthority(); String progAuth = progURI.getAuthority(); if (!equal(wdAuth, progAuth)) { setErrorMessage(ProxyLaunchMessages.connection_of_working_directory_and_program_do_not_match); return false; } String wdQuery = wdURI.getQuery(); String progQuery = progURI.getQuery(); if (!equal(wdQuery, progQuery)) { setErrorMessage(ProxyLaunchMessages.connection_of_working_directory_and_program_do_not_match); return false; } setErrorMessage(null); return true; }

Target:
private boolean checkCompatibility() { String wdName = workingDirText.getText().trim(); String progName = fProgText.getText().trim(); URI wdURI; URI progURI; try { wdURI = new URI(wdName); progURI = new URI(progName); } catch (URISyntaxException e) { System.err.println(ProxyLaunchMessages.uri_syntax_error); return false; } String wdScheme = wdURI.getScheme(); String progScheme = progURI.getScheme(); if (wdScheme == null && progScheme == null) { setErrorMessage(null); return true; } if (!equal(wdScheme, progScheme)) { setErrorMessage(ProxyLaunchMessages.scheme_of_working_directory_and_program_do_not_match); return false; } String wdAuth = wdURI.getAuthority(); String progAuth = progURI.getAuthority(); if (!equal(wdAuth, progAuth)) { setErrorMessage(ProxyLaunchMessages.connection_of_working_directory_and_program_do_not_match); return false; } String wdQuery = wdURI.getQuery(); String progQuery = progURI.getQuery(); if (!equal(wdQuery, progQuery)) { setErrorMessage(ProxyLaunchMessages.connection_of_working_directory_and_program_do_not_match); return false; } setErrorMessage(null); return true; }
Source:
public static List<ModuleInfo> getPage(int position) { int from = position * ITEMS_PER_PAGE; int to = Math.min((position + 1) * ITEMS_PER_PAGE, mModules.size()); Log.d("msgRav", Integer.toString(from) + " " + Integer.toString(to) + " " + Integer.toString(position)); if (!(from < to)) { return null; } return mModules.subList(from, to); }

Target:
public static List<ModuleInfo> getPage(int position) { int from = position * ITEMS_PER_PAGE; int to = Math.min((position + 1) * ITEMS_PER_PAGE, mModules.size()); Log.d( ScreenSlidePagerAdapter.class.getCanonicalName() ,"getting page from: " + Integer.toString(from) + "to: " + Integer.toString(to) + "page number: " + Integer.toString(position)); if (!(from < to)) { return null; } return mModules.subList(from, to); }
Source:
private Iterator<LocatedFileStatus> statusFromObjects(List<S3ObjectSummary> objects) { return objects.stream() .filter(object -> !object.getKey().endsWith(PATH_SEPARATOR) && skipGlacierObjectsIfNeeded(object)) .map(object -> new FileStatus( object.getSize(), false, 1, BLOCK_SIZE.toBytes(), object.getLastModified().getTime(), qualifiedPath(new Path(PATH_SEPARATOR + object.getKey())))) .map(this::createLocatedFileStatus) .iterator(); }

Target:
private Iterator<LocatedFileStatus> statusFromObjects(List<S3ObjectSummary> objects) { return objects.stream() .filter(object -> !object.getKey().endsWith(PATH_SEPARATOR)) .filter(object -> !skipGlacierObjects || !isGlacierObject(object)) .map(object -> new FileStatus( object.getSize(), false, 1, BLOCK_SIZE.toBytes(), object.getLastModified().getTime(), qualifiedPath(new Path(PATH_SEPARATOR + object.getKey())))) .map(this::createLocatedFileStatus) .iterator(); }