auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public Future<Void> updateBlobTtl(String blobId, String serviceId, long expiresAtMs, Callback<Void> callback) { FutureResult<Void> futureResult = new FutureResult<>(); handlePrechecks(futureResult, callback); Exception exception = null; try { getBlobIdFromString(blobId, clusterMap); if (!deletedBlobs.contains(blobId) && blobs.containsKey(blobId)) { InMemoryBlob blob = blobs.get(blobId); <START> BlobProperties existing = blob.blobProperties; <END> long newTtlSecs = Utils.getTtlInSecsFromExpiryMs(expiresAtMs, existing.getCreationTimeInMs()); blob.blobProperties.setTimeToLiveInSeconds(newTtlSecs); if (notificationSystem != null) { notificationSystem.onBlobTtlUpdated(blobId, serviceId, expiresAtMs); } } else if (deletedBlobs.contains(blobId)) { exception = new RouterException("Blob has been deleted", RouterErrorCode.BlobDeleted); } else { exception = new RouterException("Blob not found", RouterErrorCode.BlobDoesNotExist); } } catch (RouterException e) { exception = e; } catch (Exception e) { exception = new RouterException(e, RouterErrorCode.UnexpectedInternalError); } finally { completeOperation(futureResult, callback, null, exception); } return futureResult; }</code><technical_language>rename existing a more descriptive name</technical_language>

Target:
public Future<Void> updateBlobTtl(String blobId, String serviceId, long expiresAtMs, Callback<Void> callback) { FutureResult<Void> futureResult = new FutureResult<>(); handlePrechecks(futureResult, callback); Exception exception = null; try { getBlobIdFromString(blobId, clusterMap); if (!deletedBlobs.contains(blobId) && blobs.containsKey(blobId)) { InMemoryBlob blob = blobs.get(blobId); BlobProperties currentProps = blob.blobProperties; long newTtlSecs = Utils.getTtlInSecsFromExpiryMs(expiresAtMs, currentProps.getCreationTimeInMs()); blob.blobProperties.setTimeToLiveInSeconds(newTtlSecs); if (notificationSystem != null) { notificationSystem.onBlobTtlUpdated(blobId, serviceId, expiresAtMs); } } else if (deletedBlobs.contains(blobId)) { exception = new RouterException("Blob has been deleted", RouterErrorCode.BlobDeleted); } else { exception = new RouterException("Blob not found", RouterErrorCode.BlobDoesNotExist); } } catch (RouterException e) { exception = e; } catch (Exception e) { exception = new RouterException(e, RouterErrorCode.UnexpectedInternalError); } finally { completeOperation(futureResult, callback, null, exception); } return futureResult; }
Source:
<code>private TmfTimeRange getValidTimeRange(ITmfTrace trace) { if (!fTraces.containsKey(trace)) { return null; } if (!(trace instanceof TmfExperiment)) { return trace.getTimeRange(); } final ITmfTrace[] traces = ((TmfExperiment) trace).getTraces(); if (traces.length == 1) { return traces[0].getTimeRange(); <START> } <END> ITmfTimestamp start = traces[0].getStartTime(); ITmfTimestamp end = traces[0].getEndTime(); for (int i = 1; i < traces.length; i++) { ITmfTrace curTrace = traces[i]; if (curTrace.getStartTime().compareTo(start) < 1) { start = curTrace.getStartTime(); } if (curTrace.getEndTime().compareTo(end) > 1) { end = curTrace.getEndTime(); } } return new TmfTimeRange(start, end); }</code><technical_language>if traces.length == 0? Famous works ... happen</technical_language>

Target:
private TmfTimeRange getValidTimeRange(ITmfTrace trace) { if (!fTraces.containsKey(trace)) { return null; } if (!(trace instanceof TmfExperiment)) { return trace.getTimeRange(); } final ITmfTrace[] traces = ((TmfExperiment) trace).getTraces(); if (traces.length == 0) { return null; } if (traces.length == 1) { return traces[0].getTimeRange(); } ITmfTimestamp start = traces[0].getStartTime(); ITmfTimestamp end = traces[0].getEndTime(); for (int i = 1; i < traces.length; i++) { ITmfTrace curTrace = traces[i]; if (curTrace.getStartTime().compareTo(start) < 0) { start = curTrace.getStartTime(); } if (curTrace.getEndTime().compareTo(end) > 0) { end = curTrace.getEndTime(); } } return new TmfTimeRange(start, end); }
Source:
<code>protected void executeCommand() { if (getDiskImage() != null) { try { Guid taskId = persistAsyncTaskPlaceHolder(getParameters().getParentCommand()); VDSReturnValue vdsReturnValue = performImageVdsmOperation(); getReturnValue().getInternalVdsmTaskIdList().add( createTask(taskId, vdsReturnValue.getCreationInfo(), getParameters().getParentCommand(), VdcObjectType.Storage, getStorageDomainId())); } catch (VdcBLLException e) { if (e.getErrorCode() == VdcBllErrors.ImageDoesNotExistInDomainError) { log.warnFormat("The image group with id {0} wasn't actually deleted from the storage domain {1} " + <START> "because it didn't exist in it", getDiskImage().getId(), getStorageDomainId()); <END> } else if (e.getErrorCode() == VdcBllErrors.ImageDeleteError && isImageRemovedFromStorage()) { log.infoFormat("The image group with id {0} was deleted from storage"); } else { throw e; } } if (getParameters().getParentCommand() != VdcActionType.RemoveVmFromImportExport && getParameters().getParentCommand() != VdcActionType.RemoveVmTemplateFromImportExport) { performImageDbOperations(); } } else { log.warn("DiskImage is null, nothing to remove"); } setSucceeded(true); }</code><technical_language>s/The image group.*/Disk {0} exist storage domain, rolling forward/ is this a warning info</technical_language>

Target:
protected void executeCommand() { if (getDiskImage() != null) { try { Guid taskId = persistAsyncTaskPlaceHolder(getParameters().getParentCommand()); VDSReturnValue vdsReturnValue = performImageVdsmOperation(); getReturnValue().getInternalVdsmTaskIdList().add( createTask(taskId, vdsReturnValue.getCreationInfo(), getParameters().getParentCommand(), VdcObjectType.Storage, getStorageDomainId())); } catch (VdcBLLException e) { if (e.getErrorCode() == VdcBllErrors.ImageDoesNotExistInDomainError) { log.infoFormat("Disk '{0}' doesn't exist on storage domain '{1}', rolling forward", getDiskImage().getId(), getStorageDomainId()); } else if (e.getErrorCode() == VdcBllErrors.ImageDeleteError && isImageRemovedFromStorage()) { log.infoFormat("Disk '{0}' was deleted from storage domain '{1}'", getDiskImage().getId(), getStorageDomainId()); } else { throw e; } } if (getParameters().getParentCommand() != VdcActionType.RemoveVmFromImportExport && getParameters().getParentCommand() != VdcActionType.RemoveVmTemplateFromImportExport) { performImageDbOperations(); } } else { log.warn("DiskImage is null, nothing to remove"); } setSucceeded(true); }
Source:
<code>private ItemRest replace(ItemRest item, Operation operation) { checkOperationValue((String) operation.getValue()); <START> Boolean discoverable = BooleanUtils.toBooleanObject((String) operation.getValue()); <END> if (discoverable == null) { throw new PatchBadRequestException( "Boolean value not provided for discoverable operation."); } item.setDiscoverable(discoverable); return item; }</code><technical_language>receive real boolean values accept boolean "String"</technical_language>

Target:
public ItemRest replace(ItemRest item, Operation operation) { Boolean discoverable = getBooleanOperationValue(operation.getValue()); item.setDiscoverable(discoverable); return item; }
Source:
<code>protected List<Network> getNetworks() { if (networks == null) { networks = getDbFacade().getNetworkDao().getAllForDataCenter(network.getDataCenterId()); <START> if (networks == null) { <END> networks = Collections.<Network> emptyList(); } } return networks; }</code><technical_language>This code is necessary, DAO responsibility return empty list if networks. is de-facto contract in system</technical_language>

Target:
protected List<Network> getNetworks() { if (networks == null) { networks = getDbFacade().getNetworkDao().getAllForDataCenter(network.getDataCenterId()); } return networks; }
Source:
<code>public void afterProjectsRead(MavenSession session) throws MavenExecutionException { try { if (disableLifecycleParticipation(session)) { return; } List<MavenProject> projects = session.getProjects(); <START> String tychoVersion = validateConsistentTychoVersion(projects); <END> validateUniqueBaseDirs(projects); System.setProperty(P2_USER_AGENT_KEY, P2_USER_AGENT_VALUE + tychoVersion); configureComponents(session); for (MavenProject project : projects) { resolver.setupProject(session, project, DefaultReactorProject.adapt(project)); } List<ReactorProject> reactorProjects = DefaultReactorProject.adapt(session); for (MavenProject project : projects) { resolver.resolveProject(session, project, reactorProjects); } } catch (BuildFailureException e) { throw new MavenExecutionException(e.getMessage(), e); } }</code><technical_language>successful validation, simply TychoVersion.getTychoVersion()</technical_language>

Target:
public void afterProjectsRead(MavenSession session) throws MavenExecutionException { try { if (disableLifecycleParticipation(session)) { return; } List<MavenProject> projects = session.getProjects(); validate(projects); System.setProperty(P2_USER_AGENT_KEY, P2_USER_AGENT_VALUE + TychoVersion.getTychoVersion()); configureComponents(session); for (MavenProject project : projects) { resolver.setupProject(session, project, DefaultReactorProject.adapt(project)); } List<ReactorProject> reactorProjects = DefaultReactorProject.adapt(session); for (MavenProject project : projects) { resolver.resolveProject(session, project, reactorProjects); } } catch (BuildFailureException e) { throw new MavenExecutionException(e.getMessage(), e); } }
Source:
<code>public void setParams(Integer n, MatrixLib p) { if (n != null) { if (n < 0) { throw new IllegalArgumentException( "The number of trials 'n' for a Multinomial Distribution must be nonnegative"); } this.n = n; this.hasN = true; } if (p != null) { if (p.numRows() != 1 || p.numCols() == 0) { throw new IllegalArgumentException( <START> "The row vector p passed in is not a row vector"); <END> } initializeProbabilityVector(p); this.hasP = true; } }</code><technical_language>"The vector p passed in is a row vector"</technical_language>

Target:
public void setParams(Integer n, MatrixLib p) { if (n != null) { if (n < 0) { throw new IllegalArgumentException( "The number of trials 'n' for a Multinomial Distribution must be nonnegative"); } this.n = n; this.hasN = true; } if (p != null) { if (p.numRows() != 1 || p.numCols() == 0) { throw new IllegalArgumentException( "The vector p passed in is not a row vector"); } initializeProbabilityVector(p); this.hasP = true; } }
Source:
<code>public void saveWidgetValues() { IDialogSettings settings = getDialogSettings(); if <START> (settings != null) { <END> settings.put(STORE_OPEN_TYPE_ID, openType); settings.put(STORE_REPLACE_SOURCE_ID, replaceSource); } }</code><technical_language>null != settings</technical_language>

Target:
public void saveWidgetValues() { IDialogSettings settings = getDialogSettings(); if (null != settings) { settings.put(STORE_OPEN_TYPE_ID, openType); settings.put(STORE_REPLACE_SOURCE_ID, replaceSource); } }
Source:
<code>public void scanClassWithReadOnlyAndEmptyValueParams() { Swagger swagger = getSwagger(Issue1979Resource.class); Parameter readOnlyParam = swagger.getPath("/fun/readOnly").getGet().getParameters().get(0); assertTrue(readOnlyParam.isReadOnly()); <START> QueryParameter allowEmptyParam = (QueryParameter) swagger.getPath("/fun/allowEmpty").getGet().getParameters().get(0); <END> assertTrue(allowEmptyParam.getAllowEmptyValue()); }</code><technical_language>SerializableParameter instead of QueryParameter</technical_language>

Target:
public void scanClassWithReadOnlyAndEmptyValueParams() { Swagger swagger = getSwagger(Issue1979Resource.class); Parameter readOnlyParam = swagger.getPath("/fun/readOnly").getGet().getParameters().get(0); assertTrue(readOnlyParam.isReadOnly()); SerializableParameter allowEmptyParam = (SerializableParameter) swagger.getPath("/fun/allowEmpty").getGet().getParameters().get(0); assertTrue(allowEmptyParam.getAllowEmptyValue()); }
Source:
<code>private void processFlagFile() throws CmdLineException, IOException { Path flagFile = Paths.get(flags.flagFile); BufferedReader buffer = java.nio.file.Files.newBufferedReader(flagFile, UTF_8); StringBuilder builder = new StringBuilder(); List<String> tokens = new ArrayList<>(); boolean quoted = false; boolean escaped = false; int c; while ((c = buffer.read()) != -1) { <START> if (c == UTF8_BOM_CODE) { <END> continue; } if (c == 32 || c == 9 || c == 10 || c == 13) { if (quoted) { builder.append((char) c); } else if (builder.length() != 0) { tokens.add(builder.toString()); builder.setLength(0); } } else if (c == 34) { if (escaped) { if (quoted) { builder.setCharAt(builder.length()-1, (char) c); } else { builder.append((char) c); } } else { quoted = !quoted; } } else { builder.append((char) c); } escaped = c == 92; } buffer.close(); if (builder.length() != 0) { tokens.add(builder.toString()); } flags.flagFile = ""; tokens = processArgs(tokens.toArray(new String[tokens.size()])); List<GuardLevel> previous = new ArrayList<>(Flags.guardLevels); Flags.guardLevels.clear(); flags.parse(tokens); Flags.guardLevels.addAll(previous); if (!flags.flagFile.isEmpty()) { reportError("ERROR - Arguments in the file cannot contain " + "--flagfile option."); } }</code><technical_language>Please add a check insure this occurs beginning of file</technical_language>

Target:
private void processFlagFile() throws CmdLineException, IOException { Path flagFile = Paths.get(flags.flagFile); BufferedReader buffer = java.nio.file.Files.newBufferedReader(flagFile, UTF_8); StringBuilder builder = new StringBuilder(); List<String> tokens = new ArrayList<>(); boolean quoted = false; boolean escaped = false; boolean isFirstCharacter = true; int c; while ((c = buffer.read()) != -1) { if (isFirstCharacter) { isFirstCharacter = false; if (c == UTF8_BOM_CODE) { continue; } } if (c == 32 || c == 9 || c == 10 || c == 13) { if (quoted) { builder.append((char) c); } else if (builder.length() != 0) { tokens.add(builder.toString()); builder.setLength(0); } } else if (c == 34) { if (escaped) { if (quoted) { builder.setCharAt(builder.length()-1, (char) c); } else { builder.append((char) c); } } else { quoted = !quoted; } } else { builder.append((char) c); } escaped = c == 92; } buffer.close(); if (builder.length() != 0) { tokens.add(builder.toString()); } flags.flagFile = ""; tokens = processArgs(tokens.toArray(new String[tokens.size()])); List<GuardLevel> previous = new ArrayList<>(Flags.guardLevels); Flags.guardLevels.clear(); flags.parse(tokens); Flags.guardLevels.addAll(previous); if (!flags.flagFile.isEmpty()) { reportError("ERROR - Arguments in the file cannot contain " + "--flagfile option."); } }
Source:
<code>private BiConsumer<Throwable, Object> completeWithErrorContinue() { return (error, event) -> { final PrivilegedEvent errorEvent = (PrivilegedEvent) ((MessagingException) error).getEvent(); <START> System.out.println("continuing after error... " + errorEvent.getContext().getDepthLevel()); <END> (errorEvent.getContext()).success(errorEvent); }; }</code><technical_language>Remove</technical_language>

Target:
private BiConsumer<Throwable, Object> completeWithErrorContinue() { return (error, event) -> { final PrivilegedEvent errorEvent = (PrivilegedEvent) ((MessagingException) error).getEvent(); (errorEvent.getContext()).success(errorEvent); }; }
Source:
<code>private void remeasureTabs() { <START> if (getVisibility() != View.VISIBLE) return; <END> if (layoutWidth == 0) return; final int count = getTabCount(); int contentWidth = 0; for (int i = 0; i < count; i++) { View child = getTabAt(i).view; if (child.getVisibility() == View.VISIBLE) { contentWidth += Math.max(child.getMinimumWidth(), child.getMeasuredWidth()); } } if (contentWidth > layoutWidth) { setMode(TabLayout.MODE_SCROLLABLE); } else { setMode(TabLayout.MODE_FIXED); } }</code><technical_language>prevVisibility here</technical_language>

Target:
private void remeasureTabs() { if (prevVisibility != View.VISIBLE) return; if (layoutWidth == 0) return; final int count = getTabCount(); int contentWidth = 0; for (int i = 0; i < count; i++) { View child = getTabAt(i).view; if (child.getVisibility() == View.VISIBLE) { contentWidth += Math.max(child.getMinimumWidth(), child.getMeasuredWidth()); } } if (contentWidth > layoutWidth) { setMode(TabLayout.MODE_SCROLLABLE); } else { setMode(TabLayout.MODE_FIXED); } }
Source:
<code>public void visitIfStatement(IfStatementTree ifTree) { <START> Slf4jTestVisitor slf4jTestVisitor = new Slf4jTestVisitor(); <END> ifTree.condition().accept(slf4jTestVisitor); if (slf4jTestVisitor.match) { stackAndContinue(ifTree, super::visitIfStatement); } }</code><technical_language>name of visitor is appropriate, I see, checking for SLF4J level test methods, "JUL"</technical_language>

Target:
public void visitIfStatement(IfStatementTree ifTree) { LevelTestVisitor levelTestVisitor = new LevelTestVisitor(); ifTree.condition().accept(levelTestVisitor); if (levelTestVisitor.match) { stackAndContinue(ifTree, super::visitIfStatement); } else { super.visitIfStatement(ifTree); } }
Source:
<code>public Serializable execute(TaskResult... results) throws IOException { List<String> filesRelativePathName = new ArrayList<>(); boolean s3PathIsPrefix = (keyName.lastIndexOf('/') == keyName.length() - 1); File f = new File(s3LocalRelativePath); <START> if (f.exists()) { <END> getOut().println("The local path already exists"); if (s3PathIsPrefix) { try { f.mkdir(); } catch (Exception e) { getOut().println("Couldn't create destination directory!"); System.exit(1); } } } AmazonS3 amazonS3 = getS3Client(host, scheme); if (s3PathIsPrefix) { downloadDir(bucketName, keyName, s3LocalRelativePath, false, amazonS3); filesRelativePathName = SchedulerExamplesUtils.listDirectoryContents(f, new ArrayList<>()); } else { s3LocalRelativePath = Paths.get(s3LocalRelativePath, Paths.get(s3Url).getFileName().toString()).toString(); downloadFile(bucketName, keyName, s3LocalRelativePath, false, amazonS3); filesRelativePathName.add(s3LocalRelativePath); } return (Serializable) filesRelativePathName; }</code><technical_language>wrap this block in a separate method called "createDirIfNotExists(s3LocalRelativePath)"</technical_language>

Target:
public Serializable execute(TaskResult... results) throws IOException { boolean s3PathIsPrefix = (s3RemoteRelativePath.lastIndexOf('/') == s3RemoteRelativePath.length() - 1); File f = new File(s3LocalRelativePath); createDirIfNotExists(f, s3PathIsPrefix); AmazonS3 amazonS3 = S3ConnectorUtils.getS3Client(accessKey, secretKey, scheme, host); if (s3PathIsPrefix) { downloadDir(bucketName, s3RemoteRelativePath, s3LocalRelativePath, false, amazonS3); return (Serializable) SchedulerExamplesUtils.listDirectoryContents(f, new ArrayList<>()); } else { s3LocalRelativePath = Paths.get(s3LocalRelativePath, Paths.get(s3Url).getFileName().toString()).toString(); downloadFile(bucketName, s3RemoteRelativePath, s3LocalRelativePath, false, amazonS3); return (Serializable) Arrays.asList(s3LocalRelativePath); } }
Source:
<code>public synchronized void stop() { <START> if (!isStopped) { <END> if (coordinatorListener != null) { coordinatorListener.onJobModelExpired(); } metrics.isLeader.set(false); debounceTimer.stopScheduler(); zkController.stop(); shutdownMetrics(); if (coordinatorListener != null) { coordinatorListener.onCoordinatorStop(); } systemAdmins.stop(); isStopped = true; } }</code><technical_language>Please add log line. thread name debug issues</technical_language>

Target:
public synchronized void stop() { if (coordinatorListener != null) { coordinatorListener.onJobModelExpired(); } metrics.isLeader.set(false); debounceTimer.stopScheduler(); zkController.stop(); shutdownMetrics(); if (coordinatorListener != null) { coordinatorListener.onCoordinatorStop(); } systemAdmins.stop(); }
Source:
<code>protected void fillContextMenu(IMenuManager manager) { final ISelection selection = fViewer.getSelection(); ITmfFilterTreeNode filterTreeNode = null; if (selection instanceof StructuredSelection) { Object element = ((StructuredSelection) selection).getFirstElement(); if (element instanceof ITmfFilterTreeNode) { filterTreeNode = (ITmfFilterTreeNode) element; } } final ITmfFilterTreeNode selectedNode = filterTreeNode; if (selectedNode != null) { fillContextMenuForNode(selectedNode, manager); } manager.add(new Separator("delete")); if (fIsDialog && (selectedNode != null)) { Action deleteAction = new Action(Messages.FilterViewer_DeleteActionText) { @Override public void run() { selectedNode.remove(); fViewer.refresh(); } }; deleteAction.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_DELETE)); deleteAction.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_DELETE); <START> deleteAction.setAccelerator(SWT.DEL); <END> manager.add(deleteAction); } manager.add(new Separator("edit")); if (fViewer.getInput() instanceof TmfFilterRootNode || filterTreeNode == null) { manager.add(new Separator()); ITmfFilterTreeNode root = (ITmfFilterTreeNode) fViewer.getInput(); fillContextMenuForNode(root, manager); } }</code><technical_language>accelerator trigger delete action. accelerator in original code is a regression removed</technical_language>

Target:
protected void fillContextMenu(IMenuManager manager) { final ISelection selection = fViewer.getSelection(); ITmfFilterTreeNode filterTreeNode = null; if (selection instanceof StructuredSelection) { Object element = ((StructuredSelection) selection).getFirstElement(); if (element instanceof ITmfFilterTreeNode) { filterTreeNode = (ITmfFilterTreeNode) element; } } final ITmfFilterTreeNode selectedNode = filterTreeNode; if (selectedNode != null) { fillContextMenuForNode(selectedNode, manager); } manager.add(new Separator("delete")); if (fIsDialog && (selectedNode != null)) { Action deleteAction = new Action(Messages.FilterViewer_DeleteActionText) { @Override public void run() { selectedNode.remove(); fViewer.refresh(); } }; deleteAction.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_DELETE)); manager.add(deleteAction); } manager.add(new Separator("edit")); if (fViewer.getInput() instanceof TmfFilterRootNode || filterTreeNode == null) { manager.add(new Separator()); ITmfFilterTreeNode root = (ITmfFilterTreeNode) fViewer.getInput(); fillContextMenuForNode(root, manager); } }
Source:
<code>boolean isProvided() { int len = getCapacity(); <START> for(int idx = 0; idx < len; idx++) { <END> DatanodeStorageInfo cur = getStorageInfo(idx); if(cur != null) { if (cur.getStorageType() == StorageType.PROVIDED) { return true; } } } return false; }</code><technical_language>space for</technical_language>

Target:
boolean isProvided() { int len = getCapacity(); for (int idx = 0; idx < len; idx++) { DatanodeStorageInfo storage = getStorageInfo(idx); if (storage != null && storage.getStorageType().equals(StorageType.PROVIDED)) { return true; } } return false; }
Source:
<code>public void addReplicatedInstance(WorkflowExecutionContext context) throws FalconException { String feedName = context.getOutputFeedNames(); String feedInstanceDataPath = context.getOutputFeedInstancePaths(); String targetClusterName = context.getClusterName(); LOG.info("Computing feed instance for : name= path= {}, in cluster: {}", feedName, feedInstanceDataPath, targetClusterName); String feedInstanceName = getFeedInstanceName(feedName, targetClusterName, feedInstanceDataPath, context.getNominalTimeAsISO8601()); Vertex feedInstanceVertex = addFeedInstance( feedInstanceName, context, feedName, context.getSrcClusterName()); Map<RelationshipProperty, String> properties = new HashMap<RelationshipProperty, String>(); <START> properties.put(RelationshipProperty.TIMESTAMP, context.getTimeStampAsISO8601()); <END> addInstanceToEntity(feedInstanceVertex, targetClusterName, RelationshipType.CLUSTER_ENTITY, RelationshipLabel.FEED_CLUSTER_REPLICATED_EDGE, properties); addCounters(feedInstanceVertex, context); }</code><technical_language>edge nominal time. Please add STATUS edge</technical_language>

Target:
public void addReplicatedInstance(WorkflowExecutionContext context) throws FalconException { String feedName = context.getOutputFeedNames(); String feedInstanceDataPath = context.getOutputFeedInstancePaths(); String targetClusterName = context.getClusterName(); LOG.info("Computing feed instance for : name= path= {}, in cluster: {}", feedName, feedInstanceDataPath, targetClusterName); String feedInstanceName = getFeedInstanceName(feedName, targetClusterName, feedInstanceDataPath, context.getNominalTimeAsISO8601()); Vertex feedInstanceVertex = addFeedInstance( feedInstanceName, context, feedName, context.getSrcClusterName()); Map<RelationshipProperty, String> properties = edgePropertiesForIndexing(context); properties.put(RelationshipProperty.TIMESTAMP, context.getTimeStampAsISO8601()); addInstanceToEntity(feedInstanceVertex, targetClusterName, RelationshipType.CLUSTER_ENTITY, RelationshipLabel.FEED_CLUSTER_REPLICATED_EDGE, properties); addCounters(feedInstanceVertex, context); }
Source:
<code>void readLogFile() { final Display display = getSite().getShell().getDisplay(); setContentDescription(Messages.LogView_readLog_loading); CompletableFuture.supplyAsync(() -> { List<LogEntry> result = new ArrayList<>(); LogSession lastLogSession = LogReader.parseLogFile(this.fInputFile, getLogMaxTailSize(), result, this.fMemento); if (lastLogSession != null && (lastLogSession.getDate() == null || isEclipseStartTime(lastLogSession.getDate()))) { currentSession = lastLogSession; } else { currentSession = null; } return result; }).thenAccept(entries -> { elements.clear(); groups.clear(); group(entries); limitEntriesCount(); display.asyncExec(() -> { <START> setContentDescription(getTitleSummary()); <END> fFilteredTree.getViewer().refresh(); fFilteredTree.setEnabled(true); }); }); }</code><technical_language>if getTitleSummary disk access (it involves some stuff log files). I extract a local variable asyncExec</technical_language>

Target:
void readLogFile() { final Display display = getSite().getShell().getDisplay(); display.asyncExec(() -> setContentDescription(Messages.LogView_readLog_loading)); fetchLogEntries().thenAccept(this::updateLogViewer); }
Source:
<code>public CoreNode(HTConfig config, int seqNumber, int parentSeqNumber, long start) { super(config, seqNumber, parentSeqNumber, start); this.nbChildren = 0; int size = config.getMaxChildren(); this.children = new int[size]; this.childStart = new long[size]; this.childEnd = new long[size]; <START> for(int i = 0; i<size; i++){ <END> this.childEnd[i] = Long.MAX_VALUE; } }</code><technical_language>ctrl-shift-f</technical_language>

Target:
public CoreNode(HTConfig config, int seqNumber, int parentSeqNumber, long start) { super(config, seqNumber, parentSeqNumber, start); this.nbChildren = 0; int size = config.getMaxChildren(); this.children = new int[size]; this.childStart = new long[size]; this.childEnd = new long[size]; for (int i = 0; i < size; i++) { childEnd[i] = Long.MAX_VALUE; } }
Source:
<code>private boolean matchesPattern(String projectName, String pattern) { boolean match = false; switch (getPatternType(pattern)) { case REGEX: match = projectName.matches(pattern); break; case WILDCARD: match = projectName.startsWith(pattern.substring(0, pattern.length() - 1)); break; <START> default: <END> match = projectName.equals(pattern); } return match; }</code><technical_language>272d5c92d733d19633e9e3bb467b19aa641d6cc7 is preferable list enum constants default: case. commit message explains why</technical_language>

Target:
private boolean matchesPattern(String projectName, String pattern) { boolean match = false; switch (getPatternType(pattern)) { case REGEX: match = projectName.matches(pattern); break; case WILDCARD: match = projectName.startsWith(pattern.substring(0, pattern.length() - 1)); break; case EXACT_MATCH: match = projectName.equals(pattern); } return match; }
Source:
<code>public void setSiteIconMediaId(int siteIconMediaId) { <START> if (mSettings.siteIconMediaId != siteIconMediaId) { <END> mSettings.siteIconMediaId = siteIconMediaId; } }</code><technical_language>is this O(n) language code lookup if is change? mSettings.siteIconMediaId = siteIconMediaId statement is O(n), mSettings.siteIconMediaId != siteIconMediaId statement is not? If O(n), if statement removed this method mSettings.siteIconMediaId = siteIconMediaId statement. result in case O(n) while if statement mSettings.siteIconMediaId = siteIconMediaId statement O(n) that</technical_language>

Target:
public void setSiteIconMediaId(int siteIconMediaId) { mSettings.siteIconMediaId = siteIconMediaId; }
Source:
<code><START> public void testVariousServerErrorCodesForThreeParallelism() <END> throws Exception { initialize(3, true); ServerErrorCode[] serverErrorCodes = new ServerErrorCode[9]; serverErrorCodes[0] = ServerErrorCode.Blob_Not_Found; serverErrorCodes[1] = ServerErrorCode.Data_Corrupt; serverErrorCodes[2] = ServerErrorCode.IO_Error; serverErrorCodes[3] = ServerErrorCode.Partition_Unknown; serverErrorCodes[4] = ServerErrorCode.Disk_Unavailable; serverErrorCodes[5] = ServerErrorCode.No_Error; serverErrorCodes[6] = ServerErrorCode.Data_Corrupt; serverErrorCodes[7] = ServerErrorCode.Unknown_Error; serverErrorCodes[8] = ServerErrorCode.Disk_Unavailable; writeBlobRecordToServers(serverErrorCodes); future = router.deleteBlob(blobIdString, new ClientCallback()); try { future.get(); fail("Deletion should be unsuccessful. Exception is expected."); } catch (Exception e) { assertEquals("RouterErrorCode should be AmbryUnavailable", RouterErrorCode.AmbryUnavailable, ((RouterException) e.getCause()).getErrorCode()); } assertCloseCleanup(); }</code><technical_language>is this test parallelism is set 9</technical_language>

Target:
public void testVariousServerErrorCodesForThreeParallelism() throws Exception { assertCloseCleanup(); Properties props = getNonBlockingRouterProperties(); props.setProperty("router.delete.request.parallelism", "3"); VerifiableProperties vProps = new VerifiableProperties(props); router = new NonBlockingRouter(new RouterConfig(vProps), new NonBlockingRouterMetrics(new MetricRegistry()), new MockNetworkClientFactory(vProps, mockSelectorState, MAX_PORTS_PLAIN_TEXT, MAX_PORTS_SSL, CHECKOUT_TIMEOUT_MS, serverLayout, mockTime), new LoggingNotificationSystem(), clusterMap, mockTime); ServerErrorCode[] serverErrorCodes = new ServerErrorCode[9]; serverErrorCodes[0] = ServerErrorCode.Blob_Not_Found; serverErrorCodes[1] = ServerErrorCode.Data_Corrupt; serverErrorCodes[2] = ServerErrorCode.IO_Error; serverErrorCodes[3] = ServerErrorCode.Partition_Unknown; serverErrorCodes[4] = ServerErrorCode.Disk_Unavailable; serverErrorCodes[5] = ServerErrorCode.No_Error; serverErrorCodes[6] = ServerErrorCode.Data_Corrupt; serverErrorCodes[7] = ServerErrorCode.Unknown_Error; serverErrorCodes[8] = ServerErrorCode.Disk_Unavailable; presetServerErrorCode(serverErrorCodes); future = router.deleteBlob(blobIdString, new ClientCallback()); try { future.get(); fail("Deletion should be unsuccessful. Exception is expected."); } catch (Exception e) { assertEquals("RouterErrorCode should be AmbryUnavailable", RouterErrorCode.AmbryUnavailable, ((RouterException) e.getCause()).getErrorCode()); } }
Source:
<code>public boolean configure(final String name, final Map<String, Object> xmlParams) throws ConfigurationException { _serverId = _msServer.getId(); Map<String, String> params = new HashMap<String, String>(); params = _configDao.getConfiguration(Long.toHexString(_serverId), xmlParams); String value = params.get(Config.HAWorkers.key()); final int count = NumbersUtil.parseInt(value, 1); _workers = new WorkerThread[count]; for (int i = 0; i < _workers.length; i++) { _workers[i] = new WorkerThread("HA-Worker-" + i); } value = params.get("force.ha"); _forceHA = Boolean.parseBoolean(value); _timeToSleep = TimeToSleep.value() * SECONDS_TO_MILLISECONDS_FACTOR; _maxRetries = MaxRetries.value(); _timeBetweenFailures = TimeBetweenFailures.value() * SECONDS_TO_MILLISECONDS_FACTOR; _timeBetweenCleanups = TimeBetweenCleanup.value(); value = params.get("stop.retry.interval"); _stopRetryInterval = NumbersUtil.parseInt(value, STOP_RETRY_INTERVAL_SECONDS); value = params.get("restart.retry.interval"); _restartRetryInterval = NumbersUtil.parseInt(value, RESTART_RETRY_INTERVAL_SECONDS); value = params.get("investigate.retry.interval"); _investigateRetryInterval = NumbersUtil.parseInt(value, INVESTIGATE_RETRY_INTERVAL_SECONDS); value = params.get("migrate.retry.interval"); <START> _migrateRetryInterval = NumbersUtil.parseInt(value, MIGRATE_RETRY_INTERVAL_SECONDS); <END> _instance = params.get("instance"); if (_instance == null) { _instance = "VMOPS"; } _haTag = params.get("ha.tag"); _haDao.releaseWorkItems(_serverId); _stopped = true; _executor = Executors.newScheduledThreadPool(count, new NamedThreadFactory("HA")); return true; }</code><technical_language>time.between.cleanup, time.between.failures, max.retries time.to.sleep</technical_language>

Target:
public boolean configure(final String name, final Map<String, Object> xmlParams) throws ConfigurationException { _serverId = _msServer.getId(); final Map<String, String> params = _configDao.getConfiguration(Long.toHexString(_serverId), xmlParams); final int count = HAWorkers.value(); _workers = new WorkerThread[count]; for (int i = 0; i < _workers.length; i++) { _workers[i] = new WorkerThread("HA-Worker-" + i); } _forceHA = ForceHA.value(); _timeToSleep = TimeToSleep.value() * SECONDS_TO_MILLISECONDS_FACTOR; _maxRetries = MaxRetries.value(); _timeBetweenFailures = TimeBetweenFailures.value() * SECONDS_TO_MILLISECONDS_FACTOR; _timeBetweenCleanups = TimeBetweenCleanup.value(); _stopRetryInterval = StopRetryInterval.value(); _restartRetryInterval = RestartRetryInterval.value(); _investigateRetryInterval = InvestigateRetryInterval.value(); _migrateRetryInterval = MigrateRetryInterval.value(); _instance = params.get("instance"); if (_instance == null) { _instance = "VMOPS"; } _haTag = params.get("ha.tag"); _haDao.releaseWorkItems(_serverId); _stopped = true; _executor = Executors.newScheduledThreadPool(count, new NamedThreadFactory("HA")); return true; }
Source:
<code>private void initExhibitor() throws Exception { final RetryPolicy retryPolicy = new ExponentialBackoffRetry(EXHIBITOR_RETRY_TIME, EXHIBITOR_RETRY_MAX); final Collection<String> exhibitorHosts = Arrays.asList(exhibitorAddresses.split("\\s*,\\s*")); final Exhibitors exhibitors = new Exhibitors(exhibitorHosts, exhibitorPort, () -> zookeeperBrokers + zookeeperKafkaNamespace); final ExhibitorRestClient exhibitorRestClient = new DefaultExhibitorRestClient(); final ExhibitorEnsembleProvider ensembleProvider = new ExhibitorEnsembleProvider(exhibitors, <START> exhibitorRestClient, "/exhibitor/v1/cluster/list", EXHIBITOR_POLLING_MS, retryPolicy); <END> ensembleProvider.pollForInitialEnsemble(); zooKeeper = CuratorFrameworkFactory.builder() .ensembleProvider(ensembleProvider) .retryPolicy(retryPolicy) .build(); zooKeeper.start(); }</code><technical_language>I get it. Is impossible create zookeeper only? FixedEnsembleProvider for situation zookeeper available. Exhibitors instance created, ensemble provider account exhibitors, zookeepers</technical_language>

Target:
private void initExhibitor() throws Exception { final RetryPolicy retryPolicy = new ExponentialBackoffRetry(EXHIBITOR_RETRY_TIME, EXHIBITOR_RETRY_MAX); final EnsembleProvider ensembleProvider; if (exhibitorAddresses != null) { final Collection<String> exhibitorHosts = Arrays.asList(exhibitorAddresses.split("\\s*,\\s*")); final Exhibitors exhibitors = new Exhibitors(exhibitorHosts, exhibitorPort, () -> zookeeperBrokers + zookeeperKafkaNamespace); final ExhibitorRestClient exhibitorRestClient = new DefaultExhibitorRestClient(); ensembleProvider = new ExhibitorEnsembleProvider(exhibitors, exhibitorRestClient, "/exhibitor/v1/cluster/list", EXHIBITOR_POLLING_MS, retryPolicy); ((ExhibitorEnsembleProvider) ensembleProvider).pollForInitialEnsemble(); } else { ensembleProvider = new FixedEnsembleProvider(zookeeperBrokers + zookeeperKafkaNamespace); } zooKeeper = CuratorFrameworkFactory.builder() .ensembleProvider(ensembleProvider) .retryPolicy(retryPolicy) .build(); zooKeeper.start(); }
Source:
<code>public boolean apply(Game game, Ability source) { List<Permanent> permanents = game.getBattlefield().getActivePermanents(source.getControllerId(), game); for (Permanent p : permanents) { if (p.isLand()) { p.sacrifice(source.getSourceId(), game); <START> } <END> } return true; }</code><technical_language>I guess this raise possibly a concurrent modification exception</technical_language>

Target:
public boolean apply(Game game, Ability source) { Iterator<Permanent> permanents = game.getBattlefield().getActivePermanents(source.getControllerId(), game).iterator(); while (permanents.hasNext()) { Permanent p = permanents.next(); if (p.isLand()) { p.sacrifice(source.getSourceId(), game); } } return true; }
Source:
<code>protected Collection<String> defaultSuppressionAnnotations() { Collection<String> defaultValues = new HashSet<>(); defaultValues.add("javax.inject.Inject"); <START> return defaultValues; <END> }</code><technical_language>return Arrays.asList("javax.inject.Inject")</technical_language>

Target:
protected Collection<String> defaultSuppressionAnnotations() { return Arrays.asList("javax.inject.Inject"); }
Source:
<code><START> public abstract FoundIndication scan(Run build) throws IOException; <END> public abstract FoundIndication scan(Run build, PrintStream buildLog); protected FoundIndication scanOneFile(Run build, BufferedReader reader, String currentFile) throws IOException { TimerThread timerThread = new TimerThread(Thread.currentThread(), TIMEOUT_LINE); FoundIndication foundIndication = null; boolean found = false; final Pattern pattern = indication.getPattern(); String line; int currentLine = 1; timerThread.start(); try { long startTime = System.currentTimeMillis(); while ((line = reader.readLine()) != null) { try { if (pattern.matcher(new InterruptibleCharSequence(line)).matches()) { found = true; break; } } catch (RuntimeException e) { if (e.getCause() instanceof InterruptedException) { logger.warning("Timeout scanning for indication '" + indication.toString() + "' for file " + currentFile + ":" + currentLine); } else { throw e; } } currentLine++; timerThread.touch(); if (System.currentTimeMillis() - startTime > TIMEOUT_FILE) { logger.warning("File timeout scanning for indication '" + indication.toString() + "' for file " + currentFile); break; } } if (found) { String cleanLine = ConsoleNote.removeNotes(line); foundIndication = new FoundIndication(build, pattern.toString(), currentFile, cleanLine); } return foundIndication; } finally { timerThread.requestStop(); timerThread.interrupt(); try { timerThread.join(); } catch (InterruptedException eIgnore) { } Thread.interrupted(); } }</code><technical_language>here, risk tha else implemented extension point, assumptions ;)</technical_language>

Target:
public FoundIndication scan(Run build) throws IOException { if (Util.isOverridden(FailureReader.class, getClass(), "scan", AbstractBuild.class)) { return scan((AbstractBuild) build); } return null; }
Source:
<code>private Configuration getShuffleTaskConfiguration(final int stageSequence, final String computeTaskId) { if (!stageInfoList.get(stageSequence).isShuffleUsed()) { return Tang.Factory.getTang().newConfigurationBuilder().build(); } final JavaConfigurationBuilder shuffleConfBuilder = Tang.Factory.getTang() .newConfigurationBuilder(shuffleManagerList.get(stageSequence).get().getShuffleConfiguration(computeTaskId)); <START> return shuffleConfBuilder <END> .bindNamedParameter(DataShuffle.class, DataShuffle.getShuffleName(stageSequence)) .build(); }</code><technical_language>This statement merged above. declare a separate JavaConfigurationBuilder variable</technical_language>

Target:
private Configuration getShuffleTaskConfiguration(final int stageSequence, final String computeTaskId) { final JavaConfigurationBuilder shuffleConfBuilder = Tang.Factory.getTang().newConfigurationBuilder(); if (stageInfoList.get(stageSequence).isPreRunShuffleUsed()) { shuffleConfBuilder.addConfiguration( preRunShuffleManagerList.get(stageSequence).get().getShuffleConfiguration(computeTaskId)); shuffleConfBuilder.bindNamedParameter(DataPreRunShuffle.class, getPreRunShuffleName(stageSequence)); } if (stageInfoList.get(stageSequence).isPostRunShuffleUsed()) { shuffleConfBuilder.addConfiguration( postRunShuffleManagerList.get(stageSequence).get().getShuffleConfiguration(computeTaskId)); shuffleConfBuilder.bindNamedParameter(DataPostRunShuffle.class, getPostRunShuffleName(stageSequence)); } return shuffleConfBuilder.build(); }
Source:
<code><START> public MetaDataApplicationRestServiceImpl metaDataApplicationRestService(Environment environment){ <END> return new MetaDataApplicationRestServiceImpl(environment); }</code><technical_language>returning based interface impl class</technical_language>

Target:
public MetaDataService metaDataApplicationRestService(Environment environment){ return new MetaDataRestServiceImpl(environment); }
Source:
<code>private KerberosRealm getKerberosRealm() { <START> Collection<Realm> realmsList = (Collection<Realm>) authenticationService.getRealmsList(); <END> if (realmsList != null) { for (Realm realm : realmsList) { String name = realm.getClass().getName(); LOG.debug("RealmClass.getName: {}", name); if (name.equals("org.apache.zeppelin.realm.kerberos.KerberosRealm")) { return (KerberosRealm) realm; } } } return null; }</code><technical_language>change signature of AuthenticationService instead of type cast</technical_language>

Target:
private KerberosRealm getKerberosRealm() { Collection<Realm> realmsList = authenticationService.getRealmsList(); if (realmsList != null) { for (Realm realm : realmsList) { String name = realm.getClass().getName(); LOG.debug("RealmClass.getName: {}", name); if (name.equals("org.apache.zeppelin.realm.kerberos.KerberosRealm")) { return (KerberosRealm) realm; } } } return null; }
Source:
<code>public void setApiKey(@NonNull String apiKey) { <START> if (apiKey != null) { <END> impl.setApiKey(apiKey); } else { error("apiKey"); } }</code><technical_language>This is place crash burn</technical_language>

Target:
public void setApiKey(@NonNull String apiKey) { validateApiKey(apiKey); impl.setApiKey(apiKey); }
Source:
<code>Pair<String, File> encryptSegmentIfNeeded(File tempDecryptedFile, File tempEncryptedFile, boolean isUploadedSegmentEncrypted, String crypterUsedInUploadedSegment, String crypterClassNameInTableConfig, String segmentName, String tableName) { boolean segmentNeedsEncryption = !Strings.isNullOrEmpty(crypterClassNameInTableConfig); File finalSegmentFile = (isUploadedSegmentEncrypted || segmentNeedsEncryption) ? tempEncryptedFile : tempDecryptedFile; String crypterClassName = Strings.isNullOrEmpty(crypterClassNameInTableConfig) ? crypterUsedInUploadedSegment : crypterClassNameInTableConfig; ImmutablePair<String, File> out = ImmutablePair.of(crypterClassName, finalSegmentFile); if (!segmentNeedsEncryption) { return out; } if (isUploadedSegmentEncrypted && !crypterClassNameInTableConfig.equals(crypterUsedInUploadedSegment)) { throw new ControllerApplicationException(LOGGER, String .format("Uploaded segment is encrypted with '%s' while table config requires '%s' as crypter " + "(segment name = '%s', table name = '%s').", crypterUsedInUploadedSegment, crypterClassNameInTableConfig, segmentName, tableName), Response.Status.INTERNAL_SERVER_ERROR); } PinotCrypter pinotCrypter = PinotCrypterFactory.create(crypterClassNameInTableConfig); <START> LOGGER.info("Using crypter class for encrypting to {}.", crypterClassNameInTableConfig, tempDecryptedFile, <END> tempEncryptedFile); pinotCrypter.encrypt(tempDecryptedFile, tempEncryptedFile); return out; }</code><technical_language>please add table name segment name here. In production, multiple parallel pushes on, is useful determine segment/table talking about</technical_language>

Target:
Pair<String, File> encryptSegmentIfNeeded(File tempDecryptedFile, File tempEncryptedFile, boolean isUploadedSegmentEncrypted, String crypterUsedInUploadedSegment, String crypterClassNameInTableConfig, String segmentName, String tableName) { boolean segmentNeedsEncryption = !Strings.isNullOrEmpty(crypterClassNameInTableConfig); File finalSegmentFile = (isUploadedSegmentEncrypted || segmentNeedsEncryption) ? tempEncryptedFile : tempDecryptedFile; String crypterClassName = Strings.isNullOrEmpty(crypterClassNameInTableConfig) ? crypterUsedInUploadedSegment : crypterClassNameInTableConfig; ImmutablePair<String, File> out = ImmutablePair.of(crypterClassName, finalSegmentFile); if (!segmentNeedsEncryption) { return out; } if (isUploadedSegmentEncrypted && !crypterClassNameInTableConfig.equals(crypterUsedInUploadedSegment)) { throw new ControllerApplicationException(LOGGER, String.format( "Uploaded segment is encrypted with '%s' while table config requires '%s' as crypter " + "(segment name = '%s', table name = '%s').", crypterUsedInUploadedSegment, crypterClassNameInTableConfig, segmentName, tableName), Response.Status.INTERNAL_SERVER_ERROR); } PinotCrypter pinotCrypter = PinotCrypterFactory.create(crypterClassNameInTableConfig); LOGGER.info("Using crypter class '{}' for encrypting '{}' to '{}' (segment name = '{}', table name = '{}').", crypterClassNameInTableConfig, tempDecryptedFile, tempEncryptedFile, segmentName, tableName); pinotCrypter.encrypt(tempDecryptedFile, tempEncryptedFile); return out; }
Source:
<code>private void addDefaultGraphicsDevice() { VmDevice device = VmDeviceCommonUtils.findVmDeviceByGeneralType( vmBase.getManagedDeviceMap(), VmDeviceGeneralType.GRAPHICS); if (device == null) { VmDeviceType deviceType = <START> vmBase.getDefaultDisplayType() == DisplayType.vga ? VmDeviceType.VNC : VmDeviceType.SPICE; <END> device = new GraphicsDevice(deviceType); device.setId(new VmDeviceId(Guid.newGuid(), vmBase.getId())); addManagedVmDevice(device); } }</code><technical_language>os-repository prevent unsupported configuration</technical_language>

Target:
private void addDefaultGraphicsDevice() { VmDevice device = VmDeviceCommonUtils.findVmDeviceByGeneralType( vmBase.getManagedDeviceMap(), VmDeviceGeneralType.GRAPHICS); if (device != null) { return; } List<Pair<GraphicsType, DisplayType>> graphicsAndDisplays = osRepository.getGraphicsAndDisplays(vmBase.getOsId(), new Version(getVersion())); GraphicsType graphicsType = vmBase.getDefaultDisplayType() == DisplayType.vga ? GraphicsType.VNC : GraphicsType.SPICE; GraphicsType supportedGraphicsType = null; for (Pair<GraphicsType, DisplayType> pair : graphicsAndDisplays) { if (pair.getSecond() == vmBase.getDefaultDisplayType()) { if (pair.getFirst() == graphicsType) { supportedGraphicsType = graphicsType; break; } if (supportedGraphicsType == null) { supportedGraphicsType = pair.getFirst(); } } } if (supportedGraphicsType != null) { device = new GraphicsDevice(supportedGraphicsType.getCorrespondingDeviceType()); device.setId(new VmDeviceId(Guid.newGuid(), vmBase.getId())); addManagedVmDevice(device); } }