auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public SpinnerWidget(Context context, FormEntryPrompt prompt, boolean autoAdvance) { super(context, prompt); if (context instanceof AdvanceToNextListener) { listener = (AdvanceToNextListener) context; } View view = inflate(context, R.layout.spinner_layout, null); spinner = view.findViewById(R.id.spinner); choices = new String[items.size() + 1]; for (int i = 0; i < items.size(); i++) { choices[i] = prompt.getSelectChoiceText(items.get(i)); } choices[items.size()] = getContext().getString(R.string.select_one); SpinnerAdapter adapter = new SpinnerAdapter(getContext(), android.R.layout.simple_spinner_item, choices, TypedValue.COMPLEX_UNIT_DIP, getQuestionFontSize()); spinner.setAdapter(adapter); spinner.setPrompt(prompt.getQuestionText()); spinner.setEnabled(!prompt.isReadOnly()); spinner.setFocusable(!prompt.isReadOnly()); String s = null; if (prompt.getAnswerValue() != null) { s = ((Selection) prompt.getAnswerValue().getValue()).getValue(); } programmaticallySetSelection(items.size()); if (s != null) { for (int i = 0; i < items.size(); ++i) { String match = items.get(i).getValue(); if (match.equals(s)) { programmaticallySetSelection(i); } } } spinner.setOnItemSelectedListener(new OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { if (userActionOnSpinner) { if (position != items.size() && autoAdvance && listener != null) { listener.advance(); } widgetValueChanged(); } userActionOnSpinner = true; } @Override public void onNothingSelected(AdapterView<?> arg0) { } }); addAnswerView(view); }

Target:
public SpinnerWidget(Context context, FormEntryPrompt prompt, boolean autoAdvance) { super(context, prompt); if (context instanceof AdvanceToNextListener) { listener = (AdvanceToNextListener) context; } View view = inflate(context, R.layout.spinner_layout, null); spinner = view.findViewById(R.id.spinner); spinnerAdapter = new SpinnerAdapter(getContext(), getChoices(prompt)); spinner.setAdapter(spinnerAdapter); spinner.setPrompt(prompt.getQuestionText()); spinner.setEnabled(!prompt.isReadOnly()); spinner.setFocusable(!prompt.isReadOnly()); spinner.setId(ViewIds.generateViewId()); spinner.setOnItemSelectedListener(new OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { if (!firstSetSelectionCall) { if (position != items.size() && autoAdvance && listener != null) { listener.advance(); } widgetValueChanged(); } spinnerAdapter.updateSelectedItemPosition(spinner.getSelectedItemPosition()); firstSetSelectionCall = false; } @Override public void onNothingSelected(AdapterView<?> arg0) { } }); fillInPreviousAnswer(prompt); addAnswerView(view); }
Source:
protected void addBlobToDocument(String docId, String xpath, String fileName, String extension) throws IOException { File file = Files.createTempFile(fileName, ".".concat(extension)).toFile(); RestHelper.operation("Blob.AttachOnDocument", file, Map.of(), Map.of("document", docId, "xpath", xpath)); }

Target:
protected void addBlobToDocument(String docId, String xpath, String fileName, String extension) throws IOException { File file = Files.createTempFile(fileName, "." + extension).toFile(); RestHelper.operation("Blob.AttachOnDocument", file, Map.of(), Map.of("document", docId, "xpath", xpath)); }
Source:
@Test public void triggersNewBuild() throws Exception { TaskListener listener = new StreamTaskListener(System.out, Charset.defaultCharset()); Launcher launcher = j.jenkins.createLauncher(listener); FreeStyleProject project = j.createFreeStyleProject(); MercurialSCM scm = new MercurialSCM(null, tmp.getRoot().getPath(), null, null, null, null, false, null); project.setScm(scm); File repo = tmp.getRoot(); m.hg(repo, "init"); m.touchAndCommit(repo, "x"); PollingResult pr = scm.compare( launcher, listener, new MercurialTagAction("tip","",null,"default"), listener.getLogger(), Computer.currentComputer().getNode(), new FilePath(tmp.getRoot()), project); assertEquals(PollingResult.Change.SIGNIFICANT, pr.change); }

Target:
@Test public void triggersNewBuild() throws Exception { TaskListener listener = new StreamTaskListener(System.out, Charset.defaultCharset()); Launcher launcher = j.jenkins.createLauncher(listener); FreeStyleProject project = j.createFreeStyleProject(); MercurialSCM scm = new MercurialSCM(null, tmp.getRoot().getPath(), null, null, null, null, false, null); project.setScm(scm); File repo = tmp.getRoot(); m.hg(repo, "init"); m.touchAndCommit(repo, "x"); PollingResult pr = scm.compare( launcher, listener, new MercurialTagAction("tip","",null,null), listener.getLogger(), Computer.currentComputer().getNode(), new FilePath(tmp.getRoot()), project); assertEquals(PollingResult.Change.SIGNIFICANT, pr.change); }
Source:
protected void processStatsReport( ITestDevice device, InputStreamSource dataStream, DeviceMetricData runData) { Integer count = reportsPerDevice.putIfAbsent(device, 1); if (count != null) { reportsPerDevice.put(device, count + 1); } }

Target:
protected void processStatsReport( ITestDevice device, InputStreamSource dataStream, DeviceMetricData runData) { reportsPerDevice.computeIfPresent(device, (k, v) -> v + 1); reportsPerDevice.putIfAbsent(device, 1); }
Source:
String systemTempPath() throws IOException { return context.tempFolder.getRoot().getCanonicalPath().replace("\\", "/"); }

Target:
String systemTempPath() throws IOException { return context.getTempFolder().getCanonicalPath().replace("\\", "/"); }
Source:
public void test_forExpression_simple() { final String expression = "x == \"j.y\""; final JoinConditionAnalysis analysis = analyze(expression); Assert.assertEquals(expression, analysis.getOriginalExpression()); Assert.assertTrue(analysis.canHashJoin()); Assert.assertFalse(analysis.isAlwaysTrue()); Assert.assertFalse(analysis.isAlwaysFalse()); Assert.assertEquals( ImmutableList.of(Pair.of("x", "y")), equalitiesToPairs(analysis.getEquiConditions()) ); Assert.assertEquals( ImmutableList.of(), exprsToStrings(analysis.getNonEquiConditions()) ); Assert.assertThat(analysis.getRightKeyColumns(), CoreMatchers.is(ImmutableList.of("y"))); }

Target:
public void test_forExpression_simple() { final String expression = "x == \"j.y\""; final JoinConditionAnalysis analysis = analyze(expression); Assert.assertEquals(expression, analysis.getOriginalExpression()); Assert.assertTrue(analysis.canHashJoin()); Assert.assertFalse(analysis.isAlwaysTrue()); Assert.assertFalse(analysis.isAlwaysFalse()); Assert.assertEquals( ImmutableList.of(Pair.of("x", "y")), equalitiesToPairs(analysis.getEquiConditions()) ); Assert.assertEquals( ImmutableList.of(), exprsToStrings(analysis.getNonEquiConditions()) ); Assert.assertEquals(analysis.getRightEquiConditionKeys(), ImmutableSet.of("y")); }
Source:
private static boolean isSameDay(Date date1, Date date2) { Calendar calendar = Calendar.getInstance(); calendar.setTime(date1); Calendar calendar2 = Calendar.getInstance(); calendar2.setTime(date2); return calendar.get(Calendar.YEAR) == calendar2.get(Calendar.YEAR) && calendar.get(Calendar.DAY_OF_YEAR) == calendar2.get(Calendar.DAY_OF_YEAR); }

Target:
private static boolean isSameDay(Date date1, Date date2) { calendar.setTime(date1); calendar2.setTime(date2); return calendar.get(Calendar.YEAR) == calendar2.get(Calendar.YEAR) && calendar.get(Calendar.DAY_OF_YEAR) == calendar2.get(Calendar.DAY_OF_YEAR); }
Source:
public @Nullable Range getFixedYRange() { return this.fFixedYRange; }

Target:
public @Nullable Range getFixedYRange() { return fFixedYRange; }
Source:
public JsonObject getFeRegion(BigDecimal latitude, BigDecimal longitude) throws IOException, MalformedURLException { final URL url = new URL(String.format("%s?type=fe&latitude=%s&longitude=%s", this.endpointUrl, URLEncoder.encode(latitude.toString(), "UTF-8"), URLEncoder.encode(longitude.toString(), "UTF-8"))); try (InputStream in = StreamUtils.getURLInputStream(url, this.connectTimeout, this.readTimeout)) { JsonReader reader = Json.createReader(in); JsonObject json = reader.readObject(); reader.close(); return json.getJsonObject("fe"); } }

Target:
public JsonObject getFeRegion(BigDecimal latitude, BigDecimal longitude) throws IOException, MalformedURLException { final URL url = new URL(this.endpointUrl + "?type=fe" + "&latitude=" + URLEncoder.encode(latitude.toString(), "UTF-8") + "&longitude=" + URLEncoder.encode(longitude.toString(), "UTF-8") ); try (InputStream in = StreamUtils.getURLInputStream(url, this.connectTimeout, this.readTimeout)) { JsonReader reader = Json.createReader(in); JsonObject json = reader.readObject(); reader.close(); return json.getJsonObject("fe"); } }
Source:
public void testList() { for (String region : api.getConfiguredRegions()) { StackApi stackApi = api.getStackApi(region); List<Stack> stacks = stackApi.list(); assertThat(stacks).isNotNull(); } }

Target:
public void testList() { for (String region : api.getConfiguredRegions()) { StackApi stackApi = api.getStackApi(region); List<Stack> stacks = stackApi.list(); assertThat(stacks).isNotEmpty(); int oldStackSize = stacks.size(); CreateStack createStack = CreateStack.builder().name(getName()).templateUrl(TEMPLATE_URL).build(); Stack stack = stackApi.create(createStack); assertThat(stack).isNotNull(); stacks = stackApi.list(); assertThat(stacks.size()).isEqualTo(oldStackSize + 1); } }
Source:
public void sendMessage(String topic, String message) { ZooKeeperNode zookeeper = cluster.getZooKeeper(); for(Entity e : cluster.getCluster().getChildren()) { if(e instanceof KafkaBroker) { break; } } Optional<Entity> anyBrokerNodeInCluster = Iterables.tryFind(cluster.getCluster().getChildren(), Predicates.and( Predicates.instanceOf(KafkaBroker.class), EntityPredicates.attributeEqualTo(KafkaBroker.SERVICE_UP, true))); if (anyBrokerNodeInCluster.isPresent()) { KafkaBroker broker = (KafkaBroker)anyBrokerNodeInCluster.get(); Properties props = new Properties(); props.put("metadata.broker.list", format("%s:%d", broker.getAttribute(KafkaBroker.HOSTNAME), broker.getKafkaPort())); props.put("bootstrap.servers", format("%s:%d", broker.getAttribute(KafkaBroker.HOSTNAME), broker.getKafkaPort())); props.put("key.serializer", "org.apache.kafka.common.serialization.StringSerializer"); props.put("value.serializer", "org.apache.kafka.common.serialization.StringSerializer"); Producer<String, String> producer = new KafkaProducer<>(props); try { ((KafkaZooKeeper)cluster.getZooKeeper()).createTopic(topic); Thread.sleep(Duration.seconds(1).toMilliseconds()); ProducerRecord<String, String> data = new ProducerRecord<>(topic, message); producer.send(data); producer.close(); } catch (InterruptedException e) { e.printStackTrace(); } } else { throw new InvalidParameterException("No kafka broker node found"); } }

Target:
public void sendMessage(String topic, String message) { Optional<Entity> anyBrokerNodeInCluster = Iterables.tryFind(cluster.getCluster().getChildren(), Predicates.and( Predicates.instanceOf(KafkaBroker.class), EntityPredicates.attributeEqualTo(KafkaBroker.SERVICE_UP, true))); if (anyBrokerNodeInCluster.isPresent()) { KafkaBroker broker = (KafkaBroker)anyBrokerNodeInCluster.get(); Properties props = new Properties(); props.put("metadata.broker.list", format("%s:%d", broker.getAttribute(KafkaBroker.HOSTNAME), broker.getKafkaPort())); props.put("bootstrap.servers", format("%s:%d", broker.getAttribute(KafkaBroker.HOSTNAME), broker.getKafkaPort())); props.put("key.serializer", "org.apache.kafka.common.serialization.StringSerializer"); props.put("value.serializer", "org.apache.kafka.common.serialization.StringSerializer"); Producer<String, String> producer = new KafkaProducer<>(props); try { ((KafkaZooKeeper)cluster.getZooKeeper()).createTopic(topic); Thread.sleep(Duration.seconds(1).toMilliseconds()); ProducerRecord<String, String> data = new ProducerRecord<>(topic, message); producer.send(data); producer.close(); } catch (InterruptedException e) { e.printStackTrace(); } } else { throw new InvalidParameterException("No kafka broker node found"); } }
Source:
public Response getRunnerDependencies( @ApiParam(value = "The Dockstore client version") @QueryParam("client_version") String clientVersion, @ApiParam(value = "Python version, only relevant for the cwltool runner") @DefaultValue("2") @QueryParam("python_version") String pythonVersion, @ApiParam(value = "The tool runner", allowableValues = "cwltool") @DefaultValue("cwltool") @QueryParam("runner") String runner, @ApiParam(value = "Response type", allowableValues = "json, text") @DefaultValue("text") @QueryParam("output") String output, @Context ContainerRequestContext containerRequestContext) { if (!("cwltool").equals(runner)) { return Response.noContent().build(); } boolean unwrap = !("json").equals(output); String fileVersion = PipHelper.convertSemVerToAvailableVersion(clientVersion); try { String content = Resources.toString(this.getClass().getClassLoader() .getResource("requirements/" + fileVersion + "/requirements" + (pythonVersion.startsWith("3") ? "3" : "") + ".txt"), StandardCharsets.UTF_8); Map<String, String> pipDepMap = PipHelper.convertPipRequirementsStringToMap(content); return Response.status(Response.Status.OK).type(unwrap ? MediaType.TEXT_PLAIN : MediaType.APPLICATION_JSON) .entity(unwrap ? content : pipDepMap).build(); } catch (IOException e) { e.printStackTrace(); return Response.serverError().build(); } }

Target:
public Response getRunnerDependencies( @ApiParam(value = "The Dockstore client version") @QueryParam("client_version") String clientVersion, @ApiParam(value = "Python version, only relevant for the cwltool runner") @DefaultValue("2") @QueryParam("python_version") String pythonVersion, @ApiParam(value = "The tool runner", allowableValues = "cwltool") @DefaultValue("cwltool") @QueryParam("runner") String runner, @ApiParam(value = "Response type", allowableValues = "json, text") @DefaultValue("text") @QueryParam("output") String output, @Context ContainerRequestContext containerRequestContext) { if (!("cwltool").equals(runner)) { return Response.noContent().build(); } boolean unwrap = !("json").equals(output); String fileVersion = PipHelper.convertSemVerToAvailableVersion(clientVersion); try { String content = Resources.toString(this.getClass().getClassLoader() .getResource("requirements/" + fileVersion + "/requirements" + (pythonVersion.startsWith("3") ? "3" : "") + ".txt"), StandardCharsets.UTF_8); Map<String, String> pipDepMap = PipHelper.convertPipRequirementsStringToMap(content); return Response.status(Response.Status.OK).type(unwrap ? MediaType.TEXT_PLAIN : MediaType.APPLICATION_JSON) .entity(unwrap ? content : pipDepMap).build(); } catch (IOException e) { throw new CustomWebApplicationException("Could not retrieve runner dependencies file: " + e.getMessage(), HttpStatus.SC_INTERNAL_SERVER_ERROR); } }
Source:
public static String extractStringFromTokens(final String tokenString, final String tokens) { String resultString = ""; final StringTokenizer tk = new StringTokenizer(tokenString, tokens); final StringBuffer outString = new StringBuffer(); while (tk.hasMoreTokens()) { outString.append(tk.nextToken()); } resultString = outString.toString(); return resultString; }

Target:
public static String extractStringFromTokens(final String tokenString, final String tokens) { String resultString = ""; if (StringUtils.isNotEmpty(tokens)) { final StringTokenizer tk = new StringTokenizer(tokenString, tokens); final StringBuffer outString = new StringBuffer(); while (tk.hasMoreTokens()) { outString.append(tk.nextToken()); } resultString = outString.toString(); } else { resultString = tokenString; } return resultString; }
Source:
public void updateBookmark() { ReadingList.DAO.anyListContainsTitleAsync(ReadingListDaoProxy.key(getTitle()), new CallbackTask.Callback<ReadingListPage>() { @Override public void success(@Nullable ReadingListPage page) { if (page != null) { getActivity().setResult(PageActivity.RESULT_PAGE_SAVED); } if (!isAdded()) { return; } if (page != null) { pageActionTabsCallback.updateBookmark(true); page.touch(); ReadingListPageDao.instance().upsert(page); if (page.savedOrSaving()) { ReadingListPageDao.instance().markOutdated(page); } } else { pageActionTabsCallback.updateBookmark(false); } } }); }

Target:
public void updateBookmark() { ReadingList.DAO.anyListContainsTitleAsync(ReadingListDaoProxy.key(getTitle()), new CallbackTask.Callback<ReadingListPage>() { @Override public void success(@Nullable ReadingListPage page) { if (!isAdded()) { return; } if (page != null) { pageActionTabsCallback.updateBookmark(true); page.touch(); ReadingListPageDao.instance().upsert(page); if (page.savedOrSaving()) { ReadingListPageDao.instance().markOutdated(page); } } else { pageActionTabsCallback.updateBookmark(false); } } }); }
Source:
public CommandSpec build() { if (this.childCommandMap == null) { checkNotNull(this.executor, "An executor is required"); } else { ChildCommandElementExecutor childDispatcher = new ChildCommandElementExecutor(this.executor); for (Map.Entry<List<String>, ? extends CommandCallable> spec : this.childCommandMap.entrySet()) { childDispatcher.register(spec.getValue(), spec.getKey()); } if (this.args == DEFAULT_ARG) { arguments(this.executor == null ? childDispatcher : optional(childDispatcher)); } else { if (this.executor == null) { arguments(this.args, childDispatcher); } else { arguments(firstParsing(childDispatcher, this.args)); } } executor(childDispatcher); } return new CommandSpec(this.args, this.executor, this.description, this.extendedDescription, this.permission, this.argumentParser, sourceType, sourceTypeDeep); }

Target:
public CommandSpec build() { if (this.childCommandMap == null) { checkNotNull(this.executor, "An executor is required"); } else { ChildCommandElementExecutor childDispatcher = new ChildCommandElementExecutor(this.executor); for (Map.Entry<List<String>, ? extends CommandCallable> spec : this.childCommandMap.entrySet()) { childDispatcher.register(spec.getValue(), spec.getKey()); } if (this.args == DEFAULT_ARG) { arguments(this.executor == null ? childDispatcher : optional(childDispatcher)); } else { if (this.executor == null) { arguments(this.args, childDispatcher); } else { arguments(firstParsing(childDispatcher, this.args)); } } executor(childDispatcher); } return new CommandSpec(this.args, this.executor, this.description, this.extendedDescription, this.permission, this.argumentParser, this.sourceType, this.sourceTypeDeep); }
Source:
public void updateStatus(Component component, Collection<DefaultIssue> newIssues) { Collection<DefaultIssue> shortBranchIssues = shortBranchIssuesFactory.create(component); Tracking<DefaultIssue, DefaultIssue> tracking = tracker.track(newIssues, shortBranchIssues); for (Map.Entry<DefaultIssue, DefaultIssue> e : tracking.getMatchedRaws().entrySet()) { issueLifecycle.copyResolution(e.getKey(), e.getValue()); } }

Target:
public void updateStatus(Component component, Collection<DefaultIssue> newIssues) { Collection<ShortBranchIssue> shortBranchIssues = resolvedShortBranchIssuesLoader.create(component); Tracking<DefaultIssue, ShortBranchIssue> tracking = tracker.track(newIssues, shortBranchIssues); for (Map.Entry<DefaultIssue, ShortBranchIssue> e : tracking.getMatchedRaws().entrySet()) { ShortBranchIssue issue = e.getValue(); issueLifecycle.copyResolution(e.getKey(), issue.getStatus(), issue.getResolution()); } }
Source:
protected List<SearchItem> execute(SearchImagesCmd command) { WebTarget webResource = null; Integer limit = command.getLimit(); if (limit == null) { webResource = getBaseResource() .path("/images/search") .queryParam("term", command.getTerm()); } else { webResource = getBaseResource() .path("/images/search") .queryParam("term", command.getTerm()) .queryParam("limit", command.getLimit()); } LOGGER.trace("GET: {}", webResource); return webResource.request().accept(MediaType.APPLICATION_JSON).get(new TypeReference<List<SearchItem>>() { }); }

Target:
protected List<SearchItem> execute(SearchImagesCmd command) { WebTarget webResource = getBaseResource().path("/images/search") .queryParam("term", command.getTerm()); if (command.getLimit() != null) { webResource = webResource.queryParam("limit", command.getLimit()); } LOGGER.trace("GET: {}", webResource); return webResource.request().accept(MediaType.APPLICATION_JSON).get(new TypeReference<List<SearchItem>>() { }); }
Source:
public void handleRequest(final HttpServerExchange exchange) throws Exception { if (exchange.getRequestMethod().equals(Methods.GET) || exchange.getRequestMethod().equals(Methods.POST)) { serveResource(exchange, true); } else if (exchange.getRequestMethod().equals(Methods.HEAD)) { serveResource(exchange, false); } else { if (KNOWN_METHODS.contains(exchange.getRequestMethod())) { exchange.setStatusCode(StatusCodes.METHOD_NOT_ALLOWED); exchange.getResponseHeaders().add(Headers.ALLOW, String.join(", ", Methods.GET_STRING, Methods.HEAD_STRING, Methods.POST_STRING)); } else { exchange.setStatusCode(StatusCodes.NOT_IMPLEMENTED); } if ( this.next != null ) { next.handleRequest(exchange) } else { exchange.endExchange(); } } }

Target:
public void handleRequest(final HttpServerExchange exchange) throws Exception { if (exchange.getRequestMethod().equals(Methods.GET) || exchange.getRequestMethod().equals(Methods.POST)) { serveResource(exchange, true); } else if (exchange.getRequestMethod().equals(Methods.HEAD)) { serveResource(exchange, false); } else { this.unsupportedMethodHandler.handleRequest( exchange ); } }
Source:
public void addingUniqueNodeWithUnrelatedValueShouldNotAffectLookup() throws Exception { createConstraint( "Person", "id" ); long ourNode; { Statement statement = statementInNewTransaction( AnonymousContext.writeToken() ); ourNode = createLabeledNode( statement, "Person", "id", 1 ); commit(); } Statement statement = statementInNewTransaction( AnonymousContext.writeToken() ); ReadOperations readOps = statement.readOperations(); int person = readOps.labelGetForName( "Person" ); int propId = readOps.propertyKeyGetForName( "id" ); final int labelId = person; final int[] propertyKeyIds = new int[]{propId}; NewIndexDescriptor idx = readOps .uniqueIndexGetForLabelAndPropertyKey( SchemaDescriptorFactory.forLabel( labelId, propertyKeyIds ) ); createLabeledNode( statement, "Person", "id", 2 ); assertThat( readOps.nodeGetFromUniqueIndexSeek( idx, exact( propId, 1 ) ), equalTo( ourNode )); }

Target:
public void addingUniqueNodeWithUnrelatedValueShouldNotAffectLookup() throws Exception { createConstraint( "Person", "id" ); long ourNode; { Statement statement = statementInNewTransaction( AnonymousContext.writeToken() ); ourNode = createLabeledNode( statement, "Person", "id", 1 ); commit(); } Statement statement = statementInNewTransaction( AnonymousContext.writeToken() ); ReadOperations readOps = statement.readOperations(); int person = readOps.labelGetForName( "Person" ); int propId = readOps.propertyKeyGetForName( "id" ); NewIndexDescriptor idx = readOps .uniqueIndexGetForLabelAndPropertyKey( SchemaDescriptorFactory.forLabel( person, propId ) ); createLabeledNode( statement, "Person", "id", 2 ); assertThat( readOps.nodeGetFromUniqueIndexSeek( idx, exact( propId, 1 ) ), equalTo( ourNode )); }
Source:
public Iterable<Object> loadObjects( EntityProjection projection, RequestScope scope) { Class<?> entityClass = projection.getType(); Pagination pagination = projection.getPagination(); FilterExpression filterExpression = projection.getFilterExpression(); if (pagination != null && pagination.returnPageTotals()) { pagination.setPageTotals(getTotalRecords(projection, entityClass, Optional.ofNullable(filterExpression), scope.getDictionary())); } final QueryWrapper query = (QueryWrapper) new RootCollectionFetchQueryBuilder(projection, entityClass, scope.getDictionary(), sessionWrapper) .withPossibleFilterExpression(Optional.ofNullable(filterExpression)) .build(); if (isScrollEnabled) { return new ScrollableIterator<>(query.getQuery().scroll()); } return query.getQuery().list(); }

Target:
public Iterable<Object> loadObjects( EntityProjection projection, RequestScope scope) { Pagination pagination = projection.getPagination(); final QueryWrapper query = (QueryWrapper) new RootCollectionFetchQueryBuilder(projection, scope.getDictionary(), sessionWrapper) .build(); Iterable results; final boolean hasResults; if (isScrollEnabled) { results = new ScrollableIterator<>(query.getQuery().scroll()); hasResults = ((ScrollableIterator) results).hasNext(); } else { results = query.getQuery().list(); hasResults = ! ((Collection) results).isEmpty(); } if (pagination != null) { if (pagination.returnPageTotals() && (hasResults || pagination.getLimit() == 0)) { pagination.setPageTotals(getTotalRecords(projection, scope.getDictionary())); } } return results; }
Source:
private synchronized void recompute() { VersionedType<T> freshVersion = supplier.get(); if (!Objects.equals(freshVersion.version(), lastSuppliedVersion)) { lastSuppliedVersion = freshVersion.version(); cached = function.apply(freshVersion.value()); } }

Target:
private synchronized void recompute() { VersionedType<T> freshVersion = supplier.get(); if (!Objects.equals(freshVersion.version(), lastSuppliedVersion)) { cached = function.apply(freshVersion.value()); lastSuppliedVersion = freshVersion.version(); } }
Source:
public void clickOnSortStacksByNameButton() { seleniumWebDriverHelper.waitAndClick(By.xpath(Locators.SORT_STACKS_BY_NAME_BUTTON_XPATH)); WaitUtils.sleepQuietly(1); }

Target:
public void clickOnSortStacksByNameButton() { seleniumWebDriverHelper.waitAndClick(By.id(Locators.SORT_STACKS_BY_NAME_ID)); }
Source:
public void testOneOffsDontMoveDuringDecomission() { SingularityRequestBuilder bldr = new SingularityRequestBuilder(requestId, RequestType.ON_DEMAND); requestResource.postRequest(bldr.build()); deploy("d2"); requestResource.scheduleImmediately(requestId, Optional.absent()); validateTaskDoesntMoveDuringDecommission(); }

Target:
public void testOneOffsDontMoveDuringDecomission() { SingularityRequestBuilder bldr = new SingularityRequestBuilder(requestId, RequestType.ON_DEMAND); requestResource.postRequest(bldr.build()); deploy("d2"); requestResource.scheduleImmediately(requestId); validateTaskDoesntMoveDuringDecommission(); }
Source:
public Object parse(ElementInstance instance, Node node, Object value) throws Exception { String text = null; if ((value != null) && value instanceof String) { text = ((String) value) ; if ("".equals(text)) { text = null; } } if (node.getChildren().isEmpty() && node.getAttributes().isEmpty() && (text != null)) { return text; } if ((node.getChildren().size() == 1) && node.getAttributes().isEmpty() && (text == null)) { return node.getChildValue(0); } if ((node.getAttributes().size() == 1) && node.getChildren().isEmpty() && (text == null)) { return ((Node) node.getAttributes().get(0)).getValue(); } Map<String, Object> map = new HashMap<String, Object>(); List attributes = node.getAttributes(); List children = node.getChildren(); mapBinding(map, attributes); mapBinding(map, children); if ((text != null) && !"".equals(text.trim())) { map.put(null, text ); } return map; }

Target:
public Object parse(ElementInstance instance, Node node, Object value) throws Exception { String text = null; if ((value != null) && value instanceof String) { text = ((String) value); if ("".equals(text.trim())) { text = null; } } if (node.getChildren().isEmpty() && node.getAttributes().isEmpty() && (text != null)) { return text; } if ((node.getChildren().size() == 1) && node.getAttributes().isEmpty() && (text == null)) { return node.getChildValue(0); } if ((node.getAttributes().size() == 1) && node.getChildren().isEmpty() && (text == null)) { return ((Node) node.getAttributes().get(0)).getValue(); } Map<String, Object> map = new HashMap<>(); List attributes = node.getAttributes(); List children = node.getChildren(); mapBinding(map, attributes); mapBinding(map, children); if ((text != null) && !"".equals(text.trim())) { map.put(null, text); } return map; }
Source:
void reload() { if (isAdded()) { getAdapter().setMediaList(getFilteredMedia()); setFilter(mFilter); } }

Target:
void reload() { if (isAdded()) { getAdapter().setMediaList(getFilteredMedia()); } }
Source:
public void strong() { String html = parseToHtml("*foo bar*"); assertEquals(html,"<p><strong>foo bar</strong></p>\n"); }

Target:
public void strong() { String html = parseToHtml("*foo bar*"); assertEquals("<p><strong>foo bar</strong></p>\n", html); }
Source:
private void updateGpsTelem() { final Drone drone = getDrone(); final View popupView = gpsPopup.getContentView(); TextView satNoView = (TextView) popupView.findViewById(R.id.bar_gps_satno); TextView hdopView = (TextView) popupView.findViewById(R.id.bar_gps_hdop); final String update; final int gpsIcon; if (!drone.isConnected()) { update = getString(R.string.empty_content); gpsIcon = R.drawable.ic_gps_off_black_24dp; satNoView.setText(update); hdopView.setText(update); } else { Gps droneGps = drone.getAttribute(AttributeType.GPS); final String fixStatus = droneGps.getFixStatus(); if (appPrefs.shouldGpsHdopBeDisplayed()) { update = String.format(Locale.ENGLISH, "%.1f", droneGps.getGpsEph()); } else { update = String.format(Locale.ENGLISH, "%s", fixStatus); } switch(fixStatus){ case Gps.LOCK_3D: gpsIcon = R.drawable.ic_gps_fixed_black_24dp; break; case Gps.LOCK_2D: case Gps.NO_FIX: default: gpsIcon = R.drawable.ic_gps_not_fixed_black_24dp; break; } satNoView.setText(String.format("Satellites %d", droneGps.getSatellitesCount())); hdopView.setText(String.format("HDOP %.1f", droneGps.getGpsEph())); } gpsTelem.setText(update); gpsTelem.setCompoundDrawablesWithIntrinsicBounds(gpsIcon, 0, 0, 0); gpsPopup.update(); }

Target:
private void updateGpsTelem() { final Drone drone = getDrone(); final View popupView = gpsPopup.getContentView(); TextView satNoView = (TextView) popupView.findViewById(R.id.bar_gps_satno); TextView hdopStatusView = (TextView) popupView.findViewById(R.id.bar_gps_hdop_status); final String update; final int gpsIcon; if (!drone.isConnected()) { update = getString(R.string.empty_content); gpsIcon = R.drawable.ic_gps_off_black_24dp; satNoView.setText(update); hdopStatusView.setText(update); } else { Gps droneGps = drone.getAttribute(AttributeType.GPS); final String fixStatus = droneGps.getFixStatus(); if (appPrefs.shouldGpsHdopBeDisplayed()) { update = String.format(Locale.ENGLISH, "%.1f", droneGps.getGpsEph()); } else { update = String.format(Locale.ENGLISH, "%s", fixStatus); } switch(fixStatus){ case Gps.LOCK_3D: gpsIcon = R.drawable.ic_gps_fixed_black_24dp; break; case Gps.LOCK_2D: case Gps.NO_FIX: default: gpsIcon = R.drawable.ic_gps_not_fixed_black_24dp; break; } satNoView.setText(String.format(Locale.ENGLISH, "Satellites %d", droneGps.getSatellitesCount())); if (appPrefs.shouldGpsHdopBeDisplayed()) { hdopStatusView.setText(String.format(Locale.ENGLISH, "%s", fixStatus)); } else { hdopStatusView.setText(String.format(Locale.ENGLISH, "HDOP %.1f", droneGps.getGpsEph())); } } gpsTelem.setText(update); gpsTelem.setCompoundDrawablesWithIntrinsicBounds(gpsIcon, 0, 0, 0); gpsPopup.update(); }
Source:
private static List<Class<? extends Cipher>> getCipherClasses(Properties props) { List<Class<? extends Cipher>> result = new ArrayList(); String cipherClassString = Utils.getCipherClassString(props); if (cipherClassString == null) { LOG.debug("No cipher classes configured."); return null; } for (String c : Utils.splitClassNames(cipherClassString, ",")) { try { Class<?> cls = ReflectionUtils.getClassByName(c); result.add(cls.asSubclass(Cipher.class)); } catch (ClassCastException e) { LOG.error("Class is not a Cipher.", c); } catch (ClassNotFoundException e) { LOG.error("Cipher not found.", c); } } return result; }

Target:
private static List<Class<? extends Cipher>> getCipherClasses(Properties props) { List<Class<? extends Cipher>> result = new ArrayList<>(); String cipherClassString = Utils.getCipherClassString(props); if (cipherClassString == null) { LOG.debug("No cipher classes configured."); return null; } for (String c : Utils.splitClassNames(cipherClassString, ",")) { try { Class<?> cls = ReflectionUtils.getClassByName(c); result.add(cls.asSubclass(Cipher.class)); } catch (ClassCastException e) { LOG.error("Class is not a Cipher.", c); } catch (ClassNotFoundException e) { LOG.error("Cipher not found.", c); } } return result; }
Source:
public Calendar deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { Calendar calendar = new GregorianCalendar(); try { if (json.isJsonPrimitive()) { String value = json.getAsString(); Locale locale = localization.getLocale(); if (locale == null) locale = Locale.getDefault(); DateFormat format = DateFormat.getDateInstance(DateFormat.SHORT, locale); Date date = format.parse(value); calendar.setTime(date); } else { JsonObject value = json.getAsJsonObject(); String timezone = value.get("timezone").getAsString(); Long time = value.get("time").getAsLong(); calendar.setTimeZone(TimeZone.getTimeZone(timezone)); calendar.setTimeInMillis(time); } return calendar; } catch (ParseException e) { throw new ConversionError("Error to convert Calendar: " + e.getMessage()); } }

Target:
public Calendar deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) { Calendar calendar = new GregorianCalendar(); try { if (json.isJsonPrimitive()) { String value = json.getAsString(); Locale locale = localization.getLocale(); if (locale == null) locale = Locale.getDefault(); DateFormat format = DateFormat.getDateInstance(DateFormat.SHORT, locale); Date date = format.parse(value); calendar.setTime(date); } else { JsonObject value = json.getAsJsonObject(); String timezone = value.get("timezone").getAsString(); Long time = value.get("time").getAsLong(); calendar.setTimeZone(TimeZone.getTimeZone(timezone)); calendar.setTimeInMillis(time); } return calendar; } catch (JsonParseException e) { throw new ConversionError("Invalid Json format to convert Calendar: " + e.getMessage()); } catch (ParseException e) { throw new ConversionError("Error to convert Calendar: " + e.getMessage()); } }
Source:
public MapView createViewInstance(ThemedReactContext context) { mapView = new MapView(context, "pk.foo"); mapView.onCreate(null); return mapView; }

Target:
public MapView createViewInstance(ThemedReactContext context) { mapView = new MapView(context, "pk.foo"); mapView.onCreate(null); StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build(); StrictMode.setThreadPolicy(policy); return mapView; }
Source:
private SqlNode createLeftCall(SqlOperator op, List<SqlNode> nodeList) { if (nodeList.size() == 2) { return op.createCall(new SqlNodeList(nodeList, POS)); } SqlNode node = op.createCall(new SqlNodeList(nodeList.subList(0, 2), POS)); for (int i = 2; i < nodeList.size(); i++) { node = op.createCall(new SqlNodeList(ImmutableList.of(node, nodeList.get(i)), POS)); } return node; }

Target:
private SqlNode createLeftCall(SqlOperator op, List<SqlNode> nodeList) { assert nodeList != null && nodeList.size() >= 2; SqlNode node = op.createCall(new SqlNodeList(nodeList.subList(0, 2), POS)); for (int i = 2; i < nodeList.size(); i++) { node = op.createCall(new SqlNodeList(ImmutableList.of(node, nodeList.get(i)), POS)); } return node; }
Source:
public List<VmNumaNode> getVmNumaNodes(VM vm) { int vcpus = FeatureSupported.supportedInConfig(ConfigValues.HotPlugCpuSupported, vm.getCompatibilityVersion(), vm.getClusterArch()) ? VmCpuCountHelper.calcMaxVCpu(vm, vm.getClusterCompatibilityVersion()) : vm.getNumOfCpus(); List<VmNumaNode> vmNumaNodes = vmNumaNodeDao.getAllVmNumaNodeByVmId(vm.getId()); if (!vmNumaNodes.isEmpty()) { if (vcpus != vm.getNumOfCpus()) { int numaCount = vmNumaNodes.size(); int index = 0; if (numaCount > vcpus) { numaCount = vcpus; } for (VmNumaNode vmNode : vmNumaNodes) { vmNode.getCpuIds().clear(); if (numaCount <= 0) { continue; } for (int i = 0; i < vcpus / numaCount; i++) { vmNode.getCpuIds().add(index++); } vcpus -= vcpus / numaCount; --numaCount; } } return vmNumaNodes; } if (FeatureSupported.hotPlugMemory(vm.getCompatibilityVersion(), vm.getClusterArch())) { VmNumaNode vmNode = new VmNumaNode(); vmNode.setIndex(0); vmNode.setMemTotal(vm.getMemSizeMb()); for (int i = 0; i < vcpus; i++) { vmNode.getCpuIds().add(i); } return Collections.singletonList(vmNode); } return Collections.emptyList(); }

Target:
public List<VmNumaNode> getVmNumaNodes(VM vm) { int numOfVmCpus = vm.getNumOfCpus(); int vcpus = FeatureSupported.supportedInConfig(ConfigValues.HotPlugCpuSupported, vm.getCompatibilityVersion(), vm.getClusterArch()) ? VmCpuCountHelper.calcMaxVCpu(vm, vm.getClusterCompatibilityVersion()) : numOfVmCpus; List<VmNumaNode> vmNumaNodes = vmNumaNodeDao.getAllVmNumaNodeByVmId(vm.getId()); if (!vmNumaNodes.isEmpty()) { if (vcpus != numOfVmCpus) { int numaCount = vmNumaNodes.size(); int index = -1; for (VmNumaNode vmNode : vmNumaNodes) { for (Integer cpuId : vmNode.getCpuIds()) { if (index < cpuId) { index = cpuId; } } } for (VmNumaNode vmNode : vmNumaNodes) { if (numaCount <= 0) { break; } for (int i = vmNode.getCpuIds().size(); i < vcpus / numaCount; i++) { vmNode.getCpuIds().add(++index); } vcpus -= vcpus / numaCount; --numaCount; } } return vmNumaNodes; } if (FeatureSupported.hotPlugMemory(vm.getCompatibilityVersion(), vm.getClusterArch())) { VmNumaNode vmNode = new VmNumaNode(); vmNode.setIndex(0); vmNode.setMemTotal(vm.getMemSizeMb()); for (int i = 0; i < vcpus; i++) { vmNode.getCpuIds().add(i); } return Collections.singletonList(vmNode); } return Collections.emptyList(); }
Source:
protected void prepareUserDirectory(URI targetFolder) { User user = Helper.getCurrentUser(); if (user != null) { try { fileService.createDirectoryForUser(targetFolder, user.getLogin()); } catch (Exception e) { logger.error(e.getMessage(), e); Helper.setFehlerMeldung("Export canceled, could not create destination directory: " + targetFolder, e); } } }

Target:
protected void prepareUserDirectory(URI targetFolder) { User user = Helper.getCurrentUser(); if (user != null) { try { fileService.createDirectoryForUser(targetFolder, user.getLogin()); } catch (IOException | RuntimeException e) { Helper.setErrorMessage("Export canceled, could not create destination directory: " + targetFolder, logger, e); } } }
Source:
private void postConstruct() { CLASS_TO_MAPPER_MAP.put(SpecialDaysRequestData.class, this.configurationMapper); CLASS_TO_MAPPER_MAP.put(ReadAlarmRegisterData.class, this.monitoringMapper); CLASS_TO_MAPPER_MAP.put(FindEventsQuery.class, this.managementMapper); CLASS_TO_MAPPER_MAP.put(ActualMeterReadsData.class, this.monitoringMapper); CLASS_TO_MAPPER_MAP.put(GetAdministrativeStatusData.class, this.configurationMapper); CLASS_TO_MAPPER_MAP.put(PushSetupAlarm.class, this.configurationMapper); CLASS_TO_MAPPER_MAP.put(SmsDetails.class, this.adhocMapper); CLASS_TO_MAPPER_MAP.put(AdministrativeStatusType.class, this.configurationMapper); CLASS_TO_MAPPER_MAP.put(SetConfigurationObjectRequest.class, this.configurationMapper); CLASS_TO_MAPPER_MAP.put(PushSetupSms.class, this.configurationMapper); CLASS_TO_MAPPER_MAP.put(ActivityCalendar.class, this.configurationMapper); CLASS_TO_MAPPER_MAP.put(AlarmNotifications.class, this.configurationMapper); CLASS_TO_MAPPER_MAP.put(KeySet.class, this.configurationMapper); CLASS_TO_MAPPER_MAP.put(SmartMeteringDevice.class, this.installationMapper); }

Target:
private void postConstruct() { CUSTOM_CONVERTER_FOR_CLASS.put(PeriodicMeterReadsGasRequestData.class, this.periodicReadsRequestGasDataConverter); CUSTOM_CONVERTER_FOR_CLASS.put(ActualMeterReadsGasRequestData.class, this.actualReadsRequestGasDataConverter); CUSTOM_CONVERTER_FOR_CLASS.put(SetEncryptionKeyExchangeOnGMeterRequestData.class, this.setEncryptionKeyExchangeOnGMeterDataConverter); CLASS_TO_MAPPER_MAP.put(PeriodicMeterReadsRequestData.class, this.monitoringMapper); CLASS_TO_MAPPER_MAP.put(ActualMeterReadsRequestData.class, this.commonMapper); CLASS_TO_MAPPER_MAP.put(SpecialDaysRequestData.class, this.commonMapper); CLASS_TO_MAPPER_MAP.put(ReadAlarmRegisterData.class, this.monitoringMapper); CLASS_TO_MAPPER_MAP.put(FindEventsQuery.class, this.managementMapper); CLASS_TO_MAPPER_MAP.put(GetAdministrativeStatusData.class, this.commonMapper); CLASS_TO_MAPPER_MAP.put(AdministrativeStatusTypeData.class, this.configurationMapper); CLASS_TO_MAPPER_MAP.put(ActivityCalendarData.class, this.configurationMapper); CLASS_TO_MAPPER_MAP.put(SetConfigurationObjectRequestData.class, this.configurationMapper); CLASS_TO_MAPPER_MAP.put(SetAlarmNotificationsRequestData.class, this.configurationMapper); CLASS_TO_MAPPER_MAP.put(SetConfigurationObjectRequestData.class, this.configurationMapper); CLASS_TO_MAPPER_MAP.put(SetPushSetupAlarmRequestData.class, this.configurationMapper); CLASS_TO_MAPPER_MAP.put(SetPushSetupSmsRequestData.class, this.configurationMapper); CLASS_TO_MAPPER_MAP.put(SynchronizeTimeRequestData.class, this.commonMapper); CLASS_TO_MAPPER_MAP.put(GetConfigurationRequestData.class, this.commonMapper); CLASS_TO_MAPPER_MAP.put(GetFirmwareVersionRequestData.class, this.commonMapper); CLASS_TO_MAPPER_MAP.put(KeySet.class, this.configurationMapper); }
Source:
public void setJDKs(Collection<? extends JDK> jdks) { this.jdks = new ArrayList<JDK>(jdks); }

Target:
public synchronized void setJDKs(Collection<? extends JDK> jdks) { this.jdks = new ArrayList<JDK>(jdks); }
Source:
public void deliverResponse(Exchange exchange, Response response) { if (exchange == null) throw new NullPointerException("no CoAP exchange!"); if (exchange.getRequest() == null) throw new NullPointerException("no CoAP request!"); if (response == null) throw new NullPointerException("no CoAP response!"); exchange.getRequest().setResponse(response); }

Target:
public void deliverResponse(Exchange exchange, Response response) { if (exchange == null) { throw new NullPointerException("no CoAP exchange!"); } if (exchange.getRequest() == null) { throw new NullPointerException("no CoAP request!"); } if (response == null) { throw new NullPointerException("no CoAP response!"); } exchange.getRequest().setResponse(response); }
Source:
private void handleCloseWebSocketMessage(StatusCarbonMessage closeCarbonMessage, PatternPathRouter.RoutableDestination<Object> routableEndpoint, Session session) { Object webSocketEndpoint = routableEndpoint.getDestination(); Map<String, String> paramValues = routableEndpoint.getGroupNameValues(); Method method = new EndpointDispatcher().getOnCloseMethod(webSocketEndpoint); try { if (method != null) { List<Object> parameterList = new LinkedList<>(); Arrays.stream(method.getParameters()).forEach( parameter -> { if (parameter.getType() == CloseReason.class) { CloseReason.CloseCode closeCode = new CloseCodeImpl( closeCarbonMessage.getStatusCode()); CloseReason closeReason = new CloseReason( closeCode, closeCarbonMessage.getReasonText()); parameterList.add(closeReason); } else if (parameter.getType() == Session.class) { parameterList.add(session); } else if (parameter.getType() == String.class) { PathParam pathParam = parameter.getAnnotation(PathParam.class); if (pathParam != null) { parameterList.add(paramValues.get(pathParam.value())); } else { parameterList.add(null); throw new IllegalArgumentException("String parameters without" + " @PathParam annotation"); } } else { parameterList.add(null); } } ); executeMethod(method, webSocketEndpoint, parameterList, session); } } catch (Throwable throwable) { handleError(closeCarbonMessage, throwable, routableEndpoint, session); } }

Target:
private void handleCloseWebSocketMessage(StatusCarbonMessage closeCarbonMessage, PatternPathRouter.RoutableDestination<Object> routableEndpoint, Session session) { Object webSocketEndpoint = routableEndpoint.getDestination(); Map<String, String> paramValues = routableEndpoint.getGroupNameValues(); Optional<Method> methodOptional = new EndpointDispatcher().getOnCloseMethod(webSocketEndpoint); try { methodOptional.ifPresent( method -> { List<Object> parameterList = new LinkedList<>(); Arrays.stream(method.getParameters()).forEach( parameter -> { if (parameter.getType() == CloseReason.class) { CloseReason.CloseCode closeCode = new CloseCodeImpl( closeCarbonMessage.getStatusCode()); CloseReason closeReason = new CloseReason( closeCode, closeCarbonMessage.getReasonText()); parameterList.add(closeReason); } else if (parameter.getType() == Session.class) { parameterList.add(session); } else if (parameter.getType() == String.class) { PathParam pathParam = parameter.getAnnotation(PathParam.class); if (pathParam != null) { parameterList.add(paramValues.get(pathParam.value())); } else { throw new IllegalArgumentException("String parameters without" + " @PathParam annotation"); } } else { parameterList.add(null); } } ); executeMethod(method, webSocketEndpoint, parameterList, session); } ); } catch (Throwable throwable) { handleError(throwable, routableEndpoint, session); } }
Source:
protected boolean canHandle(Network network, Service service) { if (network.getBroadcastDomainType() != Networks.BroadcastDomainType.Vsp) { return false; } if (!_networkModel.isProviderForNetwork(getProvider(), network.getId())) { if (s_logger.isDebugEnabled()) { s_logger.debug("NuageElement is not a provider for network " + network.getDisplayText()); } return false; } if (service != null) { if (!_ntwkSrvcDao.canProviderSupportServiceInNetwork(network.getId(), service, getProvider())) { if (s_logger.isDebugEnabled()) { s_logger.debug("NuageElement can't provide the " + service.getName() + " service on network " + network.getDisplayText()); } return false; } } return true; }

Target:
protected boolean canHandle(Network network, Service service) { if (network.getBroadcastDomainType() != Networks.BroadcastDomainType.Vsp) { return false; } if (!_networkModel.isProviderForNetwork(getProvider(), network.getId())) { if (s_logger.isDebugEnabled()) { s_logger.debug("NuageVsp is not a provider for network " + network.getDisplayText()); } return false; } if (service != null) { if (!_ntwkSrvcDao.canProviderSupportServiceInNetwork(network.getId(), service, getProvider())) { if (s_logger.isDebugEnabled()) { s_logger.debug("NuageVsp can't provide the " + service.getName() + " service on network " + network.getDisplayText()); } return false; } } return true; }
Source:
public List<Location> getLocationsById(Collection<String> ids) { List<Location> result = new ArrayList<Location>(); for (Object id: ids) { if (id instanceof String) result.add(resolve((String)id)); else if (id instanceof Collection) { log.warn("LocationRegistry got list of list of location strings, "+ids+"; flattening"); result.addAll(getLocationsById((Collection)id)); } else if (id instanceof Location) result.add((Location)id); else { throw new IllegalArgumentException("Cannot resolve '"+id+"' to a location; unsupported type"); } } return result; }

Target:
public List<Location> getLocationsById(Collection<String> ids) { List<Location> result = new ArrayList<Location>(); for (Object id: ids) { if (id instanceof String) result.add(resolve((String)id)); else if (id instanceof Collection) { log.warn("LocationRegistry got list of list of location strings, "+ids+"; flattening"); result.addAll(getLocationsById((Collection)id)); } else if (id instanceof Location) result.add((Location)id); else { throw new IllegalArgumentException("Cannot resolve '"+id+"' to a location; unsupported type "+ (id==null ? "null" : ""+id.getClass())); } } return result; }
Source:
public HeroicConfig.Builder build(final ExtraParameters params) throws Exception { final HeroicConfig.Builder builder = HeroicConfig.builder(); final String level = params.get("level").orElse("INFO"); return builder .queryLogging( new Slf4jQueryLoggingModule(Optional.of("query_log"), Optional.of(level)) ); }

Target:
public HeroicConfig.Builder build(final ExtraParameters params) throws Exception { final HeroicConfig.Builder builder = HeroicConfig.builder(); final String level = params.get("level").orElse("TRACE"); return builder .queryLogging( new Slf4jQueryLoggingModule(Optional.of("query_log"), Optional.of(level)) ); }