auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>protected void doFullEntryScan(Predicate predicate, Set<Map.Entry<K, V>> resultingSet) { InternalSerializationService serializationService = this.serializationService; CachedQueryEntry queryEntry = new CachedQueryEntry(); Set<Map.Entry<Data, QueryCacheRecord>> entries = recordStore.entrySet(); for (Map.Entry<Data, QueryCacheRecord> entry : entries) { Data keyData = entry.getKey(); QueryCacheRecord record = entry.getValue(); Object value = record.getValue(); queryEntry.init(serializationService, keyData, value, extractors); boolean valid = predicate.apply(queryEntry); if (valid) { Object keyObject = queryEntry.getKey(); Object valueObject = toObject(queryEntry.getValueData()); <START> Map.Entry simpleEntry = new AbstractMap.SimpleEntry(keyObject, valueObject); <END> resultingSet.add(simpleEntry); } } }</code><technical_language>LazyMapEntry in [ClientMapProxy#entrySet](<LINK_0></technical_language>

Target:
protected void doFullEntryScan(Predicate predicate, Set<Map.Entry<K, V>> resultingSet) { InternalSerializationService serializationService = this.serializationService; CachedQueryEntry queryEntry = new CachedQueryEntry(); Set<Map.Entry<Data, QueryCacheRecord>> entries = recordStore.entrySet(); for (Map.Entry<Data, QueryCacheRecord> entry : entries) { Data keyData = entry.getKey(); QueryCacheRecord record = entry.getValue(); Object value = record.getValue(); queryEntry.init(serializationService, keyData, value, extractors); boolean valid = predicate.apply(queryEntry); if (valid) { Map.Entry simpleEntry = new LazyMapEntry(queryEntry.getKeyData(), queryEntry.getValueData(), serializationService); resultingSet.add(simpleEntry); } } }
Source:
<code>public void visit(ClassVisitor visitor) { String signature = null; boolean isInterface = access.contains(INTERFACE); if (superClass.isGeneric() || any(interfaces, ParameterizedType::isGeneric)) { signature = genericClassSignature(superClass, interfaces); } String[] interfaces = new String[this.interfaces.size()]; for (int i = 0; i < interfaces.length; i++) { interfaces[i] = this.interfaces.get(i).getClassName(); } int accessModifier = toAccessModifier(access); visitor.visit(V1_7, isInterface ? accessModifier : accessModifier | ACC_SUPER, type.getClassName(), signature, superClass.getClassName(), interfaces); if (source != null) { visitor.visitSource(source, debug); } for (AnnotationDefinition annotation : annotations) { annotation.visitClassAnnotation(visitor); } for (FieldDefinition field : fields) { field.visit(visitor); } <START> if (!isInterface) { <END> classInitializer.visit(visitor, true); } for (MethodDefinition method : methods) { method.visit(visitor); } visitor.visitEnd(); }</code><technical_language>Change getClassInitializer() throw if class is interface</technical_language>

Target:
public void visit(ClassVisitor visitor) { String signature = null; if (superClass.isGeneric() || any(interfaces, ParameterizedType::isGeneric)) { signature = genericClassSignature(superClass, interfaces); } String[] interfaces = new String[this.interfaces.size()]; for (int i = 0; i < interfaces.length; i++) { interfaces[i] = this.interfaces.get(i).getClassName(); } int accessModifier = toAccessModifier(access); visitor.visit(V1_7, isInterface() ? accessModifier : accessModifier | ACC_SUPER, type.getClassName(), signature, superClass.getClassName(), interfaces); if (source != null) { visitor.visitSource(source, debug); } for (AnnotationDefinition annotation : annotations) { annotation.visitClassAnnotation(visitor); } for (FieldDefinition field : fields) { field.visit(visitor); } if (!isInterface()) { classInitializer.visit(visitor, true); } for (MethodDefinition method : methods) { method.visit(visitor); } visitor.visitEnd(); }
Source:
<code>public long getLastModified(ResourceInfo src) { if (src.url != null) { URLConnection conn = null; try { conn = src.url.openConnection(); final long v = conn.getLastModified(); return v != -1 ? v : 0; } catch (Throwable ex) { return -1; } finally { if (conn != null) { try { conn.getInputStream().close(); <START> } catch (Exception ignored) { } <END> } } } final long v = src.file.lastModified(); return v == -1 ? 0 : v == 0 ? -1 : v; }</code><technical_language>log</technical_language>

Target:
public long getLastModified(ResourceInfo src) { if (src.url != null) { URLConnection conn = null; try { conn = src.url.openConnection(); final long v = conn.getLastModified(); return v != -1 ? v : 0; } catch (Throwable ex) { return -1; } finally { if (conn != null) { try { conn.getInputStream().close(); } catch (Throwable e) { log.warn("The connection cannot be closed", e); } } } } final long v = src.file.lastModified(); return v == -1 ? 0 : v == 0 ? -1 : v; }
Source:
<code>public void removeRecipe(IItemStack output) { throw new IllegalArgumentException( <START> "The Pure daisy does not output IItemStacks, use removeRecipeByBlock(MCBlockState)!"); <END> }</code><technical_language>suggestion "The Pure Daisy output IItemStacks, removeRecipeByBlock(MCBlockState)!");</technical_language>

Target:
public void removeRecipe(IItemStack output) { throw new IllegalArgumentException( "The Pure Daisy does not output IItemStacks, use removeRecipeByBlock(MCBlockState)!"); }
Source:
<code>public LayoutElementParcelable(Parcel im) { filetype = im.readInt(); iconData = im.readParcelable(IconDataParcelable.class.getClassLoader()); title = im.readString(); desc = im.readString(); permissions = im.readString(); symlink = im.readString(); int j = im.readInt(); date = im.readLong(); <START> dateModification = im.readString(); <END> int i = im.readInt(); header = i != 0; isDirectory = j != 0; size = im.readString(); longSize=im.readLong(); }</code><technical_language>This line is in wrong position, I think, Parcel read in order is written</technical_language>

Target:
public LayoutElementParcelable(Parcel im) { filetype = im.readInt(); iconData = im.readParcelable(IconDataParcelable.class.getClassLoader()); title = im.readString(); desc = im.readString(); permissions = im.readString(); symlink = im.readString(); int j = im.readInt(); date = im.readLong(); int i = im.readInt(); header = i != 0; isDirectory = j != 0; dateModification = im.readString(); size = im.readString(); longSize=im.readLong(); }
Source:
<code>protected void newSelection(ISelection selection) { List<IStoreItem> res = new ArrayList<IStoreItem>(); if (selection instanceof StructuredSelection) { StructuredSelection str = (StructuredSelection) selection; Iterator<?> iter = str.iterator(); while (iter.hasNext()) { Object object = (Object) iter.next(); if (object instanceof IAdaptable) { IAdaptable ad = (IAdaptable) object; IStoreItem coll = (IStoreItem) ad.getAdapter(IStoreItem.class); if (coll != null) { res.add(coll); } } } } clearChangeListeners(); if (res.size() > 0) { if (appliesToMe(res, aTests)) { curList.addAll(res); Iterator<IStoreItem> iter = curList.iterator(); while (iter.hasNext()) { IStoreItem iC = iter.next(); iC.addChangeListener(changeListener); } } } display(res); <START> <END> }</code><technical_language>this display() call is in wrong place. called a successful **appliesToMe()** call. move it</technical_language>

Target:
protected void newSelection(ISelection selection) { List<IStoreItem> res = new ArrayList<IStoreItem>(); if (selection instanceof StructuredSelection) { StructuredSelection str = (StructuredSelection) selection; Iterator<?> iter = str.iterator(); while (iter.hasNext()) { Object object = (Object) iter.next(); if (object instanceof IAdaptable) { IAdaptable ad = (IAdaptable) object; IStoreItem coll = (IStoreItem) ad.getAdapter(IStoreItem.class); if (coll != null) { res.add(coll); } } } } clearChangeListeners(); if (res.size() > 0) { if (appliesToMe(res, aTests)) { curList.addAll(res); Iterator<IStoreItem> iter = curList.iterator(); while (iter.hasNext()) { IStoreItem iC = iter.next(); iC.addChangeListener(changeListener); } display(res); } } }
Source:
<code><START> public List<String> getPushOptions() throws RequestNotYetReadException { <END> if (enabledCapabilities == null) throw new RequestNotYetReadException(); return Collections.unmodifiableList(pushOptions); }</code><technical_language>missing @since 4.5 for new API method</technical_language>

Target:
public List<String> getPushOptions() throws RequestNotYetReadException { if (enabledCapabilities == null) { throw new RequestNotYetReadException(); } return Collections.unmodifiableList(pushOptions); }
Source:
<code>public Dataset<Row> apply(Dataset<Row> df) { df = mergeAlgorithms(df); df = withSuggestionScore(df); df = filterToBestSuggestions(df); df = df.select( col("algos").alias(METHOD), col("wikiid").alias(WIKI), col(SUGGESTION_SCORE), col(QUERY), col(DYM)); if (!df.schema().sameType(SCHEMA_OUT)) { <START> df.printSchema(); <END> throw new SchemaInconsistencyException("Output does not match expected schema!"); } return df; }</code><technical_language>nit: pass df.schema() SchemaInconsistencyException fit exception message StructType#treeString()</technical_language>

Target:
public Dataset<Row> apply(Dataset<Row> df) { df = mergeAlgorithms(df); df = withSuggestionScore(df); df = filterToBestSuggestions(df); df = df.select( col("algos").alias("method"), col("wikiid").alias("wiki"), col("suggestion_score"), col("query"), col("dym")); StructType schema = df.schema(); if (!schema.sameType(SCHEMA_OUT)) { throw new SchemaInconsistencyException( "Output does not match expected schema!", schema); } return df; }
Source:
<code>public void traceRangeUpdated(TmfTraceRangeUpdatedSignal signal) { ITmfTrace trace = signal.getTrace(); if (!isListeningTo(trace)) { return; } synchronized (fStatisticsRangeUpdateSyncObj) { if (fSendRangeRequest) { fSendRangeRequest = false; <START> requestTimeRangeData(trace, signal.getRange()); <END> } } requestData(trace, signal.getRange()); }</code><technical_language>get current range new trace manager signal</technical_language>

Target:
public void traceRangeUpdated(TmfTraceRangeUpdatedSignal signal) { ITmfTrace trace = signal.getTrace(); if (!isListeningTo(trace)) { return; } synchronized (fStatisticsRangeUpdateSyncObj) { if (fSendRangeRequest) { fSendRangeRequest = false; requestTimeRangeData(trace, fTrace.getCurrentRange()); } } requestData(trace, signal.getRange()); }
Source:
<code>public void searchPayments_errorWhenCardDigitsAreInvalid() throws Exception { InputStream body = searchPayments(API_KEY, ImmutableMap.<String, String>builder() .put("reference", VALID_REFERENCE) .put("email", VALID_EMAIL) .put("state", VALID_STATE) .put("first_digits_card_number", "4242") <START> .put("last_digits_card_number", "423") <END> .put("from_date", VALID_FROM_DATE) .put("to_date", VALID_TO_DATE) .build() ) .statusCode(422) .contentType(JSON).extract() .body().asInputStream(); String json = IOUtils.toString(body, "UTF-8"); JsonAssert.with(json) .assertThat("$.*", hasSize(2)) .assertThat("$.code", is("P0401")) .assertThat("$.description", is("Invalid parameters: first_digits_card_number, last_digits_card_number. See Public API documentation for the correct data formats")); }</code><technical_language>of wrong length other right length non-digits in cover a broader swathe of validation</technical_language>

Target:
public void searchPayments_errorWhenCardDigitsAreInvalid() throws Exception { InputStream body = searchPayments(API_KEY, ImmutableMap.<String, String>builder() .put("reference", VALID_REFERENCE) .put("email", VALID_EMAIL) .put("state", VALID_STATE) .put("first_digits_card_number", "4a4234") .put("last_digits_card_number", "423") .put("from_date", VALID_FROM_DATE) .put("to_date", VALID_TO_DATE) .build() ) .statusCode(422) .contentType(JSON).extract() .body().asInputStream(); String json = IOUtils.toString(body, "UTF-8"); JsonAssert.with(json) .assertThat("$.*", hasSize(2)) .assertThat("$.code", is("P0401")) .assertThat("$.description", is("Invalid parameters: first_digits_card_number, last_digits_card_number. See Public API documentation for the correct data formats")); }
Source:
<code>public final void start(LeaderContender contender) throws Exception { Preconditions.checkNotNull(contender, "Contender must not be null."); Preconditions.checkState(leaderContender == null, "Contender was already set."); LOG.info("Starting LeaderElectionService {}.", this); synchronized (lock) { leaderContender = contender; running = true; <START> leaderElectionDriver.start(leaderElectionStateHandle); <END> } }</code><technical_language>LeaderElectionDriver a bit easier if instantiated here. save start method. Of need add a LeaderElectionDriverFactory</technical_language>

Target:
public final void start(LeaderContender contender) throws Exception { checkNotNull(contender, "Contender must not be null."); Preconditions.checkState(leaderContender == null, "Contender was already set."); synchronized (lock) { leaderContender = contender; leaderElectionDriver = leaderElectionDriverFactory.createLeaderElectionDriver( this, new LeaderElectionFatalErrorHandler(), leaderContender.getDescription()); LOG.info("Starting DefaultLeaderElectionService with {}.", leaderElectionDriver); running = true; } }
Source:
<code><START> public static void bindCompletionProcessor(final AbstractPropertySection section, IAssistContentProvider assistContentProvider, final Text text) { List<IAssistContentProvider> extension = EclipseUtil.getExtensionPlugins(IAssistContentProvider.class, IAssistContentProvider.ID, IAssistContentProvider.CLASS_ATTRIBUTE); if (!(extension.size() == 0)) { assistContentProvider.setView(section); IBindingService bindingService = PlatformUI.getWorkbench().getService(IBindingService.class); TriggerSequence[] activeBindinds = bindingService.getActiveBindingsFor(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS); if (activeBindinds != null && activeBindinds.length > 0) { TriggerSequence sequence = activeBindinds[0]; KeyStroke keyStroke = getKeyStroke(sequence); TextContentAdapter textContentAdapter = new TextContentAdapter(); ContentProposalAdapter adapter = new ContentProposalAdapter(text, textContentAdapter, assistContentProvider, keyStroke, IAssistContentProvider.AUTO_ACTIVATION_CHARACTERS); adapter.setPopupSize(new Point(500, 300)); adapter.addContentProposalListener(assistContentProvider); } } } <END></code><technical_language>Lots of code ducplication shared method below</technical_language>

Target:
public static void bindCompletionProcessor(final AbstractPropertySection section, IAssistContentProvider assistContentProvider, final Text text) { IAssistContentProvider contentProposalAdapter = Optional.ofNullable(assistContentProvider).orElseGet(TypeContentProposalProvider::getIAssistContentProvider); if (contentProposalAdapter != null) { contentProposalAdapter.setView(section); IBindingService bindingService = PlatformUI.getWorkbench().getService(IBindingService.class); TriggerSequence[] activeBindinds = bindingService.getActiveBindingsFor(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS); if (activeBindinds != null && activeBindinds.length > 0) { TriggerSequence sequence = activeBindinds[0]; KeyStroke keyStroke = getKeyStroke(sequence); TextContentAdapter textContentAdapter = new TextContentAdapter(); ContentProposalAdapter adapter = new ContentProposalAdapter(text, textContentAdapter, contentProposalAdapter, keyStroke, IAssistContentProvider.AUTO_ACTIVATION_CHARACTERS); adapter.setPopupSize(new Point(500, 300)); adapter.addContentProposalListener(contentProposalAdapter); } } }
Source:
<code>public void setup() { argument = new ShardConsumerArgument(shardInfo, STREAM_NAME, leaseRefresher, executorService, recordsPublisher, shardRecordProcessor, checkpointer, recordProcessorCheckpointer, parentShardPollIntervalMillis, taskBackoffTimeMillis, skipShardSyncAtWorkerInitializationIfLeasesExist, listShardsBackoffTimeInMillis, maxListShardsRetryAttempts, shouldCallProcessRecordsEvenForEmptyRecordList, idleTimeInMillis, INITIAL_POSITION_IN_STREAM, cleanupLeasesOfCompletedShards, ignoreUnexpectedChildShards, shardDetector, new AggregatorUtil(), <START> new HierarchichalShardSyncer(), metricsFactory); <END> consumer = spy( new ShardConsumer(recordsPublisher, executorService, shardInfo, logWarningForTaskAfterMillis, argument)); when(shardInfo.shardId()).thenReturn("shardId-000000000000"); when(recordProcessorCheckpointer.checkpointer()).thenReturn(checkpointer); }</code><technical_language>need a new instance of ShardSyncer? a mock object</technical_language>

Target:
public void setup() { argument = new ShardConsumerArgument(shardInfo, STREAM_NAME, leaseRefresher, executorService, recordsPublisher, shardRecordProcessor, checkpointer, recordProcessorCheckpointer, parentShardPollIntervalMillis, taskBackoffTimeMillis, skipShardSyncAtWorkerInitializationIfLeasesExist, listShardsBackoffTimeInMillis, maxListShardsRetryAttempts, shouldCallProcessRecordsEvenForEmptyRecordList, idleTimeInMillis, INITIAL_POSITION_IN_STREAM, cleanupLeasesOfCompletedShards, ignoreUnexpectedChildShards, shardDetector, new AggregatorUtil(), hierarchicalShardSyncer, metricsFactory); consumer = spy( new ShardConsumer(recordsPublisher, executorService, shardInfo, logWarningForTaskAfterMillis, argument)); when(shardInfo.shardId()).thenReturn("shardId-000000000000"); when(recordProcessorCheckpointer.checkpointer()).thenReturn(checkpointer); }
Source:
<code>public void afterPropertiesSet() throws Exception { if (workingDir == null) { String apacheWorkDir = System.getProperty("apacheDSWorkDir"); if (apacheWorkDir == null) { apacheWorkDir = createTempDirectory("apacheds-spring-security-"); } setWorkingDirectory(new File(apacheWorkDir)); } if (this.ldapOverSslEnabled && this.keyStoreFile == null) { throw new IllegalArgumentException("When LdapOverSsl is enabled, the keyStoreFile property must be set."); } server = new LdapServer(); server.setDirectoryService(service); if (this.port == 0) { this.port = getRandomPort(); <START> } <END> TcpTransport transport = new TcpTransport(port); if (ldapOverSslEnabled) { transport.setEnableSSL(true); server.setKeystoreFile(this.keyStoreFile.getAbsolutePath()); server.setCertificatePassword(this.certificatePassord); } server.setTransports(transport); start(); }</code><technical_language>for confusion. finding a random port in this configuration support. problem is port resolved open port assigned, port is another process thread, this code port. fix this want able pass in 0 TcpTransport avoid a race condition</technical_language>

Target:
public void afterPropertiesSet() throws Exception { if (workingDir == null) { String apacheWorkDir = System.getProperty("apacheDSWorkDir"); if (apacheWorkDir == null) { apacheWorkDir = createTempDirectory("apacheds-spring-security-"); } setWorkingDirectory(new File(apacheWorkDir)); } if (this.ldapOverSslEnabled && this.keyStoreFile == null) { throw new IllegalArgumentException("When LdapOverSsl is enabled, the keyStoreFile property must be set."); } server = new LdapServer(); server.setDirectoryService(service); this.transport = new TcpTransport(port); if (ldapOverSslEnabled) { transport.setEnableSSL(true); server.setKeystoreFile(this.keyStoreFile.getAbsolutePath()); server.setCertificatePassword(this.certificatePassord); } server.setTransports(transport); start(); }
Source:
<code>public IPAddress getAllocatedTask(final String appId) { final List<IPAddress> copiedList = new ArrayList<>(taskList); <START> Collections.shuffle(copiedList); <END> final IPAddress task0 = copiedList.get(0); final IPAddress task1 = copiedList.get(1); if (this.taskInfoMap.get(task0).getCpuLoad() < this.taskInfoMap.get(task1).getCpuLoad()) { return task0; } else { return task1; } }</code><technical_language>Copying list for query heavy operation. Random get tasks</technical_language>

Target:
public IPAddress getAllocatedTask(final String appId) { int index0, index1; index0 = random.nextInt(taskList.size()); index1 = random.nextInt(taskList.size()); while (index1 == index0) { index1 = random.nextInt(taskList.size()); } final IPAddress task0 = taskList.get(index0); final IPAddress task1 = taskList.get(index1); if (this.taskInfoMap.get(task0).getCpuLoad() < this.taskInfoMap.get(task1).getCpuLoad()) { return task0; } else { return task1; } }
Source:
<code>public void setUp() { <START> when(timeProvider.elapsedRealtime()).thenReturn((long) 0); <END> }</code><technical_language>suggestion when(motionEvent.getDownTime()).thenReturn((long) 0);</technical_language>

Target:
public void setUp() { when(motionEvent.getDownTime()).thenReturn((long) 0); }
Source:
<code>private Flux<PartitionEvent> createConsumer(String linkName, String partitionId, EventPosition startingPosition, ReceiveOptions receiveOptions) { return openPartitionConsumers .computeIfAbsent(linkName, name -> { logger.info("{}: Creating receive consumer for partition '{}'", linkName, partitionId); return createPartitionConsumer(name, partitionId, startingPosition, receiveOptions); }) .receive() .doFinally(signalType -> { <START> logger.info("{}: Receiving completed. Signal: {}", linkName, signalType); <END> final EventHubPartitionAsyncConsumer consumer = openPartitionConsumers.remove(linkName); if (consumer != null) { try { consumer.close(); } catch (IOException e) { logger.warning("Exception occurred while closing consumer {}", linkName, e); } } }); }</code><technical_language>Include partition id in log message</technical_language>

Target:
private Flux<PartitionEvent> createConsumer(String linkName, String partitionId, EventPosition startingPosition, ReceiveOptions receiveOptions) { return openPartitionConsumers .computeIfAbsent(linkName, name -> { logger.info("{}: Creating receive consumer for partition '{}'", linkName, partitionId); return createPartitionConsumer(name, partitionId, startingPosition, receiveOptions); }) .receive() .doFinally(signalType -> { logger.info("{}: Receiving completed. Partition: '{}'. Signal: '{}'", linkName, partitionId, signalType); final EventHubPartitionAsyncConsumer consumer = openPartitionConsumers.remove(linkName); if (consumer != null) { try { consumer.close(); } catch (IOException e) { logger.warning("Exception occurred while closing consumer {}", linkName, e); } } }); }
Source:
<code><START> public MesosSlaveInfo getMesosSlaveInfoForLabel(Label label) { <END> if (!matchesLabel(label)) { return null; } if (label.matches(Label.parse(getLabelString()))) { return this; } if (!containerInfo.getDockerImageCustomizable()) { return null; } String customImage = getCustomImage(label); if (customImage == null) { return null; } return copyWithDockerImage(label.toString(), customImage); }</code><technical_language>This deserves a unit test</technical_language>

Target:
public MesosSlaveInfo getMesosSlaveInfoForLabel(Label label) { if (!matchesLabel(label)) { return null; } if (label == null) { if (getLabelString() == null) { return this; } else { return null; } } if (label.matches(Label.parse(getLabelString()))) { return this; } if (!containerInfo.getDockerImageCustomizable()) { return null; } String customImage = getCustomImage(label); if (customImage == null) { return null; } return copyWithDockerImage(label.toString(), customImage); }
Source:
<code>public void testSetTagsOnVirtualGuest() throws Exception { ImmutableSet<String> tags = ImmutableSet.of("test", "jclouds"); assertTrue(virtualGuestApi.setTags(virtualGuest.getId(), tags)); VirtualGuest found = virtualGuestApi.getVirtualGuest(virtualGuest.getId()); Set<TagReference> tagReferences = found.getTagReferences(); assertNotNull(tagReferences); for (String tag : tags) { <START> assertThat(Iterables.contains(tagReferences, tag)).isTrue(); <END> } }</code><technical_language>Nice catch - thanks</technical_language>

Target:
public void testSetTagsOnVirtualGuest() throws Exception { ImmutableSet<String> tags = ImmutableSet.of("test", "jclouds"); assertTrue(virtualGuestApi.setTags(virtualGuest.getId(), tags)); VirtualGuest found = virtualGuestApi.getVirtualGuest(virtualGuest.getId()); Set<TagReference> tagReferences = found.getTagReferences(); assertNotNull(tagReferences); ImmutableSet.Builder<String> actualTagsBuilder = ImmutableSet.builder(); for (TagReference ref : tagReferences) { actualTagsBuilder.add(ref.getTag().getName()); } Set<String> actualTags = actualTagsBuilder.build(); assertThat(actualTags).containsAll(tags); }
Source:
<code>private int setWifiTethering(final boolean enable) { int rval = TETHER_ERROR_MASTER_ERROR; final long ident = Binder.clearCallingIdentity(); try { synchronized (mPublicSync) { final WifiManager mgr = getWifiManager(); if (mgr == null) { mLog.e("setWifiTethering: failed to get WifiManager!"); return TETHER_ERROR_SERVICE_UNAVAIL; } if ((enable && mgr.startSoftAp(null )) || (!enable && mgr.stopSoftAp())) { mWifiTetherRequested = enable; return TETHER_ERROR_NO_ERROR; } return TETHER_ERROR_MASTER_ERRROR; } } finally { Binder.restoreCallingIdentity(ident); } <START> if (rval != TETHER_ERROR_NO_ERROR) { mWifiTetherRequested = false; } return <END> rval; }</code><technical_language>This is redundant, ?</technical_language>

Target:
private int setWifiTethering(final boolean enable) { int rval = TETHER_ERROR_MASTER_ERROR; final long ident = Binder.clearCallingIdentity(); try { synchronized (mPublicSync) { final WifiManager mgr = getWifiManager(); if (mgr == null) { mLog.e("setWifiTethering: failed to get WifiManager!"); return TETHER_ERROR_SERVICE_UNAVAIL; } if ((enable && mgr.startSoftAp(null )) || (!enable && mgr.stopSoftAp())) { mWifiTetherRequested = enable; return TETHER_ERROR_NO_ERROR; } return TETHER_ERROR_MASTER_ERRROR; } } finally { Binder.restoreCallingIdentity(ident); } return rval; }
Source:
<code>private <T> T resolveSchedulerBean(Class<T> schedulerType) { try { return resolveSchedulerBean(schedulerType, false); } catch (NoUniqueBeanDefinitionException ex) { <START> return resolveSchedulerBean(schedulerType, true); <END> } catch (NoSuchBeanDefinitionException ex2) { return null; } }</code><technical_language>Is a chance this method throw exception too? If so, handle it</technical_language>

Target:
private <T> T resolveSchedulerBean(Class<T> schedulerType) { try { return resolveSchedulerBeanByType(schedulerType); } catch (NoUniqueBeanDefinitionException ex) { return resolveSchedulerBeanByName(schedulerType); } catch (NoSuchBeanDefinitionException ex2) { return null; } }
Source:
<code>public synchronized void start() throws Exception { final File setEnvFile = new File(configuration.getDirectory(), "bin" + File.separator + (SystemUtils.IS_OS_WINDOWS ? "setenv.bat" : "setenv")); if (setEnvFile != null && setEnvFile.exists()) { final File setEnvBacFile = new File(setEnvFile.getAbsolutePath() + ".backup"); setEnvFile.renameTo(setEnvBacFile); log.info("File '{}' was renamed to '{}' to ensure the propagation of own environment properties", setEnvFile.getName(), setEnvBacFile.getName()); } if (getConfiguration().getSshPort() != KarafConfiguration.DEFAULT_SSH_PORT) { setEtcProperty("sshPort", getConfiguration().getSshPort(), "org.apache.karaf.shell"); } configuration.getEnvProps().put("KARAF_REDIRECT", getStdoutLogFile().getAbsolutePath()); super.start(); addShutdownHook(new Thread(new Runnable() { public void run() { log.debug("Start shutdown sequence."); try { final ProcessBuilder processBuilder = new ProcessBuilder(configuration.generateStopCommand()); ProcessBuilderExecutor.syncExecute(processBuilder); } catch (Exception e) { throw new IllegalStateException("Karaf container was not stopped", e); } } })); <START> addShutdownHook(new Thread(new Runnable() { <END> @Override public void run() { try { while (ProcessUtils.getJavaPidByContainerId(getId()) != null) { log.debug("Stopping container..."); Thread.sleep(TimeUnit.SECONDS.toMillis(1)); } } catch (InterruptedException e) { Thread.currentThread().interrupt(); } } })); }</code><technical_language>This hook shared</technical_language>

Target:
public synchronized void start() throws Exception { final File setEnvFile = new File(configuration.getDirectory(), "bin" + File.separator + (SystemUtils.IS_OS_WINDOWS ? "setenv.bat" : "setenv")); if (setEnvFile != null && setEnvFile.exists()) { final File setEnvBacFile = new File(setEnvFile.getAbsolutePath() + ".backup"); setEnvFile.renameTo(setEnvBacFile); log.info("File '{}' was renamed to '{}' to ensure the propagation of own environment properties", setEnvFile.getName(), setEnvBacFile.getName()); } if (getConfiguration().getSshPort() != KarafConfiguration.DEFAULT_SSH_PORT) { setEtcProperty("sshPort", getConfiguration().getSshPort(), "org.apache.karaf.shell"); } configuration.getEnvProps().put("KARAF_REDIRECT", getStdoutLogFile().getAbsolutePath()); super.start(); addShutdownHook(new Thread(new Runnable() { public void run() { log.debug("Start shutdown sequence."); try { final ProcessBuilder processBuilder = new ProcessBuilder(configuration.generateStopCommand()); ProcessBuilderExecutor.syncExecute(processBuilder); } catch (Exception e) { throw new IllegalStateException("Karaf container was not stopped", e); } } })); }
Source:
<code>private void updateQualityConditionsIfRequired(DbSession dbSession, QualityGateDto builtin) { List<QualityGateCondition> qualityGateConditions = qualityGateConditionDao.selectForQualityGate(dbSession, builtin.getId()) .stream() .map(dto -> { <START> MetricDto metricDto = dbClient.metricDao().selectById(dbSession, dto.getMetricId()); <END> if (metricDto != null) { dto.setMetricKey(metricDto.getKey()); } return QualityGateCondition.from(dto); }) .collect(MoreCollectors.toList()); List<QualityGateCondition> qgConditionsToBeDeleted = new ArrayList<>(qualityGateConditions); qgConditionsToBeDeleted.removeAll(QUALITY_GATE_CONDITIONS); qgConditionsToBeDeleted.stream() .forEach(qgc -> qualityGateConditionDao.delete(qgc.toQualityGateDto(builtin.getId()), dbSession)); List<QualityGateCondition> qgConditionsToBeCreated = new ArrayList<>(QUALITY_GATE_CONDITIONS); qgConditionsToBeCreated.removeAll(qualityGateConditions); qgConditionsToBeCreated.stream() .forEach(qgc -> qualityGateConditionsUpdater.createCondition(dbSession, builtin.getId(), qgc.getMetricKey(), qgc.getOperator(), qgc.getWarningThreshold(), qgc.getErrorThreshold(), qgc.getPeriod()) ); if (!qgConditionsToBeCreated.isEmpty() || !qgConditionsToBeDeleted.isEmpty()) { LOGGER.info("Built-in qualite gate's conditions[{}] has been updated", BUILTIN_QUALITY_GATE_NAME); } }</code><technical_language>This optimized loading metrics in conditions (by creating a map of metrics ids)</technical_language>

Target:
private void updateQualityConditionsIfRequired(DbSession dbSession, QualityGateDto builtin) { Map<Long, String> idToKeyMetric = dbClient.metricDao().selectAll(dbSession).stream() .collect(toMap(metricDto -> metricDto.getId().longValue(), MetricDto::getKey)); List<QualityGateCondition> qualityGateConditions = qualityGateConditionDao.selectForQualityGate(dbSession, builtin.getId()) .stream() .map(dto -> QualityGateCondition.from(dto, idToKeyMetric)) .collect(MoreCollectors.toList()); List<QualityGateCondition> qgConditionsToBeDeleted = new ArrayList<>(qualityGateConditions); qgConditionsToBeDeleted.removeAll(QUALITY_GATE_CONDITIONS); qgConditionsToBeDeleted.stream() .forEach(qgc -> qualityGateConditionDao.delete(qgc.toQualityGateDto(builtin.getId()), dbSession)); List<QualityGateCondition> qgConditionsToBeCreated = new ArrayList<>(QUALITY_GATE_CONDITIONS); qgConditionsToBeCreated.removeAll(qualityGateConditions); qgConditionsToBeCreated.stream() .forEach(qgc -> qualityGateConditionsUpdater.createCondition(dbSession, builtin.getId(), qgc.getMetricKey(), qgc.getOperator(), qgc.getWarningThreshold(), qgc.getErrorThreshold(), qgc.getPeriod()) ); if (!qgConditionsToBeCreated.isEmpty() || !qgConditionsToBeDeleted.isEmpty()) { LOGGER.info("Built-in quality gate's conditions of has been updated", BUILTIN_QUALITY_GATE_NAME); } }
Source:
<code>public void getAwsSecurityCredentials_fromMetadataServer() throws IOException { MockExternalAccountCredentialsTransportFactory transportFactory = new MockExternalAccountCredentialsTransportFactory(); AwsCredentials awsCredential = (AwsCredentials) AwsCredentials.newBuilder(AWS_CREDENTIAL) .setHttpTransportFactory(transportFactory) .setCredentialSource(buildAwsCredentialSource(transportFactory)) .build(); AwsSecurityCredentials credentials = awsCredential.getAwsSecurityCredentials(); <START> assertEquals(credentials.getAccessKeyId(), "accessKeyId"); <END> assertEquals(credentials.getSecretAccessKey(), "secretAccessKey"); assertEquals(credentials.getToken(), "token"); }</code><technical_language>expected</technical_language>

Target:
public void getAwsSecurityCredentials_fromMetadataServer() throws IOException { MockExternalAccountCredentialsTransportFactory transportFactory = new MockExternalAccountCredentialsTransportFactory(); AwsCredentials awsCredential = (AwsCredentials) AwsCredentials.newBuilder(AWS_CREDENTIAL) .setHttpTransportFactory(transportFactory) .setCredentialSource(buildAwsCredentialSource(transportFactory)) .build(); AwsSecurityCredentials credentials = awsCredential.getAwsSecurityCredentials(); assertEquals("accessKeyId", credentials.getAccessKeyId()); assertEquals("secretAccessKey", credentials.getSecretAccessKey()); assertEquals("token", credentials.getToken()); }
Source:
<code>private static boolean isScopeSingleton(SymbolMetadata clazzMeta) { List<AnnotationValue> values = clazzMeta.valuesForAnnotation(SCOPE_ANNOTATION_FQN); for (AnnotationValue annotationValue : values) { if ("value".equals(annotationValue.name()) || "scopeName".equals(annotationValue.name())) { <START> String scopeValue = ((LiteralTree) annotationValue.value()).value(); <END> if (!"\"singleton\"".equals(scopeValue)) { return false; } } } return true; }</code><technical_language>is guarantee a LiteralTree : write a testcase a Constant refers constant in annotation this this code fail ClassCastException static final String MY_CONSTANT = "singleton"; @Scope(MyClass.MY_CONSTANT);</technical_language>

Target:
private static boolean isScopeSingleton(SymbolMetadata clazzMeta) { List<AnnotationValue> values = clazzMeta.valuesForAnnotation(SCOPE_ANNOTATION_FQN); for (AnnotationValue annotationValue : values) { if (("value".equals(annotationValue.name()) || "scopeName".equals(annotationValue.name())) && annotationValue.value() instanceof LiteralTree && !"\"singleton\"".equals(((LiteralTree) annotationValue.value()).value())) { return false; } } return true; }
Source:
<code>private boolean writeOutput(Write write) { if (!inPlace) { synchronized (outputLock) { try { write.write(outWriter); } catch (IOException e) { errWriter.append("cannot write output: " + e.getMessage()).flush(); } outWriter.flush(); return true; } } else { String tempFileName = fileToFormat.fileName() + '#'; try (Writer writer = new OutputStreamWriter( new BufferedOutputStream(new FileOutputStream(tempFileName)), UTF_8)) { write.write(writer); outWriter.flush(); } catch (IOException e) { synchronized (outputLock) { errWriter .append(tempFileName) .append(": cannot write temp file: ") .append(e.getMessage()) .append('\n') .flush(); } return false; } try { Files.move( new File(tempFileName).toPath(), new File(fileToFormat.fileName()).toPath(), StandardCopyOption.REPLACE_EXISTING); } catch(IOException e) { synchronized (outputLock) { <START> errWriter.append(tempFileName).append(": cannot rename temp file").append('\n').flush(); <END> } return false; } return true; } }</code><technical_language>log exception message, consistent error handling in this method</technical_language>

Target:
private boolean writeOutput(Write write) { if (!inPlace) { synchronized (outputLock) { try { write.write(outWriter); } catch (IOException e) { errWriter.append("cannot write output: " + e.getMessage()).flush(); } outWriter.flush(); return true; } } else { String tempFileName = fileToFormat.fileName() + '#'; try (Writer writer = new OutputStreamWriter( new BufferedOutputStream(new FileOutputStream(tempFileName)), UTF_8)) { write.write(writer); outWriter.flush(); } catch (IOException e) { synchronized (outputLock) { errWriter .append(tempFileName) .append(": cannot write temp file: ") .append(e.getMessage()) .append('\n') .flush(); } return false; } try { Files.move( new File(tempFileName).toPath(), new File(fileToFormat.fileName()).toPath(), StandardCopyOption.REPLACE_EXISTING); } catch(IOException e) { synchronized (outputLock) { errWriter .append(tempFileName) .append(": cannot rename temp file: ") .append(e.getMessage()) .append('\n') .flush(); } return false; } return true; } }
Source:
<code>public void setTasksStatusUp(Process process) throws DataException, IOException { <START> Task currentTask = ServiceManager.getProcessService().getCurrentTask(process); <END> setTaskStatusUp(currentTask); }</code><technical_language>getCurrentTask anymore more current task process</technical_language>

Target:
public void setTasksStatusUp(Process process) throws DataException, IOException { List<Task> currentTask = ServiceManager.getProcessService().getCurrentTasks(process); if (currentTask.isEmpty()) { activateNextTasks(process.getTasks()); return; } setTaskStatusUp(currentTask); }
Source:
<code><START> public ImporterTopLevel getScope() <END> { if (fScope instanceof ImporterTopLevel) return (ImporterTopLevel) fScope; return null; }</code><technical_language>simply return a scriptableObject? need cast here, done outside</technical_language>

Target:
public ScriptableObject getScope() { return fScope; }
Source:
<code>public HBaseDataSink(Class<? extends GenericTableOutputFormat> c, Contract input, String name) { super(c, input, name); final Random rnd = new Random(); final StringBuilder bld = new StringBuilder(); for (int i = 0; i < IDENTIFYIER_LEN; i++) { bld.append((char) (rnd.nextInt(26) + 'a')); } setParameter(GenericTableOutputFormat.JOB_ID_KEY, bld.toString()); <START> setParameter(GenericTableOutputFormat.JOB_ID_KEY, rnd.nextInt()); <END> }</code><technical_language>This right. in previous line is plainly overwritten</technical_language>

Target:
public HBaseDataSink(Class<? extends GenericTableOutputFormat> c, Contract input, String name) { super(c, input, name); final Random rnd = new Random(); final StringBuilder bld = new StringBuilder(); for (int i = 0; i < IDENTIFYIER_LEN; i++) { bld.append((char) (rnd.nextInt(26) + 'a')); } setParameter(GenericTableOutputFormat.JT_ID_KEY, bld.toString()); setParameter(GenericTableOutputFormat.JOB_ID_KEY, rnd.nextInt()); }
Source:
<code>public void testOpenExistingFileCompareEditor() throws Exception { editorReferences.add(getMockFileCompareEditor()); CompareEditorInput newInput = GerritCompareUi.getComparisonEditorInput( editorReferences.toArray(EMPTY_IEDITOR_REFERENCE_ARRAY), fileItemEditorInput, GerritCompareUi.getFileCompareFunction(item)); <START> assertFalse(COMPARE_EDITOR_TITLE.equals(reviewItemSetEditorInput.getTitle())); <END> assertTrue(COMPARE_EDITOR_TITLE.equals(newInput.getTitle())); }</code><technical_language>This assertion unnecessary</technical_language>

Target:
public void testOpenExistingFileCompareEditor() throws Exception { editorReferences.add(getMockFileCompareEditor()); CompareEditorInput newInput = GerritCompareUi.getComparisonEditorInput( editorReferences.toArray(EMPTY_IEDITOR_REFERENCE_ARRAY), fileItemEditorInput, GerritCompareUi.getFileComparePredicate(item)); assertTrue(newInput != fileItemEditorInput); assertEquals(COMPARE_EDITOR_TITLE, newInput.getTitle()); }
Source:
<code>public ConfigDescription getConfigDescription(URI uri, Locale locale) { if ("thing".equals(uri.getScheme()) == false) { return null; } <START> ThingTypeUID thingTypeUID = new ThingTypeUID(uri.getSchemeSpecificPart()); <END> ThingType thingType = thingTypeRegistry.getThingType(thingTypeUID); if (thingType == null) { return null; } URI configURI = thingType.getConfigDescriptionURI(); if (configURI == null) { return null; } ConfigDescription config = configDescriptionRegistry.getConfigDescription(configURI, locale); if (config == null) { return null; } return config; }</code><technical_language>is uri.getSchemeSpecificPart() of a sudden a type UID anymore a UID? Note ThingConfigDescriptionProvider, deals uris of Things</technical_language>

Target:
public ConfigDescription getConfigDescription(URI uri, Locale locale) { if ("thing".equals(uri.getScheme()) == false) { return null; } ThingUID thingUID = new ThingUID(uri.getSchemeSpecificPart()); ThingType thingType = thingTypeRegistry.getThingType(thingUID.getThingTypeUID()); if (thingType == null) { return null; } URI configURI = thingType.getConfigDescriptionURI(); if (configURI == null) { return null; } ConfigDescription config = configDescriptionRegistry.getConfigDescription(configURI, locale); if (config == null) { return null; } return config; }
Source:
<code>public static int calculateDecodedLength(char[] encoded, int offset, int len) { if (len == 0) { return 0; } int numPaddings = 0; if (encoded[offset + len - 1] == PAD) { numPaddings = 1; if (len >= 2 && encoded[offset + len - 2] == PAD) { <START> numPaddings = 2; <END> } } int remainder = len % 4; if ((numPaddings == 0) && (remainder != 0)) { numPaddings = 4 - remainder; } return (((len + 3) / 4) * 3) - numPaddings; }</code><technical_language>is purpose of this change</technical_language>

Target:
public static int calculateDecodedLength(char[] encoded, int offset, int len) { if (len == 0) return 0; if (len < 2) throw truncatedInput(); int numPaddings = 0; if (encoded[offset + len - 1] == PAD) { numPaddings = 1; if (encoded[offset + len - 2] == PAD) { numPaddings = 2; } } int remainder = len % 4; if ((numPaddings == 0) && (remainder != 0)) { numPaddings = 4 - remainder; } return (((len + 3) / 4) * 3) - numPaddings; }
Source:
<code>public void testSourceStatusAvailable() throws Exception { <START> SourceDescriptorImpl Descriptor = mock(SourceDescriptorImpl.class); <END> when(Descriptor.isAvailable()).thenReturn(true); SourceInfoRequest Request = new SourceInfoRequestSources(false, Collections.singleton("sourceId")); SourceInfoResponse Response = new SourceInfoResponseImpl(Request, Collections.EMPTY_MAP, Descriptor); when(catalogFramework.getSourceInfo(any(SourceInfoRequest.class))).thenReturn(Response); assertThat(poller.sourceStatus(CONFIG_PID), is(true)); }</code><technical_language>do mock SourceDescriptorImpl SourceDescriptor? mock interface if can</technical_language>

Target:
public void testSourceStatusAvailable() throws Exception { SourceDescriptor descriptor = mock(SourceDescriptor.class); when(descriptor.isAvailable()).thenReturn(true); when(descriptor.getLastAvailabilityDate()).thenReturn(new Date()); SourceInfoRequest request = new SourceInfoRequestSources(false, Collections.singleton("sourceId")); SourceInfoResponse response = new SourceInfoResponseImpl(request, Collections.EMPTY_MAP, descriptor); when(catalogFramework.getSourceInfo(any(SourceInfoRequest.class))).thenReturn(response); assertThat(poller.sourceStatus(CONFIG_PID), is(1)); }
Source:
<code><START> public PrintStreamWarningsPrinter(PrintStream printStream) <END> { this.printStream = requireNonNull(printStream, "printStream is null"); }</code><technical_language>this need public</technical_language>

Target:
PrintStreamWarningsPrinter(PrintStream printStream) { super(OptionalInt.empty()); this.printStream = requireNonNull(printStream, "printStream is null"); }
Source:
<code>private void getEligibleVolumes() { this.startProgress(constants.fetchingDataMessage()); AsyncQuery aQuery = new AsyncQuery(new INewAsyncCallback() { @Override public void onSuccess(Object model, Object returnValue) { GlusterVolumeGeoRepCreateModel.this.stopProgress(); VdcQueryReturnValue vdcReturnValue = (VdcQueryReturnValue) returnValue; if(!vdcReturnValue.getSucceeded()) { setQueryFailureMessage(vdcReturnValue.getExceptionString()); onPropertyChanged(new PropertyChangedEventArgs("queryFailed")); } else { List<GlusterVolumeEntity> eligibleVolumesList = (List<GlusterVolumeEntity>) vdcReturnValue.getReturnValue(); setVolumeList(eligibleVolumesList); getSlaveClusters().setItems(GlusterVolumeGeoRepCreateModel.this.getClusterForVolumes(eligibleVolumesList)); <START> recommendationViolations = ""; <END> onPropertyChanged(new PropertyChangedEventArgs("recommendationViolationVisibility")); } } }); Frontend.getInstance().runQuery(VdcQueryType.GetGlusterGeoReplicationEligibleVolumes, new IdQueryParameters(masterVolume.getId()), aQuery); }</code><technical_language>this set null</technical_language>

Target:
public void getEligibleVolumes() { this.startProgress(constants.fetchingDataMessage()); AsyncQuery aQuery = new AsyncQuery(new INewAsyncCallback() { @Override public void onSuccess(Object model, Object returnValue) { GlusterVolumeGeoRepCreateModel.this.stopProgress(); VdcQueryReturnValue vdcReturnValue = (VdcQueryReturnValue) returnValue; if(!vdcReturnValue.getSucceeded()) { setQueryFailureMessage(vdcReturnValue.getExceptionString()); onPropertyChanged(new PropertyChangedEventArgs("queryFailed")); } else { List<GlusterVolumeEntity> eligibleVolumesList = (List<GlusterVolumeEntity>) vdcReturnValue.getReturnValue(); recommendationViolations = null; setVolumeList(eligibleVolumesList); getSlaveClusters().setItems(GlusterVolumeGeoRepCreateModel.this.getClusterForVolumes(eligibleVolumesList)); } } }); Frontend.getInstance().runQuery(VdcQueryType.GetGlusterGeoReplicationEligibleVolumes, new IdQueryParameters(masterVolume.getId()), aQuery); }
Source:
<code>protected void updateSingleNic(XmlNode node, VmNetworkInterface iface) { iface.setName(node.SelectSingleNode(OvfProperties.VMD_NAME, _xmlNS).InnerText); iface.setMacAddress((node.SelectSingleNode("rasd:MACAddress", _xmlNS) != null) ? node.SelectSingleNode( "rasd:MACAddress", _xmlNS).InnerText : ""); String networkName = node.SelectSingleNode(OvfProperties.VMD_CONNECTION, _xmlNS).InnerText; if (StringUtils.isNotEmpty(networkName)) { iface.setNetworkName(networkName); <START> } else { <END> iface.setNetworkName(null); } XmlNode linkedNode = node.SelectSingleNode(OvfProperties.VMD_LINKED, _xmlNS); if (linkedNode != null) { iface.setLinked(Boolean.valueOf(linkedNode.InnerText)); } else { iface.setLinked(true); } String resourceSubType = node.SelectSingleNode("rasd:ResourceSubType", _xmlNS).InnerText; if (StringUtils.isNotEmpty(resourceSubType)) { iface.setType(Integer.parseInt(resourceSubType)); } XmlNode speed = node.SelectSingleNode("rasd:speed", _xmlNS); iface.setSpeed((speed != null) ? Integer.parseInt(speed.InnerText) : VmInterfaceType.forValue(iface.getType()) .getSpeed()); }</code><technical_language>network table null constraint name column, this exception import, is handled</technical_language>

Target:
protected void updateSingleNic(XmlNode node, VmNetworkInterface iface) { iface.setName(node.SelectSingleNode(OvfProperties.VMD_NAME, _xmlNS).InnerText); iface.setMacAddress((node.SelectSingleNode("rasd:MACAddress", _xmlNS) != null) ? node.SelectSingleNode( "rasd:MACAddress", _xmlNS).InnerText : ""); String networkName = node.SelectSingleNode(OvfProperties.VMD_CONNECTION, _xmlNS).InnerText; iface.setNetworkName(StringUtils.defaultIfEmpty(networkName, null)); XmlNode linkedNode = node.SelectSingleNode(OvfProperties.VMD_LINKED, _xmlNS); iface.setLinked(linkedNode == null ? true : Boolean.valueOf(linkedNode.InnerText)); String resourceSubType = node.SelectSingleNode("rasd:ResourceSubType", _xmlNS).InnerText; if (StringUtils.isNotEmpty(resourceSubType)) { iface.setType(Integer.parseInt(resourceSubType)); } XmlNode speed = node.SelectSingleNode("rasd:speed", _xmlNS); iface.setSpeed((speed != null) ? Integer.parseInt(speed.InnerText) : VmInterfaceType.forValue(iface.getType()) .getSpeed()); }