auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public static Slice jsonToLongDecimal(Slice json, long precision, long scale, BigInteger tenToScale) throws IOException { try (JsonParser parser = createJsonParser(JSON_FACTORY, json)) { parser.nextToken(); Slice result = castTokenAsLongDecimal(parser, intPrecision(precision), intScale(scale)); checkCondition(parser.nextToken() == null, INVALID_CAST_ARGUMENT, "Cannot cast input json to DECIMAL(%s,%s)", precision, scale); return result; } catch (IOException | NumberFormatException | PrestoException e) { throw new PrestoException(INVALID_CAST_ARGUMENT, format("Cannot cast '%s' to DECIMAL(%s,%s)", json.toStringUtf8(), precision, scale), e); } }

Target:
public static Slice jsonToLongDecimal(Slice json, long precision, long scale, BigInteger tenToScale) throws IOException { try (JsonParser parser = createJsonParser(JSON_FACTORY, json)) { parser.nextToken(); Slice result = currentTokenAsLongDecimal(parser, intPrecision(precision), intScale(scale)); checkCondition(parser.nextToken() == null, INVALID_CAST_ARGUMENT, "Cannot cast input json to DECIMAL(%s,%s)", precision, scale); return result; } catch (IOException | NumberFormatException | JsonCastException e) { throw new PrestoException(INVALID_CAST_ARGUMENT, format("Cannot cast '%s' to DECIMAL(%s,%s)", json.toStringUtf8(), precision, scale), e); } }
Source:
private List<Target<Object>> createTargets(ControllerMethod method) { Method javaMethod = method.getMethod(); List<Target<Object>> targets = new ArrayList<>(); TypeExtractor typeExtractor = new TypeExtractor(method.getController().getType()); for (Parameter p : nameProvider.parametersFor(javaMethod)) { Type type = p.getParameterizedType(); if (type instanceof TypeVariable) { type = typeExtractor.extractType(type); } targets.add(new Target<>(type, p.getName())); } return targets; }

Target:
private List<Target<Object>> createTargets(ControllerMethod method) { Method javaMethod = method.getMethod(); List<Target<Object>> targets = new ArrayList<>(); for (Parameter p : nameProvider.parametersFor(javaMethod)) { Type type = p.getParameterizedType(); if (type instanceof TypeVariable) { type = extractType(method, (TypeVariable<?>) type); } targets.add(new Target<>(type, p.getName())); } return targets; }
Source:
public void unset(int x, int y) { int offset = y * rowSize + (x / 32); int intMask = (1 << (x & 0x1f)); if ((bits[offset] & intMask) > 0) { bits[offset] ^= intMask; } }

Target:
public void unset(int x, int y) { int offset = y * rowSize + (x / 32); bits[offset] &= ~(1 << (x & 0x1f)); }
Source:
protected boolean matchesSafely(Errors item) { if (code == null) { return item.hasGlobalErrors(); } else { return item.getGlobalErrors().stream().anyMatch(c -> code.equals(c.getCode())); } }

Target:
protected boolean matchesSafely(Errors item) { if (code == null) { return item.hasGlobalErrors(); } else { return item.getGlobalErrors().stream().filter(c -> code.equals(c.getCode())).findFirst().isPresent(); } }
Source:
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ((WordPress) getApplication()).component().inject(this); setContentView(R.layout.post_list_activity); mIsPage = getIntent().getBooleanExtra(EXTRA_VIEW_PAGES, false); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setTitle(getString(mIsPage ? R.string.pages : R.string.posts)); actionBar.setDisplayShowTitleEnabled(true); actionBar.setDisplayHomeAsUpEnabled(true); } FragmentManager fm = getFragmentManager(); if (savedInstanceState == null) { mSite = (SiteModel) getIntent().getSerializableExtra(WordPress.SITE); } else { mSite = (SiteModel) savedInstanceState.getSerializable(WordPress.SITE); } if (mSite == null) { mSite = mSiteStore.getSiteByLocalId(AppPrefs.getSelectedSite()); } if (mSite == null) { ToastUtils.showToast(this, R.string.blog_not_found, ToastUtils.Duration.SHORT); finish(); return; } mPostList = (PostsListFragment) fm.findFragmentById(R.id.postList); showErrorDialogIfNeeded(getIntent().getExtras()); }

Target:
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ((WordPress) getApplication()).component().inject(this); setContentView(R.layout.post_list_activity); mIsPage = getIntent().getBooleanExtra(EXTRA_VIEW_PAGES, false); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setTitle(getString(mIsPage ? R.string.pages : R.string.posts)); actionBar.setDisplayShowTitleEnabled(true); actionBar.setDisplayHomeAsUpEnabled(true); } FragmentManager fm = getFragmentManager(); if (savedInstanceState == null) { mSite = (SiteModel) getIntent().getSerializableExtra(WordPress.SITE); } else { mSite = (SiteModel) savedInstanceState.getSerializable(WordPress.SITE); } if (mSite == null) { ToastUtils.showToast(this, R.string.blog_not_found, ToastUtils.Duration.SHORT); finish(); return; } mPostList = (PostsListFragment) fm.findFragmentById(R.id.postList); showErrorDialogIfNeeded(getIntent().getExtras()); }
Source:
public static Set<Class<?>> scanPackage(ClassLoader classLoader, String pkg) throws IOException { Reflections reflections = new Reflections(new ConfigurationBuilder() .addUrls(ClasspathHelper.forPackage(pkg, classLoader)) .addClassLoader(classLoader) .setScanners(new SubTypesScanner(false)) .setMetadataAdapter(new JavaReflectionAdapter())); Set<Class<?>> classes = new HashSet<Class<?>>(); for (String typeNames : reflections.getStore().get(SubTypesScanner.class.getSimpleName()).values()) { Class<?> clazz = safeClassForName(classLoader, typeNames); if (clazz != null) { classes.add(clazz); } } return classes; }

Target:
public static Set<Class<?>> scanPackage(ClassLoader classLoader, String pkg) throws IOException { Reflections reflections = new Reflections(new ConfigurationBuilder() .addUrls(ClasspathHelper.forPackage(pkg, classLoader)) .addClassLoader(classLoader) .setScanners(new SubTypesScanner(false))); Set<Class<?>> classes = new HashSet<Class<?>>(); for (String typeNames : reflections.getStore().get(SubTypesScanner.class.getSimpleName()).values()) { Class<?> clazz = safeClassForName(classLoader, typeNames); if (clazz != null) { classes.add(clazz); } } return classes; }
Source:
public void testCreateClassificationRequest() { final FlowDocument flowDocument = new FlowDocument(); ClassificationRequest classificationRequest; classificationRequest = enricher.createClassificationRequest(flowDocument); assertFalse(classificationRequest.isClassifiable()); flowDocument.setDstPort(123); classificationRequest = enricher.createClassificationRequest(flowDocument); assertFalse(classificationRequest.isClassifiable()); flowDocument.setSrcPort(456); classificationRequest = enricher.createClassificationRequest(flowDocument); assertFalse(classificationRequest.isClassifiable()); flowDocument.setProtocol(6); classificationRequest = enricher.createClassificationRequest(flowDocument); assertTrue(classificationRequest.isClassifiable()); }

Target:
public void testCreateClassificationRequest() { final FlowDocument flowDocument = new FlowDocument(); ClassificationRequest classificationRequest; classificationRequest = enricher.createClassificationRequest(flowDocument); assertEquals(false, classificationRequest.isClassifiable()); flowDocument.setDstPort(123); classificationRequest = enricher.createClassificationRequest(flowDocument); assertEquals(false, classificationRequest.isClassifiable()); flowDocument.setSrcPort(456); classificationRequest = enricher.createClassificationRequest(flowDocument); assertEquals(false, classificationRequest.isClassifiable()); flowDocument.setProtocol(6); classificationRequest = enricher.createClassificationRequest(flowDocument); assertEquals(true, classificationRequest.isClassifiable()); }
Source:
public void testLoadCacheWrongRepository() throws Exception { BugzillaRestConnector connector = new BugzillaRestConnector(); assertNotNull(connector); assertEquals(connector, BugzillaRestConnector.getDefault()); TaskRepository taskRepository = new TaskRepository(BugzillaRestConnector.getDefault().getConnectorKind(), "<LINK_0>"); AuthenticationCredentials credentials = new AuthenticationCredentials("username", "password"); taskRepository.setCredentials(AuthenticationType.REPOSITORY, credentials, false); BugzillaRestConfiguration configuration = BugzillaRestConnector.getDefault().getRepositoryConfiguration( taskRepository); assertNull(configuration); }

Target:
public void testLoadCacheWrongRepository() throws Exception { TaskRepository taskRepository = new TaskRepository(connector.getConnectorKind(), "<LINK_0>"); AuthenticationCredentials credentials = new AuthenticationCredentials("username", "password"); taskRepository.setCredentials(AuthenticationType.REPOSITORY, credentials, false); BugzillaRestConfiguration configuration = connector.getRepositoryConfiguration(taskRepository); assertNull(configuration); }
Source:
private CurrentWsResponse.Homepage findHomepageFor(DbSession dbSession, UserDto user) { CurrentWsResponse.Homepage homepage = null; if (isNotBlank(user.getHomepageType())) { homepage = homepageOf(dbSession, user); } return homepage != null ? homepage : defaultHomepageOf(); }

Target:
private CurrentWsResponse.Homepage findHomepageFor(DbSession dbSession, UserDto user) { if (user.getHomepageType() == null) { return defaultHomepageOf(); } String homepageValue = getHomepageValue(dbSession, user.getHomepageType(), user.getHomepageValue()); CurrentWsResponse.Homepage.Builder homepage = CurrentWsResponse.Homepage.newBuilder() .setType(CurrentWsResponse.HomepageType.valueOf(user.getHomepageType())); setNullable(homepageValue, homepage::setValue); return homepage.build(); }
Source:
public void validateDefaultRepresentation() throws Exception { super.validateDefaultRepresentation(); assertPropPresent("encounter_id"); assertPropPresent("condition_id"); assertPropPresent("certainty"); assertPropPresent("rank"); assertPropPresent("creator"); assertPropPresent("date_created"); assertPropPresent("voided"); }

Target:
public void validateDefaultRepresentation() throws Exception { super.validateDefaultRepresentation(); assertPropPresent("uuid"); assertPropEquals("diagnosis", getObject().getDiagnosis()); assertPropPresent("patient"); assertPropPresent("condition"); assertPropPresent("encounter"); assertPropEquals("certainty", getObject().getCertainty()); assertPropEquals("rank", getObject().getRank()); assertPropEquals("voided", getObject().getVoided()); assertPropPresent("display"); }
Source:
public void testCachedConnections() throws Exception { final String tableName = generateUniqueName(); final String index1Name = generateUniqueName(); final Connection conn = DriverManager.getConnection(getUrl()); final HBaseAdmin admin = getUtility().getHBaseAdmin(); final MiniHBaseCluster cluster = getUtility().getHBaseCluster(); final HRegionServer regionServer = cluster.getRegionServer(0); Configuration conf = admin.getConfiguration(); final int noOfOrgs = 20; final AtomicBoolean flag = new AtomicBoolean(); flag.set(false); String createTableSql = "CREATE TABLE " + tableName + "(org_id VARCHAR NOT NULL PRIMARY KEY, v1 INTEGER, v2 INTEGER, v3 INTEGER) VERSIONS=1 SPLIT ON ('" + ORG_PREFIX + "-" + noOfOrgs / 2 + "')"; conn.createStatement().execute(createTableSql); conn.createStatement().execute("CREATE INDEX " + index1Name + " ON " + tableName + "(v1)"); List<HRegionInfo> regions = admin.getTableRegions(TableName.valueOf(tableName)); final HRegionInfo regionInfo = regions.get(0); writeToTable(tableName, conn, noOfOrgs); Thread.sleep(1000); int beforeRegionCloseCount = getActiveConnections(regionServer, conf); int regionsCount = admin.getOnlineRegions(regionServer.getServerName()).size(); admin.unassign(regionInfo.getEncodedNameAsBytes(), true); while(!(admin.getOnlineRegions(regionServer.getServerName()).size() < regionsCount)); int afterRegionCloseCount = getActiveConnections(regionServer, conf); assertTrue("Cached connections not closed when region closes: ", afterRegionCloseCount == beforeRegionCloseCount && afterRegionCloseCount > 0); }

Target:
public void testCachedConnections() throws Exception { final String tableName = generateUniqueName(); final String index1Name = generateUniqueName(); final Connection conn = DriverManager.getConnection(getUrl()); final HBaseAdmin admin = getUtility().getHBaseAdmin(); final MiniHBaseCluster cluster = getUtility().getHBaseCluster(); final HRegionServer regionServer = cluster.getRegionServer(0); Configuration conf = admin.getConfiguration(); final int noOfOrgs = 20; final AtomicBoolean flag = new AtomicBoolean(); flag.set(false); String createTableSql = "CREATE TABLE " + tableName + "(org_id VARCHAR NOT NULL PRIMARY KEY, v1 INTEGER, v2 INTEGER, v3 INTEGER) VERSIONS=1 SPLIT ON ('" + ORG_PREFIX + "-" + noOfOrgs / 2 + "')"; conn.createStatement().execute(createTableSql); conn.createStatement().execute("CREATE INDEX " + index1Name + " ON " + tableName + "(v1)"); List<HRegionInfo> regions = admin.getTableRegions(TableName.valueOf(tableName)); final HRegionInfo regionInfo = regions.get(0); writeToTable(tableName, conn, noOfOrgs); int beforeRegionCloseCount = getActiveConnections(regionServer, conf); int regionsCount = admin.getOnlineRegions(regionServer.getServerName()).size(); admin.unassign(regionInfo.getEncodedNameAsBytes(), true); while(!(admin.getOnlineRegions(regionServer.getServerName()).size() < regionsCount)); int afterRegionCloseCount = getActiveConnections(regionServer, conf); assertTrue("Cached connections not closed when region closes: ", afterRegionCloseCount == beforeRegionCloseCount && afterRegionCloseCount > 0); }
Source:
private ComplaintEntity getEntityById(Long id) throws EntityRetrievalException { ComplaintEntity entity = null; Query query = entityManager.createQuery("FROM ComplaintEntity c " + "JOIN FETCH c.certificationBody " + "LEFT JOIN FETCH c.complaintType " + "LEFT JOIN FETCH c.complaintStatusType " + "WHERE c.deleted = false " + "AND c.id = :complaintId", ComplaintEntity.class); query.setParameter("complaintId", id); List<ComplaintEntity> result = query.getResultList(); if (result.size() > 1) { throw new EntityRetrievalException("Data error. Duplicate filter id in database."); } else if (result.size() == 1) { entity = result.get(0); } return entity; }

Target:
private ComplaintEntity getEntityById(Long id) throws EntityRetrievalException { ComplaintEntity entity = null; Query query = entityManager.createQuery("FROM ComplaintEntity c " + "JOIN FETCH c.certificationBody " + "LEFT JOIN FETCH c.complaintType " + "LEFT JOIN FETCH c.complaintStatusType " + "WHERE c.deleted = false " + "AND c.id = :complaintId", ComplaintEntity.class); query.setParameter("complaintId", id); List<ComplaintEntity> result = query.getResultList(); if (result.size() > 1) { throw new EntityRetrievalException("Data error. Duplicate complaint id in database."); } else if (result.size() == 1) { entity = result.get(0); } return entity; }
Source:
public WordTemplateContentRendererHandler(OrcsApi orcsApi, Log logger) { this.orcsApi = orcsApi; this.logger = logger; this.applicHandler = null; }

Target:
public WordTemplateContentRendererHandler(OrcsApi orcsApi, Log logger) { this.orcsApi = orcsApi; this.logger = logger; }
Source:
protected EntityTag createEntityTag(RequestContext rc, String firstId, String lastId) { Set<String> postfixSet = new HashSet<String>(); String headerName = getHeaderName(); if ( headerName != null ) { Object[] roles = rc.getHeaders(headerName); if ( roles != null ) { for (int idx = 0; idx<roles.length; idx++) { if ( roles[idx] != null ) { String aRole = roles[idx].toString(); String postfix = headerTagPostfixMap.get(aRole); if ( postfix != null ) postfixSet.add(postfix); } } } } String allPostfix = StringUtils.join(postfixSet, ","); return new EntityTag(firstId + ":" + lastId + ":" + allPostfix, true); }

Target:
protected EntityTag createEntityTag(RequestContext rc, String firstId, String lastId) { Set<String> postfixSet = new HashSet<String>(); String headerName = getHeaderName(); if ( headerName != null ) { Object[] roles = rc.getHeaders(headerName); if ( roles != null ) { for (Object aRole: roles) { String postfix = headerTagPostfixMap.get(aRole); if ( postfix != null ) postfixSet.add(postfix); } } } String allPostfix = StringUtils.join(postfixSet, ","); return new EntityTag(firstId + ":" + lastId + ":" + allPostfix, true); }
Source:
private static ZipInfoProperties checkFile(String filename) { InputStream bis = null; ZipFile zf = null; try { zf = new ZipFile(filename); ZipEntry thisEntry = null; for (String infoName : infoNames) { thisEntry = zf.getEntry(infoName); if (thisEntry != null) { break; } } if (thisEntry == null) { zf.close(); return null; } bis = zf.getInputStream(thisEntry); if (bis == null) { zf.close(); return null; } ZipInfoProperties zip = new ZipInfoProperties(ProductVersionHolder.getProductVersionHolderFromMyEnv(bis)); zip.setLocation(getCanonicalPath(new File(filename)).replace('/', File.separatorChar)); bis.close(); zf.close(); return zip; } catch (IOException ioe) { return null; } finally { if(bis != null) { try { bis.close(); } catch (IOException e) { } try { zf.close(); } catch (IOException e) { } } } }

Target:
private static ZipInfoProperties checkFile(String filename) { try(ZipFile zf = new ZipFile(filename)) { ZipEntry thisEntry = null; for (String infoName : infoNames) { thisEntry = zf.getEntry(infoName); if (thisEntry != null) { break; } } if (thisEntry == null) { return null; } ZipInfoProperties zip; try(InputStream bis = zf.getInputStream(thisEntry)) { zip = new ZipInfoProperties(ProductVersionHolder.getProductVersionHolderFromMyEnv(bis)); zip.setLocation(getCanonicalPath(new File(filename)).replace('/', File.separatorChar)); } return zip; } catch (IOException ioe) { return null; } }
Source:
public int compare(UserAlert a0, UserAlert a1) { if(a0 == a1) return 0; short prio0 = a0.getPriorityClass(); short prio1 = a1.getPriorityClass(); if(prio0 - prio1 == 0) { boolean isEvent0 = a0.isEventNotification(); boolean isEvent1 = a1.isEventNotification(); if(isEvent0 && !isEvent1) return 1; if((!isEvent0) && isEvent1) return -1; int classHash0 = a0.getClass().hashCode(); int classHash1 = a1.getClass().hashCode(); if(classHash0 > classHash1) return 1; else if(classHash0 < classHash1) return -1; boolean isN2NTM0 = a0 instanceof N2NTMUserAlert; boolean isN2NTM1 = a1 instanceof N2NTMUserAlert; if(isN2NTM0 && isN2NTM1) { if(a0.getUpdatedTime() < a1.getUpdatedTime()) return 1; else if(a0.getUpdatedTime() > a1.getUpdatedTime()) return -1; } int hash0 = a0.hashCode(); int hash1 = a1.hashCode(); if(hash0 > hash1) return 1; if(hash1 > hash0) return -1; return 0; } else { if(prio0 > prio1) return 1; else return -1; } }

Target:
public int compare(UserAlert a0, UserAlert a1) { if(a0 == a1) return 0; short prio0 = a0.getPriorityClass(); short prio1 = a1.getPriorityClass(); if(prio0 - prio1 == 0) { boolean isEvent0 = a0.isEventNotification(); boolean isEvent1 = a1.isEventNotification(); if(isEvent0 && !isEvent1) return 1; if((!isEvent0) && isEvent1) return -1; int classHash0 = a0.getClass().hashCode(); int classHash1 = a1.getClass().hashCode(); if(classHash0 > classHash1) return 1; else if(classHash0 < classHash1) return -1; if(a0.getUpdatedTime() < a1.getUpdatedTime()) return 1; else if(a0.getUpdatedTime() > a1.getUpdatedTime()) return -1; int hash0 = a0.hashCode(); int hash1 = a1.hashCode(); if(hash0 > hash1) return 1; if(hash1 > hash0) return -1; return 0; } else { if(prio0 > prio1) return 1; else return -1; } }
Source:
public boolean showMuteOverlayOnVideoCall() { if (carrierConfig == null) { return false; } return carrierConfig.getBoolean(CarrierConfigManager.KEY_VIDEO_CALL_MUTE_OVERLAY_VISIBLE_BOOL); }

Target:
public boolean showMuteOverlayOnVideoCall() { if (carrierConfig == null) { return true; } return carrierConfig.getBoolean(CarrierConfigManager.KEY_VIDEO_CALL_MUTE_OVERLAY_VISIBLE_BOOL); }
Source:
private void setDefaultDnsSystemProperties(Collection<InetAddress> dnses) { int last = 0; for (InetAddress dns : dnses) { ++last; String key = "net.dns" + last; String value = dns.getHostAddress(); try { mSystemProperties.set(key, value); } catch (Exception ignored) } for (int i = last + 1; i <= mNumDnsEntries; ++i) { String key = "net.dns" + i; try { mSystemProperties.set(key, ""); } catch (Exception ignored) } mNumDnsEntries = last; }

Target:
private void setDefaultDnsSystemProperties(Collection<InetAddress> dnses) { int last = 0; for (InetAddress dns : dnses) { ++last; setNetDnsProperty(last, dns.getHostAddress()); } for (int i = last + 1; i <= mNumDnsEntries; ++i) { setNetDnsProperty(i, ""); } mNumDnsEntries = last; }
Source:
private void addMethodToClass(ICPPClassType classType, Method method) { if (!isDuplicate(method)) { List<Method> methods = fData.get(classType); if (methods == null) { methods = new ArrayList<>(); methods.add(method); fData.put(classType, methods); } else { methods.add(method); } } }

Target:
private void addMethodToClass(ICPPClassType classType, Method method) { if (!isDuplicate(method)) { List<Method> methods = fData.get(classType); if (methods == null) { methods = new ArrayList<>(); fData.put(classType, methods); } methods.add(method); } }
Source:
private ArrayList<DiskImage> mockMultipleSourceImagesForDomain(int numberOfDisks, Guid storageDomainId, int actualDiskSize) { ArrayList<DiskImage> listDisks = new ArrayList<DiskImage>(); for (int index=0; index < numberOfDisks; index++) { Guid imageId = Guid.NewGuid(); DiskImage image = new DiskImage(); image.setImageId(imageId); ArrayList<Guid> list = new ArrayList<Guid>(); list.add(storageDomainId); image.setstorage_ids(list); image.setActualSize(actualDiskSize); listDisks.add(image); } return listDisks; }

Target:
private static List<DiskImage> mockMultipleSourceImagesForDomain(int numberOfDisks, Guid storageDomainId, int actualDiskSize) { List<DiskImage> listDisks = new ArrayList<DiskImage>(); for (int index=0; index < numberOfDisks; index++) { Guid imageId = Guid.NewGuid(); DiskImage image = new DiskImage(); image.setImageId(imageId); ArrayList<Guid> list = new ArrayList<Guid>(); list.add(storageDomainId); image.setstorage_ids(list); image.setActualSize(actualDiskSize); listDisks.add(image); } return listDisks; }
Source:
private void addTopLevelToContainer(String pid) throws DepositException { if (!topLevelPids.contains(pid)) return; try { client.addResourceStatement(destinationPID, Relationship.contains.getURI().toString(), new PID(pid).getURI()); } catch (FedoraException e) { throw new DepositException("Failed to add object " + pid + " to destination " + destinationPID.getPid(), e); } }

Target:
private void addTopLevelToContainer(String pid) throws DepositException { if (!topLevelPids.contains(pid)) return; try { client.addObjectRelationship(destinationPID, Relationship.contains.getURI().toString(), new PID(pid)); } catch (FedoraException e) { throw new DepositException("Failed to add object " + pid + " to destination " + destinationPID.getPid(), e); } }
Source:
private void triggerTest(String packageName, boolean applyGroupSelectionAtTest) { TestNG tng = new TestNG(); tng.setVerbose(0); final XmlSuite suite = new XmlSuite(); suite.setName("1297_suite"); final XmlPackage xmlPackage = new XmlPackage(); xmlPackage.setName(packageName); final XmlTest xmlTest = new XmlTest(suite); xmlTest.setName("1297_test"); if (applyGroupSelectionAtTest) { xmlTest.setGroups(getGroup()); } else { suite.setGroups(getGroup()); } xmlTest.setPackages(new ArrayList<XmlPackage>(){{add(xmlPackage);}}); suite.setTests(new ArrayList<XmlTest>(){{add(xmlTest);}}); tng.setXmlSuites(new ArrayList<XmlSuite>(){{add(suite);}}); tng.setOutputDirectory(mTempDirectory.getAbsolutePath()); tng.run(); }

Target:
private void triggerTest(String packageName, boolean applyGroupSelectionAtTest) { final XmlSuite suite = createXmlSuite("1297_suite"); final XmlTest xmlTest = createXmlTestWithPackages(suite, "1297_test", packageName); XmlGroups groups = createGroupIncluding("run"); if (applyGroupSelectionAtTest) { xmlTest.setGroups(groups); } else { suite.setGroups(groups); } TestNG tng = create(mTempDirectory.toPath(), suite); tng.setUseDefaultListeners(true); tng.run(); }
Source:
public void setDate(long columnIndex, long rowIndex, Date value){ if (parent.isImmutable()) throwImmutable(); nativeSetTimestampValue(nativePtr, columnIndex, rowIndex, value.getTime()/1000); }

Target:
public void setDate(long columnIndex, long rowIndex, Date value){ if (parent.isImmutable()) throwImmutable(); nativeSetTimestampValue(nativePtr, columnIndex, rowIndex, value.getTime()); }
Source:
public void testInitWithMultiMarkerClass() { if (!SecureLogging.hasExtClass()) return; assertTrue("this test fails if the dependency org.owasp is not available.", SecureLogging.hasExtClass()); Marker multiMarker = SecureLogging.SECURITY_SUCCESS_CONFIDENTIAL; Marker securMarker = SecureLogging.SECURITY_SUCCESS; Marker confidMarker = SecureLogging.CONFIDENTIAL; assertTrue("MultiMarker must have references.", multiMarker.hasReferences()); assertTrue("MultiMarker must contain both of its constituent Markers.", multiMarker.contains(securMarker)); assertTrue("MultiMarker must contain both of its constituent Markers.", multiMarker.contains(confidMarker)); }

Target:
public void testInitWithMultiMarkerClass() { if (!SecureLogging.hasExtClass()) { return; } assertThat(SecureLogging.hasExtClass()).as("dependency org.owasp is available.").isTrue(); Marker multiMarker = SecureLogging.SECURITY_SUCCESS_CONFIDENTIAL; Marker securMarker = SecureLogging.SECURITY_SUCCESS; Marker confidMarker = SecureLogging.CONFIDENTIAL; assertThat(multiMarker.hasReferences()).as("MultiMarker has references.").isTrue(); assertThat(multiMarker.contains(securMarker)).as("MultiMarker contains Security Marker.").isTrue(); assertThat(multiMarker.contains(confidMarker)).as("MultiMarker contains Confidential Marker.").isTrue(); }
Source:
protected void runAutonomous() throws InterruptedException, AutonomousModeOverException { float startAngle = HeadingSensor.absoluteYaw.get(); setClampOpen(true); waitUntilNot(Clamp.waitingForAutoCalibration); startSetClampHeight(0.4f); collectTote(shake.get(), 3500); setClampHeight(0.0f); singleSideTurn((long) (containerTurnTime.get() * 1000), true); pickupContainer(nudge.get()); float nextAngle = HeadingSensor.absoluteYaw.get(); turnAbsolute(startAngle, -autoZoneAngle.get(), true); waitForTime(500); float curAngle = HeadingSensor.absoluteYaw.get(); Logger.info("Actual angle: " + (curAngle - startAngle) + " based on " + startAngle + "/" + nextAngle + "/" + curAngle); float now = Utils.getCurrentTimeSeconds(); Logger.info("Setting to mechanum: " + DriveCode.leftEncoder.get() + " and " + autoZoneDistance.get()); DriveCode.octocanumShifting.set(true); drive(autoZoneDistance.get(), autoZoneSpeed.get()); Rollers.closed.set(false); driveForTime((long) (autoZoneTime.get() * 1000), autoZoneSpeed.get()); Logger.info("Setting to traction: " + (Utils.getCurrentTimeSeconds() - now) + ": " + DriveCode.leftEncoder.get()); DriveCode.octocanumShifting.set(false); }

Target:
protected void runAutonomous() throws InterruptedException, AutonomousModeOverException { float startAngle = HeadingSensor.absoluteYaw.get(); setClampOpen(true); waitUntilNot(Clamp.waitingForAutoCalibration); startSetClampHeight(0.4f); collectTote(shake.get(), (int) (toteCollectTime.get() * 1000)); setClampHeight(0.0f); singleSideTurn((long) (containerTurnTime.get() * 1000), true); pickupContainer(nudge.get()); float nextAngle = HeadingSensor.absoluteYaw.get(); turnAbsolute(startAngle, -autoZoneAngle.get(), true); waitForTime(500); float curAngle = HeadingSensor.absoluteYaw.get(); Logger.info("Actual angle: " + (curAngle - startAngle) + " based on " + startAngle + "/" + nextAngle + "/" + curAngle); float now = Utils.getCurrentTimeSeconds(); Logger.info("About to drive: " + DriveCode.leftEncoder.get() + " and " + autoZoneDistance.get()); drive(autoZoneDistance.get(), autoZoneSpeed.get()); Rollers.closed.set(false); driveForTime((long) (autoZoneTime.get() * 1000), autoZoneSpeed.get()); Logger.info("Finished: " + (Utils.getCurrentTimeSeconds() - now) + ": " + DriveCode.leftEncoder.get()); }
Source:
public void init(IActionBars bars) { super.init(bars); bars.setGlobalActionHandler(GlobalActionId.SAVE, null); bars.getToolBarManager().add(new DocumentationMenuAction()); removeAppearanceButtonsInSimulationAndTestingPerspective(bars); bars.getToolBarManager().remove(ActionIds.MENU_ARRANGE); bars.getMenuManager().findMenuUsingPath(ActionIds.MENU_DIAGRAM).remove(ActionIds.MENU_ARRANGE); }

Target:
public void init(IActionBars bars) { super.init(bars); bars.getToolBarManager().insertBefore(ActionIds.CUSTOM_ZOOM, new DocumentationMenuAction()); bars.setGlobalActionHandler(GlobalActionId.SAVE, null); showButtonsByPerspective(bars); bars.getToolBarManager().remove(ActionIds.MENU_ARRANGE); bars.getMenuManager().findMenuUsingPath(ActionIds.MENU_DIAGRAM).remove(ActionIds.MENU_ARRANGE); }
Source:
public String weather() { String result = this.restTemplate.getForObject("http://" + WEATHER_SERVICE + "/weather", String.class); return "Weather Service Response: " + result; }

Target:
public String weather() { String result = restTemplate.getForObject("http://" + WEATHER_SERVICE + "/weather", String.class); return "Weather Service Response: " + result; }
Source:
private void createKafkaTasksForGroup(int groupId, int replicas) { Map<Integer, Long> startPartitions = taskGroups.get(groupId).partitionOffsets; Map<Integer, Long> endPartitions = new HashMap<>(); for (Integer partition : startPartitions.keySet()) { endPartitions.put(partition, Long.MAX_VALUE); } String sequenceName = generateSequenceName(groupId); Map<String, String> consumerProperties = Maps.newHashMap(ioConfig.getConsumerProperties()); DateTime minimumMessageTime = taskGroups.get(groupId).minimumMessageTime.orNull(); DateTime maximumMessageTime = taskGroups.get(groupId).maximumMessageTime.orNull(); KafkaIOConfig kafkaIOConfig = new KafkaIOConfig( sequenceName, new KafkaPartitions(ioConfig.getTopic(), startPartitions), new KafkaPartitions(ioConfig.getTopic(), endPartitions), consumerProperties, true, false, minimumMessageTime, maximumMessageTime, ioConfig.isSkipOffsetGaps() ); for (int i = 0; i < replicas; i++) { String taskId = Joiner.on("_").join(sequenceName, getRandomId()); KafkaIndexTask indexTask = new KafkaIndexTask( taskId, new TaskResource(sequenceName, 1), spec.getDataSchema(), taskTuningConfig, kafkaIOConfig, spec.getContext(), null, new AuthConfig(), null ); Optional<TaskQueue> taskQueue = taskMaster.getTaskQueue(); if (taskQueue.isPresent()) { try { taskQueue.get().add(indexTask); } catch (EntryExistsException e) { log.error("Tried to add task [%s] but it already exists", indexTask.getId()); } } else { log.error("Failed to get task queue because I'm not the leader!"); } } }

Target:
private void createKafkaTasksForGroup(int groupId, int replicas) { Map<Integer, Long> startPartitions = taskGroups.get(groupId).partitionOffsets; Map<Integer, Long> endPartitions = new HashMap<>(); for (Integer partition : startPartitions.keySet()) { endPartitions.put(partition, Long.MAX_VALUE); } String sequenceName = generateSequenceName(groupId); Map<String, String> consumerProperties = Maps.newHashMap(ioConfig.getConsumerProperties()); DateTime minimumMessageTime = taskGroups.get(groupId).minimumMessageTime.orNull(); DateTime maximumMessageTime = taskGroups.get(groupId).maximumMessageTime.orNull(); KafkaIOConfig kafkaIOConfig = new KafkaIOConfig( sequenceName, new KafkaPartitions(ioConfig.getTopic(), startPartitions), new KafkaPartitions(ioConfig.getTopic(), endPartitions), consumerProperties, true, false, minimumMessageTime, maximumMessageTime, ioConfig.isSkipOffsetGaps() ); for (int i = 0; i < replicas; i++) { String taskId = Joiner.on("_").join(sequenceName, getRandomId()); KafkaIndexTask indexTask = new KafkaIndexTask( taskId, new TaskResource(sequenceName, 1), spec.getDataSchema(), taskTuningConfig, kafkaIOConfig, spec.getContext(), null, null ); Optional<TaskQueue> taskQueue = taskMaster.getTaskQueue(); if (taskQueue.isPresent()) { try { taskQueue.get().add(indexTask); } catch (EntryExistsException e) { log.error("Tried to add task [%s] but it already exists", indexTask.getId()); } } else { log.error("Failed to get task queue because I'm not the leader!"); } } }
Source:
public void deleteAndDeleteAll() { final Realm realm = looperThread.realm; realm.beginTransaction(); for (int i = 0; i < 10; i++) { StringOnly stringOnly = realm.createObject(StringOnly.class); stringOnly.setChars("String " + i); } realm.commitTransaction(); RealmResults<StringOnly> stringOnlies = realm.where(StringOnly.class).findAll(); realm.beginTransaction(); stringOnlies.get(0).deleteFromRealm(); realm.commitTransaction(); realm.beginTransaction(); stringOnlies.deleteAllFromRealm(); realm.commitTransaction(); assertEquals(0, realm.where(StringOnly.class).findAll().size()); looperThread.postRunnable(new Runnable() { @Override public void run() { realm.close(); looperThread.testComplete(); } }); }

Target:
public void deleteAndDeleteAll() { realm.beginTransaction(); for (int i = 0; i < 10; i++) { StringOnly stringOnly = realm.createObject(StringOnly.class); stringOnly.setChars("String " + i); } realm.commitTransaction(); RealmResults<StringOnly> stringOnlies = realm.where(StringOnly.class).findAll(); realm.beginTransaction(); stringOnlies.get(0).deleteFromRealm(); realm.commitTransaction(); realm.beginTransaction(); stringOnlies.deleteAllFromRealm(); realm.commitTransaction(); assertEquals(0, realm.where(StringOnly.class).findAll().size()); }
Source:
public void scanEntries(BinaryDequeScanner scanner) throws IOException { if (m_closed) { throw new IOException("Cannot scanForGap(): PBD has been closed"); } assertions(); if (m_segments.isEmpty()) { if (m_usageSpecificLog.isDebugEnabled()) { m_usageSpecificLog.debug("PBD " + m_nonce + " has no finished segments"); } return; } List<PBDSegment> toQuarantine = new ArrayList<>(); for (PBDSegment segment : m_segments.values()) { try { m_numObjects -= segment.scan(scanner); } catch (IOException e) { LOG.warn("Error scanning segment: " + segment.file() + ". Qurantining segment."); toQuarantine.add(segment); } } for (PBDSegment segment : toQuarantine) { quarantineSegment(segment, segment.getNumEntries()); } return; }

Target:
public void scanEntries(BinaryDequeScanner scanner) throws IOException { if (m_closed) { throw new IOException("Cannot scanForGap(): PBD has been closed"); } assertions(); if (m_segments.isEmpty()) { if (m_usageSpecificLog.isDebugEnabled()) { m_usageSpecificLog.debug("PBD " + m_nonce + " has no finished segments"); } return; } List<PBDSegment> toQuarantine = new ArrayList<>(); for (PBDSegment segment : m_segments.values()) { try { int truncatedEntries = segment.scan(scanner); if (truncatedEntries > 0) { m_numObjects -= truncatedEntries; if (segment.getNumEntries() == 0) { toQuarantine.add(segment); } } } catch (IOException e) { m_usageSpecificLog.warn("Error scanning segment: " + segment.file() + ". Quarantining segment."); toQuarantine.add(segment); } } for (PBDSegment segment : toQuarantine) { quarantineSegment(segment, segment.getNumEntries()); } return; }
Source:
private boolean validateDevices() { Set<String> devices = getParameters().getDevicesToReduce().stream().collect(toSet()); if (devices.size() != getParameters().getDevicesToReduce().size()) { return validate(new ValidationResult(EngineMessage.ACTION_TYPE_FAILED_DUPLICATE_DEVICE)); } if (getParameters().getDevicesToReduce().size() == lunDao.getAllForVolumeGroup(getStorageDomain().getStorage()).size()) { return validate(new ValidationResult(EngineMessage.ACTION_TYPE_FAILED_CANNOT_REMOVE_ALL_LUNS)); } return validate(blockSDValidator.lunsInDomain(getStorageDomain(), devices)) && validate(blockSDValidator.lunsEligibleForOperation(getStorageDomain(), devices)); }

Target:
private boolean validateDevices() { Set<String> devices = getParameters().getDevicesToReduce().stream().collect(toSet()); if (devices.size() != getParameters().getDevicesToReduce().size()) { return validate(new ValidationResult(EngineMessage.ACTION_TYPE_FAILED_DUPLICATE_DEVICE)); } return validate(blockSDValidator.lunsInDomain(getStorageDomain(), devices)) && validate(blockSDValidator.lunsEligibleForOperation(getStorageDomain(), devices)); }
Source:
public Response uploadFile( @FormDataParam("file") InputStream uploadedInputStream, @FormDataParam("file") FormDataContentDisposition fileDetail) { Config config = createConfig(); if (uploadedInputStream == null) { return Response.status(Response.Status.BAD_REQUEST).build(); } if (fileDetail == null) { return Response.status(Response.Status.BAD_REQUEST).build(); } String uploadDir = config.getStringValue(FILE_SYSTEM_DIRECTORY); String fileName = UUID.randomUUID() + "-" + fileDetail.getFileName(); String uploadedFileLocation = uploadDir + "/" + fileName; writeToFile(uploadedInputStream, uploadedFileLocation); String uri = String.format("http://%s:%s/api/v1/file/download/%s", (hostname != null) ? hostname : ip, getPort(), fileName); return Response.status(Response.Status.OK).entity(uri).build(); }

Target:
public Response uploadFile( @FormDataParam("file") InputStream uploadedInputStream, @FormDataParam("file") FormDataContentDisposition fileDetail) { Config config = createConfig(); if (uploadedInputStream == null) { String msg = "input stream is null"; LOG.error(msg); return Response.status(Response.Status.BAD_REQUEST) .type(MediaType.APPLICATION_JSON) .entity(Utils.createMessage(msg)).build(); } if (fileDetail == null) { String msg = "form data content disposition is null"; LOG.error(msg); return Response.status(Response.Status.BAD_REQUEST) .type(MediaType.APPLICATION_JSON) .entity(Utils.createMessage(msg)).build(); } String uploadDir = config.getStringValue(FILE_SYSTEM_DIRECTORY); String fileName = UUID.randomUUID() + "-" + fileDetail.getFileName(); String uploadedFileLocation = uploadDir + "/" + fileName; try { FileHelper.writeToFile(uploadedInputStream, uploadedFileLocation); } catch (IOException e) { LOG.error("error uploading file {}", fileDetail.getFileName(), e); return Response.serverError() .type(MediaType.APPLICATION_JSON) .entity(Utils.createMessage(e.getMessage())) .build(); } String uri = String.format("http://%s:%s/api/v1/file/download/%s", (hostname != null) ? hostname : ip, getPort(), fileName); return Response.status(Response.Status.OK).entity(uri).build(); }
Source:
static boolean isOfflineOnly(int networkPolicy) { return (networkPolicy & NetworkPolicy.OFFLINE.index) == NetworkPolicy.OFFLINE.index; }

Target:
public static boolean isOfflineOnly(int networkPolicy) { return (networkPolicy & NetworkPolicy.OFFLINE.index) != 0; }
Source:
public static void cleanupBuckets() throws IOException { GoogleCloudStorage rawStorage = createGoogleCloudStorage(); List<GoogleCloudStorageItemInfo> objectsToDelete = rawStorage.listObjectInfo( BUCKET_NAME, null, ListObjectOptions.DEFAULT_FLAT_LIST); rawStorage.deleteObjects( Lists.transform(objectsToDelete, GoogleCloudStorageItemInfo::getResourceId)); rawStorage.deleteBuckets(Arrays.asList(BUCKET_NAME)); }

Target:
public static void cleanupBuckets() throws IOException { GoogleCloudStorage rawStorage = createGoogleCloudStorage(); BUCKET_HELPER.cleanup(rawStorage); }
Source:
public ApplicationDynamicConstants() { this((CommonApplicationConstants) GWT.create(CommonApplicationConstants.class)); }

Target:
public ApplicationDynamicConstants() { this((ApplicationConstants) GWT.create(ApplicationConstants.class)); }
Source:
public void onPlayerInput(CharacterMoveInputEvent input, EntityRef entity) { CharacterCollider characterCollider = physics.getCharacterCollider(entity); if (characterCollider.isPending()) { logger.debug("Skipping input, collision not yet established"); return; } CircularBuffer<CharacterStateEvent> stateBuffer = characterStates.get(entity); CharacterStateEvent lastState = stateBuffer.getLast(); float delta = input.getDelta() + lastState.getTime() - (time.getGameTimeInMs() + MAX_INPUT_OVERFLOW + 100); if (RecordAndReplayStatus.getCurrentStatus() == RecordAndReplayStatus.REPLAYING) { delta -= MAX_INPUT_OVERFLOW_REPLAY_INCREASE; } if (delta < 0) { CharacterStateEvent newState = stepState(input, lastState, entity); stateBuffer.add(newState); if (RecordAndReplayStatus.getCurrentStatus() == RecordAndReplayStatus.REPLAYING) { characterStateEventPositionMap.updateCharacterStateEvent(newState); } else if (RecordAndReplayStatus.getCurrentStatus() == RecordAndReplayStatus.RECORDING) { characterStateEventPositionMap.add(newState.getSequenceNumber(), newState.getPosition(), newState.getVelocity()); } characterMovementSystemUtility.setToState(entity, newState); lastInputEvent.put(entity, input); } else { logger.warn("Received too much input from {}, dropping input. Delta difference: {}", entity, delta); } }

Target:
public void onPlayerInput(CharacterMoveInputEvent input, EntityRef entity) { CharacterCollider characterCollider = physics.getCharacterCollider(entity); if (characterCollider.isPending()) { logger.debug("Skipping input, collision not yet established"); return; } CircularBuffer<CharacterStateEvent> stateBuffer = characterStates.get(entity); CharacterStateEvent lastState = stateBuffer.getLast(); float delta = input.getDelta() + lastState.getTime() - (time.getGameTimeInMs() + MAX_INPUT_OVERFLOW ); if (RecordAndReplayStatus.getCurrentStatus() == RecordAndReplayStatus.REPLAYING) { delta -= MAX_INPUT_OVERFLOW_REPLAY_INCREASE; } if (delta < 0) { CharacterStateEvent newState = stepState(input, lastState, entity); stateBuffer.add(newState); if (RecordAndReplayStatus.getCurrentStatus() == RecordAndReplayStatus.REPLAYING) { characterStateEventPositionMap.updateCharacterStateEvent(newState); } else if (RecordAndReplayStatus.getCurrentStatus() == RecordAndReplayStatus.RECORDING) { characterStateEventPositionMap.add(newState.getSequenceNumber(), newState.getPosition(), newState.getVelocity()); } characterMovementSystemUtility.setToState(entity, newState); lastInputEvent.put(entity, input); } else { logger.warn("Received too much input from {}, dropping input. Delta difference: {}", entity, delta); } }
Source:
private Object genotypeValsToTargetType(final String key, final String vals) { if (!header.hasFormatLine(key)) { return vals; } final VCFFormatHeaderLine formLine = header.getFormatHeaderLine(key); final VCFHeaderLineType valType = formLine.getType(); final boolean isSingleVal = formLine.isFixedCount() ? formLine.getCount() == 1 : !vals.contains(VCFConstants.GENOTYPE_ATTRIBUTE_VALUE_SEPARATOR); if (isSingleVal) { return valType == VCFHeaderLineType.String ? vals : getMapperFunction(valType).apply(vals); } else { final List<?> targetTypeVals = mapToFormatLineType( ParsingUtils.split(vals, VCFConstants.GENOTYPE_ATTRIBUTE_VALUE_SEPARATOR_CHAR), valType); return targetTypeVals.isEmpty() ? vals : targetTypeVals; } }

Target:
private Object genotypeValsToTargetType(final String key, final String vals) { if (!header.hasFormatLine(key)) { return vals; } final VCFFormatHeaderLine formLine = header.getFormatHeaderLine(key); final VCFHeaderLineType valType = formLine.getType(); final boolean isSingleVal = !vals.contains(VCFConstants.GENOTYPE_ATTRIBUTE_VALUE_SEPARATOR); return isSingleVal ? getMapperFunction(valType).apply(vals) : mapToFormatLineType( ParsingUtils.split(vals, VCFConstants.GENOTYPE_ATTRIBUTE_VALUE_SEPARATOR_CHAR), valType); }
Source:
public void init(final AdditionalInfoPage page) { this.page = page; clear(); setup(); }

Target:
public void init(final AdditionalInfoPage page) { this.page = page; }
Source:
private boolean connectStorageServersByType(StorageType storageType, List<StorageServerConnections> connections) { Map<String, String> retValues = (HashMap<String, String>) Backend .getInstance() .getResourceManager() .RunVdsCommand( VDSCommandType.ConnectStorageServer, new StorageServerConnectionManagementVDSParameters(getVds().getId(), getStoragePool().getId(), storageType, connections)).getReturnValue(); return StorageHelperDirector.getInstance().getItem(storageType).isConnectSucceeded(retValues, connections); }

Target:
private boolean connectStorageServersByType(StorageType storageType, List<StorageServerConnections> connections) { Map<String, String> retValues = (Map<String, String>) runVdsCommand( VDSCommandType.ConnectStorageServer, new StorageServerConnectionManagementVDSParameters(getVds().getId(), getStoragePool().getId(), storageType, connections)).getReturnValue(); return StorageHelperDirector.getInstance().getItem(storageType).isConnectSucceeded(retValues, connections); }
Source:
protected boolean isTagLoadedOnMercury() { return isElementVisible(elementInVebatim); }

Target:
protected boolean isTagLoadedOnMercury() { throw new NotImplementedException(); }
Source:
public long lock(String requestId, String name) { final long start = System.currentTimeMillis(); LOG.trace("{} - Locking {}", name, requestId); ReentrantLock lock = requestLocks.computeIfAbsent(requestId, (r) -> new ReentrantLock()); lock.lock(); LOG.trace("{} - Acquired lock on ({})", name, requestId, JavaUtils.duration(start)); return System.currentTimeMillis(); }

Target:
private long lock(String requestId, String name) { final long start = System.currentTimeMillis(); LOG.trace("{} - Locking {}", name, requestId); ReentrantLock lock = requestLocks.computeIfAbsent(requestId, (r) -> new ReentrantLock()); lock.lock(); LOG.trace("{} - Acquired lock on ({})", name, requestId, JavaUtils.duration(start)); return System.currentTimeMillis(); }
Source:
private void validateSortOrderValue(String[] value) { if ("SO".equals(value[0])) { try { SAMFileHeader.SortOrder.valueOf(value[1]); } catch (IllegalArgumentException e) { if (validationStringency == ValidationStringency.STRICT) { throw new SAMFormatException("Found non conforming header SO tag: " + value[1] + ", exiting because VALIDATION_STRINGENCY=STRICT"); } else if (validationStringency == ValidationStringency.LENIENT) { log.warn("Found non conforming header SO tag: " + value[1] + ". Treating as 'unknown'."); } value[1] = "unknown"; } } }

Target:
private void validateSortOrderValue(String[] value) { if (SAMFileHeader.SORT_ORDER_TAG.equals(value[0])) { try { SortOrder.valueOf(value[1]); } catch (IllegalArgumentException e) { if (validationStringency == ValidationStringency.STRICT) { throw new SAMFormatException("Found non-conforming header SO tag: " + value[1] + ", exiting because VALIDATION_STRINGENCY=STRICT"); } else if (validationStringency == ValidationStringency.LENIENT) { log.warn("Found non-conforming header SO tag: " + value[1] + ". Treating as 'unknown'."); } value[1] = SortOrder.unknown.toString(); } } }
Source:
private void prepareResponse(String realmName, HttpServerResponse response, boolean stale) throws HttpAuthenticationException { StringBuilder sb = new StringBuilder(CHALLENGE_PREFIX); sb.append(REALM).append("=\"").append(realmName).append("\""); if (domain != null) { sb.append(", ").append(DOMAIN).append("=\"").append(domain).append("\""); } sb.append(", ").append(NONCE).append("=\"").append(nonceManager.generateNonce(realmName.getBytes(StandardCharsets.UTF_8))).append("\""); sb.append(", ").append(OPAQUE).append("=\"").append(OPAQUE_VALUE).append("\""); if (stale) { sb.append(", ").append(STALE).append("=\"true\""); } sb.append(", ").append(ALGORITHM).append("=\"").append(MD5).append("\""); response.addResponseHeader(WWW_AUTHENTICATE, sb.toString()); response.setStatusCode(UNAUTHORIZED); }

Target:
private void prepareResponse(String realmName, HttpServerResponse response, boolean stale) throws HttpAuthenticationException { StringBuilder sb = new StringBuilder(CHALLENGE_PREFIX); sb.append(REALM).append("=\"").append(DigestQuote.quote(realmName)).append("\""); if (domain != null) { sb.append(", ").append(DOMAIN).append("=\"").append(domain).append("\""); } sb.append(", ").append(NONCE).append("=\"").append(nonceManager.generateNonce(realmName.getBytes(StandardCharsets.UTF_8))).append("\""); sb.append(", ").append(OPAQUE).append("=\"").append(OPAQUE_VALUE).append("\""); if (stale) { sb.append(", ").append(STALE).append("=\"true\""); } sb.append(", ").append(ALGORITHM).append("=\"").append(MD5).append("\""); response.addResponseHeader(WWW_AUTHENTICATE, sb.toString()); response.setStatusCode(UNAUTHORIZED); }