auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public static void main( String[] args) throws Exception { if (System.getenv("ASANA_CLIENT_ID") == null || System.getenv("ASANA_CLIENT_SECRET") == null) { throw new Error("Please set the ASANA_CLIENT_ID and ASANA_CLIENT_SECRET environment variables."); } System.out.println("== Example using OAuth Client ID and Client Secret:"); OAuthApp app = new OAuthApp( System.getenv("ASANA_CLIENT_ID"), System.getenv("ASANA_CLIENT_SECRET"), OAuthApp.NATIVE_REDIRECT_URI ); Client client = Client.oauth(app); System.out.println("isAuthorized=" + app.isAuthorized()); String url = app.getAuthorizationUrl("FIXME: random state"); System.out.println(url); Desktop.getDesktop().browse(new URI(url)); System.out.println("Copy and paste the returned code from the browser and press enter:"); String code = new LineReader(new InputStreamReader(System.in)).readLine(); String accessToken = app.fetchToken(code); System.out.println("isAuthorized=" + app.isAuthorized()); System.out.println("token=" + accessToken); User user = client.users.me().execute(); System.out.println("me=" + user.name); System.out.println(user.id); if (user.photo != null) System.out.println(user.photo.image_128x128); System.out.println(user.workspaces.iterator().next().name); System.out.println("== Example using OAuth Access Token:"); app = new OAuthApp( System.getenv("ASANA_CLIENT_ID"), System.getenv("ASANA_CLIENT_SECRET"), "urn:ietf:wg:oauth:2.0:oob", accessToken ); client = Client.oauth(app); System.out.println("isAuthorized=" + app.isAuthorized()); System.out.println("me=" + client.users.me().execute().name); }

Target:
public static void main( String[] args) throws Exception { if (System.getenv("ASANA_CLIENT_ID") == null || System.getenv("ASANA_CLIENT_SECRET") == null) { throw new Error("Please set the ASANA_CLIENT_ID and ASANA_CLIENT_SECRET environment variables."); } System.out.println("== Example using OAuth Client ID and Client Secret:"); OAuthApp app = new OAuthApp( System.getenv("ASANA_CLIENT_ID"), System.getenv("ASANA_CLIENT_SECRET"), OAuthApp.NATIVE_REDIRECT_URI ); Client client = Client.oauth(app); System.out.println("isAuthorized=" + app.isAuthorized()); String url = app.getAuthorizationUrl("FIXME: random state"); System.out.println(url); Desktop.getDesktop().browse(new URI(url)); System.out.println("Copy and paste the returned code from the browser and press enter:"); String code = new LineReader(new InputStreamReader(System.in)).readLine(); String accessToken = app.fetchToken(code); System.out.println("isAuthorized=" + app.isAuthorized()); System.out.println("token=" + accessToken); User user = client.users.me().execute(); System.out.println("me=" + user.name); System.out.println(user.id); if (user.photo != null) { System.out.println(user.photo.image_128x128); } System.out.println(user.workspaces.iterator().next().name); System.out.println("== Example using OAuth Access Token:"); app = new OAuthApp( System.getenv("ASANA_CLIENT_ID"), System.getenv("ASANA_CLIENT_SECRET"), "urn:ietf:wg:oauth:2.0:oob", accessToken ); client = Client.oauth(app); System.out.println("isAuthorized=" + app.isAuthorized()); System.out.println("me=" + client.users.me().execute().name); }
Source:
protected void doDeclares() { if (this.isRunning()) { if (this.admin != null) { if (this.queue != null) { admin.declareQueue(this.queue); } if (this.binding != null) { admin.declareBinding(this.binding); } } } }

Target:
private void doDeclares() { if (this.isRunning()) { AmqpAdmin admin = this.getAdmin(); if (admin != null) { if (this.queue != null) { admin.declareQueue(this.queue); } if (this.binding != null) { admin.declareBinding(this.binding); } } } }
Source:
private <T> Optional<T> readFrom(String path, ThrowingReader<T> supplier, boolean quiet) { try { byte[] data = zookeeper.getData().forPath(path); if (ArrayUtils.isNotEmpty(data)) { return Optional.of(supplier.read(data)); } } catch (JsonMappingException malformedException) { if (quiet) { logger.warn("Unable to read data from path {}", path, malformedException); return Optional.empty(); } else { throw new MalformedDataException(path, malformedException); } } catch (Exception exception) { if (quiet) { logger.warn("Unable to read data from path {}", path, exception); return Optional.empty(); } else { throw new InternalProcessingException(exception); } } if (quiet) { logger.warn("No data at path {}", path); return Optional.empty(); } else { throw new InternalProcessingException("No data at path " + path); } }

Target:
private <T> Optional<T> readFrom(String path, ThrowingReader<T> supplier, boolean quiet) { try { byte[] data = zookeeper.getData().forPath(path); if (ArrayUtils.isNotEmpty(data)) { return Optional.of(supplier.read(data)); } else { logWarnOrThrowException("No data at path " + path, new InternalProcessingException("No data at path " + path), quiet); } } catch (JsonMappingException malformedException) { logWarnOrThrowException("Unable to read data from path " + path, new MalformedDataException(path, malformedException), quiet); } catch (InternalProcessingException e) { throw e; } catch (Exception exception) { logWarnOrThrowException("Unable to read data from path " + path, new InternalProcessingException(exception), quiet); } return Optional.empty(); }
Source:
public void testDefaultRouteWhenOutOfSyncOnOlderCluster() { cluster.setCompatibilityVersion(Version.v4_1); network.setDnsResolverConfiguration(sampleDnsResolverConfiguration); assertThat(createTestedInstance(true, sampleDnsResolverConfiguration).isNetworkInSync(), is(false)); }

Target:
public void testDefaultRouteWhenOutOfSyncOnOlderCluster() { cluster.setCompatibilityVersion(Version.v4_1); network.setDnsResolverConfiguration(sampleDnsResolverConfiguration); assertThat(createTestedInstance(true, sampleDnsResolverConfiguration).isNetworkInSync(), is(true)); }
Source:
public void processPendingMoveOrCopy_withOnlyLocalMessages() throws Exception { configureRemoteStoreWithFolder(); Collection<String> strings = Arrays.asList(K9.LOCAL_UID_PREFIX + "msg1", K9.LOCAL_UID_PREFIX + "msg2"); controller.processPendingMoveOrCopy( account, localFolder.getServerId(), FOLDER_NAME, strings, false, null); verify(account).getRemoteStore(); verify(remoteStore).getFolder(FOLDER_NAME); verify(remoteFolder).close(); verifyNoMoreInteractions(remoteFolder); }

Target:
public void processPendingMoveOrCopy_withOnlyLocalMessages() throws Exception { configureRemoteStoreWithFolder(); Collection<String> uids = Arrays.asList(K9.LOCAL_UID_PREFIX + "msg1", K9.LOCAL_UID_PREFIX + "msg2"); controller.processPendingMoveOrCopy( account, localFolder.getServerId(), FOLDER_NAME, uids, false, null); verify(account).getRemoteStore(); verify(remoteStore).getFolder(FOLDER_NAME); verify(remoteFolder).close(); verifyNoMoreInteractions(remoteFolder); }
Source:
public NinjaFileItemStream convert(FileItemStream fileItemStream) { if (inMemory) { return new NinjaInMemoryFileItemStream(fileItemStream, inMemoryFileItemFactory); } else { return new NinjaDiskFileItemStream(fileItemStream, uploadDirectory); } }

Target:
public NinjaFileItemStream convert(FileItemStream fileItemStream) { NinjaFileItemStream item; if (inMemory) { item = inMemoryFileItemStreamProvider.get(); } else { item = diskFileItemStreamProvider.get(); } item.init(fileItemStream); return item; }
Source:
private void populate(ApplicationDTO engineTools) { final VBox toolsPane = new VBox(); final Text title = new TextWithStyle(tr("Wine tools"), TITLE_CSS_CLASS); if (engineTools == null) { return; } toolsPane.getStyleClass().add(CONFIGURATION_PANE_CSS_CLASS); toolsPane.getChildren().add(title); final TilePane toolsContentPane = new TilePane(); toolsContentPane.setPrefColumns(3); toolsContentPane.getStyleClass().add("grid"); for (ScriptDTO tool : engineTools.getScripts()) { Button toolButton = new Button(tool.getScriptName()); toolButton.getStyleClass().addAll("toolButton"); toolButton.setStyle("-fx-background-image: url('" + tool.getIcon() + "');"); toolButton.setOnMouseClicked(event -> { this.lockAll(); this.engineToolsManager.runTool(container.getEngine(), container.getName(), tool.getId(), this::unlockAll, e -> Platform.runLater(() -> new ErrorMessage("Error", e).show())); }); this.lockableElements.add(toolButton); toolsContentPane.getChildren().add(toolButton); } toolsPane.getChildren().add(toolsContentPane); this.setContent(toolsPane); }

Target:
private void populate(ApplicationDTO engineTools) { final VBox toolsPane = new VBox(); final Text title = new TextWithStyle(tr("Wine tools"), TITLE_CSS_CLASS); toolsPane.getStyleClass().add(CONFIGURATION_PANE_CSS_CLASS); toolsPane.getChildren().add(title); final TilePane toolsContentPane = new TilePane(); toolsContentPane.setPrefColumns(3); toolsContentPane.getStyleClass().add("grid"); for (ScriptDTO tool : engineTools.getScripts()) { Button toolButton = new Button(tool.getScriptName()); toolButton.getStyleClass().addAll("toolButton"); toolButton.setStyle("-fx-background-image: url('" + tool.getIcon() + "');"); toolButton.setOnMouseClicked(event -> { this.lockAll(); this.engineToolsManager.runTool(container.getEngine(), container.getName(), tool.getId(), this::unlockAll, e -> Platform.runLater(() -> new ErrorMessage("Error", e).show())); }); this.lockableElements.add(toolButton); toolsContentPane.getChildren().add(toolButton); } toolsPane.getChildren().add(toolsContentPane); this.setContent(toolsPane); }
Source:
private static PlanNodeStatsEstimate symbolToSymbolEquality(PlanNodeStatsEstimate inputStatistics, Symbol left, Symbol right) { SymbolStatsEstimate leftStats = inputStatistics.getSymbolStatistics(left); SymbolStatsEstimate rightStats = inputStatistics.getSymbolStatistics(right); if (isNaN(leftStats.getDistinctValuesCount()) || isNaN(rightStats.getDistinctValuesCount())) { filterStatsForUnknownExpression(inputStatistics); } StatisticRange leftRange = StatisticRange.from(leftStats); StatisticRange rightRange = StatisticRange.from(rightStats); StatisticRange intersect = leftRange.intersect(rightRange); SymbolStatsEstimate newRightStats = buildFrom(rightStats) .setNullsFraction(0) .setStatisticsRange(intersect) .build(); SymbolStatsEstimate newLeftStats = buildFrom(leftStats) .setNullsFraction(0) .setStatisticsRange(intersect) .build(); double nullsFilterFactor = (1 - leftStats.getNullsFraction()) * (1 - rightStats.getNullsFraction()); double filterFactor = 1 / max(leftRange.getDistinctValuesCount(), rightRange.getDistinctValuesCount()); return inputStatistics.mapOutputRowCount(size -> size * filterFactor * nullsFilterFactor) .mapSymbolColumnStatistics(left, oldLeftStats -> newLeftStats) .mapSymbolColumnStatistics(right, oldRightStats -> newRightStats); }

Target:
private static PlanNodeStatsEstimate symbolToSymbolEquality(PlanNodeStatsEstimate inputStatistics, Symbol left, Symbol right) { SymbolStatsEstimate leftStats = inputStatistics.getSymbolStatistics(left); SymbolStatsEstimate rightStats = inputStatistics.getSymbolStatistics(right); if (isNaN(leftStats.getDistinctValuesCount()) || isNaN(rightStats.getDistinctValuesCount())) { filterStatsForUnknownExpression(inputStatistics); } StatisticRange leftRange = StatisticRange.from(leftStats); StatisticRange rightRange = StatisticRange.from(rightStats); StatisticRange intersect = leftRange.intersect(rightRange); SymbolStatsEstimate newRightStats = buildFrom(rightStats) .setNullsFraction(0) .setStatisticsRange(intersect) .build(); SymbolStatsEstimate newLeftStats = buildFrom(leftStats) .setNullsFraction(0) .setStatisticsRange(intersect) .build(); double nullsFilterFactor = (1 - leftStats.getNullsFraction()) * (1 - rightStats.getNullsFraction()); double filterFactor = 1 / max(leftRange.getDistinctValuesCount(), rightRange.getDistinctValuesCount()); return inputStatistics.mapOutputRowCount(rowCount -> rowCount * filterFactor * nullsFilterFactor) .mapSymbolColumnStatistics(left, oldLeftStats -> newLeftStats) .mapSymbolColumnStatistics(right, oldRightStats -> newRightStats); }
Source:
default void writeStreamAsZip(Set<SourceFile> sourceFiles, OutputStream outputStream, Path workingDirectory) { try (ZipOutputStream zipOutputStream = new ZipOutputStream(outputStream)) { List<String> paths = new ArrayList<>(); for (SourceFile sourceFile : sourceFiles) { Path resolve = workingDirectory.resolve(sourceFile.getAbsolutePath()); String stripStart = StringUtils.stripStart(resolve.toFile().toString(), "./"); ZipEntry secondaryZipEntry = new ZipEntry(stripStart); Path filePath = Paths.get(stripStart).normalize(); if (filePath.getNameCount() > 1) { String parentPath = filePath.getParent().toString() + "/"; if (!paths.contains(parentPath)) { zipOutputStream.putNextEntry(new ZipEntry(parentPath)); zipOutputStream.closeEntry(); paths.add(parentPath); } } zipOutputStream.putNextEntry(secondaryZipEntry); zipOutputStream.write(sourceFile.getContent().getBytes(Charsets.UTF_8)); zipOutputStream.closeEntry(); } } catch (IOException ex) { throw new CustomWebApplicationException("Could not create ZIP file", HttpStatus.SC_INTERNAL_SERVER_ERROR); } }

Target:
default void writeStreamAsZip(Set<SourceFile> sourceFiles, OutputStream outputStream, Path workingDirectory) { try (ZipOutputStream zipOutputStream = new ZipOutputStream(outputStream)) { List<String> paths = new ArrayList<>(); for (SourceFile sourceFile : sourceFiles) { Path resolve = workingDirectory.resolve(sourceFile.getAbsolutePath()); String stripStart = StringUtils.stripStart(resolve.toFile().toString(), "./"); ZipEntry secondaryZipEntry = new ZipEntry(stripStart); Path filePath = Paths.get(stripStart).normalize(); if (filePath.getNameCount() > 1) { String parentPath = filePath.getParent().toString() + "/"; if (!paths.contains(parentPath)) { zipOutputStream.putNextEntry(new ZipEntry(parentPath)); zipOutputStream.closeEntry(); paths.add(parentPath); } } zipOutputStream.putNextEntry(secondaryZipEntry); zipOutputStream.write(sourceFile.getContent().getBytes(Charsets.UTF_8)); } } catch (IOException ex) { throw new CustomWebApplicationException("Could not create ZIP file", HttpStatus.SC_INTERNAL_SERVER_ERROR); } }
Source:
public void onPackageAdded(String packageName) { final PackageInfo app; try { app = mPackageManager.getPackageInfo(packageName, GET_PERMISSIONS | MATCH_ANY_USER); } catch (NameNotFoundException e) { Slog.wtf(TAG, "NameNotFoundException " + packageName); return; } int uid = app.applicationInfo != null ? app.applicationInfo.uid : INVALID_UID; if (uid == INVALID_UID) { return; } processPackagePermissions(uid, Arrays.asList(app.requestedPermissions)); synchronized (mPackageNameUidMap) { mPackageNameUidMap.put(packageName, uid); } }

Target:
public void onPackageAdded(String packageName) { final PackageInfo app = getPackageInfo(packageName); if (app == null) { Slog.wtf(TAG, "Failed to get information of installed package: " + packageName); return; } int uid = (app.applicationInfo != null) ? app.applicationInfo.uid : INVALID_UID; if (uid == INVALID_UID) { return; } sendPackagePermissionsForUid(uid, filterPermission(Arrays.asList(app.requestedPermissions))); synchronized (mPackageNameUidMap) { mPackageNameUidMap.put(packageName, uid); } }
Source:
private void notifyAsyncTransactionCallbacks() { if (!pendingOnSuccessAsyncTransactionCallbacks.isEmpty()) { for (Runnable callback : pendingOnSuccessAsyncTransactionCallbacks) { realm.handler.post(callback); } pendingOnSuccessAsyncTransactionCallbacks.clear(); } }

Target:
private void notifyAsyncTransactionCallbacks() { if (!pendingOnSuccessAsyncTransactionCallbacks.isEmpty()) { for (Runnable callback : pendingOnSuccessAsyncTransactionCallbacks) { callback.run(); } pendingOnSuccessAsyncTransactionCallbacks.clear(); } }
Source:
private void processIMC(final InterModProcessEvent event) { registryManager.onInitStep(IInitListener.Step.PROCESS_IMC, event); finishAPI2(); if (inDev) { Tests.runBackgroundTests(); } }

Target:
private void processIMC(final InterModProcessEvent event) { finishAPI2(); registryManager.onInitStep(IInitListener.Step.PROCESS_IMC, event); if (inDev) { Tests.runBackgroundTests(); } }
Source:
private void checkDynamicJobUsage(IElementParameter param) { if (!EParameterName.USE_DYNAMIC_JOB.getName().equals(param.getName())) { return; } boolean isSelectUseDynamic = false; Object paramValue = param.getValue(); if (paramValue != null && paramValue instanceof Boolean) { isSelectUseDynamic = (Boolean) paramValue; } if (isSelectUseDynamic) { ERepositoryObjectType itemType = ERepositoryObjectType.getItemType(process.getProperty().getItem()); if (ERepositoryObjectType.JOBLET.equals(itemType)) { String warningMessage = Messages.getString("Node.checkDynamicJobUsageWarning"); Problems.add(ProblemStatus.WARNING, this, warningMessage); } } }

Target:
private void checkDynamicJobUsage(IElementParameter param) { if (!EParameterName.USE_DYNAMIC_JOB.getName().equals(param.getName())) { return; } boolean isSelectUseDynamic = false; Object paramValue = param.getValue(); if (paramValue != null && paramValue instanceof Boolean) { isSelectUseDynamic = (Boolean) paramValue; } if (isSelectUseDynamic) { ERepositoryObjectType itemType = ERepositoryObjectType.getItemType(process.getProperty().getItem()); if (ERepositoryObjectType.getAllTypesOfJoblet().contains(itemType)) { String warningMessage = Messages.getString("Node.checkDynamicJobUsageWarning"); Problems.add(ProblemStatus.WARNING, this, warningMessage); } } }
Source:
public OffHeapServerStore(PageSource source, int concurrency) { segments = new ArrayList<OffHeapChainMap<Long>>(concurrency); for (int i = 0; i < concurrency; i++) { segments.add(new OffHeapChainMap<Long>(source, LongPortability.INSTANCE, KILOBYTES.toBytes(4), MEGABYTES.toBytes(8), false)); } }

Target:
OffHeapServerStore(PageSource source, int concurrency) { segments = new ArrayList<OffHeapChainMap<Long>>(concurrency); for (int i = 0; i < concurrency; i++) { segments.add(new OffHeapChainMap<Long>(source, LongPortability.INSTANCE, KILOBYTES.toBytes(4), MEGABYTES.toBytes(8), false)); } }
Source:
public static void main(String[] args) { try { final AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE); final TokenCredential credential = new DefaultAzureCredentialBuilder() .authorityHost(profile.getEnvironment().getResourceManagerEndpoint()) .build(); Azure azure = Azure .configure() .withLogLevel(HttpLogDetailLevel.BASIC) .authenticate(credential, profile) .withDefaultSubscription(); System.out.println("Selected subscription: " + azure.subscriptionId()); runSample(azure, Configuration.getGlobalConfiguration().get(Configuration.PROPERTY_AZURE_CLIENT_ID)); } catch (Exception e) { System.out.println(e.getMessage()); e.printStackTrace(); } }

Target:
public static void main(String[] args) { try { final AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE); final TokenCredential credential = new DefaultAzureCredentialBuilder() .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint()) .build(); Azure azure = Azure .configure() .withLogLevel(HttpLogDetailLevel.BASIC) .authenticate(credential, profile) .withDefaultSubscription(); System.out.println("Selected subscription: " + azure.subscriptionId()); runSample(azure, Configuration.getGlobalConfiguration().get(Configuration.PROPERTY_AZURE_CLIENT_ID)); } catch (Exception e) { System.out.println(e.getMessage()); e.printStackTrace(); } }
Source:
public Collection<RegisteredService> findServiceBy(final Predicate<RegisteredService> predicate) { if (predicate == null) { return new ArrayList<>(0); } var results= serviceRegistry.findServicePredicate(predicate). stream(). sorted(). peek(RegisteredService::initialize). collect(Collectors.toMap(r -> { return r.getId(); }, Function.identity(), (r, s) -> s)); services.putAll(results); return results.values(); }

Target:
public Collection<RegisteredService> findServiceBy(final Predicate<RegisteredService> predicate) { if (predicate == null) { return new ArrayList<>(0); } val results = serviceRegistry.findServicePredicate(predicate). stream(). sorted(). peek(RegisteredService::initialize). collect(Collectors.toMap(r -> { return r.getId(); }, Function.identity(), (r, s) -> s)); services.putAll(results); return results.values(); }
Source:
public GoodDataHttpClient(final HttpClient httpClient, final SSTRetrievalStrategy sstStrategy) { this(httpClient, sstStrategy, null, null, null, VerificationLevel.COOKIE, null); notNull(httpClient); notNull(sstStrategy); }

Target:
public GoodDataHttpClient(final HttpClient httpClient, final SSTRetrievalStrategy sstStrategy) { this(httpClient, sstStrategy, null, null, null, VerificationLevel.COOKIE, null); notNull(httpClient, "httpClient cannot be null"); notNull(sstStrategy, "sstStrategy cannot be null"); }
Source:
private void processEnforceSnapshotSync(DiscoveryServiceEvent event) { if (replicationManager == null || !isLeader.get()) { return; } replicationManager.enforceSnapshotSync(event); }

Target:
private void processEnforceSnapshotSync(DiscoveryServiceEvent event) { if (replicationManager == null || !isLeader.get()) { log.warn("The current node is not the leader will skip doing the snapshot full sync"); return; } replicationManager.enforceSnapshotSync(event); }
Source:
public Object decode(ByteBuf buffer) throws Exception { int rc; long ledgerId, entryId; int packetHeader = buffer.readInt(); byte version = PacketHeader.getVersion(packetHeader); byte opCode = PacketHeader.getOpCode(packetHeader); switch (opCode) { case BookieProtocol.ADDENTRY: rc = buffer.readInt(); ledgerId = buffer.readLong(); entryId = buffer.readLong(); return BookieProtocol.AddResponse.create(version, rc, ledgerId, entryId); case BookieProtocol.READENTRY: rc = buffer.readInt(); ledgerId = buffer.readLong(); entryId = buffer.readLong(); if (rc == BookieProtocol.EOK) { return new BookieProtocol.ReadResponse(version, rc, ledgerId, entryId, buffer.retain()); } else { return new BookieProtocol.ReadResponse(version, rc, ledgerId, entryId); } case BookieProtocol.AUTH: ByteBufInputStream bufStream = new ByteBufInputStream(buffer); BookkeeperProtocol.AuthMessage.Builder builder = BookkeeperProtocol.AuthMessage.newBuilder(); builder.mergeFrom(bufStream, extensionRegistry); BookkeeperProtocol.AuthMessage am = builder.build(); return new BookieProtocol.AuthResponse(version, am); default: throw new IllegalStateException("Received unknown response : op code = " + opCode); } }

Target:
public Object decode(ByteBuf buffer) throws Exception { int rc; long ledgerId, entryId; int packetHeader = buffer.readInt(); byte version = PacketHeader.getVersion(packetHeader); byte opCode = PacketHeader.getOpCode(packetHeader); switch (opCode) { case BookieProtocol.ADDENTRY: rc = buffer.readInt(); ledgerId = buffer.readLong(); entryId = buffer.readLong(); return BookieProtocol.AddResponse.create(version, rc, ledgerId, entryId); case BookieProtocol.READENTRY: rc = buffer.readInt(); ledgerId = buffer.readLong(); entryId = buffer.readLong(); if (rc == BookieProtocol.EOK) { return new BookieProtocol.ReadResponse(version, rc, ledgerId, entryId, buffer.retainedSlice()); } else { return new BookieProtocol.ReadResponse(version, rc, ledgerId, entryId); } case BookieProtocol.AUTH: ByteBufInputStream bufStream = new ByteBufInputStream(buffer); BookkeeperProtocol.AuthMessage.Builder builder = BookkeeperProtocol.AuthMessage.newBuilder(); builder.mergeFrom(bufStream, extensionRegistry); BookkeeperProtocol.AuthMessage am = builder.build(); return new BookieProtocol.AuthResponse(version, am); default: throw new IllegalStateException("Received unknown response : op code = " + opCode); } }
Source:
void testSimpleSwitch() { int a = 0; switch(a) { case 1: break; case 2: case 3: break; } }

Target:
int testSimpleSwitch() { int a = 0; switch(a) { case 1: break; case 2: case 3: break; } return a; }
Source:
private static void metaCheck(SubscriptionContext subscriptionContext) { ClassDef classDef = (ClassDef) subscriptionContext.syntaxNode(); boolean isMetaClass = "Meta".equals(classDef.name().name()); if (!isMetaClass) { return; } boolean isWithinFlaskForm = Optional.ofNullable(TreeUtils.firstAncestorOfKind(classDef, Tree.Kind.CLASSDEF)) .map(parentClassDef -> ((ClassDef) parentClassDef).name().symbol()) .flatMap(checkedCast(Symbol.Kind.CLASS, ClassSymbol.class)) .filter(parentClassSymbol -> parentClassSymbol.canBeOrExtend("flask_wtf.FlaskForm")) .isPresent(); if (!isWithinFlaskForm) { return; } classDef.body().statements().forEach(stmt -> { if (stmt.is(Tree.Kind.ASSIGNMENT_STMT)) { AssignmentStatement asgn = (AssignmentStatement) stmt; if (isLhsCalled("csrf").test(asgn) && Expressions.isFalsy(asgn.assignedValue())) { subscriptionContext.addIssue(asgn.assignedValue(), DISABLING_CSRF_MESSAGE); } } }); }

Target:
private static void metaCheck(SubscriptionContext subscriptionContext) { ClassDef classDef = (ClassDef) subscriptionContext.syntaxNode(); if (!"Meta".equals(classDef.name().name())) { return; } boolean isWithinFlaskForm = Optional.ofNullable(TreeUtils.firstAncestorOfKind(classDef, Tree.Kind.CLASSDEF)) .map(parentClassDef -> ((ClassDef) parentClassDef).name().symbol()) .filter(s -> s.is(Symbol.Kind.CLASS)) .map(ClassSymbol.class::cast) .filter(parentClassSymbol -> parentClassSymbol.canBeOrExtend("flask_wtf.FlaskForm")) .isPresent(); if (!isWithinFlaskForm) { return; } classDef.body().statements().forEach(stmt -> { if (stmt.is(Tree.Kind.ASSIGNMENT_STMT)) { AssignmentStatement asgn = (AssignmentStatement) stmt; if (isLhsCalled("csrf").test(asgn) && Expressions.isFalsy(asgn.assignedValue())) { subscriptionContext.addIssue(asgn.assignedValue(), DISABLING_CSRF_MESSAGE); } } }); }
Source:
public Response remove(String id, Action action) { getEntity(id); validateParameters(action, "detach"); if (action.isDetach()) { AttachDettachVmDiskParameters params = new AttachDettachVmDiskParameters(parentId, Guid.createGuidFromString(id), true); return performAction(VdcActionType.DetachDiskFromVm, params); } else { return remove(id); } }

Target:
public Response remove(String id, Action action) { getEntity(id); if (action.isSetDetach() && action.isDetach()) { return performAction(VdcActionType.DetachDiskFromVm, new AttachDettachVmDiskParameters(parentId, Guid.createGuidFromString(id), true)); } else { return remove(id); } }
Source:
private void vmBalloonDriverIsRequestedAndUnavailable(Guid vmId) { Integer currentVal = vmsWithBalloonDriverProblem.get(vmId); if (currentVal == null) { vmsWithBalloonDriverProblem.put(vmId, 1); } else { vmsWithBalloonDriverProblem.put(vmId, currentVal + 1); if (currentVal >= Config.<Integer> GetValue(ConfigValues.IterationsWithBalloonProblem)) { AuditLogableBase auditLogable = new AuditLogableBase(); auditLogable.setVmId(vmId); AuditLogDirector.log(auditLogable, AuditLogType.VM_BALLOON_DRIVER_ERROR); } } }

Target:
private void vmBalloonDriverIsRequestedAndUnavailable(Guid vmId) { Integer currentVal = vmsWithBalloonDriverProblem.get(vmId); if (currentVal == null) { vmsWithBalloonDriverProblem.put(vmId, 1); } else { vmsWithBalloonDriverProblem.put(vmId, currentVal + 1); if (currentVal >= Config.<Integer> GetValue(ConfigValues.IterationsWithBalloonProblem)) { AuditLogableBase auditLogable = new AuditLogableBase(); auditLogable.setVmId(vmId); AuditLogDirector.log(auditLogable, AuditLogType.VM_BALLOON_DRIVER_ERROR); vmsWithBalloonDriverProblem.put(vmId, 0); } } }
Source:
public void configure(IProject project, Set<IPath> excludedDirectories, IProgressMonitor monitor) { ResolverConfiguration configuration = new ResolverConfiguration(); IProjectConfigurationManager configurationManager = MavenPlugin.getProjectConfigurationManager(); try { if(!project.hasNature(IMavenConstants.NATURE_ID)) { configurationManager.enableMavenNature(project, configuration, monitor); } configurationManager.updateProjectConfiguration(project, monitor); } catch (Exception ex) { log.error(ex.getMessage(), ex); } }

Target:
public void configure(IProject project, Set<IPath> excludedDirectories, IProgressMonitor monitor) { IProjectConfigurationManager configurationManager = MavenPlugin.getProjectConfigurationManager(); try { if(!project.hasNature(IMavenConstants.NATURE_ID)) { ResolverConfiguration configuration = ResolverConfigurationIO.readResolverConfiguration(project); configurationManager.enableMavenNature(project, configuration, monitor); } configurationManager.updateProjectConfiguration(project, monitor); } catch (Exception ex) { log.error(ex.getMessage(), ex); } }
Source:
protected Stream<String> getExcludedPatterns() { return Stream.concat(Stream.of( "com\\.vaadin\\.flow\\.component\\.polymertemplate\\.DefaultTemplateParser", "com\\.vaadin\\.flow\\.component\\.polymertemplate\\.NpmTemplateParser", "com\\.vaadin\\.flow\\.component\\.polymertemplate\\.BundleParser", "com\\.vaadin\\.flow\\.component\\.polymertemplate\\.BundleParser\\$DependencyVisitor", "com\\.vaadin\\.flow\\.component\\.polymertemplate\\.TemplateDataAnalyzer\\$.*", "com\\.vaadin\\.flow\\.component\\.polymertemplate\\.TemplateInitializer(\\$.*)?", "com\\.vaadin\\.flow\\.component\\.polymertemplate\\.TemplateParser(\\$.*)?", "com\\.vaadin\\.flow\\.component\\.polymertemplate\\.InjectablePolymerElementInitializer", "com\\.vaadin\\.flow\\.component\\.polymertemplate\\.TemplateDataAnalyzer", "com\\.vaadin\\.flow\\.component\\.polymertemplate\\.IdCollector", "com\\.vaadin\\.flow\\.component\\.polymertemplate\\.rpc\\.OSGiPolymerPublishedEventHandlerRegistration"), super.getExcludedPatterns()); }

Target:
protected Stream<String> getExcludedPatterns() { return Stream.concat(Stream.of( "com\\.vaadin\\.flow\\.component\\.polymertemplate\\.DefaultTemplateParser", "com\\.vaadin\\.flow\\.component\\.polymertemplate\\.NpmTemplateParser", "com\\.vaadin\\.flow\\.component\\.polymertemplate\\.BundleParser", "com\\.vaadin\\.flow\\.component\\.polymertemplate\\.BundleParser\\$DependencyVisitor", "com\\.vaadin\\.flow\\.component\\.polymertemplate\\.TemplateDataAnalyzer\\$.*", "com\\.vaadin\\.flow\\.component\\.polymertemplate\\.TemplateInitializer(\\$.*)?", "com\\.vaadin\\.flow\\.component\\.polymertemplate\\.TemplateParser(\\$.*)?", "com\\.vaadin\\.flow\\.component\\.polymertemplate\\.InjectablePolymerElementInitializer", "com\\.vaadin\\.flow\\.component\\.polymertemplate\\.TemplateDataAnalyzer", "com\\.vaadin\\.flow\\.component\\.polymertemplate\\.IdCollector"), super.getExcludedPatterns()); }
Source:
private static String checkNullToEmpty(byte[] data) { if (data == null || data.length == 0) { return ""; } return new String(data); }

Target:
private static String checkNullToEmpty(byte[] data) throws IOException { if (data == null || data.length == 0) { return ""; } return new String(data, "UTF8"); }
Source:
Collection<TransportEndpoint> getTrustedOrSuspectedEndpoints() { Map<String, ClusterMember> suspectedOrTrusted = filterValues(membership, new Predicate<ClusterMember>() { @Override public boolean apply(ClusterMember input) { return input.status() == TRUSTED || input.status() == SUSPECTED; } }); return transformEntries(suspectedOrTrusted, new Maps.EntryTransformer<String, ClusterMember, TransportEndpoint>() { @Override public TransportEndpoint transformEntry(String key, ClusterMember value) { return value.endpoint(); } }).values(); }

Target:
public Collection<TransportEndpoint> getTrustedOrSuspectedEndpoints() { Map<String, ClusterMember> suspectedOrTrusted = Maps.filterValues(membership, TRUSTED_OR_SUSPECTED_PREDICATE); return Maps.transformEntries(suspectedOrTrusted, MEMBER_TO_ENDPOINT_TRANSFORMER).values(); }
Source:
private void initVmTemplate() { VmTemplate vmFromConfiguration; ovfEntityData = getUnregisteredOVFDataDao().getByEntityIdAndStorageDomain(getParameters().getContainerId(), getParameters().getStorageDomainId()); OvfHelper ovfHelper = new OvfHelper(); if (ovfEntityData != null) { try { vmFromConfiguration = ovfHelper.readVmTemplateFromOvf(ovfEntityData.getOvfData()); vmFromConfiguration.setVdsGroupId(getParameters().getVdsGroupId()); setVmTemplate(vmFromConfiguration); getParameters().setVmTemplate(vmFromConfiguration); getParameters().setDestDomainId(ovfEntityData.getStorageDomainId()); getParameters().setSourceDomainId(ovfEntityData.getStorageDomainId()); } catch (OvfReaderException e) { log.errorFormat("failed to parse a given ovf configuration: \n" + ovfEntityData.getOvfData(), e); } } setVdsGroupId(getParameters().getVdsGroupId()); setStoragePoolId(getVdsGroup().getStoragePoolId()); }

Target:
private void initVmTemplate() { VmTemplate vmFromConfiguration = null; OvfHelper ovfHelper = new OvfHelper(); ovfEntityData = getUnregisteredOVFDataDao().getByEntityIdAndStorageDomain(getParameters().getContainerId(), getParameters().getStorageDomainId()); if (ovfEntityData != null) { try { vmFromConfiguration = ovfHelper.readVmTemplateFromOvf(ovfEntityData.getOvfData()); } catch (OvfReaderException e) { log.errorFormat("failed to parse a given ovf configuration: \n" + ovfEntityData.getOvfData(), e); } vmFromConfiguration.setVdsGroupId(getParameters().getVdsGroupId()); setVmTemplate(vmFromConfiguration); getParameters().setVmTemplate(vmFromConfiguration); getParameters().setDestDomainId(ovfEntityData.getStorageDomainId()); getParameters().setSourceDomainId(ovfEntityData.getStorageDomainId()); } setVdsGroupId(getParameters().getVdsGroupId()); setStoragePoolId(getVdsGroup().getStoragePoolId()); }
Source:
public void testConvertFunctionAndBigDecimal() throws Exception { final String resourcePath = "dtables/src/main/resources/guvnor/feature/dtables/FunctionAndBigDecimalTable.xls"; final ConversionResult conversionResult = convertResource(resourcePath); final List<ConversionMessage> messages = conversionResult.getMessages(); Assertions.assertThat(messages).hasSize(1); final String message = messages.get(0).getMessage(); SoftAssertions.assertSoftly(softly -> { softly.assertThat(message).startsWith("Created Guided Decision Table 'FunctionAndBigDecimalTable (converted on"); softly.assertThat(message).endsWith(").gdst'"); softly.assertAll(); }); }

Target:
public void testConvertFunctionAndBigDecimal() throws Exception { final String resourcePath = "dtables/src/main/resources/guvnor/feature/dtables/FunctionAndBigDecimalTable.xls"; final ConversionResult conversionResult = convertResource(resourcePath); final List<ConversionMessage> messages = conversionResult.getMessages(); Assertions.assertThat(messages).hasSize(1); final String message = messages.get(0).getMessage(); SoftAssertions.assertSoftly(softly -> { softly.assertThat(message).startsWith("Created Guided Decision Table 'FunctionAndBigDecimalTable (converted on"); softly.assertThat(message).endsWith(").gdst'"); }); }
Source:
static XContentBuilder buildMapping(Class clazz, String indexType, String idFieldName, String parentType) throws IOException { XContentBuilder mapping = jsonBuilder().startObject().startObject(indexType); if (clazz.isAnnotationPresent(DynamicTemplates.class)){ String mappingPath = ((DynamicTemplates) clazz.getAnnotation(DynamicTemplates.class)).mappingPath(); if (isNotBlank(mappingPath)) { String jsonString = ElasticsearchTemplate.readFileFromClasspath(mappingPath); if (isNotBlank(jsonString)) { addDynamicTemplatesMapping(mapping, jsonString); } } } if (hasText(parentType)) { mapping.startObject(FIELD_PARENT).field(FIELD_TYPE, parentType).endObject(); } XContentBuilder xContentBuilder = mapping.startObject(FIELD_PROPERTIES); mapEntity(xContentBuilder, clazz, true, idFieldName, "", false, FieldType.Auto, null); return xContentBuilder.endObject().endObject().endObject(); }

Target:
static XContentBuilder buildMapping(Class clazz, String indexType, String idFieldName, String parentType) throws IOException { XContentBuilder mapping = jsonBuilder().startObject().startObject(indexType); addDynamicTemplatesMapping(mapping, clazz); if (hasText(parentType)) { mapping.startObject(FIELD_PARENT).field(FIELD_TYPE, parentType).endObject(); } XContentBuilder xContentBuilder = mapping.startObject(FIELD_PROPERTIES); mapEntity(xContentBuilder, clazz, true, idFieldName, "", false, FieldType.Auto, null); return xContentBuilder.endObject().endObject().endObject(); }
Source:
public List<Attribute> getAttributes(PerunSession sess, Member member, Group group, List<String> attrNames) throws InternalErrorException { MapSqlParameterSource parameters = new MapSqlParameterSource(); parameters.addValue("mId", member.getId()); parameters.addValue("gId", group.getId()); parameters.addValue("nSO", AttributesManager.NS_MEMBER_GROUP_ATTR_OPT); parameters.addValue("nSD", AttributesManager.NS_MEMBER_GROUP_ATTR_DEF); parameters.addValue("nSV", AttributesManager.NS_MEMBER_GROUP_ATTR_VIRT); parameters.addValue("attrNames", attrNames); try { return namedParameterJdbcTemplate.query("select " + getAttributeMappingSelectQuery("mem") + " from attr_names " + "left join member_group_attr_values mem on id=mem.attr_id and member_id=:mId and group_id=:gId " + "where namespace in ( :nSO,:nSD,:nSV ) and attr_names.attr_name in ( :attrNames )", parameters, new AttributeRowMapper(sess, this, member, group)); } catch(EmptyResultDataAccessException ex) { return new ArrayList<Attribute>(); } catch(RuntimeException ex) { throw new InternalErrorException(ex); } }

Target:
public List<Attribute> getAttributes(PerunSession sess, Member member, Group group, List<String> attrNames) throws InternalErrorException { MapSqlParameterSource parameters = new MapSqlParameterSource(); parameters.addValue("mId", member.getId()); parameters.addValue("gId", group.getId()); parameters.addValue("nSO", AttributesManager.NS_MEMBER_GROUP_ATTR_OPT); parameters.addValue("nSD", AttributesManager.NS_MEMBER_GROUP_ATTR_DEF); parameters.addValue("nSV", AttributesManager.NS_MEMBER_GROUP_ATTR_VIRT); parameters.addValue("attrNames", attrNames); try { return namedParameterJdbcTemplate.query("select " + getAttributeMappingSelectQuery("mem_gr") + " from attr_names " + "left join member_group_attr_values mem_gr on id=mem_gr.attr_id and member_id=:mId and group_id=:gId " + "where namespace in ( :nSO,:nSD,:nSV ) and attr_names.attr_name in ( :attrNames )", parameters, new AttributeRowMapper(sess, this, member, group)); } catch(EmptyResultDataAccessException ex) { return new ArrayList<Attribute>(); } catch(RuntimeException ex) { throw new InternalErrorException(ex); } }
Source:
private boolean indexIsLatestVersion() { return ! Boolean.parseBoolean(Framework.getProperty(AbstractSession.DISABLED_ISLATESTVERSION_PROPERTY, "false")); }

Target:
private boolean indexIsLatestVersion() { return !Framework.isBooleanPropertyTrue(AbstractSession.DISABLED_ISLATESTVERSION_PROPERTY); }
Source:
public RangeColumnStatistics( Optional<Object> lowValue, Optional<Object> highValue, Estimate fraction, Estimate dataSize, Estimate distinctValuesCount) { this.lowValue = requireNonNull(lowValue, "lowValue can not be null"); this.highValue = requireNonNull(highValue, "highValue can not be null"); requireNonNull(fraction, "fraction can not be null"); requireNonNull(dataSize, "dataSize can not be null"); requireNonNull(distinctValuesCount, "distinctValuesCount can not be null"); this.statistics = createStatisticsMap(dataSize, fraction, distinctValuesCount); }

Target:
private RangeColumnStatistics( Optional<Object> lowValue, Optional<Object> highValue, Estimate fraction, Estimate dataSize, Estimate distinctValuesCount) { this.lowValue = requireNonNull(lowValue, "lowValue can not be null"); this.highValue = requireNonNull(highValue, "highValue can not be null"); this.fraction = requireNonNull(fraction, "fraction can not be null"); this.dataSize = requireNonNull(dataSize, "dataSize can not be null"); this.distinctValuesCount = requireNonNull(distinctValuesCount, "distinctValuesCount can not be null"); }
Source:
public void connectionLost(Throwable cause) { TRACE.log(TraceLevel.WARN, "Connection Lost: " + brokerUri); nConnectionLost.incrementValue(1L); isConnected.setValue(0); for (Iterator iterator = callBackListeners.iterator(); iterator.hasNext();) { MqttCallback callbackListener = (MqttCallback) iterator.next(); callbackListener.connectionLost(cause); } }

Target:
public void connectionLost(Throwable cause) { TRACE.log(TraceLevel.WARN, "Connection Lost: " + brokerUri); nConnectionLost.increment();; isConnected.setValue(0); for (Iterator iterator = callBackListeners.iterator(); iterator.hasNext();) { MqttCallback callbackListener = (MqttCallback) iterator.next(); callbackListener.connectionLost(cause); } }
Source:
public void testACNVSexChrs() { final File tDir = IOUtils.tempDir("Test", "Plotting"); ACNVPlotter.writeSegmentedAlleleFractionPlot(SAMPLE_NAME, TUMOR_ALLELIC_COUNTS_FILE, TANGENT_NORMALIZED_COVERAGE_FILE, SEGMENTS_FILE, tDir.getAbsolutePath()+"/", true); Assert.assertTrue(new File(tDir, SAMPLE_NAME + "_ACNV.png").exists()); Assert.assertTrue(new File(tDir, SAMPLE_NAME + "_ACNV.png").length() > 0); }

Target:
public void testACNVSexChrs() { final File tDir = IOUtils.tempDir("Test", "Plotting"); ACNVPlotter.writeSegmentedAlleleFractionPlot(SAMPLE_NAME, TUMOR_ALLELIC_COUNTS_FILE, TANGENT_NORMALIZED_COVERAGE_FILE, SEGMENTS_FILE, tDir.getAbsolutePath() + "/", OUTPUT_PREFIX, true); Assert.assertTrue(new File(tDir, OUTPUT_PREFIX + "_ACNV.png").exists()); Assert.assertTrue(new File(tDir, OUTPUT_PREFIX + "_ACNV.png").length() > 0); }
Source:
public void createSpaceRequest(final SpaceRequest jobRequest) { final Map<String, Object> params = getContext(jobRequest); params.put("Operation", "createOrgUnit"); scheduleJob(jobRequest, new CreateOrgUnitCmd(jobRequestHelper, jobResultManager, params)); }

Target:
public void createSpaceRequest(final SpaceRequest jobRequest) { final Map<String, Object> params = getContext(jobRequest); params.put("Operation", "createOrgUnit"); scheduleJob(jobRequest, new CreateSpaceCmd(jobRequestHelper, jobResultManager, params)); }
Source:
List<ProbeInstance> getSortedProbeInstances() { long modCountLocal = modCount.get(); final SortedProbeInstances sortedInstancesOld = this.sortedProbeInstances.get(); final SortedProbeInstances sortedInstances; if (sortedInstancesOld.mod < modCountLocal) { List<ProbeInstance> sorted = new ArrayList<>(probeInstances.values()); Collections.sort(sorted, COMPARATOR); sortedInstances = new SortedProbeInstances(modCountLocal, sorted); this.sortedProbeInstances.compareAndSet(sortedInstancesOld, sortedInstancesOld); } else { sortedInstances = sortedInstancesOld; } return sortedInstances.probeInstances; }

Target:
List<ProbeInstance> getSortedProbeInstances() { long modCountLocal = modCount.get(); final SortedProbeInstances sortedInstancesOld = this.sortedProbeInstances.get(); final SortedProbeInstances sortedInstances; if (sortedInstancesOld.mod < modCountLocal) { List<ProbeInstance> sorted = new ArrayList<>(probeInstances.values()); Collections.sort(sorted, COMPARATOR); sortedInstances = new SortedProbeInstances(modCountLocal, sorted); this.sortedProbeInstances.compareAndSet(sortedInstancesOld, sortedInstances); } else { sortedInstances = sortedInstancesOld; } return sortedInstances.probeInstances; }
Source:
protected void handleResourceChanged(IResourceChangeEvent event) { ActionContext context = getContext(); if (context == null) { return; } final IStructuredSelection selection = (IStructuredSelection) context .getSelection(); if (ResourceSelectionUtil.allResourcesAreOfType(selection, IResource.PROJECT) == false) { return; } List sel = selection.toList(); IResourceDelta delta = event.getDelta(); if (delta == null) { return; } for (IResourceDelta projDelta : delta.getAffectedChildren(IResourceDelta.CHANGED)) { if ((projDelta.getFlags() & (IResourceDelta.OPEN | IResourceDelta.DESCRIPTION)) != 0) { if (sel.contains(projDelta.getResource())) { getNavigator().getSite().getShell().getDisplay().syncExec( () -> { addTaskAction.selectionChanged(selection); gotoGroup.updateActionBars(); refactorGroup.updateActionBars(); workspaceGroup.updateActionBars(); }); } } } }

Target:
protected void handleResourceChanged(IResourceChangeEvent event) { ActionContext context = getContext(); if (context == null) { return; } final IStructuredSelection selection = (IStructuredSelection) context .getSelection(); if (ResourceSelectionUtil.allResourcesAreOfType(selection, IResource.PROJECT) == false) { return; } List sel = selection.toList(); IResourceDelta delta = event.getDelta(); if (delta == null) { return; } for (IResourceDelta projectDelta : delta.getAffectedChildren(IResourceDelta.CHANGED)) { if ((projectDelta.getFlags() & (IResourceDelta.OPEN | IResourceDelta.DESCRIPTION)) != 0) { if (sel.contains(projectDelta.getResource())) { getNavigator().getSite().getShell().getDisplay().syncExec( () -> { addTaskAction.selectionChanged(selection); gotoGroup.updateActionBars(); refactorGroup.updateActionBars(); workspaceGroup.updateActionBars(); }); } } } }
Source:
public boolean hasStemTable() { for (Table table : this.getSourceDatabase().getTables()) { if (table.isStem()) { return true; } } return false; }

Target:
public boolean hasStemTable() { return getSourceDatabase().getTables().stream().anyMatch(Table::isStem); }
Source:
protected void configure() { bind(ApplicationInfoManager.class).asEagerSingleton(); bind(EurekaInstanceConfig.class).toProvider(KillbillEurekaInstanceConfigProvider.class).in(Scopes.SINGLETON); bind(EurekaClientConfig.class).toProvider(DefaultEurekaClientConfigProvider.class).in(Scopes.SINGLETON); bind(InstanceInfo.class).toProvider(KillbillEurekaInstanceInfoProvider.class).in(Scopes.SINGLETON); bind(EurekaClient.class).to(DiscoveryClient.class).in(Scopes.SINGLETON); bind(AbstractDiscoveryClientOptionalArgs.class).to(EurekaClientOptionalArgs.class).in(Scopes.SINGLETON); Multibinder<ServiceRegistry> serviceRegistryBinder = Multibinder.newSetBinder(binder(), ServiceRegistry.class); serviceRegistryBinder.addBinding().to(EurekaServiceRegistry.class); }

Target:
protected void configure() { bind(ApplicationInfoManager.class).asEagerSingleton(); bind(EurekaInstanceConfig.class).toProvider(KillbillEurekaInstanceConfigProvider.class).asEagerSingleton(); bind(EurekaClientConfig.class).toProvider(DefaultEurekaClientConfigProvider.class).asEagerSingleton(); bind(InstanceInfo.class).toProvider(KillbillEurekaInstanceInfoProvider.class).asEagerSingleton(); bind(EurekaClient.class).to(DiscoveryClient.class).asEagerSingleton(); bind(AbstractDiscoveryClientOptionalArgs.class).to(EurekaClientOptionalArgs.class).asEagerSingleton(); Multibinder<ServiceRegistry> serviceRegistryBinder = Multibinder.newSetBinder(binder(), ServiceRegistry.class); serviceRegistryBinder.addBinding().to(EurekaServiceRegistry.class); }
Source:
protected IProgressMonitor getSubProgressMonitor(int workAmount) { return SubMonitor.convert(null, workAmount); }

Target:
protected IProgressMonitor getSubProgressMonitor(int workAmount) { return SubMonitor.convert(fMonitor, workAmount); }
Source:
private boolean isNestedCopyfile( CopyFile copyfile, List<RepoProject> sortedProjects) { if (copyfile.dest.indexOf('/') == -1) return false; for (RepoProject proj : sortedProjects) { if (proj.getPath().compareTo(copyfile.dest) > 0) return false; if (proj.isAncestorOf(copyfile.dest)) return true; } return false; }

Target:
private static boolean isNestedCopyfile( CopyFile copyfile, List<RepoProject> sortedProjects) { if (copyfile.dest.indexOf('/') == -1) return false; for (RepoProject proj : sortedProjects) { if (proj.getPath().compareTo(copyfile.dest) > 0) return false; if (proj.isAncestorOf(copyfile.dest)) return true; } return false; }