auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public static void validateHeaderConfigAction(String action) { if (!HEADER_ACTIONS.stream().anyMatch(action::equalsIgnoreCase)) { throw new ConfigException(String.format("Invalid header config action: '%s'. " + "Expected one of %s", action, HEADER_ACTIONS)); } }

Target:
static void validateHeaderConfigAction(String action) { if (!HEADER_ACTIONS.stream().anyMatch(action::equalsIgnoreCase)) { throw new ConfigException(String.format("Invalid header config action: '%s'. " + "Expected one of %s", action, HEADER_ACTIONS)); } }
Source:
public void testWithMergedRegions() throws Exception { final TableName tableName = TableName.valueOf(name.getMethodName()); MiniHBaseCluster cluster = TEST_UTIL.getHBaseCluster(); Admin admin = TEST_UTIL.getAdmin(); Table table = TEST_UTIL.getConnection().getTable(tableName); List<Put> puts = new ArrayList<>(); for (int i = 0; i < 10000; i++) { puts.add(new Put(Bytes.toBytes("rowkey_" + i)) .addColumn(Bytes.toBytes("fam1"), Bytes.toBytes("q1"), Bytes.toBytes("val_" + i))); } table.put(puts); admin.flush(tableName); HRegionServer regionServer = cluster.getRegionServer(0); String rsName = regionServer.getServerName().getAddress().toString(); int numRegions = regionServer.getNumberOfOnlineRegions(); List<HRegion> hRegions = regionServer.getRegions().stream() .filter(hRegion -> hRegion.getRegionInfo().getTable().equals(tableName)) .collect(Collectors.toList()); RegionMover.RegionMoverBuilder rmBuilder = new RegionMover.RegionMoverBuilder(rsName, TEST_UTIL.getConfiguration()).ack(true) .maxthreads(2); try (RegionMover rm = rmBuilder.build()) { LOG.debug("Unloading {}", regionServer.getServerName()); rm.unload(); Assert.assertEquals(0, regionServer.getNumberOfOnlineRegions()); LOG.debug("Successfully Unloaded, now Loading"); admin.mergeRegionsAsync(new byte[][] { hRegions.get(0).getRegionInfo().getRegionName(), hRegions.get(1).getRegionInfo().getRegionName() }, true) .get(5, TimeUnit.SECONDS); Assert.assertTrue(rm.load()); Assert.assertEquals(numRegions - 2, regionServer.getNumberOfOnlineRegions()); } }

Target:
public void testWithMergedRegions() throws Exception { final TableName tableName = TableName.valueOf(name.getMethodName()); MiniHBaseCluster cluster = TEST_UTIL.getHBaseCluster(); Admin admin = TEST_UTIL.getAdmin(); Table table = TEST_UTIL.getConnection().getTable(tableName); List<Put> puts = new ArrayList<>(); for (int i = 0; i < 10000; i++) { puts.add(new Put(Bytes.toBytes("rowkey_" + i)) .addColumn(Bytes.toBytes("fam1"), Bytes.toBytes("q1"), Bytes.toBytes("val_" + i))); } table.put(puts); admin.flush(tableName); HRegionServer regionServer = cluster.getRegionServer(0); String rsName = regionServer.getServerName().getAddress().toString(); int numRegions = regionServer.getNumberOfOnlineRegions(); List<HRegion> hRegions = regionServer.getRegions().stream() .filter(hRegion -> hRegion.getRegionInfo().getTable().equals(tableName)) .collect(Collectors.toList()); RegionMover.RegionMoverBuilder rmBuilder = new RegionMover.RegionMoverBuilder(rsName, TEST_UTIL.getConfiguration()).ack(true) .maxthreads(8); try (RegionMover rm = rmBuilder.build()) { LOG.debug("Unloading {}", regionServer.getServerName()); rm.unload(); Assert.assertEquals(0, regionServer.getNumberOfOnlineRegions()); LOG.debug("Successfully Unloaded, now Loading"); admin.mergeRegionsAsync(new byte[][] { hRegions.get(0).getRegionInfo().getRegionName(), hRegions.get(1).getRegionInfo().getRegionName() }, true) .get(5, TimeUnit.SECONDS); Assert.assertTrue(rm.load()); Assert.assertEquals(numRegions - 2, regionServer.getNumberOfOnlineRegions()); } }
Source:
public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null || getClass() != obj.getClass()) { return false; } final SentMessageTrace other = (SentMessageTrace) obj; return Objects.equals(this.messageId, other.messageId) && Objects.equals(this.timestamp, other.timestamp) && Objects.equals(this.subscription, other.subscription) && Objects.equals(this.reason, other.reason) && Objects.equals(this.partition, other.partition) && Objects.equals(this.offset, other.offset) && Objects.equals(this.topicName, other.topicName) && Objects.equals(this.message, other.message) && Objects.equals(this.status, other.status) && Objects.equals(this.cluster, other.cluster); }

Target:
public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null || getClass() != obj.getClass()) { return false; } final SentMessageTrace other = (SentMessageTrace) obj; return Objects.equals(this.messageId, other.messageId) && Objects.equals(this.subscription, other.subscription) && Objects.equals(this.timestamp, other.timestamp) && Objects.equals(this.status, other.status); }
Source:
public static String threadDump(final String msg) { try ( StringWriter str = new StringWriter(); PrintWriter out = new PrintWriter(str) ) { ThreadMXBean threadMXBean = ManagementFactory.getThreadMXBean(); out.println("*******************************************************************************"); out.println("Complete Thread dump " + msg); for (ThreadInfo threadInfo : threadMXBean.dumpAllThreads(true, true)) { out.println(threadInfoToString(threadInfo)); } long[] deadlockedThreads = threadMXBean.findDeadlockedThreads(); if (deadlockedThreads != null && deadlockedThreads.length > 0) { out.println("Deadlock detected!"); out.println(); for (ThreadInfo threadInfo : threadMXBean.getThreadInfo(deadlockedThreads, true, true)) { out.println(threadInfoToString(threadInfo)); } } out.println("==============================================================================="); out.println("End Thread dump " + msg); out.println("*******************************************************************************"); return str.toString(); } catch (IOException e) { logger.error("Exception thrown during generating of thread dump.", e); } return "Generating of thread dump failed " + msg; }

Target:
public static String threadDump(final String msg) { return ThreadDumpUtil.threadDump(msg); }
Source:
public void importToTruststore() { if (MapUtils.isEmpty(listIntermediate) || null == uploadedFileRoot || StringUtils.isBlank(alias)) { HelperUtil.addMessageError(null, "Alias, Intermediate and Root are required."); return; } SimpleCertificateResponseMessageType response = service.importToTruststore(alias, listIntermediate, uploadedFileRoot); if (null == response) { HelperUtil.addMessageError(null, "Fail to import to truststore."); } else if (response.isStatus()) { HelperUtil.addMessageInfo(null, "Import to truststore is successful"); } else { HelperUtil.addMessageError(null, response.getMessage()); } }

Target:
public void importToTruststore() { if (MapUtils.isEmpty(listIntermediate) || null == uploadedFileRoot || StringUtils.isBlank(alias)) { HelperUtil.addMessageError(null, "Alias, CA Root and CA Intermediate are required."); return; } SimpleCertificateResponseMessageType response = service.importToTruststore(alias, listIntermediate, uploadedFileRoot); if (null == response) { HelperUtil.addMessageError(null, "Fail to import to temporary truststore."); } else if (response.isStatus()) { HelperUtil.addMessageInfo(null, "Import to temporary truststore is successful"); } else { HelperUtil.addMessageError(null, response.getMessage()); } }
Source:
public Future<Void> processRequest(RestRequest restRequest, Callback<Void> callback) { Exception exception = null; frontendMetrics.securityServiceProcessRequestRate.mark(); long startTimeMs = System.currentTimeMillis(); if (!isOpen) { exception = new RestServiceException("IdConverter is closed", RestServiceErrorCode.ServiceUnavailable); } else { if (restRequest == null) { throw new IllegalArgumentException("RestRequest is null"); } } FutureResult<Void> futureResult = new FutureResult<Void>(); if (callback != null) { callback.onCompletion(null, exception); } futureResult.done(null, exception); frontendMetrics.securityServiceProcessRequestTimeInMs.update( System.currentTimeMillis() - startTimeMs); return futureResult; }

Target:
public Future<Void> processRequest(RestRequest restRequest, Callback<Void> callback) { Exception exception = null; frontendMetrics.securityServiceProcessRequestRate.mark(); long startTimeMs = System.currentTimeMillis(); if (!isOpen) { exception = new RestServiceException("Security service is closed", RestServiceErrorCode.ServiceUnavailable); } else { if (restRequest == null) { throw new IllegalArgumentException("RestRequest is null"); } } FutureResult<Void> futureResult = new FutureResult<Void>(); if (callback != null) { callback.onCompletion(null, exception); } futureResult.done(null, exception); frontendMetrics.securityServiceProcessRequestTimeInMs.update(System.currentTimeMillis() - startTimeMs); return futureResult; }
Source:
private static String prepareUrl( final String resolvedUrl, final File deprecatedFile, final String url, File basedir, String defaultFilePath ) { if ( resolvedUrl != null && !NO_URL.equals( resolvedUrl ) ) { return resolvedUrl; } if ( deprecatedFile != null && url != null && !url.isEmpty() ) { throw new IllegalArgumentException( "You can't use both overrideFile and overrideUrl" ); } if ( deprecatedFile != null ) { if ( deprecatedFile.exists() ) { String result = deprecatedFile.toURI().toString(); LOG.debug( "Loading overrides from file " + result ); return result; } else { LOG.warn( "overrideFile [" + deprecatedFile.getAbsolutePath() + "] was configured but doesn't exist" ); } } if ( url != null ) { if ( UrlRequester.isStringUrl( url ) ) { LOG.debug( "Loading overrides from URL " + url ); return url; } else { LOG.warn( "Unsupported or invalid URL [" + url + "] found in overrideUrl; " + "supported are 'classpath:' URLs and anything your JVM supports " + "(file:, http: and https: should always work)" ); } } final Path basedirPath = basedir.toPath(); final Path defaultPath = basedirPath.resolve( defaultFilePath ); if ( Files.exists( defaultPath ) ) { String result = defaultPath.toUri().toString(); LOG.debug( "Loading overrides from file " + result ); return result; } LOG.debug( "No (valid) URL and no file [" + defaultPath.toAbsolutePath() + "] found; not loading any overrides" ); return NO_URL; }

Target:
private static String prepareUrl( final String resolvedUrl, final File deprecatedFile, final String url, File basedir, String defaultFilePath ) { if ( resolvedUrl != null && !NO_URL.equals( resolvedUrl ) ) { return resolvedUrl; } if ( deprecatedFile != null && url != null && !url.isEmpty() ) { throw new IllegalArgumentException( "You can't use both overrideFile and overrideUrl" ); } if ( deprecatedFile != null ) { if ( deprecatedFile.exists() ) { String result = deprecatedFile.toURI().toString(); LOG.debug( "Loading overrides from file {}", result ); return result; } else { LOG.warn( "overrideFile was configured but doesn't exist", deprecatedFile.getAbsolutePath() ); } } if ( url != null ) { if ( UrlRequester.isStringUrl( url ) ) { LOG.debug( "Loading overrides from URL {}", url ); return url; } else { LOG.warn( "Unsupported or invalid URL found in overrideUrl; " + "supported are 'classpath:' URLs and anything your JVM supports " + "(file:, http: and https: should always work)", url ); } } final Path basedirPath = basedir.toPath(); final Path defaultPath = basedirPath.resolve( defaultFilePath ); if ( Files.exists( defaultPath ) ) { String result = defaultPath.toUri().toString(); LOG.debug( "Loading overrides from file {}", result ); return result; } LOG.debug( "No (valid) URL and no file found; not loading any overrides", defaultPath.toAbsolutePath() ); return NO_URL; }
Source:
public void zonedTimeFormatLegacy() throws ParseException { Date time = new Date(); DateFormat dfDate = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'Z"); String str = dfDate.format(time); Date dtParsed = DateUtil.parseTZDateString(str); assertEquals(time, dtParsed); }

Target:
public void zonedTimeFormatLegacy() throws ParseException { Date time = new Date(); DateFormat dfDate = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'Z"); String str = dfDate.format(time); Date dtParsed = DateUtil.parseTZDateString(str); assertEquals(time.toString(), dtParsed.toString()); }
Source:
public Long getIssueTypeId(String issueTypeName) { List<IssueType> issueTypeList = new ArrayList<IssueType>(); Long issueTypeId = 10004L; issueTypeList = this.getIssueTypes(); for(IssueType issue : issueTypeList) { LOGGER.warning("issueType: " + issue.getName() + " "+ issue.getId()); if(issue.getName().equalsIgnoreCase(issueTypeName)) { issueTypeId = issue.getId(); break; } } return issueTypeId; }

Target:
public Long getIssueTypeId(String issueTypeName) { List<IssueType> issueTypeList = new ArrayList<IssueType>(); Long issueTypeId = 10004L; issueTypeList = this.getIssueTypes(); for(IssueType issue : issueTypeList) { if(issue.getName().equalsIgnoreCase(issueTypeName)) { issueTypeId = issue.getId(); break; } } return issueTypeId; }
Source:
private RequestFuture<ByteBuffer> initiateJoinGroup() { if (joinFuture == null) { disableHeartbeatThread(); state = MemberState.REBALANCING; if (lastRebalanceStartMs == -1L) lastRebalanceStartMs = time.milliseconds(); joinFuture = sendJoinGroupRequest(); joinFuture.addListener(new RequestFutureListener<ByteBuffer>() { @Override public void onSuccess(ByteBuffer value) { synchronized (AbstractCoordinator.this) { if (generation.generationId != OffsetCommitRequest.DEFAULT_GENERATION_ID) { log.info("Successfully joined group with generation {}", generation.generationId); state = MemberState.STABLE; rejoinNeeded = false; lastRebalanceEndMs = time.milliseconds(); sensors.successfulRebalanceSensor.record(lastRebalanceEndMs - lastRebalanceStartMs); lastRebalanceStartMs = -1L; if (heartbeatThread != null) heartbeatThread.enable(); } else { log.info("Generation data was cleared by heartbeat thread. Rejoin failed."); failure(); } } } @Override public void onFailure(RuntimeException e) { failure(); } private void failure() { synchronized (AbstractCoordinator.this) { state = MemberState.UNJOINED; sensors.failedRebalanceSensor.record(); } } }); } return joinFuture; }

Target:
private synchronized RequestFuture<ByteBuffer> initiateJoinGroup() { if (joinFuture == null) { disableHeartbeatThread(); state = MemberState.REBALANCING; if (lastRebalanceStartMs == -1L) lastRebalanceStartMs = time.milliseconds(); joinFuture = sendJoinGroupRequest(); joinFuture.addListener(new RequestFutureListener<ByteBuffer>() { @Override public void onSuccess(ByteBuffer value) { synchronized (AbstractCoordinator.this) { if (generation != Generation.NO_GENERATION) { log.info("Successfully joined group with generation {}", generation.generationId); state = MemberState.STABLE; rejoinNeeded = false; lastRebalanceEndMs = time.milliseconds(); sensors.successfulRebalanceSensor.record(lastRebalanceEndMs - lastRebalanceStartMs); lastRebalanceStartMs = -1L; if (heartbeatThread != null) heartbeatThread.enable(); } else { log.info("Generation data was cleared by heartbeat thread. Rejoin failed."); recordRebalanceFailure(); } } } @Override public void onFailure(RuntimeException e) { synchronized (AbstractCoordinator.this) { recordRebalanceFailure(); } } private void recordRebalanceFailure() { state = MemberState.UNJOINED; sensors.failedRebalanceSensor.record(); } }); } return joinFuture; }
Source:
private void addBackgroundFromUri(Uri uri) { Scene currentScene = ProjectManager.getInstance().getCurrentlyEditedScene(); Sprite currentSprite = currentScene.getBackgroundSprite(); String resolvedFileName = StorageOperations.resolveFileName(getContentResolver(), uri); String lookDataName; String lookFileName; boolean useSpriteName = resolvedFileName == null || StorageOperations.getSanitizedFileName(resolvedFileName).equals(TMP_IMAGE_FILE_NAME); if (useSpriteName) { lookDataName = currentSprite.getName(); lookFileName = lookDataName + DEFAULT_IMAGE_EXTENSION; } else { lookDataName = StorageOperations.getSanitizedFileName(resolvedFileName); lookFileName = resolvedFileName; } lookDataName = new UniqueNameProvider().getUniqueNameInNameables(lookDataName, currentSprite.getLookList()); try { File imageDirectory = new File(currentScene.getDirectory(), IMAGE_DIRECTORY_NAME); File file = StorageOperations.copyUriToDir(getContentResolver(), uri, imageDirectory, lookFileName); LookData look = new LookData(lookDataName, file); currentSprite.getLookList().add(look); if (onNewLookListener != null) { onNewLookListener.addItem(look); refreshScriptFragment(); } } catch (IOException e) { Log.e(TAG, Log.getStackTraceString(e)); } }

Target:
private void addBackgroundFromUri(Uri uri) { Scene currentScene = ProjectManager.getInstance().getCurrentlyEditedScene(); Sprite currentSprite = currentScene.getBackgroundSprite(); String resolvedFileName = StorageOperations.resolveFileName(getContentResolver(), uri); String lookDataName; String lookFileName; boolean useSpriteName = resolvedFileName == null || StorageOperations.getSanitizedFileName(resolvedFileName).equals(TMP_IMAGE_FILE_NAME); if (useSpriteName) { lookDataName = currentSprite.getName(); lookFileName = lookDataName + DEFAULT_IMAGE_EXTENSION; } else { lookDataName = StorageOperations.getSanitizedFileName(resolvedFileName); lookFileName = resolvedFileName; } lookDataName = new UniqueNameProvider().getUniqueNameInNameables(lookDataName, currentSprite.getLookList()); try { File imageDirectory = new File(currentScene.getDirectory(), IMAGE_DIRECTORY_NAME); File file = StorageOperations.copyUriToDir(getContentResolver(), uri, imageDirectory, lookFileName); LookData look = new LookData(lookDataName, file); currentSprite.getLookList().add(look); if (onNewLookListener != null) { onNewLookListener.addItem(look); } } catch (IOException e) { Log.e(TAG, Log.getStackTraceString(e)); } }
Source:
public void push() { final Credentials oldCredentials = new Credentials("", "manu", "78"); PullOrganisationCredentialsController pullOrganisationCredentialsController = new PullOrganisationCredentialsController(oldCredentials, mPushService); IAsyncExecutor asyncExecutor = new AsyncExecutor(); IMainExecutor mainExecutor = new UIThreadExecutor(); PullOrganisationCredentialsUseCase pullOrganisationCredentialsUseCase = new PullOrganisationCredentialsUseCase(asyncExecutor, mainExecutor, pullOrganisationCredentialsController); pullOrganisationCredentialsUseCase.execute( new PullOrganisationCredentialsUseCase.Callback() { @Override public void onComplete() { CheckCredentialsWithOrgUnitUseCase checkCredentialsWithOrgUnitUseCase = new CheckCredentialsWithOrgUnitUseCase(); checkCredentialsWithOrgUnitUseCase.execute(oldCredentials, new CheckCredentialsWithOrgUnitUseCase.Callback() { @Override public void onCorrectCredentials() { PushServiceStrategy.this.onCorrectCredentials(); } @Override public void onBadCredentials() { logout(); } }); } @Override public void onError(String message) { Log.e(TAG, "Error getting user credentials: " + message); } @Override public void onNetworkError() { Log.e(TAG, "Error getting user credentials: NetworkError"); } @Override public void onPullConversionError() { Log.e(TAG, "Error getting user credentials: PullConversionError"); } }); }

Target:
public void push() { IAuthenticationManager authenticationManager = new AuthenticationManager( PreferencesState.getInstance().getContext()); IMainExecutor mainExecutor = new UIThreadExecutor(); IAsyncExecutor asyncExecutor = new AsyncExecutor(); ICredentialsRepository credentialsLocalDataSoruce = new CredentialsLocalDataSource(); IOrganisationUnitRepository organisationDataSource = new OrganisationUnitDataSource(); IInvalidLoginAttemptsRepository iInvalidLoginAttemptsRepository = new InvalidLoginAttemptsRepositoryLocalDataSource(); LoginUseCase loginUseCase = new LoginUseCase(authenticationManager, mainExecutor, asyncExecutor, organisationDataSource, credentialsLocalDataSoruce, iInvalidLoginAttemptsRepository); final Credentials oldCredentials = credentialsLocalDataSoruce.getOrganisationCredentials(); loginUseCase.execute(oldCredentials, new ALoginUseCase.Callback() { @Override public void onLoginSuccess() { PushServiceStrategy.this.onCorrectCredentials(); } @Override public void onServerURLNotValid() { Log.e(TAG, "Error getting user credentials: URL not valid "); } @Override public void onInvalidCredentials() { logout(); } @Override public void onNetworkError() { Log.e(TAG, "Error getting user credentials: NetworkError"); } @Override public void onConfigJsonNotPresent() { Log.e(TAG, "Error getting user credentials: JsonNotPresent"); } @Override public void onUnexpectedError() { Log.e(TAG, "Error getting user credentials: unexpectedError "); } @Override public void onMaxLoginAttemptsReachedError() { } }); }
Source:
public Email visit(QueryProcessingError queryProcessingError) { final FoxtrotException exception = queryProcessingError.getException(); switch (exception.getCode()) { case CARDINALITY_OVERFLOW: { return richEmailBuilder.build(templateIdFromEvent(queryProcessingError), Collections.emptyList(), exception.toMap()); } case TABLE_INITIALIZATION_ERROR: case TABLE_METADATA_FETCH_FAILURE: case TABLE_NOT_FOUND: case TABLE_ALREADY_EXISTS: case TABLE_MAP_STORE_ERROR: case INVALID_REQUEST: case DOCUMENT_NOT_FOUND: case MALFORMED_QUERY: case ACTION_RESOLUTION_FAILURE: case UNRESOLVABLE_OPERATION: case ACTION_EXECUTION_ERROR: case STORE_CONNECTION_ERROR: case STORE_EXECUTION_ERROR: case DATA_CLEANUP_ERROR: case EXECUTION_EXCEPTION: case CONSOLE_SAVE_EXCEPTION: case CONSOLE_FETCH_EXCEPTION: case AUTHORIZATION_EXCEPTION: case SOURCE_MAP_CONVERSION_FAILURE: case FQL_PERSISTENCE_EXCEPTION: case FQL_PARSE_ERROR: case PORT_EXTRACTION_ERROR: break; } return null; }

Target:
public Email visit(QueryProcessingError queryProcessingError) { final FoxtrotException exception = queryProcessingError.getException(); switch (exception.getCode()) { case CARDINALITY_OVERFLOW: { return richEmailBuilder.build(templateIdFromEvent(queryProcessingError), Collections.emptyList(), exception.toMap()); } default: break; } return null; }
Source:
public void testQuantileAtValueBigint() { QuantileDigest qdigest = new QuantileDigest(1); addAll(qdigest, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9); functionAssertions.assertFunction(format("quantile_at_value(CAST(X'%s' AS qdigest(bigint)), 20)", toHexString(qdigest)), DOUBLE, 1.0); functionAssertions.assertFunction(format("quantile_at_value(CAST(X'%s' AS qdigest(bigint)), 6)", toHexString(qdigest)), DOUBLE, 0.6); functionAssertions.assertFunction(format("quantile_at_value(CAST(X'%s' AS qdigest(bigint)), -1)", toHexString(qdigest)), DOUBLE, 0.0); }

Target:
public void testQuantileAtValueBigint() { QuantileDigest qdigest = new QuantileDigest(1); addAll(qdigest, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9); functionAssertions.assertFunction(format("quantile_at_value(CAST(X'%s' AS qdigest(bigint)), 20)", toHexString(qdigest)), DOUBLE, null); functionAssertions.assertFunction(format("quantile_at_value(CAST(X'%s' AS qdigest(bigint)), 6)", toHexString(qdigest)), DOUBLE, 0.6); functionAssertions.assertFunction(format("quantile_at_value(CAST(X'%s' AS qdigest(bigint)), -1)", toHexString(qdigest)), DOUBLE, null); }
Source:
protected void initExternalPluginsState(ILaunchConfiguration configuration) throws CoreException { Map<IPluginModelBase, String> map = BundleLauncherHelper.getTargetBundleMap(configuration, Collections.EMPTY_SET, IPDELauncherConstants.SELECTED_TARGET_PLUGINS); fPluginTreeViewer.setSubtreeChecked(fExternalPlugins, false); for (Entry<IPluginModelBase, String> entry : map.entrySet()) { IPluginModelBase model = entry.getKey(); if (fPluginTreeViewer.setChecked(model, true)) { setText(model, entry.getValue().toString()); } } fNumExternalChecked = map.size(); resetGroup(fExternalPlugins); fPluginTreeViewer.setChecked(fExternalPlugins, fNumExternalChecked > 0); fPluginTreeViewer.setGrayed(fExternalPlugins, fNumExternalChecked > 0 && fNumExternalChecked < getExternalModels().length); }

Target:
protected void initExternalPluginsState(ILaunchConfiguration configuration) throws CoreException { Map<IPluginModelBase, String> map = BundleLauncherHelper.getTargetBundleMap(configuration, Collections.EMPTY_SET, IPDELauncherConstants.SELECTED_TARGET_PLUGINS); fPluginTreeViewer.setSubtreeChecked(fExternalPlugins, false); for (Entry<IPluginModelBase, String> entry : map.entrySet()) { IPluginModelBase model = entry.getKey(); if (fPluginTreeViewer.setChecked(model, true)) { setText(model, entry.getValue()); } } fNumExternalChecked = map.size(); resetGroup(fExternalPlugins); fPluginTreeViewer.setChecked(fExternalPlugins, fNumExternalChecked > 0); fPluginTreeViewer.setGrayed(fExternalPlugins, fNumExternalChecked > 0 && fNumExternalChecked < getExternalModels().length); }
Source:
public void testUnmarshallTopLevelEmptyEventProperties() throws Exception { Diagram<Graph, Metadata> diagram = unmarshall(marshaller, BPMN_CATCHING_INTERMEDIATE_EVENT_FILE_PATH); assertDiagram(diagram, AMOUNT_OF_NODES_IN_DIAGRAM); IntermediateTimerEvent emptyTopEvent = getCatchingIntermediateNodeById(diagram, EMPTY_TOP_LEVEL_EVENT_ID, HAS_NO_INCOME_EDGE, HAS_OUTGOING_EDGE); assertGeneralSet(emptyTopEvent.getGeneral(), EMPTY_VALUE, EMPTY_VALUE); assertTimerEventEmpty(emptyTopEvent.getExecutionSet(), CANCELLING, ""); }

Target:
public void testUnmarshallTopLevelEmptyEventProperties() throws Exception { Diagram<Graph, Metadata> diagram = unmarshall(marshaller, BPMN_CATCHING_INTERMEDIATE_EVENT_FILE_PATH); assertDiagram(diagram, AMOUNT_OF_NODES_IN_DIAGRAM); IntermediateTimerEvent emptyTopEvent = getCatchingIntermediateNodeById(diagram, EMPTY_TOP_LEVEL_EVENT_ID, HAS_NO_INCOME_EDGE, HAS_OUTGOING_EDGE); assertGeneralSet(emptyTopEvent.getGeneral(), EMPTY_VALUE, EMPTY_VALUE); assertTimerEventEmpty(emptyTopEvent.getExecutionSet(), CANCELLING, EMPTY_VALUE); }
Source:
static ImageDescriptor getImageDescriptor(String path) { URL url = FileLocator.find(WebBrowserUIPlugin.getInstance().getBundle(), new Path(path), null); return ImageDescriptor.createFromURL(url); }

Target:
static ImageDescriptor getImageDescriptor(String path) { URL url = FileLocator.find(FrameworkUtil.getBundle(ImageResourceManager.class), new Path(path), null); return ImageDescriptor.createFromURL(url); }
Source:
public void streamEventsbyNameAndType() throws IOException, InterruptedException { List<ServerSentEvent<String>> events = getServerSentEvents(ACTUATOR_STREAM_CIRCUITBREAKER_EVENTS+ "/backendA/ERROR"); CircuitBreakerEventsEndpointResponse circuitBreakerEventsBefore = circuitBreakerEvents(ACTUATOR_CIRCUITBREAKEREVENTS + "/backendA"); dummyService.doSomething(false); Thread.sleep(1000); try { dummyService.doSomething(true); } catch (IOException ex) { } CircuitBreakerEventsEndpointResponse circuitBreakerEventsAfter = circuitBreakerEvents(ACTUATOR_CIRCUITBREAKEREVENTS + "/backendA"); Thread.sleep(1000); assertThat (circuitBreakerEventsBefore.getCircuitBreakerEvents().size() < circuitBreakerEventsAfter.getCircuitBreakerEvents().size()); assertThat (events.size() == 1); }

Target:
public void streamEventsbyNameAndType() throws IOException, InterruptedException { List<ServerSentEvent<String>> events = getServerSentEvents(ACTUATOR_STREAM_CIRCUITBREAKER_EVENTS+ "/backendB/SUCCESS"); CircuitBreakerEventsEndpointResponse circuitBreakerEventsBefore = circuitBreakerEvents(ACTUATOR_CIRCUITBREAKEREVENTS + "/backendB"); publishEvents(); CircuitBreakerEventsEndpointResponse circuitBreakerEventsAfter = circuitBreakerEvents(ACTUATOR_CIRCUITBREAKEREVENTS + "/backendB"); Thread.sleep(1000); assertThat (circuitBreakerEventsBefore.getCircuitBreakerEvents().size()).isLessThan(circuitBreakerEventsAfter.getCircuitBreakerEvents().size()); assertThat (events.size()).isEqualTo(1); }
Source:
public AggregatorFactory getMergingFactory(AggregatorFactory other) throws AggregatorFactoryNotMergeableException { if (other.getName().equals(this.getName()) && other instanceof ApproximateHistogramAggregatorFactory) { ApproximateHistogramAggregatorFactory castedOther = (ApproximateHistogramAggregatorFactory) other; if (Float.compare(castedOther.lowerLimit, lowerLimit) == 0 && numBuckets != castedOther.numBuckets && resolution != castedOther.resolution && Float.compare(castedOther.upperLimit, upperLimit) != 0) { return getCombiningFactory(); } else { throw new AggregatorFactoryNotMergeableException( "can't merge approx histogram aggregator factories [%s] and [%s]", this, other ); } } else { throw new AggregatorFactoryNotMergeableException( "can't merge [%s : %s] and [%s : %s]", this.getName(), this.getClass().getName(), other.getName(), other.getClass().getName() ); } }

Target:
public AggregatorFactory getMergingFactory(AggregatorFactory other) throws AggregatorFactoryNotMergeableException { if (other.getName().equals(this.getName()) && other instanceof ApproximateHistogramAggregatorFactory) { ApproximateHistogramAggregatorFactory castedOther = (ApproximateHistogramAggregatorFactory) other; return new ApproximateHistogramFoldingAggregatorFactory( name, name, Math.max(resolution, castedOther.resolution), numBuckets, Math.min(lowerLimit, castedOther.lowerLimit), Math.max(upperLimit, castedOther.upperLimit) ); } else { throw new AggregatorFactoryNotMergeableException(this, other); } }
Source:
private List<Feature> getFeatures() { if (features.isEmpty()) { plugins.setSerialEventBusOnEventListenerPlugins(bus); features.addAll(featureSupplier.get()); bus.send(new TestRunStarted(bus.getInstant())); features.forEach(feature -> bus.send(new TestSourceRead(bus.getInstant(), feature.getUri(), feature.getSource()))); } return features; }

Target:
private List<Feature> getFeatures() { if (features == null) { plugins.setSerialEventBusOnEventListenerPlugins(bus); features = featureSupplier.get(); bus.send(new TestRunStarted(bus.getInstant())); features.forEach(feature -> bus.send(new TestSourceRead(bus.getInstant(), feature.getUri(), feature.getSource()))); } return features; }
Source:
public void init( final PlaceRequest placeRequest, final Command completeCommand ) { this.placeRequest = placeRequest; Set<Option> optionsFromModeParameter = getOptionsFromModeParameter( placeRequest.getParameter( "mode", "" ) ); if ( optionsFromModeParameter.isEmpty() ) { options.addAll( getOptionsFromModeParameter( getWindowParameter( "explorer_mode" ) ) ); } else { options.addAll( optionsFromModeParameter ); } if ( options.isEmpty() ) { load(new Command() { @Override public void execute() { completeCommand.execute(); } }); } else { completeCommand.execute(); } }

Target:
public void init( final PlaceRequest placeRequest, final Command completeCommand ) { this.placeRequest = placeRequest; Set<Option> optionsFromModeParameter = getOptionsFromModeParameter( placeRequest.getParameter( "mode", "" ) ); if ( optionsFromModeParameter.isEmpty() ) { options.addAll( getOptionsFromModeParameter( getWindowParameter( "explorer_mode" ) ) ); } else { options.addAll( optionsFromModeParameter ); } if ( options.isEmpty() ) { load( completeCommand ); } else { completeCommand.execute(); } }
Source:
private ValidationResult nicActuallyExistsOrReferencesNewBond(NetworkAttachment attachment) { String nicName = attachment.getNicName(); Guid nicId = attachment.getNicId(); boolean nicActuallyExistsOrReferencesNewBond = isNicActuallyExistsOrReferencesNewBond(nicName, nicId); return ValidationResult.failWith(EngineMessage.HOST_NETWORK_INTERFACE_HAVING_ID_AND_NAME_DOES_NOT_EXIST, ReplacementUtils.createSetVariableString(VAR_NIC_ID, nicId), ReplacementUtils.createSetVariableString(VAR_NIC_NAME, nicName) ).when(!nicActuallyExistsOrReferencesNewBond); }

Target:
private ValidationResult nicActuallyExistsOrReferencesNewBond(NetworkAttachment attachment) { String nicName = attachment.getNicName(); Guid nicId = attachment.getNicId(); boolean nicActuallyExistsOrReferencesNewBond = isNicActuallyExistsOrReferencesNewBond(nicName, nicId); return ValidationResult.failWith(EngineMessage.HOST_NETWORK_INTERFACE_HAVING_ID_OR_NAME_DOES_NOT_EXIST, ReplacementUtils.createSetVariableString(VAR_NIC_ID, nicId), ReplacementUtils.createSetVariableString(VAR_NIC_NAME, nicName) ).when(!nicActuallyExistsOrReferencesNewBond); }
Source:
public void createsIssueEvent() throws Exception { final MkIssueEvents events = this.issueEvents(); final String login = "jack"; final String type = "locked"; final long before = now(); final Event.Smart event = new Event.Smart( events.create(type, 2, login, null) ); final long after = now(); MatcherAssert.assertThat( event.type(), Matchers.equalTo(type) ); MatcherAssert.assertThat( event.author().login(), Matchers.equalTo(login) ); MatcherAssert.assertThat( event.url().toString(), Matchers.equalTo("<LINK_0>") ); MatcherAssert.assertThat( event.createdAt().getTime(), Matchers.greaterThanOrEqualTo(before) ); MatcherAssert.assertThat( event.createdAt().getTime(), Matchers.lessThanOrEqualTo(after) ); }

Target:
public void createsIssueEvent() throws Exception { final MkIssueEvents events = this.issueEvents(); final String login = "jack"; final String type = "locked"; final long before = MkIssueEventsTest.now(); final Event.Smart event = new Event.Smart( events.create( type, 2, login, MkIssueEventsTest.ABSENT_STR ) ); final long after = MkIssueEventsTest.now(); MatcherAssert.assertThat( event.type(), Matchers.equalTo(type) ); MatcherAssert.assertThat( event.author().login(), Matchers.equalTo(login) ); MatcherAssert.assertThat( event.url().toString(), Matchers.equalTo("<LINK_0>") ); MatcherAssert.assertThat( event.createdAt().getTime(), Matchers.greaterThanOrEqualTo(before) ); MatcherAssert.assertThat( event.createdAt().getTime(), Matchers.lessThanOrEqualTo(after) ); }
Source:
private static PlanFragment createBroadcastJoinPlanFragment(String name, PlanFragment buildFragment) { Symbol symbol = new Symbol("column"); PlanNode tableScan = new TableScanNode( new PlanNodeId(name), new TableHandle(new ConnectorId("test"), new TestingMetadata.TestingTableHandle()), ImmutableList.of(symbol), ImmutableMap.of(symbol, new TestingColumnHandle("column")), Optional.empty(), TupleDomain.all(), null); RemoteSourceNode remote = new RemoteSourceNode(new PlanNodeId("build_id"), buildFragment.getId(), ImmutableList.of()); PlanNode join = new JoinNode( new PlanNodeId(name + "_id"), INNER, tableScan, remote, ImmutableList.of(), ImmutableList.<Symbol>builder() .addAll(tableScan.getOutputSymbols()) .addAll(remote.getOutputSymbols()) .build(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.of(REPLICATED)); return createFragment(join); }

Target:
private static PlanFragment createBroadcastJoinPlanFragment(String name, PlanFragment buildFragment) { Symbol symbol = new Symbol("column"); PlanNode tableScan = new TableScanNode( new PlanNodeId(name), new TableHandle(new ConnectorId("test"), new TestingTableHandle()), ImmutableList.of(symbol), ImmutableMap.of(symbol, new TestingColumnHandle("column")), Optional.empty(), TupleDomain.all(), null); RemoteSourceNode remote = new RemoteSourceNode(new PlanNodeId("build_id"), buildFragment.getId(), ImmutableList.of()); PlanNode join = new JoinNode( new PlanNodeId(name + "_id"), INNER, tableScan, remote, ImmutableList.of(), ImmutableList.<Symbol>builder() .addAll(tableScan.getOutputSymbols()) .addAll(remote.getOutputSymbols()) .build(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.of(REPLICATED)); return createFragment(join); }
Source:
public Map<String, String> getUserOptions() { return ofNullable(userOptions) .<Map<String, String>> map(HashMap::new) .orElse(emptyMap()); }

Target:
public Map<String, String> getUserOptions() { return Optional.ofNullable(userOptions) .<Map<String, String>> map(HashMap::new) .orElse(Collections.emptyMap()); }
Source:
void writeLine(String str, boolean mayLog) { if (mayLog) { log.debug(str); } ns.write(str + "\r\n"); if (ns.writeQueueFull()) { ns.pause(); ns.drainHandler(v -> { ns.resume(); }); } }

Target:
void writeLine(String str, boolean mayLog) { if (mayLog) { log.debug(str); } ns.write(str + "\r\n"); }
Source:
public void whenExpectingAssumptionViolatedExceptionStatementsThrowingItShouldPass() { Statement statementThrowingAssumptionViolatedException = new Fail(new AssumptionViolatedException("expected")); ExpectException expectException = new ExpectException(statementThrowingAssumptionViolatedException, AssumptionViolatedException.class); try { expectException.evaluate(); } catch (Throwable e) { fail("should not throw anything, but was thrown: " + e); } }

Target:
public void whenExpectingAssumptionViolatedExceptionStatementsThrowingItShouldPass() { Statement delegate = new Fail(new AssumptionViolatedException("expected")); ExpectException expectException = new ExpectException(delegate, AssumptionViolatedException.class); try { expectException.evaluate(); } catch (Throwable e) { fail("should not throw anything, but was thrown: " + e); } }
Source:
public java.lang.String getVersion() { return myVersion; }

Target:
public String getVersion() { return myVersion; }
Source:
public void prepare(Properties options) { Objects.requireNonNull(mapper, "mapper can not be null"); Objects.requireNonNull(topicSelector, "topicSelector can not be null"); producer = new KafkaProducer<K, V>(options); }

Target:
public void prepare(Properties options) { Objects.requireNonNull(mapper, "mapper can not be null"); Objects.requireNonNull(topicSelector, "topicSelector can not be null"); producer = new KafkaProducer<>(options); }
Source:
public static void injectParameters(Object type, Properties parameters) { if ( ParameterizedType.class.isInstance( type ) ) { if ( parameters == null ) { ConcurrentHashMapBackedProperties concurrentParams = new ConcurrentHashMapBackedProperties(parameters); ( (ParameterizedType) type ).setParameterValues( concurrentParams ); } else { ( (ParameterizedType) type ).setParameterValues( parameters ); } } else if ( parameters != null && !parameters.isEmpty() ) { throw new MappingException( "type is not parameterized: " + type.getClass().getName() ); } }

Target:
public static void injectParameters(Object type, Properties parameters) { if ( ParameterizedType.class.isInstance( type ) ) { if ( parameters == null ) { ( (ParameterizedType) type ).setParameterValues( EMPTY_PROPERTIES ); } else { ConcurrentHashMapBackedProperties concurrentParams = new ConcurrentHashMapBackedProperties(parameters); ( (ParameterizedType) type ).setParameterValues( concurrentParams ); } } else if ( parameters != null && !parameters.isEmpty() ) { throw new MappingException( "type is not parameterized: " + type.getClass().getName() ); } }
Source:
public void poll() { if (isMonitoringNeeded(vdsManager.getCopyVds().getStatus())) { VmsListFetcher fetcher = new VmsStatisticsFetcher(vdsManager); long fetchTime = System.nanoTime(); if (fetcher.fetch()) { getVmsMonitoring().perform(fetcher.getChangedVms(), fetchTime, vdsManager, true); processDevices(fetcher.getVdsmVms().stream(), fetchTime); } else { log.info("Failed to fetch vms info for host '{}' - skipping VMs monitoring.", vdsManager.getVdsName()); } } }

Target:
public void poll() { if (isMonitoringNeeded(vdsManager.getStatus())) { VmsListFetcher fetcher = new VmsStatisticsFetcher(vdsManager); long fetchTime = System.nanoTime(); if (fetcher.fetch()) { getVmsMonitoring().perform(fetcher.getChangedVms(), fetchTime, vdsManager, true); processDevices(fetcher.getVdsmVms().stream(), fetchTime); } else { log.info("Failed to fetch vms info for host '{}' - skipping VMs monitoring.", vdsManager.getVdsName()); } } }
Source:
public synchronized boolean removeSwitch(final long ovxDpid) { this.dpidCounter.releaseIndex((int) (0x000000 << 32 | ovxDpid)); OVXSwitch sw = this.getSwitch(ovxDpid); boolean down = sw.tearDown(); if (down) { sw.unregister(); } return down; }

Target:
public synchronized void removeSwitch(final long ovxDpid) { this.dpidCounter.releaseIndex((int) (0x000000 << 32 | ovxDpid)); OVXSwitch sw = this.getSwitch(ovxDpid); sw.tearDown(); sw.unregister(); }
Source:
public void seal() throws IOException { int size = (_bitmapWriters.length + 1) * Integer.BYTES; for (RoaringBitmapWriter<MutableRoaringBitmap> writer : _bitmapWriters) { size += writer.get().serializedSizeInBytes(); Preconditions.checkState(size > 0, "Inverted index file: %s exceeds 2GB limit", _invertedIndexFile); } ByteBuffer buffer = null; try (FileChannel channel = new RandomAccessFile(_invertedIndexFile, "rw").getChannel()) { buffer = channel.map(FileChannel.MapMode.READ_WRITE, 0, size).order(LITTLE_ENDIAN); int bitmapOffset = (_bitmapWriters.length + 1) * Integer.BYTES; buffer.putInt(Integer.reverseBytes(bitmapOffset)); for (RoaringBitmapWriter<MutableRoaringBitmap> writer : _bitmapWriters) { bitmapOffset += writer.getUnderlying().serializedSizeInBytes(); buffer.putInt(Integer.reverseBytes(bitmapOffset)); } for (RoaringBitmapWriter<MutableRoaringBitmap> bitmap : _bitmapWriters) { bitmap.getUnderlying().serialize(buffer); } } catch (Exception e) { FileUtils.deleteQuietly(_invertedIndexFile); throw e; } finally { if (null != buffer && CleanerUtil.UNMAP_SUPPORTED) { CleanerUtil.getCleaner().freeBuffer(buffer); } } }

Target:
public void seal() throws IOException { int startOfBitmaps = (_bitmapWriters.length + 1) * Integer.BYTES; ByteBuffer bitmapBuffer = null; ByteBuffer offsetBuffer = null; try (FileChannel channel = new RandomAccessFile(_invertedIndexFile, "rw").getChannel()) { offsetBuffer = channel.map(FileChannel.MapMode.READ_WRITE, 0, startOfBitmaps) .order(ByteOrder.BIG_ENDIAN); bitmapBuffer = channel.map(FileChannel.MapMode.READ_WRITE, startOfBitmaps, Integer.MAX_VALUE - startOfBitmaps) .order(ByteOrder.LITTLE_ENDIAN); offsetBuffer.putInt(startOfBitmaps); for (RoaringBitmapWriter<RoaringBitmap> writer : _bitmapWriters) { writer.get().serialize(bitmapBuffer); offsetBuffer.putInt(startOfBitmaps + bitmapBuffer.position()); } channel.truncate(startOfBitmaps + bitmapBuffer.position()); } catch (Exception e) { FileUtils.deleteQuietly(_invertedIndexFile); throw e; } finally { if (CleanerUtil.UNMAP_SUPPORTED) { CleanerUtil.BufferCleaner cleaner = CleanerUtil.getCleaner(); if (bitmapBuffer != null) { cleaner.freeBuffer(bitmapBuffer); } if (offsetBuffer != null) { cleaner.freeBuffer(offsetBuffer); } } } }
Source:
private String doRegister() { URI envsUri = UriComponentsBuilder.newInstance().uri(jaasEndpoint).path("/envs").build().toUri(); TestEnvironmentEntity testEnvironmentEntity = buildTestEnvironmentEntityWith(TestEnvironmentStatus.PENDING); ResponseEntity<String> responseEntity = null; boolean posted = false; do { try { responseEntity = restTemplate.postForEntity(envsUri, testEnvironmentEntity, String.class); posted = true; } catch (HttpClientErrorException e) { if (!isEnvIdUnacceptable(e)) { throw e; } envId = UUID.randomUUID().toString(); testEnvironmentEntity.setEnvironmentId(envId); } } while (!posted); final String sessionCookie = extractSessionCookie(responseEntity); LOGGER.info("Received cookie value - {}", TestEnvUtils.SESSION_COOKIE, sessionCookie); return sessionCookie; }

Target:
private String doRegister() { URI envsUri = UriComponentsBuilder.newInstance().uri(jaasEndpoint).path("/envs").build().toUri(); TestEnvironmentEntity testEnvironmentEntity = buildTestEnvironmentEntityWith(TestEnvironmentStatus.PENDING); ResponseEntity<String> responseEntity = null; boolean posted = false; do { try { responseEntity = restTemplate.postForEntity(envsUri, testEnvironmentEntity, String.class); posted = true; } catch (HttpClientErrorException e) { if (!isEnvIdUnacceptable(e)) { throw e; } envId = UUID.randomUUID().toString(); LOGGER.warn("Changing env id from to {}", testEnvironmentEntity.getEnvironmentId(), envId); testEnvironmentEntity.setEnvironmentId(envId); } } while (!posted); final String sessionCookie = extractSessionCookie(responseEntity); LOGGER.info("Environment successfully registered to JaaS with session cookie - {}", envId, sessionCookie); return sessionCookie; }
Source:
public void collectChannels(Connection connection) { if(connection.getSourceElement().isMapped() && connection.getDestinationElement().isMapped() && connection.getSourceElement().getResource() != connection.getDestinationElement().getResource()) { List<Event> sourceEvents = getSourceEvents(connection); Resource sourceResource = connection.getSourceElement().getResource(); Resource destinationResource = connection.getDestinationElement().getResource(); FBNetworkElement mappedElement = connection.getDestinationElement().getOpposite(); boolean local = sourceResource.getDevice() == destinationResource.getDevice(); for (Event sourceEvent : sourceEvents) { CommunicationChannel channel = getComChannel(local, sourceEvent, connection); if(null != channel) { CommunicationChannelDestination destination = channel.getDestination(destinationResource); destination.getConnection().add(connection); int portIndex = getPortIndex(connection, sourceEvent); List<IInterfaceElement> destinationPortList = destination.getDestinationPorts().get(portIndex); if (destinationPortList == null) { destinationPortList = new ArrayList<>(); destination.getDestinationPorts().put(portIndex, destinationPortList); } destinationPortList.add(mappedElement.getInterfaceElement(connection.getDestination().getName())); } } } }

Target:
public void collectChannels(Connection connection) { if(connection.getSourceElement().isMapped() && connection.getDestinationElement().isMapped() && connection.getSourceElement().getResource() != connection.getDestinationElement().getResource()) { List<Event> sourceEvents = getSourceEvents(connection); Resource sourceResource = connection.getSourceElement().getResource(); Resource destinationResource = connection.getDestinationElement().getResource(); FBNetworkElement mappedElement = connection.getDestinationElement().getOpposite(); boolean local = sourceResource.getDevice() == destinationResource.getDevice(); for (Event sourceEvent : sourceEvents) { CommunicationChannel channel = getComChannel(local, sourceEvent, connection); if(null != channel) { CommunicationChannelDestination destination = channel.getDestination(destinationResource); destination.getConnection().add(connection); int portIndex = getPortIndex(connection, sourceEvent); List<IInterfaceElement> destinationPortList = destination.getDestinationPorts().get(portIndex); if (null == destinationPortList) { destinationPortList = new ArrayList<>(); destination.getDestinationPorts().put(portIndex, destinationPortList); } destinationPortList.add(mappedElement.getInterfaceElement(connection.getDestination().getName())); } } } }
Source:
private void handlePackError(IOException e, PackFile p) { String warnTmpl = null; if ((e instanceof CorruptObjectException) || (e instanceof PackInvalidException)) { warnTmpl = JGitText.get().corruptPack; removePack(p); } else if (e instanceof FileNotFoundException) { warnTmpl = JGitText.get().packWasDeleted; removePack(p); } if (warnTmpl != null) { LOG.warn(MessageFormat.format(warnTmpl, p.getPackFile() .getAbsolutePath())); } else { LOG.error(MessageFormat.format( JGitText.get().exceptionWhileReadingPack, p.getPackFile() .getAbsolutePath()), e); } }

Target:
private void handlePackError(IOException e, PackFile p) { String warnTmpl = null; if ((e instanceof CorruptObjectException) || (e instanceof PackInvalidException)) { warnTmpl = JGitText.get().corruptPack; removePack(p); } else if (e instanceof FileNotFoundException) { warnTmpl = JGitText.get().packWasDeleted; removePack(p); } if (warnTmpl != null) { if (LOG.isDebugEnabled()) { LOG.warn(MessageFormat.format(warnTmpl, p.getPackFile().getAbsolutePath()), e); } else { LOG.warn(MessageFormat.format(warnTmpl, p.getPackFile().getAbsolutePath())); } } else { LOG.error(MessageFormat.format( JGitText.get().exceptionWhileReadingPack, p.getPackFile() .getAbsolutePath()), e); } }