auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void updateFields() { CommitStatus status = new CommitStatus(); assertEquals(new Date(1234), status.setCreatedAt(new Date(1234)) .getCreatedAt()); User creator = new User().setId(1); assertEquals(creator, status.setCreator(creator).getCreator()); assertEquals("desc", status.setDescription("desc").getDescription()); assertEquals(40, status.setId(40).getId()); assertEquals("state", status.setState("state").getState()); assertEquals("targetUrl", status.setTargetUrl("targetUrl") .getTargetUrl()); assertEquals(new Date(5678), status.setUpdatedAt(new Date(5678)) .getUpdatedAt()); assertEquals("url", status.setUrl("url").getUrl()); assertEquals("context", status.getContext("context").getContext()); }

Target:
public void updateFields() { CommitStatus status = new CommitStatus(); assertEquals(new Date(1234), status.setCreatedAt(new Date(1234)) .getCreatedAt()); User creator = new User().setId(1); assertEquals(creator, status.setCreator(creator).getCreator()); assertEquals("con/text", status.setContext("con/text").getContext()); assertEquals("desc", status.setDescription("desc").getDescription()); assertEquals(40, status.setId(40).getId()); assertEquals("state", status.setState("state").getState()); assertEquals("targetUrl", status.setTargetUrl("targetUrl") .getTargetUrl()); assertEquals(new Date(5678), status.setUpdatedAt(new Date(5678)) .getUpdatedAt()); assertEquals("url", status.setUrl("url").getUrl()); assertEquals("context", status.setContext("context").getContext()); }
Source:
public String generateSASLMechanismNameFromGSSApiOIDs (String objectIdentifier) throws NoSuchAlgorithmException, IOException { MessageDigest md = MessageDigest.getInstance("SHA-1"); byte[] messageDigest = md.digest(getASN1DERencoding(objectIdentifier)); BigInteger no = new BigInteger(1, messageDigest); String hashtext = no.toString(16); while (hashtext.length() < 32) { hashtext = "0" + hashtext; } String binarySHA1Hash = getFirst_7_OctetsInBinary(hashtext); binarySHA1Hash = binarySHA1Hash.substring(0, 54); String mechanismName = GS2_PREFIX + getBase32Encoding(binarySHA1Hash); return mechanismName; }

Target:
public String generateSASLMechanismNameFromGSSApiOIDs (String objectIdentifier) throws NoSuchAlgorithmException, IOException { byte[] ASN1_DER = getASN1DERencoding(objectIdentifier); String sha1_hash = SHA1.hex(ASN1_DER); String binary55Bits = getbinary55Bits(sha1_hash); String[] binaryGroups = new String[11]; for (int i = 0 ; i < binary55Bits.length() / 5 ; i++) { String binaryGroup = ""; for (int j = 0 ; j < 5 ; j++) { binaryGroup += binary55Bits.charAt(5 * i + j); } binaryGroups[i] = binaryGroup; } String base32Encoding = ""; for (int i = 0 ; i < 11 ; i++) { int decimalValue = Integer.parseInt(binaryGroups[i], 2); base32Encoding += Base32.encodeIntValue(decimalValue); } return GS2_PREFIX + base32Encoding; }
Source:
public void onDeleteAccountsFromGroup(Id me, Collection<AccountGroupMember> removed) { List<AccountGroupMemberAudit> auditInserts = Lists.newLinkedList(); List<AccountGroupMemberAudit> auditUpdates = Lists.newLinkedList(); ReviewDb reviewDB = db.get(); try { for (AccountGroupMember m : removed) { AccountGroupMemberAudit audit = null; for (AccountGroupMemberAudit a : reviewDB.accountGroupMembersAudit() .byGroupAccount(m.getAccountGroupId(), m.getAccountId())) { if (a.isActive()) { audit = a; break; } } if (audit != null) { audit.removed(me, TimeUtil.nowTs()); auditUpdates.add(audit); } else { audit = new AccountGroupMemberAudit(m, me, TimeUtil.nowTs()); audit.removedLegacy(); auditInserts.add(audit); } } reviewDB.accountGroupMembersAudit().update(auditUpdates); reviewDB.accountGroupMembersAudit().insert(auditInserts); } catch (OrmException e) { StringBuilder message = new StringBuilder( "Cannot log delete accounts from group event performed by user "); message.append(me); message.append(": "); message.append(Joiner.on("; ").join(removed)); log.error(message.toString(), e); } }

Target:
public void onDeleteAccountsFromGroup(Id me, Collection<AccountGroupMember> removed) { List<AccountGroupMemberAudit> auditInserts = Lists.newLinkedList(); List<AccountGroupMemberAudit> auditUpdates = Lists.newLinkedList(); ReviewDb reviewDB = db.get(); try { for (AccountGroupMember m : removed) { AccountGroupMemberAudit audit = null; for (AccountGroupMemberAudit a : reviewDB.accountGroupMembersAudit() .byGroupAccount(m.getAccountGroupId(), m.getAccountId())) { if (a.isActive()) { audit = a; break; } } if (audit != null) { audit.removed(me, TimeUtil.nowTs()); auditUpdates.add(audit); } else { audit = new AccountGroupMemberAudit(m, me, TimeUtil.nowTs()); audit.removedLegacy(); auditInserts.add(audit); } } reviewDB.accountGroupMembersAudit().update(auditUpdates); reviewDB.accountGroupMembersAudit().insert(auditInserts); } catch (OrmException e) { String header = "Cannot log delete accounts from group event performed by user "; logOrmExceptionForAccounts(me, removed, e, header); } }
Source:
public void testUnmapped() { final String alignmentFromKris = "0\t4\t*\t0\t0\t*\t*\t0\t0\tGCCTCGTAGTGCGCCATCAGTCTATCGATGTCGTTG\t44\"44===;;;;;;;;;::::88844\"4\"\"\"\"\"\"\"\"\n"; final SamReader samReader = createSamFileReader(alignmentFromKris); final CloseableIterator<SAMRecord> iterator = samReader.iterator(); while (iterator.hasNext()) { iterator.next(); } iterator.close(); }

Target:
public void testUnmapped() { final String alignmentFromKris = "0\t4\t*\t0\t0\t*\t*\t0\t0\tGCCTCGTAGTGCGCCATCAGTCTATCGATGTCGTTG\t44\"44===;;;;;;;;;::::88844\"4\"\"\"\"\"\"\"\"\n"; final SamReader samReader = createSamFileReader(alignmentFromKris); final CloseableIterator<SAMRecord> iterator = samReader.iterator(); while (iterator.hasNext()) { iterator.next(); } iterator.close(); CloserUtil.close(samReader); }
Source:
private void injectBootstrapper() throws InfrastructureException { LOG.debug( "Bootstrapping {}:{}. Creating folder for bootstrapper", runtimeIdentity, openShiftMachine); openShiftMachine.exec("mkdir", "-p", BOOTSTRAPPER_DIR); LOG.debug( "Bootstrapping {}:{}. Downloading bootstrapper binary", runtimeIdentity, openShiftMachine); openShiftMachine.exec( "curl", "-o", BOOTSTRAPPER_DIR + BOOTSTRAPPER_FILE, bootstrapperBinaryUrl); openShiftMachine.exec("chmod", "+x", BOOTSTRAPPER_DIR + BOOTSTRAPPER_FILE); LOG.debug("Bootstrapping {}:{}. Creating config file", runtimeIdentity, openShiftMachine); openShiftMachine.exec( "sh", "-c", "cat > " + BOOTSTRAPPER_DIR + CONFIG_FILE + " << 'EOF'\n" + GSON.toJson(installers) + "\nEOF"); }

Target:
private void injectBootstrapper() throws InfrastructureException { String machineName = openShiftMachine.getName(); LOG.debug( "Bootstrapping {}:{}. Creating folder for bootstrapper", runtimeIdentity, machineName); openShiftMachine.exec("mkdir", "-p", BOOTSTRAPPER_DIR); LOG.debug("Bootstrapping {}:{}. Downloading bootstrapper binary", runtimeIdentity, machineName); openShiftMachine.exec( "curl", "-o", BOOTSTRAPPER_DIR + BOOTSTRAPPER_FILE, bootstrapperBinaryUrl); openShiftMachine.exec("chmod", "+x", BOOTSTRAPPER_DIR + BOOTSTRAPPER_FILE); LOG.debug("Bootstrapping {}:{}. Creating config file", runtimeIdentity, machineName); openShiftMachine.exec( "sh", "-c", "cat > " + BOOTSTRAPPER_DIR + CONFIG_FILE + " << 'EOF'\n" + GSON.toJson(installers) + "\nEOF"); }
Source:
public void doSample() { checkCallState(); transmitLatestState(); }

Target:
public void doSample() { int callState = telMgr.getCallState(); updateCallState(callState); int dataConnectionState = telMgr.getDataState(); updateDataConnectionState(dataConnectionState); updateConnectionType(); transmitLatestState(); }
Source:
public void test() { JavaCheckVerifier.verify("src/test/files/checks/CompareToNotOverloadedCheck/CompareToNotOverloadedCheck.java", new CompareToNotOverloadedCheck()); }

Target:
public void test() { JavaCheckVerifier.verify("src/test/files/checks/CompareToNotOverloadedCheck.java", new CompareToNotOverloadedCheck()); }
Source:
public MessageSendingThread() { mMessageQueue = new ArrayBlockingQueue<String>(QUEUE_CAPACITY); }

Target:
public MessageSendingThread() { }
Source:
public CachingClassificationEngine(ClassificationEngine delegate) { this.delegate = Objects.requireNonNull(delegate); this.cache = CacheBuilder.newBuilder() .maximumSize(5000) .expireAfterAccess(60 * 1000, TimeUnit.MILLISECONDS) .build( new CacheLoader<ClassificationRequest, Optional<String>>() { @Override public Optional<String> load(ClassificationRequest key) { return Optional.ofNullable(delegate.classify(key)); } }); }

Target:
public CachingClassificationEngine(ClassificationEngine delegate) { this.delegate = Objects.requireNonNull(delegate); this.cache = CacheBuilder.newBuilder() .maximumSize(Integer.getInteger("org.opennms.features.flows.classification.caching.maxSize", 5000)) .expireAfterAccess(Long.getLong("org.opennms.features.flows.classification.caching.expireTime", 60 * 1000), TimeUnit.MILLISECONDS) .build( new CacheLoader<ClassificationRequest, Optional<String>>() { @Override public Optional<String> load(ClassificationRequest key) { return Optional.ofNullable(delegate.classify(key)); } }); }
Source:
private void setLoaderColumnsProperty(Loader loader, List<Field> columns){ boolean isUpperCase = sprops.convertColumnsAndTableToUppercase.getValue(); List<String> keyStr = new ArrayList<>(); List<String> columnsStr = new ArrayList<>(); int i = 0; for (Field overlapField : columns) { Field f = overlapField == null ? mainSchema.getFields().get(i) : overlapField; i++; String dbColumnName = f.getProp(SchemaConstants.TALEND_COLUMN_DB_COLUMN_NAME); if(dbColumnName == null){ dbColumnName = f.name(); } String fName = isUpperCase ? dbColumnName.toUpperCase() : dbColumnName; columnsStr.add(fName); if (null != f.getProp(SchemaConstants.TALEND_COLUMN_IS_KEY)) { keyStr.add(fName); } } row = new Object[columnsStr.size()]; loader.setProperty(LoaderProperty.columns, columnsStr); if (sprops.outputAction.getValue() == UPSERT) { keyStr.clear(); keyStr.add(sprops.upsertKeyColumn.getValue()); } if (keyStr.size() > 0) { loader.setProperty(LoaderProperty.keys, keyStr); } }

Target:
private void setLoaderColumnsProperty(Loader loader, List<Field> columns){ boolean isUpperCase = sprops.convertColumnsAndTableToUppercase.getValue(); List<String> keyStr = new ArrayList<>(); List<String> columnsStr = new ArrayList<>(); int i = 0; for (Field overlapField : columns) { Field f = overlapField == null ? mainSchema.getFields().get(i) : overlapField; i++; String dbColumnName = f.getProp(SchemaConstants.TALEND_COLUMN_DB_COLUMN_NAME); if(dbColumnName == null){ dbColumnName = f.name(); } String fName = isUpperCase ? dbColumnName.toUpperCase() : dbColumnName; columnsStr.add(fName); if (null != f.getProp(SchemaConstants.TALEND_COLUMN_IS_KEY)) { keyStr.add(fName); } } row = new Object[columnsStr.size()]; loader.setProperty(LoaderProperty.columns, columnsStr); if (UPSERT.equals(sprops.outputAction.getValue())) { keyStr.clear(); keyStr.add(sprops.upsertKeyColumn.getValue()); } if (keyStr.size() > 0) { loader.setProperty(LoaderProperty.keys, keyStr); } }
Source:
public boolean repack(ProgressMonitor pm) throws IOException { if (pm == null) pm = NullProgressMonitor.INSTANCE; PackConfig packConfig = new PackConfig(repo); if (packConfig.getIndexVersion() != 2) throw new IllegalStateException("Only index version 2"); Map<String, Ref> refsBefore = repo.getAllRefs(); HashSet<ObjectId> allHeads = new HashSet<ObjectId>(); HashSet<ObjectId> nonHeads = new HashSet<ObjectId>(); HashSet<ObjectId> tagTargets = new HashSet<ObjectId>(); for (Ref ref : refsBefore.values()) { if (ref.isSymbolic() || ref.getObjectId() == null) continue; if (isHead(ref)) allHeads.add(ref.getObjectId()); else nonHeads.add(ref.getObjectId()); if (ref.getPeeledObjectId() != null) tagTargets.add(ref.getPeeledObjectId()); } tagTargets.addAll(allHeads); packHeads(pm, allHeads); return true; }

Target:
public Collection<PackFile> repack(ProgressMonitor pm) throws IOException { PackConfig packConfig = new PackConfig(repo); if (packConfig.getIndexVersion() != 2) throw new IllegalStateException("Only index version 2"); Map<String, Ref> refsBefore = repo.getAllRefs(); HashSet<ObjectId> allHeads = new HashSet<ObjectId>(); HashSet<ObjectId> nonHeads = new HashSet<ObjectId>(); HashSet<ObjectId> tagTargets = new HashSet<ObjectId>(); HashSet<ObjectId> indexObjects = listNonHEADIndexObjects(); for (Ref ref : refsBefore.values()) { if (ref.isSymbolic() || ref.getObjectId() == null) continue; if (isHead(ref)) allHeads.add(ref.getObjectId()); else nonHeads.add(ref.getObjectId()); if (ref.getPeeledObjectId() != null) tagTargets.add(ref.getPeeledObjectId()); } tagTargets.addAll(allHeads); nonHeads.addAll(indexObjects); List<PackFile> ret = new ArrayList<PackFile>(2); ret.add(packHeads(pm, allHeads)); if (!nonHeads.isEmpty()) ret.add(packRest(pm, nonHeads, allHeads)); return ret; }
Source:
protected Request getHttpRequest(String url) { HttpClient httpClient = new HttpClient(); startHttpClient(httpClient); return httpClient.newRequest(url).method(HttpMethod.GET); }

Target:
protected Request getHttpRequest(String url) { startHttpClient(httpClient); return httpClient.newRequest(url).method(HttpMethod.GET); }
Source:
public int compareTo(ActivityEvent object) { if (date == null || object.getDate() == null) { return 0; } return date.compareTo(object.getDate()); }

Target:
public int compareTo(ActivityEvent object) { if (date == null && object.getDate() == null) { return 0; } if (date == null || object.getDate() == null) { return -1; } return date.compareTo(object.getDate()); }
Source:
private void configureFeedbackUrl() { AsyncQuery _asyncQuery = new AsyncQuery(); _asyncQuery.setModel(this); _asyncQuery.asyncCallback = new INewAsyncCallback() { @Override public void onSuccess(Object model, Object result) { String version = (String) result; feedbackUrl = dynamicMessages.feedbackUrl(version); if (feedbackUrl != null && feedbackUrl.length() > 0) { getView().setFeedbackText(feedbackLinkLabel); registerHandler(getView().getFeedbackLink().addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { WebUtils.openUrlInNewWindow(feedbackLinkLabel, feedbackUrl); } })); } } }; AsyncDataProvider.getRpmVersionViaPublic(_asyncQuery); }

Target:
private void configureFeedbackUrl() { AsyncQuery _asyncQuery = new AsyncQuery(); _asyncQuery.setModel(this); _asyncQuery.asyncCallback = new INewAsyncCallback() { @Override public void onSuccess(Object model, Object result) { String version = (String) result; feedbackUrl = dynamicMessages.feedbackUrl(version); if (feedbackUrl != null && feedbackUrl.length() > 0) { getView().setFeedbackText(feedbackLinkLabel); registerHandler(getView().getFeedbackLink().addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { WebUtils.openUrlInNewWindow(feedbackLinkLabel, feedbackUrl); } })); } } }; AsyncDataProvider.getRpmVersion(_asyncQuery); }
Source:
public List<ReplicaId> getReplicaIds() { List<Replica> replicas = getReplicas(); return new ArrayList<>(replicas); }

Target:
public List<ReplicaId> getReplicaIds() { return getReplicaIdsByState(ReplicaState.STANDBY, null); }
Source:
private void startVerifySeedActivity(DeterministicSeed seed) { List<String> mnemonicCode = seed.getMnemonicCode(); String seedArray = mnemonicCode.toArray(new String[0]); Intent intent = VerifySeedActivity.Companion.createIntent(this, seedArray); startActivity(intent); }

Target:
private void startVerifySeedActivity(DeterministicSeed seed) { List<String> mnemonicCode = seed.getMnemonicCode(); String seedArray = mnemonicCode.toArray(new String[0]); Intent intent = VerifySeedActivity.createIntent(this, seedArray); startActivity(intent); }
Source:
public void verifyMonetizationModuleShown() { Assertion.assertTrue(checkIfElementOnPage(monetizationModuleContainer)); PageObjectLogging.log("verifyMonetizationModuleShown", "Monetization module is shown", true); waitForElementByElement(monetizationModuleContainer); PageObjectLogging.log("verifyMonetizationModuleShown", "Monetization module is visible", true); }

Target:
public void verifyMonetizationModuleShown() { Assertion.assertTrue(checkIfElementOnPage(monetizationModuleContainer)); waitForElementByElement(monetizationModuleContainer); PageObjectLogging.log("verifyMonetizationModuleShown", "Monetization module is visible", true); }
Source:
public void run() { updateStatus("Started " + getStatus()); String previousThreadName = Thread.currentThread().getName(); Thread.currentThread().setName(previousThreadName + "; AsyncOperation ID " + status.getId() + ": " + status.getDescription()); try { operate(); } catch(Exception e) { status.setException(e); } finally { Thread.currentThread().setName(previousThreadName); updateStatus("Finished " + getStatus()); markComplete(); } }

Target:
public void run() { updateStatus("Started " + getStatus()); String previousThreadName = Thread.currentThread().getName(); Thread.currentThread().setName(previousThreadName + "; AsyncOp ID " + status.getId()); try { operate(); } catch(Exception e) { status.setException(e); } finally { Thread.currentThread().setName(previousThreadName); updateStatus("Finished " + getStatus()); markComplete(); } }
Source:
} catch (SAXException e) { e.printStackTrace(); }

Target:
} catch (SAXException e) { throw new RuntimeException("Unable to initialize correctly DMNValidator.", e); }
Source:
protected void executeCommand() { GlusterGeoRepSession session = getGeoRepSession(); VDSReturnValue returnValue = runVdsCommand(VDSCommandType.SetGlusterVolumeGeoRepConfigDefault, new GlusterVolumeGeoRepConfigVdsParameters(upServer.getId(), session.getMasterVolumeName(), session.getSlaveHostName(), session.getSlaveVolumeName(), getParameters().getConfigKey(), null, session.getUserName())); GlusterGeoRepSyncJob.getInstance().updateDiscoveredSessionConfig(getVdsGroupDAO().get(getGlusterVolume().getClusterId()), session); setSucceeded(returnValue.getSucceeded()); if (!getSucceeded()) { handleVdsError(AuditLogType.GLUSTER_GEOREP_CONFIG_SET_DEFAULT_FAILED, returnValue.getVdsError() .getMessage()); return; } }

Target:
protected void executeCommand() { GlusterGeoRepSession session = getGeoRepSession(); VDSReturnValue returnValue = runVdsCommand(VDSCommandType.SetGlusterVolumeGeoRepConfigDefault, new GlusterVolumeGeoRepConfigVdsParameters(upServer.getId(), session.getMasterVolumeName(), session.getSlaveHostName(), session.getSlaveVolumeName(), getParameters().getConfigKey(), null, session.getUserName())); GlusterGeoRepSyncJob.getInstance().updateDiscoveredSessionConfig(getVdsGroup(), session); setSucceeded(returnValue.getSucceeded()); if (!getSucceeded()) { handleVdsError(AuditLogType.GLUSTER_GEOREP_CONFIG_SET_DEFAULT_FAILED, returnValue.getVdsError() .getMessage()); return; } }
Source:
public void testPartialRamMapScaling() throws Exception { long maxContainerRam = 10L * Constants.GB; long boltRam = 4L * Constants.GB; topologyConfig.setContainerMaxRamHint(maxContainerRam); topologyConfig.setComponentRam(BOLT_NAME, boltRam); TopologyAPI.Topology topologyExplicitRamMap = getTopology(spoutParallelism, boltParallelism, topologyConfig); PackingPlan packingPlanExplicitRamMap = getFirstFitDecreasingPackingPlan(topologyExplicitRamMap); Assert.assertEquals(2, packingPlanExplicitRamMap.getContainers().size()); Assert.assertEquals(totalInstances, packingPlanExplicitRamMap.getInstanceCount()); AssertPacking.assertContainers(packingPlanExplicitRamMap.getContainers(), BOLT_NAME, SPOUT_NAME, boltRam, instanceDefaultResources.getRam(), null); int numScalingInstances = 3; Map<String, Integer> componentChanges = new HashMap<>(); componentChanges.put(BOLT_NAME, numScalingInstances); PackingPlan newPackingPlan = getFirstFitDecreasingPackingPlanRepack(topologyExplicitRamMap, packingPlanExplicitRamMap, componentChanges); Assert.assertEquals(4, newPackingPlan.getContainers().size()); Assert.assertEquals((Integer) (totalInstances + numScalingInstances), newPackingPlan.getInstanceCount()); AssertPacking.assertContainers(newPackingPlan.getContainers(), BOLT_NAME, SPOUT_NAME, boltRam, instanceDefaultResources.getRam(), null); }

Target:
public void testPartialRamMapScaling() throws Exception { long maxContainerRam = 10L * Constants.GB; long boltRam = 4L * Constants.GB; topologyConfig.setContainerMaxRamHint(maxContainerRam); topologyConfig.setComponentRam(BOLT_NAME, boltRam); TopologyAPI.Topology topologyExplicitRamMap = getTopology(spoutParallelism, boltParallelism, topologyConfig); PackingPlan packingPlanExplicitRamMap = getFirstFitDecreasingPackingPlan(topologyExplicitRamMap); Assert.assertEquals(2, packingPlanExplicitRamMap.getContainers().size()); Assert.assertEquals(totalInstances, packingPlanExplicitRamMap.getInstanceCount()); AssertPacking.assertContainers(packingPlanExplicitRamMap.getContainers(), BOLT_NAME, SPOUT_NAME, boltRam, instanceDefaultResources.getRam(), null); int numScalingInstances = 3; Map<String, Integer> componentChanges = new HashMap<>(); componentChanges.put(BOLT_NAME, numScalingInstances); PackingPlan newPackingPlan = getFirstFitDecreasingPackingPlanRepack(topologyExplicitRamMap, packingPlanExplicitRamMap, componentChanges); Assert.assertEquals(4, newPackingPlan.getContainers().size()); Assert.assertEquals((Integer) (totalInstances + numScalingInstances), newPackingPlan.getInstanceCount()); AssertPacking.assertContainers(newPackingPlan.getContainers(), BOLT_NAME, SPOUT_NAME, boltRam, instanceDefaultResources.getRam(), null); AssertPacking.assertContainerRam(newPackingPlan.getContainers(), maxContainerRam); }
Source:
private String generateDeviceID(List<GpodnetDevice> gpodnetDevices) { String baseId = Build.MODEL.replaceAll("\\W", ""); String id = baseId; int num = 0; while (isDeviceWithIdInList(id, gpodnetDevices)) { id = baseId + "filterdialog_" + num; num++; } return id; }

Target:
private String generateDeviceID(List<GpodnetDevice> gpodnetDevices) { String baseId = Build.MODEL.replaceAll("\\W", ""); String id = baseId; int num = 0; while (isDeviceWithIdInList(id, gpodnetDevices)) { id = baseId + "_" + num; num++; } return id; }
Source:
public SubmitJobCommand(String... params) throws CLIException { if (params == null || params.length == 0) { logger.log(Level.WARNING, "Error message: Workflow file path is required"); throw new CLIException(REASON_INVALID_ARGUMENTS, "Workflow file path is required"); } this.pathname = params[0]; if (params.length > 1) { this.variables = params[1]; } this.jobKeyValueTransformer = new JobKeyValueTransformer(); }

Target:
public SubmitJobCommand(String... params) throws NullPointerException { Objects.requireNonNull(params); this.pathname = params[0]; if (params.length > 1) { this.variables = params[1]; } this.jobKeyValueTransformer = new JobKeyValueTransformer(); }
Source:
public static Object getPythonProxy(String commandPart, Gateway gateway) { String proxyString = commandPart.substring(1, commandPart.length()); String[] parts = proxyString.split(";"); int length = parts.length; Class<?>[] interfaces = new Class<?>[length - 1]; if (length < 2) { throw new Py4JException("Invalid Python Proxy."); } ClassLoadingStrategy classLoadingStrategy = gateway.getClassLoadingStrategy(); if (classLoadingStrategy == null) classLoadingStrategy = ReflectionUtil.getClassLoadingStrategy(); if (classLoadingStrategy == null) classLoadingStrategy = new CurrentThreadClassLoadingStrategy(); for (int i = 1; i < length; i++) { try { interfaces[i - 1] = classLoadingStrategy.classForName(parts[i]); if (!interfaces[i - 1].isInterface()) { throw new Py4JException( "This class " + parts[i] + " is not an interface and cannot be used as a Python Proxy."); } } catch (ClassNotFoundException e) { throw new Py4JException("Invalid interface name: " + parts[i]); } } return gateway.createProxy(ReflectionUtil.getClassLoader(), interfaces, parts[0]); }

Target:
public static Object getPythonProxy(String commandPart, Gateway gateway) { String proxyString = commandPart.substring(1, commandPart.length()); String[] parts = proxyString.split(";"); int length = parts.length; Class<?>[] interfaces = new Class<?>[length - 1]; if (length < 2) { throw new Py4JException("Invalid Python Proxy."); } for (int i = 1; i < length; i++) { try { interfaces[i - 1] = ReflectionUtil.classForName(parts[i]); if (!interfaces[i - 1].isInterface()) { throw new Py4JException( "This class " + parts[i] + " is not an interface and cannot be used as a Python Proxy."); } } catch (ClassNotFoundException e) { throw new Py4JException("Invalid interface name: " + parts[i]); } } return gateway.createProxy(ReflectionUtil.getClassLoader(), interfaces, parts[0]); }
Source:
public void testToStringOfTagClass() { final SuppressionCommentFilter filter1 = new SuppressionCommentFilter(); final Object tag1 = getTagsAfterExecution(filter1, "filename", " assertEquals("Invalid toString result", "Tag[text='CHECKSTYLE:OFF', line=1, column=0, type=OFF," + " tagCheckRegexp=.*, tagMessageRegexp=null]", tag1.toString()); final SuppressionCommentFilter filter2 = new SuppressionCommentFilter(); filter2.setMessageFormat(".*"); final Object tag2 = getTagsAfterExecution(filter2, "filename", " assertEquals("Invalid toString result", "Tag[text='CHECKSTYLE:ON', line=1, column=0, type=ON," + " tagCheckRegexp=.*, tagMessageRegexp=.*]", tag2.toString()); }

Target:
public void testToStringOfTagClass() { final Object tag = getTagsAfterExecutionOnDefaultFilter(" assertEquals("Invalid toString result", "Tag[text='CHECKSTYLE:OFF', line=1, column=0, type=OFF," + " tagCheckRegexp=.*, tagMessageRegexp=null]", tag.toString()); }
Source:
public CopyImageToScreenNode(Context context) { super(context); WorldRenderer worldRenderer = context.get(WorldRenderer.class); requiresCondition(() -> worldRenderer.getCurrentRenderStage() == MONO || worldRenderer.getCurrentRenderStage() == LEFT_EYE); DisplayResolutionDependentFBOs displayResolutionDependentFBOs = context.get(DisplayResolutionDependentFBOs.class); sceneFinalFbo = displayResolutionDependentFBOs.get(FINAL_BUFFER); update(); displayResolutionDependentFBOs.subscribe(this); addDesiredStateChange(new EnableMaterial(DEFAULT_TEXTURED_MATERIAL)); addDesiredStateChange(new SetInputTextureFromFbo(0, sceneFinalFbo, ColorTexture, displayResolutionDependentFBOs, DEFAULT_TEXTURED_MATERIAL, "texture")); }

Target:
public CopyImageToScreenNode(Context context) { super(context); WorldRenderer worldRenderer = context.get(WorldRenderer.class); requiresCondition(() -> worldRenderer.getCurrentRenderStage() == MONO || worldRenderer.getCurrentRenderStage() == LEFT_EYE); addDesiredStateChange(new EnableMaterial(DEFAULT_TEXTURED_MATERIAL_URN)); addDesiredStateChange(new SetInputTextureFromFbo(0, FINAL_BUFFER, ColorTexture, context.get(DisplayResolutionDependentFBOs.class), DEFAULT_TEXTURED_MATERIAL_URN, "texture")); }
Source:
public Object[] getChildren(Object parentElement) { if (parentElement instanceof IFeatureModel) { IFeatureModel featureModel = (IFeatureModel) parentElement; String featureId = featureModel.getFeature().getId(); Object[] features = fInput.getFeaturesViewInput().getIncludingFeatures(featureId).toArray(); if (!fInput.getFeaturesViewInput().isIncludeProducts()) { return features; } Object[] products = fInput.getFeaturesViewInput().getIncludingProducts(featureId).toArray(); List<Object> all = new ArrayList<>(features.length + products.length); all.addAll(Arrays.asList(features)); all.addAll(Arrays.asList(products)); return all.toArray(); } return new Object[0]; }

Target:
public Object[] getChildren(Object parentElement) { if (parentElement instanceof IFeatureModel) { IFeatureModel featureModel = (IFeatureModel) parentElement; String featureId = featureModel.getFeature().getId(); Collection<IFeatureModel> features = fInput.getFeaturesViewInput().getIncludingFeatures(featureId); if (!fInput.getFeaturesViewInput().isIncludeProducts()) { return features.toArray(); } Collection<IProductModel> products = fInput.getFeaturesViewInput().getIncludingProducts(featureId); List<Object> all = new ArrayList<>(features.size() + products.size()); all.addAll(features); all.addAll(products); return all.toArray(); } return new Object[0]; }
Source:
protected ApplicationOptions getApplicationOptions(PortFinder portFinder) { return new DdfComponentOptions(portFinder) { @Override protected BundleOption getBundleOptions() { return super.getBundleOptions() .add("org.bouncycastle", "bcprov-jdk15on") .add("ddf.catalog.transformer", "catalog-transformer-attribute") .add("org.codice.thirdparty", "jts") .add("org.codice.thirdparty", "picocontainer") .add("ddf.catalog.core", "catalog-core-attachment"); } @Override protected FeatureOption getFeatureOptions() { final String[] springFeatures = { "spring-instrument", "spring-jms", "spring-test", "spring-web" }; final String[] cxfFeatures = {"cxf", "cxf-commands"}; final String[] utilitiesFeatures = {"action-core-impl"}; final String[] kernelFeatures = {"apache-commons"}; return super.getFeatureOptions() .addFeatures("org.apache.karaf.features", "spring", springFeatures) .addFeatures("org.apache.cxf.karaf", "apache-cxf", cxfFeatures) .addFeatures("ddf.features", "utilities", utilitiesFeatures) .addFeatures("ddf.features", "kernel", kernelFeatures) .addFeatureFrom("ddf.thirdparty", "rest-assured", "feature", "rest-assured") .addFeatureFrom( "ddf.platform.util", "util-uuidgenerator-api", "feature", "uuidgenerator-api") .addFeatureFrom("ddf.mime.core", "mime-core-api", "feature", "mime-core-api-only") .addFeatureFrom( "ddf.catalog.core", "catalog-core-api", "feature", "catalog-core-api-only"); } }; }

Target:
protected ApplicationOptions getApplicationOptions(PortFinder portFinder) { return new DdfComponentOptions(portFinder) { @Override protected BundleOption getBundleOptions() { return super.getBundleOptions() .add("org.bouncycastle", "bcprov-jdk15on") .add("ddf.catalog.transformer", "catalog-transformer-attribute") .add("ddf.catalog.core", "catalog-core-attachment"); } @Override protected FeatureOption getFeatureOptions() { final String[] springFeatures = { "spring-instrument", "spring-jms", "spring-test", "spring-web" }; final String[] cxfFeatures = {"cxf", "cxf-commands"}; final String[] utilitiesFeatures = {"action-core-impl"}; final String[] kernelFeatures = {"apache-commons"}; return super.getFeatureOptions() .addFeatures("org.apache.karaf.features", "spring", springFeatures) .addFeatures("org.apache.cxf.karaf", "apache-cxf", cxfFeatures) .addFeatures("ddf.features", "utilities", utilitiesFeatures) .addFeatures("ddf.features", "kernel", kernelFeatures) .addFeatureFrom("ddf.thirdparty", "rest-assured", "feature", "rest-assured") .addFeatureFrom( "ddf.platform.util", "util-uuidgenerator-api", "feature", "uuidgenerator-api") .addFeatureFrom("ddf.mime.core", "mime-core-api", "feature", "mime-core-api-only") .addFeatureFrom( "ddf.catalog.core", "catalog-core-api", "feature", "catalog-core-api-only"); } }; }
Source:
public void put(final Violation violation) { log.info("PUT VIOLATION INTO EVENTBUS"); eventBus.notify(DEFAULT_VIOLATIONS_TOPIC, Event.wrap(violation)); log.info("VIOLATION IN EVENTBUS"); }

Target:
public void put(final Violation violation) { log.debug("PUT VIOLATION INTO EVENTBUS"); eventBus.notify(DEFAULT_VIOLATIONS_TOPIC, Event.wrap(violation)); log.debug("VIOLATION IN EVENTBUS"); }
Source:
public static AbstractBAMFileIndex openIndex(SeekableStream stream, SAMSequenceDictionary dictionary) { return new CachingBAMFileIndexOptimized(stream, dictionary); }

Target:
public static AbstractBAMFileIndex openIndex(SeekableStream stream, SAMSequenceDictionary dictionary) { return new CachingBamFileIndexOptimizedForMerging(stream, dictionary); }
Source:
private DefaultBHttpClientConnection getConnection() { if (conn != null) { return conn; } File socketFile = new File(socketPath); AFUNIXSocket socket; try { socket = AFUNIXSocket.newInstance(); socket.connect(new AFUNIXSocketAddress(socketFile)); conn = new DefaultBHttpClientConnection(CLIENT_BUFFER_SIZE); conn.bind(socket); } catch (IOException e) { throw new RuntimeException(e.getMessage(), e); } return conn; }

Target:
private DefaultBHttpClientConnection getConnection() { DefaultBHttpClientConnection conn; File socketFile = new File(socketPath); AFUNIXSocket socket; try { socket = AFUNIXSocket.newInstance(); socket.connect(new AFUNIXSocketAddress(socketFile)); conn = new DefaultBHttpClientConnection(CLIENT_BUFFER_SIZE); conn.bind(socket); } catch (IOException e) { throw new RuntimeException(e.getMessage(), e); } return conn; }
Source:
public void start() { exec.submit( () -> { while (!Thread.interrupted()) { try { LOG.debug(callerName + ":Waiting for cache update notification"); Pair<String, byte[]> update = updateQueue.take(); String authorizer = update.lhs; byte[] serializedMap = update.rhs; BasicAuthDBConfig dbConfig = itemConfigMap == null ? itemConfig : itemConfigMap.get(update.lhs); if (!dbConfig.isEnableCacheNotifications()) { continue; } LOG.debug(callerName + ":Sending cache update notifications"); List<ListenableFuture<StatusResponseHolder>> futures; if (authorizer != null) { futures = sendUpdate(authorizer, serializedMap); } else { futures = sendUpdate(serializedMap); } try { List<StatusResponseHolder> responses = Futures.allAsList(futures) .get( dbConfig.getCacheNotificationTimeout(), TimeUnit.MILLISECONDS ); for (StatusResponseHolder response : responses) { LOG.debug(callerName + ":Got status: " + response.getStatus()); } } catch (Exception e) { LOG.makeAlert(e, callerName + ":Failed to get response for cache notification.").emit(); } LOG.debug(callerName + ":Received responses for cache update notifications."); } catch (Throwable t) { LOG.makeAlert(t, callerName + ":Error occured while handling updates for cachedUserMaps.").emit(); } } } ); }

Target:
public void start() { exec.submit( () -> { while (!Thread.interrupted()) { try { LOG.debug(callerName + ":Waiting for cache update notification"); Pair<String, byte[]> update = updateQueue.take(); String authorizer = update.lhs; byte[] serializedMap = update.rhs; BasicAuthDBConfig authorizerConfig = itemConfigMap.get(update.lhs); if (!authorizerConfig.isEnableCacheNotifications()) { continue; } LOG.debug(callerName + ":Sending cache update notifications"); List<ListenableFuture<StatusResponseHolder>> futures = sendUpdate( authorizer, serializedMap ); try { List<StatusResponseHolder> responses = Futures.allAsList(futures) .get( authorizerConfig.getCacheNotificationTimeout(), TimeUnit.MILLISECONDS ); for (StatusResponseHolder response : responses) { LOG.debug(callerName + ":Got status: " + response.getStatus()); } } catch (Exception e) { LOG.makeAlert(e, callerName + ":Failed to get response for cache notification.").emit(); } LOG.debug(callerName + ":Received responses for cache update notifications."); } catch (Throwable t) { LOG.makeAlert(t, callerName + ":Error occured while handling updates for cachedUserMaps.").emit(); } } } ); }
Source:
public String toString() { final StringBuilder builder = new StringBuilder(); builder.append("Service names: \"").append(Arrays.asList(serviceNames)).append("\" "); builder.append("(class ").append(serviceClassName).append(')'); builder.append(" mode ").append(modeName); builder.append(" state ").append(stateName); if (! stateName.equals(substateName)) { builder.append(" (").append(substateName).append(')'); } if (parentNames != null) { builder.append(" (parent names: ").append(Arrays.asList(parentNames)).append(')'); } final String[] dependencies = this.dependencies; final int dependenciesLength = dependencies.length; if (dependenciesLength > 0) { builder.append(" (dependencies: "); for (int i = 0; i < dependenciesLength; i++) { builder.append(dependencies[i]); if (i < dependenciesLength - 1) { builder.append(", "); } } builder.append(")"); } String exception = this.exception; if (exception != null && ! exception.isEmpty()) { builder.append(" (failure cause: ").append(exception).append(')'); } if (dependencyFailed) { builder.append(" (has failed dependency)"); } if (dependencyUnavailable) { builder.append(" (has unavailable dependency)"); } return builder.toString(); }

Target:
public String toString() { final StringBuilder builder = new StringBuilder(); builder.append("Service \"").append(serviceName).append("\" "); final String[] aliases = this.aliases; if (aliases.length > 0) { builder.append("(aliases: "); for (int i = 0; i < aliases.length; i++) { builder.append(aliases[i]); if (i < aliases.length - 1) { builder.append(", "); } } builder.append(") "); } builder.append("(class ").append(serviceClassName).append(')'); builder.append(" mode ").append(modeName); builder.append(" state ").append(stateName); if (! stateName.equals(substateName)) { builder.append(" (").append(substateName).append(')'); } String parentName = this.parentName; if (parentName != null) { builder.append(" (parent: ").append(parentName).append(')'); } final String[] dependencies = this.dependencies; final int dependenciesLength = dependencies.length; if (dependenciesLength > 0) { builder.append(" (dependencies: "); for (int i = 0; i < dependenciesLength; i++) { builder.append(dependencies[i]); if (i < dependenciesLength - 1) { builder.append(", "); } } builder.append(")"); } String exception = this.exception; if (exception != null && ! exception.isEmpty()) { builder.append(" (failure cause: ").append(exception).append(')'); } if (dependencyFailed) { builder.append(" (has failed dependency)"); } if (dependencyUnavailable) { builder.append(" (has unavailable dependency)"); } return builder.toString(); }
Source:
public void onOpen(final OpenEvent<DisclosurePanel> event) { if (infoTable == null) { AccountDiffPreference diffPrefs; if (diffBaseId == null) { diffPrefs = null; } else { diffPrefs = (new ListenableAccountDiffPreference()).get(); } Util.DETAIL_SVC.patchSetDetail(patchSet.getId(), diffBaseId, diffPrefs, new GerritCallback<PatchSetDetail>() { public void onSuccess(final PatchSetDetail result) { ensureLoaded(result); patchTable.setRegisterKeys(true); } }); } }

Target:
public void onOpen(final OpenEvent<DisclosurePanel> event) { if (infoTable == null) { AccountDiffPreference diffPrefs; if (diffBaseId == null) { diffPrefs = null; } else { diffPrefs = new ListenableAccountDiffPreference().get(); } Util.DETAIL_SVC.patchSetDetail(patchSet.getId(), diffBaseId, diffPrefs, new GerritCallback<PatchSetDetail>() { public void onSuccess(final PatchSetDetail result) { ensureLoaded(result); patchTable.setRegisterKeys(true); } }); } }
Source:
public String getIndent() { StringBuilder indentString = new StringBuilder(); for(int i=0; i<indent; i++){ indentString.append(" "); } return indentString.toString(); }

Target:
public String getIndent() { StringBuilder indentString = new StringBuilder(); for (int i = 0; i < indentSize; i++) { indentString.append(' '); } return indentString.toString(); }
Source:
private JLabel getAddedCountNameLabel() { if (addedCountNameLabel == null) { addedCountNameLabel = new javax.swing.JLabel(); addedCountNameLabel.setText(Constant.messages.getString("spider.toolbar.added.label")); } return addedCountNameLabel; }

Target:
private JLabel getAddedCountNameLabel() { if (addedCountNameLabel == null) { addedCountNameLabel = new JLabel(); addedCountNameLabel.setText(Constant.messages.getString("spider.toolbar.added.label")); } return addedCountNameLabel; }
Source:
public static Arg<Integer> columnCount(ColumnSelection columnSelection) { return getArg("columnCount", Iterables.size(columnSelection.getSelectedColumns()), true); }

Target:
public static Arg<?> columnCount(ColumnSelection columnSelection) { return getArg("columnCount", columnSelection.allColumnsSelected() ? "all" : Iterables.size(columnSelection.getSelectedColumns()), true); }
Source:
public RetryableFeignLoadBalancer(ILoadBalancer lb, IClientConfig clientConfig, ServerIntrospector serverIntrospector, LoadBalancedRetryPolicyFactory loadBalancedRetryPolicyFactory, LoadBalancedBackOffPolicyFactory loadBalancedBackOffPolicyFactory, LoadBalancedRetryListenerFactory loadBalancedRetryListenerFactory) { super(lb, clientConfig, serverIntrospector); this.loadBalancedRetryPolicyFactory = loadBalancedRetryPolicyFactory; this.setRetryHandler(new DefaultLoadBalancerRetryHandler(clientConfig)); this.loadBalancedBackOffPolicyFactory = loadBalancedBackOffPolicyFactory == null ? new LoadBalancedBackOffPolicyFactory.NoBackOffPolicyFactory() : loadBalancedBackOffPolicyFactory; this.loadBalancedRetryListenerFactory = loadBalancedRetryListenerFactory == null ? new LoadBalancedRetryListenerFactory.NoRetryListenerFactory() : loadBalancedRetryListenerFactory; }

Target:
public RetryableFeignLoadBalancer(ILoadBalancer lb, IClientConfig clientConfig, ServerIntrospector serverIntrospector, LoadBalancedRetryPolicyFactory loadBalancedRetryPolicyFactory, LoadBalancedBackOffPolicyFactory loadBalancedBackOffPolicyFactory, LoadBalancedRetryListenerFactory loadBalancedRetryListenerFactory) { super(lb, clientConfig, serverIntrospector); this.loadBalancedRetryPolicyFactory = loadBalancedRetryPolicyFactory; this.setRetryHandler(new DefaultLoadBalancerRetryHandler(clientConfig)); this.loadBalancedBackOffPolicyFactory = loadBalancedBackOffPolicyFactory == null ? new LoadBalancedBackOffPolicyFactory.NoBackOffPolicyFactory() : loadBalancedBackOffPolicyFactory; this.loadBalancedRetryListenerFactory = loadBalancedRetryListenerFactory == null ? new LoadBalancedRetryListenerFactory.DefaultRetryListenerFactory() : loadBalancedRetryListenerFactory; }
Source:
public void shutdownRequested(IRecordProcessorCheckpointer checkpointer) { LOG.info("Shutdown is requested."); if (!initialized) { LOG.info("Record processor was not initialized so no need to initiate a final checkpoint."); return; } try { LOG.info("Requesting a checkpoint on shutdown notification."); checkpointer.checkpoint(); } catch (InvalidStateException e) { LOG.error("Checkpoint triggered during shutdown encountered InvalidStateException: " + e.toString()); } catch (ShutdownException e) { LOG.error("Checkpoint triggered during shutdown encountered ShutdownException: " + e.toString()); } }

Target:
public void shutdownRequested(IRecordProcessorCheckpointer checkpointer) { LOG.info("Shutdown is requested."); if (!initialized) { LOG.info("Record processor was not initialized so no need to initiate a final checkpoint."); return; } LOG.info("Requesting a checkpoint on shutdown notification."); if (!protocol.shutdownRequested(checkpointer)) { LOG.error("Child process failed to complete shutdown notification."); } }
Source:
public boolean receive(InputStream input) throws MessageNotCompleteException, IOException { if (this.fileBytesLeft <= 0 && input.available() >= SIZEOF_INTEGER) { this.fileBytesLeft = readInteger(input); openRandomInFile(); } int read; while ((read = input.read(byteBuffer)) > 0) { fileBuffer.write(byteBuffer, 0, read); this.fileBytesLeft -= read; } boolean readComplete = isInFileComplete(); if (isBufferFilled() || readComplete) { flushBuffer(); } if (readComplete) { closeInFile(); } return readComplete; }

Target:
public boolean receive(InputStream input) throws MessageNotCompleteException, IOException { if (this.fileBytesLeft <= 0 && input.available() >= SIZEOF_INTEGER) { this.fileBytesLeft = readInteger(input); openRandomInFile(); } int read; while ((read = input.read(byteBuffer)) > 0) { fileBuffer.write(byteBuffer, 0, read); this.fileBytesLeft -= read; } boolean readComplete = isFileComplete(); if (isBufferFilled() || readComplete) { flushBuffer(); } if (readComplete) { closeInFile(); } return readComplete; }
Source:
public void testSSLConnect() throws IOException { String connectionId = selector.connect(new InetSocketAddress("localhost", server.port), BUFFER_SIZE, BUFFER_SIZE, PortType.SSL); Assert.assertFalse("Channel should not be ready by now (until handshake completes)", selector.isChannelReady(connectionId)); while (!selector.connected().contains(connectionId)) { selector.poll(10000L); } Assert.assertTrue("Channel should have been ready by now ", selector.isChannelReady(connectionId)); }

Target:
public void testSSLConnect() throws IOException { String connectionId = selector.connect(new InetSocketAddress("localhost", server.port), BUFFER_SIZE, BUFFER_SIZE, PortType.SSL); while (!selector.connected().contains(connectionId)) { selector.poll(10000L); } Assert.assertTrue("Channel should have been ready by now ", selector.isChannelReady(connectionId)); }
Source:
static byte[] encodeKey(String key, Charset charset) { checkNotNull(key, "key"); byte[] keyBytes = key.getBytes(charset); int length = keyBytes.length; if (length > 250) { throw new IllegalArgumentException("Key is too long: " + key); } if (length <= 0) { throw new IllegalArgumentException("Key is empty"); } for (int i = 0; i < length; i++) { final byte c = keyBytes[i]; if (c >= 0 && c <= 32) { throw new IllegalArgumentException("Invalid key: " + key); } } return keyBytes; }

Target:
static byte[] encodeKey(String key, Charset charset) { checkNotNull(key, "key"); checkNotNull(charset, "charset"); byte[] keyBytes = key.getBytes(charset); int length = keyBytes.length; if (length > 250) { throw new IllegalArgumentException("Key is too long: " + key); } if (length <= 0) { throw new IllegalArgumentException("Key is empty"); } for (int i = 0; i < length; i++) { final byte c = keyBytes[i]; if (c >= 0 && c <= 32) { throw new IllegalArgumentException("Invalid key: " + key); } } return keyBytes; }
Source:
public Request authenticate(Route route, Response response) throws IOException { if(unauthorizedForCluster(response)){ String requestUrl = response.request().url().toString(); Request authRequest = new Request.Builder() .addHeader("X-CSRF-Token", "1") .url(route.address().url().toString() + "oauth/authorize?response_type=token&client_id=openshift-challenging-client") .build(); try ( Response authResponse = tryAuth(authRequest)){ if(authResponse.isSuccessful()) { String token = captureToken(authResponse); return response.request().newBuilder() .header(IHttpConstants.PROPERTY_AUTHORIZATION, String.format("%s %s", IHttpConstants.AUTHORIZATION_BEARER, token)) .build(); } } throw new UnauthorizedException(captureAuthDetails(requestUrl), ResponseCodeInterceptor.getStatus(response.body().string())); } return null; }

Target:
public Request authenticate(Route route, Response response) throws IOException { if(unauthorizedForCluster(response)){ String requestUrl = response.request().url().toString(); Request authRequest = new Request.Builder() .addHeader(CSRF_TOKEN, "1") .url(route.address().url().toString() + "oauth/authorize?response_type=token&client_id=openshift-challenging-client") .build(); try ( Response authResponse = tryAuth(authRequest)){ if(authResponse.isSuccessful()) { String token = extractAndSetAuthContextToken(authResponse); return response.request().newBuilder() .header(IHttpConstants.PROPERTY_AUTHORIZATION, String.format("%s %s", IHttpConstants.AUTHORIZATION_BEARER, token)) .build(); } } throw new UnauthorizedException(captureAuthDetails(requestUrl), ResponseCodeInterceptor.getStatus(response.body().string())); } return null; }
Source:
protected void removeProxies(CoreSession session, List<String> ids) { Set<DocumentRef> proxies = new HashSet<>(); String query = String.format(PROXY_QUERY_TEMPLATE, String.join("', '", ids)); try (IterableQueryResult res = session.queryAndFetch(query, NXQL.NXQL)) { for (Map<String, Serializable> map : res) { proxies.add(new IdRef((String) map.get(NXQL.ECM_UUID))); } } session.removeDocuments(proxies.toArray(new DocumentRef[0])); try { session.save(); } catch (PropertyException e) { getLog().warn("Cannot save session", e); } }

Target:
protected void removeProxies(CoreSession session, List<String> ids) { Set<DocumentRef> proxies = new HashSet<>(); String query = String.format(PROXY_QUERY_TEMPLATE, String.join("', '", ids)); try (IterableQueryResult res = session.queryAndFetch(query, NXQL.NXQL)) { for (Map<String, Serializable> map : res) { proxies.add(new IdRef((String) map.get(NXQL.ECM_UUID))); } } session.removeDocuments(proxies.toArray(new DocumentRef[0])); try { session.save(); } catch (PropertyException e) { log.warn("Cannot save session", e); } }
Source:
private String[] breakUpField(String input) { if(input == null ) {return new String[0];} else { return input.split(" "); } }

Target:
private String[] breakUpField(String input) { if(input == null ) {return new String[0];} else { return input.split("\\s+"); } }