auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>protected static void initialiseOutbound(Node n, long baseTime, CommunicationDetails cd, StringBuilder nodeId) { CommunicationDetails.Outbound ob = new CommunicationDetails.Outbound(); ob.getIds().add(nodeId.toString()); ob.setMultiConsumer(true); ob.setProducerOffset(TimeUnit.MILLISECONDS.convert((n.getBaseTime() - baseTime), TimeUnit.NANOSECONDS)); cd.getOutbound().add(ob); if (n.getClass() == Producer.class) { ob = new CommunicationDetails.Outbound(); <START> for (int j = 0; j < ((Producer) n).getCorrelationIds().size(); j++) { <END> CorrelationIdentifier ci = ((Producer) n).getCorrelationIds().get(j); if (ci.getScope() == Scope.Interaction || ci.getScope() == Scope.ControlFlow) { ob.getIds().add(ci.getValue()); } } if (!ob.getIds().isEmpty()) { ob.setMultiConsumer(((Producer) n).multipleConsumers()); ob.setProducerOffset(TimeUnit.MILLISECONDS.convert((n.getBaseTime() - baseTime), TimeUnit.NANOSECONDS)); cd.getOutbound().add(ob); } } else if (n.containerNode()) { for (int i = 0; i < ((ContainerNode)n).getNodes().size(); i++) { int len = nodeId.length(); nodeId.append(':'); nodeId.append(i); initialiseOutbound(((ContainerNode) n).getNodes().get(i), baseTime, cd, nodeId); nodeId.delete(len, nodeId.length()); } } }</code><technical_language>Casting producer is necessary</technical_language>

Target:
protected static void initialiseOutbound(Node n, long baseTime, CommunicationDetails cd, StringBuilder nodeId) { CommunicationDetails.Outbound ob = new CommunicationDetails.Outbound(); ob.getIds().add(nodeId.toString()); ob.setMultiConsumer(true); ob.setProducerOffset(TimeUnit.MILLISECONDS.convert((n.getBaseTime() - baseTime), TimeUnit.NANOSECONDS)); cd.getOutbound().add(ob); if (n.getClass() == Producer.class) { ob = new CommunicationDetails.Outbound(); for (int j = 0; j < n.getCorrelationIds().size(); j++) { CorrelationIdentifier ci = n.getCorrelationIds().get(j); if (ci.getScope() == Scope.Interaction || ci.getScope() == Scope.ControlFlow) { ob.getIds().add(ci.getValue()); } } if (!ob.getIds().isEmpty()) { ob.setMultiConsumer(((Producer) n).multipleConsumers()); ob.setProducerOffset(TimeUnit.MILLISECONDS.convert((n.getBaseTime() - baseTime), TimeUnit.NANOSECONDS)); cd.getOutbound().add(ob); } } else if (n.containerNode()) { for (int i = 0; i < ((ContainerNode)n).getNodes().size(); i++) { int len = nodeId.length(); nodeId.append(':'); nodeId.append(i); initialiseOutbound(((ContainerNode) n).getNodes().get(i), baseTime, cd, nodeId); nodeId.delete(len, nodeId.length()); } } }
Source:
<code>public static boolean isCompressionCodecSupported(InputFormat inputFormat, Path path) { if (inputFormat instanceof TextInputFormat) { try { CompressionCodec compressionCodec = HiveUtil.getCompressionCodec((TextInputFormat) inputFormat, path); if (compressionCodec == null || Arrays.stream(S3SelectSupportedCompressionCodecs.values()) <START> .anyMatch(c -> c.codecClass.isInstance(compressionCodec))) { <END> return true; } } catch (IllegalAccessException | NoSuchFieldException e) { log.error(e, "Failed to find compressionCodec for inputFormat: %s", inputFormat.getClass().getName()); return false; } } return false; }</code><technical_language>abbreviating variable names -- c -> codec</technical_language>

Target:
public static boolean isCompressionCodecSupported(InputFormat inputFormat, Path path) { if (inputFormat instanceof TextInputFormat) { try { Optional<CompressionCodec> compressionCodec = getCompressionCodec((TextInputFormat) inputFormat, path); if (!compressionCodec.isPresent() || stream(S3SelectSupportedCompressionCodecs.values()) .anyMatch(codec -> codec.getCodecClass().isInstance(compressionCodec.get()))) { return true; } } catch (IllegalAccessException | NoSuchFieldException e) { LOG.error(e, "Failed to find compressionCodec for inputFormat: %s", inputFormat.getClass().getName()); return false; } } return false; }
Source:
<code>private String getTSUIDForMetric(final String query_string, TSDB tsdb) { if (query_string == null || query_string.isEmpty()) { throw new BadRequestException("The query string was empty"); } HashMap<String, String> tags = new HashMap<String, String>(); String metric = null; try { metric = Tags.parseWithMetric(query_string, tags); } catch (IllegalArgumentException e) { throw new BadRequestException(e.getMessage()); } TreeMap<String, String> sortedTags = new TreeMap<String, String>(tags); <START> ByteArrayOutputStream buf = new ByteArrayOutputStream(); <END> buf.write(tsdb.getUID(UniqueIdType.METRIC, metric), 0, 3); for (Entry<String, String> e : sortedTags.entrySet()) { buf.write(tsdb.getUID(UniqueIdType.TAGK, e.getKey()), 0, 3); buf.write(tsdb.getUID(UniqueIdType.TAGV, e.getValue()), 0, 3); } String tsuid = UniqueId.uidToString(buf.toByteArray()); return tsuid; }</code><technical_language>pre-allocate byte array size of metric UID size & # of tags. mark final. Final is a ton in OpenTSDB</technical_language>

Target:
private String getTSUIDForMetric(final String query_string, TSDB tsdb) { if (query_string == null || query_string.isEmpty()) { throw new BadRequestException("The query string was empty"); } final HashMap<String, String> tags = new HashMap<String, String>(); String metric = null; try { metric = Tags.parseWithMetric(query_string, tags); } catch (IllegalArgumentException e) { throw new BadRequestException(e); } final TreeMap<String, String> sortedTags = new TreeMap<String, String>(tags); final ByteArrayOutputStream buf = new ByteArrayOutputStream( TSDB.metrics_width() + sortedTags.size() * (TSDB.tagk_width() + TSDB.tagv_width())); try { buf.write(tsdb.getUID(UniqueIdType.METRIC, metric)); for (Entry<String, String> e: sortedTags.entrySet()) { buf.write(tsdb.getUID(UniqueIdType.TAGK, e.getKey()), 0, 3); buf.write(tsdb.getUID(UniqueIdType.TAGV, e.getValue()), 0, 3); } } catch (IOException e) { throw new BadRequestException(e); } final String tsuid = UniqueId.uidToString(buf.toByteArray()); return tsuid; }
Source:
<code>public void subscribeToTopic(final String topic, final AWSIotMqttQos qos, final AWSIotMqttSubscriptionStatusCallback subscriptionStatusCallback, final AWSIotMqttNewMessageCallback callback) { if (topic == null || topic.isEmpty()) { throw new IllegalArgumentException("topic is null or empty"); } if (qos == null) { throw new IllegalArgumentException("QoS cannot be null."); } if (null != mqttClient) { try { if (subscriptionStatusCallback != null) { mqttClient.subscribe(topic, qos.asInt(), null, new IMqttActionListener() { @Override public void onSuccess(IMqttToken asyncActionToken) { subscriptionStatusCallback.onSuccess(); } @Override public void onFailure(IMqttToken asyncActionToken, Throwable exception) { subscriptionStatusCallback.onFailure(exception); } }); } else { mqttClient.subscribe(topic, qos.asInt()); } } catch (final MqttException e) { <START> throw new AmazonClientException("Client error when subscribing.", e); <END> } final AWSIotMqttTopic topicModel = new AWSIotMqttTopic(topic, qos, callback); topicListeners.put(topic, topicModel); } }</code><technical_language>Consider passing this exception callback success failure passed callback consistently</technical_language>

Target:
public void subscribeToTopic(final String topic, final AWSIotMqttQos qos, final AWSIotMqttSubscriptionStatusCallback subscriptionStatusCallback, final AWSIotMqttNewMessageCallback callback) { if (topic == null || topic.isEmpty()) { throw new IllegalArgumentException("topic is null or empty"); } if (qos == null) { throw new IllegalArgumentException("QoS cannot be null."); } if (null != mqttClient) { try { if (subscriptionStatusCallback != null) { mqttClient.subscribe(topic, qos.asInt(), null, new IMqttActionListener() { @Override public void onSuccess(IMqttToken asyncActionToken) { subscriptionStatusCallback.onSuccess(); } @Override public void onFailure(IMqttToken asyncActionToken, Throwable exception) { subscriptionStatusCallback.onFailure(exception); } }); } else { mqttClient.subscribe(topic, qos.asInt()); } } catch (final MqttException e) { if(subscriptionStatusCallback != null) { subscriptionStatusCallback.onFailure(e); } else { throw new AmazonClientException("Client error when subscribing.", e); } } final AWSIotMqttTopic topicModel = new AWSIotMqttTopic(topic, qos, callback); topicListeners.put(topic, topicModel); } }
Source:
<code>protected void validateValuesSafeToInject(String command, String[] targetVars) { for (int i = 0; i < targetVars.length; i++) { String targetVar = targetVars[i]; if (isGrouped) { for (List<? extends RDFNode> group : groupedItems) { RDFNode item = group.get(i); validateSafeToInject(command, targetVar, item.asNode()); } } else { if (targetVars.length > 1) { if (items instanceof List) { List<? extends RDFNode> listItems = (List<? extends RDFNode>) items; RDFNode item = listItems.get(i); validateSafeToInject(command, targetVar, item.asNode()); } else { <START> throw new ARQException("Multiple VALUES variables (" + String.join(", ", targetVars) + ") being used without an ordered list of items: " + items.toString()); <END> } } else { for (RDFNode item : items) { validateSafeToInject(command, targetVar, item.asNode()); } } } } }</code><technical_language>this error caught sooner time user original setValues() call</technical_language>

Target:
protected void validateValuesSafeToInject(String command, String[] targetVars) { if (targetVars.length == 1) { String targetVar = targetVars[0]; for (List<? extends RDFNode> row : rowItems) { for (RDFNode item : row) { validateSafeToInject(command, targetVar, item.asNode()); } } } else { for (int i = 0; i < targetVars.length; i++) { String targetVar = targetVars[i]; for (List<? extends RDFNode> row : rowItems) { if (targetVars.length == row.size()) { RDFNode item = row.get(i); validateSafeToInject(command, targetVar, item.asNode()); } else { String rowString = row.stream().map(RDFNode::toString).collect(Collectors.joining(",")); throw new ARQException("Number of VALUES variables (" + String.join(", ", targetVars) + ") does not equal replacement row (" + rowString + ")."); } } } } }
Source:
<code><START> public TextSelectionActivity(User source, TextSelection selection, IFile file) { <END> this(source, selection, false, file); }</code><technical_language>I missing some class description here. implement selection allowing a reverse order of offsets reflects a selection. I guess done this avoid changes in Eclipse implementation. nice describe in class summary this activity contains, e.g Eclipse usage for isBackwardSelection flag other IDE support this logic</technical_language>

Target:
public TextSelectionActivity(User source, TextSelection selection, IFile file) { super(source, file); if (file == null) throw new IllegalArgumentException("file must not be null"); TextPosition startPosition = selection.getStartPosition(); this.startLine = startPosition.getLineNumber(); this.startInLineOffset = startPosition.getInLineOffset(); TextPosition endPosition = selection.getEndPosition(); this.endLine = endPosition.getLineNumber(); this.endInLineOffset = endPosition.getInLineOffset(); this.isBackwardsSelection = selection.isBackwardsSelection(); }
Source:
<code>public void close(Reporter reporter) throws IOException { log.debug("mutations written: " + mutCount + ", values written: " + valCount); if (simulate) return; try { mtbw.close(); } catch (MutationsRejectedException e) { if (!e.getSecurityErrorCodes().isEmpty()) { HashMap<String,Set<SecurityErrorCode>> tables = new HashMap<>(); <START> for (var ke : e.getSecurityErrorCodes().entrySet()) { <END> String tableId = ke.getKey().getTableId().toString(); Set<SecurityErrorCode> secCodes = tables.computeIfAbsent(tableId, k -> new HashSet<>()); secCodes.addAll(ke.getValue()); } log.error("Not authorized to write to tables : " + tables); } if (e.getConstraintViolationSummaries().size() > 0) { log.error("Constraint violations : " + e.getConstraintViolationSummaries().size()); } throw new IOException(e); } finally { client.close(); } }</code><technical_language>If checked exceptions, do e.getSecurityErrorCodes().forEach(...) instead of a loop entry set</technical_language>

Target:
public void close(Reporter reporter) throws IOException { log.debug("mutations written: " + mutCount + ", values written: " + valCount); if (simulate) return; try { mtbw.close(); } catch (MutationsRejectedException e) { if (!e.getSecurityErrorCodes().isEmpty()) { var tables = new HashMap<String,Set<SecurityErrorCode>>(); e.getSecurityErrorCodes().forEach((tabletId, secSet) -> { var tableId = tabletId.getTableId().toString(); tables.computeIfAbsent(tableId, p -> new HashSet<>()).addAll(secSet); }); log.error("Not authorized to write to tables : " + tables); } if (e.getConstraintViolationSummaries().size() > 0) { log.error("Constraint violations : " + e.getConstraintViolationSummaries().size()); } throw new IOException(e); } finally { client.close(); } }
Source:
<code>public void changeDiscoveryMode(){ <START> validationProvider = new BeansXmlValidationProviderCDI11(); <END> prepareBeanXml("all", true); }</code><technical_language>this class contains is needed/changed/new in cdi 2.0 specs? different</technical_language>

Target:
public void changeDiscoveryMode(){ validationProvider = new BeansXmlValidationProviderCDI20(); prepareBeanXml("all", true); }
Source:
<code>public void addInput(Page page) { requireNonNull(page, "page is null"); checkState(needsInput(), "Operator does not need input"); Block[] blocks = new Block[columnChannels.size()]; for (int outputChannel = 0; outputChannel < columnChannels.size(); outputChannel++) { blocks[outputChannel] = page.getBlock(columnChannels.get(outputChannel)); } statisticAggregation.addInput(page); ListenableFuture<?> blockedOnAggregation = statisticAggregation.isBlocked(); CompletableFuture<?> future = pageSink.appendPage(new Page(blocks)); updateMemoryUsage(); ListenableFuture<?> blockedOnWrite = toListenableFuture(future); if (blockedOnWrite.isDone() && blockedOnAggregation.isDone()) { blocked = NOT_BLOCKED; } else { <START> blocked = allAsList(blockedOnAggregation, blockedOnWrite); <END> } rowCount += page.getPositionCount(); updateWrittenBytes(); }</code><technical_language>remove if, else's code is generic enough. if want com.google.common.util.concurrent.Futures#allAsList(com.google.common.util.concurrent.ListenableFuture<? extends V>...) in all-done case, create a helper method if</technical_language>

Target:
public void addInput(Page page) { requireNonNull(page, "page is null"); checkState(needsInput(), "Operator does not need input"); Block[] blocks = new Block[columnChannels.size()]; for (int outputChannel = 0; outputChannel < columnChannels.size(); outputChannel++) { blocks[outputChannel] = page.getBlock(columnChannels.get(outputChannel)); } statisticAggregationOperator.addInput(page); ListenableFuture<?> blockedOnAggregation = statisticAggregationOperator.isBlocked(); CompletableFuture<?> future = pageSink.appendPage(new Page(blocks)); updateMemoryUsage(); ListenableFuture<?> blockedOnWrite = toListenableFuture(future); blocked = allAsList(blockedOnAggregation, blockedOnWrite); rowCount += page.getPositionCount(); updateWrittenBytes(); }
Source:
<code>private void move() { ArrayList<DiskImage> disks = (ArrayList<DiskImage>) getSelectedItems(); if (disks == null) { return; } if (getWindow() != null) { return; } VM vm = getEntity(); MoveDiskModel model = new MoveDiskModel(); setWindow(model); <START> if (vm.getStatus().isUpOrPaused()) { <END> model.setWarningAvailable(true); model.setMessage(ConstantsManager.getInstance().getConstants().liveStorageMigrationWarning()); model.setMessage(ConstantsManager.getInstance().getConstants().liveStorageMigrationStorageFilteringNote()); } model.setTitle(ConstantsManager.getInstance().getConstants().moveDisksTitle()); model.setHelpTag(HelpTag.move_disk); model.setHashName("move_disk"); model.setIsSourceStorageDomainNameAvailable(true); model.setEntity(this); model.init(disks); model.startProgress(null); }</code><technical_language>vm.isRunningAndQualifyForDisksMigration()</technical_language>

Target:
private void move() { ArrayList<DiskImage> disks = (ArrayList<DiskImage>) getSelectedItems(); if (disks == null) { return; } if (getWindow() != null) { return; } VM vm = getEntity(); MoveDiskModel model = new MoveDiskModel(); setWindow(model); if (vm.isRunningAndQualifyForDisksMigration()) { model.setWarningAvailable(true); model.setMessage(ConstantsManager.getInstance().getConstants().liveStorageMigrationWarning()); model.setMessage(ConstantsManager.getInstance().getConstants().liveStorageMigrationStorageFilteringNote()); } model.setTitle(ConstantsManager.getInstance().getConstants().moveDisksTitle()); model.setHelpTag(HelpTag.move_disk); model.setHashName("move_disk"); model.setIsSourceStorageDomainNameAvailable(true); model.setEntity(this); model.init(disks); model.startProgress(null); }
Source:
<code>public static LocalLauncher create( final List<Entry<String, String>> roleMapping, final Predicate<String> isDisabled, final GameData gameData) { final Predicate<Entry<String, String>> enabledPredicate = <START> entry -> !isDisabled.test(entry.getValue()); <END> final PlayerListing playerListing = new PlayerListing( null, roleMapping.stream() .collect(Collectors.toUnmodifiableMap(Entry::getKey, enabledPredicate::test)), roleMapping.stream() .filter(enabledPredicate) .collect( Collectors.toUnmodifiableMap( Entry::getKey, entry -> PlayerType.fromLabel(entry.getValue()))), gameData.getGameVersion(), gameData.getGameName(), String.valueOf(gameData.getCurrentRound()), null, null); return new LocalLauncher( GameSelector.fromGameData(gameData), new PlainRandomSource(), playerListing, null, new HeadedLaunchAction(null)); }</code><technical_language>Is worthwhile create constructor over-loads avoid null args? able put more of construction work in PlayerListing constructor simplify here</technical_language>

Target:
public static LocalLauncher create( final List<Entry<String, String>> roleMapping, final Predicate<String> isDisabled, final GameData gameData) { final Predicate<Entry<String, String>> isPlayerEnabled = entry -> !isDisabled.test(entry.getValue()); final PlayerListing playerListing = new PlayerListing( roleMapping.stream() .collect(Collectors.toUnmodifiableMap(Entry::getKey, isPlayerEnabled::test)), roleMapping.stream() .filter(isPlayerEnabled) .collect( Collectors.toUnmodifiableMap( Entry::getKey, entry -> PlayerType.fromLabel(entry.getValue()))), gameData.getGameVersion(), gameData.getGameName(), String.valueOf(gameData.getCurrentRound())); return new LocalLauncher( GameSelector.fromGameData(gameData), new PlainRandomSource(), playerListing, null, new HeadedLaunchAction(null)); }
Source:
<code>public void visitImportFrom(ImportFrom importFrom) { <START> hasUnresolvedWildcardImport |= (importFrom.isWildcardImport() && importFrom.hasUnresolvedWildcardImport()); <END> super.visitImportFrom(importFrom); }</code><technical_language>Is importFrom.isWildcardImport() needed here</technical_language>

Target:
public void visitImportFrom(ImportFrom importFrom) { hasUnresolvedWildcardImport |= importFrom.hasUnresolvedWildcardImport(); super.visitImportFrom(importFrom); }
Source:
<code>public String toString() { final StringBuilder sb = new StringBuilder("User{"); sb.append("id='").append(id).append('\''); <START> sb.append(", senderId='").append(fromUser).append('\''); <END> sb.append(", api='").append(api).append('\''); sb.append(", application='").append(application).append('\''); sb.append(", subject='").append(subject).append('\''); sb.append(", content='").append(content).append('\''); sb.append(", createdAt='").append(createdAt).append('\''); sb.append('}'); return sb.toString(); }</code><technical_language>senderId => fromuser</technical_language>

Target:
public String toString() { final StringBuilder sb = new StringBuilder("User{"); sb.append("id='").append(id).append('\''); sb.append(", fromUser='").append(fromUser).append('\''); sb.append(", api='").append(api).append('\''); sb.append(", application='").append(application).append('\''); sb.append(", subject='").append(subject).append('\''); sb.append(", content='").append(content).append('\''); sb.append(", createdAt='").append(createdAt).append('\''); sb.append('}'); return sb.toString(); }
Source:
<code><START> static Map<String, EntryValue> convertBeanToEntryMap(Object bean) { <END> Map<String, Object> buildAttributeValueMap = BeanUtilsExtended.buildObjectAttributeMap(bean); return Maps.transformEntries(buildAttributeValueMap, new ObjectToEntryValueTransformer()); }</code><technical_language>public</technical_language>

Target:
public static Map<String, EntryValue> convertBeanToEntryMap(Object bean) { Map<String, Object> buildAttributeValueMap = BeanUtilsExtended.buildObjectAttributeMap(bean); return Maps.transformEntries(buildAttributeValueMap, new ObjectToEntryValueTransformer()); }
Source:
<code>public void addSubAttribute(Attribute newSubAttribute) { if (newSubAttribute == null || newSubAttribute.getName() == null || <START> newSubAttribute.getName().equals(this.getName())) { <END> throw new IllegalArgumentException(); } subAttributes.put(newSubAttribute.getName(), newSubAttribute); }</code><technical_language>3rd is a weird condition: I add attribute "0" (the tid) a subattribute of "0" (the cpu) throws this exception. asserts do nothing, I noticed before</technical_language>

Target:
public void addSubAttribute(Attribute newSubAttribute) { if (newSubAttribute == null || newSubAttribute.getName() == null) { throw new IllegalArgumentException(); } subAttributes.put(newSubAttribute.getName(), newSubAttribute); }
Source:
<code>private InputPort<Object> wsOutput(DAG dag, String operatorName) { String daemonAddress = dag.getValue(DAG.GATEWAY_CONNECT_ADDRESS); if (!StringUtils.isEmpty(daemonAddress)) { <START> URI uri = URI.create((dag.getValue(DAG.GATEWAY_USE_SSL) ? "wss://" : "ws://") + daemonAddress + "/pubsub"); <END> String appId = "appid"; String topic = "apps.logstream." + appId + "." + operatorName; PubSubWebSocketOutputOperator<Object> wsOut = dag.addOperator(operatorName, new PubSubWebSocketOutputOperator<Object>()); wsOut.setUri(uri); wsOut.setTopic(topic); return wsOut.input; } ConsoleOutputOperator operator = dag.addOperator(operatorName, new ConsoleOutputOperator()); operator.setStringFormat(operatorName + ": %s"); return operator.input; }</code><technical_language>this is changed in places, please add a utility method centralize (regardless of core)</technical_language>

Target:
private InputPort<Object> wsOutput(DAG dag, String operatorName) { if (PubSubHelper.isGatewayConfigured(dag)) { String appId = "appid"; String topic = "apps.logstream." + appId + "." + operatorName; PubSubWebSocketOutputOperator<Object> wsOut = dag.addOperator(operatorName, new PubSubWebSocketOutputOperator<Object>()); wsOut.setUri(PubSubHelper.getURI(dag)); wsOut.setTopic(topic); return wsOut.input; } ConsoleOutputOperator operator = dag.addOperator(operatorName, new ConsoleOutputOperator()); operator.setStringFormat(operatorName + ": %s"); return operator.input; }
Source:
<code>public void initializeDefaultPreferences() { IPreferenceStore store = Activator.getDefault().getPreferenceStore(); <START> store.setDefault(PreferenceConstants.P_CHOICE, "clangd"); <END> store.setDefault(PreferenceConstants.P_FLAGS, ""); }</code><technical_language>strings need //$NON-NLS-1$ annotations</technical_language>

Target:
public void initializeDefaultPreferences() { IPreferenceStore store = Activator.getDefault().getPreferenceStore(); store.setDefault(PreferenceConstants.P_SERVER_CHOICE, "clangd"); store.setDefault(PreferenceConstants.P_SERVER_OPTIONS, ""); }
Source:
<code>final void setSessionCacheSize(int size) { if (size < 0) { throw new IllegalArgumentException(); } long oldSize = maximumCacheSize.getAndSet(size); <START> if (oldSize < size) { <END> freeSessions(); } }</code><technical_language>opposite: drain if new size < oldSize</technical_language>

Target:
final void setSessionCacheSize(int size) { long oldSize = maximumCacheSize.getAndSet(size); if (oldSize > size) { freeSessions(); } }
Source:
<code>private Predicate<String> toPredicate(final List<String> regexList, final boolean defaultResult) { return regexList .stream() <START> .map(r -> "^" + r + "$") <END> .map(Pattern::compile) .map(Pattern::asPredicate) .reduce(Predicate::or).orElse(t -> defaultResult); }</code><technical_language>Ville brought a good point here. Lets mess regex in a weird way. Simplicity is here. Lets pass string unchanged create a weird regex dialect mucking it. If user wants anchor, lets anchor</technical_language>

Target:
private Predicate<String> toPredicate(final List<String> regexList, final boolean defaultResult) { return regexList .stream() .map(Pattern::compile) .map(Pattern::asPredicate) .reduce(Predicate::or).orElse(t -> defaultResult); }
Source:
<code>private Message<?> enhanceScatterReplyMessage(Message<?> message) { MessageHeaders headers = message.getHeaders(); return getMessageBuilderFactory() .fromMessage(message) <START> .setHeader(MessageHeaders.ERROR_CHANNEL, headers.get(GATHER_RESULT_CHANNEL)) <END> .build(); }</code><technical_language>I find this a wrong decision. errorChannelName process exceptions in scatterer sub-flows gatherer</technical_language>

Target:
private Message<?> enhanceScatterReplyMessage(Message<?> message) { MessageHeaders headers = message.getHeaders(); return getMessageBuilderFactory() .fromMessage(message) .setHeader(MessageHeaders.ERROR_CHANNEL, headers.get(ORIGINAL_ERROR_CHANNEL)) .removeHeaders(ORIGINAL_ERROR_CHANNEL) .build(); }
Source:
<code>public static LibvirtSecret map(OpenstackVolumeAuthenticationKey model, LibvirtSecret template) { LibvirtSecret entity = template != null ? template : new LibvirtSecret(); if (model.isSetId()) { entity.setId(GuidUtils.asGuid(model.getId())); } if (model.isSetUuid()) { entity.setId(GuidUtils.asGuid(model.getUuid())); } if (model.isSetDescription()) { entity.setDescription(model.getDescription()); } if (model.isSetValue()) { entity.setValue(model.getValue()); } if (model.isSetUsageType()) { OpenstackVolumeAuthenticationKeyUsageType usageType = OpenstackVolumeAuthenticationKeyUsageType.fromValue(model.getUsageType()); if (usageType != null) { entity.setUsageType(map(usageType, null)); } } if (model.isSetOpenstackVolumeProvider()) { <START> entity.setProviderId(GuidUtils.asGuid(model.getOpenstackVolumeProvider().getId())); <END> } return entity; }</code><technical_language>id of provider missing, user send following: <openstack_volume_provider/> is useless, happen, in case this trigger a NPE "Guid(String)" constructor. Consider checking if id a it</technical_language>

Target:
public static LibvirtSecret map(OpenstackVolumeAuthenticationKey model, LibvirtSecret template) { LibvirtSecret entity = template != null ? template : new LibvirtSecret(); if (model.isSetId()) { entity.setId(GuidUtils.asGuid(model.getId())); } if (model.isSetUuid()) { entity.setId(GuidUtils.asGuid(model.getUuid())); } if (model.isSetDescription()) { entity.setDescription(model.getDescription()); } if (model.isSetValue()) { entity.setValue(model.getValue()); } if (model.isSetUsageType()) { OpenstackVolumeAuthenticationKeyUsageType usageType = OpenstackVolumeAuthenticationKeyUsageType.fromValue(model.getUsageType()); if (usageType != null) { entity.setUsageType(map(usageType, null)); } } if (model.isSetOpenstackVolumeProvider() && model.getOpenstackVolumeProvider().isSetId()) { entity.setProviderId(GuidUtils.asGuid(model.getOpenstackVolumeProvider().getId())); } return entity; }
Source:
<code>public DurationFormatter(Duration duration) { <START> this.stringRepresentation = duration.toString(); <END> }</code><technical_language>Do need this then? toString() called default, too</technical_language>

Target:
public DurationFormatter(Duration duration) { if ( Duration.ZERO.equals( duration ) ) { this.stringRepresentation = "0"; } else { long seconds = duration.getSeconds(); long days = seconds / ( 24 * 3_600 ); long hours = seconds / 3_600 % 24; long minutes = seconds / 60 % 60; int millis = duration.getNano() / 1_000_000; int nanos = duration.getNano() % 1_000_000; StringBuilder formattedDuration = new StringBuilder(); appendTimeUnit( formattedDuration, days, "days", "day" ); appendTimeUnit( formattedDuration, hours, "hours", "hour" ); appendTimeUnit( formattedDuration, minutes, "minutes", "minute" ); appendTimeUnit( formattedDuration, seconds % 60, "seconds", "second" ); appendTimeUnit( formattedDuration, millis, "milliseconds", "millisecond" ); appendTimeUnit( formattedDuration, nanos, "nanoseconds", "nanosecond" ); this.stringRepresentation = formattedDuration.toString(); } }
Source:
<code>private void addApproval(final PatchSetApproval.Key psaKey, final Short score, final Change c, final CmdOption co, final Transaction txn) throws OrmException, UnloggedFailure { PatchSetApproval psa = db.patchSetApprovals().get(psaKey); <START> Boolean insert = false; <END> if (psa == null) { insert = true; psa = new PatchSetApproval(psaKey, score); } final List<PatchSetApproval> approvals = Collections.emptyList(); final FunctionState fs = functionStateFactory.create(c, patchSetId, approvals); psa.setValue(score); fs.normalize( approvalTypes.getApprovalType(psa.getCategoryId()), psa); if (score != psa.getValue()) { throw new UnloggedFailure(CMD_ERR, co.name() + "=" + co.value() + " not permitted"); } psa.setGranted(); if (insert) { db.patchSetApprovals().insert(Collections.singleton(psa), txn); } else { db.patchSetApprovals().update(Collections.singleton(psa), txn); } }</code><technical_language>"b" boolean? object necessary here</technical_language>

Target:
private void addApproval(final PatchSetApproval.Key psaKey, final Short score, final Change c, final CmdOption co, final Transaction txn) throws OrmException, UnloggedFailure { PatchSetApproval psa = db.patchSetApprovals().get(psaKey); boolean insert = false; if (psa == null) { insert = true; psa = new PatchSetApproval(psaKey, score); } final List<PatchSetApproval> approvals = Collections.emptyList(); final FunctionState fs = functionStateFactory.create(c, patchSetId, approvals); psa.setValue(score); fs.normalize( approvalTypes.getApprovalType(psa.getCategoryId()), psa); if (score != psa.getValue()) { throw new UnloggedFailure(CMD_ERR, co.name() + "=" + co.value() + " not permitted"); } psa.setGranted(); if (insert) { db.patchSetApprovals().insert(Collections.singleton(psa), txn); } else { db.patchSetApprovals().update(Collections.singleton(psa), txn); } }
Source:
<code>@Override public void processInStreamOutStream(int type, BinaryRawReaderEx reader, BinaryRawWriterEx writer) throws IgniteCheckedException { switch (type) { case OP_GET_META: { int typeId = reader.readInt(); platformCtx.writeMetadata(writer, typeId, false); break; } case OP_GET_META_WITH_SCHEMAS: { int typeId = reader.readInt(); platformCtx.writeMetadata(writer, typeId, true); break; } case OP_GET_SCHEMA: { int typeId = reader.readInt(); int schemaId = reader.readInt(); platformCtx.writeSchema(writer, typeId, schemaId); break; } case OP_GET_TYPE: { int typeId = reader.readInt(); ClassNotFoundException err = null; for (byte platformId : new byte[] {DOTNET_ID, JAVA_ID}) { try { String typeName = platformContext().kernalContext().marshallerContext() .getClassName(platformId, typeId); writer.writeString(typeName); err = null; break; } <START> catch (ClassNotFoundException e) { <END> if (err == null) err = e; } } if (err != null) throw new BinaryObjectException(err); break; } case OP_REGISTER_ENUM: { String name = reader.readString(); int cnt = reader.readInt(); Map<String, Integer> vals = new HashMap<>(cnt); for (int i = 0; i < cnt; i++) { vals.put(reader.readString(), reader.readInt()); } BinaryType binaryType = platformCtx.kernalContext().grid().binary().registerEnum(name, vals); platformCtx.writeMetadata(writer, binaryType.typeId(), false); break; } default: super.processInStreamOutStream(type, reader, writer); break; } }</code><technical_language>exceptions for control flow - introduce overload for MarshallerContext.getClassName throw exceptions</technical_language>

Target:
@Override public void processInStreamOutStream(int type, BinaryRawReaderEx reader, BinaryRawWriterEx writer) throws IgniteCheckedException { switch (type) { case OP_GET_META: { int typeId = reader.readInt(); platformCtx.writeMetadata(writer, typeId, false); break; } case OP_GET_META_WITH_SCHEMAS: { int typeId = reader.readInt(); platformCtx.writeMetadata(writer, typeId, true); break; } case OP_GET_SCHEMA: { int typeId = reader.readInt(); int schemaId = reader.readInt(); platformCtx.writeSchema(writer, typeId, schemaId); break; } case OP_GET_TYPE: { int typeId = reader.readInt(); try { String typeName = platformContext().kernalContext().marshallerContext() .getClassName(MarshallerPlatformIds.DOTNET_ID, typeId); writer.writeString(typeName); } catch (ClassNotFoundException e) { throw new BinaryObjectException(e); } break; } case OP_REGISTER_ENUM: { String name = reader.readString(); int cnt = reader.readInt(); Map<String, Integer> vals = new HashMap<>(cnt); for (int i = 0; i < cnt; i++) { vals.put(reader.readString(), reader.readInt()); } BinaryType binaryType = platformCtx.kernalContext().grid().binary().registerEnum(name, vals); platformCtx.writeMetadata(writer, binaryType.typeId(), false); break; } default: super.processInStreamOutStream(type, reader, writer); break; } }
Source:
<code><START> protected void assertEvaluationIsError() throws Exception { <END> IValue value = getValue(); assertEquals(value, IntegralValue.ERROR); }</code><technical_language>is in distinguishing cases. simpler a single function, assertEvaluationIsError(), checks for either</technical_language>

Target:
protected void assertEvaluationIsError() throws Exception { IValue value = getValue(); assertEquals(IntegralValue.ERROR, value); }
Source:
<code><START> public void addPythonFile(String filePath) { <END> Preconditions.checkNotNull(filePath); String fileKey = generateUniqueFileKey(PYTHON_FILE_PREFIX, filePath); registerCachedFileIfNotExist(filePath, fileKey); if (!internalConfig.contains(PYTHON_FILES)) { internalConfig.set(PYTHON_FILES, new HashMap<>()); } internalConfig.get(PYTHON_FILES).put(fileKey, new File(filePath).getName()); }</code><technical_language>declare private? for other methods</technical_language>

Target:
private void addPythonFile(String filePath) { Preconditions.checkNotNull(filePath); String fileKey = generateUniqueFileKey(PYTHON_FILE_PREFIX, filePath); registerCachedFileIfNotExist(filePath, fileKey); if (!internalConfig.contains(PYTHON_FILES)) { internalConfig.set(PYTHON_FILES, new HashMap<>()); } internalConfig.get(PYTHON_FILES).put(fileKey, new File(filePath).getName()); }
Source:
<code>public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; IntegerCopyNumberState that = (IntegerCopyNumberState) o; return copyNumber == that.copyNumber; <START> <END> }</code><technical_language>White space</technical_language>

Target:
public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; return copyNumber == ((IntegerCopyNumberState) o).copyNumber; }
Source:
<code><START> public @NonNull TmfModelResponse<TmfTreeModel<TimeGraphEntryModel>> fetchTree(Map<String, Object> fetchParameters, @Nullable IProgressMonitor monitor) { <END> fetchTreeIsComplete = true; long rootId = ENTRY_ID.getAndIncrement(); ITmfTrace trace = getTrace(); TraceEntryModel.Builder traceEntry = new TraceEntryModel.Builder(rootId, trace.getName(), trace.getStartTime().toNanos(), trace); entryList = new ArrayList<>(); moduleEntryModelList = new ArrayList<>(); long traceEnd = traceEntry.getStartTime(); for (ITmfAnalysisModuleWithStateSystems module : fModules) { synchronized (fStartedAnalysis) { if (monitor != null) { if (monitor.isCanceled()) { return new TmfModelResponse<>(null, Status.CANCELLED, CommonStatusMessage.TASK_CANCELLED); } } } waitForInitialization(getTrace(), module); long id = ENTRY_ID.getAndIncrement(); ModuleEntryModel.Builder moduleEntry = new ModuleEntryModel.Builder(id, module.getName(), traceEntry.getStartTime(), module); long moduleEnd = traceEntry.getStartTime(); for (ITmfStateSystem ss : module.getStateSystems()) { addStateSystem(ss, id); moduleEnd = Long.max(moduleEnd, ss.getCurrentEndTime()); } moduleEntry.setEndTime(moduleEnd); traceEnd = Long.max(traceEnd, moduleEnd); ModuleEntryModel finalModuleEntry = moduleEntry.build(rootId); entryList.add(finalModuleEntry); moduleEntryModelList.add(finalModuleEntry); } traceEntry.setEndTime(traceEnd); TraceEntryModel finalTraceEntry = traceEntry.build(-1); entryList.add(finalTraceEntry); Collections.reverse(entryList); Status status = fetchTreeIsComplete ? Status.COMPLETED : Status.RUNNING; String msg = fetchTreeIsComplete ? CommonStatusMessage.COMPLETED : CommonStatusMessage.RUNNING; return new TmfModelResponse<>(new TmfTreeModel<>(Collections.emptyList(), entryList), status, msg); }</code><technical_language>cache results (you do, check if result quickly return if necessary). If analysis is run later, added fStartedAnalysis list (by listening TmfAnalysisStartedSignal) entries this analysis fetched for runs</technical_language>

Target:
public @NonNull TmfModelResponse<TmfTreeModel<TimeGraphEntryModel>> fetchTree(Map<String, Object> fetchParameters, @Nullable IProgressMonitor monitor) { List<TimeGraphEntryModel> EntryList = new ArrayList<>(fEntryBuilder.size()); moduleEntryModelList = new ArrayList<>(); Boolean fetchTreeIsComplete = true; synchronized (fEntryBuilder) { fetchTreeIsComplete &= addTrace(monitor, EntryList); if (monitor != null) { if (monitor.isCanceled()) { return new TmfModelResponse<>(null, Status.CANCELLED, CommonStatusMessage.TASK_CANCELLED); } } } Collections.reverse(EntryList); Status status = fetchTreeIsComplete ? Status.COMPLETED : Status.RUNNING; String msg = fetchTreeIsComplete ? CommonStatusMessage.COMPLETED : CommonStatusMessage.RUNNING; return new TmfModelResponse<>(new TmfTreeModel<>(Collections.emptyList(), EntryList), status, msg); }
Source:
<code>public JaxRsClientFactoryImpl(ApplicationContext ctx) { provider = () -> null; boolean disableTLS = false; if (ctx != null) { provider = () -> { try { return ctx.getBean(TlsProvider.class); } catch (NoSuchBeanDefinitionException e) { return null; } }; disableTLS = Boolean.parseBoolean(ctx.getEnvironment().getProperty(KEY_DISABLE, "false")); } if (disableTLS) { this.factoryCustomizers.add(sslContextFactory -> { <START> LOG.info("Disabling TLS 1.3"); <END> sslContextFactory.setExcludeProtocols("TLSv1.3"); }); } }</code><technical_language>Suggest log message match in places search for easier</technical_language>

Target:
public JaxRsClientFactoryImpl(ApplicationContext ctx) { provider = () -> null; if (ctx != null) { provider = () -> { try { return ctx.getBean(TlsProvider.class); } catch (NoSuchBeanDefinitionException e) { return null; } }; } }
Source:
<code>protected void execute() { motor.set(speed); LogKitten.d("MotorSet executing with speed " + speed); <START> } <END></code><technical_language>out of scope</technical_language>

Target:
public void execute() { motor.set(speed); LogKitten.d("MotorSet executing with speed " + speed); }
Source:
<code><START> private boolean onIsPotionActive(final LivingEntity entityIn, final Effect potion) { <END> return false; }</code><technical_language>Fix method name please</technical_language>

Target:
private boolean impl$onIsPotionActive(final LivingEntity entityIn, final Effect potion) { return false; }
Source:
<code>private void createPresenterViewUi() { RenderedTemplate renderedTemplate = null; <START> if (presenterConfigModel.getNestedPresenter()) { <END> renderedTemplate = createdNestedPresenterTemplates.getViewui(); } else if (presenterConfigModel.getPresenterWidget()) { renderedTemplate = createdPresenterWidgetTemplates.getViewui(); } else if (presenterConfigModel.getPopupPresenter()) { renderedTemplate = createdPopupPresenterTemplates.getViewui(); } String className = renderedTemplate.getNameAndNoExt(); String contents = renderedTemplate.getContents(); final PsiDirectory[] directoriesInPackage = createdPresenterPackage.getDirectories(); final PsiFile element = PsiFileFactory.getInstance(project).createFileFromText(className, XmlFileType.INSTANCE, contents); final CreatedPsiClass createdPsiClass = new CreatedPsiClass(); ApplicationManager.getApplication().runWriteAction(new Runnable() { public void run() { PsiElement createdElement = directoriesInPackage[0].add(element); PsiJavaFile createdJavaFile = (PsiJavaFile) createdElement; PsiClass[] createdClasses = createdJavaFile.getClasses(); createdPsiClass.setPsiClass(createdClasses[0]); CodeStyleManager.getInstance(project).reformat(createdClasses[0]); } }); }</code><technical_language>extract this if/else block a private method returning correct RenderedTemplate</technical_language>

Target:
private void createPresenterViewUi() { RenderedTemplate renderedTemplate = null; if (presenterConfigModel.getNestedPresenter()) { renderedTemplate = createdNestedPresenterTemplates.getViewui(); } else if (presenterConfigModel.getPresenterWidget()) { renderedTemplate = createdPresenterWidgetTemplates.getViewui(); } else if (presenterConfigModel.getPopupPresenter()) { renderedTemplate = createdPopupPresenterTemplates.getViewui(); } final String className = renderedTemplate.getNameAndNoExt(); final String contents = renderedTemplate.getContents(); final PsiDirectoriesModel psiDirectoriesModel = new PsiDirectoriesModel(); ApplicationManager.getApplication().invokeAndWait(new Runnable() { @Override public void run() { ApplicationManager.getApplication().runWriteAction(new Runnable() { @Override public void run() { PsiDirectory[] directoriesInPackage = createdPresenterPackage.getDirectories(); psiDirectoriesModel.set(directoriesInPackage); } }); } }, ModalityState.NON_MODAL); final PsiElementModel psiElementModel = new PsiElementModel(); ApplicationManager.getApplication().invokeAndWait(new Runnable() { @Override public void run() { ApplicationManager.getApplication().runReadAction(new Runnable() { @Override public void run() { PsiFile element = PsiFileFactory.getInstance(project).createFileFromText( className, XmlFileType.INSTANCE, contents); psiElementModel.set(element); } }); } }, ModalityState.NON_MODAL); ApplicationManager.getApplication().invokeAndWait(new Runnable() { @Override public void run() { ApplicationManager.getApplication().runWriteAction(new Runnable() { @Override public void run() { PsiDirectory[] psiDirectories = psiDirectoriesModel.get(); psiDirectories[0].add(psiElementModel.get()); } }); } }, ModalityState.NON_MODAL); }
Source:
<code>public <T, SpecT extends AbstractBrooklynObjectSpec<? extends T, SpecT>> SpecT createCatalogSpec( CatalogItem<T, SpecT> item, Set<String> encounteredTypes) throws PlanNotRecognizedException { if (item.getJavaType() != null) { Class<?> type; try { <START> type = CatalogUtils.newClassLoadingContext(mgmt, item).loadClass(item.getJavaType()); <END> } catch (Exception e) { Exceptions.propagateIfFatal(e); throw new IllegalStateException("Unable to load old-style java catalog item type " + item.getJavaType() + " for item " + item, e); } AbstractBrooklynObjectSpec<?,?> spec; if (Entity.class.isAssignableFrom(type)) { @SuppressWarnings("unchecked") Class<Entity> entityType = (Class<Entity>)type; spec = EntitySpec.create(entityType); } else if (Policy.class.isAssignableFrom(type)) { @SuppressWarnings("unchecked") Class<Policy> policyType = (Class<Policy>)type; spec = PolicySpec.create(policyType); } else { throw new IllegalStateException("Catalog item " + item + " java type " + item.getJavaType() + " is not a Brooklyn supported object."); } spec.catalogItemId(item.getCatalogItemId()); @SuppressWarnings("unchecked") SpecT untypedSpc = (SpecT) spec; return untypedSpc; } else { throw new PlanNotRecognizedException(getClass().getName() + " parses only old-style catalog items containing javaType"); } }</code><technical_language>Old-style catalog items support osgi, point in change, hurt either</technical_language>

Target:
public <T, SpecT extends AbstractBrooklynObjectSpec<? extends T, SpecT>> SpecT createCatalogSpec( CatalogItem<T, SpecT> item, Set<String> encounteredTypes) throws PlanNotRecognizedException { if (item.getJavaType() != null) { log.warn("Deprecated functionality (since 0.9.0). Using old-style xml catalog items with java type attribute for " + item); Class<?> type; try { type = CatalogUtils.newClassLoadingContext(mgmt, item).loadClass(item.getJavaType()); } catch (Exception e) { Exceptions.propagateIfFatal(e); throw new IllegalStateException("Unable to load old-style java catalog item type " + item.getJavaType() + " for item " + item, e); } AbstractBrooklynObjectSpec<?,?> spec; if (Entity.class.isAssignableFrom(type)) { @SuppressWarnings("unchecked") Class<Entity> entityType = (Class<Entity>)type; spec = EntitySpec.create(entityType); } else if (Policy.class.isAssignableFrom(type)) { @SuppressWarnings("unchecked") Class<Policy> policyType = (Class<Policy>)type; spec = PolicySpec.create(policyType); } else { throw new IllegalStateException("Catalog item " + item + " java type " + item.getJavaType() + " is not a Brooklyn supported object."); } spec.catalogItemId(item.getCatalogItemId()); @SuppressWarnings("unchecked") SpecT untypedSpc = (SpecT) spec; return untypedSpc; } else { throw new PlanNotRecognizedException(getClass().getName() + " parses only old-style catalog items containing javaType"); } }
Source:
<code>public AbstractCard(String webUrl) throws CardBuilderException { webUrl(webUrl); MetaTagModel metaTagModel = MetaTagExtractor.getMetaTags(this.webUrl); setAppLinkIos(metaTagModel.getAppLinkIos()); <START> setAppLinkIos(metaTagModel.getAppLinkAndroid()); <END> setMetaTagModel(metaTagModel); }</code><technical_language>this setAppLinkAndroid - tests picked this error up..</technical_language>

Target:
public AbstractCard(String webUrl) throws CardBuilderException { webUrl(webUrl); MetaTagModel metaTagModel = MetaTagExtractor.getMetaTags(this.webUrl); setAppLinkIos(metaTagModel.getAppLinkIos()); setAppLinkAndroid(metaTagModel.getAppLinkAndroid()); setMetaTagModel(metaTagModel); }
Source:
<code>public void getRegisterData(IRegisterDMContext regDmc , final DataRequestMonitor<IRegisterDMData> rm) { if (regDmc instanceof MIRegisterDMC) { final MIRegisterDMC miRegDmc = (MIRegisterDMC)regDmc; final IFrameDMContext frameDmc = DMContexts.getAncestorOfType(regDmc, IFrameDMContext.class); if(frameDmc == null){ <START> rm.setData(new RegisterData(frameDmc, miRegDmc.getName(), BLANK_STRING, false)); <END> rm.done(); return; } int[] regnos = {miRegDmc.getRegNo()}; fRegisterValueCache.execute( fCommandFactory.createMIDataListRegisterValues(frameDmc, MIFormat.HEXADECIMAL, regnos), new DataRequestMonitor<MIDataListRegisterValuesInfo>(getExecutor(), rm) { @Override protected void handleSuccess() { MIRegisterValue[] regValue = getData().getMIRegisterValues(); if (regValue.length == 0) { assert false : "Backend protocol error"; rm.done(); return; } assert regValue.length == 1; MIRegisterValue reg = regValue[0]; boolean isFloat = false; if ( reg.getValue().contains("float")) { isFloat = true; } rm.setData(new RegisterData(frameDmc, miRegDmc.getName(), BLANK_STRING, isFloat)); rm.done(); } }); } else { rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Unknown DMC type", null)); rm.done(); } }</code><technical_language>raplace frameDmc null show want pass in null is a mistake</technical_language>

Target:
public void getRegisterData(IRegisterDMContext regDmc , final DataRequestMonitor<IRegisterDMData> rm) { if (regDmc instanceof MIRegisterDMC) { final MIRegisterDMC miRegDmc = (MIRegisterDMC)regDmc; final IFrameDMContext frameDmc = DMContexts.getAncestorOfType(regDmc, IFrameDMContext.class); if(frameDmc == null){ rm.setData(new RegisterData(null, miRegDmc.getName(), BLANK_STRING, false)); rm.done(); return; } int[] regnos = {miRegDmc.getRegNo()}; fRegisterValueCache.execute( fCommandFactory.createMIDataListRegisterValues(frameDmc, MIFormat.HEXADECIMAL, regnos), new DataRequestMonitor<MIDataListRegisterValuesInfo>(getExecutor(), rm) { @Override protected void handleSuccess() { MIRegisterValue[] regValue = getData().getMIRegisterValues(); if (regValue.length == 0) { assert false : "Backend protocol error"; rm.done(); return; } assert regValue.length == 1; MIRegisterValue reg = regValue[0]; boolean isFloat = false; if ( reg.getValue().contains("float")) { isFloat = true; } rm.setData(new RegisterData(frameDmc, miRegDmc.getName(), BLANK_STRING, isFloat)); rm.done(); } }); } else { rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Unknown DMC type", null)); rm.done(); } }