auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public static boolean findFiles(ModContainer mod, String base, Function<Path, Boolean> preprocessor, BiFunction<Path, Path, Boolean> processor, boolean defaultUnfoundRoot) { FileSystem fs = null; try { File source = mod.getSource(); if ("minecraft".equals(mod.getModId())) { if (!DEBUG_LOAD_MINECRAFT) return true; try { URI tmp = CraftingManager.class.getResource("/assets/.mcassetsroot").toURI(); source = new File(tmp.resolve("..").getPath()); } catch (URISyntaxException e) { FMLLog.log.error("Error finding Minecraft jar: ", e); return false; } } Path root = null; if (source.isFile()) { try { fs = FileSystems.newFileSystem(source.toPath(), null); root = fs.getPath("/" + base); } catch (IOException e) { FMLLog.log.error("Error loading FileSystem from jar: ", e); return false; } } else if (source.isDirectory()) { root = source.toPath().resolve(base); } if (root == null || !Files.exists(root)) return defaultUnfoundRoot; if (preprocessor != null) { Boolean cont = preprocessor.apply(root); if (cont == null || !cont.booleanValue()) return false; } boolean success = true; if (processor != null) { Iterator<Path> itr = null; try { itr = Files.walk(root).iterator(); } catch (IOException e) { FMLLog.log.error("Error iterating filesystem for: {}", mod.getModId(), e); return false; } while (itr != null && itr.hasNext()) { Boolean ret = processor.apply(root, itr.next()); success &= ret == null ? false : ret; } } return success; } finally { IOUtils.closeQuietly(fs); } }

Target:
public static boolean findFiles(ModContainer mod, String base, Function<Path, Boolean> preprocessor, BiFunction<Path, Path, Boolean> processor, boolean defaultUnfoundRoot) { return findFiles(mod, base, preprocessor, processor, defaultUnfoundRoot, false); }
Source:
public Iterable<VMHardware> listHardwareProfiles() { final List<VMHardware> hwProfiles = Lists.newArrayList(); final List<String> locationIds = Lists.newArrayList(); Iterable<Location> locations = listLocations(); for (Location location : locations){ locationIds.add(location.name()); VMHardware hwProfile = new VMHardware(); hwProfile.name = "Standard_A5"; hwProfile.numberOfCores = 2; hwProfile.osDiskSizeInMB = 1047552; hwProfile.resourceDiskSizeInMB = 138240; hwProfile.memoryInMB = 14336; hwProfile.maxDataDiskCount = 4; hwProfile.location = "westus"; hwProfiles.add(hwProfile); } checkAndSetHwAvailability(hwProfiles, Sets.newHashSet(locationIds)); return hwProfiles; }

Target:
public Iterable<VMHardware> listHardwareProfiles() { final List<VMHardware> hwProfiles = Lists.newArrayList(); final List<String> locationIds = Lists.newArrayList(); Iterable<Location> locations = listLocations(); for (Location location : locations){ locationIds.add(location.name()); Iterable<VMSize> vmSizes = api.getVMSizeApi(location.name()).list(); for (VMSize vmSize : vmSizes){ VMHardware hwProfile = VMHardware.create( vmSize.name(), vmSize.numberOfCores(), vmSize.osDiskSizeInMB(), vmSize.resourceDiskSizeInMB(), vmSize.memoryInMB(), vmSize.maxDataDiskCount(), location.name(), false); hwProfiles.add(hwProfile); } } checkAndSetHwAvailability(hwProfiles, Sets.newHashSet(locationIds)); return hwProfiles; }
Source:
public <T> T instanceFor(Class<T> type) { type = (Class<T>) Proxies.extractRawType(type); logger.debug("asking cdi to get instance for {}", type); Bean<?> bean = getBeanFrom(type); CreationalContext<?> ctx = beanManager.createCreationalContext(bean); return (T) beanManager.getReference(bean, type, ctx); }

Target:
public <T> T instanceFor(Class<T> type) { Bean<?> bean = getBeanFrom(type); CreationalContext<?> ctx = beanManager.createCreationalContext(bean); return (T) beanManager.getReference(bean, type, ctx); }
Source:
public static Topology getTopology() { final StreamsBuilder streamsBuilder = new StreamsBuilder(); final KTable<Integer, Article> articles = streamsBuilder.table(ARTICLE_SOURCE, Consumed.with(intSerde, new Article.ArticleSerde())); final KTable<Integer, Comment> comments = streamsBuilder.table(COMMENT_SOURCE, Consumed.with(intSerde, new Comment.CommentSerde())); final KTable<Integer, Long> commentCounts = comments.groupBy((key, value) -> new KeyValue<>(value.getArticleId(), (short) 1), Grouped.with(Serdes.Integer(), Serdes.Short())) .count(); final ValueJoiner<Article, Long, AugmentedArticle> fkJoiner = (article, commentCount) -> new AugmentedArticle( article.getKey(), article.getTimestamp(), article.getText(), commentCount == null ? 0 : commentCount ); articles .leftJoin(commentCounts, fkJoiner, Materialized.with(null, new AugmentedArticle.AugmentedArticleSerde())) .toStream() .to(ARTICLE_RESULT_SINK); comments.join(articles, Comment::getArticleId, AugmentedComment.joiner(), Materialized.with(null, new AugmentedComment.AugmentedCommentSerde())) .toStream() .to(COMMENT_RESULT_SINK); return streamsBuilder.build(); }

Target:
public static Topology getTopology() { final StreamsBuilder streamsBuilder = new StreamsBuilder(); final KTable<Integer, Article> articles = streamsBuilder.table(ARTICLE_SOURCE, Consumed.with(intSerde, new Article.ArticleSerde())); final KTable<Integer, Comment> comments = streamsBuilder.table(COMMENT_SOURCE, Consumed.with(intSerde, new Comment.CommentSerde())); final KTable<Integer, Long> commentCounts = comments.groupBy((key, value) -> new KeyValue<>(value.getArticleId(), (short) 1), Grouped.with(Serdes.Integer(), Serdes.Short())) .count(); articles .leftJoin(commentCounts, AugmentedArticle.joiner(), Materialized.with(null, new AugmentedArticle.AugmentedArticleSerde())) .toStream() .to(ARTICLE_RESULT_SINK); comments.join(articles, Comment::getArticleId, AugmentedComment.joiner(), Materialized.with(null, new AugmentedComment.AugmentedCommentSerde())) .toStream() .to(COMMENT_RESULT_SINK); return streamsBuilder.build(); }
Source:
public void setDomains(ArrayList<VDSDomainsData> domains) { if (domains != null && this.domains == null) { log.info("received first domain report for host {}", cachedVds.getName()); } this.domains = domains; }

Target:
public void setDomains(ArrayList<VDSDomainsData> domains) { if (domains != null && this.domains == null) { log.info("Received first domain report for host {}", cachedVds.getName()); } this.domains = domains; }
Source:
public CreateRequest processPreCreate(CreateRequest input) throws StopProcessingException { ddf.security.Subject subject = setSubjectOnRequestProperties(input); if (input.getMetacards() != null && subject != null) { input .getMetacards() .forEach( metacard -> { String emailAddress = SubjectUtils.getEmailAddress(subject); if ((metacard.getTags().isEmpty() || metacard.getTags().contains("resource")) && StringUtils.isNotBlank(emailAddress)) { metacard.setAttribute(new AttributeImpl(Metacard.POINT_OF_CONTACT, emailAddress)); } }); } return input; }

Target:
public CreateRequest processPreCreate(CreateRequest input) throws StopProcessingException { ddf.security.Subject subject = setSubjectOnRequestProperties(input); if (input.getMetacards() != null && subject != null) { input .getMetacards() .forEach( metacard -> { String id = subjectIdentity.getUniqueIdentifier(subject); if ((metacard.getTags().isEmpty() || metacard.getTags().contains("resource")) && StringUtils.isNotBlank(id)) { metacard.setAttribute(new AttributeImpl(Metacard.POINT_OF_CONTACT, id)); } }); } return input; }
Source:
public static <T> Flowable<T> fromCompletionStage(@NonNull CompletionStage<T> stage) { ObjectHelper.requireNonNull(stage, "stage is null"); return RxJavaPlugins.onAssembly(new FlowableFromCompletionStage<>(stage)); }

Target:
public static <T> Flowable<@NonNull T> fromCompletionStage(@NonNull CompletionStage<T> stage) { ObjectHelper.requireNonNull(stage, "stage is null"); return RxJavaPlugins.onAssembly(new FlowableFromCompletionStage<>(stage)); }
Source:
public Date fromString(String value) { if (!StringUtils.isBlank(value)) { if (DateFormat.NOW.equals(value)) { return new Date(); } if (this.formats != null && this.formats.length > 0) { for (String format : this.formats) { try { SimpleDateFormat formatter = new SimpleDateFormat(format); return formatter.parse(value); } catch (ParseException exception) { } } String message = "Unable to parse date parameter: " + value; throw new RuntimeException(message); } else { try { return DatatypeConverter.parseDateTime(value).getTime(); } catch (IllegalArgumentException exception) { String message = "Unable to parse date parameter; must use ISO 8601 format: " + value; throw new RuntimeException(message); } } } return null; }

Target:
public Date fromString(String value) { if (!StringUtils.isBlank(value)) { if (DateFormat.NOW.equals(value)) { return new Date(); } if (this.formats != null && this.formats.length > 0) { for (String format : this.formats) { log.debug("Attempting to parse date \"{}\" using format: {}", value, format); try { SimpleDateFormat formatter = new SimpleDateFormat(format); return formatter.parse(value); } catch (ParseException exception) { log.debug("Unable to parse date \"{}\" with format {}", value, format, exception); } } log.debug("Unable to parse date: {}", value); throw new RuntimeException(I18n.marktr("Unable to parse date parameter")); } else { try { log.debug("Attempting to parse date \"{}\" using ISO8601 date converter", value); return DatatypeConverter.parseDateTime(value).getTime(); } catch (IllegalArgumentException exception) { log.debug("Unable to parse date \"{}\" using ISO8601 date converter", value, exception); throw new RuntimeException(I18n.marktr("Unable to parse date parameter")); } } } return null; }
Source:
public Collection<ConfiguredBundle<T>> getConfiguredBundles() { return new ArrayList<>(); }

Target:
public Iterable<ConfiguredBundle<T>> getConfiguredBundles() { return Collections.emptyList(); }
Source:
public void postRun() throws Exception { AuthType authType = flags.cfg.getEnum(AuthType.values(), "auth", null, "type", null); if (!AuthType.DEVELOPMENT_BECOME_ANY_ACCOUNT.equals(authType)) { return; } ui.header("Gerrit Administrator"); ReviewDb db = dbFactory.open(); try { if (db.accounts().anyAccounts().toList().isEmpty() && ui.yesno(true, "Create administrator user")) { Account.Id id = new Account.Id(db.nextAccountId()); String username = ui.readString("admin", "username"); String name = ui.readString("Administrator", "name"); String email = readEmail(); String httpPassword = ui.readString("secret", "HTTP password"); AccountExternalId extUser = new AccountExternalId(id, new AccountExternalId.Key( AccountExternalId.SCHEME_USERNAME, username)); if (!Strings.isNullOrEmpty(httpPassword)) { extUser.setPassword(httpPassword); } db.accountExternalIds().insert(Collections.singleton(extUser)); if (email != null) { AccountExternalId extMailto = new AccountExternalId(id, new AccountExternalId.Key( AccountExternalId.SCHEME_MAILTO, email)); extMailto.setEmailAddress(email); db.accountExternalIds().insert(Collections.singleton(extMailto)); } Account a = new Account(id, TimeUtil.nowTs()); a.setFullName(name); a.setPreferredEmail(email); db.accounts().insert(Collections.singleton(a)); AccountGroupMember m = new AccountGroupMember(new AccountGroupMember.Key(id, new AccountGroup.Id(1))); db.accountGroupMembers().insert(Collections.singleton(m)); } } finally { db.close(); } }

Target:
public void postRun() throws Exception { AuthType authType = flags.cfg.getEnum(AuthType.values(), "auth", null, "type", null); if (authType != AuthType.DEVELOPMENT_BECOME_ANY_ACCOUNT) { return; } ui.header("Gerrit Administrator"); ReviewDb db = dbFactory.open(); try { if (db.accounts().anyAccounts().toList().isEmpty() && ui.yesno(true, "Create administrator user")) { Account.Id id = new Account.Id(db.nextAccountId()); String username = ui.readString("admin", "username"); String name = ui.readString("Administrator", "name"); String email = readEmail(); String httpPassword = ui.readString("secret", "HTTP password"); AccountExternalId extUser = new AccountExternalId(id, new AccountExternalId.Key( AccountExternalId.SCHEME_USERNAME, username)); if (!Strings.isNullOrEmpty(httpPassword)) { extUser.setPassword(httpPassword); } db.accountExternalIds().insert(Collections.singleton(extUser)); if (email != null) { AccountExternalId extMailto = new AccountExternalId(id, new AccountExternalId.Key( AccountExternalId.SCHEME_MAILTO, email)); extMailto.setEmailAddress(email); db.accountExternalIds().insert(Collections.singleton(extMailto)); } Account a = new Account(id, TimeUtil.nowTs()); a.setFullName(name); a.setPreferredEmail(email); db.accounts().insert(Collections.singleton(a)); AccountGroupMember m = new AccountGroupMember(new AccountGroupMember.Key(id, new AccountGroup.Id(1))); db.accountGroupMembers().insert(Collections.singleton(m)); } } finally { db.close(); } }
Source:
public void emptyValueListOnColumnShouldNotCountAsAnEnum() throws Exception { analyzerProvider.getFactTypes().add(new FactTypes.FactType("Data", new HashSet<FactTypes.Field>() {{ add(new FactTypes.Field("totalAmount", org.drools.verifier.core.index.model.DataType.TYPE_NUMERIC_FLOAT)); }})); final String xml = loadResource("DROOLS-5059.gdst"); final Analyzer analyzer = analyzerProvider.makeAnalyser(GuidedDTXMLPersistence.getInstance() .unmarshal(xml)); analyzer.resetChecks(); analyzer.analyze(); Set<Issue> analysisReport = analyzerProvider.getAnalysisReport(); assertOnlyContains(analysisReport, CheckType.MISSING_RANGE); }

Target:
public void emptyValueListOnColumnShouldNotCountAsAnEnum() throws Exception { analyzerProvider.getFactTypes() .add(new FactTypes.FactType("Data", new Sets.Builder<FactTypes.Field>() .add(new FactTypes.Field("totalAmount", org.drools.verifier.core.index.model.DataType.TYPE_NUMERIC_FLOAT)) .build())); final String xml = loadResource("DROOLS-5059.gdst"); final Analyzer analyzer = analyzerProvider.makeAnalyser(GuidedDTXMLPersistence.getInstance() .unmarshal(xml)); analyzer.resetChecks(); analyzer.analyze(); Set<Issue> analysisReport = analyzerProvider.getAnalysisReport(); assertOnlyContains(analysisReport, CheckType.MISSING_RANGE); }
Source:
private static void generateConstructor( ClassDefinition classDefinition, FieldDefinition sessionField, CachedInstanceBinder cachedInstanceBinder, PreGeneratedExpressions preGeneratedExpressions) { Parameter sessionParameter = arg("session", ConnectorSession.class); MethodDefinition constructorDefinition = classDefinition.declareConstructor(a(PUBLIC), sessionParameter); BytecodeBlock body = constructorDefinition.getBody(); Variable thisVariable = constructorDefinition.getThis(); body.comment("super();") .append(thisVariable) .invokeConstructor(Object.class); body.append(thisVariable.setField(sessionField, sessionParameter)); cachedInstanceBinder.generateInitializations(thisVariable, body); preGeneratedExpressions.getLambdaFieldMap().values().forEach( lambdaExpressionField -> lambdaExpressionField.generateInitialization(thisVariable, body) ); body.ret(); }

Target:
private static void generateConstructor( ClassDefinition classDefinition, FieldDefinition sessionField, CachedInstanceBinder cachedInstanceBinder, PreGeneratedExpressions preGeneratedExpressions) { Parameter sessionParameter = arg("session", ConnectorSession.class); MethodDefinition constructorDefinition = classDefinition.declareConstructor(a(PUBLIC), sessionParameter); BytecodeBlock body = constructorDefinition.getBody(); Variable thisVariable = constructorDefinition.getThis(); body.comment("super();") .append(thisVariable) .invokeConstructor(Object.class); body.append(thisVariable.setField(sessionField, sessionParameter)); cachedInstanceBinder.generateInitializations(thisVariable, body); for (LambdaExpressionField field : preGeneratedExpressions.getLambdaFieldMap().values()) { field.generateInitialization(thisVariable, body); } body.ret(); }
Source:
private void waitForSubscribers() throws InterruptedException { while ( !publishProcessor.hasSubscribers() ) { Thread.sleep( 100 ); logChannel.logDebug( getString( PKG, "BlockingQueueStream.WaitForSubscribers" ) ); } }

Target:
private void waitForSubscribers() throws InterruptedException { logChannel.logDebug( getString( PKG, "BlockingQueueStream.WaitForSubscribers" ) ); while ( !publishProcessor.hasSubscribers() ) { Thread.sleep( 100 ); } logChannel.logDebug( getString( PKG, "BlockingQueueStream.HasSubscribers" ) ); }
Source:
void waitForAppToFinish() { workers.shutdown(); try { boolean finishedInTime = workers. awaitTermination(durationMs + APPLICATION_TIMEOUT_IN_MS, TimeUnit.MILLISECONDS); if (!finishedInTime) { log.error("not finished in time."); System.exit(1); } } catch (InterruptedException e) { log.error(String.valueOf(e)); throw new UnrecoverableCorfuInterruptedError(e); } finally { System.exit(0); } }

Target:
void waitForAppToFinish() { workers.shutdown(); try { boolean finishedInTime = workers. awaitTermination(DURATION_IN_MS + APPLICATION_TIMEOUT_IN_MS, TimeUnit.MILLISECONDS); if (!finishedInTime) { log.error("not finished in time."); System.exit(0); } } catch (InterruptedException e) { log.error(String.valueOf(e)); throw new UnrecoverableCorfuInterruptedError(e); } finally { System.exit(1); } }
Source:
protected IResourceVariant fetchVariant(IResource resource, int depth, IProgressMonitor monitor) throws TeamException { SubMonitor subMonitor = SubMonitor.convert(monitor); if (resource == null || isNonWorksapce(resource)) { subMonitor.done(); return null; } subMonitor.beginTask(NLS.bind( CoreText.GitResourceVariantTree_fetchingVariant, resource.getName()), IProgressMonitor.UNKNOWN); try { return fetchVariant(resource); } finally { subMonitor.done(); } }

Target:
protected IResourceVariant fetchVariant(IResource resource, int depth, IProgressMonitor monitor) throws TeamException { SubMonitor subMonitor = SubMonitor.convert(monitor); if (resource == null || isNonWorkspace(resource)) { subMonitor.done(); return null; } subMonitor.beginTask(NLS.bind( CoreText.GitResourceVariantTree_fetchingVariant, resource.getName()), IProgressMonitor.UNKNOWN); try { return fetchVariant(resource); } finally { subMonitor.done(); } }
Source:
private void storeFirmware(final SmartMeter smartMeteringDevice, final List<FirmwareVersion> firmwareVersions, final String organisationIdentification) throws FunctionalException { if (firmwareVersions.size() != 3) { LOGGER.error("Firmware can not be determined because to few module firmware versions were returned."); throw new FunctionalException(FunctionalExceptionType.UNKNOWN_FIRMWARE, ComponentType.DOMAIN_SMART_METERING); } String comm = "", ma = "", func = ""; for (FirmwareVersion firmwareVersion : firmwareVersions) { switch (firmwareVersion.getType()) { case COMMUNICATION: comm = firmwareVersion.getVersion(); break; case MODULE_ACTIVE: ma = firmwareVersion.getVersion(); break; case ACTIVE_FIRMWARE: func = firmwareVersion.getVersion(); break; default: } } List<Firmware> firmwares = this.firmwareRepository .findByModuleVersionCommAndModuleVersionMaAndModuleVersionFunc(comm, ma, func); if (firmwares.size() != 1) { LOGGER.error("Non existing combination of firmware modules returned by device."); throw new FunctionalException(FunctionalExceptionType.UNKNOWN_FIRMWARE, ComponentType.DOMAIN_SMART_METERING); } smartMeteringDevice.setFirmware(firmwares.get(0), organisationIdentification); smartMeterRepository.save(smartMeteringDevice); }

Target:
private void storeFirmware(final SmartMeter smartMeteringDevice, final List<FirmwareVersion> firmwareVersions, final String organisationIdentification) throws FunctionalException { if (firmwareVersions.size() != 3) { LOGGER.error( "Firmware can not be determined because 3 module firmware versions are expected, but were returned.", firmwareVersions.size()); throw new FunctionalException(FunctionalExceptionType.UNKNOWN_FIRMWARE, ComponentType.DOMAIN_SMART_METERING); } String comm = "", ma = "", func = ""; for (FirmwareVersion firmwareVersion : firmwareVersions) { switch (firmwareVersion.getType()) { case COMMUNICATION: comm = firmwareVersion.getVersion(); break; case MODULE_ACTIVE: ma = firmwareVersion.getVersion(); break; case ACTIVE_FIRMWARE: func = firmwareVersion.getVersion(); break; default: LOGGER.error("Cannot handle firmware version type: {}", firmwareVersion.getType().name()); throw new FunctionalException(FunctionalExceptionType.UNKNOWN_FIRMWARE, ComponentType.DOMAIN_SMART_METERING); } } List<Firmware> firmwares = this.firmwareRepository .findByModuleVersionCommAndModuleVersionMaAndModuleVersionFunc(comm, ma, func); if (firmwares.size() != 1) { LOGGER.error( "Non registered combination of firmware modules returned by device: Communication Module Active - {}, Module Active - {}, Active - {}.", comm, ma, func); throw new FunctionalException(FunctionalExceptionType.UNKNOWN_FIRMWARE, ComponentType.DOMAIN_SMART_METERING); } smartMeteringDevice.setFirmware(firmwares.get(0), organisationIdentification); smartMeterRepository.save(smartMeteringDevice); }
Source:
private SolrClient getClient(SolrContainer container) { if (client == null) { client = new Http2SolrClient.Builder("http://localhost:" + container.getSolrPort() + "/solr").build(); } return client; }

Target:
private SolrClient getClient(SolrContainer container) { if (client == null) { client = new Http2SolrClient.Builder("http://" + container.getContainerIpAddress() + ":" + container.getSolrPort() + "/solr").build(); } return client; }
Source:
@Override public Optionality getDistinctOptionality() { final Optionality optionality; switch (kind) { case BIT_AND: case BIT_OR: optionality = Optionality.IGNORED; break; default: optionality = Optionality.OPTIONAL; } return optionality; }

Target:
@Override public Optionality getDistinctOptionality() { final Optionality optionality; switch (kind) { case BIT_AND: case BIT_OR: optionality = Optionality.IGNORED; break; case BIT_XOR: optionality = Optionality.OPTIONAL; break; default: optionality = Optionality.OPTIONAL; } return optionality; }
Source:
protected static ServerJMSMessage processMessageAnnotations(ServerJMSMessage jms, MessageAnnotations annotations) throws Exception { if (annotations != null && annotations.getValue() != null) { for (Map.Entry<?, ?> entry : annotations.getValue().entrySet()) { String key = entry.getKey().toString(); if ("x-opt-delivery-time".equals(key) && entry.getValue() != null) { long deliveryTime = ((Number) entry.getValue()).longValue(); jms.setLongProperty(HDR_SCHEDULED_DELIVERY_TIME.toString(), deliveryTime); } else if ("x-opt-delivery-delay".equals(key) && entry.getValue() != null) { long delay = ((Number) entry.getValue()).longValue(); if (delay > 0) { jms.setLongProperty(HDR_SCHEDULED_DELIVERY_TIME.toString(), System.currentTimeMillis() + delay); } } else if (AMQPMessageSupport.INGRESS_TIMESTAMP.toString().equals(key) && entry.getValue() != null) { jms.setLongProperty(HDR_INGRESS_TIMESTAMP.toString(), ((Number) entry.getValue()).longValue()); } try { setProperty(jms, JMS_AMQP_MESSAGE_ANNOTATION_PREFIX + key, entry.getValue()); } catch (ActiveMQPropertyConversionException e) { encodeUnsupportedMessagePropertyType(jms, JMS_AMQP_ENCODED_MESSAGE_ANNOTATION_PREFIX + key, entry.getValue()); } } } return jms; }

Target:
protected static ServerJMSMessage processMessageAnnotations(ServerJMSMessage jms, MessageAnnotations annotations) throws Exception { if (annotations != null && annotations.getValue() != null) { for (Map.Entry<?, ?> entry : annotations.getValue().entrySet()) { String key = entry.getKey().toString(); if ("x-opt-delivery-time".equals(key) && entry.getValue() != null) { long deliveryTime = ((Number) entry.getValue()).longValue(); jms.setLongProperty(HDR_SCHEDULED_DELIVERY_TIME.toString(), deliveryTime); } else if ("x-opt-delivery-delay".equals(key) && entry.getValue() != null) { long delay = ((Number) entry.getValue()).longValue(); if (delay > 0) { jms.setLongProperty(HDR_SCHEDULED_DELIVERY_TIME.toString(), System.currentTimeMillis() + delay); } } else if (AMQPMessageSupport.HDR_INGRESS_TIME.equals(key) && entry.getValue() != null) { jms.setLongProperty(HDR_INGRESS_TIME.toString(), ((Number) entry.getValue()).longValue()); } try { setProperty(jms, JMS_AMQP_MESSAGE_ANNOTATION_PREFIX + key, entry.getValue()); } catch (ActiveMQPropertyConversionException e) { encodeUnsupportedMessagePropertyType(jms, JMS_AMQP_ENCODED_MESSAGE_ANNOTATION_PREFIX + key, entry.getValue()); } } } return jms; }
Source:
private SecondaryAction getSecondaryAction() { if (!userCanPublishPosts()) { return SecondaryAction.NONE; } switch (PostStatus.fromPost(mPost)) { case DRAFT: return SecondaryAction.SAVE; case PENDING: case SCHEDULED: return SecondaryAction.PUBLISH_NOW; case PRIVATE: case PUBLISHED: return SecondaryAction.NONE; case TRASHED: case UNKNOWN: return SecondaryAction.SAVE_AS_DRAFT; } return SecondaryAction.NONE; }

Target:
private SecondaryAction getSecondaryAction() { if (!userCanPublishPosts()) { switch (PostStatus.fromPost(mPost)) { case SCHEDULED: case DRAFT: case PENDING: case PRIVATE: case PUBLISHED: case UNKNOWN: return SecondaryAction.NONE; case TRASHED: return SecondaryAction.SAVE_AS_DRAFT; } } switch (PostStatus.fromPost(mPost)) { case DRAFT: return SecondaryAction.SAVE; case PENDING: case SCHEDULED: return SecondaryAction.PUBLISH_NOW; case PRIVATE: case PUBLISHED: return SecondaryAction.NONE; case TRASHED: case UNKNOWN: return SecondaryAction.SAVE_AS_DRAFT; } throw new IllegalStateException( "Switch in getSecondaryAction is missing a required case or the case is missing \"return\" keyword "); }
Source:
public void visitMemberSelectExpression(MemberSelectExpressionTree tree) { if (tree.expression().is(Tree.Kind.IDENTIFIER)) { IdentifierTree identifier = (IdentifierTree) tree.expression(); final Symbol owner = identifier.symbol().owner(); if (owner != null && owner.isMethodSymbol()) { return; } } if (tree.expression().symbolType().isSubtypeOf("java.lang.Class")) { return; } super.visitMemberSelectExpression(tree); }

Target:
public void visitMemberSelectExpression(MemberSelectExpressionTree tree) { if (tree.expression().is(Tree.Kind.IDENTIFIER)) { IdentifierTree identifier = (IdentifierTree) tree.expression(); Symbol owner = identifier.symbol().owner(); if (owner != null && owner.isMethodSymbol()) { return; } } if (tree.expression().symbolType().isSubtypeOf("java.lang.Class")) { return; } super.visitMemberSelectExpression(tree); }
Source:
public static Distribution fromValue(String value) { return tryFind(asList(Distribution.values()), hasValue(value)).or(UNRECOGNIZED); }

Target:
public static Distribution fromValue(String value) { return tryFind(values, hasValue(value)).or(UNRECOGNIZED); }
Source:
private List<SymbolInformationDto> symbol(ExtendedWorkspaceSymbolParams workspaceSymbolParams) { List<SymbolInformationDto> result = new ArrayList<>(); List<InitializedLanguageServer> servers; try { servers = registry .getApplicableLanguageServers(prefixURI(workspaceSymbolParams.getFileUri())) .stream() .flatMap(Collection::stream) .collect(Collectors.toList()); OperationUtil.doInParallel( servers, new LSOperation<InitializedLanguageServer, List<? extends SymbolInformation>>() { @Override public boolean canDo(InitializedLanguageServer element) { return truish( element.getInitializeResult().getCapabilities().getWorkspaceSymbolProvider()); } @Override public CompletableFuture<List<? extends SymbolInformation>> start( InitializedLanguageServer element) { return element.getServer().getWorkspaceService().symbol(workspaceSymbolParams); } @Override public boolean handleResult( InitializedLanguageServer element, List<? extends SymbolInformation> locations) { locations.forEach( o -> { o.getLocation().setUri(removeFilePrefix(o.getLocation().getUri())); result.add(new SymbolInformationDto(o)); }); return true; } }, 10000); return result; } catch (LanguageServerException e) { LOG.error("error getting symbol", e); throw new JsonRpcException(-27000, e.getMessage()); } }

Target:
private List<SymbolInformationDto> symbol(ExtendedWorkspaceSymbolParams workspaceSymbolParams) { List<SymbolInformationDto> result = new ArrayList<>(); List<InitializedLanguageServer> servers; try { servers = registry .getApplicableLanguageServers(prefixURI(workspaceSymbolParams.getFileUri())) .stream() .flatMap(Collection::stream) .collect(Collectors.toList()); OperationUtil.doInParallel( servers, new LSOperation<InitializedLanguageServer, List<? extends SymbolInformation>>() { @Override public boolean canDo(InitializedLanguageServer element) { return truish( element.getInitializeResult().getCapabilities().getWorkspaceSymbolProvider()); } @Override public CompletableFuture<List<? extends SymbolInformation>> start( InitializedLanguageServer element) { return element.getServer().getWorkspaceService().symbol(workspaceSymbolParams); } @Override public boolean handleResult( InitializedLanguageServer element, List<? extends SymbolInformation> locations) { locations.forEach( o -> { o.getLocation().setUri(removePrefixUri(o.getLocation().getUri())); result.add(new SymbolInformationDto(o)); }); return true; } }, 10000); return result; } catch (LanguageServerException e) { LOG.error("error getting symbol", e); throw new JsonRpcException(-27000, e.getMessage()); } }
Source:
public static Configuration getLoginConfiguration() { Configuration configuration = null; try { configuration = Configuration.getConfiguration(); } catch (SecurityException e) { if (SystemUtils.IS_JAVA_1_6 && !IBM_JDK) { LOGGER.debug("Unable to load default login configuration", e); } else { throw e; } } return configuration; }

Target:
public static Configuration getLoginConfiguration() { return Configuration.getConfiguration(); }
Source:
private static IProject createExistingProject(final ProjectRecord record, final boolean open, IProgressMonitor monitor) throws CoreException { String projectName = record.getProjectName(); final IWorkspace workspace = ResourcesPlugin.getWorkspace(); final IProject project = workspace.getRoot().getProject(projectName); if (project.exists()) { if (open && !project.isOpen()) { SubMonitor progress = SubMonitor.convert(monitor, 2); IPath location = project.getFile( IProjectDescription.DESCRIPTION_FILE_NAME) .getLocation(); if (location != null && location.toFile().equals( record.getProjectSystemFile())) { project.open(progress.newChild(1)); project.refreshLocal(IResource.DEPTH_INFINITE, progress.newChild(1)); } } return null; } if (record.getProjectDescription() == null) { record.setProjectDescription(workspace .newProjectDescription(projectName)); IPath locationPath = new Path(record.getProjectSystemFile() .getAbsolutePath()); if (Platform.getLocation().isPrefixOf(locationPath)) record.getProjectDescription().setLocation(null); else record.getProjectDescription().setLocation(locationPath); } else { record.getProjectDescription().setName(projectName); } SubMonitor progress = SubMonitor.convert(monitor, 8); progress.setTaskName( UIText.WizardProjectsImportPage_CreateProjectsTask); project.create(record.getProjectDescription(), progress.newChild(3)); project.open(IResource.BACKGROUND_REFRESH, progress.newChild(5)); return project; }

Target:
private static IProject createExistingProject(final ProjectRecord record, final boolean open, IProgressMonitor monitor) throws CoreException { String projectName = record.getProjectName(); final IWorkspace workspace = ResourcesPlugin.getWorkspace(); final IProject project = workspace.getRoot().getProject(projectName); if (project.exists()) { if (open && !project.isOpen()) { SubMonitor progress = SubMonitor.convert(monitor, 2); IPath location = project.getFile( IProjectDescription.DESCRIPTION_FILE_NAME) .getLocation(); if (location != null && location.toFile().equals( record.getProjectSystemFile())) { project.open(progress.newChild(1)); project.refreshLocal(IResource.DEPTH_INFINITE, progress.newChild(1)); } } return null; } if (record.getProjectDescription() == null) { record.setProjectDescription(workspace .newProjectDescription(projectName)); IPath locationPath = new Path(record.getProjectSystemFile() .getAbsolutePath()); if (Platform.getLocation().isPrefixOf(locationPath)) record.getProjectDescription().setLocation(null); else record.getProjectDescription().setLocation(locationPath); } else { record.getProjectDescription().setName(projectName); } SubMonitor progress = SubMonitor.convert(monitor, UIText.WizardProjectsImportPage_CreateProjectsTask, 8); project.create(record.getProjectDescription(), progress.newChild(3)); project.open(IResource.BACKGROUND_REFRESH, progress.newChild(5)); return project; }
Source:
private static void merge(String prefix, Map<String, Long> stats1, Map<String,Long> stats2 ) { stats1.merge(prefix+".min", stats2.get(prefix+".min"), Long::max); stats1.merge(prefix+".max", stats2.get(prefix+".max"), Long::max); stats1.merge(prefix+".sum", stats2.get(prefix+".sum"), Long::sum); stats2.forEach((k,v) -> stats1.merge(k, v, Long::sum)); }

Target:
private static void merge(String prefix, Map<String, Long> stats1, Map<String,Long> stats2) { merge(prefix+".min", Long::min, stats1, stats2); merge(prefix+".max", Long::max, stats1, stats2); merge(prefix+".sum", Long::sum, stats1, stats2); for (int i = 0; i < 32; i++) { merge(prefix+".logHist."+i, Long::sum, stats1, stats2); } }
Source:
protected int getWeight(Invoker<?> invoker, Invocation invocation) { int weight = invoker.getUrl().getMethodParameter(invocation.getMethodName(), WEIGHT_KEY, DEFAULT_WEIGHT); if (weight > 0) { long timestamp = invoker.getUrl().getParameter(REMOTE_TIMESTAMP_KEY, 0L); if (timestamp > 0L) { long uptime = System.currentTimeMillis() - timestamp; if (uptime >= Integer.MAX_VALUE) { return weight; } else if (uptime < 0) { return 1; } int warmup = invoker.getUrl().getParameter(WARMUP_KEY, DEFAULT_WARMUP); if (uptime > 0 && uptime < warmup) { weight = calculateWarmupWeight((int)uptime, warmup, weight); } } } return weight >= 0 ? weight : 0; }

Target:
protected int getWeight(Invoker<?> invoker, Invocation invocation) { int weight = invoker.getUrl().getMethodParameter(invocation.getMethodName(), WEIGHT_KEY, DEFAULT_WEIGHT); if (weight > 0) { long timestamp = invoker.getUrl().getParameter(TIMESTAMP_KEY, 0L); if (timestamp > 0L) { long uptime = System.currentTimeMillis() - timestamp; if (uptime >= Integer.MAX_VALUE) { return weight; } else if (uptime < 0) { return 1; } int warmup = invoker.getUrl().getParameter(WARMUP_KEY, DEFAULT_WARMUP); if (uptime > 0 && uptime < warmup) { weight = calculateWarmupWeight((int)uptime, warmup, weight); } } } return weight >= 0 ? weight : 0; }
Source:
public Task<Void> handleRegistrationIntentAsync(Intent intent) { List<Task<Void>> tasks = new ArrayList<>(); String registrationId = intent.getStringExtra(REGISTRATION_ID_EXTRA); if (registrationId != null && registrationId.length() > 0) { PLog.v(TAG, "Get deviceToken " + registrationId + " from GCM."); ParseInstallation installation = ParseInstallation.getCurrentInstallation(); if (!registrationId.equals(installation.getDeviceToken())) { installation.setPushType(PushType.GCM); installation.setDeviceToken(registrationId); tasks.add(installation.saveInBackground()); } tasks.add(updateLocalDeviceTokenLastModifiedAsync()); } synchronized (lock) { if (request != null) { request.onReceiveResponseIntent(intent); } } return Task.whenAll(tasks); }

Target:
public Task<Void> handleRegistrationIntentAsync(Intent intent) { List<Task<Void>> tasks = new ArrayList<>(); String registrationId = intent.getStringExtra(REGISTRATION_ID_EXTRA); if (registrationId != null && registrationId.length() > 0) { PLog.v(TAG, "Received deviceToken <" + registrationId + "> from GCM."); ParseInstallation installation = ParseInstallation.getCurrentInstallation(); if (!registrationId.equals(installation.getDeviceToken())) { installation.setPushType(PushType.GCM); installation.setDeviceToken(registrationId); tasks.add(installation.saveInBackground()); } tasks.add(updateLocalDeviceTokenLastModifiedAsync()); } synchronized (lock) { if (request != null) { request.onReceiveResponseIntent(intent); } } return Task.whenAll(tasks); }
Source:
public RuntimeManagerFactory runtimeManagerFactory(UserGroupCallback userGroupCallback, UserInfo userInfo) { SpringRuntimeManagerFactoryImpl runtimeManager = new SpringRuntimeManagerFactoryImpl(); runtimeManager.setTransactionManager((AbstractPlatformTransactionManager) transactionManager); runtimeManager.setUserGroupCallback(userGroupCallback); runtimeManager.setUserInfo(userInfo); if (properties.getQuartz().isEnabled()) { System.setProperty("org.quartz.properties", properties.getQuartz().getConfiguration()); System.setProperty("org.jbpm.timer.quartz.delay", String.valueOf(properties.getQuartz().getFailedJobDelay())); System.setProperty("org.jbpm.timer.quartz.retries", String.valueOf(properties.getQuartz().getFailedJobRetry())); System.setProperty("org.jbpm.timer.quartz.reschedule.delay", String.valueOf(properties.getQuartz().getRescheduleDelay())); System.setProperty("org.jbpm.timer.delay", String.valueOf(properties.getQuartz().getStartDelay())); } else { System.clearProperty("org.quartz.properties"); System.clearProperty("org.jbpm.timer.quartz.delay"); System.clearProperty("org.jbpm.timer.quartz.retries"); System.clearProperty("org.jbpm.timer.quartz.reschedule.delay"); System.clearProperty("org.jbpm.timer.delay"); } return runtimeManager; }

Target:
public RuntimeManagerFactory runtimeManagerFactory(UserGroupCallback userGroupCallback, UserInfo userInfo) { SpringRuntimeManagerFactoryImpl runtimeManager = new SpringRuntimeManagerFactoryImpl(); runtimeManager.setTransactionManager((AbstractPlatformTransactionManager) transactionManager); runtimeManager.setUserGroupCallback(userGroupCallback); runtimeManager.setUserInfo(userInfo); if (properties.getQuartz().isEnabled()) { System.setProperty(QUARTZ_PROPS, properties.getQuartz().getConfiguration()); System.setProperty(QUARTZ_FAILED_DELAY, String.valueOf(properties.getQuartz().getFailedJobDelay())); System.setProperty(QUARTZ_FAILED_RETRIES, String.valueOf(properties.getQuartz().getFailedJobRetry())); System.setProperty(QUARTZ_RESECHEDULE_DELAY, String.valueOf(properties.getQuartz().getRescheduleDelay())); System.setProperty(QUARTZ_START_DELAY, String.valueOf(properties.getQuartz().getStartDelay())); } else { System.clearProperty(QUARTZ_PROPS); System.clearProperty(QUARTZ_FAILED_DELAY); System.clearProperty(QUARTZ_FAILED_RETRIES); System.clearProperty(QUARTZ_RESECHEDULE_DELAY); System.clearProperty(QUARTZ_START_DELAY); } return runtimeManager; }
Source:
protected void readData(final ISeries series, final long start, final long end, final int nb) { if (getTrace() != null) { final double y[] = new double[nb]; Thread thread = new Thread("Histogram viewer update") { @Override public void run() { double x[] = getXAxis(start, end, nb); final long yLong[] = new long[nb]; Arrays.fill(y, 0.0); if (getTrace() instanceof TmfExperiment) { final TmfExperiment exp = (TmfExperiment) getTrace(); for (ITmfTrace trace : exp.getTraces()) { ITmfStatistics stats = trace.getStatistics(); List<Long> values = stats.histogramQuery(start, end, nb); for (int i = 0; i < nb; i++) { yLong[i] += values.get(i); } } } else { ITmfStatistics stats = getTrace().getStatistics(); List<Long> values = stats .histogramQuery(start, end, nb); for (int i = 0; i < nb; i++) { yLong[i] += values.get(i); } } for (int i = 0; i < nb; i++) { y[i] += yLong[i]; } drawChart(series, x, y); } }; thread.start(); } return; }

Target:
protected void readData(final ISeries series, final long start, final long end, final int nb) { if (getTrace() != null) { final double y[] = new double[nb]; Thread thread = new Thread("Histogram viewer update") { @Override public void run() { double x[] = getXAxis(start, end, nb); final long yLong[] = new long[nb]; Arrays.fill(y, 0.0); for (ITmfTrace trace : TmfTraceManager.getTraceSet(getTrace())) { ITmfStatistics stats = trace.getStatistics(); List<Long> values = stats.histogramQuery(start, end, nb); for (int i = 0; i < nb; i++) { yLong[i] += values.get(i); } } for (int i = 0; i < nb; i++) { y[i] += yLong[i]; } drawChart(series, x, y); } }; thread.start(); } return; }
Source:
private boolean checkConnection() throws SQLException { try (Connection connection = flyway.getDataSource().getConnection()) { return true; } catch (FlywaySqlException e) { System.out.println("Connection failure: " + e.getMessage()); return false; } }

Target:
private void checkConnection() { try (Connection connection = flyway.getDataSource().getConnection()) { } catch (Exception e) { throw new SchemaMigrationException(e); } }
Source:
public boolean verify(byte[] data, byte[] signature) throws VerificationException { try { int expectedSize = ECDSASignatureProvider.ECDSA.valueOf(super.getAlgorithm()).getSignatureLength(); byte[] derSignature = expectedSize != signature.length && signature[0] == 0x30 ? signature : ECDSASignatureProvider.concatenatedRSToASN1DER(signature, expectedSize); return super.verify(data, derSignature); } catch (Exception e) { throw new VerificationException("Signing failed", e); } }

Target:
public boolean verify(byte[] data, byte[] signature) throws VerificationException { try { int expectedSize = ECDSASignatureProvider.ECDSA.valueOf(getAlgorithm()).getSignatureLength(); byte[] derSignature = expectedSize != signature.length && signature[0] == 0x30 ? signature : ECDSASignatureProvider.concatenatedRSToASN1DER(signature, expectedSize); return super.verify(data, derSignature); } catch (Exception e) { throw new VerificationException("Signing failed", e); } }
Source:
protected void executeCommand() { if (getDiskImage() != null) { if (getParameters().getParentCommand() != VdcActionType.RemoveVmFromImportExport && getParameters().getParentCommand() != VdcActionType.RemoveVmTemplateFromImportExport && getParameters().getParentCommand() != VdcActionType.RemoveDisk) { removeImageFromDB(); } VDSReturnValue vdsReturnValue = performImageVdsmOperation(); getReturnValue().getInternalTaskIdList().add( CreateTask(vdsReturnValue.getCreationInfo(), getParameters().getParentCommand())); } else { log.warn("RemoveImageCommand::ExecuteCommand: DiskImage is null, nothing to remove"); } setSucceeded(true); }

Target:
protected void executeCommand() { if (getDiskImage() != null) { VDSReturnValue vdsReturnValue = performImageVdsmOperation(); getReturnValue().getInternalTaskIdList().add( CreateTask(vdsReturnValue.getCreationInfo(), getParameters().getParentCommand())); if (getParameters().getParentCommand() != VdcActionType.RemoveVmFromImportExport && getParameters().getParentCommand() != VdcActionType.RemoveVmTemplateFromImportExport && getParameters().getParentCommand() != VdcActionType.RemoveDisk) { removeImageFromDB(); } } else { log.warn("RemoveImageCommand::ExecuteCommand: DiskImage is null, nothing to remove"); } setSucceeded(true); }
Source:
protected void updateComplete(IStatusMonitor monitor) { if (!fTableCursor.isDisposed()) { super.updateComplete(monitor); } if (!hasPendingUpdates() && !fTableCursor.isDisposed()) { attemptSetKeySelection(); fTableCursor.redraw(); if (!hasPendingSetTopIndex()) { preservingSelection(() -> { int[] coordinates = getCoordinatesFromKey(getSelectionKey()); if (coordinates.length > 0) { fTableCursor.setVisible(true); } else { fTableCursor.setVisible(false); } }); } } if (!hasPendingUpdates() && fPendingFormatViewer) { formatViewer(); resizeColumnsToPreferredSize(); } }

Target:
protected void updateComplete(IStatusMonitor monitor) { if (fTableCursor.isDisposed()) { return; } super.updateComplete(monitor); if (!hasPendingUpdates()) { attemptSetKeySelection(); fTableCursor.redraw(); if (!hasPendingSetTopIndex()) { preservingSelection(() -> { int[] coordinates = getCoordinatesFromKey(getSelectionKey()); if (coordinates.length > 0) { fTableCursor.setVisible(true); } else { fTableCursor.setVisible(false); } }); } } if (!hasPendingUpdates() && fPendingFormatViewer) { formatViewer(); resizeColumnsToPreferredSize(); } }
Source:
public void setDrawerLayout(DrawerLayout drawerLayout) { this.drawerLayout = drawerLayout; drawerLayout.setDrawerListener(new DrawerLayout.SimpleDrawerListener() { @Override public void onDrawerSlide(View drawerView, float slideOffset) { Utils.hideSoftKeyboard(getActivity()); ViewAnimations.ensureTranslationY(getView(), 0); LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(drawerIndicator.getLayoutParams()); params.leftMargin = (int)(-4 * WikipediaApp.SCREEN_DENSITY * (slideOffset)); params.rightMargin = -params.leftMargin; params.gravity = Gravity.CENTER_VERTICAL; drawerIndicator.setLayoutParams(params); } }); }

Target:
public void setDrawerLayout(DrawerLayout drawerLayout) { this.drawerLayout = drawerLayout; drawerLayout.setDrawerListener(new DrawerLayout.SimpleDrawerListener() { boolean hideKeyboardCalled = false; @Override public void onDrawerSlide(View drawerView, float slideOffset) { if (!hideKeyboardCalled) { Utils.hideSoftKeyboard(getActivity()); hideKeyboardCalled = true; } ViewAnimations.ensureTranslationY(getView(), 0); LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(drawerIndicator.getLayoutParams()); params.leftMargin = (int)(-4 * WikipediaApp.SCREEN_DENSITY * (slideOffset)); params.rightMargin = -params.leftMargin; params.gravity = Gravity.CENTER_VERTICAL; drawerIndicator.setLayoutParams(params); } @Override public void onDrawerOpened(View drawerView) { hideKeyboardCalled = false; } @Override public void onDrawerClosed(View drawerView) { hideKeyboardCalled = false; } }); }
Source:
private void updateMessage() { if (commitButton == null) return; String message = null; int type = IMessageProvider.NONE; String commitMsg = commitMessageComponent.getCommitMessage(); if (commitMsg == null || commitMsg.trim().length() == 0) { message = UIText.CommitDialog_Message; type = IMessageProvider.INFORMATION; } else if (!isCommitWithoutFilesAllowed()) { message = UIText.CommitDialog_MessageNoFilesSelected; type = IMessageProvider.INFORMATION; } else { CommitStatus status = commitMessageComponent.getStatus(); message = status.getMessage(); type = status.getMessageType(); } boolean noErrors = getPreferenceStore() .getBoolean(UIPreferences.CHECK_BEFORE_COMMITTING) ? (ignoreErrors.getSelection() || getProblemsSeverity() < IMarker.SEVERITY_WARNING) : true; setMessage(message, type); boolean commitEnabled = (type == IMessageProvider.WARNING || type == IMessageProvider.NONE) && noErrors; commitButton.setEnabled(commitEnabled); commitAndPushButton.setEnabled(commitEnabled); }

Target:
private void updateMessage() { if (commitButton == null) return; String message = null; int type = IMessageProvider.NONE; boolean hasErrorsOrWarnings = getPreferenceStore() .getBoolean(UIPreferences.CHECK_BEFORE_COMMITTING) ? (getProblemsSeverity() >= IMarker.SEVERITY_WARNING && !ignoreErrors.getSelection()) : false; if (hasErrorsOrWarnings) { message = UIText.CommitDialog_MessageErrors; type = IMessageProvider.WARNING; } else { String commitMsg = commitMessageComponent.getCommitMessage(); if (commitMsg == null || commitMsg.trim().length() == 0) { message = UIText.CommitDialog_Message; type = IMessageProvider.INFORMATION; } else if (!isCommitWithoutFilesAllowed()) { message = UIText.CommitDialog_MessageNoFilesSelected; type = IMessageProvider.INFORMATION; } else { CommitStatus status = commitMessageComponent.getStatus(); message = status.getMessage(); type = status.getMessageType(); } } setMessage(message, type); boolean commitEnabled = (type == IMessageProvider.WARNING || type == IMessageProvider.NONE) && !hasErrorsOrWarnings; updateCommitButtons(commitEnabled); }