auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public List<MostRecentChecksum> findByResultTypeInDateRange(Context context, Date startDate, Date endDate, ChecksumResultCode resultCode) throws SQLException { CriteriaBuilder criteriaBuilder = getCriteriaBuilder(context); CriteriaQuery<MostRecentChecksum> criteriaQuery = getCriteriaQuery(criteriaBuilder, MostRecentChecksum.class); Root<MostRecentChecksum> mostRecentChecksumRoot = criteriaQuery.from(MostRecentChecksum.class); criteriaQuery.select(mostRecentChecksumRoot); criteriaQuery.where(criteriaBuilder.and( criteriaBuilder.equal(mostRecentChecksumRoot.get("checksumResult.resultCode"), resultCode), criteriaBuilder.lessThanOrEqualTo(mostRecentChecksumRoot.get("processStartDate"), startDate), criteriaBuilder.greaterThan(mostRecentChecksumRoot.get("processStartDate"), endDate) ) ); List<Order> orderList = new LinkedList<>(); orderList.add(criteriaBuilder.asc(mostRecentChecksumRoot.get(MostRecentChecksum_.bitstream))); criteriaQuery.orderBy(orderList); return list(context, criteriaQuery, false, MostRecentChecksum.class, -1, -1); }

Target:
public List<MostRecentChecksum> findByResultTypeInDateRange(Context context, Date startDate, Date endDate, ChecksumResultCode resultCode) throws SQLException { CriteriaBuilder criteriaBuilder = getCriteriaBuilder(context); CriteriaQuery<MostRecentChecksum> criteriaQuery = getCriteriaQuery(criteriaBuilder, MostRecentChecksum.class); Root<MostRecentChecksum> mostRecentChecksumRoot = criteriaQuery.from(MostRecentChecksum.class); Join<MostRecentChecksum, ChecksumResult> mostRecentResult = mostRecentChecksumRoot.join(MostRecentChecksum_.checksumResult); criteriaQuery.select(mostRecentChecksumRoot); criteriaQuery.where(criteriaBuilder.and( criteriaBuilder.equal(mostRecentResult.get(ChecksumResult_.resultCode), resultCode), criteriaBuilder.lessThanOrEqualTo( mostRecentChecksumRoot.get(MostRecentChecksum_.processStartDate), startDate), criteriaBuilder.greaterThan(mostRecentChecksumRoot.get(MostRecentChecksum_.processStartDate), endDate) ) ); List<Order> orderList = new LinkedList<>(); orderList.add(criteriaBuilder.asc(mostRecentChecksumRoot.get(MostRecentChecksum_.bitstream))); criteriaQuery.orderBy(orderList); return list(context, criteriaQuery, false, MostRecentChecksum.class, -1, -1); }
Source:
public void TestParserInvalidBidPriceInput() { String input = "1234,98233,adxyz,3.3,2015-03-08 03:37:12,11/12/2012,12,y,,CAMP_AD,Y,yes"; parser.in.process(input.getBytes()); parser.teardown(); Assert.assertEquals(0, objectPort.collectedTuples.size()); Assert.assertEquals(0, pojoPort.collectedTuples.size()); Assert.assertEquals(1, error.collectedTuples.size()); }

Target:
public void TestParserInvalidBidPriceInput() { String input = "1234,98233,adxyz,3.3,2015-03-08 03:37:12,11/12/2012,12,y,,CAMP_AD,Y,yes"; parser.beginWindow(0); parser.in.process(input.getBytes()); parser.endWindow(); Assert.assertEquals(0, objectPort.collectedTuples.size()); Assert.assertEquals(0, pojoPort.collectedTuples.size()); Assert.assertEquals(1, error.collectedTuples.size()); }
Source:
public boolean canGenerateReport() { if ("pom".equals(project.getPackaging())) { getLog().info("Skipping JaCoCo for project with packaging type 'pom'"); return false; }else if ("ear".equals(project.getPackaging())){ getLog().info("Skipping JaCoCo for project with packaging type 'ear'"); return false; } if (skip) { getLog().info("Skipping JaCoCo execution"); return false; } if (!getDataFile().exists()) { getLog().info("Skipping JaCoCo execution due to missing execution data file"); return false; } return true; }

Target:
public boolean canGenerateReport() { if (SKIPPED_PACKAGINGS.contains(project.getPackaging())) { getLog().info(String.format("Skipping JaCoCo for project with packaging type '%s'", project.getPackaging())); return false; } if (skip) { getLog().info("Skipping JaCoCo execution"); return false; } if (!getDataFile().exists()) { getLog().info("Skipping JaCoCo execution due to missing execution data file"); return false; } return true; }
Source:
public void serialize(ByteBuffer bb) { bb.put(data, 0, getLength()); }

Target:
public int serialize(ByteBuffer bb) { int length = getLength(); bb.put(data, 0, length); return length; }
Source:
private void initUnregisteredVM() { OvfHelper ovfHelper = new OvfHelper(); ovfEntityData = getUnregisteredOVFDataDao().getByEntityIdAndStorageDomain(getParameters().getContainerId(), getParameters().getStorageDomainId()); if (ovfEntityData != null) { try { vmFromConfiguration = ovfHelper.readVmFromOvf(ovfEntityData.getOvfData()); vmFromConfiguration.setVdsGroupId(getParameters().getVdsGroupId()); getParameters().setVm(vmFromConfiguration); getParameters().setDestDomainId(ovfEntityData.getStorageDomainId()); getParameters().setSourceDomainId(ovfEntityData.getStorageDomainId()); if (getParameters().getDiskMap() != null) { vmFromConfiguration.setDiskMap(getParameters().getDiskMap()); vmFromConfiguration.setImages(getDiskImageListFromDiskMap(getParameters().getDiskMap())); } } catch (OvfReaderException e) { log.error("Failed to parse a given ovf configuration:\n{}", ovfEntityData.getOvfData()); log.error("Exception", e); } } }

Target:
private void initUnregisteredVM() { OvfHelper ovfHelper = new OvfHelper(); ovfEntityData = getUnregisteredOVFDataDao().getByEntityIdAndStorageDomain(getParameters().getContainerId(), getParameters().getStorageDomainId()); if (ovfEntityData != null) { try { vmFromConfiguration = ovfHelper.readVmFromOvf(ovfEntityData.getOvfData()); vmFromConfiguration.setVdsGroupId(getParameters().getVdsGroupId()); getParameters().setVm(vmFromConfiguration); getParameters().setDestDomainId(ovfEntityData.getStorageDomainId()); getParameters().setSourceDomainId(ovfEntityData.getStorageDomainId()); if (getParameters().getDiskMap() != null) { vmFromConfiguration.setDiskMap(getParameters().getDiskMap()); vmFromConfiguration.setImages(getDiskImageListFromDiskMap(getParameters().getDiskMap())); } } catch (OvfReaderException e) { log.error("Failed to parse a given ovf configuration: '{}':\n{}", ovfEntityData.getOvfData(), e.getMessage()); log.debug("Exception", e); } } }
Source:
private static DbConnectionProperties createFrom(Map<String, String> map) { DbConnectionProperties props = new DbConnectionProperties(); for (Map.Entry<String, String> entry: map.entrySet()) { String key = entry.getKey(); String val = entry.getValue(); switch (key) { case "username": props.Username = val; break; case "password": props.Password = val; break; case "service": props.Service = val; break; case "database": props.DbName = val; break; case "connection-string": props.FullConnectionString = val; break; case "admin-username": case "admin-password": case "admin-database": break; default: throw new UnsupportedOperationException( "Unsupported key in properties file:" + key); } } if (props.FullConnectionString != null) { return props; } if (props.Service != null && props.Username != null && props.Password != null) { return props; } throw new Error( "You have to define either the full connection string; or service, username and password in the properties file"); }

Target:
private static DbConnectionProperties createFrom(Map<String, String> map) { DbConnectionProperties props = new DbConnectionProperties(); for (Map.Entry<String, String> entry: map.entrySet()) { String key = entry.getKey(); String val = entry.getValue(); if ("username".equals(key)) { props.Username = val; } else if ("password".equals(key)) { props.Password = val; } else if ("service".equals(key)) { props.Service = val; } else if ("database".equals(key)) { props.DbName = val; } else if ("connection-string".equals(key)) { props.FullConnectionString = val; } else { throw new UnsupportedOperationException( "Unsupported key in properties file:" + key); } } if (props.FullConnectionString != null) { return props; } if (props.Service != null && props.Username != null && props.Password != null) { return props; } throw new Error( "You have to define either the full connection string; or service, username and password in the properties file"); }
Source:
public List<MedalDepency> getMedalDepencies() { return medalDepencies; }

Target:
public List<MedalDependency> getMedalDepencies() { return medalDepencies; }
Source:
private String getWebappFilePath() throws IOException { String webappFilePath = null; if (getContext() instanceof Context) { Context ctx = getContext(); String docBase = ctx.getDocBase(); Host host = (Host) ctx.getParent(); String appBase = host.getAppBase(); File canonicalAppBase = new File(appBase); if (canonicalAppBase.isAbsolute()) { canonicalAppBase = canonicalAppBase.getCanonicalFile(); } else { canonicalAppBase = new File(System.getProperty("carbon.home"), appBase) .getCanonicalFile(); } File webappFile = new File(docBase); if (webappFile.isAbsolute()) { webappFilePath = webappFile.getCanonicalPath(); } else { webappFilePath = (new File(canonicalAppBase, docBase)).getPath(); } } return webappFilePath; }

Target:
private String getWebappFilePath() throws IOException { String webappFilePath = null; Context ctx = getContext(); String docBase = ctx.getDocBase(); Host host = (Host) ctx.getParent(); String appBase = host.getAppBase(); File canonicalAppBase = new File(appBase); if (canonicalAppBase.isAbsolute()) { canonicalAppBase = canonicalAppBase.getCanonicalFile(); } else { canonicalAppBase = new File(System.getProperty("carbon.home"), appBase) .getCanonicalFile(); } File webappFile = new File(docBase); if (webappFile.isAbsolute()) { webappFilePath = webappFile.getCanonicalPath(); } else { webappFilePath = (new File(canonicalAppBase, docBase)).getPath(); } return webappFilePath; }
Source:
public void setUp() { vm = new VM(); vm.setCpuPerSocket(2); vm.setNumOfSockets(2); vdsWithoutCores = new VDS(); vdsWithoutCores.setId(Guid.newGuid()); vdsWithoutCores.setCpuCores(0); vdsWithoutCores.setCpuThreads(0); vdsWithCores = new VDS(); vdsWithCores.setId(Guid.newGuid()); vdsWithCores.setCpuCores(2); vdsWithCores.setCpuThreads(4); cluster = new VDSGroup(); cluster.setId(Guid.newGuid()); when(vdsGroupDao.get(any(Guid.class))).thenReturn(cluster); }

Target:
public void setUp() { vm = new VM(); vm.setCpuPerSocket(2); vm.setNumOfSockets(2); vdsWithInvalidCpuInfo = new VDS(); vdsWithInvalidCpuInfo.setId(Guid.newGuid()); vdsWithInvalidCpuInfo.setCpuCores(0); vdsWithInvalidCpuInfo.setCpuThreads(0); vdsWithCores = new VDS(); vdsWithCores.setId(Guid.newGuid()); vdsWithCores.setCpuCores(2); vdsWithCores.setCpuThreads(4); cluster = new VDSGroup(); cluster.setId(Guid.newGuid()); when(vdsGroupDao.get(any(Guid.class))).thenReturn(cluster); }
Source:
public void setProgressMessage(String progressMessage) { this.progressMessage = progressMessage; }

Target:
public final void setProgressMessage(String progressMessage) { this.progressMessage = progressMessage; }
Source:
public static <C extends SCMCategory<?>> String toShortUrl(List<C> categories) { if (categories.size() == 1) { return categories.get(0).getName().toLowerCase(Locale.ENGLISH); } Set<String> urlNames = new TreeSet<String>(); for (SCMCategory category : categories) { urlNames.add(category.getName()); } return StringUtils.join(urlNames, "_").toLowerCase(Locale.ENGLISH); }

Target:
public static <C extends SCMCategory<?>> String toShortUrl(List<C> categories) { if (categories.isEmpty()) { throw new IllegalArgumentException("Must supply at least one category"); } if (categories.size() == 1) { return categories.get(0).getName().toLowerCase(Locale.ENGLISH); } Set<String> urlNames = new TreeSet<String>(); for (SCMCategory category : categories) { urlNames.add(category.getName().toLowerCase(Locale.ENGLISH)); } return StringUtils.join(urlNames, "_"); }
Source:
public AuthenticationException(ADALError code, String details, HttpWebResponse response) { super(details); mCode = code; if (null == response) { return; } mServiceStatusCode = response.getStatusCode(); if (null != response.getResponseHeaders()) { mHttpResponseHeaders = response.getResponseHeaders(); } if (null != response.getBody()) { final String responseBodyStr = response.getBody(); try { mResponseBody = new HashMap<>(); final JSONObject jsonObject = new JSONObject(responseBodyStr); final Iterator<?> i = jsonObject.keys(); while (i.hasNext()) { final String key = (String) i.next(); mResponseBody.put(key, jsonObject.getString(key)); } } catch (final JSONException exc) { return; } } }

Target:
public AuthenticationException(ADALError code, String details, HttpWebResponse response) { super(details); mCode = code; setHttpResponse(response); }
Source:
protected void setActionMessageParameters() { addCanDoActionMessage(VdcBllMessages.VAR__ACTION__HOT_PLUG); addCanDoActionMessage(VdcBllMessages.VAR__TYPE__VM_DISK); if (getDisk() != null) { addCanDoActionMessage(String.format("$%1$s %2$s", "diskAliases", getDiskAlias())); } }

Target:
protected void setActionMessageParameters() { addCanDoActionMessage(VdcBllMessages.VAR__ACTION__HOT_PLUG); addCanDoActionMessage(VdcBllMessages.VAR__TYPE__VM_DISK); }
Source:
private void parseBlueToothDevices(AbstractFile regFile, BufferedReader reader) throws FileNotFoundException, IOException { List<BlackboardArtifact> bbartifacts = new ArrayList<>(); String line = reader.readLine(); while (!line.contains(SECTION_DIVIDER)) { line = reader.readLine(); line = line.trim(); if (line.toLowerCase().contains("device unique id")) { while (!line.contains(SECTION_DIVIDER) && !line.isEmpty() && !line.toLowerCase().contains("radio support not found")) { Collection<BlackboardAttribute> attributes = new ArrayList<>(); addBlueToothAttribute(line, attributes, TSK_DEVICE_ID); line = reader.readLine(); if (line.toLowerCase().contains("name")) { addBlueToothAttribute(line, attributes, TSK_NAME); line = reader.readLine(); } addBlueToothAttribute(line, attributes, TSK_DATETIME); line = reader.readLine(); addBlueToothAttribute(line, attributes, TSK_DATETIME_ACCESSED); BlackboardArtifact bba = createArtifactWithAttributes(ARTIFACT_TYPE.TSK_BLUETOOTH_PAIRING, regFile, attributes); if(bba != null) { bbartifacts.add(bba); } line = reader.readLine(); line = reader.readLine(); } line = line.trim(); } } if (!bbartifacts.isEmpty()) { postArtifacts(bbartifacts); } }

Target:
private void parseBlueToothDevices(AbstractFile regFile, BufferedReader reader) throws FileNotFoundException, IOException { List<BlackboardArtifact> bbartifacts = new ArrayList<>(); String line = reader.readLine(); while ((line != null) && (!line.contains(SECTION_DIVIDER))) { line = reader.readLine(); if (line != null) { line = line.trim(); } if ((line != null) && (line.toLowerCase().contains("device unique id"))) { while (line != null && !line.contains(SECTION_DIVIDER) && !line.isEmpty() && !line.toLowerCase().contains("radio support not found")) { Collection<BlackboardAttribute> attributes = new ArrayList<>(); addBlueToothAttribute(line, attributes, TSK_DEVICE_ID); line = reader.readLine(); if ((line != null) && (line.toLowerCase().contains("name"))) { addBlueToothAttribute(line, attributes, TSK_NAME); line = reader.readLine(); } addBlueToothAttribute(line, attributes, TSK_DATETIME); line = reader.readLine(); addBlueToothAttribute(line, attributes, TSK_DATETIME_ACCESSED); BlackboardArtifact bba = createArtifactWithAttributes(ARTIFACT_TYPE.TSK_BLUETOOTH_PAIRING, regFile, attributes); if(bba != null) { bbartifacts.add(bba); } reader.readLine(); line = reader.readLine(); } if (line != null) { line = line.trim(); } } } if (!bbartifacts.isEmpty()) { postArtifacts(bbartifacts); } }
Source:
public void manage(Entity e) { if (isManaged(e)) { log.warn(""+this+" redundant call to start management of entity (and descendants of) "+e+"; skipping", new Exception("source of duplicate management of "+e)); return; } validateDescendantConfig(e); manageRecursive(e, ManagementTransitionMode.guessing(BrooklynObjectManagementMode.NONEXISTENT, BrooklynObjectManagementMode.MANAGED_PRIMARY)); }

Target:
public void manage(Entity e) { if (isManaged(e)) { log.warn(""+this+" redundant call to start management of entity (and descendants of) "+e+"; skipping", new Exception("source of duplicate management of "+e)); return; } manageRecursive(e, ManagementTransitionMode.guessing(BrooklynObjectManagementMode.NONEXISTENT, BrooklynObjectManagementMode.MANAGED_PRIMARY)); }
Source:
public Map<String, String> headers() { if (this.isDestroyed()) { throw new IllegalStateException("object is already destroyed"); } Map<String, String> headers = new HashMap<>(); try { final byte[] key = secretKey.getEncoded(); md5.update(key); headers.put("X-Amz-Server-Side-Encryption-Customer-Algorithm", "AES256"); headers.put("X-Amz-Server-Side-Encryption-Customer-Key", BaseEncoding.base64().encode(key)); headers.put("X-Amz-Server-Side-Encryption-Customer-Key-Md5", BaseEncoding.base64().encode(md5.digest())); } finally { md5.reset(); } }

Target:
public final Map<String, String> headers() { if (this.isDestroyed()) { throw new IllegalStateException("object is already destroyed"); } Map<String, String> headers = new HashMap<>(); try { final byte[] key = secretKey.getEncoded(); md5.update(key); headers.put("X-Amz-Server-Side-Encryption-Customer-Algorithm", "AES256"); headers.put("X-Amz-Server-Side-Encryption-Customer-Key", BaseEncoding.base64().encode(key)); headers.put("X-Amz-Server-Side-Encryption-Customer-Key-Md5", BaseEncoding.base64().encode(md5.digest())); } finally { md5.reset(); } return headers; }
Source:
public void waitTheiaIde() { try { seleniumWebDriverHelper.waitVisibility(theiaIde, PREPARING_WS_TIMEOUT_SEC); } catch (WebDriverException ex) { switchToIdeFrame(); } }

Target:
public void waitTheiaIde() { try { seleniumWebDriverHelper.waitVisibility(theiaIde, PREPARING_WS_TIMEOUT_SEC); } catch (TimeoutException ex) { switchToIdeFrame(); seleniumWebDriverHelper.waitVisibility(theiaIde, PREPARING_WS_TIMEOUT_SEC); } }
Source:
public String decode(byte[] wbxmlBody) { try { int i = 4; if ((wbxmlBody[i] & WBXML_TOKEN_MASK) != WBXML_TAG_EMN) { return null; } if ((wbxmlBody[i] & WBXML_TOKEN_WITH_ATTRS) != WBXML_TOKEN_WITH_ATTRS) { return null; } i++; if ((wbxmlBody[i] & WBXML_TOKEN_MASK) == WBXML_ATTR_TIMESTAMP) { i++; if (wbxmlBody[i] == WBXML_ATTR_OPAQUE_DATA) { i++; i+= wbxmlBody[i] + 1; } } if ((wbxmlBody[i] & WBXML_TOKEN_MASK) == WBXML_ATTR_MAILBOX && (wbxmlBody[i] & WBXML_TOKEN_MASK) == WBXML_ATTR_MAILBOX_AT) { return null; } if (wbxmlBody[i + 1] != WBXML_INLINE_STRING) { return null; } i += 2; int j = i; while (wbxmlBody[j] != WBXML_ATTR_NULL) { j++; } if (i == j) return null; String emailAddress = new String(wbxmlBody, i, j-i); i = j + 1; String extension = ExtensionEncoded(wbxmlBody[i]); if (extension != null) { emailAddress += extension; } return emailAddress; } catch (ArrayIndexOutOfBoundsException e) { if (Email.DEBUG) { Log.d(Email.LOG_TAG, "ArrayIndexOutOfBoundsException while handling " + "CONTENT_MIME_TYPE_B_EMN"); } } catch (Exception e) { if (Email.DEBUG) { Log.d(Email.LOG_TAG, "Exception while handling CONTENT_MIME_TYPE_B_EMN " + e); } } return null; }

Target:
public String decode(byte[] wbxmlBody) { try { int i = 4; if ((wbxmlBody[i] & WBXML_TOKEN_MASK) != WBXML_TAG_EMN) { return null; } if ((wbxmlBody[i] & WBXML_TOKEN_WITH_ATTRS) != WBXML_TOKEN_WITH_ATTRS) { return null; } i++; if ((wbxmlBody[i] & WBXML_TOKEN_MASK) == WBXML_ATTR_TIMESTAMP) { i++; if (wbxmlBody[i] == WBXML_ATTR_OPAQUE_DATA) { i++; i += wbxmlBody[i] + 1; } } if ((wbxmlBody[i] & WBXML_TOKEN_MASK) == WBXML_ATTR_MAILBOX && (wbxmlBody[i] & WBXML_TOKEN_MASK) == WBXML_ATTR_MAILBOX_AT) { return null; } if (wbxmlBody[i + 1] != WBXML_INLINE_STRING) { return null; } i += 2; int j = i; while (wbxmlBody[j] != WBXML_ATTR_NULL) { j++; } if (i == j) return null; String emailAddress = new String(wbxmlBody, i, j-i); i = j + 1; String extension = decodeExtension(wbxmlBody[i]); if (extension != null) { emailAddress += extension; } return emailAddress; } catch (ArrayIndexOutOfBoundsException e) { if (Email.DEBUG) { Log.d(Email.LOG_TAG, "ArrayIndexOutOfBoundsException while handling " + "CONTENT_MIME_TYPE_B_EMN"); } } catch (Exception e) { if (Email.DEBUG) { Log.d(Email.LOG_TAG, "Exception while handling CONTENT_MIME_TYPE_B_EMN " + e); } } return null; }
Source:
public VmCommand(T parameters) { super(parameters); setVmId(parameters.getVmId()); setReason(parameters.getReason()); }

Target:
public VmCommand(T parameters) { super(parameters); setVmId(parameters.getVmId()); }
Source:
public void testCRAMContainerStreamWithCraiIndex() throws IOException { final List<SAMRecord> samRecords = createRecords(100); final SAMFileHeader header = createSAMHeader(SAMFileHeader.SortOrder.coordinate); final ByteArrayOutputStream outStream = new ByteArrayOutputStream(); final ByteArrayOutputStream indexStream = new ByteArrayOutputStream(); doTest(samRecords, outStream, header, new CRAMCRAIIndexer(indexStream, header)); outStream.close(); indexStream.close(); final File cramTempFile = File.createTempFile("cramContainerStreamTest", ".cram"); cramTempFile.deleteOnExit(); final OutputStream cramFileStream = new FileOutputStream(cramTempFile); cramFileStream.write(outStream.toByteArray()); cramFileStream.close(); final File indexTempFile = File.createTempFile("cramContainerStreamTest", ".crai"); indexTempFile.deleteOnExit(); OutputStream indexFileStream = new FileOutputStream(indexTempFile); indexFileStream.write(indexStream.toByteArray()); indexFileStream.close(); final ReferenceSource refSource = createReferenceSource(); final CRAMFileReader reader = new CRAMFileReader( cramTempFile, indexTempFile, refSource, ValidationStringency.SILENT); final CloseableIterator<SAMRecord> iterator = reader.query(new QueryInterval[]{new QueryInterval(1, 10, 10)}, false); int count = 0; while (iterator.hasNext()) { SAMRecord actualRecord = iterator.next(); count++; } Assert.assertEquals(count, 2); }

Target:
public void testCRAMContainerStreamWithCraiIndex() throws IOException { final List<SAMRecord> samRecords = createRecords(100); final SAMFileHeader header = createSAMHeader(SAMFileHeader.SortOrder.coordinate); try (ByteArrayOutputStream outStream = new ByteArrayOutputStream(); ByteArrayOutputStream indexStream = new ByteArrayOutputStream()) { doTestWithIndexer(samRecords, outStream, header, new CRAMCRAIIndexer(indexStream, header)); outStream.flush(); indexStream.flush(); checkCRAMContainerStream(outStream, indexStream, ".crai"); } }
Source:
public Payload next() { Payload payload; payload = nextPayload; nextPayload = getNextPayload(); return payload; }

Target:
public Payload next() { Payload payload; if (!hasNext()) throw new NoSuchElementException(); payload = nextPayload; nextPayload = getNextPayload(); return payload; }
Source:
public DefaultDuoMultifactorAuthenticationProvider duoMultifactorAuthenticationProviders(final DuoSecurityMultifactorProperties duo) { final BasicDuoSecurityAuthenticationService s = new BasicDuoSecurityAuthenticationService(duo, httpClient); final DefaultDuoMultifactorAuthenticationProvider duoP = new DefaultDuoMultifactorAuthenticationProvider(duo.getRegistrationUrl(), s); duoP.setGlobalFailureMode(casProperties.getAuthn().getMfa().getGlobalFailureMode()); duoP.setBypassEvaluator(MultifactorAuthenticationUtils.newMultifactorAuthenticationProviderBypass(duo.getBypass())); duoP.setOrder(duo.getRank()); duoP.setId(duo.getId()); applicationContext.getBeanFactory().registerSingleton(duoP.getId()+"-provider", duoP); return duoP; }

Target:
private DuoMultifactorAuthenticationProvider duoMultifactorAuthenticationProviders(final DuoSecurityMultifactorProperties duo) { final BasicDuoSecurityAuthenticationService s = new BasicDuoSecurityAuthenticationService(duo, httpClient); final DefaultDuoMultifactorAuthenticationProvider duoP = new DefaultDuoMultifactorAuthenticationProvider(duo.getRegistrationUrl(), s); duoP.setGlobalFailureMode(casProperties.getAuthn().getMfa().getGlobalFailureMode()); duoP.setBypassEvaluator(MultifactorAuthenticationUtils.newMultifactorAuthenticationProviderBypass(duo.getBypass())); duoP.setOrder(duo.getRank()); duoP.setId(duo.getId()); applicationContext.getBeanFactory().registerSingleton(duoP.getId()+"-provider", duoP); return duoP; }
Source:
public static Configuration createConfiguration(UnderFileSystemConfiguration conf, Boolean isSecure) { Configuration wasbConf = HdfsUnderFileSystem.createConfiguration(conf); for (Map.Entry<String, String> entry : conf.toMap().entrySet()) { String key = entry.getKey(); String value = entry.getValue(); if (PropertyKey.Template.UNDERFS_AZURE_ACCOUNT_KEY.matches(key)) { wasbConf.set(key, value); } } if (isSecure) { wasbConf.set("fs.AbstractFileSystem.wasb.impl", "org.apache.hadoop.fs.azure.Wasbs"); wasbConf.set("fs.wasbs.impl", "org.apache.hadoop.fs.azure.NativeAzureFileSystem"); } else { wasbConf.set("fs.AbstractFileSystem.wasb.impl", "org.apache.hadoop.fs.azure.Wasb"); wasbConf.set("fs.wasb.impl", "org.apache.hadoop.fs.azure.NativeAzureFileSystem"); } return wasbConf; }

Target:
public static Configuration createConfiguration(UnderFileSystemConfiguration conf, Boolean isSecure) { Configuration wasbConf = HdfsUnderFileSystem.createConfiguration(conf); for (Map.Entry<String, String> entry : conf.toMap().entrySet()) { String key = entry.getKey(); String value = entry.getValue(); if (PropertyKey.Template.UNDERFS_AZURE_ACCOUNT_KEY.matches(key)) { wasbConf.set(key, value); } } if (isSecure) { wasbConf.set("fs.AbstractFileSystem.wasbs.impl", "org.apache.hadoop.fs.azure.Wasbs"); wasbConf.set("fs.wasbs.impl", "org.apache.hadoop.fs.azure.NativeAzureFileSystem"); } else { wasbConf.set("fs.AbstractFileSystem.wasb.impl", "org.apache.hadoop.fs.azure.Wasb"); wasbConf.set("fs.wasb.impl", "org.apache.hadoop.fs.azure.NativeAzureFileSystem"); } return wasbConf; }
Source:
public void assertHasParameter(AssertionInfo info, URI actual, String name, String value) { assertNotNull(info, actual); Map<String, List<String>> parameters = getParameters(actual.getQuery()); if (!parameters.containsKey(name)) { throw failures.failure(info, shouldHaveParameter(actual, name, value)); } List<String> values = parameters.get(name); if (!values.contains(value)) { throw failures.failure(info, shouldHaveParameter(actual, name, value, values.get(0))); } }

Target:
public void assertHasParameter(AssertionInfo info, URI actual, String name, String value) { assertNotNull(info, actual); Map<String, List<String>> parameters = getParameters(actual.getQuery()); if (!parameters.containsKey(name)) { throw failures.failure(info, shouldHaveParameter(actual, name, value)); } List<String> values = parameters.get(name); if (!values.contains(value)) { if (values.size() == 1) { throw failures.failure(info, shouldHaveParameter(actual, name, value, values.get(0))); } throw failures.failure(info, shouldHaveParameter(actual, name, value, values.toString())); } }
Source:
public void suggestArticleTypeIntoWhyCoolField(String text) { suggestArticleWhyCooliInput.sendKeys(text); PageObjectLogging.log("SuggestArticleTypeIntoWhyCoolField", "Type '"+text+"' into 'Why cool' field on 'Suggest Video Modal'", true, driver); }

Target:
public void suggestArticleTypeIntoWhyCoolField(String text) { suggestArticleWhyCooliInput.sendKeys(text); PageObjectLogging.log( "suggestArticleTypeIntoWhyCoolField", "Type '"+text+"' into 'Why cool' field on 'Suggest Video Modal'", true ); }
Source:
PRED_change_project_1(Term a1, Operation n) { arg1 = a1; cont = n; }

Target:
public PRED_change_project_1(Term a1, Operation n) { arg1 = a1; cont = n; }
Source:
public Response start(Action action) { validateParameters(action); return performServiceAction(action, GlusterServiceActionType.start); }

Target:
public Response start(Action action) { validateParameters(action); return performServiceAction(action, GlusterServiceActionType.START); }
Source:
public void copySelected() { if (!table.selectedRows().isEmpty()) { for (Block block : table.selectedRows()) { EditableBlock added = new EditableBlock(block); added.setName(viewModel.getUniqueName(added.getName())); try { config.addNewBlock(added); } catch (DuplicateBlockNameException e1) { e1.printStackTrace(); } setBlocks(config); setSelectedBlocks(new ArrayList<EditableBlock>(Arrays.asList(added))); table.setSelected(added); } } }

Target:
private void copySelected() { if (!table.selectedRows().isEmpty()) { for (Block block : table.selectedRows()) { EditableBlock added = new EditableBlock(block); added.setName(viewModel.getUniqueName(added.getName())); try { config.addNewBlock(added); } catch (DuplicateBlockNameException e1) { MessageDialog error = new MessageDialog(this.getShell(), "Error", null, "Failed to add block " + added.getName() + ":\nBlock with this name already exists.", MessageDialog.ERROR, new String[] {"OK"}, 0); error.open(); } setBlocks(config); setSelectedBlocks(new ArrayList<EditableBlock>(Arrays.asList(added))); table.setSelected(added); } } }
Source:
public static void closeReaders(List<ParquetFileReader> readers) { readers.forEach(r -> { try { r.close(); } catch (IOException e) { } }); }

Target:
public static void closeReaders(List<ParquetFileReader> readers) { readers.forEach(r -> { try { r.close(); } catch (IOException e) { LOG.error("Error closing reader {}", r.getFile(), e); } }); }
Source:
private List<String> getDataSourceArray() { try { Case currentCase = Case.getOpenCase(); SleuthkitCase tskDb = currentCase.getSleuthkitCase(); getLoadLogicalSources(tskDb); getLoadImageSources(tskDb); } catch (NoCurrentCaseException ex) { logger.log(Level.SEVERE, "Unable to get current open case.", ex); } catch (TskCoreException | SQLException ex) { logger.log(Level.SEVERE, "Failed to get data source info from database.", ex); } List<String> dataSourcesList = new ArrayList<>(dataSourceMap.values()); Collections.sort(dataSourcesList, (String dsName1, String dsName2) -> dsName1.compareTo(dsName2)); List<String> dataSourceDisplayNames = new ArrayList<>(); for (String dataSource : dataSourcesList) { File dataSourceFullName = new File(dataSource); dataSourceDisplayNames.add(dataSourceFullName.getName()); toolTipList.add(dataSourceFullName.getParent()); } return dataSourceDisplayNames; }

Target:
private List<String> getDataSourceArray() { List<String> dsList = new ArrayList<>(); try { Case currentCase = Case.getCurrentCaseThrows(); SleuthkitCase tskDb = currentCase.getSleuthkitCase(); List<DataSource> dataSources = tskDb.getDataSources(); Collections.sort(dataSources, (DataSource ds1, DataSource ds2) -> ds1.getName().compareTo(ds2.getName())); for (DataSource ds : dataSources) { String dsName = ds.getName(); File dataSourceFullName = new File(dsName); String displayName = dataSourceFullName.getName(); dataSourceMap.put(ds.getId(), displayName); toolTipList.add(dsName); dsList.add(displayName); } } catch (NoCurrentCaseException ex) { logger.log(Level.SEVERE, "Unable to get current open case.", ex); } catch (TskCoreException ex) { logger.log(Level.SEVERE, "Failed to get data source info from database.", ex); } return dsList; }
Source:
private static InputStream getDsTriples(final DatastreamVersion dv, final ObjectReference ref, final Map<String, String> createDates) { final ByteArrayOutputStream out = new ByteArrayOutputStream(); final Model triples = ModelFactory.createDefaultModel(); final String uri = "info:fedora/" + dv.getDatastreamInfo().getObjectInfo().getPid() + "/" + dv.getDatastreamInfo().getDatastreamId(); final String dsid = dv.getDatastreamInfo().getDatastreamId(); System.out.println("DS URI: " + uri); if (dv.isFirstVersionIn(ref)) { createDates.put(dv.getDatastreamInfo().getDatastreamId(), dv.getCreated()); } addDateLiteral(triples, uri, "<LINK_1>", createDates.get(dsid)); addDateLiteral(triples, uri, "<LINK_2>", dv.getCreated()); addStringLiteral(triples, uri, "<LINK_6>", dv.getDatastreamInfo().getDatastreamId()); addStringLiteral(triples, uri, "<LINK_3>", dv.getLabel()); addStringLiteral(triples, uri, "<LINK_0>", dv.getDatastreamInfo().getState()); addStringLiteral(triples, uri, "<LINK_5>", dv.getFormatUri()); addStringLiteral(triples, uri, "<LINK_4>", dv.getMimeType()); triples.write(out, "TTL"); return new ByteArrayInputStream(out.toByteArray()); }

Target:
private static InputStream getDsTriples(final DatastreamVersion dv, final ObjectReference ref, final Map<String, String> createDates) { final ByteArrayOutputStream out = new ByteArrayOutputStream(); final Model triples = ModelFactory.createDefaultModel(); final String uri = "info:fedora/" + dv.getDatastreamInfo().getObjectInfo().getPid() + "/" + dv.getDatastreamInfo().getDatastreamId(); final String dsid = dv.getDatastreamInfo().getDatastreamId(); if (dv.isFirstVersionIn(ref)) { createDates.put(dv.getDatastreamInfo().getDatastreamId(), dv.getCreated()); } addDateLiteral(triples, uri, "<LINK_1>", createDates.get(dsid)); addDateLiteral(triples, uri, "<LINK_2>", dv.getCreated()); addStringLiteral(triples, uri, "<LINK_6>", dv.getDatastreamInfo().getDatastreamId()); addStringLiteral(triples, uri, "<LINK_3>", dv.getLabel()); addStringLiteral(triples, uri, "<LINK_0>", dv.getDatastreamInfo().getState()); addStringLiteral(triples, uri, "<LINK_5>", dv.getFormatUri()); addStringLiteral(triples, uri, "<LINK_4>", dv.getMimeType()); triples.write(out, "TTL"); return new ByteArrayInputStream(out.toByteArray()); }
Source:
public void writeObject(ObjectOutput output, Object object) throws IOException { int number = objects.get(object.getClass(), -1); output.writeByte(number); switch (ExternalizerId.values()[number]) { case EQUALITY_PREDICATE: output.writeObject(((EqualityPredicate) object).object); break; } }

Target:
public void writeObject(ObjectOutput output, Object object) throws IOException { ExternalizerId id = objects.get(object.getClass()); if (id == null) { throw new IllegalArgumentException("Unsupported class " + object.getClass() + " was provided!"); } output.writeByte(id.ordinal()); switch (id) { case EQUALITY_PREDICATE: output.writeObject(((EqualityPredicate) object).object); break; } }
Source:
public Iterator<Object[]> queryableData() throws IOException { List<Object[]> tests = new ArrayList<>(); tests.add(new Object[]{new File(TEST_DATA_DIR, "NA12891.fp.vcf"), false}); tests.add(new Object[]{new File(TEST_DATA_DIR, "NA12891.vcf"), false}); tests.add(new Object[]{VcfTestUtils.createTemporaryIndexedVcfFromInput(new File(TEST_DATA_DIR, "NA12891.vcf"), "fingerprintcheckertest.tmp."), true}); tests.add(new Object[]{new File(TEST_DATA_DIR, "NA12891.vcf.gz"), true}); return tests.iterator(); }

Target:
public Iterator<Object[]> queryableData() throws IOException { List<Object[]> tests = new ArrayList<>(); tests.add(new Object[]{new File(TEST_DATA_DIR, "NA12891.fp.vcf"), false}); tests.add(new Object[]{new File(TEST_DATA_DIR, "NA12891.vcf"), false}); tests.add(new Object[]{VcfTestUtils.createTemporaryIndexedVcfFromInput(new File(TEST_DATA_DIR, "NA12891.vcf"), "fingerprintcheckertest.tmp."), true}); tests.add(new Object[]{VcfTestUtils.createTemporaryIndexedVcfFromInput(new File(TEST_DATA_DIR, "NA12891.vcf.gz"), "fingerprintcheckertest.tmp."), true}); tests.add(new Object[]{new File("/dev/null"), false}); tests.add(new Object[]{new File("/dev/stdin"), false}); tests.add(new Object[]{new File("/dev/stdout"), false}); tests.add(new Object[]{new File("."), false}); tests.add(new Object[]{new File(".."), false}); tests.add(new Object[]{new File("/"), false}); tests.add(new Object[]{TEST_DATA_DIR, false}); return tests.iterator(); }
Source:
protected Observable<ClientInterestChannel> reestablish() { final EurekaClientRegistry<InstanceInfo> prevRegistry = currentDelegateChannel().associatedRegistry(); final EurekaClientRegistry<InstanceInfo> newRegistry = new EurekaClientRegistryImpl(metricFactory.getRegistryMetrics()); final ClientInterestChannel newChannel = channelFactory.newInterestChannel(newRegistry); return Observable.create(new Observable.OnSubscribe<ClientInterestChannel>() { @Override public void call(final Subscriber<? super ClientInterestChannel> subscriber) { try { Interest<InstanceInfo> activeInterests = new MultipleInterests<InstanceInfo>(interestTracker.interests.keySet()); newChannel.appendInterest(activeInterests).subscribe(); newRegistry.forInterest(activeInterests) .lift(new RegistrySwapOperator(prevRegistry, newRegistry, swapStrategyFactory)) .doOnCompleted(new Action0() { @Override public void call() { prevRegistry.shutdown(); subscriber.onNext(newChannel); subscriber.onCompleted(); } }) .subscribe(); } catch (Exception e) { subscriber.onError(e); } } }); }

Target:
protected Observable<ClientInterestChannel> reestablish() { final ClientInterestChannel newChannel = channelFactory.newInterestChannel(); final EurekaClientRegistry<InstanceInfo> prevRegistry = currentDelegateChannel().associatedRegistry(); final EurekaClientRegistry<InstanceInfo> newRegistry = newChannel.associatedRegistry(); return Observable.create(new Observable.OnSubscribe<ClientInterestChannel>() { @Override public void call(final Subscriber<? super ClientInterestChannel> subscriber) { try { Interest<InstanceInfo> activeInterests = new MultipleInterests<InstanceInfo>(interestTracker.interests.keySet()); newChannel.appendInterest(activeInterests).subscribe(); newRegistry.forInterest(activeInterests) .lift(new RegistrySwapOperator(prevRegistry, newRegistry, swapStrategyFactory)) .doOnCompleted(new Action0() { @Override public void call() { subscriber.onNext(newChannel); subscriber.onCompleted(); } }) .subscribe(); } catch (Exception e) { subscriber.onError(e); } } }); }
Source:
public static Duration seconds(Number n) { return new Duration( n.longValue(), TimeUnit.SECONDS ); }

Target:
public static Duration seconds(Number n) { return new Duration( (long)(n.doubleValue() * TimeUnit.SECONDS.toNanos(1)), TimeUnit.NANOSECONDS ); }
Source:
public Set<SearchFilterItem> getActiveFilterItems(SearchFilter filter) { String filterMapKey = filter.getFilterTypeMapKey(); if (filterMapKey.equals(JournalFilterType.JOURNAL_FILTER_MAP_KEY)) { return filter.getActiveFilterItems(journalKeys); } else if (filterMapKey.equals(SingletonSearchFilterType.ARTICLE_TYPE.getFilterMapKey())) { return filter.getActiveFilterItems(articleTypes); } else if (filterMapKey.equals(SingletonSearchFilterType.SUBJECT_AREA.getFilterMapKey())) { return filter.getActiveFilterItems(subjectList); } else if (filterMapKey.equals(SingletonSearchFilterType.AUTHOR.getFilterMapKey())) { return filter.getActiveFilterItems(authors); } else if (filterMapKey.equals(SingletonSearchFilterType.SECTION.getFilterMapKey())) { return filter.getActiveFilterItems(sections); } else { throw new RuntimeException("Search Filter not configured with sane map key: " + filterMapKey); } }

Target:
public Set<SearchFilterItem> getActiveFilterItems(SearchFilter filter) { String filterMapKey = filter.getFilterTypeMapKey(); Function<CommonParams, List<String>> getter = FILTER_KEYS_TO_FIELDS.get(filterMapKey); if (getter == null) { throw new RuntimeException("Search Filter not configured with sane map key: " + filterMapKey); } return filter.getActiveFilterItems(getter.apply(this)); }
Source:
private Iterable<ImmutableBitmap> getBitmapIterable(final BitmapIndexSelector selector) { if (isSimpleEquals()) { return ImmutableList.of(selector.getBitmapIndex(dimension, likeMatcher.getPrefix())); } else if (isSimplePrefix()) { final BitmapIndex bitmapIndex = selector.getBitmapIndex(dimension); if (bitmapIndex == null) { return ImmutableList.of(likeMatcher.matches(null) ? Filters.allTrue(selector) : Filters.allFalse(selector)); } final Indexed<String> dimValues = selector.getDimensionValues(dimension); return Filters.bitmapsFromIndexes( getDimValueIndexIterableForPrefixMatch(bitmapIndex, dimValues), bitmapIndex ); } else { return ImmutableList.of( Filters.matchPredicate( dimension, selector, likeMatcher.predicateFactory(extractionFn).makeStringPredicate() ) ); } }

Target:
private Iterable<ImmutableBitmap> getBitmapIterable(final BitmapIndexSelector selector) { if (isSimpleEquals()) { return ImmutableList.of(selector.getBitmapIndex(dimension, likeMatcher.getPrefix())); } else if (isSimplePrefix()) { final BitmapIndex bitmapIndex = selector.getBitmapIndex(dimension); if (bitmapIndex == null) { return ImmutableList.of(likeMatcher.matches(null) ? Filters.allTrue(selector) : Filters.allFalse(selector)); } final Indexed<String> dimValues = selector.getDimensionValues(dimension); return Filters.bitmapsFromIndexes( getDimValueIndexIterableForPrefixMatch(bitmapIndex, dimValues), bitmapIndex ); } else { return Filters.matchPredicateNoUnion( dimension, selector, likeMatcher.predicateFactory(extractionFn).makeStringPredicate() ); } }
Source:
protected Child getNoLabelsChild() throws IllegalArgumentException { if (noLabelsChild == null) { throw new IllegalArgumentException("For a labelled metric you must specify the labels"); } return noLabelsChild; }

Target:
protected Child getNoLabelsChild() { if (noLabelsChild == null) { throw new IllegalArgumentException("For a labelled metric you must specify the labels"); } return noLabelsChild; }
Source:
public boolean filter(CategoryDTO category) { boolean result = true; if (!containCommercialApplications.getValue()) { result &= category.getApplications().stream() .anyMatch(application -> application.getScripts().stream().anyMatch(script -> script.isFree())); } if (containRequiresPatchApplications.getValue()) { result &= category.getApplications().stream().anyMatch( application -> application.getScripts().stream().anyMatch(script -> !script.isRequiresPatch())); } if (!containTestingApplications.getValue()) { result &= category.getApplications().stream().anyMatch(application -> application.getScripts().stream() .anyMatch(script -> CollectionUtils.isEmpty(script.getTestingOperatingSystems()))); } if (!containAllOSCompatibleApplications.getValue()) { result &= category.getApplications().stream() .anyMatch(application -> application.getScripts().stream() .anyMatch(script -> script.getCompatibleOperatingSystems() .contains(operatingSystemFetcher.fetchCurrentOperationSystem()))); } return result && category.getApplications().stream() .anyMatch(application -> filterTextMatcher.test(filterText.getValue(), application)); }

Target:
public boolean filter(CategoryDTO category) { boolean result = true; if (!containCommercialApplications.getValue()) { result &= category.getApplications().stream() .anyMatch(application -> application.getScripts().stream().anyMatch(script -> script.isFree())); } if (containRequiresPatchApplications.getValue()) { result &= category.getApplications().stream().anyMatch( application -> application.getScripts().stream().anyMatch(script -> !script.isRequiresPatch())); } if (!containTestingApplications.getValue()) { result &= category.getApplications().stream().anyMatch(application -> application.getScripts().stream() .anyMatch(script -> CollectionUtils.isEmpty(script.getTestingOperatingSystems()))); } if (!containAllOSCompatibleApplications.getValue()) { result &= category.getApplications().stream() .anyMatch(application -> application.getScripts().stream() .filter(script -> !CollectionUtils.isEmpty(script.getCompatibleOperatingSystems())) .anyMatch(script -> script.getCompatibleOperatingSystems() .contains(operatingSystemFetcher.fetchCurrentOperationSystem()))); } return result && category.getApplications().stream() .anyMatch(application -> filterTextMatcher.test(filterText.getValue(), application)); }
Source:
public ContainerLaunchContext preLaunch(ContainerLaunchContext context) { if (log.isDebugEnabled()) { log.debug("preLaunch: " + context); } AppmasterService service = getAppmasterService(); if (service != null) { int port = service.getPort(); String address = service.getHost(); Map<String, String> env = new HashMap<String, String>(context.getEnvironment()); env.put(YarnSystemConstants.AMSERVICE_PORT, Integer.toString(port)); env.put(YarnSystemConstants.AMSERVICE_HOST, address); env.put(YarnSystemConstants.SYARN_CONTAINER_ID, ConverterUtils.toString(context.getContainerId())); context.setEnvironment(env); return context; } else { return context; } }

Target:
public ContainerLaunchContext preLaunch(ContainerLaunchContext context) { if (log.isDebugEnabled()) { log.debug("preLaunch: " + context); } AppmasterService service = getAppmasterService(); if (service != null) { int port = service.getPort(); String address = service.getHost(); Map<String, String> env = new HashMap<String, String>(context.getEnvironment()); env.put(YarnSystemConstants.AMSERVICE_PORT, Integer.toString(port)); env.put(YarnSystemConstants.AMSERVICE_HOST, address); env.put(YarnSystemConstants.SYARN_CONTAINER_ID, ConverterUtils.toString(context.getContainerId())); context.setEnvironment(env); } return context; }
Source:
private void postIssueComment(PullRequestRef pr, PostJobIssue issue, Map<String, StashCommentReport> commentsByFile, StashDiffReport diffReport, StashClient stashClient, Optional<Severity> taskSeverityThreshold ) throws StashClientException, StashConfigurationException { String issueKey = issue.key(); String path = getIssuePath(issue); StashCommentReport comments = commentsByFile.get(path); String commentContent = getMarkdownPrinter().printIssueMarkdown(issue); Integer issueLine = issue.line(); if (issueLine == null) { issueLine = 0; } if (comments != null && comments.contains(commentContent, path, issueLine)) { LOGGER.debug("Comment \"{}\" already pushed on file ({})", issueKey, path, issueLine); return; } IssueType type = diffReport.getType(path, issueLine, config.issueVicinityRange()); if (type == null) { LOGGER.debug( "Comment \"{}\" cannot be pushed to Stash like it does not belong to diff view - (line: {})", issueKey, path, issueLine); return; } long line = diffReport.getLine(path, issueLine); StashComment comment = stashClient .postCommentLineOnPullRequest(pr, commentContent, path, line, type); LOGGER .info("Comment \"{}\" has been created ({}) on file ({})", issueKey, type, path, line); if ( taskSeverityThreshold.isPresent() && issue.severity().compareTo(taskSeverityThreshold.get()) >= 0 ) { stashClient.postTaskOnComment(issue.message(), comment.getId()); if (LOGGER.isInfoEnabled()) { LOGGER.info("Comment \"{}\" has been linked to a Stash task", comment.getId()); } } }

Target:
private void postIssueComment(PullRequestRef pr, PostJobIssue issue, Map<String, StashCommentReport> commentsByFile, StashDiffReport diffReport, StashClient stashClient, Optional<Severity> taskSeverityThreshold ) throws StashClientException, StashConfigurationException { String issueKey = issue.key(); String path = getIssuePath(issue); StashCommentReport comments = commentsByFile.get(path); String commentContent = getMarkdownPrinter().printIssueMarkdown(issue); Integer issueLine = issue.line(); if (issueLine == null) { issueLine = 0; } if (comments != null && comments.contains(commentContent, path, issueLine)) { LOGGER.debug("Comment \"{}\" already pushed on file ({})", issueKey, path, issueLine); return; } IssueType type = diffReport.getType(path, issueLine, config.issueVicinityRange()); if (type == null) { LOGGER.info( "Comment \"{}\" cannot be pushed to Stash like it does not belong to diff view - (line: {})", issueKey, path, issueLine); return; } long line = diffReport.getLine(path, issueLine); StashComment comment = stashClient .postCommentLineOnPullRequest(pr, commentContent, path, line, type); LOGGER .info("Comment \"{}\" has been created ({}) on file ({})", issueKey, type, path, line); if ( taskSeverityThreshold.isPresent() && issue.severity().compareTo(taskSeverityThreshold.get()) >= 0 ) { stashClient.postTaskOnComment(issue.message(), comment.getId()); if (LOGGER.isInfoEnabled()) { LOGGER.info("Comment \"{}\" has been linked to a Stash task", comment.getId()); } } }
Source:
public void getProjectById() throws Exception { final Project project = gd.getProjectService().getProjectById(this.project.getId()); assertThat(project, project(this.project)); }

Target:
public void getProjectById() throws Exception { final Project project = gd.getProjectService().getProjectById(this.project.getId()); assertThat(project, hasSameIdAs(this.project)); }
Source:
public void close() { input.close(); }

Target:
public void close() { try { if (input != null) input.close(); } catch (IOException e) { } }