auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private List<String> getAccountUris(final ServerContext vsoDeploymentContext) { List<String> accountUris = new ArrayList<String>(); final Client accountClient = vsoDeploymentContext.getClient(); final String accountApiUrlFormat = VsoAuthenticationProvider.VSO_AUTH_URL + ACCOUNT_ENDPOINT; final WebTarget resourceTarget = accountClient.target(String.format(accountApiUrlFormat, vsoDeploymentContext.getUserId())); final Map<String, String> parameters = new HashMap<String, String>(); parameters.put("api-version", "3.0-preview.1"); parameters.put("charset", "UTF-8"); final Invocation invocation = resourceTarget.request( new MediaType("application", "json", parameters)) .buildGet(); final String response = invocation.invoke(String.class); final ObjectMapper objectMapper = new ObjectMapper(); JsonNode rootNode = null; try { rootNode = objectMapper.readTree(response); } catch (IOException e) { logger.error("Could not parse Account response", e); return accountUris; } final List<JsonNode> nodes = rootNode.findValues(TFS_SERVICE_URL_PROPERTY_NAME); for (final JsonNode node : nodes) { accountUris.add(StringUtils.removeEnd(node.path("$value").asText(), "/")); } return accountUris; }

Target:
private List<String> getAccountUris(final ServerContext vsoDeploymentContext) { List<String> accountUris = new ArrayList<String>(); final Client accountClient = vsoDeploymentContext.getClient(); final String accountApiUrlFormat = VsoAuthenticationProvider.VSO_AUTH_URL + ACCOUNT_ENDPOINT; final WebTarget resourceTarget = accountClient.target(String.format(accountApiUrlFormat, vsoDeploymentContext.getUserId())); final Map<String, String> parameters = new HashMap<String, String>(); parameters.put("api-version", "3.0-preview.1"); parameters.put("charset", "UTF-8"); final Invocation invocation = resourceTarget.request( new MediaType("application", "json", parameters)) .buildGet(); final String response = invocation.invoke(String.class); final ObjectMapper objectMapper = new ObjectMapper(); JsonNode rootNode = null; try { rootNode = objectMapper.readTree(response); } catch (IOException e) { logger.error("Could not parse Account response", e); throw new TeamServicesException(TeamServicesException.KEY_VSO_AUTH_FAILED, e); } final List<JsonNode> nodes = rootNode.findValues(TFS_SERVICE_URL_PROPERTY_NAME); for (final JsonNode node : nodes) { accountUris.add(StringUtils.removeEnd(node.path("$value").asText(), "/")); } return accountUris; }
Source:
public boolean matches(AttributeSet other) { if (other.attributes.size() != attributes.size()) return false; Iterator<Map.Entry<String, Attribute<?>>> i = attributes.entrySet().iterator(); while (i.hasNext()) { Map.Entry<String, Attribute<?>> e = i.next(); String key = e.getKey(); Attribute<?> value = e.getValue(); if (value == null) { if (!(other.attributes.get(key)==null && other.attributes.containsKey(key))) return false; } else { if (!value.matches(other.attributes.get(key))) return false; } } return true; }

Target:
public boolean matches(AttributeSet other) { if (other.attributes.size() != attributes.size()) return false; Iterator<Map.Entry<String, Attribute<?>>> i = attributes.entrySet().iterator(); while (i.hasNext()) { Map.Entry<String, Attribute<?>> e = i.next(); String key = e.getKey(); Attribute<?> value = e.getValue(); if (value == null) { if (!(other.attributes.containsKey(key) && other.attributes.get(key)==null)) return false; } else { if (!value.matches(other.attributes.get(key))) return false; } } return true; }
Source:
public void addExecutorInGUI() { String name = "executor_" + RandomStringUtils.randomAlphanumeric(6); ConfigFragment config = page.getConfigFragment(); WizardWindow wizard = config.getResourceManager().addResource(); Editor editor = wizard.getEditor(); editor.text("name", name); editor.text(JNDI_NAME, JNDI_VALID); wizard.clickSave(); Console.withBrowser(browser).dismissReloadRequiredWindowIfPresent(); assertTrue("Executor should be present in table", config.resourceIsPresent(name)); ResourceAddress address = new ResourceAddress(eeAddress).add(EE_CHILD, name); verifier.verifyResource(address, true, 5000); removeEEChild(EE_CHILD, name); }

Target:
public void addExecutorInGUI() { String name = "executor_" + RandomStringUtils.randomAlphanumeric(6); ConfigFragment config = page.getConfigFragment(); WizardWindow wizard = config.getResourceManager().addResource(); Editor editor = wizard.getEditor(); editor.text("name", name); editor.text(JNDI_NAME, JNDI_VALID); wizard.saveAndDismissReloadRequiredWindow(); assertTrue("Executor should be present in table", config.resourceIsPresent(name)); ResourceAddress address = new ResourceAddress(eeAddress).add(EE_CHILD, name); verifier.verifyResource(address, true, 5000); removeEEChild(EE_CHILD, name); }
Source:
public Client resolveArgument(final MethodParameter parameter, final ModelAndViewContainer mavContainer, final NativeWebRequest request, final WebDataBinderFactory binderFactory) throws Exception { final Optional<String> clientId = Optional.ofNullable(request.getUserPrincipal()).map(Principal::getName); if (!featureToggleService.isFeatureEnabled(CHECK_APPLICATION_LEVEL_PERMISSIONS) || clientId.filter(settings.getAdminClientId()::equals).isPresent() || settings.getAuthMode() == OFF) { return Client.PERMIT_ALL; } return clientId.map(client -> new AuthorizedClient(client, getScopes())) .orElseThrow(() -> new UnauthorizedUserException("Client unauthorized")); }

Target:
public Client resolveArgument(final MethodParameter parameter, final ModelAndViewContainer mavContainer, final NativeWebRequest request, final WebDataBinderFactory binderFactory) throws Exception { final Optional<String> clientId = Optional.ofNullable(request.getUserPrincipal()).map(Principal::getName); if (!featureToggleService.isFeatureEnabled(CHECK_APPLICATION_LEVEL_PERMISSIONS) || clientId.filter(settings.getAdminClientId()::equals).isPresent() || settings.getAuthMode() == OFF) { return Client.FULL_ACCESS; } return clientId.map(client -> new NakadiClient(client, getScopes())) .orElseThrow(() -> new UnauthorizedUserException("Client unauthorized")); }
Source:
protected void executeCommand() { Guid storagePoolId = getDiskImage().getStoragePoolId() != null ? getDiskImage().getStoragePoolId() .getValue() : Guid.Empty; Guid storageDomainId = getDiskImage().getStorageIds() != null && getDiskImage().getStorageIds().size() > 0 ? getDiskImage().getStorageIds() .get(0) : Guid.Empty; Guid imageGroupId = getDiskImage().getimage_group_id() != null ? getDiskImage().getimage_group_id().getValue() : Guid.Empty; VDSReturnValue vdsReturnValue = Backend .getInstance() .getResourceManager() .RunVdsCommand( VDSCommandType.MergeSnapshots, new MergeSnapshotsVDSCommandParameters(storagePoolId, storageDomainId, getVmId(), imageGroupId, getDiskImage().getImageId(), getDestinationDiskImage().getImageId(), getDiskImage().isWipeAfterDelete(), getStoragePool().getcompatibility_version() .toString())); if (vdsReturnValue != null && vdsReturnValue.getCreationInfo() != null) { getReturnValue().getInternalTaskIdList().add( createTaskSuspendTransaction(vdsReturnValue.getCreationInfo(), VdcActionType.RemoveSnapshot, ExecutionMessageDirector.resolveStepMessage(StepEnum.MERGE_SNAPSHOTS, getJobMessageProperties()), VdcObjectType.Storage, storageDomainId)); setSucceeded(vdsReturnValue.getSucceeded()); } else { setSucceeded(false); } }

Target:
protected void executeCommand() { Guid storagePoolId = getDiskImage().getStoragePoolId() != null ? getDiskImage().getStoragePoolId() .getValue() : Guid.Empty; Guid storageDomainId = getDiskImage().getStorageIds() != null && getDiskImage().getStorageIds().size() > 0 ? getDiskImage().getStorageIds() .get(0) : Guid.Empty; Guid imageGroupId = getDiskImage().getimage_group_id() != null ? getDiskImage().getimage_group_id().getValue() : Guid.Empty; VDSReturnValue vdsReturnValue = Backend .getInstance() .getResourceManager() .RunVdsCommand( VDSCommandType.MergeSnapshots, new MergeSnapshotsVDSCommandParameters(storagePoolId, storageDomainId, getVmId(), imageGroupId, getDiskImage().getImageId(), getDestinationDiskImage().getImageId(), getDiskImage().isWipeAfterDelete(), getStoragePool().getcompatibility_version() .toString())); if (vdsReturnValue != null && vdsReturnValue.getCreationInfo() != null) { getReturnValue().getInternalTaskIdList().add( createTask(vdsReturnValue.getCreationInfo(), VdcActionType.RemoveSnapshot, ExecutionMessageDirector.resolveStepMessage(StepEnum.MERGE_SNAPSHOTS, getJobMessageProperties()), VdcObjectType.Storage, storageDomainId)); setSucceeded(vdsReturnValue.getSucceeded()); } else { setSucceeded(false); } }
Source:
public String createNonce(String seed, Repository repo, long timestamp) throws IllegalStateException { String path = repo.getDirectory() != null ? repo.getDirectory().getPath() : ""; try { byte[] keyBytes = seed.getBytes("ISO-8859-1"); SecretKeySpec signingKey = new SecretKeySpec(keyBytes, "HmacSHA1"); Mac mac = Mac.getInstance("HmacSHA1"); mac.init(signingKey); String input = path + ":" + String.valueOf(timestamp); byte[] rawHmac = mac.doFinal(input.getBytes("UTF-8")); String sentNonce = String.format( "%d-%20X", new Long(timestamp), rawHmac); return sentNonce; } catch (InvalidKeyException e) { throw new IllegalStateException(e); } catch (NoSuchAlgorithmException e) { throw new IllegalStateException(e); } catch (UnsupportedEncodingException e) { throw new IllegalStateException(e); } }

Target:
public String createNonce(String seed, Repository repo, long timestamp) throws IllegalStateException { String path; if (repo instanceof DfsRepository) path = ((DfsRepository) repo).getDescription().getRepositoryName(); else if (repo.getDirectory() != null) path = repo.getDirectory().getPath(); else throw new IllegalStateException(); try { byte[] keyBytes = seed.getBytes("ISO-8859-1"); SecretKeySpec signingKey = new SecretKeySpec(keyBytes, "HmacSHA1"); Mac mac = Mac.getInstance("HmacSHA1"); mac.init(signingKey); String input = path + ":" + String.valueOf(timestamp); byte[] rawHmac = mac.doFinal(input.getBytes("UTF-8")); String sentNonce = String.format( "%d-%20X", new Long(timestamp), rawHmac); return sentNonce; } catch (InvalidKeyException e) { throw new IllegalStateException(e); } catch (NoSuchAlgorithmException e) { throw new IllegalStateException(e); } catch (UnsupportedEncodingException e) { throw new IllegalStateException(e); } }
Source:
public GdbConsoleTerminateLaunchAction(ILaunch launch) { fLaunch = launch; setText(ConsoleMessages.ConsoleTerminateLaunchAction_name); setToolTipText(ConsoleMessages.ConsoleTerminateLaunchAction_description); setImageDescriptor(GdbUIPlugin.getImageDescriptor(IConsoleImagesConst.IMG_CONSOLE_TERMINATE_ACTIVE_COLOR)); }

Target:
public GdbConsoleTerminateLaunchAction(ILaunch launch) { fLaunch = launch; setText(ConsoleMessages.ConsoleTerminateLaunchAction_name); setToolTipText(ConsoleMessages.ConsoleTerminateLaunchAction_description); setImageDescriptor(GdbUIPlugin.getImageDescriptor(IConsoleImagesConst.IMG_CONSOLE_TERMINATE_ACTIVE_COLOR)); setDisabledImageDescriptor(GdbUIPlugin.getImageDescriptor(IConsoleImagesConst.IMG_CONSOLE_TERMINATE_DISABLED_COLOR)); DebugPlugin.getDefault().getLaunchManager().addLaunchListener(this); }
Source:
public Router getRouter() { try { NonBlockingRouter router = new NonBlockingRouter(routerConfig, routerMetrics, networkClientFactory, notificationSystem, clusterMap, kms, cryptoService, cryptoJobHandler, accountService, time, defaultPartitionClass); router.setRequestHandlerPool(requestHandlerPool); return router; } catch (IOException e) { throw new IllegalStateException("Error instantiating NonBlocking Router ", e); } }

Target:
public Router getRouter() throws InstantiationException { try { MetricRegistry registry = clusterMap.getMetricRegistry(); RequestHandlerPool requestHandlerPool = getRequestHandlerPool(verifiableProperties, clusterMap, notificationSystem); NetworkClientFactory networkClientFactory = new LocalNetworkClientFactory((LocalRequestResponseChannel) requestHandlerPool.getChannel(), new NetworkConfig(verifiableProperties), new NetworkMetrics(registry), time); NonBlockingRouter router = new NonBlockingRouter(routerConfig, routerMetrics, networkClientFactory, notificationSystem, clusterMap, kms, cryptoService, cryptoJobHandler, accountService, time, defaultPartitionClass); router.addResourceToClose(requestHandlerPool); logger.info("Instantiated NonBlockingRouter"); return router; } catch (Exception e) { logger.error("Error instantiating NonBlocking Router", e); throw new InstantiationException("Error instantiating NonBlocking Router: " + e.toString()); } }
Source:
public String format(String input) { List<String> sentences = StringUtil.getStringAsSentences(input); StringBuilder result = new StringBuilder(); for (String sentence : sentences) { Title title = new Title(sentence); title.getWords().stream().filter(Word::isSmallerWord).forEach(Word::toLowerCase); title.getWords().stream().filter(Word::isLargerWord).forEach(Word::toUpperFirst); title.getFirstWord().ifPresent(Word::toUpperFirst); title.getLastWord().ifPresent(Word::toUpperFirst); for (int i = 0; i < (title.getWords().size() - 2); i++) { if (title.getWords().get(i).endsWithColon()) { title.getWords().get(i + 1).toUpperFirst(); } } result.append(title.toString() + " "); } result.deleteCharAt(result.length() - 1); return result.toString(); }

Target:
public String format(String input) { return StringUtil.getStringAsSentences(input) .stream() .map(sentence -> { Title title = new Title(sentence); title.getWords().stream().filter(Word::isSmallerWord).forEach(Word::toLowerCase); title.getWords().stream().filter(Word::isLargerWord).forEach(Word::toUpperFirst); title.getFirstWord().ifPresent(Word::toUpperFirst); title.getLastWord().ifPresent(Word::toUpperFirst); for (int i = 0; i < (title.getWords().size() - 2); i++) { if (title.getWords().get(i).endsWithColon()) { title.getWords().get(i + 1).toUpperFirst(); } } return title.toString(); }) .collect(Collectors.joining(" ")); }
Source:
public void suggestions_without_query_should_contain_recently_browsed() throws Exception { ComponentDto project = db.components().insertComponent(newPrivateProjectDto(organization)); componentIndexer.indexOnStartup(null); authorizationIndexerTester.allowOnlyAnyone(project); SuggestionsWsResponse response = actionTester.newRequest() .setMethod("POST") .setParam(PARAM_RECENTLY_BROWSED, Stream.of(project.getKey()).collect(joining(","))) .executeProtobuf(SuggestionsWsResponse.class); assertThat(response.getResultsList()) .filteredOn(q -> q.getItemsCount() > 0) .extracting(Category::getQ) .containsExactly(Qualifiers.PROJECT); assertThat(response.getResultsList()) .flatExtracting(Category::getItemsList) .extracting(Suggestion::getKey, Suggestion::getOrganization) .containsExactly(tuple(project.getKey(), organization.getKey())); }

Target:
public void suggestions_without_query_should_contain_recently_browsed() throws Exception { ComponentDto project = db.components().insertComponent(newPrivateProjectDto(organization)); componentIndexer.indexOnStartup(null); userSessionRule.addProjectPermission(USER, project); SuggestionsWsResponse response = ws.newRequest() .setMethod("POST") .setParam(PARAM_RECENTLY_BROWSED, project.getKey()) .executeProtobuf(SuggestionsWsResponse.class); assertThat(response.getResultsList()) .filteredOn(q -> q.getItemsCount() > 0) .extracting(Category::getQ) .containsExactly(Qualifiers.PROJECT); assertThat(response.getResultsList()) .flatExtracting(Category::getItemsList) .extracting(Suggestion::getKey, Suggestion::getIsRecentlyBrowsed) .containsExactly(tuple(project.getKey(), true)); }
Source:
public void handleActualMeterReadsResponse(final DeviceMessageMetadata deviceMessageMetadata, final ResponseMessageResultType deviceResult, final OsgpException exception, final MeterReadsGasResponseDto actualMeterReadsGas) { LOGGER.info("handleActualMeterReadsResponse for MessageType: {}", deviceMessageMetadata.getMessageType()); ResponseMessageResultType result = deviceResult; if (exception != null) { LOGGER.error(DEVICE_RESPONSE_NOT_OK_LOG_MSG, exception); result = ResponseMessageResultType.NOT_OK; } this.webServiceResponseMessageSender.send( ResponseMessage.newResponseMessageBuilder() .withCorrelationUid(deviceMessageMetadata.getCorrelationUid()) .withOrganisationIdentification(deviceMessageMetadata.getOrganisationIdentification()) .withDeviceIdentification(deviceMessageMetadata.getDeviceIdentification()).withResult(result) .withOsgpException(exception) .withDataObject(this.monitoringMapper.map(actualMeterReadsGas, MeterReadsGas.class)) .withMessagePriority(deviceMessageMetadata.getMessagePriority()).build(), deviceMessageMetadata.getMessageType()); }

Target:
public void handleActualMeterReadsResponse(final DeviceMessageMetadata deviceMessageMetadata, final ResponseMessageResultType deviceResult, final OsgpException exception, final MeterReadsGasResponseDto actualMeterReadsGas) { LOGGER.info("handleActualMeterReadsResponse for MessageType: {}", deviceMessageMetadata.getMessageType()); ResponseMessageResultType result = deviceResult; if (exception != null) { LOGGER.error(DEVICE_RESPONSE_NOT_OK_LOG_MSG, exception); result = ResponseMessageResultType.NOT_OK; } final ResponseMessage responseMessage = ResponseMessage.newResponseMessageBuilder() .withCorrelationUid(deviceMessageMetadata.getCorrelationUid()) .withOrganisationIdentification(deviceMessageMetadata.getOrganisationIdentification()) .withDeviceIdentification(deviceMessageMetadata.getDeviceIdentification()).withResult(result) .withOsgpException(exception) .withDataObject(this.monitoringMapper.map(actualMeterReadsGas, MeterReadsGas.class)) .withMessagePriority(deviceMessageMetadata.getMessagePriority()).build(); this.webServiceResponseMessageSender.send(responseMessage, deviceMessageMetadata.getMessageType()); }
Source:
public static void browsePostOrPage(Context context, SiteModel site, PostModel post) { if (site == null || post == null || TextUtils.isEmpty(post.getLink())) return; String url = UrlUtils.appendUrlParameter(post.getLink(), "preview", "true"); url = url.replace(site.getUrl(), site.getUnmappedUrl()); String shareableUrl = post.getLink(); String shareSubject = post.getTitle(); if (site.isWPCom()) { WPWebViewActivity.openPostUrlByUsingGlobalWPCOMCredentials(context, url, shareableUrl, shareSubject); } else if (site.isJetpackConnected()) { WPWebViewActivity.openJetpackBlogPostPreview(context, url, shareableUrl, shareSubject, site.getFrameNonce()); } else { WPWebViewActivity.openUrlByUsingBlogCredentials(context, site, post, url, new String[]{post.getLink()}); } }

Target:
public static void browsePostOrPage(Context context, SiteModel site, PostModel post) { if (site == null || post == null || TextUtils.isEmpty(post.getLink())) return; String url = UrlUtils.appendUrlParameter(post.getLink(), "preview", "true"); String shareableUrl = post.getLink(); String shareSubject = post.getTitle(); if (site.isWPCom()) { if (!TextUtils.isEmpty(site.getUnmappedUrl())) { url = url.replace(site.getUrl(), site.getUnmappedUrl()); } WPWebViewActivity.openPostUrlByUsingGlobalWPCOMCredentials(context, url, shareableUrl, shareSubject); } else if (site.isJetpackConnected()) { WPWebViewActivity.openJetpackBlogPostPreview(context, url, shareableUrl, shareSubject, site.getFrameNonce()); } else { WPWebViewActivity.openUrlByUsingBlogCredentials(context, site, post, url, new String[]{post.getLink()}); } }
Source:
private void updateDestination() { destinationSpinner.removeActionListener(destinationListener); destinationSpinner.removeAllItems(); for (Destination format : Destination.destinationValues()) { destinationSpinner.addItem(format); } destinationSpinner.setSelectedItem(controller.getDestination()); destinationSpinner.addActionListener(destinationListener); }

Target:
private void updateDestination() { destinationSpinner.removeActionListener(destinationListener); destinationSpinner.removeAllItems(); for (Destination format : Destination.values()) { destinationSpinner.addItem(format); } destinationSpinner.setSelectedItem(controller.getDestination()); destinationSpinner.addActionListener(destinationListener); }
Source:
public void testRefreshView() { final String typeName = "typeName"; final DataType parent = mock(DataType.class); final List<DataType> expectedDataTypes = new ArrayList<DataType>() {{ add(mock(DataType.class)); }}; when(dataTypeUtils.externalDataTypes(parent, typeName)).thenReturn(expectedDataTypes); dataTypeSelect.init(listItem, parent); dataTypeSelect.refreshView(typeName); assertEquals(expectedDataTypes, dataTypeSelect.getSubDataTypes()); verify(listItem).refreshSubItems(expectedDataTypes); }

Target:
public void testRefreshView() { final String typeName = "typeName"; final DataType parent = mock(DataType.class); final List<DataType> expectedDataTypes = Collections.singletonList(mock(DataType.class)); when(dataTypeUtils.externalDataTypes(parent, typeName)).thenReturn(expectedDataTypes); dataTypeSelect.init(listItem, parent); dataTypeSelect.refreshView(typeName); assertEquals(expectedDataTypes, dataTypeSelect.getSubDataTypes()); verify(listItem).refreshSubItems(expectedDataTypes); }
Source:
public static String prettyHexString(String hexString) { String prettyHexString = ""; if (hexString.length() % 2 != 0) hexString = "0" + hexString; int iterations = hexString.length() / 2; for (int i = 0; i < iterations; i++) prettyHexString += hexString.substring(2 * i, 2 * i + 2) + " "; return prettyHexString.trim(); }

Target:
public static String prettyHexString(String hexString) { if (hexString == null) throw new NullPointerException("Hexadecimal string cannot be null."); String prettyHexString = ""; if (hexString.length() % 2 != 0) hexString = "0" + hexString; int iterations = hexString.length() / 2; for (int i = 0; i < iterations; i++) prettyHexString += hexString.substring(2 * i, 2 * i + 2) + " "; return prettyHexString.trim(); }
Source:
public boolean test(Object receiver, String property, Object[] args, Object expectedValue) { boolean result = false; if (SEMANTIC_DELETION_PROPERTY.equals(property)) { result = expectedValue.equals(DeleteActionUtil.isSemanticDeletion((IGraphicalEditPart) receiver)); } else if (READ_ONLY_PROPERTY.equals(property)) { final Object model = ((IGraphicalEditPart) receiver).getModel(); if (model instanceof View && !(((View) model).getElement() instanceof PrimitiveType)) { result = true; } else { result = expectedValue.equals(DeleteActionUtil.isReadOnly((IGraphicalEditPart) receiver)); } } return result; }

Target:
public boolean test(Object receiver, String property, Object[] args, Object expectedValue) { boolean result = false; if (SEMANTIC_DELETION_PROPERTY.equals(property)) { result = expectedValue.equals(DeleteActionUtil.isSemanticDeletion((IGraphicalEditPart) receiver)); } else if (READ_ONLY_PROPERTY.equals(property)) { final Object model = ((IGraphicalEditPart) receiver).getModel(); if (model instanceof View && ((View)model).getElement() instanceof org.eclipse.uml2.uml.Class){ org.eclipse.uml2.uml.Class clazz = (org.eclipse.uml2.uml.Class) ((View)model).getElement(); if(clazz.isMetaclass()){ result = true; } } else { result = expectedValue.equals(DeleteActionUtil.isReadOnly((IGraphicalEditPart) receiver)); } } return result; }
Source:
protected void accumulateConsecutiveDnsTimeoutCount(int code) { final DnsResult result = new DnsResult(code); final int index = mResultIndices.add(); if (index >= 0 && index < mSize) { mDnsEvents[index] = result; } if (result.isTimeout()) { mConsecutiveTimeoutCount++; } else { mConsecutiveTimeoutCount = 0; } }

Target:
protected void accumulateConsecutiveDnsTimeoutCount(int code) { final DnsResult result = new DnsResult(code); mDnsEvents[mResultIndices.add()] = result; if (result.isTimeout()) { mConsecutiveTimeoutCount++; } else { mConsecutiveTimeoutCount = 0; } }
Source:
public Point getDPI () { checkDevice (); long hDC = internal_new_GC (null); int dpiX = OS.GetDeviceCaps (hDC, OS.LOGPIXELSX); int dpiY = OS.GetDeviceCaps (hDC, OS.LOGPIXELSY); internal_dispose_GC (hDC, null); return DPIUtil.autoScaleDown(new Point (dpiX, dpiY)); }

Target:
public Point getDPI () { checkDevice (); long hDC = internal_new_GC (null); int widthMM = OS.GetDeviceCaps(hDC, OS.HORZSIZE); int width = OS.GetDeviceCaps(hDC, OS.HORZRES); int dpi = Compatibility.round (254 * width, widthMM * 10); return new Point (dpi, dpi); }
Source:
public void testGeneIdorGeneNameNonExisting() { List<FeatureCoordinates> featureCoordinates = findByIdOrNameHelper(GENE_ID_NON_EXISTING, GENE_NAME_NON_EXISITNG); assertTrue(featureCoordinates.size() == 0); featureCoordinates = findByIdOrNameHelper(GENE_ID_NON_EXISTING, null); assertTrue(featureCoordinates.size() == 0); featureCoordinates = findByIdOrNameHelper(null, GENE_NAME_NON_EXISITNG); assertTrue(featureCoordinates.size() == 0); }

Target:
public void testGeneIdorGeneNameNonExisting() { List<FeatureCoordinates> featureCoordinates = findByIdOrNameHelper(GENE_ID_NON_EXISTING, GENE_NAME_NON_EXISITNG); assertEquals(0, featureCoordinates.size()); featureCoordinates = findByIdOrNameHelper(GENE_ID_NON_EXISTING, null); assertEquals(0, featureCoordinates.size()); featureCoordinates = findByIdOrNameHelper(null, GENE_NAME_NON_EXISITNG); assertEquals(0, featureCoordinates.size()); }
Source:
public static InputStream getResource(String resource) throws IOException { File resourceFile = new File(resource); if (resourceFile.exists() && !resourceFile.isFile()) { throw new IOException(String.format("%s is not a file. ", resourceFile.getAbsolutePath())); } InputStream is = resourceFile.exists() ? new FileInputStream(resourceFile) : Thread.currentThread().getContextClassLoader().getResourceAsStream(resource); if (is == null) { throw new IOException(String.format("Resource: %s is not found", resource)); } return is; }

Target:
public static InputStream getResource(String resource) throws IOException { File resourceFile = new File(resource); if (resourceFile.exists() && !resourceFile.isFile()) { throw new IOException(String.format("%s is not a file. ", resourceFile.getAbsolutePath())); } InputStream is = resourceFile.exists() ? new FileInputStream(resourceFile) : Thread.currentThread().getContextClassLoader().getResourceAsStream(resource); if (is == null) { throw new IOException(String.format("Resource %s is not found", resource)); } return is; }
Source:
public CurrentTemperatureCharacteristic( Supplier<CompletableFuture<Double>> getter, Consumer<HomekitCharacteristicChangeCallback> subscriber, Runnable unsubscriber) { this(0, 100, 0.1, getter, subscriber, unsubscriber); }

Target:
public CurrentTemperatureCharacteristic( Supplier<CompletableFuture<Double>> getter, Consumer<HomekitCharacteristicChangeCallback> subscriber, Runnable unsubscriber) { this(DEFAULT_MIN_VALUE, DEFAULT_MAX_VALUE, DEFAULT_STEP, getter, subscriber, unsubscriber); }
Source:
public int compareTo(@Nonnull OutputDataStream otherStream) { if (getSizeInBytes() == otherStream.getSizeInBytes()) { return 0; } return getSizeInBytes() < otherStream.getSizeInBytes() ? -1 : 1; }

Target:
public int compareTo(@Nonnull OutputDataStream otherStream) { return Long.compare(sizeInBytes, otherStream.sizeInBytes); }
Source:
public void createFolder(String path) { if (exists(ensureTrailingSlashPresent(path))) { return; } List<String> parts = Splitter.on('/').splitToList(path); StringBuilder sb = new StringBuilder(); for (String objectName : parts) { sb.append(ensureTrailingSlashPresent(objectName)); if (!exists(sb.toString())) { createEmptyObject(sb.toString()); } } }

Target:
public void createFolder(String path) { if (exists(ensureTrailingSlashPresent(path))) { return; } List<String> parts = PATH_SPLITTER.splitToList(path); StringBuilder sb = new StringBuilder(); for (String objectName : parts) { sb.append(objectName); sb.append(PATH_SEPARATOR); if (!exists(sb.toString())) { createEmptyObject(sb.toString()); } } }
Source:
public MediaType getContentType() { if (this.readOnly && this.cachedContentType != null) { return this.cachedContentType; } else { String value = getFirst(CONTENT_TYPE); MediaType contentType = (StringUtils.hasLength(value) ? MediaType.parseMediaType(value) : null); if (this.readOnly) { this.cachedContentType = contentType; } return contentType; } }

Target:
public MediaType getContentType() { String value = getFirst(CONTENT_TYPE); return (StringUtils.hasLength(value) ? MediaType.parseMediaType(value) : null); }
Source:
public static void init() { IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus(); ITEMS.register(modEventBus); for (SlimeBlock.SlimeType type : SlimeBlock.SlimeType.values()) { System.out.println(type); System.out.println(type.toString()); } }

Target:
public static void init() { IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus(); ITEMS.register(modEventBus); }
Source:
public CharSequence getStr(int col) { return columnNumber == 0 ? "table" : "column"; }

Target:
public CharSequence getStr(int col) { return description; }
Source:
public void coverage() { coverPrivateConstructor(FraTradeCsvLoader.class); }

Target:
public void coverage() { coverPrivateConstructor(FraTradeCsvLoader.class); coverPrivateConstructor(SwapTradeCsvLoader.class); coverPrivateConstructor(TermDepositTradeCsvLoader.class); coverPrivateConstructor(FullSwapTradeCsvLoader.class); }
Source:
public List<CtfTmfEventField> getValue() { return new ArrayList<CtfTmfEventField>(Arrays.asList((CtfTmfEventField[])super.getValue())); }

Target:
public CtfTmfEventField[] getValue() { return (CtfTmfEventField[])super.getValue(); }
Source:
private void writeAndFlush(final Channel channel, final CompletionKey key, final Object request, final boolean allowFastFail) { if (channel == null) { errorOut(key); return; } if (isWritable != channel.isWritable()) { isWritable = !isWritable; } if (allowFastFail && !isWritable) { errorOut(key); return; } try { final long startTime = MathUtils.nowInNano(); ChannelFuture future = channel.writeAndFlush(request); future.addListener(new ChannelFutureListener() { @Override public void operationComplete(ChannelFuture future) throws Exception { if (future.isSuccess()) { nettyOpLogger.registerSuccessfulEvent(MathUtils.elapsedNanos(startTime), TimeUnit.NANOSECONDS); completionObjects.get(key).setOutstanding(); } else { nettyOpLogger.registerFailedEvent(MathUtils.elapsedNanos(startTime), TimeUnit.NANOSECONDS); } } }); } catch (Throwable e) { LOG.warn("Operation failed", requestToString(request), e); errorOut(key); } }

Target:
private void writeAndFlush(final Channel channel, final CompletionKey key, final Object request, final boolean allowFastFail) { if (channel == null) { LOG.warn("Operation failed: channel == null", requestToString(request)); errorOut(key); return; } final boolean isChannelWritable = channel.isWritable(); if (isWritable != isChannelWritable) { isWritable = isChannelWritable; } if (allowFastFail && !isWritable) { LOG.warn("Operation failed: TooManyRequestsException", requestToString(request)); errorOut(key, BKException.Code.TooManyRequestsException); return; } try { final long startTime = MathUtils.nowInNano(); ChannelPromise promise = channel.newPromise().addListener(future -> { if (future.isSuccess()) { nettyOpLogger.registerSuccessfulEvent(MathUtils.elapsedNanos(startTime), TimeUnit.NANOSECONDS); CompletionValue completion = completionObjects.get(key); if (completion != null) { completion.setOutstanding(); } } else { nettyOpLogger.registerFailedEvent(MathUtils.elapsedNanos(startTime), TimeUnit.NANOSECONDS); } }); channel.writeAndFlush(request, promise); } catch (Throwable e) { LOG.warn("Operation failed", requestToString(request), e); errorOut(key); } }
Source:
public void init() throws DeviceException { AndroidDebugBridge.initIfNeeded(false ); AndroidDebugBridge bridge = AndroidDebugBridge.createBridge( adbLocation.getAbsolutePath(), false ); long timeOut = 30000; int sleepTime = 1000; while (!bridge.hasInitialDeviceList() && timeOut > 0) { try { Thread.sleep(sleepTime); } catch (InterruptedException e) { throw new DeviceException(e); } timeOut -= sleepTime; } if (timeOut <= 0 && !bridge.hasInitialDeviceList()) { throw new DeviceException("Timeout getting device list."); } IDevice[] devices = bridge.getDevices(); if (devices.length == 0) { throw new DeviceException("No connected devices!"); } final String androidSerial = System.getenv("ANDROID_SERIAL"); final Boolean isValidSerial = androidSerial != null && !androidSerial.isEmpty(); for (IDevice iDevice : devices) { if (!isValidSerial || iDevice.getSerialNumber().equals(androidSerial)) { localDevices.add(new ConnectedDevice(iDevice)); } } if (localDevices.isEmpty()) { throw new DeviceException( String.format("Connected device with serial %s not found!", androidSerial)); } }

Target:
public void init() throws DeviceException { AndroidDebugBridge.initIfNeeded(false ); AndroidDebugBridge bridge = AndroidDebugBridge.createBridge( adbLocation.getAbsolutePath(), false ); long timeOut = 30000; int sleepTime = 1000; while (!bridge.hasInitialDeviceList() && timeOut > 0) { try { Thread.sleep(sleepTime); } catch (InterruptedException e) { throw new DeviceException(e); } timeOut -= sleepTime; } if (timeOut <= 0 && !bridge.hasInitialDeviceList()) { throw new DeviceException("Timeout getting device list."); } IDevice[] devices = bridge.getDevices(); if (devices.length == 0) { throw new DeviceException("No connected devices!"); } final String androidSerial = System.getenv("ANDROID_SERIAL"); final Boolean isValidSerial = androidSerial != null && !androidSerial.isEmpty(); final List<IDevice> filteredDevices = Lists.newArrayListWithCapacity(devices.length); for (IDevice iDevice : devices) { if (!isValidSerial || iDevice.getSerialNumber().equals(androidSerial)) { filteredDevices.add(iDevice); } } if (filteredDevices.isEmpty()) { throw new DeviceException("Connected device with serial %s not found!", androidSerial); } for (IDevice device : filteredDevices) { if (device.getState() == IDevice.DeviceState.ONLINE) { localDevices.add(new ConnectedDevice(device)); } else { iLogger.info( "Skipping device '%s' (%s): Device is %s%s.", device.getName(), device.getSerialNumber(), device.getState(), device.getState() == IDevice.DeviceState.UNAUTHORIZED ? ",\n" + " see <LINK_0>" : ""); } } if (localDevices.isEmpty()) { if (isValidSerial) { throw new DeviceException("Connected device with serial $1%s is not online.", androidSerial); } else { throw new DeviceException("No online devices found."); } } }
Source:
public TaggedBlobItem(String containerName, String name) { this(containerName, name, new HashMap<>()); }

Target:
public TaggedBlobItem(String containerName, String name) { this(containerName, name, Collections.emptyMap()); }
Source:
public void parseNetworkListWithOneNetworkIllegalArgException() throws Exception { WifiConfiguration openNetwork = WifiConfigurationTestUtil.createOpenNetwork(); WifiConfiguration eapNetwork = WifiConfigurationTestUtil.createEapNetwork(); String xmlString = new String(getTestNetworksXmlBytes(openNetwork, eapNetwork)); xmlString = xmlString.replaceAll( String.format(XmlUtilTest.XML_STRING_EAP_METHOD_REPLACE_FORMAT, eapNetwork.enterpriseConfig.getEapMethod()), String.format(XmlUtilTest.XML_STRING_EAP_METHOD_REPLACE_FORMAT, WifiEnterpriseConfig.Eap.NONE)); List<WifiConfiguration> retrievedNetworkList = deserializeData(xmlString.getBytes(), true ); assertEquals(1, retrievedNetworkList.size()); for (WifiConfiguration network : retrievedNetworkList) { assertNotEquals(eapNetwork.SSID, network.SSID); } }

Target:
public void parseNetworkListWithOneNetworkIllegalArgException() throws Exception { WifiConfiguration openNetwork = WifiConfigurationTestUtil.createOpenNetwork(); WifiConfiguration eapNetwork = WifiConfigurationTestUtil.createEapNetwork(); String xmlString = new String(getTestNetworksXmlBytes(openNetwork, eapNetwork)); xmlString = xmlString.replaceAll( String.format(XmlUtilTest.XML_STRING_EAP_METHOD_REPLACE_FORMAT, eapNetwork.enterpriseConfig.getEapMethod()), String.format(XmlUtilTest.XML_STRING_EAP_METHOD_REPLACE_FORMAT, WifiEnterpriseConfig.Eap.NONE)); List<WifiConfiguration> retrievedNetworkList = deserializeData(xmlString.getBytes(StandardCharsets.UTF_8), true ); assertEquals(1, retrievedNetworkList.size()); for (WifiConfiguration network : retrievedNetworkList) { assertNotEquals(eapNetwork.SSID, network.SSID); } }
Source:
public String getState(String key) { return _zkAdapter.getDatastreamTaskStateForKey(this.getInternalDatastreamTask(), key); }

Target:
public String getState(String key) { return _zkAdapter.getDatastreamTaskStateForKey(_internalDatastreamTask, key); }
Source:
public static void toLowerCase(@Nullable final CharSequence str, final CharSink sink) { if (str == null || str.length() == 0) { return; } for (int i = 0; i < str.length(); i++) { sink.put(toLowerCase(str.charAt(i))); } }

Target:
public static void toLowerCase(@Nullable final CharSequence str, final CharSink sink) { if(str != null) { final int len = str.length(); for (int i = 0; i < len; i++) { sink.put(Character.toLowerCase(str.charAt(i))); } } }
Source:
protected void configFacets(IDataModel dataModel, String projectLocation) { super.configFacets(dataModel, projectLocation); FacetDataModelMap map = (FacetDataModelMap) dataModel.getProperty(IFacetProjectCreationDataModelProperties.FACET_DM_MAP); IDataModel configJSF = (IDataModel) map.get("jst.jsf"); if(configJSF == null) { configJSF = DataModelFactory.createDataModel(new JSFFacetInstallDataModelProvider()); map.add(configJSF); } configJSF = (IDataModel) map.get("jst.jsf"); if(configJSF != null) { String template = getProperty(TEMPLATE_VERSION_ID); String version = template.indexOf("1.1") >= 0 ? "1.1" : template.indexOf("1.2") >= 0 ? "1.2" : template.indexOf("2.0") >= 0 ? "2.0" : template.indexOf("2.1") >= 0 ? "2.1" : template.indexOf("2.2") >= 0 ? "2.2" : template.indexOf("2.2") >= 0 ? "2.3" : null; if(version != null) { configJSF.setProperty(IFacetDataModelProperties.FACET_VERSION_STR, version); } IProjectFacet facet = ProjectFacetsManager.getProjectFacet("jst.jsf"); try { IFacetedProject fproj = ProjectFacetsManager.create(getProject(), true, new NullProgressMonitor()); LibraryInstallDelegate libraryDelegate = new LibraryInstallDelegate(fproj, facet.getDefaultVersion()); ILibraryProvider provider = LibraryProviderFramework.getProvider("jsf-no-op-library-provider"); libraryDelegate.setLibraryProvider(provider); configJSF.setProperty(IJSFFacetInstallDataModelProperties.LIBRARY_PROVIDER_DELEGATE, libraryDelegate); } catch (CoreException e) { JsfUiPlugin.getDefault().logError(e); } } }

Target:
protected void configFacets(IDataModel dataModel, String projectLocation) { super.configFacets(dataModel, projectLocation); FacetDataModelMap map = (FacetDataModelMap) dataModel.getProperty(IFacetProjectCreationDataModelProperties.FACET_DM_MAP); IDataModel configJSF = (IDataModel) map.get("jst.jsf"); if(configJSF == null) { configJSF = DataModelFactory.createDataModel(new JSFFacetInstallDataModelProvider()); map.add(configJSF); } configJSF = (IDataModel) map.get("jst.jsf"); if(configJSF != null) { String template = getProperty(TEMPLATE_VERSION_ID); String version = template.indexOf("1.1") >= 0 ? "1.1" : template.indexOf("1.2") >= 0 ? "1.2" : template.indexOf("2.0") >= 0 ? "2.0" : template.indexOf("2.1") >= 0 ? "2.1" : template.indexOf("2.2") >= 0 ? "2.2" : template.indexOf("2.3") >= 0 ? "2.3" : null; if(version != null) { configJSF.setProperty(IFacetDataModelProperties.FACET_VERSION_STR, version); } IProjectFacet facet = ProjectFacetsManager.getProjectFacet("jst.jsf"); try { IFacetedProject fproj = ProjectFacetsManager.create(getProject(), true, new NullProgressMonitor()); LibraryInstallDelegate libraryDelegate = new LibraryInstallDelegate(fproj, facet.getDefaultVersion()); ILibraryProvider provider = LibraryProviderFramework.getProvider("jsf-no-op-library-provider"); libraryDelegate.setLibraryProvider(provider); configJSF.setProperty(IJSFFacetInstallDataModelProperties.LIBRARY_PROVIDER_DELEGATE, libraryDelegate); } catch (CoreException e) { JsfUiPlugin.getDefault().logError(e); } } }
Source:
public List<String> getMatchingStackFrames(@NonNull String filter, boolean fullTrace, @NonNull Locale locale) { filter = filter.toLowerCase(locale); List<String> matchingFrames = Lists.newArrayList(); if (mStackTrace.length > 0) { final int length = fullTrace ? mStackTrace.length : 1; for (int i = 0; i < length; ++i) { String frameString = mStackTrace[i].toString(); if (frameString.toLowerCase(locale).contains(filter)) { matchingFrames.add(frameString); } } } return matchingFrames; }

Target:
public List<String> getMatchingStackFrames(@NonNull String filter, boolean fullTrace, @NonNull Locale locale) { filter = filter.toLowerCase(locale); if (mStackTrace.length > 0) { final int length = fullTrace ? mStackTrace.length : 1; List<String> matchingFrames = Lists.newArrayListWithExpectedSize(length); for (int i = 0; i < length; ++i) { String frameString = mStackTrace[i].toString(); if (frameString.toLowerCase(locale).contains(filter)) { matchingFrames.add(frameString); } } return matchingFrames; } else { return Collections.emptyList(); } }
Source:
private String createKey( final String key ) { try { final MessageDigest md = MessageDigest.getInstance( "SHA-256" ); md.update( key.getBytes() ); final byte[] digest = md.digest(); return new String( Base64.encode( digest ) ); } catch ( final Exception b ) { return null; } }

Target:
private String createKey( final String key ) { if ( StringUtil.isEmpty( key ) ) { return ANONYMOUS; } try { final MessageDigest md = MessageDigest.getInstance( "SHA-256" ); md.update( key.getBytes() ); final byte[] digest = md.digest(); return new String( Base64.encode( digest ) ); } catch ( final NoSuchAlgorithmException e ) { throw new Error( e ); } }
Source:
static String doTransform(String value, String transform) { switch (transform) { case LOWER_CASE: return value.toLowerCase(); case UPPER_CASE: return value.toUpperCase(); default: throw new UnsupportedOperationException(String.format("transform '%s' is unsupported", transform)); } }

Target:
static String doTransform(String value, String transform) { switch (transform) { case LOWER_CASE: return value.toLowerCase(Locale.ROOT); case UPPER_CASE: return value.toUpperCase(Locale.ROOT); default: throw new UnsupportedOperationException(String.format("transform '%s' is unsupported", transform)); } }
Source:
public StyledString getStyledText(Object element) { if (fProviders != null) { for (ICHEProvider provider : fProviders) { StyledString styledString = provider.getStyledText(element); if (styledString != null) return styledString; } } if (element instanceof CHNode) { CHNode node= (CHNode) element; ICElement decl= node.getOneRepresentedDeclaration(); if (decl != null) { StyledString label; if (node.isMultiDef()) { long options= fCLabelProvider.getTextFlags(); fCLabelProvider.setTextFlags(LABEL_OPTIONS_SIMPLE); label= fCLabelProvider.getStyledText(decl); fCLabelProvider.setTextFlags(options); } else { label= fCLabelProvider.getStyledText(decl); if (node.isInitializer()) { label= addInitializerDecoration(label); } } int refCount= node.getReferenceCount(); if (refCount > 1) { final int offset= label.length(); label.append(NLS.bind(" ({0} {1})", Integer.valueOf(refCount), CHMessages.CHLabelProvider_matches)); label.setStyle(offset, label.length() - offset, StyledString.COUNTER_STYLER); } String decorated= decorateText(label.getString(), element); if (decorated != null) { return StyledCellLabelProvider.styleDecoratedString(decorated, StyledString.DECORATIONS_STYLER, label); } return label; } } return fCLabelProvider.getStyledText(element); }

Target:
public StyledString getStyledText(Object element) { if (fProviders == null ) { fProviders = fView.getLabelProviders(); } if (fProviders != null) { for (IStyledLabelProvider provider : fProviders) { StyledString styledString = provider.getStyledText(element); if (styledString != null) return styledString; } } if (element instanceof CHNode) { CHNode node= (CHNode) element; ICElement decl= node.getOneRepresentedDeclaration(); if (decl != null) { StyledString label; if (node.isMultiDef()) { long options= fCLabelProvider.getTextFlags(); fCLabelProvider.setTextFlags(LABEL_OPTIONS_SIMPLE); label= fCLabelProvider.getStyledText(decl); fCLabelProvider.setTextFlags(options); } else { label= fCLabelProvider.getStyledText(decl); if (node.isInitializer()) { label= addInitializerDecoration(label); } } int refCount= node.getReferenceCount(); if (refCount > 1) { final int offset= label.length(); label.append(NLS.bind(" ({0} {1})", Integer.valueOf(refCount), CHMessages.CHLabelProvider_matches)); label.setStyle(offset, label.length() - offset, StyledString.COUNTER_STYLER); } String decorated= decorateText(label.getString(), element); if (decorated != null) { return StyledCellLabelProvider.styleDecoratedString(decorated, StyledString.DECORATIONS_STYLER, label); } return label; } } return fCLabelProvider.getStyledText(element); }
Source:
public void showError(@NonNull final Context context, @NonNull final Throwable error) { @StringRes int errorResId = R.string.error_unknown; Icon icon = null; @StringRes int actionTextResId = 0; View.OnClickListener actionListener = null; if (error instanceof IOException) { icon = FontAwesomeIcons.fa_wifi; if (NetworkUtil.isConnected(context)) { errorResId = R.string.network_connected_error; } else { errorResId = R.string.reset_no_network_message; } } else if (error instanceof HttpStatusException) { switch (((HttpStatusException) error).getStatusCode()) { case HttpStatus.SERVICE_UNAVAILABLE: errorResId = R.string.network_service_unavailable; break; case HttpStatus.UPGRADE_REQUIRED: errorResId = R.string.app_version_unsupported; actionTextResId = R.string.label_update; actionListener = AppStoreUtils.OPEN_APP_IN_APP_STORE_CLICK_LISTENER; break; } } if (errorResId == R.string.error_unknown) { logger.error(error, true); } showError(errorResId, icon, actionTextResId, actionListener); }

Target:
public void showError(@NonNull final Context context, @NonNull final Throwable error) { showError(context, error, 0, null); }
Source:
public void readStats(GlowPlayer player) { File statsFile = getPlayerFile(player.getUniqueId()); player.getStatisticMap().getValues().clear(); if (statsFile.exists()) { try { JSONParser parser = new JSONParser(); JSONObject json = (JSONObject) parser.parse(new FileReader(statsFile)); for (Object o : json.keySet()) { String key = (String) o; int value = (int) (long) json.get(o); player.getStatisticMap().getValues().put(key, value); } } catch (ParseException | IOException e) { e.printStackTrace(); } } }

Target:
public void readStats(GlowPlayer player) { File statsFile = getPlayerFile(player.getUniqueId()); player.getStatisticMap().getValues().clear(); if (statsFile.exists()) { try { JSONParser parser = new JSONParser(); JSONObject json = (JSONObject) parser.parse(new FileReader(statsFile)); for (Object o : json.keySet()) { String key = (String) o; int value = ((Long) json.get(o)).intValue(); player.getStatisticMap().getValues().put(key, value); } } catch (ParseException | IOException e) { e.printStackTrace(); } } }