auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public static VirtualFile findVirtualFile(final Module module, IPath path) { VirtualFile moduleRoot = getModuleRoot(module); if (path.isAbsolute()) return null; if (path.segmentCount() == 0) return moduleRoot; VirtualFile virtualFile = moduleRoot.findFileByRelativePath(path.toString()); if (virtualFile != null && ModuleRootManager.getInstance(module).getFileIndex().isInContent(virtualFile)) { return virtualFile; } return null; }

Target:
public static VirtualFile findVirtualFile(final Module module, IPath path) { VirtualFile moduleRoot = getModuleRoot(module); if (path.isAbsolute()) return null; if (path.segmentCount() == 0) return moduleRoot; VirtualFile virtualFile = moduleRoot.findFileByRelativePath(path.toString()); if (virtualFile == null) return null; boolean isOnContent = Filesystem.runReadAction( () -> ModuleRootManager.getInstance(module).getFileIndex().isInContent(virtualFile)); if (isOnContent) return virtualFile; return null; }
Source:
public StateManager getStateManager() { return this.stateManager; }

Target:
public BookieStateManager getStateManager() { return (BookieStateManager) this.stateManager; }
Source:
public OAuthToken getToken(String oauthProviderName, String userId) throws IOException { if (userId == null || userId.isEmpty()) { return null; } try { UriBuilder ub = UriBuilder.fromUri(apiEndpoint) .path(OAuthAuthenticationService.class) .path(OAuthAuthenticationService.class, "token") .queryParam("oauth_provider", oauthProviderName); Link getTokenLink = DtoFactory.newDto(Link.class).withHref(ub.build().toString()).withMethod("GET"); OAuthToken token = httpJsonRequestFactory.fromLink(getTokenLink) .request() .asDto(OAuthToken.class); if (token == null) { LOG.warn("Token not found for user {}", userId); return null; } return token; } catch (ServerException | UnauthorizedException | ForbiddenException | NotFoundException | ConflictException | BadRequestException e) { LOG.error("Exception on token retrieval, message : {}", e.getLocalizedMessage()); return null; } }

Target:
public OAuthToken getToken(String oauthProviderName, String userId) throws IOException { if (userId.isEmpty()) { return null; } try { UriBuilder ub = UriBuilder.fromUri(apiEndpoint) .path(OAuthAuthenticationService.class) .path(OAuthAuthenticationService.class, "token") .queryParam("oauth_provider", oauthProviderName); Link getTokenLink = DtoFactory.newDto(Link.class).withHref(ub.build().toString()).withMethod("GET"); OAuthToken token = httpJsonRequestFactory.fromLink(getTokenLink) .request() .asDto(OAuthToken.class); if (token == null) { LOG.warn("Token not found for user {}", userId); return null; } return token; } catch (ServerException | UnauthorizedException | ForbiddenException | NotFoundException | ConflictException | BadRequestException e) { LOG.error("Exception on token retrieval, message : {}", e.getLocalizedMessage()); return null; } }
Source:
private void runFirehoseV2(FirehoseV2 firehose) { try { firehose.start(); } catch (Exception e) { log.error(e, "Failed to start firehoseV2"); return; } log.info("FirehoseV2 started"); final Supplier<Committer> committerSupplier = Committers.supplierFromFirehoseV2(firehose); boolean haveRow = true; while (haveRow) { InputRow inputRow = null; int numRows = 0; try { inputRow = firehose.currRow(); if (inputRow != null) { try { numRows = plumber.add(inputRow, committerSupplier); } catch (IndexSizeExceededException e) { log.info("Index limit exceeded: %s", e.getMessage()); metrics.incrementThrownAway(); continue; } if (numRows < 0) { metrics.incrementThrownAway(); log.debug("Throwing away event[%s]", inputRow); } else { metrics.incrementProcessed(); } } else { log.debug("thrown away null input row, considering unparseable"); metrics.incrementUnparseable(); } } catch (Exception e) { log.makeAlert(e, "Unknown exception, Ignoring and continuing.") .addData("inputRow", inputRow); } try { haveRow = firehose.advance(); } catch (Exception e) { log.debug(e, "exception in firehose.advance(), considering unparseable row"); metrics.incrementUnparseable(); } } }

Target:
private void runFirehoseV2(FirehoseV2 firehose) { try { firehose.start(); } catch (Exception e) { log.error(e, "Failed to start firehoseV2"); return; } log.info("FirehoseV2 started"); final Supplier<Committer> committerSupplier = Committers.supplierFromFirehoseV2(firehose); boolean haveRow = true; while (haveRow) { InputRow inputRow = null; int numRows = 0; try { inputRow = firehose.currRow(); if (inputRow != null) { numRows = plumber.add(inputRow, committerSupplier); if (numRows < 0) { metrics.incrementThrownAway(); log.debug("Throwing away event[%s]", inputRow); } else { metrics.incrementProcessed(); } } else { log.debug("thrown away null input row, considering unparseable"); metrics.incrementUnparseable(); } } catch (Exception e) { log.makeAlert(e, "Unknown exception, Ignoring and continuing.") .addData("inputRow", inputRow); } try { haveRow = firehose.advance(); } catch (Exception e) { log.debug(e, "exception in firehose.advance(), considering unparseable row"); metrics.incrementUnparseable(); } } }
Source:
public void maintenance() { Guid clusterId = getClusterIdOfSelectedHosts(); if (clusterId == null) { maintenance(false, false, null); } else { AsyncDataProvider.getInstance().getClusterById(new AsyncQuery<>( cluster -> { if (cluster != null) { maintenance(true, cluster.supportsGlusterService(), clusterId); } }), clusterId); } }

Target:
public void maintenance() { Guid clusterId = getClusterIdOfSelectedHosts(); if (clusterId == null) { maintenance(false, null); } else { AsyncDataProvider.getInstance().getClusterById(new AsyncQuery<>( cluster -> { if (cluster != null) { maintenance(cluster.supportsGlusterService(), clusterId); } }), clusterId); } }
Source:
public void learn(long seq, PaxosValue value) { Preconditions.checkArgument(seq == value.getRound(), "seq differs from PaxosValue.round"); try { learn.apply(Maps.immutableEntry(client, value)).get(); } catch (InterruptedException e) { Throwable cause = e.getCause(); if (cause instanceof RuntimeException) { throw (RuntimeException) cause; } throw new RuntimeException(cause); } catch (ExecutionException e) { Thread.currentThread().interrupt(); throw new RuntimeException(e); } }

Target:
public void learn(long seq, PaxosValue value) { Preconditions.checkArgument(seq == value.getRound(), "seq differs from PaxosValue.round"); try { learn.apply(Maps.immutableEntry(client, value)).get(); } catch (ExecutionException e) { Throwable cause = e.getCause(); if (cause instanceof RuntimeException) { throw (RuntimeException) cause; } throw new RuntimeException(cause); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new RuntimeException(e); } }
Source:
public void initialize(JavaProject project, int possibleMatchSize) throws JavaModelException { if (this.nameEnvironment != null && possibleMatchSize != 1) this.nameEnvironment.cleanup(); SearchableEnvironment searchableEnvironment = project.newSearchableNameEnvironment(this.workingCopies); this.nameEnvironment = possibleMatchSize == 1 ? (INameEnvironment) searchableEnvironment : (INameEnvironment) new JavaSearchNameEnvironment(project, this.workingCopies); Map map = project.getOptions(true); map.put(CompilerOptions.OPTION_TaskTags, org.eclipse.jdt.internal.compiler.util.Util.EMPTY_STRING); this.options = new CompilerOptions(map); ProblemReporter problemReporter = new ProblemReporter( DefaultErrorHandlingPolicies.proceedWithAllProblems(), this.options, new DefaultProblemFactory()); this.lookupEnvironment = new LookupEnvironment(this, this.options, problemReporter, this.nameEnvironment); this.lookupEnvironment.mayTolerateMissingType = true; this.parser = MatchLocatorParser.createParser(problemReporter, this); this.basicParser = null; this.nameLookup = searchableEnvironment.nameLookup; this.numberOfMatches = 0; this.matchesToProcess = new PossibleMatch[possibleMatchSize]; if (this.patternLocator instanceof TypeReferenceLocator) { ((TypeReferenceLocator) this.patternLocator).registerListener(this.lookupEnvironment); } }

Target:
public void initialize(JavaProject project, int possibleMatchSize) throws JavaModelException { if (this.nameEnvironment != null && possibleMatchSize != 1) this.nameEnvironment.cleanup(); SearchableEnvironment searchableEnvironment = project.newSearchableNameEnvironment(this.workingCopies); this.nameEnvironment = possibleMatchSize == 1 ? (INameEnvironment) searchableEnvironment : (INameEnvironment) new JavaSearchNameEnvironment(project, this.workingCopies); Map map = project.getOptions(true); map.put(CompilerOptions.OPTION_TaskTags, org.eclipse.jdt.internal.compiler.util.Util.EMPTY_STRING); this.options = new CompilerOptions(map); ProblemReporter problemReporter = new ProblemReporter( DefaultErrorHandlingPolicies.proceedWithAllProblems(), this.options, new DefaultProblemFactory()); this.lookupEnvironment = new LookupEnvironment(this, this.options, problemReporter, this.nameEnvironment); this.lookupEnvironment.mayTolerateMissingType = true; this.parser = MatchLocatorParser.createParser(problemReporter, this); this.basicParser = null; this.nameLookup = searchableEnvironment.nameLookup; this.numberOfMatches = 0; this.matchesToProcess = new PossibleMatch[possibleMatchSize]; if (this.patternLocator instanceof TypeReferenceLocator) { this.lookupEnvironment.addResolutionListener((TypeReferenceLocator) this.patternLocator); } }
Source:
private static String loadSwaggerFile(String pathToArchive) throws IOException { if (checkFileExistence(pathToArchive + APIImportExportConstants.YAML_SWAGGER_DEFINITION_LOCATION)) { if (log.isDebugEnabled()) { log.debug("Found swagger file " + pathToArchive + APIImportExportConstants.YAML_SWAGGER_DEFINITION_LOCATION); } String yamlContent = FileUtils.readFileToString( new File(pathToArchive + APIImportExportConstants.YAML_SWAGGER_DEFINITION_LOCATION)); return CommonUtil.yamlToJson(yamlContent); } else if (checkFileExistence(pathToArchive + APIImportExportConstants.JSON_SWAGGER_DEFINITION_LOCATION)) { if (log.isDebugEnabled()) { log.debug("Found swagger file " + pathToArchive + APIImportExportConstants.JSON_SWAGGER_DEFINITION_LOCATION); } return FileUtils.readFileToString( new File(pathToArchive + APIImportExportConstants.JSON_SWAGGER_DEFINITION_LOCATION)); } throw new IOException("Missing swagger file. Either swagger.json or swagger.yaml should present"); }

Target:
private static String loadSwaggerFile(String pathToArchive) throws IOException { if (CommonUtil.checkFileExistence(pathToArchive + APIImportExportConstants.YAML_SWAGGER_DEFINITION_LOCATION)) { if (log.isDebugEnabled()) { log.debug("Found swagger file " + pathToArchive + APIImportExportConstants.YAML_SWAGGER_DEFINITION_LOCATION); } String yamlContent = FileUtils.readFileToString( new File(pathToArchive + APIImportExportConstants.YAML_SWAGGER_DEFINITION_LOCATION)); return CommonUtil.yamlToJson(yamlContent); } else if (CommonUtil.checkFileExistence(pathToArchive + APIImportExportConstants.JSON_SWAGGER_DEFINITION_LOCATION)) { if (log.isDebugEnabled()) { log.debug("Found swagger file " + pathToArchive + APIImportExportConstants.JSON_SWAGGER_DEFINITION_LOCATION); } return FileUtils.readFileToString( new File(pathToArchive + APIImportExportConstants.JSON_SWAGGER_DEFINITION_LOCATION)); } throw new IOException("Missing swagger file. Either swagger.json or swagger.yaml should present"); }
Source:
public void readFully(long position, byte[] buffer, int offset, int length) throws IOException { FileReadRequest key = new FileReadRequest(path, position, length); if (!cacheManager.get(hiveFileContext, key, buffer, offset).isPresent()) { inputStream.readFully(position, buffer, offset, length); return; } if (!cacheManager.get(hiveFileContext, key, buffer, offset).get()) { inputStream.readFully(position, buffer, offset, length); cacheManager.put(hiveFileContext.getTable(), key, wrappedBuffer(buffer, offset, length)); return; } if (cacheValidationEnabled) { byte[] validationBuffer = new byte[length]; inputStream.readFully(position, validationBuffer, 0, length); for (int i = 0; i < length; i++) { verify(buffer[offset + i] == validationBuffer[i], "corrupted buffer at position " + i); } } }

Target:
public void readFully(long position, byte[] buffer, int offset, int length) throws IOException { FileReadRequest key = new FileReadRequest(path, position, length); switch (cacheManager.get(key, buffer, offset, cacheQuota)) { case HIT: break; case MISS: inputStream.readFully(position, buffer, offset, length); cacheManager.put(key, wrappedBuffer(buffer, offset, length), cacheQuota); return; case CACHE_QUOTA_EXCEED: inputStream.readFully(position, buffer, offset, length); return; } if (cacheValidationEnabled) { byte[] validationBuffer = new byte[length]; inputStream.readFully(position, validationBuffer, 0, length); for (int i = 0; i < length; i++) { verify(buffer[offset + i] == validationBuffer[i], "corrupted buffer at position " + i); } } }
Source:
private ControllerInboundInvocationHandler injectControllerInboundInvocationHandler(Cache cache) { ControllerInboundInvocationHandler handler = new ControllerInboundInvocationHandler( extractComponent(cache, InboundInvocationHandler.class)); JGroupsTransport t = (JGroupsTransport) extractComponent(cache, Transport.class); CommandAwareRpcDispatcher card = t.getCommandAwareRpcDispatcher(); replaceField(handler, "inboundInvocationHandler", card, CommandAwareRpcDispatcher.class); replaceComponent(cache.getCacheManager(), InboundInvocationHandler.class, handler, true); return handler; }

Target:
private ControllerInboundInvocationHandler injectControllerInboundInvocationHandler(Cache cache) { ControllerInboundInvocationHandler handler = new ControllerInboundInvocationHandler( extractComponent(cache, InboundInvocationHandler.class)); replaceComponent(cache.getCacheManager(), InboundInvocationHandler.class, handler, true); JGroupsTransport t = (JGroupsTransport) extractComponent(cache, Transport.class); CommandAwareRpcDispatcher card = t.getCommandAwareRpcDispatcher(); replaceField(handler, "inboundInvocationHandler", card, CommandAwareRpcDispatcher.class); return handler; }
Source:
private void refreshAbnormalStateResolverMap(ClusterConfig clusterConfig) { if (clusterConfig == null) { logger.debug("Skip refreshing abnormal state resolvers because the ClusterConfig is missing"); return; } Map<String, String> resolverMap = clusterConfig.getAbnormalStateResolverMap(); logger.debug("Start loading the abnormal state resolvers with configuration {}", resolverMap); _abnormalStateResolverMap.keySet().retainAll(resolverMap.keySet()); for (String stateModel : resolverMap.keySet()) { String resolverClassName = resolverMap.get(stateModel); if (resolverClassName == null || resolverClassName.isEmpty()) { continue; } if (!resolverClassName.equals(getAbnormalStateResolver(stateModel).getClass().getName())) { try { AbnormalStateResolver resolver = AbnormalStateResolver.class .cast(HelixUtil.loadClass(getClass(), resolverClassName).newInstance()); _abnormalStateResolverMap.put(stateModel, resolver); } catch (Exception e) { throw new HelixException(String .format("Failed to instantiate the abnormal state resolver %s for state model %s", resolverClassName, stateModel)); } } } logger.debug("Finish loading the abnormal state resolvers {}", _abnormalStateResolverMap); }

Target:
private void refreshAbnormalStateResolverMap(ClusterConfig clusterConfig) { if (clusterConfig == null) { logger.debug("Skip refreshing abnormal state resolvers because the ClusterConfig is missing"); return; } Map<String, String> resolverMap = clusterConfig.getAbnormalStateResolverMap(); logger.info("Start loading the abnormal state resolvers with configuration {}", resolverMap); _abnormalStateResolverMap.keySet().retainAll(resolverMap.keySet()); for (String stateModel : resolverMap.keySet()) { String resolverClassName = resolverMap.get(stateModel); if (resolverClassName == null || resolverClassName.isEmpty()) { continue; } if (!resolverClassName.equals(getAbnormalStateResolver(stateModel).getClass().getName())) { try { AbnormalStateResolver resolver = AbnormalStateResolver.class .cast(HelixUtil.loadClass(getClass(), resolverClassName).newInstance()); _abnormalStateResolverMap.put(stateModel, resolver); } catch (Exception e) { throw new HelixException(String .format("Failed to instantiate the abnormal state resolver %s for state model %s", resolverClassName, stateModel)); } } } logger.info("Finish loading the abnormal state resolvers {}", _abnormalStateResolverMap); }
Source:
public Mono<Secret> getSecret(SecretBase secretBase) { Objects.requireNonNull(secretBase, "The Secret Base parameter cannot be null."); if (secretBase.version() == null) { return getSecret(secretBase.name()); } return getSecretWithResponse(secretBase.name(), secretBase.version()) .flatMap(FluxUtil::toMono); }

Target:
public Mono<Secret> getSecret(SecretBase secretBase) { return getSecretWithResponse(secretBase).flatMap(FluxUtil::toMono); }
Source:
private void deleteReferenceSetEntries(int referenceSetID) throws EamDbException{ Connection conn = connect(); PreparedStatement preparedStatement = null; String sql = "DELETE FROM %s WHERE reference_set_id=?"; String fileTableName = EamDbUtil.correlationTypeToReferenceTableName(getCorrelationTypeById(CorrelationAttribute.FILES_TYPE_ID)); try { preparedStatement = conn.prepareStatement(String.format(sql, fileTableName)); preparedStatement.setInt(1, referenceSetID); preparedStatement.executeUpdate(); } catch (SQLException ex) { throw new EamDbException("Error deleting files from reference set", ex); } finally { EamDbUtil.closePreparedStatement(preparedStatement); EamDbUtil.closeConnection(conn); } }

Target:
private void deleteReferenceSetEntries(int referenceSetID) throws EamDbException{ Connection conn = connect(); PreparedStatement preparedStatement = null; String sql = "DELETE FROM %s WHERE reference_set_id=?"; String fileTableName = EamDbUtil.correlationTypeToReferenceTableName(getCorrelationTypeById(CorrelationAttribute.FILES_TYPE_ID)); try { preparedStatement = conn.prepareStatement(String.format(sql, fileTableName)); preparedStatement.setInt(1, referenceSetID); preparedStatement.executeUpdate(); } catch (SQLException ex) { throw new EamDbException("Error deleting files from reference set " + referenceSetID, ex); } finally { EamDbUtil.closePreparedStatement(preparedStatement); EamDbUtil.closeConnection(conn); } }
Source:
public ValidationResult isBlockSizeAutoDetectionSupported() { StorageType storageType = storageDomainStatic.getStorageType(); List<String> withoutSupportVDSes = getVdsDao().getAllForStoragePool(storagePool.getId()) .stream() .filter(vds -> { if (vds.getSupportedBlockSize() == null) { return true; } if (!vds.getSupportedBlockSize().containsKey(storageType.name())) { return true; } @SuppressWarnings("unchecked") List<Integer> blockSizeForStorage = (List<Integer>) vds.getSupportedBlockSize().get(storageType.name()); return !blockSizeForStorage.contains(0); }) .map(VDS::getName) .collect(Collectors.toList()); if (!withoutSupportVDSes.isEmpty()) { List<String> replacements = Collections.singletonList( ReplacementUtils.createSetVariableString("hosts", withoutSupportVDSes)); return new ValidationResult(EngineMessage.ERROR_CANNOT_ATTACH_STORAGE_DOMAIN_STORAGE_4K_UNSUPPORTED, replacements); } return ValidationResult.VALID; }

Target:
public ValidationResult isBlockSizeAutoDetectionSupported() { StorageType storageType = storageDomainStatic.getStorageType(); List<String> withoutSupportVDSes = getVdsDao().getAllForStoragePool(storagePool.getId()) .stream() .filter(vds -> { if (vds.getSupportedBlockSize() == null) { return true; } if (!vds.getSupportedBlockSize().containsKey(storageType.name())) { return true; } @SuppressWarnings("unchecked") List<Integer> blockSizeForStorage = (List<Integer>) vds.getSupportedBlockSize().get(storageType.name()); return !blockSizeForStorage.contains(StorageBlockSize.BLOCK_AUTO.getValue()); }) .map(VDS::getName) .collect(Collectors.toList()); if (!withoutSupportVDSes.isEmpty()) { List<String> replacements = Collections.singletonList( ReplacementUtils.createSetVariableString("hosts", withoutSupportVDSes)); return new ValidationResult(EngineMessage.ERROR_CANNOT_ATTACH_STORAGE_DOMAIN_STORAGE_4K_UNSUPPORTED, replacements); } return ValidationResult.VALID; }
Source:
public void canBeComparedProperly() throws Exception { final Label.Unmodified one = new Label.Unmodified( LabelTest.repo("jef", "jef_repo"), "{\"name\":\"paul\"}"); final Label.Unmodified other = new Label.Unmodified( LabelTest.repo("stan", "stan_repo"), "{\"name\":\"paul\"}"); Assert.assertFalse(one.equals(other)); Assert.assertFalse(one.compareTo(other) == 0); }

Target:
public void canBeComparedProperly() throws Exception { final Label.Unmodified one = new Label.Unmodified( LabelTest.repo("jef", "jef_repo"), "{\"name\":\"paul\"}" ); final Label.Unmodified other = new Label.Unmodified( LabelTest.repo("stan", "stan_repo"), "{\"name\":\"paul\"}" ); MatcherAssert.assertThat( one.equals(other), Matchers.is(false) ); MatcherAssert.assertThat( one.compareTo(other), Matchers.not(0) ); }
Source:
public boolean isAdVisible(final WebElement element, final String selector, final WebDriver driver) { hideSlot(selector, driver); final BufferedImage backgroundImg = shooter.takeScreenshot(element, driver); PageObjectLogging.log("ScreenshotsComparison", "Background image in " + selector, true, driver); showSlot(selector, driver); try { WebDriverWait wait = new WebDriverWait(driver, AD_TIMEOUT_SEC); wait.until(new ExpectedCondition<Object>() { @Override public Object apply(WebDriver driver) { BufferedImage adImg = shooter.takeScreenshot(element, driver); PageObjectLogging.log("ScreenshotsComparison", "Ad image in " + selector, true); if (adImg.getHeight() == 1) { return false; } return imageComparison.areImagesDifferent(backgroundImg, adImg, IMAGES_THRESHOLD_PERCENT); } }); } catch (TimeoutException e) { return false; } return true; }

Target:
public boolean isAdVisible(final WebElement element, final String selector, final WebDriver driver) { hideSlot(selector, driver); final BufferedImage backgroundImg = shooter.takeScreenshot(element, driver); PageObjectLogging.log("ScreenshotsComparison", "Background image in " + selector, true, driver); showSlot(selector, driver); try { WebDriverWait wait = new WebDriverWait(driver, AD_TIMEOUT_SEC); wait.until(new ExpectedCondition<Object>() { @Override public Object apply(WebDriver driver) { BufferedImage adImg = shooter.takeScreenshot(element, driver); PageObjectLogging.log("ScreenshotsComparison", "Ad image in " + selector, true); if (adImg.getHeight() == 1) { return false; } return imageComparison.areImagesDifferent(backgroundImg, adImg, IMAGES_THRESHOLD_PERCENT); } }); } catch (TimeoutException e) { PageObjectLogging.logWarning("ScreenshotsComparison", e); return false; } return true; }
Source:
public void resetInstalledLocation() throws CoreException { boolean locationReset = false; if (this.getMarker().getAttribute(REQUESTED_LINE) != null) { int line = this.getMarker().getAttribute(REQUESTED_LINE, -1); setAttribute(IMarker.LINE_NUMBER, line); locationReset = true; } if (this.getMarker().getAttribute(REQUESTED_CHAR_START) != null) { int charStart = this.getMarker().getAttribute(REQUESTED_CHAR_START, -1); setAttribute(IMarker.CHAR_START, charStart); locationReset = true; } if (this.getMarker().getAttribute(REQUESTED_CHAR_END) != null) { int charEnd = this.getMarker().getAttribute(REQUESTED_CHAR_END, -1); setAttribute(IMarker.CHAR_END, charEnd); locationReset = true; } if (this.getMarker().getAttribute(REQUESTED_SOURCE_HANDLE) != null) { String file = this.getMarker().getAttribute(REQUESTED_SOURCE_HANDLE, ""); setAttribute(ICBreakpoint.SOURCE_HANDLE, file); locationReset = true; } if (locationReset) { setAttribute( IMarker.MESSAGE, getMarkerMessage() ); } }

Target:
public void resetInstalledLocation() throws CoreException { boolean locationReset = false; if (this.getMarker().getAttribute(REQUESTED_LINE) != null) { int line = this.getMarker().getAttribute(REQUESTED_LINE, -1); setAttribute(IMarker.LINE_NUMBER, line); locationReset = true; } if (this.getMarker().getAttribute(REQUESTED_CHAR_START) != null) { int charStart = this.getMarker().getAttribute(REQUESTED_CHAR_START, -1); setAttribute(IMarker.CHAR_START, charStart); locationReset = true; } if (this.getMarker().getAttribute(REQUESTED_CHAR_END) != null) { int charEnd = this.getMarker().getAttribute(REQUESTED_CHAR_END, -1); setAttribute(IMarker.CHAR_END, charEnd); locationReset = true; } if (this.getMarker().getAttribute(REQUESTED_SOURCE_HANDLE) != null) { String file = this.getMarker().getAttribute(REQUESTED_SOURCE_HANDLE, ""); setAttribute(ICBreakpoint.SOURCE_HANDLE, file); setAttribute(RESET_INSTALLED_LOCATION, Boolean.TRUE); locationReset = true; } if (locationReset) { setAttribute( IMarker.MESSAGE, getMarkerMessage() ); } }
Source:
public void process() { PerformanceMonitor.startActivity("rendering/outline"); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); renderFullscreenQuad(); bindDisplay(); PerformanceMonitor.endActivity(); }

Target:
public void process() { PerformanceMonitor.startActivity("rendering/outline"); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); renderFullscreenQuad(); PerformanceMonitor.endActivity(); }
Source:
void scheduleSnapshot(DomainEventMessage<?> eventMessage) { snapshotter.scheduleSnapshot(aggregateType, eventMessage.getAggregateIdentifier()); }

Target:
private void scheduleSnapshot(DomainEventMessage<?> eventMessage) { snapshotter.scheduleSnapshot(aggregateType, eventMessage.getAggregateIdentifier()); }
Source:
public InternalNode(List<AbstractNode> children) { this.children = children; this.outgoingEdges = new ArrayList<>(); bindMargins(); DoubleBinding rangeBegin = marginProperty().divide(2).negate(); for (AbstractNode child : children) { child.translateYProperty().bind(rangeBegin.add(child.marginProperty().divide(2))); child.translateXProperty().set(LEVELWIDTH); rangeBegin = rangeBegin.add(child.marginProperty()); Edge e = new Edge(child); this.outgoingEdges.add(e); } this.getChildren().addAll(0, outgoingEdges); this.getChildren().addAll(children); }

Target:
public InternalNode(List<AbstractNode> children) { this.children = children; this.outgoingEdges = new ArrayList<>(); bindMargins(); bindLeafCount(); DoubleBinding rangeBegin = marginProperty().divide(2).negate(); for (AbstractNode child : children) { child.translateYProperty().bind(rangeBegin.add(child.marginProperty().divide(2))); child.translateXProperty().set(LEVELWIDTH); rangeBegin = rangeBegin.add(child.marginProperty()); Edge e = new Edge(child); this.outgoingEdges.add(e); } this.getChildren().addAll(0, outgoingEdges); this.getChildren().addAll(children); }
Source:
public void testNullPointerExceptionUponDataStreamerClosing() throws Exception { cnt = 0; startGrids(5); boolean failed = false; final CyclicBarrier barrier = new CyclicBarrier(2); multithreadedAsync(new Callable<Object>() { @Override public Object call() throws Exception { U.awaitQuiet(barrier); G.stopAll(true); return null; } }, 1); Ignite g4 = grid(4); IgniteDataStreamer<Object, Object> dataLdr = g4.dataStreamer(DEFAULT_CACHE_NAME); dataLdr.perNodeBufferSize(32); for (int i = 0; i < 100000; i += 2) { dataLdr.addData(i, i); dataLdr.removeData(i + 1); } U.awaitQuiet(barrier); info("Closing data streamer."); try { dataLdr.close(true); } catch (CacheException | IllegalStateException ignore) { failed = true; } finally { assertTrue(failed); } }

Target:
public void testNullPointerExceptionUponDataStreamerClosing() throws Exception { cnt = 0; startGrids(5); final CyclicBarrier barrier = new CyclicBarrier(2); multithreadedAsync(new Callable<Object>() { @Override public Object call() throws Exception { U.awaitQuiet(barrier); G.stopAll(true); return null; } }, 1); Ignite g4 = grid(4); IgniteDataStreamer<Object, Object> dataLdr = g4.dataStreamer(DEFAULT_CACHE_NAME); dataLdr.perNodeBufferSize(32); for (int i = 0; i < 100000; i += 2) { dataLdr.addData(i, i); dataLdr.removeData(i + 1); } U.awaitQuiet(barrier); info("Closing data streamer."); try { dataLdr.close(true); } catch (CacheException | IllegalStateException ignore) { } }
Source:
private int getUpdatedCaretPosition(StringBuilder currentCalculatedMessage, int currentCaretPosition, CommitMessageWithCaretPosition messageWithPosition, ICommitMessageProvider2 provider) { int pos = currentCaretPosition; if (currentCaretPosition == CommitMessageWithCaretPosition.NO_POSITION) { if (messageWithPosition .getDesiredCaretPosition() == CommitMessageWithCaretPosition.NO_POSITION) { return pos; } if (messageWithPosition .getDesiredCaretPosition() > messageWithPosition .getMessage().length() || messageWithPosition .getDesiredCaretPosition() < CommitMessageWithCaretPosition.NO_POSITION) { Activator.logWarning( MessageFormat.format( UIText.CommitDialog_CaretPositionOutOfBounds, provider.getClass().getName(), messageWithPosition.getDesiredCaretPosition()), null); return CommitMessageWithCaretPosition.NO_POSITION; } else { pos = currentCalculatedMessage.length(); if (currentCalculatedMessage.length() > 0) { pos += MESSAGE_SEPARATOR.length(); } pos += messageWithPosition.getDesiredCaretPosition(); } } else { Activator .logWarning( MessageFormat.format( UIText.CommitDialog_MultipleCommitMessageProvider2Implementations, provider.getClass().getName()), null); } return pos; }

Target:
private int getUpdatedCaretPosition(StringBuilder currentCalculatedMessage, int currentCaretPosition, CommitMessageWithCaretPosition messageWithPosition, ICommitMessageProvider2 provider) { int pos = currentCaretPosition; if (currentCaretPosition == CommitMessageWithCaretPosition.NO_POSITION) { String providedMessage = messageWithPosition.getMessage(); if (providedMessage == null || providedMessage.trim().isEmpty()) { return pos; } int providedCaretPosition = messageWithPosition .getDesiredCaretPosition(); if (providedCaretPosition == CommitMessageWithCaretPosition.NO_POSITION) { return pos; } if (providedCaretPosition > providedMessage.length() || providedCaretPosition < 0) { Activator.logWarning( MessageFormat.format( UIText.CommitDialog_CaretPositionOutOfBounds, provider.getClass().getName(), providedCaretPosition), null); return CommitMessageWithCaretPosition.NO_POSITION; } else { pos = currentCalculatedMessage.length(); if (currentCalculatedMessage.length() > 0) { pos += MESSAGE_SEPARATOR.length(); } pos += providedCaretPosition; } } else { Activator .logWarning( MessageFormat.format( UIText.CommitDialog_MultipleCommitMessageProvider2Implementations, provider.getClass().getName()), null); } return pos; }
Source:
public byte[] loadSectionData() throws IOException { byte[] data = new byte[(int)sh_size]; efile.seek(sh_offset); efile.read(data); return data; }

Target:
public byte[] loadSectionData() throws IOException { makeSureNotCompressed(); byte[] data = new byte[(int)sh_size]; efile.seek(sh_offset); efile.read(data); return data; }
Source:
public static void endTaskStep(NGuid stepId, ExecutionStatus exitStatus) { try { if (stepId != null) { Step step = JobRepositoryFactory.getJobRepository().getStep(stepId.getValue()); if (step != null) { step.markStepEnded(exitStatus); } JobRepositoryFactory.getJobRepository().updateStep(step); } } catch (Exception e) { log.errorFormat("Failed to terminate step {0} with status {1}", stepId, exitStatus, e); } }

Target:
public static void endTaskStep(NGuid stepId, ExecutionStatus exitStatus) { try { if (stepId != null) { Step step = JobRepositoryFactory.getJobRepository().getStep(stepId.getValue()); if (step != null) { step.markStepEnded(exitStatus); JobRepositoryFactory.getJobRepository().updateStep(step); } } } catch (Exception e) { log.errorFormat("Failed to terminate step {0} with status {1}", stepId, exitStatus, e); } }
Source:
public Mono<AccessToken> getToken(TokenRequestContext request) { String clientId = configuration.get(Configuration.PROPERTY_AZURE_CLIENT_ID); String tenantId = configuration.get(Configuration.PROPERTY_AZURE_TENANT_ID); String clientSecret = configuration.get(Configuration.PROPERTY_AZURE_CLIENT_SECRET); String certPath = configuration.get(Configuration.PROPERTY_AZURE_CLIENT_CERTIFICATE_PATH); String username = configuration.get(Configuration.PROPERTY_AZURE_USERNAME); String password = configuration.get(Configuration.PROPERTY_AZURE_PASSWORD); return Mono.fromSupplier(() -> { if (verifyNotNull(clientId)) { if (verifyNotNull(tenantId, clientSecret)) { return new ClientSecretCredential(tenantId, clientId, clientSecret, identityClientOptions); } else if (verifyNotNull(tenantId, certPath)) { return new ClientCertificateCredential(tenantId, clientId, certPath, null, identityClientOptions); } else if (verifyNotNull(username, password)) { return new UsernamePasswordCredential(clientId, tenantId, username, password, identityClientOptions); } } throw logger.logExceptionAsError(new ClientAuthenticationException( "Cannot create any credentials with the current environment variables", null)); }).flatMap(cred -> cred.getToken(request)); }

Target:
public Mono<AccessToken> getToken(TokenRequestContext request) { return Mono.fromSupplier(() -> { String clientId = configuration.get(Configuration.PROPERTY_AZURE_CLIENT_ID); String tenantId = configuration.get(Configuration.PROPERTY_AZURE_TENANT_ID); String clientSecret = configuration.get(Configuration.PROPERTY_AZURE_CLIENT_SECRET); String certPath = configuration.get(Configuration.PROPERTY_AZURE_CLIENT_CERTIFICATE_PATH); String username = configuration.get(Configuration.PROPERTY_AZURE_USERNAME); String password = configuration.get(Configuration.PROPERTY_AZURE_PASSWORD); if (verifyNotNull(clientId)) { if (verifyNotNull(tenantId, clientSecret)) { return new ClientSecretCredential(tenantId, clientId, clientSecret, identityClientOptions); } else if (verifyNotNull(tenantId, certPath)) { return new ClientCertificateCredential(tenantId, clientId, certPath, null, identityClientOptions); } else if (verifyNotNull(username, password)) { return new UsernamePasswordCredential(clientId, tenantId, username, password, identityClientOptions); } } throw logger.logExceptionAsError(new ClientAuthenticationException( "Cannot create any credentials with the current environment variables", null)); }).flatMap(cred -> cred.getToken(request)); }
Source:
public void update(long value) { histogram.update(value); Snapshot values = histogram.getSnapshot(); percentiles.forEach(x -> updateGaugeValues(x)); }

Target:
public void update(long value) { histogram.update(value); }
Source:
public Object getEventObject() { return serializationService.toObject(key); }

Target:
public Object getEventObject() { if (key == null) { key = serializationService.toObject(dataKey); } return key; }
Source:
public Map<AccessCategory.Id, AccessCategory> get() { Map<AccessCategory.Id, AccessCategory> accessCategories = new HashMap<AccessCategory.Id, AccessCategory>(); try { final ReviewDb db = schema.open(); try { for (AccessCategory ac : db.accessCategories().all()) { accessCategories.put(ac.getId(), ac); } } finally { db.close(); } } catch (OrmException e) { throw new ProvisionException("Cannot query approval categories", e); } return accessCategories; }

Target:
public Map<AccessCategory.Id, AccessCategory> get() { Map<AccessCategory.Id, AccessCategory> accessCategories = new HashMap<AccessCategory.Id, AccessCategory>(); try { final ReviewDb db = schema.open(); try { for (AccessCategory ac : db.accessCategories().all()) { accessCategories.put(ac.getId(), ac); } } finally { db.close(); } } catch (OrmException e) { throw new ProvisionException("Cannot query approval access categories", e); } return Collections.unmodifiableMap(accessCategories); }
Source:
public void endAddressScan() throws Exception { for (MirrorController partition : partitions) { partition.startAddressScan(); } }

Target:
public void endAddressScan() throws Exception { for (MirrorController partition : partitions) { partition.endAddressScan(); } }
Source:
public InterceptorChain resolveParameterValue(Message<?> message) { InterceptorChain tl = CURRENT.get(); if (tl != null) { return tl; } return CurrentUnitOfWork.map(uow -> (InterceptorChain) uow.getResource(INTERCEPTOR_CHAIN_EMITTER_KEY)) .orElseThrow(() -> new IllegalStateException( "InterceptorChain should have been injected")); }

Target:
public InterceptorChain resolveParameterValue(Message<?> message) { InterceptorChain interceptorChain = CURRENT.get(); if (interceptorChain != null) { return interceptorChain; } return CurrentUnitOfWork.map(uow -> (InterceptorChain) uow.getResource(INTERCEPTOR_CHAIN_EMITTER_KEY)) .orElseThrow(() -> new IllegalStateException( "InterceptorChain should have been injected")); }
Source:
public BigInteger decodeInteger() throws ASN1Exception { return new BigInteger(drainElementValue()); }

Target:
public BigInteger decodeInteger() throws ASN1Exception { if (INTEGER_TYPE != peekType()) { throw log.asnUnexpectedTag(); } return new BigInteger(drainElementValue()); }
Source:
public boolean supports(final RepositoryPath repositoryPath) { if (repositoryPath == null) { return false; } boolean isNotMetadata = ThrowingFunction.unchecked(RepositoryFiles::isMetadata).apply(repositoryPath); if (!isNotMetadata) { return false; } Repository repository = repositoryPath.getRepository(); return ((ImmutableRepository)repository).getRemoteRepository() != null; }

Target:
public boolean supports(final RepositoryPath repositoryPath) throws IOException { if (repositoryPath == null) { return false; } if (!RepositoryFiles.isMetadata(repositoryPath)) { return false; } Repository repository = repositoryPath.getRepository(); return ((RepositoryData)repository).getRemoteRepository() != null; }
Source:
public ConfigurationClientBuilder endpoint(String endpoint) { try { this.endpoint = new URL(endpoint); } catch (MalformedURLException ex) { throw new IllegalArgumentException("'endpoint' must be a valid URL"); } return this; }

Target:
public ConfigurationClientBuilder endpoint(String endpoint) { try { this.endpoint = new URL(endpoint); } catch (MalformedURLException ex) { logger.logAndThrow(new IllegalArgumentException("'endpoint' must be a valid URL")); } return this; }
Source:
private void processWaitEvents(boolean finalize) { Iterator<Map.Entry<JoinEvent<K,T>, Future<List>>> waitIterator = waitingEvents.entrySet().iterator(); while (waitIterator.hasNext()) { Map.Entry<JoinEvent<K,T>, Future<List>> waitingEvent = waitIterator.next(); Future<List> future = waitingEvent.getValue(); if (!finalize) { break; } if (future.isDone() || finalize) { try { JoinEvent<K,T> event = waitingEvent.getKey(); joinStream(event.value,event.isStream1Data,future.get()); } catch (InterruptedException | ExecutionException e) { throw new RuntimeException("end window", e); } waitIterator.remove(); } } }

Target:
private void processWaitEvents(boolean finalize) { Iterator<Map.Entry<JoinEvent<K,T>, Future<List>>> waitIterator = waitingEvents.entrySet().iterator(); while (waitIterator.hasNext()) { Map.Entry<JoinEvent<K,T>, Future<List>> waitingEvent = waitIterator.next(); Future<List> future = waitingEvent.getValue(); if (future.isDone() || finalize) { try { JoinEvent<K,T> event = waitingEvent.getKey(); joinStream(event.value,event.isStream1Data,future.get()); } catch (InterruptedException | ExecutionException e) { throw new RuntimeException("end window", e); } waitIterator.remove(); if (!finalize) { break; } } } }
Source:
public void process(ObjectType type, ObjectField field, Sortable annotation) { ToolUi ui = field.as(ToolUi.class); ui.setSortable(annotation.value()); Collections.addAll(ui.getSortOperators(), annotation.sortOperators()); }

Target:
public void process(ObjectType type, ObjectField field, Sortable annotation) { ToolUi ui = field.as(ToolUi.class); ui.setSortable(annotation.value()); ui.setSortOperators(new LinkedHashSet<>(Arrays.asList(annotation.sortOperators()))); }
Source:
public HttpRequestEndPoint getEndPointCourseStructure(final String courseId){ return new HttpRequestEndPoint() { public String getUrl() { try { PrefManager pref = new PrefManager(MainApplication.instance(), PrefManager.Pref.LOGIN); String username = URLEncoder.encode(pref.getCurrentUserProfile().username, "UTF-8"); String block_count = URLEncoder.encode("video", "UTF-8"); String block_fields = URLEncoder.encode("graded,format,student_view_multi_device", "UTF-8"); String block_json = URLEncoder.encode("video", "UTF-8"); String cId = URLEncoder.encode(courseId, "UTF-8"); String url = config.getApiHostURL() + "/api/courses/v1/blocks/?course_id=" + cId + "&user=" + username + "&depth=all&requested_fields=" + block_fields + "&student_view_data=" + block_json + "&block_counts=" + block_count+ "&nav_depth=3"; logger.debug("GET url for enrolling in a Course: " + url); return url; } catch (UnsupportedEncodingException e) { logger.error(e); } return ""; } public String getCacheKey() { return config.getApiHostURL() + "/api/courses/v1/blocks/?course_id=" + courseId; } public Map<String, String> getParameters() { return null; } }; }

Target:
public HttpRequestEndPoint getEndPointCourseStructure(final String courseId){ return new HttpRequestEndPoint() { public String getUrl() { try { PrefManager pref = new PrefManager(MainApplication.instance(), PrefManager.Pref.LOGIN); String username = URLEncoder.encode(pref.getCurrentUserProfile().username, "UTF-8"); String block_counts = URLEncoder.encode("video", "UTF-8"); String requested_fields = URLEncoder.encode("graded,format,student_view_multi_device", "UTF-8"); String student_view_data = URLEncoder.encode("video", "UTF-8"); String cId = URLEncoder.encode(courseId, "UTF-8"); String url = config.getApiHostURL() + "/api/courses/v1/blocks/?course_id=" + cId + "&user=" + username + "&depth=all&requested_fields=" + requested_fields + "&student_view_data=" + student_view_data + "&block_counts=" + block_counts+ "&nav_depth=3"; logger.debug("GET url for enrolling in a Course: " + url); return url; } catch (UnsupportedEncodingException e) { logger.error(e); } return ""; } public String getCacheKey() { return config.getApiHostURL() + "/api/courses/v1/blocks/?course_id=" + courseId; } public Map<String, String> getParameters() { return null; } }; }
Source:
private void handleExposeMinMaxValues(Context context,DiscoverySearchFilterFacet field, SearchFacetEntryRest facetEntry) { try { String minValue = searchService.calculateExtremeValue(context, field.getIndexFieldName() + "_min", field.getIndexFieldName() + "_min_sort", DiscoverQuery.SORT_ORDER.asc); String maxValue = searchService.calculateExtremeValue(context, field.getIndexFieldName() + "_max", field.getIndexFieldName() + "_max_sort", DiscoverQuery.SORT_ORDER.desc); if (StringUtils.isNotBlank(minValue) && StringUtils.isNotBlank(maxValue)) { facetEntry.setMinValue(minValue); facetEntry.setMaxValue(maxValue); } } catch (SearchServiceException e) { e.printStackTrace(); } }

Target:
private void handleExposeMinMaxValues(Context context,DiscoverySearchFilterFacet field, SearchFacetEntryRest facetEntry) { try { String minValue = searchService.calculateExtremeValue(context, field.getIndexFieldName() + "_min", field.getIndexFieldName() + "_min_sort", DiscoverQuery.SORT_ORDER.asc); String maxValue = searchService.calculateExtremeValue(context, field.getIndexFieldName() + "_max", field.getIndexFieldName() + "_max_sort", DiscoverQuery.SORT_ORDER.desc); if (StringUtils.isNotBlank(minValue) && StringUtils.isNotBlank(maxValue)) { facetEntry.setMinValue(minValue); facetEntry.setMaxValue(maxValue); } } catch (SearchServiceException e) { log.error(e.getMessage(), e); } }
Source:
protected boolean connectLunDisks(Guid hostId) { if (getVm().getDiskMap().isEmpty()) { vmHandler.updateDisksFromDb(getVm()); } List<LunDisk> lunDisks = DisksFilter.filterLunDisks(getVm().getDiskMap().values()); Set<String> connections = new HashSet<>(); for (LunDisk lunDisk : lunDisks) { LUNs lun = lunDisk.getLun(); lun.setLunConnections(new ArrayList<>(storageServerConnectionDao.getAllForLun(lun.getLUNId()))); if (connections.containsAll(lun.getLunConnections().stream().map(c -> c.getConnection()).collect(Collectors.toList()))) { continue; } if (lun.getLunConnections().isEmpty()) { return false; } if (!connect(hostId, lun)) { log.info("Failed to connect a lun disk to vdsm '{}' skipping it", hostId); return false; } connections.addAll(lun.getLunConnections().stream().map(c -> c.getConnection()).collect(Collectors.toList())); } return true; }

Target:
protected boolean connectLunDisks(Guid hostId) { if (getVm().getDiskMap().isEmpty()) { vmHandler.updateDisksFromDb(getVm()); } List<LunDisk> lunDisks = DisksFilter.filterLunDisks(getVm().getDiskMap().values()); Set<String> connections = new HashSet<>(); for (LunDisk lunDisk : lunDisks) { LUNs lun = lunDisk.getLun(); lun.setLunConnections(new ArrayList<>(storageServerConnectionDao.getAllForLun(lun.getLUNId()))); if (connections.containsAll( lun.getLunConnections() .stream() .map(c -> c.getId()) .collect(Collectors.toList()))) { continue; } if (lun.getLunConnections().isEmpty()) { return false; } if (!connect(hostId, lun)) { log.info("Failed to connect a lun disk to vdsm '{}' skipping it", hostId); return false; } connections.addAll(lun.getLunConnections() .stream() .map(c -> c.getId()) .collect(Collectors.toList())); } return true; }
Source:
static double[] calculateRowVariances(final RealMatrix m) { Utils.nonNull(m, "Cannot calculate variances for a null matrix."); final StandardDeviation std = new StandardDeviation(); final double[] result = new double[m.getRowDimension()]; for (int i = 0; i < m.getRowDimension(); i++) { final double row = m.getRow(i); result[i] = Math.pow(std.evaluate(row), 2); } return result; }

Target:
static double[] calculateRowVariances(final RealMatrix m) { Utils.nonNull(m, "Cannot calculate variances for a null matrix."); return MatrixSummaryUtils.getRowVariances(m); }
Source:
public File getMobileSlotScreenshot(WebElement element, WebDriver driver) { Shooter shooter = new Shooter(); File page = shooter.capturePage(driver); BufferedImage scaledPage = shooter.scaleImage(page, chromeDriverScreenshotScale, chromeDriverScreenshotScale); File slotScreenshot = shooter.cropImage(element.getLocation(), element.getSize(), scaledPage); return slotScreenshot; }

Target:
public File getMobileSlotScreenshot(WebElement element, WebDriver driver) { ImageEditor imageEditor = new ImageEditor(); Shooter shooter = new Shooter(); File page = shooter.capturePage(driver); BufferedImage scaledPage = imageEditor.scaleImage( page, chromeDriverScreenshotScale, chromeDriverScreenshotScale ); File slotScreenshot = imageEditor.cropImage(element.getLocation(), element.getSize(), scaledPage); return slotScreenshot; }
Source:
public Query build() { Checks.checkNotEmpty(table, "Please specify table name"); return new Query( distinct, table, columns, where, whereArgs, groupBy, having, orderBy, limit ); }

Target:
public Query build() { checkNotEmpty(table, "Please specify table name"); return new Query( distinct, table, columns, where, whereArgs, groupBy, having, orderBy, limit ); }
Source:
public void postToInflux(String payload) { HttpPost post = new HttpPost( "http://" + influxdbEmitterConfig.getHostname() + ":" + influxdbEmitterConfig.getPort() + "/write?db=" + influxdbEmitterConfig.getDatabaseName() + "&u=" + influxdbEmitterConfig.getInfluxdbUserName() + "&p=" + influxdbEmitterConfig.getInfluxdbPassword() ); post.setEntity(new StringEntity(payload, ContentType.DEFAULT_TEXT)); post.setHeader("Content-Type", "application/x-www-form-urlencoded"); try { influxdbClient.execute(post); } catch (IOException ex) { log.info(ex.toString()); } finally { post.releaseConnection(); } }

Target:
public void postToInflux(String payload) { HttpPost post = new HttpPost( "http://" + influxdbEmitterConfig.getHostname() + ":" + influxdbEmitterConfig.getPort() + "/write?db=" + influxdbEmitterConfig.getDatabaseName() + "&u=" + influxdbEmitterConfig.getInfluxdbUserName() + "&p=" + influxdbEmitterConfig.getInfluxdbPassword() ); post.setEntity(new StringEntity(payload, ContentType.DEFAULT_TEXT)); post.setHeader("Content-Type", "application/x-www-form-urlencoded"); try { influxdbClient.execute(post); } catch (IOException ex) { log.info(ex, "Failed to post events to InfluxDB."); } finally { post.releaseConnection(); } }