auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private TagItemTextCell(ApplicationResources resources, ApplicationTemplates templates) { super(new AbstractCell<SafeHtml>("click", "mouseover", "mouseout") { @Override public void render(Context context, SafeHtml value, SafeHtmlBuilder sb) { TagModel tagModel = (TagModel) context.getKey(); tagModel.setIsAvailable(false); if (value != null) { sb.append(value); } } private void updateTagElement(boolean showOver, Element tagItem, Element tagBtn) { tagItem.getStyle().setBorderColor(showOver ? TAG_INNER_BORDER_COLOR : TAG_BORDER_UNSELECTED); tagBtn.getStyle().setVisibility(showOver ? Visibility.VISIBLE : Visibility.HIDDEN); } @Override public void onBrowserEvent(Context context, Element parent, SafeHtml value, NativeEvent event, ValueUpdater<SafeHtml> valueUpdater) { TagModel tagModel = (TagModel) context.getKey(); Element tagItemElement = parent.getFirstChildElement(); Element tagButtonElement = parent.getNextSiblingElement().getFirstChildElement(); if (event.getType().equals("mouseover") && tagModel.getType() != TagModelType.Root) { updateTagElement(true, tagItemElement, tagButtonElement); } else if (event.getType().equals("mouseout") && !tagModel.getSelection()) { updateTagElement(false, tagItemElement, tagButtonElement); } } }); this.resources = resources; this.templates = templates; }

Target:
private TagItemTextCell(ApplicationResources resources, ApplicationTemplates templates) { super(new AbstractCell<SafeHtml>(CLICK, MOUSEOVER, MOUSEOUT) { @Override public void render(Context context, SafeHtml value, SafeHtmlBuilder sb) { TagModel tagModel = (TagModel) context.getKey(); tagModel.setIsAvailable(false); if (value != null) { sb.append(value); } } private void updateTagElement(boolean showOver, Element tagItem, Element tagBtn) { tagItem.getStyle().setBorderColor(showOver ? TAG_INNER_BORDER_COLOR : TAG_BORDER_UNSELECTED); tagBtn.getStyle().setVisibility(showOver ? Visibility.VISIBLE : Visibility.HIDDEN); } @Override public void onBrowserEvent(Context context, Element parent, SafeHtml value, NativeEvent event, ValueUpdater<SafeHtml> valueUpdater) { TagModel tagModel = (TagModel) context.getKey(); Element tagItemElement = parent.getFirstChildElement(); Element tagButtonElement = parent.getNextSiblingElement().getFirstChildElement(); if (event.getType().equals(MOUSEOVER) && tagModel.getType() != TagModelType.Root) { updateTagElement(true, tagItemElement, tagButtonElement); } else if (event.getType().equals(MOUSEOUT) && !tagModel.getSelection()) { updateTagElement(false, tagItemElement, tagButtonElement); } } }); this.resources = resources; this.templates = templates; }
Source:
private void peerProbeAlternateInterfaces(VDS host) { Network glusterNetwork = findGlusterNetwork(host); GlusterServer glusterServer = DbFacade.getInstance().getGlusterServerDao().get(host.getId()); if (glusterNetwork != null && host.getStatus() == VDSStatus.Up && glusterServer != null) { List<VdsNetworkInterface> interfaces = DbFacade.getInstance().getInterfaceDao().getAllInterfacesForVds(host.getId()); for (VdsNetworkInterface iface : interfaces) { if (glusterNetwork.getName().equals(iface.getNetworkName()) && !StringUtils.isBlank(iface.getAddress()) && !glusterServer.getKnownAddresses().contains(iface.getAddress())) { VDS upServer = getAlternateUpServerInCluster(host.getVdsGroupId(), host.getId()); if (upServer != null) { Boolean peerProbed = glusterPeerProbe(upServer.getId(), iface.getAddress()); if (peerProbed) { glusterServer.getKnownAddresses().add(iface.getAddress()); DbFacade.getInstance() .getGlusterServerDao() .updateKnownAddresses(host.getId(), glusterServer.getKnownAddresses()); } } } } } }

Target:
private void peerProbeAlternateInterfaces(VDS host) { Network glusterNetwork = findGlusterNetwork(host); GlusterServer glusterServer = DbFacade.getInstance().getGlusterServerDao().get(host.getId()); if (glusterNetwork != null && host.getStatus() == VDSStatus.Up && glusterServer != null) { List<VdsNetworkInterface> interfaces = DbFacade.getInstance().getInterfaceDao().getAllInterfacesForVds(host.getId()); for (VdsNetworkInterface iface : interfaces) { if (glusterNetwork.getName().equals(iface.getNetworkName()) && !StringUtils.isBlank(iface.getAddress()) && !glusterServer.getKnownAddresses().contains(iface.getAddress())) { VDS upServer = getAlternateUpServerInCluster(host.getVdsGroupId(), host.getId()); if (upServer != null) { Boolean peerProbed = glusterPeerProbeAdditionalInterface(upServer.getId(), iface.getAddress()); if (peerProbed) { DbFacade.getInstance() .getGlusterServerDao().addKnownAddress(host.getId(), iface.getAddress()); } } } } } }
Source:
private Article populateArticleFromXml(Document doc, Optional<ManifestXml> manifestXml, int xmlDataLength) { ArticleXml xml = new ArticleXml(doc); ArticleIdentity doi; try { doi = xml.readDoi(); } catch (XmlContentException e) { throw complainAboutXml(e); } Article article = findArticleById(doi); final boolean creating = (article == null); if (creating) { article = new Article(); article.setDoi(doi.getKey()); } try { article = xml.build(article); } catch (XmlContentException e) { throw complainAboutXml(e); } relateToJournals(article); populateCategories(article, doc); initializeAssets(article, manifestXml, xml, xmlDataLength); populateRelatedArticles(article, xml); return article; }

Target:
private Article populateArticleFromXml(Document doc, Optional<ManifestXml> manifestXml, int xmlDataLength) { ArticleXml xml = new ArticleXml(doc); ArticleIdentity doi; try { doi = xml.readDoi(); } catch (XmlContentException e) { throw complainAboutXml(e); } Article article = findArticleById(doi); if (article == null) { article = new Article(); article.setDoi(doi.getKey()); } try { article = xml.build(article); } catch (XmlContentException e) { throw complainAboutXml(e); } relateToJournals(article); populateCategories(article, doc); initializeAssets(article, manifestXml, xml, xmlDataLength); populateRelatedArticles(article, xml); return article; }
Source:
private static void queryData(Dataset ds) { JenaTextExample1.queryData(ds); }

Target:
private static void queryData(Dataset ds) { queryDataWithoutProperty(ds); }
Source:
public void internalReceiveCommand(String itemName, Command command) { super.internalReceiveCommand(itemName, command); logger.debug("MyQ binding received command '{}' for item '{}'", command, itemName); if (myqOnlineData != null) { computeCommandForItem(command, itemName); } }

Target:
public void internalReceiveCommand(String itemName, Command command) { super.internalReceiveCommand(itemName, command); logger.debug("MyQ binding received command '{}' for item '{}'", command, itemName); if (myqOnlineData != null) { computeCommandForItem(command, itemName); } else { logger.warn("Command '{}' for item '{}' not sent", command, itemName); } }
Source:
public boolean equals(Object obj) { if (! super.equals(obj)) { return false; } InternalObservableList lObj = (InternalObservableList) obj; if (internalList.equals(lObj.internalList)) { return true; } return false; }

Target:
public boolean equals(Object obj) { if (!super.equals(obj)) { return false; } final InternalObservableList lObj = (InternalObservableList) obj; if (internalList.equals(lObj.internalList)) { return internalList.equals(lObj.internalList); } return false; }
Source:
public <T> UpdateResults update(final T entity, final UpdateOperations<T> operations) { if (entity instanceof Query) { return update((Query<T>) entity, operations); } return update((Query<T>) createQuery(mapper.getMappedClass(entity).getClazz()) .disableValidation() .filter(Mapper.ID_KEY, mapper.getId(entity)), operations); }

Target:
public <T> UpdateResults update(final T entity, final UpdateOperations<T> operations) { if (entity instanceof Query) { return update((Query<T>) entity, operations); } final MappedClass mc = mapper.getMappedClass(entity); Query<?> query = createQuery(mapper.getMappedClass(entity).getClazz()) .disableValidation() .filter(Mapper.ID_KEY, mapper.getId(entity)); if (!mc.getFieldsAnnotatedWith(Version.class).isEmpty()) { final MappedField field = mc.getFieldsAnnotatedWith(Version.class).get(0); query.field(field.getNameToStore()).equal(field.getFieldValue(entity)); } return update((Query<T>) query, operations); }
Source:
public void testPendingReadLacOpMissingExplicitLAC() throws Exception { LedgerHandle lh = bkc.createLedger(3, 3, 2, BookKeeper.DigestType.CRC32, pwd); lh.append(data); lh.append(data); lh.append(data); final CompletableFuture<Long> result = new CompletableFuture<>(); PendingReadLacOp pro = new PendingReadLacOp(lh, (rc, lac) -> result.complete(lac)) { @Override public void initiate() { for (int i = 0; i < lh.metadata.currentEnsemble.size(); i++) { final Integer index = new Integer(i); ByteBufList buffer = lh.getDigestManager().computeDigestAndPackageForSending( 2, 1, data.length, Unpooled.wrappedBuffer(data)); bkc.scheduler.schedule(() -> { readLacComplete( 0, lh.getId(), null, Unpooled.copiedBuffer(buffer.toArray()), index); }, 0, TimeUnit.SECONDS); lh.bk.getBookieClient().readLac(lh.metadata.currentEnsemble.get(i), lh.ledgerId, this, i); } } }; pro.initiate(); assertEquals(1, result.get().longValue()); }

Target:
public void testPendingReadLacOpMissingExplicitLAC() throws Exception { LedgerHandle lh = bkc.createLedger(3, 3, 2, BookKeeper.DigestType.CRC32, pwd); lh.append(data); lh.append(data); lh.append(data); final CompletableFuture<Long> result = new CompletableFuture<>(); PendingReadLacOp pro = new PendingReadLacOp(lh, (rc, lac) -> result.complete(lac)) { @Override public void initiate() { for (int i = 0; i < lh.metadata.currentEnsemble.size(); i++) { final int index = i; ByteBufList buffer = lh.getDigestManager().computeDigestAndPackageForSending( 2, 1, data.length, Unpooled.wrappedBuffer(data)); bkc.scheduler.schedule(() -> { readLacComplete( 0, lh.getId(), null, Unpooled.copiedBuffer(buffer.toArray()), index); }, 0, TimeUnit.SECONDS); lh.bk.getBookieClient().readLac(lh.metadata.currentEnsemble.get(i), lh.ledgerId, this, i); } } }; pro.initiate(); assertEquals(1, result.get().longValue()); }
Source:
private static CloseableHttpAsyncClient createNoSSLClient() { TrustStrategy acceptingTrustStrategy = (X509Certificate[] chain, String authType) -> true; SSLContext sslContext = null; try { sslContext = SSLContexts.custom().loadTrustMaterial(null, acceptingTrustStrategy).build(); } catch (Exception e) { logger.error("Could not create SSLContext"); } return HttpAsyncClients.custom() .setSSLHostnameVerifier(NoopHostnameVerifier.INSTANCE) .setSSLContext(sslContext).build(); }

Target:
private static CloseableHttpAsyncClient createNoSSLClient() { final TrustStrategy acceptingTrustStrategy = (X509Certificate[] chain, String authType) -> true; try { final SSLContext sslContext = SSLContexts.custom().loadTrustMaterial(null, acceptingTrustStrategy).build(); return HttpAsyncClients.custom() .setSSLHostnameVerifier(NoopHostnameVerifier.INSTANCE) .setSSLContext(sslContext).build(); } catch (Exception e) { logger.error("Could not create SSLContext",e); return null; } }
Source:
public void validateClientId(FacesContext context, UIComponent component, Object value) { OAuth2ClientService clientService = Framework.getService(OAuth2ClientService.class); if (!(component instanceof UIInput && value instanceof String)) { return; } Object currentValue = ((UIInput) component).getValue(); if (currentValue != null && currentValue.equals(value)) { return; } if (clientService.hasClient((String) value)) { FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_ERROR, ComponentUtils.translate(context, "label.oauth2.existing.clientId"), null); throw new ValidatorException(message); } }

Target:
public void validateClientId(FacesContext context, UIComponent component, Object value) { if (!(component instanceof UIInput && value instanceof String)) { return; } Object currentValue = ((UIInput) component).getValue(); if (currentValue != null && currentValue.equals(value)) { return; } OAuth2ClientService clientService = Framework.getService(OAuth2ClientService.class); if (clientService.hasClient((String) value)) { FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_ERROR, ComponentUtils.translate(context, "label.oauth2.existing.clientId"), null); throw new ValidatorException(message); } }
Source:
public List<GroupInfo> parseGroupInfos(JsonElement result) throws RestApiException { List<GroupInfo> list = null; SortedMap<String, GroupInfo> map = gson.fromJson(result, GROUP_MAP_TYPE); list = new ArrayList(map.values()); return list; }

Target:
public List<GroupInfo> parseGroupInfos(JsonElement result) throws RestApiException { SortedMap<String, GroupInfo> map = gson.fromJson(result, GROUP_MAP_TYPE); return new ArrayList(map.values()); }
Source:
private void scanProjects(final File dir, final String prefix, final SortedSet<Project.NameKey> names) { final File[] ls = dir.listFiles(); if (ls == null) { return; } for (File f : ls) { String fileName = f.getName(); if (FileKey.isGitRepository(f, FS.DETECTED)) { if (fileName.equals(Constants.DOT_GIT)) { continue; } Project.NameKey nameKey = getProjectName(prefix, fileName); if (isUnreasonableName(nameKey)) { log.warn("Ignoring unreasonably named repository " + f.getAbsolutePath()); } else { names.add(nameKey); } } else if (f.isDirectory()) { scanProjects(f, prefix + f.getName() + "/", names); } } }

Target:
private void scanProjects(final File dir, final String prefix, final SortedSet<Project.NameKey> names) { final File[] ls = dir.listFiles(); if (ls == null) { return; } for (File f : ls) { String fileName = f.getName(); if (fileName.equals(Constants.DOT_GIT)) { } else if (FileKey.isGitRepository(f, FS.DETECTED)) { Project.NameKey nameKey = getProjectName(prefix, fileName); if (isUnreasonableName(nameKey)) { log.warn("Ignoring unreasonably named repository " + f.getAbsolutePath()); } else { names.add(nameKey); } } else if (f.isDirectory()) { scanProjects(f, prefix + f.getName() + "/", names); } } }
Source:
public void shouldValidateEmailAddress_withValidEmailAddresses() { final List<String> validEmails = new ArrayList<String>(); validEmails.add("prettyandsimple@example.com"); validEmails.add("very.common@example.com"); validEmails.add("disposable.style.email.with+symbol@example.com"); validEmails.add("other.email-with-dash@example.com"); validEmails.add("x@example.com"); validEmails.add("example-indeed@strange-example.com"); validEmails.add("admin@mailserver1"); validEmails.add("#!$%&'*+-/=?^_`{}|~@example.org"); validEmails.add("example@localhost"); validEmails.add("example@s.solutions"); validEmails.add("user@com"); validEmails.add("user@localserver"); validEmails.add("john..doe@example.com"); final List<String> wrongValidatedEmails = new ArrayList<>(); for (final String email : validEmails) { try { Check.isValidEmail(field, email); } catch (final ValidationException e) { wrongValidatedEmails.add(email); } } if (!wrongValidatedEmails.isEmpty()) { fail("Expected to validate the following email addresses, but were actually invalidated: " + wrongValidatedEmails); } }

Target:
public void shouldValidateEmailAddress_withValidEmailAddresses() { final List<String> validEmails = new ArrayList<String>(); validEmails.add("prettyandsimple@example.com"); validEmails.add("very.common@example.com"); validEmails.add("disposable.style.email.with+symbol@example.com"); validEmails.add("other.email-with-dash@example.com"); validEmails.add("x@example.com"); validEmails.add("example-indeed@strange-example.com"); validEmails.add("admin@mailserver1"); validEmails.add("#!$%&'*+-/=?^_`{}|~@example.org"); validEmails.add("example@localhost"); validEmails.add("example@s.solutions"); validEmails.add("user@com"); validEmails.add("user@localserver"); validEmails.add("john..doe@example.com"); final List<String> invalidatedEmails = new ArrayList<>(); for (final String email : validEmails) { try { Check.isValidEmail(field, email); } catch (final ValidationException e) { invalidatedEmails.add(email); } } if (!invalidatedEmails.isEmpty()) { fail("Expected to validate the following email addresses, but were actually invalidated: " + invalidatedEmails); } }
Source:
public PreviousPeriodMeasureDefinition( @JsonProperty("measureIdentifier") final String measureIdentifier, @JsonProperty("dateDataSets") final List<PreviousPeriodDateDataSet> dateDataSets) { this.measureIdentifier = notNull(measureIdentifier, "'measureIdentifier' must not be null!"); this.dateDataSets = notEmpty(dateDataSets, "'dateDataSets' list must not be empty!"); }

Target:
public PreviousPeriodMeasureDefinition( @JsonProperty("measureIdentifier") final String measureIdentifier, @JsonProperty("dateDataSets") final List<PreviousPeriodDateDataSet> dateDataSets) { this.measureIdentifier = notNull(measureIdentifier, "measureIdentifier"); this.dateDataSets = notEmpty(dateDataSets, "dateDataSets"); }
Source:
public void testRejectedExecution() { Client client = new Client(getContext(), "api-key"); for (int k = 0; k < MAX_ALLOWED_TASKS * 2; k++) { client.notify(new Throwable()); } }

Target:
public void testRejectedExecution() throws Exception { assertEquals(0, errorStorageDir.listFiles().length); for (int k = 0; k < TASK_COUNT; k++) { client.notify(new Throwable("Rejected Execution")); } File[] files = errorStorageDir.listFiles(); assertTrue(files.length > 0); File errorFile = files[0]; ErrorStoreTest.checkFirstErrorReportFile(errorFile); }
Source:
public static void main(String args[]){ List<String> params = new ArrayList<String>(); params.add("--plugin"); params.add(${workflow-name}Decider.class.getCanonicalName()); params.add("--"); params.addAll(Arrays.asList(args)); System.out.println("Parameters: " + Arrays.deepToString(params.toArray())); net.sourceforge.seqware.pipeline.runner.PluginRunner.main(params.toArray(new String[params.size()])); }

Target:
public static void main(String args[]){ List<String> params = new ArrayList<String>(); if (ArrayUtils.contains(args,"--verbose")){ params.add("--verbose"); } params.add("--plugin"); params.add(${workflow-name}Decider.class.getCanonicalName()); params.add("--"); params.addAll(Arrays.asList(args)); System.out.println("Parameters: " + Arrays.deepToString(params.toArray())); net.sourceforge.seqware.pipeline.runner.PluginRunner.main(params.toArray(new String[params.size()])); }
Source:
private static void initFileSystem() throws IOException { Configuration conf = new Configuration(); conf.set("FS.defaultFS", STORAGE_URL); jailedFileSystem.initialize(LocalFileSystem.getDefaultUri(conf), conf); }

Target:
private static void initFileSystem() throws IOException { Configuration conf = new Configuration(); conf.set("fs.defaultFS", STORAGE_URL); jailedFileSystem.initialize(LocalFileSystem.getDefaultUri(conf), conf); }
Source:
protected ClassDescriptor selectClassDescriptor(Map row) throws PersistenceBrokerException { ClassDescriptor baseClassDescriptor = getClassDescriptor(); List<?> extentClassNames = baseClassDescriptor.getExtentClassNames(); if (extentClassNames.size() != 1) { throw new PersistenceBrokerException("The class descriptor for " + baseClassDescriptor.getClassNameOfObject() + " should have had exactly 1 extent class, but instead had " + extentClassNames.size()); } String extentClassName = (String) extentClassNames.get(0); ClassDescriptor extentClassDescriptor = baseClassDescriptor.getRepository().getDescriptorFor(extentClassName); if (extentClassDescriptor == null) { throw new PersistenceBrokerException("Could not find " + extentClassName + " extent class descriptor for base class " + baseClassDescriptor.getClassNameOfObject()); } return extentClassDescriptor; }

Target:
protected ClassDescriptor selectClassDescriptor(Map row) throws PersistenceBrokerException { ClassDescriptor baseClassDescriptor = getClassDescriptor(); List<?> extentClassNames = baseClassDescriptor.getExtentClassNames(); if (extentClassNames.size() != 1) { throw new PersistenceBrokerException("The class descriptor for " + baseClassDescriptor.getClassNameOfObject() + " should have had exactly 1 extent class, but instead had " + extentClassNames.size() + " extents: " + extentClassNames); } String extentClassName = (String) extentClassNames.get(0); ClassDescriptor extentClassDescriptor = baseClassDescriptor.getRepository().getDescriptorFor(extentClassName); if (extentClassDescriptor == null) { throw new PersistenceBrokerException("Could not find " + extentClassName + " extent class descriptor for base class " + baseClassDescriptor.getClassNameOfObject()); } else if (StringUtils.equals(baseClassDescriptor.getClassNameOfObject(), extentClassDescriptor.getClassNameOfObject())) { throw new PersistenceBrokerException("The base class descriptor for " + baseClassDescriptor.getClassNameOfObject() + " should not have been selected as the implicit descriptor for extent class " + extentClassName); } return extentClassDescriptor; }
Source:
public Scope getScope(String name, int tenantId) throws APIManagementException { try (Connection connection = APIMgtDBUtil.getConnection()) { try (PreparedStatement preparedStatement = connection.prepareStatement(SQLConstants.GET_SCOPE_SQL)) { preparedStatement.setString(1, name); preparedStatement.setInt(2, tenantId); try (ResultSet resultSet = preparedStatement.executeQuery()) { if (resultSet.next()) { String displayName = resultSet.getString("DISPLAY_NAME"); String description = resultSet.getString("DESCRIPTION"); Scope scope = new Scope(); scope.setName(displayName); scope.setDescription(description); scope.setKey(name); scope.setRoles(String.join(",", getScopeBindings(connection, name, tenantId))); return scope; } } } catch (SQLException e) { log.error("Error while deleting scopes from db", e); throw new APIManagementException("Error while deleting scopes from db", e, ExceptionCodes.INTERNAL_ERROR); } } catch (SQLException e) { throw new APIManagementException("Error while retrieving database connection", e, ExceptionCodes.INTERNAL_ERROR); } return null; }

Target:
public Scope getScope(String name, int tenantId) throws APIManagementException { try (Connection connection = APIMgtDBUtil.getConnection()) { try (PreparedStatement preparedStatement = connection.prepareStatement(SQLConstants.GET_SCOPE_SQL)) { preparedStatement.setString(1, name); preparedStatement.setInt(2, tenantId); try (ResultSet resultSet = preparedStatement.executeQuery()) { if (resultSet.next()) { String displayName = resultSet.getString("DISPLAY_NAME"); String description = resultSet.getString("DESCRIPTION"); Scope scope = new Scope(); scope.setName(displayName); scope.setDescription(description); scope.setKey(name); scope.setRoles(String.join(",", getScopeBindings(connection, name, tenantId))); return scope; } } } catch (SQLException e) { String msg = String.format("Error while retrieving scope %s from db", name); log.error(msg, e); throw new APIManagementException(msg, e, ExceptionCodes.INTERNAL_ERROR); } } catch (SQLException e) { throw new APIManagementException("Error while retrieving database connection", e, ExceptionCodes.INTERNAL_ERROR); } return null; }
Source:
protected String extractCategory(ValuedParameter[] params, ConstraintViolation<Object> violation) { Iterator<Node> path = violation.getPropertyPath().iterator(); path.next(); StringBuilder cat = new StringBuilder(); cat.append(params[path.next().as(ParameterNode.class).getParameterIndex()].getName()); while (path.hasNext()) { cat.append(".").append(path.next()); } return cat.toString(); }

Target:
protected String extractCategory(ValuedParameter[] params, ConstraintViolation<Object> violation) { Iterator<Node> path = violation.getPropertyPath().iterator(); Node method = path.next(); logger.debug("Constraint violation on method {}: {}", method, violation); StringBuilder cat = new StringBuilder(); cat.append(params[path.next().as(ParameterNode.class).getParameterIndex()].getName()); while (path.hasNext()) { cat.append(".").append(path.next()); } return cat.toString(); }
Source:
public void define(NewController context) { WebService.NewAction action = context.createAction(ACTION_RENAME) .setSince("6.6") .setDescription("Rename the main branch of a project") .setInternal(true) .setPost(true) .setHandler(this); action .createParam(PARAM_PROJECT) .setDescription("Project key") .setExampleValue(KEY_PROJECT_EXAMPLE_001) .setRequired(true); action .createParam(PARAM_BRANCH) .setDescription("New name of the main branch") .setExampleValue("master") .setRequired(true); }

Target:
public void define(NewController context) { WebService.NewAction action = context.createAction(ACTION_RENAME) .setSince("6.6") .setDescription("Rename the main branch of a project. <br />" + "Requires 'Administer' permission on the specified project.") .setInternal(true) .setPost(true) .setHandler(this); action .createParam(PARAM_PROJECT) .setDescription("Project key") .setExampleValue(KEY_PROJECT_EXAMPLE_001) .setRequired(true); action .createParam(PARAM_BRANCH) .setDescription("New name of the main branch") .setExampleValue("master") .setRequired(true); }
Source:
protected void applyMutation(Mutation uncastMutation) { AssociatedMutation mutation = (AssociatedMutation) uncastMutation; MutatableCode mutatableCode = mutation.mutatableCode; MInsn newArrayInsn = newArrayLengthInsns.get(mutation.newArrayToChangeIdx); int newArrayInsnIdx = mutatableCode.getInstructionIndex(newArrayInsn); if (newArrayInsnIdx < 0) { newArrayInsn = scanNewArray(mutatableCode); if (newArrayInsn == null) { return; } newArrayInsnIdx = mutatableCode.getInstructionIndex(newArrayInsn); } MInsn newInsn = new MInsn(); newInsn.insn = new Instruction(); newInsn.insn.info = Instruction.getOpcodeInfo(Opcode.CONST_16); mutatableCode.allocateTemporaryVRegs(1); newArrayInsn.insn.vregB = mutatableCode.getTemporaryVReg(0); newInsn.insn.vregA = (int) newArrayInsn.insn.vregB; newInsn.insn.vregB = rng.nextInt(100); mutatableCode.insertInstructionAt(newInsn, newArrayInsnIdx); Log.info("Changed the length of the array to " + newInsn.insn.vregB); stats.incrementStat("Changed length of new array"); mutatableCode.finishedUsingTemporaryVRegs(); }

Target:
protected void applyMutation(Mutation uncastMutation) { AssociatedMutation mutation = (AssociatedMutation) uncastMutation; MutatableCode mutatableCode = mutation.mutatableCode; MInsn newArrayInsn = newArrayLengthInsns.get(mutation.newArrayToChangeIdx); int newArrayInsnIdx = mutatableCode.getInstructionIndex(newArrayInsn); if (newArrayInsnIdx < 0) { newArrayInsnIdx = scanNewArray(mutatableCode); if (newArrayInsnIdx == -1) { return; } } MInsn newInsn = new MInsn(); newInsn.insn = new Instruction(); newInsn.insn.info = Instruction.getOpcodeInfo(Opcode.CONST_16); mutatableCode.allocateTemporaryVRegs(1); newArrayInsn.insn.vregB = mutatableCode.getTemporaryVReg(0); newInsn.insn.vregA = (int) newArrayInsn.insn.vregB; newInsn.insn.vregB = rng.nextInt(100); mutatableCode.insertInstructionAt(newInsn, newArrayInsnIdx); Log.info("Changed the length of the array to " + newInsn.insn.vregB); stats.incrementStat("Changed length of new array"); mutatableCode.finishedUsingTemporaryVRegs(); }
Source:
public void shouldFillInWarningIfChePluginDoesNotHaveAnyContainersButThereAreRelatedCommands() throws Exception { ChePlugin chePlugin = createChePlugin("plugin"); String pluginRef = chePlugin.getId() + ":" + chePlugin.getVersion(); CommandImpl pluginCommand = new CommandImpl("test-command", "echo Hello World!", "custom"); pluginCommand.getAttributes().put("plugin", pluginRef); internalEnvironment.getCommands().add(pluginCommand); applier.apply(internalEnvironment, singletonList(chePlugin)); List<Warning> envWarnings = internalEnvironment.getWarnings(); assertEquals(envWarnings.size(), 1); Warning warning = envWarnings.get(0); assertEquals(warning.getCode(), 44012); assertEquals( warning.getMessage(), "There are configured commands for plugin 'some-id:0.0.3' that doesn't have any containers"); }

Target:
public void shouldFillInWarningIfChePluginDoesNotHaveAnyContainersButThereAreRelatedCommands() throws Exception { ChePlugin chePlugin = createChePlugin("plugin"); String pluginRef = chePlugin.getId() + ":" + chePlugin.getVersion(); CommandImpl pluginCommand = new CommandImpl("test-command", "echo Hello World!", "custom"); pluginCommand.getAttributes().put("plugin", pluginRef); internalEnvironment.getCommands().add(pluginCommand); applier.apply(internalEnvironment, singletonList(chePlugin)); List<Warning> envWarnings = internalEnvironment.getWarnings(); assertEquals(envWarnings.size(), 1); Warning warning = envWarnings.get(0); assertEquals( warning.getCode(), Warnings.COMMAND_IS_CONFIGURED_IN_PLUGIN_WITHOUT_CONTAINERS_WARNING_CODE); assertEquals( warning.getMessage(), "There are configured commands for plugin 'some-id:0.0.3' that doesn't have any containers"); }
Source:
public void testRunMultipleQueries_ignored_failure() { ArrayList<VdcQueryType> queryTypeList = new ArrayList<VdcQueryType>(); queryTypeList.add(VdcQueryType.Search); ArrayList<VdcQueryParametersBase> queryParamsList = new ArrayList<VdcQueryParametersBase>(); queryParamsList.add(new SearchParameters("*win*", SearchType.VM)); Frontend.RunMultipleQueries(queryTypeList, queryParamsList, mockMultipleQueryCallback, "test", mockService); verify(mockService).RunMultipleQueries(eq(queryTypeList), eq(queryParamsList), callbackMultipleQueries.capture()); StatusCodeException exception = new StatusCodeException(0, "0 status code"); callbackMultipleQueries.getValue().onFailure(exception); }

Target:
public void testRunMultipleQueries_ignored_failure() { ArrayList<VdcQueryType> queryTypeList = new ArrayList<VdcQueryType>(); queryTypeList.add(VdcQueryType.Search); ArrayList<VdcQueryParametersBase> queryParamsList = new ArrayList<VdcQueryParametersBase>(); queryParamsList.add(new SearchParameters("*win*", SearchType.VM)); Frontend.RunMultipleQueries(queryTypeList, queryParamsList, mockMultipleQueryCallback, "test", mockService); verify(mockService).RunMultipleQueries(eq(queryTypeList), eq(queryParamsList), callbackMultipleQueries.capture()); StatusCodeException exception = new StatusCodeException(0, "0 status code"); callbackMultipleQueries.getValue().onFailure(exception); verify(mockFrontendFailureEvent, never()).raise(eq(Frontend.class), any(FrontendFailureEventArgs.class)); }
Source:
public void onProcessSelectionEvent(@Observes final ProcessDefSelectionEvent event) { String containerId = event.getDeploymentId(); String serverTemplateId = event.getServerTemplateId(); String processId = event.getProcessId(); processImageService.call((String svgContent) -> displayImage(svgContent), (String message, Throwable throwable) -> { displayImage(""); return false; }).getProcessDiagram(serverTemplateId, containerId, processId); }

Target:
public void onProcessSelectionEvent(@Observes final ProcessDefSelectionEvent event) { String containerId = event.getDeploymentId(); String serverTemplateId = event.getServerTemplateId(); String processId = event.getProcessId(); processImageService.call((String svgContent) -> displayImage(svgContent)).getProcessDiagram(serverTemplateId, containerId, processId); }
Source:
@Override public void onDisconnect() { if (isBound) { context.unbindService(this); } Intent intent = new Intent(context, FusedLocationProviderService.class); context.stopService(intent); service = null; }

Target:
@Override public void onDisconnect() { if (isBound) { context.unbindService(this); isBound = false; } Intent intent = new Intent(context, FusedLocationProviderService.class); context.stopService(intent); service = null; }
Source:
public ResponseEntity<Category> createCategory(@RequestBody @Valid Category category) { String currentUsername = ControllerUtil.getCurrentLoggedUsername(); System.out.println(" >>>> Username: " + currentUsername); AppUser user = appUserDao.findUserByUsername(currentUsername); category.setUser(user); Category responseCategory = categoryDao.save(category); return new ResponseEntity<Category>(responseCategory, HttpStatus.OK); }

Target:
public ResponseEntity<Category> createCategory(@RequestBody @Valid Category category) { String currentUsername = ControllerUtil.getCurrentLoggedUsername(); AppUser user = appUserDao.findByUsername(currentUsername); category.setUser(user); Category responseCategory = categoryDao.save(category); return new ResponseEntity<Category>(responseCategory, HttpStatus.OK); }
Source:
public String getUpdateFieldLog(String fieldName, String previousValue, String value){ return "Updated "+ fieldName + " {"+ (previousValue != null? "From: '"+ previousValue + "' to: " : "" ) + "'"+ (value != null ? value : "" ) + "'}" ; }

Target:
public String getUpdateFieldLog(String fieldName, String previousValue, String value){ return "Updated "+ fieldName + " {From: '"+ (previousValue!=null ? previousValue : "" ) + "' to: '"+ (value!=null ? value : "" ) + "'}" ; }
Source:
public String toString() { StringBuilder sb = new StringBuilder(); Object object; for (int i = 0, length = valueTable.length; i < length; i++) { if ((object = valueTable[i]) != null) { sb.append(keyTable[i]); sb.append(" -> "); sb.append(object.toString()); sb.append("\n"); } } return sb.toString(); }

Target:
public String toString() { StringBuilder sb = new StringBuilder(); Object object; for (int i = 0, length = valueTable.length; i < length; i++) { if ((object = valueTable[i]) != null) { sb.append(keyTable[i]); sb.append(" -> "); sb.append(object); sb.append("\n"); } } return sb.toString(); }
Source:
public TypeInference getTypeInference(DataTypeFactory typeFactory) { TypeInference.Builder builder = TypeInference.newBuilder(); builder.outputTypeStrategy(new ResultTypeStrategy(this)); return builder.build(); }

Target:
public TypeInference getTypeInference(DataTypeFactory typeFactory) { TypeInference.Builder builder = TypeInference.newBuilder(); builder.inputTypeStrategy(new HiveUDFInputStrategy()); builder.outputTypeStrategy(new HiveUDFOutputStrategy()); return builder.build(); }
Source:
public PrinterController(Printer printer) { super(printer); }

Target:
public PrinterController(Printer printer) { this.printer = printer; }
Source:
public Void call() throws Exception { init(); OzoneConfiguration configuration = createOzoneConfiguration(); fileSystem = FileSystem.get(URI.create(rootPath), configuration); Path file = new Path(rootPath + "/" + generateObjectName(0)); try (FSDataInputStream stream = fileSystem.open(file)) { referenceDigest = getDigest(stream); } timer = getMetrics().timer("gile-read"); runTests(this::validateFile); return null; }

Target:
public Void call() throws Exception { init(); OzoneConfiguration configuration = createOzoneConfiguration(); fileSystem = FileSystem.get(URI.create(rootPath), configuration); Path file = new Path(rootPath + "/" + generateObjectName(0)); try (FSDataInputStream stream = fileSystem.open(file)) { referenceDigest = getDigest(stream); } timer = getMetrics().timer("file-read"); runTests(this::validateFile); return null; }
Source:
private MoveOrCopyImageGroupParameters createCopyParams(DiskImage diskImage) { Guid destImageGroupID = Guid.newGuid(); Guid srcStorageDomainID = diskImage.getStorageIds().get(0); Map<DiskImage, DiskImage> oldToNewDiskImageMap = imagesHandler.mapChainToNewIDs(diskImage.getId(), destImageGroupID, getParameters().getDestStorageDomainId()); getParameters().getSrcToDstChainMap() .put(destImageGroupID, oldToNewDiskImageMap .keySet() .stream() .collect(Collectors.toMap(di -> di.getImageId(), di -> oldToNewDiskImageMap.get(di)))); List<DiskImage> newChain = new ArrayList(oldToNewDiskImageMap.values()); imagesHandler.sortImageList(newChain); MoveOrCopyImageGroupParameters p = new MoveOrCopyImageGroupParameters(diskImage.getImageId(), srcStorageDomainID, getParameters().getDestStorageDomainId(), ImageOperation.Copy); p.setAddImageDomainMapping(false); p.setVolumeFormat(diskImage.getVolumeFormat()); p.setVolumeType(diskImage.getVolumeType()); p.setUseCopyCollapse(false); p.setWipeAfterDelete(diskImage.isWipeAfterDelete()); p.setEntityInfo(new EntityInfo(VdcObjectType.VM, getVmId())); p.setParentParameters(getParameters()); p.setParentCommand(getActionType()); p.setJobWeight(Job.MAX_WEIGHT); p.setDestImages(newChain); p.setImageGroupID(diskImage.getId()); p.setDestImageGroupId(destImageGroupID); return p; }

Target:
private MoveOrCopyImageGroupParameters createCopyParams(DiskImage diskImage) { Guid srcStorageDomainID = diskImage.getStorageIds().get(0); Guid destImageGroupID = Guid.newGuid(); List<DiskImage> newChain = prepareImageChainMap(diskImage, destImageGroupID); MoveOrCopyImageGroupParameters p = new MoveOrCopyImageGroupParameters(diskImage.getImageId(), srcStorageDomainID, getParameters().getDestStorageDomainId(), ImageOperation.Copy); p.setAddImageDomainMapping(false); p.setVolumeFormat(diskImage.getVolumeFormat()); p.setVolumeType(diskImage.getVolumeType()); p.setUseCopyCollapse(false); p.setWipeAfterDelete(diskImage.isWipeAfterDelete()); p.setEntityInfo(new EntityInfo(VdcObjectType.VM, getVmId())); p.setParentParameters(getParameters()); p.setParentCommand(getActionType()); p.setJobWeight(Job.MAX_WEIGHT); p.setDestImages(newChain); p.setImageGroupID(diskImage.getId()); p.setDestImageGroupId(destImageGroupID); return p; }
Source:
public void init() throws IOException { SWTBotUtils.failIfUIThread(); Thread.currentThread().setName("SWTBot Thread"); SWTBotPreferences.TIMEOUT = 20000; fLogger.addAppender(new ConsoleAppender(new SimpleLayout())); fBot = new SWTWorkbenchBot(); SWTBotUtils.closeView("welcome", fBot); SWTBotUtils.switchToTracingPerspective(); SWTBotUtils.waitForJobs(); fLocation = File.createTempFile("sample", ".xml"); try (BufferedRandomAccessFile braf = new BufferedRandomAccessFile(fLocation, "rw")) { braf.writeBytes(TRACE_START); for (int i = 0; i < 100; i++) { braf.writeBytes(makeEvent(i * 100, i % 4)); } braf.writeBytes(TRACE_END); } }

Target:
public void init() throws IOException { SWTBotUtils.failIfUIThread(); Thread.currentThread().setName("SWTBot Thread"); SWTBotPreferences.TIMEOUT = 20000; fLogger.addAppender(new ConsoleAppender(new SimpleLayout())); fBot = new SWTWorkbenchBot(); SWTBotUtils.closeView("welcome", fBot); SWTBotUtils.switchToTracingPerspective(); SWTBotUtils.waitForJobs(); fLocation = File.createTempFile("sample", ".xml"); try (BufferedRandomAccessFile braf = new BufferedRandomAccessFile(fLocation, "rw")) { braf.writeBytes(TRACE_START); for (int i = 0; i < NUM_EVENTS; i++) { braf.writeBytes(makeEvent(i * 100, i % 4)); } braf.writeBytes(TRACE_END); } }
Source:
void populate(final int row, final AccountGroupIncludeByUuid k) { AccountGroup.UUID uuid = k.getIncludeUUID(); CheckBox checkBox = new CheckBox(); table.setWidget(row, 1, checkBox); checkBox.setEnabled(enabled); if (AccountGroup.isInternalGroup(uuid)) { table.setWidget(row, 2, new Hyperlink(groups.get(uuid).getName(), Dispatcher.toGroup(uuid))); table.setText(row, 3, groups.get(uuid).getDescription()); } else { table.setText(row, 2, uuid.get()); table.setText(row, 3, Util.C.externalGroup()); } final FlexCellFormatter fmt = table.getFlexCellFormatter(); fmt.addStyleName(row, 1, Gerrit.RESOURCES.css().iconCell()); fmt.addStyleName(row, 2, Gerrit.RESOURCES.css().dataCell()); fmt.addStyleName(row, 3, Gerrit.RESOURCES.css().dataCell()); setRowItem(row, k); }

Target:
void populate(final int row, final AccountGroupIncludeByUuid k) { AccountGroup.UUID uuid = k.getIncludeUUID(); CheckBox checkBox = new CheckBox(); table.setWidget(row, 1, checkBox); checkBox.setEnabled(enabled); if (AccountGroup.isInternalGroup(uuid)) { table.setWidget(row, 2, new Hyperlink(groups.get(uuid).getName(), Dispatcher.toGroup(uuid))); table.setText(row, 3, groups.get(uuid).getDescription()); } else { table.setText(row, 2, uuid.get()); } final FlexCellFormatter fmt = table.getFlexCellFormatter(); fmt.addStyleName(row, 1, Gerrit.RESOURCES.css().iconCell()); fmt.addStyleName(row, 2, Gerrit.RESOURCES.css().dataCell()); fmt.addStyleName(row, 3, Gerrit.RESOURCES.css().dataCell()); setRowItem(row, k); }
Source:
private void doBackupCheck() { AuditLogableBase alert = new AuditLogableBase(); EngineBackupLog lastDbBackup = getLastBackupByScope(BACKUP_SCOPE.DB); EngineBackupLog lastFilesBackup = getLastBackupByScope(BACKUP_SCOPE.FILES); if (lastDbBackup == null || lastFilesBackup == null) { auditLogDirector.log(alert, AuditLogType.ENGINE_NO_FULL_BACKUP); } else { Integer backupAlertPeriodInDays = Config.<Integer>getValue(ConfigValues.BackupAlertPeriodInDays); Date lastDbBackupDate = lastDbBackup.getDoneAt(); Date lastFilesBackupDate = lastFilesBackup.getDoneAt(); Date lastFullBackupDate = lastDbBackupDate.compareTo(lastFilesBackupDate) < 0 ? lastDbBackupDate : lastFilesBackupDate; long diffInDays = (Calendar.getInstance().getTimeInMillis() - lastFullBackupDate.getTime()) / TimeUnit.DAYS.toMillis(1); if (diffInDays > backupAlertPeriodInDays) { alert.addCustomValue("Date", lastFullBackupDate.toString()); auditLogDirector.log(alert, AuditLogType.ENGINE_NO_WARM_BACKUP); } } }

Target:
private void doBackupCheck() { AuditLogableBase alert = new AuditLogableBase(); EngineBackupLog lastDbBackup = getLastBackupByScope(BackupScope.DB); EngineBackupLog lastFilesBackup = getLastBackupByScope(BackupScope.FILES); if (lastDbBackup == null || lastFilesBackup == null) { auditLogDirector.log(alert, AuditLogType.ENGINE_NO_FULL_BACKUP); } else { Integer backupAlertPeriodInDays = Config.<Integer>getValue(ConfigValues.BackupAlertPeriodInDays); Date lastDbBackupDate = lastDbBackup.getDoneAt(); Date lastFilesBackupDate = lastFilesBackup.getDoneAt(); Date lastFullBackupDate = lastDbBackupDate.compareTo(lastFilesBackupDate) < 0 ? lastDbBackupDate : lastFilesBackupDate; long diffInDays = (Calendar.getInstance().getTimeInMillis() - lastFullBackupDate.getTime()) / TimeUnit.DAYS.toMillis(1); if (diffInDays > backupAlertPeriodInDays) { alert.addCustomValue("Date", lastFullBackupDate.toString()); auditLogDirector.log(alert, AuditLogType.ENGINE_NO_WARM_BACKUP); } } }
Source:
protected RexCall( RelDataType type, SqlOperator op, List<? extends RexNode> operands) { this.type = Objects.requireNonNull(type); this.op = Objects.requireNonNull(op); this.operands = ImmutableList.copyOf(operands); this.digest = computeDigest(isA(SqlKind.CAST) || isA(SqlKind.NEW_SPECIFICATION)); assert op.getKind() != null : op; assert op.validRexOperands(operands.size(), Litmus.THROW) : this; }

Target:
protected RexCall( RelDataType type, SqlOperator op, List<? extends RexNode> operands) { this.type = Objects.requireNonNull(type); this.op = Objects.requireNonNull(op); this.operands = ImmutableList.copyOf(operands); assert op.getKind() != null : op; assert op.validRexOperands(operands.size(), Litmus.THROW) : this; }
Source:
private boolean isAllowed(@Nonnull SlimefunBackpack backpack, @Nullable ItemStack item) { if (item == null || item.getType() == Material.AIR) { return true; } SlimefunItem sfitem = SlimefunItem.getByItem(item); if (backpack instanceof HazmatBackpack && !(sfitem instanceof Radioactive)) { return false; } if (sfitem instanceof Radioactive && !(backpack instanceof HazmatBackpack)) { return false; } return backpack.isItemAllowed(item, sfitem); }

Target:
private boolean isAllowed(@Nonnull SlimefunBackpack backpack, @Nullable ItemStack item) { if (item == null || item.getType() == Material.AIR) { return true; } return backpack.isItemAllowed(item, SlimefunItem.getByItem(item)); }
Source:
private void init() { Logger.init(this.getApplicationContext()); application = this; registerActivityLifecycleCallbacks(new MyActivityLifecycleCallbacks()); Environment env = new Environment(); env.setupEnvironment(this.getApplicationContext()); createImageCache(); CalligraphyConfig.initDefault(new CalligraphyConfig.Builder() .setDefaultFontPath("fonts/fontawesome-webfont-4.3.0.ttf") .build() ); if (Config.getInstance().getSegmentConfig().isEnabled()) { SegmentFactory.makeInstance(this); } if (Config.getInstance().getFabricConfig().isEnabled()) { Fabric.with(this, new Crashlytics()); } if (Config.getInstance().getNewRelicConfig().isEnabled()) { NewRelic.withApplicationToken(Config.getInstance().getNewRelicConfig().getNewRelicKey()) .withCrashReportingEnabled(false) .start(this); } boolean isOnZeroRatedNetwork = NetworkUtil.isOnZeroRatedNetwork(getApplicationContext()); if ( !isOnZeroRatedNetwork && Config.getInstance().getFacebookConfig().isEnabled()) { com.facebook.Settings.setApplicationId(Config.getInstance().getFacebookConfig().getFacebookAppId()); } if ( Config.getInstance().isNotificationEnabled() ){ Config.ParseNotificationConfig parseNotificationConfig = Config.getInstance().getParseNotificationConfig(); if ( parseNotificationConfig.isEnabled() ) { Parse.enableLocalDatastore(this); Parse.initialize(this, parseNotificationConfig.getParseApplicationId(), parseNotificationConfig.getParseClientKey()); tryToUpdateParseForAppUpgrade(this); } } new Storage(this).repairDownloadCompletionData(); EventBus.getDefault().registerSticky(this); }

Target:
private void init() { Logger.init(this.getApplicationContext()); application = this; registerActivityLifecycleCallbacks(new MyActivityLifecycleCallbacks()); Environment env = new Environment(); env.setupEnvironment(this.getApplicationContext()); createImageCache(); if (Config.getInstance().getSegmentConfig().isEnabled()) { SegmentFactory.makeInstance(this); } if (Config.getInstance().getFabricConfig().isEnabled()) { Fabric.with(this, new Crashlytics()); } if (Config.getInstance().getNewRelicConfig().isEnabled()) { NewRelic.withApplicationToken(Config.getInstance().getNewRelicConfig().getNewRelicKey()) .withCrashReportingEnabled(false) .start(this); } boolean isOnZeroRatedNetwork = NetworkUtil.isOnZeroRatedNetwork(getApplicationContext()); if ( !isOnZeroRatedNetwork && Config.getInstance().getFacebookConfig().isEnabled()) { com.facebook.Settings.setApplicationId(Config.getInstance().getFacebookConfig().getFacebookAppId()); } if ( Config.getInstance().isNotificationEnabled() ){ Config.ParseNotificationConfig parseNotificationConfig = Config.getInstance().getParseNotificationConfig(); if ( parseNotificationConfig.isEnabled() ) { Parse.enableLocalDatastore(this); Parse.initialize(this, parseNotificationConfig.getParseApplicationId(), parseNotificationConfig.getParseClientKey()); tryToUpdateParseForAppUpgrade(this); } } new Storage(this).repairDownloadCompletionData(); EventBus.getDefault().registerSticky(this); }
Source:
private static String resolveFromAuthorizationHeader(HttpServletRequest request) { String authorization = request.getHeader(HttpHeaders.AUTHORIZATION); if (StringUtils.hasText(authorization) && authorization.toLowerCase().startsWith("bearer")) { Matcher matcher = authorizationPattern.matcher(authorization); if (!matcher.matches()) { BearerTokenError error = new BearerTokenError(BearerTokenErrorCodes.INVALID_TOKEN, HttpStatus.UNAUTHORIZED, "Bearer token is malformed", "<LINK_0>"); throw new OAuth2AuthenticationException(error); } return matcher.group("token"); } return null; }

Target:
private static String resolveFromAuthorizationHeader(HttpServletRequest request) { String authorization = request.getHeader(HttpHeaders.AUTHORIZATION); if (StringUtils.startsWithIgnoreCase(authorization, "bearer")) { Matcher matcher = authorizationPattern.matcher(authorization); if (!matcher.matches()) { BearerTokenError error = new BearerTokenError(BearerTokenErrorCodes.INVALID_TOKEN, HttpStatus.UNAUTHORIZED, "Bearer token is malformed", "<LINK_0>"); throw new OAuth2AuthenticationException(error); } return matcher.group("token"); } return null; }