auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected Argument build(ZoneId value, ConfigRegistry config) { return new LoggableBinderArgument<>(Objects.toString(value, null), PreparedStatement::setString); }

Target:
protected Argument build(ZoneId value, ConfigRegistry config) { return LoggableBinderArgument.bindAsString(value); }
Source:
private List<SubmitRecord> invalidResult(Term rule, Term record, String reason) { return ruleError("Submit rule " + rule + " for change " + cd.getId() + " of " + getProjectName() + " output invalid result: " + record + (reason == null ? "" : ". Reason: " + reason)); }

Target:
private List<SubmitRecord> invalidResult(Term rule, Term record, String reason) { return ruleError(String.format("Submit rule %s for change %s of %s output " + "invalid result: %s%s", rule, cd.getId(), getProjectName(), record, (reason == null ? "" : ". Reason: " + reason))); }
Source:
public void doCapture_shouldSetChargeStatusToCaptureApprovedRetryOnError_whenProviderReturnsErrorResponse() { String gatewayTxId = "theTxId"; ChargeEntity charge = createNewChargeWith("worldpay", 1L, CAPTURE_APPROVED, gatewayTxId); ChargeEntity chargeSpy = spy(charge); mockChargeDaoOperations(chargeSpy); worldpayWillRespondWithError(); when(mockedProviders.byName(charge.getPaymentGatewayName())).thenReturn(mockedPaymentProvider); GatewayResponse response = cardCaptureService.doCapture(charge.getExternalId()); assertThat(response.isFailed(), is(true)); InOrder inOrder = Mockito.inOrder(chargeSpy); inOrder.verify(chargeSpy).setStatus(CAPTURE_READY); inOrder.verify(chargeSpy).setStatus(CAPTURE_APPROVED_RETRY); verify(mockedChargeEventDao).persistChargeEventOf(chargeSpy, Optional.empty()); verify(mockStatusUpdater).updateChargeTransactionStatus(charge.getExternalId(), CAPTURE_READY); verify(mockStatusUpdater).updateChargeTransactionStatus(charge.getExternalId(), CAPTURE_APPROVED_RETRY); verifyZeroInteractions(mockUserNotificationService); }

Target:
public void doCapture_shouldSetChargeStatusToCaptureApprovedRetryOnError_whenProviderReturnsErrorResponse() { String gatewayTxId = "theTxId"; ChargeEntity charge = createNewChargeWith("worldpay", 1L, CAPTURE_APPROVED, gatewayTxId); ChargeEntity chargeSpy = spy(charge); mockChargeDaoOperations(chargeSpy); worldpayWillRespondWithError(); when(mockedProviders.byName(charge.getPaymentGatewayName())).thenReturn(mockedPaymentProvider); GatewayResponse response = cardCaptureService.doCapture(charge.getExternalId()); assertThat(response.isFailed(), is(true)); InOrder inOrder = Mockito.inOrder(chargeSpy); inOrder.verify(chargeSpy).setStatus(CAPTURE_READY); inOrder.verify(chargeSpy).setStatus(CAPTURE_APPROVED_RETRY); verify(mockedChargeEventDao).persistChargeEventOf(chargeSpy, Optional.empty()); InOrder inOrderStatusUpdater = Mockito.inOrder(mockStatusUpdater); inOrderStatusUpdater.verify(mockStatusUpdater).updateChargeTransactionStatus(charge.getExternalId(), CAPTURE_READY); inOrderStatusUpdater.verify(mockStatusUpdater).updateChargeTransactionStatus(charge.getExternalId(), CAPTURE_APPROVED_RETRY); verifyZeroInteractions(mockUserNotificationService); }
Source:
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain chain) throws IOException, ServletException { HttpServletRequest request = (HttpServletRequest) servletRequest; HttpServletResponse response = (HttpServletResponse) servletResponse; String token = request.getHeader("X-Proofpoint-TraceToken"); if (token == null || token.isEmpty()) { createAndRegisterNewRequestToken(); } else if (token.charAt(0) == '{') { try { registerTraceToken(TRACE_TOKEN_JSON_CODEC.fromJson(token)); } catch (RuntimeException e) { createAndRegisterNewRequestToken(); } } else { registerRequestToken(token); } chain.doFilter(request, response); }

Target:
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain chain) throws IOException, ServletException { HttpServletRequest request = (HttpServletRequest) servletRequest; HttpServletResponse response = (HttpServletResponse) servletResponse; String token = request.getHeader("X-Proofpoint-TraceToken"); if (token == null || token.isEmpty()) { registerNewRequestToken(request); } else if (token.charAt(0) == '{') { try { registerTraceToken(TRACE_TOKEN_JSON_CODEC.fromJson(token)); } catch (RuntimeException e) { registerNewRequestToken(request); } } else { registerRequestToken(token); } chain.doFilter(request, response); }
Source:
public CollectionResource createCollection(String newName) throws DotRuntimeException { newName = newName.toLowerCase(); User user=(User)HttpManager.request().getAuthorization().getTag(); String folderPath =""; if(dotDavHelper.isTempResource(newName)){ Host host; try { host = hostAPI.find(folder.getHostId(), user, false); folderPath = APILocator.getIdentifierAPI().find(folder).getPath(); } catch (DotDataException e) { Logger.error(DotWebdavHelper.class, e.getMessage(), e); throw new DotRuntimeException(e.getMessage(), e); } catch (DotSecurityException e) { Logger.error(DotWebdavHelper.class, e.getMessage(), e); throw new DotRuntimeException(e.getMessage(), e); } String hostFolderPath = File.separator + host.getHostname() + folderPath; if(!hostFolderPath.endsWith(File.separator)){ hostFolderPath = hostFolderPath + File.separator; } dotDavHelper.createTempFolder(hostFolderPath + newName); File f = new File(File.separator + host.getHostname() + folderPath); TempFolderResourceImpl tr = new TempFolderResourceImpl(f.getPath(),f ,isAutoPub); return tr; } if(!path.endsWith("/")){ path = path + "/"; } try { Folder f = dotDavHelper.createFolder(path + newName, user); FolderResourceImpl fr = new FolderResourceImpl(f, path + newName + "/"); return fr; } catch (Exception e) { Logger.error(this, e.getMessage(), e); throw new DotRuntimeException(e.getMessage(), e); } }

Target:
public CollectionResource createCollection(String newName) throws DotRuntimeException { newName = newName.toLowerCase(); User user=(User)HttpManager.request().getAuthorization().getTag(); String folderPath =""; if(dotDavHelper.isTempResource(newName)){ Host host; try { host = hostAPI.find(folder.getHostId(), user, false); folderPath = APILocator.getIdentifierAPI().find(folder).getPath(); } catch (DotDataException e) { Logger.error(DotWebdavHelper.class, e.getMessage(), e); throw new DotRuntimeException(e.getMessage(), e); } catch (DotSecurityException e) { Logger.error(DotWebdavHelper.class, e.getMessage(), e); throw new DotRuntimeException(e.getMessage(), e); } final String hostFolderPath = new StringBuilder(File.separator).append(host.getHostname()) .append(!folderPath.endsWith(File.separator)?folderPath + File.separator : folderPath).toString(); dotDavHelper.createTempFolder(hostFolderPath + newName); File file = new File(File.separator + host.getHostname() + folderPath); TempFolderResourceImpl tempFolderResource = new TempFolderResourceImpl(file.getPath(),file ,isAutoPub); return tempFolderResource; } if(!path.endsWith("/")){ path = path + "/"; } try { Folder newfolder = dotDavHelper.createFolder(path + newName, user); FolderResourceImpl folderResource = new FolderResourceImpl(newfolder, path + newName + "/"); return folderResource; } catch (Exception e) { Logger.error(this, e.getMessage(), e); throw new DotRuntimeException(e.getMessage(), e); } }
Source:
public void onException(JMSException exception) { logger.error("Error in the JMS connection. " + exception.getMessage()); try { jmsServerConnector.closeAll(); } catch (JMSConnectorException e) { logger.error("Error while closing the connection, session or consumer after receiving the exception call " + "from jms provider. " + e.getMessage()); } try { jmsServerConnector.createMessageListener(); } catch (JMSConnectorException e) { JMSConnectionRetryHandler jmsConnectionRetryHandler = new JMSConnectionRetryHandler(jmsServerConnector, retryInterval, maxRetryCount); try { jmsConnectionRetryHandler.start(); } catch (JMSConnectorException e1) { throw new RuntimeException("Cannot establish the connection again after retrying for " + maxRetryCount + " times", e); } } }

Target:
public void onException(JMSException exception) { logger.error("Error in the JMS connection. " + exception.getMessage()); try { jmsServerConnector.closeAll(); } catch (JMSConnectorException e) { logger.error("Error while closing the connection, session or consumer after receiving the exception call " + "from jms provider. ", e); } try { jmsServerConnector.createMessageListener(); } catch (JMSConnectorException e) { JMSConnectionRetryHandler jmsConnectionRetryHandler = new JMSConnectionRetryHandler(jmsServerConnector, retryInterval, maxRetryCount); try { jmsConnectionRetryHandler.retry(); } catch (JMSConnectorException e1) { throw new RuntimeException( "Cannot establish the connection again after retrying for " + maxRetryCount + " times", e1); } } }
Source:
public final void loginThrowSInvalidPasswordException() throws SPlatformLoginException, SInvalidUserException, SInvalidPasswordException, SInvalidPlatformCredentialsException { final String userName = "userName"; final String password = "pwd"; doThrow(new SInvalidPasswordException("")).when(authenticationService).checkUserCredentials(userName, password); platformLoginServiceImpl.login(userName, password); }

Target:
public final void loginThrowSInvalidPasswordException() throws Exception { final String userName = "userName"; final String password = "pwd"; doThrow(new SInvalidPasswordException("")).when(authenticationService).checkUserCredentials(userName, password); platformLoginServiceImpl.login(userName, password); }
Source:
public void testServerListeningHostValidity() throws Exception { TChannel tchannel = new TChannel.Builder("some-service") .setServerHost(InetAddress.getByName("localhost")) .build(); tchannel.listen(); System.out.println(tchannel.getListeningHost()); assertTrue((tchannel.getListeningHost().matches("^\\d+\\.\\d+\\.\\d+\\.\\d+$"))); }

Target:
public void testServerListeningHostValidity() throws Exception { TChannel tchannel = new TChannel.Builder("some-service") .setServerHost(InetAddress.getByName("localhost")) .build(); tchannel.listen(); assertTrue((tchannel.getListeningHost().matches("^\\d+\\.\\d+\\.\\d+\\.\\d+$"))); }
Source:
private void initEditMode(ChangeInfo info) { if (Gerrit.isSignedIn() && info.status().isOpen()) { RevisionInfo rev = info.revision(revision); if (isEditModeEnabled(info, rev)) { editMode.setVisible(fileTableMode == FileTable.Mode.REVIEW); addFile.setVisible(!editMode.isVisible()); reviewMode.setVisible(!editMode.isVisible()); addFileAction = new AddFileAction( changeId, info.revision(revision), style, addFile); } else { editMode.setVisible(false); addFile.setVisible(false); reviewMode.setVisible(false); } boolean hasEdit = info.has_edit() && info.current_revision().equals(info.edit().name()); reply.setVisible(!hasEdit); quickApprove.setVisible(!hasEdit); } }

Target:
private void initEditMode(ChangeInfo info) { if (Gerrit.isSignedIn() && info.status().isOpen()) { RevisionInfo rev = info.revision(revision); if (isEditModeEnabled(info, rev)) { editMode.setVisible(fileTableMode == FileTable.Mode.REVIEW); addFile.setVisible(!editMode.isVisible()); reviewMode.setVisible(!editMode.isVisible()); addFileAction = new AddFileAction( changeId, info.revision(revision), style, addFile); } else { editMode.setVisible(false); addFile.setVisible(false); reviewMode.setVisible(false); } if (rev.is_edit()) { reply.setVisible(false); quickApprove.setVisible(false); } } }
Source:
public void doFilterWhenCookieRequestCacheConfiguredThenExpiredSavedRequestCookieSetAfterMatch() throws Exception { CookieRequestCache cache = new CookieRequestCache(); RequestCacheAwareFilter filter = new RequestCacheAwareFilter(cache); MockHttpServletRequest request = new MockHttpServletRequest(); request.setServerName("abc.com"); request.setServletPath("/destination"); request.setRequestURI("/destination"); request.setScheme("https"); request.setServerPort(443); request.setSecure(true); String encodedRedirectUrl = Base64.getEncoder().encodeToString("<LINK_0>".getBytes()); Cookie savedRequest = new Cookie("REDIRECT_URI", encodedRedirectUrl); savedRequest.setMaxAge(-1); savedRequest.setSecure(request.isSecure()); savedRequest.setPath("/"); savedRequest.setHttpOnly(true); request.setCookies(savedRequest); MockHttpServletResponse response = new MockHttpServletResponse(); filter.doFilter(request, response, new MockFilterChain()); Cookie expiredCookie = response.getCookie("REDIRECT_URI"); assertThat(expiredCookie).isNotNull(); assertThat(expiredCookie.getValue()).isEmpty(); assertThat(expiredCookie.getMaxAge()).isZero(); }

Target:
public void doFilterWhenCookieRequestCacheConfiguredThenExpiredSavedRequestCookieSetAfterMatch() throws Exception { CookieRequestCache cache = new CookieRequestCache(); RequestCacheAwareFilter filter = new RequestCacheAwareFilter(cache); MockHttpServletRequest request = new MockHttpServletRequest(); request.setServerName("abc.com"); request.setRequestURI("/destination"); request.setScheme("https"); request.setServerPort(443); request.setSecure(true); String encodedRedirectUrl = Base64.getEncoder().encodeToString("<LINK_0>".getBytes()); Cookie savedRequest = new Cookie("REDIRECT_URI", encodedRedirectUrl); savedRequest.setMaxAge(-1); savedRequest.setSecure(request.isSecure()); savedRequest.setPath("/"); savedRequest.setHttpOnly(true); request.setCookies(savedRequest); MockHttpServletResponse response = new MockHttpServletResponse(); filter.doFilter(request, response, new MockFilterChain()); Cookie expiredCookie = response.getCookie("REDIRECT_URI"); assertThat(expiredCookie).isNotNull(); assertThat(expiredCookie.getValue()).isEmpty(); assertThat(expiredCookie.getMaxAge()).isZero(); }
Source:
protected void stopReplications() { for (Replicator replicator : replicators) { replicationListener.remove(replicator); replicator.stop(); } }

Target:
protected void stopReplications() { synchronized (replicators) { for (Replicator replicator : replicators) { replicationListener.remove(replicator); replicator.stop(); } } }
Source:
public void generate(final Ds3ApiSpec spec, final FileUtils fileUtils, final Path destDir) throws IOException { this.spec = spec; this.fileUtils = fileUtils; this.outputDirectory = destDir; try { generateCommands(); } catch (TemplateException e) { e.printStackTrace(); } }

Target:
public void generate(final Ds3ApiSpec spec, final FileUtils fileUtils, final Path destDir) throws IOException { this.spec = spec; this.fileUtils = fileUtils; this.outputDirectory = destDir; try { generateCommands(); } catch (final TemplateException e) { e.printStackTrace(); } }
Source:
public void assertNotIntrumented_should_throw_exception_when_jacoco_data_field_is_present() { InstrSupport.assertNotInstrumented("$jacocoData", "Foo"); }

Target:
public void assertNotIntrumented_should_throw_exception_when_jacoco_data_field_is_present() { exception.expect(IllegalStateException.class); exception.expectMessage( "Cannot process instrumented class Foo. Please supply original non-instrumented classes."); InstrSupport.assertNotInstrumented("$jacocoData", "Foo"); }
Source:
public void acceptResponse(ByteBuf buf, short status, HeaderDecoder decoder) { if (HotRodConstants.isNotExist(status) || !HotRodConstants.isSuccess(status)) { complete(null); } else { short flags = buf.readUnsignedByte(); long creation = -1; int lifespan = -1; long lastUsed = -1; int maxIdle = -1; if ((flags & INFINITE_LIFESPAN) != INFINITE_LIFESPAN) { creation = buf.readLong(); lifespan = ByteBufUtil.readVInt(buf); } if ((flags & INFINITE_MAXIDLE) != INFINITE_MAXIDLE) { lastUsed = buf.readLong(); maxIdle = ByteBufUtil.readVInt(buf); } long version = buf.readLong(); int totalLength = ByteBufUtil.readVInt(buf); VersionedMetadataImpl versionedMetadata = new VersionedMetadataImpl(creation, lifespan, lastUsed, maxIdle, version); ChannelInputStream stream = new ChannelInputStream(versionedMetadata, () -> { channel.pipeline().remove(ChannelInputStream.class); }, totalLength); channel.pipeline().addBefore(HeaderDecoder.NAME, ChannelInputStream.NAME, stream); stream.moveReadable(buf); complete(stream); } }

Target:
public void acceptResponse(ByteBuf buf, short status, HeaderDecoder decoder) { if (HotRodConstants.isNotExist(status) || !HotRodConstants.isSuccess(status)) { complete(null); } else { short flags = buf.readUnsignedByte(); long creation = -1; int lifespan = -1; long lastUsed = -1; int maxIdle = -1; if ((flags & INFINITE_LIFESPAN) != INFINITE_LIFESPAN) { creation = buf.readLong(); lifespan = ByteBufUtil.readVInt(buf); } if ((flags & INFINITE_MAXIDLE) != INFINITE_MAXIDLE) { lastUsed = buf.readLong(); maxIdle = ByteBufUtil.readVInt(buf); } long version = buf.readLong(); int totalLength = ByteBufUtil.readVInt(buf); VersionedMetadataImpl versionedMetadata = new VersionedMetadataImpl(creation, lifespan, lastUsed, maxIdle, version); ChannelInputStream stream = new ChannelInputStream(versionedMetadata, () -> { if (channel.pipeline().get(ChannelInputStream.class) != null) { channel.pipeline().remove(ChannelInputStream.class); } }, totalLength); if (stream.moveReadable(buf)) { channel.pipeline().addBefore(HeaderDecoder.NAME, ChannelInputStream.NAME, stream); } complete(stream); } }
Source:
public Promise<String> getValue() { final Resource[] resources = appContext.getResources(); if (resources == null || resources.length != 1) { return promises.resolve(""); } final Resource resource = resources[0]; final Optional<Project> project = resource.getRelatedProject(); if (!JavaUtil.isJavaProject(project.get())) { return promises.resolve(""); } final String projectPath = project.get().getLocation().toString(); return classpathContainer.getClasspathEntries(projectPath).then(new Function<List<ClasspathEntryDto>, String>() { @Override public String apply(List<ClasspathEntryDto> arg) throws FunctionException { classpathResolver.resolveClasspathEntries(arg); Set<String> sources = classpathResolver.getSources(); StringBuilder classpath = new StringBuilder(""); for (String source : sources) { classpath.append(source.substring(projectPath.length() + 1)).append(':'); } if (classpath.toString().isEmpty()) { classpath.append(appContext.getProjectsRoot().toString()).append(projectPath); } return classpath.toString(); } }); }

Target:
public Promise<String> getValue() { final Resource[] resources = appContext.getResources(); if (resources == null || resources.length != 1) { return promises.resolve(""); } final Resource resource = resources[0]; final Optional<Project> project = resource.getRelatedProject(); if (!JavaUtil.isJavaProject(project.get())) { return promises.resolve(""); } final String projectPath = project.get().getLocation().toString(); return classpathContainer.getClasspathEntries(projectPath).then(new Function<List<ClasspathEntryDto>, String>() { @Override public String apply(List<ClasspathEntryDto> arg) throws FunctionException { classpathResolver.resolveClasspathEntries(arg); Set<String> sources = classpathResolver.getSources(); StringBuilder classpath = new StringBuilder(); for (String source : sources) { classpath.append(source.substring(projectPath.length() + 1)).append(':'); } if (classpath.toString().isEmpty()) { classpath.append(appContext.getProjectsRoot().toString()).append(projectPath); } return classpath.toString(); } }); }
Source:
protected void executeQueryCommand() { InstanceType instance; GetVmTemplateParameters params = getParameters(); if (params.getName() != null) { instance = DbFacade.getInstance().getVmTemplateDao() .getInstanceByName(params.getName(), getUserID(), getParameters().isFiltered()); } else { instance = DbFacade.getInstance().getVmTemplateDao() .get(getParameters().getId(), getUserID(), getParameters().isFiltered()); } getQueryReturnValue().setReturnValue(instance); }

Target:
protected void executeQueryCommand() { InstanceType instance; GetVmTemplateParameters params = getParameters(); if (params.getName() != null) { instance = vmTemplateDao.getInstanceTypeByName(params.getName(), getUserID(), getParameters().isFiltered()); } else { instance = vmTemplateDao.get(getParameters().getId(), getUserID(), getParameters().isFiltered()); } getQueryReturnValue().setReturnValue(instance); }
Source:
public void revertFile() throws IOException { OutputStream fileOutputStream = Files.newOutputStream( Paths.get("src/test/resources/metadata/testmetaOldFormat.xml")); fileOutputStream.write(testMetaOldFormat); fileOutputStream.close(); }

Target:
public void revertFile() throws IOException { IOUtils.write( testMetaOldFormat, Files.newOutputStream(Paths.get(pathOfOldMetaFormat))); }
Source:
public void setFacet(@NotNull AndroidFacet facet) { if (myConfigurationProvider == null || !myConfigurationProvider.isCloudTestingOptionEnabled(facet.getModule().getProject())) { return; } myCurrentFacet = facet; myCurrentModule = myCurrentFacet.getModule(); myTestingConfigurations = myConfigurationProvider.getTestingConfigurations(myCurrentFacet); removeActionListener(myActionListener); myActionListener = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { CloudTestConfiguration selectedConfig = myConfigurationProvider .openMatrixConfigurationDialog(myCurrentFacet, (CloudTestConfiguration)getComboBox().getSelectedItem()); if (selectedConfig != null) { CloudMatrixConfigurationCoordinator.getInstance(). updateComboBoxesWithNewTestingConfigurations(myConfigurationProvider.getTestingConfigurations(myCurrentFacet), myCurrentModule); getComboBox().setSelectedItem(selectedConfig); getComboBox().updateUI(); } } }; addActionListener(myActionListener); updateContent(); }

Target:
public void setFacet(@NotNull AndroidFacet facet) { if (!CloudTestConfigurationProvider.isEnabled()) { return; } myCurrentFacet = facet; myCurrentModule = myCurrentFacet.getModule(); myTestingConfigurations = myConfigurationProvider.getTestingConfigurations(myCurrentFacet); removeActionListener(myActionListener); myActionListener = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { CloudTestConfiguration selectedConfig = myConfigurationProvider .openMatrixConfigurationDialog(myCurrentFacet, (CloudTestConfiguration)getComboBox().getSelectedItem()); if (selectedConfig != null) { CloudMatrixConfigurationCoordinator.getInstance(). updateComboBoxesWithNewTestingConfigurations(myConfigurationProvider.getTestingConfigurations(myCurrentFacet), myCurrentModule); getComboBox().setSelectedItem(selectedConfig); getComboBox().updateUI(); } } }; addActionListener(myActionListener); updateContent(); }
Source:
public void segmentsFinished(byte[] finishedSegments) { if (trackSegments) { if (finishedSegments != null) { BitSet bitSet = BitSet.valueOf(finishedSegments); if (trace) log.tracef("Removing completed segments %s", bitSet); bitSet.stream().forEach(seg -> keysPerSegment.set(seg, null)); } } }

Target:
public void segmentsFinished(byte[] finishedSegments) { if (trackSegments && finishedSegments != null) { BitSet bitSet = BitSet.valueOf(finishedSegments); if (trace) log.tracef("Removing completed segments %s", bitSet); bitSet.stream().forEach(seg -> keysPerSegment.set(seg, null)); } }
Source:
public NewDeviceRequestDto setNewDeviceRequestForUser(UUID userId, String yonaPassword, String newDeviceRequestPassword) { userService.updateUser(userId, ue -> { User userEntity = userService.getValidatedUserById(ue.getId()); NewDeviceRequest newDeviceRequestEntity = NewDeviceRequest.createInstance(yonaPassword); newDeviceRequestEntity.encryptYonaPassword(newDeviceRequestPassword); userEntity.setNewDeviceRequest(newDeviceRequestEntity); logger.info("User with mobile number '{}' and ID '{}' set a new device request", userEntity.getMobileNumber(), userEntity.getId()); }); return NewDeviceRequestDto.createInstanceWithoutPassword(); }

Target:
public NewDeviceRequestDto setNewDeviceRequestForUser(UUID userId, String yonaPassword, String newDeviceRequestPassword) { userService.updateUser(userId, userEntity -> { userService.assertValidatedUser(userEntity); NewDeviceRequest newDeviceRequestEntity = NewDeviceRequest.createInstance(yonaPassword); newDeviceRequestEntity.encryptYonaPassword(newDeviceRequestPassword); userEntity.setNewDeviceRequest(newDeviceRequestEntity); logger.info("User with mobile number '{}' and ID '{}' set a new device request", userEntity.getMobileNumber(), userEntity.getId()); }); return NewDeviceRequestDto.createInstanceWithoutPassword(); }
Source:
private IStatus[] validateModel() { ArrayList<IStatus> warningsErrors = new ArrayList<IStatus>(); Iterator<String> i = mappedModel.keySet().iterator(); while(i.hasNext()) { String serverType = i.next(); Map<String, SubsystemMapping> val = mappedModel.get(serverType); Collection<SubsystemMapping> types = val.values(); Iterator<SubsystemMapping> it = types.iterator(); while(it.hasNext()) { SubsystemMapping mapping = it.next(); SubsystemType type = mapping.getSubsystem(); if( type != null ) { IStatus s = validateSubsystemMapping(mapping); if( !s.isOK()) { mapping.isValid = false; mapping.validationError = s; warningsErrors.add(s); } } else { warningsErrors.add(new Status(IStatus.ERROR, ASWTPToolsPlugin.PLUGIN_ID, "Invalid - Mapped Subsystem does not exist: " + serverType + ", " + type.id)); } } } return (IStatus[]) warningsErrors.toArray(new IStatus[warningsErrors.size()]); }

Target:
private IStatus[] validateModel() { ArrayList<IStatus> warningsErrors = new ArrayList<IStatus>(); for (Map.Entry<String, Map<String, SubsystemMapping>> entry : mappedModel.entrySet()) { String serverType = entry.getKey(); Map<String, SubsystemMapping> val = entry.getValue(); Collection<SubsystemMapping> types = val.values(); Iterator<SubsystemMapping> it = types.iterator(); while(it.hasNext()) { SubsystemMapping mapping = it.next(); SubsystemType type = mapping.getSubsystem(); if( type != null ) { IStatus s = validateSubsystemMapping(mapping); if( !s.isOK()) { mapping.isValid = false; mapping.validationError = s; warningsErrors.add(s); } } else { warningsErrors.add(new Status(IStatus.ERROR, ASWTPToolsPlugin.PLUGIN_ID, "Invalid - Mapped Subsystem does not exist: " + serverType + ", " + type.id)); } } } return (IStatus[]) warningsErrors.toArray(new IStatus[warningsErrors.size()]); }
Source:
public void removeGroupUnion(PerunSession sess, Group resultGroup, Group operandGroup, boolean parentFlag) throws InternalErrorException, GroupRelationDoesNotExist, GroupRelationCannotBeRemoved, GroupNotExistsException { if (!groupsManagerImpl.isOneWayRelationBetweenGroups(resultGroup, operandGroup)) { throw new GroupRelationDoesNotExist("Union does not exist between result group " + resultGroup + " and operand group" + operandGroup + "."); } PerunLocksUtils.lockGroupMembership(resultGroup); PerunLocksUtils.lockGroupMembership(operandGroup); if (parentFlag || groupsManagerImpl.isRelationRemovable(sess, resultGroup, operandGroup)) { try { removeRelationMembers(sess, resultGroup, getGroupMembers(sess, operandGroup), operandGroup.getId()); } catch (WrongAttributeValueException | WrongReferenceAttributeValueException ex) { throw new InternalErrorException("Removing relation members failed. Cause: {}", ex); } catch (NotGroupMemberException ex) { throw new ConsistencyErrorException("Database inconsistency. Cause: {}", ex); } } else { throw new GroupRelationCannotBeRemoved("Union between result group " + resultGroup + " and operand group" + operandGroup + " cannot be removed, because it's part of the hierarchical structure of the groups."); } groupsManagerImpl.removeGroupUnion(sess, resultGroup, operandGroup); }

Target:
public void removeGroupUnion(PerunSession sess, Group resultGroup, Group operandGroup, boolean parentFlag) throws InternalErrorException, GroupRelationDoesNotExist, GroupRelationCannotBeRemoved, GroupNotExistsException { if (!groupsManagerImpl.isOneWayRelationBetweenGroups(resultGroup, operandGroup)) { throw new GroupRelationDoesNotExist("Union does not exist between result group " + resultGroup + " and operand group" + operandGroup + "."); } if (parentFlag || groupsManagerImpl.isRelationRemovable(sess, resultGroup, operandGroup)) { try { removeRelationMembers(sess, resultGroup, getGroupMembers(sess, operandGroup), operandGroup.getId()); } catch (WrongAttributeValueException | WrongReferenceAttributeValueException ex) { throw new InternalErrorException("Removing relation members failed. Cause: {}", ex); } catch (NotGroupMemberException ex) { throw new ConsistencyErrorException("Database inconsistency. Cause: {}", ex); } } else { throw new GroupRelationCannotBeRemoved("Union between result group " + resultGroup + " and operand group" + operandGroup + " cannot be removed, because it's part of the hierarchical structure of the groups."); } groupsManagerImpl.removeGroupUnion(sess, resultGroup, operandGroup); for (Member member : getGroupMembers(sess, resultGroup)) { recalculateMemberGroupStatusRecursively(sess, member, resultGroup); } }
Source:
public Rev checkpoint(String noteId, String checkpointMsg) throws IOException { LOG.info("Checkpoint feature isn't supported in {}", this.getClass().toString()); return null; }

Target:
public Revision checkpoint(String noteId, String checkpointMsg) throws IOException { LOG.info("Checkpoint feature isn't supported in {}", this.getClass().toString()); return null; }
Source:
public void recreateAllSearchIndexes(List<Event> events) { mDb.beginTransaction(); try { for (Event e : events) { insertCallback(e); } } finally { mDb.setTransactionSuccessful(); } mDb.endTransaction(); }

Target:
public void recreateAllSearchIndexes(List<Event> events) { mDb.beginTransaction(); try { for (int i = 0; i < events.size(); i++) { insertCallback(events.get(i)); } } finally { mDb.setTransactionSuccessful(); } mDb.endTransaction(); }
Source:
public Accumulator createAccumulator() { Accumulator accumulator; if (distinct) { accumulator = instantiateAccumulator( inputChannels.stream() .map(value -> value + 1) .collect(Collectors.toList()), Optional.of(0)); List<Type> argumentTypes = new ArrayList<>(); for (int input : inputChannels) { argumentTypes.add(sourceTypes.get(input)); } accumulator = new DistinctingAccumulator(accumulator, argumentTypes, inputChannels, maskChannel, session, joinCompiler); } else { accumulator = instantiateAccumulator(inputChannels, maskChannel); } if (orderByChannels.isEmpty()) { return accumulator; } return new OrderingAccumulator(accumulator, sourceTypes, orderByChannels, orderings, pagesIndexFactory); }

Target:
public Accumulator createAccumulator() { Accumulator accumulator; if (distinct) { accumulator = instantiateAccumulator( inputChannels.stream() .map(value -> value + 1) .collect(Collectors.toList()), Optional.of(0)); List<Type> argumentTypes = inputChannels.stream() .map(sourceTypes::get) .collect(Collectors.toList()); accumulator = new DistinctingAccumulator(accumulator, argumentTypes, inputChannels, maskChannel, session, joinCompiler); } else { accumulator = instantiateAccumulator(inputChannels, maskChannel); } if (orderByChannels.isEmpty()) { return accumulator; } return new OrderingAccumulator(accumulator, sourceTypes, orderByChannels, orderings, pagesIndexFactory); }
Source:
private void showQrCode() throws MalformedURLException { Map<String, String> params = new ArrayMap<>(); params.put("text", mDeviceId); new ImageGetRequest(mActivity, new URL("https://" + mActivity.getApi().getGui().address), ImageGetRequest.QR_CODE_GENERATOR, mActivity.getFilesDir() + "/" + SyncthingService.HTTPS_CERT_FILE, mActivity.getApi().getGui().apiKey, params, qrCodeBitmap -> { mActivity.showQrCodeDialog(mDeviceId, qrCodeBitmap); mActivity.closeDrawer(); }, error -> Toast.makeText(mActivity, R.string.could_not_access_deviceid, Toast.LENGTH_SHORT).show()); }

Target:
private void showQrCode() { String httpsCertPath = mActivity.getFilesDir() + "/" + SyncthingService.HTTPS_CERT_FILE; String apiKey = mActivity.getApi().getGui().apiKey; URL url = mActivity.getApi().getUrl(); new ImageGetRequest(mActivity, url, ImageGetRequest.QR_CODE_GENERATOR, httpsCertPath, apiKey, ImmutableMap.of("text", mDeviceId),qrCodeBitmap -> { mActivity.showQrCodeDialog(mDeviceId, qrCodeBitmap); mActivity.closeDrawer(); }, error -> Toast.makeText(mActivity, R.string.could_not_access_deviceid, Toast.LENGTH_SHORT).show()); }
Source:
public AutoCompletionCandidates doAutoCompleteLoggerName(@QueryParameter String value) { List<String> candidateNames = new ArrayList<>(); Enumeration<String> loggerNames = LogManager.getLogManager().getLoggerNames(); String lowercaseValue = value.toLowerCase(Locale.ENGLISH); while (loggerNames.hasMoreElements()) { String loggerName = loggerNames.nextElement(); String[] loggerNameParts = loggerName.split("[.]"); for (int i = 0 ; i < loggerNameParts.length ; i++) { String loggerNamePrefix = StringUtils.join(Arrays.copyOf(loggerNameParts, i+1), "."); if (loggerNamePrefix.toLowerCase(Locale.ENGLISH).contains(lowercaseValue) && !candidateNames.contains(loggerNamePrefix)) { candidateNames.add(loggerNamePrefix); } } } AutoCompletionCandidates candidates = new AutoCompletionCandidates(); candidates.add(candidateNames.toArray(new String[0])); return candidates; }

Target:
public AutoCompletionCandidates doAutoCompleteLoggerName(@QueryParameter String value) { if (value == null) { return new AutoCompletionCandidates(); } Set<String> candidateNames = new LinkedHashSet<>(getAutoCompletionCandidates(Collections.list(LogManager.getLogManager().getLoggerNames()))); for (String part : value.split("[ ]+")) { HashSet<String> partCandidates = new HashSet<>(); String lowercaseValue = part.toLowerCase(Locale.ENGLISH); for (String loggerName : candidateNames) { if (loggerName.toLowerCase(Locale.ENGLISH).contains(lowercaseValue)) { partCandidates.add(loggerName); } } candidateNames.retainAll(partCandidates); } AutoCompletionCandidates candidates = new AutoCompletionCandidates(); candidates.add(candidateNames.toArray(new String[0])); return candidates; }
Source:
private static String getValueFromIdByName(String id, String name) { if (id == null) { return null; } Iterable<String> iterable = Arrays.asList(id.split("/")); Iterator<String> itr = iterable.iterator(); while (itr.hasNext()) { String part = itr.next(); if (part != null && !part.trim().equals("")) { if (part.equalsIgnoreCase(name)) { if (itr.hasNext()) { return itr.next(); } else { return null; } } } } return null; }

Target:
private static String getValueFromIdByName(String id, String name) { if (id == null) { return null; } Iterable<String> iterable = Arrays.asList(id.split("/")); Iterator<String> itr = iterable.iterator(); while (itr.hasNext()) { String part = itr.next(); if (part != null && !part.trim().isEmpty()) { if (part.equalsIgnoreCase(name)) { if (itr.hasNext()) { return itr.next(); } else { return null; } } } } return null; }
Source:
public void nonContiguousEventsThrows() { eventCache.processStartTransactionsUpdate(TIMESTAMPS, SNAPSHOT); eventCache.processStartTransactionsUpdate(TIMESTAMPS_2, LockWatchStateUpdate.success(LEADER, 10L, ImmutableList.of(WATCH_EVENT, LOCK_EVENT, LOCK_EVENT_2))); eventCache.processStartTransactionsUpdate(ImmutableSet.of(23L, 55L), LockWatchStateUpdate.success(LEADER, 20L, ImmutableList.of(UnlockEvent.builder(ImmutableSet.of()).build(20L)))); verifyStage(); assertThatThrownBy(() -> eventCache.removeTransactionStateFromCache(START_TS)) .isExactlyInstanceOf(SafeIllegalArgumentException.class) .hasMessage("Events form a non-contiguous sequence"); }

Target:
public void nonContiguousEventsThrows() { setupInitialState(); assertThatThrownBy(() -> eventCache.processStartTransactionsUpdate(TIMESTAMPS_2, LockWatchStateUpdate.success(LEADER, 7L, ImmutableList.of(WATCH_EVENT, LOCK_EVENT, LOCK_EVENT_2)))) .isExactlyInstanceOf(SafeIllegalArgumentException.class) .hasMessage("Events form a non-contiguous sequence"); }
Source:
public void start(StartContext startContext) throws StartException { final char[] thePassword; if (base64) { byte[] value = Base64.getDecoder().decode(password); String tempPassword = new String(value, StandardCharsets.UTF_8); String trimmedPassword = tempPassword.trim(); if (tempPassword.equals(trimmedPassword) == false) { ROOT_LOGGER.whitespaceTrimmed(); } thePassword = trimmedPassword.toCharArray(); } else { thePassword = password.toCharArray(); } factory = new CallbackHandlerFactory() { public CallbackHandler getCallbackHandler(String username) { return new SecretCallbackHandler(username, thePassword); } }; }

Target:
public void start(StartContext startContext) throws StartException { final char[] thePassword; if (base64) { byte[] value = Base64.getDecoder().decode(password); String tempPassword = new String(value, StandardCharsets.ISO_8859_1); String trimmedPassword = tempPassword.trim(); if (tempPassword.equals(trimmedPassword) == false) { ROOT_LOGGER.whitespaceTrimmed(); } thePassword = trimmedPassword.toCharArray(); } else { thePassword = password.toCharArray(); } factory = new CallbackHandlerFactory() { public CallbackHandler getCallbackHandler(String username) { return new SecretCallbackHandler(username, thePassword); } }; }
Source:
public void showObjectDetails(Object event, Shell parentShell) { CapraOfficeObject officeObject; if (event instanceof DoubleClickEvent) { IStructuredSelection selection = (IStructuredSelection) ((DoubleClickEvent) event).getSelection(); officeObject = (CapraOfficeObject) selection.getFirstElement(); } else if (event instanceof ExecutionEvent) { IStructuredSelection selection; try { selection = (IStructuredSelection) HandlerUtil.getCurrentSelectionChecked((ExecutionEvent) event); officeObject = (CapraOfficeObject) selection.getFirstElement(); } catch (ExecutionException e) { e.printStackTrace(); officeObject = null; } } else { return; } officeObject.showOfficeObjectInNativeEnvironment(); }

Target:
public void showObjectDetails(Object event, Shell parentShell) { CapraOfficeObject officeObject; if (event instanceof DoubleClickEvent) { IStructuredSelection selection = (IStructuredSelection) ((DoubleClickEvent) event).getSelection(); officeObject = (CapraOfficeObject) selection.getFirstElement(); } else if (event instanceof ExecutionEvent) { IStructuredSelection selection; try { selection = (IStructuredSelection) HandlerUtil.getCurrentSelectionChecked((ExecutionEvent) event); officeObject = (CapraOfficeObject) selection.getFirstElement(); } catch (ExecutionException e) { e.printStackTrace(); return; } } else { return; } try { officeObject.showOfficeObjectInNativeEnvironment(); } catch (CapraOfficeObjectNotFound e) { e.printStackTrace(); showMessage(viewer.getControl().getShell(), SWT.ERROR, ERROR_TITLE, e.getMessage()); } }
Source:
static String getSpanName(String commandName, @Nullable String collectionName) { return commandName + (collectionName == null ? "" : (" " + collectionName)); }

Target:
static String getSpanName(String commandName, @Nullable String collectionName) { if (collectionName == null) return commandName; return commandName + " " + collectionName; }
Source:
protected void addLinksToPage(final PageMeta meta, final AuthenticationReverseRouter reverseRouter) { meta.addHalLink(reverseRouter.logInPageCall(), "signIn", "logIn"); meta.addHalLink(reverseRouter.logInProcessCall(), "logInSubmit"); meta.addHalLink(reverseRouter.logOutProcessCall(), "logOut"); meta.addHalLink(reverseRouter.logInPageCall(), "signUp"); meta.addHalLink(reverseRouter.signUpProcessCall(), "signUpSubmit"); meta.addHalLink(reverseRouter.changePasswordPageCall(), "changePassword"); meta.addHalLink(reverseRouter.changePasswordProcessCall(), "changePassword"); }

Target:
protected void addLinksToPage(final PageMeta meta, final AuthenticationReverseRouter reverseRouter) { meta.addHalLink(reverseRouter.logInPageCall(), "signIn", "logIn"); meta.addHalLink(reverseRouter.logInProcessCall(), "logInSubmit"); meta.addHalLink(reverseRouter.logOutProcessCall(), "logOut"); meta.addHalLink(reverseRouter.logInPageCall(), "signUp"); meta.addHalLink(reverseRouter.signUpProcessCall(), "signUpSubmit"); }
Source:
void mergeRegions(Candidate other) { Region a = clearRegionList(); Region b = other.clearRegionList(); Region t; if (a.resultStart < b.resultStart) { Region n = a.next; a.next = null; t = a; a = n; } else { Region n = b.next; b.next = null; t = b; b = n; } regionList = t; while (a != null && b != null) { if (a.resultStart < b.resultStart) { Region n = a.next; if (t.resultStart + t.length == a.resultStart) t.length += a.length; else { a.next = null; t.next = a; t = a; } a = n; } else { Region n = b.next; if (t.resultStart + t.length == b.resultStart) t.length += b.length; else { b.next = null; t.next = b; t = b; } b = n; } } if (a != null) { if (t.resultStart + t.length == a.resultStart) { t.length += a.length; a = a.next; } t.next = a; } else { if (t.resultStart + t.length == b.resultStart) { t.length += b.length; b = b.next; } t.next = b; } }

Target:
void mergeRegions(Candidate other) { Region a = clearRegionList(); Region b = other.clearRegionList(); Region t = null; while (a != null && b != null) { if (a.resultStart < b.resultStart) { Region n = a.next; t = add(t, this, a); a = n; } else { Region n = b.next; t = add(t, this, b); b = n; } } if (a != null) { Region n = a.next; t = add(t, this, a); t.next = n; } else { Region n = b.next; t = add(t, this, b); t.next = n; } }
Source:
private void readEntriesFromReadAheadCache(PendingReadRequest nextRequest) { while (!nextRequest.hasReadEnoughEntries()) { CacheEntry entry; boolean hitEndOfLogSegment; synchronized (this) { entry = readAheadEntries.peek(); hitEndOfLogSegment = (null == entry) && isEndOfLogSegment(); } if (hitEndOfLogSegment) { completeExceptionally(new EndOfLogSegmentException(getSegment().getZNodeName()), false); return; } if (null == entry) { return; } if (!entry.isDone()) { if (isEndOfLogSegment(entry.getEntryId())) { completeExceptionally(new EndOfLogSegmentException(getSegment().getZNodeName()), false); } return; } if (entry.isSuccess()) { CacheEntry removedEntry = readAheadEntries.poll(); try { if (entry != removedEntry) { DLIllegalStateException ise = new DLIllegalStateException("Unexpected condition at reading from " + getSegment()); completeExceptionally(ise, false); return; } try { nextRequest.addEntry(processReadEntry(entry.getEntry())); } catch (IOException e) { completeExceptionally(e, false); return; } } finally { if (removedEntry != null) { removedEntry.release(); } } } else if (skipBrokenEntries && BKException.Code.DigestMatchException == entry.getRc()) { skippedBrokenEntriesCounter.inc(); CacheEntry removedEntry = readAheadEntries.poll(); removedEntry.release(); continue; } else { completeExceptionally(new BKTransmitException("Encountered issue on reading entry " + entry.getEntryId() + " @ log segment " + getSegment(), entry.getRc()), false); return; } } }

Target:
private void readEntriesFromReadAheadCache(PendingReadRequest nextRequest) { while (!nextRequest.hasReadEnoughEntries()) { CacheEntry entry; boolean hitEndOfLogSegment; synchronized (this) { entry = readAheadEntries.peek(); hitEndOfLogSegment = (null == entry) && isEndOfLogSegment(); } if (hitEndOfLogSegment) { completeExceptionally(new EndOfLogSegmentException(getSegment().getZNodeName()), false); return; } if (null == entry) { return; } if (!entry.isDone()) { if (isEndOfLogSegment(entry.getEntryId())) { completeExceptionally(new EndOfLogSegmentException(getSegment().getZNodeName()), false); } return; } if (entry.isSuccess()) { CacheEntry removedEntry = readAheadEntries.poll(); try { if (entry != removedEntry) { DLIllegalStateException ise = new DLIllegalStateException("Unexpected condition at reading from " + getSegment()); completeExceptionally(ise, false); return; } try { nextRequest.addEntry(processReadEntry(entry.getEntry())); } catch (IOException e) { completeExceptionally(e, false); return; } } finally { ReferenceCountUtil.safeRelease(removedEntry); } } else if (skipBrokenEntries && BKException.Code.DigestMatchException == entry.getRc()) { skippedBrokenEntriesCounter.inc(); CacheEntry removedEntry = readAheadEntries.poll(); removedEntry.release(); continue; } else { completeExceptionally(new BKTransmitException("Encountered issue on reading entry " + entry.getEntryId() + " @ log segment " + getSegment(), entry.getRc()), false); return; } } }
Source:
public static RepositoryType fromRepositoryURL(final String stringURI) { if (stringURI.startsWith("git:") || stringURI.endsWith(".git") || stringURI.contains("github") || stringURI.contains("git.app")) { return RepositoryType.GIT; } else if (stringURI.startsWith("svn:") || stringURI.contains("svn") || stringURI.contains("trunk")) { return RepositoryType.SVN; } else if (stringURI.startsWith(":pserver:") || stringURI.contains("cvsroot")) { return RepositoryType.SVN; } else if (stringURI.endsWith(".jar") || stringURI.endsWith(".gz") || stringURI.endsWith(".zip")) { return RepositoryType.ARCHIVE; } else { return RepositoryType.UNKNOWN; } }

Target:
public static RepositoryType fromRepositoryURL(final String stringURI) { if (stringURI.startsWith("git:") || stringURI.endsWith(".git") || stringURI.contains("github") || stringURI.contains("git.app")) { return RepositoryType.GIT; } else if (stringURI.startsWith("svn:") || stringURI.contains("svn") || stringURI.contains("trunk")) { return RepositoryType.SVN; } else if (stringURI.startsWith(":pserver:") || stringURI.contains("cvsroot")) { return RepositoryType.CVS; } else if (stringURI.endsWith(".jar") || stringURI.endsWith(".gz") || stringURI.endsWith(".zip")) { return RepositoryType.ARCHIVE; } else { return RepositoryType.UNKNOWN; } }
Source:
public ActionResult execute() { String studentId; String studentEmail = getRequestParamValue(Const.ParamsNames.STUDENT_EMAIL); String courseId = getRequestParamValue(Const.ParamsNames.COURSE_ID); if (studentEmail == null || courseId == null) { studentId = userInfo.id; } else { StudentAttributes student = logic.getStudentForEmail(courseId, studentEmail); studentId = student.getGoogleId(); } StudentProfileAttributes studentProfile = logic.getStudentProfile(studentId); String name = logic.getAccount(studentId).name; if (studentProfile == null) { studentProfile = StudentProfileAttributes.builder(studentId).build(); } StudentProfileData output = new StudentProfileData(name, studentProfile); return new JsonResult(output); }

Target:
public ActionResult execute() { String studentId; String studentEmail = getRequestParamValue(Const.ParamsNames.STUDENT_EMAIL); String courseId = getRequestParamValue(Const.ParamsNames.COURSE_ID); if (studentEmail == null || courseId == null) { studentId = userInfo.id; } else { StudentAttributes student = logic.getStudentForEmail(courseId, studentEmail); studentId = student.getGoogleId(); } if (StringHelper.isEmpty(studentId)) { return new JsonResult(MESSAGE_STUDENT_NOT_REGISTERED, HttpStatus.SC_NOT_FOUND); } StudentProfileAttributes studentProfile = logic.getStudentProfile(studentId); String name = logic.getAccount(studentId).name; if (studentProfile == null) { studentProfile = StudentProfileAttributes.builder(studentId).build(); } StudentProfileData output = new StudentProfileData(name, studentProfile); return new JsonResult(output); }
Source:
private boolean isPemParsable(String type, String fileName) { if (PKCS7_TYPE.equals(type) || CERT_TYPE.equals(type) || PEM_TYPE.equals(type)) { return true; } if (StringUtils.endsWithIgnoreCase(fileName, ".crt") || StringUtils.endsWithIgnoreCase(fileName, ".key") || StringUtils.endsWithIgnoreCase(fileName, ".pem") || StringUtils.endsWithIgnoreCase(fileName, ".p7b")) { return true; } return false; }

Target:
private boolean isPemParsable(String type, String fileName) { if (PKCS7_TYPE.equals(type) || CERT_TYPE.equals(type) || PEM_TYPE.equals(type)) { return true; } return (StringUtils.endsWithIgnoreCase(fileName, ".crt") || StringUtils.endsWithIgnoreCase(fileName, ".key") || StringUtils.endsWithIgnoreCase(fileName, ".pem") || StringUtils.endsWithIgnoreCase(fileName, ".p7b")); }
Source:
private Map<String, Pair<String, String>> getSharedLocksForTemplateDisk() { initVmTemplateId(); return Collections.singletonMap(getVmTemplateId().toString(), LockMessagesMatchUtil.makeLockingPair(LockingGroup.TEMPLATE, EngineMessage.VM_TEMPLATE_IS_LOCKED)); }

Target:
private Map<String, Pair<String, String>> getSharedLocksForTemplateDisk() { return Collections.singletonMap(getVmTemplateId().toString(), LockMessagesMatchUtil.makeLockingPair(LockingGroup.TEMPLATE, EngineMessage.VM_TEMPLATE_IS_LOCKED)); }