auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void updateCustView(OoyalaNotification notification) { VideoData data = (VideoData) notification.getData(); if (data != null) { castViewManager.configureCastView(data.getTitle(), data.getDescription(), data.getUrl()); } else { castViewManager.configureCastView( player.getCurrentItem().getTitle(), player.getCurrentItem().getDescription(), player.getCurrentItem().getPromoImageURL(0, 0) ); } }

Target:
private void updateCustView(OoyalaNotification notification) { if (notification != null && notification.getData() != null && notification.getData() instanceof VideoData) { VideoData data = (VideoData) notification.getData(); castViewManager.configureCastView(data.getTitle(), data.getDescription(), data.getUrl()); } else if (player != null && player.getCurrentItem() != null) { castViewManager.configureCastView( player.getCurrentItem().getTitle(), player.getCurrentItem().getDescription(), player.getCurrentItem().getPromoImageURL(0, 0) ); } }
Source:
public static void copyDeps(OkBuckExtension extension) { FileUtil.copyResourceToProject("d8/" + RT_STUB_JAR, new File(D8_CACHE, RT_STUB_JAR)); List<Rule> d8 = Collections.singletonList( new Prebuilt() .prebuiltType(RuleType.PREBUILT_JAR.getProperties().get(0)) .prebuilt(RT_STUB_JAR) .ruleType(RuleType.PREBUILT_JAR.getBuckName()) .name(RT_STUB_JAR)); Multimap<String, String> loadStatements = LoadStatementsUtil.getLoadStatements(d8, extension.getRuleOverridesExtension()); FileUtil.writeToBuckFile(loadStatements, d8, new File(D8_CACHE, "BUCK")); }

Target:
public static void copyDeps(OkBuckExtension extension) { FileUtil.copyResourceToProject("d8/" + RT_STUB_JAR, new File(D8_CACHE, RT_STUB_JAR)); List<Rule> d8 = Collections.singletonList( new Prebuilt() .prebuiltType(RuleType.PREBUILT_JAR.getProperties().get(0)) .prebuilt(RT_STUB_JAR) .ruleType(RuleType.PREBUILT_JAR.getBuckName()) .name(RT_STUB_JAR)); Multimap<String, String> loadStatements = LoadStatementsUtil.getLoadStatements(d8, extension.getRuleOverridesExtension()); FileUtil.writeToBuckFile(loadStatements, d8, new File(D8_CACHE, OkBuckGradlePlugin.BUCK)); }
Source:
public synchronized void resetData() { this.selectedSed = (ExtSed) ws.getSedManager().getSelected(); setTitle(); setDataTables(); setSelectedStarTable(0); }

Target:
public void resetData() { this.selectedSed = (ExtSed) ws.getSedManager().getSelected(); setTitle(); setDataTables(); setSelectedStarTable(0); }
Source:
public E createEntity(A entityToAdd) throws InvalidParametersException, EntityAlreadyExistsException { Assumption.assertNotNull(Const.StatusCodes.DBLEVEL_NULL_INPUT, entityToAdd); entityToAdd.sanitizeForSaving(); if (!entityToAdd.isValid()) { throw new InvalidParametersException(entityToAdd.getInvalidityInfo()); } if (hasEntity(entityToAdd)) { String error = String.format(ERROR_CREATE_ENTITY_ALREADY_EXISTS, entityToAdd.getEntityTypeAsString()) + entityToAdd.getIdentificationString(); log.info(error); throw new EntityAlreadyExistsException(error); } E entity = entityToAdd.toEntity(); saveEntity(entity, entityToAdd); return entity; }

Target:
public E createEntity(A entityToAdd) throws InvalidParametersException, EntityAlreadyExistsException { return createEntity(entityToAdd, true); }
Source:
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); ConfigProvider plugin; ClassLoader savedLoader = compareAndSwapLoaders(klass.getClassLoader()); try { plugin = newPlugin(klass); plugin.configure(configProviderConfig); } finally { compareAndSwapLoaders(savedLoader); } return plugin; }

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:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); 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)); }

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:
private boolean hasExt(PackExt ext) { return (extensions & ext.getBit()) == ext.getBit(); }

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

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:
public BrooklynCampPlatformLauncherAbstract launch() { assert platform == null; if (getBrooklynMgmt()==null) useManagementContext(newMgmtContext()); platform = new BrooklynCampPlatform( PlatformRootSummary.builder().name("Brooklyn CAMP Platform").build(), getBrooklynMgmt()) .setConfigKeyAtManagmentContext(); return this; }

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:
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;", "var a = a || {get b() {}}; a.c = 1;"); }

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:
public boolean closeConnection() { try { if (cachedConnection != null) { cachedConnection.close(); } return true; } catch (JMSException e) { logger.error("JMS Exception while closing the connection."); } return false; }

Target:
public void closeConnection() throws JMSException { if (cachedConnection != null) { cachedConnection.close(); } }
Source:
public void addMetricsData( @Suspended final AsyncResponse asyncResponse, @ApiParam(value = "List of metrics", required = true) MixedMetricsRequest metricsRequest) { Collection<Observable<Void>> observables = new ArrayList<>(); 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()) ); }

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:
private synchronized SegmentChangeRequestsSnapshot getRequestsSinceWithoutWait(final Counter counter) { Counter lastCounter = getLastCounter(); if (counter.counter >= lastCounter.counter) { throw new IAE("counter >= last counter"); } 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); } }

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:
public void layout(boolean changed) { if (ignoreLayouts) { return; } ignoreLayouts = true; ignoreResizes = true; super.requestLayout(); ignoreResizes = false; }

Target:
public void layout(boolean changed) { if (ignoreLayouts) { return; } ignoreLayouts = true; ignoreResizes = true; super.layout(changed); ignoreResizes = false; }
Source:
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); if(group.ownerId != null) 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)); } }

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:
private HttpPipelinePolicy createHttpPipelineAuthPolicy() { HttpPipelinePolicy authPolicy; 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; }

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:
protected void executeCommand() { GlusterVolumeGeoRepSessionStartParameters parameters = getParameters(); setGlusterVolumeId(parameters.getVolumeId()); VDSReturnValue returnValue = runVdsCommand(VDSCommandType.GlusterVolumeGeoRepStart, new GlusterVolumeGeoRepSessionStartVDSParameters(upServer.getId(), getGlusterVolumeName(), parameters.getSlaveVolumeName(), parameters.getSlaveHost())); setSucceeded(returnValue.getSucceeded()); if(! getSucceeded()) { handleVdsError(AuditLogType.GLUSTER_VOLUME_GEO_REP_START_FAILED_EXCEPTION, returnValue.getVdsError().getMessage()); } }

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:
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; } }

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:
public void verifyNoAdsOnPage() { scrollToSelector(AdsContent.getSlotSelector(AdsContent.BOTTOM_LB)); verifyNoAds(); PageObjectLogging.log( "verifyNoAdsOnPage", "No ads detected", true, driver ); }

Target:
public void verifyNoAdsOnPage() { verifyNoAds(); PageObjectLogging.log( "verifyNoAdsOnPage", "No ads detected", true, driver ); }
Source:
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) { } } String relativePath = computeRelativePathToRoot(); try { return this.root.isDescendant(relativePath + potentialChildRelativePath); } catch (InterruptedException e) { return false; } }

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:
public TodoList() { setId("template"); 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"); }

Target:
public TodoList() { setId("template"); creator.addCreateCallback(todo -> addNewTodoItem(todo)); }
Source:
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(); 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; } }

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:
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) .setLocal(true); 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); } }

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:
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) { if (((ParameterizedType) specializingType).getRawType().equals( ((ParameterizedType) type).getRawType())) { assignable = BeanTypeAssignabilityRules.instance().isAssignableFrom(type, specializingType); } } } } if (!assignable) { throw BeanLogger.LOG.specializingBeanMissingSpecializedType(this, type, specializedBean); } } } } } }

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:
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) { errorMsgs.add("ACTION=UNION action combines abutting intervals by default, so it is incompatible with DONT_COMBINE_ABUTTING=true."); } return errorMsgs.isEmpty() ? null : errorMsgs.toArray(new String[0]); }

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:
HelixStoreOperator(HelixPropertyStoreConfig storeConfig, HelixPropertyStoreFactory storeFactory) { ArrayList<String> paths = new ArrayList<>(); paths.add(storeConfig.rootPath); store = storeFactory.getHelixPropertyStore(storeConfig, paths); }

Target:
HelixStoreOperator(HelixPropertyStoreConfig storeConfig, HelixPropertyStoreFactory storeFactory) { List<String> subscribedPaths = Collections.singletonList(storeConfig.rootPath); store = storeFactory.getHelixPropertyStore(storeConfig, subscribedPaths); }
Source:
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)); 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()); } }

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:
private void parseConfiguration() { Map<String, String> defaultsMapping = new HashMap<>(); if (!defaults.isEmpty()) { String[] defaultsList = this.defaults.split(","); for (String defaultValue : defaultsList) { String[] defaultsArray = defaultValue.split(":"); 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); } }

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:
void mergeConditionalAnd(ConditionalState leftConditionalState, ConditionalState rightConditionalState) { leftConditionalState.falseState.merge(leftConditionalState.trueState, null); leftConditionalState.falseState.merge(rightConditionalState.falseState, null); leftConditionalState.trueState.merge(rightConditionalState.trueState, null); falseState.apply(leftConditionalState.falseState); trueState.apply(leftConditionalState.trueState); }

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:
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)); } } }

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:
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()) { System.err.println("ERROR: " + response.getErrorMessage()); } return false; } }

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:
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)) .collect(Collectors.toCollection(LinkedHashSet::new)); }

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:
private QualifiedName toLowerCaseName( QualifiedName name ) { String[] lowerCaseNamespace = Arrays.stream( name.namespace() ).map( String::toLowerCase ).toArray( String[]::new ); String lowercaseName = name.name().toLowerCase(); return new QualifiedName( lowerCaseNamespace, lowercaseName ); }

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:
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) { throw new RuntimeException("The [mfaRankingConfig] Map is mis-configured. It does not have a ranking value mapping for the" + " [" + 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; }

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:
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 '{}'.", leaseStorageDomainId); } return returnValue.getSucceeded(); }

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(); }
Source:
public void test_enqueuing_exceptional_yields() { BytecodeCFGBuilder.BytecodeCFG cfg = BytecodeCFGBuilderTest.getBytecodeCFG("tryCatch", "src/test/java/org/sonar/java/bytecode/se/BytecodeEGWalkerExecuteTest.java"); BytecodeCFGBuilder.Block b2 = cfg.blocks().get(2); SquidClassLoader squidClassLoader = new SquidClassLoader(new ArrayList<>(FileUtils.listFiles(new File("target/test-jars"), new String[] {"jar", "zip"}, true))); BytecodeEGWalker walker = new BytecodeEGWalker(new BehaviorCache(null, squidClassLoader)); walker.programState = ProgramState.EMPTY_STATE.stackValue(new SymbolicValue()).stackValue(new SymbolicValue()); walker.programPosition = new ProgramPoint(b2).next().next(); walker.executeInstruction(b2.elements().get(3)); assertThat(walker.workList).hasSize(3); cfg = BytecodeCFGBuilderTest.getBytecodeCFG("tryWrongCatch", "src/test/java/org/sonar/java/bytecode/se/BytecodeEGWalkerExecuteTest.java"); b2 = cfg.blocks().get(2); cfg.blocks().forEach(b-> System.out.println(b.printBlock())); walker.workList.clear(); walker.programState = ProgramState.EMPTY_STATE.stackValue(new SymbolicValue()).stackValue(new SymbolicValue()); walker.programPosition = new ProgramPoint(b2).next().next(); walker.executeInstruction(b2.elements().get(3)); assertThat(walker.workList).hasSize(3); }

Target:
public void test_enqueuing_exceptional_yields() { BytecodeCFGBuilder.BytecodeCFG cfg = BytecodeCFGBuilderTest.getBytecodeCFG("tryCatch", "src/test/java/org/sonar/java/bytecode/se/BytecodeEGWalkerExecuteTest.java"); BytecodeCFGBuilder.Block b2 = cfg.blocks().get(2); SquidClassLoader squidClassLoader = new SquidClassLoader(new ArrayList<>(FileUtils.listFiles(new File("target/test-jars"), new String[] {"jar", "zip"}, true))); BytecodeEGWalker walker = new BytecodeEGWalker(new BehaviorCache(null, squidClassLoader)); walker.programState = ProgramState.EMPTY_STATE.stackValue(new SymbolicValue()).stackValue(new SymbolicValue()); walker.programPosition = new ProgramPoint(b2).next().next(); walker.executeInstruction(b2.elements().get(3)); assertThat(walker.workList).hasSize(3); cfg = BytecodeCFGBuilderTest.getBytecodeCFG("tryWrongCatch", "src/test/java/org/sonar/java/bytecode/se/BytecodeEGWalkerExecuteTest.java"); b2 = cfg.blocks().get(2); walker.workList.clear(); walker.programState = ProgramState.EMPTY_STATE.stackValue(new SymbolicValue()).stackValue(new SymbolicValue()); walker.programPosition = new ProgramPoint(b2).next().next(); walker.executeInstruction(b2.elements().get(3)); assertThat(walker.workList).hasSize(3); assertThat(walker.workList.pop().programState.exitValue()).isNotNull().isInstanceOf(SymbolicValue.ExceptionalSymbolicValue.class); assertThat(walker.workList.pop().programState.exitValue()).isNotNull().isInstanceOf(SymbolicValue.ExceptionalSymbolicValue.class); assertThat(walker.workList.pop().programState.exitValue()).isNull(); }