auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void execute(CloudStackClient cloudStackClient, Pool pool, DelegateExecution execution) { if (execution.getVariable(ProcessVariables.NETWORK_ID) != null) { LOG.warn("Network process variable ({}) will be overwritten!", ProcessVariables.NETWORK_ID); } Network network; final String existingNetwork = pool.getNetwork().getOption(NetworkOptions.EXISTING_NETWORK_ID); if (existingNetwork != null) { network = checkNotNull(cloudStackClient.getNetworkClient().getNetwork(existingNetwork), "Network with id " + existingNetwork + " does not exist"); } else { final String networkName = Networks.formatNameFromBusinessKey(execution.getProcessBusinessKey()); final String zoneId = pool.getProvider().getOption(ProviderOptions.ZONE_ID); final String networkOffering = pool.getProvider().getOption(ProviderOptions.NETWORK_OFFERING); try { network = Networks.getByName(cloudStackClient, networkName); LOG.info("Network with name exists.", networkName); } catch (NoSuchElementException e) { LOG.info(String.format("Creating network %s in zone %s with offering %s", networkName, zoneId, networkOffering)); network = cloudStackClient.getNetworkClient().createNetworkInZone(zoneId, networkOffering, networkName, networkName, CreateNetworkOptions.NONE); } } LOG.info("Storing network id in process variable {}", network.getId(), ProcessVariables.NETWORK_ID); execution.setVariable(ProcessVariables.NETWORK_ID, network.getId()); }

Target:
public void execute(CloudStackClient cloudStackClient, Pool pool, DelegateExecution execution) { if (execution.getVariable(ProcessVariables.NETWORK_ID) != null) { LOG.warn("Network process variable ({}) will be overwritten!", ProcessVariables.NETWORK_ID); } Network network; final String existingNetwork = pool.getNetwork().getOption(NetworkOptions.EXISTING_NETWORK_ID); if (existingNetwork != null) { network = checkNotNull(cloudStackClient.getNetworkClient().getNetwork(existingNetwork), "Network with id " + existingNetwork + " does not exist"); } else { final String networkName = Networks.formatNameFromBusinessKey(execution.getProcessBusinessKey()); final String zoneId = pool.getProvider().getOption(ProviderOptions.ZONE_ID); final String networkOfferingId = pool.getProvider().getOption(ProviderOptions.NETWORK_OFFERING_ID); try { network = Networks.getByName(cloudStackClient, networkName); LOG.info("Network with name exists.", networkName); } catch (NoSuchElementException e) { LOG.info(String.format("Creating network %s in zone %s with offering %s", networkName, zoneId, networkOfferingId)); network = cloudStackClient.getNetworkClient().createNetworkInZone(zoneId, networkOfferingId, networkName, networkName, CreateNetworkOptions.NONE); } } LOG.info("Storing network id in process variable {}", network.getId(), ProcessVariables.NETWORK_ID); execution.setVariable(ProcessVariables.NETWORK_ID, network.getId()); }
Source:
private void giveItem(CommandSender sender, Player p, SlimefunItem sfItem, String[] args) { if (sfItem instanceof MultiBlockMachine) { SlimefunPlugin.getLocalization().sendMessage(sender, "guide.cheat.no-multiblocks"); } else { int amount = parseAmount(args); if (amount > 0) { SlimefunPlugin.getLocalization().sendMessage(p, "messages.given-item", true, msg -> msg.replace(PLACEHOLDER_ITEM, sfItem.getItemName()).replace(PLACEHOLDER_AMOUNT, String.valueOf(amount))); HashMap<Integer,ItemStack> excess = p.getInventory().addItem(new CustomItem(sfItem.getItem(), amount)); if (SlimefunPlugin.getCfg().getBoolean("options.drop-excess-sf-give-items") && !excess.isEmpty()) { for (ItemStack is : excess.values()) { p.getWorld().dropItemNaturally(p.getLocation(), is); } } SlimefunPlugin.getLocalization().sendMessage(sender, "messages.give-item", true, msg -> msg.replace(PLACEHOLDER_PLAYER, args[1]).replace(PLACEHOLDER_ITEM, sfItem.getItemName()).replace(PLACEHOLDER_AMOUNT, String.valueOf(amount))); } else { SlimefunPlugin.getLocalization().sendMessage(sender, "messages.not-valid-amount", true, msg -> msg.replace(PLACEHOLDER_AMOUNT, args[3])); } } }

Target:
private void giveItem(CommandSender sender, Player p, SlimefunItem sfItem, String[] args) { if (sfItem instanceof MultiBlockMachine) { SlimefunPlugin.getLocalization().sendMessage(sender, "guide.cheat.no-multiblocks"); } else { int amount = parseAmount(args); if (amount > 0) { SlimefunPlugin.getLocalization().sendMessage(p, "messages.given-item", true, msg -> msg.replace(PLACEHOLDER_ITEM, sfItem.getItemName()).replace(PLACEHOLDER_AMOUNT, String.valueOf(amount))); Map<Integer,ItemStack> excess = p.getInventory().addItem(new CustomItem(sfItem.getItem(), amount)); if (SlimefunPlugin.getCfg().getBoolean("options.drop-excess-sf-give-items") && !excess.isEmpty()) { for (ItemStack is : excess.values()) { p.getWorld().dropItem(p.getLocation(), is); } } SlimefunPlugin.getLocalization().sendMessage(sender, "messages.give-item", true, msg -> msg.replace(PLACEHOLDER_PLAYER, args[1]).replace(PLACEHOLDER_ITEM, sfItem.getItemName()).replace(PLACEHOLDER_AMOUNT, String.valueOf(amount))); } else { SlimefunPlugin.getLocalization().sendMessage(sender, "messages.not-valid-amount", true, msg -> msg.replace(PLACEHOLDER_AMOUNT, args[3])); } } }
Source:
private static Optional<ExecutableElement> findBuildMethod( TypeElement autoValueClass, TypeElement builderElement) { List<ExecutableElement> methods = ElementFilter.methodsIn(builderElement.getEnclosedElements()) .stream() .filter(e -> !MoreElements.hasModifiers(STATIC, PRIVATE).apply(e)) .filter(e -> e.getParameters().isEmpty()) .filter(e -> MoreTypes.equivalence().equivalent(e.getReturnType(), autoValueClass.asType())) .collect(Collectors.toList()); if (methods.isEmpty()) { return Optional.empty(); } List<ExecutableElement> annotatedMethods = methods.stream() .filter(e -> MoreElements.isAnnotationPresent(e, GsonBuild.class)) .collect(Collectors.toList()); if (annotatedMethods.size() > 1) { return Optional.empty(); } else if (annotatedMethods.size() == 1) { return Optional.of(Iterables.getOnlyElement(annotatedMethods)); } return methods.stream() .filter(e -> e.getSimpleName().contentEquals("build")) .findFirst(); }

Target:
private static ExecutableElement findBuildMethod( TypeElement autoValueClass, TypeElement builderElement) { Set<ExecutableElement> methods = ElementFilter.methodsIn(builderElement.getEnclosedElements()) .stream() .filter(MoreElements.hasModifiers(STATIC, PRIVATE).negate()) .filter(e -> e.getParameters().isEmpty()) .filter(e -> MoreTypes.equivalence().equivalent(e.getReturnType(), autoValueClass.asType())) .collect(Collectors.toSet()); if (methods.size() == 1) { return Iterables.getOnlyElement(methods); } else { Set<ExecutableElement> annotatedMethods = methods.stream() .filter(e -> MoreElements.isAnnotationPresent(e, AutoValueGsonBuild.class)) .collect(Collectors.toSet()); if (annotatedMethods.size() == 1) { return Iterables.getOnlyElement(annotatedMethods); } } return null; }
Source:
public void selectCompositeAutocompleteProposal(String item) { seleniumWebDriverHelper.waitAndClick( By.xpath(format(AUTOCOMPLETE_CONTAINER + "/li/span[text()='%s']", item))); }

Target:
public void selectCompositeAutocompleteProposal(String item) { seleniumWebDriverHelper.waitAndClick( By.xpath(format(AUTOCOMPLETE_CONTAINER + "/li/span[.='%s']", item))); }
Source:
private static void validateAgreement(String agreement, List<String> validationErrors) { if (!isValid(agreement, AGREEMENT_ID_MAX_LENGTH)){ validationErrors.add("agreement"); } }

Target:
private static void validateAgreement(String agreement, List<String> validationErrors) { if (!isValid(agreement, AGREEMENT_ID_MAX_LENGTH)){ validationErrors.add("agreement_id"); } }
Source:
public void testResourceNotFoundForShard() { FanOutRecordsPublisher source = new FanOutRecordsPublisher(kinesisClient, SHARD_ID, CONSUMER_ARN); ArgumentCaptor<FanOutRecordsPublisher.RecordFlow> flowCaptor = ArgumentCaptor .forClass(FanOutRecordsPublisher.RecordFlow.class); ArgumentCaptor<ProcessRecordsInput> inputCaptor = ArgumentCaptor.forClass(ProcessRecordsInput.class); Subscriber<ProcessRecordsInput> subscriber = spy(new Subscriber<ProcessRecordsInput>() { @Override public void onSubscribe(final Subscription subscription) { } @Override public void onNext(final ProcessRecordsInput processRecordsInput) { } @Override public void onError(final Throwable throwable) { } @Override public void onComplete() { } }); source.subscribe(subscriber); verify(kinesisClient).subscribeToShard(any(SubscribeToShardRequest.class), flowCaptor.capture()); FanOutRecordsPublisher.RecordFlow recordFlow = flowCaptor.getValue(); recordFlow.exceptionOccurred(new RuntimeException(ResourceNotFoundException.builder().build())); verify(subscriber).onSubscribe(any()); verify(subscriber, never()).onError(any()); verify(subscriber).onNext(inputCaptor.capture()); verify(subscriber).onComplete(); ProcessRecordsInput input = inputCaptor.getValue(); assertThat(input.isAtShardEnd(), equalTo(true)); assertThat(input.records().isEmpty(), equalTo(true)); }

Target:
public void testResourceNotFoundForShard() { FanOutRecordsPublisher source = new FanOutRecordsPublisher(kinesisClient, SHARD_ID, CONSUMER_ARN); ArgumentCaptor<FanOutRecordsPublisher.RecordFlow> flowCaptor = ArgumentCaptor .forClass(FanOutRecordsPublisher.RecordFlow.class); ArgumentCaptor<ProcessRecordsInput> inputCaptor = ArgumentCaptor.forClass(ProcessRecordsInput.class); source.subscribe(subscriber); verify(kinesisClient).subscribeToShard(any(SubscribeToShardRequest.class), flowCaptor.capture()); FanOutRecordsPublisher.RecordFlow recordFlow = flowCaptor.getValue(); recordFlow.exceptionOccurred(new RuntimeException(ResourceNotFoundException.builder().build())); verify(subscriber).onSubscribe(any()); verify(subscriber, never()).onError(any()); verify(subscriber).onNext(inputCaptor.capture()); verify(subscriber).onComplete(); ProcessRecordsInput input = inputCaptor.getValue(); assertThat(input.isAtShardEnd(), equalTo(true)); assertThat(input.records().isEmpty(), equalTo(true)); }
Source:
private PagedSearchResult<ProductProjection> searchResult() { final String json = "{" + " \"facets\": {" + " \"categories.id\": {" + " \"type\": \"terms\"," + " \"missing\": 5," + " \"total\": 60," + " \"other\": 0," + " \"terms\": [" + " { " + " \"term\": \"one\", " + " \"count\": 30 " + " }," + " { " + " \"term\": \"two\", " + " \"count\": 20 " + " }," + " { " + " \"term\": \"three\", " + " \"count\": 10 " + " }" + " ]" + " }" + " }" + "}"; final JsonNode node = Json.parse(json); return SphereJsonUtils.readObject(node, PagedSearchResult.class); }

Target:
private PagedSearchResult<ProductProjection> searchResult() { return readObjectFromResource("pagedSearchResult.json", new TypeReference<PagedSearchResult<ProductProjection>>() {}); }
Source:
public void updateTimeZoneMappings() throws IOException { String foo = "<LINK_1>"; List<String> versionsToUpgrade = new ArrayList<>(); try ( TarArchiveInputStream tar = new TarArchiveInputStream( new GZIPInputStream( new URL( foo ).openStream() ) ) ) { for ( ArchiveEntry entry; (entry = tar.getNextEntry()) != null; ) { if ( "NEWS".equalsIgnoreCase( entry.getName() ) ) { try ( BufferedReader reader = new BufferedReader( new InputStreamReader( tar ) ) ) { for ( String line; (line = reader.readLine()) != null; ) { if ( line.startsWith( "Release " ) ) { String substring = line.substring( line.indexOf( ' ' ) + 1 ); String release = substring.substring( 0, substring.indexOf( ' ' ) ); if ( !TimeZoneMapping.LATEST_SUPPORTED_IANA_VERSION.equals( release ) ) { versionsToUpgrade.add( release ); } else { break; } } } } break; } } } HashSet<String> upgradedAlready = new HashSet<>(); StringBuilder builder = new StringBuilder(); for ( int i = versionsToUpgrade.size(); i-- > 0; ) { upgradeIANATo( versionsToUpgrade.get( i ), upgradedAlready, builder ); } String s = builder.toString(); assertThat( "Please append the following to the end of `TZIDS`: \n" + s, s, isEmptyString() ); }

Target:
public void updateTimeZoneMappings() throws IOException { List<String> versionsToUpgrade = new ArrayList<>(); readTZDBFile( null, "NEWS", line -> { if ( line.startsWith( "Release " ) ) { String substring = line.substring( line.indexOf( ' ' ) + 1 ); String release = substring.substring( 0, substring.indexOf( ' ' ) ); if ( TimeZoneMapping.LATEST_SUPPORTED_IANA_VERSION.equals( release ) ) { return false; } versionsToUpgrade.add( release ); } return true; } ); HashSet<String> upgradedAlready = new HashSet<>(); StringBuilder builder = new StringBuilder(); for ( int i = versionsToUpgrade.size(); i-- > 0; ) { upgradeIANATo( versionsToUpgrade.get( i ), upgradedAlready, builder ); } String s = builder.toString(); assertThat( "Please append the following to the end of `TZIDS`: \n" + s, s, isEmptyString() ); }
Source:
public static long count() { if (!isHawkInitialised()) { return 0; } return hawkBuilder.getStorage().count(); }

Target:
public static long count() { Utils.validateBuild(); return internal.getStorage().count(); }
Source:
public void should_successfully_parse_json() throws IOException { StatsDetails details = IntelJsonParser.parse("/json/details-stats.json", StatsDetails.class); assertNotNull(details); }

Target:
public void should_successfully_parse_json() throws IOException { StatsDetails details = IntelJsonParser.parse("/json/details-stats.json", StatsDetails.class); assertNotNull(details.getGeneralStats().getAccuracy()); assertNotNull(details.getGeneralStats().getAssaultScore()); assertNotNull(details.getGeneralStats().getAvengerKills()); }
Source:
public void run() { Properties properties = new Properties(); try { File file = Paths.get(credentialsFile).toFile(); if (!file.exists()) { throw new FileNotFoundException("The file does not exist"); } try (FileInputStream is = new FileInputStream(file)) { properties.load(is); if (!properties.containsKey(USERNAME_PROP) || !properties.containsKey(PASSWORD_PROP)) { return; } basicCredentials.updateCredentials( properties.getProperty(USERNAME_PROP), properties.getProperty(PASSWORD_PROP) ); } } catch (Exception e) { LOGGER.error("Load credentials file error", e); } }

Target:
@Override public void run() { try { updateCredentialsFromProperties(); } catch (Exception e) { LOGGER.error("Error loading elasticsearch credentials", e); } }
Source:
private void testFromIterable(ImmutableList<Integer> list) { ImmutableList<Integer> listP = ImmutableList.from(list); assertEquals(list, listP); }

Target:
private void testFromIterable(ImmutableList<Integer> list) { ImmutableList<Integer> listP = ImmutableList.from((Iterable<Integer>) list); assertEquals(list, listP); }
Source:
public boolean isMockIaaSReady() { try { URI uri = new URIBuilder(endpoint + INIT_CONTEXT).build(); HttpResponse response = restClient.doGet(uri); if (response != null) { return response.getStatusCode() == 200; } throw new RuntimeException("An unknown error occurred"); } catch (Exception e) { String message = "Could not check whether mock-iaas is active"; throw new RuntimeException(message, e); } }

Target:
public boolean isMockIaaSReady() { try { URI uri = new URIBuilder(endpoint + INIT_CONTEXT).build(); HttpResponse response = restClient.doGet(uri); return response != null && response.getStatusCode() == 200; } catch (Exception e) { String message = "Could not check whether mock-iaas is active"; throw new RuntimeException(message, e); } }
Source:
public int hashCode() { return blockID.getUnlocalizedName().hashCode(); }

Target:
public int hashCode() { return (blockID.getClass().getSimpleName() + ":" + damage).hashCode(); }
Source:
public ResponseEntity postEvent(@PathVariable final String eventTypeName, @RequestBody final String event, final NativeWebRequest nativeWebRequest) { LOG.trace("Received event for event type {}", event, eventTypeName); try { return doWithMetrics(eventTypeName, System.nanoTime(), () -> { final JSONArray events = new JSONArray(event); final EventPublishResult result = publisher.publish(events, eventTypeName); return response(result); }); } catch (final JSONException e) { LOG.debug("Problem parsing event", e); return create(Problem.valueOf(Response.Status.BAD_REQUEST), nativeWebRequest); } catch (final NoSuchEventTypeException e) { LOG.debug("Event type not found.", e); return create(e.asProblem(), nativeWebRequest); } catch (final NakadiException e) { LOG.debug("Failed to publish batch", e); return create(e.asProblem(), nativeWebRequest); } }

Target:
public ResponseEntity postEvent(@PathVariable final String eventTypeName, @RequestBody final String event, final NativeWebRequest nativeWebRequest) { LOG.trace("Received event for event type {}", event, eventTypeName); try { return doWithMetrics(eventTypeName, System.nanoTime(), () -> { final JSONArray eventsAsJsonObjects = new JSONArray(event); final EventPublishResult result = publisher.publish(eventsAsJsonObjects, eventTypeName); return response(result); }); } catch (final JSONException e) { LOG.debug("Problem parsing event", e); return create(Problem.valueOf(Response.Status.BAD_REQUEST), nativeWebRequest); } catch (final NoSuchEventTypeException e) { LOG.debug("Event type not found.", e); return create(e.asProblem(), nativeWebRequest); } catch (final NakadiException e) { LOG.debug("Failed to publish batch", e); return create(e.asProblem(), nativeWebRequest); } }
Source:
private void loadDepartments() throws IOException { if (isIndexAvailable(DEPARTMENTS_INDEX)) { searchUtils.deleteIndex(DEPARTMENTS_INDEX); } searchUtils.createIndex(DEPARTMENTS_INDEX, getDepartmentsSetting(), DEPARTMENT_TYPE, getDepartmentsMapping()); elasticSearchLog("Indexing departments").log(); long start = System.currentTimeMillis(); try ( InputStream resourceStream = SearchBoostTermsResolver.class.getResourceAsStream(DEPARTMENTS_PATH); BufferedReader br = new BufferedReader(new InputStreamReader(resourceStream)) ) { for (String line; (line = br.readLine()) != null; ) { processDepartment(line); } } elasticSearchLog("Indexing departments complete") .addParameter("totalTime(ms)", (System.currentTimeMillis() - start)) .log(); }

Target:
private void loadDepartments() throws IOException { if (isIndexAvailable(DEPARTMENTS_INDEX)) { searchUtils.deleteIndex(DEPARTMENTS_INDEX); } searchUtils.createIndex(DEPARTMENTS_INDEX, getDepartmentsSetting(), DEPARTMENT_TYPE, getDepartmentsMapping()); elasticSearchLog("Indexing departments").log(); long start = System.currentTimeMillis(); try ( InputStream resourceStream = SearchBoostTermsResolver.class.getResourceAsStream(DEPARTMENTS_PATH); InputStreamReader inputStreamReader = new InputStreamReader(resourceStream); BufferedReader br = new BufferedReader(inputStreamReader) ) { for (String line; (line = br.readLine()) != null; ) { processDepartment(line); } } elasticSearchLog("Indexing departments complete") .addParameter("totalTime(ms)", (System.currentTimeMillis() - start)) .log(); }
Source:
public static boolean isTimeFilterPresent(List<Filter> filters) { for (Filter filter : filters) { if (ElasticsearchUtils.TIME_FIELD.equals(filter.getField())) { return true; } } return false; }

Target:
public static boolean isTimeFilterPresent(List<Filter> filters) { AtomicBoolean timeFilterPresent = new AtomicBoolean(false); filters.forEach(filter -> { if (ElasticsearchUtils.TIME_FIELD.equals(filter.getField())) { timeFilterPresent.set(true); } }); return timeFilterPresent.get(); }
Source:
public String resolve() { String location = ""; if (!CollectionUtils.isEmpty(studyInstanceMap)) { if (this.observationUnitRow != null) { final Optional<ObservationUnitData> instanceNoUnitData = Optional.of(observationUnitRow.getVariables().entrySet().stream().collect(Collectors .toMap(k -> k.getValue().getVariableId(), k -> k.getValue())).get(TermId.TRIAL_INSTANCE_FACTOR.getId())); if (instanceNoUnitData.isPresent()) { final String instanceNo = instanceNoUnitData.get().getValue(); if (instanceNo != null && studyInstanceMap.containsKey(Integer.valueOf(instanceNo))) { location = studyInstanceMap.get(Integer.valueOf(instanceNo)).getLocationAbbreviation(); } } } else { final StudyInstance firstInstance = studyInstanceMap.get(1); if (firstInstance != null) { location = firstInstance.getLocationAbbreviation(); } } } if (StringUtils.isBlank(location)) { LocationAbbreviationResolver.LOG.debug( "No Location Abbreviation was resolved"); return ""; } return location; }

Target:
public String resolve() { String location = ""; if (!CollectionUtils.isEmpty(this.studyInstanceMap)) { if (this.observationUnitRow != null) { final Optional<ObservationUnitData> instanceNoUnitData = Optional.ofNullable(this.observationUnitRow.getVariables().entrySet().stream().collect(Collectors .toMap(k -> k.getValue().getVariableId(), Map.Entry::getValue)).get(TermId.TRIAL_INSTANCE_FACTOR.getId())); if (instanceNoUnitData.isPresent()) { final String instanceNo = instanceNoUnitData.get().getValue(); if (instanceNo != null && this.studyInstanceMap.containsKey(Integer.valueOf(instanceNo))) { location = this.studyInstanceMap.get(Integer.valueOf(instanceNo)).getLocationAbbreviation(); } } } else { final StudyInstance firstInstance = this.studyInstanceMap.get(1); if (firstInstance != null) { location = firstInstance.getLocationAbbreviation(); } } } if (StringUtils.isBlank(location)) { LocationAbbreviationResolver.LOG.debug( "No Location Abbreviation was resolved"); return ""; } return location; }
Source:
public void testInsertInto() { QualifiedName table = QualifiedName.of("a"); Query query = simpleQuery(selectList(new AllColumns()), table(QualifiedName.of("t"))); assertStatement("INSERT INTO a\nSELECT * FROM t", new Insert(table, Optional.empty(), query)); assertStatement("INSERT INTO a (c1, c2)\nSELECT * FROM t", new Insert(table, Optional.of(ImmutableList.of(identifier("c1"), identifier("c2"))), query)); }

Target:
public void testInsertInto() { QualifiedName table = QualifiedName.of("a"); Query query = simpleQuery(selectList(new AllColumns()), table(QualifiedName.of("t"))); assertStatement("INSERT INTO a SELECT * FROM t", new Insert(table, Optional.empty(), query)); assertStatement("INSERT INTO a (c1, c2) SELECT * FROM t", new Insert(table, Optional.of(ImmutableList.of(identifier("c1"), identifier("c2"))), query)); }
Source:
public void channelWritabilityChanged(ChannelHandlerContext ctx) throws Exception { if (writabilityStates.equals("")) { writabilityStates = String.valueOf(ctx.channel().isWritable()); } else { writabilityStates += "," + ctx.channel().isWritable(); } super.channelWritabilityChanged(ctx); }

Target:
public void channelWritabilityChanged(ChannelHandlerContext ctx) throws Exception { if ("".equals(writabilityStates)) { writabilityStates = String.valueOf(ctx.channel().isWritable()); } else { writabilityStates += "," + ctx.channel().isWritable(); } super.channelWritabilityChanged(ctx); }
Source:
public boolean performNextOperation(int completedChildCount) { if (getParameters().getOvfUpdateStep() == OvfUpdateStep.OVF_STORES_CREATION) { setOvfUpdateStep(OvfUpdateStep.OVF_UPLOAD); if (!updateOvfStoreContent()) { setSucceeded(false); log.error("Failed to update OVF_STORE content"); throw new EngineException(EngineError.OvfContentUpdateFailure); } return true; } return false; }

Target:
public boolean performNextOperation(int completedChildCount) { if (getParameters().getOvfUpdateStep() == OvfUpdateStep.OVF_STORES_CREATION) { setOvfUpdateStep(OvfUpdateStep.OVF_UPLOAD); if (!updateOvfStoreContent()) { setSucceeded(false); log.error("Failed to update OVF_STORE content"); throw new EngineException(EngineError.UPLOAD_FAILURE); } return true; } return false; }
Source:
public List<Pair<Guid, Integer>> score(List<VDS> hosts, VM vm, Map<String, String> parameters) { List<Pair<Guid, Integer>> scores = new ArrayList<Pair<Guid, Integer>>(); boolean isHostedEngine = vm.isHostedEngine(); if (!hosts.isEmpty()) { if (isHostedEngine) { int maxHaScore = hosts.get(0).getHighlyAvailableScore(); for (VDS host : hosts) { if (host.getHighlyAvailableScore() > maxHaScore) { maxHaScore = host.getHighlyAvailableScore(); } } if (maxHaScore == 0) { fillDefaultScores(hosts, scores); } else { float ratio = maxHaScore > MaxSchedulerWeight ? ((float) MaxSchedulerWeight / maxHaScore) : 1; for (VDS host : hosts) { scores.add(new Pair<Guid, Integer>(host.getId(), MaxSchedulerWeight - Math.round(host.getHighlyAvailableScore() * ratio))); } } } else { fillDefaultScores(hosts, scores); } } return scores; }

Target:
public List<Pair<Guid, Integer>> score(List<VDS> hosts, VM vm, Map<String, String> parameters) { List<Pair<Guid, Integer>> scores = new ArrayList<Pair<Guid, Integer>>(); boolean isHostedEngine = vm.isHostedEngine(); if (isHostedEngine) { float ratio = MAXIMUM_HA_SCORE > MaxSchedulerWeight ? ((float) MaxSchedulerWeight / MAXIMUM_HA_SCORE) : 1; for (VDS host : hosts) { scores.add(new Pair<Guid, Integer>(host.getId(), MaxSchedulerWeight - Math.round(host.getHighlyAvailableScore() * ratio))); } } else { fillDefaultScores(hosts, scores); } return scores; }
Source:
public static ExpectedCondition<Boolean> textNotPresentInElementLocatedBy( final By by, final String text) { return new ExpectedCondition<Boolean>() { public Boolean apply(WebDriver driver) { String elementText = null; try { elementText = driver.findElement(by).getText(); }catch (NoSuchElementException | StaleElementReferenceException e){ return false; } return !elementText.contains(text); } @Override public String toString() { return String.format("text ('%s') to be present in element located by %s", text, by.toString()); } }; }

Target:
public static ExpectedCondition<Boolean> textNotPresentInElementLocatedBy( final By by, final String text) { return new ExpectedCondition<Boolean>() { public Boolean apply(WebDriver driver) { try { return !driver.findElement(by).getText().contains(text); }catch (NoSuchElementException | StaleElementReferenceException e){ return false; } } @Override public String toString() { return String.format("text ('%s') to be present in element located by %s", text, by.toString()); } }; }
Source:
public void testIntFloorDivMod() { testFloorDivModI(123, 456); testFloorDivModI(456, 123); testFloorDivModI(369, 123); testFloorDivModI(1, 0); testFloorDivModI(Integer.MAX_VALUE, 1); testFloorDivModI(Integer.MAX_VALUE, -1); testFloorDivModI(Integer.MIN_VALUE, -1); testFloorDivModI(Integer.MIN_VALUE, -1); }

Target:
public void testIntFloorDivMod() { testFloorDivModI(123, 456); testFloorDivModI(456, 123); testFloorDivModI(369, 123); testFloorDivModI(1, 0); testFloorDivModI(Integer.MAX_VALUE, 1); testFloorDivModI(Integer.MAX_VALUE, -1); testFloorDivModI(Integer.MIN_VALUE, 1); testFloorDivModI(Integer.MIN_VALUE, -1); }
Source:
public boolean releaseLock(@Nonnull final Lock lock) { try { Integer result = Integer.valueOf(tryRemoveLock(lock)); Id lockRelease = releaseId.withTag("lockName", lock.getName().toLowerCase()); switch (result) { case 1: log.info("Released lock {}", lock); registry.counter(lockRelease.withTag("status", "SUCCESS")).increment(); return true; case 2: log.info("Released lock {}", lock); registry.counter(lockRelease.withTag("status", "SUCCESS_GONE")).increment(); return true; case 0: log.warn("Failed releasing lock {}: Not owner", lock); registry.counter(lockRelease.withTag("status", "FAILED_NOT_OWNER")).increment(); return false; default: log.error("Unknown release response code for lock {}", result, lock); registry.counter(lockRelease.withTag("status", "ERROR")).increment(); return false; } } finally { heartbeatQueue.removeIf(r -> r.getLock().equals(lock)); } }

Target:
public boolean releaseLock(@Nonnull final Lock lock) { try { Id lockRelease = releaseId.withTag("lockName", lock.getName()); String status = tryReleaseLock(lock); registry.counter(lockRelease.withTag("status", status)).increment(); switch (status) { case SUCCESS: case SUCCESS_GONE: log.info("Released lock {}", lock); return true; case FAILED_NOT_OWNER: log.warn("Failed releasing lock {}: Not owner", lock); return false; default: log.error("Unknown release response code for lock {}", status, lock); return false; } } finally { heartbeatQueue.removeIf(r -> r.getLock().equals(lock)); } }
Source:
protected void addVmTemplateImages(Map<Guid, Guid> srcDeviceIdToTargetDeviceIdMapping) { List<DiskImage> diskImages = getVmDisksFromDB(); if (diskImages.isEmpty()) { return; } List<CinderDisk> cinderDisks = new ArrayList<>(); for (DiskImage diskImage : diskImages) { if (diskImage.getImageStatus() == ImageStatus.ILLEGAL) { DiskImage snapshotImageInDb = getDiskImageDao().getSnapshotById(diskImage.getImageId()); if (snapshotImageInDb == null) { saveIllegalDisk(diskImage); } } else { if (diskImage.getDiskStorageType() == DiskStorageType.CINDER) { CinderDisk cinder = (CinderDisk) diskImage; cinderDisks.add(cinder); continue; } addVmTemplateImage(srcDeviceIdToTargetDeviceIdMapping, diskImage); } } if (!getReturnValue().getVdsmTaskIdList().isEmpty() || !cinderDisks.isEmpty()) { lockSnapshot(); } if (!cinderDisks.isEmpty()) { addVmTemplateCinderDisks(srcDeviceIdToTargetDeviceIdMapping); } }

Target:
protected void addVmTemplateImages(Map<Guid, Guid> srcDeviceIdToTargetDeviceIdMapping) { List<DiskImage> diskImages = getVmDisksFromDB(); if (diskImages.isEmpty()) { return; } List<CinderDisk> cinderDisks = new ArrayList<>(); for (DiskImage diskImage : diskImages) { if (diskImage.getImageStatus() == ImageStatus.ILLEGAL) { DiskImage snapshotImageInDb = getDiskImageDao().getSnapshotById(diskImage.getImageId()); if (snapshotImageInDb == null) { saveIllegalDisk(diskImage); } } else { if (diskImage.getDiskStorageType() == DiskStorageType.CINDER) { cinderDisks.add((CinderDisk) diskImage); continue; } addVmTemplateImage(srcDeviceIdToTargetDeviceIdMapping, diskImage); } } if (!getReturnValue().getVdsmTaskIdList().isEmpty() || !cinderDisks.isEmpty()) { lockSnapshot(); } if (!cinderDisks.isEmpty()) { addVmTemplateCinderDisks(srcDeviceIdToTargetDeviceIdMapping); } }
Source:
public static String fetchPrometheusUrl(Provider<KubevirtProviderProperties> provider, AuditLogDirector auditLogDirector) { OpenshiftApi api; Optional<V1Route> route = null; try { api = KubevirtUtils.getOpenshiftApi(provider); } catch (IOException e) { log.error("failed to connect to openshift for kubevirt provider (url = {}): {}", provider.getUrl(), ExceptionUtils.getRootCauseMessage(e)); log.debug("Exception", e); return null; } try { V1RouteList routes = api.listNamespacedRoute("openshift-monitoring", null, "metadata.name=prometheus-k8s", null, null, null, null, null, Boolean.FALSE); route = routes.getItems().stream().findAny(); } catch (ApiException e) { KubevirtUtils.auditAuthorizationIssues(e, auditLogDirector, provider); log.error("failed to retrieve prometheus url for kubevirt provider (url = {}): {}", provider.getUrl(), ExceptionUtils.getRootCauseMessage(e)); log.debug("Exception", e); } if (route != null && route.isPresent()) { String host = route.get().getSpec().getHost(); try { log.debug("Found Prometheus route '{}'", host); return new URI("https", host, null, null).toString(); } catch (URISyntaxException e) { log.error("Failed to retrieve prometheus url for kubevirt provider (host = {}, url = {}): {}", host, provider.getUrl(), ExceptionUtils.getRootCauseMessage(e)); log.debug("Exception", e); } } return null; }

Target:
public static String fetchPrometheusUrl(Provider<KubevirtProviderProperties> provider, AuditLogDirector auditLogDirector) { OpenshiftApi api; Optional<V1Route> route = null; try { api = KubevirtUtils.getOpenshiftApi(provider); } catch (IOException e) { log.error("failed to connect to openshift for kubevirt provider (url = {}): {}", provider.getUrl(), ExceptionUtils.getRootCauseMessage(e)); log.debug("Exception", e); return null; } try { V1RouteList routes = api.listNamespacedRoute("openshift-monitoring", null, "metadata.name=prometheus-k8s", null, null, null, null, null, Boolean.FALSE); route = routes.getItems().stream().findAny(); } catch (ApiException e) { KubevirtAuditUtils.auditAuthorizationIssues(e, auditLogDirector, provider); log.error("failed to retrieve prometheus url for kubevirt provider (url = {}): {}", provider.getUrl(), ExceptionUtils.getRootCauseMessage(e)); log.debug("Exception", e); } if (route != null && route.isPresent()) { String host = route.get().getSpec().getHost(); try { log.debug("Found Prometheus route '{}'", host); return new URI("https", host, null, null).toString(); } catch (URISyntaxException e) { log.error("Failed to retrieve prometheus url for kubevirt provider (host = {}, url = {}): {}", host, provider.getUrl(), ExceptionUtils.getRootCauseMessage(e)); log.debug("Exception", e); } } return null; }
Source:
public Trigger loadTrigger(int triggerId) throws TriggerLoaderException { logger.info("Loading trigger " + triggerId + " from db."); ResultSetHandler<List<Trigger>> handler = new TriggerResultHandler(); try { List<Trigger> triggers = dbOperator.query(GET_TRIGGER, handler, triggerId); if (triggers.size() == 0) { logger.error("Loaded 0 triggers. Failed to load trigger " + triggerId); throw new TriggerLoaderException("Loaded 0 triggers. Failed to load trigger " + triggerId); } return triggers.get(0); } catch (SQLException ex) { throw new TriggerLoaderException("Load a specific trigger failed."); } }

Target:
public Trigger loadTrigger(int triggerId) throws TriggerLoaderException { logger.info("Loading trigger " + triggerId + " from db."); ResultSetHandler<List<Trigger>> handler = new TriggerResultHandler(); try { List<Trigger> triggers = dbOperator.query(GET_TRIGGER, handler, triggerId); if (triggers.size() == 0) { logger.error("Loaded 0 triggers. Failed to load trigger " + triggerId); throw new TriggerLoaderException("Loaded 0 triggers. Failed to load trigger " + triggerId); } return triggers.get(0); } catch (SQLException ex) { logger.error("Failed to load trigger " + triggerId); throw new TriggerLoaderException("Load a specific trigger failed.", ex); } }
Source:
public static void registerItemBlocks(final RegistryEvent.Register<Item> event) { final ItemBlock[] items = { new ItemBlock(funnel), new ItemBlock(dissimulation), new ItemBlock(transvector_interface), new ItemBlock(transvector_dislocator), new ItemBlock(repairer), new ItemBlock(magnet), new ItemBlock(mob_magnet), (ItemBlock) new ItemBlock(nitor_vapor).setCreativeTab(null) }; final IForgeRegistry<Item> registry = event.getRegistry(); for (final ItemBlock item : items) { final Block block = item.getBlock(); final ResourceLocation registryName = Preconditions.checkNotNull(block.getRegistryName(), "Block %s has null registry name", block); registry.register(item.setRegistryName(registryName)); ITEM_BLOCKS.add(item); } }

Target:
public static void registerItemBlocks(final RegistryEvent.Register<Item> event) { final ItemBlock[] items = { new ItemBlock(funnel), new ItemBlock(dissimulation), new ItemBlock(transvector_interface), new ItemBlock(transvector_dislocator), new ItemBlock(repairer), new ItemBlock(magnet), new ItemBlock(mob_magnet), new ItemBlock(nitor_vapor) }; final IForgeRegistry<Item> registry = event.getRegistry(); for (final ItemBlock item : items) { final Block block = item.getBlock(); final ResourceLocation registryName = Preconditions.checkNotNull(block.getRegistryName(), "Block %s has null registry name", block); registry.register(item.setRegistryName(registryName)); ITEM_BLOCKS.add(item); } }
Source:
public GuiCustomModLoadingErrorScreen(CustomModLoadingErrorDisplayException customException) { super(); this.customException = customException; }

Target:
public GuiCustomModLoadingErrorScreen(CustomModLoadingErrorDisplayException customException) { this.customException = customException; }
Source:
public void internalSchedule(TimerJobInstance timerJobInstance) { TimerConfig config = new TimerConfig(new EjbTimerJob(timerJobInstance), true); Date expirationTime = timerJobInstance.getTrigger().hasNextFireTime(); logger.debug("Timer expiration date is {}", expirationTime); if (expirationTime != null) { timerService.createSingleActionTimer(expirationTime, config); logger.debug("Timer scheduled on scheduler service", timerJobInstance); if(USE_LOCAL_CACHE) localCache.putIfAbsent(((EjbGlobalJobHandle) timerJobInstance.getJobHandle()).getUuid(), timerJobInstance); } else { logger.info("Timer that was to be scheduled has already expired"); } }

Target:
public void internalSchedule(TimerJobInstance timerJobInstance) { TimerConfig config = new TimerConfig(new EjbTimerJob(timerJobInstance), true); Date expirationTime = timerJobInstance.getTrigger().hasNextFireTime(); logger.debug("Timer expiration date is {}", expirationTime); if (expirationTime != null) { timerService.createSingleActionTimer(expirationTime, config); logger.debug("Timer scheduled on scheduler service", timerJobInstance); if (USE_LOCAL_CACHE) { localCache.putIfAbsent(((EjbGlobalJobHandle) timerJobInstance.getJobHandle()).getUuid(), timerJobInstance); } } else { logger.info("Timer that was to be scheduled has already expired"); } }
Source:
public BaseStrictlySparseFieldFacet2D(Region3i targetRegion, Border3D border) { super(targetRegion, border); Vector2i size = getRelativeRegion().size(); this.data = new ArrayList<>(Collections.nCopies(size.x * size.y, Optional.empty())); }

Target:
public BaseStrictlySparseFieldFacet2D(Region3i targetRegion, Border3D border) { super(targetRegion, border); }
Source:
boolean getInclusive() { return inclusive == 1 ? true : false; }

Target:
boolean getInclusive() { return inclusive == (byte) 1; }
Source:
public void testPersonByNameAge() throws Exception { IndexFunction<Person> idx = index("nameAge", "WHERE name=? AND age=?"); Assert.assertEquals("nameAge", idx.getName()); IndexKeyBuilder b; Person p; b = new IndexKeyBuilder(); p = new Person(new Person.Key("hm"), 42); assertTrue(idx.includes(p)); idx.encode(b, p); assertEqualToBuilderResult(new byte[] {'h', 'm', 0x00, 0x01, 0x01, 42}, b); p = new Person(new Person.Key(null), 0); assertFalse(idx.includes(p)); new IndexKeyBuilder(); assertFalse(idx.includes(p)); }

Target:
public void testPersonByNameAge() throws Exception { IndexFunction<Person> idx = index("nameAge", "WHERE name=? AND age=?"); Assert.assertEquals("nameAge", idx.getName()); IndexKeyBuilder b; Person p; b = new IndexKeyBuilder(); p = new Person(new Person.Key("hm"), 42); assertTrue(idx.includes(p)); idx.encode(b, p); assertEqualToBuilderResult(new byte[] {'h', 'm', 0x00, 0x01, 0x01, 42}, b); p = new Person(new Person.Key(null), 0); assertFalse(idx.includes(p)); }
Source:
public ResponseEntity<String> upload( @RequestPart("file") MultipartFile file) { try { String documentName = file.getOriginalFilename(); ObjectMetadata objectMetadata = new ObjectMetadata(); objectMetadata.setContentLength(file.getSize()); objectMetadata.setContentType(file.getContentType()); PutObjectRequest putObjectRequest = new PutObjectRequest(this.bucketName, documentName, file.getInputStream(), objectMetadata) .withCannedAcl(CannedAccessControlList.PublicRead); s3Client.putObject(putObjectRequest); String objectUrl = s3Client.getUrl(this.bucketName, documentName).toExternalForm(); log.info("Uploaded " + documentName + " to S3 bucket: " + objectUrl); return new ResponseEntity<String>(objectUrl, HttpStatus.OK); } catch (Exception e) { log.error(e.getMessage(), e); return new ResponseEntity<String>(HttpStatus.BAD_REQUEST); } }

Target:
public ResponseEntity<String> upload(@RequestPart("file") MultipartFile file) throws SdkClientException, AmazonServiceException, IOException { String documentName = file.getOriginalFilename(); ObjectMetadata objectMetadata = new ObjectMetadata(); objectMetadata.setContentLength(file.getSize()); objectMetadata.setContentType(file.getContentType()); PutObjectRequest putObjectRequest = new PutObjectRequest(this.bucketName, documentName, file.getInputStream(), objectMetadata) .withCannedAcl(CannedAccessControlList.PublicRead); s3Client.putObject(putObjectRequest); String objectUrl = s3Client.getUrl(this.bucketName, documentName).toExternalForm(); log.info("Uploaded " + documentName + " to S3 bucket: " + objectUrl); return new ResponseEntity<String>(objectUrl, HttpStatus.OK); }
Source:
public <T> NSArray<T> valueForKey(ERXKey<T> erxKey, boolean removeNulls, boolean distinct, boolean flatten) { if (erxKey.type() == ERXKey.Type.Operator) { final String message = "You cannot use an Opperator (@sum, @max, etc.) ERXKey with valueForKey(ERXKey) " + "because the value returned by valueForKey(opperator) cannot be cast to NSArray. " + "Call valueForKey(myERXKey.key()) instead."; throw new IllegalArgumentException(message); } NSArray<T> values = (NSArray<T>) valueForKeyPath(erxKey.key()); if (removeNulls) { values = ERXArrayUtilities.removeNullValues(values); } if (flatten && erxKey.isToManyRelationship()) { values = ERXArrayUtilities.flatten(values); } if (distinct) { values = ERXArrayUtilities.distinct(values); } return values; }

Target:
public <T> NSArray<T> valueForKey(ERXKey<T> erxKey, boolean removeNulls, boolean distinct, boolean flatten) { if (erxKey.type() == ERXKey.Type.Operator) { final String message = "You cannot use an Operator (@sum, @max, etc.) ERXKey with valueForKey(ERXKey) " + "because the value returned by valueForKey(opperator) cannot be cast to NSArray. " + "Call valueForKey(MY_OPPERATOR_ERXKEY.key()) instead."; throw new IllegalArgumentException(message); } NSArray<T> values = (NSArray<T>) valueForKeyPath(erxKey.key()); if (removeNulls) { values = ERXArrayUtilities.removeNullValues(values); } if (flatten && erxKey.isToManyRelationship()) { values = ERXArrayUtilities.flatten(values); } if (distinct) { values = ERXArrayUtilities.distinct(values); } return values; }
Source:
private long getCrc32cAsLong(byte[] data) { return (long) Hashing.crc32c().hashBytes(data).asInt(); }

Target:
private long getCrc32cAsLong(byte[] data) { return Hashing.crc32c().hashBytes(data).padToLong(); }
Source:
default Tuple2<List<T>, List<T>> partition(Predicate<? super T> predicate) { Objects.requireNonNull(predicate, "predicate is null"); Queue<T> left = Queue.empty(), right = Queue.empty(); for (T t : this) { if (predicate.test(t)) { left = left.append(t); } else { right = right.append(t); } } return Tuple.of(left.toList(), right.toList()); }

Target:
default Tuple2<List<T>, List<T>> partition(Predicate<? super T> predicate) { Objects.requireNonNull(predicate, "predicate is null"); List<T> left = empty(), right = empty(); for (T t : this) { if (predicate.test(t)) { left = left.prepend(t); } else { right = right.prepend(t); } } return Tuple.of(left.reverse(), right.reverse()); }
Source:
public static void write004(Writer writer, Enumeration<Collector.MetricFamilySamples> mfs) throws IOException { while(mfs.hasMoreElements()) { Collector.MetricFamilySamples metricFamilySamples = mfs.nextElement(); writer.write("# HELP "); writer.write(metricFamilySamples.name); writer.write(' '); writeEscapedHelp(writer, metricFamilySamples.help); writer.write('\n'); writer.write("# TYPE "); writer.write(metricFamilySamples.name); writer.write(' '); writer.write(typeString(metricFamilySamples.type)); writer.write('\n'); for (Collector.MetricFamilySamples.Sample sample: metricFamilySamples.samples) { writer.write(sample.name); if (sample.labelNames.size() > 0) { writer.write('{'); for (int i = 0; i < sample.labelNames.size(); ++i) { writer.write(sample.labelNames.get(i)); writer.write("=\""); writeEscapedLabelValue(writer, sample.labelValues.get(i)); writer.write("\","); } writer.write('}'); } writer.write(' '); writer.write(Collector.doubleToGoString(sample.value)); if (sample.timestamp != null){ writer.write(' '); writer.write(sample.timestamp.toString()); } writer.write('\n'); } } }

Target:
public static void write004(Writer writer, Enumeration<Collector.MetricFamilySamples> mfs) throws IOException { while(mfs.hasMoreElements()) { Collector.MetricFamilySamples metricFamilySamples = mfs.nextElement(); writer.write("# HELP "); writer.write(metricFamilySamples.name); writer.write(' '); writeEscapedHelp(writer, metricFamilySamples.help); writer.write('\n'); writer.write("# TYPE "); writer.write(metricFamilySamples.name); writer.write(' '); writer.write(typeString(metricFamilySamples.type)); writer.write('\n'); for (Collector.MetricFamilySamples.Sample sample: metricFamilySamples.samples) { writer.write(sample.name); if (sample.labelNames.size() > 0) { writer.write('{'); for (int i = 0; i < sample.labelNames.size(); ++i) { writer.write(sample.labelNames.get(i)); writer.write("=\""); writeEscapedLabelValue(writer, sample.labelValues.get(i)); writer.write("\","); } writer.write('}'); } writer.write(' '); writer.write(Collector.doubleToGoString(sample.value)); if (sample.timestampMs != null){ writer.write(' '); writer.write(sample.timestampMs.toString()); } writer.write('\n'); } } }
Source:
public void readExternal(DataInputStream in, PrototypeFactory pf) throws IOException, DeserializationException { className = ExtUtil.readString(in); refs = (Hashtable<String, TreeReference>)ExtUtil.read(in, new ExtWrapMap(String.class, TreeReference.class), pf); responses = (Hashtable<String, TreeReference>)ExtUtil.read(in, new ExtWrapMap(String.class, TreeReference.class), pf); isQuick = ExtUtil.readBool(in); className = ExtUtil.readString(in); component = ExtUtil.readString(in); buttonLabel = ExtUtil.readString(in); }

Target:
public void readExternal(DataInputStream in, PrototypeFactory pf) throws IOException, DeserializationException { className = ExtUtil.readString(in); refs = (Hashtable<String, TreeReference>)ExtUtil.read(in, new ExtWrapMap(String.class, TreeReference.class), pf); responses = (Hashtable<String, TreeReference>)ExtUtil.read(in, new ExtWrapMap(String.class, TreeReference.class), pf); isQuick = ExtUtil.readBool(in); component = ExtUtil.readString(in); buttonLabel = ExtUtil.readString(in); }
Source:
private void refreshHighlighters(String mode) { clearAllMarkers(); Scheduler.get().scheduleDeferred(new ScheduledCommand() { @Override public void execute() { TextFileType fileType = editor_.getFileType(); highlighters_.clear(); if (pUserPrefs_.get().highlightWebLink().getValue()) { highlighters_.add(webLinkHighlighter()); } pUserPrefs_.get().highlightWebLink().bind( new CommandWithArg<Boolean>() { public void execute(Boolean arg) { if (arg) { highlighters_.add(webLinkHighlighter()); } else { highlighters_.remove(webLinkHighlighter()); } }}); if (fileType != null && (fileType.isMarkdown() || fileType.isRmd())) highlighters_.add(markdownLinkHighlighter()); nextHighlightStart_ = 0; timer_.schedule(700); } }); }

Target:
private void refreshHighlighters(String mode) { clearAllMarkers(); Scheduler.get().scheduleDeferred(new ScheduledCommand() { @Override public void execute() { TextFileType fileType = editor_.getFileType(); highlighters_.clear(); pUserPrefs_.get().highlightWebLink().bind( new CommandWithArg<Boolean>() { public void execute(Boolean arg) { if (arg) { highlighters_.add(webLinkHighlighter()); } else { highlighters_.remove(webLinkHighlighter()); } }}); if (fileType != null && (fileType.isMarkdown() || fileType.isRmd())) highlighters_.add(markdownLinkHighlighter()); nextHighlightStart_ = 0; timer_.schedule(700); } }); }