auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public boolean barrierAnnouncement( InputChannelInfo channelInfo, CheckpointBarrier announcedBarrier, int sequenceNumber) { checkState( sequenceNumberInAnnouncedChannels.put(channelInfo, sequenceNumber) == null, "Stream corrupt: Repeated barrierAnnouncement for same checkpoint on input " + channelInfo); return false; }

Target:
public void barrierAnnouncement( InputChannelInfo channelInfo, CheckpointBarrier announcedBarrier, int sequenceNumber) { Integer previousValue = sequenceNumberInAnnouncedChannels.put(channelInfo, sequenceNumber); checkState( previousValue == null, "Stream corrupt: Repeated barrierAnnouncement [%s] overwriting [%s] for the same checkpoint on input %s", announcedBarrier, sequenceNumber, channelInfo); }
Source:
private void removeImageFromDB() { final DiskImage diskImage = getDiskImage(); final List<Snapshot> updatedSnapshots = prepareSnapshotConfigurationsWithoutImage(diskImage.getId()); TransactionSupport.executeInScope(TransactionScopeOption.Required, new TransactionMethod<Object>() { @Override public Object runInTransaction() { getDiskImageDynamicDAO().remove(diskImage.getImageId()); Guid imageTemplate = diskImage.getit_guid(); Guid currentGuid = diskImage.getImageId(); while (!imageTemplate.equals(currentGuid) && !currentGuid.equals(Guid.Empty)) { RemoveChildren(currentGuid); DiskImage image = getDiskImageDao().getSnapshotById(currentGuid); if (image != null) { RemoveSnapshot(image); currentGuid = image.getParentId(); } else { currentGuid = Guid.Empty; log.warnFormat( "RemoveImageCommand::RemoveImageFromDB: 'image' (snapshot of image '{0}') is null, cannot remove it.", diskImage.getImageId()); } } getBaseDiskDao().remove(diskImage.getId()); getVmDeviceDAO().remove(new VmDeviceId(diskImage.getId(), null)); for (Snapshot s : updatedSnapshots) { getSnapshotDao().update(s); } return null; } }); }

Target:
private void removeImageFromDB() { final DiskImage diskImage = getDiskImage(); final List<Snapshot> updatedSnapshots = prepareSnapshotConfigWithoutImage(diskImage.getId()); TransactionSupport.executeInScope(TransactionScopeOption.Required, new TransactionMethod<Object>() { @Override public Object runInTransaction() { getDiskImageDynamicDAO().remove(diskImage.getImageId()); Guid imageTemplate = diskImage.getit_guid(); Guid currentGuid = diskImage.getImageId(); while (!currentGuid.equals(imageTemplate) && !currentGuid.equals(Guid.Empty)) { RemoveChildren(currentGuid); DiskImage image = getDiskImageDao().getSnapshotById(currentGuid); if (image != null) { RemoveSnapshot(image); currentGuid = image.getParentId(); } else { currentGuid = Guid.Empty; log.warnFormat( "'image' (snapshot of image '{0}') is null, cannot remove it.", diskImage.getImageId()); } } getBaseDiskDao().remove(diskImage.getId()); getVmDeviceDAO().remove(new VmDeviceId(diskImage.getId(), null)); for (Snapshot s : updatedSnapshots) { getSnapshotDao().update(s); } return null; } }); }
Source:
public boolean isIntentToAdd() { return (getExtendedFlags() & INTENT_TO_ADD) == INTENT_TO_ADD; }

Target:
public boolean isIntentToAdd() { return (getExtendedFlags() & INTENT_TO_ADD) != 0; }
Source:
private static boolean insideCondition(SyntaxToken token) { Tree treeWithCondition = CheckUtils.getFirstAncestor(token, Kind.IF_STATEMENT, Kind.WHILE_STATEMENT, Kind.DO_WHILE_STATEMENT, Kind.FOR_STATEMENT, Kind.CONDITIONAL_EXPRESSION); Tree condition = condition(treeWithCondition); return condition != null && ((JavaScriptTree) condition).isAncestorOf((JavaScriptTree) token); }

Target:
private static boolean insideCondition(SyntaxToken token) { Tree treeWithCondition = CheckUtils.getFirstAncestor(token, Kind.IF_STATEMENT, Kind.WHILE_STATEMENT, Kind.DO_WHILE_STATEMENT, Kind.FOR_STATEMENT, Kind.CONDITIONAL_EXPRESSION); if (treeWithCondition == null) { return false; } Tree condition = condition(treeWithCondition); return condition != null && ((JavaScriptTree) condition).isAncestorOf((JavaScriptTree) token); }
Source:
private List<String> getCellValues(Row row) { List<String> values = new ArrayList<>(); for (Cell cell : row) { values.add(cell.getStringCellValue()); } return values; }

Target:
private List<String> getCellValues(Row row) { return Lists.newArrayList(Iterables.transform(row, Cell::getStringCellValue)); }
Source:
private boolean commitCursor(final String subscriptionId, final EventType eventType, final SubscriptionCursor cursor) throws ServiceUnavailableException, NoSuchSubscriptionException, InvalidCursorException { final String topic = eventType.getTopic(); final String offsetPath = format(PATH_ZK_OFFSET, subscriptionId, topic, cursor.getPartition()); try { @SuppressWarnings("unchecked") final Boolean committed = executeWithRetry(() -> { final Stat stat = new Stat(); final byte[] currentOffsetData = zkHolder.get() .getData() .storingStatIn(stat) .forPath(offsetPath); final String currentOffset = new String(currentOffsetData, Charsets.UTF_8); final NakadiCursor cursorToCommit = new NakadiCursor(topic, cursor.getPartition(), cursor.getOffset()); final NakadiCursor currentCursor = new NakadiCursor(topic, cursor.getPartition(), currentOffset); if (timelineService.getTopicRepository(eventType) .compareOffsets(cursorToCommit, currentCursor) > 0) { zkHolder.get() .setData() .withVersion(stat.getVersion()) .forPath(offsetPath, cursor.getOffset().getBytes(Charsets.UTF_8)); return true; } else { return false; } }, new RetryForSpecifiedCountStrategy<Boolean>(COMMIT_CONFLICT_RETRY_TIMES) .withExceptionsThatForceRetry(KeeperException.BadVersionException.class)); return Optional.ofNullable(committed).orElse(false); } catch (final IllegalArgumentException e) { throw new InvalidCursorException(CursorError.INVALID_FORMAT, cursor); } catch (final Exception e) { throw new ServiceUnavailableException(ERROR_COMMUNICATING_WITH_ZOOKEEPER, e); } }

Target:
private boolean commitCursor(final String subscriptionId, final EventType eventType, final SubscriptionCursor cursor) throws ServiceUnavailableException, NoSuchSubscriptionException, InvalidCursorException { final String topic = timelineService.getTimeline(eventType).getTopic(); final String offsetPath = format(PATH_ZK_OFFSET, subscriptionId, topic, cursor.getPartition()); try { @SuppressWarnings("unchecked") final Boolean committed = executeWithRetry(() -> { final Stat stat = new Stat(); final byte[] currentOffsetData = zkHolder.get() .getData() .storingStatIn(stat) .forPath(offsetPath); final String currentOffset = new String(currentOffsetData, Charsets.UTF_8); final NakadiCursor cursorToCommit = new NakadiCursor(topic, cursor.getPartition(), cursor.getOffset()); final NakadiCursor currentCursor = new NakadiCursor(topic, cursor.getPartition(), currentOffset); if (timelineService.getTopicRepository(eventType) .compareOffsets(cursorToCommit, currentCursor) > 0) { zkHolder.get() .setData() .withVersion(stat.getVersion()) .forPath(offsetPath, cursor.getOffset().getBytes(Charsets.UTF_8)); return true; } else { return false; } }, new RetryForSpecifiedCountStrategy<Boolean>(COMMIT_CONFLICT_RETRY_TIMES) .withExceptionsThatForceRetry(KeeperException.BadVersionException.class)); return Optional.ofNullable(committed).orElse(false); } catch (final IllegalArgumentException e) { throw new InvalidCursorException(CursorError.INVALID_FORMAT, cursor); } catch (final Exception e) { throw new ServiceUnavailableException(ERROR_COMMUNICATING_WITH_ZOOKEEPER, e); } }
Source:
private boolean isFromCurrentScope(VariableIdentifierTree variableIdentifierTree) { SyntaxToken variableToken = variableIdentifierTree.token(); Scope currentScope = scopes.peek(); return currentScope != null && currentScope.getSymbols(Symbol.Kind.VARIABLE).stream() .filter(symbol -> currentScope.equals(symbol.scope())) .flatMap(symbol -> symbol.usages().stream()) .anyMatch(variableToken::equals); }

Target:
private boolean isFromCurrentScope(VariableIdentifierTree variableIdentifierTree) { SyntaxToken variableToken = variableIdentifierTree.token(); Scope currentScope = scopes.peek(); return currentScope != null && currentScope.getSymbols(Symbol.Kind.VARIABLE).stream() .filter(symbol -> !(symbol.hasModifier("static") || symbol.hasModifier("global"))) .filter(symbol -> currentScope.equals(symbol.scope())) .flatMap(symbol -> symbol.usages().stream()) .anyMatch(variableToken::equals); }
Source:
public static String getAppHome() { String appHome = System.getenv("ORIENTEER_APP_HOME"); return Strings.isEmpty(appHome) ? "./" : appHome; }

Target:
public static String getAppHome() { String appHome = System.getenv(ENV_ORIENTEER_HOME); return Strings.isEmpty(appHome) ? "./" : appHome; }
Source:
private ReplChangeManager(Configuration conf) throws MetaException { try { if (!inited) { if (MetastoreConf.getBoolVar(conf, ConfVars.REPLCMENABLED)) { ReplChangeManager.enabled = true; ReplChangeManager.conf = conf; Path cmroot = new Path(MetastoreConf.getVar(conf, ConfVars.REPLCMDIR)); FileSystem cmFs = cmroot.getFileSystem(conf); if (!cmFs.exists(cmroot)) { cmFs.mkdirs(cmroot); cmFs.setPermission(cmroot, new FsPermission("700")); } cmRootMapping.put(NO_ENCRYPTION, cmroot); UserGroupInformation usergroupInfo = UserGroupInformation.getCurrentUser(); msUser = usergroupInfo.getShortUserName(); msGroup = usergroupInfo.getPrimaryGroupName(); } inited = true; } } catch (IOException e) { throw new MetaException(StringUtils.stringifyException(e)); } }

Target:
private ReplChangeManager(Configuration conf) throws MetaException { try { if (!inited) { if (MetastoreConf.getBoolVar(conf, ConfVars.REPLCMENABLED)) { ReplChangeManager.enabled = true; ReplChangeManager.conf = conf; cmRootDir = MetastoreConf.getVar(conf, ConfVars.REPLCMDIR); encryptedCmRootDir = MetastoreConf.getVar(conf, ConfVars.REPLCMENCRYPTEDDIR); fallbackNonEncryptedCmRootDir = MetastoreConf.getVar(conf, ConfVars.REPLCMFALLBACKNONENCRYPTEDDIR); Path cmroot = new Path(cmRootDir); createCmRoot(cmroot); FileSystem cmRootFs = cmroot.getFileSystem(conf); HdfsEncryptionShim pathEncryptionShim = hadoopShims .createHdfsEncryptionShim(cmRootFs, conf); Path cmRootEncrypted = new Path(encryptedCmRootDir); if (cmRootEncrypted.isAbsolute()) { throw new MetaException(ConfVars.REPLCMENCRYPTEDDIR.getHiveName() + " should be a relative path"); } if (pathEncryptionShim.isPathEncrypted(cmroot)) { String encryptionZonePath = cmRootFs.getUri() + pathEncryptionShim.getEncryptionZoneForPath(cmroot).getPath(); encryptionZones.put(encryptionZonePath, cmRootDir); } else { encryptionZones.put(NO_ENCRYPTION, cmRootDir); } UserGroupInformation usergroupInfo = UserGroupInformation.getCurrentUser(); msUser = usergroupInfo.getShortUserName(); msGroup = usergroupInfo.getPrimaryGroupName(); } inited = true; } } catch (IOException e) { throw new MetaException(StringUtils.stringifyException(e)); } }
Source:
public boolean validPdpAddress(String employeeId) { Person employee = findPerson(employeeId); boolean validPerson = validPerson(employee); boolean validAddress = validPerson; if (validPerson) { String state = employee.getAddressStateProvinceCodeUnmasked(); String country = employee.getAddressCountryCodeUnmasked(); if (StringUtils.isBlank(state) && StringUtils.isBlank(country)) { validAddress = false; LOG.error("validPdpAddress, " + employee.getName() + " does not have a Country Code or a State/Province code."); } else { if (LOG.isDebugEnabled()) { LOG.debug("validPdpAddress, The employee " + employee.getName() + " had a country code or state code." ); } } } return validAddress; }

Target:
public boolean validPdpAddress(String employeeId) { Person employee = findPerson(employeeId); boolean validPerson = validPerson(employee); boolean validAddress = validPerson; if (validPerson) { String state = employee.getAddressStateProvinceCodeUnmasked(); String country = employee.getAddressCountryCodeUnmasked(); if (StringUtils.isBlank(state) && StringUtils.isBlank(country)) { validAddress = false; LOG.error("validPdpAddress, " + employee.getName() + " does not have a Country Code or a State/Province code."); } else { if (LOG.isDebugEnabled()) { StringBuilder sb = new StringBuilder("validPdpAddress, The employee "); sb.append(employee.getName()).append(" has a valid PDP address. The state code was '").append(state); sb.append("' and the country code was '").append(country).append("'."); LOG.debug(sb.toString()); } } } return validAddress; }
Source:
protected Stream<ScheduledJob> allJobsWithEveryAnnotation() { return Arrays.stream(this.jobs) .filter(job -> job.getClass().isAnnotationPresent(Every.class)) .map(job -> { Class<? extends Job> clazz = job.getClass(); Every everyAnnotation = clazz.getAnnotation(Every.class); boolean requestRecovery = everyAnnotation.requestRecovery(); boolean storeDurably = everyAnnotation.storeDurably(); String value = everyAnnotation.value(); if (value.isEmpty() || value.matches("\\$\\{.*\\}")) { value = readDurationFromConfig(everyAnnotation, clazz, configuration); log.info(clazz + " is configured in the config file to run every " + value); } long milliSeconds = TimeParserUtil.parseDuration(value); SimpleScheduleBuilder scheduleBuilder = SimpleScheduleBuilder.simpleSchedule() .withIntervalInMilliseconds(milliSeconds); int repeatCount = everyAnnotation.repeatCount(); applyRepeatCount(repeatCount, scheduleBuilder); MisfirePolicy misfirePolicy = everyAnnotation.misfirePolicy(); applyMisfirePolicy(misfirePolicy, scheduleBuilder); DateTime start = extractStart(clazz); int priority = everyAnnotation.priority(); Trigger trigger = TriggerBuilder.newTrigger().withSchedule(scheduleBuilder) .startAt(start.toDate()) .withPriority(priority) .build(); JobKey jobKey = createJobKey(everyAnnotation.jobName(), job); String message = extractMessage(clazz, jobKey); return new ScheduledJob(jobKey, clazz, trigger, requestRecovery, storeDurably, message); }); }

Target:
protected Stream<ScheduledJob> allJobsWithEveryAnnotation() { return Arrays.stream(this.jobs) .filter(job -> job.getClass().isAnnotationPresent(Every.class)) .map(job -> { Class<? extends Job> clazz = job.getClass(); Every everyAnnotation = clazz.getAnnotation(Every.class); long interval = getInterval(clazz, everyAnnotation); SimpleScheduleBuilder scheduleBuilder = SimpleScheduleBuilder.simpleSchedule() .withIntervalInMilliseconds(interval); int repeatCount = everyAnnotation.repeatCount(); applyRepeatCount(repeatCount, scheduleBuilder); MisfirePolicy misfirePolicy = everyAnnotation.misfirePolicy(); applyMisfirePolicy(misfirePolicy, scheduleBuilder); DateTime start = extractStart(clazz); int priority = everyAnnotation.priority(); Trigger trigger = TriggerBuilder.newTrigger().withSchedule(scheduleBuilder) .startAt(start.toDate()) .withPriority(priority) .build(); JobKey jobKey = createJobKey(everyAnnotation.jobName(), job); String message = extractMessage(clazz, jobKey); boolean requestRecovery = everyAnnotation.requestRecovery(); boolean storeDurably = everyAnnotation.storeDurably(); return new ScheduledJob(jobKey, clazz, trigger, requestRecovery, storeDurably, message); }); }
Source:
private boolean isLastKilledQueryGone() { boolean lastKilledQueryIsGone = (lastKilledQuery == null); if (!lastKilledQueryIsGone) { ClusterMemoryPool generalPool = pools.get(GENERAL_POOL); if (generalPool != null) { lastKilledQueryIsGone = generalPool.getQueryMemoryReservations().containsKey(lastKilledQuery); } } return lastKilledQueryIsGone; }

Target:
private boolean isLastKilledQueryGone() { if (lastKilledQuery == null) { return true; } ClusterMemoryPool generalPool = pools.get(GENERAL_POOL); if (generalPool == null) { return false; } return generalPool.getQueryMemoryReservations().containsKey(lastKilledQuery); }
Source:
protected FeedbackSessionAttributes extractFeedbackSessionData() { FeedbackSessionAttributes newSession = new FeedbackSessionAttributes(); newSession.setCourseId(getRequestParamValue(Const.ParamsNames.COURSE_ID)); newSession.setFeedbackSessionName(SanitizationHelper.sanitizeTitle( getRequestParamValue(Const.ParamsNames.FEEDBACK_SESSION_NAME))); newSession.setFeedbackSessionType(FeedbackSessionType.STANDARD); newSession = setTime(newSession); String paramTimeZone = getRequestParamValue(Const.ParamsNames.FEEDBACK_SESSION_TIMEZONE); if (paramTimeZone != null) { try { newSession.setTimeZone(Double.parseDouble(paramTimeZone)); } catch (NumberFormatException nfe) { log.warning("Failed to parse time zone parameter: " + paramTimeZone); } } String paramGracePeriod = getRequestParamValue(Const.ParamsNames.FEEDBACK_SESSION_GRACEPERIOD); try { newSession.setGracePeriod(Integer.parseInt(paramGracePeriod)); } catch (NumberFormatException nfe) { log.warning("Failed to parse graced period parameter: " + paramGracePeriod); } String type = getRequestParamValue(Const.ParamsNames.FEEDBACK_SESSION_RESULTSVISIBLEBUTTON); newSession = setResultsVisibleFromTime(newSession, type); type = getRequestParamValue(Const.ParamsNames.FEEDBACK_SESSION_SESSIONVISIBLEBUTTON); newSession = setSessionVisibleFromTime(newSession, type); newSession = setEmail(newSession); return newSession; }

Target:
protected FeedbackSessionAttributes extractFeedbackSessionData() { FeedbackSessionAttributes newSession = new FeedbackSessionAttributes(); newSession.setCourseId(getRequestParamValue(Const.ParamsNames.COURSE_ID)); newSession.setFeedbackSessionName(SanitizationHelper.sanitizeTitle( getRequestParamValue(Const.ParamsNames.FEEDBACK_SESSION_NAME))); newSession.setFeedbackSessionType(FeedbackSessionType.STANDARD); setTime(newSession); setTimeZone(newSession); setGracePeriod(newSession); setResultsVisibleFromTime(newSession); setSessionVisibleFromTime(newSession); setEmail(newSession); return newSession; }
Source:
public Object visitReadWriteManyCommand(InvocationContext ctx, ReadWriteManyCommand command) throws Throwable { if (ctx.isOriginLocal()) { if (forceRemoteReadForFunctionalCommands && !command.hasAnyFlag(FlagBitSets.SKIP_XSITE_BACKUP)) { CompletableFuture<Void> cf = remoteGetAll(ctx, command, command.getAffectedKeys(), RemoteGetAllForWriteHandler.INSTANCE); if (cf == null) { return invokeNext(ctx, command); } else { return asyncInvokeNext(ctx, command, cf); } } else { return handleFunctionalReadManyCommand(ctx, command, readWriteManyHelper); } } else { return handleTxWriteManyCommand(ctx, command, command.getAffectedKeys(), readWriteManyHelper::copyForLocal); } }

Target:
public Object visitReadWriteManyCommand(InvocationContext ctx, ReadWriteManyCommand command) throws Throwable { if (ctx.isOriginLocal()) { if (forceRemoteReadForFunctionalCommands && !command.hasAnyFlag(FlagBitSets.SKIP_XSITE_BACKUP)) { CompletableFuture<Void> cf = remoteGetAll(ctx, command, command.getAffectedKeys(), RemoteGetAllForWriteHandler.INSTANCE); return asyncInvokeNext(ctx, command, cf); } else { return handleFunctionalReadManyCommand(ctx, command, readWriteManyHelper); } } else { return handleTxWriteManyCommand(ctx, command, command.getAffectedKeys(), readWriteManyHelper::copyForLocal); } }
Source:
public void display(OutputStream out) { final PrintWriter stdout; try { stdout = new PrintWriter(new BufferedWriter(new OutputStreamWriter(out, "UTF-8"))); } catch (UnsupportedEncodingException e) { throw new RuntimeException("JVM lacks UTF-8 encoding", e); } Map<String, PluginInfo> output = Maps.newTreeMap(); List<Plugin> plugins = pluginLoader.getPlugins(); Collections.sort(plugins, new Comparator<Plugin>() { @Override public int compare(Plugin a, Plugin b) { return a.getName().compareTo(b.getName()); } }); if (!format.isJson()) { stdout.format("%-30s %-10s\n", "Name", "Version"); stdout .print("----------------------------------------------------------------------\n"); } for (Plugin p : plugins) { PluginInfo info = new PluginInfo(); info.name = p.getName(); info.version = p.getVersion(); if (format.isJson()) { output.put(info.name, info); } else { stdout.format("%-30s %-10s\n", info.name, Strings.nullToEmpty(info.version)); } } if (format.isJson()) { format.newGson().toJson(output, new TypeToken<Map<String, PluginInfo>>() {}.getType(), stdout); stdout.print('\n'); } stdout.flush(); }

Target:
public void display(OutputStream out) { final PrintWriter stdout; try { stdout = new PrintWriter(new BufferedWriter(new OutputStreamWriter(out, "UTF-8"))); } catch (UnsupportedEncodingException e) { throw new RuntimeException("JVM lacks UTF-8 encoding", e); } Map<String, PluginInfo> output = Maps.newTreeMap(); List<Plugin> plugins = Lists.newArrayList(pluginLoader.getPlugins()); Collections.sort(plugins, new Comparator<Plugin>() { @Override public int compare(Plugin a, Plugin b) { return a.getName().compareTo(b.getName()); } }); if (!format.isJson()) { stdout.format("%-30s %-10s\n", "Name", "Version"); stdout .print("----------------------------------------------------------------------\n"); } for (Plugin p : plugins) { PluginInfo info = new PluginInfo(); info.version = p.getVersion(); if (format.isJson()) { output.put(p.getName(), info); } else { stdout.format("%-30s %-10s\n", p.getName(), Strings.nullToEmpty(info.version)); } } if (format.isJson()) { format.newGson().toJson(output, new TypeToken<Map<String, PluginInfo>>() {}.getType(), stdout); stdout.print('\n'); } stdout.flush(); }
Source:
public void saveFile() throws IOException { File file = new File("src/test/resources/metadata/testmetaOldFormat.xml"); testMetaOldFormat = FileLoader.readFileToByteArray(file); }

Target:
public void saveFile() throws IOException { File file = new File("src/test/resources/metadata/testmetaOldFormat.xml"); testMetaOldFormat = IOUtils.toByteArray(file.toURI()); }
Source:
PackageBinding addPackage(PackageBinding packageBinding, boolean checkForSplit) { if (packageBinding.isDeclaredIn(this)) { char[] packageName = packageBinding.readableName(); if (checkForSplit && this.environment.useModuleSystem) { char[][] declaringModuleNames = null; if (isUnnamed()) { IModuleAwareNameEnvironment moduleEnv = (IModuleAwareNameEnvironment) this.environment.nameEnvironment; declaringModuleNames = moduleEnv.getUniqueModulesDeclaringPackage(new char[][] {packageName}, ANY); } packageBinding = combineWithPackagesFromOtherRelevantModules(packageBinding, packageBinding.compoundName, declaringModuleNames); } this.declaredPackages.put(packageName, packageBinding.getVisibleFor(this, true, true )); if (packageBinding.parent == null) { this.environment.knownPackages.put(packageName, packageBinding); } } return packageBinding; }

Target:
PackageBinding addPackage(PackageBinding packageBinding, boolean checkForSplit) { if (packageBinding.isDeclaredIn(this)) { char[] packageName = packageBinding.readableName(); if (checkForSplit && this.environment.useModuleSystem) { char[][] declaringModuleNames = null; if (isUnnamed()) { IModuleAwareNameEnvironment moduleEnv = (IModuleAwareNameEnvironment) this.environment.nameEnvironment; declaringModuleNames = moduleEnv.getUniqueModulesDeclaringPackage(new char[][] {packageName}, ANY); } packageBinding = combineWithPackagesFromOtherRelevantModules(packageBinding, packageBinding.compoundName, declaringModuleNames); } this.declaredPackages.put(packageName, packageBinding.getIncarnation(this)); if (packageBinding.parent == null) { this.environment.knownPackages.put(packageName, packageBinding); } } return packageBinding; }
Source:
private boolean rollbackOtherTransaction(long startTs, TransactionService transactionService) { try { transactionService.putUnlessExists(startTs, TransactionConstants.FAILED_COMMIT_TS); transactionOutcomeMetrics.markRollbackOtherTransaction(); return true; } catch (KeyAlreadyExistsException e) { return false; } }

Target:
private boolean rollbackOtherTransaction(long startTs, TransactionService transactionService) { try { transactionService.putUnlessExists(startTs, TransactionConstants.FAILED_COMMIT_TS); transactionOutcomeMetrics.markRollbackOtherTransaction(); return true; } catch (KeyAlreadyExistsException e) { log.debug("This isn't a bug but it should be very infrequent. Two transactions tried to roll back someone" + " else's request with start: {}", SafeArg.of("startTs", startTs), new TransactionFailedRetriableException( "Two transactions tried to roll back someone else's request with start: " + startTs, e)); return false; } }
Source:
public void showError(CommandSender sender, Throwable throwable, String commandLabel) { sender.sendMessage(tl("errorWithMessage", throwable.getMessage())); if (ess.getSettings().isDebug()) { ess.getLogger().log(Level.INFO, tl("errorCallingCommand", commandLabel), throwable); throwable.printStackTrace(); } }

Target:
public void showError(CommandSender sender, Throwable throwable, String commandLabel) { sender.sendMessage(tl("errorWithMessage", throwable.getMessage())); if (ess.getSettings().isDebug()) { logger.log(Level.INFO, tl("errorCallingCommand", commandLabel), throwable); throwable.printStackTrace(); } }
Source:
private void maybeReasignAlias(Node assign) { String alias = null; for (Node child = assign.getFirstChild(); child != null; child = child.getFirstChild()) { if (child.isName()) { alias = child.getString(); } } if (aliasToProvidedNamespace.containsKey(alias)) { String providedNamespace = aliasToProvidedNamespace.get(alias); String suffix = assign.getFirstChild().getQualifiedName().substring(alias.length()); Node qName = NodeUtil.newQName(compiler, providedNamespace + suffix); assign.replaceChild(assign.getFirstChild(), qName); } }

Target:
private void maybeReasignAlias(Node assign) { String alias = null; for (Node child = assign.getFirstChild(); child != null; child = child.getFirstChild()) { if (child.isName()) { alias = child.getQualifiedName(); } } if (aliasToProvidedNamespace.containsKey(alias)) { String providedNamespace = aliasToProvidedNamespace.get(alias); String suffix = assign.getFirstChild().getQualifiedName().substring(alias.length()); Node qName = NodeUtil.newQName(compiler, providedNamespace + suffix); assign.replaceChild(assign.getFirstChild(), qName); } }
Source:
@Override public void run() throws InterruptedException { Row row; List values = new ArrayList(); while ((row = source.receive()) != null) { values.add(row.getValues()); } row = Row.of(ImmutableList.copyOf(values)); sink.send(row); }

Target:
@Override public void run() throws InterruptedException { Row row; List<Object[]> values = new ArrayList<>(); while ((row = source.receive()) != null) { values.add(row.getValues()); } row = Row.of(ImmutableList.copyOf(values)); sink.send(row); }
Source:
public Map<String, Set<DocumentReference>> updateAndSaveDocFromRequest( DocumentReference docRef) { Collection<XWikiDocument> xdocs = Collections.<XWikiDocument>emptyList(); try { xdocs = getDocFormCommand().updateDocFromMap(docRef, getContext().getRequest().getParameterMap(), getContext()); return saveXWikiDocCollection(xdocs); } catch (XWikiException xwe) { LOGGER.error("Exception in getDocFormCommand().updateDocFromMap()", xwe); } return Collections.emptyMap(); }

Target:
public Map<String, Set<DocumentReference>> updateAndSaveDocFromRequest( DocumentReference docRef) { Collection<XWikiDocument> xdocs = Collections.<XWikiDocument>emptyList(); try { xdocs = getDocFormCommand().updateDocFromMap(docRef, getContext().getRequest().getParameterMap(), getContext()); return checkRightsAndSaveXWikiDocCollection(xdocs); } catch (XWikiException xwe) { LOGGER.error("Exception in getDocFormCommand().updateDocFromMap()", xwe); } return Collections.emptyMap(); }
Source:
public void rvvLockedAfterKeysAreLockedAndUnlockRVVBeforeKeys() throws Exception { PutAllPRMessage message = spy(new PutAllPRMessage(bucketId, 1, false, false, false, null)); message.addEntry(entryData); doReturn(keys).when(message).getKeysToBeLocked(); when(bucketRegion.waitUntilLocked(keys)).thenReturn(true); when(bucketRegion.doLockForPrimary(false)).thenThrow(new PrimaryBucketException()); doNothing().when(bucketRegion).lockRVVForBulkOp(); doNothing().when(bucketRegion).unlockRVVForBulkOp(); InternalCache cache = mock(InternalCache.class); InternalDistributedSystem ids = mock(InternalDistributedSystem.class); when(bucketRegion.getCache()).thenReturn(cache); when(cache.getDistributedSystem()).thenReturn(ids); when(ids.getOffHeapStore()).thenReturn(null); try { message.doLocalPutAll(partitionedRegion, mock(InternalDistributedMember.class), 1); fail("Expect PrimaryBucketException"); } catch (Exception e) { assertThat(e instanceof PrimaryBucketException); } InOrder inOrder = inOrder(bucketRegion); inOrder.verify(bucketRegion).waitUntilLocked(keys); inOrder.verify(bucketRegion).lockRVVForBulkOp(); inOrder.verify(bucketRegion).unlockRVVForBulkOp(); inOrder.verify(bucketRegion).removeAndNotifyKeys(keys); }

Target:
public void rvvLockedAfterKeysAreLockedAndUnlockRVVBeforeKeys() throws Exception { PutAllPRMessage message = spy(new PutAllPRMessage(bucketId, 1, false, false, false, null)); message.addEntry(entryData); doReturn(keys).when(message).getKeysToBeLocked(); when(bucketRegion.waitUntilLocked(keys)).thenReturn(true); when(bucketRegion.doLockForPrimary(false)).thenThrow(new PrimaryBucketException()); doNothing().when(bucketRegion).lockRVVForBulkOp(); doNothing().when(bucketRegion).unlockRVVForBulkOp(); InternalCache cache = mock(InternalCache.class); InternalDistributedSystem ids = mock(InternalDistributedSystem.class); when(bucketRegion.getCache()).thenReturn(cache); when(cache.getDistributedSystem()).thenReturn(ids); when(ids.getOffHeapStore()).thenReturn(null); assertThatThrownBy( () -> message.doLocalPutAll(partitionedRegion, mock(InternalDistributedMember.class), 1)) .isInstanceOf(PrimaryBucketException.class); InOrder inOrder = inOrder(bucketRegion); inOrder.verify(bucketRegion).waitUntilLocked(keys); inOrder.verify(bucketRegion).lockRVVForBulkOp(); inOrder.verify(bucketRegion).unlockRVVForBulkOp(); inOrder.verify(bucketRegion).removeAndNotifyKeys(keys); }
Source:
public static ServiceRegistrar createServiceRegistrar(final Path path, final String address, final String domain) { final ServiceRegistrarFactory factory; if (path == null) { factory = createFactory(); } else { factory = createFactory(path); } if (address != null) { log.info("Creating service registrar with address: {}", address); return factory.create(address); } else if (domain != null && !domain.equals("")) { log.info("Creating service registrar for domain: {}", domain); return domain.equals("localhost") ? factory.create("tcp://localhost:4999") : factory.createForDomain(domain); } else { log.info("No address nor domain configured, not creating service registrar."); return new NopServiceRegistrar(); } }

Target:
public static ServiceRegistrar createServiceRegistrar(final Path path, final String address, final String domain) { final ServiceRegistrarFactory factory; if (path == null) { factory = createFactory(); } else { factory = createFactory(path); } if (address != null) { log.info("Creating service registrar with address: {}", address); return factory.create(address); } else if (!Strings.isNullOrEmpty(domain)) { log.info("Creating service registrar for domain: {}", domain); return domain.equals("localhost") ? factory.create("tcp://localhost:4999") : factory.createForDomain(domain); } else { log.info("No address nor domain configured, not creating service registrar."); return new NopServiceRegistrar(); } }
Source:
public void marshal(ITypeMarshalBuffer buffer) throws CoreException { short firstBytes = ITypeMarshalBuffer.ARRAY_TYPE; int flags= 0; long nval= -1; IValue val= null; if (isConst()) flags |= 0x01; if (isVolatile()) flags |= 0x02; if (isRestrict()) flags |= 0x04; if (isStatic()) flags |= 0x08; if (isVariableLength()) flags |= 0x10; if (flags != 0) { firstBytes |= ITypeMarshalBuffer.FLAG1; } val= getSize(); if (val != null) { firstBytes |= ITypeMarshalBuffer.FLAG2; Long num= val.numericalValue(); if (num != null) { nval= num; if (nval >= 0) { firstBytes |= ITypeMarshalBuffer.FLAG3; } } } buffer.putShort(firstBytes); if (flags != 0) { buffer.putByte((byte) flags); } if (nval >= 0) { buffer.putLong(nval); } else if (val != null) { buffer.marshalValue(val); } buffer.marshalType(getType()); }

Target:
public void marshal(ITypeMarshalBuffer buffer) throws CoreException { short firstBytes = ITypeMarshalBuffer.ARRAY_TYPE; long nval= -1; IValue val= null; if (isConst()) firstBytes |= ITypeMarshalBuffer.FLAG1; if (isVolatile()) firstBytes |= ITypeMarshalBuffer.FLAG2; if (isRestrict()) firstBytes |= ITypeMarshalBuffer.FLAG3; if (isStatic()) firstBytes |= ITypeMarshalBuffer.FLAG4; if (isVariableLength()) firstBytes |= ITypeMarshalBuffer.FLAG5; val= getSize(); if (val != null) { firstBytes |= ITypeMarshalBuffer.FLAG6; Long num= val.numericalValue(); if (num != null) { nval= num; if (nval >= 0) { firstBytes |= ITypeMarshalBuffer.FLAG7; } } } buffer.putShort(firstBytes); if (nval >= 0) { buffer.putLong(nval); } else if (val != null) { buffer.marshalValue(val); } buffer.marshalType(getType()); }
Source:
public static <T extends Cborable> Pair<FragmentedPaddedCipherText, List<FragmentWithHash>> build(SymmetricKey from, T secret, int paddingBlockSize, int maxFragmentSize, Hasher hasher) { if (paddingBlockSize < 1) throw new IllegalStateException("Invalid padding block size: " + paddingBlockSize); byte[] nonce = from.createNonce(); byte[] cipherText = from.encrypt(pad(secret.serialize(), paddingBlockSize), nonce); if (cipherText.length <= 4096 + TweetNaCl.SECRETBOX_OVERHEAD_BYTES) { FragmentWithHash frag = new FragmentWithHash(new Fragment(cipherText), hasher.identityHash(cipherText, true)); return new Pair<>(new FragmentedPaddedCipherText(nonce, Collections.singletonList(frag.hash)), Collections.singletonList(frag)); } byte[][] split = split(cipherText, maxFragmentSize); List<FragmentWithHash> frags = Arrays.asList(split).stream() .map(d -> new FragmentWithHash(new Fragment(d), hasher.hash(d, true))) .collect(Collectors.toList()); List<Multihash> hashes = frags.stream() .map(f -> f.hash) .collect(Collectors.toList()); return new Pair<>(new FragmentedPaddedCipherText(nonce, hashes), frags); }

Target:
public static <T extends Cborable> Pair<FragmentedPaddedCipherText, List<FragmentWithHash>> build(SymmetricKey from, T secret, int paddingBlockSize, int maxFragmentSize, Hasher hasher) { if (paddingBlockSize < 1) throw new IllegalStateException("Invalid padding block size: " + paddingBlockSize); byte[] nonce = from.createNonce(); byte[] cipherText = from.encrypt(pad(secret.serialize(), paddingBlockSize), nonce); if (cipherText.length <= 4096 + TweetNaCl.SECRETBOX_OVERHEAD_BYTES) { FragmentWithHash frag = new FragmentWithHash(new Fragment(cipherText), hasher.identityHash(cipherText, true)); return new Pair<>(new FragmentedPaddedCipherText(nonce, Collections.singletonList(frag.hash)), Collections.singletonList(frag)); } byte[][] split = split(cipherText, maxFragmentSize); List<FragmentWithHash> frags = Arrays.stream(split) .map(d -> new FragmentWithHash(new Fragment(d), hasher.hash(d, true))) .collect(Collectors.toList()); List<Multihash> hashes = frags.stream() .map(f -> f.hash) .collect(Collectors.toList()); return new Pair<>(new FragmentedPaddedCipherText(nonce, hashes), frags); }
Source:
public void handle(ExecutionContext context) { NotFound reportMessage = new NotFound(System.currentTimeMillis()); reportMessage.setRequestId(context.request().id()); reportMessage.setClientRequest(new io.gravitee.reporter.api.common.Request()); reportMessage.getClientRequest().setMethod(context.request().method()); reportMessage.getClientRequest().setUri(context.request().uri()); reportMessage.getClientRequest().setHeaders(new HttpHeaders(context.request().headers())); reporterService.report(reportMessage); next.handle(context); }

Target:
public void handle(ExecutionContext context) { Metrics metrics = context.request().metrics(); metrics.setApi(UNKNOWN_SERVICE); metrics.setApplication(UNKNOWN_SERVICE); if (logEnabled) { Buffer payload = Buffer.buffer(); context.request().bodyHandler(payload::appendBuffer).endHandler(aVoid -> { Log log = new Log(System.currentTimeMillis()); log.setRequestId(context.request().id()); log.setClientRequest(new io.gravitee.reporter.api.common.Request()); log.getClientRequest().setMethod(context.request().method()); log.getClientRequest().setUri(context.request().uri()); log.getClientRequest().setHeaders(new HttpHeaders(context.request().headers())); log.getClientRequest().setBody(payload.toString()); metrics.setLog(log); reporterService.report(metrics); next.handle(context); }); } else { reporterService.report(metrics); next.handle(context); } }
Source:
public void testOnSwitch() throws Exception { final Diagram diagram = mock(Diagram.class); final String defSetId = "defSetId"; final String shapeDefId = "shapeDefId"; tested.onSwitch(diagram, defSetId, shapeDefId); verify(view, times(1)).showLoading(); verify(view, times(1)).hideBusyIndicator(); verify(sessionEditorPresenter, times(1)).destroy(); verify(sessionEditorPresenter, times(1)).open(any(ProjectDiagram.class), any(SessionPresenter.SessionPresenterCallback.class)); }

Target:
public void testOnSwitch() { final Diagram diagram = mock(Diagram.class); final String defSetId = "defSetId"; final String shapeDefId = "shapeDefId"; tested.onSwitch(diagram, defSetId, shapeDefId); verify(view, times(1)).showLoading(); verify(view, times(1)).hideBusyIndicator(); verify(sessionEditorPresenter, times(1)).destroy(); verify(sessionEditorPresenter, times(1)).open(any(ProjectDiagram.class), any(SessionPresenter.SessionPresenterCallback.class)); }
Source:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ArcGISScene scene = new ArcGISScene(); scene.setBasemap(Basemap.createNationalGeographic()); mSceneView = findViewById(R.id.sceneView); mSceneView.setScene(scene); final Surface surface = new Surface(); ArcGISTiledElevationSource elevationSource = new ArcGISTiledElevationSource( getString(R.string.elevation_image_service)); surface.getElevationSources().add(elevationSource); scene.setBaseSurface(surface); Point initialLocation = new Point(-119.94891542688772, 46.75792111605992, 3183, mSceneView.getSpatialReference()); Camera camera = new Camera(initialLocation, 0, 7, 70, 0); mSceneView.setViewpointCamera(camera); mExaggerationValueText = findViewById(R.id.exaggerationSeekBarValueText); final SeekBar mExaggerationSeekBar = findViewById(R.id.exaggerationSeekBar); mExaggerationSeekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { @Override public void onProgressChanged(SeekBar seekBar, int progress, boolean b) { mExaggerationValueText.setText(String.valueOf((float) progress)); surface.setElevationExaggeration((float) progress); } @Override public void onStartTrackingTouch(SeekBar seekBar) { } @Override public void onStopTrackingTouch(SeekBar seekBar) { } }); }

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mSceneView = findViewById(R.id.sceneView); ArcGISScene scene = new ArcGISScene(Basemap.Type.NATIONAL_GEOGRAPHIC); mSceneView.setScene(scene); final Surface surface = new Surface(); ArcGISTiledElevationSource elevationSource = new ArcGISTiledElevationSource(getString(R.string.elevation_image_service_url)); surface.getElevationSources().add(elevationSource); scene.setBaseSurface(surface); Point initialLocation = new Point(-119.94891542688772, 46.75792111605992, 3183, mSceneView.getSpatialReference()); Camera camera = new Camera(initialLocation, 0, 7, 70, 0); mSceneView.setViewpointCamera(camera); final TextView exaggerationTextView = findViewById(R.id.exaggerationValueTextView); final SeekBar exaggerationSeekBar = findViewById(R.id.exaggerationSeekBar); exaggerationSeekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { @Override public void onProgressChanged(SeekBar seekBar, int progress, boolean b) { exaggerationTextView.setText(String.valueOf(progress)); surface.setElevationExaggeration(progress); } @Override public void onStartTrackingTouch(SeekBar seekBar) { } @Override public void onStopTrackingTouch(SeekBar seekBar) { } }); }
Source:
public ITmfTrace getTraceAsStub2() { ITmfTrace trace = null; final URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(fDirectory + File.separator + fPath), null); try { File test = new File(FileLocator.toFileURL(location).toURI()); trace = new TmfTraceStub2(test.toURI().getPath(), ITmfTrace.DEFAULT_TRACE_CACHE_SIZE, false, null); TmfSignalManager.deregister(trace); } catch (URISyntaxException e) { throw new RuntimeException(e); } catch (IOException e) { throw new RuntimeException(e); } catch (TmfTraceException e) { throw new RuntimeException(e); } return trace; }

Target:
public ITmfTrace getTraceAsStub2() { ITmfTrace trace = null; final URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(fDirectory + File.separator + fPath), null); try { File test = new File(FileLocator.toFileURL(location).toURI()); trace = new TmfTraceStub2(test.toURI().getPath(), ITmfTrace.DEFAULT_TRACE_CACHE_SIZE, false, null); TmfSignalManager.deregister(trace); } catch (URISyntaxException | IOException | TmfTraceException e) { throw new IllegalStateException(e); } return trace; }
Source:
private Builder(MetricRegistry registry) { this.registry = registry; this.clock = Clock.defaultClock(); this.prefix = null; this.rateUnit = TimeUnit.SECONDS; this.durationUnit = TimeUnit.MILLISECONDS; this.filter = MetricFilter.ALL; this.disabledMetricTypes = Collections.emptySet(); }

Target:
private Builder(MetricRegistry registry) { this.registry = registry; this.clock = Clock.defaultClock(); this.prefix = null; this.rateUnit = TimeUnit.SECONDS; this.durationUnit = TimeUnit.MILLISECONDS; this.filter = MetricFilter.ALL; this.disabledMetricTypes = EnumSet.noneOf(MetricTypes.class); }
Source:
private Object getLock(ObjectName objectName) { if (locks.get(objectName) == null) { locks.putIfAbsent(objectName, new Object()); } return locks.get(objectName); }

Target:
private Object getLock(ObjectName objectName) { return locks.computeIfAbsent(objectName, k -> new Object()); }
Source:
ConstantPool(DataInput data) throws IOException { super(); int count = data.readUnsignedShort(); types = new byte[count]; values = new Object[count]; for (int i = 1; i < count; i++) { byte type = data.readByte(); types[i] = type; switch (type) { case UTF8 : values[i] = data.readUTF(); break; case INTEGER : case FIELDREF : case METHODREF : case INTERFACEMETHODREF : case NAMEANDTYPE : values[i] = data.readInt(); break; case FLOAT : values[i] = data.readFloat(); break; case LONG : values[i] = data.readLong(); ++i; break; case DOUBLE : values[i] = data.readDouble(); ++i; break; case CLASS : case STRING : values[i] = data.readUnsignedShort(); break; case UNUSED : default: } } }

Target:
ConstantPool(DataInput data) throws IOException { super(); int count = data.readUnsignedShort(); types = new byte[count]; values = new Object[count]; for (int i = 1; i < count; i++) { byte type = data.readByte(); types[i] = type; switch (type) { case UTF8 : values[i] = data.readUTF(); break; case UNUSED : break; case INTEGER : case FIELDREF : case METHODREF : case INTERFACEMETHODREF : case NAMEANDTYPE : values[i] = data.readInt(); break; case FLOAT : values[i] = data.readFloat(); break; case LONG : values[i] = data.readLong(); ++i; break; case DOUBLE : values[i] = data.readDouble(); ++i; break; case CLASS : case STRING : values[i] = data.readUnsignedShort(); break; default: } } }
Source:
public static Namespace of(String... values) { List<String> list = Lists.newArrayList(values); return new Namespace(list); }

Target:
public static Namespace of(String... values) { return of(Lists.newArrayList(values)); }
Source:
public long getTimeUntilNextRun() { long now = timeProvider.getTime(); List<Requester> dueRequesters = getDueRequesters(now); if (dueRequesters.isEmpty()) { return WAKEUP_INTERVAL_MILLIS; } else { if (logger.isTraceEnabled()) { Requester nextDueRequester = dueRequesters.get(0); logger.trace(hashCode() + ": Next nack is scheduled for ssrc " + nextDueRequester.ssrc + " at " + Math.max(nextDueRequester.nextRequestAt, 0) + ". (current time is " + now + ")"); } return Math.max(dueRequesters.get(0).nextRequestAt - now, 0); } }

Target:
public long getTimeUntilNextRun() { long now = timeProvider.currentTimeMillis(); Requester nextDueRequester = getNextDueRequester(); if (nextDueRequester == null) { return WAKEUP_INTERVAL_MILLIS; } else { if (logger.isTraceEnabled()) { logger.trace(hashCode() + ": Next nack is scheduled for ssrc " + nextDueRequester.ssrc + " at " + Math.max(nextDueRequester.nextRequestAt, 0) + ". (current time is " + now + ")"); } return Math.max(nextDueRequester.nextRequestAt - now, 0); } }
Source:
long windowProc (long hwnd, int msg, long wParam, long lParam) { if (handle == 0) return 0; if (hwnd == toolTipHandle || hwnd == balloonTipHandle || hwnd == menuItemToolTipHandle) { switch (msg) { case OS.WM_TIMER: { if (wParam != ToolTip.TIMER_ID) break; ToolTip tip = getCurrentToolTip (hwnd); if (tip != null && tip.autoHide) { tip.setVisible (false); } break; } case OS.WM_LBUTTONDOWN: { ToolTip tip = getCurrentToolTip (hwnd); if (tip != null) { tip.setVisible (false); tip.sendSelectionEvent (SWT.Selection); } break; } } return callWindowProc (hwnd, msg, wParam, lParam); } return super.windowProc (hwnd, msg, wParam, lParam); }

Target:
long windowProc (long hwnd, int msg, long wParam, long lParam) { if (handle == 0) return 0; if((style & SWT.NO_MOVE) != 0 && msg == OS.WM_NCLBUTTONDOWN && wParam == OS.HTCAPTION) return 0; if (hwnd == toolTipHandle || hwnd == balloonTipHandle || hwnd == menuItemToolTipHandle) { switch (msg) { case OS.WM_TIMER: { if (wParam != ToolTip.TIMER_ID) break; ToolTip tip = getCurrentToolTip (hwnd); if (tip != null && tip.autoHide) { tip.setVisible (false); } break; } case OS.WM_LBUTTONDOWN: { ToolTip tip = getCurrentToolTip (hwnd); if (tip != null) { tip.setVisible (false); tip.sendSelectionEvent (SWT.Selection); } break; } } return callWindowProc (hwnd, msg, wParam, lParam); } return super.windowProc (hwnd, msg, wParam, lParam); }
Source:
private boolean canUpdateCompatibilityVersionOrCpu() { allForCluster = vdsDao.getAllForCluster(oldCluster.getId()); List<VDS> upVdss = allForCluster.stream() .filter(v -> v.getStatus() == VDSStatus.Up) .collect(Collectors.toList()); boolean valid = true; String lowerVersionHosts = ""; String lowCpuHosts = ""; String incompatibleEmulatedMachineHosts = ""; for (VDS vds : upVdss) { if (!VersionSupport.checkClusterVersionSupported( getCluster().getCompatibilityVersion(), vds)) { valid = false; lowerVersionHosts = lowerVersionHosts.concat(vds.getName() + ", "); } if (getCluster().supportsVirtService() && missingServerCpuFlags(vds) != null) { valid = false; lowCpuHosts = lowCpuHosts.concat(vds.getName() + ", "); } if (!isSupportedEmulatedMachinesMatchClusterLevel(vds)) { valid = false; incompatibleEmulatedMachineHosts = incompatibleEmulatedMachineHosts.concat(vds.getName() + ", "); } } if (!lowerVersionHosts.isEmpty()) { addValidationVarAndMessage("host", lowerVersionHosts, EngineMessage.CLUSTER_CANNOT_UPDATE_COMPATIBILITY_VERSION_WITH_LOWER_HOSTS); } if (!lowCpuHosts.isEmpty()) { addValidationVarAndMessage("host", lowCpuHosts, EngineMessage.CLUSTER_CANNOT_UPDATE_CPU_WITH_LOWER_HOSTS); } if (!lowerVersionHosts.isEmpty()) { addValidationVarAndMessage("host", lowerVersionHosts, EngineMessage.CLUSTER_CANNOT_UPDATE_COMPATIBILITY_VERSION_WITH_INCOMPATIBLE_EMULATED_MACHINE); } return valid; }

Target:
private boolean canUpdateCompatibilityVersionOrCpu() { allForCluster = vdsDao.getAllForCluster(oldCluster.getId()); List<VDS> upVdss = allForCluster.stream() .filter(v -> v.getStatus() == VDSStatus.Up) .collect(Collectors.toList()); boolean valid = true; String lowerVersionHosts = ""; String lowCpuHosts = ""; String incompatibleEmulatedMachineHosts = ""; for (VDS vds : upVdss) { if (!VersionSupport.checkClusterVersionSupported( getCluster().getCompatibilityVersion(), vds)) { valid = false; lowerVersionHosts = lowerVersionHosts.concat(vds.getName() + ", "); } if (getCluster().supportsVirtService() && missingServerCpuFlags(vds) != null) { valid = false; lowCpuHosts = lowCpuHosts.concat(vds.getName() + ", "); } if (!isSupportedEmulatedMachinesMatchClusterLevel(vds)) { valid = false; incompatibleEmulatedMachineHosts = incompatibleEmulatedMachineHosts.concat(vds.getName() + ", "); } } if (!lowerVersionHosts.isEmpty()) { addValidationVarAndMessage("host", lowerVersionHosts.replaceAll(", $", ""), EngineMessage.CLUSTER_CANNOT_UPDATE_COMPATIBILITY_VERSION_WITH_LOWER_HOSTS); } if (!lowCpuHosts.isEmpty()) { addValidationVarAndMessage("host", lowCpuHosts.replaceAll(", $", ""), EngineMessage.CLUSTER_CANNOT_UPDATE_CPU_WITH_LOWER_HOSTS); } if (!incompatibleEmulatedMachineHosts.isEmpty()) { addValidationVarAndMessage("host", incompatibleEmulatedMachineHosts.replaceAll(", $", ""), EngineMessage.CLUSTER_CANNOT_UPDATE_COMPATIBILITY_VERSION_WITH_INCOMPATIBLE_EMULATED_MACHINE); } return valid; }