auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsPlayer) { if (args.length == 0) { return false; } String message = StringUtils.join(args, " "); <START> FUtil.bcastMsg(String.format("[§5[§eTotalFreedom§5] §b:%s] %s", sender.getName(), message)); <END> return true; }</code><technical_language>prefix announcement config.yml</technical_language>

Target:
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsPlayer) { if (args.length == 0) { return false; } String message = StringUtils.join(args, " "); TFM_Util.bcastMsg(TFM_ConfigEntry.ANNOUNCER_PREFIX.getString().replaceAll("&", "§") + message); return true; }
Source:
<code>private boolean isNodeUnavailableForTooLong(RMNode node) { <START> int period = PAResourceManagerProperties.RM_UNAVAILABLE_NODES_MAX_PERIOD.getValueAsInt(); <END> int periodInMilliseconds = period * 60 * 1000; long now = System.currentTimeMillis(); return (node.getState().equals(NodeState.DOWN) || node.getState().equals(NodeState.LOST)) && (now - node.getStateChangeTime() > periodInMilliseconds); }</code><technical_language>rename period periodInMinutes</technical_language>

Target:
private boolean isNodeUnavailableForTooLong(RMNode node) { if (PAResourceManagerProperties.RM_UNAVAILABLE_NODES_MAX_PERIOD.isSet()) { int periodInMinutes = PAResourceManagerProperties.RM_UNAVAILABLE_NODES_MAX_PERIOD.getValueAsInt(); int periodInMilliseconds = periodInMinutes * 60 * 1000; return (node.getState().equals(NodeState.DOWN) || node.getState().equals(NodeState.LOST)) && (node.millisSinceStateChanged() > periodInMilliseconds); } return false; }
Source:
<code>public void reset() { long endSegment = Math.max(logMetadata.getGlobalTail(), 0L) / RECORDS_PER_LOG_FILE; log.warn("Global Tail:{}, endSegment={}", logMetadata.getGlobalTail(), endSegment); closeSegmentHandlers(endSegment); deleteFilesMatchingFilter(file -> { try { String segmentStr = file.getName().split("\\.")[0]; return Long.parseLong(segmentStr) <= endSegment; } catch (Exception e) { log.warn("reset: ignoring file {}", file.getName()); return false; <START> } <END> }); dataStore.resetStartingAddress(); dataStore.resetTailSegment(); logMetadata = new LogMetadata(); logSizeQuota = new ResourceQuota("LogSizeQuota", logSizeLimit); log.info("reset: Completed, end segment {}", endSegment); }</code><technical_language>test trigger issue of this (which causing leak). dropped</technical_language>

Target:
public void reset() { log.warn("Reset. Global Tail:{}", logMetadata.getGlobalTail()); Lock lock = resetLock.writeLock(); lock.lock(); try { closeAllSegmentHandlers(); deleteFilesMatchingFilter(file -> true); dataStore.resetStartingAddress(); dataStore.resetTailSegment(); logMetadata = new LogMetadata(); logSizeQuota = new ResourceQuota("LogSizeQuota", logSizeLimit); log.info("reset: Completed"); } finally { lock.unlock(); } }
Source:
<code>public static List<String> getFeaturesFromFeatureRepo(String featureFilePath) { XPath xPath = XPathFactory.newInstance().newXPath(); List<String> featureIds = new ArrayList<>(); try (FileInputStream fi = new FileInputStream(new File(featureFilePath))) { Document featuresFile = XMLUtils.getInstance().getSecureDocumentBuilder(false).parse(fi); NodeList features = (NodeList) xPath.compile(FEATURE_XPATH).evaluate(featuresFile, XPathConstants.NODESET); LOGGER.info("Found feature(s)", features.getLength()); for (int i = 0; i < features.getLength(); i++) { NamedNodeMap attributes = features.item(i).getAttributes(); Node name = attributes.getNamedItem("name"); LOGGER.info("name node: {}", name.getNodeValue()); Node version = attributes.getNamedItem("version"); LOGGER.info("version node: {}", version.getNodeValue()); String featureId = String.format("%s/%s", name.getNodeValue(), version.getNodeValue()); LOGGER.info("Found feature id: {}", featureId); featureIds.add(featureId); } } catch (Exception e) { LOGGER.error( "Error encountered using xpath to retrieve names and versions from {}", featureFilePath, <START> e); <END> throw new RuntimeException( "Unable to read features names in feature file at: " + featureFilePath, e); } return featureIds; }</code><technical_language>![MAJOR](<LINK_0> 'Severity: MAJOR') Define throw a dedicated exception instead of a generic one. [![rule](<LINK_1>](<LINK_2></technical_language>

Target:
public static List<String> getFeaturesFromFeatureRepo(String featureFilePath) { XPath xPath = XPathFactory.newInstance().newXPath(); List<String> featureIds = new ArrayList<>(); try (FileInputStream fi = new FileInputStream(new File(featureFilePath))) { Document featuresFile = XMLUtils.getInstance().getSecureDocumentBuilder(false).parse(fi); NodeList features = (NodeList) xPath.compile(FEATURE_XPATH).evaluate(featuresFile, XPathConstants.NODESET); LOGGER.info("Found feature(s)", features.getLength()); for (int i = 0; i < features.getLength(); i++) { NamedNodeMap attributes = features.item(i).getAttributes(); Node name = attributes.getNamedItem("name"); Node version = attributes.getNamedItem("version"); String featureId = String.format("%s/%s", name.getNodeValue(), version.getNodeValue()); LOGGER.info("Found feature id: {}", featureId); featureIds.add(featureId); } } catch (Exception e) { LOGGER.error( "Error encountered using xpath to retrieve names and versions from {}", featureFilePath, e); throw new RuntimeException( "Unable to read features names in feature file at: " + featureFilePath, e); } return featureIds; }
Source:
<code>public void testVarianceTooHigh() { final Long accountId = 999L; final List<Long> wakeTimeList = new ArrayList<>(); <START> Long spread = 500L; <END> wakeTimeList.add(0L); wakeTimeList.add(0L + spread); wakeTimeList.add(0L + spread + spread); Optional<InsightCard> someResult = WakeVariance.processWakeVarianceData(accountId, wakeTimeList, new WakeStdDevData()); assertThat(someResult.isPresent(), is(Boolean.TRUE)); final String expectedTitle = WakeVarianceMsgEN.getWakeVarianceTooHigh(0, 0).title; assertThat(someResult.get().title, is(expectedTitle)); }</code><technical_language>final</technical_language>

Target:
public void testVarianceTooHigh() { final Long accountId = 999L; final List<Integer> wakeTimeList = new ArrayList<>(); final Integer spread = 500; wakeTimeList.add(0); wakeTimeList.add(0 + spread); wakeTimeList.add(0 + spread + spread); final Optional<InsightCard> someResult = WakeVariance.processWakeVarianceData(accountId, wakeTimeList, new WakeStdDevData()); assertThat(someResult.isPresent(), is(Boolean.TRUE)); final String expectedTitle = WakeVarianceMsgEN.getWakeVarianceTooHigh(0, 0).title; assertThat(someResult.get().title, is(expectedTitle)); }
Source:
<code>protected Box finish(MovieHeaderBox mvhd) throws IOException { checkState(!finished, "The muxer track has finished muxing"); if (getEntries().isEmpty()) { if (codec == Codec.H264 && !spsList.isEmpty()) { SeqParameterSet sps = SeqParameterSet.read(spsList.get(0).duplicate()); Size size = H264Utils.getPicSize(sps); VideoCodecMeta meta = createSimpleVideoCodecMeta(size, ColorSpace.YUV420); addVideoSampleEntry(meta); } <START> } <END> setCodecPrivateIfNeeded(); return super.finish(mvhd); }</code><technical_language>I convert this a warning, i.e. Logger.warn("Creating a track sample entry");</technical_language>

Target:
protected Box finish(MovieHeaderBox mvhd) throws IOException { checkState(!finished, "The muxer track has finished muxing"); if (getEntries().isEmpty()) { if (codec == Codec.H264 && !spsList.isEmpty()) { SeqParameterSet sps = SeqParameterSet.read(spsList.get(0).duplicate()); Size size = H264Utils.getPicSize(sps); VideoCodecMeta meta = createSimpleVideoCodecMeta(size, ColorSpace.YUV420); addVideoSampleEntry(meta); } else { Logger.warn("CodecMP4MuxerTrack: Creating a track without sample entry"); } } setCodecPrivateIfNeeded(); return super.finish(mvhd); }
Source:
<code>public static boolean isSupported() { if (isSupportedCached == null) { log.debug("Checking if SRA module is supported in that environment"); isSupportedCached = NGS.isSupported(); if (!isSupportedCached) { <START> log.info("SRA is not supported. Will not able to read from SRA"); <END> } else { String versionString = appVersionString == null ? defaultAppVersionString : appVersionString; versionString += " through " + htsJdkVersionString; NGS.setAppVersionString(versionString); } } return isSupportedCached; }</code><technical_language>Typo: "Will able" -> "Will able"</technical_language>

Target:
public static boolean isSupported() { if (isSupportedCached == null) { log.debug("Checking if SRA module is supported in that environment"); isSupportedCached = NGS.isSupported(); if (!isSupportedCached) { log.info("SRA is not supported. Will not be able to read from SRA"); } else { NGS.setAppVersionString(getFullVersionString()); } } return isSupportedCached; }
Source:
<code>public boolean test() { PropertyDialog pd = new PropertyDialog(project.getName()); pd.open(); new WaitUntil(new ShellIsAvailable("Properties for " + projectName), TimePeriod.DEFAULT); new DefaultTreeItem("Project Facets").select(); try { <START> new WaitUntil(new ShellIsAvailable("Setting Java Build Path"), TimePeriod.DEFAULT); <END> new PushButton("Discard").click(); } catch (Exception e) { } boolean result; if (natureParent != null) { result = new DefaultTreeItem(new DefaultTree(1), natureParent, natureID).isChecked(); if (version != null) { result = result && new DefaultTreeItem(new DefaultTree(1), natureParent, natureID).getCell(1).equals(version); } } else { result = new DefaultTreeItem(new DefaultTree(1), natureID).isChecked(); if (version != null) { result = result && new DefaultTreeItem(new DefaultTree(1), natureID).getCell(1).equals(version); } } pd.ok(); new WaitWhile(new ShellIsAvailable("Properties for " + projectName), TimePeriod.DEFAULT); return result; }</code><technical_language>I suppose this needed <LINK_0> is resolved</technical_language>

Target:
public boolean test() { PropertyDialog pd = new PropertyDialog(project.getName()); pd.open(); new WaitUntil(new ShellIsAvailable("Properties for " + projectName), TimePeriod.DEFAULT); new DefaultTreeItem("Project Facets").select(); if (!JavaVersionHelper.getJavaVersion().equals("1.8")) { try { new DefaultShell("Setting Java Build Path"); new PushButton("Apply").click(); } catch (CoreLayerException e) { } } boolean result; if (natureParent != null) { result = new DefaultTreeItem(new DefaultTree(1), natureParent, natureID).isChecked(); if (version != null) { result = result && new DefaultTreeItem(new DefaultTree(1), natureParent, natureID).getCell(1).equals(version); } } else { result = new DefaultTreeItem(new DefaultTree(1), natureID).isChecked(); if (version != null) { result = result && new DefaultTreeItem(new DefaultTree(1), natureID).getCell(1).equals(version); } } pd.ok(); new WaitWhile(new ShellIsAvailable("Properties for " + projectName), TimePeriod.DEFAULT); return result; }
Source:
<code>public void update() throws BankException, LoginException, BankChoiceException, IOException { super.update(); if (username == null || password == null || username.length() == 0 || password.length() == 0) { throw new LoginException(res.getText(R.string.invalid_username_password).toString()); } urlopen = login(); String loanName; Matcher matcher; try { matcher = reAccountLink.matcher(this.lastResponse); while (matcher.find()) { accounts.add(new Account( Html.fromHtml(matcher.group(3)).toString().trim(), Helpers.parseBalance(Html.fromHtml(matcher.group(5)).toString()), Html.fromHtml(matcher.group(4)).toString().trim() )); } goToPage(PageType.CREDIT_CARDS); matcher = reCreditCardLink.matcher(this.lastResponse); while (matcher.find()) { accounts.add(new Account( matcher.group(2), Helpers.parseBalance(matcher.group(5)), "c:" + matcher.group(3), -1L, Account.CCARD )); } goToPage(PageType.LOANS); matcher = reLoanLink.matcher(this.lastResponse); while (matcher.find()) { loanName = matcher.group(2) + ' ' + matcher.group(3); accounts.add(new Account( loanName, Helpers.parseBalance(matcher.group(5)), "l:" + matcher.group(3).trim(), -1L, Account.LOANS )); } if (accounts.isEmpty()) { throw new BankException(res.getText(R.string.no_accounts_found).toString()); } <START> } finally { <END> super.updateComplete(); } }</code><technical_language>remove finally {</technical_language>

Target:
public void update() throws BankException, LoginException, BankChoiceException, IOException { super.update(); if (username == null || password == null || username.length() == 0 || password.length() == 0) { throw new LoginException(res.getText(R.string.invalid_username_password).toString()); } urlopen = login(); String loanName; Matcher matcher = reAccountLink.matcher(this.lastResponse); while (matcher.find()) { accounts.add(new Account( Html.fromHtml(matcher.group(3)).toString().trim(), Helpers.parseBalance(Html.fromHtml(matcher.group(5)).toString()), Html.fromHtml(matcher.group(4)).toString().trim() )); } goToPage(PageType.CREDIT_CARDS); matcher = reCreditCardLink.matcher(this.lastResponse); while (matcher.find()) { accounts.add(new Account( matcher.group(2), Helpers.parseBalance(matcher.group(5)), "c:" + matcher.group(3), -1L, Account.CCARD )); } goToPage(PageType.LOANS); matcher = reLoanLink.matcher(this.lastResponse); while (matcher.find()) { loanName = matcher.group(2) + ' ' + matcher.group(3); accounts.add(new Account( loanName, Helpers.parseBalance(matcher.group(5)), "l:" + matcher.group(3).trim(), -1L, Account.LOANS )); } if (accounts.isEmpty()) { throw new BankException(res.getText(R.string.no_accounts_found).toString()); } super.updateComplete(); }
Source:
<code>public void typeInSearchField(String content, int length) { waitForElementVisibleByElement(searchInput); <START> searchInput.sendKeys(content.substring(0, length)); <END> PageObjectLogging.log( "typeInSearchField", "String >>" + content.substring(0, length) + "<< was typed in string field", true ); }</code><technical_language>needs a substring for this</technical_language>

Target:
public void typeInSearchField(String content, int length) { waitForElementVisibleByElement(searchInput); searchInput.sendKeys(content.substring(0, 3)); PageObjectLogging.log( "typeInSearchField", "String >>" + content.substring(0, length) + "<< was typed in string field", true ); }
Source:
<code>void start(Bench bench, String action) { this.currentAction = bench.getName() + ": " + action; <START> this.startTime = System.nanoTime(); <END> }</code><technical_language>rename startTime startTimeNs</technical_language>

Target:
void start(Bench bench, String action) { this.currentAction = bench.getName() + ": " + action; this.startTimeNs = System.nanoTime(); }
Source:
<code>public static boolean matchProperties(final Cluster oldEntity, final Cluster newEntity) { Map<String, String> oldProps = new HashMap<String, String>(); Map<String, String> newProps = new HashMap<String, String>(); if (oldEntity.getProperties() != null) { for (Property prop : oldEntity.getProperties().getProperties()) { oldProps.put(prop.getName(), prop.getValue()); } } if (newEntity.getProperties() != null) { for (Property prop : newEntity.getProperties().getProperties()) { newProps.put(prop.getName(), prop.getValue()); } } <START> <END> if (oldProps.keySet().equals(newProps.keySet())) { for (Map.Entry<String, String> keyVals : oldProps.entrySet()) { if (!keyVals.getValue().equals(newProps.get(keyVals.getKey()))) { return false; } } return true; } return false; }</code><technical_language>add a function return properties of a cluster, for location interface</technical_language>

Target:
public static boolean matchProperties(final Cluster oldEntity, final Cluster newEntity) { Map<String, String> oldProps = getClusterProperties(oldEntity); Map<String, String> newProps = getClusterProperties(newEntity); return oldProps.equals(newProps); }
Source:
<code>public final TypeClass asHaskellObject(final Context ctx) { TypeBuilder builder = new TypeBuilder(ctx.typeClasses); TypeClass tc = new TypeClass(this.getName()); for (String instance : this.instances) { Type t = builder.build(instance); <START> if (t instanceof ConstT) <END> tc.getTypes().add((ConstT) t); } return tc; }</code><technical_language>Missing braces {}</technical_language>

Target:
public final TypeClass asHaskellObject(final Context ctx) { TypeBuilder builder = new TypeBuilder(ctx.typeClasses); TypeClass tc = new TypeClass(this.getName()); for (String instance : this.instances) { Type t = builder.build(instance); if (t instanceof ConstT) { tc.getTypes().add((ConstT) t); } } return tc; }
Source:
<code>public void testInfo() throws IOException { SimpleFeatureStore store1 = (SimpleFeatureStore) data.getFeatureSource(first.typeName); ResourceInfo info = store1.getInfo(); assertEquals("sf_roads", info.getName()); assertEquals("Generated from sfRoads", info.getDescription()); assertTrue(info.getKeywords().contains("sfRoads roads")); assertEquals("roads_Type", info.getTitle()); assertEquals("<LINK_0>", info.getSchema().toString()); <START> assertEquals(589242.03, info.getBounds().getMinX(),0.01); <END> assertEquals("EPSG:NAD27 / UTM zone 13N", info.getCRS().getName().toString()); }</code><technical_language>Is this in meters/feet? Hmm... do suggest change in precision</technical_language>

Target:
public void testInfo() throws IOException { SimpleFeatureStore store1 = (SimpleFeatureStore) data.getFeatureSource(first.typeName); ResourceInfo info = store1.getInfo(); assertEquals("sf_roads", info.getName()); assertEquals("Generated from sfRoads", info.getDescription()); assertTrue(info.getKeywords().contains("sfRoads roads")); assertEquals("roads_Type", info.getTitle()); assertEquals("<LINK_0>", info.getSchema().toString()); assertEquals(589275.24, info.getBounds().getMinX(), 0.01); assertEquals("EPSG:NAD27 / UTM zone 13N", info.getCRS().getName().toString()); }
Source:
<code>private <T extends Config> T loadConfig(String configDirectory, String configFileName, Class<T> configClass) { FileHelper configFileHelper = new FileHelper(configDirectory, configFileName); String fileContents; if (!configFileHelper.exists()) { <START> fileContents = DEFAULT_FILE_CONTENTS; <END> } else { try { fileContents = configFileHelper.loadFileContents(); } catch (IOException e) { HTLog.error(logger, e); logger.error(e.toString()); fileContents = DEFAULT_FILE_CONTENTS; } } return createConfig(fileContents, configClass); }</code><technical_language>initialize fileContents DEFAULT_FILE_CONTENTS, if (configFileHelper.exists()) instead for else case</technical_language>

Target:
private <T> T loadConfig(String configDirectory, String configFileName, Class<T> configClass) { String fileContents = DEFAULT_FILE_CONTENTS; if (FileHelper.isFileExists(configDirectory, configFileName)) { try { fileContents = FileHelper.getFileContents(configDirectory, configFileName); } catch (IOException e) { HTLog.error(logger, e); logger.error(e.toString()); } } return createConfig(fileContents, configClass); }
Source:
<code>public String call() { StringBuilder result = new StringBuilder(); final File rootPath = new File(this.rootPathName); <START> for (File file : Preconditions.checkNotNull(rootPath.listFiles())) { <END> if (file.isFile()) { try { result.append(Util.getDigestOf(new FileInputStream(file))) .append(" ") .append(file.getName()).append('\n'); } catch (IOException e) { } } } return result.toString(); }</code><technical_language>Throwing IllegalArgumentException is improvement a NullPointerException I think</technical_language>

Target:
public String call() { StringBuilder result = new StringBuilder(); final File rootPath = new File(this.rootPathName); for (File file : FileUtils.listFiles(rootPath, null, false)) { if (file.isFile()) { try { result.append(Util.getDigestOf(new FileInputStream(file))) .append(" ") .append(file.getName()).append('\n'); } catch (IOException e) { } } } return result.toString(); }
Source:
<code>public void handleQueryMessage(final long senderHSId, long requestId, long gapStart) { m_es.execute(new Runnable() { @Override public void run() { boolean canCover = canCoverNextSequenceNumber(gapStart); <START> long lastSeq = m_gapTracker.getRangeContaining(gapStart); <END> sendQueryResponse(senderHSId, requestId, canCover, lastSeq); } }); }</code><technical_language>Technically method return a 'range', upper boundary. this method return startting sequence number of block covering gap? return if 'canCover' returned false? merge 2 methods? e.g. seqNo = getStartingSequenceNumberCoveringGap(gapStart). If returned 0, cover</technical_language>

Target:
public void handleQueryMessage(final long senderHSId, long requestId, long gapStart) { m_es.execute(new Runnable() { @Override public void run() { long lastSeq = Long.MIN_VALUE; Pair<Long, Long> range = m_gapTracker.getRangeContaining(gapStart); if (range != null) { lastSeq = range.getSecond(); } sendQueryResponse(senderHSId, requestId, lastSeq); } }); }
Source:
<code>static int read(ReadableByteChannel channel, ByteBuffer buffer) throws IOException { int read = channel.read(buffer); if(read < 0) { <START> throw new IOException("Channel has reached EOF"); <END> } return read; }</code><technical_language>This is confusing. users do RabbitMQ channels. Please "Connection reached EOF" simply "I/O thread: reached EOF"</technical_language>

Target:
static int read(ReadableByteChannel channel, ByteBuffer buffer) throws IOException { int read = channel.read(buffer); if(read < 0) { throw new IOException("I/O thread: reached EOF"); } return read; }
Source:
<code>public Set<Integer> getRemovedPartitions(JobConfig jobConfig, JobContext jobContext, Set<Integer> allPartitions) { Set<Integer> deletedPartitions = new HashSet<>(); for (Integer partition : jobContext.getPartitionSet()) { if (!allPartitions.contains(partition)) { deletedPartitions.add(partition); } } <START> return deletedPartitions; <END> }</code><technical_language>nit: condensed line</technical_language>

Target:
public Set<Integer> getRemovedPartitions(JobConfig jobConfig, JobContext jobContext, Set<Integer> allPartitions) { return jobContext.getPartitionSet().stream().filter(partition -> !allPartitions.contains(partition)).collect( Collectors.toSet()); }
Source:
<code>private boolean updateIsoListFromVDSM(Guid repoStoragePoolId, Guid repoStorageDomainId) { boolean refreshIsoSucceeded = false; if (repoStorageDomainId != null) { try { VDSReturnValue returnValue = Backend .getInstance() .getResourceManager() .RunVdsCommand(VDSCommandType.GetIsoList, new IrsBaseVDSCommandParameters(repoStoragePoolId)); @SuppressWarnings("unchecked") Map<String, Map<String, String>> isoDomainList = <START> (Map<String, Map<String, String>>) returnValue.getReturnValue(); <END> if (returnValue.getSucceeded() && isoDomainList != null) { log.debugFormat("The refresh process from VDSM, for Iso files succeeded."); refreshIsoSucceeded = refreshIsoFileListMetaData(repoStorageDomainId, repoStorageDom, isoDomainList, ImageFileType.ISO); } } catch (Exception e) { refreshIsoSucceeded = false; log.warnFormat("The refresh process from VDSM, for Iso files failed."); log.error(e); } } return refreshIsoSucceeded; }</code><technical_language>Rename isoStats - change</technical_language>

Target:
private boolean updateIsoListFromVDSM(Guid repoStoragePoolId, Guid repoStorageDomainId) { boolean refreshIsoSucceeded = false; if (repoStorageDomainId != null) { try { VDSReturnValue returnValue = Backend .getInstance() .getResourceManager() .RunVdsCommand(VDSCommandType.GetIsoList, new IrsBaseVDSCommandParameters(repoStoragePoolId)); @SuppressWarnings("unchecked") Map<String, Map<String, String>> fileStats = (Map<String, Map<String, String>>) returnValue.getReturnValue(); if (returnValue.getSucceeded() && fileStats != null) { log.debugFormat("The refresh process from VDSM, for Iso files succeeded."); refreshIsoSucceeded = refreshIsoFileListMetaData(repoStorageDomainId, repoStorageDom, fileStats, ImageFileType.ISO); } } catch (Exception e) { refreshIsoSucceeded = false; log.warnFormat("The refresh process from VDSM, for Iso files failed."); log.error(e); } } return refreshIsoSucceeded; }
Source:
<code>public List<SDVariable> doDiff(List<SDVariable> i_v1) { SDVariable prod = outputVariables()[0]; <START> SDVariable broadcastableGrad = sameDiff.f().reductionBroadcastableWithOrigShape(arg().getShape().length, dimensions, i_v1.get(0)); <END> SDVariable broadcastableProd = sameDiff.f().reductionBroadcastableWithOrigShape(arg().getShape().length, dimensions, prod); SDVariable mul = broadcastableGrad.div(broadcastableProd); SDVariable ret = arg().mul(mul); return Collections.singletonList(ret); }</code><technical_language>Arg a shape. some place holder logic want put in here. checking for null shapes do this good</technical_language>

Target:
public List<SDVariable> doDiff(List<SDVariable> i_v1) { SDVariable prod = outputVariables()[0]; int origRank = Shape.rankFromShape(arg().getShape()); SDVariable broadcastableGrad = sameDiff.f().reductionBroadcastableWithOrigShape(origRank, dimensions, i_v1.get(0)); SDVariable broadcastableProd = sameDiff.f().reductionBroadcastableWithOrigShape(origRank, dimensions, prod); SDVariable mul = broadcastableGrad.div(broadcastableProd); SDVariable ret = arg().mul(mul); return Collections.singletonList(ret); }
Source:
<code>public String getDescription() { <START> return "add network partition deployment"; <END> }</code><technical_language>change text "add" "Add"</technical_language>

Target:
public String getDescription() { return "Add network partition deployment"; }
Source:
<code>public <D, M> M toAvro(Schema schema, D input) { <START> return ((AvroMapper<D, M>) getMapper(input.getClass())).toAvro(schema, input); <END> }</code><technical_language>making getMapper generic move cast</technical_language>

Target:
public <D, M> M toAvro(Schema schema, D input) { return (M) getMapper((Class<D>) input.getClass()).toAvro(schema, input); }
Source:
<code>public int getHeight() { int height = 0; try { <START> height = ImageUtil.getInstance().getDimension(getFileAsset()).height; <END> } catch(Exception e) { Logger.error(this, e.getMessage()); } return height; }</code><technical_language>I modify code a call time ImageUtil.getInstance().getDimension(getFileAsset()) store dimension in a private variable, load file get height width in instance. check if dimension is null get proper</technical_language>

Target:
public int getHeight() { try { if (fileDimension.height == 0) { fileDimension = ImageUtil.getInstance().getDimension(getFileAsset()); } } catch (Exception e) { Logger.error(this, e.getMessage()); } return fileDimension.height; }
Source:
<code>public static PDPrintStyle getPolygonStyle (JSONObject oskariStyle, PDResources resources) throws IOException { PDPrintStyle style = new PDPrintStyle(); JSONObject stroke = JSONHelper.optJSONObject(oskariStyle, "stroke", () -> new JSONObject()); JSONObject strokeArea = JSONHelper.optJSONObject(stroke, "area", () -> new JSONObject()); setStrokeStyle(style, strokeArea); <START> JSONObject fill = JSONHelper.optJSONObject(oskariStyle, "fill", () -> new JSONObject()); <END> JSONObject fillArea = JSONHelper.optJSONObject(fill, "area", () -> new JSONObject()); int pattern = fillArea.optInt("pattern"); Color color = ColorUtil.parseColor(JSONHelper.optString(fill,"color")); style.setFillColor(color); if (pattern >= 0 && pattern <= 3 && color != null) { style.setFillPattern(createFillPattern(resources, pattern, color)); } setLabelStyle(style, oskariStyle); return style; }</code><technical_language>skip lines setLabelStyle() if fill is null here? more clear setFillPattern() is called. check if style.setFillColor() null param. optInt() returns 0 for null color null setFillPattern() is called. If lines skipped reading this code in future need check optInt() parseColors() do for nulls figure out is set for style here</technical_language>

Target:
public static PDPrintStyle getPolygonStyle (JSONObject oskariStyle, PDResources resources) throws IOException { JSONObject stroke = oskariStyle.optJSONObject("stroke"); if (stroke != null) { stroke = stroke.optJSONObject("area"); } PDPrintStyle style = new PDPrintStyle(); setStrokeStyle(style, stroke); setFillStyle(style, oskariStyle, resources); setLabelStyle(style, oskariStyle); return style; }
Source:
<code>private void onDeleteSnapshot() { if (getConfirmWindow() == null) { return; } ConfirmationModel model = (ConfirmationModel) getConfirmWindow(); if <START> (model.getProgress() != null) { <END> return; } List<VdcActionParametersBase> paramsList = new ArrayList<>(); for (GlusterVolumeSnapshotEntity snapshot : (List<GlusterVolumeSnapshotEntity>) getSelectedItems()) { GlusterVolumeSnapshotActionParameters param = new GlusterVolumeSnapshotActionParameters(getEntity().getId(), snapshot.getSnapshotName(), true); paramsList.add(param); } model.startProgress(null); Frontend.getInstance().runMultipleAction(VdcActionType.DeleteGlusterVolumeSnapshot, paramsList, new IFrontendMultipleActionAsyncCallback() { @Override public void executed(FrontendMultipleActionAsyncResult result) { ConfirmationModel localModel = (ConfirmationModel) getConfirmWindow(); localModel.stopProgress(); setConfirmWindow(null); } }, model); }</code><technical_language>Is this required? this true</technical_language>

Target:
private void onDeleteSnapshot() { if (getConfirmWindow() == null) { return; } ConfirmationModel model = (ConfirmationModel) getConfirmWindow(); List<VdcActionParametersBase> paramsList = new ArrayList<>(); for (GlusterVolumeSnapshotEntity snapshot : (List<GlusterVolumeSnapshotEntity>) getSelectedItems()) { GlusterVolumeSnapshotActionParameters param = new GlusterVolumeSnapshotActionParameters(getEntity().getId(), snapshot.getSnapshotName(), true); paramsList.add(param); } model.startProgress(null); Frontend.getInstance().runMultipleAction(VdcActionType.DeleteGlusterVolumeSnapshot, paramsList, new IFrontendMultipleActionAsyncCallback() { @Override public void executed(FrontendMultipleActionAsyncResult result) { ConfirmationModel localModel = (ConfirmationModel) getConfirmWindow(); localModel.stopProgress(); setConfirmWindow(null); } }, model); }
Source:
<code>public TableSaw(Category category, SlimefunItemStack item) { super(category, item, new ItemStack[] { null, null, null, new ItemStack(Material.SMOOTH_STONE_SLAB), new ItemStack(Material.STONECUTTER), new ItemStack(Material.SMOOTH_STONE_SLAB), null, new ItemStack(Material.IRON_BLOCK), null }, BlockFace.SELF); for (Material log : Tag.LOGS.getValues()) { Optional<Material> planks = MaterialConverter.getPlanksFromLog(log); if (planks.isPresent()) { displayedRecipes.add(new ItemStack(log)); displayedRecipes.add(new ItemStack(planks.get(), 8)); } } <START> CustomItem ci = new CustomItem(Material.OAK_PLANKS, "Any Wooden Plank"); displayedRecipes.add(new ItemStack(ci)); displayedRecipes.add(new ItemStack(Material.STICK, 4)); <END> }</code><technical_language>adding planks instead of this weird placeholder</technical_language>

Target:
public TableSaw(Category category, SlimefunItemStack item) { super(category, item, new ItemStack[] { null, null, null, new ItemStack(Material.SMOOTH_STONE_SLAB), new ItemStack(Material.STONECUTTER), new ItemStack(Material.SMOOTH_STONE_SLAB), null, new ItemStack(Material.IRON_BLOCK), null }, BlockFace.SELF); for (Material log : Tag.LOGS.getValues()) { Optional<Material> planks = MaterialConverter.getPlanksFromLog(log); if (planks.isPresent()) { displayedRecipes.add(new ItemStack(log)); displayedRecipes.add(new ItemStack(planks.get(), 8)); } } for (Material plank : Tag.PLANKS.getValues()) { displayedRecipes.add(new ItemStack(plank)); displayedRecipes.add(new ItemStack(Material.STICK, 4)); } }
Source:
<code>public void operateList() { final Key key = new Key(args.namespace, args.set, "aoplkey1"); Mono<KeyRecord> mono = reactorClient.delete(key) .switchIfEmpty(Mono.just(key)) .flatMap(key1 -> { List<Value> itemList = new ArrayList<Value>(); itemList.add(Value.get(55)); itemList.add(Value.get(77)); return reactorClient.operate(key, ListOperation.appendItems(binName, itemList), ListOperation.pop(binName, -1), ListOperation.size(binName)); }); StepVerifier.create(mono) .expectNextMatches(keyRecord -> { assertRecordFound(keyRecord.key, keyRecord.record); List<?> list = keyRecord.record.getList(binName); long size = (Long)list.get(0); <START> assertEquals(2, size); <END> long val = (Long)list.get(1); assertEquals(77, val); size = (Long)list.get(2); assertEquals(1, size); return true; }) .verifyComplete(); }</code><technical_language>consider assertj assertThat(list.get(0)).isEqualTo(2)</technical_language>

Target:
public void operateList() { final Key key = new Key(args.namespace, args.set, "aoplkey1"); Mono<KeyRecord> mono = reactorClient.delete(key) .switchIfEmpty(Mono.just(key)) .flatMap(key1 -> { List<Value> itemList = new ArrayList<Value>(); itemList.add(Value.get(55)); itemList.add(Value.get(77)); return reactorClient.operate(key, ListOperation.appendItems(binName, itemList), ListOperation.pop(binName, -1), ListOperation.size(binName)); }); StepVerifier.create(mono) .expectNextMatches(keyRecord -> { assertRecordFound(keyRecord.key, keyRecord.record); List<?> list = keyRecord.record.getList(binName); assertThat((Long)list.get(0)).isEqualTo(2); assertThat((Long)list.get(1)).isEqualTo(77); assertThat((Long)list.get(2)).isEqualTo(1); return true; }) .verifyComplete(); }
Source:
<code><START> public List<String> getRepoTags() { <END> return repoTags; }</code><technical_language>please avoid breaking changes public APIs</technical_language>

Target:
public String[] getRepoTags() { return repoTags; }
Source:
<code>public ScalarFunctionImplementation specialize(BoundVariables boundVariables, int arity, TypeManager typeManager, FunctionRegistry functionRegistry) { <START> List<ScalarImplementationChoice> implementationChoices = new ArrayList<>(); <END> for (PolymorphicScalarFunctionChoice choice : choices) { implementationChoices.add(getScalarFunctionImplementationChoice(boundVariables, typeManager, functionRegistry, choice)); } return new ScalarFunctionImplementation(implementationChoices, deterministic); }</code><technical_language>ImmutableList.builder()</technical_language>

Target:
public ScalarFunctionImplementation specialize(BoundVariables boundVariables, int arity, TypeManager typeManager, FunctionRegistry functionRegistry) { ImmutableList.Builder<ScalarImplementationChoice> implementationChoices = ImmutableList.builder(); for (PolymorphicScalarFunctionChoice choice : choices) { implementationChoices.add(getScalarFunctionImplementationChoice(boundVariables, typeManager, functionRegistry, choice)); } return new ScalarFunctionImplementation(implementationChoices.build(), deterministic); }
Source:
<code>private String networkVisualization(String networkId, ModelMap model) throws QuadrigaStorageException{ INetwork network = networkManager.getNetwork(networkId); if(network==null){ return "auth/404"; <START> } <END> ITransformedNetwork transformedNetwork= transformationManager.getTransformedNetwork(networkId); String nwId = "\""+networkId+"\""; model.addAttribute("networkid",nwId); model.addAttribute("network", network); String json = null; if(transformedNetwork!=null){ json = d3Creator.getD3JSON(transformedNetwork.getNodes(), transformedNetwork.getLinks()); } model.addAttribute("jsonstring",json); return "auth/networks/visualize"; }</code><technical_language>this done top of visualizeNetworks (where before). If is network, rest of code executed</technical_language>

Target:
private String networkVisualization(String networkId, ModelMap model) throws QuadrigaStorageException { INetwork network = networkManager.getNetwork(networkId); if (network == null) { return "auth/404"; } ITransformedNetwork transformedNetwork = transformationManager.getTransformedNetwork(networkId); model.addAttribute("networkid", networkId); model.addAttribute("network", network); String json = null; if (transformedNetwork != null) { json = d3Creator.getD3JSON(transformedNetwork.getNodes(), transformedNetwork.getLinks()); } model.addAttribute("jsonstring", json); return "auth/networks/visualize"; }
Source:
<code>public void onSchemaAddQueryEntity(SchemaAddQueryEntityOperation op) { <START> CacheConfiguration oldCfg = cacheCfg; <END> if (oldCfg != null) { CacheConfiguration newCfg = new CacheConfiguration(oldCfg); newCfg.setQueryEntities(Collections.singletonList(op.entity())); newCfg.setSqlSchema(op.schemaName()); newCfg.setSqlEscapeAll(op.isSqlEscape()); newCfg.setQueryParallelism(op.queryParallelism()); cacheCfg = newCfg; } if (qryMgr != null) qryMgr.enable(); }</code><technical_language>CacheConfiguration<?, ?> oldCfg = cacheCfg; if (oldCfg != null) { CacheConfiguration<?, ?> newCfg = new CacheConfiguration<>(oldCfg); remove compiler warnings</technical_language>

Target:
public void onSchemaAddQueryEntity(SchemaAddQueryEntityOperation op) { onSchemaAddQueryEntity(op.entities(), op.schemaName(), op.isSqlEscape(), op.queryParallelism()); }
Source:
<code>public ApiPersistentConnection getApiPersistentConnection(String name) { <START> for (ApiPersistentConnection other : this.apiPersistentConnections) { <END> if (other.getName().equals(name)) { return other; } } return null; }</code><technical_language>var name changed</technical_language>

Target:
public ApiPersistentConnection getApiPersistentConnection(String name) { for (ApiPersistentConnection pconn : this.apiPersistentConnections) { if (pconn.getName().equals(name)) { return pconn; } } return null; }
Source:
<code>public void LightboxTest_010_filepage_video() { WikiBasePageObject base = new WikiBasePageObject(driver); SpecialVideosPageObject specialVideos = base.openSpecialVideoPage(wikiURL); int itemNumber = 0; String fileUrl = specialVideos.getFileUrl(wikiURL, itemNumber); LightboxComponentObject lightbox = specialVideos.openLightboxForGridVideo(itemNumber); lightbox.verifyLightboxPopup(); lightbox.verifyLightboxVideo(); lightbox.verifyTitleUrl(fileUrl); <START> lightbox.verifyMoreInfoUrl(fileUrl); <END> FilePagePageObject filePage = lightbox.clickTitle(); filePage.verifyTabsExistVideo(); filePage.verifyEmbeddedVideoIsPresent(); filePage.verifyVideoAutoplay(true); }</code><technical_language>need line, verifyTitleUrl is checking that. point1</technical_language>

Target:
public void LightboxTest_010_filepage_video() { WikiBasePageObject base = new WikiBasePageObject(driver); base.logInCookie(credentials.userNameStaff, credentials.passwordStaff, wikiURL); SpecialVideosPageObject specialVideos = base.openSpecialVideoPage(wikiURL); int itemNumber = 0; String fileUrl = specialVideos.getFileUrl(wikiURL, itemNumber); LightboxComponentObject lightbox = specialVideos.openLightboxForGridVideo(itemNumber); lightbox.verifyLightboxPopup(); lightbox.verifyLightboxVideo(); FilePagePageObject filePage = lightbox.clickTitle(); filePage.verifyTabsExistVideo(); filePage.verifyEmbeddedVideoIsPresent(); filePage.verifyVideoAutoplay(true); }
Source:
<code>public URL getComplexQueryURL(ComplexSearchQuery complexSearchQuery) { try { URIBuilder uriBuilder = new URIBuilder("<LINK_0>"); uriBuilder.addParameter("apikey", API_KEY); complexSearchQuery.getDefaultField().ifPresent(defaultField -> uriBuilder.addParameter("querytext", defaultField)); complexSearchQuery.getAuthor().ifPresent(author -> uriBuilder.addParameter("author", author)); complexSearchQuery.getTitle().ifPresent(articleTitle -> uriBuilder.addParameter("article_title", articleTitle)); complexSearchQuery.getJournal().ifPresent(journalTitle -> uriBuilder.addParameter("publication_title", journalTitle)); complexSearchQuery.getFromYear().map(String::valueOf).ifPresent(year -> uriBuilder.addParameter("start_year", year)); complexSearchQuery.getToYear().map(String::valueOf).ifPresent(year -> uriBuilder.addParameter("end_year", year)); URLDownload.bypassSSLVerification(); return uriBuilder.build().toURL(); } catch (URISyntaxException | MalformedURLException ex) { LOGGER.error("Error creating URL.", ex); <START> throw new IllegalStateException("Error during creation of URL.", ex); <END> } }</code><technical_language>please a other getUrl*** methods handle exception handling. I allowed simply throw performSearch method converts a FetcherException</technical_language>

Target:
public URL getComplexQueryURL(ComplexSearchQuery complexSearchQuery) throws URISyntaxException, MalformedURLException { URIBuilder uriBuilder = new URIBuilder("<LINK_0>"); uriBuilder.addParameter("apikey", API_KEY); complexSearchQuery.getDefaultField().ifPresent(defaultField -> uriBuilder.addParameter("querytext", defaultField)); complexSearchQuery.getAuthors().ifPresent(authors -> uriBuilder.addParameter("author", String.join(" AND ", authors))); complexSearchQuery.getTitlePhrases().ifPresent(articleTitlePhrases -> uriBuilder.addParameter("article_title", String.join(" AND ", articleTitlePhrases))); complexSearchQuery.getJournal().ifPresent(journalTitle -> uriBuilder.addParameter("publication_title", journalTitle)); complexSearchQuery.getFromYear().map(String::valueOf).ifPresent(year -> uriBuilder.addParameter("start_year", year)); complexSearchQuery.getToYear().map(String::valueOf).ifPresent(year -> uriBuilder.addParameter("end_year", year)); complexSearchQuery.getSingleYear().map(String::valueOf).ifPresent(year -> { uriBuilder.addParameter("start_year", year); uriBuilder.addParameter("end_year", year); }); URLDownload.bypassSSLVerification(); return uriBuilder.build().toURL(); }
Source:
<code>private RebaseResult cherryPickCommit(RevCommit commitToPick) throws IOException, GitAPIException, NoMessageException, UnmergedPathsException, ConcurrentRefUpdateException, WrongRepositoryStateException, NoHeadException { try { monitor.beginTask(MessageFormat.format( JGitText.get().applyingCommit, commitToPick.getShortMessage()), ProgressMonitor.UNKNOWN); if (preserveMerges) <START> return cherryPickCommitPreservingMerges(commitToPick); <END> newHead = tryFastForward(commitToPick); lastStepWasForward = newHead != null; if (!lastStepWasForward) { String ourCommitName = getOurCommitName(); CherryPickResult cherryPickResult = new Git(repo).cherryPick() .include(commitToPick).setOurCommitName(ourCommitName) .setReflogPrefix(REFLOG_PREFIX).setStrategy(strategy) .call(); switch (cherryPickResult.getStatus()) { case FAILED: if (operation == Operation.BEGIN) return abort(RebaseResult.failed(cherryPickResult .getFailingPaths())); else return stop(commitToPick, Status.STOPPED); case CONFLICTING: return stop(commitToPick, Status.STOPPED); case OK: newHead = cherryPickResult.getNewHead(); } } return null; } finally { monitor.endTask(); } }</code><technical_language>nit-pick: empty line nice break out "else" a method</technical_language>

Target:
private RebaseResult cherryPickCommit(RevCommit commitToPick) throws IOException, GitAPIException, NoMessageException, UnmergedPathsException, ConcurrentRefUpdateException, WrongRepositoryStateException, NoHeadException { try { monitor.beginTask(MessageFormat.format( JGitText.get().applyingCommit, commitToPick.getShortMessage()), ProgressMonitor.UNKNOWN); if (preserveMerges) return cherryPickCommitPreservingMerges(commitToPick); else return cherryPickCommitFlattening(commitToPick); } finally { monitor.endTask(); } }
Source:
<code>public void testRecordsException() throws Exception { TestException testException = new TestException(); TestRequestDispatcher requestProcessor = new TestRequestDispatcher() { @Override public void dispatch(ChannelStateWriteRequest request) { throw testException; } }; LinkedBlockingDeque<ChannelStateWriteRequest> deque = new LinkedBlockingDeque<>(Arrays.asList(new TestWriteRequest())); <START> try (ChannelStateWriteRequestExecutorImpl worker = new ChannelStateWriteRequestExecutorImpl(requestProcessor, deque)) { <END> worker.start(); } }</code><technical_language>I clear is this test motivation for. dispatcher throws exception, terminate internal thread ChannelStateWriteRequestExecutorImpl. worker#close, throw exception actually, i verify exception is testException</technical_language>

Target:
public void testRecordsException() throws IOException { TestException testException = new TestException(); TestRequestDispatcher throwingRequestProcessor = new TestRequestDispatcher() { @Override public void dispatch(ChannelStateWriteRequest request) { throw testException; } }; LinkedBlockingDeque<ChannelStateWriteRequest> deque = new LinkedBlockingDeque<>(Arrays.asList(new TestWriteRequest())); ChannelStateWriteRequestExecutorImpl worker = new ChannelStateWriteRequestExecutorImpl(throwingRequestProcessor, deque); worker.run(); try { worker.close(); } catch (IOException e) { if (findThrowable(e, TestException.class).filter(found -> found == testException).isPresent()) { return; } else { throw e; } } fail("exception not thrown"); }
Source:
<code>public void shutdown(){ buffer.clear(); if (thread != null) thread.interrupt(); try { if (thread != null) thread.join(); <START> } catch (InterruptedException e) { <END> } buffer.clear(); }</code><technical_language>This happen, silently swallowing exception if does</technical_language>

Target:
public void shutdown(){ buffer.clear(); if (thread != null) thread.interrupt(); try { if (thread != null) thread.join(); } catch (InterruptedException e) { throw new RuntimeException(e); } buffer.clear(); }
Source:
<code>public LocationHandle forTemporaryTable(SemiTransactionalHiveMetastore metastore, ConnectorSession session, Table table) { String schemaName = table.getDatabaseName(); String tableName = table.getTableName(); HdfsContext context = new HdfsContext(session, schemaName, tableName); Path targetPath = getTableDefaultLocation(context, metastore, hdfsEnvironment, schemaName, tableName); if (pathExists(context, hdfsEnvironment, targetPath)) { <START> deleteDirectory(context, hdfsEnvironment, targetPath); <END> } return new LocationHandle(targetPath, targetPath, TEMPORARY, DIRECT_TO_TARGET_NEW_DIRECTORY); }</code><technical_language>offline discussion, delete dangerous some worker (after failure) try write directory. fail for :) . In case, want revert change testCreateBucketedTemporaryTable write :)</technical_language>

Target:
public LocationHandle forTemporaryTable(SemiTransactionalHiveMetastore metastore, ConnectorSession session, Table table) { String schemaName = table.getDatabaseName(); String tableName = table.getTableName(); HdfsContext context = new HdfsContext(session, schemaName, tableName); Path targetPath = new Path(getTableDefaultLocation(context, metastore, hdfsEnvironment, schemaName, tableName), randomUUID().toString().replaceAll("-", "_")); return new LocationHandle(targetPath, targetPath, TEMPORARY, DIRECT_TO_TARGET_NEW_DIRECTORY); }