auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void replaceAll() throws Exception { Map<String, Serializable> params = new HashMap<String, Serializable>(); params.put("file", file); DataStore store = DataStoreFinder.getDataStore(params); final SimpleFeatureType type = store.getSchema("locations"); final FeatureWriter<SimpleFeatureType, SimpleFeature> writer; SimpleFeature f; DefaultFeatureCollection collection = new DefaultFeatureCollection(); GeometryFactory gf = JTSFactoryFinder.getGeometryFactory(); Point portland = gf.createPoint(new Coordinate( 45.52, -122.681944)); f = SimpleFeatureBuilder.build(type, new Object[] { portland, "Portland", 800, 2014 }, "locations.1"); collection.add(f); writer = store.getFeatureWriter("locations", Transaction.AUTO_COMMIT); try { while (writer.hasNext()) { writer.next(); writer.remove(); } SimpleFeatureIterator iterator = collection.features(); while (iterator.hasNext()) { SimpleFeature feature = iterator.next(); SimpleFeature newFeature = writer.next(); newFeature.setAttributes(feature.getAttributes()); writer.write(); } } finally { writer.close(); } SimpleFeatureStore featureStore = (SimpleFeatureStore) store.getFeatureSource("locations"); assertEquals("featureStore should only have the one feature we created", 1, featureStore.getFeatures().size()); String contents; if (isWindows() == true) { contents = "LAT,LON,CITY,NUMBER,YEAR\r\nPOINT (45.52 -122.681944),Portland,800,2014,"; } else { contents = "LAT,LON,CITY,NUMBER,YEAR\nPOINT (45.52 -122.681944),Portland,800,2014,"; } assertEquals("Ensure the file has only the one feature we created", contents.trim(), checkFileContents(file).trim()); }

Target:
public void replaceAll() throws Exception { Map<String, Serializable> params = new HashMap<String, Serializable>(); params.put("file", file); DataStore store = DataStoreFinder.getDataStore(params); final SimpleFeatureType type = store.getSchema("locations"); final FeatureWriter<SimpleFeatureType, SimpleFeature> writer; SimpleFeature f; DefaultFeatureCollection collection = new DefaultFeatureCollection(); GeometryFactory gf = JTSFactoryFinder.getGeometryFactory(); Point portland = gf.createPoint(new Coordinate( 45.52, -122.681944)); f = SimpleFeatureBuilder.build(type, new Object[] { portland, "Portland", 800, 2014 }, "locations.1"); collection.add(f); writer = store.getFeatureWriter("locations", Transaction.AUTO_COMMIT); try { while (writer.hasNext()) { writer.next(); writer.remove(); } SimpleFeatureIterator iterator = collection.features(); while (iterator.hasNext()) { SimpleFeature feature = iterator.next(); SimpleFeature newFeature = writer.next(); newFeature.setAttributes(feature.getAttributes()); writer.write(); } } finally { writer.close(); } SimpleFeatureStore featureStore = (SimpleFeatureStore) store.getFeatureSource("locations"); assertEquals("featureStore should only have the one feature we created", 1, featureStore.getFeatures().size()); final String newline = System.lineSeparator(); String contents = "LAT,LON,CITY,NUMBER,YEAR" + newline + "POINT (45.52 -122.681944),Portland,800,2014,"; assertEquals("Ensure the file has only the one feature we created", contents.trim(), checkFileContents(file).trim()); }
Source:
public ResponseEntity<OsmRecipient> registerOsm(@RequestParam("bitcoin_addr") String bitcoinAddress, @RequestParam("osm_usr") String osmUser, @RequestParam("osm_pwd") String osmPassword, @RequestParam("email") String email) { checkParameter("Bitcoin address", bitcoinAddress); checkParameter("E-mail", email); checkParameter("Osm user", osmUser); checkParameter("Osm password", osmPassword); String username = processOsmUsername(osmUser); String credentials = encodeCredentialsToBase64(username, osmPassword); authenticateUser(credentials); long registerTimestamp = System.currentTimeMillis(); OsmRecipient recipient = new OsmRecipient(osmUser, email, bitcoinAddress, registerTimestamp); recipient = osmRecipientsRepository.save(recipient); return ResponseEntity.ok(recipient); }

Target:
public ResponseEntity<OsmRecipient> registerOsm(@RequestParam("bitcoin_addr") String bitcoinAddress, @RequestParam("osm_usr") String osmUser, @RequestParam("osm_pwd") String osmPassword, @RequestParam("email") String email) { checkParameter("Bitcoin address", bitcoinAddress); validateBitcoinAddress(bitcoinAddress); checkParameter("E-mail", email); checkParameter("Osm user", osmUser); checkParameter("Osm password", osmPassword); String username = processOsmUsername(osmUser); String credentials = encodeCredentialsToBase64(username, osmPassword); authenticateUser(credentials); long registerTimestamp = System.currentTimeMillis(); OsmRecipient recipient = new OsmRecipient(osmUser, email, bitcoinAddress, registerTimestamp); recipient = osmRecipientsRepository.save(recipient); return ResponseEntity.ok(recipient); }
Source:
public void write(String targetName) { File outFile = new File(mainFolder, targetName + ".html"); WriteTextFile out = new WriteTextFile(outFile.getAbsolutePath()); for (String line : lines) { out.writeln(line); } out.close(); lines = new ArrayList<>(); }

Target:
public void write(String targetName) { File outFile = new File(mainFolder, targetName + ".html"); try (BufferedWriter bw = Files.newBufferedWriter(outFile.toPath()); PrintWriter out = new PrintWriter(bw)) { for (String line : lines) { out.println(line); } } catch (IOException e) { e.printStackTrace(); } lines = new ArrayList<>(); }
Source:
public void gcUnsafe() { while (garbageSendingDeque.size() < SENDING_QUEUE_CAPACITY && garbageReceivingQueue.size() >= BATCH_SIZE) { List<SMRGarbageEntry> garbageEntries = new ArrayList<>(); garbageReceivingQueue.drainTo(garbageEntries, BATCH_SIZE); if (garbageEntries.isEmpty()) { log.trace("Garbage Informer has nothing to send"); return; } GarbageBatch garbageBatch = new GarbageBatch(compressGarbage(garbageEntries)); garbageSendingDeque.offer(garbageBatch); } log.debug("GarbageInformer: Drains sending queue"); sendGarbage(); }

Target:
public void gcUnsafe() { while (garbageSendingDeque.size() < SENDING_QUEUE_CAPACITY) { List<SMRGarbageEntry> garbageEntries = new ArrayList<>(); int drainedNum = garbageReceivingQueue.drainTo(garbageEntries, BATCH_SIZE); if (drainedNum == 0) { break; } GarbageBatch garbageBatch = new GarbageBatch(compressGarbage(garbageEntries)); garbageSendingDeque.offer(garbageBatch); if (drainedNum < BATCH_SIZE) { break; } } log.debug("GarbageInformer: Drains sending queue"); sendGarbage(); }
Source:
public Response accept(@InjectParam AuthenticatedUser user, @QueryParam("token") String token) { Database database; try { database = entityManager.get().createQuery("SELECT db FROM Database db " + "WHERE db.transferToken = :token", Database.class) .setParameter("token", token) .getSingleResult(); } catch(NoResultException noResult) { return Response.status(Response.Status.NOT_FOUND) .entity("Token is no longer valid. Database transfer may have been cancelled, or may already have been approved").build(); } User currentOwner = database.getOwner(); User proposedOwner = database.getTransferUser(); if (user.isAnonymous()) { return Response.status(Response.Status.UNAUTHORIZED).build(); } if (proposedOwner.getId() != user.getUserId()) { return Response.status(Response.Status.FORBIDDEN).build(); } TransferAuthorized transfer = new TransferAuthorized(currentOwner.getId(), proposedOwner.getId(), database.getId(), token); DatabaseResource resource = new DatabaseResource(catalog, dispatcher, new DatabaseProviderImpl(entityManager), entityManager, mailSender, database.getId()); return resource.startTransfer(user, transfer.toJson().toJson()); }

Target:
public Response accept(@InjectParam AuthenticatedUser user, @QueryParam("token") String token) { Database database; try { database = entityManager.get().createQuery("SELECT db FROM Database db " + "WHERE db.transferToken = :token", Database.class) .setParameter("token", token) .getSingleResult(); } catch(NoResultException noResult) { return Response.status(Response.Status.NOT_FOUND) .entity("Token is no longer valid. Database transfer may have been cancelled, or may already have been approved").build(); } User currentOwner = database.getOwner(); User proposedOwner = database.getTransferUser(); if (user.isAnonymous()) { return Response.status(Response.Status.UNAUTHORIZED).build(); } if (proposedOwner.getId() != user.getUserId()) { return Response.status(Response.Status.FORBIDDEN).build(); } TransferAuthorized transfer = new TransferAuthorized(currentOwner.getId(), proposedOwner.getId(), database.getId(), token); DatabaseResource resource = new DatabaseResource(catalog, dispatcher, new DatabaseProviderImpl(entityManager), entityManager, mailSender, database.getId()); return resource.startTransfer(user, transfer); }
Source:
public void bytesSkipped( long bytesSkipped ) { out.println( "... skipped " + bytesSkipped + " bytes of weird tx log data" ); }

Target:
public void bytesSkipped( long bytesSkipped ) { out.println( "... skipped " + bytesSkipped + " bytes of indecipherable transaction log data" ); }
Source:
private Map<String, String> getConceptAnswers(Locale locale) { Map<String, String> conceptAnswers = new LinkedHashMap<String, String>(); for (ConceptAnswer answer : concept.getAnswers(true)) { log.debug("getting answers"); String key = answer.getAnswerConcept().getConceptId().toString(); ConceptName cn = answer.getAnswerConcept().getName(locale); String name = ""; if (cn != null) { name = cn.toString(); } if (answer.getAnswerDrug() != null) { key = key + "^" + answer.getAnswerDrug().getDrugId(); name = answer.getAnswerDrug().getFullName(locale); } if (answer.getAnswerConcept().isRetired()) { String string = Context.getMessageSourceService().getMessage("Concept.retired"); name = name + string ; } conceptAnswers.put(key, name); } return conceptAnswers; }

Target:
private Map<String, String> getConceptAnswers(Locale locale) { Map<String, String> conceptAnswers = new LinkedHashMap<String, String>(); for (ConceptAnswer answer : concept.getAnswers(true)) { log.debug("getting answers"); String key = answer.getAnswerConcept().getConceptId().toString(); ConceptName cn = answer.getAnswerConcept().getName(locale); String name = ""; if (cn != null) { name = cn.toString(); } if (answer.getAnswerDrug() != null) { key = key + "^" + answer.getAnswerDrug().getDrugId(); name = answer.getAnswerDrug().getFullName(locale); } if (answer.getAnswerConcept().isRetired()) { name = "<span class='retired'>" + name + "</span>"; } conceptAnswers.put(key, name); } return conceptAnswers; }
Source:
public SelectionContext(boolean authenticated, String user, Optional<String> source, Set<String> clientTags, int queryPriority, Optional<String> queryType) { this.authenticated = authenticated; this.user = requireNonNull(user, "user is null"); this.source = requireNonNull(source, "source is null"); this.clientTags = requireNonNull(clientTags, "tags is null"); this.queryPriority = queryPriority; this.queryType = requireNonNull(queryType, "queryType is null"); }

Target:
public SelectionContext(boolean authenticated, String user, Optional<String> source, Set<String> clientTags, int queryPriority, Optional<String> queryType) { this.authenticated = authenticated; this.user = requireNonNull(user, "user is null"); this.source = requireNonNull(source, "source is null"); this.clientTags = unmodifiableSet(requireNonNull(clientTags, "tags is null")); this.queryPriority = queryPriority; this.queryType = requireNonNull(queryType, "queryType is null"); }
Source:
void onAllNodesReplicated(int totalPushTasksCount) { if (replicationsCount == 0) { return; } RefReplicationDoneEvent event = new RefReplicationDoneEvent(replicatedProject, replicatedRef, replicationsCount); postEvent(replicatedProject, replicatedRef, event); }

Target:
void onAllNodesReplicated(int totalPushTasksCount) { if (totalPushTasksCount == 0) { return; } RefReplicationDoneEvent event = new RefReplicationDoneEvent(replicatedProject, replicatedRef, totalPushTasksCount); postEvent(replicatedProject, replicatedRef, event); }
Source:
public void handleMemberAttributeChangeEventV10(Member member, Collection<Member> members, String key, int opType, String value) { Collection<Member> currentMembersList = clusterService.getMemberList(); if (currentMembersList.contains(member)) { final MemberAttributeOperationType operationType = MemberAttributeOperationType.getValue(opType); ((AbstractMember) member).updateAttribute(operationType, key, value); MemberAttributeEvent memberAttributeEvent = new MemberAttributeEvent(client.getCluster(), member, new HashSet<>(members), operationType, key, value); clusterService.fireMemberAttributeEvent(memberAttributeEvent); } }

Target:
public void handleMemberAttributeChangeEventV10(Member member, Collection<Member> members, String key, int opType, String value) { Collection<Member> currentMembersList = clusterService.getMemberList(); String uuid = member.getUuid(); for (Member target : currentMembersList) { if (target.getUuid().equals(uuid)) { final MemberAttributeOperationType operationType = MemberAttributeOperationType.getValue(opType); ((AbstractMember) target).updateAttribute(operationType, key, value); MemberAttributeEvent memberAttributeEvent = new MemberAttributeEvent(client.getCluster(), target, new HashSet<>(members), operationType, key, value); clusterService.fireMemberAttributeEvent(memberAttributeEvent); break; } } }
Source:
public Response delete(@PathParam("id") Long id) { Migration migration = migrationService.delete(id); if (migration == null) { return getMigrationNotFound(id); } return Response.ok(migration).build(); }

Target:
public Response delete(@PathParam("id") Long id) throws MigrationNotFoundException { return Response.ok(migrationService.delete(id)).build(); }
Source:
public Map<String, Product> getProducts(IOperationMonitor monitor) throws BugzillaRestException { return retrieveItems(monitor, "/product?type=accessible", new Function<ProductResponse, Product[]>() { public Product[] apply(ProductResponse input) { return input.getProducts(); } }, new TypeToken<ProductResponse>() { }); }

Target:
private Map<String, Product> getProducts(IOperationMonitor monitor) throws BugzillaRestException { return retrieveItems(monitor, "/product?type=accessible", new TypeToken<ProductResponse>() { }); }
Source:
public EntityInteractHandler getItemHandler() { return (e, item) -> { if (e.getRightClicked().getType() == EntityType.ZOMBIE_VILLAGER) { Player p = e.getPlayer(); item.setAmount(item.getAmount() - 1); if (e.getHand() == EquipmentSlot.OFF_HAND) { p.getInventory().setItemInOffHand(item); } else { p.getInventory().setItemInMainHand(item); } p.playSound(p.getLocation(), Sound.ENTITY_ZOMBIE_VILLAGER_CONVERTED, 1, 1); ZombieVillager zombieVillager = (ZombieVillager) e.getRightClicked(); zombieVillager.setConversionTime(1); if (SlimefunPlugin.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_15)) { zombieVillager.setConversionPlayer(p); } } }; }

Target:
public EntityInteractHandler getItemHandler() { return (p, entity, item, offhand) -> { if (entity.getType() == EntityType.ZOMBIE_VILLAGER) { ItemUtils.consumeItem(item, false); p.playSound(p.getLocation(), Sound.ENTITY_ZOMBIE_VILLAGER_CONVERTED, 1, 1); ZombieVillager zombieVillager = (ZombieVillager) entity; if (SlimefunPlugin.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_14)) { zombieVillager.setConversionTime(1); if (SlimefunPlugin.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_15)) { zombieVillager.setConversionPlayer(p); } } else { zombieVillager.setVillager(true); } } }; }
Source:
public static Double getGenotypeDouble(final Genotype g, final String fieldName, final double defaultValue) { final Object o2ExtendedAttribute = g.getExtendedAttribute(fieldName, VCFConstants.MISSING_VALUE_v4); final String o2PArtifactAsString = String.valueOf(o2ExtendedAttribute); if ((o2PArtifactAsString == null) || (o2PArtifactAsString.equals(VCFConstants.MISSING_VALUE_v4))) { return defaultValue; } return Double.parseDouble(o2PArtifactAsString); }

Target:
public static Double getGenotypeDouble(final Genotype g, final String fieldName, final double defaultValue) { Utils.nonNull(g); final String genotypeFieldAsString = getGenotypeString(g, fieldName); return isVcfGenotypeFieldEmpty(genotypeFieldAsString) ? defaultValue : Double.parseDouble(genotypeFieldAsString); }
Source:
public Guid executeAsyncCommand(final VdcActionType actionType, final VdcActionParametersBase parameters, final CommandContext cmdContext) { final CommandBase<?> command = CommandsFactory.createCommand(actionType, parameters, cmdContext); command.persistCommand(command.getParameters().getParentCommand(), cmdContext, true); CommandCallBack callBack = command.getCallBack(); if (callBack != null) { cmdCallBackMap.put(command.getCommandId(), callBack); } try { executor.submit(new Callable<VdcReturnValueBase>() { @Override public VdcReturnValueBase call() throws Exception { return executeCommand(command, cmdContext); } }); } catch(RejectedExecutionException ex) { command.setCommandStatus(CommandStatus.FAILED); } return command.getCommandId(); }

Target:
public Future<VdcReturnValueBase> executeAsyncCommand(final VdcActionType actionType, final VdcActionParametersBase parameters, final CommandContext cmdContext) { final CommandBase<?> command = CommandsFactory.createCommand(actionType, parameters, cmdContext); command.persistCommand(command.getParameters().getParentCommand(), cmdContext, true); CommandCallBack callBack = command.getCallBack(); if (callBack != null) { cmdCallBackMap.put(command.getCommandId(), callBack); } Future<VdcReturnValueBase> retVal; try { retVal = executor.submit(new Callable<VdcReturnValueBase>() { @Override public VdcReturnValueBase call() throws Exception { return executeCommand(command, cmdContext); } }); } catch(RejectedExecutionException ex) { command.setCommandStatus(CommandStatus.FAILED); log.errorFormat("Failed to submit command to executor service, command {0} status has been set to FAILED", command.getCommandId().toString()); retVal = new RejectedExecutionFuture(); } return retVal; }
Source:
private static Metadata metadataForSnapshot(SnapshotsInProgress.Entry snapshot, Metadata metadata) { if (snapshot.includeGlobalState() == false) { Metadata.Builder builder = Metadata.builder(); for (IndexId index : snapshot.indices()) { final IndexMetadata indexMetadata = metadata.index(index.getName()); if (indexMetadata == null) { assert snapshot.partial() : "Index [" + index + "] was deleted during a snapshot but snapshot was not partial."; } else { builder.put(indexMetadata, false); } } Map<String, DataStream> dataStreams = new HashMap<>(metadata.dataStreams()); dataStreams.keySet().removeIf(ds -> snapshot.dataStreams().contains(ds) == false); builder.dataStreams(dataStreams); metadata = builder.build(); } return metadata; }

Target:
private static Metadata metadataForSnapshot(SnapshotsInProgress.Entry snapshot, Metadata metadata) { if (snapshot.includeGlobalState() == false) { Metadata.Builder builder = Metadata.builder(); for (IndexId index : snapshot.indices()) { final IndexMetadata indexMetadata = metadata.index(index.getName()); if (indexMetadata == null) { assert snapshot.partial() : "Index [" + index + "] was deleted during a snapshot but snapshot was not partial."; } else { builder.put(indexMetadata, false); } } if (snapshot.userMetadata() != null && snapshot.userMetadata().containsKey(DataStream.DATA_STREAMS_METADATA_FIELD)) { @SuppressWarnings("unchecked") List<String> dataStreamNames = (List<String>) snapshot.userMetadata().get(DataStream.DATA_STREAMS_METADATA_FIELD); Map<String, DataStream> dataStreams = new HashMap<>(); for (String dataStreamName : dataStreamNames) { DataStream dataStream = metadata.dataStreams().get(dataStreamName); if (dataStream == null) { assert snapshot.partial() : "Data stream [" + dataStreamName + "] was deleted during a snapshot but snapshot was not partial."; } else { dataStreams.put(dataStreamName, dataStream); } } builder.dataStreams(dataStreams); } metadata = builder.build(); } return metadata; }
Source:
public void theChannelOfDeviceIsCleared(final String gMeter) { final SmartMeter mbusDevice = this.smartMeterRepository.findByDeviceIdentification(gMeter); Assert.assertNotNull(mbusDevice); Assert.assertNull("GatewayDevice must be empty", mbusDevice.getChannel()); }

Target:
public void theChannelOfDeviceIsCleared(final String gMeter) { final SmartMeter mbusDevice = this.smartMeterRepository.findByDeviceIdentification(gMeter); Assert.assertNotNull("No MbusDevice found", mbusDevice); Assert.assertNull("GatewayDevice must be empty", mbusDevice.getChannel()); }
Source:
public String expandAll(Run<?, ?> run, TaskListener listener) throws IOException, InterruptedException { if (run instanceof AbstractBuild) { try { return TokenMacro.expandAll((AbstractBuild) run, listener, content, false, loadPrivateTokens()); } catch (MacroEvaluationException e) { LOGGER.error("Can't process token content in ({})", content, run.getParent().getFullName(), e.getMessage()); LOGGER.trace(e.getMessage(), e); return content; } } else { return run.getEnvironment(listener).expand(trimToEmpty(content)); } }

Target:
public String expandAll(Run<?, ?> run, TaskListener listener) throws IOException, InterruptedException { if (run instanceof AbstractBuild) { try { return TokenMacro.expandAll( (AbstractBuild) run, listener, content, false, Collections.<TokenMacro>emptyList() ); } catch (MacroEvaluationException e) { LOGGER.error("Can't process token content in ({})", content, run.getParent().getFullName(), e.getMessage()); LOGGER.trace(e.getMessage(), e); return content; } } else { return run.getEnvironment(listener).expand(trimToEmpty(content)); } }
Source:
private InputStream getInputStream() throws IOException { ContentResolver contentResolver = context.getContentResolver(); Uri uri = getData().uri; switch (matcher.match(uri)) { case ID_LOOKUP: uri = ContactsContract.Contacts.lookupContact(contentResolver, uri); if (null == uri) { return null; } case ID_CONTACT: if (SDK_INT < ICE_CREAM_SANDWICH) { return openContactPhotoInputStream(contentResolver, uri); } else { return ContactPhotoStreamIcs.get(contentResolver, uri); } case ID_THUMBNAIL: case ID_DISPLAY_PHOTO: return contentResolver.openInputStream(uri); default: return null; } }

Target:
private InputStream getInputStream() throws IOException { ContentResolver contentResolver = context.getContentResolver(); Uri uri = getData().uri; switch (matcher.match(uri)) { case ID_LOOKUP: uri = ContactsContract.Contacts.lookupContact(contentResolver, uri); if (null == uri) { return null; } case ID_CONTACT: if (SDK_INT < ICE_CREAM_SANDWICH) { return openContactPhotoInputStream(contentResolver, uri); } else { return ContactPhotoStreamIcs.get(contentResolver, uri); } case ID_THUMBNAIL: case ID_DISPLAY_PHOTO: return contentResolver.openInputStream(uri); default: throw new IllegalStateException("Invalid uri: " + uri); } }
Source:
protected void initialize(Subject subj) throws PrivilegedActionException { final Configuration config = getRemoteCacheManagerConfig(subj); Subject.doAs(subj, new PrivilegedExceptionAction<Void>() { public Void run() throws Exception { remoteCacheManager = new RemoteCacheManager(config, true); return null; } }); remoteCache = remoteCacheManager.getCache(TEST_CACHE_NAME); }

Target:
protected void initialize(Subject subj) throws PrivilegedActionException { final Configuration config = getRemoteCacheManagerConfig(subj); remoteCacheManager = new RemoteCacheManager(config, true); remoteCache = remoteCacheManager.getCache(TEST_CACHE_NAME); }
Source:
public void responseReceived(SubscribeToShardResponse response) { parent.setLastRequestId(response.responseMetadata().requestId()); log.debug("{}: [SubscriptionLifetime]: (RecordFlow#responseReceived) @ id: -- Response received. rid: {}, erid: {}, sdkfields: {}", parent.shardId, connectionStartedAt, subscribeToShardId, response.responseMetadata().requestId(), response.responseMetadata().extendedRequestId(), response.sdkFields()); }

Target:
public void responseReceived(SubscribeToShardResponse response) { log.debug("{}: [SubscriptionLifetime]: (RecordFlow#responseReceived) @ id: -- Response received. Request id - {}", parent.shardId, connectionStartedAt, subscribeToShardId, response.responseMetadata().requestId()); final RequestDetails requestDetails = new RequestDetails(response.responseMetadata().requestId(), connectionStartedAt.toString()); parent.setLastSuccessfulRequestDetails(requestDetails); }
Source:
public FateStatus getTransactionStatus(ReadOnlyTStore<T> zs, Set<Long> filterTxid, EnumSet<TStatus> filterStatus, Map<Long,List<String>> heldLocks, Map<Long,List<String>> waitingLocks) { List<Long> transactions = zs.list(); List<TransactionStatus> statuses = new ArrayList<>(transactions.size()); for (Long tid : transactions) { zs.reserve(tid); String debug = (String) zs.getProperty(tid, "debug"); List<String> hlocks = null; if (heldLocks == null) { heldLocks = Collections.emptyMap(); } else { hlocks = heldLocks.remove(tid); } if (hlocks == null) { hlocks = Collections.emptyList(); } List<String> wlocks = null; if (waitingLocks == null) { waitingLocks = Collections.emptyMap(); } else { wlocks = waitingLocks.remove(tid); } if (wlocks == null) { wlocks = Collections.emptyList(); } String top = null; ReadOnlyRepo<T> repo = zs.top(tid); if (repo != null) top = repo.getDescription(); TStatus status = zs.getStatus(tid); zs.unreserve(tid, 0); if ((filterTxid != null && !filterTxid.contains(tid)) || (filterStatus != null && !filterStatus.contains(status))) continue; statuses.add(new TransactionStatus(tid, status, debug, hlocks, wlocks, top)); } return new FateStatus(statuses, heldLocks, waitingLocks); }

Target:
private FateStatus getTransactionStatus(ReadOnlyTStore<T> zs, Set<Long> filterTxid, EnumSet<TStatus> filterStatus, Map<Long,List<String>> heldLocks, Map<Long,List<String>> waitingLocks) { List<Long> transactions = zs.list(); List<TransactionStatus> statuses = new ArrayList<>(transactions.size()); for (Long tid : transactions) { zs.reserve(tid); String debug = (String) zs.getProperty(tid, "debug"); List<String> hlocks = heldLocks.remove(tid); if (hlocks == null) { hlocks = Collections.emptyList(); } List<String> wlocks = waitingLocks.remove(tid); if (wlocks == null) { wlocks = Collections.emptyList(); } String top = null; ReadOnlyRepo<T> repo = zs.top(tid); if (repo != null) top = repo.getDescription(); TStatus status = zs.getStatus(tid); zs.unreserve(tid, 0); if ((filterTxid != null && !filterTxid.contains(tid)) || (filterStatus != null && !filterStatus.contains(status))) continue; statuses.add(new TransactionStatus(tid, status, debug, hlocks, wlocks, top)); } return new FateStatus(statuses, heldLocks, waitingLocks); }
Source:
public Response toResponse(InstallerException exception) { ServiceError serviceError = DtoFactory.newDto(ServiceError.class).withMessage(exception.getMessage()); String errorAsJson = DtoFactory.getInstance().toJson(serviceError); if (exception instanceof InstallerNotFoundException) { return Response.status(Response.Status.NOT_FOUND) .entity(errorAsJson) .type(MediaType.APPLICATION_JSON) .build(); } else if (exception instanceof InstallerConflictException) { return Response.status(Response.Status.CONFLICT) .entity(errorAsJson) .type(MediaType.APPLICATION_JSON) .build(); } else if (exception instanceof IllegalInstallerKeyException) { return Response.status(Response.Status.BAD_REQUEST) .entity(errorAsJson) .type(MediaType.APPLICATION_JSON) .build(); } else { return Response.serverError() .entity(errorAsJson) .type(MediaType.APPLICATION_JSON) .build(); } }

Target:
public Response toResponse(InstallerException exception) { ServiceError serviceError = DtoFactory.newDto(ServiceError.class).withMessage(exception.getMessage()); String errorAsJson = DtoFactory.getInstance().toJson(serviceError); if (exception instanceof InstallerNotFoundException) { return Response.status(Response.Status.NOT_FOUND) .entity(errorAsJson) .type(MediaType.APPLICATION_JSON) .build(); } else if (exception instanceof InstallerAlreadyExistsException) { return Response.status(Response.Status.CONFLICT) .entity(errorAsJson) .type(MediaType.APPLICATION_JSON) .build(); } else if (exception instanceof IllegalInstallerKeyException) { return Response.status(Response.Status.BAD_REQUEST) .entity(errorAsJson) .type(MediaType.APPLICATION_JSON) .build(); } else { return Response.serverError() .entity(errorAsJson) .type(MediaType.APPLICATION_JSON) .build(); } }
Source:
public synchronized void close() { isClosed = true; ingestJob.addStreamingIngestDataSource(); }

Target:
public synchronized void close() { isClosed = true; ingestJob.processStreamingIngestDataSource(); }
Source:
private static RankProcessStrategy getRankStrategy(boolean insertOnly) { if (insertOnly) { return AppendFastStrategy$.MODULE$; } else { return RetractStrategy$.MODULE$; } }

Target:
private static RankProcessStrategy getRankStrategy(boolean insertOnly) { if (insertOnly) { return RankProcessStrategy.APPEND_FAST_STRATEGY; } else { return RankProcessStrategy.RETRACT_STRATEGY; } }
Source:
public SemanticException(QualifierType type) { super(String.format("Invalid input in filter for type \"%s\"", type)); }

Target:
public SemanticException(QualifierType type) { super(String.format(ERROR_MESSAGE, type, type.getDescriptionOfValidInputs())); }
Source:
private File makeReadGroupFile(final SAMReadGroupRecord readGroup, final String preExtSuffix) { String fileName = null; if (RG_TAG.equalsIgnoreCase("PU")){ fileName = readGroup.getPlatformUnit(); } else if (RG_TAG.equalsIgnoreCase("ID")){ fileName = readGroup.getReadGroupId(); } if (fileName == null) { throw new PicardException("The selected RG_TAG: "+RG_TAG+" is not present in the bam header."); } fileName = IOUtil.makeFileNameSafe(fileName); if (preExtSuffix != null) fileName += preExtSuffix; fileName += ".fastq"; if (COMPRESS_OUTPUTS) { fileName += ".gz"; } final File result = (OUTPUT_DIR != null) ? new File(OUTPUT_DIR, fileName) : new File(fileName); IOUtil.assertFileIsWritable(result); return result; }

Target:
private File makeReadGroupFile(final SAMReadGroupRecord readGroup, final String preExtSuffix) { String fileName = null; if (RG_TAG.equalsIgnoreCase("PU")){ fileName = readGroup.getPlatformUnit(); } else if (RG_TAG.equalsIgnoreCase("ID")){ fileName = readGroup.getReadGroupId(); } if (fileName == null) { throw new PicardException("The selected RG_TAG: "+RG_TAG+" is not present in the bam header."); } fileName = IOUtil.makeFileNameSafe(fileName); if (preExtSuffix != null) fileName += preExtSuffix; fileName += COMPRESS_OUTPUTS_PER_RG ? ".fastq.gz" : ".fastq"; final File result = (OUTPUT_DIR != null) ? new File(OUTPUT_DIR, fileName) : new File(fileName); IOUtil.assertFileIsWritable(result); return result; }
Source:
protected IStatus run(IProgressMonitor monitor) { RevCommit commit = null; try { commitOperation.execute(monitor); commit = commitOperation.getCommit(); CommitMessageComponentStateManager.deleteState(repository); RepositoryMapping mapping = RepositoryMapping .findRepositoryMapping(repository); if (mapping != null) mapping.fireRepositoryChanged(); } catch (CoreException e) { if (e.getCause() instanceof JGitInternalException) { return Activator.createErrorStatus(e.getLocalizedMessage(), e.getCause()); } if (e.getCause() instanceof AbortedByHookException) { showAbortedByHook(e.getCause()); } else { return Activator.createErrorStatus( UIText.CommitAction_CommittingFailed, e); } } finally { GitLightweightDecorator.refresh(); } if (commit != null) { if (openCommitEditor) openCommitEditor(commit); if (pushUpstream) pushUpstream(commit); } return Status.OK_STATUS; }

Target:
protected IStatus run(IProgressMonitor monitor) { RevCommit commit = null; try { commitOperation.execute(monitor); commit = commitOperation.getCommit(); CommitMessageComponentStateManager.deleteState(repository); RepositoryMapping mapping = RepositoryMapping .findRepositoryMapping(repository); if (mapping != null) mapping.fireRepositoryChanged(); } catch (CoreException e) { if (e.getCause() instanceof JGitInternalException) { return Activator.createErrorStatus(e.getLocalizedMessage(), e.getCause()); } if (e.getCause() instanceof AbortedByHookException) { showAbortedByHook(e.getCause()); return Status.CANCEL_STATUS; } else { return Activator.createErrorStatus( UIText.CommitAction_CommittingFailed, e); } } finally { GitLightweightDecorator.refresh(); } if (commit != null) { if (openCommitEditor) openCommitEditor(commit); if (pushUpstream) pushUpstream(commit); } return Status.OK_STATUS; }
Source:
private HttpURLConnection authorizeConnection( HttpURLConnection conn, String service, int authAttempts) throws NoRemoteRepositoryException, TransportException, IOException { final int status = HttpSupport.response(conn); switch (status) { case HttpURLConnection.HTTP_OK: return conn; case HttpURLConnection.HTTP_NOT_FOUND: throw new NoRemoteRepositoryException(uri, MessageFormat.format( JGitText.get().uriNotFound, conn.getURL())); case HttpURLConnection.HTTP_UNAUTHORIZED: authMethod = HttpAuthMethod.scanResponse(conn); if (authMethod == HttpAuthMethod.NONE) throw new TransportException(uri, MessageFormat.format( JGitText.get().authenticationNotSupported, uri)); if (1 < authAttempts || !authMethod.authorize(uri, getCredentialsProvider())) { throw new TransportException(uri, JGitText.get().notAuthorized); } return null; case HttpURLConnection.HTTP_FORBIDDEN: throw new TransportException(uri, MessageFormat.format( JGitText.get().serviceNotPermitted, service)); default: String err = status + " " + conn.getResponseMessage(); throw new TransportException(uri, err); } }

Target:
private HttpURLConnection authorizeConnection( HttpURLConnection conn, String service, int authAttempts) throws NoRemoteRepositoryException, TransportException, IOException { int status = HttpSupport.response(conn); switch (status) { case HttpURLConnection.HTTP_OK: return conn; case HttpURLConnection.HTTP_NOT_FOUND: throw new NoRemoteRepositoryException(uri, MessageFormat.format( JGitText.get().uriNotFound, conn.getURL())); case HttpURLConnection.HTTP_UNAUTHORIZED: authMethod = HttpAuthMethod.scanResponse(conn); if (authMethod == HttpAuthMethod.NONE) throw new TransportException(uri, MessageFormat.format( JGitText.get().authenticationNotSupported, uri)); if (1 < authAttempts || !authMethod.authorize(uri, getCredentialsProvider())) throw new TransportException(uri, JGitText.get().notAuthorized); return null; case HttpURLConnection.HTTP_FORBIDDEN: throw new TransportException(uri, MessageFormat.format( JGitText.get().serviceNotPermitted, service)); default: String err = status + " " + conn.getResponseMessage(); throw new TransportException(uri, err); } }
Source:
protected void invokeTestMethod(JupiterEngineExecutionContext context, DynamicTestExecutor dynamicTestExecutor) { TestExtensionContext testExtensionContext = (TestExtensionContext) context.getExtensionContext(); context.getThrowableCollector().execute(() -> { Object instance = testExtensionContext.getTestInstance(); Object testFactoryMethodResult = executableInvoker.invoke(getTestMethod(), instance, testExtensionContext, context.getExtensionRegistry()); TestSource source = getSource().orElseThrow(AssertionError::new); try (Stream<DynamicNode> dynamicNodeStream = toDynamicNodeStream(testFactoryMethodResult)) { AtomicInteger index = new AtomicInteger(); dynamicNodeStream.forEach(node -> { JupiterTestDescriptor descriptor = createDescriptor(this, node, index, source); dynamicTestExecutor.execute(descriptor); }); } catch (ClassCastException ex) { throw invalidReturnTypeException(ex); } }); }

Target:
protected void invokeTestMethod(JupiterEngineExecutionContext context, DynamicTestExecutor dynamicTestExecutor) { TestExtensionContext testExtensionContext = (TestExtensionContext) context.getExtensionContext(); context.getThrowableCollector().execute(() -> { Object instance = testExtensionContext.getTestInstance(); Object testFactoryMethodResult = executableInvoker.invoke(getTestMethod(), instance, testExtensionContext, context.getExtensionRegistry()); TestSource source = getSource().orElseThrow(() -> new JUnitException("Test source must be present")); try (Stream<DynamicNode> dynamicNodeStream = toDynamicNodeStream(testFactoryMethodResult)) { int index = 1; Iterator<DynamicNode> iterator = dynamicNodeStream.iterator(); while (iterator.hasNext()) { DynamicNode dynamicNode = iterator.next(); JupiterTestDescriptor descriptor = createDynamicDescriptor(this, dynamicNode, index++, source); dynamicTestExecutor.execute(descriptor); } } catch (ClassCastException ex) { throw invalidReturnTypeException(ex); } }); }
Source:
private static void installBootBundles(Framework framework) { Enumeration<URL> resources; try { resources = Osgis.class.getClassLoader().getResources(MANIFEST_PATH); } catch (IOException e) { throw Exceptions.propagate(e); } BundleContext bundleContext = framework.getBundleContext(); Map<String, Bundle> installedBundles = getInstalledBundles(bundleContext); while(resources.hasMoreElements()) { URL url = resources.nextElement(); ReferenceWithError<Boolean> installResult = installExtensionBundle(bundleContext, url, installedBundles, getVersionedId(framework)); if (installResult.hasError()) { if (installResult.getMaskingError()) { if (LOG.isTraceEnabled()) LOG.trace(installResult.getError().getMessage()); } else { if (installResult.masksErrorIfPresent()) { LOG.debug(installResult.getError().getMessage()); } else { LOG.warn("Unable to install manifest from "+url+": "+installResult.getError(), installResult.getError()); } } } } }

Target:
private static void installBootBundles(Framework framework) { Enumeration<URL> resources; try { resources = Osgis.class.getClassLoader().getResources(MANIFEST_PATH); } catch (IOException e) { throw Exceptions.propagate(e); } BundleContext bundleContext = framework.getBundleContext(); Map<String, Bundle> installedBundles = getInstalledBundles(bundleContext); while(resources.hasMoreElements()) { URL url = resources.nextElement(); ReferenceWithError<Boolean> installResult = installExtensionBundle(bundleContext, url, installedBundles, getVersionedId(framework)); if (installResult.hasError()) { if (installResult.getWithoutError()) { if (LOG.isTraceEnabled()) LOG.trace(installResult.getError().getMessage()); } else { if (installResult.masksErrorIfPresent()) { LOG.debug(installResult.getError().getMessage()); } else { LOG.warn("Unable to install manifest from "+url+": "+installResult.getError(), installResult.getError()); } } } } }
Source:
private void createRemoteComposite() { if (fFileWidget == null) { fFileWidget = new RemoteResourceBrowserWidget(fDialogComposite, SWT.BORDER, 0); fFileWidget.setLayoutData(new GridData(GridData.FILL_BOTH)); fFileWidget.setInitialPath(LTTngControlServiceConstants.DEFAULT_PATH); fFileWidget.setConnection(fConnection); getButton(IDialogConstants.OK_ID).setEnabled(true); } }

Target:
private void createRemoteComposite() { if (fFileWidget == null) { fFileWidget = new RemoteResourceBrowserWidget(fDialogComposite, SWT.BORDER, 0); fFileWidget.setLayoutData(new GridData(GridData.FILL_BOTH)); fFileWidget.setInitialPath(LTTngControlServiceConstants.DEFAULT_PATH); fFileWidget.setConnection(fConnection); fFileWidget.addSelectionChangedListener(new ISelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent event) { enableRemoteButtons(); } }); getButton(IDialogConstants.OK_ID).setEnabled(true); } }
Source:
public List<RepoImage> getUserRequestForStorageDomainRepoFileList(Guid storageDomainId, ImageFileType imageType, boolean forceRefresh) { if (!isStorageDomainIdValid(storageDomainId)) { throw new EngineException(EngineError.GetIsoListError); } if (forceRefresh) { if (refreshRepos(storageDomainId, imageType)) { throw new EngineException(EngineError.IMAGES_NOT_SUPPORTED_ERROR); } } else { refreshReposIfIntervalPassed(storageDomainId, imageType); } return getCachedIsoListByDomainId(storageDomainId, imageType); }

Target:
public List<RepoImage> getUserRequestForStorageDomainRepoFileList(Guid storageDomainId, ImageFileType imageType, boolean forceRefresh) { if (!isStorageDomainIdValid(storageDomainId)) { throw new EngineException(EngineError.GetIsoListError); } if (forceRefresh) { if (!refreshRepos(storageDomainId, imageType)) { throw new EngineException(EngineError.IMAGES_NOT_SUPPORTED_ERROR); } } else { refreshReposIfIntervalPassed(storageDomainId, imageType); } return getCachedIsoListByDomainId(storageDomainId, imageType); }
Source:
public Optional<Response> handleWithoutObaData() { if (askState == SessionAttribute.AskState.VERIFYSTOP) { return StopUtil.handleDuplicateStopResponse(personalization.getPrincipleId(), attributesManager, true, googleMaps, obaClient, obaDao); } if (askState == SessionAttribute.AskState.COPY_PROFILE_CONFIRM && personalization.isPersonalized()) { try { Optional<ObaUserDataItem> obaUserDataItem = this.obaDao.getUserData(personalization.getUserId()); obaUserDataItem.get().setUserId(personalization.getPersonId()); obaUserDataItem.get().setPreviousResponse(StringUtils.EMPTY); ObaUserClient obaUserClient = new ObaUserClient(obaUserDataItem.get().getObaBaseUrl()); this.obaDao.saveUserData(obaUserDataItem.get()); return CityUtil.tellArrivals(obaUserDataItem.get(), obaUserClient, attributesManager, obaDao); } catch (Exception e) { log.error(e); throw new OneBusAwayException(promptHelper.getPrompt(Prompt.COMMUNICATION_ERROR_MESSAGE), e); } } log.error("Received yes intent without a question."); return CityUtil.askForCityResponse(); }

Target:
public Optional<Response> handleWithoutObaData() { if (askState == SessionAttribute.AskState.VERIFYSTOP) { return StopUtil.handleDuplicateStopResponse(personalization.getPrincipleId(), attributesManager, true, googleMaps, obaClient, obaDao); } if (askState == SessionAttribute.AskState.COPY_PROFILE_CONFIRM && personalization.isPersonalized()) { try { Optional<ObaUserDataItem> obaUserDataItem = this.obaDao.getUserData(personalization.getUserId()); obaUserDataItem.get().setUserId(personalization.getPersonId()); obaUserDataItem.get().setPreviousResponse(StringUtils.EMPTY); ObaUserClient obaUserClient = new ObaUserClient(obaUserDataItem.get().getObaBaseUrl()); this.obaDao.saveUserData(obaUserDataItem.get()); populateAlexaSessionAttributes(obaUserDataItem); return CityUtil.tellArrivals(obaUserDataItem.get(), obaUserClient, attributesManager, obaDao); } catch (Exception e) { log.error(e); throw new OneBusAwayException(promptHelper.getPrompt(Prompt.COMMUNICATION_ERROR_MESSAGE), e); } } log.error("Received yes intent without a question."); return CityUtil.askForCityResponse(); }
Source:
public void replace(final Expression oldExpr, final Expression newExpr) { final int idx = steps.indexOf(oldExpr); if (idx < 0) { if (LOG.isTraceEnabled()) { LOG.trace("Expression not found when trying to replace: " + ExpressionDumper.dump(oldExpr) + "; in: " + ExpressionDumper.dump(this)); } return; } steps.set(idx, newExpr); }

Target:
public void replace(final Expression oldExpr, final Expression newExpr) { final int idx = steps.indexOf(oldExpr); if (idx < 0) { if (LOG.isTraceEnabled()) { LOG.trace("Expression not found when trying to replace: {}; in: {}", ExpressionDumper.dump(oldExpr), ExpressionDumper.dump(this)); } return; } steps.set(idx, newExpr); }
Source:
private boolean validateWeightForResourceConfig(ClusterConfig clusterConfig, ResourceConfig resourceConfig, IdealState idealState) { if (resourceConfig == null) { return !clusterConfig.getDefaultPartitionWeightMap().isEmpty(); } Map<String, Map<String, Integer>> capacityMap; try { capacityMap = resourceConfig.getPartitionCapacityMap(); } catch (IOException ex) { logger.error("Invalid partition capacity configuration of resource: {}", idealState.getResourceName(), ex); return false; } Set<String> capacityMapSet = new HashSet<>(capacityMap.keySet()); boolean hasDefaultCapacity = capacityMapSet.contains(ResourceConfig.DEFAULT_PARTITION_KEY); capacityMapSet.remove(ResourceConfig.DEFAULT_PARTITION_KEY); if (capacityMapSet.size() != idealState.getNumPartitions() && !hasDefaultCapacity) { logger.error( "ResourceConfig for does not have all partitions defined in PartitionCapacityMap!", idealState.getResourceName()); return false; } capacityMap.keySet().forEach(partitionName -> WagedValidationUtil .validateAndGetPartitionCapacity(partitionName, resourceConfig, capacityMap, clusterConfig)); return true; }

Target:
private boolean validateWeightForResourceConfig(ClusterConfig clusterConfig, ResourceConfig resourceConfig, IdealState idealState) { if (resourceConfig == null) { if (clusterConfig.getDefaultPartitionWeightMap().isEmpty()) { logger.error( "ResourceConfig for is null, and there are no default weights set in ClusterConfig!", idealState.getResourceName()); return false; } if (clusterConfig.getDefaultPartitionWeightMap().keySet() .containsAll(clusterConfig.getInstanceCapacityKeys())) { return true; } logger.error( "ResourceConfig for is null, and ClusterConfig's default partition weight map doesn't have all the required keys!", idealState.getResourceName()); return false; } Map<String, Map<String, Integer>> capacityMap; try { capacityMap = resourceConfig.getPartitionCapacityMap(); } catch (IOException ex) { logger.error("Invalid partition capacity configuration of resource: {}", idealState.getResourceName(), ex); return false; } Set<String> capacityMapSet = new HashSet<>(capacityMap.keySet()); boolean hasDefaultCapacity = capacityMapSet.contains(ResourceConfig.DEFAULT_PARTITION_KEY); capacityMapSet.remove(ResourceConfig.DEFAULT_PARTITION_KEY); if (capacityMapSet.size() != idealState.getNumPartitions() && !hasDefaultCapacity) { logger.error( "ResourceConfig for does not have all partitions defined in PartitionCapacityMap!", idealState.getResourceName()); return false; } capacityMap.keySet().forEach(partitionName -> WagedValidationUtil .validateAndGetPartitionCapacity(partitionName, resourceConfig, capacityMap, clusterConfig)); return true; }
Source:
public boolean equals(Object obj) { if (obj instanceof SynchronizationModel) { final SynchronizationModel other = (SynchronizationModel)obj; boolean equals = leftTraversal.equals(other.leftTraversal); if (equals) { equals = rightTraversal != null && rightTraversal.equals(other.rightTraversal) || other.rightTraversal == null; } if (equals) { equals = originTraversal != null && originTraversal.equals(other.originTraversal) || other.originTraversal == null; } return equals; } return false; }

Target:
public boolean equals(Object obj) { if (obj instanceof SynchronizationModel) { final SynchronizationModel other = (SynchronizationModel)obj; return Objects.equal(leftTraversal, other.leftTraversal) && Objects.equal(rightTraversal, other.rightTraversal) && Objects.equal(originTraversal, other.originTraversal); } return false; }
Source:
private BacklogColumnUI() { super(WorldXViewerFactory.COLUMN_NAMESPACE + ".backlog", "Backlog", 100, XViewerAlign.Left, false, SortDataType.String, true, "Backlog that this item belongs to. (BL) if Agile Backlog, else Goal (which are sometimes used as backlogs)"); }

Target:
private BacklogColumnUI() { super(WorldXViewerFactory.COLUMN_NAMESPACE + ".backlog", "Backlog", 100, XViewerAlign.Left, false, SortDataType.String, true, "Backlog that this item belongs to."); }
Source:
protected static ImmutableList<Ds3EnumConstant> convertAllEnumConstants( final ImmutableList<Ds3EnumConstant> enumConstants, final NameMapper nameMapper) { if (enumConstants == null || enumConstants.isEmpty()) { return enumConstants; } ImmutableList.Builder<Ds3EnumConstant> builder = ImmutableList.builder(); for (final Ds3EnumConstant enumConstant : enumConstants) { final Ds3EnumConstant convertedEnumConstant = new Ds3EnumConstant( enumConstant.getName(), convertAllProperties(enumConstant.getDs3Properties(), nameMapper)); builder.add(convertedEnumConstant); } return builder.build(); }

Target:
protected static ImmutableList<Ds3EnumConstant> convertAllEnumConstants( final ImmutableList<Ds3EnumConstant> enumConstants, final NameMapper nameMapper) { if (enumConstants == null || enumConstants.isEmpty()) { return enumConstants; } final ImmutableList.Builder<Ds3EnumConstant> builder = ImmutableList.builder(); for (final Ds3EnumConstant enumConstant : enumConstants) { final Ds3EnumConstant convertedEnumConstant = new Ds3EnumConstant( enumConstant.getName(), convertAllProperties(enumConstant.getDs3Properties(), nameMapper)); builder.add(convertedEnumConstant); } return builder.build(); }