auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public XmlValidatingMessageSelector(Resource schema, String schemaType) throws IOException { <START> this(schema, SchemaType.valueOf(schemaType)); <END> }</code><technical_language>true: schemaType null empty string well. Yes, if(schemaType == null) { in another ctor, assert logic</technical_language>

Target:
public XmlValidatingMessageSelector(Resource schema, String schemaType) throws IOException { this(schema, StringUtils.isEmpty(schemaType) ? (SchemaType) null : SchemaType.valueOf(schemaType)); }
Source:
<code>CompletableFuture<Acknowledge> runApplicationAndShutdownClusterAsync( final DispatcherGateway dispatcher, final ScheduledExecutor scheduledExecutor) { applicationCompletionFuture = fixJobIdAndRunApplicationAsync(dispatcher, scheduledExecutor); return applicationCompletionFuture .handle((r, t) -> { final ApplicationStatus applicationStatus; if (t != null) { if (ExceptionUtils.findThrowable(t, JobCancellationException.class).isPresent()) { applicationStatus = ApplicationStatus.CANCELED; <START> LOG.warn("Application {}: ", applicationStatus, t); <END> return dispatcher.shutDownCluster(applicationStatus); } if (ExceptionUtils.findThrowable(t, JobExecutionException.class).isPresent()) { applicationStatus = ApplicationStatus.FAILED; LOG.warn("Application {}: ", applicationStatus, t); return dispatcher.shutDownCluster(applicationStatus); } return dispatcher.shutDownClusterExceptionally(t); } else { applicationStatus = ApplicationStatus.SUCCEEDED; LOG.info("Application completed SUCCESSFULLY"); return dispatcher.shutDownCluster(applicationStatus); } }) .thenCompose(Function.identity()); }</code><technical_language>Warn log level high for a normal state transition</technical_language>

Target:
CompletableFuture<Acknowledge> runApplicationAndShutdownClusterAsync( final DispatcherGateway dispatcher, final ScheduledExecutor scheduledExecutor) { applicationCompletionFuture = fixJobIdAndRunApplicationAsync(dispatcher, scheduledExecutor); return applicationCompletionFuture .handle((r, t) -> { final ApplicationStatus applicationStatus; if (t != null) { if (ExceptionUtils.findThrowable(t, JobCancellationException.class).isPresent()) { applicationStatus = ApplicationStatus.CANCELED; LOG.info("Application {}: ", applicationStatus, t); return dispatcher.shutDownCluster(applicationStatus); } if (ExceptionUtils.findThrowable(t, JobExecutionException.class).isPresent()) { applicationStatus = ApplicationStatus.FAILED; LOG.info("Application {}: ", applicationStatus, t); return dispatcher.shutDownCluster(applicationStatus); } LOG.warn("Exiting with Application Status UNKNOWN: ", t); errorHandler.onFatalError(t); return CompletableFuture.completedFuture(Acknowledge.get()); } else { applicationStatus = ApplicationStatus.SUCCEEDED; LOG.info("Application completed SUCCESSFULLY"); return dispatcher.shutDownCluster(applicationStatus); } }) .thenCompose(Function.identity()); }
Source:
<code>protected void ExecuteIrsBrokerCommand() { _result = getIrsProxy().getImagesList(getParameters().getStorageDomainId().toString()); ProceedProxyReturnValue(); ArrayList<Guid> tempRetValue = new ArrayList<Guid>(_result.mImageList.length); <START> for (int i = 0; i < _result.mImageList.length; i++) { <END> tempRetValue.add(new Guid(_result.mImageList[i])); } setReturnValue(tempRetValue); }</code><technical_language>foreeach syntax, more readable</technical_language>

Target:
protected void ExecuteIrsBrokerCommand() { _result = getIrsProxy().getImagesList(getParameters().getStorageDomainId().toString()); ProceedProxyReturnValue(); ArrayList<Guid> tempRetValue = new ArrayList<Guid>(_result.getImageList().length); for (String id : _result.getImageList()) { tempRetValue.add(new Guid(id)); } setReturnValue(tempRetValue); }
Source:
<code>private static String buildCanonicalUriFromId(String id) { checkArgument(!Strings.isNullOrEmpty(id), "Cannot build canonical uri from empty id"); <START> return "<LINK_0>"+id; <END> }</code><technical_language>Constant</technical_language>

Target:
private static String buildCanonicalUriFromId(String id) { return RTE_CANONICAL_URI_PREFIX.concat(id); }
Source:
<code>private void createButtons() { ButtonType confirmButtonType = new ButtonType("Confirm", ButtonBar.ButtonData.OK_DONE); getDialogPane().getButtonTypes().addAll(confirmButtonType, ButtonType.CANCEL); setResultConverter(dialogButton -> { if (dialogButton == confirmButtonType) { if (!queryField.isDisabled()) queryField.appendText(" "); <START> return TurboLabel.getLabelsNameList(state.getAssignedLabels()); <END> } return null; }); }</code><technical_language>method called getLabelNames instead</technical_language>

Target:
private void createButtons() { ButtonType confirmButtonType = new ButtonType("Confirm", ButtonBar.ButtonData.OK_DONE); getDialogPane().getButtonTypes().addAll(confirmButtonType, ButtonType.CANCEL); setResultConverter(dialogButton -> { if (dialogButton == confirmButtonType) { if (!queryField.isDisabled()) queryField.appendText(" "); return TurboLabel.getLabelNames(state.getAssignedLabels()); } return null; }); }
Source:
<code>public Block getBlock(int[] positions, int positionCount) { checkArgument(outputPositionCount > 0, "outputPositionCount must be greater than zero"); checkState(outputRequired, "This stream reader doesn't produce output"); checkState(positionCount <= outputPositionCount, "Not enough values"); checkState(!valuesInUse, "BlockLease hasn't been closed yet"); if (allNulls) { return new RunLengthEncodedBlock(nullBlock, outputPositionCount); } boolean includeNulls = nullsAllowed && presentStream != null; if (positionCount == outputPositionCount) { Block block = makeBlock(positionCount, nullsAllowed, nulls, values); nulls = null; values = null; return block; } <START> long[] valuesCopy = createValuesCopy(positionCount); <END> boolean[] nullsCopy = null; if (includeNulls) { nullsCopy = new boolean[positionCount]; } copyValues(positions, positionCount, valuesCopy, nullsCopy); return makeBlock(positionCount, includeNulls, nullsCopy, valuesCopy); }</code><technical_language>consider replacing createValuesCopy ensureValuesCapacity abstract methods a member variable valuesPerPosition; subclasses provide (2 1) constructor. long[] valuesCopy = new long[valuesPerPosition * positionCount]; otherwise, createValuesCopy needs a name; currently suggests method is making a copy, is allocating memory</technical_language>

Target:
public Block getBlock(int[] positions, int positionCount) { checkArgument(outputPositionCount > 0, "outputPositionCount must be greater than zero"); checkState(outputRequired, "This stream reader doesn't produce output"); checkState(positionCount <= outputPositionCount, "Not enough values"); checkState(!valuesInUse, "BlockLease hasn't been closed yet"); if (allNulls) { return new RunLengthEncodedBlock(nullBlock, outputPositionCount); } boolean includeNulls = nullsAllowed && presentStream != null; if (positionCount == outputPositionCount) { Block block = makeBlock(positionCount, nullsAllowed, nulls, values); nulls = null; values = null; return block; } long[] valuesCopy = new long[valuesPerPosition * positionCount]; boolean[] nullsCopy = null; if (includeNulls) { nullsCopy = new boolean[positionCount]; } copyValues(positions, positionCount, valuesCopy, nullsCopy); return makeBlock(positionCount, includeNulls, nullsCopy, valuesCopy); }
Source:
<code><START> public boolean isClearingPartition(CacheGroupContext grp, int part) { <END> if (grp.persistenceEnabled()) return false; synchronized (mux) { if (clearingPartitions == null) return false; Set<Integer> parts = clearingPartitions.get(grp.groupId()); return parts != null && parts.contains(part); } }</code><technical_language>this optimization works correctly? In case of persistence enabled = true this method return false, while addClearingPartition works if persistence enabled = false</technical_language>

Target:
public boolean isClearingPartition(CacheGroupContext grp, int part) { if (!grp.persistenceEnabled()) return false; synchronized (mux) { if (clearingPartitions == null) return false; Set<Integer> parts = clearingPartitions.get(grp.groupId()); return parts != null && parts.contains(part); } }
Source:
<code>public List<N> sort(Collection<N> nodes) { <START> LinkedHashMap<ID, NodeInfo<ID, N>> nodeInfos = new LinkedHashMap<>(nodes.size()); <END> List<NodeInfo<ID, N>> results = new ArrayList<>(nodes.size()); int pos = 0; boolean needsSorting = false; for (N node : nodes) { ID nodeID = identityExtractor.apply(node); Set<ID> preds = new HashSet<>(directPredecessorsExtractor.apply(node)); needsSorting |= !preds.isEmpty(); NodeInfo<ID, N> nodeInfo = nodeInfos.computeIfAbsent(nodeID, __ -> new NodeInfo<>()); nodeInfo.id = nodeID; nodeInfo.predecessors = preds; nodeInfo.sourcePosition = pos++; nodeInfo.node = node; for (ID pred : preds) { NodeInfo<ID, N> predNode = nodeInfos.computeIfAbsent(pred, __ -> new NodeInfo<>()); if (predNode.successors == null) { predNode.successors = new HashSet<>(); } predNode.successors.add(nodeID); } } if (needsSorting) { TreeSet<NodeInfo<ID, N>> tmp = new TreeSet<>(Comparator.comparingInt(a -> a.sourcePosition)); tmp.addAll(nodeInfos.values()); nodeInfos.clear(); tmp.forEach(ni -> nodeInfos.put(ni.id, ni)); sort(nodeInfos, results); } else { results = new ArrayList<>(nodeInfos.values()); } return results.stream().map(ni -> ni.node).collect(Collectors.toList()); }</code><technical_language>FYI If intention precisely predict size of map size a good predictor. This is reason Google Guava methods for creation of maps predicted size. this a problem non-highload projects treated premature optimization</technical_language>

Target:
public List<N> sort(Collection<N> nodes) { LinkedHashMap<ID, NodeInfo<ID, N>> nodeInfos = newLinkedHashMapWithExpectedSize(nodes.size()); List<NodeInfo<ID, N>> results = new ArrayList<>(nodes.size()); int pos = 0; boolean needsSorting = false; for (N node : nodes) { ID nodeID = identityExtractor.apply(node); Set<ID> preds = new HashSet<>(directPredecessorsExtractor.apply(node)); needsSorting = needsSorting || !preds.isEmpty(); NodeInfo<ID, N> nodeInfo = nodeInfos.computeIfAbsent(nodeID, __ -> new NodeInfo<>()); nodeInfo.id = nodeID; nodeInfo.predecessors = preds; nodeInfo.sourcePosition = pos++; nodeInfo.node = node; for (ID pred : preds) { NodeInfo<ID, N> predNode = nodeInfos.computeIfAbsent(pred, __ -> new NodeInfo<>()); if (predNode.successors == null) { predNode.successors = new HashSet<>(); } predNode.successors.add(nodeID); } } if (needsSorting) { TreeSet<NodeInfo<ID, N>> tmp = new TreeSet<>(Comparator.comparingInt(a -> a.sourcePosition)); tmp.addAll(nodeInfos.values()); nodeInfos.clear(); tmp.forEach(ni -> nodeInfos.put(ni.id, ni)); sort(nodeInfos, results); } else { results = new ArrayList<>(nodeInfos.values()); } return results.stream().map(ni -> ni.node).collect(Collectors.toList()); }
Source:
<code>protected boolean showDebug() { <START> return (devMode || "false".equalsIgnoreCase(disabled)); <END> }</code><technical_language>hm... disabled attribute controlled client ($(".selector").attr("disabled", "false")) I do option do a page rendering server side. some other pair of catch this</technical_language>

Target:
protected boolean showDebug() { return (devMode || Boolean.TRUE == PrepareOperations.getDevModeOverride()); }
Source:
<code>public void assign(WorkerSlot slot, String topologyId, Collection<ExecutorDetails> executors) { <START> SchedulerAssignment assignment = this.getAssignmentById(topologyId); <END> if (assignment == null) { assignment = new SchedulerAssignment(topologyId, new HashMap<ExecutorDetails, WorkerSlot>()); this.assignments.put(topologyId, assignment); } assignment.assign(slot, executors); }</code><technical_language>This function throw exception if slot is assigned</technical_language>

Target:
public void assign(WorkerSlot slot, String topologyId, Collection<ExecutorDetails> executors) { if (this.isSlotOccupied(slot)) { throw new RuntimeException("slot: [" + slot.getNodeId() + ", " + slot.getPort() + "] is already occupied."); } SchedulerAssignmentImpl assignment = (SchedulerAssignmentImpl)this.getAssignmentById(topologyId); if (assignment == null) { assignment = new SchedulerAssignmentImpl(topologyId, new HashMap<ExecutorDetails, WorkerSlot>()); this.assignments.put(topologyId, assignment); } else { for (ExecutorDetails executor : executors) { if (assignment.isExecutorAssigned(executor)) { throw new RuntimeException("the executor is already assigned, you should unassign it before assign it to another slot."); } } } assignment.assign(slot, executors); }
Source:
<code>private Field dbSaveUpdate(final Field throwAwayField) throws DotDataException { FieldBuilder builder = FieldBuilder.builder(throwAwayField); Date modDate = DateUtils.round(new Date(), Calendar.SECOND); builder.modDate(modDate); Field oldField = null; try { oldField = selectInDb(throwAwayField.id()); builder.fixed(oldField.fixed()); builder.readOnly(oldField.readOnly()); builder.dataType(oldField.dataType()); builder.dbColumn(oldField.dbColumn()); } catch (NotFoundInDbException e) { List<Field> fieldsAlreadyAdded = byContentTypeId(throwAwayField.contentTypeId()); if (throwAwayField.id() == null) { builder.id(UUID.randomUUID().toString()); } if (throwAwayField.sortOrder() < 0) { builder.sortOrder( fieldsAlreadyAdded.stream().map(f -> f.sortOrder()).max(Integer::compare).orElse(-1) + 1 ); } final List<String> takenFieldVars = fieldsAlreadyAdded.stream().map(Field::variable).collect( Collectors.toList()); <START> takenFieldVars.addAll(InterfaceType.RESERVED_GRAPHQL_FIELD_NAMES); <END> String tryVar = (throwAwayField.variable() == null) ? suggestVelocityVar(throwAwayField.name(), takenFieldVars) : throwAwayField.variable(); builder.variable(tryVar); } builder = FieldBuilder.builder(normalizeData(builder.build())); Field retField = builder.build(); validateDbColumn(retField); if (oldField == null) { insertInodeInDb(retField); insertFieldInDb(retField); } else { updateInodeInDb(retField); updateFieldInDb(retField); } return retField; }</code><technical_language>move this logic Util, like: class GrahpQLUtil { public List<String> getReservedWord(){ return InterfaceType.RESERVED_GRAPHQL_FIELD_NAMES; } }</technical_language>

Target:
private Field dbSaveUpdate(final Field throwAwayField) throws DotDataException { FieldBuilder builder = FieldBuilder.builder(throwAwayField); Date modDate = DateUtils.round(new Date(), Calendar.SECOND); builder.modDate(modDate); Field oldField = null; try { oldField = selectInDb(throwAwayField.id()); builder.fixed(oldField.fixed()); builder.readOnly(oldField.readOnly()); builder.dataType(oldField.dataType()); builder.dbColumn(oldField.dbColumn()); } catch (NotFoundInDbException e) { List<Field> fieldsAlreadyAdded = byContentTypeId(throwAwayField.contentTypeId()); if (throwAwayField.id() == null) { builder.id(UUID.randomUUID().toString()); } if (throwAwayField.sortOrder() < 0) { builder.sortOrder( fieldsAlreadyAdded.stream().map(f -> f.sortOrder()).max(Integer::compare).orElse(-1) + 1 ); } final List<String> takenFieldVars = fieldsAlreadyAdded.stream().map(Field::variable).collect( Collectors.toList()); String tryVar = (throwAwayField.variable() == null) ? suggestVelocityVar(throwAwayField.name(), takenFieldVars) : throwAwayField.variable(); builder.variable(tryVar); } builder = FieldBuilder.builder(normalizeData(builder.build())); Field retField = builder.build(); validateDbColumn(retField); if (oldField == null) { insertInodeInDb(retField); insertFieldInDb(retField); } else { updateInodeInDb(retField); updateFieldInDb(retField); } return retField; }
Source:
<code>private void reportError(BuildStep bs, Throwable e, BuildListener listener, boolean phase) { final String buildStep; if (bs instanceof Publisher) buildStep = ((Publisher) bs).getDescriptor().getDisplayName(); else <START> buildStep = bs.getClass().getName(); <END> if (e instanceof AbortException) { LOGGER.log(Level.FINE, "{0} : {1} failed", new Object[] {AbstractBuild.this, buildStep}); listener.error(buildStep + "' failed: " + e.getMessage()); } else { String msg = buildStep + "' aborted due to exception: "; e.printStackTrace(listener.error(msg)); LOGGER.log(WARNING, msg, e); } if (phase) { setResult(Result.FAILURE); } }</code><technical_language>NIT: friendly request please enclose code blocks braces .... line :smile:</technical_language>

Target:
private void reportError(BuildStep bs, Throwable e, BuildListener listener, boolean phase) { final String buildStep; if (bs instanceof Publisher) { buildStep = ((Publisher) bs).getDescriptor().getDisplayName(); } else { buildStep = bs.getClass().getName(); } if (e instanceof AbortException) { LOGGER.log(Level.FINE, "{0} : {1} failed", new Object[] {AbstractBuild.this, buildStep}); listener.error(buildStep + "' failed: " + e.getMessage()); } else { String msg = buildStep + "' aborted due to exception: "; e.printStackTrace(listener.error(msg)); LOGGER.log(WARNING, msg, e); } if (phase) { setResult(Result.FAILURE); } }
Source:
<code>public SlackResponse(String slackResponseString) { <START> JSONObject result = new JSONObject(slackResponseString); <END> channelId = result.getString("channel"); ts = result.getString("ts"); }</code><technical_language>This is a breaking change is currently implemented. works for bot user credentials, If a bot user this throws exception: org.json.JSONException: A JSONObject text '{' 1 [character 2 line 1] org.json.JSONTokener.syntaxError(JSONTokener.java:433) org.json.JSONObject.<init>(JSONObject.java:194) org.json.JSONObject.<init>(JSONObject.java:321) jenkins.plugins.slack.workflow.SlackResponse.<init>(SlackResponse.java:13) jenkins.plugins.slack.workflow.SlackSendStep$SlackSendStepExecution.run(SlackSendStep.java:270) jenkins.plugins.slack.workflow.SlackSendStep$SlackSendStepExecution.run(SlackSendStep.java:198) org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1$1.call(AbstractSynchronousNonBlockingStepExecution.java:47) hudson.security.ACL.impersonate(ACL.java:260) org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1.run(AbstractSynchronousNonBlockingStepExecution.java:44) java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) java.util.concurrent.FutureTask.run(FutureTask.java:266) java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) java.lang.Thread.run(Thread.java:748) contents of slackResponseString is: ok</technical_language>

Target:
public SlackResponse(String slackResponseString) { if (!StringUtils.isEmpty(slackResponseString)) { JSONObject result = new JSONObject(slackResponseString); channelId = result.getString("channel"); ts = result.getString("ts"); } }
Source:
<code>protected CompressionCodec getCodec(CompressionCodecName codecName,Configuration conf) { String[] configCodecNames = conf.getStrings(CodecConfigurationKeys.CUSTOMIZED_COMPRESSION_CODEC_NAME); String codecClassName = null; int codecIdx = Arrays.asList(configCodecNames).indexOf(codecName.toString()); if(codecIdx > 0){ String[] configCodecClassNames=conf.getStrings(CodecConfigurationKeys.CUSTOMIZED_COMPRESSION_CODEC_CLASS_NAME); codecClassName = configCodecClassNames[codecIdx]; } if(codecClassName == null ||codecClassName.isEmpty()){ codecClassName = codecName.getHadoopCompressionCodecClassName(); <START> } <END> if (codecClassName == null) { return null; } CompressionCodec codec = CODEC_BY_NAME.get(codecClassName); if (codec != null) { return codec; } try { Class<?> codecClass; try { codecClass = Class.forName(codecClassName); } catch (ClassNotFoundException e) { codecClass = configuration.getClassLoader().loadClass(codecClassName); } codec = (CompressionCodec) ReflectionUtils.newInstance(codecClass, configuration); CODEC_BY_NAME.put(codecClassName, codec); return codec; } catch (ClassNotFoundException e) { throw new BadConfigurationException("Class " + codecClassName + " was not found", e); } }</code><technical_language>Line break L230</technical_language>

Target:
protected CompressionCodec getCodec(CompressionCodecName codecName,Configuration conf) { String[] configCodecNames = conf.getStrings(CodecConfigurationKeys.CUSTOMIZED_COMPRESSION_CODEC_NAME); String codecClassName = null; if(configCodecNames != null && configCodecNames.length > 0 && codecName != null) { int codecIdx = Arrays.asList(configCodecNames).indexOf(codecName.toString()); if(codecIdx >= 0) { String[] configCodecClassNames=conf.getStrings(CodecConfigurationKeys.CUSTOMIZED_COMPRESSION_CODEC_CLASS_NAME); codecClassName = configCodecClassNames[codecIdx]; } } if(codecClassName == null ||codecClassName.isEmpty()) { codecClassName = codecName.getHadoopCompressionCodecClassName(); } if (codecClassName == null) { return null; } CompressionCodec codec = CODEC_BY_NAME.get(codecClassName); if (codec != null) { return codec; } try { Class<?> codecClass; try { codecClass = Class.forName(codecClassName); } catch (ClassNotFoundException e) { codecClass = configuration.getClassLoader().loadClass(codecClassName); } codec = (CompressionCodec) ReflectionUtils.newInstance(codecClass, configuration); CODEC_BY_NAME.put(codecClassName, codec); return codec; } catch (ClassNotFoundException e) { throw new BadConfigurationException("Class " + codecClassName + " was not found", e); } }
Source:
<code>private SSLEngineResult.HandshakeStatus wrap() throws IOException { SSLEngineResult res; SSLEngineResult.HandshakeStatus hs; SSLEngineResult.Status status; try { res = m_sslEngine.wrap(m_localClearData, m_localEncData); hs = res.getHandshakeStatus(); } catch (SSLException e) { System.err.println("wrap: see SSLException"); m_sslEngine.closeOutbound(); return m_sslEngine.getHandshakeStatus(); } switch (res.getStatus()) { case OK: m_localEncData.flip(); while (m_localEncData.hasRemaining()) { m_sc.write(m_localEncData); } m_localEncData.compact(); break; case BUFFER_OVERFLOW: <START> m_localEncData = ByteBuffer.allocate(m_localEncData.capacity() * 2); <END> break; case BUFFER_UNDERFLOW: throw new IOException("SSLEngine: nothing in m_localClearData when wrapping"); case CLOSED: m_localEncData.flip(); try { while (m_localEncData.hasRemaining()) { m_sc.write(m_localEncData); } } catch (IOException e) { } hs = m_sslEngine.getHandshakeStatus(); break; } return hs; }</code><technical_language>bit shifting << 1 is faster \* 2</technical_language>

Target:
private SSLEngineResult.HandshakeStatus wrap() throws IOException { SSLEngineResult res; SSLEngineResult.HandshakeStatus hs; try { res = m_sslEngine.wrap(m_clear, m_encrypted); hs = res.getHandshakeStatus(); } catch (SSLException e) { m_sslEngine.closeOutbound(); throw e; } switch (res.getStatus()) { case OK: m_encrypted.flip(); while (m_encrypted.hasRemaining()) { m_sc.write(m_encrypted); } m_encrypted.compact(); break; case BUFFER_OVERFLOW: m_encrypted = ByteBuffer.allocate(m_encrypted.capacity() << 1); break; case BUFFER_UNDERFLOW: throw new IOException("SSLEngine: nothing in m_localClearData when wrapping"); case CLOSED: m_encrypted.flip(); try { while (m_encrypted.hasRemaining()) { m_sc.write(m_encrypted); } } catch (IOException e) { } hs = m_sslEngine.getHandshakeStatus(); break; } return hs; }
Source:
<code>public void addPlanTags() { Set<String> planTags = BlogUtils.planTags(); <START> if (planTags != null) { <END> addTags(planTags.toArray(new String[planTags.size()])); } }</code><technical_language>planTags() return a non-null set (and explicit if choose add relevant return type annotation) so, feel free remove this null-check. Thanks</technical_language>

Target:
public void addPlanTags() { Set<String> planTags = BlogUtils.planTags(); addTags(planTags.toArray(new String[planTags.size()])); }
Source:
<code><START> public static Map<@NonNull String, @NonNull Collection<String>> getEventFieldNames(Iterable<@NonNull ? extends ITmfEventType> eventTypes) { <END> Map<@NonNull String, @NonNull Collection<String>> retMap = new HashMap<>(); for (ITmfEventType eventType : eventTypes) { Collection<String> collection = eventType.getFieldNames(); if (collection != null) { Collections.unmodifiableCollection(collection); retMap.put(eventType.getName(), Collections.unmodifiableCollection(collection)); } } return retMap; }</code><technical_language>a Multimap instead</technical_language>

Target:
public static Multimap<@NonNull String, @NonNull String> getEventFieldNames(Iterable<@NonNull ? extends ITmfEventType> eventTypes) { Multimap<@NonNull String, @NonNull String> retMap = HashMultimap.create(); eventTypes.forEach(eventType -> { Collection<String> collection = eventType.getFieldNames(); if (collection != null) { collection.forEach(field -> { if (field != null) { retMap.put(eventType.getName(), field); } }); } }); return retMap; }
Source:
<code>private void showRestartDialog() { <START> Display.getDefault().asyncExec(() -> { <END> IWorkbench workbench = PlatformUI.getWorkbench(); if (0 == MessageDialog.open(MessageDialog.QUESTION_WITH_CANCEL, workbench.getActiveWorkbenchWindow().getShell(), PreferencesMessages.WizardPreferencesImportRestartDialog_title, PreferencesMessages.WizardPreferencesImportRestartDialog_message, SWT.NONE, PreferencesMessages.WizardPreferencesImportRestartDialog_ok, PreferencesMessages.WizardPreferencesImportRestartDialog_cancel)) workbench.restart(); }); }</code><technical_language>display pop-up move away</technical_language>

Target:
private void showRestartDialog() { if (0 == MessageDialog.open(MessageDialog.CONFIRM, mainPage.getShell(), PreferencesMessages.WizardPreferencesImportRestartDialog_title, PreferencesMessages.WizardPreferencesImportRestartDialog_message, SWT.NONE, PreferencesMessages.WizardPreferencesImportRestartDialog_ok, PreferencesMessages.WizardPreferencesImportRestartDialog_cancel)) { Display.getDefault().asyncExec(() -> { PlatformUI.getWorkbench().restart(); }); } }
Source:
<code>public void useHTML(boolean enabled) { <START> LOGGER.fine("Deprecated: HTMLWriterOutput.useHtml() has been deprecated and its functionality removed."); <END> }</code><technical_language>suggestion LOGGER.log(Level. WARNING, null, new UnsupportedOperationException("Deprecated: HTMLWriterOutput.useHtml() deprecated functionality removed.")); is this message otherwise</technical_language>

Target:
public void useHTML(boolean enabled) { LOGGER.log(Level. WARNING, null, new UnsupportedOperationException("Deprecated: HTMLWriterOutput.useHtml() has been deprecated and its functionality removed.")); }
Source:
<code>protected AbstractIndexedFastaSequenceFile(final Path path, final FastaSequenceIndex index) { super(path); if (index == null) throw new IllegalArgumentException("Null index for fasta " + path); this.index = index; IOUtil.assertFileIsReadable(path); reset(); <START> if(getSequenceDictionary() != null) <END> sanityCheckDictionaryAgainstIndex(path.toAbsolutePath().toString(),sequenceDictionary,index); }</code><technical_language>add this 1 line</technical_language>

Target:
protected AbstractIndexedFastaSequenceFile(final Path path, final FastaSequenceIndex index) { super(path); if (index == null) { throw new IllegalArgumentException("Null index for fasta " + path); } this.index = index; IOUtil.assertFileIsReadable(path); reset(); if(getSequenceDictionary() != null) { sanityCheckDictionaryAgainstIndex(path.toAbsolutePath().toString(),sequenceDictionary,index); } }
Source:
<code>private CountDownLatch submitPut() throws Exception { final CountDownLatch doneLatch = new CountDownLatch(requestAndResultsList.size()); if (router == null || !router.isOpen()) { VerifiableProperties vProps = getNonBlockingRouterProperties(); router = new NonBlockingRouter(new RouterConfig(vProps), new NonBlockingRouterMetrics(new MetricRegistry()), new MockNetworkClientFactory(vProps, mockSelectorState, MAX_PORTS_PLAIN_TEXT, MAX_PORTS_SSL, CHECKOUT_TIMEOUT_MS, mockServerLayout, mockTime), new LoggingNotificationSystem(), mockClusterMap, mockTime); } for (final RequestAndResult requestAndResult : requestAndResultsList) { <START> Utils.newThread(new Runnable() { <END> @Override public void run() { ReadableStreamChannel putChannel = new ByteBufferReadableStreamChannel(ByteBuffer.wrap(requestAndResult.putContent)); requestAndResult.result = (FutureResult<String>) router .putBlob(requestAndResult.putBlobProperties, requestAndResult.putUserMetadata, putChannel, new Callback<String>() { @Override public void onCompletion(String result, Exception exception) { doneLatch.countDown(); } }); } }, false).start(); } return doneLatch; }</code><technical_language>this done in a thread. call putBlob() is blocking anyway. Do get out of this in a thread</technical_language>

Target:
private CountDownLatch submitPut() throws Exception { final CountDownLatch doneLatch = new CountDownLatch(requestAndResultsList.size()); if (router == null || !router.isOpen()) { router = getNonBlockingRouter(); } for (final RequestAndResult requestAndResult : requestAndResultsList) { Utils.newThread(new Runnable() { @Override public void run() { ReadableStreamChannel putChannel = new ByteBufferReadableStreamChannel(ByteBuffer.wrap(requestAndResult.putContent)); requestAndResult.result = (FutureResult<String>) router .putBlob(requestAndResult.putBlobProperties, requestAndResult.putUserMetadata, putChannel, new Callback<String>() { @Override public void onCompletion(String result, Exception exception) { doneLatch.countDown(); } }); } }, true).start(); } return doneLatch; }
Source:
<code>public boolean remove(EE value) throws Exception { <START> Iterator<EE> iterator = getListState().get().iterator(); <END> List<EE> list = new ArrayList<>(); while (iterator.hasNext()) { EE it = iterator.next(); list.add(it); } boolean success = list.remove(value); if (success) { getListState().update(list); } return success; }</code><technical_language>getListState().get() return null object, add a null check</technical_language>

Target:
public boolean remove(EE value) throws Exception { Iterable<EE> iterable = getListState().get(); if (iterable == null) { return false; } Iterator<EE> iterator = iterable.iterator(); List<EE> list = new ArrayList<>(); while (iterator.hasNext()) { EE it = iterator.next(); list.add(it); } boolean success = list.remove(value); if (success) { getListState().update(list); } return success; }
Source:
<code>public void testPairPutIfAbsent() { Module module = createModule(createModuleRootManager(createVirtualRoot(moduleRootPath, "/asd", null))); intelliJReferencePointManager.putIfAbsent(referencePoint, module); Module module2 = intelliJReferencePointManager.getModule(referencePoint); <START> <END> Assert.assertNotNull(module2); }</code><technical_language>codacy detected: This test assert</technical_language>

Target:
public void testPairPutIfAbsent() { Module module = createModule("Module1"); intelliJReferencePointManager.putIfAbsent(referencePoint, module); Module module2 = intelliJReferencePointManager.getModule(referencePoint); Assert.assertNotNull(module2); Assert.assertEquals(module, module2); }
Source:
<code>protected void checkFile(@NotNull GoFile file, @NotNull ProblemsHolder problemsHolder) { MultiMap<String, GoImportSpec> importMap = file.getImportMap(); for (PsiElement importIdentifier : GoImportOptimizer.findRedundantImportIdentifiers(importMap)) { problemsHolder.registerProblem(importIdentifier, "Redundant alias", ProblemHighlightType.LIKE_UNUSED_SYMBOL, OPTIMIZE_QUICK_FIX); } for (GoImportSpec duplicatedImportSpec : GoImportOptimizer.findDuplicatedEntries(importMap)) { problemsHolder.registerProblem(duplicatedImportSpec, "Redeclared import", ProblemHighlightType.GENERIC_ERROR, OPTIMIZE_QUICK_FIX); } <START> MultiMap<String, GoImportSpec> nameMap = getImportNameMap(file); <END> for (Map.Entry<String, Collection<GoImportSpec>> specs : nameMap.entrySet()) { Iterator<GoImportSpec> imports = specs.getValue().iterator(); imports.next(); while (imports.hasNext()) { problemsHolder.registerProblem(imports.next(), "Redeclared import", ProblemHighlightType.GENERIC_ERROR, OPTIMIZE_QUICK_FIX); } } if (!problemsHolder.isOnTheFly()) { resolveAllReferences(file); } for (PsiElement importEntry : GoImportOptimizer.filterUnusedImports(file, importMap).values()) { GoImportSpec spec = GoImportOptimizer.getImportSpec(importEntry); if (spec != null) { if (spec.getImportString().resolve() != null) { problemsHolder.registerProblem(spec, "Unused import", ProblemHighlightType.GENERIC_ERROR, OPTIMIZE_QUICK_FIX); } } } }</code><technical_language>This logic partly duplicates loop is GoImportOptimizer#findDuplicatedEntries. This leads duplicated error message ![screenshot 2015-09-09 21 44 35](<LINK_0></technical_language>

Target:
protected void checkFile(@NotNull GoFile file, @NotNull ProblemsHolder problemsHolder) { MultiMap<String, GoImportSpec> importMap = file.getImportMap(); for (PsiElement importIdentifier : GoImportOptimizer.findRedundantImportIdentifiers(importMap)) { problemsHolder.registerProblem(importIdentifier, "Redundant alias", ProblemHighlightType.LIKE_UNUSED_SYMBOL, OPTIMIZE_QUICK_FIX); } Collection<GoImportSpec> duplicatedEntries = GoImportOptimizer.findDuplicatedEntries(importMap); for (GoImportSpec duplicatedImportSpec : duplicatedEntries) { problemsHolder.registerProblem(duplicatedImportSpec, "Redeclared import", ProblemHighlightType.GENERIC_ERROR, OPTIMIZE_QUICK_FIX); } for (Map.Entry<String, Collection<GoImportSpec>> specs : importMap.entrySet()) { Iterator<GoImportSpec> imports = specs.getValue().iterator(); imports.next(); while (imports.hasNext()) { GoImportSpec redeclaredImport = imports.next(); if (!duplicatedEntries.contains(redeclaredImport)) { problemsHolder.registerProblem(redeclaredImport, "Redeclared import", ProblemHighlightType.GENERIC_ERROR); } } } if (!problemsHolder.isOnTheFly()) { resolveAllReferences(file); } for (PsiElement importEntry : GoImportOptimizer.filterUnusedImports(file, importMap).values()) { GoImportSpec spec = GoImportOptimizer.getImportSpec(importEntry); if (spec != null) { if (spec.getImportString().resolve() != null) { problemsHolder.registerProblem(spec, "Unused import", ProblemHighlightType.GENERIC_ERROR, OPTIMIZE_QUICK_FIX); } } } }
Source:
<code>public static AdapterFBType getPlugType(AdapterType adapterType) { AdapterFBType temp = EcoreUtil.copy(adapterType.getAdapterFBType()); <START> ArrayList<Event> <END> inputEvents = new ArrayList<>(temp.getInterfaceList().getEventOutputs()); for (Event event : inputEvents) { event.setIsInput(true); } ArrayList<Event> outputEvents = new ArrayList<>(temp.getInterfaceList().getEventInputs()); for (Event event : outputEvents) { event.setIsInput(false); } ArrayList<VarDeclaration> inputVars = new ArrayList<>(temp.getInterfaceList().getOutputVars()); for (VarDeclaration varDecl : inputVars) { varDecl.setIsInput(true); } ArrayList<VarDeclaration> outputVars = new ArrayList<>(temp.getInterfaceList().getInputVars()); for (VarDeclaration varDecl : outputVars) { varDecl.setIsInput(false); } temp.getInterfaceList().getEventInputs().clear(); temp.getInterfaceList().getEventOutputs().clear(); temp.getInterfaceList().getInputVars().clear(); temp.getInterfaceList().getOutputVars().clear(); temp.getInterfaceList().getEventInputs().addAll(inputEvents); temp.getInterfaceList().getEventOutputs().addAll(outputEvents); temp.getInterfaceList().getInputVars().addAll(inputVars); temp.getInterfaceList().getOutputVars().addAll(outputVars); return temp; }</code><technical_language>change implementation-agnostic interface List<Event></technical_language>

Target:
public static AdapterFBType getPlugType(AdapterType adapterType) { AdapterFBType temp = EcoreUtil.copy(adapterType.getAdapterFBType()); List<Event> inputEvents = new ArrayList<>(temp.getInterfaceList().getEventOutputs()); for (Event event : inputEvents) { event.setIsInput(true); } List<Event> outputEvents = new ArrayList<>(temp.getInterfaceList().getEventInputs()); for (Event event : outputEvents) { event.setIsInput(false); } List<VarDeclaration> inputVars = new ArrayList<>(temp.getInterfaceList().getOutputVars()); for (VarDeclaration varDecl : inputVars) { varDecl.setIsInput(true); } List<VarDeclaration> outputVars = new ArrayList<>(temp.getInterfaceList().getInputVars()); for (VarDeclaration varDecl : outputVars) { varDecl.setIsInput(false); } temp.getInterfaceList().getEventInputs().clear(); temp.getInterfaceList().getEventOutputs().clear(); temp.getInterfaceList().getInputVars().clear(); temp.getInterfaceList().getOutputVars().clear(); temp.getInterfaceList().getEventInputs().addAll(inputEvents); temp.getInterfaceList().getEventOutputs().addAll(outputEvents); temp.getInterfaceList().getInputVars().addAll(inputVars); temp.getInterfaceList().getOutputVars().addAll(outputVars); return temp; }
Source:
<code>public static void setAutoCrashReportingEnabled(Context context, boolean isEnabled) { SharedPreferences.Editor editor = getSharedPreferences(context).edit(); editor.putBoolean(SETTINGS_CRASH_REPORTS, isEnabled); editor.commit(); <START> CrashReporter.IS_CRASH_REPORTER_INITIALIZED = CrashReporter.initialize(context); <END> }</code><technical_language>Instead of assigning variable here, update variable in CrashReporter.initialize method itself</technical_language>

Target:
public static void setAutoCrashReportingEnabled(Context context, boolean isEnabled) { SharedPreferences.Editor editor = getSharedPreferences(context).edit(); editor.putBoolean(SETTINGS_CRASH_REPORTS, isEnabled); editor.commit(); if (isEnabled) { CrashReporter.initialize(context); } }
Source:
<code>public MySqlAccountServiceConfig(VerifiableProperties verifiableProperties) { <START> dbUrl = verifiableProperties.getString(DB_URL, ""); <END> dbUser = verifiableProperties.getString(DB_USER, ""); dbPassword = verifiableProperties.getString(DB_PASSWORD, ""); updaterPollingIntervalMs = verifiableProperties.getIntInRange(UPDATER_POLLING_INTERVAL_MS_KEY, 2 * 1000, 0, Integer.MAX_VALUE); updaterShutDownTimeoutMs = verifiableProperties.getIntInRange(UPDATER_SHUT_DOWN_TIMEOUT_MS_KEY, 5 * 1000, 1, Integer.MAX_VALUE); backupDir = verifiableProperties.getString(BACKUP_DIRECTORY_KEY, ""); updateDisabled = verifiableProperties.getBoolean(UPDATE_DISABLED, false); }</code><technical_language>required</technical_language>

Target:
public MySqlAccountServiceConfig(VerifiableProperties verifiableProperties) { dbUrl = verifiableProperties.getString(DB_URL); dbUser = verifiableProperties.getString(DB_USER); dbPassword = verifiableProperties.getString(DB_PASSWORD); updaterPollingIntervalSeconds = verifiableProperties.getIntInRange(UPDATER_POLLING_INTERVAL_SECONDS, 60, 0, Integer.MAX_VALUE); updaterShutDownTimeoutMinutes = verifiableProperties.getIntInRange(UPDATER_SHUT_DOWN_TIMEOUT_MINUTES, 2, 1, Integer.MAX_VALUE); backupDir = verifiableProperties.getString(BACKUP_DIRECTORY_KEY, ""); updateDisabled = verifiableProperties.getBoolean(UPDATE_DISABLED, false); }
Source:
<code>public FunctionHandle resolveFunction(Session session, QualifiedName name, List<TypeSignatureProvider> parameterTypes) { <START> if (!session.getSystemProperty("tdigest_enabled", Boolean.class) && isTDigestFunction(name.toString(), parameterTypes)) { <END> throw new PrestoException(INVALID_SESSION_PROPERTY, "Session property for tdigest functions is disabled"); } return staticFunctionNamespace.resolveFunction(name, parameterTypes); }</code><technical_language>isTDigestEnabled</technical_language>

Target:
public FunctionHandle resolveFunction(Session session, QualifiedName name, List<TypeSignatureProvider> parameterTypes) { StaticFunctionHandle resolvedFunction = (StaticFunctionHandle) staticFunctionNamespace.resolveFunction(name, parameterTypes); if (!isTDigestEnabled(session) && isTDigestFunction(resolvedFunction.getSignature().getName(), resolvedFunction.getSignature().getArgumentTypes())) { throw new PrestoException(FUNCTION_NOT_FOUND, "Session property for tdigest functions is disabled"); } return resolvedFunction; }
Source:
<code>private boolean removeFromFeatureMap(final Object featureKey, boolean unique, final Object value, final EObject holder) { final Collection<EObject> setHolder = valueToFeatureToHolderMap.get(value, featureKey); if (setHolder != null) { boolean removed = setHolder.remove(holder); if (setHolder.isEmpty()) { valueToFeatureToHolderMap.remove(value, featureKey); } if (!removed) { <START> String msg = String.format("Notification received to remove value %s from feature %s of object %s, but feature is not indexed. This indicates some errors in underlying model representation.", value, featureKey, holder); <END> logNotificationHandlingError(msg); } return removed && (unique || (!setHolder.contains(holder))); } return false; }</code><technical_language>problem is "feature is indexed" (it INSTANCES indexing level), "value is absent index" similar</technical_language>

Target:
private boolean removeFromFeatureMap(final Object featureKey, boolean unique, final Object value, final EObject holder) { final Collection<EObject> setHolder = valueToFeatureToHolderMap.get(value, featureKey); if (setHolder != null) { boolean removed = setHolder.remove(holder); if (setHolder.isEmpty()) { valueToFeatureToHolderMap.remove(value, featureKey); } if (!removed) { String msg = String.format("Notification received to remove value %s from feature %s of object %s, but feature value is missing from the index. This indicates some errors in underlying model representation.", value, featureKey, holder); logNotificationHandlingError(msg); } return removed && (unique || (!setHolder.contains(holder))); } return false; }
Source:
<code>public final Response containerContent(@Context final HttpServletRequest req, @Context final HttpServletResponse res, @PathParam("containerId") final String containerId, @PathParam("contentletId") final String contentletId) throws DotDataException, DotSecurityException { final InitDataObject initData = this.webResource.init(true, req, true); final User user = initData.getUser(); final PageMode mode = PageMode.EDIT_MODE; final Language landId = WebAPILocator.getLanguageWebAPI().getLanguage(req); PageMode.setPageMode(req, PageMode.EDIT_MODE); final ShortyId contentShorty = this.shortyAPI .getShorty(contentletId) .orElseGet(() -> { throw new ResourceNotFoundException("Can't find contentlet:" + contentletId); }); try { req.getSession().setAttribute(com.liferay.portal.util.WebKeys.USER_ID, user.getUserId()); <START> PrincipalThreadLocal.setName(user.getUserId()); <END> final Contentlet contentlet = (contentShorty.type == ShortType.IDENTIFIER) ? this.contentletAPI.findContentletByIdentifierAnyLanguage(contentShorty.longId): this.contentletAPI.find(contentShorty.longId, user, mode.respectAnonPerms); final String html = this.getHTML(req, res, containerId, user, contentlet); final Map<String, String> response = ImmutableMap.<String, String> builder().put("render", html).build(); return Response.ok(new ResponseEntityView(response)).build(); } catch (DotSecurityException e) { throw new ForbiddenException(e); } }</code><technical_language>webResource do this work? Also, setting session, auth care of this</technical_language>

Target:
public final Response containerContent(@Context final HttpServletRequest req, @Context final HttpServletResponse res, @PathParam("containerId") final String containerId, @PathParam("contentletId") final String contentletId) throws DotDataException, DotSecurityException { final InitDataObject initData = this.webResource.init(true, req, true); final User user = initData.getUser(); final PageMode mode = PageMode.EDIT_MODE; final Language landId = WebAPILocator.getLanguageWebAPI().getLanguage(req); PageMode.setPageMode(req, PageMode.EDIT_MODE); final ShortyId contentShorty = this.shortyAPI .getShorty(contentletId) .orElseGet(() -> { throw new ResourceNotFoundException("Can't find contentlet:" + contentletId); }); try { final Contentlet contentlet = (contentShorty.type == ShortType.IDENTIFIER) ? this.contentletAPI.findContentletByIdentifierAnyLanguage(contentShorty.longId): this.contentletAPI.find(contentShorty.longId, user, mode.respectAnonPerms); final String html = this.getHTML(req, res, containerId, user, contentlet); final Map<String, String> response = ImmutableMap.<String, String> builder().put("render", html).build(); return Response.ok(new ResponseEntityView(response)).build(); } catch (DotSecurityException e) { throw new ForbiddenException(e); } }
Source:
<code>private void reconfigureKafkaConsumer(final boolean forceSeek) { if (eventConsumer == null) { throw new IllegalStateException( "kafkaConsumer should not be null when calling reconfigureKafkaConsumer method"); } final Set<EventTypePartition> newAssignment = offsets.keySet().stream() .filter(o -> !this.releasingPartitions.containsKey(o)) .collect(Collectors.toSet()); if (forceSeek) { try { eventConsumer.reassign(Collections.emptyList()); } catch (final InvalidCursorException ex) { throw new NakadiRuntimeException(ex); } } final Set<EventTypePartition> currentAssignment = eventConsumer.getAssignment(); getLog().info("Changing kafka assignment from to {}", Arrays.deepToString(currentAssignment.toArray()), Arrays.deepToString(newAssignment.toArray())); if (!currentAssignment.equals(newAssignment)) { try { final Map<EventTypePartition, NakadiCursor> beforeFirst = getBeforeFirstCursors(newAssignment); final List<NakadiCursor> cursors = newAssignment.stream() .map(pk -> { final NakadiCursor beforeFirstAvailable = beforeFirst.get(pk); offsets.get(pk).ensureDataAvailable(beforeFirstAvailable); return offsets.get(pk).getSentOffset(); }) .collect(Collectors.toList()); eventConsumer.reassign(cursors); } catch (InvalidCursorException ex) { getLog().error("Failed to reassign updated cursors for subscription", ex); <START> switchState(new CleanupState(ex)); <END> } } }</code><technical_language>this processing is done level of StreamingContext, do change :)</technical_language>

Target:
private void reconfigureKafkaConsumer(final boolean forceSeek) { if (eventConsumer == null) { throw new IllegalStateException( "kafkaConsumer should not be null when calling reconfigureKafkaConsumer method"); } final Set<EventTypePartition> newAssignment = offsets.keySet().stream() .filter(o -> !this.releasingPartitions.containsKey(o)) .collect(Collectors.toSet()); if (forceSeek) { try { eventConsumer.reassign(Collections.emptyList()); } catch (final InvalidCursorException ex) { throw new NakadiRuntimeException(ex); } } final Set<EventTypePartition> currentAssignment = eventConsumer.getAssignment(); getLog().info("Changing kafka assignment from to {}", Arrays.deepToString(currentAssignment.toArray()), Arrays.deepToString(newAssignment.toArray())); if (!currentAssignment.equals(newAssignment)) { try { final Map<EventTypePartition, NakadiCursor> beforeFirst = getBeforeFirstCursors(newAssignment); final List<NakadiCursor> cursors = newAssignment.stream() .map(pk -> { final NakadiCursor beforeFirstAvailable = beforeFirst.get(pk); offsets.get(pk).ensureDataAvailable(beforeFirstAvailable); return offsets.get(pk).getSentOffset(); }) .collect(Collectors.toList()); eventConsumer.reassign(cursors); } catch (InvalidCursorException ex) { throw new NakadiRuntimeException(ex); } } }
Source:
<code><START> public void rootTestForDeletions() throws URISyntaxException { <END> String url = "/v2/variants/13:32889711::A?species=mmusculus&assembly=grcm38"; VariantWithSamplesAndAnnotation variantWithSamplesAndAnnotations = restTemplate.exchange( url, HttpMethod.GET, null, new ParameterizedTypeReference<VariantWithSamplesAndAnnotation>() { }).getBody(); assertEquals("13", variantWithSamplesAndAnnotations.getChromosome()); assertNull(variantWithSamplesAndAnnotations.getReference()); assertEquals("A", variantWithSamplesAndAnnotations.getAlternate()); assertEquals(32889711, variantWithSamplesAndAnnotations.getStart()); }</code><technical_language>test method names swapped. 13:32889711::A is insertion</technical_language>

Target:
public void rootTestForDeletions() throws URISyntaxException { String url = "/v2/variants/13:32889711:T:?species=mmusculus&assembly=grcm38"; VariantWithSamplesAndAnnotation variantWithSamplesAndAnnotations = restTemplate.exchange( url, HttpMethod.GET, null, new ParameterizedTypeReference<VariantWithSamplesAndAnnotation>() { }).getBody(); assertEquals("13", variantWithSamplesAndAnnotations.getChromosome()); assertEquals("T", variantWithSamplesAndAnnotations.getReference()); assertTrue(variantWithSamplesAndAnnotations.getAlternate().isEmpty()); assertEquals(32889711, variantWithSamplesAndAnnotations.getStart()); }