auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void writeOutUsersDotAttributesFile(File userAttributesFile) { Map<String, Object> json = null; try (InputStream stream = Files.newInputStream(Paths.get(userAttributesFile.toURI()))) { json = GSON.fromJson( new InputStreamReader(stream), new TypeToken<Map<String, Object>>() {}.getType()); } catch (IOException e) { LOGGER.warn("Unable to read system user attribute file for hostname update.", e); return; } addGuestClaimsProfileAttributes(json); if (json.containsKey(oldHostName)) { json.put(System.getProperty(SystemBaseUrl.EXTERNAL_HOST), json.remove(oldHostName)); } for (Map.Entry<String, Object> entry : json.entrySet()) { json.put(entry.getKey(), replaceLocalhost(entry.getValue())); } try { FileUtils.writeStringToFile(userAttributesFile, GSON.toJson(json), Charset.defaultCharset()); } catch (IOException e) { LOGGER.warn("Unable to write user attribute file for system update.", e); } }

Target:
private void writeOutUsersDotAttributesFile(File userAttributesFile) { Map<String, Object> json = null; try (BufferedReader br = Files.newBufferedReader(Paths.get(userAttributesFile.toURI()))) { json = GSON.fromJson(br, MAP_STRING_TO_OBJECT_TYPE); } catch (IOException e) { LOGGER.warn("Unable to read system user attribute file for hostname update.", e); return; } addGuestClaimsProfileAttributes(json); if (json.containsKey(oldHostName)) { json.put(System.getProperty(SystemBaseUrl.EXTERNAL_HOST), json.remove(oldHostName)); } for (Map.Entry<String, Object> entry : json.entrySet()) { json.put(entry.getKey(), replaceLocalhost(entry.getValue())); } try { FileUtils.writeStringToFile(userAttributesFile, GSON.toJson(json), Charset.defaultCharset()); } catch (IOException e) { LOGGER.warn("Unable to write user attribute file for system update.", e); } }
Source:
public static String resolveName(Object context, String path) { Preconditions.checkNotNull(path, "path must not be null"); if (path==null || path.startsWith("/") || Urls.isUrlWithProtocol(path)) return path; Preconditions.checkNotNull(context, "context must not be null when path is relative"); return packagePath(context)+path; }

Target:
public static String resolveName(Object context, String path) { Preconditions.checkNotNull(path, "path must not be null"); if (path.startsWith("/") || Urls.isUrlWithProtocol(path)) return path; Preconditions.checkNotNull(context, "context must not be null when path is relative"); return packagePath(context)+path; }
Source:
public Optional<Furnace> build(DataView container) throws InvalidDataException { final Optional<Furnace> furnaceOptional = super.build(container); if (!furnaceOptional.isPresent()) { throw new InvalidDataException("The container had insufficient data to create a Furnace tile entity!"); } final Furnace furnace = furnaceOptional.get(); final TileEntityFurnace tileEntityFurnace = (TileEntityFurnace) furnace; final DataQuery burnTime = new DataQuery("BurnTime"); final DataQuery burnTimeTotal = new DataQuery("BurnTimeTotal"); final DataQuery cookTime = new DataQuery("CookTime"); final DataQuery cookTimeTotal = new DataQuery("cookTimeTotal"); final DataQuery customName = new DataQuery("CustomName"); if (container.contains(customName)) { tileEntityFurnace.setCustomInventoryName(container.getString(customName).get()); } if (!container.contains(burnTime) || !container.contains(burnTimeTotal) || !container.contains(cookTime) || !container.contains(cookTimeTotal)) { throw new InvalidDataException("The provided container does not contain the data to make a Furnace!"); } tileEntityFurnace.setField(0, container.getInt(burnTime).get() - container.getInt(burnTime).get()); tileEntityFurnace.setField(1, container.getInt(burnTimeTotal).get()); tileEntityFurnace.setField(2, container.getInt(cookTime).get()); tileEntityFurnace.setField(3, container.getInt(cookTimeTotal).get()); tileEntityFurnace.validate(); return Optional.of(furnace); }

Target:
public Optional<Furnace> build(DataView container) throws InvalidDataException { final Optional<Furnace> furnaceOptional = super.build(container); if (!furnaceOptional.isPresent()) { throw new InvalidDataException("The container had insufficient data to create a Furnace tile entity!"); } final Furnace furnace = furnaceOptional.get(); final TileEntityFurnace tileEntityFurnace = (TileEntityFurnace) furnace; final DataQuery burnTime = new DataQuery("BurnTime"); final DataQuery burnTimeTotal = new DataQuery("BurnTimeTotal"); final DataQuery cookTime = new DataQuery("CookTime"); final DataQuery cookTimeTotal = new DataQuery("CookTimeTotal"); final DataQuery customName = new DataQuery("CustomName"); if (container.contains(customName)) { tileEntityFurnace.setCustomInventoryName(container.getString(customName).get()); } if (!container.contains(burnTime) || !container.contains(burnTimeTotal) || !container.contains(cookTime) || !container.contains(cookTimeTotal)) { throw new InvalidDataException("The provided container does not contain the data to make a Furnace!"); } tileEntityFurnace.setField(0, container.getInt(burnTime).get()); tileEntityFurnace.setField(1, container.getInt(burnTimeTotal).get()); tileEntityFurnace.setField(2, container.getInt(cookTime).get()); tileEntityFurnace.setField(3, container.getInt(cookTimeTotal).get()); tileEntityFurnace.markDirty(); return Optional.of(furnace); }
Source:
protected void parseCurrencyPairs(int requestId, String responseString, List<CurrencyPairInfo> pairs) throws Exception { final JSONArray resultJsonArray = new JSONArray(responseString); for(int i=0; i<resultJsonArray.length(); ++i) { final JSONObject marketJsonObject = resultJsonArray.getJSONObject(i); final String symbol = marketJsonObject.getString("symbol"); for (String base : BASE_CURRENCIES) { if (symbol.endsWith(base)) { pairs.add(new CurrencyPairInfo( symbol.substring(0, symbol.lastIndexOf(base)), base, null)); } } } }

Target:
protected void parseCurrencyPairs(int requestId, String responseString, List<CurrencyPairInfo> pairs) throws Exception { final JSONArray resultJsonArray = new JSONArray(responseString); for(int i=0; i<resultJsonArray.length(); ++i) { final JSONObject marketJsonObject = resultJsonArray.getJSONObject(i); final String symbol = marketJsonObject.getString("symbol"); for (String counter : COUNTER_CURRENCIES) { if (symbol.endsWith(counter)) { pairs.add(new CurrencyPairInfo( symbol.substring(0, symbol.lastIndexOf(counter)), counter, symbol)); } } } }
Source:
public void run() { try { Thread.currentThread().setName("LearnerCnxAcceptorHandler-" + serverSocket.getLocalSocketAddress()); while (!stop.get()) { acceptConnections(); } } catch (Exception e) { LOG.warn("Exception while accepting follower", e); if (!fail.get()) { handleException(getName(), e); fail.set(true); halt(); } } finally { latch.countDown(); } }

Target:
public void run() { try { Thread.currentThread().setName("LearnerCnxAcceptorHandler-" + serverSocket.getLocalSocketAddress()); while (!stop.get()) { acceptConnections(); } } catch (Exception e) { LOG.warn("Exception while accepting follower", e); if (fail.compareAndSet(false, true)) { handleException(getName(), e); halt(); } } finally { latch.countDown(); } }
Source:
public void testColor() { Factory factory = new Factory(); assertEquals("#FF0000", ((Literal) Util.color("FF0000", factory)).getValue()); assertEquals("#00FF00", ((Literal) Util.color("00ff00", factory)).getValue()); assertEquals("#0000FF", ((Literal) Util.color("#0000FF", factory)).getValue()); assertEquals("#FFFF00", ((Literal) Util.color("0xFFFF00", factory)).getValue()); assertEquals("#00FFFF", ((Literal) Util.color("rgb(0, 255, 255)", factory)).getValue()); assertEquals("#FF00FF", ((Literal) Util.color("f0f", factory)).getValue()); }

Target:
public void testColor() { Factory factory = new Factory(); assertEquals(new Color(0xFF0000), ((Literal) Util.color("FF0000", factory)).getValue()); assertEquals(new Color(0x00FF00), ((Literal) Util.color("00ff00", factory)).getValue()); assertEquals(new Color(0x0000FF), ((Literal) Util.color("#0000FF", factory)).getValue()); assertEquals(new Color(0xFFFF00), ((Literal) Util.color("0xFFFF00", factory)).getValue()); assertEquals(new Color(0x00FFFF), ((Literal) Util.color("rgb(0, 255, 255)", factory)).getValue()); assertEquals(new Color(0xFF00FF), ((Literal) Util.color("f0f", factory)).getValue()); }
Source:
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_logo_picker); app = (MapleApplication) this.getApplication(); logos = app.getCurrentCompanyLogos(); companyTag = app.getCurrentCompany(); GridView gridview = (GridView) findViewById(R.id.gridview); gridview.setAdapter(new ImageAdapter(this)); gridview.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView<?> parent, View v, int position, long id) { setLogo(v, position); } }); }

Target:
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_logo_picker); app = (MapleApplication) this.getApplication(); logos = app.getCurrentCompanyLogos(); companyTag = app.getCurrentCompany(); TextView header = (TextView) findViewById(R.id.logoPickerTitle); header.setText("Pick A " + companyTag + " Logo"); gridview = (GridView) findViewById(R.id.gridview); gridview.setAdapter(new ImageAdapter(this)); gridview.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView<?> parent, View v, int position, long id) { setSelectedView(position); setLogo(v, position); } }); }
Source:
public String toString() { StringBuilder n = new StringBuilder(); n.append("PatchListKey["); if (projectKey != null) { n.append(projectKey.get()); n.append(" "); } n.append(oldId != null ? oldId.name() : "BASE"); n.append(".."); n.append(newId.name()); n.append(" "); n.append(oldSeqNum); n.append(".."); n.append(newSeqNum); n.append(" "); n.append(whitespace.name()); n.append("]"); return n.toString(); }

Target:
public String toString() { StringBuilder n = new StringBuilder(); n.append("PatchListKey["); if (projectKey != null) { n.append(projectKey.get()); n.append(" "); } n.append(oldId != null ? oldId.name() : "BASE"); n.append(".."); n.append(newId.name()); if(oldSeqNum > 0 && newSeqNum > 0) { n.append(" "); n.append(oldSeqNum); n.append(".."); n.append(newSeqNum); } n.append(" "); n.append(whitespace.name()); n.append("]"); return n.toString(); }
Source:
protected void exitSubrule(GrammarAST tree) { if (tree.getType() == CLOSURE || tree.getType() == POSITIVE_CLOSURE) { for (Map.Entry<String, MutableInt> entry : frequencies.peek().entrySet()) { entry.getValue().v = 2; } int multiplier = tree.getType() == POSITIVE_CLOSURE ? 1 : 0; for (Map.Entry<String, MutableInt> entry : minFrequencies.peek().entrySet()) { entry.getValue().v *= multiplier; } } }

Target:
protected void exitSubrule(GrammarAST tree) { if (tree.getType() == CLOSURE || tree.getType() == POSITIVE_CLOSURE) { for (Map.Entry<String, MutableInt> entry : frequencies.peek().entrySet()) { entry.getValue().v = 2; } } if (tree.getType() == CLOSURE) { minFrequencies.peek().clear(); } }
Source:
public QuestionWidget(Context context, FormEntryPrompt prompt, AudioHelper audioHelper) { super(context); this.audioHelper = audioHelper; AppDependencyComponent component = DaggerUtils.getComponent((Activity) getContext()); this.referenceManager = component.referenceManager(); themeUtils = new ThemeUtils(context); playColor = themeUtils.getAccentColor(); if (context instanceof FormEntryActivity) { state = ((FormEntryActivity) context).getState(); permissionUtils = new PermissionUtils(); } if (context instanceof DependencyProvider) { injectDependencies((DependencyProvider) context); } player = new MediaPlayer(); questionFontSize = Collect.getQuestionFontsize(); formEntryPrompt = prompt; setGravity(Gravity.TOP); setPadding(0, 7, 0, 0); questionQuestionLabel = createQuestionMediaLayout(prompt); helpTextLayout = createHelpTextLayout(); helpTextLayout.setId(ViewIds.generateViewId()); guidanceTextLayout = helpTextLayout.findViewById(R.id.guidance_text_layout); textLayout = helpTextLayout.findViewById(R.id.text_layout); warningText = helpTextLayout.findViewById(R.id.warning_text); helpTextView = setupHelpText(helpTextLayout.findViewById(R.id.help_text_view), prompt); guidanceTextView = setupGuidanceTextAndLayout(helpTextLayout.findViewById(R.id.guidance_text_view), prompt); addQuestionMediaLayout(getQuestionQuestionLabel()); addHelpTextLayout(getHelpTextLayout()); if (context instanceof FormEntryActivity && !getFormEntryPrompt().isReadOnly()) { registerToClearAnswerOnLongPress((FormEntryActivity) context); } }

Target:
public QuestionWidget(Context context, FormEntryPrompt prompt, AudioHelper audioHelper) { super(context); this.audioHelper = audioHelper; AppDependencyComponent component = DaggerUtils.getComponent((Activity) getContext()); this.referenceManager = component.referenceManager(); themeUtils = new ThemeUtils(context); playColor = themeUtils.getAccentColor(); if (context instanceof FormEntryActivity) { state = ((FormEntryActivity) context).getState(); permissionUtils = new PermissionUtils(); } if (context instanceof DependencyProvider) { injectDependencies((DependencyProvider) context); } player = new MediaPlayer(); questionFontSize = Collect.getQuestionFontsize(); formEntryPrompt = prompt; setGravity(Gravity.TOP); setPadding(0, 7, 0, 0); audioVideoImageTextLabel = createQuestionLabel(prompt); helpTextLayout = createHelpTextLayout(); helpTextLayout.setId(ViewIds.generateViewId()); guidanceTextLayout = helpTextLayout.findViewById(R.id.guidance_text_layout); textLayout = helpTextLayout.findViewById(R.id.text_layout); warningText = helpTextLayout.findViewById(R.id.warning_text); helpTextView = setupHelpText(helpTextLayout.findViewById(R.id.help_text_view), prompt); guidanceTextView = setupGuidanceTextAndLayout(helpTextLayout.findViewById(R.id.guidance_text_view), prompt); addQuestionMediaLayout(getAudioVideoImageTextLabel()); addHelpTextLayout(getHelpTextLayout()); if (context instanceof FormEntryActivity && !getFormEntryPrompt().isReadOnly()) { registerToClearAnswerOnLongPress((FormEntryActivity) context); } }
Source:
protected HttpRequestBase createHttpRequestBase() { String bugUrl = getUrlSuffix(); BugzillaRestLoginToken token = ((BugzillaRestHttpClient) getClient()).getLoginToken(); if ((!(this instanceof BugzillaRestValidateRequest) && !(this instanceof BugzillaRestUnauthenticatedGetRequest)) && token != null && bugUrl.length() > 0) { if (bugUrl.endsWith("?")) { bugUrl += ("token=" + token.getToken()); } else { bugUrl += ("&token=" + token.getToken()); } } HttpRequestBase request = new HttpGet(baseUrl() + bugUrl); request.setHeader(CONTENT_TYPE, TEXT_XML_CHARSET_UTF_8); request.setHeader(ACCEPT, APPLICATION_JSON); return request; }

Target:
protected HttpRequestBase createHttpRequestBase() { String bugUrl = getUrlSuffix(); BugzillaRestLoginToken token = ((BugzillaRestHttpClient) getClient()).getLoginToken(); if ((!(this instanceof BugzillaRestValidateRequest) && !(this instanceof BugzillaRestUnauthenticatedGetRequest)) && token != null && bugUrl.length() > 0) { if (!bugUrl.endsWith("?")) { bugUrl += "&"; } bugUrl += "token=" + token.getToken(); } HttpRequestBase request = new HttpGet(baseUrl() + bugUrl); request.setHeader(CONTENT_TYPE, TEXT_XML_CHARSET_UTF_8); request.setHeader(ACCEPT, APPLICATION_JSON); return request; }
Source:
public void writeToAtomicFile() throws Exception { afw.write(expectedContent, 0, expectedContent.length()); afw.flush(); assertTrue("File writer did not properly flush to temporary file", Files.size(afw.getTemporaryPath()) == expectedContent.length()); }

Target:
public void writeToAtomicFile() throws Exception { afw.write(expectedContent, 0, expectedContent.length()); afw.flush(); assertEquals("File writer did not properly flush to temporary file", expectedContent.length(), Files.size(afw.getTemporaryPath())); }
Source:
public CronTab(String format, int line, Hash hash) throws ANTLRException { set(format, line, hash); }

Target:
public CronTab(String format, int line, Hash hash) throws ANTLRException { this(format, line, hash, null); }
Source:
private boolean isSyscallEntry(String eventName) { return ((eventName.startsWith(fLayout.eventSyscallEntryPrefix()) || eventName.startsWith(fLayout.eventCompatSyscallEntryPrefix())) && !(eventName.equals(fLayout.eventSyscallEntryPrefix() + "exit"))); }

Target:
private boolean isSyscallEntry(String eventName) { for (String prefix : fSysPrefixes) { if (eventName.startsWith(prefix)) { return !eventName.equals(prefix + fLayout.eventExitSyscallSuffix()); } } return false; }
Source:
public void migrateName(String n) { String space = " "; String[] name = n.split(space); if (isClanner()) { int i = 0; givenName = name[i]; for (i = 1; i < name.length - 1; i++) { if (!name[i].equals(space)) { givenName += space + name[i]; } } if (!(!StringUtil.isNullOrEmpty(getBloodname()) && getBloodname().equals(name[i]))) { givenName += space + name[i]; } surname = null; } else { if (name.length == 1) { givenName = name[0]; surname = null; } else if (name.length == 2) { givenName = name[0]; surname = name[1]; } else if (name.length == 3) { givenName = name[0]; if (name[1].equals(space)) { surname = name[2]; } else { surname = name[1] + space + name[2]; } } else if (name.length > 3) { int i = 0; givenName = name[i]; for (i = 1; i < name.length - 2; i++) { if (!name[i].equals(space)) { givenName += space + name[i]; } } if (name[i].equals(space)) { surname = name[i + 1]; } else { surname = name[i] + space + name[i + 1]; } } } setFullName(); }

Target:
public void migrateName(String n) { final String space = " "; String[] name = n.split(space); if (isClanner()) { int i = 0; givenName = name[i]; for (i = 1; i < name.length - 1; i++) { if (!name[i].equals(space)) { givenName += space + name[i]; } } if (!(!StringUtil.isNullOrEmpty(getBloodname()) && getBloodname().equals(name[i]))) { givenName += space + name[i]; } surname = null; } else { if (name.length == 1) { givenName = name[0]; surname = null; } else if (name.length == 2) { givenName = name[0]; surname = name[1]; } else if (name.length == 3) { givenName = name[0]; if (name[1].equals(space)) { surname = name[2]; } else { surname = name[1] + space + name[2]; } } else if (name.length > 3) { int i = 0; givenName = name[i]; for (i = 1; i < name.length - 2; i++) { if (!name[i].equals(space)) { givenName += space + name[i]; } } if (name[i].equals(space)) { surname = name[i + 1]; } else { surname = name[i] + space + name[i + 1]; } } } setFullName(); }
Source:
public Result updateCreateVersionSet(final UUID uuid) { final VersionSet view = request().body().as(VersionSet.class); for (Map.Entry<String, PackageVersion> packageVersionEntry : view.getPackages().entrySet()) { if (!packageVersionEntry.getKey().equals(packageVersionEntry.getValue().getPackageName())) { return badRequest("versionSet.packages: keys must match package names."); } } final models.internal.VersionSet internalModel = viewToInternalVersionSpec(view); try { _versionSpecificationRepository.addOrUpdateVersionSet(internalModel); } catch (final Exception e) { LOGGER.error() .setMessage("Failed to create / update VersionSpecification") .addData("models.view.VersionSet", view) .addData("models.internal.VersionSet", internalModel) .setThrowable(e) .log(); return internalServerError(); } return ok(); }

Target:
public Result updateCreateVersionSet(final UUID uuid) { final String bodyText = request().body().asText(); final VersionSet view; try { view = OBJECT_MAPPER.readValue(bodyText, VersionSet.class); } catch (final IOException e) { LOGGER.error() .setMessage("Failed to deserialize body in updateCreateVersionSet") .addData("Body", bodyText) .addData("Uuid", uuid) .setThrowable(e) .log(); return badRequest("Malformed request body"); } for (Map.Entry<String, PackageVersion> packageVersionEntry : view.getPackages().entrySet()) { if (!packageVersionEntry.getKey().equals(packageVersionEntry.getValue().getPackageName())) { return badRequest("versionSet.packages: keys must match package names."); } } final models.internal.VersionSet internalModel = viewToInternalVersionSpec(view); try { _versionSpecificationRepository.addOrUpdateVersionSet(internalModel); } catch (final Exception e) { LOGGER.error() .setMessage("Failed to create / update VersionSpecification") .addData("Models.view.VersionSet", view) .addData("Models.internal.VersionSet", internalModel) .setThrowable(e) .log(); return internalServerError(); } return ok(); }
Source:
public TaskSummary getTask(String serverTemplateId, String containerId, Long taskId) { if (serverTemplateId == null || serverTemplateId.isEmpty()) { return null; } if (!specManagementService.getServerTemplate(serverTemplateId).getContainerSpec(containerId).getStatus().equals(KieContainerStatus.STARTED)) { return null; } UserTaskServicesClient client = getClient(serverTemplateId, UserTaskServicesClient.class); try { TaskInstance task = client.getTaskInstance(containerId, taskId); return new TaskSummaryMapper().apply(task); } catch (KieServicesHttpException kieException) { if (kieException.getHttpCode() == NOT_FOUND_ERROR_CODE) { return null; } else { throw kieException; } } }

Target:
public TaskSummary getTask(String serverTemplateId, String containerId, Long taskId) { if (serverTemplateId == null || serverTemplateId.isEmpty()) { return null; } UserTaskServicesClient client = getClient(serverTemplateId, UserTaskServicesClient.class); try { TaskInstance task = client.getTaskInstance(containerId, taskId); return new TaskSummaryMapper().apply(task); } catch (KieServicesHttpException kieException) { if (kieException.getHttpCode() == NOT_FOUND_ERROR_CODE) { return null; } else { throw kieException; } } }
Source:
public void setup() { RoboGuice.useAnnotationDatabases = false; context = Robolectric.buildActivity(RoboActivity.class).create().get(); astroboy = RoboGuice.getInjector(context).getInstance(Astroboy.class); }

Target:
public void setup() { RoboGuice.setUseAnnotationDatabases(false); context = Robolectric.buildActivity(RoboActivity.class).create().get(); astroboy = RoboGuice.getInjector(context).getInstance(Astroboy.class); }
Source:
private static InputStream getBody(Response response) { try { if (response.body() != null) { return response.body().asInputStream(); } } catch (IOException e) { log.warn("Unable to read message body from response {}", response, e); return null; } }

Target:
private static InputStream getBody(Response response) { try { if (response.body() != null) { return response.body().asInputStream(); } } catch (IOException e) { log.warn("Unable to read message body from response {}", response, e); } return null; }
Source:
public String socketDescription() { Socket socket = transportLayer.socketChannel().socket(); return "(Remote Address: " + ( socket.getInetAddress() == null ? "[non-connected socket]" : socket.getInetAddress().toString() ) + ", Local Address: " + socket.getLocalAddress().toString() + ")"; }

Target:
public String socketDescription() { Socket socket = transportLayer.socketChannel().socket(); if (socket == null) return "[non-existing socket]"; return "(Remote Address: " + ( socket.getInetAddress() == null ? "[non-connected socket]" : socket.getInetAddress().toString() ) + ", Local Address: " + socket.getLocalAddress().toString() + ")"; }
Source:
public void notEmptyExcludesShouldBeNotEmptyArguments() throws Exception { final Environment env = new Environment.Mock() .withExcludes("Foo,Bar"); final FindBugsExcludes excludes = new FindBugsExcludes(env); final Collection<String> arguments = excludes.asArguments(); MatcherAssert.assertThat( "The argument was empty for not empty excludes", arguments, new IsNot<>( new IsEmptyCollection<>() ) ); MatcherAssert.assertThat( "Expected a single argument", arguments.size(), new IsEqual<>(1) ); new FindBugsExcludesTest.ExcludesXml( new SAXReader().read(arguments.iterator().next()) ).assertXpath("count(/FindBugsFilter)=1"); }

Target:
public void notEmptyExcludesShouldBeNotEmptyArguments() throws Exception { final List<String> arguments = new FindBugsExcludes( new Environment.Mock().withExcludes("Foo,Bar") ).asArguments(); MatcherAssert.assertThat( "The argument was empty for not empty excludes", arguments, new IsNot<>( new IsEmptyCollection<>() ) ); MatcherAssert.assertThat( "Expected a single argument", arguments.size(), new IsEqual<>(1) ); final Document doc = DocumentBuilderFactory.newInstance() .newDocumentBuilder() .parse(arguments.get(0)); MatcherAssert.assertThat( doc, new HasXPath( FindBugsExcludesTest.COUNT_FILTER, new IsEqual<>("1") ) ); }
Source:
public static Long getLong(String name, Long def) { String v = getString(name); if (v != null) { try { return Long.decode(v); } catch (NumberFormatException e) { if (LOGGER.isLoggable(Level.CONFIG)) { LOGGER.log(Level.CONFIG, "Property. Value is not integer: {0} => {1}", new Object[] {name, v}); } } } return def; }

Target:
public static Long getLong(String name, Long def) { String v = getString(name); if (v != null) { try { return Long.decode(v); } catch (NumberFormatException e) { if (LOGGER.isLoggable(Level.CONFIG)) { LOGGER.log(Level.CONFIG, "Property. Value is not long: {0} => {1}", new Object[] {name, v}); } } } return def; }
Source:
public void define(WebService.NewController controller) { WebService.NewAction action = controller.createAction(ACTION) .setPost(true) .setDescription("Set Homepage of current user. Requires to be identified.") .setSince("7.0") .setHandler(this); action.createParam(PARAM_TYPE) .setDescription("Type of the requested page") .setRequired(true) .setPossibleValues(HomepageTypes.valuesAsString()); action.createParam(PARAM_KEY) .setDescription("additional information to filter the page") .setExampleValue("admin"); }

Target:
public void define(WebService.NewController controller) { WebService.NewAction action = controller.createAction(ACTION) .setPost(true) .setDescription("Set Homepage of current user.<br> Requires authentication.") .setSince("7.0") .setHandler(this); action.createParam(PARAM_TYPE) .setDescription("Type of the requested page") .setRequired(true) .setPossibleValues(HomepageTypes.keys()); action.createParam(PARAM_VALUE) .setDescription("Additional information to filter the page (project or organization key)") .setExampleValue("my-project-key"); }
Source:
public PlanState cloneWithApplied(PConstraintInfo op) { ArrayList<PConstraintInfo> newOperationsList = new ArrayList<>(this.getOperations()); newOperationsList.add(op); Collection<PVariable> deltaVariables = op.getFreeVariables(); Set<PVariable> allBoundVariables = new HashSet<>(this.getBoundVariables()); allBoundVariables.addAll(deltaVariables); PlanState newState = new PlanState(getAssociatedPBody(), newOperationsList, allBoundVariables, deltaVariables); newState.accountNewOperation(op); return newState; }

Target:
public PlanState cloneWithApplied(PConstraintInfo op) { ArrayList<PConstraintInfo> newOperationsList = new ArrayList<>(pBody.getConstraints().size()); newOperationsList.addAll(this.getOperations()); newOperationsList.add(op); Collection<PVariable> deltaVariables = op.getFreeVariables(); Set<PVariable> allBoundVariables = new HashSet<>(this.getBoundVariables().size() + deltaVariables.size()); allBoundVariables.addAll(this.getBoundVariables()); allBoundVariables.addAll(deltaVariables); PlanState newState = new PlanState(getAssociatedPBody(), newOperationsList, allBoundVariables, deltaVariables); newState.accountNewOperation(op); return newState; }
Source:
private Cell getKeyCellForTable(TableReference tableRef) { return Cell.create(getBytesForTableRef(tableRef), AtlasDbConstants.NAMESPACE_SHORT_COLUMN_BYTES); }

Target:
static Cell getKeyCellForTable(TableReference tableRef) { return Cell.create(getBytesForTableRef(tableRef), AtlasDbConstants.NAMESPACE_SHORT_COLUMN_BYTES); }
Source:
public synchronized void close() throws Exception { if (!reqQueueExecutor.isShutdown()) reqQueueExecutor.shutdown(); synchronized(scopedCleanupActions) { for (Callable<Void> actions : scopedCleanupActions.values()) { actions.call(); } scopedCleanupActions.clear(); } for (Callable<Void> action : cleanupActions) { action.call(); } cleanupActions.clear(); }

Target:
public void close() throws Exception { if (running.compareAndSet(true, false)) { LOGGER.info("closing PreDestroyMonitor..."); reqQueueExecutor.shutdown(); synchronized(scopedCleanupActions) { for (Callable<Void> actions : scopedCleanupActions.values()) { actions.call(); } scopedCleanupActions.clear(); scopedCleanupActions = Collections.emptyMap(); } if (!reqQueueExecutor.awaitTermination(90, TimeUnit.SECONDS)) { LOGGER.error("internal executor still active; shutting down now"); reqQueueExecutor.shutdownNow(); } for (Callable<Void> action : cleanupActions) { action.call(); } cleanupActions.clear(); markerReferenceQueue = null; scopeBindings.clear(); scopeBindings = Collections.emptyMap(); } else { LOGGER.warn("PreDestroyMonitor.close() invoked but instance is not running"); } }
Source:
private static Function<Page, Page> enforceLayoutProcessor(List<Symbol> expectedLayout, Map<Symbol, Integer> inputLayout) { int[] channels = new int[expectedLayout.size()]; for (int i = 0; i < expectedLayout.size(); i++) { Symbol symbol = expectedLayout.get(i); Integer channel = inputLayout.get(symbol); checkArgument(channel != null, "channel not found for symbol: %s", symbol); channels[i] = channel; } if (Arrays.equals(channels, range(0, inputLayout.size()).toArray())) { return Function.identity(); } return new PageChannelSelector(channels); }

Target:
private static Function<Page, Page> enforceLayoutProcessor(List<Symbol> expectedLayout, Map<Symbol, Integer> inputLayout) { int[] channels = expectedLayout.stream() .peek(symbol -> checkArgument(inputLayout.containsKey(symbol), "channel not found for symbol: %s", symbol)) .mapToInt(inputLayout::get) .toArray(); if (Arrays.equals(channels, range(0, inputLayout.size()).toArray())) { return Function.identity(); } return new PageChannelSelector(channels); }
Source:
private static File createNewBasePersistDirectory() { try { return Files.createTempDir(); } catch (IllegalStateException e) { String message = "Failed to create temporary directory!" + System.lineSeparator() + "Make sure `java.io.tmpdir` property is set to existing and writable directory."; throw new IllegalStateException(message, e); } }

Target:
private static File createNewBasePersistDirectory() { try { return Files.createTempDir(); } catch (IllegalStateException e) { String messageTemplate = "Failed to create temporary directory in [%s]! " + "Make sure the `java.io.tmpdir` property is set to an existing and writable directory " + "with enough free space."; throw new ISE(e, messageTemplate, System.getProperty("java.io.tmpdir")); } }
Source:
public static PluginManager createPluginManager() { PluginManager pluginManager = new DefaultPluginManager() { @Override protected ExtensionFinder createExtensionFinder() { return new BuckExtensionFinder(); } @Override protected CompoundPluginDescriptorFinder createPluginDescriptorFinder() { CompoundPluginDescriptorFinder finder = new CompoundPluginDescriptorFinder(); finder.add(new ManifestPluginDescriptorFinder()); return finder; } @Override protected PluginRepository createPluginRepository() { try { return new DefaultPluginRepository( Files.createTempDirectory("pf4j-plugins"), false); } catch (IOException e) { throw new RuntimeException(e); } } }; pluginManager.loadPlugins(); pluginManager.startPlugins(); return pluginManager; }

Target:
public static PluginManager createPluginManager() { PluginManager pluginManager = new DefaultPluginManager() { @Override protected ExtensionFinder createExtensionFinder() { return new BuckExtensionFinder(); } @Override public Path getPluginsRoot() { return Paths.get("buck-plugins"); } }; pluginManager.loadPlugins(); pluginManager.startPlugins(); return pluginManager; }
Source:
public Response toResponse(final Exception e) { return Response.status(Response.Status.INTERNAL_SERVER_ERROR) .entity(e.getMessage()) .type(MediaType.TEXT_PLAIN) .build(); }

Target:
public Response toResponse(final Exception e) { logger.log(Level.WARNING, "Exception while processing request", e); return ExceptionMapperUtils.toResponse(Response.Status.INTERNAL_SERVER_ERROR, e); }
Source:
protected void volumeType_SelectedItemChanged() { if (getVolumeType().getSelectedItem() == null || getDataCenter().getSelectedItem() == null || getStorageDomain().getSelectedItem() == null) { return; } if (!isInStorageDomainUpdate) { isUserSelectVolumeType = true; } VolumeType volumeType = getVolumeType().getSelectedItem(); StorageType storageType = getStorageDomain().getSelectedItem().getStorageType(); updateShareable(volumeType, storageType); }

Target:
protected void volumeType_SelectedItemChanged() { if (getVolumeType().getSelectedItem() == null || getDataCenter().getSelectedItem() == null || getStorageDomain().getSelectedItem() == null) { return; } if (!isInStorageDomainUpdate) { isUserSelectedVolumeType = true; } VolumeType volumeType = getVolumeType().getSelectedItem(); StorageType storageType = getStorageDomain().getSelectedItem().getStorageType(); updateShareable(volumeType, storageType); }
Source:
private boolean isExecutableType(TypeMirror accessorType) { return accessorType.getKind() == TypeKind.EXECUTABLE && accessorType instanceof ExecutableType; }

Target:
private boolean isExecutableType(TypeMirror accessorType) { return accessorType.getKind() == TypeKind.EXECUTABLE; }
Source:
public TankItem(Block blockIn, Properties builder) { super(blockIn, builder); this.addPropertyOverride(new ResourceLocation("tconstruct","amount"), (stack, world, entity) -> { System.out.println("test1"); return 0.0F; } ); }

Target:
public TankItem(Block blockIn, Properties builder) { super(blockIn, builder); }
Source:
private String getExport( @NotNull String target, @Nullable ProcessAdapter processAdapter ) { try { final File outputFile = FileUtil.createTempFile("pants_export_" + target.replace('/', '_') + "_run", ".out"); final GeneralCommandLine commandLine = PantsUtil.defaultCommandLine(getProjectPath()); commandLine.addParameter("export"); commandLine.addParameter("--formatted"); if (myResolveSourcesAndDocsForJars) { commandLine.addParameter("--export-libraries-sources"); commandLine.addParameter("--export-libraries-javadocs"); } commandLine.addParameters(target); commandLine.addParameter("--export-output-file=" + outputFile.getPath()); LOG.debug(commandLine.toString()); final ProcessOutput processOutput = getProcessOutput(commandLine, processAdapter); if (processOutput.getStdout().contains("no such option")) { throw new ExternalSystemException("Pants doesn't have necessary APIs. Please upgrade you pants!"); } if (processOutput.checkSuccess(LOG)) { return FileUtil.loadFile(outputFile); } else { throw new PantsExecutionException("Failed to update the project!", commandLine.getCommandLineString("pants"), processOutput); } } catch (IOException | ExecutionException e) { throw new RuntimeException(e); } }

Target:
private String getExport( @NotNull String target, @Nullable ProcessAdapter processAdapter ) { try { final File outputFile = FileUtil.createTempFile("pants_export_run", ".out"); final GeneralCommandLine commandLine = PantsUtil.defaultCommandLine(getProjectPath()); commandLine.addParameter("export"); commandLine.addParameter("--formatted"); if (myResolveSourcesAndDocsForJars) { commandLine.addParameter("--export-libraries-sources"); commandLine.addParameter("--export-libraries-javadocs"); } commandLine.addParameters(target); commandLine.addParameter("--export-output-file=" + outputFile.getPath()); LOG.debug(commandLine.toString()); final ProcessOutput processOutput = getProcessOutput(commandLine, processAdapter); if (processOutput.getStdout().contains("no such option")) { throw new ExternalSystemException("Pants doesn't have necessary APIs. Please upgrade you pants!"); } if (processOutput.checkSuccess(LOG)) { return FileUtil.loadFile(outputFile); } else { throw new PantsExecutionException("Failed to update the project!", commandLine.getCommandLineString("pants"), processOutput); } } catch (IOException | ExecutionException e) { throw new RuntimeException(e); } }
Source:
private DiskDef.DiskBus getGuestDiskModel(final String platformEmulator) { if (platformEmulator == null) { return DiskDef.DiskBus.IDE; } else if (platformEmulator.startsWith("Other PV Virtio-SCSI")) { return DiskDef.DiskBus.SCSI; } else if (platformEmulator.startsWith("Ubuntu") || platformEmulator.startsWith("Fedora") || platformEmulator.startsWith("CentOS") || platformEmulator.startsWith("Red Hat Enterprise Linux") || platformEmulator.startsWith("Debian GNU/Linux") || platformEmulator.startsWith("FreeBSD") || platformEmulator.startsWith("Oracle") || platformEmulator.startsWith("Windows PV") || platformEmulator.startsWith("Other PV")) { return DiskDef.DiskBus.VIRTIO; } else { return DiskDef.DiskBus.IDE; } }

Target:
private DiskDef.DiskBus getGuestDiskModel(final String platformEmulator) { if (platformEmulator == null) { return DiskDef.DiskBus.IDE; } else if (platformEmulator.startsWith("Other PV Virtio-SCSI")) { return DiskDef.DiskBus.SCSI; } else if (platformEmulator.contains("Ubuntu") || platformEmulator.startsWith("Fedora") || platformEmulator.startsWith("CentOS") || platformEmulator.startsWith("Red Hat Enterprise Linux") || platformEmulator.startsWith("Debian GNU/Linux") || platformEmulator.startsWith("FreeBSD") || platformEmulator.startsWith("Oracle") || platformEmulator.startsWith("Other PV")) { return DiskDef.DiskBus.VIRTIO; } else { return DiskDef.DiskBus.IDE; } }
Source:
private void addActivityCommentMessageLinks(ActivityCommentMessageDto message) { IntervalActivity activity = IntervalActivity.getIntervalActivityRepository().findById(message.getIntervalActivityId()) .orElse(null); Objects.requireNonNull(activity, String.format("Activity linked from activity comment message not found from sender '%s' and activity id '%s'", message.getSenderNickname(), message.getIntervalActivityId())); Goal goal = Objects.requireNonNull(activity.getGoal(), String.format("Activity getGoal() returns null for '%s' instance with id '%s' and start time '%s'", activity.getClass().getSimpleName(), activity.getId(), activity.getStartDate())); if (goalIdMapping.isUserGoal(goal.getId())) { messageController.getUserActivityController().addLinks(goalIdMapping, activity, message); } else { messageController.getBuddyActivityController().addLinks(goalIdMapping, activity, message); } }

Target:
private void addActivityCommentMessageLinks(ActivityCommentMessageDto message) { IntervalActivity activity = IntervalActivity.getIntervalActivityRepository().findById(message.getIntervalActivityId()) .orElseThrow(() -> new IllegalStateException(String.format( "Activity linked from activity comment message not found from sender '%s' and activity id '%s'", message.getSenderNickname(), message.getIntervalActivityId()))); Goal goal = Objects.requireNonNull(activity.getGoal(), String.format("Activity getGoal() returns null for '%s' instance with id '%s' and start time '%s'", activity.getClass().getSimpleName(), activity.getId(), activity.getStartDate())); if (goalIdMapping.isUserGoal(goal.getId())) { messageController.getUserActivityController().addLinks(goalIdMapping, activity, message); } else { messageController.getBuddyActivityController().addLinks(goalIdMapping, activity, message); } }
Source:
TailoredPeersClusterMap() { for (String datanodeName : datanodeNames) { String[] parts = datanodeName.split(":"); Port port = new Port(Integer.parseInt(parts[1]), PortType.PLAINTEXT); List<String> mountPaths = Collections.singletonList("/" + datanodeName); MockDataNodeId dataNodeId = new MockDataNodeId(parts[0], Collections.singletonList(port), mountPaths, DC_NAME); datanodes.put(datanodeName, dataNodeId); } List<MockDataNodeId> partNodes = new ArrayList<>(); partNodes.add(datanodes.get(datanodeNames[0])); partNodes.add(datanodes.get(datanodeNames[1])); partitions.add(new MockPartitionId(0, partNodes, 0)); partNodes.clear(); partNodes.add(datanodes.get(datanodeNames[0])); partNodes.add(datanodes.get(datanodeNames[1])); partitions.add(new MockPartitionId(1, partNodes, 0)); partNodes.clear(); partNodes.add(datanodes.get(datanodeNames[0])); partNodes.add(datanodes.get(datanodeNames[2])); partitions.add(new MockPartitionId(2, partNodes, 0)); partNodes.clear(); partNodes.add(datanodes.get(datanodeNames[0])); partitions.add(new MockPartitionId(3, partNodes, 0)); partNodes.clear(); partNodes.add(datanodes.get(datanodeNames[3])); partitions.add(new MockPartitionId(4, partNodes, 0)); peerMap.put(datanodeNames[0], new HashSet(Arrays.asList(datanodeNames[1], datanodeNames[2]))); peerMap.put(datanodeNames[1], new HashSet(Arrays.asList(datanodeNames[0]))); peerMap.put(datanodeNames[2], Collections.singleton(datanodeNames[0])); peerMap.put(datanodeNames[3], Collections.EMPTY_SET); }

Target:
TailoredPeersClusterMap() { for (String datanodeName : DATANODE_NAMES) { String[] parts = datanodeName.split(":"); Port port = new Port(Integer.parseInt(parts[1]), PortType.PLAINTEXT); List<String> mountPaths = Collections.singletonList("/" + datanodeName); MockDataNodeId dataNodeId = new MockDataNodeId(parts[0], Collections.singletonList(port), mountPaths, DC_NAME); datanodes.put(datanodeName, dataNodeId); } List<MockDataNodeId> partNodes = new ArrayList<>(); partNodes.add(datanodes.get(DATANODE_NAMES[0])); partNodes.add(datanodes.get(DATANODE_NAMES[1])); partitions.add(new MockPartitionId(0, partNodes, 0)); partNodes.clear(); partNodes.add(datanodes.get(DATANODE_NAMES[0])); partNodes.add(datanodes.get(DATANODE_NAMES[1])); partitions.add(new MockPartitionId(1, partNodes, 0)); partNodes.clear(); partNodes.add(datanodes.get(DATANODE_NAMES[0])); partNodes.add(datanodes.get(DATANODE_NAMES[2])); partitions.add(new MockPartitionId(2, partNodes, 0)); partNodes.clear(); partNodes.add(datanodes.get(DATANODE_NAMES[0])); partitions.add(new MockPartitionId(3, partNodes, 0)); partNodes.clear(); partNodes.add(datanodes.get(DATANODE_NAMES[3])); partitions.add(new MockPartitionId(4, partNodes, 0)); peerMap.put(DATANODE_NAMES[0], new HashSet(Arrays.asList(DATANODE_NAMES[1], DATANODE_NAMES[2]))); peerMap.put(DATANODE_NAMES[1], new HashSet(Arrays.asList(DATANODE_NAMES[0]))); peerMap.put(DATANODE_NAMES[2], Collections.singleton(DATANODE_NAMES[0])); peerMap.put(DATANODE_NAMES[3], Collections.EMPTY_SET); }
Source:
public void setup() { for (ResourceLocation id : Block.REGISTRY.getKeys()) { Block block = Block.REGISTRY.getObject(id); if (block == null) continue; if (TrackTools.isRailBlock(block)) add(block); } for (ResourceLocation id : Item.REGISTRY.getKeys()) { Item item = Item.REGISTRY.getObject(id); if (item instanceof ItemMinecart || item instanceof IMinecartItem) add(item); } add(RailcraftItems.SIGNAL_BLOCK_SURVEYOR); add(RailcraftItems.SIGNAL_TUNER); add(RailcraftItems.SIGNAL_LAMP); add(RailcraftItems.CIRCUIT); add(RailcraftItems.SIGNAL_LABEL); add(RailcraftItems.MAG_GLASS); add(RailcraftItems.GOGGLES); add(RailcraftBlocks.WAY_OBJECT); add(RailcraftBlocks.DETECTOR); add(RailcraftBlocks.SIGNAL_BOX); }

Target:
public void setup() { add(RailcraftItems.SIGNAL_BLOCK_SURVEYOR); add(RailcraftItems.SIGNAL_TUNER); add(RailcraftItems.SIGNAL_LAMP); add(RailcraftItems.CIRCUIT); add(RailcraftItems.SIGNAL_LABEL); add(RailcraftItems.MAG_GLASS); add(RailcraftItems.GOGGLES); add(RailcraftBlocks.WAY_OBJECT); add(RailcraftBlocks.DETECTOR); add(RailcraftBlocks.SIGNAL_BOX); }
Source:
protected void endSuccessfullySynchronous() { VM vm = getVm(); VmHandler.UnLockVm(vm.getId()); this.endDefaultOps(vm); setSucceeded(true); }

Target:
protected void endSuccessfullySynchronous() { VM vm = getVm(); VmHandler.UnLockVm(vm.getId()); this.endDefaultOperations(vm); setSucceeded(true); }
Source:
static String createProcessorId(ApplicationConfig appConfig) { if (appConfig.getProcessorId() != null) { return appConfig.getProcessorId(); } else if (appConfig.getAppProcessorIdGeneratorClass() != null) { ProcessorIdGenerator idGenerator = Util.getObj(appConfig.getAppProcessorIdGeneratorClass(), ProcessorIdGenerator.class); return idGenerator.generateProcessorId(appConfig); } else { throw new ConfigException(String.format("Expected either %s or %s to be configured", ApplicationConfig.PROCESSOR_ID, ApplicationConfig.APP_PROCESSOR_ID_GENERATOR_CLASS)); } }

Target:
static String createProcessorId(ApplicationConfig appConfig) { if (StringUtils.isNotBlank(appConfig.getProcessorId())) { return appConfig.getProcessorId(); } else if (StringUtils.isNotBlank(appConfig.getAppProcessorIdGeneratorClass())) { ProcessorIdGenerator idGenerator = Util.getObj(appConfig.getAppProcessorIdGeneratorClass(), ProcessorIdGenerator.class); return idGenerator.generateProcessorId(appConfig); } else { throw new ConfigException(String.format("Expected either %s or %s to be configured", ApplicationConfig.PROCESSOR_ID, ApplicationConfig.APP_PROCESSOR_ID_GENERATOR_CLASS)); } }
Source:
public V apply(EntryView.ReadWriteEntryView<K, V> entry) { V merged = value; if (entry.find().isPresent()) { merged = remappingFunction.apply(entry.get(), value); } if (merged == null) { entry.remove(); } else { entry.set(merged); } return merged; }

Target:
public V apply(EntryView.ReadWriteEntryView<K, V> entry) { try { V merged = value; if (entry.find().isPresent()) { merged = remappingFunction.apply(entry.get(), value); } if (merged == null) { entry.set(merged); } else { entry.set(merged, metadata); } return merged; } catch (Exception ex) { throw new UserRaisedFunctionalException(ex); } }
Source:
private void disconnect() throws XAException { try { xaConnection.close(); } catch (JMSException e) { LOGGER.warn("Failed to close connection", e); throw new XAException(XAException.XAER_PROTO); } finally { xaConnection = null; xaSession = null; delegate = null; } }

Target:
private void disconnect() { try { xaConnection.close(); } catch (JMSException e) { LOGGER.warn("Failed to close connection", e); } finally { xaConnection = null; xaSession = null; delegate = null; } }
Source:
public BackendlessCollection<GeoPoint> getPoints( BackendlessGeoQuery geoQuery ) throws BackendlessException { checkGeoQuery( geoQuery ); CollectionAdaptingPolicy<GeoPoint> adaptingPolicy = new CollectionAdaptingPolicy<GeoPoint>(); BackendlessCollection<GeoPoint> result = (BackendlessCollection<GeoPoint>) Invoker.invokeSync( GEO_MANAGER_SERVER_ALIAS, "getPoints", new Object[] { Backendless.getApplicationId(), Backendless.getVersion(), geoQuery }, new AdaptingResponder<GeoPoint>( GeoPoint.class, adaptingPolicy ) ); if( result instanceof BackendlessGeoCollection ) { Backendless.Cache.put( Messaging.DEVICE_ID + "." + BackendlessGeoQuery.class.getSimpleName(), geoQuery ); } result.setQuery( geoQuery ); result.setType( GeoPoint.class ); return result; }

Target:
public BackendlessCollection<GeoPoint> getPoints( BackendlessGeoQuery geoQuery ) throws BackendlessException { checkGeoQuery( geoQuery ); CollectionAdaptingPolicy<GeoPoint> adaptingPolicy = new CollectionAdaptingPolicy<GeoPoint>(); BackendlessCollection<GeoPoint> result = (BackendlessCollection<GeoPoint>) Invoker.invokeSync( GEO_MANAGER_SERVER_ALIAS, "getPoints", new Object[] { Backendless.getApplicationId(), Backendless.getVersion(), geoQuery }, new AdaptingResponder<GeoPoint>( GeoPoint.class, adaptingPolicy ) ); result.setQuery( geoQuery ); result.setType( GeoPoint.class ); if( geoQuery.getDpp() != null && geoQuery.getDpp() > 0 ) { setReferenceToCluster( result ); } return result; }