auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private static void waitForStreamState(AmazonKinesisClient kinesisClient, String streamName, @Nullable StreamStatus expectedStatus) { long waitTime = System.currentTimeMillis() + TIMEOUT; while (System.currentTimeMillis() < waitTime) { try { TimeUnit.MILLISECONDS.sleep(SLEEP_INTERVAL); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } StreamStatus streamState = streamExists(kinesisClient, streamName) ? getStreamState(kinesisClient, streamName) : null; if (expectedStatus == streamState) { return; } } <START> throw new IllegalStateException(String.format("TimedOut waithing for stream to be in %s state", expectedStatus)); <END> }</code><technical_language>nit: Timed out..</technical_language>

Target:
private static void waitForStreamState(AmazonKinesisClient kinesisClient, String streamName, @Nullable StreamStatus expectedStatus) { long waitTime = System.currentTimeMillis() + TIMEOUT; while (System.currentTimeMillis() < waitTime) { try { TimeUnit.MILLISECONDS.sleep(SLEEP_INTERVAL); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } StreamStatus streamState = streamExists(kinesisClient, streamName) ? getStreamState(kinesisClient, streamName) : null; if (expectedStatus == streamState) { return; } } throw new IllegalStateException(String.format("Timed out waiting for stream to be in %s state", expectedStatus)); }
Source:
<code>protected void updateCompactionMark(CorfuRuntime runtime, long compactionMark) { <START> if (runtime.getAddressSpaceView().getCompactionMark() < compactionMark) { <END> runtime.getAddressSpaceView().setCompactionMark(compactionMark); log.trace("Compaction mark is updated to {}", compactionMark); } }</code><technical_language>I thought compaction mark determined log unit actual compaction? this compaction mark is set garbage marking</technical_language>

Target:
protected void updateCompactionMark(CorfuRuntime runtime, long compactionMark) { runtime.getAddressSpaceView().getCompactionMark().getAndUpdate((address) -> { if (address < compactionMark) { log.trace("Compaction mark is updated to {}", compactionMark); return compactionMark; } else { return address; } }); }
Source:
<code>public List<Command> transmit(final List<Command> commands) { LOG.trace("transmitting commands", commands.size()); if (serverConnector == null) { <START> LOG.debug("no server connector wired for in-memory connector"); <END> return Collections.EMPTY_LIST; } if (sleepMillis > 0) { try { Thread.sleep(sleepMillis); } catch (InterruptedException e) { throw new RuntimeException(e); } } List<Command> result = new LinkedList<Command>(); for (Command command : commands) { LOG.trace("processing {}", command); result.addAll(serverConnector.receive(command)); } return result; }</code><technical_language>This warn</technical_language>

Target:
public List<Command> transmit(final List<Command> commands) { LOG.trace("transmitting commands", commands.size()); if (serverConnector == null) { LOG.warn("no server connector wired for in-memory connector"); return Collections.EMPTY_LIST; } if (sleepMillis > 0) { try { Thread.sleep(sleepMillis); } catch (InterruptedException e) { throw new RuntimeException(e); } } List<Command> result = new LinkedList<Command>(); for (Command command : commands) { LOG.trace("processing {}", command); result.addAll(serverConnector.receive(command)); } return result; }
Source:
<code>public List<String> getJournalKeysFromDois(List<String> dois, Site site) throws IOException { if (dois.isEmpty()) { return new ArrayList<String>(); } List<String> quoted = dois.stream().map(doi -> { return "\"" + QueryParser.escape(doi) + "\""; }).collect(Collectors.toList()); ArticleSearchQuery explicitDoiSearchQuery = ArticleSearchQuery.builder() .setSimple(false) .setRows(dois.size()) .setQuery("id:(" + String.join(" OR ", quoted) + ")") .setIsJournalSearch(true) .build(); Map<String, ?> results = solrSearchApi.search(explicitDoiSearchQuery, site); List<Map<String, ?>> docs = (List<Map<String, ?>>) results.get("docs"); Map<String, String> keysMap = new HashMap<String,String>(); <START> docs.stream().forEach(data -> { <END> keysMap.put((String) data.get("id"), (String) data.get("journal_key")); }); List<String> journalKeys = dois.stream().map(id -> { if (keysMap.containsKey(id)) { return keysMap.get(id); } else { return ""; } }).collect(Collectors.toList()); return journalKeys; }</code><technical_language>call forEach docs instance directly, creating a **stream()** first. For example: docs.forEach(...)</technical_language>

Target:
public List<String> getJournalKeysFromDois(List<String> dois, Site site) throws IOException { if (dois.isEmpty()) { return new ArrayList<String>(); } List<String> quoted = dois.stream().map(doi -> { return "\"" + QueryParser.escape(doi) + "\""; }).collect(Collectors.toList()); ArticleSearchQuery explicitDoiSearchQuery = ArticleSearchQuery.builder() .setSimple(false) .setRows(dois.size()) .setQuery("id:(" + String.join(" OR ", quoted) + ")") .setIsJournalSearch(true) .build(); Map<String, ?> results = solrSearchApi.search(explicitDoiSearchQuery, site); List<Map<String, ?>> docs = (List<Map<String, ?>>) results.get("docs"); Map<String, String> keysMap = new HashMap<String,String>(); docs.forEach(data -> { keysMap.put((String) data.get("id"), (String) data.get("journal_key")); }); List<String> journalKeys = dois.stream().map(id -> { if (keysMap.containsKey(id)) { return keysMap.get(id); } else { return ""; } }).collect(Collectors.toList()); return journalKeys; }
Source:
<code>protected Response exportPersistenceData(MementoCopyMode preferredOrigin) { if (!Entitlements.isEntitled(mgmt().getEntitlementManager(), Entitlements.SEE_ALL_SERVER_INFO, null)) throw WebResourceUtils.unauthorized("User '%s' is not authorized for this operation", Entitlements.getEntitlementContext().user()); try { String label = mgmt().getManagementNodeId()+"-"+Time.makeDateSimpleStampString(); PersistenceObjectStore targetStore = BrooklynPersistenceUtils.newPersistenceObjectStore(mgmt(), null, "web-persistence-"+label+"-"+Identifiers.makeRandomId(4)); BrooklynPersistenceUtils.writeMemento(mgmt(), targetStore, preferredOrigin); ByteArrayOutputStream baos = new ByteArrayOutputStream(); <START> ArchiveBuilder.zip().addDirContentsAt( ((FileBasedObjectStore)targetStore).getBaseDir(), "/" ).stream(baos); <END> String filename = "brooklyn-state-"+label+".zip"; return Response.ok(baos.toByteArray(), MediaType.APPLICATION_OCTET_STREAM_TYPE) .header("Content-Disposition","attachment; filename = "+filename) .build(); } catch (Exception e) { log.warn("Unable to serve persistence data (rethrowing): "+e, e); throw Exceptions.propagate(e); } }</code><technical_language>empty archive. If I open another unzip app I get a subfolder name contains files another empty subfolder. - replacing "/" "" default unzip app shows files top level, opening alternative app (7Zip) I get empty subfolder. - Replacing "/" getBaseDir().getName() work - unexpected phantom folders, works default Windows unzip app</technical_language>

Target:
protected Response exportPersistenceData(MementoCopyMode preferredOrigin) { if (!Entitlements.isEntitled(mgmt().getEntitlementManager(), Entitlements.SEE_ALL_SERVER_INFO, null)) throw WebResourceUtils.unauthorized("User '%s' is not authorized for this operation", Entitlements.getEntitlementContext().user()); try { String label = mgmt().getManagementNodeId()+"-"+Time.makeDateSimpleStampString(); PersistenceObjectStore targetStore = BrooklynPersistenceUtils.newPersistenceObjectStore(mgmt(), null, "web-persistence-"+label+"-"+Identifiers.makeRandomId(4)); BrooklynPersistenceUtils.writeMemento(mgmt(), targetStore, preferredOrigin); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ArchiveBuilder.zip().addDirContentsAt( ((FileBasedObjectStore)targetStore).getBaseDir(), ((FileBasedObjectStore)targetStore).getBaseDir().getName() ).stream(baos); String filename = "brooklyn-state-"+label+".zip"; return Response.ok(baos.toByteArray(), MediaType.APPLICATION_OCTET_STREAM_TYPE) .header("Content-Disposition","attachment; filename = "+filename) .build(); } catch (Exception e) { log.warn("Unable to serve persistence data (rethrowing): "+e, e); throw Exceptions.propagate(e); } }
Source:
<code>private boolean checkLunsInStorageDomain(List<String> lunIds, StorageDomain storageDomain) { List<LUNs> lunsFromDb = getLunDao().getAllForVolumeGroup(getStorageDomain().getStorage()); <START> List<String> lunsList = new ArrayList<>(lunIds); <END> for (LUNs lun : lunsFromDb) { if (lunsList.contains(lun.getLUN_id())) { lunsList.remove(lun.getLUN_id()); } } return lunsList.isEmpty(); }</code><technical_language>care order, remove operations - a HashSet</technical_language>

Target:
private boolean checkLunsInStorageDomain(List<String> lunIds, StorageDomain storageDomain) { List<LUNs> lunsFromDb = getLunDao().getAllForVolumeGroup(getStorageDomain().getStorage()); Set<String> lunsList = new HashSet<>(lunIds); for (LUNs lun : lunsFromDb) { if (lunsList.contains(lun.getLUN_id())) { lunsList.remove(lun.getLUN_id()); } } return lunsList.isEmpty(); }
Source:
<code>public ImportVmFromExternalSourceModel(VmImportGeneralModel vmImportGeneralModel, VmImportDiskListModel importDiskListModel, VmImportInterfaceListModel vmImportInterfaceListModel, ClusterListModel<Void> cluster, QuotaListModel clusterQuota) { super(vmImportGeneralModel, importDiskListModel, vmImportInterfaceListModel, cluster, clusterQuota); getStorage().getSelectedItemChangedEvent().addListener(new IEventListener<EventArgs>() { @Override public void eventRaised(Event<? extends EventArgs> ev, Object sender, EventArgs args) { ListModel<StorageDomain> list = (ListModel<StorageDomain>)sender; <START> ImportVmData importVmData = (ImportVmData) getItems().toArray()[0]; <END> if (list.getSelectedItem().getStorageType().isBlockDomain() && importVmData.getVm().getOrigin() == OriginType.KVM) { setMessage(constants.kvmBlockDomainWraning()); } else { setMessage(""); } } }); }</code><technical_language>is enough check first? need check if is one? a method: private boolean containsKvmOrigin(){ for (Object item : getItems()) { ImportVmData importVmData = (ImportVmData) item; if (importVmData.getVm().getOrigin() == OriginType.KVM) { return true; } } }</technical_language>

Target:
public ImportVmFromExternalSourceModel(VmImportGeneralModel vmImportGeneralModel, VmImportDiskListModel importDiskListModel, VmImportInterfaceListModel vmImportInterfaceListModel, ClusterListModel<Void> cluster, QuotaListModel clusterQuota) { super(vmImportGeneralModel, importDiskListModel, vmImportInterfaceListModel, cluster, clusterQuota); getStorage().getSelectedItemChangedEvent().addListener(new IEventListener<EventArgs>() { @Override public void eventRaised(Event<? extends EventArgs> ev, Object sender, EventArgs args) { @SuppressWarnings("unchecked") ListModel<StorageDomain> list = (ListModel<StorageDomain>)sender; if (list.getSelectedItem().getStorageType().isBlockDomain() && containsKvmOrigin()) { setMessage(constants.kvmBlockDomainWraning()); } else { setMessage(""); } } }); }
Source:
<code>public void logout(final IProgressMonitor monitor) throws XmlRpcException { (new BugzillaXmlRpcOperation<Integer>(this) { @SuppressWarnings("serial") @Override public Integer execute() throws XmlRpcException { Object response = call(monitor, XML_USER_LOGOUT, null); return -1; } }).execute(); <START> userID = -1; <END> token = null; return; }</code><technical_language>this a finally this if logout fails (e.g. if user logged out)</technical_language>

Target:
public void logout(final IProgressMonitor monitor) throws XmlRpcException { try { (new BugzillaXmlRpcOperation<Integer>(this) { @Override public Integer execute() throws XmlRpcException { call(monitor, XML_USER_LOGOUT); return -1; } }).execute(); } catch (XmlRpcException e) { e.printStackTrace(); throw e; } finally { userID = -1; token = null; } return; }
Source:
<code>public SingleThreadedEventHandlingStrategy(SessionConnector connector, int queueLowerWatermark, int queueUpperWatermark) { sessionConnector = connector; eventQueue = new LinkedBlockingQueue<>(); queueTracker = WatermarkTracker.newMulti(eventQueue, queueLowerWatermark, queueUpperWatermark, evt -> evt.quickfixSession, qfSession -> { final IoSession ioSession = lookupIoSession(qfSession); if (ioSession != null && ioSession.isReadSuspended()) { ioSession.resumeRead(); <START> LOG.info("{}: inbound queue size < lower watermark ({}), socket reads resumed", <END> qfSession.getSessionID(), queueLowerWatermark); } }, qfSession -> { final IoSession ioSession = lookupIoSession(qfSession); if (ioSession != null && !ioSession.isReadSuspended()) { ioSession.suspendRead(); LOG.info("{}: inbound queue size > upper watermark ({}), socket reads suspended", qfSession.getSessionID(), queueUpperWatermark); } }); }</code><technical_language>IMHO this DEBUG logging</technical_language>

Target:
public SingleThreadedEventHandlingStrategy(SessionConnector connector, int queueLowerWatermark, int queueUpperWatermark) { sessionConnector = connector; eventQueue = new LinkedBlockingQueue<>(); queueTracker = newMultiSessionWatermarkTracker(eventQueue, queueLowerWatermark, queueUpperWatermark, evt -> evt.quickfixSession); }
Source:
<code>protected void executeQueryCommand() { Disk diskFromDao = getDbFacade().getDiskDao().get(getParameters().getEntityId()); if (diskFromDao != null) { <START> log.info("The disk already exist in the DB, hence, should not be fetched from Cinder."); <END> getQueryReturnValue().setReturnValue(null); return; } Volume Volume = getVolumeProviderProxy().getVolumeById(getParameters().getEntityId().toString()); Guid storageDomainId = getParameters().getId(); CinderDisk unregisteredDisk = CinderBroker.volumeToCinderDisk(Volume, storageDomainId); getQueryReturnValue().setReturnValue(unregisteredDisk); }</code><technical_language>please add id</technical_language>

Target:
protected void executeQueryCommand() { Disk diskFromDao = getDbFacade().getDiskDao().get(getParameters().getEntityId()); if (diskFromDao != null) { log.info("The disk already exist in the DB, hence, should not be fetched from Cinder. ID: '{}', Alias: '{}'", diskFromDao.getId(), diskFromDao.getDiskAlias()); getQueryReturnValue().setReturnValue(null); return; } String volumeId = getParameters().getEntityId().toString(); Volume volume = getVolumeProviderProxy().getVolumeById(volumeId); if (volume == null) { log.info("The volume doesn't exist in Cinder. ID: '{}'", volumeId); getQueryReturnValue().setReturnValue(null); return; } Guid storageDomainId = getParameters().getId(); CinderDisk unregisteredDisk = CinderBroker.volumeToCinderDisk(volume, storageDomainId); getQueryReturnValue().setReturnValue(unregisteredDisk); }
Source:
<code>public static void main(String[] args) throws IOException, NoSuchAlgorithmException, InvalidKeyException { try { MinioClient minioClient = new MinioClient( "<LINK_1>", "Q3AM3UQ867SPQQA43P2F", "zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG"); if (minioClient.bucketExists("my-bucketname")) { System.out.println("my-bucketname already exists"); } else { minioClient.makeBucket(MakeBucketArgs.builder().bucket("my-bucketname").build()); System.out.println("my-bucketname is created successfully"); } if (minioClient.bucketExists("my-bucketname2")) { System.out.println("my-bucketname2 already exists"); } else { minioClient.makeBucket( MakeBucketArgs.builder().bucket("my-bucketname2").region("us-west-1").build()); System.out.println("my-bucketname2 is created successfully"); } if (minioClient.bucketExists("my-bucketname3")) { System.out.println("my-bucketname3 already exists"); } else { minioClient.makeBucket( MakeBucketArgs.builder() .bucket("my-bucketname3") .region("us-west-1") .objectLock(true) .build()); <START> System.out.println("my-bucketname3 is created successfully"); <END> } } catch (MinioException e) { System.out.println("Error occurred: " + e); } }</code><technical_language>1. bucket names my-bucketname, my-bucketname-in-eu, my-bucketname-in-eu-with-object-lock 2. I prefer longer block in if i.e. if (!minioClient.bucketExists(...)) { is better</technical_language>

Target:
public static void main(String[] args) throws IOException, NoSuchAlgorithmException, InvalidKeyException { try { MinioClient minioClient = new MinioClient( "<LINK_1>", "Q3AM3UQ867SPQQA43P2F", "zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG"); if (!minioClient.bucketExists("my-bucketname")) { minioClient.makeBucket(MakeBucketArgs.builder().bucket("my-bucketname").build()); System.out.println("my-bucketname is created successfully"); } if (!minioClient.bucketExists("my-bucketname-in-eu")) { minioClient.makeBucket( MakeBucketArgs.builder().bucket("my-bucketname-in-eu").region("eu-west-1").build()); System.out.println("my-bucketname-in-eu is created successfully"); } if (!minioClient.bucketExists("my-bucketname-in-eu-with-object-lock")) { minioClient.makeBucket( MakeBucketArgs.builder() .bucket("my-bucketname-in-eu-with-object-lock") .region("eu-west-1") .objectLock(true) .build()); System.out.println("my-bucketname-in-eu-with-object-lock is created successfully"); } } catch (MinioException e) { System.out.println("Error occurred: " + e); } }
Source:
<code>public void testXmlHttpDigest() { String cp = "REST_XML_DIGEST"; RestConnectionProfileWizard.openWizard(cp) <START> .setConnectionUrl("<LINK_0>") <END> .setType(RestConnectionProfileWizard.TYPE_XML) .setAuth(RestConnectionProfileWizard.AUTH_TYPE_DIGEST, "user", "user") .testConnection() .finish(); String sourceModel = "RestXmlDigestSource"; String viewModel = "RestXmlDigestView"; RestImportWizard.openWizard() .setProfileName(cp) .nextPage() .setProject(PROJECT_NAME) .setSourceModelName(sourceModel) .setViewModelName(viewModel) .setProcedureName(PROCEDURE_NAME) .nextPage() .setJndiName(sourceModel + "DS") .nextPage() .setRootPath("schedule/day/broadcasts/broadcast") .setColumns("pid","start","end","programme/title") .finish(); String vdb = "RestXmlDigestVdb"; VdbWizard.openVdbWizard() .setLocation(PROJECT_NAME) .setName(vdb) .addModel(PROJECT_NAME, viewModel) .finish(); ServersViewExt.getInstance().refreshServer(teiidServer.getName()); modelExplorer.deployVdb(PROJECT_NAME, vdb); TeiidJDBCHelper jdbchelper = new TeiidJDBCHelper(teiidServer, vdb); assertEquals(16, jdbchelper.getNumberOfResults("exec " + viewModel + "." + PROCEDURE_NAME + "()")); }</code><technical_language>Do internal url in public tests</technical_language>

Target:
public void testXmlHttpDigest() { String sourceModel = "RestXmlDigestSource"; String viewModel = "RestXmlDigestView"; RestImportWizard.openWizard() .setProfileName(ConnectionProfileConstants.REST_XML_SECURE) .nextPage() .setProject(PROJECT_NAME) .setSourceModelName(sourceModel) .setViewModelName(viewModel) .setProcedureName(PROCEDURE_NAME) .nextPage() .setJndiName(sourceModel + "DS") .nextPage() .setRootPath("schedule/day/broadcasts/broadcast") .setColumns("pid","start","end","programme/title") .finish(); String vdb = "RestXmlDigestVdb"; VdbWizard.openVdbWizard() .setLocation(PROJECT_NAME) .setName(vdb) .addModel(PROJECT_NAME, viewModel) .finish(); ServersViewExt.getInstance().refreshServer(teiidServer.getName()); modelExplorer.deployVdb(PROJECT_NAME, vdb); TeiidJDBCHelper jdbchelper = new TeiidJDBCHelper(teiidServer, vdb); assertEquals(16, jdbchelper.getNumberOfResults("exec " + viewModel + "." + PROCEDURE_NAME + "()")); }
Source:
<code>private String getBaseUri() { String interfaceName = clientInterface.getName(); String property = String.format(REST_URI_FORMAT, interfaceName); <START> String baseURI = null; <END> try { baseURI = ConfigFacade.getOptionalValue(property, String.class).orElse(null); } catch (NoSuchElementException ex) { } if (baseURI == null) { property = String.format(REST_URL_FORMAT, interfaceName); baseURI = ConfigFacade.getOptionalValue(property, String.class).orElse(null); } if (baseURI == null) { RegisterRestClient anno = clientInterface.getAnnotation(RegisterRestClient.class); if (anno != null) { String annoUri = anno.baseUri(); if (annoUri != null && !"".equals(anno.baseUri())) { baseURI = annoUri; } } } if (baseURI == null) { throw new IllegalStateException("Unable to determine base URI from configuration for " + interfaceName); } return baseURI; }</code><technical_language>A bit simpler String baseURI = ConfigFacade .getOptionalValue(String.format(REST_URI_FORMAT, interfaceName), String.class) .orElseGet(() -> ConfigFacade.getOptionalValue(String.format(REST_URL_FORMAT, interfaceName), String.class).orElse(null));</technical_language>

Target:
private String getBaseUri() { String interfaceName = clientInterface.getName(); String baseURI = ConfigFacade .getOptionalValue(String.format(REST_URI_FORMAT, interfaceName), String.class) .orElseGet(() -> ConfigFacade.getOptionalValue(String.format(REST_URL_FORMAT, interfaceName), String.class).orElse(null)); if (baseURI == null) { RegisterRestClient anno = clientInterface.getAnnotation(RegisterRestClient.class); if (anno != null) { String annoUri = anno.baseUri(); if (annoUri != null && !"".equals(anno.baseUri())) { baseURI = annoUri; } } } if (baseURI == null) { throw new IllegalStateException("Unable to determine base URI from configuration for " + interfaceName); } return baseURI; }
Source:
<code>public List<OntClass> listClasses(Resource res) { List<String> types = res.listProperties(RDF.type).toList().stream() .map(st -> st.getObject().asResource().getURI()) .collect(Collectors.toList()); <START> return ontology.listClasses().toList().stream() <END> .filter(cls -> types.contains(cls.getURI())) .collect(Collectors.toList()); }</code><technical_language>ontology.listClasses().toList() returns a list of size 0</technical_language>

Target:
public Set<OntClass> listClasses(Resource res) { Set<OntClass> classes = new HashSet<>(); OntClass cls = ontology.getOntClass(res.listProperties(RDF.type) .toList().get(0).getObject().asResource().getURI()); classes.add(cls); classes.addAll(cls.listSuperClasses().toSet()); return classes; }
Source:
<code>public void testEliminateCrossJoin() { tester.assertThat(new EliminateCrossJoins()) .setSystemProperty(REORDER_JOINS, "true") .on(crossJoinAndJoin(INNER)) .matches( join(INNER, <START> ImmutableList.of(aliases -> new EquiJoinClause(new Symbol("cySymbol"), new Symbol("bySymbol"))), <END> join(INNER, ImmutableList.of(aliases -> new EquiJoinClause(new Symbol("axSymbol"), new Symbol("cxSymbol"))), any(), any() ), any() ) ); }</code><technical_language>explain need project anymore</technical_language>

Target:
public void testEliminateCrossJoin() { tester().assertThat(new EliminateCrossJoins()) .setSystemProperty(REORDER_JOINS, "true") .on(crossJoinAndJoin(INNER)) .matches( join(INNER, ImmutableList.of(aliases -> new EquiJoinClause(new Symbol("cySymbol"), new Symbol("bySymbol"))), join(INNER, ImmutableList.of(aliases -> new EquiJoinClause(new Symbol("axSymbol"), new Symbol("cxSymbol"))), any(), any() ), any() ) ); }
Source:
<code>public FormValidation doTestConnection(@QueryParameter("slackTeamDomain") final String teamDomain, @QueryParameter("slackToken") final String authToken, @QueryParameter("slackRoom") final String room, @QueryParameter("slackBuildServerUrl") final String buildServerUrl) throws FormException { try { <START> SlackService testSlackService = new StandardSlackService(StringUtils.isEmpty(teamDomain) ? this.teamDomain : teamDomain, <END> StringUtils.isEmpty(authToken) ? this.token : authToken, StringUtils.isEmpty(room) ? this.room : room); String message = "Slack/Jenkins plugin: you're all set on " + (StringUtils.isEmpty(buildServerUrl) ? this.buildServerUrl : buildServerUrl); boolean success = testSlackService.publish(message, "green"); return success ? FormValidation.ok("Success") : FormValidation.error("Failure"); } catch (Exception e) { return FormValidation.error("Client error : " + e.getMessage()); } }</code><technical_language>I understand kind of obfuscated untrained eye. Is a set checking for empty string falling a default? conditionals testSlackService variable a better</technical_language>

Target:
public FormValidation doTestConnection(@QueryParameter("slackTeamDomain") final String teamDomain, @QueryParameter("slackToken") final String authToken, @QueryParameter("slackRoom") final String room, @QueryParameter("slackBuildServerUrl") final String buildServerUrl) throws FormException { try { String targetDomain = teamDomain; if (StringUtils.isEmpty(targetDomain)) { targetDomain = this.teamDomain; } String targetToken = authToken; if (StringUtils.isEmpty(targetToken)) { targetToken = this.token; } String targetRoom = room; if (StringUtils.isEmpty(targetRoom)) { targetRoom = this.room; } String targetBuildServerUrl = buildServerUrl; if (StringUtils.isEmpty(targetBuildServerUrl)) { targetBuildServerUrl = this.buildServerUrl; } SlackService testSlackService = getSlackService(targetDomain, targetToken, targetRoom); String message = "Slack/Jenkins plugin: you're all set on " + targetBuildServerUrl; boolean success = testSlackService.publish(message, "green"); return success ? FormValidation.ok("Success") : FormValidation.error("Failure"); } catch (Exception e) { return FormValidation.error("Client error : " + e.getMessage()); } }
Source:
<code>public void onError(Throwable e) { <START> try { <END> log.warn("Fetching data failed", e); generator.close(); } catch (IOException e1) { log.error("Failed to close " + generator.getClass().getName()); } }</code><technical_language>latch updated here? Undertow task thread stay blocked indefinitely</technical_language>

Target:
public void onError(Throwable e) { try { log.warn("Fetching data failed", e); generator.close(); } catch (IOException e1) { log.error("Failed to close " + generator.getClass().getName()); } finally { latch.countDown(); } }
Source:
<code><START> Optional<String> getLatestCloneName(String topologyName, Collection<Topology> topologies) { <END> String prefix = getTopologyClonePrefix(topologyName); return topologies.stream() .filter(t -> t.getName().startsWith(prefix)) .map(Topology::getName) .max((t1, t2) -> getCloneNum(t1) - getCloneNum(t2)); }</code><technical_language>move this some utils class keeping in StreamlineService</technical_language>

Target:
Optional<String> getLatestCloneName(String topologyName, Collection<Topology> topologies) { return Utils.getLatestName( topologies.stream().map(Topology::getName).collect(Collectors.toSet()), Utils.getPrefix(topologyName, CLONE_SUFFIX), CLONE_SUFFIX); }
Source:
<code>public OAuth2AuthorizedClient authorize(OAuth2AuthorizationContext context) { Assert.notNull(context, "context cannot be null"); ClientRegistration clientRegistration = context.getClientRegistration(); OAuth2AuthorizedClient authorizedClient = context.getAuthorizedClient(); <START> if (!AuthorizationGrantType.PASSWORD.equals(clientRegistration.getAuthorizationGrantType()) || <END> authorizedClient != null) { return null; } String username = context.getAttribute(OAuth2AuthorizationContext.USERNAME_ATTRIBUTE_NAME); String password = context.getAttribute(OAuth2AuthorizationContext.PASSWORD_ATTRIBUTE_NAME); if (!StringUtils.hasText(username) || !StringUtils.hasText(password)) { return null; } OAuth2PasswordGrantRequest passwordGrantRequest = new OAuth2PasswordGrantRequest(clientRegistration, username, password); OAuth2AccessTokenResponse tokenResponse = this.accessTokenResponseClient.getTokenResponse(passwordGrantRequest); return new OAuth2AuthorizedClient(clientRegistration, context.getPrincipal().getName(), tokenResponse.getAccessToken(), tokenResponse.getRefreshToken()); }</code><technical_language>retrieve OAuth2AuthorizedClient if token is expired</technical_language>

Target:
public OAuth2AuthorizedClient authorize(OAuth2AuthorizationContext context) { Assert.notNull(context, "context cannot be null"); ClientRegistration clientRegistration = context.getClientRegistration(); OAuth2AuthorizedClient authorizedClient = context.getAuthorizedClient(); if (!AuthorizationGrantType.PASSWORD.equals(clientRegistration.getAuthorizationGrantType())) { return null; } String username = context.getAttribute(OAuth2AuthorizationContext.USERNAME_ATTRIBUTE_NAME); String password = context.getAttribute(OAuth2AuthorizationContext.PASSWORD_ATTRIBUTE_NAME); if (!StringUtils.hasText(username) || !StringUtils.hasText(password)) { return null; } if (authorizedClient != null && !hasTokenExpired(authorizedClient.getAccessToken())) { return null; } if (authorizedClient != null && hasTokenExpired(authorizedClient.getAccessToken()) && authorizedClient.getRefreshToken() != null) { return null; } OAuth2PasswordGrantRequest passwordGrantRequest = new OAuth2PasswordGrantRequest(clientRegistration, username, password); OAuth2AccessTokenResponse tokenResponse = this.accessTokenResponseClient.getTokenResponse(passwordGrantRequest); return new OAuth2AuthorizedClient(clientRegistration, context.getPrincipal().getName(), tokenResponse.getAccessToken(), tokenResponse.getRefreshToken()); }
Source:
<code>public String apply(ProjectResource rsrc, Input input) <START> throws Exception { <END> Project project = rsrc.getControl().getProject(); databaseDeleteHandler.delete(project); filesystemDeleteHandler.delete(project, input == null ? false : input.preserve); cacheDeleteHandler.delete(project); return String.format("The project \"%s\" was successfully deleted", rsrc.getName()); }</code><technical_language>try avoid throwing Exception prefer list concrete Exceptions thrown</technical_language>

Target:
public Object apply(ProjectResource rsrc, Input input) throws Exception { Project project = rsrc.getControl().getProject(); databaseDeleteHandler.delete(project); filesystemDeleteHandler.delete(project, input == null ? false : input.preserve); cacheDeleteHandler.delete(project); return Response.none(); }
Source:
<code>public void perform(GraphRewrite event, EvaluationContext context, ArchiveModel originalArchive) { if (!originalArchive.getDuplicateArchives().iterator().hasNext()) { return; } ArchiveModel originalParentArchive = originalArchive.getParentArchive(); FileModel originalArchiveParentFile = originalArchive.getParentFile(); originalArchive.setParentFile(null); originalArchive.setParentArchive(null); GraphService<DuplicateArchiveModel> duplicateArchiveService = event.getGraphContext().service(DuplicateArchiveModel.class); DuplicateArchiveModel duplicateArchive = duplicateArchiveService.create(); duplicateArchive.setOriginalArchive(originalArchive); duplicateArchive.setSHA1Hash(originalArchive.getSHA1Hash()); duplicateArchive.setFilePath(originalArchive.getFilePath()); duplicateArchive.setArchiveName(originalArchive.getArchiveName()); duplicateArchive.setFileName(originalArchive.getFileName()); duplicateArchive.setParentArchive(originalParentArchive); duplicateArchive.setParentFile(originalArchiveParentFile); <START> } <END></code><technical_language>I understand this much. need some explanation. archives duplicated archives, some duplications. I guess archives intended in <shared-libs></technical_language>

Target:
public void perform(GraphRewrite event, EvaluationContext context, ArchiveModel originalArchive) { if (!originalArchive.getDuplicateArchives().iterator().hasNext()) { return; } ArchiveModel originalParentArchive = originalArchive.getParentArchive(); FileModel originalArchiveParentFile = originalArchive.getParentFile(); originalArchive.setParentFile(null); originalArchive.setParentArchive(null); GraphService<DuplicateArchiveModel> duplicateArchiveService = event.getGraphContext().service(DuplicateArchiveModel.class); DuplicateArchiveModel duplicateArchive = duplicateArchiveService.create(); duplicateArchive.setCanonicalArchive(originalArchive); duplicateArchive.setSHA1Hash(originalArchive.getSHA1Hash()); duplicateArchive.setFilePath(originalArchive.getFilePath()); duplicateArchive.setArchiveName(originalArchive.getArchiveName()); duplicateArchive.setFileName(originalArchive.getFileName()); duplicateArchive.setParentArchive(originalParentArchive); duplicateArchive.setParentFile(originalArchiveParentFile); }
Source:
<code>private void addFunctionBlock(FunctionEntry entry) { try { FunctionBlock fb = new FunctionBlock(entry.getName(), <START> entry.asHaskellObject(new Context()), parent); <END> addBlock(fb); } catch (IOException e) { e.printStackTrace(); } }</code><technical_language>line refactor</technical_language>

Target:
private void addFunctionBlock(FunctionEntry entry) { try { Type type = entry.asHaskellObject(new Context()); FunctionBlock fb = new FunctionBlock(entry.getName(), type, parent); addBlock(fb); } catch (IOException e) { e.printStackTrace(); } }
Source:
<code>public ScheduledFuture scheduleTask() { return scheduler.scheduleWithFixedDelay(() -> { try { if (!table.getEntity(currentJMVersion.get(), processorId).getIsLeader()) { LOG.info("Not the leader anymore. Shutting down LeaderBarrierCompleteScheduler."); <START> scheduler.shutdownNow(); <END> barrierTimeout.getAndSet(true); listener.onStateChange(); } LOG.info("Leader checking for barrier state"); Iterable<ProcessorEntity> tableList = table.getEntitiesWithPartition(nextJMVersion); Set<String> tableProcessors = new HashSet<>(); for (ProcessorEntity entity : tableList) { tableProcessors.add(entity.getRowKey()); } LOG.info("blobProcessorSet = {}", blobProcessorSet); LOG.info("tableProcessors = {}", tableProcessors); if ((System.currentTimeMillis() - startTime) > (BARRIER_TIMEOUT_SEC * 1000)) { barrierTimeout.getAndSet(true); listener.onStateChange(); } else if (blobProcessorSet.equals(tableProcessors)) { listener.onStateChange(); } } catch (Exception e) { errorHandler.accept("Exception in LeaderBarrierCompleteScheduler. Stopping the processor..."); } }, BARRIER_REACHED_DELAY_SEC, BARRIER_REACHED_DELAY_SEC, TimeUnit.SECONDS); }</code><technical_language>shutting scheduler in listener? verify flow. if shutdown scheduler, current executing task finish scheduler is fully shutdown. Also, listener.onStateChange returns, is task expected continue running Line 87? I multiple shared states scheduler listener, is necessary. again, refactor schedulers for work :) Please note in follow-up JIRA if unable address it</technical_language>

Target:
public ScheduledFuture scheduleTask() { return scheduler.scheduleWithFixedDelay(() -> { try { if (!table.getEntity(currentJMVersion.get(), processorId).getIsLeader()) { LOG.info("Not the leader anymore. Shutting down LeaderBarrierCompleteScheduler."); barrierTimeout.getAndSet(true); listener.onStateChange(); } else { LOG.info("Leader checking for barrier state"); Iterable<ProcessorEntity> tableList = table.getEntitiesWithPartition(nextJMVersion); Set<String> tableProcessors = new HashSet<>(); for (ProcessorEntity entity : tableList) { tableProcessors.add(entity.getRowKey()); } LOG.info("List of live processors as seen on the blob = {}", blobProcessorSet); LOG.info("List of live processors as seen in the table = {}", tableProcessors); if ((System.currentTimeMillis() - startTime) > (BARRIER_TIMEOUT_SEC * 1000)) { barrierTimeout.getAndSet(true); listener.onStateChange(); } else if (blobProcessorSet.equals(tableProcessors)) { listener.onStateChange(); } } } catch (Exception e) { errorHandler.accept("Exception in LeaderBarrierCompleteScheduler. Stopping the processor..."); } }, BARRIER_REACHED_DELAY_SEC, BARRIER_REACHED_DELAY_SEC, TimeUnit.SECONDS); }
Source:
<code>private MethodInvocation createInvocation(AST ast, Expression operand, String operator) { if (fSetter.isEmpty() || fGetter.isEmpty()) { return null; } Expression receiver= getReceiver(operand); InfixExpression argument= ast.newInfixExpression(); MethodInvocation invocation= ast.newMethodInvocation(); invocation.setName(ast.newSimpleName(fSetter)); if (receiver != null) invocation.setExpression((Expression)fRewriter.createCopyTarget(receiver)); invocation.arguments().add(argument); if ("++".equals(operator)) { argument.setOperator(InfixExpression.Operator.PLUS); } else if ("--".equals(operator)) { argument.setOperator(InfixExpression.Operator.MINUS); } else { Assert.isTrue(false, "Should not happen"); } <START> fReferencingSetter= true; <END> MethodInvocation getter= ast.newMethodInvocation(); getter.setName(ast.newSimpleName(fGetter)); if (receiver != null) getter.setExpression((Expression)fRewriter.createCopyTarget(receiver)); argument.setLeftOperand(getter); argument.setRightOperand(ast.newNumberLiteral("1")); fReferencingGetter= true; return invocation; }</code><technical_language>this is needed for usage sooner, sense move here. easier read code 2 fields set bottom</technical_language>

Target:
private MethodInvocation createInvocation(AST ast, Expression operand, String operator) { if (fSetter.isEmpty() || fGetter.isEmpty()) { return null; } Expression receiver= getReceiver(operand); MethodInvocation invocation= ast.newMethodInvocation(); invocation.setName(ast.newSimpleName(fSetter)); if (receiver != null) invocation.setExpression((Expression)fRewriter.createCopyTarget(receiver)); InfixExpression argument= ast.newInfixExpression(); invocation.arguments().add(argument); if ("++".equals(operator)) { argument.setOperator(InfixExpression.Operator.PLUS); } else if ("--".equals(operator)) { argument.setOperator(InfixExpression.Operator.MINUS); } else { Assert.isTrue(false, "Should not happen"); } MethodInvocation getter= ast.newMethodInvocation(); getter.setName(ast.newSimpleName(fGetter)); if (receiver != null) getter.setExpression((Expression)fRewriter.createCopyTarget(receiver)); argument.setLeftOperand(getter); argument.setRightOperand(ast.newNumberLiteral("1")); fReferencingGetter= true; fReferencingSetter= true; return invocation; }
Source:
<code>public void testRedefinitionZeppelinContext() { if (getSparkVersionNumber() > 11) { <START> String redefinitionCode = "z = 1\n"; <END> String restoreCode = "z = _zc\n"; String validCode = "z.input(\"test\")\n"; assertEquals(InterpreterResult.Code.SUCCESS, pySparkInterpreter.interpret(validCode, context).code()); assertEquals(InterpreterResult.Code.SUCCESS, pySparkInterpreter.interpret(redefinitionCode, context).code()); assertEquals(InterpreterResult.Code.ERROR, pySparkInterpreter.interpret(validCode, context).code()); assertEquals(InterpreterResult.Code.SUCCESS, pySparkInterpreter.interpret(restoreCode, context).code()); assertEquals(InterpreterResult.Code.SUCCESS, pySparkInterpreter.interpret(validCode, context).code()); } }</code><technical_language>verify ZeppelinContext work reassign of z</technical_language>

Target:
public void testRedefinitionZeppelinContext() { if (getSparkVersionNumber() > 11) { String redefinitionCode = "z = 1\n"; String restoreCode = "z = __zeppelin__\n"; String validCode = "z.input(\"test\")\n"; assertEquals(InterpreterResult.Code.SUCCESS, pySparkInterpreter.interpret(validCode, context).code()); assertEquals(InterpreterResult.Code.SUCCESS, pySparkInterpreter.interpret(redefinitionCode, context).code()); assertEquals(InterpreterResult.Code.ERROR, pySparkInterpreter.interpret(validCode, context).code()); assertEquals(InterpreterResult.Code.SUCCESS, pySparkInterpreter.interpret(restoreCode, context).code()); assertEquals(InterpreterResult.Code.SUCCESS, pySparkInterpreter.interpret(validCode, context).code()); } }
Source:
<code>public void componentNotFound() { <START> showMessage("Component was not found."); <END> }</code><technical_language>Consider i18n instead of hardcoding string Component found.</technical_language>

Target:
public void componentNotFound() { showMessage(i18n.componentNotFound()); }
Source:
<code>public static synchronized Path handleIngestUrl( final String ingestUrl, final Properties configProperties) throws IOException { if (urlHandlerList == null) { final Iterator<IngestUrlHandlerSpi> handlers = new SPIServiceRegistry(IngestUrlHandlerSpi.class).load(IngestUrlHandlerSpi.class); <START> urlHandlerList = new ArrayList<>(); <END> while (handlers.hasNext()) { urlHandlerList.add(handlers.next()); } } for (final IngestUrlHandlerSpi h : urlHandlerList) { final Path path = h.handlePath(ingestUrl, configProperties); if (path != null) { return path; } } return null; }</code><technical_language>Lists.newArrayList(handlers);</technical_language>

Target:
public static synchronized Path handleIngestUrl( final String ingestUrl, final Properties configProperties) throws IOException { if (urlHandlerList == null) { final Iterator<IngestUrlHandlerSpi> handlers = new SPIServiceRegistry(IngestUrlHandlerSpi.class).load(IngestUrlHandlerSpi.class); urlHandlerList = Lists.newArrayList(handlers); } for (final IngestUrlHandlerSpi h : urlHandlerList) { final Path path = h.handlePath(ingestUrl, configProperties); if (path != null) { return path; } } return null; }
Source:
<code>public EnterpriseBeanProxyMethodHandler(SessionBean<T> bean, SessionObjectReference reference) { this.bean = bean; this.manager = bean.getBeanManager(); this.beanId = bean.getIdentifier(); this.reference = reference; <START> BeanLogger.LOG.createdSessionBeanProxy(bean); <END> }</code><technical_language>add a new logging statement distinguish cases: - a new proxy is created - proxy is activated passivation</technical_language>

Target:
private EnterpriseBeanProxyMethodHandler(SessionBean<T> bean, SessionObjectReference reference) { this.bean = bean; this.manager = bean.getBeanManager(); this.beanId = bean.getIdentifier(); Map<Class<?>, Class<?>> typeToBusinessInterfaceMap = new HashMap<Class<?>, Class<?>>(); discoverBusinessInterfaces(typeToBusinessInterfaceMap, bean.getEjbDescriptor().getRemoteBusinessInterfacesAsClasses()); discoverBusinessInterfaces(typeToBusinessInterfaceMap, bean.getEjbDescriptor().getLocalBusinessInterfacesAsClasses()); this.typeToBusinessInterfaceMap = ImmutableMap.copyOf(typeToBusinessInterfaceMap); if (reference == null) { this.reference = bean.createReference(); BeanLogger.LOG.createdSessionBeanProxy(bean); } else { this.reference = reference; BeanLogger.LOG.activatedSessionBeanProxy(bean); } }
Source:
<code>@Test public void testDistinctWithFilterAndGroupBy() { <START> final String sql = "SELECT deptno, SUM(comm), COUNT(DISTINCT comm),\n" + "COUNT(DISTINCT sal) FILTER (WHERE sal > 1000)\n" <END> + "FROM emp\n" + "GROUP BY deptno"; HepProgram program = new HepProgramBuilder() .addRuleInstance(AggregateExpandDistinctAggregatesRule.INSTANCE) .build(); sql(sql).with(program).check(); }</code><technical_language>Is this a minimal reproducible example? Frankly speaking, is hard follow code, is sad is trivial example in PR. I prefer a simple example clear rule produces</technical_language>

Target:
@Test public void testDistinctWithFilterAndGroupBy() { final String sql = "SELECT deptno, SUM(comm), COUNT(DISTINCT sal) FILTER (WHERE sal > 1000)\n" + "FROM emp\n" + "GROUP BY deptno"; HepProgram program = new HepProgramBuilder() .addRuleInstance(AggregateExpandDistinctAggregatesRule.INSTANCE) .build(); sql(sql).with(program).check(); }
Source:
<code>public void configure(JobConf job) { InitializationProperties props = new InitializationProperties(); <START> props.setZookeepers(job.get("io.fluo.zookeeper.connect")); <END> props.setZookeeperRoot(job.get("io.fluo.zookeeper.root")); props.setAccumuloInstance(job.get("io.fluo.accumulo.instance")); props.setAccumuloUser(job.get("io.fluo.accumulo.user")); props.setAccumuloPassword(job.get("io.fluo.accumulo.password")); nodeSize = job.getInt("trie.node.size", 4); LoaderExecutorProperties lep = new LoaderExecutorProperties(props); try { le = new LoaderExecutor(lep); } catch (Exception e) { e.printStackTrace(); } }</code><technical_language>This contants setter methods. strictly related this issue. interested in changing this part of this patch? If I open another issue change</technical_language>

Target:
public void configure(JobConf job) { InitializationProperties props = new InitializationProperties(); props.setZookeepers(job.get(Constants.FLUO_PREFIX + ".zookeeper.connect")); props.setZookeeperRoot(job.get(Constants.FLUO_PREFIX + ".zookeeper.root")); props.setAccumuloInstance(job.get(Constants.FLUO_PREFIX + ".accumulo.instance")); props.setAccumuloUser(job.get(Constants.FLUO_PREFIX + ".accumulo.user")); props.setAccumuloPassword(job.get(Constants.FLUO_PREFIX + ".accumulo.password")); nodeSize = job.getInt("trie.node.size", 4); LoaderExecutorProperties lep = new LoaderExecutorProperties(props); try { le = new LoaderExecutor(lep); } catch (Exception e) { e.printStackTrace(); } }
Source:
<code>private void setupImportObservedButton( final View view ) { final Button importObservedButton = (Button) view.findViewById( R.id.import_observed_button ); final SharedPreferences prefs = getActivity().getSharedPreferences(ListFragment.SHARED_PREFS, 0); final String authname = prefs.getString(ListFragment.PREF_AUTHNAME, null); if (null == authname) { importObservedButton.setEnabled(false); } else if (MainActivity.getMainActivity().isTransferring()) { importObservedButton.setEnabled(false); } else { <START> importObservedButton.setOnClickListener(new OnClickListener() { <END> @Override public void onClick(final View buttonView) { MainActivity.createConfirmation(getActivity(), DataFragment.this.getString(R.string.data_import_observed), MainActivity.DATA_TAB_POS, IMPORT_DIALOG); } }); } }</code><technical_language>Pry leave listener else, set, if button is enabled work</technical_language>

Target:
private void setupImportObservedButton( final View view ) { final Button importObservedButton = (Button) view.findViewById( R.id.import_observed_button ); final SharedPreferences prefs = getActivity().getSharedPreferences(ListFragment.SHARED_PREFS, 0); final String authname = prefs.getString(ListFragment.PREF_AUTHNAME, null); if (null == authname) { importObservedButton.setEnabled(false); } else if (MainActivity.getMainActivity().isTransferring()) { importObservedButton.setEnabled(false); } importObservedButton.setOnClickListener(new OnClickListener() { @Override public void onClick(final View buttonView) { MainActivity.createConfirmation(getActivity(), DataFragment.this.getString(R.string.data_import_observed), MainActivity.DATA_TAB_POS, IMPORT_DIALOG); } }); }
Source:
<code>private void deleteExecutionDir(final int executionId) { <START> LOGGER.debug("Deleting execution directory for " + executionId); <END> synchronized (this.executionDirDeletionSync) { final Path flowExecutionDir = Paths.get(this.executionDirectory.toPath().toString(), String.valueOf(executionId)); try { FileUtils.deleteDirectory(flowExecutionDir.toFile()); } catch (final IOException e) { LOGGER.warn("Error when deleting directory " + flowExecutionDir.toAbsolutePath() + ".", e); } } }</code><technical_language>this output happen *inside* synchronized block, in case enter right (or all)</technical_language>

Target:
private void deleteExecutionDir(final int executionId) { LOGGER.info("Deleting execution directory for " + executionId); synchronized (this.executionDirDeletionSync) { LOGGER.info("Starting execution directory deletion for " + executionId); final Path flowExecutionDir = Paths.get(this.executionDirectory.toPath().toString(), String.valueOf(executionId)); try { FileUtils.deleteDirectory(flowExecutionDir.toFile()); } catch (final IOException e) { LOGGER.warn("Error when deleting directory " + flowExecutionDir.toAbsolutePath() + ".", e); } } }
Source:
<code>public long getItemId(int position) { return getItemAtPosition(position)._id; <START> } <END></code><technical_language>is getItemAtPosition returns null -> NPE</technical_language>

Target:
public long getItemId(int position) { if (isValidPosition(position)) { return getItemAtPosition(position)._id; } else { return NO_POSITION; } }
Source:
<code>public void add(Object obj) throws IOException { if (obj == null) { addValues(null); } else if (obj instanceof int[]) { addValues(Ints.asList((int[]) obj)); } else if (obj instanceof List) { addValues((List<Integer>) obj); } else { <START> throw new IAE("unsupported object type"); <END> } }</code><technical_language>print object type is well</technical_language>

Target:
public void add(Object obj) throws IOException { if (obj == null) { addValues(null); } else if (obj instanceof int[]) { addValues(Ints.asList((int[]) obj)); } else if (obj instanceof List) { addValues((List<Integer>) obj); } else { throw new IAE("unsupported multi-value type: " + obj.getClass()); } }