auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public int initializeAppResources(CommCareApp app) { try { currentApp = app; if (currentApp.initializeApplication()) { return STATE_READY; } else { return STATE_CORRUPTED; } } catch (Exception e) { Log.i("FAILURE", "Problem with loading"); Log.i("FAILURE", "E: " + e.getMessage()); e.printStackTrace(); ExceptionReportTask ert = new ExceptionReportTask(); ert.execute(e); return STATE_CORRUPTED; } }

Target:
public void initializeAppResources(CommCareApp app) { int resourceState; try { currentApp = app; if (currentApp.initializeApplication()) { resourceState = STATE_READY; } else { resourceState = STATE_CORRUPTED; } } catch (Exception e) { Log.i("FAILURE", "Problem with loading"); Log.i("FAILURE", "E: " + e.getMessage()); e.printStackTrace(); ExceptionReportTask ert = new ExceptionReportTask(); ert.execute(e); resourceState = STATE_CORRUPTED; } app.setAppResourceState(resourceState); }
Source:
public void canFetchLogsForQuery() { writeToLogs(1, 100); int lastVerified = 27; List<HistoryQuery> historyQueries = ImmutableList.of(HistoryQuery.of(NAMESPACE_AND_USE_CASE, lastVerified, lastVerified + 500)); List<LogsForNamespaceAndUseCase> paxosHistory = HistoryLoaderAndTransformer.getLogsForHistoryQueries(history, historyQueries); sanityCheckLoadedHistory(paxosHistory, 100 - lastVerified + 1); }

Target:
public void canFetchLogsForQuery() { writeToLogs(1, 100); int lastVerified = 27; List<HistoryQuery> historyQueries = ImmutableList.of(HistoryQueries.unboundedHistoryQuerySinceSeq(lastVerified)); List<LogsForNamespaceAndUseCase> paxosHistory = HistoryLoaderAndTransformer.getLogsForHistoryQueries(history, historyQueries); sanityCheckLoadedHistory(paxosHistory, 100 - lastVerified + 1); }
Source:
public void initialise() { final ScrollableArea scrollArea = find("scrollArea", ScrollableArea.class); scrollArea.moveToBottom(); commandLine = find("commandLine", UIText.class); getManager().setFocus(commandLine); commandLine.subscribe(widget -> { String text = commandLine.getText(); if (!text.isEmpty()) { String command = "say"; List<String> params = Collections.singletonList(text); console.execute(new Name(command), params, localPlayer.getClientEntity()); commandLine.setText(""); scrollArea.moveToBottom(); MiniChatOverlay overlay = nuiManager.addOverlay("engine:minichatOverlay", MiniChatOverlay.class); overlay.setVisible(true); nuiManager.closeScreen(this); } }); final UILabel history = find("messageHistory", UILabel.class); history.bindText(new ReadOnlyBinding<String>() { @Override public String get() { StringBuilder messageList = new StringBuilder(); for (Iterator<Message> it = console.getMessages(CoreMessageType.CHAT, CoreMessageType.NOTIFICATION).iterator(); it.hasNext();) { messageList.append(it.next().getMessage()); if (it.hasNext()) { messageList.append(Console.NEW_LINE); } } return messageList.toString(); } }); }

Target:
public void initialise() { final ScrollableArea scrollArea = find("scrollArea", ScrollableArea.class); scrollArea.moveToBottom(); commandLine = find("commandLine", UIText.class); getManager().setFocus(commandLine); commandLine.subscribe(widget -> { String text = commandLine.getText(); if (!text.isEmpty()) { String command = "say"; List<String> params = Collections.singletonList(text); console.execute(new Name(command), params, localPlayer.getClientEntity()); commandLine.setText(""); scrollArea.moveToBottom(); MiniChatOverlay overlay = nuiManager.addOverlay("engine:minichatOverlay", MiniChatOverlay.class); overlay.setVisible(true); nuiManager.closeScreen(this); } }); final UILabel history = find("messageHistory", UILabel.class); history.bindText(new ReadOnlyBinding<String>() { @Override public String get() { Iterable<Message> messageIterable = console.getMessages(CoreMessageType.CHAT, CoreMessageType.NOTIFICATION); Stream<Message> messageStream = StreamSupport.stream(messageIterable.spliterator(), false); return messageStream.map(Message::getMessage).collect(Collectors.joining(Console.NEW_LINE)); } }); }
Source:
public void testLiveEventListGet_withOptions() throws Exception { Client client = getLiveClient(); Request<ScopedList<Event>> request = new Event.ListRequestBuilder() .options(new ScopedList.Options() .limit(5) .order(Ordering.ReverseChronological)) .build(); ScopedList<Event> events = client.sendRequest(request, new TypeReference<ScopedList<Event>>() { }); assertEquals(5, events.getLimit()); assertEquals(5, events.getData().size()); assertEquals(Ordering.ReverseChronological, events.getOrder()); assertEquals(114, events.getTotal()); Event event = events.getData().get(0); assertNotNull(event); }

Target:
public void testLiveEventListGet_withOptions() throws Exception { Request<ScopedList<Event>> request = new Event.ListRequestBuilder() .options(new ScopedList.Options() .limit(5) .order(Ordering.ReverseChronological)) .build(); ScopedList<Event> events = client.sendRequest(request, new TypeReference<ScopedList<Event>>() { }); assertEquals(5, events.getLimit()); assertEquals(5, events.getData().size()); assertEquals(Ordering.ReverseChronological, events.getOrder()); assertTrue(events.getTotal() > 0); Event event = events.getData().get(0); assertNotNull(event); }
Source:
public void process(CarbonHttpRequest request, CarbonHttpResponse response, ConfigurationContext configurationContext) throws AxisFault { API api = getAPIFromSynapseConfig(request); if (api == null) { handleException(request.getRequestURI()); } else { String responseString; try { Yaml yamlDefinition = new Yaml(); String defFromRegistry = retrieveFromRegistry(api, request); if (defFromRegistry != null) { JsonParser jsonParser = new JsonParser(); responseString = yamlDefinition.dumpAsMap(GSONUtils.gsonJsonObjectToMap(jsonParser.parse(defFromRegistry))); } else { AxisConfiguration axisConfiguration = DataHolder.getInstance().getAxisConfigurationContext().getAxisConfiguration(); ServerConfig serverConfig = new CarbonServerConfig(axisConfiguration); responseString = yamlDefinition.dumpAsMap(new GenericApiObjectDefinition(api, serverConfig).getDefinitionMap()); } } catch (RegistryException e) { throw new AxisFault("Error occurred while retrieving swagger definition from registry", e); } updateResponse(response, responseString, SwaggerConstants.CONTENT_TYPE_YAML); } }

Target:
public void process(CarbonHttpRequest request, CarbonHttpResponse response, ConfigurationContext configurationContext) throws AxisFault { API api = getAPIFromSynapseConfig(request); if (api == null) { handleException(request.getRequestURI()); } else { String responseString; try { Yaml yamlDefinition = new Yaml(); String defFromRegistry = retrieveFromRegistry(api, request); if (defFromRegistry != null) { JsonParser jsonParser = new JsonParser(); responseString = yamlDefinition.dumpAsMap(GSONUtils.gsonJsonObjectToMap(jsonParser.parse(defFromRegistry))); } else { ServerConfig serverConfig = new CarbonServerConfig(); responseString = yamlDefinition.dumpAsMap(new GenericApiObjectDefinition(api, serverConfig).getDefinitionMap()); } } catch (RegistryException e) { throw new AxisFault("Error occurred while retrieving swagger definition from registry", e); } updateResponse(response, responseString, SwaggerConstants.CONTENT_TYPE_YAML); } }
Source:
private static Event compact(Event event) { final EventContext context = event.getContext(); final EventContext.Builder resultContext = context.toBuilder() .clearEnrichment(); final EventContext originEventContext = context.getEventContext(); if (!isDefault(originEventContext)) { resultContext.setEventContext(originEventContext.toBuilder() .clearOrigin() .clearEnrichment()); } final RejectionContext originRejectionContext = context.getRejectionContext(); if (!isDefault(originRejectionContext)) { resultContext.setRejectionContext(originRejectionContext.toBuilder() .clearEnrichment()); } return event.toBuilder() .setContext(resultContext) .build(); }

Target:
private static Event compact(Event event) { final EventContext context = event.getContext(); final EventContext.Builder resultContext = context.toBuilder() .clearEnrichment(); final EventContext.OriginCase originCase = resultContext.getOriginCase(); switch (originCase) { case EVENT_CONTEXT: resultContext.setEventContext(context.getEventContext() .toBuilder() .clearOrigin() .clearEnrichment()); break; case REJECTION_CONTEXT: resultContext.setRejectionContext(context.getRejectionContext() .toBuilder() .clearEnrichment()); break; case COMMAND_CONTEXT: break; case ORIGIN_NOT_SET: break; default: throw newIllegalStateException("Unsupported origin case encountered: %s", originCase); } return event.toBuilder() .setContext(resultContext) .build(); }
Source:
public boolean isEquilateral() { throw new UnsupportedOperationException("Delete this statement and write your own implementation."); }

Target:
boolean isEquilateral() { throw new UnsupportedOperationException("Delete this statement and write your own implementation."); }
Source:
private static Double toNumeric_inclusiveOfDatestrings(Object o) { Double d = toNumeric(o); if (Double.isNaN(d.doubleValue())) { o = unpack(o); if (o instanceof String) { Date dateFromString = DateUtils.parseDate((String)o); if (dateFromString != null) { return new Double(DateUtils.daysSinceEpoch(dateFromString)); } } } return d; }

Target:
private static Double toNumeric_inclusiveOfDatestrings(Object o) { Double d = toNumeric(o); if (Double.isNaN(d.doubleValue())) { o = unpack(o); if (o instanceof String) { Date dateFromString = DateUtils.parseDate((String)o); if (dateFromString != null) { return toNumeric(dateFromString); } } } return d; }
Source:
public List<Attribute> getRequiredAttributes(PerunSession sess, Resource resourceToGetServicesFrom, Member member, Group group) throws InternalErrorException { try { return jdbc.query("select " + getAttributeMappingSelectQuery("mem") + " from attr_names " + "left join member_group_attr_values mem on id=mem.attr_id and mem.group_id=? and member_id=? " + "where namespace in (?,?,?) " + "and attr_names.id in (select distinct service_required_attrs.attr_id from service_required_attrs " + "join resource_services on service_required_attrs.service_id=resource_services.service_id and resource_services.resource_id=?)", new AttributeRowMapper(sess, this, null), group.getId(), member.getId(), AttributesManager.NS_MEMBER_GROUP_ATTR_DEF, AttributesManager.NS_MEMBER_GROUP_ATTR_OPT, AttributesManager.NS_MEMBER_GROUP_ATTR_VIRT, resourceToGetServicesFrom.getId()); } catch(EmptyResultDataAccessException ex) { return new ArrayList<Attribute>(); } catch(RuntimeException ex) { throw new InternalErrorException(ex); } }

Target:
public List<Attribute> getRequiredAttributes(PerunSession sess, Resource resourceToGetServicesFrom, Member member, Group group) throws InternalErrorException { try { return jdbc.query("select " + getAttributeMappingSelectQuery("mem_gr") + " from attr_names " + "left join member_group_attr_values mem_gr on id=mem_gr.attr_id and mem_gr.group_id=? and member_id=? " + "where namespace in (?,?,?) " + "and attr_names.id in (select distinct service_required_attrs.attr_id from service_required_attrs " + "join resource_services on service_required_attrs.service_id=resource_services.service_id and resource_services.resource_id=?)", new AttributeRowMapper(sess, this, null), group.getId(), member.getId(), AttributesManager.NS_MEMBER_GROUP_ATTR_DEF, AttributesManager.NS_MEMBER_GROUP_ATTR_OPT, AttributesManager.NS_MEMBER_GROUP_ATTR_VIRT, resourceToGetServicesFrom.getId()); } catch(EmptyResultDataAccessException ex) { return new ArrayList<Attribute>(); } catch(RuntimeException ex) { throw new InternalErrorException(ex); } }
Source:
private HostControllerBootstrap boot(String[] args, final String authCode) { try { final long startTime = Module.getStartTime(); final HostControllerEnvironmentWrapper hostControllerEnvironmentWrapper = determineEnvironment(args, startTime); if (hostControllerEnvironmentWrapper.getHostControllerEnvironment() == null) { usage(); if (hostControllerEnvironmentWrapper.getHostControllerEnvironmentStatus() == HostControllerEnvironmentWrapper.HostControllerEnvironmentStatus.ERROR) { abort(); } return null; } else { try { final HostControllerBootstrap hc = new HostControllerBootstrap(hostControllerEnvironmentWrapper.getHostControllerEnvironment(), authCode); hc.bootstrap(); return hc; } catch(Throwable t) { abort(t); return null; } } } catch (Throwable t) { abort(t); return null; } }

Target:
private HostControllerBootstrap boot(String[] args, final String authCode) { try { final long startTime = Module.getStartTime(); final HostControllerEnvironmentWrapper hostControllerEnvironmentWrapper = determineEnvironment(args, startTime); if (hostControllerEnvironmentWrapper.getHostControllerEnvironment() == null) { usage(); if (hostControllerEnvironmentWrapper.getHostControllerEnvironmentStatus() == HostControllerEnvironmentWrapper.HostControllerEnvironmentStatus.ERROR) { abort(); } else { SystemExiter.safeAbort(); } return null; } else { try { final HostControllerBootstrap hc = new HostControllerBootstrap(hostControllerEnvironmentWrapper.getHostControllerEnvironment(), authCode); hc.bootstrap(); return hc; } catch(Throwable t) { abort(t); return null; } } } catch (Throwable t) { abort(t); return null; } }
Source:
public MethodInvariantContext(MethodTree methodTree) { this.methodTree = methodTree; TypeTree returnType = methodTree.returnType(); this.returnStatementTrees = extractReturnStatements(methodTree); methodToCheck = !isConstructorOrVoid(returnType) && returnStatementTrees.size() > 1; returnImmutableType = methodToCheck && (returnType.symbolType().isPrimitive() || returnType.symbolType().is("java.lang.String")); }

Target:
MethodInvariantContext(MethodTree methodTree) { this.methodTree = methodTree; TypeTree returnType = methodTree.returnType(); this.returnStatementTrees = extractReturnStatements(methodTree); methodToCheck = !isConstructorOrVoid(methodTree, returnType) && returnStatementTrees.size() > 1; returnImmutableType = methodToCheck && (returnType.symbolType().isPrimitive() || returnType.symbolType().is("java.lang.String")); }
Source:
protected static Predicate<Image> createPredicateMatchingRepoTags(final String imageIdOrName) { return new Predicate<Image>() { @Override public boolean apply(Image input) { final String imageNameWithHostPrefix = "docker.io/" + imageIdOrName; for (String tag : input.repoTags()) { if (tag.equals(imageIdOrName) || tag.equals(imageIdOrName + ":latest") || tag.equals(imageNameWithHostPrefix) || tag.equals(imageNameWithHostPrefix + ":latest")) { return true; } } return false; } }; }

Target:
protected static Predicate<Image> createPredicateMatchingRepoTags(final String imageIdOrName) { final Pattern imgPattern = Pattern .compile(PATTERN_IMAGE_PREFIX + Pattern.quote(imageIdOrName) + PATTERN_IMAGE_SUFFIX); return new Predicate<Image>() { @Override public boolean apply(Image input) { for (String tag : input.repoTags()) { if (imgPattern.matcher(tag).matches()) { return true; } } return false; } }; }
Source:
public void validateInstalatorData(VM vm, String token) throws InvalidInstallProductRequestException { if (!vm.canWorkWithInstallatorServer()) { String message = "The VM does not include the node hostname required to Install " + "software"; throw new InvalidInstallProductRequestException(message); } try { this.isNodeRegistered(vm.getHostname(), token); } catch (CanNotCallChefException e) { String errorMesg = "Node " + vm.getHostname() + " is not registered in ChefServer"; log.info(errorMesg); throw new InvalidInstallProductRequestException(errorMesg); } }

Target:
public void validateInstalatorData(VM vm, String token) throws InvalidInstallProductRequestException { if (!vm.canWorkWithInstallatorServer()) { String message = "The VM does not include the node hostname required to Install " + "software"; throw new InvalidInstallProductRequestException(message); } try { this.isNodeRegistered(vm.getHostname(), token); } catch (CanNotCallPuppetException e) { String errorMesg = "Node " + vm.getHostname() + " is not registered in the puppet master " + e.getMessage(); log.info(errorMesg); throw new InvalidInstallProductRequestException(errorMesg); } }
Source:
public void initialise() { UIText address = find("address", UIText.class); getManager().setFocus(address); WidgetUtil.trySubscribe(this, "join", new ActivateEventListener() { @Override public void onActivated(UIWidget button) { getManager().popScreen(); UIText address = find("address", UIText.class); JoinStatus status = networkSystem.join(address.getText(), TerasologyConstants.DEFAULT_PORT); if (status.getStatus() != JoinStatus.Status.FAILED) { engine.changeState(new StateLoading(status)); } else { getManager().pushScreen("engine:errorMessagePopup", ErrorMessagePopup.class) .setError("Failed to Join", "Could not connect to server - " + status.getErrorMessage()); } } }); WidgetUtil.trySubscribe(this, "cancel", new ActivateEventListener() { @Override public void onActivated(UIWidget button) { getManager().popScreen(); } }); }

Target:
public void initialise() { WidgetUtil.trySubscribe(this, "join", new ActivateEventListener() { @Override public void onActivated(UIWidget button) { getManager().popScreen(); UIText address = find("address", UIText.class); JoinStatus status = networkSystem.join(address.getText(), TerasologyConstants.DEFAULT_PORT); if (status.getStatus() != JoinStatus.Status.FAILED) { engine.changeState(new StateLoading(status)); } else { getManager().pushScreen("engine:errorMessagePopup", ErrorMessagePopup.class) .setError("Failed to Join", "Could not connect to server - " + status.getErrorMessage()); } } }); WidgetUtil.trySubscribe(this, "cancel", new ActivateEventListener() { @Override public void onActivated(UIWidget button) { getManager().popScreen(); } }); }
Source:
public HandlerResult handle(ProcessState state, ProcessInstance process) { Instance instance = (Instance)state.getResource(); if (!InstanceConstants.CONTAINER_LIKE.contains(instance.getKind())) { return null; } Map<String, Object> labels = DataAccessor.fieldMap(instance, InstanceConstants.FIELD_LABELS); Map<Object, Object> data = new HashMap<>(); if (labels.containsKey(SystemLabels.LABEL_AGENT_CREATE) && labels.get(SystemLabels.LABEL_AGENT_CREATE).equals("true")) { List<String> dataVolumes = new ArrayList<>(DataAccessor.fieldStringList(instance, InstanceConstants.FIELD_DATA_VOLUMES)); if (!dataVolumes.contains(AgentConstants.AGENT_INSTANCE_BIND_MOUNT)) { dataVolumes.add(AgentConstants.AGENT_INSTANCE_BIND_MOUNT); } data.put(InstanceConstants.FIELD_DATA_VOLUMES, dataVolumes); } setName(instance, labels, data); setNetworkMode(instance, labels, data); setDns(instance, labels, data); setLogConfig(instance, data); if (!data.isEmpty()) { return new HandlerResult(data); } String uuid = DataAccessor.fieldString(instance, InstanceConstants.FIELD_IMAGE_UUID); if (uuid == null || uuid.isEmpty() || uuid.trim().isEmpty()) { return null; } String fullImageName = DockerImage.parse(uuid).getFullName(); DockerImage dockerImage = DockerImage.parse(uuid); if (dockerImage == null) { return null; } String server = dockerImage.getServer(); if (!fullImageName.startsWith(server)) { String defaultRegistry = DEFAULT_REGISTRY.get(); fullImageName = defaultRegistry + "/" + fullImageName; } data.put(InstanceConstants.FIELD_IMAGE_UUID, fullImageName); return null; }

Target:
public HandlerResult handle(ProcessState state, ProcessInstance process) { Instance instance = (Instance)state.getResource(); if (!InstanceConstants.CONTAINER_LIKE.contains(instance.getKind())) { return null; } Map<String, Object> labels = DataAccessor.fieldMap(instance, InstanceConstants.FIELD_LABELS); Map<Object, Object> data = new HashMap<>(); if (labels.containsKey(SystemLabels.LABEL_AGENT_CREATE) && labels.get(SystemLabels.LABEL_AGENT_CREATE).equals("true")) { List<String> dataVolumes = new ArrayList<>(DataAccessor.fieldStringList(instance, InstanceConstants.FIELD_DATA_VOLUMES)); if (!dataVolumes.contains(AgentConstants.AGENT_INSTANCE_BIND_MOUNT)) { dataVolumes.add(AgentConstants.AGENT_INSTANCE_BIND_MOUNT); } data.put(InstanceConstants.FIELD_DATA_VOLUMES, dataVolumes); } setName(instance, labels, data); setNetworkMode(instance, labels, data); setDns(instance, labels, data); setLogConfig(instance, data); if (!data.isEmpty()) { return new HandlerResult(data); } return null; }
Source:
public List<MetricFamilySamples> collect() { ArrayList<MetricFamilySamples> mfSamples = new ArrayList<MetricFamilySamples>(); for (SortedMap.Entry<String, Gauge> entry : registry.getGauges().entrySet()) { mfSamples.addAll(fromGauge(entry.getKey(), entry.getValue())); } for (SortedMap.Entry<String, Counter> entry : registry.getCounters().entrySet()) { mfSamples.addAll(fromCounter(entry.getKey(), entry.getValue())); } for (SortedMap.Entry<String, Histogram> entry : registry.getHistograms().entrySet()) { mfSamples.addAll(fromHistogram(entry.getKey(), entry.getValue())); } for (SortedMap.Entry<String, Timer> entry : registry.getTimers().entrySet()) { mfSamples.addAll(fromTimer(entry.getKey(), entry.getValue())); } for (SortedMap.Entry<String, Meter> entry : registry.getMeters().entrySet()) { mfSamples.addAll(fromMeter(entry.getKey(), entry.getValue())); } return mfSamples; }

Target:
public List<MetricFamilySamples> collect() { ArrayList<MetricFamilySamples> mfSamples = new ArrayList<MetricFamilySamples>(); for (SortedMap.Entry<String, Gauge> entry : registry.getGauges().entrySet()) { mfSamples.addAll(fromGauge(sanitizeMetricName(entry.getKey()), entry.getValue())); } for (SortedMap.Entry<String, Counter> entry : registry.getCounters().entrySet()) { mfSamples.addAll(fromCounter(sanitizeMetricName(entry.getKey()), entry.getValue())); } for (SortedMap.Entry<String, Histogram> entry : registry.getHistograms().entrySet()) { mfSamples.addAll(fromHistogram(sanitizeMetricName(entry.getKey()), entry.getValue())); } for (SortedMap.Entry<String, Timer> entry : registry.getTimers().entrySet()) { mfSamples.addAll(fromTimer(sanitizeMetricName(entry.getKey()), entry.getValue())); } for (SortedMap.Entry<String, Meter> entry : registry.getMeters().entrySet()) { mfSamples.addAll(fromMeter(sanitizeMetricName(entry.getKey()), entry.getValue())); } return mfSamples; }
Source:
public boolean hasChildren(Object element) { return ((MyModel) element).children.size() > 0; }

Target:
public boolean hasChildren(Object element) { return !((MyModel) element).children.isEmpty(); }
Source:
public BarData doInBackground(Void... params) { cardDao = dbOpenHelper.getCardDao(); Integer DAYS = 30; List<String> xVals = new ArrayList<String>(INITIAL_CAPACITY); List<BarEntry> yVals = new ArrayList<BarEntry>(INITIAL_CAPACITY); Integer MILLISECONDS_PER_DAY = 60 * 60 * 24 * 1000; Date now = new Date(); for (int i = -INITIAL_CAPACITY; i < 1; i++) { Date endDate = new Date(now.getTime() + i * MILLISECONDS_PER_DAY); Date startDate = new Date(endDate.getTime() - MILLISECONDS_PER_DAY); xVals.add("" + i); yVals.add(new BarEntry((float)cardDao.getNewLearnedCardCount(null, startDate, endDate), INITIAL_CAPACITY + i)); } BarDataSet dataSet = new BarDataSet(yVals, getString(R.string.number_of_new_cards_learned_in_a_day_text)); BarData data = new BarData(xVals, dataSet); data.setValueTextColor(Color.WHITE); return data; }

Target:
public BarData doInBackground(Void... params) { cardDao = dbOpenHelper.getCardDao(); List<String> xVals = new ArrayList<String>(INITIAL_CAPACITY); List<BarEntry> yVals = new ArrayList<BarEntry>(INITIAL_CAPACITY); Date now = new Date(); for (int i = -INITIAL_CAPACITY; i < 1; i++) { Date endDate = new Date(now.getTime() + i * MILLISECONDS_PER_DAY); Date startDate = new Date(endDate.getTime() - MILLISECONDS_PER_DAY); xVals.add("" + i); yVals.add(new BarEntry((float)cardDao.getNewLearnedCardCount(null, startDate, endDate), INITIAL_CAPACITY + i)); } BarDataSet dataSet = new BarDataSet(yVals, getString(R.string.number_of_new_cards_learned_in_a_day_text)); BarData data = new BarData(xVals, dataSet); data.setValueTextColor(Color.WHITE); return data; }
Source:
SuggestReviewers(AccountVisibility av, AccountInfo.Loader.Factory accountLoaderFactory, AccountControl.Factory accountControlFactory, AccountCache accountCache, GroupMembers.Factory groupMembersFactory, IdentifiedUser.GenericFactory identifiedUserFactory, Provider<CurrentUser> currentUser, Provider<ReviewDb> dbProvider, @GerritServerConfig Config cfg, GroupBackend groupBackend) { this.accountLoaderFactory = accountLoaderFactory; this.accountControlFactory = accountControlFactory; this.accountCache = accountCache; this.groupMembersFactory = groupMembersFactory; this.dbProvider = dbProvider; this.identifiedUserFactory = identifiedUserFactory; this.currentUser = currentUser; this.groupBackend = groupBackend; String suggest = cfg.getString("suggest", null, "accounts"); if ("OFF".equalsIgnoreCase(suggest) || Boolean.FALSE.toString().equalsIgnoreCase(suggest)) { this.suggestAccounts = false; } else { this.suggestAccounts = (av != AccountVisibility.NONE); } this.suggestFrom = cfg.getInt("suggest", null, "from", 0); this.maxAllowed = cfg.getInt("addreviewer", "maxAllowed", PostReviewers.DEFAULT_MAX_REVIEWERS); }

Target:
SuggestReviewers(AccountVisibility av, AccountInfo.Loader.Factory accountLoaderFactory, AccountControl.Factory accountControlFactory, AccountCache accountCache, GroupMembers.Factory groupMembersFactory, IdentifiedUser.GenericFactory identifiedUserFactory, Provider<CurrentUser> currentUser, Provider<ReviewDb> dbProvider, @GerritServerConfig Config cfg, GroupBackend groupBackend) { this.accountLoaderFactory = accountLoaderFactory; this.accountControlFactory = accountControlFactory; this.accountCache = accountCache; this.groupMembersFactory = groupMembersFactory; this.dbProvider = dbProvider; this.identifiedUserFactory = identifiedUserFactory; this.currentUser = currentUser; this.groupBackend = groupBackend; String suggest = cfg.getString("suggest", null, "accounts"); if ("OFF".equalsIgnoreCase(suggest) || "false".equalsIgnoreCase(suggest)) { this.suggestAccounts = false; } else { this.suggestAccounts = (av != AccountVisibility.NONE); } this.suggestFrom = cfg.getInt("suggest", null, "from", 0); this.maxAllowed = cfg.getInt("addreviewer", "maxAllowed", PostReviewers.DEFAULT_MAX_REVIEWERS); }
Source:
JMXReporter(@Nullable final String portsConfig) { this.mBeanServer = ManagementFactory.getPlatformMBeanServer(); this.registeredMetrics = new HashMap<>(); if (portsConfig != null) { this.jmxServer = JMXServer.getInstance(portsConfig); } else { this.jmxServer = null; } LOG.info("Configured JMXReporter with {port:{}}", portsConfig); }

Target:
JMXReporter(@Nullable final String portsConfig) { this.mBeanServer = ManagementFactory.getPlatformMBeanServer(); this.registeredMetrics = new HashMap<>(); if (portsConfig != null) { LOG.warn("JMXReporter port config is deprecated. " + "Please use: instead!", JMXServerOptions.JMX_SERVER_PORT); JMXService.startInstance(portsConfig); } }
Source:
public ToStringHelper string() { ToStringHelper toString = super.string(); if (privateNetworking != null) { toString.add("privateNetworking", privateNetworking); } if (backupsEnabled != null) { toString.add("backupsEnabled", backupsEnabled); } if (!sshKeyIds.isEmpty()) { toString.add("sshKeyIds", sshKeyIds); } return toString; }

Target:
public ToStringHelper string() { ToStringHelper toString = super.string().omitNullValues(); toString.add("privateNetworking", privateNetworking); toString.add("backupsEnabled", backupsEnabled); if (!sshKeyIds.isEmpty()) { toString.add("sshKeyIds", sshKeyIds); } return toString; }
Source:
public CosmosTemplate(CosmosFactory cosmosFactory, CosmosConfig cosmosConfig, MappingCosmosConverter mappingCosmosConverter) { Assert.notNull(cosmosFactory, "CosmosDbFactory must not be null!"); Assert.notNull(mappingCosmosConverter, "MappingCosmosConverter must not be null!"); this.cosmosFactory = cosmosFactory; this.cosmosConfig = cosmosConfig; this.mappingCosmosConverter = mappingCosmosConverter; this.cosmosAsyncClient = cosmosFactory.getCosmosClient(); }

Target:
public CosmosTemplate(CosmosFactory cosmosFactory, CosmosConfig cosmosConfig, MappingCosmosConverter mappingCosmosConverter) { Assert.notNull(cosmosFactory, "CosmosFactory must not be null!"); Assert.notNull(mappingCosmosConverter, "MappingCosmosConverter must not be null!"); this.mappingCosmosConverter = mappingCosmosConverter; this.cosmosAsyncClient = cosmosFactory.getCosmosAsyncClient(); this.databaseName = cosmosFactory.getDatabaseName(); this.responseDiagnosticsProcessor = cosmosConfig.getResponseDiagnosticsProcessor(); this.queryMetricsEnabled = cosmosConfig.isQueryMetricsEnabled(); }
Source:
public static <T1, T2, R> Single<R> zip(Single<? extends T1> s1, Single<? extends T2> s2, final Func2<? super T1, ? super T2, ? extends R> zipFunction) { return SingleOperatorZip.zip(new Single<?>[] {s1, s2}, new FuncN<R>() { @Override public R call(Object... args) { return zipFunction.call((T1) args[0], (T2) args[1]); } }); }

Target:
public static final <T1, T2, R> Single<R> zip(Single<? extends T1> s1, Single<? extends T2> s2, final Func2<? super T1, ? super T2, ? extends R> zipFunction) { return SingleOperatorZip.zip(new Single<?>[] {s1, s2}, new FuncN<R>() { @Override public R call(Object... args) { return zipFunction.call((T1) args[0], (T2) args[1]); } }); }
Source:
public boolean shouldExecuteOnProject(Project project) { return fileSystem.hasFiles(fileSystem.predicates().hasLanguage(Python.KEY)); }

Target:
public boolean shouldExecuteOnProject(Project project) { FilePredicates p = fileSystem.predicates(); return fileSystem.hasFiles(p.and(p.hasType(InputFile.Type.MAIN), p.hasLanguage(Python.KEY))); }
Source:
private void respondHello(String header, Socket s) throws IOException { try { Writer o = new OutputStreamWriter(s.getOutputStream(), "UTF-8"); if (header.startsWith("GET / ")) { o.write("HTTP/1.0 200 OK\n"); o.write("Content-Type: text/plain;charset=UTF-8\n"); o.write("\n"); o.write("Jenkins-Agent-Protocols: "); boolean first = true; for (AgentProtocol p : AgentProtocol.all()) { if (first) first = false; else o.write(","); o.write(p.getName()); } o.write("\n"); o.write("Jenkins-Version: " + Jenkins.VERSION + "\n"); o.write("Jenkins-Session: " + Jenkins.SESSION_HASH + "\n"); o.write("Client: " + s.getInetAddress().getHostAddress() + "\n"); o.flush(); s.shutdownOutput(); } else { o.write("HTTP/1.0 404 Not Found\n"); o.write("Content-Type: text/plain;charset=UTF-8\n"); o.write("\n"); o.write("Not Found\n"); o.flush(); s.shutdownOutput(); } InputStream i = s.getInputStream(); IOUtils.copy(i, new NullOutputStream()); s.shutdownInput(); } finally { s.close(); } }

Target:
private void respondHello(String header, Socket s) throws IOException { try { Writer o = new OutputStreamWriter(s.getOutputStream(), "UTF-8"); if (header.startsWith("GET / ")) { o.write("HTTP/1.0 200 OK\r\n"); o.write("Content-Type: text/plain;charset=UTF-8\r\n"); o.write("\r\n"); o.write("Jenkins-Agent-Protocols: "); boolean first = true; for (AgentProtocol p : AgentProtocol.all()) { if (first) first = false; else o.write(","); o.write(p.getName()); } o.write("\r\n"); o.write("Jenkins-Version: " + Jenkins.VERSION + "\r\n"); o.write("Jenkins-Session: " + Jenkins.SESSION_HASH + "\r\n"); o.write("Client: " + s.getInetAddress().getHostAddress() + "\r\n"); o.write("Server: " + s.getLocalAddress().getHostAddress() + "\r\n"); o.flush(); s.shutdownOutput(); } else { o.write("HTTP/1.0 404 Not Found\r\n"); o.write("Content-Type: text/plain;charset=UTF-8\r\n"); o.write("\r\n"); o.write("Not Found\r\n"); o.flush(); s.shutdownOutput(); } InputStream i = s.getInputStream(); IOUtils.copy(i, new NullOutputStream()); s.shutdownInput(); } finally { s.close(); } }
Source:
protected String modifybasename(String suggestedname) { String name=suggestedname; for(String prefix : CUT_PREFIX) { if(suggestedname.toLowerCase().startsWith(prefix)) { if(suggestedname.length()>prefix.length()) { name= suggestedname.substring(prefix.length()); } } } for(String suffix : IRREG_NOUNS.keySet()) { if(name.toLowerCase().endsWith(suffix.toLowerCase())) { String firstpart=name.substring(0,name.length()-suffix.length()); return firstpart+IRREG_NOUNS.get(suffix); } } for(String varname : NO_JAVA_TYPES) { if(name.equalsIgnoreCase(varname)) { return FOR_LOOP_ELEMENT_IDENTIFIER; } } for(String suffix : IRREG_ENDINGS) { if(name.toLowerCase().endsWith(suffix)) { return FOR_LOOP_ELEMENT_IDENTIFIER; } } if(name.length()>2 && name.endsWith("s")) { return name.substring(0,name.length()-1); } return FOR_LOOP_ELEMENT_IDENTIFIER; }

Target:
protected String modifybasename(String suggestedname) { String name=suggestedname; for(String prefix : CUT_PREFIX) { if(prefix.length()>=suggestedname.length()) { continue; } char afterprefix= suggestedname.charAt(prefix.length()); if(Character.isUpperCase(afterprefix)||afterprefix=='_') { if(suggestedname.toLowerCase().startsWith(prefix)) { String name_without_prefix= suggestedname.substring(prefix.length()); if(name_without_prefix.startsWith("_")&&name_without_prefix.length()>1) { name= name_without_prefix.substring(1); } else { name= name_without_prefix; } if(name.length()==1) { return name; } break; } } } for(String suffix : IRREG_NOUNS.keySet()) { if(name.toLowerCase().endsWith(suffix.toLowerCase())) { String firstpart=name.substring(0,name.length()-suffix.length()); return firstpart+IRREG_NOUNS.get(suffix); } } for(String varname : NO_JAVA_TYPES) { if(name.equalsIgnoreCase(varname)) { return FOR_LOOP_ELEMENT_IDENTIFIER; } } for(String suffix : IRREG_ENDINGS) { if(name.toLowerCase().endsWith(suffix)) { return FOR_LOOP_ELEMENT_IDENTIFIER; } } if(name.length()>2 && name.endsWith("s")) { return name.substring(0,name.length()-1); } return FOR_LOOP_ELEMENT_IDENTIFIER; }
Source:
private Encounter checkVersionAndSetEncounter(Config config, String responseJson) { Encounter createdEncounter; if ("1.9".equals(config.getOpenMrsVersion())) { createdEncounter = buildGsonWithAdaptersDeserialize().fromJson(responseJson, Encounter.class); } else { createdEncounter = (Encounter) JsonUtils.readJson(responseJson, Encounter.class); } return createdEncounter; }

Target:
private Encounter checkVersionAndSetEncounter(Config config, String responseJson) { Encounter createdEncounter; if (OPENMRS_V19.equals(config.getOpenMrsVersion())) { createdEncounter = buildGsonWithAdaptersDeserialize().fromJson(responseJson, Encounter.class); } else { createdEncounter = (Encounter) JsonUtils.readJson(responseJson, Encounter.class); } return createdEncounter; }
Source:
public EEFLabelLifecycleManager(EEFLabelDescription description, IVariableManager variableManager, IInterpreter interpreter, TransactionalEditingDomain editingDomain) { super(description, variableManager, interpreter, editingDomain); this.description = description; }

Target:
public EEFLabelLifecycleManager(EEFLabelDescription description, IVariableManager variableManager, IInterpreter interpreter, TransactionalEditingDomain editingDomain) { super(variableManager, interpreter, editingDomain); this.description = description; }
Source:
public DMNModel compile(Reader source) { try { Definitions dmndefs = null; if(dmnCompilerConfig != null) { if (dmnCompilerConfig.getRegisteredExtensions().isEmpty()) { dmndefs = DMNMarshallerFactory.newMarshallerWithExtensions(getDmnCompilerConfig().getRegisteredExtensions()).unmarshal( source ); } }else { dmndefs = DMNMarshallerFactory.newDefaultMarshaller().unmarshal(source); } DMNModel model = compile( dmndefs ); return model; } catch ( Exception e ) { logger.error( "Error compiling model from source.", e ); } return null; }

Target:
public DMNModel compile(Reader source) { try { Definitions dmndefs = null; if(dmnCompilerConfig != null && !dmnCompilerConfig.getRegisteredExtensions().isEmpty()) { dmndefs = DMNMarshallerFactory.newMarshallerWithExtensions(getDmnCompilerConfig().getRegisteredExtensions()).unmarshal( source ); } else { dmndefs = DMNMarshallerFactory.newDefaultMarshaller().unmarshal(source); } DMNModel model = compile( dmndefs ); return model; } catch ( Exception e ) { logger.error( "Error compiling model from source.", e ); } return null; }
Source:
public long getIncomingTuplesCount() { return incomingTuplesCount; }

Target:
protected long getIncomingTuplesCount() { return incomingTuplesCount; }
Source:
public void onDeleted(Run run) { Job<?, ?> j = run.getParent(); for (PeepholePermalink pp : Util.filter(j.getPermalinks(), PeepholePermalink.class)) { if (pp.resolve(j)==run) { Run<?,?> r = pp.find(run.getPreviousBuild()); LOGGER.fine("Updating "+pp.getPermalinkFile(j).getName()+" permalink from deleted "+run.getNumber()+" to "+(r == null ? -1 : r.getNumber())); pp.updateCache(j,r); } } }

Target:
public void onDeleted(Run run) { Job<?, ?> j = run.getParent(); for (PeepholePermalink pp : Util.filter(j.getPermalinks(), PeepholePermalink.class)) { if (pp.resolve(j)==run) { Run<?,?> r = pp.find(run.getPreviousBuild()); if (LOGGER.isLoggable(Level.FINE)) LOGGER.fine("Updating "+pp.getPermalinkFile(j).getName()+" permalink from deleted "+run.getNumber()+" to "+(r == null ? -1 : r.getNumber())); pp.updateCache(j,r); } } }
Source:
@Override public <T> void addPolygon(AirMapPolygon<T> polygon) { try { JSONArray array = new JSONArray(); for (LatLng point : polygon.getPolygonOptions().getPoints()) { JSONObject json = new JSONObject(); json.put("lat", point.latitude); json.put("lng", point.longitude); array.put(json); } webView.loadUrl(String.format("javascript:addPolygon(" + array.toString() + ", %1$d, %2$d, %3$d, %4$d);", polygon.getId(), (int) polygon.getPolygonOptions().getStrokeWidth(), polygon.getPolygonOptions().getStrokeColor(), polygon.getPolygonOptions().getFillColor())); } catch (JSONException e) { Log.e(TAG, "error constructing polyline JSON", e); } }

Target:
@Override public <T> void addPolygon(AirMapPolygon<T> polygon) { try { JSONArray array = new JSONArray(); for (LatLng point : polygon.getPolygonOptions().getPoints()) { JSONObject json = new JSONObject(); json.put("lat", point.latitude); json.put("lng", point.longitude); array.put(json); } webView.loadUrl(String.format(Locale.US, "javascript:addPolygon(" + array.toString() + ", %1$d, %2$d, %3$d, %4$d);", polygon.getId(), (int) polygon.getPolygonOptions().getStrokeWidth(), polygon.getPolygonOptions().getStrokeColor(), polygon.getPolygonOptions().getFillColor())); } catch (JSONException e) { Log.e(TAG, "error constructing polyline JSON", e); } }
Source:
public ItemStack tryToFillSlots(ItemStack stack, int... slots) { if (slots.length % 2 != 0) { throw new IllegalArgumentException("Slots must be pairs."); } ItemStack maxStack = stack.clone(); maxStack.setAmount(stack.getMaxStackSize()); Integer firstEmpty = null; for (int s = 0; s < slots.length && stack.getAmount() > 0; s += 2) { int start = slots[s]; int end = slots[s + 1]; int delta = start < end ? 1 : -1; for (int i = start; i != end && stack.getAmount() > 0; i += delta) { if (!itemShiftClickAllowed(i, stack)) { continue; } ItemStack currentStack = getItem(i); if (firstEmpty == null && InventoryUtil.isEmpty(currentStack)) { firstEmpty = i; } else if (currentStack.isSimilar(stack)) { int amount = currentStack.getAmount(); int maxStackSize = Math.min(currentStack.getMaxStackSize(), getMaxStackSize()); int transfer = Math.min(stack.getAmount(), maxStackSize - amount); if (transfer > 0) { currentStack.setAmount(amount + transfer); stack.setAmount(stack.getAmount() - transfer); } setItem(i, currentStack); } } } if (firstEmpty != null) { if (stack.getAmount() > stack.getMaxStackSize()) { setItem(firstEmpty, maxStack); stack.setAmount(stack.getAmount() - stack.getMaxStackSize()); } else { ItemStack finalStack = stack.clone(); setItem(firstEmpty, finalStack); stack.setAmount(0); } } if (stack.getAmount() <= 0) { stack = InventoryUtil.createEmptyStack(); } return stack; }

Target:
public ItemStack tryToFillSlots(ItemStack stack, int... slots) { if (slots.length % 2 != 0) { throw new IllegalArgumentException("Slots must be pairs."); } ItemStack maxStack = stack.clone(); maxStack.setAmount(stack.getMaxStackSize()); int firstEmpty = -1; for (int s = 0; s < slots.length && stack.getAmount() > 0; s += 2) { int start = slots[s]; int end = slots[s + 1]; int delta = start < end ? 1 : -1; for (int i = start; i != end && stack.getAmount() > 0; i += delta) { if (!itemShiftClickAllowed(i, stack)) { continue; } ItemStack currentStack = getItem(i); if (firstEmpty == -1 && InventoryUtil.isEmpty(currentStack)) { firstEmpty = i; } else if (currentStack.isSimilar(stack)) { int amount = currentStack.getAmount(); int maxStackSize = Math.min(currentStack.getMaxStackSize(), getMaxStackSize()); int transfer = Math.min(stack.getAmount(), maxStackSize - amount); if (transfer > 0) { currentStack.setAmount(amount + transfer); stack.setAmount(stack.getAmount() - transfer); } setItem(i, currentStack); } } } if (firstEmpty != -1) { if (stack.getAmount() > stack.getMaxStackSize()) { setItem(firstEmpty, maxStack); stack.setAmount(stack.getAmount() - stack.getMaxStackSize()); } else { ItemStack finalStack = stack.clone(); setItem(firstEmpty, finalStack); stack.setAmount(0); } } if (stack.getAmount() <= 0) { stack = InventoryUtil.createEmptyStack(); } return stack; }
Source:
public void testInitializesLocalPersistenceService() throws IOException { final File rootDirectory = folder.newFolder("testInitializesLocalPersistenceService"); try { newCacheManagerBuilder().with(new PersistenceConfiguration(rootDirectory)).build(true); } catch (Exception e) { assertThat(e, instanceOf(StateTransitionException.class)); assertThat(e.getCause(), instanceOf(IllegalArgumentException.class)); assertThat(e.getCause().getMessage().endsWith("CRAP!"), is(true)); } }

Target:
public void testInitializesLocalPersistenceService() throws IOException { final File rootDirectory = folder.newFolder("testInitializesLocalPersistenceService"); assertTrue(rootDirectory.delete()); newCacheManagerBuilder().with(new PersistenceConfiguration(rootDirectory)).build(true); assertTrue(rootDirectory.isDirectory()); }
Source:
public Metacard toQueryTemplateMetacard(Map<String, Object> formTemplate) { try { Map<String, Object> filterJson = (Map) formTemplate.get("filterTemplate"); if (filterJson == null) { return null; } String title = (String) formTemplate.get("title"); if (title == null || title.trim().isEmpty()) { throw new IllegalArgumentException("Search forms must have a non-empty title"); } String description = (String) formTemplate.get("description"); String id = (String) formTemplate.get("id"); TransformVisitor<JAXBElement> visitor = new TransformVisitor<>(new XmlModelBuilder()); VisitableJsonElementImpl.create(new FilterNodeMapImpl(filterJson)).accept(visitor); JAXBElement filter = visitor.getResult(); if (!filter.getDeclaredType().equals(FilterType.class)) { LOGGER.error( "Error occurred during filter processing, root type should be a but was {}", FilterType.class.getName(), filter.getDeclaredType().getName()); return null; } QueryTemplateMetacard metacard = (id == null) ? new QueryTemplateMetacard(title, description) : new QueryTemplateMetacard(title, description, id); String filterXml = writer.marshal(filter); metacard.setFormsFilter(filterXml); Map<String, Object> querySettings = (Map<String, Object>) formTemplate.get("querySettings"); if (querySettings != null) { metacard.setQuerySettings(querySettings); } return metacard; } catch (JAXBException e) { LOGGER.error("XML generation failed for query template metacard's filter", e); } catch (FilterProcessingException e) { LOGGER.error("Could not use filter JSON for template - {}", e.getMessage()); } return null; }

Target:
public Metacard toQueryTemplateMetacard(Map<String, Object> formTemplate) { try { Map<String, Object> filterJson = (Map) formTemplate.get("filterTemplate"); if (filterJson == null) { return null; } String title = (String) formTemplate.get("title"); if (StringUtils.isBlank(title)) { throw new IllegalArgumentException("Search form title cannot be blank"); } String description = (String) formTemplate.get("description"); String id = (String) formTemplate.get("id"); TransformVisitor<JAXBElement> visitor = new TransformVisitor<>(new XmlModelBuilder()); VisitableJsonElementImpl.create(new FilterNodeMapImpl(filterJson)).accept(visitor); JAXBElement filter = visitor.getResult(); if (!filter.getDeclaredType().equals(FilterType.class)) { LOGGER.error( "Error occurred during filter processing, root type should be a but was {}", FilterType.class.getName(), filter.getDeclaredType().getName()); return null; } QueryTemplateMetacard metacard = (id == null) ? new QueryTemplateMetacard(title, description) : new QueryTemplateMetacard(title, description, id); String filterXml = writer.marshal(filter); metacard.setFormsFilter(filterXml); Map<String, Object> querySettings = (Map<String, Object>) formTemplate.get("querySettings"); if (querySettings != null) { metacard.setQuerySettings(querySettings); } return metacard; } catch (JAXBException e) { LOGGER.error("XML generation failed for query template metacard's filter", e); } catch (FilterProcessingException e) { LOGGER.error("Could not use filter JSON for template - {}", e.getMessage()); } return null; }
Source:
public void setEnableSmallFileFeatures(final boolean on) { enableSmallFileFeatures = on; Element element = context.getElement().getFirstChildElement(); while (element.getPropertyInt("value") != AccountDiffPreference.WHOLE_FILE_CONTEXT) { element = element.getNextSiblingElement(); } if (element.getPropertyInt("value") == AccountDiffPreference.WHOLE_FILE_CONTEXT) { if (enableSmallFileFeatures) { element.removeAttribute("disabled"); } else { element.setAttribute("disabled", "disabled"); if (AccountDiffPreference.CONTEXT_CHOICES[context.getSelectedIndex()] == AccountDiffPreference.WHOLE_FILE_CONTEXT) { for (int i = 0; i < AccountDiffPreference.CONTEXT_CHOICES.length; i++) { if (AccountDiffPreference.CONTEXT_CHOICES[i] == DiffScreen.LARGE_FILE_CONTEXT) { context.setSelectedIndex(i); break; } } } } } toggleEnabledStatus(save.isEnabled()); }

Target:
public void setEnableSmallFileFeatures(final boolean on) { enableSmallFileFeatures = on; NodeList<OptionElement> options = context.getElement().<SelectElement>cast().getOptions(); int lastIndex = options.getLength() - 1; OptionElement currOption = options.getItem(lastIndex); if (enableSmallFileFeatures) { currOption.setDisabled(false); } else { currOption.setDisabled(true); if (context.getSelectedIndex() == lastIndex) { context.setSelectedIndex(lastIndex - 1); } } toggleEnabledStatus(save.isEnabled()); }
Source:
public Condition voidCondition(Condition condition, String voidReason) { condition.setVoided(true); condition.setVoidedBy(Context.getAuthenticatedUser()); condition.setVoidReason(voidReason); if(condition.getDateVoided() == null){ condition.setDateVoided(new Date()); } Context.getConditionService().saveCondition(condition); return condition; }

Target:
public Condition voidCondition(Condition condition, String voidReason) { return conditionDAO.saveCondition(condition); }
Source:
private void update(List<VmNetworkInterface> interfaces) { if (interfaces != null && !interfaces.isEmpty()) { for (VmNetworkInterface ifc : interfaces) { VmNetworkStatistics stats = ifc.getStatistics(); vmManager.update(stats); } } }

Target:
private void update(List<VmNetworkInterface> interfaces) { if (interfaces == null) { return; } for (VmNetworkInterface ifc : interfaces) { vmManager.update(ifc.getStatistics()); } }