auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public Object execute(ExecutionEvent event) throws ExecutionException { Shell activeShell= HandlerUtil.getActiveShell(event); Object newNameValue= HandlerUtil.getVariable(event, LTK_RENAME_COMMAND_NEWNAME_PARAMETER_KEY); String newName= null; if (newNameValue instanceof String) { newName= (String) newNameValue; } else if (newNameValue != null) { RefactoringUIPlugin.logErrorMessage(NLS.bind(RefactoringUIMessages.RenameResourceHandler_ERROR_EXPECTED_STRING, newNameValue.getClass().getName())); } ISelection sel= HandlerUtil.getCurrentSelection(event); if (sel instanceof IStructuredSelection) { IResource resource= getCurrentResource((IStructuredSelection) sel); if (resource != null) { RenameResourceWizard refactoringWizard; Change change= null; RefactoringProcessor processor= null; if (newName != null) { refactoringWizard= new RenameResourceWizard(resource, newName); processor= ((ProcessorBasedRefactoring) refactoringWizard.getRefactoring()).getProcessor(); change= getChange(refactoringWizard); refactoringWizard= new RenameResourceWizard(resource, newName); } else { refactoringWizard= new RenameResourceWizard(resource); } try { if (newName == null || change == null || isCompositeChange(change) || !(processor instanceof RenameResourceProcessor)) { RefactoringWizardOpenOperation op= new RefactoringWizardOpenOperation(refactoringWizard); op.run(activeShell, RefactoringUIMessages.RenameResourceHandler_title); } else { change.perform(new NullProgressMonitor()); } } catch (InterruptedException | CoreException e) { RefactoringUIPlugin.log(e); } } } return null; }

Target:
public Object execute(ExecutionEvent event) throws ExecutionException { Shell activeShell= HandlerUtil.getActiveShell(event); Object newNameValue= HandlerUtil.getVariable(event, LTK_RENAME_COMMAND_NEWNAME_PARAMETER_KEY); String newName= null; if (newNameValue instanceof String) { newName= (String) newNameValue; } else if (newNameValue != null) { RefactoringUIPlugin.logErrorMessage(NLS.bind(RefactoringUIMessages.RenameResourceHandler_ERROR_EXPECTED_STRING, newNameValue.getClass().getName())); } ISelection sel= HandlerUtil.getCurrentSelection(event); if (sel instanceof IStructuredSelection) { IResource resource= getCurrentResource((IStructuredSelection) sel); if (resource != null) { RenameResourceWizard refactoringWizard; Change change= null; RefactoringProcessor processor= null; if (newName != null) { refactoringWizard= new RenameResourceWizard(resource, newName); processor= ((ProcessorBasedRefactoring) refactoringWizard.getRefactoring()).getProcessor(); change= getChange(refactoringWizard); refactoringWizard= new RenameResourceWizard(resource, newName); } else { refactoringWizard= new RenameResourceWizard(resource); } try { if (newName == null || change == null || isCompositeChange(change) || !(processor instanceof RenameResourceProcessor)) { RefactoringWizardOpenOperation op= new RefactoringWizardOpenOperation(refactoringWizard); op.run(activeShell, RefactoringUIMessages.RenameResourceHandler_title); } else { change.perform(new NullProgressMonitor()); } } catch (InterruptedException | CoreException e) { } } } return null; }
Source:
public static Map<SystemStreamPartition, String> readOffsetFile(File storagePartitionDir, Set<SystemStreamPartition> storeSSPs) { Map<SystemStreamPartition, String> offsets = null; String fileContents; File offsetFileRef = new File(storagePartitionDir, OFFSET_FILE_NAME); String storePath = storagePartitionDir.getPath(); if (offsetFileRef.exists()) { LOG.info("Found offset file in storage partition directory: {}", storePath); try { fileContents = FileUtil.readWithChecksum(offsetFileRef); try { offsets = OBJECT_MAPPER.readValue(fileContents, OFFSETS_TYPE_REFERENCE); } catch (JsonParseException | JsonMappingException e) { LOG.info("Exception in json-parsing offset file {}, reading as string offset-value", storagePartitionDir.toPath(), OFFSET_FILE_NAME); offsets = (storeSSPs.size() == 1) ? storeSSPs.stream().collect(Collectors.toMap(x -> x, y -> fileContents)) : null; } catch (IOException e) { LOG.info("Exception in json-parsing offset file {}, reading as string offset-value", storagePartitionDir.toPath(), OFFSET_FILE_NAME); offsets = (storeSSPs.size() == 1) ? storeSSPs.stream().collect(Collectors.toMap(x -> x, y -> fileContents)) : null; } } catch (Exception e) { LOG.warn("Failed to read offset file in storage partition directory: {}", storePath, e); } } else { LOG.info("No offset file found in storage partition directory: {}", storePath); } return offsets; }

Target:
public static Map<SystemStreamPartition, String> readOffsetFile(File storagePartitionDir, Set<SystemStreamPartition> storeSSPs) { Map<SystemStreamPartition, String> offsets = new HashMap<>(); String fileContents = null; File offsetFileRef = new File(storagePartitionDir, OFFSET_FILE_NAME); String storePath = storagePartitionDir.getPath(); if (offsetFileRef.exists()) { LOG.info("Found offset file in storage partition directory: {}", storePath); try { fileContents = FileUtil.readWithChecksum(offsetFileRef); offsets = OBJECT_MAPPER.readValue(fileContents, OFFSETS_TYPE_REFERENCE); } catch (JsonParseException | JsonMappingException e) { LOG.info("Exception in json-parsing offset file {}, reading as string offset-value", storagePartitionDir.toPath(), OFFSET_FILE_NAME); final String finalFileContents = fileContents; offsets = (storeSSPs.size() == 1) ? storeSSPs.stream().collect(Collectors.toMap(ssp -> ssp, offset -> finalFileContents)) : offsets; } catch (Exception e) { LOG.warn("Failed to read offset file in storage partition directory: {}", storePath, e); } } else { LOG.info("No offset file found in storage partition directory: {}", storePath); } return offsets; }
Source:
public void testSaveSettingsEmptyProperty() throws BundleException { SettingsDto dto = new SettingsDto(); dto.setTaskPossibleErrors(null); dto.setTaskLogActivities(null); controller.saveSettings(dto); verify(settingsFacade, never()).setProperty(eq(TASK_LOG_ACTIVITIES_KEY), anyString()); verify(settingsFacade, times(1)).setProperty(eq(TASK_POSSIBLE_ERRORS_KEY), anyString()); }

Target:
public void testSaveSettingsEmptyProperty() throws BundleException { SettingsDto dto = new SettingsDto(); dto.setTaskPossibleErrors(null); dto.setTaskLogActivities(null); controller.saveSettings(dto); }
Source:
public int hashCode() { return hash; }

Target:
public int hashCode() { int result = ntCall.key.hashCode(); result = 31 * result + stateBegin; result = 31 * result + state.hashCode(); return result; }
Source:
private void processCheckpoint(StreamAddressSpace streamAddressSpace, Function<ILogData, BackpointerOp> filter, NavigableSet<Long> queue) { List<Long> checkpointAddresses = new ArrayList<>(); streamAddressSpace.getAddressMap().forEach(checkpointAddresses::add); checkpointAddresses.sort(Collections.reverseOrder()); Iterable<List<Long>> batches = Iterables.partition(checkpointAddresses, runtime.getParameters().getCheckpointReadBatchSize()); boolean checkpointResolved = false; for (List<Long> batch : batches) { if (checkpointResolved) { break; } try { List<ILogData> entries = readAll(batch); for (ILogData data : entries) { checkpointResolved = filterCheckpointEntry(data, filter, queue); if (checkpointResolved) { break; } } } catch (TrimmedException te) { checkpointResolved = processCheckpointBatchByEntry(batch, filter, queue); } } }

Target:
private void processCheckpoint(StreamAddressSpace streamAddressSpace, Function<ILogData, BackpointerOp> filter, NavigableSet<Long> queue) { SortedSet<Long> checkpointAddresses = new TreeSet<>(Collections.reverseOrder()); streamAddressSpace.getAddressMap().forEach(checkpointAddresses::add); Iterable<List<Long>> batches = Iterables.partition(checkpointAddresses, runtime.getParameters().getCheckpointReadBatchSize()); boolean checkpointResolved = false; for (List<Long> batch : batches) { if (checkpointResolved) { break; } try { List<ILogData> entries = readAll(batch); for (ILogData data : entries) { checkpointResolved = filterCheckpointEntry(data, filter, queue); if (checkpointResolved) { break; } } } catch (TrimmedException te) { checkpointResolved = processCheckpointBatchByEntry(batch, filter, queue); } } }
Source:
public String extractAttributeValueString(Attribute attrib) { StringBuilder strBuilder = new StringBuilder(); if (attrib != null) { List<XMLObject> attrVals = attrib.getAttributeValues(); for (Object o : attrVals) { if (o instanceof org.w3c.dom.Element) { org.w3c.dom.Element elem = (org.w3c.dom.Element) o; strBuilder.append(elem.getTextContent()); break; } else if (o instanceof String) { strBuilder.append(o + " "); } else if (o instanceof XSStringImpl) { strBuilder.append(((XSStringImpl) o).getValue()); } } } return strBuilder.toString().trim(); }

Target:
public String extractAttributeValueString(Attribute attrib) { StringBuilder strBuilder = new StringBuilder(); if (attrib != null) { List<XMLObject> attrVals = attrib.getAttributeValues(); for (Object o : attrVals) { if (o instanceof org.w3c.dom.Element) { org.w3c.dom.Element elem = (org.w3c.dom.Element) o; strBuilder.append(elem.getTextContent()); break; } else if (o instanceof String) { strBuilder.append(o).append(" "); } else if (o instanceof XSStringImpl) { strBuilder.append(((XSStringImpl) o).getValue()); } } } return strBuilder.toString().trim(); }
Source:
public static void watch(Thread thread, Runnable task) { ObjectUtil.checkNotNull(thread, "thread"); if (!thread.isAlive()) { throw new IllegalArgumentException("thread must be alive."); } schedule(thread, ObjectUtil.checkNotNull(task, "task"), true); }

Target:
public static void watch(Thread thread, Runnable task) { ObjectUtil.checkNotNull(thread, "thread"); ObjectUtil.checkNotNull(task, "task"); if (!thread.isAlive()) { throw new IllegalArgumentException("thread must be alive."); } schedule(thread, task, true); }
Source:
private static void transferChunk(Layout layout, CorfuRuntime runtime, String endpoint, List<Long> chunk) { long ts1 = System.currentTimeMillis(); Map<Long, ILogData> dataMap = runtime.getAddressSpaceView() .fetchAll(chunk, true); long ts2 = System.currentTimeMillis(); log.info("stateTransfer: read [{}-{}] in ms", chunk.get(0), chunk.get(chunk.size() - 1), (ts2 - ts1)); List<LogData> entries = new ArrayList<>(); for (long address : chunk) { if (!dataMap.containsKey(address)) { log.error("Missing address in batch {}", address, chunk); throw new IllegalStateException("Missing address"); } entries.add((LogData) dataMap.get(address)); } ts1 = System.currentTimeMillis(); boolean transferSuccess = CFUtils.getUninterruptibly(runtime.getLayoutView() .getRuntimeLayout(layout) .getLogUnitClient(endpoint) .writeRange(entries), OverwriteException.class); ts2 = System.currentTimeMillis(); if (!transferSuccess) { log.error("stateTransfer: Failed to transfer to {}", chunk, endpoint); throw new IllegalStateException("Failed to transfer!"); } log.info("stateTransfer: Transferred address chunk [{}-{}] to in ms", chunk.get(0), chunk.get(chunk.size() - 1), endpoint, (ts2 - ts1)); }

Target:
private static void transferChunk(Layout layout, CorfuRuntime runtime, String endpoint, List<Long> chunk) { if (chunk.isEmpty()) { return; } long ts1 = System.currentTimeMillis(); Map<Long, ILogData> dataMap = runtime.getAddressSpaceView() .fetchAll(chunk, true); long ts2 = System.currentTimeMillis(); log.info("stateTransfer: read [{}-{}] in ms", chunk.get(0), chunk.get(chunk.size() - 1), (ts2 - ts1)); List<LogData> entries = new ArrayList<>(); for (long address : chunk) { if (!dataMap.containsKey(address)) { log.error("Missing address in batch {}", address, chunk); throw new IllegalStateException("Missing address"); } entries.add((LogData) dataMap.get(address)); } try { ts1 = System.currentTimeMillis(); boolean transferSuccess = CFUtils.getUninterruptibly(runtime.getLayoutView() .getRuntimeLayout(layout) .getLogUnitClient(endpoint) .writeRange(entries), OverwriteException.class); ts2 = System.currentTimeMillis(); if (!transferSuccess) { log.error("stateTransfer: Failed to transfer to {}", chunk, endpoint); throw new IllegalStateException("Failed to transfer!"); } } catch (OverwriteException oe) { log.error("stateTransfer: Overwrite Exception on transfer of chunk: {}", chunk); throw oe; } log.info("stateTransfer: Transferred address chunk [{}-{}] to in ms", chunk.get(0), chunk.get(chunk.size() - 1), endpoint, (ts2 - ts1)); }
Source:
static URI relativize(URI current, URI target) { String slash = "/"; if (!target.toString().equals(target.getPath())) { return target; } if (!current.toString().equals(current.getPath())) { return target; } String cur = current.normalize().getPath(); String dest = target.normalize().getPath(); if (cur.startsWith(slash) != dest.startsWith(slash)) { return target; } while (cur.startsWith(slash)) { cur = cur.substring(1); } while (dest.startsWith(slash)) { dest = dest.substring(1); } if (cur.indexOf('/') == -1 || dest.indexOf('/') == -1) { String prefix = "prefix/"; cur = prefix + cur; dest = prefix + dest; } if (!cur.endsWith(slash)) { int lastSlash = cur.lastIndexOf('/'); cur = cur.substring(0, lastSlash); } String destFile = ""; if (!dest.endsWith(slash)) { int lastSlash = dest.lastIndexOf('/'); destFile = dest.substring(lastSlash + 1, dest.length()); dest = dest.substring(0, dest.lastIndexOf('/')); } String[] cs = cur.split(slash); String[] ds = dest.split(slash); int common = 0; while (common < cs.length && common < ds.length && cs[common].equals(ds[common])) { common++; } StringJoiner j = new StringJoiner(slash); for (int i = common; i < cs.length; i++) { j.add(".."); } for (int i = common; i < ds.length; i++) { j.add(ds[i]); } j.add(destFile); return URI.create(j.toString()); }

Target:
static URI relativize(URI current, URI target) { if (!target.toString().equals(target.getPath())) { return target; } if (!current.toString().equals(current.getPath())) { return target; } String cur = current.normalize().getPath(); String dest = target.normalize().getPath(); if (cur.startsWith(SLASH) != dest.startsWith(SLASH)) { return target; } while (cur.startsWith(SLASH)) { cur = cur.substring(1); } while (dest.startsWith(SLASH)) { dest = dest.substring(1); } if (cur.indexOf('/') == -1 || dest.indexOf('/') == -1) { String prefix = "prefix/"; cur = prefix + cur; dest = prefix + dest; } if (!cur.endsWith(SLASH)) { int lastSlash = cur.lastIndexOf('/'); cur = cur.substring(0, lastSlash); } String destFile = ""; if (!dest.endsWith(SLASH)) { int lastSlash = dest.lastIndexOf('/'); destFile = dest.substring(lastSlash + 1, dest.length()); dest = dest.substring(0, dest.lastIndexOf('/')); } String[] cs = cur.split(SLASH); String[] ds = dest.split(SLASH); int common = 0; while (common < cs.length && common < ds.length && cs[common].equals(ds[common])) { common++; } StringJoiner j = new StringJoiner(SLASH); for (int i = common; i < cs.length; i++) { j.add(".."); } for (int i = common; i < ds.length; i++) { j.add(ds[i]); } j.add(destFile); return URI.create(j.toString()); }
Source:
default List<MessageFilter<Message>> filters() { List<Filter> list = getFilterList(); return ImmutableList.copyOf(list); }

Target:
default List<MessageFilter<Message>> filters() { List<Filter> filterList = getFilterList(); @SuppressWarnings("unchecked") List<MessageFilter<Message>> list = (List<MessageFilter<Message>>) (List<?>) filterList; return list; }
Source:
public void click(final MouseEvent event) { if (getHost() instanceof CollapseHandlePart) { @SuppressWarnings("unchecked") final CompartmentContentPart<?, ?> compartment = VisualPartUtil.findParentVisualPartInstance(getHost().getAnchorages().keys() .iterator().next(), CompartmentContentPart.class); if (null != compartment && compartment.isCanCollapse()) { final boolean valueToSet = !compartment.isCollapsed(); final DrawerStyle drawerStyle = getcreateDrawerStyle(compartment); final SetRequest setRequest = new SetRequest(drawerStyle, NotationPackage.Literals.DRAWER_STYLE__COLLAPSED, valueToSet); final IElementEditService provider = ElementEditServiceUtils.getCommandProvider(drawerStyle); if (provider != null) { final CompositeCommand collapseCommand = new CompositeCommand("Collapse element"); collapseCommand.add(provider.getEditCommand(setRequest)); AdapterFactoryEditingDomain.getEditingDomainFor(drawerStyle).getCommandStack().execute(new GMFtoEMFCommandWrapper(collapseCommand)); } } } }

Target:
public void click(final MouseEvent event) { if (getHost() instanceof CollapseHandlePart) { @SuppressWarnings("unchecked") final CompartmentContentPart<?, ?> compartment = VisualPartUtil.findParentVisualPartInstance(getHost().getAnchorages().keys() .iterator().next(), CompartmentContentPart.class); if (null != compartment && compartment.isCanCollapse()) { final boolean valueToSet = !compartment.isCollapsed(); final DrawerStyle drawerStyle = getCreateDrawerStyle(compartment); final SetRequest setRequest = new SetRequest(drawerStyle, NotationPackage.Literals.DRAWER_STYLE__COLLAPSED, valueToSet); final IElementEditService provider = ElementEditServiceUtils.getCommandProvider(drawerStyle); if (provider != null) { final CompositeCommand collapseCommand = new CompositeCommand("Collapse element"); collapseCommand.add(provider.getEditCommand(setRequest)); AdapterFactoryEditingDomain.getEditingDomainFor(drawerStyle).getCommandStack().execute(new GMFtoEMFCommandWrapper(collapseCommand)); } } } }
Source:
void handleOnNewIntent(Uri uri) { if (uri == null || !REACT_TWITTER_OAUTH_SCHEME.equals(uri.getScheme())) { return; } intentModule.handleOnNewIntent(uri); }

Target:
void handleOnNewIntent(Uri uri) { if (!isUriValid(uri)) { return; } intentModule.handleOnNewIntent(uri); }
Source:
public Spec spec() { try { return new Spec.Simple( new JdkRequest(UriBuilder.fromUri(this.home).build()) .header(HttpHeaders.ACCEPT, MediaType.APPLICATION_XML) .header(HttpHeaders.AUTHORIZATION, this.token) .method(Request.GET) .fetch() .as(RestResponse.class) .assertStatus(HttpURLConnection.HTTP_OK) .as(XmlResponse.class) .xml() .xpath("/page/rule/spec/text()") .get(0) ); } catch (IOException ex) { throw new IllegalStateException(ex); } }

Target:
public Spec spec() { try { return new Spec.Simple( new JdkRequest(this.home) .header(HttpHeaders.ACCEPT, MediaType.APPLICATION_XML) .header(HttpHeaders.AUTHORIZATION, this.token) .fetch() .as(RestResponse.class) .assertStatus(HttpURLConnection.HTTP_OK) .as(XmlResponse.class) .xml() .xpath("/page/rule/spec/text()") .get(0) ); } catch (IOException ex) { throw new IllegalStateException(ex); } }
Source:
public JSONObject getTranslation( JSONObject query ) { JSONObject result = null; try { String service = query.getString("service"); if ( service.equals( "google" ) ) { String text = query.getString("text"); String target = query.getString("target"); ConfigPropertiesUtil configUtil = new ConfigPropertiesUtil(); Properties properties = configUtil.getConfigProperties(); String translationApiKey = properties.getProperty(TRANSLATE_API_KEY); result = translateGoogle( text, target, translationApiKey ); } } catch ( JSONException e ) { LOGGER.error( "Incorrect Configuration for Translation API", e ); } catch ( ConfigException e ) { LOGGER.error( "Error with internal configuration properties", e ); } return result; }

Target:
public JSONObject getTranslation( JSONObject query ) { JSONObject result = null; try { String service = query.getString("service"); String text = query.getString("text"); String target = query.getString("target"); if ( StringUtils.equalsIgnoreCase( service, "google" ) ) { Properties properties = _service.getConfigProperties(); if ( properties != null ) { String translationApiKey = properties.getProperty(TRANSLATE_API_KEY); String translationApiEndpoint = properties.getProperty(TRANSLATE_API_ENDPOINT); if ( translationApiKey != null && translationApiEndpoint != null ) { result = translateGoogle( text, target, translationApiKey, translationApiEndpoint ); } } } if ( result == null ){ JSONObject resultErr = new JSONObject(); resultErr.put("message", "Incorrect Translation Service Configuration"); result = new JSONObject(); result.put("error", resultErr); } } catch ( JSONException e ) { LOGGER.error( "Incorrect Configuration for Translation API", e ); } catch ( ConfigException e ) { LOGGER.error( "Error with internal configuration properties", e ); } return result; }
Source:
protected int initializeConsumers() { int count = 0; synchronized (this.consumersMonitor) { if (this.consumers == null) { this.consumers = new HashMap<BlockingQueueConsumer, Boolean>(this.concurrentConsumers); cancellationLock.reset(); while (this.consumers.size() < this.concurrentConsumers) { BlockingQueueConsumer consumer = createBlockingQueueConsumer(); this.consumers.put(consumer, true); count++; } } } return count; }

Target:
protected int initializeConsumers() { int count = 0; synchronized (this.consumersMonitor) { if (this.consumers == null) { cancellationLock.reset(); this.consumers = new HashMap<BlockingQueueConsumer, Boolean>(this.concurrentConsumers); for (int i = 0; i < this.concurrentConsumers; i++) { BlockingQueueConsumer consumer = createBlockingQueueConsumer(); this.consumers.put(consumer, true); count++; } } } return count; }
Source:
public Set<String> getVolumes(@Nonnull EnvVars launchEnv, String objectId) throws IOException, InterruptedException { LaunchResult result = launch(launchEnv, true, "inspect", objectId); if (result.getStatus() != 0) { return Collections.EMPTY_SET; } JsonParser parser = new JsonParser(); JsonElement information = parser.parse(result.getOut()); JsonObject volumes = information.getAsJsonArray().get(0).getAsJsonObject().getAsJsonObject("Config").getAsJsonObject("Volumes"); Gson gson = new Gson(); Type volumesMapType = new TypeToken<Map<String, JsonElement>>(){}.getType(); Map<String, JsonElement> volumesMap = gson.fromJson(volumes, volumesMapType); return volumesMap.keySet(); }

Target:
public List<String> getVolumes(@Nonnull EnvVars launchEnv, String objectId) throws IOException, InterruptedException { LaunchResult result = launch(launchEnv, true, "inspect", "-f", "{{range $index, $element := .Config.Volumes}}{{$index}}\n{{end}}", objectId); if (result.getStatus() != 0) { return Collections.EMPTY_LIST; } String volumes = result.getOut(); return Arrays.asList(volumes.split("\\n")); }
Source:
private HttpClientRequest doRequest(HttpMethod method, String host, int port, String relativeURI, MultiMap headers) { Objects.requireNonNull(method, "no null method accepted"); Objects.requireNonNull(host, "no null host accepted"); Objects.requireNonNull(relativeURI, "no null relativeURI accepted"); checkClosed(); ProxyOptions proxyOptions = options.getProxyOptions(); if (!options.isSsl() && proxyOptions != null && proxyOptions.getType() == ProxyType.HTTP) { if (headers == null) { headers = MultiMap.caseInsensitiveMultiMap(); } relativeURI = "http://" + host + (port != 80 ? ":" + port : "") + relativeURI; host = proxyOptions.getHost(); port = proxyOptions.getPort(); log.debug("changing request to proxy request " + relativeURI); log.debug("username "+proxyOptions.getUsername()+" password "+proxyOptions.getPassword()); if (proxyOptions.getUsername() != null && proxyOptions.getPassword() != null) { log.debug("adding authorization header"); headers.add("Proxy-Authorization", "Basic " + Base64.getEncoder() .encodeToString((proxyOptions.getUsername() + ":" + proxyOptions.getPassword()).getBytes())); } headers.add("Host", host + (port != 80 ? ":" + port : "")); } HttpClientRequest req = new HttpClientRequestImpl(this, method, host, port, options.isSsl(), relativeURI, vertx); if (headers != null) { req.headers().setAll(headers); } return req; }

Target:
private HttpClientRequest doRequest(HttpMethod method, String host, int port, String relativeURI, MultiMap headers) { Objects.requireNonNull(method, "no null method accepted"); Objects.requireNonNull(host, "no null host accepted"); Objects.requireNonNull(relativeURI, "no null relativeURI accepted"); checkClosed(); String connectHost; int connectPort; ProxyOptions proxyOptions = options.getProxyOptions(); final boolean useProxy = !options.isSsl() && proxyOptions != null && proxyOptions.getType() == ProxyType.HTTP; if (useProxy) { relativeURI = "http://" + host + (port != 80 ? ":" + port : "") + relativeURI; connectHost = proxyOptions.getHost(); connectPort = proxyOptions.getPort(); if (proxyOptions.getUsername() != null && proxyOptions.getPassword() != null) { if (headers == null) { headers = MultiMap.caseInsensitiveMultiMap(); } headers.add("Proxy-Authorization", "Basic " + Base64.getEncoder() .encodeToString((proxyOptions.getUsername() + ":" + proxyOptions.getPassword()).getBytes())); } } else { connectHost = host; connectPort = port; } HttpClientRequest req = new HttpClientRequestImpl(this, method, connectHost, connectPort, options.isSsl(), relativeURI, vertx); if (useProxy) { req.setHost(host + (port != 80 ? ":" + port : "")); } if (headers != null) { req.headers().setAll(headers); } return req; }
Source:
public static List<Pair<RelNode, List<RelOptMaterialization>>> useMaterializedViews( final RelNode rel, List<RelOptMaterialization> materializations) { return useMaterializedViews(rel, materializations, null); }

Target:
public static List<Pair<RelNode, List<RelOptMaterialization>>> useMaterializedViews( final RelNode rel, List<RelOptMaterialization> materializations) { return useMaterializedViews(rel, materializations, ImmutableList.of()); }
Source:
public static OperationModel createModel( VisibilityPredicate visibility, ReflectionPredicate reflectionPredicate, List<Pattern> omitMethods, Set<@ClassGetName String> classnames, Set<@ClassGetName String> coveredClassesGoalNames, ClassNameErrorHandler errorHandler, List<String> literalsFileList, SpecificationCollection operationSpecifications) throws SignatureParseException, NoSuchMethodException { OperationModel model = new OperationModel(); model.omitMethods = omitMethods; model.addClassTypes( visibility, reflectionPredicate, classnames, coveredClassesGoalNames, errorHandler, literalsFileList); OmitMethodsPredicate omitPredicate = new OmitMethodsPredicate(omitMethods); model.omitMethodsPredicate = omitPredicate; model.addOperationsFromClasses( model.classTypes, visibility, reflectionPredicate, omitPredicate, operationSpecifications); model.addOperationsUsingSignatures( GenInputsAbstract.methodlist, visibility, reflectionPredicate, omitPredicate); model.addObjectConstructor(); return model; }

Target:
public static OperationModel createModel( VisibilityPredicate visibility, ReflectionPredicate reflectionPredicate, List<Pattern> omitMethods, Set<@ClassGetName String> classnames, Set<@ClassGetName String> coveredClassesGoalNames, ClassNameErrorHandler errorHandler, List<String> literalsFileList, SpecificationCollection operationSpecifications) throws SignatureParseException, NoSuchMethodException { OperationModel model = new OperationModel(); model.omitMethods = omitMethods; model.addClassTypes( visibility, reflectionPredicate, classnames, coveredClassesGoalNames, errorHandler, literalsFileList); model.omitMethodsPredicate = new OmitMethodsPredicate(omitMethods); model.addOperationsFromClasses( model.classTypes, visibility, reflectionPredicate, operationSpecifications); model.addOperationsUsingSignatures( GenInputsAbstract.methodlist, visibility, reflectionPredicate); model.addObjectConstructor(); return model; }
Source:
@DataBoundSetter public final void setParameterDefinitions(List<ParameterDefinition> parameterDefinitions) { this.parameterDefinitions = parameterDefinitions; }

Target:
public final void setParameterDefinitions(List<ParameterDefinition> parameterDefinitions) { this.parameterDefinitions = parameterDefinitions; }
Source:
private static BackgroundHiveSplitLoader backgroundHiveSplitLoaderOfflinePartitions() throws Exception { ConnectorSession connectorSession = new TestingConnectorSession( new HiveSessionProperties(new HiveClientConfig().setMaxSplitSize(new DataSize(1.0, GIGABYTE))).getSessionProperties()); return new BackgroundHiveSplitLoader( SIMPLE_TABLE, createPartitionMetadataWithOfflinePartitions(), TupleDomain.all(), createBucketSplitInfo(Optional.empty(), ImmutableList.of()), connectorSession, new TestingHdfsEnvironment(), new NamenodeStats(), new TestingDirectoryLister(TEST_FILES), directExecutor(), 2, false); }

Target:
private static BackgroundHiveSplitLoader backgroundHiveSplitLoaderOfflinePartitions() { ConnectorSession connectorSession = new TestingConnectorSession( new HiveSessionProperties(new HiveClientConfig().setMaxSplitSize(new DataSize(1.0, GIGABYTE))).getSessionProperties()); return new BackgroundHiveSplitLoader( SIMPLE_TABLE, createPartitionMetadataWithOfflinePartitions(), TupleDomain.all(), createBucketSplitInfo(Optional.empty(), ImmutableList.of()), connectorSession, new TestingHdfsEnvironment(), new NamenodeStats(), new TestingDirectoryLister(TEST_FILES), directExecutor(), 2, false); }
Source:
protected Message<?> toMessage(EventObject event) { EntryEventMessagePayload<?, ?> messagePayload = null; final Map<String, Object> headers = new HashMap<String, Object>(); headers.put(HazelcastHeaders.EVENT, ((AbstractIMapEvent) event).getEventType()); headers.put(HazelcastHeaders.MEMBER, ((AbstractIMapEvent) event).getMember()); headers.put(HazelcastHeaders.NAME, ((AbstractIMapEvent) event).getName()); if (event instanceof EntryEvent) { Assert.notNull(((EntryEvent) event).getKey(), "key must not be null"); messagePayload = new EntryEventMessagePayload( ((EntryEvent) event).getKey(), ((EntryEvent) event).getValue(), ((EntryEvent) event).getOldValue()); } else if (event instanceof MapEvent) { messagePayload = new EntryEventMessagePayload(((MapEvent) event).getNumberOfEntriesAffected()); } else { throw new IllegalStateException("Invalid event is received. Event : " + event); } return getMessageBuilderFactory().withPayload(messagePayload).copyHeaders(headers).build(); }

Target:
protected Message<?> toMessage(EventObject event) { final Map<String, Object> headers = new HashMap<String, Object>(); headers.put(HazelcastHeaders.EVENT_TYPE, ((AbstractIMapEvent) event).getEventType().name()); headers.put(HazelcastHeaders.MEMBER, ((AbstractIMapEvent) event).getMember().getSocketAddress()); headers.put(HazelcastHeaders.CACHE_NAME, ((AbstractIMapEvent) event).getName()); if (event instanceof EntryEvent) { Assert.notNull(((EntryEvent) event).getKey(), "key must not be null"); EntryEventMessagePayload<?, ?> messagePayload = new EntryEventMessagePayload( ((EntryEvent) event).getKey(), ((EntryEvent) event).getValue(), ((EntryEvent) event).getOldValue()); return getMessageBuilderFactory().withPayload(messagePayload).copyHeaders(headers).build(); } else if (event instanceof MapEvent) { return getMessageBuilderFactory() .withPayload(((MapEvent) event).getNumberOfEntriesAffected()).copyHeaders(headers).build(); } else { throw new IllegalStateException("Invalid event is received. Event : " + event); } }
Source:
public List<NuxeoOAuth2Token> getProviderUserTokens(@Context HttpServletRequest request) { String nxuser = request.getUserPrincipal().getName(); return getTokens(nxuser).stream() .filter(token -> token.getClientId() == null).collect(Collectors.toList()); }

Target:
public List<NuxeoOAuth2Token> getProviderUserTokens(@Context HttpServletRequest request) { checkNotAnonymousUser(); String nxuser = request.getUserPrincipal().getName(); return getTokens(nxuser).stream() .filter(token -> token.getClientId() == null).collect(Collectors.toList()); }
Source:
private static String getIommu(CpuVendor cpuVendor, boolean iommu) { if (!iommu) { return ""; } switch (cpuVendor) { case AMD: return "amd_iommu=1 "; case INTEL: return "intel_iommu=1 "; case IBM: return ""; default: throw new RuntimeException("Unknown CpuType: " + cpuVendor); } }

Target:
private static String getIommu(CpuVendor cpuVendor, boolean iommu) { if (!iommu) { return ""; } switch (cpuVendor) { case AMD: return "amd_iommu=on "; case INTEL: return "intel_iommu=on "; case IBM: return ""; default: throw new RuntimeException("Unknown CpuType: " + cpuVendor); } }
Source:
public void action() throws Exception { log("Create an remove an empty local node source with time slot policy"); createEmptyNodeSource(EMPTY_NODE_SOURCE_NAME); removeNodeSource(EMPTY_NODE_SOURCE_NAME); log("Create a local node source with " + NODES_NUMBER + " nodes with time slot policy"); createDefaultNodeSource(NODE_SOURCE_NAME); log("Waiting for the time slot policy to remove the nodes"); repeater.accept(NODES_NUMBER, () -> this.rmHelper.waitForAnyNodeEvent(RMEventType.NODE_REMOVED)); log("Waiting for the time slot policy to add the nodes again"); RMTHelper.waitForNodesToBeUp(NODES_NUMBER, this.monitorsHandler); log("Waiting for the time slot policy to remove the nodes again"); repeater.accept(NODES_NUMBER, () -> this.rmHelper.waitForAnyNodeEvent(RMEventType.NODE_REMOVED)); removeNodeSource(NODE_SOURCE_NAME); }

Target:
public void action() throws Exception { log("Create then remove an empty local node source with time slot policy"); createEmptyNodeSource(EMPTY_NODE_SOURCE_NAME); removeNodeSource(EMPTY_NODE_SOURCE_NAME); log("Create a local node source with " + NODES_NUMBER + " nodes with time slot policy"); createDefaultNodeSource(NODE_SOURCE_NAME); log("Waiting for the time slot policy to remove the nodes"); repeater.accept(NODES_NUMBER, () -> this.rmHelper.waitForAnyNodeEvent(RMEventType.NODE_REMOVED)); log("Waiting for the time slot policy to add the nodes again"); RMTHelper.waitForNodesToBeUp(NODES_NUMBER, this.monitorsHandler); log("Waiting for the time slot policy to remove the nodes again"); repeater.accept(NODES_NUMBER, () -> this.rmHelper.waitForAnyNodeEvent(RMEventType.NODE_REMOVED)); removeNodeSource(NODE_SOURCE_NAME); }
Source:
public void handleSend(@Nullable Resp response, @Nullable Throwable error, Span span) { HttpServerResponse serverResponse; if (response == null || response instanceof HttpServerResponse) { serverResponse = (HttpServerResponse) response; } else { serverResponse = new HttpServerResponse.FromHttpAdapter<>(adapter, response); } handleFinish(serverResponse, error, span); }

Target:
public void handleSend(@Nullable Resp response, @Nullable Throwable error, Span span) { HttpServerResponse serverResponse; if (response == null || response instanceof HttpServerResponse) { serverResponse = (HttpServerResponse) response; } else { serverResponse = new FromResponseAdapter<>(adapter, response); } handleFinish(serverResponse, error, span); }
Source:
public void prepareEnvironment(ITestContext context) throws Exception { System.setProperty("java.security.auth.login.config", "./kafka_server_jaas.conf"); try { for (ITestNGMethod method : context.getAllTestMethods()) { method.setRetryAnalyzer(new Retry()); } for (Starter<?> starter : STARTERS.values()) { starter.start(); } this.zookeeper = startZookeeperClient(); CuratorFramework kafkaZookeeper = startKafkaZookeeperClient(); SharedServices.initialize(STARTERS, zookeeper, kafkaZookeeper); logger.info("Environment was prepared"); } catch (Exception e) { logger.error("Exception during environment preparation", e); } }

Target:
public void prepareEnvironment(ITestContext context) throws Exception { try { for (ITestNGMethod method : context.getAllTestMethods()) { method.setRetryAnalyzer(new Retry()); } for (Starter<?> starter : STARTERS.values()) { starter.start(); } this.zookeeper = startZookeeperClient(); CuratorFramework kafkaZookeeper = startKafkaZookeeperClient(); SharedServices.initialize(STARTERS, zookeeper, kafkaZookeeper); logger.info("Environment was prepared"); } catch (Exception e) { logger.error("Exception during environment preparation", e); } }
Source:
public static long requireNonNegative( long value ) { if ( value < 0 ) { throw new IllegalArgumentException( "Expected non-negative integer value, got " + value ); } return value; }

Target:
public static long requireNonNegative( long value ) { if ( value < 0 ) { throw new IllegalArgumentException( "Expected non-negative long value, got " + value ); } return value; }
Source:
protected static void validateImageUuid(String image) { DockerImage dockerImage = DockerImage.parse(image); if (dockerImage == null) { return; } String server = dockerImage.getServer(); List<String> whitelistRegistries = WHITELIST_REGISTRIES.get(); String defaultRegistry = DEFAULT_REGISTRY.get(); String userProvidedRegistry = dockerImage.getServer(); if (!image.contains(server)) { if(!StringUtils.isBlank(defaultRegistry)) { userProvidedRegistry = defaultRegistry; } } if (whitelistRegistries.size() > 0) { if (!StringUtils.isEmpty(userProvidedRegistry) && !StringUtils.isBlank(userProvidedRegistry)) { if (!whitelistRegistries.contains(userProvidedRegistry)) { throw new ValidationErrorException(ValidationErrorCodes.INVALID_OPTION, InstanceConstants.FIELD_IMAGE_UUID); } } else { if (!StringUtils.isEmpty(defaultRegistry) && !StringUtils.isBlank(defaultRegistry)) { if (!whitelistRegistries.contains(defaultRegistry)) { throw new ValidationErrorException(ValidationErrorCodes.INVALID_OPTION, InstanceConstants.FIELD_IMAGE_UUID); } } } } }

Target:
protected static void validateImageUuid(String image) { DockerImage dockerImage = DockerImage.parse(image); if (dockerImage == null) { return; } String registry = dockerImage.getServer(); List<String> whitelistRegistries = WHITELIST_REGISTRIES.get(); String defaultRegistry = DEFAULT_REGISTRY.get(); String userProvidedRegistry = dockerImage.getServer(); if (!image.contains(registry)) { if(!StringUtils.isBlank(defaultRegistry)) { userProvidedRegistry = defaultRegistry; } } if (whitelistRegistries.size() > 0) { if (!StringUtils.isEmpty(userProvidedRegistry) && !StringUtils.isBlank(userProvidedRegistry)) { if (!whitelistRegistries.contains(userProvidedRegistry)) { throw new ValidationErrorException(ValidationErrorCodes.INVALID_OPTION, InstanceConstants.FIELD_IMAGE_UUID); } } else { if (!StringUtils.isEmpty(defaultRegistry) && !StringUtils.isBlank(defaultRegistry)) { if (!whitelistRegistries.contains(defaultRegistry)) { throw new ValidationErrorException(ValidationErrorCodes.INVALID_OPTION, InstanceConstants.FIELD_IMAGE_UUID); } } } } }
Source:
private boolean isFromExcludedPackage(String candidateClassName) { String classNameWithPackage = candidateClassName; if (!candidateClassName.contains(DOT)) { classNameWithPackage = parentContext .getClassNameWithPackage(candidateClassName) .orElse(null); } if (classNameWithPackage == null) { return false; } else { return excludedPackages.stream().anyMatch(classNameWithPackage::startsWith); } }

Target:
private boolean isFromExcludedPackage(String candidateClassName) { String classNameWithPackage = candidateClassName; if (!candidateClassName.contains(DOT)) { classNameWithPackage = parentContext.getClassNameWithPackage(candidateClassName) .orElse(""); } boolean isFromExcludedPackage = false; if (classNameWithPackage.contains(DOT)) { final int lastDotIndex = classNameWithPackage.lastIndexOf(DOT); final String packageName = classNameWithPackage.substring(0, lastDotIndex); isFromExcludedPackage = packageName.startsWith("java.lang") || excludedPackages.contains(packageName); } return isFromExcludedPackage; }
Source:
public void testCall() { String change_id = null; String commit_id = null; try { GitAccess gAccess = new GitAccess(); Git git = gAccess.getGitProject(); gAccess.addFile("EGerritTestReviewFile.java", "Hello reviewers community !\n This is the second line \n"); gAccess.pushFile(); change_id = gAccess.getChangeId(); commit_id = gAccess.getCommitId(); } catch (Exception e1) { e1.printStackTrace(); } CreateDraftCommand command = fGerrit.createDraftComments(change_id, commit_id); CommentInfo commentInfo = new CommentInfo(); commentInfo.setLine(2); commentInfo.setMessage("This is a test comment"); commentInfo.setPath("EGerritTestReviewFile.java"); command.setCommentInfo(commentInfo); command.requiresAuthentication(true); CommentInfo result = null; try { result = command.call(); } catch (EGerritException e) { fail(e.getMessage()); } SetReviewCommand command2 = fGerrit.setReview(change_id, commit_id); ReviewInput reviewInput = new ReviewInput(); reviewInput.setMessage("This review is NOW ready to go ..."); Map obj = new HashMap(); obj.put("Code-Review", "2"); reviewInput.setLabels(obj); command2.setReviewInput(reviewInput); command2.requiresAuthentication(true); ReviewInfo result2 = null; try { result2 = command2.call(); } catch (EGerritException e) { fail(e.getMessage()); } System.out.println(result2); assertEquals(result2.getLabels(), reviewInput.getLabels()); }

Target:
public void testCall() { String change_id = null; String commit_id = null; try { GitAccess gAccess = new GitAccess(); Git git = gAccess.getGitProject(); gAccess.addFile("EGerritTestReviewFile.java", "Hello reviewers community !\n This is the second line \n"); gAccess.pushFile(); change_id = gAccess.getChangeId(); commit_id = gAccess.getCommitId(); } catch (Exception e1) { fail(e1.getMessage()); } CreateDraftCommand command = fGerrit.createDraftComments(change_id, commit_id); CommentInfo commentInfo = new CommentInfo(); commentInfo.setLine(2); commentInfo.setMessage("This is a test comment"); commentInfo.setPath("EGerritTestReviewFile.java"); command.setCommentInfo(commentInfo); CommentInfo result = null; try { result = command.call(); } catch (EGerritException e) { fail(e.getMessage()); } SetReviewCommand command2 = fGerrit.setReview(change_id, commit_id); ReviewInput reviewInput = new ReviewInput(); reviewInput.setMessage("This review is NOW ready to go ..."); Map obj = new HashMap(); obj.put("Code-Review", "2"); reviewInput.setLabels(obj); command2.setReviewInput(reviewInput); ReviewInfo result2 = null; try { result2 = command2.call(); } catch (EGerritException e) { fail(e.getMessage()); } assertEquals(result2.getLabels(), reviewInput.getLabels()); }
Source:
public void traceOpened(@Nullable TmfTraceOpenedSignal signal) { LatencyAnalysis analysis = LatencyViewerUtils.getAnalysisFromSignal(signal); if (analysis != null) { analysis.addListener(fListener); LatencyViewerUtils.runAnalysis(); } }

Target:
public void traceOpened(@Nullable TmfTraceOpenedSignal signal) { LatencyAnalysis analysis = LatencyViewerUtils.getAnalysisFromSignal(signal); if (analysis != null) { LatencyViewerUtils.runAnalysis(fListener); } }
Source:
@Override public boolean apply(BinaryObject bo) { System.out.println("CompositePredicate on " + ignite.configuration().getIgniteInstanceName()); for (BinaryPredicate predicate : predicates) { predicate.ignite = ignite; if (!predicate.apply(bo)) return false; } return true; }

Target:
@Override public boolean apply(BinaryObject bo) { log.info("CompositePredicate on " + ignite.configuration().getIgniteInstanceName()); for (BinaryPredicate predicate : predicates) { predicate.ignite = ignite; if (!predicate.apply(bo)) return false; } return true; }
Source:
private void addSkyNodes(RenderGraph renderGraph) { Node backdropNode = new BackdropNode(context); renderGraph.addNode(backdropNode, "backdropNode"); DisplayResolutionDependentFBOs displayResolutionDependentFBOs = context.get(DisplayResolutionDependentFBOs.class); FBOConfig hazeIntermediateConfig = new FBOConfig(HazeNode.INTERMEDIATE_HAZE_FBO_URI, ONE_16TH_SCALE, FBO.Type.DEFAULT); FBO hazeIntermediateFbo = displayResolutionDependentFBOs.request(hazeIntermediateConfig); HazeNode hazeIntermediateNode = new HazeNode(context, displayResolutionDependentFBOs.getGBufferPair().getLastUpdatedFbo(), hazeIntermediateFbo); renderGraph.addNode(hazeIntermediateNode, "hazeIntermediateNode"); FBOConfig hazeFinalConfig = new FBOConfig(HazeNode.FINAL_HAZE_FBO_URI, ONE_32TH_SCALE, FBO.Type.DEFAULT); FBO hazeFinalFbo = displayResolutionDependentFBOs.request(hazeFinalConfig); HazeNode hazeFinalNode = new HazeNode(context, hazeIntermediateFbo, hazeFinalFbo); renderGraph.addNode(hazeFinalNode, "hazeFinalNode"); Node lastUpdatedGBufferClearingNode = renderGraph.findNode(new SimpleUri("engine:lastUpdatedGBufferClearingNode")); renderGraph.connect(lastUpdatedGBufferClearingNode, backdropNode); renderGraph.connect(backdropNode, hazeIntermediateNode); renderGraph.connect(hazeIntermediateNode, hazeFinalNode); }

Target:
private void addSkyNodes(RenderGraph renderGraph) { Node backdropNode = new BackdropNode(context); renderGraph.addNode(backdropNode, "backdropNode"); FBOConfig hazeIntermediateConfig = new FBOConfig(HazeNode.INTERMEDIATE_HAZE_FBO_URI, ONE_16TH_SCALE, FBO.Type.DEFAULT); FBO hazeIntermediateFbo = displayResolutionDependentFBOs.request(hazeIntermediateConfig); HazeNode hazeIntermediateNode = new HazeNode(context, displayResolutionDependentFBOs.getGBufferPair().getLastUpdatedFbo(), hazeIntermediateFbo); renderGraph.addNode(hazeIntermediateNode, "hazeIntermediateNode"); FBOConfig hazeFinalConfig = new FBOConfig(HazeNode.FINAL_HAZE_FBO_URI, ONE_32TH_SCALE, FBO.Type.DEFAULT); FBO hazeFinalFbo = displayResolutionDependentFBOs.request(hazeFinalConfig); HazeNode hazeFinalNode = new HazeNode(context, hazeIntermediateFbo, hazeFinalFbo); renderGraph.addNode(hazeFinalNode, "hazeFinalNode"); Node lastUpdatedGBufferClearingNode = renderGraph.findNode("engine:lastUpdatedGBufferClearingNode"); renderGraph.connect(lastUpdatedGBufferClearingNode, backdropNode, hazeIntermediateNode, hazeFinalNode); }
Source:
public void insert(Realm realm, Collection<? extends RealmModel> objects) { if (objects.isEmpty()) { return; } RealmProxyMediator mediator = getMediator(Util.getOriginalModelClass(Util.getOriginalModelClass(objects.iterator().next().getClass()))); mediator.insert(realm, objects); }

Target:
public void insert(Realm realm, Collection<? extends RealmModel> objects) { RealmProxyMediator mediator = getMediator(Util.getOriginalModelClass(Util.getOriginalModelClass(objects.iterator().next().getClass()))); mediator.insert(realm, objects); }
Source:
public static Map<String, Object> visitParameters(Visit visit) { Map<String, Object> visitParameters = new HashMap<>(); visitParameters.put(EventKeys.VISIT_ID, visit.getUuid()); visitParameters.put(EventKeys.VISIT_START_DATETIME, visit.getStartDatetime()); visitParameters.put(EventKeys.VISIT_END_DATETIME, visit.getEndDatetime()); visitParameters.put(EventKeys.VISIT_TYPE, visit.getVisitType().getUuid()); visitParameters.put(EventKeys.VISIT_TYPE, null); if (visit.getLocation() != null) { visitParameters.put(EventKeys.LOCATION_ID, visit.getLocation().getUuid()); } else { visitParameters.put(EventKeys.LOCATION_ID, null); } return visitParameters; }

Target:
public static Map<String, Object> visitParameters(Visit visit) { Map<String, Object> visitParameters = new HashMap<>(); visitParameters.put(EventKeys.VISIT_ID, visit.getUuid()); visitParameters.put(EventKeys.VISIT_START_DATETIME, visit.getStartDatetime()); visitParameters.put(EventKeys.VISIT_STOP_DATETIME, visit.getStopDatetime()); visitParameters.put(EventKeys.VISIT_TYPE, visit.getVisitType().getUuid()); if (visit.getLocation() != null) { visitParameters.put(EventKeys.LOCATION_ID, visit.getLocation().getUuid()); } return visitParameters; }
Source:
private <L, M extends MeasurementType<L>> Metric buildMetric(MeasurementInstance<L, M> m, MeasurementUnit metricUnits) { Metric.Builder mb = Metric.builder() .name(m.getName().getNameString()) .type(m.getType().getName().getNameString()); if (metricUnits != null) { mb.unit(MetricUnit.valueOf(metricUnits.name())); } m.getProperties().forEach((k, v) -> mb.property(k, v.toString())); mb.property("hawkular.metric.type", m.getType().getMetricType().name()); mb.property("hawkular.metric.typeId", m.getType().getID().getIDString()); return mb.build(); }

Target:
private <L, M extends MeasurementType<L>> Metric buildMetric(MeasurementInstance<L, M> m, MeasurementUnit metricUnits) { Metric.Builder mb = Metric.builder() .name(m.getName().getNameString()) .type(m.getType().getName().getNameString()); if (metricUnits != null) { mb.unit(MetricUnit.valueOf(metricUnits.name())); } m.getProperties().forEach((k, v) -> mb.property(k, v.toString())); mb.property("hawkular.metric.type", m.getType().getMetricType().name()); mb.property("hawkular.metric.typeId", m.getType().getID().getIDString()); mb.property("hawkular.metric.id", m.getID().getIDString()); return mb.build(); }