auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void update(Config source) { for (Config config : configs) { if (StringUtils.equals(config.getName(), source.getName())) { config.setOpenMrsUrl(source.getOpenMrsUrl()); config.setUsername(source.getUsername()); config.setPassword(source.getPassword()); config.setMotechPatientIdentifierTypeName(source.getMotechPatientIdentifierTypeName()); config.getPatientIdentifierTypeNames().clear(); config.getPatientIdentifierTypeNames().addAll(source.getPatientIdentifierTypeNames()); return; } } throw new ConfigurationNotFoundException(source.getName()); }

Target:
public void update(Config source) { for (Config config : configs) { if (StringUtils.equals(config.getName(), source.getName())) { config.setOpenMrsUrl(source.getOpenMrsUrl()); config.setUsername(source.getUsername()); config.setPassword(source.getPassword()); config.setMotechPatientIdentifierTypeName(source.getMotechPatientIdentifierTypeName()); config.setPatientIdentifierTypeNames(source.getPatientIdentifierTypeNames()); return; } } throw new ConfigurationNotFoundException(source.getName()); }
Source:
public void updateConsumer( @PathParam("consumer_uuid") @Verify(Consumer.class) String uuid, @ApiParam(name = "consumer", required = true) ConsumerDTO dto, @Context Principal principal) { Consumer toUpdate = consumerCurator.verifyAndLookupConsumer(uuid); dto.setUuid(uuid); this.sanitizeConsumerFacts(dto); ConsumerType toUpdateType = this.consumerTypeCurator.getConsumerType(toUpdate); boolean isShare = dto.getType() != null && dto.getType().getLabel() != null && dto.getType().getLabel().equals("share"); if (toUpdateType.isType(ConsumerTypeEnum.SHARE) || isShare) { validateShareConsumerUpdate(toUpdate, dto, principal); } GuestMigration guestMigration = migrationProvider.get(); guestMigration.buildMigrationManifest(dto, toUpdate); if (performConsumerUpdates(dto, toUpdate, guestMigration)) { try { if (guestMigration.isMigrationPending()) { guestMigration.migrate(); } else { consumerCurator.update(toUpdate); } } catch (CandlepinException ce) { throw ce; } catch (Exception e) { log.error("Problem updating unit:", e); throw new BadRequestException(i18n.tr("Problem updating unit {0}", dto)); } } }

Target:
public void updateConsumer( @PathParam("consumer_uuid") @Verify(Consumer.class) String uuid, @ApiParam(name = "consumer", required = true) ConsumerDTO dto, @Context Principal principal) { Consumer toUpdate = consumerCurator.verifyAndLookupConsumer(uuid); dto.setUuid(uuid); this.sanitizeConsumerFacts(dto); ConsumerType toUpdateType = this.consumerTypeCurator.getConsumerType(toUpdate); if (toUpdateType.isType(ConsumerTypeEnum.SHARE)) { validateShareConsumerUpdate(toUpdate, dto, principal); } GuestMigration guestMigration = migrationProvider.get(); guestMigration.buildMigrationManifest(dto, toUpdate); if (performConsumerUpdates(dto, toUpdate, guestMigration)) { try { if (guestMigration.isMigrationPending()) { guestMigration.migrate(); } else { consumerCurator.update(toUpdate); } } catch (CandlepinException ce) { throw ce; } catch (Exception e) { log.error("Problem updating unit:", e); throw new BadRequestException(i18n.tr("Problem updating unit {0}", dto)); } } }
Source:
public Statement createBootstrapScriptForGroup(String group, @Nullable String nodeName) { return groupToBootScript.apply(group, null); }

Target:
public Statement createBootstrapScriptForGroup(String group, @Nullable String nodeName) { return groupToBootScript.apply(group, nodeName); }
Source:
public ChangeAttribute asChangeAttribute(final Change change) { ChangeAttribute a = new ChangeAttribute(); a.project = change.getProject().get(); a.branch = change.getDest().getShortName(); a.topic = change.getTopic(); a.id = change.getKey().get(); a.number = change.getId().toString(); a.subject = change.getSubject(); try { ChangeData cd = new ChangeData(change); a.commitMessage = cd.commitMessage(repoManager, db); } catch (OrmException e) { } catch (IOException e) { } a.url = getChangeUrl(change); a.owner = asAccountAttribute(change.getOwner()); a.status = change.getStatus(); return a; }

Target:
public ChangeAttribute asChangeAttribute(final Change change) { ChangeAttribute a = new ChangeAttribute(); a.project = change.getProject().get(); a.branch = change.getDest().getShortName(); a.topic = change.getTopic(); a.id = change.getKey().get(); a.number = change.getId().toString(); a.subject = change.getSubject(); try { a.commitMessage = new ChangeData(change).commitMessage(repoManager, db); } catch (Exception e) { log.error("Error while getting full commit message for" + " change " + a.number); } a.url = getChangeUrl(change); a.owner = asAccountAttribute(change.getOwner()); a.status = change.getStatus(); return a; }
Source:
protected void clean(IProgressMonitor monitor) throws CoreException { try { IProject myProject = getProject(); BuilderPlugin.clearComponentMarkers(myProject); final Project model; try { model = Central.getProject(myProject); } catch (Exception e) { MarkerSupport markers = new MarkerSupport(myProject); markers.deleteMarkers("*"); markers.createMarker(null, IMarker.SEVERITY_ERROR, "Cannot find bnd project", BndtoolsConstants.MARKER_BND_PATH_PROBLEM); return; } if (model == null) return; try { Central.bndCall(new Callable<Void>() { @Override public Void call() throws Exception { model.clean(); return null; } }, monitor); } catch (TimeoutException | InterruptedException e) { logger.logWarning("Unable to clean project " + myProject.getName(), e); return; } IFolder targetFolder = myProject.getFolder(calculateTargetDirPath(model)); targetFolder.refreshLocal(IResource.DEPTH_INFINITE, monitor); } catch (Exception e) { throw new CoreException(new Status(IStatus.ERROR, PLUGIN_ID, 0, "Build Error!", e)); } }

Target:
protected void clean(IProgressMonitor monitor) throws CoreException { try { IProject myProject = getProject(); final Project model; try { model = Central.getProject(myProject); } catch (Exception e) { MarkerSupport markers = new MarkerSupport(myProject); markers.deleteMarkers("*"); markers.createMarker(null, IMarker.SEVERITY_ERROR, "Cannot find bnd project", BndtoolsConstants.MARKER_BND_PATH_PROBLEM); return; } if (model == null) return; try { Central.bndCall(new Callable<Void>() { @Override public Void call() throws Exception { model.clean(); return null; } }, monitor); } catch (TimeoutException | InterruptedException e) { logger.logWarning("Unable to clean project " + myProject.getName(), e); return; } IFolder targetFolder = myProject.getFolder(calculateTargetDirPath(model)); targetFolder.refreshLocal(IResource.DEPTH_INFINITE, monitor); } catch (Exception e) { throw new CoreException(new Status(IStatus.ERROR, PLUGIN_ID, 0, "Build Error!", e)); } }
Source:
public BuildTrigger(IBuild build, IClient client) { this.resource = build; this.client = client; this.subresource = BUILD_SUBRESOURCE; this.causes = new ArrayList<String>(); }

Target:
public BuildTrigger(IBuild build, IClient client) { this.resource = build; this.client = client; this.subresource = BUILD_SUBRESOURCE; this.causes = new ArrayList<>(); }
Source:
private LogReplicationConfig getLogReplicationConfiguration(CorfuRuntime runtime) { LogReplicationStreamNameTableManager replicationStreamNameTableManager = new LogReplicationStreamNameTableManager(runtime, serverContext.getPluginConfigFilePath()); Set<String> streamsToReplicate = replicationStreamNameTableManager.getStreamsToReplicate(); boolean upgraded = replicationStreamNameTableManager .isUpgraded(); if (upgraded) { input(new DiscoveryServiceEvent(DiscoveryServiceEvent.DiscoveryServiceEventType.UPGRADE)); } return new LogReplicationConfig(streamsToReplicate, serverContext.getMaxNumSnapshotDataMsgPerCycle(), serverContext.getLogReplicationMaxDataMessageSize()); }

Target:
private LogReplicationConfig getLogReplicationConfiguration(CorfuRuntime runtime) { LogReplicationStreamNameTableManager replicationStreamNameTableManager = new LogReplicationStreamNameTableManager(runtime, serverContext.getPluginConfigFilePath()); Set<String> streamsToReplicate = replicationStreamNameTableManager.getStreamsToReplicate(); boolean upgraded = replicationStreamNameTableManager .isUpgraded(); if (upgraded) { input(new DiscoveryServiceEvent(DiscoveryServiceEvent.DiscoveryServiceEventType.UPGRADE)); } return new LogReplicationConfig(streamsToReplicate, serverContext.getMaxNumMsgPerBatch(), serverContext.getLogReplicationMaxDataMessageSize()); }
Source:
private ContentTypeConvertingInterceptor(String contentType, boolean input) { this.contentType = contentType; this.mimeType = MessageConverterUtils.getMimeType(contentType); this.input = input; if (MessageConverterUtils.X_JAVA_OBJECT.includes(this.mimeType)) { this.klazz = MessageConverterUtils .getJavaTypeForJavaObjectContentType(this.mimeType); } else if (this.mimeType.equals(MessageConverterUtils.X_SPRING_TUPLE)) { this.klazz = Tuple.class; } else if (this.mimeType.getType().equals("text") || this.mimeType.getSubtype().equals( "json") || this.mimeType.getSubtype().equals("xml")) { this.klazz = String.class; } else { this.klazz = byte[].class; } this.messageConverter = MessageConverterConfigurer.this.compositeMessageConverterFactory .getMessageConverterForType(this.mimeType); }

Target:
private ContentTypeConvertingInterceptor(String contentType, boolean input) { this.contentType = contentType; this.mimeType = MessageConverterUtils.getMimeType(contentType); this.input = input; if (MessageConverterUtils.X_JAVA_OBJECT.equals(this.mimeType)) { this.klazz = MessageConverterUtils .getJavaTypeForJavaObjectContentType(this.mimeType); } else if (this.mimeType.equals(MessageConverterUtils.X_SPRING_TUPLE)) { this.klazz = Tuple.class; } else if (this.mimeType.getType().equals("text") || this.mimeType.getSubtype().equals( "json") || this.mimeType.getSubtype().equals("xml")) { this.klazz = String.class; } else { this.klazz = byte[].class; } this.messageConverter = MessageConverterConfigurer.this.compositeMessageConverterFactory .getMessageConverterForType(this.mimeType); }
Source:
public SetupTemplateContributionItem() { super(new SetupTemplateAction()); editor = (JSPMultiPageEditor) PlatformUI .getWorkbench().getActiveWorkbenchWindow().getActivePage() .getActiveEditor(); this.sourceEditor = editor.getSourceEditor(); IVisualEditor visualEditor = editor.getVisualEditor(); IVisualController controller = visualEditor != null ? visualEditor.getController() : null; if (controller != null && controller instanceof VpeController) { this.vpeController = (VpeController) controller; this.pageContext = (VpePageContext) vpeController.getPageContext(); } else { this.vpeController = null; this.pageContext = null; } getAction().setPageContext(pageContext); }

Target:
public SetupTemplateContributionItem() { super(new SetupTemplateAction()); editor = (JSPMultiPageEditor) PlatformUI .getWorkbench().getActiveWorkbenchWindow().getActivePage() .getActiveEditor(); this.sourceEditor = editor.getSourceEditor(); IVisualEditor visualEditor = editor.getVisualEditor(); IVisualController controller = visualEditor != null ? visualEditor.getController() : null; if (controller instanceof VpeController) { this.vpeController = (VpeController) controller; this.pageContext = (VpePageContext) vpeController.getPageContext(); } else { this.vpeController = null; this.pageContext = null; } getAction().setPageContext(pageContext); }
Source:
protected Election createElectionAlgorithm(int electionAlgorithm) { Election le = null; switch (electionAlgorithm) { case 3: QuorumCnxManager qcm = createCnxnManager(); QuorumCnxManager oldQcm = qcmRef.getAndSet(qcm); if (oldQcm != null) { LOG.warn("Clobbering already-set QuorumCnxManager (restarting leader election?)"); oldQcm.halt(); } QuorumCnxManager.Listener listener = qcm.listener; if (listener != null) { listener.start(); FastLeaderElection fle = new FastLeaderElection(this, qcm); fle.start(); le = fle; } else { LOG.error("Null listener when initializing cnx manager"); } break; default: assert false; } return le; }

Target:
protected Election createElectionAlgorithm(int electionAlgorithm) { Election le = null; switch (electionAlgorithm) { case 1: throw new UnsupportedOperationException("Election Algorithm 1 is not supported."); case 2: throw new UnsupportedOperationException("Election Algorithm 2 is not supported."); case 3: QuorumCnxManager qcm = createCnxnManager(); QuorumCnxManager oldQcm = qcmRef.getAndSet(qcm); if (oldQcm != null) { LOG.warn("Clobbering already-set QuorumCnxManager (restarting leader election?)"); oldQcm.halt(); } QuorumCnxManager.Listener listener = qcm.listener; if (listener != null) { listener.start(); FastLeaderElection fle = new FastLeaderElection(this, qcm); fle.start(); le = fle; } else { LOG.error("Null listener when initializing cnx manager"); } break; default: assert false; } return le; }
Source:
public void afterPhase(PhaseEvent event) { FacesContext facesContext = event.getFacesContext(); String currentPage = facesContext.getViewRoot().getViewId(); LOG.debug("current page: ".concat(currentPage)); HttpSession session = (HttpSession) facesContext.getExternalContext().getSession(false); UserLogin currentUser = null; if (session != null) { currentUser = (UserLogin) session.getAttribute(USER_INFO_SESSION_ATTRIBUTE); } validateCSRFToken(event); if (!noLoginRequiredPages.contains(currentPage) && currentUser == null) { LOG.debug("login required and current user is null, redirecting to login page."); NavigationHandler nh = facesContext.getApplication().getNavigationHandler(); nh.handleNavigation(facesContext, null, NavigationConstant.LOGIN_PAGE); } else { boolean hasRolePermission = roleService.checkRole(formatPageName(currentPage), currentUser); boolean isConfigured = checkConfiguredDisplay(formatPageName(currentPage)); if (currentUser != null && (hasRolePermission == false || isConfigured == false)) { LOG.debug("User, " + currentUser.getUserName() + " can not access given page: " + currentPage); NavigationHandler nh = facesContext.getApplication().getNavigationHandler(); nh.handleNavigation(facesContext, null, NavigationConstant.STATUS_PAGE); } } }

Target:
public void afterPhase(PhaseEvent event) { FacesContext facesContext = event.getFacesContext(); String currentPage = facesContext.getViewRoot().getViewId(); LOG.debug("current page: ".concat(currentPage)); HttpSession session = (HttpSession) facesContext.getExternalContext().getSession(false); UserLogin currentUser = null; if (session != null) { currentUser = (UserLogin) session.getAttribute(USER_INFO_SESSION_ATTRIBUTE); } validateCsrfToken(event); if (!noLoginRequiredPages.contains(currentPage) && currentUser == null) { LOG.debug("login required and current user is null, redirecting to login page."); NavigationHandler nh = facesContext.getApplication().getNavigationHandler(); nh.handleNavigation(facesContext, null, NavigationConstant.LOGIN_PAGE); } else { boolean hasRolePermission = roleService.checkRole(formatPageName(currentPage), currentUser); boolean isConfigured = checkConfiguredDisplay(formatPageName(currentPage)); if (currentUser != null && (hasRolePermission == false || isConfigured == false)) { LOG.debug("User, " + currentUser.getUserName() + " can not access given page: " + currentPage); NavigationHandler nh = facesContext.getApplication().getNavigationHandler(); nh.handleNavigation(facesContext, null, NavigationConstant.STATUS_PAGE); } } }
Source:
public void testLatchSizeN() { final int latchSize = 1; final String latchId = "testLatchSizeN"; ExecutorService pool = Executors.newFixedThreadPool(3); Future f1 = pool.submit(getParticipantRunnable(latchSize, latchId, "participant1")); Future f2 = pool.submit(getParticipantRunnable(latchSize, latchId, "participant2")); Future f3 = pool.submit(getParticipantRunnable(latchSize, latchId, "participant3")); try { f1.get(30, TimeUnit.SECONDS); f2.get(30, TimeUnit.SECONDS); f3.get(30, TimeUnit.SECONDS); } catch (Exception e) { Assert.fail("failed to get future." + e.getLocalizedMessage()); } finally { pool.shutdownNow(); } try { List<String> latchParticipants = testZkUtils.getZkClient().getChildren( String.format("%s/%s_%s", KEY_BUILDER.getRootPath(), ZkProcessorLatch.LATCH_PATH, latchId)); Assert.assertNotNull(latchParticipants); Assert.assertEquals(3, latchParticipants.size()); } catch (Exception e) { Assert.fail("Failed to read the latch status from ZK directly" + e.getLocalizedMessage()); } }

Target:
public void testLatchSizeN() { final int latchSize = 3; final String latchId = "testLatchSizeN"; ExecutorService pool = Executors.newFixedThreadPool(3); Future f1 = pool.submit(getParticipantRunnable(latchSize, latchId, "participant1")); Future f2 = pool.submit(getParticipantRunnable(latchSize, latchId, "participant2")); Future f3 = pool.submit(getParticipantRunnable(latchSize, latchId, "participant3")); try { f1.get(30, TimeUnit.SECONDS); f2.get(30, TimeUnit.SECONDS); f3.get(30, TimeUnit.SECONDS); } catch (Exception e) { Assert.fail("failed to get future." + e.getLocalizedMessage()); } finally { pool.shutdownNow(); } try { List<String> latchParticipants = testZkUtils.getZkClient().getChildren( String.format("%s/%s_%s", KEY_BUILDER.getRootPath(), ZkProcessorLatch.LATCH_PATH, latchId)); Assert.assertNotNull(latchParticipants); Assert.assertEquals(3, latchParticipants.size()); } catch (Exception e) { Assert.fail("Failed to read the latch status from ZK directly" + e.getLocalizedMessage()); } }
Source:
public Repository getRepository(final IResource resource) { Repository[] repositories = org.eclipse.egit.core.Activator .getDefault().getRepositoryCache().getAllRepositories(); Repository repository = null; int segmentCount = 0; for (Repository r : repositories) { if (!r.isBare()) { try { IPath repoPath = new Path(r.getWorkTree() .getCanonicalPath()); IPath location = resource.getLocation(); if (location != null && repoPath.isPrefixOf(resource.getLocation())) { if (repository == null || repoPath.segmentCount() > segmentCount) { repository = r; segmentCount = repoPath.segmentCount(); } } } catch (IOException e) { Activator .error("looking up working tree path of git repository failed", e); } } } return repository; }

Target:
public Repository getRepository(final IResource resource) { Repository[] repositories = org.eclipse.egit.core.Activator .getDefault().getRepositoryCache().getAllRepositories(); Repository repository = null; int largestSegmentCount = 0; for (Repository r : repositories) { if (!r.isBare()) { try { IPath repoPath = new Path(r.getWorkTree() .getCanonicalPath()); IPath location = resource.getLocation(); if (location != null && repoPath.isPrefixOf(location)) { if (repository == null || repoPath.segmentCount() > largestSegmentCount) { repository = r; largestSegmentCount = repoPath.segmentCount(); } } } catch (IOException e) { Activator .error("looking up working tree path of git repository failed", e); } } } return repository; }
Source:
public void doFilter( ServletRequest req, ServletResponse resp, FilterChain chain) throws IOException, ServletException { CurrentUser user = userProvider.get(); if (user != null && user.isIdentifiedUser()) { IdentifiedUser who = (IdentifiedUser) user; if (who.getUserName() != null && !who.getUserName().isEmpty()) { req.setAttribute(REQ_ATTR_KEY, who.getUserName()); } else { req.setAttribute(REQ_ATTR_KEY, who.getAccountId()); } } chain.doFilter(req, resp); }

Target:
public void doFilter( ServletRequest req, ServletResponse resp, FilterChain chain) throws IOException, ServletException { CurrentUser user = userProvider.get(); if (user != null && user.isIdentifiedUser()) { IdentifiedUser who = (IdentifiedUser) user; if (who.getUserName() != null && !who.getUserName().isEmpty()) { req.setAttribute(REQ_ATTR_KEY, who.getUserName()); } else { req.setAttribute(REQ_ATTR_KEY, "a/" + who.getAccountId()); } } chain.doFilter(req, resp); }
Source:
void shouldNotFailOnDeleteByIdWithAnyVersion(@Autowired VersionedThingWithAssignedIdRepository repository) { try (Session session = driver.session()) { session.writeTransaction(tx -> { tx.run("CREATE (v:VersionedThingWithAssignedId {id:1, myVersion:3})").consume(); return null; }); } StepVerifier.create(repository.deleteById(1L)) .verifyComplete(); try (Session session = driver.session()) { long count = session.readTransaction(tx -> tx.run("MATCH (v:VersionedThingWithAssignedId) return count(v) as vCount").next() .get("vCount").asLong()); assertThat(count).isEqualTo(0); } }

Target:
void shouldNotFailOnDeleteByIdWithAnyVersion(@Autowired VersionedThingWithAssignedIdRepository repository) { try (Session session = driver.session()) { session.writeTransaction(tx -> tx.run("CREATE (v:VersionedThingWithAssignedId {id:1, myVersion:3})").consume()); } StepVerifier.create(repository.deleteById(1L)) .verifyComplete(); try (Session session = driver.session()) { long count = session.readTransaction(tx -> tx.run("MATCH (v:VersionedThingWithAssignedId) return count(v) as vCount").next() .get("vCount").asLong()); assertThat(count).isEqualTo(0); } }
Source:
protected boolean canDoAction() { setGlusterVolumeId(getParameters().getVolumeId() == null ? getGeoRepSession().getMasterVolumeId() : getParameters().getVolumeId()); if (!super.canDoAction()) { return false; } if (getGeoRepSession().getStatus().equals(GeoRepSessionStatus.ACTIVE)) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_GEOREP_SESSION_ALREADY_STARTED); } return true; }

Target:
protected boolean canDoAction() { setGlusterVolumeId(getGeoRepSession().getMasterVolumeId()); if (!super.canDoAction()) { return false; } if (getGeoRepSession().getStatus().equals(GeoRepSessionStatus.ACTIVE)) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_GEOREP_SESSION_ALREADY_STARTED); } return true; }
Source:
public void processPresign( Response response, AuthnRequest authnRequest, List<String> spMetadata, Set<SamlProtocol.Binding> supportedBindings) { response.getIssuer().setNameQualifier(NAME_QUALIFIER); for (Assertion assertion : response.getAssertions()) { assertion.getSubject().getNameID().setNameQualifier(NAME_QUALIFIER); } }

Target:
public void processPresign( Response response, AuthnRequest authnRequest, List<String> spMetadata, Set<SamlProtocol.Binding> supportedBindings) { if (response.getIssuer() != null) { setNameQualifierIfPersistent(response.getIssuer()); } for (Assertion assertion : response.getAssertions()) { if (assertion.getSubject() != null && assertion.getSubject().getNameID() != null) { setNameQualifierIfPersistent(assertion.getSubject().getNameID()); } setNameQualifierIfPersistent(assertion.getIssuer()); } }
Source:
abstract void start(PluginGuiceEnvironment env) throws Exception; abstract void stop(PluginGuiceEnvironment env); public abstract JarFile getJarFile(); public abstract PluginContentScanner getContentScanner(); public abstract Injector getSysInjector(); @Nullable public abstract Injector getSshInjector(); @Nullable public abstract Injector getHttpInjector(); public void add(RegistrationHandle handle) { if (manager != null) { if (handle instanceof ReloadableRegistrationHandle) { if (reloadableHandles == null) { reloadableHandles = Lists.newArrayList(); } reloadableHandles.add((ReloadableRegistrationHandle<?>) handle); } manager.add(handle); } }

Target:
abstract void start(PluginGuiceEnvironment env) throws Exception; abstract void stop(PluginGuiceEnvironment env); @Deprecated public abstract JarFile getJarFile(); public abstract PluginContentScanner getContentScanner(); public abstract Injector getSysInjector(); @Nullable public abstract Injector getSshInjector(); @Nullable public abstract Injector getHttpInjector(); public void add(RegistrationHandle handle) { if (manager != null) { if (handle instanceof ReloadableRegistrationHandle) { if (reloadableHandles == null) { reloadableHandles = Lists.newArrayList(); } reloadableHandles.add((ReloadableRegistrationHandle<?>) handle); } manager.add(handle); } }
Source:
private Optional<String> maybeChooseUncompactedTable( Map<String, Long> tableToLastTimeSwept, Map<String, Long> tableToLastTimeCompacted) { List<String> uncompactedTables = tableToLastTimeSwept.keySet().stream() .filter(table -> !tableToLastTimeCompacted.keySet().contains(table)) .collect(Collectors.toList()); if (uncompactedTables.size() > 0) { int randomTableIndex = ThreadLocalRandom.current().nextInt(uncompactedTables.size()); String randomlyChosenTable = uncompactedTables.get(randomTableIndex); log.info("There are some tables which have been swept, but not compacted. Choosing at random.", safeTableRef(randomlyChosenTable)); return Optional.of(randomlyChosenTable); } return Optional.empty(); }

Target:
private static Optional<String> maybeChooseUncompactedTable( Map<String, Long> tableToLastTimeSwept, Map<String, Long> tableToLastTimeCompacted) { List<String> uncompactedTables = tableToLastTimeSwept.keySet().stream() .filter(table -> !tableToLastTimeCompacted.keySet().contains(table)) .collect(Collectors.toList()); if (uncompactedTables.size() > 0) { int randomTableIndex = ThreadLocalRandom.current().nextInt(uncompactedTables.size()); String randomlyChosenTable = uncompactedTables.get(randomTableIndex); log.info("There are some tables which have been swept, but not compacted. Choosing at random.", safeTableRef(randomlyChosenTable)); return Optional.of(randomlyChosenTable); } return Optional.empty(); }
Source:
public void afterPropertiesSet() throws Exception { poolingOptions = newPoolingOptions(); if (heartbeatIntervalSeconds != null) { poolingOptions.setHeartbeatIntervalSeconds(heartbeatIntervalSeconds); } if (idleTimeoutSeconds != null) { poolingOptions.setIdleTimeoutSeconds(idleTimeoutSeconds); } if (initializationExecutor != null) { poolingOptions.setInitializationExecutor(initializationExecutor); } if (poolTimeoutMilliseconds != null) { poolingOptions.setPoolTimeoutMillis(poolTimeoutMilliseconds); } HostDistancePoolingOptions local = LocalHostDistancePoolingOptions.create(localCoreConnections, localMaxConnections, localMaxSimultaneousRequests, localMinSimultaneousRequests); local.setMaxConnectionsPerHost(poolingOptions); local.setCoreConnectionsPerHost(poolingOptions); local.setMaxRequestsPerConnection(poolingOptions); local.setNewConnectionThreshold(poolingOptions); HostDistancePoolingOptions remote = RemoteHostDistancePoolingOptions.create(remoteCoreConnections, remoteMaxConnections, remoteMaxSimultaneousRequests, remoteMinSimultaneousRequests); remote.setMaxConnectionsPerHost(poolingOptions); remote.setCoreConnectionsPerHost(poolingOptions); remote.setMaxRequestsPerConnection(poolingOptions); remote.setNewConnectionThreshold(poolingOptions); }

Target:
public void afterPropertiesSet() throws Exception { poolingOptions = configureRemoteHostDistancePoolingOptions( configureLocalHostDistancePoolingOptions(newPoolingOptions())); if (heartbeatIntervalSeconds != null) { poolingOptions.setHeartbeatIntervalSeconds(heartbeatIntervalSeconds); } if (idleTimeoutSeconds != null) { poolingOptions.setIdleTimeoutSeconds(idleTimeoutSeconds); } if (initializationExecutor != null) { poolingOptions.setInitializationExecutor(initializationExecutor); } if (poolTimeoutMilliseconds != null) { poolingOptions.setPoolTimeoutMillis(poolTimeoutMilliseconds); } }
Source:
public OracleWeekDiffFunction() { super("(select sign(i1) * floor(abs(i1)) from (values (trunc(-(cast(?1 as date) - cast(?2 as date))) / 7)) as temp(i1))"); }

Target:
public OracleWeekDiffFunction() { super("trunc(-(cast(?1 as date) - cast(?2 as date))/7)"); }
Source:
private boolean checkNullBytesPrepended(final byte[] bytes) { if (bytes.length > IVBYTES.length) { boolean ivPrepended = false; for (short s = 0; s < IVBYTES.length; s++) { if (bytes[s] == 0) { ivPrepended = true; } else { return false; } } return ivPrepended; } else { return false; } }

Target:
private boolean checkNullBytesPrepended(final byte[] bytes) { if (bytes.length > IVBYTES.length) { boolean nullBytesPrepended = false; for (short s = 0; s < IVBYTES.length; s++) { if (bytes[s] == 0) { nullBytesPrepended = true; } else { return false; } } return nullBytesPrepended; } else { return false; } }
Source:
public void onSaveInstanceState(Bundle outState) { if (backStack != null) { updateCurrentBackStackItem(); outState.putParcelableArrayList("backStack", backStack); } }

Target:
public void onSaveInstanceState(Bundle outState) { updateCurrentBackStackItem(); outState.putParcelableArrayList("backStack", backStack); }
Source:
public abstract boolean isCollection(String schemaName, String fieldTypeName) throws SQLException; public abstract boolean isStruct(String schemaName, String fieldTypeName) throws SQLException; public abstract boolean isPrimitive(String fieldTypeName) throws SQLException; public List<String> getAllTablesInDatabase() throws SQLException { throw new DatastreamRuntimeException("getAllTablesInDatabase operation not supported"); }

Target:
public abstract boolean isCollection(String schemaName, String fieldTypeName) throws SQLException; public abstract boolean isStruct(String schemaName, String fieldTypeName) throws SQLException; public abstract boolean isPrimitive(String fieldTypeName) throws SQLException; public List<String> getAllTablesInDatabase() throws SQLException { throw new UnsupportedOperationException("getAllTablesInDatabase operation not supported"); }
Source:
public void force(boolean force) throws IOException { long start = System.nanoTime (); fileChannel.force (force); update(syncMetrics, SYNC_METRICS, start, MB_DATA); }

Target:
public void force(boolean force) throws IOException { final long start = System.nanoTime(); fileChannel.force(force); if(force) update(syncMetaMetrics, SYNC_META_METRICS, start, MB_DATA); else update(syncMetrics, SYNC_METRICS, start, MB_DATA); }
Source:
public void toExecute(JobExecutionContext context) throws JobExecutionException { try { JobDataMap map = context.getMergedJobDataMap(); String ownerKey = map.getString(JobStatus.TARGET_ID); Boolean lazy = map.getBoolean(LAZY_REGEN); Owner owner = ownerCurator.lookupByKey(ownerKey); if (owner == null) { context.setResult("Nothing to do. Owner no longer exists"); return; } poolManager.getRefresher(lazy).setUnitOfWork(unitOfWork).add(owner).run(); context.setResult("Pools refreshed for owner " + owner.getDisplayName()); } catch (PersistenceException e) { throw new RetryJobException("RefreshPoolsJob encountered a problem.", e); } catch (RuntimeException e) { if (e.getCause() != null && SQLException.class.isAssignableFrom(e.getCause().getClass())) { log.warn("Caught a runtime exception wrapping an SQLException."); throw new RetryJobException("RefreshPoolsJob encountered a problem.", e); } log.error("RefreshPoolsJob encountered a problem.", e); context.setResult(e.getMessage()); throw new JobExecutionException(e.getMessage(), e, false); } catch (Exception e) { log.error("RefreshPoolsJob encountered a problem.", e); context.setResult(e.getMessage()); throw new JobExecutionException(e.getMessage(), e, false); } }

Target:
public void toExecute(JobExecutionContext context) throws JobExecutionException { try { JobDataMap map = context.getMergedJobDataMap(); String ownerKey = map.getString(JobStatus.TARGET_ID); Boolean lazy = map.getBoolean(LAZY_REGEN); Owner owner = ownerCurator.lookupByKey(ownerKey); if (owner == null) { context.setResult("Nothing to do. Owner no longer exists"); return; } poolManager.getRefresher(lazy).setUnitOfWork(unitOfWork).add(owner).run(); context.setResult("Pools refreshed for owner " + owner.getDisplayName()); } catch (PersistenceException e) { throw new RetryJobException("RefreshPoolsJob encountered a problem.", e); } catch (RuntimeException e) { Throwable cause = e.getCause(); while (cause != null) { if (SQLException.class.isAssignableFrom(cause.getClass())) { log.warn("Caught a runtime exception wrapping an SQLException."); throw new RetryJobException("RefreshPoolsJob encountered a problem.", e); } cause = cause.getCause(); } log.error("RefreshPoolsJob encountered a problem.", e); context.setResult(e.getMessage()); throw new JobExecutionException(e.getMessage(), e, false); } catch (Exception e) { log.error("RefreshPoolsJob encountered a problem.", e); context.setResult(e.getMessage()); throw new JobExecutionException(e.getMessage(), e, false); } }
Source:
public WriteCompletedEvent( String queryId, String path, String schemaName, String tableName, @Nullable String partitionName, String storageFormat, String writerImplementation, String prestoVersion, String serverAddress, @Nullable String principal, String environment, Map<String, String> sessionProperties, @Nullable Long bytes, long rows) { this.queryId = requireNonNull(queryId, "queryId is null"); this.path = requireNonNull(path, "path is null"); this.schemaName = requireNonNull(schemaName, "schemaName is null"); this.tableName = requireNonNull(tableName, "tableName is null"); this.partitionName = partitionName; this.storageFormat = requireNonNull(storageFormat, "storageFormat is null"); this.writerImplementation = requireNonNull(writerImplementation, "writerImplementation is null"); this.prestoVersion = requireNonNull(prestoVersion, "prestoVersion is null"); this.host = requireNonNull(serverAddress, "serverAddress is null"); this.principal = principal; this.environment = requireNonNull(environment, "environment is null"); this.sessionProperties = requireNonNull(sessionProperties, "sessionProperties is null"); this.bytes = bytes; this.rows = rows; this.timestamp = Instant.now(); }

Target:
public WriteCompletedEvent( String queryId, String path, String schemaName, String tableName, @Nullable String partitionName, String storageFormat, String writerImplementation, String prestoVersion, String serverAddress, @Nullable String principal, String environment, Map<String, String> sessionProperties, @Nullable Long bytes, long rows) { this.queryId = requireNonNull(queryId, "queryId is null"); this.path = requireNonNull(path, "path is null"); this.schemaName = requireNonNull(schemaName, "schemaName is null"); this.tableName = requireNonNull(tableName, "tableName is null"); this.partitionName = partitionName; this.storageFormat = requireNonNull(storageFormat, "storageFormat is null"); this.writerImplementation = requireNonNull(writerImplementation, "writerImplementation is null"); this.prestoVersion = requireNonNull(prestoVersion, "prestoVersion is null"); this.host = requireNonNull(serverAddress, "serverAddress is null"); this.principal = principal; this.environment = requireNonNull(environment, "environment is null"); this.sessionProperties = requireNonNull(sessionProperties, "sessionProperties is null"); this.bytes = bytes; this.rows = rows; }
Source:
private Map<Pair<String, Integer>, Pair<String, Integer>> gbyMatches(MaterializedViewInfo mv) { final FilterMatcher filter = new FilterMatcher(m_stmt.m_joinTree.getJoinExpression(), predicate_of(mv)); if(filter.match() && gbyTablesEqual(mv) && gbyColumnsMatch(mv)) { return getViewColumnMaps(mv); } else { return null; } }

Target:
private Map<Pair<String, Integer>, Pair<String, Integer>> gbyMatches(MaterializedViewInfo mv) { final FilterMatcher filter = new FilterMatcher(m_selectStmt.m_joinTree.getJoinExpression(), predicate_of(mv)); if (filter.match() && gbyTablesEqual(mv) && gbyColumnsMatch(mv)) { return getViewColumnMaps(mv); } else { return null; } }
Source:
private String getValueFromRequest(HttpServletRequest request, String parameter) { String parameterValue = request.getParameter(parameter); if (parameterValue != null) { return parameterValue; } Map allParams = (Map) request.getAttribute(HandlerMapping.URI_TEMPLATE_VARIABLES_ATTRIBUTE); if (allParams != null) { return (String) allParams.get(parameter); } return null; }

Target:
private String getValueFromRequest(HttpServletRequest request, String parameter) { String parameterValue = null; Map allParams = (Map) request.getAttribute(HandlerMapping.URI_TEMPLATE_VARIABLES_ATTRIBUTE); if (allParams != null) { parameterValue = (String) allParams.get(parameter); } if (parameterValue == null) { parameterValue = request.getParameter(parameter); } return parameterValue; }
Source:
public String saveEntityJson(HttpServletRequest request, HttpServletResponse response, Model model, @PathVariable Map<String, String> pathVars, @PathVariable(value = "id") String id, @ModelAttribute(value = "entityForm") EntityForm entityForm, BindingResult result, RedirectAttributes ra) throws Exception { saveEntity(request, response, model, pathVars, id, entityForm, result, ra); JsonResponse json = new JsonResponse(response); if (result.hasErrors()) { populateJsonValidationErrors(entityForm, result, json); } List<String> dirtyList = buildDirtyList(pathVars, request, id); if (!dirtyList.isEmpty()) { json.with("dirty", dirtyList); } return json.done(); }

Target:
public String saveEntityJson(HttpServletRequest request, HttpServletResponse response, Model model, @PathVariable Map<String, String> pathVars, @PathVariable(value = "id") String id, @ModelAttribute(value = "entityForm") EntityForm entityForm, BindingResult result, RedirectAttributes ra) throws Exception { saveEntity(request, response, model, pathVars, id, entityForm, result, ra); JsonResponse json = new JsonResponse(response); if (result.hasErrors()) { populateJsonValidationErrors(entityForm, result, json); } List<String> dirtyList = buildDirtyList(pathVars, request, id); if (CollectionUtils.isNotEmpty(dirtyList)) { json.with("dirty", dirtyList); } return json.done(); }
Source:
public static VersionInfo parseVersionInfoFromClusterVersion(ClusterVersion clusterVersion) throws ParseException { String[] versionParts = clusterVersion.getStatus().getDesired().getVersion().split("\\."); VersionInfo.Builder versionInfoBuilder = new VersionInfo.Builder(); if (versionParts.length == 3) { versionInfoBuilder.withMajor(versionParts[0]); versionInfoBuilder.withMinor(versionParts[1] + "." + versionParts[2]); } versionInfoBuilder.withBuildDate(clusterVersion.getMetadata().getCreationTimestamp()); return versionInfoBuilder.build(); }

Target:
private static VersionInfo parseVersionInfoFromClusterVersion(ClusterVersion clusterVersion) throws ParseException { String[] versionParts = clusterVersion.getStatus().getDesired().getVersion().split("\\."); VersionInfo.Builder versionInfoBuilder = new VersionInfo.Builder(); if (versionParts.length == 3) { versionInfoBuilder.withMajor(versionParts[0]); versionInfoBuilder.withMinor(versionParts[1] + "." + versionParts[2]); } versionInfoBuilder.withBuildDate(clusterVersion.getMetadata().getCreationTimestamp()); return versionInfoBuilder.build(); }
Source:
public GatewayResponse capture(CaptureGatewayRequest request) { return worldpayCaptureHandler.capture(request); }

Target:
public GatewayResponse<BaseCaptureResponse> capture(CaptureGatewayRequest request) { return worldpayCaptureHandler.capture(request); }
Source:
public BinaryContent transform( SourceResponse upstreamResponse, Map<String, Serializable> arguments) throws CatalogTransformerException { List<Metacard> metacards = upstreamResponse .getResults() .stream() .map(Result::getMetacard) .collect(Collectors.toList()); Set<String> hiddenFields = Optional.ofNullable((Set<String>) arguments.get(HIDDEN_FIELDS_KEY)) .orElse(Collections.emptySet()); List<String> attributeOrder = Optional.ofNullable((List<String>) arguments.get(COLUMN_ORDER_KEY)) .orElse(Collections.emptyList()); Map<String, String> columnAliasMap = Optional.ofNullable((Map<String, String>) arguments.get(COLUMN_ALIAS_KEY)) .orElse(Collections.emptyMap()); Set<AttributeDescriptor> allAttributeDescriptors = getAllAttributes(metacards, hiddenFields); Set<String> requestedFields = new HashSet<>(attributeOrder); if (!requestedFields.isEmpty()) { allAttributeDescriptors = allAttributeDescriptors .stream() .filter(attrDesc -> requestedFields.contains(attrDesc.getName())) .collect(Collectors.toSet()); } List<AttributeDescriptor> sortedAttributeDescriptors = sortAttributes(allAttributeDescriptors, attributeOrder); Appendable csv = writeMetacardsToCsv(metacards, sortedAttributeDescriptors, columnAliasMap); return createResponse(csv); }

Target:
public BinaryContent transform( SourceResponse upstreamResponse, Map<String, Serializable> arguments) throws CatalogTransformerException { List<Metacard> metacards = upstreamResponse .getResults() .stream() .map(Result::getMetacard) .collect(Collectors.toList()); Set<String> hiddenFields = Optional.ofNullable((Set<String>) arguments.get(HIDDEN_FIELDS_KEY)) .orElse(Collections.emptySet()); List<String> attributeOrder = Optional.ofNullable((List<String>) arguments.get(COLUMN_ORDER_KEY)) .orElse(Collections.emptyList()); Map<String, String> columnAliasMap = Optional.ofNullable((Map<String, String>) arguments.get(COLUMN_ALIAS_KEY)) .orElse(Collections.emptyMap()); Set<String> requestedFields = new HashSet<>(attributeOrder); Set<AttributeDescriptor> requestedAttributeDescriptors = requestedFields.isEmpty() ? getAllCsvAttributeDescriptors(metacards) : getOnlyRequestedAttributes(metacards, requestedFields); Set<AttributeDescriptor> filteredAttributeDescriptors = requestedAttributeDescriptors .stream() .filter(desc -> !hiddenFields.contains(desc.getName())) .collect(Collectors.toSet()); List<AttributeDescriptor> sortedAttributeDescriptors = sortAttributes(filteredAttributeDescriptors, attributeOrder); Appendable csv = writeMetacardsToCsv(metacards, sortedAttributeDescriptors, columnAliasMap); return createResponse(csv); }
Source:
protected void loadApp(String appKey) { if(salesforceReactActivity != null && !salesforceReactActivity.shouldAuthenticate()){ super.loadApp(appKey); } }

Target:
protected void loadApp(String appKey) { loadReactAppOnceIfReady(appKey); }
Source:
public synchronized Delta<UsbSerialDeviceInformation> scan() throws IOException { Set<UsbSerialDeviceInformation> deviceInfos = usbSerialScanner.scan(); Set<UsbSerialDeviceInformation> added = getAddedDeviceInfos(deviceInfos); Set<UsbSerialDeviceInformation> removed = getRemovedDeviceInfos(deviceInfos); Set<UsbSerialDeviceInformation> unchanged = Sets.difference(deviceInfos, added); lastScanResult = deviceInfos; return new Delta<>(added, removed, unchanged); }

Target:
public synchronized Delta<UsbSerialDeviceInformation> scan() throws IOException { Set<UsbSerialDeviceInformation> scanResult = usbSerialScanner.scan(); Set<UsbSerialDeviceInformation> added = setDifference(scanResult, lastScanResult); Set<UsbSerialDeviceInformation> removed = setDifference(lastScanResult, scanResult); Set<UsbSerialDeviceInformation> unchanged = setDifference(scanResult, added); lastScanResult = scanResult; return new Delta<>(added, removed, unchanged); }
Source:
public void testGenerateThirdPartyNameToFullModuleNameWithException() throws Exception { final URLClassLoader classLoader = mock(URLClassLoader.class); final Set<String> packages = new LinkedHashSet<>(1); packages.add(BASE_PACKAGE); mockStatic(ModuleReflectionUtil.class); doThrow(new IOException("mock exception")).when(ModuleReflectionUtil.class); ModuleReflectionUtil.getCheckstyleModules(packages, classLoader); final PackageObjectFactory objectFactory = new PackageObjectFactory(packages, Thread.currentThread().getContextClassLoader()); final Method method = objectFactory.getClass().getDeclaredMethod( "generateThirdPartyNameToFullModuleName", ClassLoader.class); method.setAccessible(true); final int size = ((Map<String, String>) method.invoke(objectFactory, classLoader)).size(); assertEquals("Invalid map size", 0, size); }

Target:
public void testGenerateThirdPartyNameToFullModuleNameWithException() throws Exception { final String name = "String"; final String packageName = "java.lang"; final ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); final Set<String> packages = Collections.singleton(packageName); final PackageObjectFactory objectFactory = new PackageObjectFactory(packages, classLoader, TRY_IN_ALL_REGISTERED_PACKAGES); mockStatic(ModuleReflectionUtil.class); doThrow(new IOException("mock exception")).when(ModuleReflectionUtil.class); ModuleReflectionUtil.getCheckstyleModules(packages, classLoader); final String internalFieldName = "thirdPartyNameToFullModuleNames"; final Map<String, String> nullMap = Whitebox.getInternalState(objectFactory, internalFieldName); assertNull("Expected uninitialized field", nullMap); final Object instance = objectFactory.createModule(name); assertEquals("Expected empty string", "", instance); final Map<String, String> emptyMap = Whitebox.getInternalState(objectFactory, internalFieldName); assertEquals("Expected empty map", Collections.emptyMap(), emptyMap); }
Source:
public KudoResourceMappingProvider () { mappings.put("kudo.dev/v1beta1#InstanceList", io.fabric8.kudo.api.model.v1beta1.InstanceList.class); mappings.put("kudo.dev/v1beta1#Instance", io.fabric8.kudo.api.model.v1beta1.Instance.class); }

Target:
public KudoResourceMappingProvider () { mappings.put("kudo.dev/v1beta1#InstanceList", io.fabric8.kudo.v1beta1.InstanceList.class); mappings.put("kudo.dev/v1beta1#Instance", io.fabric8.kudo.v1beta1.Instance.class); mappings.put("kudo.dev/v1beta1#OperatorVersion", io.fabric8.kudo.v1beta1.OperatorVersion.class); mappings.put("kudo.dev/v1beta1#OperatorVersionList", io.fabric8.kudo.v1beta1.OperatorVersionList.class); mappings.put("kudo.dev/v1beta1#Operator", io.fabric8.kudo.v1beta1.Operator.class); mappings.put("kudo.dev/v1beta1#OperatorList", io.fabric8.kudo.v1beta1.OperatorList.class); }
Source:
public void reset() { super.reset(); CTabFolder folder = (CTabFolder) getWidget(); folder.setSelectionBackground((Color) null); folder.setSelectionForeground((Color) null); folder.setBackground(null, null); CTabFolderRenderer renderer = folder.getRenderer(); if (renderer != null && !renderer.getClass().getName() .equals(CTabFolderRenderer.class.getName())) { try { Method m = renderer.getClass().getMethod("setSelectedTabFill", new Class[] { Color.class }); m.invoke(renderer, (Color) null); m = renderer.getClass().getMethod("setTabOutline", new Class[] { Color.class }); m.invoke(renderer, (Color) null); m = renderer.getClass().getMethod("setInnerKeyline", new Class[] { Color.class }); m.invoke(renderer, (Color) null); m = renderer.getClass().getMethod("setOuterKeyline", new Class[] { Color.class }); m.invoke(renderer, (Color) null); m = renderer.getClass().getMethod("setShadowColor", new Class[] { Color.class }); m.invoke(renderer, (Color) null); m = renderer.getClass().getMethod("setActiveToolbarGradient", new Class[] { Color[].class, int[].class }); m.invoke(renderer, null, null); m = renderer.getClass().getMethod("setInactiveToolbarGradient", new Class[] { Color[].class, int[].class }); m.invoke(renderer, null, null); } catch (Exception e) { } folder.setRenderer(null); } }

Target:
public void reset() { super.reset(); CTabFolder folder = (CTabFolder) getWidget(); folder.setSelectionBackground((Color) null); folder.setSelectionForeground((Color) null); folder.setBackground(null, null); if (folder.getRenderer() instanceof ICTabRendering) { ICTabRendering renderer = (ICTabRendering) folder .getRenderer(); folder.setRenderer(null); renderer.setSelectedTabFill(null); renderer.setTabOutline(null); renderer.setInnerKeyline(null); renderer.setOuterKeyline(null); renderer.setShadowColor(null); renderer.setActiveToolbarGradient(null, null); renderer.setInactiveToolbarGradient(null, null); } }
Source:
public void setUp() { Context context = InstrumentationRegistry.getTargetContext().getApplicationContext(); sensorNames.addAll(Arrays.asList(context.getResources().getStringArray(R.array.nxt_sensor_chooser))); sensorCodes.addAll(Arrays.asList(NXTSensor.Sensor.getSensorCodes())); sensorName = context.getString(sensorNameStringId); }

Target:
public void setUp() { Context context = InstrumentationRegistry.getTargetContext(); sensorNames.addAll(Arrays.asList(context.getResources().getStringArray(R.array.nxt_sensor_chooser))); sensorCodes.addAll(Arrays.asList(NXTSensor.Sensor.getSensorCodes())); sensorName = context.getString(sensorNameStringId); }