auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public ContextMenuBuilder createPrimaryContextMenu(JsonTree node) { ContextMenuBuilder contextMenu = new ContextMenuBuilder(); ContextMenuLevel primaryLevel = contextMenu.addLevel(LEVEL_PRIMARY); primaryLevel.setVisible(true); JsonTreeValue.Type type = node.getValue().getType(); ENDED level. if ((type == JsonTreeValue.Type.ARRAY && !node.getValue().getKey().equals("contents")) || type == JsonTreeValue.Type.OBJECT) { ContextMenuLevel addLevel = contextMenu.addLevel(LEVEL_ADD_EXTENDED); primaryLevel.addOption(OPTION_ADD_EXTENDED, n -> contextMenu.getLevel(LEVEL_ADD_EXTENDED).setVisible(!addLevel.isVisible()), null, false); createAddContextMenu(node, addLevel); } if (type == JsonTreeValue.Type.ARRAY && node.getValue().getKey().equals("contents")) { primaryLevel.addOption(OPTION_ADD_WIDGET, externalConsumers.get(OPTION_ADD_WIDGET), node, true); } primaryLevel.addOption(OPTION_COPY, externalConsumers.get(OPTION_COPY), node, true); primaryLevel.addOption(OPTION_PASTE, externalConsumers.get(OPTION_PASTE), node, true); if (type != JsonTreeValue.Type.NULL && !(type == JsonTreeValue.Type.OBJECT && !node.isRoot() && node.getParent().getValue().getType() == JsonTreeValue.Type.ARRAY)) { primaryLevel.addOption(OPTION_EDIT, externalConsumers.get(OPTION_EDIT), node, true); } return contextMenu; }

Target:
public ContextMenuBuilder createPrimaryContextMenu(JsonTree node) { ContextMenuBuilder contextMenu = new ContextMenuBuilder(); ContextMenuLevel primaryLevel = contextMenu.addLevel(true); JsonTreeValue.Type type = node.getValue().getType(); ENDED level. if ((type == JsonTreeValue.Type.ARRAY && !node.getValue().getKey().equals("contents")) || type == JsonTreeValue.Type.OBJECT) { ContextMenuLevel addLevel = contextMenu.addLevel(false); primaryLevel.addNavigationOption(OPTION_ADD_EXTENDED, addLevel); createAddContextMenu(node, addLevel); } if (type == JsonTreeValue.Type.ARRAY && node.getValue().getKey().equals("contents")) { primaryLevel.addOption(OPTION_ADD_WIDGET, externalConsumers.get(OPTION_ADD_WIDGET), node, true); } primaryLevel.addOption(OPTION_COPY, externalConsumers.get(OPTION_COPY), node, true); primaryLevel.addOption(OPTION_PASTE, externalConsumers.get(OPTION_PASTE), node, true); if (type != JsonTreeValue.Type.NULL && !(type == JsonTreeValue.Type.OBJECT && !node.isRoot() && node.getParent().getValue().getType() == JsonTreeValue.Type.ARRAY)) { primaryLevel.addOption(OPTION_EDIT, externalConsumers.get(OPTION_EDIT), node, true); } return contextMenu; }
Source:
public T getValue() { if (!this.started) { throw ClusteringServerLogger.ROOT_LOGGER.notStarted(this.context.getServiceName().getCanonicalName()); } try { Map<Node, CommandResponse<Optional<T>>> responses = this.context.getCommandDispatcher().executeOnCluster(new SingletonValueCommand<T>()); List<Map.Entry<Node, Optional<T>>> result = responses.entrySet().stream().map(entry -> { try { return new AbstractMap.SimpleImmutableEntry<>(entry.getKey(), entry.getValue().get()); } catch (ExecutionException e) { throw new IllegalArgumentException(e); } }).filter(entry -> entry.getValue() != null).collect(Collectors.toList()); if (result.size() > 1) { throw ClusteringServerLogger.ROOT_LOGGER.multiplePrimaryProvidersDetected(this.context.getServiceName().getCanonicalName(), result.stream().map(Map.Entry::getKey).collect(Collectors.toList())); } for (Map.Entry<Node, Optional<T>> nodeOptionalEntry : result) { return Optional.of(nodeOptionalEntry).orElseThrow(() -> ClusteringServerLogger.ROOT_LOGGER.noResponseFromMaster(this.context.getServiceName().getCanonicalName())).getValue().orElse(null); } return Optional.<Map.Entry<Node, Optional<T>>>empty().orElseThrow(() -> ClusteringServerLogger.ROOT_LOGGER.noResponseFromMaster(this.context.getServiceName().getCanonicalName())).getValue().orElse(null); } catch (CommandDispatcherException e) { throw new IllegalArgumentException(e); } }

Target:
public T getValue() { if (!this.started) { throw ClusteringServerLogger.ROOT_LOGGER.notStarted(this.context.getServiceName().getCanonicalName()); } try { Map<Node, CommandResponse<Optional<T>>> responses = this.context.getCommandDispatcher().executeOnCluster(new SingletonValueCommand<T>()); List<Map.Entry<Node, Optional<T>>> result = responses.entrySet().stream().map(entry -> { try { return new AbstractMap.SimpleImmutableEntry<>(entry.getKey(), entry.getValue().get()); } catch (ExecutionException e) { throw new IllegalArgumentException(e); } }).filter(entry -> entry.getValue() != null).collect(Collectors.toList()); if (result.size() > 1) { throw ClusteringServerLogger.ROOT_LOGGER.multiplePrimaryProvidersDetected(this.context.getServiceName().getCanonicalName(), result.stream().map(Map.Entry::getKey).collect(Collectors.toList())); } if (result.isEmpty()) { throw ClusteringServerLogger.ROOT_LOGGER.noResponseFromMaster(this.context.getServiceName().getCanonicalName()); } return result.get(0).getValue().orElse(null); } catch (CommandDispatcherException e) { throw new IllegalArgumentException(e); } }
Source:
protected ThingHandler createHandler(Thing thing) { return new FSInternetRadioHandler(thing); }

Target:
protected ThingHandler createHandler(Thing thing) { ThingTypeUID thingTypeUID = thing.getThingTypeUID(); if (thingTypeUID.equals(THING_TYPE_RADIO)) { return new FSInternetRadioHandler(thing); } return null; }
Source:
Coordinator(TestSuite testSuite, ComponentRegistry componentRegistry, CoordinatorParameters coordinatorParameters, WorkerParameters workerParameters, ClusterLayoutParameters clusterLayoutParameters, ClusterLayout clusterLayout) { this.outputDirectory = ensureExistingDirectory(new File(System.getProperty("user.dir"), testSuite.getId())); echoLocal("Output directory: " + outputDirectory.getAbsolutePath()); this.testSuite = testSuite; this.componentRegistry = componentRegistry; this.coordinatorParameters = coordinatorParameters; this.workerParameters = workerParameters; this.clusterLayoutParameters = clusterLayoutParameters; this.hdrHistogramContainer = new HdrHistogramContainer(outputDirectory, performanceStateContainer); this.failureContainer = new FailureContainer( outputDirectory, componentRegistry, testSuite.getTolerableFailures()); this.simulatorProperties = coordinatorParameters.getSimulatorProperties(); this.bash = new Bash(simulatorProperties); this.clusterLayout = clusterLayout; this.hazelcastJARs = HazelcastJARs.newInstance(bash, simulatorProperties, clusterLayout.getVersionSpecs()); this.lastTestPhaseToSync = coordinatorParameters.getLastTestPhaseToSync(); logConfiguration(); }

Target:
Coordinator(TestSuite testSuite, ComponentRegistry componentRegistry, CoordinatorParameters coordinatorParameters, WorkerParameters workerParameters, ClusterLayoutParameters clusterLayoutParameters, ClusterLayout clusterLayout) { this.outputDirectory = ensureExistingDirectory(new File(System.getProperty("user.dir"), testSuite.getId())); this.testSuite = testSuite; this.componentRegistry = componentRegistry; this.coordinatorParameters = coordinatorParameters; this.workerParameters = workerParameters; this.clusterLayoutParameters = clusterLayoutParameters; this.hdrHistogramContainer = new HdrHistogramContainer(outputDirectory, performanceStateContainer); this.failureContainer = new FailureContainer( outputDirectory, componentRegistry, testSuite.getTolerableFailures()); this.simulatorProperties = coordinatorParameters.getSimulatorProperties(); this.bash = new Bash(simulatorProperties); this.clusterLayout = clusterLayout; this.hazelcastJARs = HazelcastJARs.newInstance(bash, simulatorProperties, clusterLayout.getVersionSpecs()); this.lastTestPhaseToSync = coordinatorParameters.getLastTestPhaseToSync(); logConfiguration(); }
Source:
protected boolean canDoAction() { if (getParameters() == null || (getParameters().getQuotaId() == null)) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_QUOTA_NOT_EXIST); return false; } Quota quota = getQuota(); if (quota == null) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_QUOTA_NOT_EXIST); return false; } if (getQuotaDAO().isQuotaInUse(quota) && !quota.getQuotaEnforcementType().equals(QuotaEnforcementTypeEnum.DISABLED)) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_QUOTA_IN_USE_BY_VM_OR_DISK); return false; } return true; }

Target:
protected boolean canDoAction() { if (getParameters() == null || (getParameters().getQuotaId() == null)) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_QUOTA_NOT_EXIST); return false; } Quota quota = getQuota(); if (quota == null) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_QUOTA_NOT_EXIST); return false; } if (getQuotaDAO().isQuotaInUse(quota) && !QuotaEnforcementTypeEnum.DISABLED.equals(quota.getQuotaEnforcementType())) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_QUOTA_IN_USE_BY_VM_OR_DISK); return false; } return true; }
Source:
protected void addAllExpectedMsgs() { addExpectedMsg(13, 54, Severity.WARNING, Messages.SWITCH_STATEMENT); addExpectedMsg(17, 12, Severity.WARNING, Messages.CLASS); addExpectedMsg(24, 21, Severity.WARNING, Messages.CLASS); addExpectedMsg(27, 12, Severity.WARNING, Messages.STRUCT); addExpectedMsg(30, 7, Severity.WARNING, Messages.STRUCT); addExpectedMsg(32, 20, Severity.WARNING, Messages.STRUCT); addExpectedMsg(51, 25, Severity.WARNING, Messages.PROTOCOL); addExpectedMsg(54, 24, Severity.WARNING, Messages.PROTOCOL); addExpectedMsg(57, 7, Severity.WARNING, Messages.PROTOCOL); addExpectedMsg(63, 30, Severity.WARNING, Messages.EXTENSION); addExpectedMsg(66, 16, Severity.WARNING, Messages.EXTENSION); addExpectedMsg(68, 30, Severity.WARNING, Messages.EXTENSION); addExpectedMsg(71, 20, Severity.WARNING, Messages.EXTENSION); addExpectedMsg(78, 14, Severity.WARNING, Messages.FUNCTION); addExpectedMsg(85, 16, Severity.WARNING, Messages.FUNCTION); }

Target:
protected void addAllExpectedMsgs() { addExpectedBraceMsg(13, 54, Severity.WARNING, Messages.SWITCH_STATEMENT); addExpectedBraceMsg(17, 12, Severity.WARNING, Messages.CLASS); addExpectedEmptyConstructBodyMsg(24, 19, Severity.WARNING); addExpectedBraceMsg(27, 12, Severity.WARNING, Messages.STRUCT); addExpectedEmptyConstructBodyMsg(30, 5, Severity.WARNING); addExpectedEmptyConstructBodyMsg(32, 18, Severity.WARNING); addExpectedEmptyConstructBodyMsg(51, 23, Severity.WARNING); addExpectedEmptyConstructBodyMsg(54, 22, Severity.WARNING); addExpectedEmptyConstructBodyMsg(57, 5, Severity.WARNING); addExpectedEmptyConstructBodyMsg(63, 28, Severity.WARNING); addExpectedEmptyConstructBodyMsg(68, 28, Severity.WARNING); addExpectedEmptyConstructBodyMsg(71, 18, Severity.WARNING); addExpectedBraceMsg(85, 16, Severity.WARNING, Messages.FUNCTION); addExpectedEmptyConstructBodyMsg(89, 28, Severity.WARNING); addExpectedBraceMsg(91, 29, Severity.WARNING, Messages.CLASS); addExpectedBraceMsg(96, 4, Severity.WARNING, Messages.CLASS); addExpectedBraceMsg(100, 14, Severity.WARNING, Messages.CLASS); addExpectedBraceMsg(103, 6, Severity.WARNING, Messages.CLASS); }
Source:
public Void visit(KApp kapp, Void _) { if (kapp.getLabel() instanceof Token) { Token token = (Token)kapp.getLabel(); if (token.tokenSort().equals(Sort.of("#Id"))) { result.write("#id \""); } result.write(token.value()); if (token.tokenSort().equals(Sort.of("#Id"))) { result.write("\""); } result.write(token.toString()); } else { this.visitNode(kapp.getLabel()); result.write("("); boolean stopnextline = false; if (kapp.getChild() instanceof KList) { KList listOfK = (KList)kapp.getChild(); if (listOfK.getContents().size() <= 1) { stopnextline = true; } } if (kapp.getChild() instanceof ListTerminator) { stopnextline = true; } if (nextline) { if (!stopnextline) { result.endLine(); result.indent(1); } } else { result.indentToCurrent(); } this.visitNode(kapp.getChild()); result.write(")"); if (!nextline || !stopnextline) { result.unindent(); } } return null; }

Target:
public Void visit(KApp kapp, Void _) { if (kapp.getLabel() instanceof Token) { Token token = (Token)kapp.getLabel(); if (token.tokenSort().equals(Sort.BUILTIN_ID)) { result.write("#id \""); } result.write(token.value()); if (token.tokenSort().equals(Sort.BUILTIN_ID)) { result.write("\""); } result.write(token.toString()); } else { this.visitNode(kapp.getLabel()); result.write("("); boolean stopnextline = false; if (kapp.getChild() instanceof KList) { KList listOfK = (KList)kapp.getChild(); if (listOfK.getContents().size() <= 1) { stopnextline = true; } } if (kapp.getChild() instanceof ListTerminator) { stopnextline = true; } if (nextline) { if (!stopnextline) { result.endLine(); result.indent(1); } } else { result.indentToCurrent(); } this.visitNode(kapp.getChild()); result.write(")"); if (!nextline || !stopnextline) { result.unindent(); } } return null; }
Source:
public JobId submit(File workflowFile, Map<String, String> variables) throws NotConnectedRestException, PermissionRestException, SubmissionClosedRestException, JobCreationRestException { try { JobId jobId = scheduler.submit(createJobObject(workflowFile, variables)); return jobId; } catch (NotConnectedException e) { throw new NotConnectedRestException(e); } catch (PermissionException e) { throw new PermissionRestException(e); } catch (SubmissionClosedException e) { throw new SubmissionClosedRestException(e); } catch (JobCreationException e) { throw new JobCreationRestException(e); } catch (Exception e) { logger.warn("Unexpected error when submitting job", e); throw new JobCreationRestException(e); } }

Target:
public JobId submit(File workflowFile, Map<String, String> variables) throws NotConnectedRestException, PermissionRestException, SubmissionClosedRestException, JobCreationRestException { try { return scheduler.submit(createJobObject(workflowFile, variables)); } catch (NotConnectedException e) { throw new NotConnectedRestException(e); } catch (PermissionException e) { throw new PermissionRestException(e); } catch (SubmissionClosedException e) { throw new SubmissionClosedRestException(e); } catch (JobCreationException e) { throw new JobCreationRestException(e); } catch (Exception e) { logger.warn("Unexpected error when submitting job", e); throw new JobCreationRestException(e); } }
Source:
public void deserialize(Block block, int index, GeometryState state) { state.addMemoryUsage(-state.estimateGeometryMemorySize()); state.setGeometry(GeometrySerde.deserialize(GEOMETRY.getSlice(block, index))); state.addMemoryUsage(state.estimateGeometryMemorySize()); }

Target:
public void deserialize(Block block, int index, GeometryState state) { long previousMemorySize = state.getGeometry() != null ? state.getGeometry().estimateMemorySize() : 0; state.setGeometry(GeometrySerde.deserialize(GEOMETRY.getSlice(block, index)), previousMemorySize); }
Source:
private boolean isTokenSep(final int idx) { if (idx < 0 || idx >= text.length) { return false; } return text[idx] == tokenSep; }

Target:
private boolean isTokenSep(final int idx) { return text[idx] == edItemConfig.tokenSep; }
Source:
protected Map<String, String> createManifestHeaders(final String projectName) { final Map<String, String> headers = new HashMap<String, String>(); headers.put(ManifestUtils.MANIFEST_VERSION, "1.0"); headers.put(org.osgi.framework.Constants.BUNDLE_MANIFESTVERSION, "2"); headers.put(org.osgi.framework.Constants.BUNDLE_NAME, projectName); headers.put(org.osgi.framework.Constants.BUNDLE_SYMBOLICNAME, toJavaIdentifier(projectName, false)); headers.put(org.osgi.framework.Constants.BUNDLE_VERSION, "1.0.0.qualifier"); headers.put(org.osgi.framework.Constants.BUNDLE_VENDOR, "BonitaSoft S.A."); headers.put(org.osgi.framework.Constants.BUNDLE_REQUIREDEXECUTIONENVIRONMENT, "JavaSE-1.7"); headers.put(org.osgi.framework.Constants.REQUIRE_BUNDLE, new StringBuilder() .append("javax.persistence;bundle-version=\"2.0.3\"").append(",") .append(System.lineSeparator()) .append(" ") .append(engineBundleSymbolicName()).toString()); return headers; }

Target:
protected Map<String, String> createManifestHeaders(final String projectName) { final Map<String, String> headers = new HashMap<String, String>(); headers.put(ManifestUtils.MANIFEST_VERSION, "1.0"); headers.put(org.osgi.framework.Constants.BUNDLE_MANIFESTVERSION, "2"); headers.put(org.osgi.framework.Constants.BUNDLE_NAME, projectName); headers.put(org.osgi.framework.Constants.BUNDLE_SYMBOLICNAME, toJavaIdentifier(projectName, false)); headers.put(org.osgi.framework.Constants.BUNDLE_VERSION, "1.0.0.qualifier"); headers.put(org.osgi.framework.Constants.BUNDLE_VENDOR, "Bonitasoft S.A."); headers.put(org.osgi.framework.Constants.BUNDLE_REQUIREDEXECUTIONENVIRONMENT, "JavaSE-1.7"); headers.put(org.osgi.framework.Constants.REQUIRE_BUNDLE, new StringBuilder() .append("javax.persistence;bundle-version=\"2.0.3\"").append(",") .append(System.lineSeparator()) .append(" ") .append(engineBundleSymbolicName()).toString()); return headers; }
Source:
private static ICompletionProposal[] proposals(String prefix, int offset) { List<ICompletionProposal> results = new ArrayList<>(); for (String s : ALL_OPTIONS) { if (prefix == null || s.startsWith(prefix)) { IContextInformation info = new ContextInformation(s, s); String text = prefix == null ? s : s.substring(prefix.length()); results.add(new CompletionProposal(text + ": ", offset, 0, text.length() + 2, null, s, info, null)); } } Collections.sort(results, new Comparator<ICompletionProposal>() { @Override public int compare(ICompletionProposal p1, ICompletionProposal p2) { return p1.getDisplayString() .compareTo(p2.getDisplayString()); } }); return results.toArray(new ICompletionProposal[0]); }

Target:
private static ICompletionProposal[] proposals(String prefix, int offset) { ArrayList<ICompletionProposal> results = new ArrayList<ICompletionProposal>(Syntax.HELP.size()); for (Syntax s : Syntax.HELP.values()) { if (prefix == null || s.getHeader() .startsWith(prefix)) { IContextInformation info = new ContextInformation(s.getHeader(), s.getHeader()); String text = prefix == null ? s.getHeader() : s.getHeader() .substring(prefix.length()); results.add(new CompletionProposal(text + ": ", offset, 0, text.length() + 2, null, s.getHeader(), info, s.getLead())); } } Collections.sort(results, new Comparator<ICompletionProposal>() { @Override public int compare(ICompletionProposal p1, ICompletionProposal p2) { return p1.getDisplayString() .compareTo(p2.getDisplayString()); } }); return results.toArray(new ICompletionProposal[0]); }
Source:
public void onInteract(@Nonnull Player p, @Nonnull Block b) { ItemStack item = p.getInventory().getItemInMainHand(); boolean itemIsAPlank = Tag.PLANKS.isTagged(item.getType()); boolean itemIsALog = Tag.LOGS.isTagged(item.getType()); ItemStack output = null; if (itemIsALog) { Optional<Material> planks = MaterialConverter.getPlanksFromLog(item.getType()); output = new ItemStack(planks.get(), 8); } else if (itemIsAPlank){ output = new ItemStack(Material.STICK, 4); } else { return; } if (p.getGameMode() != GameMode.CREATIVE) { ItemUtils.consumeItem(item, true); } Inventory outputChest = findOutputChest(b, output); if (outputChest != null) { outputChest.addItem(output); } else { b.getWorld().dropItemNaturally(b.getLocation(), output); } b.getWorld().playEffect(b.getLocation(), Effect.STEP_SOUND, item.getType()); }

Target:
public void onInteract(@Nonnull Player p, @Nonnull Block b) { ItemStack item = p.getInventory().getItemInMainHand(); ItemStack output = getItemsToOutput(item.getType()); if (output == null) { SlimefunPlugin.getLocalization().sendMessage(p, "machines.wrong-item", true); return; } if (p.getGameMode() != GameMode.CREATIVE) { ItemUtils.consumeItem(item, true); } outputItems(b, output); b.getWorld().playEffect(b.getLocation(), Effect.STEP_SOUND, item.getType()); }
Source:
private void setClassInvocationFailure(Class<?> clazz, Object instance) { synchronized(this){ Set<Object> instances = m_classInvocationResults.get( clazz ); if (instances == null) { instances = Sets.newHashSet(); m_classInvocationResults.put(clazz, instances); } instances.add(instance); } }

Target:
private void setClassInvocationFailure(Class<?> clazz, Object instance) { synchronized(m_classInvocationResults){ Set<Object> instances = m_classInvocationResults.get( clazz ); if (instances == null) { instances = Sets.newHashSet(); m_classInvocationResults.put(clazz, instances); } instances.add(instance); } }
Source:
private JavaSymbol.TypeJavaSymbol getEnclosingClass(String shortName, String packageName) { JavaSymbol.TypeJavaSymbol owner = null; String enclosingClassName = Convert.enclosingClassName(shortName); if (StringUtils.isNotEmpty(enclosingClassName)) { enclosingClassName = Convert.fullName(packageName, enclosingClassName); InputStream inputStream = inputStreamFor(enclosingClassName); while (inputStream == null && enclosingClassName.endsWith("$")) { enclosingClassName = enclosingClassName.substring(0, enclosingClassName.length() - 1); inputStream = inputStreamFor(enclosingClassName); } owner = getClassSymbol(enclosingClassName); } return owner; }

Target:
private JavaSymbol.TypeJavaSymbol getEnclosingClass(String shortName, String packageName) { JavaSymbol.TypeJavaSymbol owner = null; String enclosingClassName = Convert.enclosingClassName(shortName); if (StringUtils.isNotEmpty(enclosingClassName)) { enclosingClassName = Convert.fullName(packageName, enclosingClassName); InputStream inputStream = null; try { inputStream = inputStreamFor(enclosingClassName); while (inputStream == null && enclosingClassName.endsWith("$")) { enclosingClassName = enclosingClassName.substring(0, enclosingClassName.length() - 1); inputStream = inputStreamFor(enclosingClassName); } } finally { Closeables.closeQuietly(inputStream); } owner = getClassSymbol(enclosingClassName); } return owner; }
Source:
public void onItemBind(ItemBinding itemBinding, int position, T item) { itemBinding.clearExtra(); if (itemExtraBindingMap != null && !itemExtraBindingMap.isEmpty()) { for (int i = 0; i < itemExtraBindingMap.size(); i++) { Class<? extends T> key = itemExtraBindingMap.keyAt(i); if (key.isInstance(item)) { SparseArray<Object> extraBindings = itemExtraBindingMap.valueAt(i); if (extraBindings != null) { for (int j = 0, size = extraBindings.size(); j < size; j++) { int variableId = extraBindings.keyAt(j); Object value = extraBindings.valueAt(j); if (value instanceof PropertyResolver) { value = ((PropertyResolver<T>) value).resolve(item); } itemBinding.bindExtra(variableId, value); } } break; } } } for (int i = 0; i < itemBindingMap.size(); i++) { Class<? extends T> key = itemBindingMap.keyAt(i); if (key.isInstance(item)) { int[] values = itemBindingMap.valueAt(i); itemBinding.set(values[0], values[1]); return; } } throw new IllegalArgumentException("Missing class for item " + item); }

Target:
public void onItemBind(ItemBinding itemBinding, int position, T item) { for (int i = 0; i < itemBindingClassList.size(); i++) { Class<? extends T> key = itemBindingClassList.get(i); if (key.isInstance(item)) { OnItemBind itemBind = itemBindingList.get(i); itemBind.onItemBind(itemBinding, position, item); return; } } throw new IllegalArgumentException("Missing class for item " + item); }
Source:
private static SetAlarmNotificationsRequestData fetchAlarmNotifications( final Map<String, String> requestParameters) { final List<AlarmNotification> lstAlarmNotifications = new ArrayList<>(); if (nullCheckAlarmType(requestParameters, "")) { lstAlarmNotifications.add(addAlarmNotification(requestParameters, "")); } for (int i = 1; i < NUMBER_ALARM_TYPES; i++) { if (nullCheckAlarmType(requestParameters, "_" + Integer.toString(i))) { lstAlarmNotifications.add(addAlarmNotification(requestParameters, "_" + Integer.toString(i))); } } return addAlarmNotificationsToRequestData(lstAlarmNotifications); }

Target:
private static SetAlarmNotificationsRequestData fetchAlarmNotifications( final Map<String, String> requestParameters) { final List<AlarmNotification> alarmNotificationsList = new ArrayList<>(); if (nullCheckAlarmType(requestParameters, "")) { alarmNotificationsList.add(getAlarmNotification(requestParameters, "")); } for (int i = 1; i < NUMBER_ALARM_TYPES; i++) { if (nullCheckAlarmType(requestParameters, "_" + Integer.toString(i))) { alarmNotificationsList.add(getAlarmNotification(requestParameters, "_" + Integer.toString(i))); } } return addAlarmNotificationsToRequestData(alarmNotificationsList); }
Source:
public void trackEnrollClicked(@NonNull String courseId, boolean emailOptIn) { final AnswersEvent event = new AnswersEvent(Events.COURSE_ENROLL_CLICKED); event.putCustomAttribute(Keys.NAME, Values.USER_COURSE_ENROLL_CLICKED) .putCustomAttribute(Analytics.Keys.COURSE_ID, courseId) .putCustomAttribute(Keys.EMAIL_OPT_IN, emailOptIn ? 1 : 0) ; event.addCategoryToBiEvents(Values.CONVERSION, courseId); trackAnswersEvent(event); }

Target:
public void trackEnrollClicked(@NonNull String courseId, boolean emailOptIn) { }
Source:
private void readFullAccountAndUpdateCache(String pathToFullAccountMetadata) throws JSONException { lock.lock(); try { long startTimeMs = System.currentTimeMillis(); logger.trace("Start reading full account metadata set from path={}", pathToFullAccountMetadata); ZNRecord zNRecord = helixStore.get(pathToFullAccountMetadata, null, AccessOption.PERSISTENT); logger.trace("Fetched ZNRecord from path={}, took time={} ms", pathToFullAccountMetadata, System.currentTimeMillis() - startTimeMs); if (zNRecord == null) { logger.debug("The ZNRecord to read does not exist on path={}", pathToFullAccountMetadata); } else { Map<String, String> remoteAccountMap = zNRecord.getMapField(ACCOUNT_METADATA_MAP_KEY); if (remoteAccountMap == null) { logger.debug("ZNRecord={} to read on path={} does not have a simple map with key={}", zNRecord, pathToFullAccountMetadata, ACCOUNT_METADATA_MAP_KEY); } else { logger.trace("Start parsing remote account data."); AccountInfoMap newAccountInfoMap = new AccountInfoMap(remoteAccountMap); Map<Short, Account> oldIdToAccountMap = accountInfoMapRef.get().idToAccountMap; List<Short> idForUpdatedAccounts = new ArrayList<>(); for (Account newAccount : newAccountInfoMap.getAccounts()) { if (!newAccount.equals(oldIdToAccountMap.get(newAccount.getId()))) { idForUpdatedAccounts.add(newAccount.getId()); } } accountInfoMapRef.set(newAccountInfoMap); logger.info("Received updates for accounts. Account IDs={}", idForUpdatedAccounts.size(), idForUpdatedAccounts); } } } finally { lock.unlock(); } }

Target:
private void readFullAccountAndUpdateCache(String pathToFullAccountMetadata) throws JSONException { lock.lock(); try { long startTimeMs = System.currentTimeMillis(); logger.trace("Start reading full account metadata set from path={}", pathToFullAccountMetadata); ZNRecord zNRecord = helixStore.get(pathToFullAccountMetadata, null, AccessOption.PERSISTENT); logger.trace("Fetched ZNRecord from path={}, took time={} ms", pathToFullAccountMetadata, System.currentTimeMillis() - startTimeMs); if (zNRecord == null) { logger.debug("The ZNRecord to read does not exist on path={}", pathToFullAccountMetadata); } else { Map<String, String> remoteAccountMap = zNRecord.getMapField(ACCOUNT_METADATA_MAP_KEY); if (remoteAccountMap == null) { logger.debug("ZNRecord={} to read on path={} does not have a simple map with key={}", zNRecord, pathToFullAccountMetadata, ACCOUNT_METADATA_MAP_KEY); } else { logger.trace("Start parsing remote account data."); AccountInfoMap newAccountInfoMap = new AccountInfoMap(remoteAccountMap); Map<Short, Account> oldIdToAccountMap = accountInfoMapRef.get().idToAccountMap; List<Short> idsOfUpdatedAccounts = new ArrayList<>(); for (Account newAccount : newAccountInfoMap.getAccounts()) { if (!newAccount.equals(oldIdToAccountMap.get(newAccount.getId()))) { idsOfUpdatedAccounts.add(newAccount.getId()); } } accountInfoMapRef.set(newAccountInfoMap); logger.info("Received updates for accounts. Account IDs={}", idsOfUpdatedAccounts.size(), idsOfUpdatedAccounts); } } } finally { lock.unlock(); } }
Source:
private void setRevisions(ChangeInfo change, String patchSet) { int i = patchSet.indexOf(".."); if (i > 0) { this.revisionA = getRevision(change, patchSet.substring(0, i)); if (patchSet.length() > i + 2) { this.revisionB = getRevision(change, patchSet.substring(i + 2)); } else { throw new IllegalArgumentException("Invalid patch set: " + patchSet); } } else { this.revisionB = getRevision(change, patchSet); this.revisionA = this.revisionB + "^1"; } }

Target:
private void setRevisions(ChangeInfo change, String patchSet) { int i = patchSet.indexOf(".."); if (i > 0) { revisionA = getRevision(change, patchSet.substring(0, i)); if (patchSet.length() > i + 2) { revisionB = getRevision(change, patchSet.substring(i + 2)); } else { throw new IllegalArgumentException("Invalid patch set: " + patchSet); } } else { revisionB = getRevision(change, patchSet); revisionA = this.revisionB + "^1"; } }
Source:
private void _nextTerminationEntry() throws Exception { _terminationDialog[_terminationIndex++].call(); }

Target:
private void _nextTerminationEntry() throws Exception { try { _terminationDialog[_terminationIndex++].call(); } catch (ArrayIndexOutOfBoundsException e) { throw new RuntimeException("Protocol violation", e); } }
Source:
public void shouldSendGooglePay3DSRequestWhenGooglePayDetailsWithoutIpAddressArePresent() throws Exception { try { worldpayApplePayAuthorisationHandler.authorise(getGooglePay3DSAuthorisationRequestWithoutIpAddress()); } catch (GatewayErrorException e) { ArgumentCaptor<GatewayOrder> gatewayOrderArgumentCaptor = ArgumentCaptor.forClass(GatewayOrder.class); ArgumentCaptor<Map<String, String>> headers = ArgumentCaptor.forClass(Map.class); verify(mockGatewayClient).postRequestFor(eq(WORLDPAY_URL), eq(gatewayAccountEntity), gatewayOrderArgumentCaptor.capture(), headers.capture()); assertXMLEqual(TestTemplateResourceLoader.load(WORLDPAY_VALID_AUTHORISE_WORLDPAY_GOOGLE_PAY_3DS_REQUEST_WITHOUT_IP_ADDRESS), gatewayOrderArgumentCaptor.getValue().getPayload()); assertThat(headers.getValue().size(), is(1)); assertThat(headers.getValue(), is(AuthUtil.getGatewayAccountCredentialsAsAuthHeader(gatewayAccountEntity))); } }

Target:
public void shouldSendGooglePay3DSRequestWhenGooglePayDetailsWithoutIpAddressArePresent() throws Exception { try { worldpayApplePayAuthorisationHandler.authorise(getGooglePay3DSAuthorisationRequestWithoutIpAddress()); } catch (GatewayErrorException e) { verify(mockGatewayClient).postRequestFor(eq(WORLDPAY_URL), eq(gatewayAccountEntity), gatewayOrderArgumentCaptor.capture(), headers.capture()); assertXMLEqual(TestTemplateResourceLoader.load(WORLDPAY_VALID_AUTHORISE_WORLDPAY_GOOGLE_PAY_3DS_REQUEST_WITHOUT_IP_ADDRESS), gatewayOrderArgumentCaptor.getValue().getPayload()); assertThat(headers.getValue().size(), is(1)); assertThat(headers.getValue(), is(AuthUtil.getGatewayAccountCredentialsAsAuthHeader(gatewayAccountEntity))); } }
Source:
public InternalRecord( List<String> keys, Value[] values ) { this.keys = keys; this.values = values; int numFields = keys.size(); Map<String, Integer> fieldLookup = new HashMap<>( numFields ); for ( int i = 0; i < numFields; i++ ) { String name = keys.get(i); fieldLookup.put( name, i ); } this.keyIndexLookup = fieldLookup; }

Target:
public InternalRecord( List<String> keys, Value[] values ) { this.keys = keys; this.values = values; }
Source:
public List<TagName> getTagNamesInUse(long dsObjId) throws TskCoreException { ArrayList<TagName> tagNames = new ArrayList<>(); String queryStr = "SELECT * FROM tag_names " + "WHERE tag_name_id IN " + "( SELECT content_tags.tag_name_id as tag_name_id " + "FROM content_tags as content_tags, tsk_files as tsk_files" + " WHERE content_tags.obj_id = tsk_files.obj_id" + " AND tsk_files.data_source_obj_id = " + dsObjId + " UNION " + "SELECT artifact_tags.tag_name_id as tag_name_id " + " FROM blackboard_artifact_tags as artifact_tags, blackboard_artifacts AS arts " + " WHERE artifact_tags.artifact_id = arts.artifact_id" + " AND arts.data_source_obj_id = " + dsObjId + " )"; try (CaseDbQuery query = caseDb.executeQuery(queryStr);) { ResultSet resultSet = query.getResultSet(); while (resultSet.next()) { tagNames.add(new TagName(resultSet.getLong("tag_name_id"), resultSet.getString("display_name"), resultSet.getString("description"), TagName.HTML_COLOR.getColorByName(resultSet.getString("color")), TskData.FileKnown.valueOf(resultSet.getByte("knownStatus")))); } return tagNames; } catch (SQLException | TskCoreException ex) { throw new TskCoreException("Failed to get tag names in use for data source objID : " + dsObjId, ex); } }

Target:
public List<TagName> getTagNamesInUse(long dsObjId) throws TskCoreException { return caseDb.getTagNamesInUse(dsObjId); }
Source:
public Map<String, String> getProperties() { return properties; }

Target:
public Map<String, String> getProperties() { return MoreObjects.firstNonNull(properties, new HashMap<String, String>()); }
Source:
public void addContents(@NonNull Container result) { result.add( new Content("nodes/master/running-jobs.txt") { @Override public void writeTo(OutputStream os) throws IOException { try (PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(os, StandardCharsets.UTF_8)))) { Optional.ofNullable(Jenkins.getInstanceOrNull()) .ifPresent(jenkins -> jenkins.getAllItems(Job.class) .stream() .filter(Job::isBuilding) .forEach(job -> { ((Job<?, ?>) job) .getBuilds() .filter(Run::isBuilding) .forEach(run -> out.println(String.format(MESSAGE_FORMAT, job.getFullName(), run.getNumber()))); })); } finally { os.flush(); } } } ); }

Target:
public void addContents(@NonNull Container result) { result.add( new Content("nodes/master/running-jobs.txt") { @Override public void writeTo(OutputStream os) throws IOException { try (OutputStreamWriter osw = new OutputStreamWriter(os, StandardCharsets.UTF_8); BufferedWriter bw = new BufferedWriter(osw); PrintWriter out = new PrintWriter(bw)) { Optional.ofNullable(Jenkins.getInstanceOrNull()) .ifPresent(jenkins -> jenkins.getAllItems(Job.class) .stream() .filter(Job::isBuilding) .forEach(job -> { ((Job<?, ?>) job) .getBuilds() .filter(Run::isBuilding) .forEach(run -> out.println(String.format(MESSAGE_FORMAT, job.getFullName(), run.getNumber()))); })); } finally { out.flush(); } } } ); }
Source:
default @Nullable Object removeArgument(String name) { return false; }

Target:
default @Nullable Object removeArgument(String name) { return null; }
Source:
static List<FormPage> toRecognizedLayout(AnalyzeResult analyzeResult, boolean includeTextDetails) { List<ReadResult> readResults = analyzeResult.getReadResults(); List<PageResult> pageResults = analyzeResult.getPageResults(); List<FormPage> formPages = new ArrayList<>(); forEachWithIndex(readResults, ((index, readResultItem) -> { List<FormTable> perPageTableList = new ArrayList<>(); if (!CoreUtils.isNullOrEmpty(pageResults)) { PageResult pageResultItem = pageResults.get(index); perPageTableList = getPageTables(pageResultItem, readResults, pageResultItem.getPage()); } List<FormLine> perPageFormLineList = new ArrayList<>(); if (includeTextDetails && !CoreUtils.isNullOrEmpty(readResultItem.getLines())) { perPageFormLineList = getReadResultFormLines(readResultItem); } formPages.add(getFormPage(readResultItem, perPageTableList, perPageFormLineList)); })); return formPages; }

Target:
static List<FormPage> toRecognizedLayout(AnalyzeResult analyzeResult, boolean includeTextDetails) { List<ReadResult> readResults = analyzeResult.getReadResults(); List<PageResult> pageResults = analyzeResult.getPageResults(); List<FormPage> formPages = new ArrayList<>(); boolean pageResultsIsNullOrEmpty = CoreUtils.isNullOrEmpty(pageResults); forEachWithIndex(readResults, ((index, readResultItem) -> { List<FormTable> perPageTableList = new ArrayList<>(); if (!pageResultsIsNullOrEmpty) { PageResult pageResultItem = pageResults.get(index); perPageTableList = getPageTables(pageResultItem, readResults, pageResultItem.getPage()); } List<FormLine> perPageFormLineList = new ArrayList<>(); if (includeTextDetails && !CoreUtils.isNullOrEmpty(readResultItem.getLines())) { perPageFormLineList = getReadResultFormLines(readResultItem); } formPages.add(getFormPage(readResultItem, perPageTableList, perPageFormLineList)); })); return formPages; }
Source:
private static final boolean isPrimitiveIntegral(TypeKind typeKind) { switch (typeKind) { case INT: case SHORT: case BYTE: case CHAR: case LONG: return true; default: return false; } }

Target:
private static boolean isPrimitiveIntegral(TypeKind typeKind) { switch (typeKind) { case INT: case SHORT: case BYTE: case CHAR: case LONG: return true; default: return false; } }
Source:
protected void connectToLeader(MultipleAddresses addr, String hostname) throws IOException, InterruptedException { List<InetSocketAddress> addresses = addr.getAllAddresses(); ExecutorService executor = Executors.newFixedThreadPool(addresses.size()); CountDownLatch latch = new CountDownLatch(addresses.size()); AtomicReference<Socket> socket = new AtomicReference<>(null); addresses.stream().map(address -> new LeaderConnector(address, socket, latch)).forEach(executor::submit); latch.await(); if(socket.get() == null) throw new IOException("Failed connect to " + addr); else sock = socket.get(); self.authLearner.authenticate(sock, hostname); leaderIs = BinaryInputArchive.getArchive(new BufferedInputStream( sock.getInputStream())); bufferedOutput = new BufferedOutputStream(sock.getOutputStream()); leaderOs = BinaryOutputArchive.getArchive(bufferedOutput); }

Target:
protected void connectToLeader(MultipleAddresses addr, String hostname) throws IOException, InterruptedException { Set<InetSocketAddress> addresses = addr.getAllAddresses(); ExecutorService executor = Executors.newFixedThreadPool(addresses.size()); CountDownLatch latch = new CountDownLatch(addresses.size()); AtomicReference<Socket> socket = new AtomicReference<>(null); addresses.stream().map(address -> new LeaderConnector(address, socket, latch)).forEach(executor::submit); latch.await(); if (socket.get() == null) { throw new IOException("Failed connect to " + addr); } else { sock = socket.get(); } self.authLearner.authenticate(sock, hostname); leaderIs = BinaryInputArchive.getArchive(new BufferedInputStream( sock.getInputStream())); bufferedOutput = new BufferedOutputStream(sock.getOutputStream()); leaderOs = BinaryOutputArchive.getArchive(bufferedOutput); }
Source:
private Collection<? extends CRL> getCRLs(List<InputStream> crlStreams) throws GeneralSecurityException { CertificateFactory cf = CertificateFactory.getInstance("X.509"); Collection<CRL> crls = new ArrayList<>(); try { for (InputStream stream : crlStreams) { crls.addAll(cf.generateCRLs(stream)); } return crls; } finally { try { for (InputStream stream : crlStreams) { stream.close(); } } catch (Exception ignore) } }

Target:
private Collection<? extends CRL> getCRLs(List<InputStream> crlStreams) throws GeneralSecurityException { CertificateFactory cf = CertificateFactory.getInstance("X.509"); Collection<CRL> crls = new ArrayList<>(); try { for (InputStream stream : crlStreams) { crls.addAll(cf.generateCRLs(stream)); } return crls; } finally { for (InputStream stream : crlStreams) { try { stream.close(); } catch (Exception ignore) } } }
Source:
boolean validateVdsGroup() { if (getVdsGroup() == null) { return failCanDoAction(VdcBllMessages.VDS_CLUSTER_IS_NOT_VALID); } return true; }

Target:
protected boolean validateVdsGroup() { if (getVdsGroup() == null) { return failCanDoAction(VdcBllMessages.VDS_CLUSTER_IS_NOT_VALID); } return true; }
Source:
public static boolean is64BitJVM() { return ((System.getProperty("sun.arch.data.model").equals("64")) | (System.getProperty("os.arch").equals("x86_64")) | (System.getProperty("os.arch").equals("amd64"))); }

Target:
public static boolean is64BitJVM() { return (("64".equals(System.getProperty("sun.arch.data.model"))) || ("x86_64".equals(System.getProperty("os.arch"))) || ("amd64".equals(System.getProperty("os.arch")))); }
Source:
public static boolean containsConsole() { if (enabledWidgets != null) { boolean containsConsole = false; for (CoreScreenLayer layer : enabledWidgets) { if (layer instanceof ConsoleScreen) { LoggerFactory.getLogger("").info("console open"); containsConsole = true; } } return containsConsole; } return false; }

Target:
public static boolean containsConsole() { if (enabledWidgets != null) { boolean containsConsole = false; for (CoreScreenLayer layer : enabledWidgets) { if (layer instanceof ConsoleScreen) { return true; } } } return false; }
Source:
private String buildInOperator(int size) { if (size == 1) { return "(?)"; } StringBuilder builder = new StringBuilder("(") .append(StringUtils.join(Collections.nCopies(size, "?"), ",")) .append(")"); return builder.toString(); }

Target:
private String buildInOperator(int size) { if (size == 1) { return "(?)"; } StringBuilder builder = new StringBuilder("(") .append(TextUtils.join(",", Collections.nCopies(size, "?"))) .append(")"); return builder.toString(); }
Source:
private void navigateTo() { if (cache == null || cache.coords == null) { showToast(res.getString(R.string.err_location_unknown)); } cgeonavigate navigateActivity = new cgeonavigate(); Intent navigateIntent = new Intent(this, navigateActivity.getClass()); navigateIntent.putExtra("latitude", cache.coords.getLatitude()); navigateIntent.putExtra("longitude", cache.coords.getLongitude()); navigateIntent.putExtra("geocode", ""); navigateIntent.putExtra("name", R.string.search_some_destination); startActivity(navigateIntent); }

Target:
private void navigateTo() { if (cache == null || cache.coords == null) { showToast(res.getString(R.string.err_location_unknown)); } cgeonavigate navigateActivity = new cgeonavigate(); Intent navigateIntent = new Intent(this, navigateActivity.getClass()); navigateIntent.putExtra("latitude", cache.coords.getLatitude()); navigateIntent.putExtra("longitude", cache.coords.getLongitude()); navigateIntent.putExtra("geocode", ""); navigateIntent.putExtra("name", res.getString(R.string.search_some_destination)); startActivity(navigateIntent); }
Source:
public void updated(Map<String, Object> properties) { logger.info("Updating {}...", properties.get(ConfigurationService.KURA_SERVICE_PID)); stopReconnectTask(); this.properties.clear(); this.properties.putAll(properties); getThrottle(); this.store.update((Integer) this.properties.get(STORE_HOUSEKEEPER_INTERVAL_PROP_NAME), (Integer) this.properties.get(STORE_PURGE_AGE_PROP_NAME), (Integer) this.properties.get(STORE_CAPACITY_PROP_NAME)); if (!this.dataTransportService.isConnected()) { startReconnectTask(); } }

Target:
public void updated(Map<String, Object> properties) { logger.info("Updating {}...", properties.get(ConfigurationService.KURA_SERVICE_PID)); stopReconnectTask(); this.properties.clear(); this.properties.putAll(properties); createThrottle(); this.store.update(dataServiceOptions.getStoreHousekeeperInterval(), dataServiceOptions.getStorePurgeAge(), dataServiceOptions.getStoreCapacity()); if (!this.dataTransportService.isConnected()) { startReconnectTask(); } }
Source:
public LogReplicationEntry receive(LogReplicationEntry message) { rxMessageCounter++; rxMessageCount.setValue(rxMessageCounter); log.debug("Sink manager received while in {}", message.getMetadata().getMessageMetadataType(), rxState); if (message.getMetadata().getTopologyConfigId() != topologyConfigId) { log.warn("Sink manager with config id ignored msg id {}", topologyConfigId, message.getMetadata().getTopologyConfigId()); return null; } if (message.getMetadata().getMessageMetadataType().equals(MessageType.SNAPSHOT_START)) { processSnapshotStart(message); return null; } if (!receivedValidMessage(message)) { END ACK message and END message again, but the receiver has already transited to if (message.getMetadata().getMessageMetadataType() == SNAPSHOT_TRANSFER_END) { log.warn("Sink Manager in state and received message {}. Resending the ACK for SNAPSHOT_END.", rxState, message.getMetadata()); LogReplicationEntryMetadata metadata = snapshotSinkBufferManager.makeAckMessage(message); return new LogReplicationEntry(metadata, new byte[0]); } log.warn("Sink Manager in state and received message {}. Dropping Message.", rxState, message.getMetadata()); return null; } if (rxState.equals(RxState.LOG_ENTRY_SYNC)) { return logEntrySinkBufferManager.processMsgAndBuffer(message); } else { return snapshotSinkBufferManager.processMsgAndBuffer(message); } }

Target:
public LogReplicationEntry receive(LogReplicationEntry message) { rxMessageCounter++; rxMessageCount.setValue(rxMessageCounter); log.debug("Sink manager received while in {}", message.getMetadata().getMessageMetadataType(), rxState); if (message.getMetadata().getTopologyConfigId() != topologyConfigId) { log.warn("Sink manager with config id ignored msg id {}", topologyConfigId, message.getMetadata().getTopologyConfigId()); return null; } if (message.getMetadata().getMessageMetadataType().equals(MessageType.SNAPSHOT_START)) { processSnapshotStart(message); return null; } if (!receivedValidMessage(message)) { END ACK message and END message again, but the receiver has already transited to if (message.getMetadata().getMessageMetadataType() == SNAPSHOT_TRANSFER_END) { log.warn("Sink Manager in state and received message {}. Resending the ACK for SNAPSHOT_END.", rxState, message.getMetadata()); LogReplicationEntryMetadata metadata = snapshotSinkBufferManager.getAckMetadata(message); return new LogReplicationEntry(metadata, new byte[0]); } log.warn("Sink Manager in state and received message {}. Dropping Message.", rxState, message.getMetadata()); return null; } if (rxState.equals(RxState.LOG_ENTRY_SYNC)) { return logEntrySinkBufferManager.processMsgAndBuffer(message); } else { return snapshotSinkBufferManager.processMsgAndBuffer(message); } }
Source:
public void launchesTerminated(ILaunch[] launches) { for (ILaunch l : launches) { if (l.equals(launch)) { Display.getDefault().syncExec(new Runnable() { public void run() { try { String s = exePath.toOSString(); URI workingDirURI = getProject().getLocationURI(); RemoteProxyManager rpmgr = RemoteProxyManager.getInstance(); IRemoteFileProxy proxy = rpmgr.getFileProxy(getProject()); String workingDirPath = proxy.toPath(workingDirURI); String gmonExpected = workingDirPath + "/gmon.out"; IFileStore f = proxy.getResource(gmonExpected); if (!f.fetchInfo().exists()) { String title = GprofLaunchMessages.GprofCompilerOptions_msg; String message = GprofLaunchMessages.GprofCompileAgain_msg; Shell parent = PlatformUI.getWorkbench().getDisplay().getActiveShell(); MessageDialog.openWarning(parent, title, message); } IFileStore exe = proxy.getResource(exePath.toString()); if (exe.fetchInfo().getLastModified() > f.fetchInfo().getLastModified()) { String title = GprofLaunchMessages.GprofGmonStale_msg; String message = GprofLaunchMessages.GprofGmonStaleExplanation_msg; Shell parent = PlatformUI.getWorkbench().getDisplay().getActiveShell(); MessageDialog.openWarning(parent, title, message); } Display.getDefault().asyncExec(new LaunchTerminationWatcherRunnable(s, gmonExpected)); } catch (NullPointerException e) { } catch (CoreException e) { } } }); } } }

Target:
public void launchesTerminated(ILaunch[] launches) { for (ILaunch l : launches) { if (l.equals(launch)) { Display.getDefault().syncExec(new Runnable() { public void run() { try { String s = exePath.toOSString(); URI workingDirURI = getProject().getLocationURI(); RemoteProxyManager rpmgr = RemoteProxyManager.getInstance(); IRemoteFileProxy proxy = rpmgr.getFileProxy(getProject()); String workingDirPath = proxy.toPath(workingDirURI); String gmonExpected = workingDirPath + "/gmon.out"; IFileStore f = proxy.getResource(gmonExpected); if (!f.fetchInfo().exists()) { String title = GprofLaunchMessages.GprofCompilerOptions_msg; String message = GprofLaunchMessages.GprofCompileAgain_msg; Shell parent = PlatformUI.getWorkbench().getDisplay().getActiveShell(); MessageDialog.openWarning(parent, title, message); } else { IFileStore exe = proxy.getResource(exePath.toString()); if (exe.fetchInfo().getLastModified() > f.fetchInfo().getLastModified()) { String title = GprofLaunchMessages.GprofGmonStale_msg; String message = GprofLaunchMessages.GprofGmonStaleExplanation_msg; Shell parent = PlatformUI.getWorkbench().getDisplay().getActiveShell(); MessageDialog.openWarning(parent, title, message); } } Display.getDefault().asyncExec(new LaunchTerminationWatcherRunnable(s, gmonExpected)); } catch (NullPointerException e) { } catch (CoreException e) { } } }); } } }