auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private ICompletionProposal[] getProbeVariableCompletions(IDocument document, int offset, String prefix){ String probe = getProbe(document, offset); String[] completionData = stpMetadataSingleton.getProbeVariableCompletions(probe, prefix); ICompletionProposal[] result = new ICompletionProposal[completionData.length]; int prefixLength = prefix.length(); for (int i = 0; i < completionData.length; i++){ int endIndex = completionData[i].indexOf(':'); String variableName = completionData[i].substring(prefixLength, endIndex); result[i] = new CompletionProposal( variableName, offset, 0, endIndex - prefixLength, null, completionData[i] + " - variable", null, <START> TapsetLibrary.getAndCacheDocumentation("probe::" + probe + "::" + variableName)); END> } return result; }</code><technical_language>I this fixed problem, tested solution thoroughly</technical_language>

Target:
private ICompletionProposal[] getProbeVariableCompletions(IDocument document, int offset, String prefix){ String probe = getProbe(document, offset); String[] completionData = stpMetadataSingleton.getProbeVariableCompletions(probe, prefix); ICompletionProposal[] result = new ICompletionProposal[completionData.length]; int prefixLength = prefix.length(); for (int i = 0; i < completionData.length; i++){ int endIndex = completionData[i].indexOf(':'); String variableName = completionData[i].substring(0, endIndex); result[i] = new CompletionProposal( completionData[i].substring(prefixLength, endIndex), offset, 0, endIndex - prefixLength, null, completionData[i] + " - variable", null, TapsetLibrary.getAndCacheDocumentation("probe::" + probe + "::" + variableName)); } return result; }
Source:
<code>public RelNode convert( RelOptPlanner planner, RelNode rel, RelCollation toCollation, boolean allowInfiniteCostConverters) { if (toCollation.getFieldCollations().isEmpty()) { return null; } Convention toConvention = rel.getConvention(); <START> RelBuilder builder = RelFactories.LOGICAL_BUILDER.create(rel.getCluster(), null); <END> RelNode sort = builder.push(rel) .adoptConvention(toConvention) .sort(toCollation) .build(); RelNode newRel = planner.register(sort, rel); final RelTraitSet newTraitSet = rel.getTraitSet().replace(toCollation); if (!newRel.getTraitSet().equals(newTraitSet)) { newRel = planner.changeTraits(newRel, newTraitSet); } return newRel; }</code><technical_language>Based new APIs, simpler code: RelFactories.SortFactory sortFactory = toConvention.getRelFactories().sortFactory; Sort sort = (Sort) sortFactory.createSort(rel, toCollation, null, null); avoids creating a builder throw away</technical_language>

Target:
public RelNode convert( RelOptPlanner planner, RelNode rel, RelCollation toCollation, boolean allowInfiniteCostConverters) { if (toCollation.getFieldCollations().isEmpty()) { return null; } RelBuilder builder = RelFactories.LOGICAL_BUILDER.create(rel.getCluster(), null); RelNode sort = builder.push(rel) .sort(toCollation) .build(); RelNode newRel = planner.register(sort, rel); final RelTraitSet newTraitSet = rel.getTraitSet().replace(toCollation); if (!newRel.getTraitSet().equals(newTraitSet)) { newRel = planner.changeTraits(newRel, newTraitSet); } return newRel; }
Source:
<code>public void connectionListenerDestroyed(ConnectionListener cl) { if (cl.getState() == ConnectionState.DESTROYED) <START> { <END> log.tracef("ManagedConnection is already destroyed %s", cl); return; } if (statistics.isEnabled()) statistics.deltaDestroyedCount(); cl.setState(ConnectionState.DESTROYED); ManagedConnection mc = cl.getManagedConnection(); try { mc.destroy(); } catch (Throwable t) { log.debug("Exception destroying ManagedConnection " + cl, t); } mc.removeConnectionEventListener(cl); }</code><technical_language>here. this statistics update remain connectionListenerDestroyed. remainder of code is in ConnectionListener.destroy</technical_language>

Target:
public void connectionListenerDestroyed(ConnectionListener cl) { if (statistics.isEnabled()) statistics.deltaDestroyedCount(); }
Source:
<code>public static ResourceType addResourceTypeToRegistry(final String resourceType, boolean isNative, final String description, final String defaultPath, final String defaultExtension, final String... otherExtensions) { ResourceType resource = new ResourceType( resourceType, isNative, description, defaultPath, defaultExtension, otherExtensions ); CACHE.put( resourceType, resource ); <START> resource.getAllExtensions().forEach( ext -> CACHE.put( "." + ext, resource ) ); <END> return resource; }</code><technical_language>Is this change related PR is unrelated fix</technical_language>

Target:
public static ResourceType addResourceTypeToRegistry(final String resourceType, boolean isNative, final String description, final String defaultPath, final String defaultExtension, final String... otherExtensions) { ResourceType resource = new ResourceType( resourceType, isNative, description, defaultPath, defaultExtension, otherExtensions ); CACHE.put( resourceType, resource ); resource.getAllExtensions().forEach( ext -> { if (ext.contains( "." )) { throw new IllegalArgumentException( "A resource extension cannot contain a dot. Found: " + ext ); } CACHE.put( "." + ext, resource ); } ); return resource; }
Source:
<code>public BackgroundTask<?> getDataLoadingTask() { <START> if (dataLoadingTask == null) { <END> return null; } return dataLoadingTask; }</code><technical_language>This condition/if is uncessary return null dataLoadingTask</technical_language>

Target:
public BackgroundTask<?> getDataLoadingTask() { return dataLoadingTask; }
Source:
<code>public static Collection testParameters() { return Arrays.asList( new Object[][]{ { new Long( "1" ), new BigDecimal( "1" ) }, { new Long( "2" ), new BigInteger( "2" ) }, { new Long( "3" ), new Byte( "3" ) }, { null, new Double( "4.0" ) }, { null, new Float( "5.0" ) }, { new Long( "6" ), new Integer( "6" ) }, { new Long( "7" ), new Long( "7" ) }, { new Long( "8" ), new Short( "8" ) }, { new Long( "9" ), "9" }, { null, true }, { null, new Date() }, <START> { null, "bananna" } <END> } ); }</code><technical_language>Bananna</technical_language>

Target:
public static Collection testParameters() { return Arrays.asList( new Object[][]{ { new Long( "1" ), new BigDecimal( "1" ) }, { new Long( "2" ), new BigInteger( "2" ) }, { new Long( "3" ), new Byte( "3" ) }, { null, new Double( "4.0" ) }, { null, new Float( "5.0" ) }, { new Long( "6" ), new Integer( "6" ) }, { new Long( "7" ), new Long( "7" ) }, { new Long( "8" ), new Short( "8" ) }, { new Long( "9" ), "9" }, { null, true }, { null, new Date() }, { null, "banana" } } ); }
Source:
<code>synchronized void endTransaction(Transaction t, boolean hasChanges) { int txId = t.transactionId; t.setStatus(Transaction.STATUS_CLOSED); boolean success = transactions.compareAndSet(txId, t, null); <START> assert success; <END> do { VersionedBitSet original = openTransactions.get(); assert original.get(txId); VersionedBitSet clone = original.cloneIt(); clone.clear(txId); success = openTransactions.compareAndSet(original, clone); } while(!success); if (hasChanges) { boolean wasStored = t.wasStored; if (wasStored && !preparedTransactions.isClosed()) { preparedTransactions.remove(txId); } if (wasStored || store.getAutoCommitDelay() == 0) { store.tryCommit(); } else { if (undoLog.isEmpty()) { int unsaved = store.getUnsavedMemory(); int max = store.getAutoCommitMemory(); if (unsaved * 4 > max * 3) { store.tryCommit(); } } } } }</code><technical_language>strange assignment is below</technical_language>

Target:
synchronized void endTransaction(Transaction t, boolean hasChanges) { int txId = t.transactionId; t.setStatus(Transaction.STATUS_CLOSED); assert transactions.get(txId) == t : transactions.get(txId) + " != " + t; transactions.set(txId, null); boolean success; do { VersionedBitSet original = openTransactions.get(); assert original.get(txId); VersionedBitSet clone = original.clone(); clone.clear(txId); success = openTransactions.compareAndSet(original, clone); } while(!success); if (hasChanges) { boolean wasStored = t.wasStored; if (wasStored && !preparedTransactions.isClosed()) { preparedTransactions.remove(txId); } if (wasStored || store.getAutoCommitDelay() == 0) { store.tryCommit(); } else { if (undoLog.isEmpty()) { int unsaved = store.getUnsavedMemory(); int max = store.getAutoCommitMemory(); if (unsaved * 4 > max * 3) { store.tryCommit(); } } } } }
Source:
<code>public Int2DArrayAssert isDeepEqualTo(int[][] expected) { if (actual == expected) { return myself; <START> } <END> isNotNull(); if (expected.length != actual.length) { throw failures.failure(info, shouldHaveSameSizeAs(actual, expected, actual.length, expected.length)); } for (int i = 0; i < actual.length; i++) { int[] actualSubArray = actual[i]; int[] expectedSubArray = expected[i]; if (actualSubArray == expectedSubArray) { continue; } if (actualSubArray == null) { throw failures.failure(info, shouldNotBeNull("actual[" + i + "]")); } if (expectedSubArray.length != actualSubArray.length) { throw failures.failure(info, shouldHaveSameSizeOfSubarrayAs(actual, expected, actualSubArray, expectedSubArray, actualSubArray.length, expectedSubArray.length, i)); } for (int j = 0; j < actualSubArray.length; j++) { if (actualSubArray[j] != expectedSubArray[j]) { throw failures.failure(info, shouldBeEqual(actualSubArray[j], expectedSubArray[j], info.representation(), "[" + i + "][" + j + "]")); } } } return myself; }</code><technical_language>done consistently in codebase, I tend prefer removing if instruction fit a line, I find a bit more concise readable. ex: java if (actual == expected) return myself;</technical_language>

Target:
public Int2DArrayAssert isDeepEqualTo(int[][] expected) { if (actual == expected) return myself; isNotNull(); if (expected.length != actual.length) { throw failures.failure(info, shouldHaveSameSizeAs(actual, expected, actual.length, expected.length)); } for (int i = 0; i < actual.length; i++) { int[] actualSubArray = actual[i]; int[] expectedSubArray = expected[i]; if (actualSubArray == expectedSubArray) continue; if (actualSubArray == null) { throw failures.failure(info, shouldNotBeNull("actual[" + i + "]")); } if (expectedSubArray.length != actualSubArray.length) { throw failures.failure(info, subarraysShouldHaveSameSize(actual, expected, actualSubArray, expectedSubArray, i)); } for (int j = 0; j < actualSubArray.length; j++) { if (actualSubArray[j] != expectedSubArray[j]) { throw failures.failure(info, shouldBeEqual(actualSubArray[j], expectedSubArray[j], info.representation(), "[" + i + "][" + j + "]")); } } } return myself; }
Source:
<code>public void updatePidFromNitro(HttpServletResponse response, @PathVariable("pid") String pid) throws IOException { Iterable<List<Item>> items; try { items = contentAdapter .fetchEpisodes(ProgrammesQuery.builder() .withPid(pid) .withMixins(ANCESTOR_TITLES, CONTRIBUTIONS, IMAGES, GENRE_GROUPINGS) .withPageSize(1) .build()); } catch (NitroException e) { log.error("Failed to get Nitro item {}", pid, e); writeServerErrorWithStack(response, e); return; } <START> if (Iterables.getOnlyElement(items) == null) { <END> log.error("No items found in Nitro for pid {}", pid); response.setStatus(HttpStatusCode.NOT_FOUND.code()); response.setContentLength(0); return; } List<Item> itemsList = Iterables.getOnlyElement(items); Iterator<Item> itemIterator = itemsList.iterator(); createOrUpdateItems(response, pid, itemIterator); }</code><technical_language>Duplicated call for .getOnlyElement</technical_language>

Target:
public void updatePidFromNitro( HttpServletResponse response, @PathVariable("pid") String pid ) throws IOException { Item item; try { Iterable<List<Item>> items = contentAdapter .fetchEpisodes(ProgrammesQuery.builder() .withPid(pid) .withMixins(ANCESTOR_TITLES, CONTRIBUTIONS, IMAGES, GENRE_GROUPINGS) .withPageSize(1) .build()); item = Iterables.getOnlyElement(items).get(0); } catch (NoSuchElementException e) { log.error("No items found in Nitro for pid {}", pid); response.setStatus(HttpStatusCode.NOT_FOUND.code()); response.setContentLength(0); return; } catch (NitroException e) { log.error("Failed to get Nitro item {}", pid, e); writeServerErrorWithStack(response, e); return; } createOrUpdateItem(response, pid, item); }
Source:
<code>public final void runAction() throws IOException { Project project = windowObjects.getProject(); final Editor projectEditor = FileEditorManager.getInstance(project).getSelectedTextEditor(); if (projectEditor != null) { windowObjects.getFileNameContentsMap().clear(); windowObjects.getFileNameNumbersMap().clear(); final JTree jTree = windowObjects.getjTree(); final DefaultTreeModel model = (DefaultTreeModel) jTree.getModel(); final DefaultMutableTreeNode root = (DefaultMutableTreeNode) model.getRoot(); root.removeAllChildren(); jTree.setVisible(true); windowObjects.getSpotlightPaneTinyEditorsJPanel().removeAll(); if (editorDocOps.isJavaFile(projectEditor.getDocument())) { Pair<Integer, Integer> pair = editorDocOps.getLineOffSets(projectEditor, windowObjects.getDistance()); Set<String> allImports = getAllImportsAfterExcludes(projectEditor, pair); if (!allImports.isEmpty()) { ProgressManager.getInstance().run(new QueryKBServerTask( windowObjects.getProject(), allImports, jTree, model, root)); } else { if (projectEditor.getSelectionModel().hasSelection()) { utilsInstance.showHelpInfo(HELP_MESSAGE_IF_CODE_SELECTED); } else { <START> utilsInstance.showHelpInfo(HELP_MESSAGE_NO_SELECTED_CODE); <END> } } } else { utilsInstance.showHelpInfo(FILETYPE_HELP); } } else { utilsInstance.showHelpInfo(EDITOR_ERROR); } }</code><technical_language>utils is ok</technical_language>

Target:
public final void runAction() throws IOException { Project project = windowObjects.getProject(); final Editor projectEditor = FileEditorManager.getInstance(project).getSelectedTextEditor(); if (projectEditor != null) { windowObjects.getFileNameContentsMap().clear(); windowObjects.getFileNameNumbersMap().clear(); final JTree jTree = windowObjects.getjTree(); final DefaultTreeModel model = (DefaultTreeModel) jTree.getModel(); final DefaultMutableTreeNode root = (DefaultMutableTreeNode) model.getRoot(); root.removeAllChildren(); jTree.setVisible(true); windowObjects.getSpotlightPaneTinyEditorsJPanel().removeAll(); if (editorDocOps.isJavaFile(projectEditor.getDocument())) { Pair<Integer, Integer> pair = editorDocOps.getLineOffSets(projectEditor, windowObjects.getDistance()); Set<String> allImports = getAllImportsAfterExcludes(projectEditor, pair); if (!allImports.isEmpty()) { ProgressManager.getInstance().run(new QueryKBServerTask( windowObjects.getProject(), allImports, jTree, model, root)); } else { if (projectEditor.getSelectionModel().hasSelection()) { uiUtils.showHelpInfo(HELP_MESSAGE_IF_CODE_SELECTED); } else { uiUtils.showHelpInfo(HELP_MESSAGE_NO_SELECTED_CODE); } } } else { uiUtils.showHelpInfo(FILETYPE_HELP); } } else { uiUtils.showHelpInfo(EDITOR_ERROR); } }
Source:
<code>public void writeToTopology(final InternalTopologyBuilder topologyBuilder) { final String processorName = processorParameters.processorName(); topologyBuilder.addProcessor(processorName, processorParameters.processorSupplier(), parentNodeNames()); if (storeNames.length > 0) { topologyBuilder.connectProcessorAndStateStores(processorName, storeNames); } <START> if (storeNeeded) { <END> topologyBuilder.addStateStore(Objects.requireNonNull(storeBuilder, "storeBuilder was null"), processorName); } }</code><technical_language>ktableSource.queryableName() != null do this check (we get source ktable node via: final KTableSource<K, V> ktableSource = (KTableSource<K, V>) processorParameters.processorSupplier();</technical_language>

Target:
public void writeToTopology(final InternalTopologyBuilder topologyBuilder) { final String processorName = processorParameters.processorName(); topologyBuilder.addProcessor(processorName, processorParameters.processorSupplier(), parentNodeNames()); if (storeNames.length > 0) { topologyBuilder.connectProcessorAndStateStores(processorName, storeNames); } if (processorParameters.processorSupplier() instanceof KTableSource) { if (((KTableSource<?, ?>) processorParameters.processorSupplier()).materialized()) { topologyBuilder.addStateStore(Objects.requireNonNull(storeBuilder, "storeBuilder was null"), processorName); } } else if (storeBuilder != null) { topologyBuilder.addStateStore(storeBuilder, processorName); } }
Source:
<code><START> public boolean isDeactivationSafe() { <END> return ctx.cache().inMemoryCaches().isEmpty(); }</code><technical_language>Please, ctx.cache().cacheDescriptors() remove GridCacheProcessor#inMemoryCaches method. return ctx.cache().cacheDescriptors().values().stream() .filter(desc -> !isPersistentCache(desc.cacheConfiguration(), ctx.config().getDataStorageConfiguration())) .findFirst() .isPresent();</technical_language>

Target:
public boolean isDeactivationSafe() { return !ctx.cache().cacheDescriptors().values().stream() .anyMatch(desc -> !isPersistentCache(desc.cacheConfiguration(), ctx.config().getDataStorageConfiguration())); }
Source:
<code>public String getLink() { <START> return this.link; <END> }</code><technical_language>link member removed this line replaced with: java return this.baseStyleGuideLink + this.name;</technical_language>

Target:
public String getLink() { return BASE_STYLE_GUIDE_LINK + this.getName(); }
Source:
<code>public synchronized void setCatalogInitialization(CatalogInitialization catalogInitialization) { <START> if (catalogInitialization!=null) catalogInitialization.injectManagementContext(this); <END> this.catalogInitialization = catalogInitialization; }</code><technical_language>prefer fail if user passes in null, failing NPE in some unrelated code/thread later. do like: this.catalogInitialization = checkNotNull(catalogInitialization, "catalogInitialization"); catalogInitialization.injectManagementContext(this);</technical_language>

Target:
public void setCatalogInitialization(CatalogInitialization catalogInitialization) { synchronized (catalogInitMutex) { Preconditions.checkNotNull(catalogInitialization, "initialization must not be null"); if (this.catalogInitialization!=null && this.catalogInitialization != catalogInitialization) throw new IllegalStateException("Changing catalog init from "+this.catalogInitialization+" to "+catalogInitialization+"; changes not permitted"); catalogInitialization.injectManagementContext(this); this.catalogInitialization = catalogInitialization; } }
Source:
<code>public String getSVG(String svgWidth, String svgHeight) { try { DOMSource domSource = new DOMSource(svgDocument.getFirstChild()); StringWriter writer = new StringWriter(); StreamResult result = new StreamResult(writer); <START> TransformerFactory tf = TransformerFactory.newInstance(); <END> Transformer transformer = tf.newTransformer(); if(!svgWidth.isEmpty()){ svgDocument.getFirstChild().getAttributes().getNamedItem("width").setTextContent(svgWidth); } if(!svgHeight.isEmpty()){ svgDocument.getFirstChild().getAttributes().getNamedItem("height").setTextContent(svgHeight); } transformer.transform(domSource, result); return writer.toString(); } catch (TransformerException e) { throw new RuntimeException("Could not transform svg", e); } }</code><technical_language>overload please</technical_language>

Target:
public String getSVG(String svgWidth, String svgHeight) { try { DOMSource domSource = new DOMSource(svgDocument.getFirstChild()); StringWriter writer = new StringWriter(); StreamResult result = new StreamResult(writer); TransformerFactory tf = TransformerFactory.newInstance(); Transformer transformer = tf.newTransformer(); if (svgWidth != null && !svgWidth.isEmpty()) { svgDocument.getFirstChild().getAttributes().getNamedItem("width").setTextContent(svgWidth); } if (svgHeight != null && !svgHeight.isEmpty()) { svgDocument.getFirstChild().getAttributes().getNamedItem("height").setTextContent(svgHeight); } transformer.transform(domSource, result); return writer.toString(); } catch (TransformerException e) { throw new RuntimeException("Could not transform svg", e); } }
Source:
<code>public void setExcludedPatterns(Set<String> patterns) { if (excludedPatterns != null && excludedPatterns.size() > 0) { LOG.warn("Replacing excluded patterns with [{}], be aware that this affects all instances and safety of your application!", excludedPatterns, patterns); } else { <START> LOG.debug("Replacing excluded patterns with [{}], be aware that this affects all instances and safety of your application!", <END> excludedPatterns, patterns); } excludedPatterns = new HashSet<>(patterns.size()); for (String pattern : patterns) { excludedPatterns.add(Pattern.compile(pattern, Pattern.CASE_INSENSITIVE)); } }</code><technical_language>LOG.debug("Sets excluded patterns [{}]", patterns);</technical_language>

Target:
public void setExcludedPatterns(Set<String> patterns) { if (excludedPatterns != null && excludedPatterns.size() > 0) { LOG.warn("Replacing excluded patterns with [{}], be aware that this affects all instances and safety of your application!", excludedPatterns, patterns); } else { LOG.debug("Sets excluded patterns to [{}]", patterns); } excludedPatterns = new HashSet<>(patterns.size()); for (String pattern : patterns) { excludedPatterns.add(Pattern.compile(pattern, Pattern.CASE_INSENSITIVE)); } }
Source:
<code>public String getDisplayString(RadiologyReport radiologyReport) { <START> return radiologyReport.getReportStatus() <END> .toString(); }</code><technical_language>display more unique resource report status. imagine return a list of RadiologyReport REST show display property. radiologyReport.radiologyOrder.getAccessionNumber() + radiologyReport.reportDate + radiologyReport.principalResultsInterpreter aware/test for null</technical_language>

Target:
public String getDisplayString(RadiologyReport radiologyReport) { return radiologyReport.getRadiologyOrder() .getOrderNumber() + ", " + radiologyReport.getReportStatus() .toString(); }
Source:
<code>public boolean commit(Transaction tx) throws TException { try { return client.commitTx(TransactionConverterUtils.wrap(tx)).isValue(); <START> } catch (Exception e) { <END> isValid = false; throw e; } }</code><technical_language>This close connection a service exception TransactionNotInProgressException is thrown, some other exception thrown wrap/unwrap, right</technical_language>

Target:
public boolean commit(Transaction tx) throws TException, TransactionNotInProgressException { try { return client.commitTx(TransactionConverterUtils.wrap(tx)).isValue(); } catch (TTransactionNotInProgressException e) { throw new TransactionNotInProgressException(e.getMessage()); } catch (TException e) { isValid.set(false); throw e; } }
Source:
<code>private boolean addToFeatureMap(final Object featureKey, boolean unique, final Object value, final EObject holder) { Collection<EObject> setVal = valueToFeatureToHolderMap.get(value, featureKey); if (setVal == null) { setVal = unique ? new HashSet<EObject>() : HashMultiset.<EObject> create(); valueToFeatureToHolderMap.put(value, featureKey, setVal); } boolean changed = unique || !setVal.contains(holder); <START> setVal.add(holder); <END> return changed; }</code><technical_language>want put a check perhaps: if feature is unique, set is changed, duplicate insertion</technical_language>

Target:
private boolean addToFeatureMap(final Object featureKey, boolean unique, final Object value, final EObject holder) { Collection<EObject> setVal = valueToFeatureToHolderMap.get(value, featureKey); if (setVal == null) { setVal = unique ? new HashSet<EObject>() : HashMultiset.<EObject> create(); valueToFeatureToHolderMap.put(value, featureKey, setVal); } boolean changed = unique || !setVal.contains(holder); boolean success = setVal.add(holder); if (unique && !success) { String msg = String.format("Error adding feature %s to the index with type %s. This indicates some errors in underlying model representation.", value, featureKey); logNotificationHandlingError(msg); } return changed; }
Source:
<code>public void testApplicationFileExist() throws Exception { <START> File f = new File("target/liberty/usr/servers/test/dropins/appsdirectory-set-appz-configured-it.war"); <END> Assert.assertTrue(f.getCanonicalFile() + " doesn't exist", f.exists()); }</code><technical_language>"*notconfigured-it.war" Double check folder this passed</technical_language>

Target:
public void testApplicationFileExist() throws Exception { File f = new File("liberty/usr/servers/test/dropins/appsdirectory-set-appz-notconfigured-it.war"); Assert.assertTrue(f.getCanonicalFile() + " doesn't exist", f.exists()); }
Source:
<code>public void start(CoprocessorEnvironment env) throws IOException { Configuration config = env.getConfiguration(); timeInterval = config.getLong( QueryServices.TASK_HANDLING_INTERVAL_ATTRIB, <START> QueryServicesOptions.DEFAULT_TASK_HANDLING_INTERVAL); <END> timeMaxInterval = config.getLong( QueryServices.TASK_HANDLING_MAX_INTERVAL_ATTRIB, QueryServicesOptions.DEFAULT_TASK_HANDLING_MAX_INTERVAL); initialDelay = config.getLong( QueryServices.TASK_HANDLING_INITIAL_DELAY_ATTRIB, QueryServicesOptions.DEFAULT_TASK_HANDLING_INITIAL_DELAY); }</code><technical_language>simplify exposing properties out. defaults good enough. Especially initialDelay parameter is for test purposes</technical_language>

Target:
public void start(CoprocessorEnvironment env) throws IOException { Configuration config = env.getConfiguration(); timeInterval = config.getLong( QueryServices.TASK_HANDLING_INTERVAL_MS_ATTRIB, QueryServicesOptions.DEFAULT_TASK_HANDLING_INTERVAL_MS); timeMaxInterval = config.getLong( QueryServices.TASK_HANDLING_MAX_INTERVAL_MS_ATTRIB, QueryServicesOptions.DEFAULT_TASK_HANDLING_MAX_INTERVAL_MS); }
Source:
<code>public void sendResourcePack(String url, String hash) throws IllegalArgumentException { <START> Preconditions.checkArgument( hash.length() <= 40 ); <END> if ( !hash.equals( resourcePackHash ) ) { unsafe().sendPacket( new ResourcePackRequest( url, hash ) ); } }</code><technical_language>Message</technical_language>

Target:
public void sendResourcePack(String url, String hash) throws IllegalArgumentException { if ( hash != null ) { Preconditions.checkArgument( hash.length() <= 40, "Hash must be at least 40 characters" ); if ( hash.equals( resourcePackHash ) ) { return; } } unsafe().sendPacket( new ResourcePackRequest( url, hash ) ); }
Source:
<code>public String placeMarketOrder(MarketOrder marketOrder) throws IOException { <START> return placeBithumbMarketOrder(marketOrder).getOrderId(); <END> }</code><technical_language>try / catch BithumbException needed</technical_language>

Target:
public String placeMarketOrder(MarketOrder marketOrder) throws IOException { try { return placeBithumbMarketOrder(marketOrder).getOrderId(); } catch (BithumbException e) { throw BithumbErrorAdapter.adapt(e); } }
Source:
<code>public Mono<Map<Symbol, Object>> getRemoteProperties() { <START> if (this.remoteProperties != null) { <END> return Mono.just(this.remoteProperties); } synchronized (this) { if (this.remoteProperties != null) { return Mono.just(this.remoteProperties); } return RetryUtil.withRetry( getEndpointStates() .takeUntil(state -> state == AmqpEndpointState.ACTIVE) .then(Mono.fromCallable(() -> { this.remoteProperties = sender.getRemoteProperties(); return this.remoteProperties; })), timeout, retry); } }</code><technical_language>I if this easier reason if AtomicReference volatile</technical_language>

Target:
public Mono<Map<Symbol, Object>> getRemoteProperties() { return RetryUtil.withRetry( getEndpointStates() .takeUntil(state -> state == AmqpEndpointState.ACTIVE) .then(Mono.fromCallable(sender::getRemoteProperties)), timeout, retry); }
Source:
<code>private void defineJavaRepository(Context context) { NewRepository repo = context .createRepository(CheckListRegistrar.REPOSITORY_KEY, "java") <START> .setName(CheckListRegistrar.REPOSITORY_NAME); <END> rulesLoader.load(repo, CheckListRegistrar.CHECK_CLASSES); repo.done(); }</code><technical_language>pretty weird name for a class, change JavaCheckClasses. consistent HTL easier grasp</technical_language>

Target:
private void defineJavaRepository(Context context) { NewRepository repo = context .createRepository(JavaCheckClasses.REPOSITORY_KEY, "java") .setName(JavaCheckClasses.REPOSITORY_NAME); rulesLoader.load(repo, JavaCheckClasses.CHECK_CLASSES); repo.done(); }
Source:
<code>public long getBytesReceived() { <START> return callbackWrapper != null ? callbackWrapper.totalBytesRead.get() : 0; <END> }</code><technical_language>this is a mock ok is a subtle difference - is number of bytes acknowledged supplied AsyncWritableChannel. is actual bytes "received"</technical_language>

Target:
public long getBytesReceived() { return bytesReceived.get(); }
Source:
<code>protected void testFirstEntry(ReportVideoCampaign first) { <START> Assert.assertEquals(7848880157L, first.getAccountId().longValue()); <END> Assert.assertEquals("a", first.getAccount()); Assert.assertEquals("a", first.getCampaignName()); Assert.assertEquals("enabled", first.getStatus()); Assert.assertEquals(179512L, first.getImpressions().longValue()); Assert.assertEquals(2295L, first.getViews().longValue()); Assert.assertEquals(73.16, first.getViewPlayed25BigDecimal().doubleValue()); Assert.assertEquals(53.38, first.getViewPlayed50BigDecimal().doubleValue()); Assert.assertEquals(42.15, first.getViewPlayed75BigDecimal().doubleValue()); Assert.assertEquals(41.82, first.getViewPlayed100BigDecimal().doubleValue()); Assert.assertEquals(0.00, first.getCtrBigDecimal().doubleValue()); Assert.assertEquals(0L, first.getWebsiteClicks().longValue()); }</code><technical_language>a fake CID please</technical_language>

Target:
protected void testFirstEntry(ReportVideoCampaign first) { Assert.assertEquals(123L, first.getAccountId().longValue()); Assert.assertEquals("a", first.getAccount()); Assert.assertEquals("a", first.getCampaignName()); Assert.assertEquals("enabled", first.getStatus()); Assert.assertEquals(179512L, first.getImpressions().longValue()); Assert.assertEquals(2295L, first.getViews().longValue()); Assert.assertEquals(73.16, first.getViewPlayed25BigDecimal().doubleValue()); Assert.assertEquals(53.38, first.getViewPlayed50BigDecimal().doubleValue()); Assert.assertEquals(42.15, first.getViewPlayed75BigDecimal().doubleValue()); Assert.assertEquals(41.82, first.getViewPlayed100BigDecimal().doubleValue()); Assert.assertEquals(0.00, first.getCtrBigDecimal().doubleValue()); Assert.assertEquals(1300L, first.getBudget().longValue()); Assert.assertEquals(0L, first.getWebsiteClicks().longValue()); }
Source:
<code>public ConsistencyLevel getDefaultConsistencyLevel() { <START> DatabaseAccount databaseAccount = this.globalEndpointManager.getDatabaseAccountFromCache(this.serviceEndpoint).block(); <END> return BridgeInternal.getConsistencyPolicy(databaseAccount).getDefaultConsistencyLevel(); }</code><technical_language>blocking calls SDK good. deadlock, perf hit, etc. blocking calls else</technical_language>

Target:
public Mono<ConsistencyLevel> getDefaultConsistencyLevel() { return this.globalEndpointManager.getDatabaseAccountFromCache(this.serviceEndpoint).map(databaseAccount -> BridgeInternal.getConsistencyPolicy(databaseAccount).getDefaultConsistencyLevel()); }
Source:
<code>private static Boolean doBeforeAttributeRightsCheck(PerunSession sess, ActionType actionType, AttributeDefinition attrDef) throws InternalErrorException, AttributeNotExistsException { Utils.notNull(sess, "sess"); Utils.notNull(actionType, "ActionType"); Utils.notNull(attrDef, "AttributeDefinition"); getPerunBl().getAttributesManagerBl().checkAttributeExists(sess, attrDef); if (!sess.getPerunPrincipal().isAuthzInitialized()) { refreshAuthz(sess); } if (sess.getPerunPrincipal().getRoles() == null) { return false; } if (sess.getPerunPrincipal().getRoles().hasRole(Role.PERUNADMIN)) { return true; } if (sess.getPerunPrincipal().getRoles().hasRole(Role.ENGINE) && actionType.equals(ActionType.READ)) { return true; } if (sess.getPerunPrincipal().getRoles().hasRole(Role.PERUNOBSERVER) && <START> (actionType.equals(ActionType.READ) || actionType.equals(ActionType.READ_PUBLIC) || actionType.equals(ActionType.READ_VO))) { <END> return true; } if (sess.getPerunPrincipal().getRoles().hasRole(Role.RPC) && actionType.equals(ActionType.READ)) { return true; } return null; }</code><technical_language>I optimize read checks here. conditions applies for roles ENGINE, RPC PERUNOBSERVER action is type of READ</technical_language>

Target:
private static Boolean doBeforeAttributeRightsCheck(PerunSession sess, ActionType actionType, AttributeDefinition attrDef) throws InternalErrorException, AttributeNotExistsException { Utils.notNull(sess, "sess"); Utils.notNull(actionType, "ActionType"); Utils.notNull(attrDef, "AttributeDefinition"); getPerunBl().getAttributesManagerBl().checkAttributeExists(sess, attrDef); if (!sess.getPerunPrincipal().isAuthzInitialized()) { refreshAuthz(sess); } if (sess.getPerunPrincipal().getRoles() == null) { return false; } if (sess.getPerunPrincipal().getRoles().hasRole(Role.PERUNADMIN)) { return true; } if ((actionType.equals(ActionType.READ) || actionType.equals(ActionType.READ_PUBLIC) || actionType.equals(ActionType.READ_VO)) && (sess.getPerunPrincipal().getRoles().hasRole(Role.RPC) || sess.getPerunPrincipal().getRoles().hasRole(Role.PERUNOBSERVER) || sess.getPerunPrincipal().getRoles().hasRole(Role.ENGINE))) { return true; } return null; }
Source:
<code>private void getVerificationsForRequirement(String sub, ArtifactReadable req) { boolean noVerifications = true; for (ArtifactReadable ver : req.getRelated(CoreRelationTypes.Verification__Verifier).getList()) { noVerifications = false; <START> try { <END> getResultsForVerifications(sub, req, ver); } catch (IOException ex) { System.out.println("IOException"); } } if (noVerifications) { try { String[] row = {req.getName(), sub, "NO VERIFICATION TRACE", "NO RESULTS TRACE"}; writer.writeRow((Object[]) row); } catch (Exception ex) { System.out.println("Exception"); } } }</code><technical_language>skip try/catch IOException return; need add a throws IOException statement method</technical_language>

Target:
private void getVerificationsForRequirement(String sub, ArtifactReadable req) throws IOException { boolean noVerifications = true; for (ArtifactReadable ver : req.getRelated(CoreRelationTypes.Verification__Verifier).getList()) { noVerifications = false; getResultsForVerifications(sub, req, ver); } if (noVerifications) { String[] row = {req.getName(), sub, "NO VERIFICATION TRACE", "NO RESULTS TRACE"}; writer.writeRow((Object[]) row); } }
Source:
<code>private static String truncateDiskProperty(String diskProperty, int maxLength, boolean encodeProperty) { if (encodeProperty) { <START> diskProperty = diskProperty.substring(0, maxLength / 4); <END> String encodedProperty = StringUtils.EMPTY; for (int i = diskProperty.length(); i > 0; --i) { encodedProperty = encodeDiskProperty(diskProperty.substring(0, i)); if (encodedProperty.length() <= maxLength) { break; } } return encodedProperty; } return diskProperty.substring(0, maxLength); }</code><technical_language>a constant instead of 4</technical_language>

Target:
private String truncateDiskProperty(String diskProperty, int maxLength, boolean encodeProperty) { if (encodeProperty) { diskProperty = diskProperty.substring(0, maxLength / MAX_TRUNCATION_RATIO_WITH_HEX_USING_UTF_16LE); String encodedProperty = StringUtils.EMPTY; for (int i = diskProperty.length(); i > 0; --i) { encodedProperty = encodeDiskProperty(diskProperty.substring(0, i)); if (encodedProperty.length() <= maxLength) { break; } } return encodedProperty; } return diskProperty.substring(0, maxLength); }
Source:
<code>protected List<String> getVmNames(Label label) { <START> ArrayList<String> vmNames = new ArrayList<>(); <END> if (!entitiesNameMap.isEmpty() && !label.getVms().isEmpty()) { label.getVms().forEach(id -> { String vmName = entitiesNameMap.get(id); if (vmName != null && !vmName.isEmpty()) { vmNames.add(vmName); } }); Collections.sort(vmNames); } return vmNames; }</code><technical_language>List</technical_language>

Target:
protected List<String> getVmNames(Label label) { List<String> vmNames = new ArrayList<>(); if (!entitiesNameMap.isEmpty() && !label.getVms().isEmpty()) { label.getVms().forEach(id -> { String vmName = entitiesNameMap.get(id); if (vmName != null && !vmName.isEmpty()) { vmNames.add(vmName); } }); Collections.sort(vmNames); } return vmNames; }
Source:
<code><START> protected boolean processImageInIrs() { <END> Guid taskId = persistAsyncTaskPlaceHolder(getParameters().getParentCommand()); VDSReturnValue vdsReturnValue = runVdsCommand( VDSCommandType.CreateImage, new CreateImageVDSCommandParameters(getParameters().getStoragePoolId(), getParameters() .getStorageDomainId(), getImageGroupId(), getParameters().getDiskInfo().getSize(), getParameters().getDiskInfo().getVolumeType(), getParameters().getDiskInfo() .getVolumeFormat(), getDestinationImageId(), getJsonDiskDescription())); if (vdsReturnValue.getSucceeded()) { getParameters().setVdsmTaskIds(new ArrayList<Guid>()); getParameters().getVdsmTaskIds().add( createTask(taskId, vdsReturnValue.getCreationInfo(), getParameters().getParentCommand(), VdcObjectType.Storage, getParameters().getStorageDomainId())); getReturnValue().getInternalVdsmTaskIdList().add(getParameters().getVdsmTaskIds().get(0)); return true; } return false; }</code><technical_language>1. this file related create snapshot flow. 2. do persist placeholder compatible rest of code</technical_language>

Target:
protected boolean processImageInIrs() { Guid taskId = getAsyncTaskId(); VDSReturnValue vdsReturnValue = runVdsCommand( VDSCommandType.CreateImage, new CreateImageVDSCommandParameters(getParameters().getStoragePoolId(), getParameters() .getStorageDomainId(), getImageGroupId(), getParameters().getDiskInfo().getSize(), getParameters().getDiskInfo().getVolumeType(), getParameters().getDiskInfo() .getVolumeFormat(), getDestinationImageId(), getJsonDiskDescription())); if (vdsReturnValue.getSucceeded()) { getParameters().setVdsmTaskIds(new ArrayList<Guid>()); getParameters().getVdsmTaskIds().add( createTask(taskId, vdsReturnValue.getCreationInfo(), getParameters().getParentCommand(), VdcObjectType.Storage, getParameters().getStorageDomainId())); getReturnValue().getInternalVdsmTaskIdList().add(getParameters().getVdsmTaskIds().get(0)); return true; } return false; }
Source:
<code><START> public <TContext> Flux<CosmosBulkOperationRequestAndResponse<TContext>> processBulkOperations( <END> Flux<CosmosItemOperation> operations) { return this.processBulkOperations(operations, new BulkProcessingOptions<>()); }</code><technical_language>I api for CosmosContianer (sync version). please add too</technical_language>

Target:
public <TContext> Flux<CosmosBulkOperationResponse<TContext>> processBulkOperations( Flux<CosmosItemOperation> operations) { return this.processBulkOperations(operations, new BulkProcessingOptions<>()); }
Source:
<code>public void shouldWriteVersions() throws Exception { String databaseName = mongoRule.getRandomTemporaryDatabaseName(); MongoOperations mongoOperations = MongoConfiguration.getMongoOperations(databaseName, mongoConnection, mongoMappingContext); String vepCacheVersion = "87"; String vepVersion = "88"; assertStepCompletes(databaseName, vepCacheVersion, vepVersion); <START> List<AnnotationMetadata> annotationMetadatas = mongoOperations.findAll(AnnotationMetadata.class); <END> assertEquals(1, annotationMetadatas.size()); assertEquals(vepCacheVersion, annotationMetadatas.get(0).getCacheVersion()); assertEquals(vepVersion, annotationMetadatas.get(0).getVepVersion()); }</code><technical_language>"data" is a plural noun</technical_language>

Target:
public void shouldWriteVersions() throws Exception { String databaseName = mongoRule.getRandomTemporaryDatabaseName(); MongoOperations mongoOperations = MongoConfiguration.getMongoOperations(databaseName, mongoConnection, mongoMappingContext); String vepCacheVersion = "87"; String vepVersion = "88"; assertStepIsComplete(databaseName, vepCacheVersion, vepVersion); List<AnnotationMetadata> annotationMetadataList = mongoOperations.findAll(AnnotationMetadata.class); assertEquals(1, annotationMetadataList.size()); assertEquals(vepCacheVersion, annotationMetadataList.get(0).getCacheVersion()); assertEquals(vepVersion, annotationMetadataList.get(0).getVepVersion()); }
Source:
<code>public void serialize(RowData row, DataOutputView target) throws IOException { int len = fieldSerializers.length; if (row.getArity() != len) { throw new RuntimeException("Row arity of input element does not match serializers."); } <START> fillMask(fieldSerializers.length, row, mask); <END> writeMask(mask, target); for (int i = 0; i < row.getArity(); i++) { if (!row.isNullAt(i)) { fieldSerializers[i].serialize(RowData.get(row, i, fieldTypes[i]), target); } } }</code><technical_language>suggestion fillMask(len, row, mask);</technical_language>

Target:
public void serialize(RowData row, DataOutputView target) throws IOException { int len = fieldSerializers.length; if (row.getArity() != len) { throw new RuntimeException("Row arity of input element does not match serializers."); } fillMask(len, row, mask); writeMask(mask, target); for (int i = 0; i < row.getArity(); i++) { if (!row.isNullAt(i)) { fieldSerializers[i].serialize(RowData.get(row, i, fieldTypes[i]), target); } } }
Source:
<code>protected Object processObject(Object o) { <START> if (o != null && o instanceof PGobject && <END> ((PGobject)o).getType().equals("jsonb")) { return ((PGobject) o).getValue(); } return super.processObject(o); }</code><technical_language>null check is needed, instanceof return false if left operand is null</technical_language>

Target:
protected Object processObject(Object o) { if (o instanceof PGobject && ((PGobject)o).getType().equals("jsonb")) { return ((PGobject) o).getValue(); } return super.processObject(o); }
Source:
<code>public String TransliterierenPerson() { Person md = this.curPerson.getP(); if (md.getRole().equals("Author")) { Transliteration trans = new Transliteration(); try { MetadataType mdtDin = this.myPrefs.getMetadataTypeByName("AuthorTransliteratedDIN"); MetadataType mdtIso = this.myPrefs.getMetadataTypeByName("AuthorTransliteratedISO"); Person mdDin = new Person(mdtDin); Person mdIso = new Person(mdtIso); <START> mdDin.setFirstname(trans.transliterateDin(md.getFirstname())); <END> mdDin.setLastname(trans.transliterateDin(md.getLastname())); mdIso.setFirstname(trans.transliterateIso(md.getFirstname())); mdIso.setLastname(trans.transliterateIso(md.getLastname())); mdDin.setRole("AuthorTransliteratedDIN"); mdIso.setRole("AuthorTransliteratedISO"); this.myDocStruct.addPerson(mdDin); this.myDocStruct.addPerson(mdIso); } catch (MetadataTypeNotAllowedException e) { myLogger.error("Fehler beim Hinzufügen der Transliterationen (MetadataTypeNotAllowedException): " + e.getMessage()); } } saveMetadataAsBean(this.myDocStruct); if (!updateBlocked()) { return "SperrungAbgelaufen"; } return ""; }</code><technical_language>transliterateDIN, transliterateISO here</technical_language>

Target:
public String TransliterierenPerson() { Person md = this.curPerson.getP(); if (md.getRole().equals("Author")) { Transliteration trans = new Transliteration(); try { MetadataType metadataTypeDIN = this.myPrefs.getMetadataTypeByName("AuthorTransliteratedDIN"); MetadataType metadataTypeISO = this.myPrefs.getMetadataTypeByName("AuthorTransliteratedISO"); Person mdDin = new Person(metadataTypeDIN); Person mdIso = new Person(metadataTypeISO); mdDin.setFirstname(trans.transliterateDIN(md.getFirstname())); mdDin.setLastname(trans.transliterateDIN(md.getLastname())); mdIso.setFirstname(trans.transliterateISO(md.getFirstname())); mdIso.setLastname(trans.transliterateISO(md.getLastname())); mdDin.setRole("AuthorTransliteratedDIN"); mdIso.setRole("AuthorTransliteratedISO"); this.myDocStruct.addPerson(mdDin); this.myDocStruct.addPerson(mdIso); } catch (MetadataTypeNotAllowedException e) { myLogger.error("Fehler beim Hinzufügen der Transliterationen (MetadataTypeNotAllowedException): " + e.getMessage()); } } saveMetadataAsBean(this.myDocStruct); if (!updateBlocked()) { return "SperrungAbgelaufen"; } return ""; }
Source:
<code>public void customFunction() { String sql = "" + "PREFIX fn: <<LINK_0>> " + "select (fn:mycustomfucnction() as ?res1) (str(fn:mycustomfucnction('Rya')) as ?res2) " + "where {}"; try { TupleQuery query = this.conn.prepareTupleQuery(QueryLanguage.SPARQL, sql); TupleQueryResult qres = query.evaluate(); ArrayList<HashMap<String, Value>> reslist = new ArrayList<HashMap<String, Value>>(); while (qres.hasNext()) { BindingSet b = qres.next(); Set<String> names = b.getBindingNames(); HashMap<String, Value> hm = new HashMap<String, Value>(); <START> for (Object n : names) { <END> hm.put( (String) n, b.getValue((String) n) ); } reslist.add(hm); if (hm.containsKey("res1")) { Assert.assertEquals(hm.get("res1").stringValue(), "Hello"); } else { Assert.fail("'res1' is not in result set."); } if (hm.containsKey("res2")) { Assert.assertEquals(hm.get("res2").stringValue(), "Hello, Rya"); } else { Assert.fail("'res2' is not in result set"); } } } catch (Exception ex) { Assert.fail(ex.getMessage()); } }</code><technical_language>loop objects Set's generic type is String</technical_language>

Target:
public void customFunction() { FunctionRegistry.getInstance().add(new CustomSparqlFunction()); String sql = "" + "PREFIX fn: <<LINK_0>> " + "select (fn:mycustomfunction() as ?res1) (str(fn:mycustomfunction('Rya')) as ?res2) " + "where {}"; try { TupleQuery query = this.conn.prepareTupleQuery(QueryLanguage.SPARQL, sql); TupleQueryResult qres = query.evaluate(); if (qres.getBindingNames().size() == 2) { Assert.assertArrayEquals(new String[] { "res1", "res2" }, qres.getBindingNames().toArray()); } else { Assert.fail("Binding set length is not what's expected."); } } catch (Exception ex) { Assert.fail(ex.getMessage()); } }
Source:
<code>public Object next() { if ( position >= len ) { throw new NoSuchElementException(); } Object result = Array.get( array, position ); position++; <START> return result; <END> }</code><technical_language>In is this improvement</technical_language>

Target:
public Object next() { if ( position >= len ) { throw new NoSuchElementException(); } int offset = position++; return Array.get( array, offset ); }
Source:
<code>public static void registerKryoSerialization(Map<String, Object> conf, Class klass) { <START> setSerializationClassName("org.apache.heron.api.serializer.KryoSerializer"); <END> getRegisteredKryoSerializations(conf).add(klass.getName()); }</code><technical_language>create a final field for this "org.apache.heron.api.serializer.KryoSerializer" string reuse</technical_language>

Target:
public static void registerKryoSerialization(Map<String, Object> conf, Class klass) { setSerializationClassName(conf, HERON_KRYO_SERIALIZER_CLASS_NAME); getRegisteredKryoSerializations(conf).add(klass.getName()); }