auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private static boolean isKnownShortcode(String shortCode) { if (shortCode == null) return false; if (mShortcodeTable.size() == 0) { mShortcodeTable.add("dailymotion"); mShortcodeTable.add("flickr"); mShortcodeTable.add("hulu"); mShortcodeTable.add("kickstarter"); mShortcodeTable.add("vimeo"); mShortcodeTable.add("vine"); mShortcodeTable.add("wpvideo"); mShortcodeTable.add("youtube"); mShortcodeTable.add("audio"); mShortcodeTable.add("playlist"); mShortcodeTable.add("soundcloud"); mShortcodeTable.add("gallery"); mShortcodeTable.add("instagram"); mShortcodeTable.add("scribd"); mShortcodeTable.add("slideshare"); mShortcodeTable.add("slideshow"); mShortcodeTable.add("presentation"); mShortcodeTable.add("googleapps"); mShortcodeTable.add("office"); mShortcodeTable.add("googlemaps"); mShortcodeTable.add("polldaddy"); mShortcodeTable.add("recipe"); mShortcodeTable.add("sitemap"); mShortcodeTable.add("twitter-timeline"); mShortcodeTable.add("upcomingevents"); } return mShortcodeTable.contains(shortCode); }

Target:
private static boolean isKnownShortcode(String shortCode) { if (shortCode == null) return false; if (mShortcodeTable.size() == 0) { mShortcodeTable.add("audio"); mShortcodeTable.add("caption"); mShortcodeTable.add("embed"); mShortcodeTable.add("gallery"); mShortcodeTable.add("playlist"); mShortcodeTable.add("video"); mShortcodeTable.add("wp_caption"); mShortcodeTable.add("dailymotion"); mShortcodeTable.add("flickr"); mShortcodeTable.add("hulu"); mShortcodeTable.add("kickstarter"); mShortcodeTable.add("soundcloud"); mShortcodeTable.add("vimeo"); mShortcodeTable.add("vine"); mShortcodeTable.add("wpvideo"); mShortcodeTable.add("youtube"); mShortcodeTable.add("instagram"); mShortcodeTable.add("scribd"); mShortcodeTable.add("slideshare"); mShortcodeTable.add("slideshow"); mShortcodeTable.add("presentation"); mShortcodeTable.add("googleapps"); mShortcodeTable.add("office"); mShortcodeTable.add("googlemaps"); mShortcodeTable.add("polldaddy"); mShortcodeTable.add("recipe"); mShortcodeTable.add("sitemap"); mShortcodeTable.add("twitter-timeline"); mShortcodeTable.add("upcomingevents"); } return mShortcodeTable.contains(shortCode); }
Source:
private static boolean validateWildcardSerializable(MetaClass mc) { if(mc.isInterface() || (mc.isAbstract() && !mc.isEnum())) { log.info("Serializable types cannot be an interface or abstract, ignoring: " + mc.getFullyQualifiedName()); return false; } return true; }

Target:
private static boolean validateWildcardSerializable(MetaClass mc) { if (mc.isInterface() || (mc.isAbstract() && !mc.isEnum())) { log.debug("Serializable types cannot be an interface or abstract, ignoring: {}", mc.getFullyQualifiedName()); return false; } return true; }
Source:
public void testLookupForUserFileNotFound() throws IOException { TextFileBasedIdentityHandler handler = new TextFileBasedIdentityHandler(userMappingFile.getPath() + ".test", groupMappingFile.getPath()); assertUserLookup(handler, testUserDataLine3.split(":")[0], ""); }

Target:
public void testLookupForUserFileNotFound() throws Exception { TextFileBasedIdentityHandler handler = new TextFileBasedIdentityHandler(userMappingFile.getPath() + ".test", groupMappingFile.getPath()); intercept(FileNotFoundException.class, "FileNotFoundException", () -> handler.lookupForLocalUserIdentity(testUserDataLine3.split(":")[0])); }
Source:
protected void addReferences(ReferenceDescriptor[] references) { if (references != null) { for (ReferenceDescriptor desc : references) { try { addReference(referenceClass.getDeclaredConstructor(ReferenceDescriptor.class).newInstance(desc)); } catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException | InstantiationException e) { throw new DirectoryException( "An error occurred while instantiating reference class " + referenceClass.getName(), e); } } } }

Target:
protected void addReferences(ReferenceDescriptor[] references) { if (references != null) { for (ReferenceDescriptor desc : references) { try { addReference(referenceClass.getDeclaredConstructor(ReferenceDescriptor.class).newInstance(desc)); } catch (ReflectiveOperationException e) { throw new DirectoryException( "An error occurred while instantiating reference class " + referenceClass.getName(), e); } } } }
Source:
public void testValidateNonsenseCigar(){ SAMRecord rec = createTestRecordHelper(); rec.setCigarString("nonsense"); rec.setValidationStringency(ValidationStringency.STRICT); List<SAMValidationError> err = rec.validateCigar(-1); Assert.assertTrue(err != null); Assert.assertTrue(!err.isEmpty()); }

Target:
public void testValidateNonsenseCigar(){ SAMRecord rec = createTestRecordHelper(); rec.setCigarString("nonsense"); rec.setValidationStringency(ValidationStringency.STRICT); List<SAMValidationError> err = rec.validateCigar(-1); Assert.assertNotNull(err); Assert.assertEquals(err.size(), 1); Assert.assertEquals(err.get(0).getType(), SAMValidationError.Type.INVALID_CIGAR); }
Source:
public Void call(ApiCaller ac, Deserializer parms) throws PerunException { ac.stateChangingCheck(); List<Integer> memberInts = parms.readList("members", Integer.class); if (memberInts == null) { throw new RpcException(RpcException.Type.MISSING_VALUE, "Non-empty list of members not sent."); } Group group = ac.getGroupById(parms.readInt("group")); List<Member> members = new ArrayList<>(); for (Integer memberInt : memberInts) { Member member = ac.getMemberById(memberInt); if (!ac.getGroupsManager().isGroupMember(ac.getSession(), group, member)) { members.add(member); } else { Member groupMember = ac.getGroupsManager().getGroupMemberById(ac.getSession(), group, member.getId()); if (MembershipType.INDIRECT.equals(groupMember.getMembershipType())) { members.add(member); } } } ac.getGroupsManager().addMembers(ac.getSession(), group, members); return null; }

Target:
public Group call(ApiCaller ac, Deserializer parms) throws PerunException { ac.stateChangingCheck(); if (parms.contains("group")) { if (parms.contains("parentGroup")) { return ac.getGroupsManager().createGroup(ac.getSession(), ac.getGroupById(parms.readInt("parentGroup")), parms.read("group", Group.class)); } else if (parms.contains("vo")) { Group group = parms.read("group", Group.class); if (group.getParentGroupId() == null) { return ac.getGroupsManager().createGroup(ac.getSession(), ac.getVoById(parms.readInt("vo")), group); } else { throw new RpcException(RpcException.Type.WRONG_PARAMETER, "Top-level groups can't have parentGroupId set!"); } } else { throw new RpcException(RpcException.Type.MISSING_VALUE, "vo or parentGroup"); } } else if (parms.contains("name") && parms.contains("description")) { if (parms.contains("parentGroup")) { String name = parms.readString("name"); String description = parms.readString("description"); Group group = new Group(name, description); return ac.getGroupsManager().createGroup(ac.getSession(), ac.getGroupById(parms.readInt("parentGroup")), group); } else if (parms.contains("vo")) { String name = parms.readString("name"); String description = parms.readString("description"); Group group = new Group(name, description); return ac.getGroupsManager().createGroup(ac.getSession(), ac.getVoById(parms.readInt("vo")), group); } else { throw new RpcException(RpcException.Type.MISSING_VALUE, "vo or parentGroup"); } } else { throw new RpcException(RpcException.Type.MISSING_VALUE, "group or (name and description)"); } }
Source:
protected void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); setContentView(R.layout.puzzle); setTitle(R.string.puzzle_view_name); Level levelObject = new Level(); levelObject.put("levelNumber", 100); levelObject.put("points", 100); levelObject.put("puzzleID", 10); levelObject.saveInBackground(); Puzzle puzzleObject = new Puzzle(); puzzleObject.put("riddle", "What is the favorite animal of Jennifer?"); puzzleObject.put("answer", "Pusheen"); puzzleObject.put("points", 100); puzzleObject.put("location", new ParseGeoPoint(23, 23)); puzzleObject.saveInBackground(); TextView question = (TextView) findViewById(R.id.question); question.setText(puzzleObject.getString("riddle")); correctAnswer = puzzleObject.getString("answer"); chk1 = (CheckBox) findViewById(R.id.chkanswer_1); chk2 = (CheckBox) findViewById(R.id.chkanswer_2); chk3 = (CheckBox) findViewById(R.id.chkanswer_3); chk4 = (CheckBox) findViewById(R.id.chkanswer_4); List<String> answers = new ArrayList<String>(Arrays.asList("Puppy","Koala","Panda",correctAnswer)); List<CheckBox> checkBoxes = new ArrayList<CheckBox>(Arrays.asList(chk1, chk2, chk3, chk4)); List<Integer> ordering = generateRandomOrder(); for (int i = 0; i < totalNumMultChoice; i++){ checkBoxes.get(i).setText(answers.get(ordering.get(i))); } addListenerOnMainMenuButton(); addListenerOnChkAnswer_1(); addListenerOnChkAnswer_2(); addListenerOnChkAnswer_3(); addListenerOnChkAnswer_4(); }

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.puzzle); setTitle(R.string.puzzle_view_name); Level levelObject = new Level(); levelObject.put("levelNumber", 100); levelObject.put("points", 100); levelObject.put("puzzleID", 10); Puzzle puzzleObject = new Puzzle(); puzzleObject.put("riddle", "What is the favorite animal of Jennifer?"); puzzleObject.put("answer", "Pusheen"); puzzleObject.put("points", 100); puzzleObject.put("location", new ParseGeoPoint(23, 23)); TextView question = (TextView) findViewById(R.id.question); question.setText(puzzleObject.getString("riddle")); correctAnswer = puzzleObject.getString("answer"); chk1 = (CheckBox) findViewById(R.id.chkanswer_1); chk2 = (CheckBox) findViewById(R.id.chkanswer_2); chk3 = (CheckBox) findViewById(R.id.chkanswer_3); chk4 = (CheckBox) findViewById(R.id.chkanswer_4); List<String> answers = new ArrayList<String>(Arrays.asList("Puppy","Koala","Panda",correctAnswer)); List<CheckBox> checkBoxes = new ArrayList<CheckBox>(Arrays.asList(chk1, chk2, chk3, chk4)); List<Integer> ordering = generateRandomOrder(); for (int i = 0; i < totalNumMultChoice; i++) { checkBoxes.get(i).setText(answers.get(ordering.get(i))); } addListenerOnMainMenuButton(); addListenerOnChkAnswer_1(); addListenerOnChkAnswer_2(); addListenerOnChkAnswer_3(); addListenerOnChkAnswer_4(); }
Source:
private String escapedValue(String value) { if (value != null) { value = value.replaceAll("&", "&amp;"); value = value.replaceAll("<", "&lt;"); value = value.replaceAll(">", "&gt;"); } return value; }

Target:
private String escapedValue(String value) { if (value != null) { value = value.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;"); } return value; }
Source:
public void poll() { if (isMonitoringNeeded(vdsManager.getStatus())) { VmsListFetcher fetcher = new VmsStatisticsFetcher(vdsManager); long fetchTime = System.nanoTime(); if (fetcher.fetch()) { List<VdsmVm> dbVms = getVmsMonitoring().perform(fetcher.getChangedVms(), fetchTime, vdsManager, true); processDevices(dbVms.stream(), fetchTime); } else { log.info("Failed to fetch vms info for host '{}' - skipping VMs monitoring.", vdsManager.getVdsName()); } } }

Target:
public void poll() { if (isMonitoringNeeded(vdsManager.getStatus())) { VmsListFetcher fetcher = new VmsStatisticsFetcher(vdsManager); long fetchTime = System.nanoTime(); if (fetcher.fetch()) { getVmsMonitoring().perform(fetcher.getChangedVms(), fetchTime, vdsManager, true); List<VdsmVm> vdsmVmsToMonitor = fetcher.getChangedVms().stream(). filter(monitoredVm -> monitoredVm.getFirst() != null). map(Pair::getSecond).collect(Collectors.toList()); processDevices(vdsmVmsToMonitor.stream(), fetchTime); } else { log.info("Failed to fetch vms info for host '{}' - skipping VMs monitoring.", vdsManager.getVdsName()); } } }
Source:
public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((fullPath == null) ? 0 : fullPath.hashCode()); result = prime * result + ((storage == null) ? 0 : storage.hashCode()); return result; }

Target:
public int hashCode() { return Objects.hashCode(fullPath, storage); }
Source:
public static ObjectInstance getNewSimpleIngredientObjectInstance(ObjectClass simpleIngredientClass, String name, int attributes, int useCount, Set<String> traits, String ingredientContainer) { ObjectInstance newInstance = new ObjectInstance(simpleIngredientClass, name); setAttributes(newInstance, attributes); newInstance.setValue(IngredientFactory.attributeUseCount, useCount); for (String trait : traits) { newInstance.addRelationalTarget("traits", trait); } if (ingredientContainer != null || ingredientContainer != "") { newInstance.addRelationalTarget(IngredientFactory.attributeContainer, ingredientContainer); } return newInstance; }

Target:
public static ObjectInstance getNewSimpleIngredientObjectInstance(ObjectClass simpleIngredientClass, String name, int attributes, int useCount, Set<String> traits, String ingredientContainer) { ObjectInstance newInstance = new ObjectInstance(simpleIngredientClass, name); IngredientFactory.setAttributes(newInstance, attributes); newInstance.setValue(IngredientFactory.attributeUseCount, useCount); for (String trait : traits) { newInstance.addRelationalTarget("traits", trait); } if (ingredientContainer != null || ingredientContainer != "") { newInstance.addRelationalTarget(IngredientFactory.attributeContainer, ingredientContainer); } return newInstance; }
Source:
public boolean equals(Object o) { if (this == o) { return true; } if(o == null || o.getClass() != this.getClass()){ return false; } if (!(o instanceof DTColumnConfig52)) { return false; } DTColumnConfig52 that = (DTColumnConfig52) o; if (hideColumn != that.hideColumn) { return false; } if (width != that.width) { return false; } if (defaultValue != null ? !defaultValue.equals(that.defaultValue) : that.defaultValue != null) { return false; } if (typedDefaultValue != null ? !typedDefaultValue.equals(that.typedDefaultValue) : that.typedDefaultValue != null) { return false; } return header != null ? header.equals(that.header) : that.header == null; }

Target:
public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof DTColumnConfig52)) { return false; } DTColumnConfig52 that = (DTColumnConfig52) o; return hideColumn == that.hideColumn && width == that.width && Objects.equals(defaultValue, that.defaultValue) && Objects.equals(typedDefaultValue, that.typedDefaultValue) && Objects.equals(header, that.header); }
Source:
private void runExec() { try { this.process = Runtime.getRuntime().exec(this.command); this.reader = new BufferedReader(new InputStreamReader(this.process.getInputStream())); this.getTaskExecutor().execute(this); this.startStatusReader(); this.startProcessMonitor(); } catch (IOException e) { throw new MessagingException("Failed to exec tail command: '" + this.options + "'", e); } }

Target:
private void runExec() { this.destroyProcess(); if (logger.isInfoEnabled()) { logger.info("Starting tail process"); } try { Process process = Runtime.getRuntime().exec(this.command); BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream())); this.process = process; this.startProcessMonitor(); this.startStatusReader(); this.reader = reader; this.getTaskExecutor().execute(this); } catch (IOException e) { throw new MessagingException("Failed to exec tail command: '" + this.command + "'", e); } }
Source:
private boolean hasDateFormat() { return Optional .ofNullable(dateFormatContainer) .map(DateFormatContainer::getDateFormat) .isPresent(); }

Target:
private boolean hasDateFormat() { return dateFormatContainer != null && dateFormatContainer.getDateFormat() != null; }
Source:
private void initializeDefaults() { encoding_.addItem("ASCII", "ASCII"); encoding_.addItem("UTF-16", "UTF-16"); encoding_.addItem("UTF-16BE", "UTF-16BE"); encoding_.addItem("UTF-16LE", "UTF-16LE"); encoding_.addItem("UTF-32", "UTF-32"); encoding_.addItem("UTF-32BE", "UTF-32BE"); encoding_.addItem("UTF-32LE", "UTF-32LE"); encoding_.addItem("UTF-7", "UTF-7"); encoding_.addItem("UTF-8", "UTF-8"); encoding_.addItem("UTF-8-MAC", "UTF-8-MAC"); encoding_.addItem("UTF8", "UTF8"); encoding_.addItem("UTF8-MAC", "UTF8-MAC"); encoding_.addItem("Other", ""); encoding_.setSelectedIndex(8); }

Target:
private void initializeDefaults() { encoding_.addItem("ASCII", "ASCII"); encoding_.addItem("UTF-8", "UTF-8"); encoding_.addItem("ISO-8859-1", "ISO-8859-1"); encoding_.addItem("WINDOWS-1252", "WINDOWS-1252"); encoding_.addItem("SHIFT-JIS", "SHIFT-JIS"); encoding_.addItem("ISO-2022-JP", "ISO-2022-JP"); encoding_.addItem("BIG5", "BIG5"); encoding_.addItem("ISO-2022-KR", "ISO-2022-KR"); encoding_.addItem("ISO-8859-7", "ISO-8859-7"); encoding_.addItem("GB2312", "GB2312"); encoding_.addItem("GB18030", "GB18030"); encoding_.addItem("ISO-8859-2", "ISO-8859-2"); encoding_.addItem(otherLabel, ""); encoding_.setSelectedIndex(1); }
Source:
public void trackValuePropModalView(@NonNull String courseId, @Nullable String assignmentId, @NonNull String screenName) { final FirebaseEvent event = new FirebaseEvent(Events.VALUE_PROP_MODAL_VIEW); event.putCourseId(courseId); if (assignmentId != null) { event.putString(Keys.ASSIGNMENT_ID, assignmentId); } event.putString(Keys.SCREEN_NAME, screenName); logFirebaseEvent(event.getName(), event.getBundle()); }

Target:
public void trackValuePropModalView(@NonNull String courseId, @Nullable String assignmentId, @NonNull String screenName) { final FirebaseEvent event = new FirebaseEvent(Events.VALUE_PROP_MODAL_VIEW); event.putCourseId(courseId); if (TextUtils.isEmpty(assignmentId)) { event.putString(Keys.ASSIGNMENT_ID, assignmentId); } event.putString(Keys.SCREEN_NAME, screenName); logFirebaseEvent(event.getName(), event.getBundle()); }
Source:
public void allFilesExist() { assertTrue(CertificateUtils.verifyCertificatesExist("src/test/resources/testVerifyCertificatesExist/allFiles")); }

Target:
public void allFilesExist() { assertTrue(CertificateUtils.verifyCertificatesExist(getPathToTestResources("allFilesExist"))); }
Source:
public InstructorFeedbackResultsSectionPanel() { panelClass = "panel-success"; isDisplayingMissingParticipants = true; isTeamWithResponses = new HashMap<String, Boolean>(); participantPanels = new LinkedHashMap<String, List<InstructorResultsParticipantPanel>>(); }

Target:
public InstructorFeedbackResultsSectionPanel() { panelClass = "panel-success"; isDisplayingMissingParticipants = true; isAbleToLoadResponses = true; isTeamWithResponses = new HashMap<String, Boolean>(); participantPanels = new LinkedHashMap<String, List<InstructorFeedbackResultsParticipantPanel>>(); }
Source:
protected JAXBContext getClassContext(Class<?> type, Type genericType) throws JAXBException { final AtomicReference<JAXBException> jaxbException = new AtomicReference<>(); final JAXBContext context = classContexts.computeIfAbsent(type, t -> { final Class<?>[] classes; if (extraClass != null) { classes = new Class[extraClass.length + 1]; classes[0] = type; System.arraycopy(extraClass, 0, classes, 1, extraClass.length); } else { classes = new Class[] {type}; } try { return newJAXBContextInstance(classes, cProperties); } catch (JAXBException e) { jaxbException.set(e); return null; } }); if (null != jaxbException.get()) { throw jaxbException.get(); } return context; }

Target:
protected JAXBContext getClassContext(Class<?> type, Type genericType) throws JAXBException { final JAXBException[] jaxbException = new JAXBException[] {null}; final JAXBContext context = classContexts.computeIfAbsent(type, t -> { final Class<?>[] classes; if (extraClass != null) { classes = new Class[extraClass.length + 1]; classes[0] = type; System.arraycopy(extraClass, 0, classes, 1, extraClass.length); } else { classes = new Class[] {type}; } try { return newJAXBContextInstance(classes, cProperties); } catch (JAXBException e) { jaxbException[0] = e; return null; } }); if (null != jaxbException[0]) { throw jaxbException[0]; } return context; }
Source:
public List<Integer> getPartitionIntegerKeys() throws NoConnectionsException, IOException, ProcCallException { if(m_distributer.getPartitionKeys().size() > 0){ return m_distributer.getPartitionKeys(); } long time = System.currentTimeMillis() - m_lastPartitionKeyFetched; if(time > 5 * 60 * 1000){ m_partitionIntegerKeys.clear(); } setPartitions(); return m_partitionIntegerKeys; }

Target:
public List<Integer> getPartitionIntegerKeys() throws NoConnectionsException, IOException, ProcCallException { if (m_distributer.getPartitionKeys().size() > 0) { return m_distributer.getPartitionKeys(); } long time = System.currentTimeMillis() - m_lastPartitionKeyFetched; if (time > PARTITION_KEYS_INFO_REFRESH_FREQUENCY) { m_partitionIntegerKeys.clear(); } refreshPartitionKeys(); return m_partitionIntegerKeys; }
Source:
public void processBindingConfiguration(String context, Item item, String bindingConfig) throws BindingConfigParseException { super.processBindingConfiguration(context, item, bindingConfig); bindingConfig = bindingConfig.replace(" ", ""); Matcher matcher = CONFIG_PATTERN.matcher(bindingConfig); if (matcher.matches()) { PilightBindingConfig config = new PilightBindingConfig(); String instance = matcher.group("instance"); String location = matcher.group("location"); String device = matcher.group("device"); config.setItem(item); config.setInstance(instance); config.setLocation(location); config.setDevice(device); String values = matcher.group("properties"); if (!StringUtils.isEmpty(values)) { String[] pairs = values.split(","); for (String pair : pairs) { String[] kv = pair.split("="); String key = kv[0]; String value = kv[1]; if (key.equals("property")) { config.setProperty(value); } } } boolean isValueItem = item.getClass().equals(NumberItem.class) || item.getClass().equals(StringItem.class); if (isValueItem && StringUtils.isEmpty(config.getProperty())) { logger.error("No property specified for item {}", config.getItemName()); } else { logger.info("pilight:{} item bound to device in location {}{}", config.getInstance(), config.getItemName(), config.getDevice(), config.getLocation(), config.getProperty() != null ? ", property " + config.getProperty() : ""); addBindingConfig(item, config); } } else { logger.error("Item config does not match instance#location:device,property=optional pattern", bindingConfig); } }

Target:
public void processBindingConfiguration(String context, Item item, String bindingConfig) throws BindingConfigParseException { super.processBindingConfiguration(context, item, bindingConfig); bindingConfig = bindingConfig.replace(" ", ""); Matcher matcher = CONFIG_PATTERN.matcher(bindingConfig); if (matcher.matches()) { PilightBindingConfig config = new PilightBindingConfig(); String instance = matcher.group("instance"); String location = matcher.group("location"); String device = matcher.group("device"); config.setItemName(item.getName()); config.setItemType(item.getClass()); config.setInstance(instance); config.setLocation(location); config.setDevice(device); String values = matcher.group("properties"); if (!StringUtils.isEmpty(values)) { String[] pairs = values.split(","); for (String pair : pairs) { String[] kv = pair.split("="); String key = kv[0]; String value = kv[1]; if (key.equals("property")) { config.setProperty(value); } } } boolean isValueItem = item.getClass().equals(NumberItem.class) || item.getClass().equals(StringItem.class); if (isValueItem && StringUtils.isEmpty(config.getProperty())) { logger.error("No property specified for item {}", config.getItemName()); } else { logger.info("pilight:{} item bound to device in location {}{}", config.getInstance(), config.getItemName(), config.getDevice(), config.getLocation(), config.getProperty() != null ? ", property " + config.getProperty() : ""); addBindingConfig(item, config); } } else { logger.error("Item config does not match instance#location:device,property=optional pattern", bindingConfig); } }
Source:
private ConfigurationImpl() { this.validationBootstrapParameters = new ValidationBootstrapParameters(); this.defaultResourceBundleLocator = new PlatformResourceBundleLocator( ResourceBundleMessageInterpolator.USER_VALIDATION_MESSAGES ); this.defaultTraversableResolver = new DefaultTraversableResolver(); this.defaultConstraintValidatorFactory = new ConstraintValidatorFactoryImpl(); if ( Version.getJavaRelease() >= 8 ) { this.defaultParameterNameProvider = new Java8DefaultParameterNameProvider(); } else { this.defaultParameterNameProvider = new DefaultParameterNameProvider(); } this.defaultMessageInterpolator = new ResourceBundleMessageInterpolator( defaultResourceBundleLocator ); }

Target:
private ConfigurationImpl() { this.validationBootstrapParameters = new ValidationBootstrapParameters(); this.defaultResourceBundleLocator = new PlatformResourceBundleLocator( ResourceBundleMessageInterpolator.USER_VALIDATION_MESSAGES ); this.defaultTraversableResolver = new DefaultTraversableResolver(); this.defaultConstraintValidatorFactory = new ConstraintValidatorFactoryImpl(); this.defaultParameterNameProvider = new DefaultParameterNameProvider(); this.defaultMessageInterpolator = new ResourceBundleMessageInterpolator( defaultResourceBundleLocator ); }
Source:
@SuppressWarnings("unused") public void setQueryResults(List<QueryResult> queryResults) { this.queryResults = queryResults; }

Target:
public void setQueryResults(List<QueryResult> queryResults) { this.queryResults = queryResults; }
Source:
public ProcessTxnResult processTxn(Request request) { TxnHeader hdr = request.getHdr(); processTxnForSessionEvents(request, hdr, request.getTxn()); final boolean writeRequest = (hdr != null); final boolean quorumRequest = request.isQuorum(); if (!writeRequest && !quorumRequest) { return new ProcessTxnResult(); } synchronized (outstandingChanges) { ProcessTxnResult rc = processTxnInDB(hdr, request.getTxn()); if (writeRequest) { long zxid = hdr.getZxid(); while (!outstandingChanges.isEmpty() && outstandingChanges.peek().zxid <= zxid) { ChangeRecord cr = outstandingChanges.remove(); ServerMetrics.getMetrics().OUTSTANDING_CHANGES_REMOVED.add(1); if (cr.zxid < zxid) { LOG.warn("Zxid outstanding is less than current {}", cr.zxid, zxid); } if (outstandingChangesForPath.get(cr.path) == cr) { outstandingChangesForPath.remove(cr.path); } } } if (quorumRequest) { getZKDatabase().addCommittedProposal(request); } return rc; } }

Target:
public ProcessTxnResult processTxn(Request request) { TxnHeader hdr = request.getHdr(); processTxnForSessionEvents(request, hdr, request.getTxn()); final boolean writeRequest = (hdr != null); final boolean quorumRequest = request.isQuorum(); if (!writeRequest && !quorumRequest) { return new ProcessTxnResult(); } synchronized (outstandingChanges) { ProcessTxnResult rc = processTxnInDB(hdr, request.getTxn()); if (writeRequest) { long zxid = hdr.getZxid(); while (!outstandingChanges.isEmpty() && outstandingChanges.peek().zxid <= zxid) { ChangeRecord cr = outstandingChanges.remove(); ServerMetrics.getMetrics().OUTSTANDING_CHANGES_REMOVED.add(1); if (cr.zxid < zxid) { LOG.warn( "Zxid outstanding 0x{} is less than current 0x{}", Long.toHexString(cr.zxid), Long.toHexString(zxid)); } if (outstandingChangesForPath.get(cr.path) == cr) { outstandingChangesForPath.remove(cr.path); } } } if (quorumRequest) { getZKDatabase().addCommittedProposal(request); } return rc; } }
Source:
private void sendBlockEntityToAllPlayers(TileEntity blockEntity) { if (blockEntity == null) { return; } SPacketUpdateTileEntity packet = blockEntity.getUpdatePacket(); if (packet == null) { return; } sendPacketToAllPlayers(packet); }

Target:
private void sendBlockEntityToAllPlayers(TileEntity blockEntity) { if (blockEntity == null) { return; } Packet packet = blockEntity.getUpdatePacket(); if (packet == null) { return; } sendPacketToAllPlayers(packet); }
Source:
public static void writeHttpResponse(final ChannelHandlerContext ctx, final HttpResponse response, boolean keepAlive) { if (keepAlive) { response.headers().set(HttpHeaderNames.CONNECTION, HttpHeaderValues.KEEP_ALIVE); ctx.write(response); } else { ctx.write(response); ctx.writeAndFlush(Unpooled.EMPTY_BUFFER).addListener(ChannelFutureListener.CLOSE); } }

Target:
public static void writeHttpResponse(final ChannelHandlerContext ctx, final HttpResponse response, boolean keepAlive) { if (keepAlive) { response.headers().set(HttpHeaderNames.CONNECTION, HttpHeaderValues.KEEP_ALIVE); ctx.write(response); } else { ctx.writeAndFlush(response).addListener(ChannelFutureListener.CLOSE); } }
Source:
public Object invoke(final InvocationContext context) throws Exception { Transaction current = TransactionSupport.current(); if (current == null) { return runInTransaction(context, TransactionScopeOption.Required); } else { Transactional transactional = context.getMethod().getAnnotation(Transactional.class); return runInTransaction(context, transactional.propogation()); } }

Target:
public Object invoke(final InvocationContext context) throws Exception { Transaction current = TransactionSupport.current(); if (current == null) { return runInTransaction(context, TransactionScopeOption.Required); } else { Transactional transactional = context.getMethod().getAnnotation(Transactional.class); if (transactional != null) { return runInTransaction(context, transactional.propogation()); } else { return context.proceed(); } } }
Source:
protected WorkloadProcessDescriptiveStatistics assembleDescriptiveScenarioStatistics(StatisticsCalculator calculator, TaskData taskData) { WorkloadProcessDescriptiveStatistics statistics = new WorkloadProcessDescriptiveStatistics(); statistics.setTaskData(taskData); List<WorkloadProcessLatencyPercentile> percentiles = Lists.newArrayList(); for (double percentileKey : getGlobalPercentilesKeys()) { double percentileValue = calculator.getPercentile(percentileKey); WorkloadProcessLatencyPercentile percentile = new WorkloadProcessLatencyPercentile(percentileKey, percentileValue); percentile.setWorkloadProcessDescriptiveStatistics(statistics); if (Double.isNaN(percentileKey) || Double.isNaN(percentileValue)) { log.error("Percentile has NaN values : key={}, value={}", percentileKey, percentileValue); continue; } percentiles.add(percentile); } if (!percentiles.isEmpty()) { statistics.setPercentiles(percentiles); } return statistics; }

Target:
protected WorkloadProcessDescriptiveStatistics assembleDescriptiveScenarioStatistics(StatisticsCalculator calculator, TaskData taskData) { WorkloadProcessDescriptiveStatistics statistics = new WorkloadProcessDescriptiveStatistics(); statistics.setTaskData(taskData); List<WorkloadProcessLatencyPercentile> percentiles = Lists.newArrayList(); for (double percentileKey : getGlobalPercentilesKeys()) { double percentileValue = calculator.getPercentile(percentileKey); if (Double.isNaN(percentileKey) || Double.isNaN(percentileValue)) { log.error("Percentile has NaN values : key={}, value={}", percentileKey, percentileValue); continue; } WorkloadProcessLatencyPercentile percentile = new WorkloadProcessLatencyPercentile(percentileKey, percentileValue); percentile.setWorkloadProcessDescriptiveStatistics(statistics); percentiles.add(percentile); } if (!percentiles.isEmpty()) { statistics.setPercentiles(percentiles); } return statistics; }
Source:
Builder parentFolder(File parentFolder) { this.parentFolder = parentFolder; return this; }

Target:
public Builder parentFolder(File parentFolder) { this.parentFolder = parentFolder; return this; }
Source:
private boolean isOriginalError(Error newError, Optional<Error> originalError) { if (!originalError.isPresent()) { return false; } return originalError.get().equals(newError); }

Target:
private boolean isOriginalError(Error newError, Optional<Error> originalError) { return originalError.map(error -> error.equals(newError)).orElse(false); }
Source:
public void reloadBrooklynProperties() { log.info("Reloading brooklyn properties from " + builder); BrooklynProperties properties = builder.build(); configMap = properties; if (brooklynAdditionalProperties != null) { log.info("Reloading additional brooklyn properties from " + brooklynAdditionalProperties); configMap.addFromMap(brooklynAdditionalProperties); } this.downloadsManager = BasicDownloadsManager.newDefault(configMap); this.locationRegistry = null; for (PropertiesReloadListener listener : reloadListeners) { if (listener != null) listener.reloaded(); } }

Target:
public void reloadBrooklynProperties() { log.info("Reloading brooklyn properties from " + builder); BrooklynProperties properties = builder.build(); configMap = properties; if (brooklynAdditionalProperties != null) { log.info("Reloading additional brooklyn properties from " + brooklynAdditionalProperties); configMap.addFromMap(brooklynAdditionalProperties); } this.downloadsManager = BasicDownloadsManager.newDefault(configMap); this.locationRegistry = null; for (PropertiesReloadListener listener : reloadListeners) { listener.reloaded(); } }
Source:
private void applyForcedChanges(){ ApiTokenPropertyConfiguration apiTokenPropertyConfiguration = ApiTokenPropertyConfiguration.get(); if(!apiTokenPropertyConfiguration.hasExistingConfigFile()){ apiTokenPropertyConfiguration.setCreationOfLegacyTokenEnabled(false); apiTokenPropertyConfiguration.setTokenGenerationOnCreationEnabled(false); } }

Target:
private void applyForcedChanges(){ ApiTokenPropertyConfiguration apiTokenPropertyConfiguration = ApiTokenPropertyConfiguration.get(); if(!apiTokenPropertyConfiguration.hasExistingConfigFile()){ LOGGER.log(Level.INFO, "New API token system configured with insecure options to keep legacy behavior"); apiTokenPropertyConfiguration.setCreationOfLegacyTokenEnabled(false); apiTokenPropertyConfiguration.setTokenGenerationOnCreationEnabled(false); } }
Source:
public void run(final Object[] train, final ZContext chef, final Socket mic) { final int mandat = 5; Fortune star = (Fortune) train[1]; final Entourage entourage = (Entourage) train[3]; final ZContext producer = (ZContext) train[2]; final Set set = (Set) train[0]; final String gossip = (String) train[4]; final Object[] bags = new Object[train.length - mandat]; System.arraycopy(train, mandat, bags, 0, bags.length); if (entourage != null) { entourage.breakaleg(chef, star, mic, bags); } try { String name = star.premiere(mic, bags); set.lights(name, number); showMustGoOn(chef, set, mic, star, bags); } finally { try { boolean tell = star.interview(mic); if (tell && gossip != null) { try { mic.send(gossip); } catch (Exception e) { } } star.party(chef); star = null; if (entourage != null) { entourage.party(chef); } chef.close(); if (producer != null) { producer.close(); } } finally { exit.countDown(); } } }

Target:
public void run(final Object[] train, final ZContext chef, final Socket mic) { final int mandat = 5; Fortune star = (Fortune) train[1]; final Entourage entourage = (Entourage) train[3]; final ZContext producer = (ZContext) train[2]; final Set set = (Set) train[0]; final String gossip = (String) train[4]; final Object[] bags = new Object[train.length - mandat]; System.arraycopy(train, mandat, bags, 0, bags.length); if (entourage != null) { entourage.breakaleg(chef, star, mic, bags); } try { String name = star.premiere(mic, bags); set.lights(name, number); showMustGoOn(chef, set, mic, star, bags); } finally { try { boolean tell = star.interview(mic); if (tell && gossip != null) { try { mic.send(gossip); } catch (ZMQException e) { assert (e.getErrorCode() == Error.ETERM.getCode()); } } star.party(chef); star = null; if (entourage != null) { entourage.party(chef); } chef.close(); if (producer != null) { producer.close(); } } finally { exit.countDown(); } } }
Source:
protected boolean setupWorkingDirectoryAndExtractPackages() { String coreReleasePackageURI = LocalContext.corePackageUri(config); LOG.info("core release package uri: " + coreReleasePackageURI); String coreReleaseFileDestination = Paths.get( topologyWorkingDirectory, "heron-core.tar.gz").toString(); String topologyPackageURI = Runtime.topologyPackageUri(runtime).toString(); String topologyPackageDestination = Paths.get( topologyWorkingDirectory, "topology.tar.gz").toString(); if (!SchedulerUtils.setupWorkingDirectory(topologyWorkingDirectory)) { return false; } final boolean isVerbose = Context.verbose(config); if (config.getBooleanValue(LocalKey.USE_HERON_CORE_URI.value(), LocalKey.USE_HERON_CORE_URI.getDefaultBoolean())) { if (!SchedulerUtils.extractPackage(topologyWorkingDirectory, coreReleasePackageURI, coreReleaseFileDestination, true, isVerbose)) { return false; } } else { Path heronCore = Paths.get(config.getStringValue(Key.HERON_HOME), "heron-core"); Path heronCoreLink = Paths.get(topologyWorkingDirectory, "heron-core"); try { Files.createSymbolicLink(heronCoreLink, heronCore); } catch (IOException ioe) { LOG.log(Level.SEVERE, "Unable to create heron core link from " + heronCoreLink + " to " + heronCore, ioe); return false; } } return SchedulerUtils.extractPackage(topologyWorkingDirectory, topologyPackageURI, topologyPackageDestination, true, isVerbose); }

Target:
protected boolean setupWorkingDirectoryAndExtractPackages() { String coreReleasePackageURI = LocalContext.corePackageUri(config); LOG.info("core release package uri: " + coreReleasePackageURI); String coreReleaseFileDestination = Paths.get( topologyWorkingDirectory, "heron-core.tar.gz").toString(); String topologyPackageURI = Runtime.topologyPackageUri(runtime).toString(); String topologyPackageDestination = Paths.get( topologyWorkingDirectory, "topology.tar.gz").toString(); if (!SchedulerUtils.createOrCleanDirectory(topologyWorkingDirectory)) { return false; } final boolean isVerbose = Context.verbose(config); if (config.getBooleanValue(LocalKey.USE_HERON_CORE_URI.value(), LocalKey.USE_HERON_CORE_URI.getDefaultBoolean())) { if (!SchedulerUtils.extractPackage(topologyWorkingDirectory, coreReleasePackageURI, coreReleaseFileDestination, true, isVerbose)) { return false; } } else { Path heronCore = Paths.get(config.getStringValue(Key.HERON_HOME), "heron-core"); Path heronCoreLink = Paths.get(topologyWorkingDirectory, "heron-core"); try { Files.createSymbolicLink(heronCoreLink, heronCore); } catch (IOException ioe) { LOG.log(Level.SEVERE, "Unable to create heron core link from " + heronCoreLink + " to " + heronCore, ioe); return false; } } return SchedulerUtils.extractPackage(topologyWorkingDirectory, topologyPackageURI, topologyPackageDestination, true, isVerbose); }
Source:
protected AddressPair(String macAddress, String ipAddress) { this.macAddress = macAddress; this.ipAddress = ipAddress; }

Target:
protected AddressPair(String macAddress, String ipAddress) { checkNotNull(macAddress, "mac address should not be null"); checkNotNull(ipAddress, "ip should not be null"); this.macAddress = macAddress; this.ipAddress = ipAddress; }
Source:
protected void recordCapabilitiesAndRequirements(OperationContext context, AttributeDefinition attributeDefinition, ModelNode newValue, ModelNode oldValue) { super.recordCapabilitiesAndRequirements(context, attributeDefinition, newValue, oldValue); if (oldValue.isDefined()) { context.deregisterCapability(DEFAULT_TRACER_CAPABILITY.getDynamicName(oldValue.asString())); } if (newValue.isDefined()) { context.registerCapability(RuntimeCapability.Builder.of(DEFAULT_TRACER_CAPABILITY.getDynamicName(newValue.asString()), false).build()); } }

Target:
protected void recordCapabilitiesAndRequirements(OperationContext context, AttributeDefinition attributeDefinition, ModelNode newValue, ModelNode oldValue) { if (oldValue.isDefined()) { context.deregisterCapability(DEFAULT_TRACER_CAPABILITY_NAME); } if (newValue.isDefined()) { context.registerCapability(DEFAULT_TRACER_CAPABILITY); } }
Source:
public void verifySectionVisibility(){ waitForElementByElement(sectionVisibilityElement); PageObjectLogging.log("verifySectionVisibility", "section is opened and visible", true, driver); }

Target:
public void verifySectionVisibility(){ waitForElementByElement(sectionVisibilityElement); PageObjectLogging.log("verifySectionVisibility", "section is opened and visible", true); }
Source:
private Constraint processMoveCost(ConstraintFactory factory) { return factory.from(MrProcessAssignment.class) .filter(MrProcessAssignment::isMoved) .penalizeLong(MrConstraints.PROCESS_MOVE_COST, HardSoftLongScore.ofSoft(1L), MrProcessAssignment::getProcessMoveCost); }

Target:
private Constraint processMoveCost(ConstraintFactory factory) { return factory.from(MrProcessAssignment.class) .filter(MrProcessAssignment::isMoved) .penalizeLong(MrConstraints.PROCESS_MOVE_COST, HardSoftLongScore.ONE_SOFT, MrProcessAssignment::getProcessMoveCost); }
Source:
PendingAddOp(LedgerHandle lh, AddCallback cb, Object ctx) { this.lh = lh; this.cb = cb; this.ctx = ctx; this.entryId = LedgerHandle.INVALID_ENTRY_ID; writeSet = new int[lh.metadata.getWriteQuorumSize()]; Arrays.fill(writeSet, -12345); this.ackSet = lh.distributionSchedule.getAckSet(); this.addOpLogger = lh.bk.getAddOpLogger(); this.timeoutSec = lh.bk.getConf().getAddEntryQuorumTimeout(); }

Target:
PendingAddOp(LedgerHandle lh, AddCallback cb, Object ctx) { this.lh = lh; this.cb = cb; this.ctx = ctx; this.entryId = LedgerHandle.INVALID_ENTRY_ID; this.ackSet = lh.distributionSchedule.getAckSet(); this.addOpLogger = lh.bk.getAddOpLogger(); this.timeoutSec = lh.bk.getConf().getAddEntryQuorumTimeout(); }
Source:
private String getDefaultAllowedOrigins() throws ServletException { VdcQueryReturnValue value = backend.runPublicQuery(VdcQueryType.GetDefaultAllowedOrigins, new VdcQueryParametersBase()); if (!value.getSucceeded()) { throw new ServletException("Can't get list of default origins"); } return value.getReturnValue(); }

Target:
private Set<String> getDefaultAllowedOrigins() throws ServletException { GetDefaultAllowedOriginsQueryParameters parameters = new GetDefaultAllowedOriginsQueryParameters(); parameters.addSuffix(":9090"); VdcQueryReturnValue value = backend.runPublicQuery(VdcQueryType.GetDefaultAllowedOrigins, parameters); if (!value.getSucceeded()) { throw new ServletException("Can't get list of default origins"); } log.debug("Origins allowed by default: {}", StringUtils.join((Set<String>)value.getReturnValue(), ',')); return value.getReturnValue(); }
Source:
public void destroy() { super.destroy(); if (transport != null) { try { transport.close(); } catch (IOException e) { log.debug("Error when closing graphite socket: ", e); } } transport = null; }

Target:
public void destroy() { super.destroy(); if (transport != null) { try { transport.close(); } catch (IOException e) { log.debug("Error when closing Datadog client: ", e); } transport = null; } }
Source:
public void fetchEncodings() throws Exception { List<String> encodings = newArrayList("UTF-8", "UTF-16"); driver.addExpectation(onRequestTo("/r/nai-realms/encodings").withMethod(GET), returnResponse(encodings)); List<String> got = client.fetchEncodings(); assertThat(got, deepEquals(encodings)); }

Target:
public void fetchEncodings() throws Exception { List<String> want = newArrayList("UTF-8", "UTF-16"); driver.addExpectation(onRequestTo("/r/nai-realms/encodings").withMethod(GET), returnResponse(want)); List<String> got = client.fetchEncodings(); assertThat(got, deepEquals(want)); }
Source:
public Long getUuid() { return new Long(self.getArtId()); }

Target:
public Long getUuid() { return Long.valueOf(self.getArtId()); }
Source:
public void run() { ViewPagerDownloadManager.instance.done(this, true); }

Target:
public void run() { }
Source:
public void init() { createEditor(); filterListEditor.hideLabel(); initWidget(ViewUiBinder.uiBinder.createAndBindUi(this)); }

Target:
public void init() { filterListEditor = createFilterListEditor(); filterListEditor.hideLabel(); initWidget(ViewUiBinder.uiBinder.createAndBindUi(this)); addSelectedItemButton.addStyleName(Styles.PULL_RIGHT); }
Source:
public List<UserDto> getAllOrgaMembers() { List<UserDto> result = new ArrayList(); userService.findAllOrgaMembers().forEach(u -> result.add(userConverter.toDto(u))); return result; }

Target:
public List<UserDto> getAllOrgaMembers() { return userService .findAllOrgaMembers() .stream() .map(userConverter::toDto) .collect(Collectors.toList()); }
Source:
private List<ModuleLaunchRequest> toModuleLaunchRequests(ModuleLauncherProperties moduleLauncherProperties) { List<ModuleLaunchRequest> requests = new ArrayList<>(); String[] modules = moduleLauncherProperties.getModules(); Map<Integer, Map<String, String>> arguments = moduleLauncherProperties.getArgs(); for (int i = 0; i < moduleLauncherProperties.getModules().length; i++) { ModuleLaunchRequest moduleLaunchRequest = new ModuleLaunchRequest(modules[i], arguments.get(i)); requests.add(moduleLaunchRequest); } return requests; }

Target:
private List<ModuleLaunchRequest> toModuleLaunchRequests(ModuleLauncherProperties moduleLauncherProperties) { List<ModuleLaunchRequest> requests = new ArrayList<>(); String[] modules = moduleLauncherProperties.getModules(); Map<Integer, Map<String, String>> arguments = moduleLauncherProperties.getArgs(); for (int i = 0; i < modules.length; i++) { ModuleLaunchRequest moduleLaunchRequest = new ModuleLaunchRequest(modules[i], arguments.get(i)); requests.add(moduleLaunchRequest); } return requests; }
Source:
public void enableSSL() { if (!m_enableSSL || m_sslContextRef.get() != null) return; synchronized (m_sslContextRef) { try { m_sslContextRef.set(SSLConfiguration.initializeSslContext(m_sslConfig)); } catch (IOException | NoSuchAlgorithmException | KeyStoreException | CertificateException | UnrecoverableKeyException | KeyManagementException ex) { throw new IllegalArgumentException("Failed to initialize SSL from config file: " + m_sslPropsFile, ex); } } }

Target:
public void enableSSL() { m_enableSSL = true; if (m_sslConfig == null) { m_sslConfig = new SSLConfiguration.SslConfig(); } }
Source:
public void testPairedIntervalFilter(final String intervalFilename, final int expectNumber) throws Exception { final File inputSam = File.createTempFile("testSam", ".sam", TEST_DIR); inputSam.deleteOnExit(); final SAMFileWriter writer = new SAMFileWriterFactory() .setCreateIndex(true).makeBAMWriter(builder.getHeader(), false, inputSam); for (final SAMRecord record : builder) { writer.addAlignment(record); } writer.close(); final File intervalFile = new File(intervalFilename); final FilterSamReads program = new FilterSamReads(); program.INPUT = inputSam; program.OUTPUT = File.createTempFile("FilterSamReads.output.", ".sam"); program.OUTPUT.deleteOnExit(); program.FILTER = FilterSamReads.Filter.includePairedIntervals; program.INTERVAL_LIST = intervalFile; Assert.assertEquals(program.doWork(),0); final SamReader samReader = SamReaderFactory.makeDefault().open(program.OUTPUT); final SAMRecordIterator iter = samReader.iterator(); int count = 0; while (iter.hasNext()) { iter.next(); ++ count; } iter.close(); samReader.close(); Assert.assertEquals(count, expectNumber); }

Target:
public void testPairedIntervalFilter(final String intervalFilename, final int expectNumber) throws Exception { final File inputSam = File.createTempFile("testSam", ".sam", TEST_DIR); inputSam.deleteOnExit(); final SAMFileWriter writer = new SAMFileWriterFactory() .setCreateIndex(true).makeBAMWriter(builder.getHeader(), false, inputSam); for (final SAMRecord record : builder) { writer.addAlignment(record); } writer.close(); final File intervalFile = new File(intervalFilename); FilterSamReads filterTest = setupProgram(intervalFile, inputSam, FilterSamReads.Filter.includePairedIntervals); Assert.assertEquals(filterTest.doWork(),0); long count = getReadCount(filterTest); Assert.assertEquals(count, expectNumber); }
Source:
public void filterRegisteredTest() throws Exception { WebTarget base = client.target(generateURL("/") + "testIt"); Response response = base.request().get(); Assert.assertEquals(404, response.getStatus()); }

Target:
public void filterRegisteredTest() throws Exception { WebTarget base = client.target(generateURL("/") + "testIt"); Response response = base.request().get(); Assert.assertEquals(456, response.getStatus()); }