auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private CompletableFuture<Void> doInitialSync() { LOGGER.debug("Making initial Sync to all seed members: {}", seedMembers); if (seedMembers.isEmpty()) { <START> return CompletableFuture.completedFuture(null); <END> } CompletableFuture<Void> syncResponseFuture = new CompletableFuture<>(); String cid = member.id(); transport.listen().observeOn(scheduler) .filter(msg -> SYNC_ACK.equals(msg.qualifier())) .filter(msg -> cid.equals(msg.correlationId())) .filter(this::checkSyncGroup) .take(1) .timeout(config.getSyncTimeout(), TimeUnit.MILLISECONDS, scheduler) .subscribe(message -> { onSyncAck(message); schedulePeriodicSync(); syncResponseFuture.complete(null); }, throwable -> { LOGGER.info("Timeout getting initial SyncAck from seed members: {}", seedMembers); schedulePeriodicSync(); syncResponseFuture.complete(null); }); Message syncMsg = prepareSyncDataMsg(SYNC, cid); seedMembers.forEach(address -> transport.send(address, syncMsg)); return syncResponseFuture; }</code><technical_language>hm, i a bug (not related futures). need call schedulePeriodicSync(); returning future</technical_language>

Target:
private CompletableFuture<Void> doInitialSync() { LOGGER.debug("Making initial Sync to all seed members: {}", seedMembers); if (seedMembers.isEmpty()) { schedulePeriodicSync(); return CompletableFuture.completedFuture(null); } CompletableFuture<Void> syncResponseFuture = new CompletableFuture<>(); String cid = member.id(); transport.listen().observeOn(scheduler) .filter(msg -> SYNC_ACK.equals(msg.qualifier())) .filter(msg -> cid.equals(msg.correlationId())) .filter(this::checkSyncGroup) .take(1) .timeout(config.getSyncTimeout(), TimeUnit.MILLISECONDS, scheduler) .subscribe( message -> { onSyncAck(message); schedulePeriodicSync(); syncResponseFuture.complete(null); }, throwable -> { LOGGER.info("Timeout getting initial SyncAck from seed members: {}", seedMembers); schedulePeriodicSync(); syncResponseFuture.complete(null); }); Message syncMsg = prepareSyncDataMsg(SYNC, cid); seedMembers.forEach(address -> transport.send(address, syncMsg)); return syncResponseFuture; }
Source:
<code>private int compactPartition(PartitionId partition) { if (isShuttingDown()) { logger.info("Skipping compaction due to shut down."); return 0; } logger.info("Beginning dead blob compaction for partition {}", partition); String partitionPath = partition.toPathString(); if (!partitions.contains(partition)) { <START> logger.warn("Skipping compaction of Partition as the partition was reassgined", partition); <END> return 0; } try { return cloudDestination.compactPartition(partitionPath); } catch (CloudStorageException ex) { logger.error("Compaction failed for partition {}", partitionPath, ex); vcrMetrics.compactionFailureCount.inc(); } return 0; }</code><technical_language>Typo: reassigned</technical_language>

Target:
private int compactPartition(PartitionId partition) throws CloudStorageException { if (isShutDown()) { logger.info("Skipping compaction due to shut down."); return 0; } logger.info("Beginning dead blob compaction for partition {}", partition); String partitionPath = partition.toPathString(); if (!partitions.contains(partition)) { logger.warn("Skipping compaction of Partition as the partition was reassigned", partition); return 0; } try { return cloudDestination.compactPartition(partitionPath); } catch (CloudStorageException ex) { logger.error("Compaction failed for partition {}", partitionPath, ex); throw ex; } }
Source:
<code>public void before() { try { <START> SWTBotUtils.openTrace(TRACE_PROJECT_NAME, FileLocator.toFileURL(CtfTestTrace.ARM_64_BIT_HEADER.getTraceURL()).getPath(), KERNEL_TRACE_TYPE); <END> } catch (IOException e) { fail(e.getMessage()); } SWTBotUtils.activateEditor(fBot, "bug446190"); fViewBotCfv = fBot.viewById(ControlFlowView.ID); SWTBotUtils.openView(CP_ID); fViewBotCp = fBot.viewById(CP_ID); fViewBotCp.show(); fViewBotCfv.show(); fViewBotCfv.setFocus(); }</code><technical_language>For Windows: String path = Paths.get(FileLocator.toFileURL(CtfTestTrace.ARM_64_BIT_HEADER.getTraceURL()).toURI()).toString(); SWTBotUtils.openTrace(TRACE_PROJECT_NAME, path, KERNEL_TRACE_TYPE);</technical_language>

Target:
public void before() { try { SWTBotUtils.openTrace(TRACE_PROJECT_NAME, Paths.get(FileLocator.toFileURL(CtfTestTrace.ARM_64_BIT_HEADER.getTraceURL()).toURI()).toString(), KERNEL_TRACE_TYPE); } catch (IOException | URISyntaxException e) { fail(e.getMessage()); } SWTBotUtils.activateEditor(fBot, "bug446190"); fViewBotCfv = fBot.viewById(ControlFlowView.ID); SWTBotUtils.openView(CP_ID); fViewBotCp = fBot.viewById(CP_ID); fViewBotCp.show(); fViewBotCfv.show(); fViewBotCfv.setFocus(); }
Source:
<code>public Status update(String table, String key, HashMap<String, ByteIterator> values) { try { if (!transactionUpdate) { BaseDocument updateDoc = new BaseDocument(); for (String field : values.keySet()) { updateDoc.addAttribute(field, byteIteratorToString(values.get(field))); } arangoDriver.updateDocument(table, key, updateDoc); return Status.OK; } else { String transactionAction = "function (id) {" + "var db = require('internal').db;" + String.format("db._update(id, %s, true, false, %s);}", mapToJson(values), Boolean.toString(waitForSync).toLowerCase()); TransactionEntity transaction = arangoDriver.createTransaction(transactionAction); transaction.addWriteCollection(table); transaction.setParams(createDocumentHandle(table, key)); arangoDriver.executeTransaction(transaction); return Status.OK; } } catch (ArangoException e) { if (e.getErrorNumber() != ErrorNums.ERROR_ARANGO_DOCUMENT_NOT_FOUND) { <START> logger.error("Fail to update: " + table + " " + key, e); <END> } else { logger.debug("Trying to update document not exist: {}", table, key); return Status.NOT_FOUND; } } catch (Exception e) { logger.error("Exception while trying update " + table + " " + key, e); } return Status.ERROR; }</code><technical_language>a format placeholder instead of string concat</technical_language>

Target:
public Status update(String table, String key, HashMap<String, ByteIterator> values) { try { if (!transactionUpdate) { BaseDocument updateDoc = new BaseDocument(); for (String field : values.keySet()) { updateDoc.addAttribute(field, byteIteratorToString(values.get(field))); } arangoDriver.updateDocument(table, key, updateDoc); return Status.OK; } else { String transactionAction = "function (id) {" + "var db = require('internal').db;" + String.format("db._update(id, %s, true, false, %s);}", mapToJson(values), Boolean.toString(waitForSync).toLowerCase()); TransactionEntity transaction = arangoDriver.createTransaction(transactionAction); transaction.addWriteCollection(table); transaction.setParams(createDocumentHandle(table, key)); arangoDriver.executeTransaction(transaction); return Status.OK; } } catch (ArangoException e) { if (e.getErrorNumber() != ErrorNums.ERROR_ARANGO_DOCUMENT_NOT_FOUND) { logger.error("Fail to update: with ex {}", table, key, e.toString()); } else { logger.debug("Trying to update document not exist: {}", table, key); return Status.NOT_FOUND; } } catch (RuntimeException e) { logger.error("Exception while trying update with ex {}", table, key, e.toString()); } return Status.ERROR; }
Source:
<code>public void testActionStore () throws Exception { <START> ObjectStoreEnvironmentBean oseb = BeanPopulator.getNamedInstance(ObjectStoreEnvironmentBean.class, "communicationStore"); <END> oseb.setObjectStoreDir("tmp"); ObjectStoreEnvironmentBean objectStoreEnvironmentBean = new ObjectStoreEnvironmentBean(); objectStoreEnvironmentBean.setLocalOSRoot( "tmp" ); ActionStore as = new ActionStore(objectStoreEnvironmentBean); final OutputObjectState buff = new OutputObjectState(); final String tn = "/StateManager/junit"; for (int i = 0; i < 100; i++) { Uid u = new Uid(); as.write_uncommitted(u, tn, buff); as.commit_state(u, tn); assertTrue(as.currentState(u, tn) != StateStatus.OS_UNCOMMITTED); InputObjectState ios = new InputObjectState(); as.allObjUids("", ios); assertTrue(as.read_uncommitted(u, tn) == null); as.write_committed(u, tn, buff); as.read_committed(u, tn); assertTrue(!as.remove_uncommitted(u, tn)); as.remove_committed(u, tn); assertTrue(!as.hide_state(u, tn)); assertTrue(!as.reveal_state(u, tn)); } }</code><technical_language>is this related SPI changes</technical_language>

Target:
public void testActionStore () throws Exception { ObjectStoreEnvironmentBean objectStoreEnvironmentBean = new ObjectStoreEnvironmentBean(); objectStoreEnvironmentBean.setLocalOSRoot( "tmp" ); ActionStore as = new ActionStore(objectStoreEnvironmentBean); final OutputObjectState buff = new OutputObjectState(); final String tn = "/StateManager/junit"; for (int i = 0; i < 100; i++) { Uid u = new Uid(); as.write_uncommitted(u, tn, buff); as.commit_state(u, tn); assertTrue(as.currentState(u, tn) != StateStatus.OS_UNCOMMITTED); InputObjectState ios = new InputObjectState(); as.allObjUids("", ios); assertTrue(as.read_uncommitted(u, tn) == null); as.write_committed(u, tn, buff); as.read_committed(u, tn); assertTrue(!as.remove_uncommitted(u, tn)); as.remove_committed(u, tn); assertTrue(!as.hide_state(u, tn)); assertTrue(!as.reveal_state(u, tn)); } }
Source:
<code>static void validateDataStreams(SortedMap<String, IndexAbstraction> indicesLookup, @Nullable DataStreamMetadata dsMetadata) { if (dsMetadata != null) { for (DataStream ds : dsMetadata.dataStreams().values()) { Map<String, IndexAbstraction> conflicts = indicesLookup.subMap(ds.getName() + "-", ds.getName() + ".") .entrySet().stream() .filter(entry -> { if (entry.getValue().getType() != IndexAbstraction.Type.CONCRETE_INDEX) { return true; } else { int indexNameCounter; try { indexNameCounter = IndexMetadata.parseIndexNameCounter(entry.getKey()); <START> } catch (Exception e) { <END> return false; } return indexNameCounter > ds.getGeneration(); } }).collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)); if (conflicts.size() > 0) { throw new IllegalStateException("data stream [" + ds.getName() + "] could create backing indices that conflict with " + conflicts.size() + " existing index(s) or alias(s)" + " including '" + conflicts.keySet().iterator().next() + "'"); } } } }</code><technical_language>catch IllegalArgumentException here? cases specific failure logic, mask other potential problem</technical_language>

Target:
static void validateDataStreams(SortedMap<String, IndexAbstraction> indicesLookup, @Nullable DataStreamMetadata dsMetadata) { if (dsMetadata != null) { for (DataStream ds : dsMetadata.dataStreams().values()) { Map<String, IndexAbstraction> conflicts = indicesLookup.subMap(ds.getName() + "-", ds.getName() + ".") .entrySet().stream() .filter(entry -> { if (entry.getValue().getType() != IndexAbstraction.Type.CONCRETE_INDEX) { return true; } else { int indexNameCounter; try { indexNameCounter = IndexMetadata.parseIndexNameCounter(entry.getKey()); } catch (IllegalArgumentException e) { return false; } return indexNameCounter > ds.getGeneration(); } }).collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)); if (conflicts.size() > 0) { throw new IllegalStateException("data stream [" + ds.getName() + "] could create backing indices that conflict with " + conflicts.size() + " existing index(s) or alias(s)" + " including '" + conflicts.keySet().iterator().next() + "'"); } } } }
Source:
<code>private Map<SubPair, List<String>> getSubPoolMap() throws SQLException, DatabaseException { Statement stmt = connection.createStatement(); Map<SubPair, List<String>> subPoolsMap = new HashMap<>(); ResultSet rs = stmt.executeQuery( "SELECT cp_pool.id, cp_pool.subscriptionid, " + "cp_pool.subscriptionsubkey, cp_pool.owner_id " + "FROM cp_pool, " + "(SELECT subscriptionid, subscriptionsubkey " + "FROM cp_pool " + "WHERE subscriptionid IS NOT NULL " + "AND subscriptionsubkey IS NOT NULL " + "GROUP BY subscriptionid, subscriptionsubkey " + "HAVING count(id) > 1) subs " + "WHERE subs.subscriptionid = cp_pool.subscriptionid " + "AND subs.subscriptionsubkey = cp_pool.subscriptionsubkey"); Map<SubPair, String> subOwners = new HashMap<>(); while (rs.next()) { SubPair current = new SubPair(rs.getString(2), rs.getString(3)); if (!subPoolsMap.containsKey(current)) { subPoolsMap.put(current, new LinkedList<>()); subOwners.put(current, rs.getString(4)); } else if (!subOwners.get(current).equals(rs.getString(4))) { <START> logger.error("Owners '{}' and '{}' both have pools from subscription: {}", <END> rs.getString(4), subOwners.get(current), current); throw new DatabaseException("Pools exist for subscription " + current + " within multiple " + "owners."); } subPoolsMap.get(current).add(rs.getString(1)); } rs.close(); return subPoolsMap; }</code><technical_language>this work? I thought liquibase logger support this style of interpolation</technical_language>

Target:
private Map<SubPair, List<String>> getSubPoolMap() throws SQLException, DatabaseException { Statement stmt = connection.createStatement(); Map<SubPair, List<String>> subPoolsMap = new HashMap<>(); ResultSet rs = stmt.executeQuery( "SELECT cp_pool.id, cp_pool.subscriptionid, " + "cp_pool.subscriptionsubkey, cp_pool.owner_id " + "FROM cp_pool, " + "(SELECT subscriptionid, subscriptionsubkey " + "FROM cp_pool " + "WHERE subscriptionid IS NOT NULL " + "AND subscriptionsubkey IS NOT NULL " + "GROUP BY subscriptionid, subscriptionsubkey " + "HAVING count(id) > 1) subs " + "WHERE subs.subscriptionid = cp_pool.subscriptionid " + "AND subs.subscriptionsubkey = cp_pool.subscriptionsubkey"); Map<SubPair, String> subOwners = new HashMap<>(); while (rs.next()) { SubPair current = new SubPair(rs.getString(2), rs.getString(3)); if (!subPoolsMap.containsKey(current)) { subPoolsMap.put(current, new LinkedList<>()); subOwners.put(current, rs.getString(4)); } else if (!subOwners.get(current).equals(rs.getString(4))) { logger.error(String.format("Owners '%s' and '%s' both have pools from subscription: %s", rs.getString(4), subOwners.get(current), current)); throw new DatabaseException("Pools exist for subscription " + current + " within multiple " + "owners."); } subPoolsMap.get(current).add(rs.getString(1)); } rs.close(); return subPoolsMap; }
Source:
<code>@Test public void getPriorityWithMultipleRequests() { Action action1 = mockAction(URI_KEY_1, URI_1, NORMAL); Action action2 = mockAction(URI_KEY_1, URI_1, HIGH); BitmapHunter hunter = forRequest(mockPicasso(new NetworkRequestHandler(downloader, stats)), dispatcher, cache, stats, action1); hunter.attach(action2); assertThat(hunter.getAction()).isEqualTo(action1); assertThat(hunter.getActions()).hasSize(1); <START> assertThat(hunter.getActions()).contains(action2); <END> assertThat(hunter.getPriority()).isEqualTo(HIGH); }</code><technical_language>replace hasSize+contains calls containsExactly, nbd, this is existing code had</technical_language>

Target:
@Test public void getPriorityWithMultipleRequests() { Action action1 = mockAction(URI_KEY_1, URI_1, NORMAL); Action action2 = mockAction(URI_KEY_1, URI_1, HIGH); BitmapHunter hunter = forRequest(mockPicasso(new NetworkRequestHandler(downloader, stats)), dispatcher, cache, stats, action1); hunter.attach(action2); assertThat(hunter.getAction()).isEqualTo(action1); assertThat(hunter.getActions()).containsExactly(action2); assertThat(hunter.getPriority()).isEqualTo(HIGH); }
Source:
<code>protected @NonNull List<@NonNull TimeGraphEntryModel> getTree(@NonNull ITmfStateSystem ss, @NonNull TimeQueryFilter filter, @Nullable IProgressMonitor monitor) throws StateSystemDisposedException { Builder<@NonNull TimeGraphEntryModel> builder = new Builder<>(); long parentId = getId(ITmfStateSystem.ROOT_ATTRIBUTE); <START> builder.add(new TimeGraphEntryModel(parentId, -1, getTrace().getName(), ss.getStartTime(), ss.getCurrentEndTime())); <END> addChildren(ss, builder, ITmfStateSystem.ROOT_ATTRIBUTE, parentId); return builder.build(); }</code><technical_language>null, add a null check something</technical_language>

Target:
protected @NonNull List<@NonNull TimeGraphEntryModel> getTree(@NonNull ITmfStateSystem ss, @NonNull TimeQueryFilter filter, @Nullable IProgressMonitor monitor) throws StateSystemDisposedException { Builder<@NonNull TimeGraphEntryModel> builder = new Builder<>(); long parentId = getId(ITmfStateSystem.ROOT_ATTRIBUTE); builder.add(new TimeGraphEntryModel(parentId, -1, String.valueOf(getTrace().getName()), ss.getStartTime(), ss.getCurrentEndTime())); addChildren(ss, builder, ITmfStateSystem.ROOT_ATTRIBUTE, parentId); return builder.build(); }
Source:
<code>static <BO extends BrooklynObject> Class<? extends AbstractBrooklynObjectSpec<?,?>> lookupSpecTypeForTarget(Class<BO> targetSuperType) { if (targetSuperType==null) return null; BrooklynObjectType best = null; for (BrooklynObjectType t: BrooklynObjectType.values()) { <START> if (t.getSpecType()==null) continue; <END> if (!t.getInterfaceType().isAssignableFrom(targetSuperType)) continue; if (t.getInterfaceType().equals(targetSuperType)) return t.getSpecType(); if (best==null) { best = t; continue; } if (best.getSpecType().isAssignableFrom(t.getSpecType())) { best = t; continue; } } if (best==null) { log.warn("Unexpected target supertype ("+targetSuperType+"); unable to infer spec type"); return null; } return best.getSpecType(); }</code><technical_language>getInterfaceType()</technical_language>

Target:
static <BO extends BrooklynObject> Class<? extends AbstractBrooklynObjectSpec<?,?>> lookupSpecTypeForTarget(Class<BO> targetSuperType) { if (targetSuperType==null) return null; BrooklynObjectType best = null; for (BrooklynObjectType t: BrooklynObjectType.values()) { if (t.getInterfaceType()==null) continue; if (!t.getInterfaceType().isAssignableFrom(targetSuperType)) continue; if (t.getInterfaceType().equals(targetSuperType)) return t.getSpecType(); if (best==null) { best = t; continue; } if (best.getInterfaceType().isAssignableFrom(t.getInterfaceType())) { best = t; continue; } } if (best==null) { log.warn("Unexpected target supertype ("+targetSuperType+"); unable to infer spec type"); return null; } return best.getSpecType(); }
Source:
<code>public GamesTableController(MapService mapService, JoinGameHelper joinGameHelper, I18n i18n, UiService uiService, PreferencesService preferencesService) { this.mapService = mapService; this.joinGameHelper = joinGameHelper; this.i18n = i18n; this.uiService = uiService; this.preferencesService = preferencesService; this.selectedGame = new SimpleObjectProperty<>(); modChangedListener = (observable, oldValue, newValue) -> modsColumn.setVisible(newValue); <START> passwordChangeListener = (observable, oldValue, newValue) -> passwordProtectionColumn.setVisible(newValue); <END> }</code><technical_language>modChangedListener sounds a mod changed. Better: showModdedGamesChangedListener. showPasswordProtectedGamesChangedListener</technical_language>

Target:
public GamesTableController(MapService mapService, JoinGameHelper joinGameHelper, I18n i18n, UiService uiService, PreferencesService preferencesService) { this.mapService = mapService; this.joinGameHelper = joinGameHelper; this.i18n = i18n; this.uiService = uiService; this.preferencesService = preferencesService; this.selectedGame = new SimpleObjectProperty<>(); showModdedGamesChangedListener = (observable, oldValue, newValue) -> modsColumn.setVisible(newValue); showPasswordProtectedGamesChangedListener = (observable, oldValue, newValue) -> passwordProtectionColumn.setVisible(newValue); }
Source:
<code>private static void assertFullGetAllAttachableDisksByPoolId(List<Disk> disks) { <START> assertEquals("There should be only three attachable disks", 4, disks.size()); <END> Set<Guid> expectedFloatingDiskIds = new HashSet<Guid>(Arrays.asList(FixturesTool.FLOATING_DISK_ID, FixturesTool.FLOATING_LUN_ID, FixturesTool.FLOATING_CINDER_DISK_ID)); Set<Guid> actualFloatingDiskIds = new HashSet<Guid>(); for (Disk disk : disks) { actualFloatingDiskIds.add(disk.getId()); } assertEquals("Wrong attachable disks", expectedFloatingDiskIds, actualFloatingDiskIds); }</code><technical_language>4</technical_language>

Target:
private static void assertFullGetAllAttachableDisksByPoolId(List<Disk> disks) { assertEquals("There should be only four attachable disks", 4, disks.size()); Set<Guid> expectedFloatingDiskIds = new HashSet<Guid>(Arrays.asList(FixturesTool.FLOATING_DISK_ID, FixturesTool.FLOATING_LUN_ID, FixturesTool.FLOATING_CINDER_DISK_ID)); Set<Guid> actualFloatingDiskIds = new HashSet<Guid>(); for (Disk disk : disks) { actualFloatingDiskIds.add(disk.getId()); } assertEquals("Wrong attachable disks", expectedFloatingDiskIds, actualFloatingDiskIds); }
Source:
<code>public Response getGeoAlertsForGeoClusters(@PathParam("alertType") String alertType) { try { String authorizedUser = MultitenantUtils.getTenantAwareUsername( CarbonContext.getThreadLocalCarbonContext().getUsername() ); GeoLocationProviderService geoService = DeviceMgtAPIUtils.getGeoService(); if (GeoServices.ALERT_TYPE_WITHIN.equals(alertType)) { List<GeoFence> alerts = geoService.getWithinAlerts(); return Response.ok().entity(alerts).build(); } else if (GeoServices.ALERT_TYPE_EXIT.equals(alertType)) { List<GeoFence> alerts = geoService.getExitAlerts(); return Response.ok().entity(alerts).build(); } else if (GeoServices.ALERT_TYPE_SPEED.equals(alertType)) { String result = geoService.getSpeedAlerts(); return Response.ok().entity(result).build(); } else if (GeoServices.ALERT_TYPE_PROXIMITY.equals(alertType)) { String result = geoService.getProximityAlerts(); return Response.ok().entity(result).build(); } else if (GeoServices.ALERT_TYPE_STATIONARY.equals(alertType)) { List<GeoFence> alerts = geoService.getStationaryAlerts(); return Response.ok().entity(alerts).build(); } else if (GeoServices.ALERT_TYPE_TRAFFIC.equals(alertType)) { List<GeoFence> alerts = geoService.getTrafficAlerts(); return Response.ok().entity(alerts).build(); } <START> return null; <END> } catch (GeoLocationBasedServiceException e) { String error = "Error occurred while getting the geo alerts for " + alertType + " alert"; log.error(error, e); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(error).build(); } }</code><technical_language>throw error of matches</technical_language>

Target:
public Response getGeoAlertsForGeoClusters(@PathParam("alertType") String alertType) { try { GeoLocationProviderService geoService = DeviceMgtAPIUtils.getGeoService(); List<GeoFence> alerts = null; String result = null; switch (alertType) { case GeoServices.ALERT_TYPE_WITHIN: alerts = geoService.getWithinAlerts(); break; case GeoServices.ALERT_TYPE_EXIT: alerts = geoService.getExitAlerts(); break; case GeoServices.ALERT_TYPE_STATIONARY: alerts = geoService.getStationaryAlerts(); break; case GeoServices.ALERT_TYPE_TRAFFIC: alerts = geoService.getTrafficAlerts(); break; case GeoServices.ALERT_TYPE_SPEED: result = geoService.getSpeedAlerts(); return Response.ok().entity(result).build(); case GeoServices.ALERT_TYPE_PROXIMITY: result = geoService.getProximityAlerts(); return Response.ok().entity(result).build(); default: throw new GeoLocationBasedServiceException("Invalid Alert Type"); } return Response.ok().entity(alerts).build(); } catch (GeoLocationBasedServiceException e) { String error = "Error occurred while getting the geo alerts for " + alertType + " alert"; log.error(error, e); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(error).build(); } }
Source:
<code>public void adsFandomMobileArticleAds(String article) throws IOException { String testedPage = urlBuilder.getUrlForFandomPage(article); AdsBaseObject wikiPage = new AdsBaseObject(driver, testedPage); getJquery(); wikiPage.verifyFandomMobileArticleTopLeaderboard(); wikiPage.verifyFandomMobileArticleBottomLeaderboard(); <START> <END> }</code><technical_language>Please remove extra line</technical_language>

Target:
public void adsFandomMobileArticleAds(String article) { String testedPage = urlBuilder.getUrlForFandomPage(article); AdsFandomObject wikiPage = new AdsFandomObject(driver, testedPage); getJquery(); wikiPage.verifyFandomMobileTopBoxad(); wikiPage.verifyFandomMobileArticleBottomLeaderboard(); }
Source:
<code>public static Integer getConceptIdForUnits(String units) { String appDataDir = OpenmrsUtil.getApplicationDataDirectory(); Properties props = new Properties(); String conceptId = null; File propFile; BufferedReader br; String propString; try { propFile = new File(appDataDir + System.getProperty("file.separator") + DatabaseUtil.ORDER_ENTRY_UPGRADE_SETTINGS_FILENAME); br = new BufferedReader(new FileReader(propFile)); propString = IOUtils.toString(br).replaceAll("[^\\S\\n]", "\\\\ "); props.load(new StringReader(propString)); for (Map.Entry prop : props.entrySet()) { if (prop.getKey().equals(units)) { conceptId = prop.getValue().toString(); if (conceptId != null) { return Integer.valueOf(conceptId); } else { return null; } } } } catch (NumberFormatException e) { throw new APIException("Your order entry upgrade settings file" + "contains invalid mapping from " + units + " to concept ID " + conceptId + ". ID must be an integer or null. Please refer to upgrade instructions for more details.", e); } catch (IOException e) { if (e instanceof FileNotFoundException) { throw new APIException("Unable to find file containing order entry upgrade settings in your " + "application data directory: " + appDataDir + "\nPlease refer to upgrade instructions for more details.", e); } else { throw new APIException(e); } } <START> <END> throw new APIException("Your order entry upgrade settings file" + " does not have mapping for " + units + ". Please refer to upgrade instructions for more details."); }</code><technical_language>need a finally clause close buffered reader if is null</technical_language>

Target:
public static Integer getConceptIdForUnits(String units) { String appDataDir = OpenmrsUtil.getApplicationDataDirectory(); Properties props = new Properties(); String conceptId = null; try { props.load(new FileInputStream(appDataDir + System.getProperty("file.separator") + DatabaseUtil.ORDER_ENTRY_UPGRADE_SETTINGS_FILENAME)); for (Map.Entry prop : props.entrySet()) { if (prop.getKey().equals(units)) { conceptId = prop.getValue().toString(); if (conceptId != null) { return Integer.valueOf(conceptId); } else { return null; } } } } catch (NumberFormatException e) { throw new APIException("Your order entry upgrade settings file" + "contains invalid mapping from " + units + " to concept ID " + conceptId + ". ID must be an integer or null. Please refer to upgrade instructions for more details.", e); } catch (IOException e) { if (e instanceof FileNotFoundException) { throw new APIException("Unable to find file containing order entry upgrade settings in your " + "application data directory: " + appDataDir + "\nPlease refer to upgrade instructions for more details.", e); } else { throw new APIException(e); } } throw new APIException("Your order entry upgrade settings file" + " does not have mapping for " + units + ". Please refer to upgrade instructions for more details."); }
Source:
<code>public static ReferenceSequenceFile getReferenceSequenceFile(final Path path, final boolean truncateNamesAtWhitespace, final boolean preferIndexed) { getFastaExtension(path); if (truncateNamesAtWhitespace && preferIndexed && canCreateIndexedFastaReader(path)) { try (final InputStream stream = new BufferedInputStream(Files.newInputStream(path))) { return (BlockCompressedInputStream.isValidFile(stream)) ? new BlockCompressedIndexedFastaSequenceFile(path) : new IndexedFastaSequenceFile(path); } <START> catch (final FileNotFoundException e) { <END> throw new IllegalStateException("Should never happen, because existence of files has been checked.", e); } catch (final IOException e) { throw new SAMException("Error opening FASTA: " + path, e); } } else { return new FastaSequenceFile(path, truncateNamesAtWhitespace); } }</code><technical_language>remove this case for FileNotFoundException fall general case</technical_language>

Target:
public static ReferenceSequenceFile getReferenceSequenceFile(final Path path, final boolean truncateNamesAtWhitespace, final boolean preferIndexed) { getFastaExtension(path); if (truncateNamesAtWhitespace && preferIndexed && canCreateIndexedFastaReader(path)) { try (final InputStream stream = new BufferedInputStream(Files.newInputStream(path))) { return (BlockCompressedInputStream.isValidFile(stream)) ? new BlockCompressedIndexedFastaSequenceFile(path) : new IndexedFastaSequenceFile(path); } catch (final IOException e) { throw new SAMException("Error opening FASTA: " + path, e); } } else { return new FastaSequenceFile(path, truncateNamesAtWhitespace); } }
Source:
<code>public void validateItemType(Item item, String bindingConfig) throws BindingConfigParseException { if (!(item instanceof SwitchItem || item instanceof StringItem || item instanceof NumberItem || item instanceof RollershutterItem || item instanceof ContactItem || item instanceof DimmerItem)) { <START> throw new BindingConfigParseException("item '" + item.getName() + "' is of type '" <END> + item.getClass().getSimpleName() + "', only Switch-, Number- and StringItems are allowed - please check your *.items configuration"); } }</code><technical_language>of changes supported item types, this throw message updated "Items of type supported."</technical_language>

Target:
public void validateItemType(Item item, String bindingConfig) throws BindingConfigParseException { if (!(item instanceof SwitchItem || item instanceof StringItem || item instanceof NumberItem || item instanceof RollershutterItem || item instanceof ContactItem || item instanceof DimmerItem)) { throw new BindingConfigParseException("Item '" + item.getName() + "' is of type '" + item.getClass().getSimpleName() + "', only Switch-, Number-, Rollershutter-, Contact-, Dimmer- and StringItems are allowed - please check your *.items configuration"); } }
Source:
<code>protected void startUpdateCheck() { try { updateTask = UpdateTask.getNewInstance(); updateTask.startPinnedNotification(this); updateTask.registerTaskListener(this); } catch (IllegalStateException e) { connectToRunningTask(); return; } catch (TaskListenerRegistrationException e) { enterErrorState("Attempting to register a TaskListener to an " + "already registered task."); return; } String ref = ResourceInstallUtils.getDefaultProfileRef(); <START> String newestRef = ResourceInstallUtils.getLatestProfileRef(); <END> updateTask.execute(newestRef); uiController.downloadingUiState(); }</code><technical_language>guessing want this in alternative update path, opposed replacing default update behavior</technical_language>

Target:
protected void startUpdateCheck() { try { updateTask = UpdateTask.getNewInstance(); updateTask.startPinnedNotification(this); updateTask.registerTaskListener(this); } catch (IllegalStateException e) { connectToRunningTask(); return; } catch (TaskListenerRegistrationException e) { enterErrorState("Attempting to register a TaskListener to an " + "already registered task."); return; } String ref = ResourceInstallUtils.getDefaultProfileRef(); if(DeveloperPreferences.isUseDevFormsEnabled()) { ref = ResourceInstallUtils.getLatestProfileRef(); } updateTask.execute(ref); uiController.downloadingUiState(); }
Source:
<code>private static Map<String, ModuleService> loadModules(Class cls) { Map<String, ModuleService> modules = new HashMap<>(); if(cls != null) { Map<String, ExtensionProxy> proxies = new HashMap<>(); <START> ExtMap context = new ExtMap().mput(Base.GlobalContextKeys.EXTENSIONS_MAP, proxies); <END> ServiceLoader<ModuleService> loader = ServiceLoader.load(cls); for (ModuleService module : loader) { modules.put(module.getName(), module); module.setContext(context); } } return modules; }</code><technical_language>I get it... this is context, key is private. do need this? loaded extensions reference other global base. need figure out is required in context</technical_language>

Target:
private static Map<String, ModuleService> loadModules(Class cls) { Map<String, ModuleService> modules = new HashMap<>(); if(cls != null) { Map<String, ExtensionProxy> proxies = new HashMap<>(); ExtMap context = new ExtMap().mput(ModuleService.EXTENSIONS_MAP, proxies); ServiceLoader<ModuleService> loader = ServiceLoader.load(cls); for (ModuleService module : loader) { modules.put(module.getName(), module); module.setContext(context); } } return modules; }
Source:
<code>protected static InitialContext createJNDIContextFromServer0() throws NamingException { final Properties env = new Properties(); env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory"); <START> env.put(Context.PROVIDER_URL, System.getProperty(Context.PROVIDER_URL, "http-remoting://127.0.0.1:8080")); <END> env.put(Context.SECURITY_PRINCIPAL, "guest"); env.put(Context.SECURITY_CREDENTIALS, "guest"); return new InitialContext(env); }</code><technical_language>This hard coded host names, fail IPv6</technical_language>

Target:
protected static InitialContext createJNDIContextFromServer0() throws NamingException { final Properties env = new Properties(); env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory"); env.put(Context.PROVIDER_URL, "http-remoting://" + TestSuiteEnvironment.getServerAddress() + ":8080"); env.put(Context.SECURITY_PRINCIPAL, "guest"); env.put(Context.SECURITY_CREDENTIALS, "guest"); return new InitialContext(env); }
Source:
<code>public static StatusCode login() { final ImmutablePair<String, String> login = Settings.getGCVoteLogin(); if (login == null) { Log.e("Credentials can't be retreived"); return StatusCode.NO_LOGIN_INFO_STORED; } <START> if (StringUtils.isEmpty(login.left) || StringUtils.isEmpty(login.right)) { <END> Log.e("GCVote login information is not stored"); return StatusCode.NO_LOGIN_INFO_STORED; } final Parameters params = new Parameters("version", "cgeo"); params.put("userName", login.left, "password", login.right); final InputStream response = Network.getResponseStream(Network.getRequest("<LINK_0>", params)); boolean loggedIn = false; try { final XmlPullParserFactory factory = XmlPullParserFactory.newInstance(); final XmlPullParser xpp = factory.newPullParser(); xpp.setInput(response, Charsets.UTF_8.name()); int eventType = xpp.getEventType(); while (eventType != XmlPullParser.END_DOCUMENT) { if (eventType == XmlPullParser.START_TAG) { final String tagName = xpp.getName(); if (StringUtils.equals(tagName, "votes")) { loggedIn = StringUtils.equals(xpp.getAttributeValue(null, "loggedIn"), "true"); break; } } eventType = xpp.next(); } } catch (final Exception e) { Log.e("Cannot parse GCVote result", e); return StatusCode.UNKNOWN_ERROR; } if (loggedIn) { Log.i("Successfully logged in gcvote.com as " + login.left); return StatusCode.NO_ERROR; } else { Log.e("Username or password is wrong"); return StatusCode.WRONG_LOGIN_DATA; } }</code><technical_language>If empty, blank, checked in Settings.getGCVoteLogin(). returns null returns potentially valid credentials</technical_language>

Target:
public static StatusCode login() { final ImmutablePair<String, String> login = Settings.getGCVoteLogin(); if (login == null) { Log.e("Credentials can't be retreived"); return StatusCode.NO_LOGIN_INFO_STORED; } final Parameters params = new Parameters("version", "cgeo", "userName", login.left, "password", login.right); final InputStream response = Network.getResponseStream(Network.getRequest("<LINK_0>", params)); try { final XmlPullParserFactory factory = XmlPullParserFactory.newInstance(); final XmlPullParser xpp = factory.newPullParser(); xpp.setInput(response, Charsets.UTF_8.name()); int eventType = xpp.getEventType(); while (eventType != XmlPullParser.END_DOCUMENT) { if (eventType == XmlPullParser.START_TAG) { final String tagName = xpp.getName(); if (StringUtils.equals(tagName, "votes")) { if (StringUtils.equals(xpp.getAttributeValue(null, "loggedIn"), "true")) { Log.i("Successfully logged in gcvote.com as " + login.left); return StatusCode.NO_ERROR; } else { Log.e("Username or password is wrong"); return StatusCode.WRONG_LOGIN_DATA; } } } eventType = xpp.next(); } } catch (final Exception e) { Log.e("Cannot parse GCVote result", e); return StatusCode.UNKNOWN_ERROR; } return StatusCode.UNKNOWN_ERROR; }
Source:
<code>private String getPoolVmTooltip(VmType vmType) { switch (vmType) { case Server: return constants.pooledServer(); case Desktop: return constants.pooledDesktop(); default: <START> return ""; END> } }</code><technical_language>please this consistent getPoolVmImageResource default case is fallthrough of Desktop</technical_language>

Target:
private String getPoolVmTooltip(VmType vmType) { switch (vmType) { case Server: return constants.pooledServer(); case Desktop: return constants.pooledDesktop(); default: return constants.pooledDesktop(); } }
Source:
<code>public void init(ScrollRequest scrollRequest, Map<String, String> map) { if (!(scrollRequest instanceof GenericScrollRequest)) { throw new IllegalArgumentException( "Requires a GenericScrollRequest got a " + scrollRequest.getClass().getCanonicalName()); } GenericScrollRequest request = (GenericScrollRequest) scrollRequest; File file = new File(request.getQuery()); size = request.getSize(); try { iterator = FileUtils.lineIterator(file, "UTF-8"); } catch (IOException e) { throw new IllegalArgumentException("Invalid file " + file, e); } <START> log.info("Scroll init: {}, size: {]", file.getAbsolutePath(), size); <END> }</code><technical_language>suggestion log.info("Scroll init: {}, size: {}", file.getAbsolutePath(), size);</technical_language>

Target:
public void init(ScrollRequest scrollRequest, Map<String, String> map) { if (!(scrollRequest instanceof GenericScrollRequest)) { throw new IllegalArgumentException( "Requires a GenericScrollRequest got a " + scrollRequest.getClass().getCanonicalName()); } GenericScrollRequest request = (GenericScrollRequest) scrollRequest; File file = new File(request.getQuery()); size = request.getSize(); try { iterator = FileUtils.lineIterator(file, "UTF-8"); } catch (IOException e) { throw new IllegalArgumentException("Invalid file " + file, e); } log.info("Scroll init: {}, size: {}", file.getAbsolutePath(), size); }
Source:
<code>public synchronized void remove(int n) throws IOException { if (isEmpty()) throw new NoSuchElementException(); if (n > elementCount) { throw new IllegalArgumentException( "Cannot remove more elements (" + n + ") than present in queue (" + elementCount + ")."); } <START> if (n < 1) { <END> throw new IllegalArgumentException( "Cannot remove a non-positive (" + n + ") number of elements."); } if (n == elementCount) { clear(); return; } final int eraseStartPosition = first.position; int eraseTotalLength = 0; int newFirstPosition = first.position; int newFirstLength = first.length; for (int i = 0; i < n; i++) { eraseTotalLength += Element.HEADER_LENGTH + newFirstLength; newFirstPosition = wrapPosition(newFirstPosition + Element.HEADER_LENGTH + newFirstLength); ringRead(newFirstPosition, buffer, 0, Element.HEADER_LENGTH); newFirstLength = readInt(buffer, 0); } writeHeader(fileLength, elementCount - n, newFirstPosition, last.position); elementCount -= n; first = new Element(newFirstPosition, newFirstLength); ringErase(eraseStartPosition, eraseTotalLength); }</code><technical_language>0 a no-op erroring</technical_language>

Target:
public synchronized void remove(int n) throws IOException { if (isEmpty()) { throw new NoSuchElementException(); } if (n < 0) { throw new IllegalArgumentException("Cannot remove negative (" + n + ") number of elements."); } if (n == 0) { return; } if (n == elementCount) { clear(); return; } if (n > elementCount) { throw new IllegalArgumentException( "Cannot remove more elements (" + n + ") than present in queue (" + elementCount + ")."); } final int eraseStartPosition = first.position; int eraseTotalLength = 0; int newFirstPosition = first.position; int newFirstLength = first.length; for (int i = 0; i < n; i++) { eraseTotalLength += Element.HEADER_LENGTH + newFirstLength; newFirstPosition = wrapPosition(newFirstPosition + Element.HEADER_LENGTH + newFirstLength); ringRead(newFirstPosition, buffer, 0, Element.HEADER_LENGTH); newFirstLength = readInt(buffer, 0); } writeHeader(fileLength, elementCount - n, newFirstPosition, last.position); elementCount -= n; first = new Element(newFirstPosition, newFirstLength); ringErase(eraseStartPosition, eraseTotalLength); }
Source:
<code>public void showAlertDialog(String title, String message) { AlertDialog.Builder dialog = new AlertDialog.Builder(getActivity()); dialog.setTitle(title); <START> dialog.setMessage(message).setCancelable(false).setPositiveButton(R.string.ok, new <END> DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.dismiss(); } }).create().show(); }</code><technical_language>is a string defined name dialog_action_ok</technical_language>

Target:
public void showAlertDialog(String title, String message) { new MaterialDialog.Builder().init(getActivity()) .setTitle(title) .setMessage(message) .setCancelable(false) .setPositiveButton(getStringMessage(R.string.dialog_action_ok), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.dismiss(); } }) .createMaterialDialog() .show(); }
Source:
<code><START> public void init() throws Exception { <END> int portOffset = 1; int idleTime = 1; serverPropertyMap.put("-DportOffset", Integer.toString(portOffset)); serverPropertyMap.put("-Dtenant.idle.time", Integer.toString(idleTime)); AutomationContext autoCtx = new AutomationContext(); CarbonTestServerManager server = new CarbonTestServerManager(autoCtx, System.getProperty("carbon.zip"), serverPropertyMap); manager.startServers(server); UserPopulator userPopulator = new UserPopulator("AS", "appServerInstance0002"); userPopulator.populateUsers(); }</code><technical_language>Thow applicable exceptions</technical_language>

Target:
public void init() throws Exception { int portOffset = 1; int idleTime = 1; serverPropertyMap.put("-DportOffset", Integer.toString(portOffset)); serverPropertyMap.put("-Dtenant.idle.time", Integer.toString(idleTime)); AutomationContext autoCtx = new AutomationContext(); CarbonTestServerManager server = new CarbonTestServerManager(autoCtx, System.getProperty("carbon.zip"), serverPropertyMap); asServerManager.startServers(server); UserPopulator userPopulator = new UserPopulator(ASIntegrationConstants.AS_PRODUCT_GROUP, ASIntegrationConstants.AS_INSTANCE_0002); userPopulator.populateUsers(); }
Source:
<code><START> public static void openInCompare(RevCommit commit1, <END> RevCommit commit2, String commit1Path, String commit2Path, Repository repository, IWorkbenchPage workBenchPage) { final ITypedElement base = CompareUtils .getFileRevisionTypedElement(commit1Path, commit1, repository); final ITypedElement next = CompareUtils .getFileRevisionTypedElement(commit2Path, commit2, repository); CompareEditorInput in = new GitCompareFileRevisionEditorInput(base, next, repository, null); CompareUtils.openInCompareEditor(workBenchPage, in); }</code><technical_language>avoid unrelated formatting changes</technical_language>

Target:
public static void openInCompare(RevCommit commit1, RevCommit commit2, String commit1Path, String commit2Path, Repository repository, IWorkbenchPage workBenchPage) { final ITypedElement base = CompareUtils .getFileRevisionTypedElement(commit1Path, commit1, repository); final ITypedElement next = CompareUtils .getFileRevisionTypedElement(commit2Path, commit2, repository); CompareEditorInput in = new GitCompareFileRevisionEditorInput(base, next, null); CompareUtils.openInCompare(workBenchPage, repository, in); }
Source:
<code>public UploadStatistics applyDeltaCodeSystemsRemove(String theSystem, CustomTerminologySet theValue) { <START> validateDstu3OrNewer(); <END> TermCodeSystem cs = myCodeSystemDao.findByCodeSystemUri(theSystem); if (cs == null) { throw new InvalidRequestException("Unknown code system: " + theSystem); } AtomicInteger removeCounter = new AtomicInteger(0); for (TermConcept nextSuppliedConcept : theValue.getRootConcepts()) { Optional<TermConcept> conceptOpt = myTerminologySvc.findCode(theSystem, nextSuppliedConcept.getCode()); if (conceptOpt.isPresent()) { TermConcept concept = conceptOpt.get(); deleteConceptChildrenAndConcept(concept, removeCounter); } } IIdType target = cs.getResource().getIdDt(); return new UploadStatistics(removeCounter.get(), target); }</code><technical_language>Add of these? java ValidateUtil.isNotBlankOrThrowInvalidRequest(theSystem, "No system provided");</technical_language>

Target:
public UploadStatistics applyDeltaCodeSystemsRemove(String theSystem, CustomTerminologySet theValue) { ValidateUtil.isNotBlankOrThrowInvalidRequest(theSystem, "No system provided"); validateDstu3OrNewer(); TermCodeSystem cs = myCodeSystemDao.findByCodeSystemUri(theSystem); if (cs == null) { throw new InvalidRequestException("Unknown code system: " + theSystem); } AtomicInteger removeCounter = new AtomicInteger(0); for (TermConcept nextSuppliedConcept : theValue.getRootConcepts()) { Optional<TermConcept> conceptOpt = myTerminologySvc.findCode(theSystem, nextSuppliedConcept.getCode()); if (conceptOpt.isPresent()) { TermConcept concept = conceptOpt.get(); deleteConceptChildrenAndConcept(concept, removeCounter); } } IIdType target = cs.getResource().getIdDt(); return new UploadStatistics(removeCounter.get(), target); }
Source:
<code>public static <TSource, TInner, TKey, TResult> Enumerable<TResult> hashJoin( Enumerable<TSource> outer, Enumerable<TInner> inner, Function1<TSource, TKey> outerKeySelector, Function1<TInner, TKey> innerKeySelector, Function2<TSource, TInner, TResult> resultSelector, EqualityComparer<TKey> comparer, boolean generateNullsOnLeft, boolean generateNullsOnRight) { return hashJoin_( outer, inner, outerKeySelector, innerKeySelector, resultSelector, comparer, generateNullsOnLeft, <START> generateNullsOnRight, null); <END> }</code><technical_language>minor: consistent style-wise, null in a new line (same predicate in line 1081)</technical_language>

Target:
public static <TSource, TInner, TKey, TResult> Enumerable<TResult> hashJoin( Enumerable<TSource> outer, Enumerable<TInner> inner, Function1<TSource, TKey> outerKeySelector, Function1<TInner, TKey> innerKeySelector, Function2<TSource, TInner, TResult> resultSelector, EqualityComparer<TKey> comparer, boolean generateNullsOnLeft, boolean generateNullsOnRight) { return hashEquiJoin_( outer, inner, outerKeySelector, innerKeySelector, resultSelector, comparer, generateNullsOnLeft, generateNullsOnRight); }
Source:
<code>public void testCacheConfigUsage() { <START> DefaultCacheEventListenerConfiguration cacheEventListenerConfiguration = new DefaultCacheEventListenerConfiguration(ListenerObject.class); <END> cacheEventListenerConfiguration.setEventsToFireOn(ListenerObject.fireOn()); cacheEventListenerConfiguration.setEventOrderingMode(ListenerObject.eventOrdering()); cacheEventListenerConfiguration.setEventFiringMode(ListenerObject.eventFiring()); final CacheManager manager = CacheManagerBuilder.newCacheManagerBuilder() .withCache("foo", CacheConfigurationBuilder.newCacheConfigurationBuilder() .addServiceConfig(cacheEventListenerConfiguration) .buildConfig(Object.class, Object.class)).build(); final Collection<?> bar = manager.getCache("foo", Object.class, Object.class).getRuntimeConfiguration().getServiceConfigurations(); assertThat(bar.iterator().next().getClass().toString(), is(ListenerObject.object.toString())); }</code><technical_language>a builder for a listener configuration? Also, calling a test object instead of enums code clear</technical_language>

Target:
public void testCacheConfigUsage() { Set<EventType> eventTypeSet = new HashSet<EventType>(); eventTypeSet.add(EventType.CREATED); eventTypeSet.add(EventType.UPDATED); DefaultCacheEventListenerBuilder listenerBuilder = DefaultCacheEventListenerBuilder.newCacheEventListenerBuilder(); listenerBuilder.withEventsToFireOn(EnumSet.copyOf(eventTypeSet)); listenerBuilder.withEventOrdering(EventOrdering.UNORDERED); listenerBuilder.withEventFiringMode(EventFiring.ASYNCHRONOUS); DefaultCacheEventListenerConfiguration cacheEventListenerConfiguration = listenerBuilder.build(ListenerObject.class); final CacheManager manager = CacheManagerBuilder.newCacheManagerBuilder() .withCache("foo", CacheConfigurationBuilder.newCacheConfigurationBuilder() .addServiceConfig(cacheEventListenerConfiguration) .buildConfig(Object.class, Object.class)).build(true); final Collection<?> bar = manager.getCache("foo", Object.class, Object.class).getRuntimeConfiguration().getServiceConfigurations(); assertThat(bar.iterator().next().getClass().toString(), is(ListenerObject.object.toString())); }