auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public abstract @Nullable PcapPacket parseNextPacket() throws IOException, BadPcapFileException, BadPacketException; public synchronized void skipNextPacket() throws IOException, BadPcapFileException { if (getFileChannel().size() - getFileChannel().position() == 0) { return; } if (getFileChannel().size() - getFileChannel().position() < PcapFileValues.PACKET_HEADER_SIZE) { throw new BadPcapFileException("A pcap header is invalid."); } ByteBuffer pcapPacketHeader = ByteBuffer.allocate(PcapFileValues.PACKET_HEADER_SIZE); pcapPacketHeader.clear(); pcapPacketHeader.order(ByteOrder.BIG_ENDIAN); getFileChannel().read(pcapPacketHeader); pcapPacketHeader.flip(); pcapPacketHeader.position(PcapFileValues.INCLUDED_LENGTH_POSITION); long includedPacketLength = ConversionHelper.unsignedIntToLong(pcapPacketHeader.getInt()); if (getFileChannel().size() - getFileChannel().position() < includedPacketLength) { throw new BadPcapFileException("A packet header is invalid."); } getFileChannel().position(getFileChannel().position() + includedPacketLength); fFileIndex.put(++fCurrentRank, getFileChannel().position()); }

Target:
public abstract @Nullable PcapPacket parseNextPacket() throws IOException, BadPcapFileException, BadPacketException; public abstract void skipNextPacket() throws IOException, BadPcapFileException; public abstract void seekPacket(long rank) throws IOException, BadPcapFileException; public synchronized long getTotalNbPackets() throws IOException, BadPcapFileException { if (fTotalNumberPackets == -1) { long rank = fCurrentRank; fCurrentRank = fFileIndex.floorKey(rank); while (hasNextPacket()) { skipNextPacket(); } fTotalNumberPackets = fCurrentRank; fCurrentRank = rank; seekPacket(rank); } return fTotalNumberPackets; }
Source:
public String getUsage() { String typeString = getType().getSimpleName(); if (isArray()) { typeString += getArrayDelimiter() + typeString; } String cmd = typeString + (hasName() ? " " + getName() : ""); if (required) { cmd = "<" + cmd + ">"; } else { cmd = "(" + cmd + ")"; } return cmd; }

Target:
public String getUsage() { String simpleTypeName = getType().getSimpleName(); StringBuilder usage = new StringBuilder(simpleTypeName); if (isArray()) { usage.append(getArrayDelimiter()).append(simpleTypeName); } if (hasName()) { usage.append(' ').append(getName()); } if (required) { usage.insert(0, '<'); usage.append('>'); } else { usage.insert(0, '('); usage.append(')'); } return usage.toString(); }
Source:
public void testCreateTwoBorderNodesAtSameLocationWithThinGridSpacing() { int gridStep = 50; editor.setSnapToGrid(true, gridStep, 2); SWTBotGefEditPart packageP4 = editor.getEditPart(PACKAGE_4_NAME, AbstractDiagramContainerEditPart.class); Rectangle packageAbsoluteBounds = editor.getAbsoluteBounds(packageP4); Point creationLocation = packageAbsoluteBounds.getTopLeft().translate(20, 20); createBorderedNode(BORDERED_NODE_CREATION_ON_PACKAGE_TOOL_NAME_2, creationLocation.x, creationLocation.y); createBorderedNode(BORDERED_NODE_CREATION_ON_PACKAGE_TOOL_NAME_2, creationLocation.x, creationLocation.y); IGraphicalEditPart firstNewNode = (IGraphicalEditPart) editor.getEditPart("new Enum2", AbstractDiagramBorderNodeEditPart.class).part(); assertTrue("For BorderNode 'new Enum2', the x coordinate or y coordinate of top left corner should be on the grid should be on the grid.", checkLocationAlignOnGrid(firstNewNode, gridStep)); IGraphicalEditPart secondNewNode = (IGraphicalEditPart) editor.getEditPart("new Enum3", AbstractDiagramBorderNodeEditPart.class).part(); assertTrue("For BorderNode 'new Enum3', the x coordinate or y coordinate of top left corner should be on the grid should be on the grid.", checkLocationAlignOnGrid(secondNewNode, gridStep)); }

Target:
public void testCreateTwoBorderNodesAtSameLocationWithThinGridSpacing() { int gridStep = 50; editor.setSnapToGrid(true, gridStep, 2); SWTBotGefEditPart packageP4 = editor.getEditPart(PACKAGE_4_NAME, AbstractDiagramContainerEditPart.class); Rectangle packageAbsoluteBounds = editor.getAbsoluteBounds(packageP4); Point creationLocation = packageAbsoluteBounds.getTopLeft().translate(20, 20); createBorderedNode(BORDERED_NODE_CREATION_ON_PACKAGE_TOOL_NAME_2, creationLocation.x, creationLocation.y); createBorderedNode(BORDERED_NODE_CREATION_ON_PACKAGE_TOOL_NAME_2, creationLocation.x, creationLocation.y); IGraphicalEditPart firstNewNode = (IGraphicalEditPart) editor.getEditPart("new Enum2", AbstractDiagramBorderNodeEditPart.class).part(); checkLocationAlignOnGrid(firstNewNode, "BorderNode 'new Enum2'"); IGraphicalEditPart secondNewNode = (IGraphicalEditPart) editor.getEditPart("new Enum3", AbstractDiagramBorderNodeEditPart.class).part(); checkLocationAlignOnGrid(secondNewNode, "BorderNode 'new Enum3'"); }
Source:
private void fetchPresenterWidgetTemplate(PresenterOptions presenterOptions) throws Exception { PresenterWidgetOptions presenterWidgetOptions = new PresenterWidgetOptions(); presenterWidgetOptions.setSingleton(presenterConfigModel.isUseSingleton()); try { createdPresenterWidgetTemplates = CreatePresenterWidget.run(presenterOptions, presenterWidgetOptions, true); } catch (Exception e) { throw e; } }

Target:
private void fetchPresenterWidgetTemplate(PresenterOptions presenterOptions) throws Exception { PresenterWidgetOptions presenterWidgetOptions = new PresenterWidgetOptions(); presenterWidgetOptions.setSingleton(presenterConfigModel.isUseSingleton()); createdPresenterWidgetTemplates = CreatePresenterWidget.run(presenterOptions, presenterWidgetOptions, true); }
Source:
public void testConvertSecondsToMinutes() { long seconds = 1800L; Pair<Long, TimeUnit> expectedResults = TimeConverter.autoConvert(seconds, TimeUnit.SECONDS); assertEquals(expectedResults.getFirst().longValue() , 30L); }

Target:
public void testConvertSecondsToMinutes() { long seconds = 1800L; Pair<Long, TimeUnit> expectedResults = TimeConverter.autoConvert(seconds, TimeUnit.SECONDS); assertEquals(expectedResults.getFirst().longValue() , 30L); assertEquals(expectedResults.getSecond(), TimeUnit.MINUTES); }
Source:
public void loadBuiltInDefaultFilter() { for (String pattern : java.util.Arrays.asList(new String[] { "/.project", "/.cproject", "/.settings/", "**/coredir.[0-9]*/", "**/core", "!**/core/", "**/core.[0-9]*" })) { addPattern(pattern, true); } }

Target:
public void loadBuiltInDefaultFilter() { for (String pattern : java.util.Arrays.asList(new String[] { "/.project", "/.cproject", "/.settings/", "coredir.[0-9]*/", "core", "!core/", "core.[0-9]*", "!core.[0-9]*/" })) { addPattern(pattern, true); } }
Source:
public Mono<Void> deleteAll(Publisher<? extends T> entityStream) { Assert.notNull(entityStream, "EntityStream must not be null!"); return deleteById(Flux.from(entityStream) .handle((o, synchronousSink) -> { ID id = entityInformation.getId(o); if (id != null) { synchronousSink.next(id); } })); }

Target:
public Mono<Void> deleteAll(Publisher<? extends T> entityStream) { Assert.notNull(entityStream, "EntityStream must not be null!"); return Flux.from(entityStream) .map(entity -> { ID id = entityInformation.getId(entity); if (id == null) { throw new IllegalStateException("Entity id must not be null!"); } return convertId(id); }) .collectList() .map(objects -> { return new StringQuery(QueryBuilders.idsQuery() .addIds(objects.toArray(new String[0])) .toString()); }) .flatMap(query -> { return elasticsearchOperations .deleteBy(query, entityInformation.getJavaType(), entityInformation.getIndexCoordinates()); }) .then(); }
Source:
private void openGeoPackage() { String geoPackagePath = Environment.getExternalStorageDirectory() + getString(R.string.local_folder) + getString(R.string.file_name); Log.d(TAG, geoPackagePath); GeoPackage geoPackage = new GeoPackage(geoPackagePath); geoPackage.loadAsync(); geoPackage.addDoneLoadingListener(() -> { if (geoPackage.getLoadStatus() == LoadStatus.LOADED) { FeatureTable geoPackageTable = geoPackage.getGeoPackageFeatureTables().get(0); if (geoPackageTable == null) { Toast.makeText(MainActivity.this, "No feature table found in the package!", Toast.LENGTH_LONG); Log.e(TAG, "No feature table found in this package!"); } FeatureLayer featureLayer = new FeatureLayer(geoPackageTable); mMap.getOperationalLayers().add(featureLayer); } else { Toast.makeText(MainActivity.this, "GeoPackage failed to load! " + geoPackage.getLoadError(), Toast.LENGTH_LONG); Log.e(TAG, "GeoPackage failed to load!" + geoPackage.getLoadError()); } }); }

Target:
private void openGeoPackage() { String geoPackagePath = Environment.getExternalStorageDirectory() + getString(R.string.local_folder) + getString(R.string.file_name); Log.d(TAG, geoPackagePath); GeoPackage geoPackage = new GeoPackage(geoPackagePath); geoPackage.loadAsync(); geoPackage.addDoneLoadingListener(() -> { if (geoPackage.getLoadStatus() == LoadStatus.LOADED) { FeatureTable geoPackageTable = geoPackage.getGeoPackageFeatureTables().get(0); if (geoPackageTable == null) { Toast.makeText(MainActivity.this, "No feature table found in the package!", Toast.LENGTH_LONG).show(); Log.e(TAG, "No feature table found in this package!"); return; } FeatureLayer featureLayer = new FeatureLayer(geoPackageTable); mMap.getOperationalLayers().add(featureLayer); } else { Toast.makeText(MainActivity.this, "GeoPackage failed to load! " + geoPackage.getLoadError(), Toast.LENGTH_LONG).show(); Log.e(TAG, "GeoPackage failed to load!" + geoPackage.getLoadError()); } }); }
Source:
private void decreaseBuffersInBacklogUnsafe(boolean isBuffer) { assert Thread.holdsLock(buffers); if (isBuffer) { buffersInBacklog--; parent.notifyDecreaseBacklog(buffersInBacklog); } }

Target:
private void decreaseBuffersInBacklogUnsafe(boolean isBuffer) { assert Thread.holdsLock(buffers); if (isBuffer) { buffersInBacklog--; } }
Source:
public String getClusterName() { final String clusterName = client.getClientConfig().getClusterName(); if (clusterName == null) { throw new RuntimeException("Cluster name cannot be null on the client which participates in XA Transaction"); } return clusterName; }

Target:
public String getClusterName() { return client.getClientConfig().getClusterName(); }
Source:
public static void main(String[] args) { ExecutorService es = Executors.newFixedThreadPool(1000); ReaderWriterLock lock = new ReaderWriterLock(); AtomicInteger index = new AtomicInteger(0); IntStream.range(0, 100).forEach(i -> { Runnable task = null; if (ran.nextFloat() <= 0.6) { task = new Runnable() { @Override public void run() { Lock writeLock = lock.writeLock(); writeLock.lock(); try { int cur = index.getAndIncrement(); System.out.println("Writer " + cur + " begin"); simulateReadOrWrite(); System.out.println("Writer " + cur + " finish"); } finally { writeLock.unlock(); } } }; } else { task = new Runnable() { @Override public void run() { Lock readLock = lock.readLock(); readLock.lock(); try { int cur = index.getAndIncrement(); System.out.println("Reader " + cur + " begin"); simulateReadOrWrite(); System.out.println("Reader " + cur + " finish"); } finally { readLock.unlock(); } } }; } es.submit(task); }); }

Target:
public static void main(String[] args) { ExecutorService executeService = Executors.newFixedThreadPool(1000); ReaderWriterLock lock = new ReaderWriterLock(); IntStream.range(0, 10) .forEach(i -> executeService.submit(new Reader("Reader " + i, lock.readLock()))); IntStream.range(0, 10) .forEach(i -> executeService.submit(new Writer("Writer " + i, lock.writeLock()))); executeService.shutdown(); try { executeService.awaitTermination(5, TimeUnit.SECONDS); } catch (InterruptedException e) { System.out.println("Error waiting for ExecutorService shutdown"); } }
Source:
public List<ECSTaskTemplate> getAllTemplates() { List<ECSTaskTemplate> dynamicTemplates = TaskTemplateMap.get().getTemplates(this); List<ECSTaskTemplate> allTemplates = new CopyOnWriteArrayList<>(); allTemplates.addAll(dynamicTemplates); if (templates != null) { allTemplates.addAll(templates); } return allTemplates; }

Target:
private List<ECSTaskTemplate> getAllTemplates() { List<ECSTaskTemplate> dynamicTemplates = TaskTemplateMap.get().getTemplates(this); List<ECSTaskTemplate> allTemplates = new CopyOnWriteArrayList<>(); allTemplates.addAll(dynamicTemplates); if (templates != null) { allTemplates.addAll(templates); } return allTemplates; }
Source:
public void onResume() { super.onResume(); PermissionHandler.executeIfLocationPermissionGranted(this.activity, new PermissionGrantedCallback(PermissionRequestContext.CacheDetailActivity) { @Override public void execute() { Log.d("CacheDetailActivity.OnResumePermissionGrantedCallback.execute"); final Sensors sensors = Sensors.getInstance(); sensors.setupGeoDataObservables(Settings.useGooglePlayServices(), Settings.useLowPowerMode()); sensors.setupDirectionObservable(); resumeDisposables.addAll(geoDirUpdate.start(GeoDirHandler.UPDATE_GEODIR), startTimer()); } }); final List<String> toRefresh; synchronized (dirtyCaches) { toRefresh = new ArrayList<>(dirtyCaches); dirtyCaches.clear(); } if (!toRefresh.isEmpty()) { AndroidRxUtils.refreshScheduler.scheduleDirect(new Runnable() { @Override public void run() { for (final String geocode : toRefresh) { final Geocache cache = DataStore.loadCache(geocode, LoadFlags.LOAD_WAYPOINTS); if (cache != null) { caches.remove(cache); caches.add(cache); } } displayExecutor.execute(new DisplayRunnable(CGeoMap.this)); } }); } }

Target:
public void onResume() { super.onResume(); PermissionHandler.executeIfLocationPermissionGranted(this.activity, new PermissionGrantedCallback(PermissionRequestContext.CacheDetailActivity) { @Override public void execute() { Log.d("CGeoMap.OnResumePermissionGrantedCallback.execute"); final Sensors sensors = Sensors.getInstance(); sensors.setupGeoDataObservables(Settings.useGooglePlayServices(), Settings.useLowPowerMode()); sensors.setupDirectionObservable(); resumeDisposables.addAll(geoDirUpdate.start(GeoDirHandler.UPDATE_GEODIR), startTimer()); } }); final List<String> toRefresh; synchronized (dirtyCaches) { toRefresh = new ArrayList<>(dirtyCaches); dirtyCaches.clear(); } if (!toRefresh.isEmpty()) { AndroidRxUtils.refreshScheduler.scheduleDirect(new Runnable() { @Override public void run() { for (final String geocode : toRefresh) { final Geocache cache = DataStore.loadCache(geocode, LoadFlags.LOAD_WAYPOINTS); if (cache != null) { caches.remove(cache); caches.add(cache); } } displayExecutor.execute(new DisplayRunnable(CGeoMap.this)); } }); } }
Source:
private TableReference getSingleTable() throws TException { Set<TableReference> lockTables = schemaMutationLockTables.getAllLockTables(); if (lockTables.size() > 1) { Set<TableReference> emptyLockTables = lockTables.stream() .filter(schemaMutationLockTables::isLockTableEmpty) .collect(Collectors.toSet()); if (lockTables.size() - emptyLockTables.size() > 1) { throw new IllegalStateException("Multiple schema mutation lock tables have been created.\n" + "This happens when multiple nodes have themselves as lockLeader in the configuration.\n" + "Please ensure the lockLeader is the same for each node, stop all Atlas clients using this " + "keyspace, restart your cassandra cluster and run the clean-cass-locks-state cli command.\n" + "The tables that clashed were: " + lockTables); } if (lockTables.size() == emptyLockTables.size()) { emptyLockTables.remove(emptyLockTables.iterator().next()); } for (TableReference emptyLockTable : emptyLockTables) { schemaMutationLockTables.dropLockTable(emptyLockTable); } lockTables.removeAll(emptyLockTables); } return Iterables.getOnlyElement(lockTables); }

Target:
private TableReference getSingleTable() throws TException { Set<TableReference> lockTables = schemaMutationLockTables.getAllLockTables(); if (lockTables.size() > 1) { throw new IllegalStateException("Multiple schema mutation lock tables have been created.\n" + "This happens when multiple nodes have themselves as lockLeader in the configuration.\n" + "Please ensure the lockLeader is the same for each node, stop all Atlas clients using this " + "keyspace, restart your cassandra cluster and run the clean-cass-locks-state cli command.\n" + "The tables that clashed were: " + lockTables); } return Iterables.getOnlyElement(lockTables); }
Source:
protected void process(PipelineReportFromDatanode pipelineReportFromDatanode) { Preconditions.checkNotNull(pipelineReportFromDatanode); Pipeline pipeline; PipelineReportsProto pipelineReport = pipelineReportFromDatanode.getReport(); for (PipelineReport report : pipelineReport.getPipelineReportList()) { PipelineID pipelineID = PipelineID .getFromProtobuf(report.getPipelineID()); try { pipeline = pipelineManager.getPipeline(pipelineID); } catch (PipelineNotFoundException e) { continue; } if (processedPipelineIDs.contains(pipelineID)) { continue; } if (pipeline.getFactor() == HddsProtos.ReplicationFactor.THREE && pipeline.getPipelineState() == Pipeline.PipelineState.OPEN) { currentHealthyPipelineCount++; getSafeModeMetrics().incCurrentHealthyPipelinesCount(); } processedPipelineIDs.add(pipelineID); } if (scmInSafeMode()) { SCMSafeModeManager.getLogger().info( "SCM in safe mode. Healthy pipelines reported count is {}, " + "required healthy pipeline reported count is {}", currentHealthyPipelineCount, healthyPipelineThresholdCount); } }

Target:
protected void process(PipelineReportFromDatanode pipelineReportFromDatanode) { Preconditions.checkNotNull(pipelineReportFromDatanode); Pipeline pipeline; PipelineReportsProto pipelineReport = pipelineReportFromDatanode.getReport(); for (PipelineReport report : pipelineReport.getPipelineReportList()) { PipelineID pipelineID = PipelineID .getFromProtobuf(report.getPipelineID()); if (processedPipelineIDs.contains(pipelineID)) { continue; } try { pipeline = pipelineManager.getPipeline(pipelineID); } catch (PipelineNotFoundException e) { continue; } if (pipeline.getFactor() == HddsProtos.ReplicationFactor.THREE && pipeline.getPipelineState() == Pipeline.PipelineState.OPEN) { currentHealthyPipelineCount++; getSafeModeMetrics().incCurrentHealthyPipelinesCount(); } processedPipelineIDs.add(pipelineID); } if (scmInSafeMode()) { SCMSafeModeManager.getLogger().info( "SCM in safe mode. Healthy pipelines reported count is {}, " + "required healthy pipeline reported count is {}", currentHealthyPipelineCount, healthyPipelineThresholdCount); } }
Source:
private synchronized void flushWrittenBytesToServiceInternal(final long offset, final boolean retainUncommitedData, final boolean isClose) throws IOException { try (AbfsPerfInfo tracker = new AbfsPerfInfo(client.getAbfsPerfTracker(), "flushWrittenBytesToServiceInternal", "flush")) { tracker.registerResult(client.flush(path, offset, retainUncommitedData, isClose).getResult()).registerSuccess(true); } catch (AzureBlobFileSystemException ex) { if (ex instanceof AbfsRestOperationException) { if (((AbfsRestOperationException) ex).getStatusCode() == HttpURLConnection.HTTP_NOT_FOUND) { throw new FileNotFoundException(ex.getMessage()); } } throw new IOException(ex); } this.lastFlushOffset = offset; }

Target:
private synchronized void flushWrittenBytesToServiceInternal(final long offset, final boolean retainUncommitedData, final boolean isClose) throws IOException { AbfsPerfTracker tracker = client.getAbfsPerfTracker(); try (AbfsPerfInfo perfInfo = new AbfsPerfInfo(tracker, "flushWrittenBytesToServiceInternal", "flush")) { AbfsRestOperation op = client.flush(path, offset, retainUncommitedData, isClose); perfInfo.registerResult(op.getResult()).registerSuccess(true); } catch (AzureBlobFileSystemException ex) { if (ex instanceof AbfsRestOperationException) { if (((AbfsRestOperationException) ex).getStatusCode() == HttpURLConnection.HTTP_NOT_FOUND) { throw new FileNotFoundException(ex.getMessage()); } } throw new IOException(ex); } this.lastFlushOffset = offset; }
Source:
public boolean updateBlobMetadata(BlobId blobId, String fieldName, Object value) throws BlobStorageException { Objects.requireNonNull(blobId, "BlobId cannot be null"); Objects.requireNonNull(fieldName, "Field name cannot be null"); try { BlockBlobClient blobClient = getBlockBlobClient(blobId, false); Timer.Context storageTimer = azureMetrics.blobUpdateTime.time(); try { BlobProperties blobProperties = blobClient.getProperties(); if (blobProperties == null) { logger.debug("Blob not found.", blobId); return false; } String etag = blobProperties.getETag(); Map<String, String> metadata = blobProperties.getMetadata(); String textValue = String.valueOf(value); if (!textValue.equals(metadata.get(fieldName))) { metadata.put(fieldName, textValue); if (updateCallback != null) { try { updateCallback.call(); } catch (Exception ex) { } } BlobRequestConditions blobRequestConditions = new BlobRequestConditions().setIfMatch(etag); blobClient.setMetadataWithResponse(metadata, blobRequestConditions, null, Context.NONE); } return true; } finally { storageTimer.stop(); } } catch (BlobStorageException e) { if (isNotFoundError(e.getErrorCode())) { return false; } if (e.getErrorCode() == BlobErrorCode.CONDITION_NOT_MET) { azureMetrics.blobUpdateConflictCount.inc(); } throw e; } }

Target:
public boolean updateBlobMetadata(BlobId blobId, String fieldName, Object value) throws BlobStorageException { Objects.requireNonNull(blobId, "BlobId cannot be null"); Objects.requireNonNull(fieldName, "Field name cannot be null"); try { BlockBlobClient blobClient = getBlockBlobClient(blobId, false); Timer.Context storageTimer = azureMetrics.blobUpdateTime.time(); try { BlobProperties blobProperties = blobClient.getProperties(); if (blobProperties == null) { logger.debug("Blob not found.", blobId); return false; } String etag = blobProperties.getETag(); Map<String, String> metadata = blobProperties.getMetadata(); String textValue = String.valueOf(value); if (!textValue.equals(metadata.get(fieldName))) { metadata.put(fieldName, textValue); if (updateCallback != null) { try { updateCallback.call(); } catch (Exception ex) { logger.error("Error in update callback", ex); } } BlobRequestConditions blobRequestConditions = new BlobRequestConditions().setIfMatch(etag); blobClient.setMetadataWithResponse(metadata, blobRequestConditions, null, Context.NONE); } return true; } finally { storageTimer.stop(); } } catch (BlobStorageException e) { if (isNotFoundError(e.getErrorCode())) { return false; } if (e.getErrorCode() == BlobErrorCode.CONDITION_NOT_MET) { azureMetrics.blobUpdateConflictCount.inc(); } throw e; } }
Source:
private int getCacheDuration(){ String duration = System.getProperty(SYSTEM_PROPERTY_CACHE_DURATION, "300"); try { return Integer.parseInt(duration); } catch(NumberFormatException e) { String message = String.format("cannot parse system property: %s with value=%s, using default instead." , SYSTEM_PROPERTY_CACHE_DURATION , duration); LOG.warn(message, e); } return 300; }

Target:
private int getCacheDuration(){ return Integer.getInteger(SYSTEM_PROPERTY_CACHE_DURATION, 300); }
Source:
public boolean hasLicenseInfo() { return !(license.equals("") && licenseShortName.equals("") & licenseUrl.equals("")); }

Target:
public boolean hasLicenseInfo() { return !license.isEmpty() && !licenseShortName.isEmpty() && !licenseUrl.isEmpty(); }
Source:
public Response updateRolesForScope(ScopeListDTO body, MessageContext messageContext) throws APIManagementException { String tenantDomain = MultitenantUtils.getTenantDomain(RestApiUtil.getLoggedInUsername()); JsonObject existingTenantConfObject = new JsonObject(); try { APIMRegistryService apimRegistryService = new APIMRegistryServiceImpl(); String existingTenantConf = apimRegistryService.getConfigRegistryResourceContent(tenantDomain, APIConstants.API_TENANT_CONF_LOCATION); existingTenantConfObject = new JsonParser().parse(existingTenantConf).getAsJsonObject(); } catch (RegistryException | UserStoreException e) { APIUtil.handleException("Couldn't read tenant configuration from tenant registry", e); } try { JSONObject responseJson = new JSONObject(); JSONArray scopeJson = new JSONArray(); for(int i = 0; i < body.getList().size(); i++) { JSONObject scopeRoleJson = new JSONObject(); scopeRoleJson.put("Name", body.getList().get(i).getName()); scopeRoleJson.put("Roles", body.getList().get(i).getRoles()); scopeJson.put(scopeRoleJson); } responseJson.put("Scope", scopeJson); existingTenantConfObject.remove("RESTAPIScopes"); Gson gson = new Gson(); existingTenantConfObject.add("RESTAPIScopes", gson.fromJson(responseJson.toString(), JsonElement.class)); APIUtil.updateTenantConf(existingTenantConfObject.toString(),tenantDomain); Map<String, String> scopeRoleMapping = APIUtil.getRESTAPIScopesForTenant(MultitenantUtils .getTenantDomain(RestApiUtil.getLoggedInUsername())); ScopeListDTO scopeListDTO = SystemScopesMappingUtil.fromScopeListToScopeListDTO(scopeRoleMapping); return Response.ok().entity(scopeListDTO).build(); } catch (APIManagementException e) { String errorMessage = "Error when updating the list of scopes-role mapping."; RestApiUtil.handleInternalServerError(errorMessage, e, log); } return null; }

Target:
public Response updateRolesForScope(ScopeListDTO body, MessageContext messageContext) throws APIManagementException { JSONObject newScopeRoleJson = SystemScopesMappingUtil.createJsonObjectOfScopeMapping(body); APIUtil.updateTenantConfOfRoleScopeMapping(newScopeRoleJson, RestApiUtil.getLoggedInUsername()); Map<String, String> scopeRoleMapping = APIUtil.getRESTAPIScopesForTenant(MultitenantUtils .getTenantDomain(RestApiUtil.getLoggedInUsername())); ScopeListDTO scopeListDTO = SystemScopesMappingUtil.fromScopeListToScopeListDTO(scopeRoleMapping); return Response.ok().entity(scopeListDTO).build(); }
Source:
Bitmap quickMemoryCacheCheck(String key) { Bitmap cached = cache.get(key); if (cached != null) { stats.dispatchCacheHit(); } else { stats.dispatchCacheMiss(); } return cached; }

Target:
Bitmap quickMemoryCacheCheck(String key) { Bitmap cached = cache.get(key); if (cached != null) { stats.dispatchCacheHit(); } return cached; }
Source:
void subscription() { final BoundedContext boundedContext = setupBoundedContextWithProjectAggregateRepo(); final SubscriptionService subscriptionService = SubscriptionService.newBuilder() .add(boundedContext) .build(); final MemoizeStreamObserver<Subscription> observer = new MemoizeStreamObserver<>(); subscriptionService.subscribe(null, observer); assertNull(observer.streamFlowValue()); assertFalse(observer.isCompleted()); assertNotNull(observer.throwable()); assertInstanceOf(NullPointerException.class, observer.throwable()); }

Target:
void subscription() { BoundedContext boundedContext = setupBoundedContextWithProjectAggregateRepo(); SubscriptionService subscriptionService = SubscriptionService.newBuilder() .add(boundedContext) .build(); MemoizeStreamObserver<Subscription> observer = new MemoizeStreamObserver<>(); subscriptionService.subscribe(null, observer); assertNull(observer.streamFlowValue()); assertFalse(observer.isCompleted()); assertNotNull(observer.throwable()); assertInstanceOf(NullPointerException.class, observer.throwable()); }
Source:
void createWereBetweenPredicate() { final Command command1 = requestFactory.createCommand(StringValue.getDefaultInstance(), minutesAgo(5)); final Command command2 = requestFactory.createCommand(Int64Value.getDefaultInstance(), minutesAgo(2)); final Command command3 = requestFactory.createCommand(BoolValue.getDefaultInstance(), secondsAgo(30)); final Command command4 = requestFactory.createCommand(BoolValue.getDefaultInstance(), secondsAgo(20)); final Command command5 = requestFactory.createCommand(BoolValue.getDefaultInstance(), secondsAgo(5)); final ImmutableList<Command> commands = ImmutableList.of(command1, command2, command3, command4, command5); final Iterable<Command> filter = Iterables.filter( commands, Commands.wereWithinPeriod(minutesAgo(3), secondsAgo(10)) ); assertEquals(3, FluentIterable.from(filter) .size()); }

Target:
void createWereBetweenPredicate() { final Command fiveMinsAgo = requestFactory.createCommand(StringValue.getDefaultInstance(), minutesAgo(5)); final Command twoMinsAgo = requestFactory.createCommand(Int64Value.getDefaultInstance(), minutesAgo(2)); final Command thirtySecondsAgo = requestFactory.createCommand(BoolValue.getDefaultInstance(), secondsAgo(30)); final Command twentySecondsAgo = requestFactory.createCommand(BoolValue.getDefaultInstance(), secondsAgo(20)); final Command fiveSecondsAgo = requestFactory.createCommand(BoolValue.getDefaultInstance(), secondsAgo(5)); final ImmutableList<Command> commands = ImmutableList.of(fiveMinsAgo, twoMinsAgo, thirtySecondsAgo, twentySecondsAgo, fiveSecondsAgo); final Iterable<Command> filter = Iterables.filter( commands, Commands.wereWithinPeriod(minutesAgo(3), secondsAgo(10)) ); assertEquals(3, FluentIterable.from(filter) .size()); }
Source:
public void testOrderingPostProcessors() throws IOException { final Resource left = input.getLeft(); final Resource right = input.getRight(); final IComparisonScope scope = EMFCompare.createDefaultScope(left, right); PostProcessorDescriptorRegistryImpl registry = new PostProcessorDescriptorRegistryImpl(); registry.put(TestPostProcessor1.class.getName(), new TestPostProcessorDescriptor(Pattern.compile(""), null, new TestPostProcessor1(), 1)); registry.put(TestPostProcessor2.class.getName(), new TestPostProcessorDescriptor(Pattern .compile("<LINK_0>"), null, new TestPostProcessor2(), 10)); registry.put(TestPostProcessor3.class.getName(), new TestPostProcessorDescriptor(Pattern .compile("<LINK_0>"), null, new TestPostProcessor3(), 9)); registry.put(TestPostProcessor4.class.getName(), new TestPostProcessorDescriptor(Pattern .compile("<LINK_0>"), null, new TestPostProcessor4(), 11)); EMFCompare.builder().setPostProcessorRegistry(registry).build().compare(scope); List<IPostProcessor> postProcessors = registry.getPostProcessors(scope); assertTrue(postProcessors.get(0) instanceof TestPostProcessor3); assertTrue(postProcessors.get(1) instanceof TestPostProcessor2); assertTrue(postProcessors.get(2) instanceof TestPostProcessor4); }

Target:
public void testOrderingPostProcessors() throws IOException { final Resource left = input.getLeft(); final Resource right = input.getRight(); final IComparisonScope scope = EMFCompare.createDefaultScope(left, right); PostProcessorDescriptorRegistryImpl registry = new PostProcessorDescriptorRegistryImpl(); registry.put(TestPostProcessor1.class.getName(), new TestPostProcessorDescriptor(Pattern.compile(""), null, new TestPostProcessor1(), 1)); registry.put(TestPostProcessor2.class.getName(), new TestPostProcessorDescriptor(Pattern .compile("<LINK_0>"), null, new TestPostProcessor2(), 10)); registry.put(TestPostProcessor3.class.getName(), new TestPostProcessorDescriptor(Pattern .compile("<LINK_0>"), null, new TestPostProcessor3(), 9)); registry.put(TestPostProcessor4.class.getName(), new TestPostProcessorDescriptor(Pattern .compile("<LINK_0>"), null, new TestPostProcessor4(), 11)); EMFCompare.builder().setPostProcessorRegistry(registry).build().compare(scope); List<IPostProcessor> postProcessors = registry.getPostProcessors(scope); assertEquals(3, postProcessors.size()); assertTrue(postProcessors.get(0) instanceof TestPostProcessor3); assertTrue(postProcessors.get(1) instanceof TestPostProcessor2); assertTrue(postProcessors.get(2) instanceof TestPostProcessor4); }
Source:
public void init() throws Exception { StreamConfig configuration = getConfiguration(); ClassLoader userClassLoader = getUserCodeClassLoader(); StreamConfig.Input[] inputs = configuration.getInputs(userClassLoader); ArrayList<IndexedInputGate>[] inputLists = new ArrayList[ (int) Arrays.stream(inputs) .filter(input -> (input instanceof StreamConfig.NetworkInput)) .count()]; WatermarkGauge[] watermarkGauges = new WatermarkGauge[inputs.length]; for (int i = 0; i < inputLists.length; i++) { inputLists[i] = new ArrayList<>(); } for (int i = 0; i < inputs.length; i++) { watermarkGauges[i] = new WatermarkGauge(); mainOperator.getMetricGroup().gauge(MetricNames.currentInputWatermarkName(i + 1), watermarkGauges[i]); } MinWatermarkGauge minInputWatermarkGauge = new MinWatermarkGauge(watermarkGauges); mainOperator.getMetricGroup().gauge(MetricNames.IO_CURRENT_INPUT_WATERMARK, minInputWatermarkGauge); List<StreamEdge> inEdges = configuration.getInPhysicalEdges(userClassLoader); int numberOfInputs = configuration.getNumberOfNetworkInputs(); for (int i = 0; i < numberOfInputs; i++) { int inputType = inEdges.get(i).getTypeNumber(); IndexedInputGate reader = getEnvironment().getInputGate(i); inputLists[inputType - 1].add(reader); } createInputProcessor(inputLists, inputs, watermarkGauges); getEnvironment().getMetricGroup().gauge(MetricNames.IO_CURRENT_INPUT_WATERMARK, minInputWatermarkGauge::getValue); }

Target:
public void init() throws Exception { StreamConfig configuration = getConfiguration(); ClassLoader userClassLoader = getUserCodeClassLoader(); InputConfig[] inputs = configuration.getInputs(userClassLoader); ArrayList[] inputLists = new ArrayList[configuration.getNumberOfNetworkInputs()]; WatermarkGauge[] watermarkGauges = new WatermarkGauge[inputs.length]; for (int i = 0; i < inputLists.length; i++) { inputLists[i] = new ArrayList<>(); } for (int i = 0; i < inputs.length; i++) { watermarkGauges[i] = new WatermarkGauge(); mainOperator.getMetricGroup().gauge(MetricNames.currentInputWatermarkName(i + 1), watermarkGauges[i]); } MinWatermarkGauge minInputWatermarkGauge = new MinWatermarkGauge(watermarkGauges); mainOperator.getMetricGroup().gauge(MetricNames.IO_CURRENT_INPUT_WATERMARK, minInputWatermarkGauge); List<StreamEdge> inEdges = configuration.getInPhysicalEdges(userClassLoader); int numberOfInputs = configuration.getNumberOfNetworkInputs(); for (int i = 0; i < numberOfInputs; i++) { int inputType = inEdges.get(i).getTypeNumber(); IndexedInputGate reader = getEnvironment().getInputGate(i); inputLists[inputType - 1].add(reader); } createInputProcessor(inputLists, inputs, watermarkGauges); getEnvironment().getMetricGroup().gauge(MetricNames.IO_CURRENT_INPUT_WATERMARK, minInputWatermarkGauge::getValue); }
Source:
public void setResponseData(String data) { if(data!=null && !data.equals("") && responseContentType!= null && responseContentType.toLowerCase().indexOf("application/json")!=-1){ try{ JSONObject responseJSON = new JSONObject(data); this.responseData = responseJSON.toString(); }catch(Exception e){ e.printStackTrace(); } }else { this.responseData = data; } }

Target:
public void setResponseData(String data) { this.responseData = data; }
Source:
public IndexedInts getRow() { final IndexedInts row = selector.getRow(); if (row.size() == 1) { if (nullAdjustment == 0) { return row; } else { return new SingleIndexedInt(row.get(0) + nullAdjustment); } } else { return new SingleIndexedInt(0); } }

Target:
public IndexedInts getRow() { final IndexedInts row = selector.getRow(); if (row.size() == 1) { if (nullAdjustment == 0) { return row; } else { return SingleIndexedInt.of(row.get(0) + nullAdjustment); } } else { return SingleIndexedInt.of(0); } }
Source:
public ShiroPasswordEncoder(final PasswordService delegate) { this.delegate = delegate; }

Target:
public ShiroPasswordEncoder(final PasswordService delegate) { CommonHelper.assertNotNull("delegate", delegate); this.delegate = delegate; }
Source:
private Map<String, ResourceAssignment> calculateAssignment( ResourceControllerDataProvider clusterData, Map<HelixConstants.ChangeType, Set<String>> clusterChanges, Map<String, Resource> resourceMap, Set<String> activeNodes, Map<String, ResourceAssignment> baseline, Map<String, ResourceAssignment> prevBestPossibleAssignment) throws HelixRebalanceException { long startTime = System.currentTimeMillis(); LOG.info("Start calculating for an assignment"); ClusterModel clusterModel; try { clusterModel = ClusterModelProvider.generateClusterModel(clusterData, resourceMap, activeNodes, clusterChanges, baseline, prevBestPossibleAssignment); } catch (Exception ex) { throw new HelixRebalanceException("Failed to generate cluster model.", HelixRebalanceException.Type.INVALID_CLUSTER_STATUS, ex); } OptimalAssignment optimalAssignment = _rebalanceAlgorithm.calculate(clusterModel); Map<String, ResourceAssignment> newAssignment = optimalAssignment.getOptimalResourceAssignment(); LOG.info("Finish calculateAssignment(). Took: ms.", System.currentTimeMillis() - startTime); return newAssignment; }

Target:
private Map<String, ResourceAssignment> calculateAssignment( ResourceControllerDataProvider clusterData, Map<HelixConstants.ChangeType, Set<String>> clusterChanges, Map<String, Resource> resourceMap, Set<String> activeNodes, Map<String, ResourceAssignment> baseline, Map<String, ResourceAssignment> prevBestPossibleAssignment) throws HelixRebalanceException { long startTime = System.currentTimeMillis(); LOG.info("Start calculating for an assignment"); ClusterModel clusterModel; try { clusterModel = ClusterModelProvider.generateClusterModel(clusterData, resourceMap, activeNodes, clusterChanges, baseline, prevBestPossibleAssignment); } catch (Exception ex) { throw new HelixRebalanceException("Failed to generate cluster model.", HelixRebalanceException.Type.INVALID_CLUSTER_STATUS, ex); } OptimalAssignment optimalAssignment = _rebalanceAlgorithm.calculate(clusterModel); Map<String, ResourceAssignment> newAssignment = optimalAssignment.getOptimalResourceAssignment(); LOG.info("Finish calculating an assignment. Took: ms.", System.currentTimeMillis() - startTime); return newAssignment; }
Source:
private void addMonitors(AbstractMonitors monitors, Timeline timeline) { monitors.addMonitor(new CpuUsageMonitor(jmxConnectionProvider, timeline)); monitors.addMonitor(new MemoryUsageMonitor(jmxConnectionProvider, timeline)); monitors.addMonitor(new GcMonitor(jmxConnectionProvider, timeline)); monitors.addMonitor(new OpenFilesMonitor(jmxConnectionProvider, timeline)); monitors.addMonitor(new RssMonitor(timeline)); if (interfaceName != null) { monitors.addMonitor(NetworkBytesMonitor.createReceiveMonitor(interfaceName, timeline)); monitors.addMonitor(NetworkBytesMonitor.createTransmitMonitor(interfaceName, timeline)); } }

Target:
private void addMonitors(AbstractMonitors monitors, Timeline timeline) { monitors.addMonitor(new CpuUsageMonitor(jmxConnectionProvider, timeline)); monitors.addMonitor(new MemoryUsageMonitor(jmxConnectionProvider, timeline)); monitors.addMonitor(new GcMonitor(jmxConnectionProvider, timeline)); monitors.addMonitor(new OpenFilesMonitor(jmxConnectionProvider, timeline)); if (SystemUtils.IS_LINUX) { monitors.addMonitor(new RssMonitor(timeline)); } if (interfaceName != null) { monitors.addMonitor(NetworkBytesMonitor.createReceiveMonitor(interfaceName, timeline)); monitors.addMonitor(NetworkBytesMonitor.createTransmitMonitor(interfaceName, timeline)); } }
Source:
public void initClusterConnection() { try { connect(); } catch (ConnectionException ex) { LOGGER.error("Creation connection failed due to", ex); throw new RuntimeException(ex); } }

Target:
public void initClusterConnection() { try { connect(); } catch (ConnectionException ex) { LOGGER.error("Initial connection failed due to", ex); throw new RuntimeException(ex); } }
Source:
public String getTooltip(MergeMode mode) { String tooltip; switch (mode) { case LEFT_TO_RIGHT: tooltip = EMFCompareDiagramEditMessages.getString("merged.to.right.tooltip"); break; case RIGHT_TO_LEFT: tooltip = EMFCompareDiagramEditMessages.getString("merged.to.left.tooltip"); break; case ACCEPT: tooltip = EMFCompareDiagramEditMessages.getString("accept.change.tooltip"); break; case REJECT: tooltip = EMFCompareDiagramEditMessages.getString("reject.change.tooltip"); break; default: throw new IllegalStateException(); } return tooltip; }

Target:
public String getTooltip(MergeMode mode) throws IllegalArgumentException { String tooltip; switch (mode) { case LEFT_TO_RIGHT: tooltip = EMFCompareDiagramEditMessages.getString("merged.to.right.tooltip"); break; case RIGHT_TO_LEFT: tooltip = EMFCompareDiagramEditMessages.getString("merged.to.left.tooltip"); break; case ACCEPT: tooltip = EMFCompareDiagramEditMessages.getString("accept.change.tooltip"); break; case REJECT: tooltip = EMFCompareDiagramEditMessages.getString("reject.change.tooltip"); break; default: throw new IllegalArgumentException(); } return tooltip; }
Source:
private Credentials getUserCredentials(HttpServletRequest request) { String header = request.getHeader(SSOUtils.HEADER_AUTHORIZATION).substring("Basic".length()); Credentials credentials = null; if (StringUtils.isNotEmpty(header)) { String[] creds = new String( Base64.decodeBase64(request.getHeader(SSOUtils.HEADER_AUTHORIZATION).substring("Basic".length())), Charset.forName("UTF-8") ).split(":", 2); credentials = translateUser(creds[0], creds[1]); } return credentials; }

Target:
private Credentials getUserCredentials(HttpServletRequest request) { String header = request.getHeader(SSOUtils.HEADER_AUTHORIZATION); Credentials credentials = null; if (StringUtils.isNotEmpty(header)) { String[] creds = new String( Base64.decodeBase64(header.substring("Basic".length())), Charset.forName("UTF-8") ).split(":", 2); if (creds.length == 2) { credentials = translateUser(creds[0], creds[1]); } } return credentials; }
Source:
public static MetricKey<ASTAnyTypeDeclaration> of(final Metric<ASTAnyTypeDeclaration> metric, final String name) { return new MetricKey<ASTAnyTypeDeclaration>() { @Override public String name() { return name; } @Override public Metric<ASTAnyTypeDeclaration> getCalculator() { return metric; } @Override public boolean supports(ASTAnyTypeDeclaration node) { return metric.supports(node); } @Override public boolean equals(Object obj) { return obj == this; } @Override public int hashCode() { return (metric != null ? metric.hashCode() * 31 : 0) + (name != null ? name.hashCode() : 0); } }; }

Target:
public static MetricKey<ASTAnyTypeDeclaration> of(final Metric<ASTAnyTypeDeclaration> metric, final String name) { return new MetricKey<ASTAnyTypeDeclaration>() { @Override public String name() { return name; } @Override public Metric<ASTAnyTypeDeclaration> getCalculator() { return metric; } @Override public boolean supports(ASTAnyTypeDeclaration node) { return metric.supports(node); } @Override public boolean equals(Object obj) { return obj != null && getClass() == obj.getClass() && Objects.equals(name(), getClass().cast(obj).name()) && Objects.equals(getCalculator(), getClass().cast(obj).getCalculator()); } @Override public int hashCode() { return (metric != null ? metric.hashCode() * 31 : 0) + (name != null ? name.hashCode() : 0); } }; }
Source:
public void testSetVisibleSizeAndRefresh() { uiModel.setVisibleSizeAndRefresh(0, 0); verify(delegate).setVisibleSizeAndRefresh(eq(0), eq(0)); }

Target:
public void testSetVisibleSizeAndRefresh() { uiModel.setVisibleSizeAndRefresh(0, 1); verify(delegate).setVisibleSizeAndRefresh(eq(0), eq(1)); }
Source:
public void testReadViaFluentAPI() { FooBarPGType result = (FooBarPGType) handle.createQuery("SELECT get_foo_bar(1)") .map(new PGObjectColumnMapper()) .findOnly(); assertThat(result).isEqualTo(new FooBarPGType(1, "foo1", "bar1")); }

Target:
public void testReadViaFluentAPI() { FooBarPGType result = handle.createQuery("SELECT get_foo_bar(1)") .mapTo(FooBarPGType.class) .findOnly(); assertThat(result).isEqualTo(new FooBarPGType(1, "foo1", "bar1")); }
Source:
public static URI toURI(IPath path) throws CoreException { if (path.isUNC()) { IRemoteServicesManager manager = RemoteCorePlugin.getService(IRemoteServicesManager.class); String[] parts = path.segment(0).split(":"); IRemoteConnectionType services = null; String connName = null; if (parts.length == 2) { services = manager.getConnectionType(parts[0]); connName = parts[1]; } else if (parts.length == 1) { String id = Preferences.getString(IRemotePreferenceConstants.PREF_REMOTE_SERVICES_ID); if (id != null) { services = manager.getConnectionType(id); } connName = parts[0]; } IRemoteConnection conn = null; if (services != null) { conn = services.getConnection(connName); } else if (connName != null) { for (IRemoteConnectionType s : manager.getAllConnectionTypes()) { if (s != null) { conn = s.getConnection(connName); if (conn != null) { break; } } } } if (conn != null) { String scheme = conn.getConnectionType().getScheme(); String filePath = path.removeFirstSegments(1).makeAbsolute().toString(); try { return new URI(scheme, connName, filePath, null, null); } catch (URISyntaxException e) { } } } return null; }

Target:
public static URI toURI(IPath path) { if (path.isUNC()) { IRemoteServicesManager manager = RemoteCorePlugin.getService(IRemoteServicesManager.class); String[] parts = path.segment(0).split(":"); IRemoteConnectionType services = null; String connName = null; if (parts.length == 2) { services = manager.getConnectionType(parts[0]); connName = parts[1]; } else if (parts.length == 1) { String id = Preferences.getString(IRemotePreferenceConstants.PREF_REMOTE_SERVICES_ID); if (id != null) { services = manager.getConnectionType(id); } connName = parts[0]; } IRemoteConnection conn = null; if (services != null) { conn = services.getConnection(connName); } else if (connName != null) { for (IRemoteConnectionType s : manager.getAllConnectionTypes()) { if (s != null) { conn = s.getConnection(connName); if (conn != null) { break; } } } } if (conn != null) { String scheme = conn.getConnectionType().getScheme(); String filePath = path.removeFirstSegments(1).makeAbsolute().toString(); try { return new URI(scheme, connName, filePath, null, null); } catch (URISyntaxException e) { } } } return null; }
Source:
private Iterable<ITask> getTasksAssosciatedWithReviewTask(ITask reviewTask) { String lookupUrl = reviewTask.getUrl(); String taskUrl = "http://someurl"; AbstractRepositoryConnector repository = TasksUiPlugin.getRepositoryManager() .getConnectorForRepositoryTaskUrl(taskUrl); String taskId = repository.getTaskIdFromTaskUrl(taskUrl); String repositoryUrl = repository.getRepositoryUrlFromTaskUrl(taskUrl); ITask assosciatedTask = taskList.getTask(repositoryUrl, taskId); if (assosciatedTask == null) { return Collections.emptyList(); } return ImmutableSet.of(assosciatedTask); }

Target:
private ITask getTasksAssosciatedWithReviewTask(ITask reviewTask) { String lookupUrl = reviewTask.getUrl(); String taskUrl = "http://someurl"; AbstractRepositoryConnector repository = TasksUiPlugin.getRepositoryManager() .getConnectorForRepositoryTaskUrl(taskUrl); String taskId = repository.getTaskIdFromTaskUrl(taskUrl); String repositoryUrl = repository.getRepositoryUrlFromTaskUrl(taskUrl); ITask assosciatedTask = taskList.getTask(repositoryUrl, taskId); return assosciatedTask; }
Source:
static ConnectionSettingsFilter optional(final String... settingNames) { return (ConnectionSettings inputSettings) -> { ConnectionSettings outputSettings = inputSettings.clone(); for (final String settingName : settingNames) { if (outputSettings.hasSetting(settingName)) { outputSettings.removeSetting(settingName); } } return outputSettings; }; }

Target:
static ConnectionSettingsFilter optional(final String... settingNames) { return (ConnectionSettings inputSettings) -> { ConnectionSettings outputSettings = inputSettings.clone(); for (final String settingName : settingNames) { outputSettings.removeSetting(settingName); } return outputSettings; }; }
Source:
public Page getOutput() { if (!finishing) { return null; } QueryInfo queryInfo = queryPerformanceFetcher.getQueryInfo(operatorContext.getDriverContext().getTaskId().getQueryId()); checkState(queryInfo.getOutputStage().isPresent(), "Output stage is missing"); checkState(queryInfo.getOutputStage().get().getSubStages().size() == 1, "Expected one sub stage of explain node"); if (!hasFinalStageInfo(queryInfo.getOutputStage().get())) { return null; } String plan = textDistributedPlan(queryInfo.getOutputStage().get().getSubStages().get(0), metadata, statsCalculator, costCalculator, operatorContext.getSession(), verbose); BlockBuilder builder = VARCHAR.createBlockBuilder(new BlockBuilderStatus(), 1); VARCHAR.writeString(builder, plan); outputConsumed = true; return new Page(builder.build()); }

Target:
public Page getOutput() { if (!finishing) { return null; } QueryInfo queryInfo = queryPerformanceFetcher.getQueryInfo(operatorContext.getDriverContext().getTaskId().getQueryId()); checkState(queryInfo.getOutputStage().isPresent(), "Output stage is missing"); checkState(queryInfo.getOutputStage().get().getSubStages().size() == 1, "Expected one sub stage of explain node"); if (!hasFinalStageInfo(queryInfo.getOutputStage().get())) { return null; } String plan = textDistributedPlan(queryInfo.getOutputStage().get().getSubStages().get(0), functionRegistry, statsCalculator, costCalculator, operatorContext.getSession(), verbose); BlockBuilder builder = VARCHAR.createBlockBuilder(new BlockBuilderStatus(), 1); VARCHAR.writeString(builder, plan); outputConsumed = true; return new Page(builder.build()); }