auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public String getCredentials(String serviceName, String accountName) { String credential; if (Platform.isWindows()) { WindowsCredentialAccessor winCredAccessor = new WindowsCredentialAccessor(serviceName, accountName); credential = winCredAccessor.read(); } else if (Platform.isMac()) { KeyChainAccessor keyChainAccessor = new KeyChainAccessor(null, serviceName, accountName); byte[] readCreds = keyChainAccessor.read(); credential = new String(readCreds, StandardCharsets.UTF_8); } else if (Platform.isLinux()) { LinuxKeyRingAccessor keyRingAccessor = new LinuxKeyRingAccessor( "org.freedesktop.Secret.Generic", "service", serviceName, "account", accountName); byte[] readCreds = keyRingAccessor.read(); credential = new String(readCreds, StandardCharsets.UTF_8); } else { throw logger.logExceptionAsError( new CredentialUnavailableException("Platform could not be determined for VsCode" + " Credential authentication.")); } if (!isRefreshTokenString(credential)) { throw logger.logExceptionAsError( new CredentialUnavailableException("Please authenticate via Azure Tools plugin in VSCode IDE.")); } return credential; }

Target:
public String getCredentials(String serviceName, String accountName) { String credential; if (Platform.isWindows()) { try { WindowsCredentialAccessor winCredAccessor = new WindowsCredentialAccessor(serviceName, accountName); credential = winCredAccessor.read(); } catch (RuntimeException e) { throw logger.logExceptionAsError(new CredentialUnavailableException( "Failed to read Vs Code credentials from Windows Credential API.", e)); } } else if (Platform.isMac()) { try { KeyChainAccessor keyChainAccessor = new KeyChainAccessor(null, serviceName, accountName); byte[] readCreds = keyChainAccessor.read(); credential = new String(readCreds, StandardCharsets.UTF_8); } catch (RuntimeException e) { throw logger.logExceptionAsError(new CredentialUnavailableException( "Failed to read Vs Code credentials from Mac Native Key Chain.", e)); } } else if (Platform.isLinux()) { try { LinuxKeyRingAccessor keyRingAccessor = new LinuxKeyRingAccessor( "org.freedesktop.Secret.Generic", "service", serviceName, "account", accountName); byte[] readCreds = keyRingAccessor.read(); credential = new String(readCreds, StandardCharsets.UTF_8); } catch (RuntimeException e) { throw logger.logExceptionAsError(new CredentialUnavailableException( "Failed to read Vs Code credentials from Linux Key Ring.", e)); } } else { throw logger.logExceptionAsError( new CredentialUnavailableException(PLATFORM_NOT_SUPPORTED_ERROR)); } if (CoreUtils.isNullOrEmpty(credential) || !isRefreshTokenString(credential)) { throw logger.logExceptionAsError( new CredentialUnavailableException("Please authenticate via Azure Tools plugin in VS Code IDE.")); } return credential; }
Source:
void convertToReftable(boolean writeLogs, boolean backup) throws IOException { File newRefs = new File(getDirectory(), "refs.new"); File reftableDir = new File(getDirectory(), Constants.REFTABLE); if (reftableDir.exists() && reftableDir.listFiles().length > 0) { throw new IOException("reftable dir exists and is nonempty"); } FileReftableDatabase.convertFrom(this, newRefs, writeLogs); File refsFile = new File(getDirectory(), "refs"); File packedRefs = new File(getDirectory(), Constants.PACKED_REFS); File logsDir = new File(getDirectory(), Constants.LOGS); if (backup) { FileUtils.rename(refsFile, new File(getDirectory(), "refs.old")); if (packedRefs.exists()) { FileUtils.rename(packedRefs, new File(getDirectory(), Constants.PACKED_REFS + ".old")); } if (logsDir.exists()) { FileUtils.rename(logsDir, new File(getDirectory(), Constants.LOGS + ".old")); } } else { packedRefs.delete(); FileUtils.delete(logsDir, FileUtils.RECURSIVE); FileUtils.delete(refsFile, FileUtils.RECURSIVE); } FileUtils.rename(newRefs, refsFile); refs.close(); refs = new FileReftableDatabase(this, refsFile); }

Target:
void convertToReftable(boolean writeLogs, boolean backup) throws IOException { File newRefs = new File(getDirectory(), "refs.new"); File reftableDir = new File(getDirectory(), Constants.REFTABLE); if (reftableDir.exists() && reftableDir.listFiles().length > 0) { throw new IOException(JGitText.get().refTableDirExistsNonEmpty); } FileReftableDatabase.convertFrom(this, newRefs, writeLogs); File refsFile = new File(getDirectory(), "refs"); File packedRefs = new File(getDirectory(), Constants.PACKED_REFS); File logsDir = new File(getDirectory(), Constants.LOGS); if (backup) { FileUtils.rename(refsFile, new File(getDirectory(), "refs.old")); if (packedRefs.exists()) { FileUtils.rename(packedRefs, new File(getDirectory(), Constants.PACKED_REFS + ".old")); } if (logsDir.exists()) { FileUtils.rename(logsDir, new File(getDirectory(), Constants.LOGS + ".old")); } } else { packedRefs.delete(); FileUtils.delete(logsDir, FileUtils.RECURSIVE); FileUtils.delete(refsFile, FileUtils.RECURSIVE); } FileUtils.rename(newRefs, refsFile); refs.close(); refs = new FileReftableDatabase(this, refsFile); }
Source:
public void setUpLanguageScrollTabData(@NonNull List<String> languageCodes, int position, @Nullable Callback callback) { if (this.callback != null) { this.callback = null; } this.callback = callback; this.languageCodes = languageCodes; if (horizontalLanguageScroll.getChildCount() > 0) { horizontalLanguageScroll.removeAllTabs(); } for (int i = 0; i < languageCodes.size(); i++) { TabLayout.Tab tab = horizontalLanguageScroll.newTab(); tab.setCustomView(createLanguageTab(languageCodes.get(i))); horizontalLanguageScroll.addTab(tab); updateTabView(false, tab); } if (horizontalLanguageScroll != null && horizontalLanguageScroll.getTabAt(position) != null) { horizontalLanguageScroll.postDelayed(() -> horizontalLanguageScroll.getTabAt(position).select(), 100); } }

Target:
public void setUpLanguageScrollTabData(@NonNull List<String> languageCodes, int position, @Nullable Callback callback) { if (this.callback != null) { this.callback = null; } this.callback = callback; this.languageCodes = languageCodes; if (horizontalLanguageScroll.getChildCount() > 0) { horizontalLanguageScroll.removeAllTabs(); } for (int i = 0; i < languageCodes.size(); i++) { TabLayout.Tab tab = horizontalLanguageScroll.newTab(); tab.setCustomView(createLanguageTab(languageCodes.get(i))); horizontalLanguageScroll.addTab(tab); updateTabView(false, tab); } if (horizontalLanguageScroll != null && horizontalLanguageScroll.getTabAt(position) != null) { horizontalLanguageScroll.post(() -> { if (!isAttachedToWindow()) { return; } horizontalLanguageScroll.getTabAt(position).select(); }); } }
Source:
public PullRequestSCMHead migrate(@NonNull GitHubSCMSource source, @NonNull FixMetadata head) { PullRequestSource src = source.retrievePullRequestSource(head.getNumber()); GitHubSCMSourceHelper helper = GitHubSCMSourceHelper.build(source); return new PullRequestSCMHead(head.getName(), src == null ? null : src.getSourceOwner(), src == null ? null : src.getSourceRepo(), src == null ? null : src.getSourceBranch(), head.getNumber(), head.getTarget(), src != null && helper.owner.equalsIgnoreCase(src.getSourceOwner()) ? SCMHeadOrigin.DEFAULT : new SCMHeadOrigin.Fork(head.getSourceOwner()), head.getCheckoutStrategy()); }

Target:
public PullRequestSCMHead migrate(@NonNull GitHubSCMSource source, @NonNull FixMetadata head) { PullRequestSource src = source.retrievePullRequestSource(head.getNumber()); return new PullRequestSCMHead(head.getName(), src == null ? null : src.getSourceOwner(), src == null ? null : src.getSourceRepo(), src == null ? null : src.getSourceBranch(), head.getNumber(), head.getTarget(), src != null && source.getRepoOwner().equalsIgnoreCase(src.getSourceOwner()) ? SCMHeadOrigin.DEFAULT : new SCMHeadOrigin.Fork(head.getSourceOwner()), head.getCheckoutStrategy()); }
Source:
public Future<VdcReturnValueBase> executeAsyncCommand(final VdcActionType actionType, final VdcActionParametersBase parameters, final CommandContext cmdContext) { final CommandBase<?> command = CommandsFactory.createCommand(actionType, parameters, cmdContext); CommandCallBack callBack = command.getCallBack(); command.persistCommand(command.getParameters().getParentCommand(), cmdContext, callBack != null); if (callBack != null) { cmdCallBackMap.put(command.getCommandId(), callBack); } if (callBack != null) { cmdCallBackMap.put(command.getCommandId(), callBack); } Future<VdcReturnValueBase> retVal; try { retVal = executor.submit(new Callable<VdcReturnValueBase>() { @Override public VdcReturnValueBase call() throws Exception { return executeCommand(command, cmdContext); } }); } catch(RejectedExecutionException ex) { command.setCommandStatus(CommandStatus.FAILED); log.errorFormat("Failed to submit command to executor service, command {0} status has been set to FAILED", command.getCommandId().toString()); retVal = new RejectedExecutionFuture(); } return retVal; }

Target:
public Future<VdcReturnValueBase> executeAsyncCommand(final VdcActionType actionType, final VdcActionParametersBase parameters, final CommandContext cmdContext) { final CommandBase<?> command = CommandsFactory.createCommand(actionType, parameters, cmdContext); CommandCallBack callBack = command.getCallBack(); command.persistCommand(command.getParameters().getParentCommand(), cmdContext, callBack != null); if (callBack != null) { cmdCallBackMap.put(command.getCommandId(), callBack); } Future<VdcReturnValueBase> retVal; try { retVal = executor.submit(new Callable<VdcReturnValueBase>() { @Override public VdcReturnValueBase call() throws Exception { return executeCommand(command, cmdContext); } }); } catch(RejectedExecutionException ex) { command.setCommandStatus(CommandStatus.FAILED); log.errorFormat("Failed to submit command to executor service, command {0} status has been set to FAILED", command.getCommandId().toString()); retVal = new RejectedExecutionFuture(); } return retVal; }
Source:
public void onResume() { super.onResume(); setShowProgressBar(false); adapter.items.get(0).subtitle = Utils.getCurrentProjectName(getActivity()); adapter.notifyDataSetChanged(); String projectName = getActivity().getIntent().getStringExtra(StatusBarNotificationManager.EXTRA_PROJECT_NAME); if (projectName != null) { loadDownloadedProject(projectName); getActivity().getIntent().removeExtra(StatusBarNotificationManager.EXTRA_PROJECT_NAME); } }

Target:
public void onResume() { super.onResume(); setShowProgressBar(false); adapter.items.get(0).subtitle = Utils.getCurrentProjectName(getActivity()); adapter.notifyDataSetChanged(); String projectName = getActivity().getIntent().getStringExtra(StatusBarNotificationManager.EXTRA_PROJECT_NAME); if (projectName != null) { loadDownloadedProject(projectName); } }
Source:
private Integer getQosBandwidth(Guid clusterId) { final HostNetworkQos migrationHostNetworkQos = dbFacade.getHostNetworkQosDao() .getHostNetworkQosOfMigrationNetworkByClusterId(clusterId); if (migrationHostNetworkQos == null) { return null; } if (migrationHostNetworkQos.getOutAverageRealtime() != null) { return migrationHostNetworkQos.getOutAverageRealtime(); } return migrationHostNetworkQos.getOutAverageUpperlimit(); }

Target:
private Integer getQosBandwidth(Guid clusterId) { final HostNetworkQos migrationHostNetworkQos = hostNetworkQosDao .getHostNetworkQosOfMigrationNetworkByClusterId(clusterId); if (migrationHostNetworkQos == null) { return null; } if (migrationHostNetworkQos.getOutAverageRealtime() != null) { return migrationHostNetworkQos.getOutAverageRealtime(); } return migrationHostNetworkQos.getOutAverageUpperlimit(); }
Source:
public FindSliceProvider( MapperContext context, EntityHelper<SensorReading> sensorReadingHelper) { this.session = context.getSession(); this.sensorReadingHelper = sensorReadingHelper; this.selectStart = sensorReadingHelper.selectStart().whereColumn("sensor_id").isEqualTo(bindMarker()); }

Target:
public FindSliceProvider( MapperContext context, EntityHelper<SensorReading> sensorReadingHelper) { this.session = context.getSession(); this.sensorReadingHelper = sensorReadingHelper; this.selectStart = sensorReadingHelper.selectStart().whereColumn("id").isEqualTo(bindMarker()); }
Source:
private void reportAnalytics(ObaSituation situation) { ObaSituation.AllAffects[] allAffects = situation.getAllAffects(); List<String> agencyIds = new ArrayList<>(); for (int i=0; i< allAffects.length; i++) { ObaSituation.AllAffects affect = allAffects[i]; if (!agencyIds.contains(affect.getAgencyId())){ agencyIds.add(affect.getAgencyId()); } } for (String agencyId: agencyIds) { ObaAnalytics.reportEventWithCategory(ObaAnalytics.ObaEventCategory.UI_ACTION.toString(), getString(R.string.analytics_action_service_alerts), getString(R.string.analytics_label_service_alerts) + agencyId); } }

Target:
private void reportAnalytics(ObaSituation situation) { ObaSituation.AllAffects[] allAffects = situation.getAllAffects(); Set<String> agencyIds = new HashSet<>(); for (int i = 0; i < allAffects.length; i++) { agencyIds.add(allAffects[i].getAgencyId()); } for (String agencyId : agencyIds) { ObaAnalytics.reportEventWithCategory(ObaAnalytics.ObaEventCategory.UI_ACTION.toString(), getString(R.string.analytics_action_service_alerts), getString(R.string.analytics_label_service_alerts) + agencyId); } }
Source:
protected ErlangVisitor buildErlangVisitor(@NotNull final ProblemsHolder holder, @NotNull LocalInspectionToolSession session) { return new ErlangVisitor() { @Override public void visitFunctionCallExpression(@NotNull ErlangFunctionCallExpression o) { if (o.getParent() instanceof ErlangGlobalFunctionCallExpression) return; if (o.getQAtom().getMacros() != null) return; PsiReference reference = o.getReference(); if (!(reference instanceof ErlangFunctionReferenceImpl) || reference.resolve() == null) return; ErlangFunctionReferenceImpl r = (ErlangFunctionReferenceImpl) reference; String name = r.getName(); int arity = r.getArity(); ErlangBifDescriptor bifDescriptor = ErlangBifTable.getBif("erlang", name, arity); if (((ErlangFile)o.getContainingFile()).getFunction(name, arity) == null || bifDescriptor == null || !bifDescriptor.isAutoImported() || ((ErlangFile)o.getContainingFile()).isNoAutoImport(name, arity)) return; holder.registerProblem(o.getNameIdentifier(), "Ambiguous call of overridden pre R14 auto-imported BIF " + "'" + r.getSignature() + "'", ProblemHighlightType.GENERIC_ERROR_OR_WARNING, new ErlangSpecifyModulePrefixFix("erlang")); } }; }

Target:
protected ErlangVisitor buildErlangVisitor(@NotNull final ProblemsHolder holder, @NotNull LocalInspectionToolSession session) { return new ErlangVisitor() { @Override public void visitFunctionCallExpression(@NotNull ErlangFunctionCallExpression o) {if (o.getParent() instanceof ErlangGlobalFunctionCallExpression) return; if (o.getQAtom().getMacros() != null) return; String name = o.getName(); int arity = o.getArgumentList().getExpressionList().size(); ErlangBifDescriptor bifDescriptor = ErlangBifTable.getBif("erlang", name, arity); if (bifDescriptor == null || !bifDescriptor.isAutoImported() || ((ErlangFile)o.getContainingFile()).isNoAutoImport(name, arity) || ((ErlangFile)o.getContainingFile()).getFunction(name, arity) == null) return; holder.registerProblem(o.getNameIdentifier(), "Ambiguous call of overridden pre R14 auto-imported BIF " + "'" + name + "/" + arity + "'", ProblemHighlightType.GENERIC_ERROR_OR_WARNING, new ErlangSpecifyModulePrefixFix("erlang")); } }; }
Source:
public void setMulePlugins(SortedMap<Dependency, SortedSet<Dependency>> mulePlugins) { validatePlugins(mulePlugins.keySet()); this.mulePlugins = mulePlugins; }

Target:
public void setMulePlugins(SortedMap<Dependency, SortedSet<Dependency>> mulePlugins) { validatePlugins(mulePlugins.keySet()); this.mulePlugins.putAll(mulePlugins); }
Source:
public static List<CloudBlobMetadata> capMetadataListBySize(List<CloudBlobMetadata> originalList, long size) { long totalSize = 0; List<CloudBlobMetadata> cappedList = new ArrayList<>(); for (CloudBlobMetadata metadata : originalList) { if (totalSize + metadata.getSize() > size) { if (cappedList.size() == 0) { cappedList.add(metadata); } break; } cappedList.add(metadata); totalSize += metadata.getSize(); } return cappedList; }

Target:
public static List<CloudBlobMetadata> capMetadataListBySize(List<CloudBlobMetadata> originalList, long size) { long totalSize = 0; List<CloudBlobMetadata> cappedList = new ArrayList<>(); for (CloudBlobMetadata metadata : originalList) { if (totalSize + metadata.getSize() > size) { if (cappedList.isEmpty()) { cappedList.add(metadata); } break; } cappedList.add(metadata); totalSize += metadata.getSize(); } return cappedList; }
Source:
public Object execute(ExecutionEvent event) throws ExecutionException { Connection connection = null; IProject project = null; ISelection selection = HandlerUtil.getCurrentSelection(event); final IDockerImage image = UIUtils.getFirstElement(selection, IDockerImage.class); if (image != null) { selection = OpenShiftUIUtils.getOpenShiftExplorerSelection(); project = ResourceUtils.getProject(UIUtils.getFirstElement(selection, IResource.class)); connection = OpenShiftUIUtils.getConnectionForExplorerSelection(Connection.class); } if(connection == null) { connection = OpenShiftUIUtils.getExplorerDefaultConnection(Connection.class); } runWizard(HandlerUtil.getActiveWorkbenchWindow(event).getShell(), image, project,connection); return null; }

Target:
public Object execute(ExecutionEvent event) throws ExecutionException { Connection connection = null; IProject project = null; ISelection selection = HandlerUtil.getCurrentSelection(event); final IDockerImage image = UIUtils.getFirstElement(selection, IDockerImage.class); if (image != null) { selection = OpenShiftUIUtils.getOpenShiftExplorerSelection(); project = ResourceUtils.getProject(UIUtils.getFirstElement(selection, IResource.class)); connection = ConnectionsRegistryUtil.getConnectionFor(project); } if(connection == null) { connection = OpenShiftUIUtils.getExplorerDefaultConnection(Connection.class); } runWizard(HandlerUtil.getActiveWorkbenchWindow(event).getShell(), image, project,connection); return null; }
Source:
protected Set<Value.Immutable<?>> api$getVanillaValues() { Set<Value.Immutable<?>> values = super.api$getVanillaValues(); values.add(this.color().asImmutable()); values.add(this.radius().asImmutable()); values.add(this.particleEffect().asImmutable()); values.add(this.duration().asImmutable()); values.add(this.waitTime().asImmutable()); values.add(this.radiusOnUse().asImmutable()); values.add(this.radiusPerTick().asImmutable()); values.add(this.durationOnUse().asImmutable()); values.add(this.applicationDelay().asImmutable()); values.add(this.effects().asImmutable()); values.add(this.age().asImmutable()); return values; }

Target:
protected Set<Value.Immutable<?>> api$getVanillaValues() { final Set<Value.Immutable<?>> values = super.api$getVanillaValues(); values.add(this.color().asImmutable()); values.add(this.radius().asImmutable()); values.add(this.particleEffect().asImmutable()); values.add(this.duration().asImmutable()); values.add(this.waitTime().asImmutable()); values.add(this.radiusOnUse().asImmutable()); values.add(this.radiusPerTick().asImmutable()); values.add(this.durationOnUse().asImmutable()); values.add(this.applicationDelay().asImmutable()); values.add(this.effects().asImmutable()); values.add(this.age().asImmutable()); return values; }
Source:
public Map<String, ServerImpl> getServers() { ServerEvaluationStrategy strategy = provider.getStrategy(info, serversConf, internalHost); Map<String, List<PortBinding>> ports; if (info.getNetworkSettings() != null && info.getNetworkSettings().getPorts() != null) { ports = info.getNetworkSettings().getPorts(); } else { return Collections.emptyMap(); } Map<String, ServerImpl> servers = new LinkedHashMap<>(); for (String portProtocol : ports.keySet()) { servers.put(portProtocol, strategy.getServer(portProtocol)); } return servers; }

Target:
public Map<String, ServerImpl> getServers() { ServerEvaluationStrategy strategy = provider.get(); return strategy.getServers(info, internalHost, serversConf); }
Source:
public void add(DiffObjectCount toAdd) { treesCount += toAdd.getTreesCount(); featuresCount += toAdd.getFeaturesCount(); }

Target:
void add(DiffObjectCount toAdd) { treesCount += toAdd.getTreesCount(); featuresCount += toAdd.getFeaturesCount(); }
Source:
private int calcCameraRotation(int screenOrientationDegrees) { if (mCameraInfo.facing == Camera.CameraInfo.CAMERA_FACING_FRONT) { return (mCameraInfo.orientation + screenOrientationDegrees) % 360; } final int landscapeFlip = isLandscape(screenOrientationDegrees) ? 180 : 0; return (mCameraInfo.orientation + screenOrientationDegrees + landscapeFlip) % 360; }

Target:
private int calcCameraRotation(int screenOrientationDegrees) { if (mCameraInfo.facing == Camera.CameraInfo.CAMERA_FACING_BACK) { return (mCameraInfo.orientation + screenOrientationDegrees) % 360; } final int landscapeFlip = isLandscape(screenOrientationDegrees) ? 180 : 0; return (mCameraInfo.orientation + screenOrientationDegrees + landscapeFlip) % 360; }
Source:
Context findFailoverNode(final VirtualHost.HostEntry entry, final String domain, final String session, final String jvmRoute, final boolean forceStickySession) { if (modCluster.isDeterministicFailover()) { String sessionId = session.substring(0, session.indexOf('.')); int index = Math.abs(sessionId.hashCode()) % entry.getNodes().size(); List<String> ordered = new ArrayList<>(entry.getNodes()); Collections.sort(ordered); String electedJvmRoute = ordered.get(index); UndertowLogger.ROOT_LOGGER.debugf("Using deterministic failover target: %s", electedJvmRoute); return entry.getContextForNode(electedJvmRoute); } String failOverDomain = null; if (domain == null) { final Node node = nodes.get(jvmRoute); if (node != null) { failOverDomain = node.getNodeConfig().getDomain(); } if (failOverDomain == null) { failOverDomain = failoverDomains.get(jvmRoute); } } else { failOverDomain = domain; } final Collection<Context> contexts = entry.getContexts(); if (failOverDomain != null) { final Context context = electNode(contexts, true, failOverDomain); if (context != null) { return context; } } if (forceStickySession) { return null; } else { return electNode(contexts, false, null); } }

Target:
Context findFailoverNode(final VirtualHost.HostEntry entry, final String domain, final String session, final String jvmRoute, final boolean forceStickySession) { if (modCluster.isDeterministicFailover()) { List<String> candidates = new ArrayList<>(entry.getNodes().size()); for (String route : entry.getNodes()) { Node node = nodes.get(route); if (node != null && !node.isInErrorState()) { candidates.add(route); } } String sessionId = session.substring(0, session.indexOf('.')); int index = Math.abs(sessionId.hashCode()) % candidates.size(); Collections.sort(candidates); String electedRoute = candidates.get(index); UndertowLogger.ROOT_LOGGER.debugf("Using deterministic failover target: %s", electedRoute); return entry.getContextForNode(electedRoute); } String failOverDomain = null; if (domain == null) { final Node node = nodes.get(jvmRoute); if (node != null) { failOverDomain = node.getNodeConfig().getDomain(); } if (failOverDomain == null) { failOverDomain = failoverDomains.get(jvmRoute); } } else { failOverDomain = domain; } final Collection<Context> contexts = entry.getContexts(); if (failOverDomain != null) { final Context context = electNode(contexts, true, failOverDomain); if (context != null) { return context; } } if (forceStickySession) { return null; } else { return electNode(contexts, false, null); } }
Source:
public PcapNgBlock(SeekableByteChannel fileChannel, ByteOrder byteOrder) throws IOException, BadPcapFileException { ByteBuffer pcapPacketHeader; pcapPacketHeader = ByteBuffer.allocate(PcapFileValues.PCAPNG_BLOCK_HEADER_SIZE); pcapPacketHeader.order(byteOrder); fileChannel.read(pcapPacketHeader); pcapPacketHeader.flip(); int blockType = pcapPacketHeader.getInt(); fBlockType = blockType; int blockLength = pcapPacketHeader.getInt(); fBlockLength = blockLength; fBody = ByteBuffer.allocate(blockLength - PcapFileValues.PCAPNG_BLOCK_HEADER_SIZE); fBody.order(byteOrder); fileChannel.read(fBody); fBody.flip(); fBody.position(0); }

Target:
public PcapNgBlock(SeekableByteChannel fileChannel, ByteOrder byteOrder) throws IOException { ByteBuffer pcapPacketHeader; pcapPacketHeader = ByteBuffer.allocate(PcapFileValues.PCAPNG_BLOCK_HEADER_SIZE); pcapPacketHeader.order(byteOrder); fileChannel.read(pcapPacketHeader); pcapPacketHeader.flip(); fBlockType = pcapPacketHeader.getInt(); fBlockLength = pcapPacketHeader.getInt(); fBody = ByteBuffer.allocate(fBlockLength - PcapFileValues.PCAPNG_BLOCK_HEADER_SIZE - 4); fBody.order(byteOrder); fileChannel.read(fBody); fileChannel.position(fileChannel.position() + 4); fBody.flip(); }
Source:
public final boolean process( Set<? extends TypeElement> annotations, RoundEnvironment roundEnv ) { for (TypeElement annotation : annotations) { AnnotatedElements annotatedElements = getAnnotatedElements(roundEnv, annotation); if (!(annotatedElements.getAnnotatedClasses().isEmpty() && annotatedElements.getAnnotatedMethods().isEmpty()) ) { File outputDir = getOutputDirectory(); outputDir.mkdirs(); makeFile(new File(outputDir, ModernizerAnnotationUtils.IGNORE_CLASSES_FILE_NAME), annotatedElements.getAnnotatedClasses()); makeFile(new File(outputDir, ModernizerAnnotationUtils.IGNORE_METHODS_FILE_NAME), annotatedElements.getAnnotatedMethods()); } } return true; }

Target:
public final boolean process( Set<? extends TypeElement> annotations, RoundEnvironment roundEnv ) { for (TypeElement annotation : annotations) { AnnotatedElements annotatedElements = getAnnotatedElements(roundEnv, annotation); if (!annotatedElements.getAnnotatedClasses().isEmpty() || !annotatedElements.getAnnotatedMethods().isEmpty() ) { File outputDir = getOutputDirectory(); outputDir.mkdirs(); writeLines(new File(outputDir, ModernizerAnnotationUtils.IGNORE_CLASSES_FILE_NAME), annotatedElements.getAnnotatedClasses()); writeLines(new File(outputDir, ModernizerAnnotationUtils.IGNORE_METHODS_FILE_NAME), annotatedElements.getAnnotatedMethods()); } } return true; }
Source:
public Account executeAccount(IProgressMonitor monitor) throws GerritException { if (restQueryAPIEnabled) { try { GerritAccount gerritAccount = executeAccountsRest(monitor, "self"); Account account = new Account(new Account.Id(gerritAccount.getAccountId())); account.setFullName(gerritAccount.getName()); account.setPreferredEmail(gerritAccount.getEmail()); return account; } catch (GerritException e) { restQueryAPIEnabled = false; } } return executeAccountGwt(monitor); }

Target:
public Account executeAccount(IProgressMonitor monitor) throws GerritException { final Version version = getVersion(monitor); return execute(monitor, new Operation<Account>() { @Override public void execute(IProgressMonitor monitor) throws GerritException { getAccountService(version).myAccount(this); } }); }
Source:
private boolean isBeforeParameters(CContentAssistInvocationContext context) { int relativeOffset = context.getInvocationOffset() - context.getParseOffset(); if (relativeOffset == 0) return true; int startOffset = context.getParseOffset(); try { String completePrefix = context.getDocument().get(startOffset, context.getInvocationOffset() - startOffset); if (completePrefix.trim().endsWith("(")) return true; } catch (BadLocationException e) { return false; } return false; }

Target:
private boolean isBeforeParameters(CContentAssistInvocationContext context) { int relativeOffset = context.getInvocationOffset() - context.getParseOffset(); if (relativeOffset == 0) return true; int startOffset = context.getParseOffset(); try { String completePrefix = context.getDocument().get(startOffset, context.getInvocationOffset() - startOffset); int lastChar = getLastNonWhitespaceChar(completePrefix); if (lastChar != -1 && completePrefix.charAt(lastChar) == '(') return true; } catch (BadLocationException e) { return false; } return false; }
Source:
public ZkJobCoordinator(Config config, MetricsRegistry metricsRegistry) { this.config = config; ZkConfig zkConfig = new ZkConfig(config); ZkKeyBuilder keyBuilder = new ZkKeyBuilder(new ApplicationConfig(config).getGlobalAppId()); ZkClient zkClient = ZkCoordinationServiceFactory .createZkClient(zkConfig.getZkConnect(), zkConfig.getZkSessionTimeoutMs(), zkConfig.getZkConnectionTimeoutMs()); this.metrics = new ZkJobCoordinatorMetrics(metricsRegistry); this.zkUtils = new ZkUtils(keyBuilder, zkClient, zkConfig.getZkConnectionTimeoutMs(), metrics); this.processorId = createProcessorId(config); LeaderElector leaderElector = new ZkLeaderElector(processorId, zkUtils); leaderElector.setLeaderElectorListener(new LeaderElectorListenerImpl()); this.zkController = new ZkControllerImpl(processorId, zkUtils, this, leaderElector); this.barrier = new ZkBarrierForVersionUpgrade(keyBuilder.getJobModelVersionBarrierPrefix(), zkUtils, new ZkBarrierListenerImpl()); this.debounceTimeMs = new JobConfig(config).getDebounceTimeMs(); this.reporters = MetricsReporterLoader.getMetricsReporters(new MetricsConfig(config), processorId); zkClient.subscribeStateChanges(new ZkSessionStateChangedListener()); }

Target:
public ZkJobCoordinator(Config config, MetricsRegistry metricsRegistry) { this.config = config; ZkConfig zkConfig = new ZkConfig(config); ZkKeyBuilder keyBuilder = new ZkKeyBuilder(new ApplicationConfig(config).getGlobalAppId()); ZkClient zkClient = ZkCoordinationServiceFactory .createZkClient(zkConfig.getZkConnect(), zkConfig.getZkSessionTimeoutMs(), zkConfig.getZkConnectionTimeoutMs()); zkClient.subscribeStateChanges(new ZkSessionStateChangedListener()); this.metrics = new ZkJobCoordinatorMetrics(metricsRegistry); this.zkUtils = new ZkUtils( keyBuilder, zkClient, zkConfig.getZkConnectionTimeoutMs(), metricsRegistry); this.processorId = createProcessorId(config); LeaderElector leaderElector = new ZkLeaderElector(processorId, zkUtils); leaderElector.setLeaderElectorListener(new LeaderElectorListenerImpl()); this.zkController = new ZkControllerImpl(processorId, zkUtils, this, leaderElector); this.barrier = new ZkBarrierForVersionUpgrade(keyBuilder.getJobModelVersionBarrierPrefix(), zkUtils, new ZkBarrierListenerImpl()); this.debounceTimeMs = new JobConfig(config).getDebounceTimeMs(); this.reporters = MetricsReporterLoader.getMetricsReporters(new MetricsConfig(config), processorId); }
Source:
public PinotQueryGeneratorContext visitFilter(FilterNode node, PinotQueryGeneratorContext context) { context = node.getSource().accept(this, context); requireNonNull(context, "context is null"); LinkedHashMap<VariableReferenceExpression, Selection> selections = context.getSelections(); String filter = node.getPredicate().accept(pinotFilterExpressionConverter, (var) -> selections.get(var)).getDefinition(); return context.withFilter(filter).withOutputColumns(node.getOutputVariables()); }

Target:
public PinotQueryGeneratorContext visitFilter(FilterNode node, PinotQueryGeneratorContext context) { context = node.getSource().accept(this, context); requireNonNull(context, "context is null"); LinkedHashMap<VariableReferenceExpression, Selection> selections = context.getSelections(); String filter = node.getPredicate().accept(pinotFilterExpressionConverter, selections::get).getDefinition(); return context.withFilter(filter).withOutputColumns(node.getOutputVariables()); }
Source:
public boolean isInsecureSkipTLSVerify() { if(cluster.containsKey("insecure-skip-tls-verify")) { return (Boolean) cluster.get("insecure-skip-tls-verify"); } return false; }

Target:
public boolean isInsecureSkipTLSVerify() { if(cluster.containsKey(INSECURE_SKIP_TLS_VERIFY)) { return (Boolean) cluster.get(INSECURE_SKIP_TLS_VERIFY); } return false; }
Source:
private void setStatusIfNotTheSame(InstanceMetaData instanceMetaData, InstanceStatus newStatus) { if (updateStatus) { instanceMetaData.setInstanceStatus(newStatus); LOGGER.info(":::Auto sync::: The instance status updated from to {}", instanceMetaData.getInstanceStatus(), newStatus); } else { LOGGER.info(":::Auto sync::: The instance status would be had to update from to {}", instanceMetaData.getInstanceStatus(), newStatus); } }

Target:
private void setStatusIfNotTheSame(InstanceMetaData instanceMetaData, InstanceStatus newStatus) { if (instanceMetaData.getInstanceStatus() != newStatus) { if (updateStatus) { instanceMetaData.setInstanceStatus(newStatus); LOGGER.info(":::Auto sync::: The instance status updated from to {}", instanceMetaData.getInstanceStatus(), newStatus); } else { LOGGER.info(":::Auto sync::: The instance status would be had to update from to {}", instanceMetaData.getInstanceStatus(), newStatus); } } }
Source:
public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof Flight)) { return false; } Flight flight = (Flight) o; if (dofM != flight.dofM) { return false; } if (dofW != flight.dofW) { return false; } if (flightNum != flight.flightNum) { return false; } if (originId != flight.originId) { return false; } if (destId != flight.destId) { return false; } if (Double.compare(flight.scheduleDepTime, scheduleDepTime) != 0) { return false; } if (distance != flight.distance) { return false; } if (!carrier.equals(flight.carrier)) { return false; } if (!tailNum.equals(flight.tailNum)) { return false; } if (!origin.equals(flight.origin)) { return false; } if (!dest.equals(flight.dest)) { return false; } if (!deptime.equals(flight.deptime)) { return false; } if (!depDelayMins.equals(flight.depDelayMins)) { return false; } if (!scheduledArrTime.equals(flight.scheduledArrTime)) { return false; } if (!arrTime.equals(flight.arrTime)) { return false; } if (!arrDelay.equals(flight.arrDelay)) { return false; } if (!elapsedTime.equals(flight.elapsedTime)) { return false; } return delayed != null ? delayed.equals(flight.delayed) : flight.delayed == null; }

Target:
public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof Flight)) { return false; } Flight flight = (Flight) o; return dofM == flight.dofM && dofW == flight.dofW && Objects.equals(carrier, flight.carrier) && Objects.equals(tailNum, flight.tailNum) && flightNum == flight.flightNum && originId == flight.originId && Objects.equals(origin, flight.origin) && destId == flight.destId && Objects.equals(dest, flight.dest) && scheduleDepTime == flight.scheduleDepTime && Objects.equals(deptime, flight.deptime) && Objects.equals(depDelayMins, flight.depDelayMins) && Objects.equals(scheduledArrTime, flight.scheduledArrTime) && Objects.equals(arrTime, flight.arrTime) && Objects.equals(arrDelay, flight.arrDelay) && Objects.equals(elapsedTime, flight.elapsedTime) && distance == flight.distance && Objects.equals(delayed, flight.delayed); }
Source:
public void setScoreFilter(int score) { enforceNetworkStackPermission(); sendMessage(obtainMessage(CMD_SET_SCORE, score, 0)); }

Target:
public void setScoreFilter(int score) { sendMessage(obtainMessage(CMD_SET_SCORE, score, 0)); }
Source:
public void theReplaceKeysRequestIsReceived() throws Throwable { PROPERTIES_MAP.put(DEVICE_IDENTIFICATION_G_LABEL, this.deviceId.getDeviceIdG()); PROPERTIES_MAP.put(ORGANISATION_IDENTIFICATION_LABEL, this.organisationId.getOrganisationId()); this.RequestRunner(PROPERTIES_MAP, TEST_CASE_NAME_REQUEST, TEST_CASE_XML, TEST_SUITE_XML); }

Target:
public void theReplaceKeysRequestIsReceived() throws Throwable { PROPERTIES_MAP.put(DEVICE_IDENTIFICATION_E_LABEL, this.deviceId.getDeviceIdE()); PROPERTIES_MAP.put(ORGANISATION_IDENTIFICATION_LABEL, this.organisationId.getOrganisationId()); this.RequestRunner(PROPERTIES_MAP, TEST_CASE_NAME_REQUEST, TEST_CASE_XML, TEST_SUITE_XML); }
Source:
public IPropertyWrapper getProperty(String name) { buildPropertyMap(); return null; }

Target:
public IPropertyWrapper getProperty(String name) { buildPropertyMap(); return properties.get(name); }
Source:
public void controller(@RequestParam("patientId") Patient patient, @RequestParam(value = "tab", defaultValue = "visits") String selectedTab, PageModel model, @InjectBeans PatientDomainWrapper patientDomainWrapper, @SpringBean("orderService") OrderService orderService, @SpringBean("adtService") AdtService adtService, @SpringBean("appFrameworkService") AppFrameworkService appFrameworkService, UiSessionContext sessionContext) { patientDomainWrapper.setPatient(patient); model.addAttribute("patient", patientDomainWrapper); model.addAttribute("orders", orderService.getOrdersByPatient(patient)); model.addAttribute("availableTasks", new ArrayList()); model.addAttribute("activeVisitTasks", new ArrayList()); model.addAttribute("addressHierarchyLevels", getAddressHierarchyLevels()); model.addAttribute("selectedTab", selectedTab); Location sessionLocation = sessionContext.getSessionLocation(); if (sessionLocation == null) sessionLocation = LocationUtility.getDefaultLocation(); Location visitLocation = sessionLocation; VisitDomainWrapper activeVisit = adtService.getActiveVisit((Patient) patient, visitLocation); model.addAttribute("activeVisit", activeVisit); List<Extension> encounterTemplateExtensions = appFrameworkService .getExtensionsForCurrentUser(ENCOUNTER_TEMPLATE_EXTENSION); model.addAttribute("encounterTemplateExtensions", encounterTemplateExtensions); }

Target:
public void controller(@RequestParam("patientId") Patient patient, @RequestParam(value = "tab", defaultValue = "visits") String selectedTab, PageModel model, @InjectBeans PatientDomainWrapper patientDomainWrapper, @SpringBean("orderService") OrderService orderService, @SpringBean("adtService") AdtService adtService, @SpringBean("appFrameworkService") AppFrameworkService appFrameworkService, UiSessionContext sessionContext) { patientDomainWrapper.setPatient(patient); model.addAttribute("patient", patientDomainWrapper); model.addAttribute("orders", orderService.getOrdersByPatient(patient)); model.addAttribute("addressHierarchyLevels", getAddressHierarchyLevels()); model.addAttribute("selectedTab", selectedTab); Location visitLocation = adtService.getLocationThatSupportsVisits(sessionContext.getSessionLocation()); VisitDomainWrapper activeVisit = adtService.getActiveVisit((Patient) patient, visitLocation); model.addAttribute("activeVisit", activeVisit); List<Extension> encounterTemplateExtensions = appFrameworkService .getExtensionsForCurrentUser(ENCOUNTER_TEMPLATE_EXTENSION); model.addAttribute("encounterTemplateExtensions", encounterTemplateExtensions); model.addAttribute("overallActions", appFrameworkService.getExtensionsForCurrentUser("patientDashboard.overallActions")); model.addAttribute("visitActions", appFrameworkService.getExtensionsForCurrentUser("patientDashboard.visitActions")); }
Source:
public boolean test(R record) { return record.key() == null; }

Target:
public boolean test(R record) { return record.value() == null; }
Source:
public Set<String> getEnabledServiceNames() { return properties.entrySet().stream().filter(keyValuePair -> Boolean.valueOf((String) keyValuePair.getValue())) .map(keyValuePair -> ((String) keyValuePair.getKey()).substring(((String) keyValuePair.getKey()).lastIndexOf(".") + 1).toUpperCase(Locale.getDefault())).collect(toSet()); }

Target:
public Set<String> getEnabledServiceNames() { return properties.entrySet().stream().filter(keyValuePair -> Boolean.valueOf((String) keyValuePair.getValue())) .map(keyValuePair -> ((String) keyValuePair.getKey()).substring(((String) keyValuePair.getKey()).lastIndexOf('.') + 1).toUpperCase(Locale.getDefault())).collect(toSet()); }
Source:
private void setDelta(int bucket, int value) { int slot = bucketToSlot(bucket); byte clearMask = (byte) (BUCKET_MASK << shiftForBucket(bucket)); deltas[slot] &= (byte) ~clearMask; byte setMask = (byte) (value << shiftForBucket(bucket)); deltas[slot] |= setMask; }

Target:
private void setDelta(int bucket, int value) { int slot = bucketToSlot(bucket); byte clearMask = (byte) (BUCKET_MASK << shiftForBucket(bucket)); deltas[slot] &= ~clearMask; byte setMask = (byte) (value << shiftForBucket(bucket)); deltas[slot] |= setMask; }
Source:
private void runOnceForTable(TableToSweep tableToSweep) { Stopwatch watch = Stopwatch.createStarted(); TableReference tableRef = tableToSweep.getTableRef(); byte[] startRow = tableToSweep.getStartRow(); SweepBatchConfig batchConfig = getAdjustedBatchConfig(); try { SweepResults results = sweepRunner.run( tableRef, batchConfig, startRow); long elapsedMillis = watch.elapsed(TimeUnit.MILLISECONDS); log.info("Swept unique cells from starting at {}" + " and performed deletions in ms" + " up to timestamp {}.", SafeArg.of("", results.getCellTsPairsExamined()), UnsafeArg.of("table name", tableRef), SafeArg.of("row hex", startRowToHex(startRow)), SafeArg.of("", results.getStaleValuesDeleted()), SafeArg.of("", elapsedMillis), SafeArg.of("", results.getSweptTimestamp())); sweepPerfLogger.logSweepResults( SweepPerformanceResults.builder() .sweepResults(results) .tableName(tableRef.getQualifiedName()) .elapsedMillis(elapsedMillis) .build()); saveSweepResults(tableToSweep, results); } catch (RuntimeException e) { log.warn("Failed to sweep with batch config starting from row {}", UnsafeArg.of("table name", tableRef), SafeArg.of("", batchConfig), SafeArg.of("hex", startRowToHex(startRow))); throw e; } }

Target:
private void runOnceForTable(TableToSweep tableToSweep) { Stopwatch watch = Stopwatch.createStarted(); TableReference tableRef = tableToSweep.getTableRef(); byte[] startRow = tableToSweep.getStartRow(); SweepBatchConfig batchConfig = getAdjustedBatchConfig(); try { SweepResults results = sweepRunner.run( tableRef, batchConfig, startRow); long elapsedMillis = watch.elapsed(TimeUnit.MILLISECONDS); log.info("Swept unique cells from starting at {}" + " and performed deletions in ms" + " up to timestamp {}.", SafeArg.of("cellsExamined", results.getCellTsPairsExamined()), UnsafeArg.of("table name", tableRef), UnsafeArg.of("start row hex", startRowToHex(startRow)), SafeArg.of("staleValuesDeleted", results.getStaleValuesDeleted()), SafeArg.of("elapsedMillis", elapsedMillis), SafeArg.of("sweptTimestamp", results.getSweptTimestamp())); sweepPerfLogger.logSweepResults( SweepPerformanceResults.builder() .sweepResults(results) .tableName(tableRef.getQualifiedName()) .elapsedMillis(elapsedMillis) .build()); saveSweepResults(tableToSweep, results); } catch (RuntimeException e) { log.debug("Failed to sweep with batch config starting from row {}", UnsafeArg.of("table name", tableRef), SafeArg.of("cell batch size", batchConfig), UnsafeArg.of("start row hex", startRowToHex(startRow))); throw e; } }
Source:
public void registerExternalIdentifier() throws Exception { TestUtils.mockEditAccount(mockAccountDao, mockAccount); service.registerExternalIdentifier(TEST_STUDY, "BBB", externalId); verify(mockDao).registerExternalId(externalId); verify(mockAccount).setExternalId(externalId.getIdentifier()); }

Target:
public void registerExternalIdentifier() throws Exception { TestUtils.mockEditAccount(mockAccountDao, mockAccount); Set<String> dataGroups = Sets.newHashSet(); when(mockAccount.getDataGroups()).thenReturn(dataGroups); service.registerExternalIdentifier(TEST_STUDY, "BBB", externalId); verify(mockDao).registerExternalId(externalId); verify(mockAccount).setExternalId(externalId.getIdentifier()); assertEquals(Sets.newHashSet("football_player"), dataGroups); }
Source:
public boolean onKeyEvent(NUIKeyEvent event) { if (event.isDown()) { int keyId = event.getKey().getId(); if (keyId == Keyboard.KeyId.UP) { if (TabbingManager.focusedWidget instanceof UIDropdown) { if (((UIDropdown) TabbingManager.focusedWidget).isOpened()) { TabbingManager.setWidgetIsOpen(true); ((UIDropdown) TabbingManager.focusedWidget).changeHighlighted(false); } else { TabbingManager.setWidgetIsOpen(false); } } if (parent != null && !TabbingManager.isWidgetOpen()) { parent.scroll(true); } return true; } else if (keyId == Keyboard.KeyId.DOWN) { if (TabbingManager.focusedWidget instanceof UIDropdown) { if (((UIDropdown) TabbingManager.focusedWidget).isOpened()) { TabbingManager.setWidgetIsOpen(true); ((UIDropdown) TabbingManager.focusedWidget).changeHighlighted(true); } else { TabbingManager.setWidgetIsOpen(false); } } if (parent != null && !TabbingManager.isWidgetOpen()) { parent.scroll(false); } return true; } } return super.onKeyEvent(event); }

Target:
public boolean onKeyEvent(NUIKeyEvent event) { if (event.isDown()) { int keyId = event.getKey().getId(); if (keyId == Keyboard.KeyId.UP) { if (parent != null && !TabbingManager.isWidgetOpen()) { parent.scroll(true); } return true; } else if (keyId == Keyboard.KeyId.DOWN) { if (parent != null && !TabbingManager.isWidgetOpen()) { parent.scroll(false); } return true; } } return super.onKeyEvent(event); }
Source:
public void start() { if (State.NOT_STARTED.equals(this.state)) { logger.debug("Transcriber is now transcribing"); this.state = State.TRANSCRIBING; this.executorService = Executors.newSingleThreadExecutor(); List<String> names = new ArrayList<>(participants.size()); participants.values().forEach((p) -> { String name; if ((name = p.getName()) == null) { name = p.getId(); } names.add(name); }); this.transcript.started(roomName, names); } else { logger.warn("Trying to start Transcriber while it is" + "already started"); } }

Target:
public void start() { if (State.NOT_STARTED.equals(this.state)) { logger.debug("Transcriber is now transcribing"); this.state = State.TRANSCRIBING; this.executorService = Executors.newSingleThreadExecutor(); List<String> names = new ArrayList<>(participants.size()); participants.values().forEach((p) -> names.add(p.getName())); this.transcript.started(roomName, names); } else { logger.warn("Trying to start Transcriber while it is" + "already started"); } }
Source:
public void edit(final IscsiStorageModel object) { driver.edit(object); initLists(object); object.getPropertyChangedEvent().addListener((ev, sender, args) -> { String propName = args.propertyName; if (propName.equals("IsValid")) { onIsValidPropertyChange(object); } else if (propName.equals("IsGroupedByTarget")) { updateListByGrouping(object); } }); iscsiTargetToLunView.edit(object); iscsiLunToTargetView.edit(object); targetsToLunTab.addClickHandler(event -> { iscsiLunToTargetView.disableItemsUpdate(); object.setIsGroupedByTarget(true); }); lunToTargetsTab.addClickHandler(event -> { iscsiTargetToLunView.disableItemsUpdate(); object.setIsGroupedByTarget(false); }); dialogTabPanel.switchTab(object.getIsGroupedByTarget() ? targetsToLunTab : lunToTargetsTab); updateListByGrouping(object); if (!object.getContainer().isNewStorage()) { switch (object.getContainer().getStorage().getStatus()) { case Maintenance: mainLabel.setText(constants.storageIscsiRemoveLUNsLabel()); subLabel.setText(constants.storageIscsiAvailableActionsOnMaintenanceLabel()); break; case Active: mainLabel.setText(constants.storageIscsiActionsLabel()); subLabel.setText(constants.storageIscsiAvailableActionsForActiveDomainsLabel()); break; } } dialogTabPanel.setBarStyle(object.getContainer().isNewStorage() ? (!multiSelection ? style.barNewDisk() : style.barShort()) : style.barLong()); }

Target:
public void edit(final IscsiStorageModel object) { driver.edit(object); initLists(object); object.getPropertyChangedEvent().addListener((ev, sender, args) -> { String propName = args.propertyName; if (propName.equals("IsValid")) { onIsValidPropertyChange(object); } else if (propName.equals("IsGroupedByTarget")) { updateListByGrouping(object); } }); iscsiTargetToLunView.edit(object); iscsiLunToTargetView.edit(object); targetsToLunTab.addClickHandler(event -> { iscsiLunToTargetView.disableItemsUpdate(); object.setIsGroupedByTarget(true); }); lunToTargetsTab.addClickHandler(event -> { iscsiTargetToLunView.disableItemsUpdate(); object.setIsGroupedByTarget(false); }); dialogTabPanel.switchTab(object.getIsGroupedByTarget() ? targetsToLunTab : lunToTargetsTab); updateListByGrouping(object); if (!object.getContainer().isNewStorage()) { switch (object.getContainer().getStorage().getStatus()) { case Maintenance: mainLabel.setText(constants.storageIscsiRemoveLUNsLabel()); subLabel.setText(constants.storageIscsiAvailableActionsOnMaintenanceLabel()); break; case Active: mainLabel.setText(constants.storageIscsiActionsLabel()); subLabel.setText(constants.storageIscsiAvailableActionsForActiveDomainsLabel()); break; } } if (object.getContainer().isNewStorage()) { dialogTabPanel.setBarStyle(multiSelection ? style.barShort() : style.barNewDisk()); } else { dialogTabPanel.setBarStyle(style.barLong()); } }