auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public ConfigProvider newConfigProvider(AbstractConfig config, String providerPrefix, ClassLoaderUsage classLoaderUsage) { String classPropertyName = providerPrefix + ".class"; Map<String, String> originalConfig = config.originalsStrings(); if (!originalConfig.containsKey(classPropertyName)) { return null; } Class<? extends ConfigProvider> klass = null; switch (classLoaderUsage) { case CURRENT_CLASSLOADER: klass = pluginClassFromConfig(config, classPropertyName, ConfigProvider.class); break; case PLUGINS: String configProviderClassOrAlias = originalConfig.get(classPropertyName); try { klass = pluginClass(delegatingLoader, configProviderClassOrAlias, ConfigProvider.class); } catch (ClassNotFoundException e) { throw new ConnectException( "Failed to find any class that implements ConfigProvider and which name matches " + configProviderClassOrAlias + ", available ConfigProviders are: " + pluginNames(delegatingLoader.configProviders()) ); } break; } if (klass == null) { throw new ConnectException("Unable to initialize the ConfigProvider specified in '" + classPropertyName + "'"); } String configPrefix = providerPrefix + ".param."; Map<String, Object> configProviderConfig = config.originalsWithPrefix(configPrefix); <START> ConfigProvider plugin; <END> ClassLoader savedLoader = compareAndSwapLoaders(klass.getClassLoader()); try { plugin = newPlugin(klass); plugin.configure(configProviderConfig); } finally { compareAndSwapLoaders(savedLoader); } return plugin; }</code><technical_language>ConfigProvider introduced in AK 2.0, this change backported earlier branches</technical_language>

Target:
public ConfigProvider newConfigProvider(AbstractConfig config, String providerPrefix, ClassLoaderUsage classLoaderUsage) { String classPropertyName = providerPrefix + ".class"; Map<String, String> originalConfig = config.originalsStrings(); if (!originalConfig.containsKey(classPropertyName)) { return null; } Class<? extends ConfigProvider> klass = null; switch (classLoaderUsage) { case CURRENT_CLASSLOADER: klass = pluginClassFromConfig(config, classPropertyName, ConfigProvider.class, delegatingLoader.configProviders()); break; case PLUGINS: String configProviderClassOrAlias = originalConfig.get(classPropertyName); try { klass = pluginClass(delegatingLoader, configProviderClassOrAlias, ConfigProvider.class); } catch (ClassNotFoundException e) { throw new ConnectException( "Failed to find any class that implements ConfigProvider and which name matches " + configProviderClassOrAlias + ", available ConfigProviders are: " + pluginNames(delegatingLoader.configProviders()) ); } break; } if (klass == null) { throw new ConnectException("Unable to initialize the ConfigProvider specified in '" + classPropertyName + "'"); } String configPrefix = providerPrefix + ".param."; Map<String, Object> configProviderConfig = config.originalsWithPrefix(configPrefix); ConfigProvider plugin; ClassLoader savedLoader = compareAndSwapLoaders(klass.getClassLoader()); try { plugin = newPlugin(klass); plugin.configure(configProviderConfig); } finally { compareAndSwapLoaders(savedLoader); } return plugin; }
Source:
<code>protected void onCreate(Bundle savedInstanceState) { <START> super.onCreate(savedInstanceState); <END> setContentView(R.layout.activity_main); mMapView = (MapView) findViewById(R.id.mapView); final ArcGISMap map = new ArcGISMap(Basemap.createTopographic()); mMapView.setMap(map); SimpleMarkerSymbol markerSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbol.Style.TRIANGLE, Color.BLUE, 14); SimpleFillSymbol fillSymbol = new SimpleFillSymbol(SimpleFillSymbol.Style.CROSS, Color.BLUE, null); SimpleLineSymbol lineSymbol = new SimpleLineSymbol(SimpleLineSymbol.Style.SOLID, Color.BLUE, 3); GraphicsOverlay overlay = new GraphicsOverlay(); mMapView.getGraphicsOverlays().add(overlay); overlay.getGraphics().add(new Graphic(createPolygon(), fillSymbol)); overlay.getGraphics().add(new Graphic(createPolyline(), lineSymbol)); overlay.getGraphics().add(new Graphic(createMultipoint(), markerSymbol)); overlay.getGraphics().add(new Graphic(createPoint(), markerSymbol)); mMapView.setViewpointGeometryAsync(createEnvelope(), getResources().getDimension(R.dimen.viewpoint_padding)); }</code><technical_language>order of methods changed here? This order deliberate, show creation of geometries code in sample (code guidelines constructors class methods, this a constructor)</technical_language>

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mMapView = (MapView) findViewById(R.id.mapView); final ArcGISMap mMap = new ArcGISMap(Basemap.createTopographic()); mMapView.setMap(mMap); SimpleMarkerSymbol markerSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbol.Style.TRIANGLE, Color.BLUE, 14); SimpleFillSymbol fillSymbol = new SimpleFillSymbol(SimpleFillSymbol.Style.CROSS, Color.BLUE, null); SimpleLineSymbol lineSymbol = new SimpleLineSymbol(SimpleLineSymbol.Style.SOLID, Color.BLUE, 3); GraphicsOverlay overlay = new GraphicsOverlay(); mMapView.getGraphicsOverlays().add(overlay); overlay.getGraphics().add(new Graphic(createPolygon(), fillSymbol)); overlay.getGraphics().add(new Graphic(createPolyline(), lineSymbol)); overlay.getGraphics().add(new Graphic(createMultipoint(), markerSymbol)); overlay.getGraphics().add(new Graphic(createPoint(), markerSymbol)); mMapView.setViewpointGeometryAsync(createEnvelope(), getResources().getDimension(R.dimen.viewpoint_padding)); }
Source:
<code>private boolean hasExt(PackExt ext) { <START> return (extensions & ext.getBit()) == ext.getBit(); <END> }</code><technical_language>!= 0 is valid if bit is 1 bit set</technical_language>

Target:
private boolean hasExt(PackExt ext) { return (extensions & ext.getBit()) != 0; }
Source:
<code>public static XMLEventReader createXMLEventReader(InputStream inputStream) { try { return XML_INPUT_FACTORY.createXMLEventReader(inputStream); } catch (Exception e) { <START> throw new XmlBeanDefinitionException("Error occurred creating a new XMLEventReader from a InputStream.", e); <END> } }</code><technical_language>Error occurred while creating a new XMLEventReader InputStream</technical_language>

Target:
public static XMLEventReader createXMLEventReader(InputStream inputStream) { try { return XML_INPUT_FACTORY.createXMLEventReader(inputStream); } catch (Exception e) { throw new XmlBeanDefinitionException("Error occurred while creating a new XMLEventReader from InputStream.", e); } }
Source:
<code>public BrooklynCampPlatformLauncherAbstract launch() { <START> assert platform == null; <END> if (getBrooklynMgmt()==null) useManagementContext(newMgmtContext()); platform = new BrooklynCampPlatform( PlatformRootSummary.builder().name("Brooklyn CAMP Platform").build(), getBrooklynMgmt()) .setConfigKeyAtManagmentContext(); return this; }</code><technical_language>assert checkNotNull(platform, "platform")? This is a public method, prefer throw exception replace platform silently if misused in production</technical_language>

Target:
public BrooklynCampPlatformLauncherAbstract launch() { if (platform!=null) throw new IllegalStateException("platform already created"); if (getBrooklynMgmt()==null) useManagementContext(newMgmtContext()); platform = new BrooklynCampPlatform( PlatformRootSummary.builder().name("Brooklyn CAMP Platform").build(), getBrooklynMgmt()) .setConfigKeyAtManagmentContext(); return this; }
Source:
<code>public void testGlobalObjectDeclaredToPreserveItsPreviousValue3() { test("var a = a || {get b() {}}; a.c = 1;", "var a = a || {get b() {}}; var a$c = 1;"); test("var a = a || {get b() {}}; a.c = 1;", <START> "var a = a || {get b() {}}; a.c = 1;"); <END> }</code><technical_language>I difference before/after here, nocollapse annotation is removed. in other tests testSame. is annotation removed in some tests in others? testSame here</technical_language>

Target:
public void testGlobalObjectDeclaredToPreserveItsPreviousValue3() { test("var a = a || {get b() {}}; a.c = 1;", "var a = a || {get b() {}}; var a$c = 1;"); testSame("var a = a || {get b() {}}; a.c = 1;"); }
Source:
<code>public boolean closeConnection() { try { if (cachedConnection != null) { cachedConnection.close(); } return true; } catch (JMSException e) { <START> logger.error("JMS Exception while closing the connection."); <END> } return false; }</code><technical_language>add exception argument</technical_language>

Target:
public void closeConnection() throws JMSException { if (cachedConnection != null) { cachedConnection.close(); } }
Source:
<code>public void addMetricsData( @Suspended final AsyncResponse asyncResponse, @ApiParam(value = "List of metrics", required = true) MixedMetricsRequest metricsRequest) { <START> Collection<Observable<Void>> observables = new ArrayList<>(); <END> List<Gauge> gauges = metricsRequest.getGaugeMetrics(); if (gauges != null && !gauges.isEmpty()) { observables.add(metricsService .addGaugeData(requestToGauges(tenantId, gauges).subscribeOn(Schedulers.computation()))); } List<Counter> counters = metricsRequest.getCounters(); if (counters != null && !counters.isEmpty()) { observables.add(metricsService .addCounterData(requestToCounters(tenantId, counters).subscribeOn(Schedulers.computation()))); } List<Availability> availabilities = metricsRequest.getAvailabilityMetrics(); if (availabilities != null && !availabilities.isEmpty()) { observables.add(metricsService.addAvailabilityData( requestToAvailabilities(tenantId, availabilities).subscribeOn(Schedulers.computation()))); } Observable.merge(observables).subscribe( aVoid -> {}, t -> asyncResponse.resume(ApiUtils.serverError(t)), () -> asyncResponse.resume(Response.ok().build()) ); }</code><technical_language>This reactive design a bit more difficult follow happening. empty observables is issue, processed (nothing react to)</technical_language>

Target:
public void addMetricsData( @Suspended final AsyncResponse asyncResponse, @ApiParam(value = "List of metrics", required = true) MixedMetricsRequest metricsRequest) { if (metricsRequest == null) { asyncResponse.resume(emptyPayload()); return; } List<Gauge> gauges = metricsRequest.getGauges(); List<Counter> counters = metricsRequest.getCounters(); List<Availability> availabilities = metricsRequest.getAvailabilities(); if ((gauges == null || gauges.isEmpty()) && (availabilities == null || availabilities.isEmpty()) && (counters == null || counters.isEmpty())) { asyncResponse.resume(emptyPayload()); return; } Collection<Observable<Void>> observables = new ArrayList<>(); if (gauges != null && !gauges.isEmpty()) { gauges = ImmutableList.copyOf(gauges); observables.add(metricsService .addGaugeData(requestToGauges(tenantId, gauges).subscribeOn(Schedulers.computation()))); } if (counters != null && !counters.isEmpty()) { counters = ImmutableList.copyOf(counters); observables.add(metricsService .addCounterData(requestToCounters(tenantId, counters).subscribeOn(Schedulers.computation()))); } if (availabilities != null && !availabilities.isEmpty()) { availabilities = ImmutableList.copyOf(availabilities); observables.add(metricsService .addAvailabilityData(requestToAvailabilities(tenantId, ImmutableList.copyOf(availabilities)) .subscribeOn(Schedulers.computation()))); } Observable.merge(observables).subscribe( aVoid -> {}, t -> asyncResponse.resume(ApiUtils.serverError(t)), () -> asyncResponse.resume(Response.ok().build()) ); }
Source:
<code>private synchronized SegmentChangeRequestsSnapshot getRequestsSinceWithoutWait(final Counter counter) { Counter lastCounter = getLastCounter(); if (counter.counter >= lastCounter.counter) { <START> throw new IAE("counter >= last counter"); <END> } else if (lastCounter.counter - counter.counter >= maxSize) { throw new IAE("can't serve request, not enough history is kept"); } else { int changeStartIndex = (int) (counter.counter + changes.size() - lastCounter.counter); Counter counterToMatch = counter.counter == 0 ? Counter.ZERO : changes.get(changeStartIndex - 1).counter; if (!counterToMatch.matches(counter)) { throw new IAE("counter failed to match"); } List<DataSegmentChangeRequest> result = new ArrayList<>(); for (int i = changeStartIndex; i < changes.size(); i++) { result.add(changes.get(i).changeRequest); } return new SegmentChangeRequestsSnapshot(changes.get(changes.size() - 1).counter, result); } }</code><technical_language>Please include actual values in here, message exists debugging if thrown</technical_language>

Target:
private synchronized SegmentChangeRequestsSnapshot getRequestsSinceWithoutWait(final Counter counter) { Counter lastCounter = getLastCounter(); if (counter.counter >= lastCounter.counter) { throw new IAE("counter[%s] >= last counter[%s]", counter, lastCounter); } else if (lastCounter.counter - counter.counter >= maxSize) { return SegmentChangeRequestsSnapshot.fail( StringUtils.safeFormat( "can't serve request, not enough history is kept. given counter [%s] and current last counter [%s]", counter, lastCounter ) ); } else { int changeStartIndex = (int) (counter.counter + changes.size() - lastCounter.counter); Counter counterToMatch = counter.counter == 0 ? Counter.ZERO : changes.get(changeStartIndex - 1).counter; if (!counterToMatch.matches(counter)) { throw new IAE("counter[%s] failed to match with [%s]", counter, counterToMatch); } List<DataSegmentChangeRequest> result = new ArrayList<>(); for (int i = changeStartIndex; i < changes.size(); i++) { result.add(changes.get(i).changeRequest); } return SegmentChangeRequestsSnapshot.success(changes.get(changes.size() - 1).counter, result); } }
Source:
<code>public void layout(boolean changed) { if (ignoreLayouts) { return; } ignoreLayouts = true; ignoreResizes = true; <START> super.requestLayout(); <END> ignoreResizes = false; }</code><technical_language>Please change layout</technical_language>

Target:
public void layout(boolean changed) { if (ignoreLayouts) { return; } ignoreLayouts = true; ignoreResizes = true; super.layout(changed); ignoreResizes = false; }
Source:
<code>public String createGroup(UserGroup group) throws SharingRegistryException, TException { try{ UserGroupPK userGroupPK = new UserGroupPK(); userGroupPK.setGroupId(group.groupId); userGroupPK.setDomainId(group.domainId); if((new UserGroupRepository()).get(userGroupPK) != null) throw new SharingRegistryException("There exist group with given group id"); group.setGroupCardinality(GroupCardinality.MULTI_USER); group.setCreatedTime(System.currentTimeMillis()); group.setUpdatedTime(System.currentTimeMillis()); (new UserGroupRepository()).create(group); <START> if(group.ownerId != null) <END> addUsersToGroup(group.domainId, Arrays.asList(group.ownerId), group.groupId); return group.groupId; }catch (Throwable ex) { logger.error(ex.getMessage(), ex); throw new SharingRegistryException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex)); } }</code><technical_language>Sneha, instead of owner, owner argument migration script in other pull request</technical_language>

Target:
public String createGroup(UserGroup group) throws SharingRegistryException, TException { try{ UserGroupPK userGroupPK = new UserGroupPK(); userGroupPK.setGroupId(group.groupId); userGroupPK.setDomainId(group.domainId); if((new UserGroupRepository()).get(userGroupPK) != null) throw new SharingRegistryException("There exist group with given group id"); group.setGroupCardinality(GroupCardinality.MULTI_USER); group.setCreatedTime(System.currentTimeMillis()); group.setUpdatedTime(System.currentTimeMillis()); (new UserGroupRepository()).create(group); addUsersToGroup(group.domainId, Arrays.asList(group.ownerId), group.groupId); return group.groupId; }catch (Throwable ex) { logger.error(ex.getMessage(), ex); throw new SharingRegistryException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex)); } }
Source:
<code>private HttpPipelinePolicy createHttpPipelineAuthPolicy() { <START> HttpPipelinePolicy authPolicy; <END> if (this.tokenCredential != null) { authPolicy = new BearerTokenAuthenticationPolicy( this.tokenCredential, "<LINK_0>"); } else if (this.credential != null) { authPolicy = new HmacAuthenticationPolicy(this.credential); } else { throw logger.logExceptionAsError( new IllegalArgumentException("Missing credential information while building a client.")); } return authPolicy; }</code><technical_language>Do need create authPolicy variable? return directly</technical_language>

Target:
private HttpPipelinePolicy createHttpPipelineAuthPolicy() { if (this.tokenCredential != null && this.accessKeyCredential != null) { throw logger.logExceptionAsError( new IllegalArgumentException("Both 'credential' and 'accessKey' are set. Just one may be used.")); } if (this.tokenCredential != null) { return new BearerTokenAuthenticationPolicy( this.tokenCredential, "<LINK_0>"); } else if (this.accessKeyCredential != null) { return new HmacAuthenticationPolicy(this.accessKeyCredential); } else { throw logger.logExceptionAsError( new IllegalArgumentException("Missing credential information while building a client.")); } }
Source:
<code>protected void executeCommand() { GlusterVolumeGeoRepSessionStartParameters parameters = getParameters(); setGlusterVolumeId(parameters.getVolumeId()); <START> VDSReturnValue returnValue = runVdsCommand(VDSCommandType.GlusterVolumeGeoRepStart, new GlusterVolumeGeoRepSessionStartVDSParameters(upServer.getId(), getGlusterVolumeName(), parameters.getSlaveVolumeName(), parameters.getSlaveHost())); <END> setSucceeded(returnValue.getSucceeded()); if(! getSucceeded()) { handleVdsError(AuditLogType.GLUSTER_VOLUME_GEO_REP_START_FAILED_EXCEPTION, returnValue.getVdsError().getMessage()); } }</code><technical_language>need validate parameters present in canDoAction method</technical_language>

Target:
protected void executeCommand() { GlusterVolumeGeoRepSessionParameters parameters = getParameters(); setGlusterVolumeId(parameters.getVolumeId()); VDSReturnValue returnValue = runVdsCommand(VDSCommandType.GlusterVolumeGeoRepStart, new GlusterVolumeGeoRepSessionVDSParameters(upServer.getId(), getGlusterVolumeName(), parameters.getSlaveVolumeName(), parameters.getSlaveHost())); setSucceeded(returnValue.getSucceeded()); if(getSucceeded()) { getGeoRepSession().setStatus(GeoRepSessionStatus.ACTIVE); getGlusterGeoRepDao().updateSession(getGeoRepSession()); } else { handleVdsError(AuditLogType.GLUSTER_VOLUME_GEO_REP_START_FAILED_EXCEPTION, returnValue.getVdsError().getMessage()); return; } }
Source:
<code>public Image createImage(boolean returnMissingImageOnError, Device device) { try { return new Image(device, <START> ((ImageDataProvider) this)::getImageData); <END> } catch (IllegalArgumentException | SWTException e) { if (returnMissingImageOnError) { try { return new Image(device, DEFAULT_IMAGE_DATA); } catch (SWTException e2) { return null; } } return null; } }</code><technical_language>new Image(device, (ImageDataProvider) this::getImageData); enough</technical_language>

Target:
public Image createImage(boolean returnMissingImageOnError, Device device) { try { return new Image(device, (ImageDataProvider) this::getImageData); } catch (IllegalArgumentException | SWTException e) { if (returnMissingImageOnError) { try { return new Image(device, DEFAULT_IMAGE_DATA); } catch (SWTException e2) { return null; } } return null; } }
Source:
<code>public void verifyNoAdsOnPage() { <START> scrollToSelector(AdsContent.getSlotSelector(AdsContent.BOTTOM_LB)); <END> verifyNoAds(); PageObjectLogging.log( "verifyNoAdsOnPage", "No ads detected", true, driver ); }</code><technical_language>a part of logic in verifyNoAd? reuse SLOT_TRIGGERS in verifyNoAd scroll slot necessary? <LINK_0> pretty implemented :(</technical_language>

Target:
public void verifyNoAdsOnPage() { verifyNoAds(); PageObjectLogging.log( "verifyNoAdsOnPage", "No ads detected", true, driver ); }
Source:
<code>public boolean isDescendant(String potentialChildRelativePath) throws IOException { if (potentialChildRelativePath.equals("") && cacheDescendant) { return true; } if (new File(potentialChildRelativePath).isAbsolute()) { throw new IllegalArgumentException("Only a relative path is supported, the given path is absolute: " + potentialChildRelativePath); } FilePath directChild = this.f.child(potentialChildRelativePath); if (Objects.equals(directChild.getParent(), this.f)) { try { boolean isDirectDescendant = this.f.isDescendant(potentialChildRelativePath); if (isDirectDescendant) { return true; } } <START> catch (InterruptedException e) { <END> } } String relativePath = computeRelativePathToRoot(); try { return this.root.isDescendant(relativePath + potentialChildRelativePath); } catch (InterruptedException e) { return false; } }</code><technical_language>gonna reset interrupt status this</technical_language>

Target:
public boolean isDescendant(String potentialChildRelativePath) throws IOException { if (potentialChildRelativePath.equals("") && cacheDescendant) { return true; } if (new File(potentialChildRelativePath).isAbsolute()) { throw new IllegalArgumentException("Only a relative path is supported, the given path is absolute: " + potentialChildRelativePath); } FilePath directChild = this.f.child(potentialChildRelativePath); if (Objects.equals(directChild.getParent(), this.f)) { try { boolean isDirectDescendant = this.f.isDescendant(potentialChildRelativePath); if (isDirectDescendant) { return true; } } catch (InterruptedException e) { return false; } } String relativePath = computeRelativePathToRoot(); try { return this.root.isDescendant(relativePath + potentialChildRelativePath); } catch (InterruptedException e) { return false; } }
Source:
<code>public TodoList() { <START> setId("template"); <END> creator.getElement().addEventListener("new-task", event -> { Todo todo = mapTodo(event.getEventData()); TodoElement todoElement = new TodoElement(todo); todoElement.getElement().addEventListener("remove", e -> getElement().removeChild(todoElement.getElement())); todoElement.addStateChangeListener( () -> { if (todoElement.isCompleted()) { todoElement.getElement().setAttribute("slot", "done"); } }); getElement().appendChild(todoElement.getElement()); }, "event.detail"); }</code><technical_language>![MAJOR](<LINK_0> 'Severity: MAJOR') Remove this call a constructor overridable "setId" method. [![rule](<LINK_1>](<LINK_2></technical_language>

Target:
public TodoList() { setId("template"); creator.addCreateCallback(todo -> addNewTodoItem(todo)); }
Source:
<code><START> private void handleTagDeleted(BlackBoardArtifactTagDeletedEvent tagDeletedEvent) { <END> Case openCase; try { openCase = Case.getCurrentCaseThrows(); } catch (NoCurrentCaseException ex) { LOGGER.log(Level.SEVERE, "Exception while getting open case.", ex); return; } long contentID = tagDeletedEvent.getDeletedTagInfo().getContentID(); long artifactID = tagDeletedEvent.getDeletedTagInfo().getArtifactID(); if (!isNotableTagName(tagDeletedEvent.getDeletedTagInfo().getName())) { return; } try { Content content = openCase.getSleuthkitCase().getContentById(contentID); BlackboardArtifact bbArtifact = openCase.getSleuthkitCase().getBlackboardArtifact(artifactID); TagsManager tagsManager = openCase.getServices().getTagsManager(); List<BlackboardArtifactTag> tags = tagsManager.getBlackboardArtifactTagsByArtifact(bbArtifact); if (hasNotableTag(tags)) { String comment = getMostRecentNotableComment(tags); setArtifactKnownStatus(content, bbArtifact, comment, TskData.FileKnown.BAD, false); } else { String comment = tagDeletedEvent.getDeletedTagInfo().getComment(); setArtifactKnownStatus(content, bbArtifact, comment, TskData.FileKnown.UNKNOWN, true); } } catch (TskCoreException ex) { LOGGER.log(Level.SEVERE, "Failed to find content", ex); return; } }</code><technical_language>remarks file tag added/deleted event handling; artifact tag added/deleted event handling is similar</technical_language>

Target:
private void handleTagDeleted(BlackBoardArtifactTagDeletedEvent tagDeletedEvent) { Case openCase; try { openCase = Case.getCurrentCaseThrows(); } catch (NoCurrentCaseException ex) { LOGGER.log(Level.SEVERE, "Exception while getting open case.", ex); return; } long contentID = tagDeletedEvent.getDeletedTagInfo().getContentID(); long artifactID = tagDeletedEvent.getDeletedTagInfo().getArtifactID(); try { Content content = openCase.getSleuthkitCase().getContentById(contentID); if (isKnownFile(content)) { return; } BlackboardArtifact bbArtifact = openCase.getSleuthkitCase().getBlackboardArtifact(artifactID); TagsManager tagsManager = openCase.getServices().getTagsManager(); List<BlackboardArtifactTag> tags = tagsManager.getBlackboardArtifactTagsByArtifact(bbArtifact); List<CorrelationAttributeInstance> instanceToDelete = CorrelationAttributeUtil.makeCorrAttrsForCorrelation(bbArtifact); instanceToDelete.forEach((cai) -> { try { AttributeUpdate attrUpdate = assessTagDelete(dbManager, cai, tags); setArtifactKnownStatus(cai, attrUpdate.getComment(), attrUpdate.getFileKnown()); } catch (CentralRepoException | CorrelationAttributeNormalizationException ex) { LOGGER.log(Level.WARNING, "There was an error assessing new status for " + cai + " during blackboard artifact tag deletion event.", ex); } }); } catch (TskCoreException ex) { LOGGER.log(Level.SEVERE, "Failed to find content", ex); return; } }
Source:
<code>private long streamQuery0(String qry, String schemaName, IgniteDataStreamer streamer, QueryParserResultDml dml, final Object[] args) throws IgniteCheckedException { Long qryId = runningQryMgr.register(qry, GridCacheQueryType.SQL_FIELDS, schemaName, true, null); Exception failReason = null; try { UpdatePlan plan = dml.plan(); Object[] params = args != null ? args : X.EMPTY_OBJECT_ARRAY; Iterator<List<?>> iter0; if (!F.isEmpty(plan.selectQuery())) { SqlFieldsQuery selectQry = new SqlFieldsQuery(plan.selectQuery()) .setArgs(params) <START> .setLocal(true); <END> QueryParserResult selectParseRes = parser.parse(schemaName, selectQry, false); GridQueryFieldsResult res = executeSelectLocal( selectParseRes.queryDescriptor(), selectParseRes.queryParameters(), selectParseRes.select(), null, null, null, false, 0 ); iter0 = res.iterator(); } else iter0 = plan.createRows(params).iterator(); Iterator<List<?>> iter = new GridQueryCacheObjectsIterator(iter0, objectContext(), true); Map<Object, Object> rows = null; while (iter.hasNext()) { List<?> row = iter.next(); IgniteBiTuple<?, ?> t = plan.processRow(row); if (rows == null) { if (iter.hasNext()) rows = new LinkedHashMap<>(plan.rowCount()); else { streamer.addData(t.getKey(), t.getValue()); return 1; } } rows.put(t.getKey(), t.getValue()); } streamer.addData(rows); return rows.size(); } catch (IgniteException | IgniteCheckedException e) { failReason = e; throw e; } finally { runningQryMgr.unregister(qryId, failReason); } }</code><technical_language>this query is local</technical_language>

Target:
private long streamQuery0(String qry, String schemaName, IgniteDataStreamer streamer, QueryParserResultDml dml, final Object[] args) throws IgniteCheckedException { Long qryId = runningQryMgr.register(qry, GridCacheQueryType.SQL_FIELDS, schemaName, true, null); Exception failReason = null; try { UpdatePlan plan = dml.plan(); Iterator<List<?>> iter = new GridQueryCacheObjectsIterator(updateQueryRows(schemaName, plan, args), objectContext(), true); if (!iter.hasNext()) return 0; IgniteBiTuple<?, ?> t = plan.processRow(iter.next()); if (!iter.hasNext()) { streamer.addData(t.getKey(), t.getValue()); return 1; } else { Map<Object, Object> rows = new LinkedHashMap<>(plan.rowCount()); rows.put(t.getKey(), t.getValue()); while (iter.hasNext()) { List<?> row = iter.next(); t = plan.processRow(row); rows.put(t.getKey(), t.getValue()); } streamer.addData(rows); return rows.size(); } } catch (IgniteException | IgniteCheckedException e) { failReason = e; throw e; } finally { runningQryMgr.unregister(qryId, failReason); } }
Source:
<code>public void checkSpecialization() { if (isSpecializing()) { boolean isNameDefined = getAnnotated().isAnnotationPresent(Named.class); String previousSpecializedBeanName = null; for (AbstractBean<?, ?> specializedBean : getSpecializedBeans()) { String name = specializedBean.getName(); if (previousSpecializedBeanName != null && name != null && !previousSpecializedBeanName.equals(specializedBean.getName())) { throw BeanLogger.LOG.beansWithDifferentBeanNamesCannotBeSpecialized(previousSpecializedBeanName, specializedBean.getName(), this); } previousSpecializedBeanName = name; if (isNameDefined && name != null) { throw BeanLogger.LOG.nameNotAllowedOnSpecialization(getAnnotated()); } for (Type type : specializedBean.getTypes()) { if (!getTypes().contains(type)) { boolean assignable = false; if (type instanceof ParameterizedType) { for (Type specializingType : getTypes()) { if (specializingType instanceof ParameterizedType) { <START> if (((ParameterizedType) specializingType).getRawType().equals( <END> ((ParameterizedType) type).getRawType())) { assignable = BeanTypeAssignabilityRules.instance().isAssignableFrom(type, specializingType); } } } } if (!assignable) { throw BeanLogger.LOG.specializingBeanMissingSpecializedType(this, type, specializedBean); } } } } } }</code><technical_language>Reflections.getRawType() utility method</technical_language>

Target:
public void checkSpecialization() { if (isSpecializing()) { boolean isNameDefined = getAnnotated().isAnnotationPresent(Named.class); String previousSpecializedBeanName = null; for (AbstractBean<?, ?> specializedBean : getSpecializedBeans()) { String name = specializedBean.getName(); if (previousSpecializedBeanName != null && name != null && !previousSpecializedBeanName.equals(specializedBean.getName())) { throw BeanLogger.LOG.beansWithDifferentBeanNamesCannotBeSpecialized(previousSpecializedBeanName, specializedBean.getName(), this); } previousSpecializedBeanName = name; if (isNameDefined && name != null) { throw BeanLogger.LOG.nameNotAllowedOnSpecialization(getAnnotated()); } boolean rawInsteadOfGeneric = (this instanceof AbstractClassBean<?> && specializedBean.getBeanClass().getTypeParameters().length > 0 && !(((AbstractClassBean<?>) this).getBeanClass().getGenericSuperclass() instanceof ParameterizedType)); for (Type specializedType : specializedBean.getTypes()) { if (rawInsteadOfGeneric && specializedType instanceof ParameterizedType) { throw BeanLogger.LOG.specializingBeanMissingSpecializedType(this, specializedType, specializedBean); } boolean contains = getTypes().contains(specializedType); if (!contains) { for (Type specializingType : getTypes()) { if (TypeEqualitySpecializationUtils.areTheSame(specializingType, specializedType)) { contains = true; break; } } } if (!contains) { throw BeanLogger.LOG.specializingBeanMissingSpecializedType(this, specializedType, specializedBean); } } } } }
Source:
<code>protected String[] customCommandLineValidation() { final List<String> errorMsgs = new ArrayList<>(); if (SCATTER_COUNT < 1) { errorMsgs.add("SCATTER_COUNT must be greater than 0."); } if (BREAK_BANDS_AT_MULTIPLES_OF < 0) { errorMsgs.add("BREAK_BANDS_AT_MULTIPLES_OF must be greater than or equal to 0."); } if ((SECOND_INPUT == null || SECOND_INPUT.isEmpty()) && ACTION.takesSecondInput) { errorMsgs.add("SECOND_INPUT was not provided but action " + ACTION + " requires a second input."); } if ((SECOND_INPUT != null && !SECOND_INPUT.isEmpty()) && !ACTION.takesSecondInput) { errorMsgs.add("SECOND_INPUT was provided but action " + ACTION + " doesn't take a second input."); } if (COUNT_OUTPUT != null && OUTPUT_VALUE == Output.NONE) { errorMsgs.add("COUNT_OUTPUT was provided but OUTPUT_VALUE is set to NONE."); } if (ACTION == Action.UNION && DONT_COMBINE_ABUTTING) { <START> errorMsgs.add("ACTION=UNION action combines abutting intervals by default, so it is incompatible with DONT_COMBINE_ABUTTING=true."); <END> } return errorMsgs.isEmpty() ? null : errorMsgs.toArray(new String[0]); }</code><technical_language>replicate htsjdk code a private method allows state "mergeAbutting", right? eventually push htsdjk</technical_language>

Target:
protected String[] customCommandLineValidation() { final List<String> errorMsgs = new ArrayList<>(); if (SCATTER_COUNT < 1) { errorMsgs.add("SCATTER_COUNT must be greater than 0."); } if (BREAK_BANDS_AT_MULTIPLES_OF < 0) { errorMsgs.add("BREAK_BANDS_AT_MULTIPLES_OF must be greater than or equal to 0."); } if ((SECOND_INPUT == null || SECOND_INPUT.isEmpty()) && ACTION.takesSecondInput) { errorMsgs.add("SECOND_INPUT was not provided but action " + ACTION + " requires a second input."); } if ((SECOND_INPUT != null && !SECOND_INPUT.isEmpty()) && !ACTION.takesSecondInput) { errorMsgs.add("SECOND_INPUT was provided but action " + ACTION + " doesn't take a second input."); } if (COUNT_OUTPUT != null && OUTPUT_VALUE == Output.NONE) { errorMsgs.add("COUNT_OUTPUT was provided but OUTPUT_VALUE is set to NONE."); } return errorMsgs.isEmpty() ? null : errorMsgs.toArray(new String[0]); }
Source:
<code>HelixStoreOperator(HelixPropertyStoreConfig storeConfig, HelixPropertyStoreFactory storeFactory) { ArrayList<String> paths = new ArrayList<>(); paths.add(storeConfig.rootPath); <START> store = storeFactory.getHelixPropertyStore(storeConfig, paths); <END> }</code><technical_language>if Collections.singletonList(storeConfig.rootPath) works instead of creating ArrayList</technical_language>

Target:
HelixStoreOperator(HelixPropertyStoreConfig storeConfig, HelixPropertyStoreFactory storeFactory) { List<String> subscribedPaths = Collections.singletonList(storeConfig.rootPath); store = storeFactory.getHelixPropertyStore(storeConfig, subscribedPaths); }
Source:
<code>public void resumeParallel() throws Exception { prism.getClusterHelper().submitEntity(URLS.SUBMIT_URL, bundles[0].getClusters().get(0)); prism.getFeedHelper().submitEntity(URLS.SUBMIT_URL, bundles[0].getDataSets().get(0)); <START> prism.getFeedHelper().schedule(URLS.SCHEDULE_URL, bundles[0].getDataSets().get(0)); <END> Thread.sleep(15000); prism.getFeedHelper().resume(URLS.RESUME_URL, bundles[0].getDataSets().get(0)); Thread.sleep(5000); prism.getFeedHelper().suspend(URLS.SUSPEND_URL, bundles[0].getDataSets().get(0)); Thread.sleep(15000); for (int i = 1; i <= brothers.length; i++) { brothers[i - 1] = new Brother("brother" + i, "resume", ENTITY_TYPE.DATA, brotherGrimm, bundles[0], prism, URLS.RESUME_URL); } for (Brother brother : brothers) { brother.start(); } for (Brother brother : brothers) { brother.join(); } for (Brother brother : brothers) { logger.info(brother.getName() + " output: \n" + Util.prettyPrintXml(brother.getOutput().getMessage())); AssertUtil.assertSucceeded(brother.getOutput()); } }</code><technical_language>add assertion response</technical_language>

Target:
public void resumeParallel() throws Exception { prism.getClusterHelper().submitEntity(URLS.SUBMIT_URL, bundles[0].getClusters().get(0)); prism.getFeedHelper().submitEntity(URLS.SUBMIT_URL, bundles[0].getDataSets().get(0)); AssertUtil.assertSucceeded(prism.getFeedHelper().schedule(URLS.SCHEDULE_URL, bundles[0].getDataSets().get(0))); Thread.sleep(15000); prism.getFeedHelper().resume(URLS.RESUME_URL, bundles[0].getDataSets().get(0)); Thread.sleep(5000); prism.getFeedHelper().suspend(URLS.SUSPEND_URL, bundles[0].getDataSets().get(0)); Thread.sleep(15000); for (int i = 1; i <= brothers.length; i++) { brothers[i - 1] = new Brother("brother" + i, "resume", ENTITY_TYPE.DATA, brotherGrimm, bundles[0], prism, URLS.RESUME_URL); } for (Brother brother : brothers) { brother.start(); } for (Brother brother : brothers) { brother.join(); } for (Brother brother : brothers) { logger.info(brother.getName() + " output: \n" + Util.prettyPrintXml(brother.getOutput().getMessage())); AssertUtil.assertSucceeded(brother.getOutput()); } }
Source:
<code>private void parseConfiguration() { Map<String, String> defaultsMapping = new HashMap<>(); if (!defaults.isEmpty()) { String[] defaultsList = this.defaults.split(","); for (String defaultValue : defaultsList) { <START> String[] defaultsArray = defaultValue.split(":"); <END> defaultsMapping.put(defaultsArray[0], defaultsArray[1]); } } String[] mappingArray = this.mapping.split(","); for (String mapping : mappingArray) { String[] mappingValueArray = mapping.split(":"); ValueMapping valueMapping = new ValueMapping(); valueMapping.setTargetField(mappingValueArray[2]); valueMapping.setLookupTableName(mappingValueArray[1]); if (defaultsMapping.containsKey(mappingValueArray[0])) { valueMapping.setDefaultValue(defaultsMapping.get(mappingValueArray[0])); } mappingValues.put(mappingValueArray[0], valueMapping); } }</code><technical_language>check 2 items in array, throw IllegalArgumentException if not, a descriptive message</technical_language>

Target:
private void parseConfiguration() { if (!defaults.isEmpty()) { String[] defaultsList = this.defaults.split(","); for (String defaultValue : defaultsList) { String[] defaultsArray = defaultValue.split(":"); if (defaultsArray.length != 2) { throw new IllegalArgumentException("Invalid default " + defaultValue + ". Defaults should contain source" + " field and its corresponding default value in the format: " + "<source-field>:<default-value>[,<source-field>:<default-value>]*" + "For example: lang_code:English,country_code:Britain"); } else { defaultsMapping.put(defaultsArray[0], defaultsArray[1]); } } } String[] mappingArray = this.mapping.split(","); for (String mapping : mappingArray) { String[] mappingValueArray = mapping.split(":"); if (mappingValueArray.length != 3) { throw new IllegalArgumentException("Invalid mapping " + mapping + ". Mapping should contain source field, " + "lookup table name and target field in the format: " + "<source-field>:<lookup-table-name>:<target-field>" + "[,<source-field>:<lookup-table-name>:<target-field>]*" + "For example: lang_code:language_code_lookup:lang_desc," + "country_code:country_lookup:country_name"); } else { String defaultValue = null; if (defaultsMapping.containsKey(mappingValueArray[0])) { defaultValue = defaultsMapping.get(mappingValueArray[0]); } ValueMapping valueMapping = new ValueMapping(mappingValueArray[2], mappingValueArray[1], defaultValue); mappingValues.put(mappingValueArray[0], valueMapping); } } }
Source:
<code>void mergeConditionalAnd(ConditionalState leftConditionalState, ConditionalState rightConditionalState) { leftConditionalState.falseState.merge(leftConditionalState.trueState, null); <START> leftConditionalState.falseState.merge(rightConditionalState.falseState, null); <END> leftConditionalState.trueState.merge(rightConditionalState.trueState, null); falseState.apply(leftConditionalState.falseState); trueState.apply(leftConditionalState.trueState); }</code><technical_language>I doubtful this "merge" in fact. in case of : java if(a !=null && b!=null) { //... } else { a.foo(); //we raise issue cancel constraints "a" (which is fine) b.foo(); //shall raise issue ? idea path b b is perfectly fine, case is a. } i in example issue in mind of line in else written</technical_language>

Target:
void mergeConditionalAnd(ConditionalState leftConditionalState, ConditionalState rightConditionalState) { trueState.copyValuesFrom(leftConditionalState.trueState); trueState.copyValuesFrom(rightConditionalState.trueState); falseState.copyValuesFrom(leftConditionalState.falseState.invalidateValues()); falseState.copyValuesFrom(rightConditionalState.falseState.invalidateValues()); }
Source:
<code><START> void addPeer(String peerId) throws IOException { <END> boolean added = false; try { added = this.replicationPeers.addPeer(peerId); } catch (ReplicationException e) { throw new IOException(e); } if (added) { addSource(peerId); if (replicationForBulkLoadDataEnabled) { throwIOExceptionWhenFail(() -> this.queueStorage.addPeerToHFileRefs(peerId)); } } }</code><technical_language>Funny, I want stay public in current work (meta region replicas). move in patch</technical_language>

Target:
public void addPeer(String peerId) throws IOException { boolean added = false; try { added = this.replicationPeers.addPeer(peerId); } catch (ReplicationException e) { throw new IOException(e); } if (added) { addSource(peerId); if (replicationForBulkLoadDataEnabled) { throwIOExceptionWhenFail(() -> this.queueStorage.addPeerToHFileRefs(peerId)); } } }
Source:
<code>public boolean updateQuery(final String sql) throws ServiceException { NettyClientBase client = connection.getTajoMasterConnection(); connection.checkSessionAndGet(client); TajoMasterClientProtocolService.BlockingInterface tajoMasterService = client.getStub(); QueryRequest.Builder builder = QueryRequest.newBuilder(); builder.setSessionId(connection.sessionId); builder.setQuery(sql); builder.setIsJson(false); ClientProtos.UpdateQueryResponse response = tajoMasterService.updateQuery(null, builder.build()); if (response.getResultCode() == ClientProtos.ResultCode.OK) { connection.updateSessionVarsCache(ProtoUtil.convertToMap(response.getSessionVars())); return true; } else { if (response.hasErrorMessage()) { <START> System.err.println("ERROR: " + response.getErrorMessage()); <END> } return false; } }</code><technical_language>move this line, nice if change LOG</technical_language>

Target:
public boolean updateQuery(final String sql) throws ServiceException { NettyClientBase client = connection.getTajoMasterConnection(); connection.checkSessionAndGet(client); TajoMasterClientProtocolService.BlockingInterface tajoMasterService = client.getStub(); QueryRequest.Builder builder = QueryRequest.newBuilder(); builder.setSessionId(connection.sessionId); builder.setQuery(sql); builder.setIsJson(false); ClientProtos.UpdateQueryResponse response = tajoMasterService.updateQuery(null, builder.build()); if (response.getResultCode() == ClientProtos.ResultCode.OK) { connection.updateSessionVarsCache(ProtoUtil.convertToMap(response.getSessionVars())); return true; } else { if (response.hasErrorMessage()) { LOG.error("ERROR: " + response.getErrorMessage()); } return false; } }
Source:
<code>private Set<Voice> getAllVoicesSorted(Locale locale) { Comparator<Voice> byTTSLabel = (Voice v1, Voice v2) -> { return getTTS(v1).getLabel(locale).compareTo(getTTS(v2).getLabel(locale)); }; Comparator<Voice> byVoiceLocale = (Voice v1, Voice v2) -> { return v1.getLocale().getDisplayName(locale).compareTo(v2.getLocale().getDisplayName(locale)); }; return ttsServices.values().stream().map(s -> s.getAvailableVoices()).flatMap(Collection::stream) .sorted(byTTSLabel.thenComparing(byVoiceLocale).thenComparing(Voice::getLabel)) <START> .collect(Collectors.toCollection(LinkedHashSet::new)); <END> }</code><technical_language><LINK_0> I suggest wrap returned set unmodifiable set. Consumers create a copy of set decide handle modifications. wdyt</technical_language>

Target:
private Set<Voice> getAllVoicesSorted(Locale locale) { return ttsServices.values().stream().map(s -> s.getAvailableVoices()).flatMap(Collection::stream) .sorted(createVoiceComparator(locale)) .collect(collectingAndThen(toCollection(LinkedHashSet::new), Collections::unmodifiableSet)); }
Source:
<code>private QualifiedName toLowerCaseName( QualifiedName name ) { <START> String[] lowerCaseNamespace = Arrays.stream( name.namespace() ).map( String::toLowerCase ).toArray( String[]::new ); <END> String lowercaseName = name.name().toLowerCase(); return new QualifiedName( lowerCaseNamespace, lowercaseName ); }</code><technical_language>size array upfront in this case sizes known, in need create intermediate objects in lambda way</technical_language>

Target:
private QualifiedName toLowerCaseName( QualifiedName name ) { String[] oldNs = name.namespace(); String[] lowerCaseNamespace = new String[oldNs.length]; for ( int i = 0; i < oldNs.length; i++ ) { lowerCaseNamespace[i] = oldNs[i].toLowerCase(); } String lowercaseName = name.name().toLowerCase(); return new QualifiedName( lowerCaseNamespace, lowercaseName ); }
Source:
<code>public boolean anyPreviouslyAchievedAuthenticationMethodsStrongerThanRequestedOne(final Set<String> previouslyAchievedAuthenticationMethods, final String requestedAuthenticationMethod) { Assert.notNull(previouslyAchievedAuthenticationMethods); Assert.notNull(requestedAuthenticationMethod); if (previouslyAchievedAuthenticationMethods.isEmpty()) { return false; } final Integer currRank = this.mfaRankingConfig.get(requestedAuthenticationMethod); if (currRank == null) { <START> throw new RuntimeException("The [mfaRankingConfig] Map is mis-configured. It does not have a ranking value mapping for the" <END> + " [" + requestedAuthenticationMethod + "] authentication method."); } Integer prevRank = null; for (final String prevMethod : previouslyAchievedAuthenticationMethods) { prevRank = this.mfaRankingConfig.get(prevMethod); if (prevRank == null) { throw new RuntimeException("The [mfaRankingConfig] Map is mis-configured. It does not have a ranking value mapping for the" + " [" + prevMethod + "] authentication method."); } if(prevRank < currRank) { return true; } } return false; }</code><technical_language>sense delegate this DefaultAuthenticationMethodVerifier</technical_language>

Target:
public boolean anyPreviouslyAchievedAuthenticationMethodsStrongerThanRequestedOne(final Set<String> previouslyAchievedAuthenticationMethods, final String requestedAuthenticationMethod) { Assert.notNull(previouslyAchievedAuthenticationMethods); Assert.notNull(requestedAuthenticationMethod); if (previouslyAchievedAuthenticationMethods.isEmpty()) { return false; } final Integer requestedRank = getRank(requestedAuthenticationMethod); Integer prevRank = null; for (final String prevMethod : previouslyAchievedAuthenticationMethods) { prevRank = getRank(prevMethod); if (prevRank < requestedRank) { return true; } } return false; }
Source:
<code>protected boolean addVmLease(Guid leaseStorageDomainId, Guid vmId, boolean hotPlugLease) { if (leaseStorageDomainId == null) { return true; } VmLeaseParameters params = new VmLeaseParameters(getStoragePoolId(), leaseStorageDomainId, vmId); if (hotPlugLease) { params.setVdsId(getVm().getRunOnVds()); params.setHotPlugLease(true); } params.setParentCommand(getActionType()); params.setParentParameters(getParameters()); ActionReturnValue returnValue = runInternalActionWithTasksContext(ActionType.AddVmLease, params); if (returnValue.getSucceeded()) { getTaskIdList().addAll(returnValue.getInternalVdsmTaskIdList()); } if (!returnValue.getSucceeded()) { log.error("Failed to add the VM Lease on Storage Domain ID '{}'.", <START> leaseStorageDomainId); <END> } return returnValue.getSucceeded(); }</code><technical_language>IIRC a string, verify, please</technical_language>

Target:
protected boolean addVmLease(Guid leaseStorageDomainId, Guid vmId, boolean hotPlugLease) { if (leaseStorageDomainId == null) { return true; } VmLeaseParameters params = new VmLeaseParameters(getStoragePoolId(), leaseStorageDomainId, vmId); if (hotPlugLease) { params.setVdsId(getVm().getRunOnVds()); params.setHotPlugLease(true); } params.setParentCommand(getActionType()); params.setParentParameters(getParameters()); ActionReturnValue returnValue = runInternalActionWithTasksContext(ActionType.AddVmLease, params); if (returnValue.getSucceeded()) { getTaskIdList().addAll(returnValue.getInternalVdsmTaskIdList()); } return returnValue.getSucceeded(); }