auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public static boolean reportErrorToProducer(PMode pmode) { boolean notifyProducer = false; if(pmode.getErrorHandling() != null) { if(pmode.getErrorHandling().getReport() != null) { notifyProducer = pmode.getErrorHandling().getReport().isProcessErrorNotifyProducer(); } } return notifyProducer; }

Target:
public static boolean reportErrorToProducer(PMode pmode) { boolean notifyProducer = false; if(pmode.getErrorHandling() != null && pmode.getErrorHandling().getReport() != null) { notifyProducer = pmode.getErrorHandling().getReport().isProcessErrorNotifyProducer(); } return notifyProducer; }
Source:
public IReadAccess getReader(IContentAccessFactory factory) { return factory.getPluginRepositoryReader(RepositoryHelper.appendPath( "src/main", basePath)); }

Target:
public IReadAccess getReader(IContentAccessFactory factory) { return factory.getPluginRepositoryReader(RepositoryHelper.appendPath("..", basePath)); }
Source:
public int hashCode() { int result = spec != null ? spec.hashCode() : 0; result = 31 * result + (name != null ? name.hashCode() : 0); result = 31 * result + (config != null ? config.hashCode() : 0); return result; }

Target:
public int hashCode() { return Objects.hashCode(spec, name, config); }
Source:
public ResponseEntity<?> deleteSubscription(@PathVariable("id") final String subscriptionId, final NativeWebRequest request) { subscriptionService.deleteSubscription(subscriptionId); return status(NO_CONTENT).build(); }

Target:
public ResponseEntity<?> deleteSubscription(@PathVariable("id") final String subscriptionId, final NativeWebRequest request) throws DbWriteOperationsBlockedException, NoSuchSubscriptionException, NoSuchEventTypeException, ServiceTemporarilyUnavailableException, InternalNakadiException { subscriptionService.deleteSubscription(subscriptionId); return status(NO_CONTENT).build(); }
Source:
protected void doRun(IProgressMonitor monitor) throws CoreException { if (monitor == null) { monitor = new NullProgressMonitor(); } SubMonitor progress = SubMonitor.convert(monitor, MakeUIPlugin.getResourceString("MakeCCWizard.task_name"), 10); super.doRun(progress.split(9)); if (newProject != null) { CCorePlugin.getDefault().convertProjectFromCtoCC(newProject, progress.split(1)); } monitor.done(); }

Target:
protected void doRun(IProgressMonitor monitor) throws CoreException { SubMonitor progress = SubMonitor.convert(monitor, MakeUIPlugin.getResourceString("MakeCCWizard.task_name"), 10); super.doRun(progress.split(9)); if (newProject != null) { CCorePlugin.getDefault().convertProjectFromCtoCC(newProject, progress.split(1)); } else progress.worked(1); }
Source:
public List<Map<String, String>> getDataRows() { return dataRows.stream().map(m -> { return m.entrySet().stream().collect(Collectors.toMap(e -> e.getKey(), e -> e.getValue().toString())); }).collect(Collectors.toList()); }

Target:
public List<Map<String, String>> getDataRows() { return getDataRowsAsCompositeVariants().stream().map(m -> { return m.entrySet().stream().collect(Collectors.toMap(e -> e.getKey(), e -> e.getValue().toString())); }).collect(Collectors.toList()); }
Source:
public boolean bat$isAwake() { return getIsBatHanging(); }

Target:
public boolean bat$isAwake() { return !getIsBatHanging(); }
Source:
private int getNumRubricRows(int questionNum) { return getQuestionForm(questionNum).findElements(By.cssSelector("tm-rubric-question-edit-details-form tr")).size(); }

Target:
private int getNumRubricRows(int questionNum) { return getQuestionForm(questionNum).findElements(By.cssSelector("#rubric-table tr")).size(); }
Source:
public Action getNextEventAction() { if (fNextEventAction == null) { fNextEventAction = new Action() { @Override public void runWithEvent(Event event) { boolean extend = (event.stateMask & SWT.SHIFT) != 0; selectNextEvent(extend); } }; fNextEventAction.setText(Messages.TmfTimeGraphViewer_NextStateChangeActionNameText); fNextEventAction.setToolTipText(Messages.TmfTimeGraphViewer_NextStateChangeActionToolTipText); fNextEventAction.setImageDescriptor(Activator.getDefault().getImageDescripterFromPath(ITmfImageConstants.IMG_UI_NEXT_EVENT)); } return fNextEventAction; }

Target:
public Action getNextEventAction() { if (fNextEventAction == null) { fNextEventAction = new Action() { @Override public void runWithEvent(Event event) { boolean extend = (event.stateMask & SWT.SHIFT) != 0; selectNextEvent(extend); } }; fNextEventAction.setText(Messages.TmfTimeGraphViewer_NextStateChangeActionNameText); fNextEventAction.setToolTipText(Messages.TmfTimeGraphViewer_NextStateChangeActionToolTipText); fNextEventAction.setImageDescriptor(Activator.getDefault().getImageDescripterFromPath(ITmfImageConstants.IMG_UI_NEXT_STATE_CHANGE)); } return fNextEventAction; }
Source:
public void commit() throws CommitException { if (updates.size() == 0) { deleteWeakRow(); return; } for (Map<Column,Bytes> cols : updates.values()) stats.incrementEntriesSet(cols.size()); CommitData cd = createCommitData(); try { if (!preCommit(cd)) { readUnread(cd); throw new CommitException(); } long commitTs = OracleClient.getInstance(env).getTimestamp(); if (commitPrimaryColumn(cd, commitTs)) { finishCommit(cd, commitTs); } else { throw new CommitException(); } } catch (CommitException e) { throw e; } catch (RuntimeException e) { throw e; } catch (Exception e) { throw new RuntimeException(e); } finally { stats.setFinishTime(System.currentTimeMillis()); for (Set<Column> cols : cd.getRejected().values()) { stats.incrementCollisions(cols.size()); } close(); } }

Target:
public synchronized void commit() throws CommitException { if (status == TxStatus.CLOSED) { throw new CommitException("Transaction was previously closed"); } else if (status == TxStatus.COMMITTED) { throw new CommitException("Transaction was previously committed"); } if (updates.size() == 0) { deleteWeakRow(); return; } for (Map<Column,Bytes> cols : updates.values()) stats.incrementEntriesSet(cols.size()); CommitData cd = createCommitData(); try { if (!preCommit(cd)) { readUnread(cd); throw new CommitException("Pre-commit failed"); } long commitTs = OracleClient.getInstance(env).getTimestamp(); if (commitPrimaryColumn(cd, commitTs)) { finishCommit(cd, commitTs); } else { throw new CommitException("Commit failed"); } } catch (CommitException e) { throw e; } catch (RuntimeException e) { throw e; } catch (Exception e) { throw new RuntimeException(e); } finally { stats.setFinishTime(System.currentTimeMillis()); for (Set<Column> cols : cd.getRejected().values()) { stats.incrementCollisions(cols.size()); } status = TxStatus.COMMITTED; } }
Source:
public String[] getConfigInformation(int id) { try { try { Class.forName(jdbcDriver); } catch (ClassNotFoundException e) { e.printStackTrace(); } Connection connection = DriverManager.getConnection(mysqlURL, username, password); String sql = "SELECT teamName, description, datasetName, evaluator, id FROM configurations WHERE id = " + id + ";"; PreparedStatement insertStmt = connection.prepareStatement(sql); ResultSet configInfoList = insertStmt.executeQuery(); configInfoList.next(); String configInfo[] = new String[6]; configInfo[0] = configInfoList.getString(1); configInfo[1] = configInfoList.getString(2); configInfo[2] = configInfoList.getString(3); configInfo[3] = "task_variant_b"; configInfo[4] = configInfoList.getString(4); configInfo[5] = Integer.toString(configInfoList.getInt(5)); connection.close(); return configInfo; } catch (SQLException e) { e.printStackTrace(); return null; } }

Target:
public models.Configuration getConfigInformation(int id) { try { try { Class.forName(jdbcDriver); } catch (ClassNotFoundException e) { e.printStackTrace(); } Connection connection = DriverManager.getConnection(mysqlURL, username, password); String sql = "SELECT teamName, description, datasetName, evaluator, id FROM configurations WHERE id = " + id + ";"; PreparedStatement insertStmt = connection.prepareStatement(sql); ResultSet configInfoList = insertStmt.executeQuery(); configInfoList.next(); models.Configuration config = new models.Configuration(configInfoList.getString(1), configInfoList.getString(2), configInfoList.getString(3), "task_variant_b", configInfoList.getString(4), Integer.toString(configInfoList.getInt(5))); connection.close(); return config; } catch (SQLException e) { e.printStackTrace(); return null; } }
Source:
public Pair<List<Guid>, Guid> balance(VDSGroup cluster, List<VDS> hosts, Map<String, String> parameters, ArrayList<String> messages) { final Pair<List<Guid>, Guid> migrationRule = super.balance(cluster, hosts, parameters, messages); List<VDS> allHosts = DbFacade.getInstance().getVdsDao().getAllForVdsGroup(cluster.getId()); Pair<VDS, VDSStatus> action = evaluatePowerManagementSituation( getDownHosts(allHosts, parameters), getMaintenanceHosts(allHosts, parameters), getEmptyHosts(allHosts, parameters), parameters ); if (action != null) processPmAction(action); return migrationRule; }

Target:
public Pair<List<Guid>, Guid> balance(VDSGroup cluster, List<VDS> hosts, Map<String, String> parameters, ArrayList<String> messages) { final Pair<List<Guid>, Guid> migrationRule = super.balance(cluster, hosts, parameters, messages); List<VDS> allHosts = DbFacade.getInstance().getVdsDao().getAllForVdsGroup(cluster.getId()); Pair<VDS, VDSStatus> action = evaluatePowerManagementSituation( getDownHosts(allHosts, parameters), getMaintenanceHosts(allHosts, parameters), getEmptyHosts(allHosts, parameters), parameters); if (action != null) { processPmAction(action); } return migrationRule; }
Source:
public void onLoadFinished(Loader<Cursor> cursorLoader, Cursor cursor) { if (cursor == null) { return; } callingFragment.setPageSaved(cursor.getCount() != 0); callingFragment.setSavedPageCheckComplete(true); }

Target:
public void onLoadFinished(Loader<Cursor> cursorLoader, Cursor cursor) { callingFragment.setPageSaved(cursor.getCount() != 0); callingFragment.setSavedPageCheckComplete(true); Menu optionsMenu = callingFragment.getOptionsMenu(); if (optionsMenu != null) { MenuItem savePageItem = optionsMenu.findItem(R.id.menu_page_save); if (savePageItem == null) { return; } callingFragment.updateSavePageMenuItem(savePageItem); } }
Source:
public Object apply(ConfigResource resource) throws AuthException, BadRequestException, ResourceConflictException, Exception { final Map<String, CapabilityInfo> output = Maps.newTreeMap(); Class<? extends CapabilityConstants> bundleClass = CapabilityConstants.get().getClass(); CapabilityConstants c = CapabilityConstants.get(); for (String s : Splitter.on(", ").split(CapabilityConstants.get().capabilityNames)) { String v = (String) bundleClass.getField(s).get(c); CapabilityInfo info = new CapabilityInfo(s, v); output.put(s, info); } return OutputFormat.JSON.newGson().toJsonTree(output, new TypeToken<Map<String, GroupInfo>>() {}.getType()); }

Target:
public Map<String, CapabilityInfo> apply(ConfigResource resource) throws AuthException, BadRequestException, ResourceConflictException, IllegalArgumentException, SecurityException, IllegalAccessException, NoSuchFieldException { Map<String, CapabilityInfo> output = Maps.newTreeMap(); Class<? extends CapabilityConstants> bundleClass = CapabilityConstants.get().getClass(); CapabilityConstants c = CapabilityConstants.get(); for (String id : GlobalCapability.getAllNames()) { String name = (String) bundleClass.getField(id).get(c); output.put(id, new CapabilityInfo(id, name)); } return output; }
Source:
private void cancelJob(GerritTriggeredEvent event) { List<hudson.model.Queue.Item> itemsInQueue = Queue.getInstance().getItems(myProject); for (hudson.model.Queue.Item item : itemsInQueue) { if (checkCausedByGerrit(event, item.getCauses())) { Queue.getInstance().cancel(item); } } for (Computer c : Hudson.getInstance().getComputers()) { List<Executor> executors = new ArrayList<Executor>(); executors.addAll(c.getOneOffExecutors()); executors.addAll(c.getExecutors()); for (Executor e : executors) { if (e.getCurrentExecutable() instanceof Run<?,?>) { Run<?,?> run = (Run<?,?>) e.getCurrentExecutable(); if (checkCausedByGerrit(event, run.getCauses())) { e.interrupt( Result.ABORTED, new NewPatchSetInterruption() ); } } } } }

Target:
private void cancelJob(GerritTriggeredEvent event) { List<hudson.model.Queue.Item> itemsInQueue = Queue.getInstance().getItems(getJob()); for (hudson.model.Queue.Item item : itemsInQueue) { if (checkCausedByGerrit(event, item.getCauses())) { Queue.getInstance().cancel(item); } } for (Computer c : Jenkins.getInstance().getComputers()) { List<Executor> executors = new ArrayList<Executor>(); executors.addAll(c.getOneOffExecutors()); executors.addAll(c.getExecutors()); for (Executor e : executors) { if (e.getCurrentExecutable() instanceof Run<?,?>) { Run<?,?> run = (Run<?,?>) e.getCurrentExecutable(); if (checkCausedByGerrit(event, run.getCauses())) { e.interrupt( Result.ABORTED, new NewPatchSetInterruption() ); } } } } }
Source:
private void process() { boolean justProcessedEquals = false; while (pos < max) { char ch = toProcess[pos]; if (justProcessedEquals) { if (!isWhitespace(ch) && ch != 0) { lexArgValueIdentifier(); } justProcessedEquals = false; continue; } if (isAlphabetic(ch) || isDigit(ch) || ch == '_' || ch == '.') { lexIdentifier(); } else { switch (ch) { case '&': pushCharToken(TokenKind.AMPERSAND); break; case '<': pushCharToken(TokenKind.SPLIT_OPEN); break; case '>': pushCharToken(TokenKind.SPLIT_CLOSE); break; case '|': if (isTwoCharToken(TokenKind.DOUBLE_PIPE)) { pushPairToken(TokenKind.DOUBLE_PIPE); } else { pushPairToken(TokenKind.PIPE); } break; case '-': if (!isTwoCharToken(TokenKind.DOUBLE_MINUS)) { throw new JobSpecificationException( expressionString, pos, JobDSLMessage.MISSING_CHARACTER, "-"); } pushPairToken(TokenKind.DOUBLE_MINUS); break; case '=': justProcessedEquals = true; pushCharToken(TokenKind.EQUALS); break; case ' ': case '\t': case '\r': pos++; break; case '\n': pos++; break; case '(': pushCharToken(TokenKind.OPEN_PAREN); break; case ')': pushCharToken(TokenKind.CLOSE_PAREN); break; case '\'': lexQuotedStringLiteral(); break; case '"': lexDoubleQuotedStringLiteral(); break; case 0: pos++; break; case '\\': throw new StreamDefinitionException( expressionString, pos, XDDSLMessages.UNEXPECTED_ESCAPE_CHAR); default: throw new StreamDefinitionException( expressionString, pos, XDDSLMessages.UNEXPECTED_DATA, Character.valueOf(ch).toString()); } } } }

Target:
private void process() { boolean justProcessedEquals = false; while (pos < max) { char ch = toProcess[pos]; if (justProcessedEquals) { if (!isWhitespace(ch) && ch != 0) { lexArgValueIdentifier(); } justProcessedEquals = false; continue; } if (isAlphabetic(ch) || isDigit(ch) || ch == '_' || ch == '.') { lexIdentifier(); } else { switch (ch) { case '&': pushCharToken(TokenKind.AMPERSAND); break; case '<': pushCharToken(TokenKind.SPLIT_OPEN); break; case '>': pushCharToken(TokenKind.SPLIT_CLOSE); break; case '|': if (isTwoCharToken(TokenKind.DOUBLE_PIPE)) { pushPairToken(TokenKind.DOUBLE_PIPE); } else { pushPairToken(TokenKind.PIPE); } break; case '-': if (!isTwoCharToken(TokenKind.DOUBLE_MINUS)) { throw new JobSpecificationException( expressionString, pos, JobDSLMessage.MISSING_CHARACTER, "-"); } pushPairToken(TokenKind.DOUBLE_MINUS); break; case '=': justProcessedEquals = true; pushCharToken(TokenKind.EQUALS); break; case ' ': case '\t': case '\r': case '\n': pos++; break; case '(': pushCharToken(TokenKind.OPEN_PAREN); break; case ')': pushCharToken(TokenKind.CLOSE_PAREN); break; case '\'': lexQuotedStringLiteral(); break; case '"': lexDoubleQuotedStringLiteral(); break; case 0: pos++; break; case '\\': throw new JobSpecificationException( expressionString, pos, JobDSLMessage.UNEXPECTED_ESCAPE_CHAR); default: throw new JobSpecificationException( expressionString, pos, JobDSLMessage.UNEXPECTED_DATA, Character.valueOf(ch).toString()); } } } }
Source:
public PythonFunctionRegistrar getPythonFunctionRegistrar() { Preconditions.checkNotNull(pyFuncReg); return pyFuncReg; }

Target:
public PythonFunctionRegistrar getPythonFunctionRegistrar() throws DbException { PythonFunctionRegistrar pyFuncRegistrar = null; if (!execEnvVars.containsKey(MyriaConstants.EXEC_ENV_VAR_TEST_MODE)) { if (getLocalSubQuery() instanceof WorkerSubQuery) { pyFuncRegistrar = ((WorkerSubQuery) getLocalSubQuery()).getWorker().getPythonFunctionRegistrar(); } } return pyFuncRegistrar; }
Source:
public Schema getSchema(FormatContext context) { if (conf.containsMacro(PathTrackingConfig.NAME_SCHEMA) || !Strings.isNullOrEmpty(conf.schema)) { return super.getSchema(context); } String filePath = conf.getProperties().getProperties().getOrDefault("path", null); try { Job job = JobUtils.createInstance(); Configuration hconf = job.getConfiguration(); final Path file = conf.getFilePathForSchemaGeneration(filePath, "parquet", hconf); final ParquetReader reader = AvroParquetReader.builder(file).build(); GenericData.Record record = (GenericData.Record) reader.read(); return Schema.parseJson(record.getSchema().toString()); } catch (IOException e) { context.getFailureCollector().addFailure("Schema error", e.getMessage()); } return super.getSchema(context); }

Target:
public Schema getSchema(FormatContext context) { if (conf.containsMacro(PathTrackingConfig.NAME_SCHEMA) || !Strings.isNullOrEmpty(conf.schema)) { return super.getSchema(context); } try { return getDefaultSchema(context); } catch (IOException e) { throw new IllegalArgumentException("Invalid schema: " + e.getMessage(), e); } }
Source:
protected void modified(Map<String, Object> config) { if (config != null) { this.defaultServiceId = (String) config.get("default"); } }

Target:
protected void modified(Map<String, Object> config) { if (config != null) { defaultServiceId = (String) config.get("default"); } }
Source:
protected void handleNotificationEvent(final Notification notification) { Set<EditPart> partToRefresh1 = DiagramElementEditPartOperation.handleNotificationEvent(this, notification, false); for (EditPart editPart : partToRefresh1) { editPart.refresh(); } super.handleNotificationEvent(notification); Set<EditPart> partToRefresh2 = AbstractDiagramNodeEditPartOperation.handleNotificationEvent(this, notification, false); List<EditPart> partToRefreshFromNode = partToRefresh2.stream().filter(part->!partToRefresh1.contains(part)).collect(Collectors.toList()); for (EditPart editPart : partToRefreshFromNode) { editPart.refresh(); } handleDefaultSizeNotification(notification); if (NotationPackage.eINSTANCE.getDrawerStyle_Collapsed() == notification.getFeature()) { refreshBounds(); } if (isRegion() && getParent() != null && new NotificationQuery(notification).isNotationLayoutChange()) { EditPart regionContainer = getParent().getParent(); if (regionContainer instanceof AbstractDiagramContainerEditPart && shouldRefreshRegionContainerBounds(regionContainer)) { ((AbstractDiagramContainerEditPart) regionContainer).refreshBounds(); } } }

Target:
protected void handleNotificationEvent(final Notification notification) { Set<EditPart> partToRefresh1 = DiagramElementEditPartOperation.handleNotificationEvent(this, notification, false); for (EditPart editPart : partToRefresh1) { editPart.refresh(); } super.handleNotificationEvent(notification); Set<EditPart> partToRefresh2 = AbstractDiagramNodeEditPartOperation.handleNotificationEvent(this, notification, false); partToRefresh2.removeAll(partToRefresh1); for (EditPart editPart : partToRefresh2) { editPart.refresh(); } handleDefaultSizeNotification(notification); if (NotationPackage.eINSTANCE.getDrawerStyle_Collapsed() == notification.getFeature()) { refreshBounds(); } if (isRegion() && getParent() != null && new NotificationQuery(notification).isNotationLayoutChange()) { EditPart regionContainer = getParent().getParent(); if (regionContainer instanceof AbstractDiagramContainerEditPart && shouldRefreshRegionContainerBounds(regionContainer)) { ((AbstractDiagramContainerEditPart) regionContainer).refreshBounds(); } } }
Source:
private AddressProvider createAddressProvider(ClientConfig config) { boolean discoveryEnabled = new HazelcastProperties(config.getProperties()) .getBoolean(ClientProperty.DISCOVERY_SPI_ENABLED); ClientAwsConfig awsConfig = config.getNetworkConfig().getAwsConfig(); List<String> userConfiguredAddresses = config.getNetworkConfig().getAddresses(); if (discoveryEnabled || (awsConfig != null && awsConfig.isEnabled()) || !userConfiguredAddresses.isEmpty()) { return null; } return new AddressProvider() { @Override public Collection<Address> loadAddresses() { Collection<Address> possibleAddresses = new ArrayList<Address>(); for (Address address : getKnownAddresses()) { Collection<Address> addresses = AddressHelper.getPossibleSocketAddresses(address.getPort(), address.getHost(), 1); possibleAddresses.addAll(addresses); } return possibleAddresses; } }; }

Target:
private AddressProvider createAddressProvider(ClientConfig config) { boolean discoveryEnabled = new HazelcastProperties(config.getProperties()) .getBoolean(ClientProperty.DISCOVERY_SPI_ENABLED); ClientAwsConfig awsConfig = config.getNetworkConfig().getAwsConfig(); List<String> userConfiguredAddresses = config.getNetworkConfig().getAddresses(); boolean isAtLeastAProviderConfigured = discoveryEnabled || (awsConfig != null && awsConfig.isEnabled()) || !userConfiguredAddresses.isEmpty(); if (isAtLeastAProviderConfigured) { return null; } return new AddressProvider() { @Override public Collection<Address> loadAddresses() { Collection<Address> possibleAddresses = new ArrayList<Address>(); for (Address address : getKnownAddresses()) { Collection<Address> addresses = AddressHelper.getPossibleSocketAddresses(address.getPort(), address.getHost(), 1); possibleAddresses.addAll(addresses); } return possibleAddresses; } }; }
Source:
public static <T> T getInstance( Injector injector, String configClassName, Class<? extends T> classRunByCoordinator, Class<? extends T> defaultClass ) throws ClassNotFoundException { if (configClassName != null) { @SuppressWarnings("unchecked") final T instance = (T) injector.getInstance(Class.forName(configClassName)); return instance; } if (classRunByCoordinator != null && isCoordinator(injector)) { return injector.getInstance(classRunByCoordinator); } if (defaultClass != null) { return injector.getInstance(defaultClass); } return null; }

Target:
private static <T> T getInstance( Injector injector, String configClassName, Class<? extends T> classRunByCoordinator, Class<? extends T> defaultClass ) throws ClassNotFoundException { if (configClassName != null) { @SuppressWarnings("unchecked") final T instance = (T) injector.getInstance(Class.forName(configClassName)); return instance; } if (isCoordinator(injector)) { return injector.getInstance(classRunByCoordinator); } return injector.getInstance(defaultClass); }
Source:
private void validateForRequireDrug(DrugOrder order, Errors errors) { AdministrationService administrationService = Context.getAdministrationService(); String requireDrug = administrationService.getGlobalProperty( OpenmrsConstants.GLOBAL_PROPERTY_DRUG_ORDER_REQUIRE_DRUG, "false"); if (requireDrug == null || (requireDrug != null && Boolean.parseBoolean(requireDrug))) { if (order.getDrug() == null) { ValidationUtils.rejectIfEmpty(errors, "drug", "DrugOrder.error.drugIsRequire"); } } }

Target:
private void validateForRequireDrug(DrugOrder order, Errors errors) { AdministrationService administrationService = Context.getAdministrationService(); String requireDrug = administrationService.getGlobalProperty( OpenmrsConstants.GLOBAL_PROPERTY_DRUG_ORDER_REQUIRE_DRUG, "false"); if (Boolean.parseBoolean(requireDrug)) { if (order.getDrug() == null) { ValidationUtils.rejectIfEmpty(errors, "drug", "DrugOrder.error.drugIsRequired"); } } }
Source:
public void onCloseFileSystem(final JGitFileSystem fileSystem) { fsManager.addClosedFileSystems(fileSystem); synchronized (postponedEventsLock) { fileSystem.clearPostponedWatchEvents(); } if (fsManager.allTheFSAreClosed()) { forceStopDaemon(); shutdownSSH(); shutdownCluster(); } }

Target:
public void onCloseFileSystem(final JGitFileSystem fileSystem) { fsManager.addClosedFileSystems(fileSystem); synchronized (postponedEventsLock) { fileSystem.clearPostponedWatchEvents(); } if (fsManager.allTheFSAreClosed()) { forceStopDaemon(); shutdownSSH(); shutdownEventsManager(); } }
Source:
public InterpolatedSmileFunction(final GeneralSmileInterpolator interpolator, final double forward, final double[] strikes, final double expiry, final double[] impliedVols) { ArgumentChecker.notNull(interpolator, "interpolator"); ArgumentChecker.notNull(strikes, "strikes"); ArgumentChecker.notNull(impliedVols, "impliedVols"); _interpolator = interpolator; _smileFunction = interpolator.getVolatilityFunction(forward, strikes, expiry, impliedVols); }

Target:
public InterpolatedSmileFunction(final GeneralSmileInterpolator interpolator, final double forward, final double[] strikes, final double expiry, final double[] impliedVols) { ArgumentChecker.notNull(interpolator, "interpolator"); ArgumentChecker.notNull(strikes, "strikes"); ArgumentChecker.notNull(impliedVols, "impliedVols"); ArgumentChecker.isTrue(strikes.length == impliedVols.length, "strikes and impliedVols should have the same length"); _interpolator = interpolator; _smileFunction = interpolator.getVolatilityFunction(forward, strikes, expiry, impliedVols); }
Source:
public static <T extends Comparable> DateTimeExpression<T> currentDate(Class<T> cl) { return Expressions.<T>dateTimeOperation(cl, Ops.DateTimeOps.CURRENT_DATE); }

Target:
public static <T extends Comparable> DateTimeExpression<T> currentDate(Class<T> cl) { return Expressions.dateTimeOperation(cl, Ops.DateTimeOps.CURRENT_DATE); }
Source:
public List<ContextMenuItem> getDefaultItems() { String idScheme = getIdScheme(); List<ContextMenuItem> items = new ArrayList<>(); for (ContextMenuItem item : this.items) { String id = item.getId(); if (id != null && (id.startsWith(idScheme) && !APP_PROFILES_ID.equals(id) || id.startsWith(AIDL_LAYERS_PREFIX))) { items.add(item); } } return items; }

Target:
public List<ContextMenuItem> getDefaultItems() { String idScheme = getIdScheme(); List<ContextMenuItem> items = new ArrayList<>(); for (ContextMenuItem item : this.items) { String id = item.getId(); if (id != null && (id.startsWith(idScheme))) { items.add(item); } } return items; }
Source:
protected final Cluster getUpcomingCluster(String host, int port) throws Exception { try (DiagnosticService diagnosticService = DiagnosticServiceFactory.fetch( InetSocketAddress.createUnresolved(host, port), getClass().getSimpleName(), OP_TIMEOUT, OP_TIMEOUT, null)) { return diagnosticService.getProxy(TopologyService.class).getUpcomingNodeContext().getCluster(); } }

Target:
protected final Cluster getUpcomingCluster(String host, int port) throws Exception { try (DiagnosticService diagnosticService = DiagnosticServiceFactory.fetch( InetSocketAddress.createUnresolved(host, port), getClass().getSimpleName(), getConnectionTimeout(), getConnectionTimeout(), null)) { return diagnosticService.getProxy(TopologyService.class).getUpcomingNodeContext().getCluster(); } }
Source:
public void write(NullWritable key, AbstractFileMetadata fileMetadata) throws IOException, InterruptedException { AbstractFileMetadata.Credentials sourceCredentials = fileMetadata.getCredentials(); if (!sourceFilesystemMap.containsKey(sourceCredentials)) { sourceFilesystemMap.put(sourceCredentials, getSourceFilesystemFromCredentials(sourceCredentials)); } FileSystem sourceFilesystem = sourceFilesystemMap.get(sourceCredentials); Path srcPath = new Path(fileMetadata.fullPath); Path destPath = new Path(basePath + "/" + fileMetadata.basePath); FsPermission permission = new FsPermission(fileMetadata.getPermission()); if (fileMetadata.isFolder) { if (!destFileSystem.exists(destPath) && sourceFilesystem.isDirectory(srcPath)) { destFileSystem.mkdirs(destPath, permission); } return; } else if (!sourceFilesystem.exists(srcPath)) { return; } if (!enableOverwrite && destFileSystem.exists(destPath)) { return; } FSDataInputStream inputStream = sourceFilesystem.open(srcPath); FSDataOutputStream outputStream = FileSystem.create(destFileSystem, destPath, permission); byte[] buf = new byte[bufferSize]; int len; while ((len = inputStream.read(buf)) >= 0) { outputStream.write(buf, 0, len); } inputStream.close(); outputStream.close(); }

Target:
public void write(NullWritable key, AbstractFileMetadata fileMetadata) throws IOException, InterruptedException { if (fileMetadata.getRelativePath().isEmpty()) { return; } Path srcPath = new Path(fileMetadata.getFullPath()); Path destPath = new Path(basePath, fileMetadata.getRelativePath()); FsPermission permission = new FsPermission(fileMetadata.getPermission()); if (!enableOverwrite && destFileSystem.exists(destPath)) { return; } String uriString = fileMetadata.getHostURI(); if (!sourceFilesystemMap.containsKey(uriString)) { sourceFilesystemMap.put(uriString, getSourceFilesystemConnection(fileMetadata)); } FileSystem sourceFilesystem = sourceFilesystemMap.get(uriString); if (fileMetadata.isFolder()) { if (!destFileSystem.exists(destPath) && sourceFilesystem.isDirectory(srcPath)) { destFileSystem.mkdirs(destPath, permission); if (preserveOwner) { destFileSystem.setOwner(destPath, fileMetadata.getOwner(), fileMetadata.getGroup()); } } return; } else if (!sourceFilesystem.exists(srcPath)) { LOG.warn("{} doesn't exist in source filesystem.", fileMetadata.getFullPath()); return; } FSDataInputStream inputStream = sourceFilesystem.open(srcPath, bufferSize); FSDataOutputStream outputStream = FileSystem.create(destFileSystem, destPath, permission); try { byte[] buf = new byte[bufferSize]; int len; while ((len = inputStream.read(buf)) >= 0) { outputStream.write(buf, 0, len); } } finally { try { inputStream.close(); } finally { outputStream.close(); if (preserveOwner) { destFileSystem.setOwner(destPath, fileMetadata.getOwner(), fileMetadata.getGroup()); } } } }
Source:
public VoltTable[] run(byte[] licenseBytes) throws InterruptedException, ExecutionException { log.info("Received user request to update database license."); VoltTable vt = constructResultTable(); Map<Integer, ClientResponse> result; result = callNTProcedureOnAllHosts("@LicenseValidation", licenseBytes).get(); String err = checkResult(result); if (err != null) { vt.addRow(VoltSystemProcedure.STATUS_FAILURE, err); return new VoltTable[] { vt }; } result = callNTProcedureOnAllHosts("@LiveLicenseUpdate").get(); err = checkResult(result); if (err != null) { vt.addRow(VoltSystemProcedure.STATUS_FAILURE, err); return new VoltTable[] { vt }; } log.info("License is updated successfully."); vt.addRow(VoltSystemProcedure.STATUS_OK, ""); return new VoltTable[] { vt }; }

Target:
public VoltTable[] run(byte[] licenseBytes) throws InterruptedException, ExecutionException { log.info("Received user request to update database license."); VoltTable vt = constructResultTable(); Map<Integer, ClientResponse> result; result = callNTProcedureOnAllHosts("@LicenseValidation", licenseBytes).get(); String err = checkResult(result); if (err != null) { vt.addRow(VoltSystemProcedure.STATUS_FAILURE, err); return new VoltTable[] { vt }; } result = callNTProcedureOnAllHosts("@LiveLicenseUpdate").get(); err = checkResult(result); if (err != null) { vt.addRow(VoltSystemProcedure.STATUS_FAILURE, err); return new VoltTable[] { vt }; } log.info("License updated successfully."); vt.addRow(VoltSystemProcedure.STATUS_OK, "SUCCESS"); return new VoltTable[] { vt }; }
Source:
private boolean updateWeatherData() { WeatherUndergroundConfiguration config = getConfigAs(WeatherUndergroundConfiguration.class); WeatherUndergroundBridgeHandler handler = null; if (this.getBridge() != null) { handler = (WeatherUndergroundBridgeHandler) this.getBridge().getHandler(); } if (handler != null) { weatherData = handler.getWeatherData(USUAL_FEATURES, StringUtils.trimToEmpty(config.location), this.localeProvider, this.gson); if (weatherData != null) { updateStatus(ThingStatus.ONLINE); } else { updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.OFFLINE.COMMUNICATION_ERROR); } } return weatherData != null; }

Target:
private boolean updateWeatherData() { WeatherUndergroundConfiguration config = getConfigAs(WeatherUndergroundConfiguration.class); WeatherUndergroundBridgeHandler handler = null; Bridge bridge = this.getBridge(); if (bridge != null) { handler = (WeatherUndergroundBridgeHandler) bridge.getHandler(); } if (handler != null) { weatherData = handler.getWeatherData(USUAL_FEATURES, StringUtils.trimToEmpty(config.location), this.localeProvider, this.gson); if (weatherData != null) { updateStatus(ThingStatus.ONLINE); } else { updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.OFFLINE.COMMUNICATION_ERROR); } } return weatherData != null; }
Source:
public int hashCode() { return Objects.hashCode(projectUuid, ceTaskUuid, analysisUuid); }

Target:
public int hashCode() { return Objects.hash(projectUuid, ceTaskUuid, analysisUuid); }
Source:
private boolean checkIfLeaderAlive() { String currJMV = currentJMVersion.get(); String blobJMV = blob.getJobModelVersion(); Iterable<ProcessorEntity> tableList = table.getEntitiesWithPartition(currJMV); ProcessorEntity leader = null, nextLeader = null; for (ProcessorEntity entity: tableList) { if (entity.getIsLeader()) { leader = entity; } } int currJMVInt = 0; if (!currJMV.equals(initialState)) { currJMVInt = Integer.valueOf(currJMV); } if (Integer.valueOf(blobJMV) > currJMVInt) { LOG.info("Leader info 2 in LeaderLivenessCheckScheduker: {}", leader); for (ProcessorEntity entity : table.getEntitiesWithPartition(blobJMV)) { if (entity.getIsLeader()) { nextLeader = entity; } } } if ((leader == null || (System.currentTimeMillis() - leader.getTimestamp().getTime() >= ( LIVENESS_DEBOUNCE_TIME_SEC * 1000))) && nextLeader == null) { return false; } return true; }

Target:
private boolean checkIfLeaderAlive() { String currJMV = currentJMVersion.get(); String blobJMV = blob.getJobModelVersion(); Iterable<ProcessorEntity> tableList = table.getEntitiesWithPartition(currJMV); ProcessorEntity leader = null, nextLeader = null; for (ProcessorEntity entity: tableList) { if (entity.getIsLeader()) { leader = entity; break; } } int currJMVInt = 0; if (!currJMV.equals(initialState)) { currJMVInt = Integer.valueOf(currJMV); } if (Integer.valueOf(blobJMV) > currJMVInt) { for (ProcessorEntity entity : table.getEntitiesWithPartition(blobJMV)) { if (entity.getIsLeader()) { nextLeader = entity; break; } } } if ((leader == null || (System.currentTimeMillis() - leader.getTimestamp().getTime() >= ( LIVENESS_DEBOUNCE_TIME_SEC * 1000))) && nextLeader == null) { return false; } return true; }
Source:
public synchronized int getType (Class<? extends AbstractRecord> c) { for (int i = 0; i < _map.size(); i++) { RecordTypeMap typeMap = _map.get(i); if (typeMap.getRecordClass() != null && typeMap.getRecordClass().equals(c)) return _map.get(i).getType(); } return RecordType.UNTYPED; }

Target:
public synchronized int getType (Class<? extends AbstractRecord> c) { for (int i = 0; i < _map.size(); i++) { Class<? extends AbstractRecord> recordClass = _map.get(i).getRecordClass(); if (recordClass != null && recordClass.equals(c)) return _map.get(i).getType(); } return RecordType.UNTYPED; }
Source:
private void flushStripe(FlushReason flushReason) throws IOException { List<OrcDataOutput> outputData = new ArrayList<>(); long stripeStartOffset = orcDataSink.size(); if (closedStripes.isEmpty()) { outputData.add(createDataOutput(MAGIC)); stripeStartOffset += MAGIC.length(); } try { outputData.addAll(bufferStripeData(stripeStartOffset, flushReason)); if (flushReason == CLOSED) { outputData.addAll(bufferFileFooter()); } orcDataSink.write(outputData); } catch (IOException e) { throw e; } finally { columnWriters.forEach(ColumnWriter::reset); dictionaryCompressionOptimizer.reset(); rowGroupRowCount = 0; stripeRowCount = 0; bufferedBytes = toIntExact(columnWriters.stream().mapToLong(ColumnWriter::getBufferedBytes).sum()); } }

Target:
private void flushStripe(FlushReason flushReason) throws IOException { List<OrcDataOutput> outputData = new ArrayList<>(); long stripeStartOffset = orcDataSink.size(); if (closedStripes.isEmpty()) { outputData.add(createDataOutput(MAGIC)); stripeStartOffset += MAGIC.length(); } try { outputData.addAll(bufferStripeData(stripeStartOffset, flushReason)); if (flushReason == CLOSED) { outputData.addAll(bufferFileFooter()); } orcDataSink.write(outputData); } finally { columnWriters.forEach(ColumnWriter::reset); dictionaryCompressionOptimizer.reset(); rowGroupRowCount = 0; stripeRowCount = 0; bufferedBytes = toIntExact(columnWriters.stream().mapToLong(ColumnWriter::getBufferedBytes).sum()); } }
Source:
public Optional<Argument> build(Type type, Object value, ConfigRegistry config) { return JdbiOptionals.findFirstPresent( () -> tryArray(type, value, config), () -> tryCollection(type, value, config) ); }

Target:
public Optional<Argument> build(Type type, Object value, ConfigRegistry config) { return IterableLike.elementTypeOf(type) .flatMap(config.get(SqlArrayTypes.class)::findFor) .map(arrayType -> arrayArgument(value, arrayType)); }
Source:
private List<GLJournalEntry> executePostGLJournalEntries(ParamsMap params) throws MambuApiException { ApiDefinition apiDefiinition = new ApiDefinition(APIData.GLJOURNALENTRIES, ContentType.WWW_FORM, Method.POST, GLJournalEntry.class, ApiReturnFormat.COLLECTION); List<GLJournalEntry> glEntries = serviceExecutor.execute(apiDefiinition, params); return glEntries; }

Target:
private List<GLJournalEntry> executePostGLJournalEntries(ParamsMap params) throws MambuApiException { ApiDefinition apiDefinition = new ApiDefinition(APIData.GLJOURNALENTRIES, ContentType.WWW_FORM, Method.POST, GLJournalEntry.class, ApiReturnFormat.COLLECTION); List<GLJournalEntry> glEntries = serviceExecutor.execute(apiDefinition, params); return glEntries; }
Source:
public CommandResult exec(ContextAwareCommandInvocation commandInvocation) { if (help) { commandInvocation.println(commandInvocation.getHelpInfo()); } return CommandResult.SUCCESS; }

Target:
public CommandResult exec(ContextAwareCommandInvocation commandInvocation) { commandInvocation.println(commandInvocation.getHelpInfo()); return CommandResult.SUCCESS; }
Source:
public HelixManagerProperty getHelixManagerProperty(String zkAddress, String clusterName) { ConfigAccessor configAccessor = new ConfigAccessor(zkAddress); CloudConfig cloudConfig = configAccessor.getCloudConfig(clusterName); if (cloudConfig == null) { CloudConfig.Builder builder = new CloudConfig.Builder(clusterName); builder.setCloudEnabled(false); cloudConfig = builder.build(); } Properties properties = new Properties(); try { InputStream stream = Thread.currentThread().getContextClassLoader() .getResourceAsStream(HELIX_PARTICIPANT_PROPERTY_FILE); properties.load(stream); } catch (IOException e) { String errMsg = String.format("failed to open Helix participant properties file: %s", HELIX_PARTICIPANT_PROPERTY_FILE); LOG.error(errMsg); throw new IllegalArgumentException(errMsg, e); } LOG.info("HelixPropertyFactory successfully loaded helix participant properties: {}", properties); return new HelixManagerProperty(properties, cloudConfig); }

Target:
public HelixManagerProperty getHelixManagerProperty(String zkAddress, String clusterName) { ConfigAccessor configAccessor = new ConfigAccessor(zkAddress); CloudConfig cloudConfig; try { cloudConfig = configAccessor.getCloudConfig(clusterName) == null ? buildEmptyCloudConfig(clusterName) : configAccessor.getCloudConfig(clusterName); } catch (HelixException e) { cloudConfig = buildEmptyCloudConfig(clusterName); } Properties properties = new Properties(); try { InputStream stream = Thread.currentThread().getContextClassLoader() .getResourceAsStream(HELIX_PARTICIPANT_PROPERTY_FILE); properties.load(stream); } catch (IOException e) { String errMsg = String.format("failed to open Helix participant properties file: %s", HELIX_PARTICIPANT_PROPERTY_FILE); throw new IllegalArgumentException(errMsg, e); } LOG.info("HelixPropertyFactory successfully loaded helix participant properties: {}", properties); return new HelixManagerProperty(properties, cloudConfig); }
Source:
private void migrateLabelsToAllProjects(ReviewDb db, LegacyLabelTypes labelTypes) throws SQLException, RepositoryNotFoundException, IOException, ConfigInvalidException { Repository git = mgr.openRepository(allProjects); try { MetaDataUpdate md = new MetaDataUpdate(GitReferenceUpdated.DISABLED, allProjects, git); md.getCommitBuilder().setAuthor(serverUser); md.getCommitBuilder().setCommitter(serverUser); ProjectConfig config = ProjectConfig.read(md); Map<String, LabelType> configTypes = config.getLabelSections(); List<LabelType> newTypes = Lists.newArrayList(); for (LegacyLabelType type : labelTypes.getLegacyLabelTypes()) { type.setId(null); if (!configTypes.containsKey(type.getName())) { newTypes.add(type); } } newTypes.addAll(configTypes.values()); configTypes.clear(); for (LabelType type : newTypes) { configTypes.put(type.getName(), type); } md.setMessage("Upgrade to Gerrit Code Review schema 77\n"); config.commit(md); } finally { git.close(); } }

Target:
private void migrateLabelsToAllProjects(ReviewDb db, LegacyLabelTypes labelTypes) throws SQLException, RepositoryNotFoundException, IOException, ConfigInvalidException { Repository git = mgr.openRepository(allProjects); try { MetaDataUpdate md = new MetaDataUpdate(GitReferenceUpdated.DISABLED, allProjects, git); md.getCommitBuilder().setAuthor(serverUser); md.getCommitBuilder().setCommitter(serverUser); ProjectConfig config = ProjectConfig.read(md); Map<String, LabelType> configTypes = config.getLabelSections(); List<LabelType> newTypes = Lists.newArrayList(); for (LegacyLabelType type : labelTypes.getLegacyLabelTypes()) { if (!configTypes.containsKey(type.getName())) { newTypes.add(type); } } newTypes.addAll(configTypes.values()); configTypes.clear(); for (LabelType type : newTypes) { configTypes.put(type.getName(), type); } md.setMessage("Upgrade to Gerrit Code Review schema 77\n"); config.commit(md); } finally { git.close(); } }
Source:
public ActionResult execute() { String courseId = getNonNullRequestParamValue(Const.ParamsNames.COURSE_ID); String feedbackSessionName = getNonNullRequestParamValue(Const.ParamsNames.FEEDBACK_SESSION_NAME); Intent intent = Intent.valueOf(getNonNullRequestParamValue(Const.ParamsNames.INTENT)); List<FeedbackQuestionAttributes> questions; try { switch (intent) { case STUDENT_SUBMISSION: questions = logic.getFeedbackQuestionsForStudents(feedbackSessionName, courseId); break; case INSTRUCTOR_SUBMISSION: InstructorAttributes instructor = getInstructorOfCourseFromRequest(courseId); questions = logic.getFeedbackQuestionsForInstructors(feedbackSessionName, courseId, instructor.getEmail()); break; case FULL_DETAIL: questions = logic.getFeedbackQuestionsForSession(feedbackSessionName, courseId); break; default: throw new InvalidHttpParameterException("Unknown intent " + intent); } } catch (EntityDoesNotExistException e) { throw new EntityNotFoundException(e); } String moderatedPerson = getRequestParamValue(Const.ParamsNames.FEEDBACK_SESSION_MODERATED_PERSON); if (!StringHelper.isEmpty(moderatedPerson)) { questions.removeIf(question -> !canInstructorSeeQuestion(question)); } FeedbackQuestions response = new FeedbackQuestions(questions); response.normalizeQuestionNumber(); return new JsonResult(response); }

Target:
public ActionResult execute() { String courseId = getNonNullRequestParamValue(Const.ParamsNames.COURSE_ID); String feedbackSessionName = getNonNullRequestParamValue(Const.ParamsNames.FEEDBACK_SESSION_NAME); Intent intent = Intent.valueOf(getNonNullRequestParamValue(Const.ParamsNames.INTENT)); List<FeedbackQuestionAttributes> questions; try { switch (intent) { case STUDENT_SUBMISSION: questions = logic.getFeedbackQuestionsForStudents(feedbackSessionName, courseId); break; case INSTRUCTOR_SUBMISSION: InstructorAttributes instructor = getInstructorOfCourseFromRequest(courseId); questions = logic.getFeedbackQuestionsForInstructors(feedbackSessionName, courseId, instructor.getEmail()); break; case FULL_DETAIL: questions = logic.getFeedbackQuestionsForSession(feedbackSessionName, courseId); break; default: throw new InvalidHttpParameterException("Unknown intent " + intent); } } catch (EntityDoesNotExistException e) { throw new EntityNotFoundException(e); } String moderatedPerson = getRequestParamValue(Const.ParamsNames.FEEDBACK_SESSION_MODERATED_PERSON); if (!StringHelper.isEmpty(moderatedPerson)) { questions.removeIf(question -> !canInstructorSeeQuestion(question)); } FeedbackQuestionsData response = new FeedbackQuestionsData(questions); response.normalizeQuestionNumber(); return new JsonResult(response); }
Source:
protected CallOptions getCallOptions() { if (callOptions.getDeadline() != null) { return callOptions; } MethodDescriptor<RequestT, ResponseT> methodDescriptor = rpc.getMethodDescriptor(); if (methodDescriptor == BigtableGrpc.getReadRowsMethod() && !CallOptionsFactory.ConfiguredCallOptionsFactory.isGet(request)) { return callOptions; } return callOptions.withDeadlineAfter(UNARY_DEADLINE_MINUTES, TimeUnit.MINUTES); }

Target:
protected CallOptions getCallOptions() { if (callOptions.getDeadline() != null) { return callOptions; } if (request instanceof ReadRowsRequest && !CallOptionsFactory.ConfiguredCallOptionsFactory.isGet((ReadRowsRequest) request)) { return callOptions; } return callOptions.withDeadlineAfter(UNARY_DEADLINE_MINUTES, TimeUnit.MINUTES); }
Source:
private static void cleanup() throws IOException { String[] directoryNames = { DatabaseDescriptor.getCommitLogLocation(), }; for (String dirName : directoryNames) { File dir = new File(dirName); if (!dir.exists()) throw new RuntimeException("No such directory: " + dir.getAbsolutePath()); FileUtils.deleteRecursive(dir); } for (String dirName : DatabaseDescriptor.getAllDataFileLocations()) { File dir = new File(dirName); if (!dir.exists()) throw new RuntimeException("No such directory: " + dir.getAbsolutePath()); FileUtils.deleteRecursive(dir); } }

Target:
private static void cleanup() throws IOException { rmdirs(DatabaseDescriptor.getCommitLogLocation()); rmdirs(DatabaseDescriptor.getAllDataFileLocations()); }
Source:
public void testHttpConnection() throws Exception { Server server = new Server(0); server.setHandler(new AddPointsHandler()); server.start(); URI uri = server.getURI(); DataPointReceiver dpr = new HttpDataPointProtobufReceiverFactory( new SignalFxEndpoint(uri.getScheme(), "127.0.0.1", uri.getPort())) .createDataPointReceiver(); dpr.addDataPoints(AUTH_TOKEN, Collections.singletonList( SignalFxProtocolBuffers.DataPoint.newBuilder().setSource("source").build())); server.stop(); }

Target:
public void testHttpConnection() throws Exception { Server server = new Server(0); server.setHandler(new AddPointsHandler()); server.start(); URI uri = server.getURI(); DataPointReceiver dpr = new HttpDataPointProtobufReceiverFactory( new SignalFxEndpoint(uri.getScheme(), uri.getHost(), uri.getPort())) .createDataPointReceiver(); dpr.addDataPoints(AUTH_TOKEN, Collections.singletonList( SignalFxProtocolBuffers.DataPoint.newBuilder().setSource("source").build())); server.stop(); }
Source:
public Map<String, String> getLabels() { final Map<String, String> labels = new HashMap<>(getCommonLabels()); labels.put(Constants.LABEL_COMPONENT_KEY, Constants.LABEL_COMPONENT_JOB_MANAGER); flinkConfig.getOptional(KubernetesConfigOptions.JOB_MANAGER_LABELS).ifPresent(labels::putAll); return Collections.unmodifiableMap(labels); }

Target:
public Map<String, String> getLabels() { final Map<String, String> labels = new HashMap<>(); labels.putAll(flinkConfig.getOptional(KubernetesConfigOptions.JOB_MANAGER_LABELS).orElse(Collections.emptyMap())); labels.putAll(getCommonLabels()); labels.put(Constants.LABEL_COMPONENT_KEY, Constants.LABEL_COMPONENT_JOB_MANAGER); return Collections.unmodifiableMap(labels); }