auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>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)){ <START> hostFolderPath = hostFolderPath + File.separator; <END> } 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); } }</code><technical_language>yeap do final String hostFolderPath = new StringBuilder(File.separator).append( host.getHostname()).append( (!folderPath.endsWith(File.separator)?folderPath + File.separator:folderPath) ).toString();</technical_language>

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:
<code>public void onException(JMSException exception) { logger.error("Error in the JMS connection. " + exception.getMessage()); try { jmsServerConnector.closeAll(); } catch (JMSConnectorException e) { <START> logger.error("Error while closing the connection, session or consumer after receiving the exception call " <END> + "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); } } }</code><technical_language>print exception stack trace well? need add e.getMessage() IMO. information is printed stack trace</technical_language>

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:
<code><START> public final void loginThrowSInvalidPasswordException() throws SPlatformLoginException, SInvalidUserException, SInvalidPasswordException, SInvalidPlatformCredentialsException { <END> final String userName = "userName"; final String password = "pwd"; doThrow(new SInvalidPasswordException("")).when(authenticationService).checkUserCredentials(userName, password); platformLoginServiceImpl.login(userName, password); }</code><technical_language>tests method throws Exception, expect bo throwned</technical_language>

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:
<code>public void testServerListeningHostValidity() throws Exception { TChannel tchannel = new TChannel.Builder("some-service") .setServerHost(InetAddress.getByName("localhost")) .build(); tchannel.listen(); <START> System.out.println(tchannel.getListeningHost()); <END> assertTrue((tchannel.getListeningHost().matches("^\\d+\\.\\d+\\.\\d+\\.\\d+$"))); }</code><technical_language>remove system out</technical_language>

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:
<code>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 = <START> info.has_edit() && info.current_revision().equals(info.edit().name()); <END> reply.setVisible(!hasEdit); quickApprove.setVisible(!hasEdit); } }</code><technical_language>rev.is_edit() inline below</technical_language>

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:
<code>public void doFilterWhenCookieRequestCacheConfiguredThenExpiredSavedRequestCookieSetAfterMatch() throws Exception { CookieRequestCache cache = new CookieRequestCache(); RequestCacheAwareFilter filter = new RequestCacheAwareFilter(cache); MockHttpServletRequest request = new MockHttpServletRequest(); request.setServerName("abc.com"); <START> request.setServletPath("/destination"); <END> 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(); }</code><technical_language>set servlet path for this test pass</technical_language>

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:
<code>protected void stopReplications() { for (Replicator replicator : replicators) { replicationListener.remove(replicator); <START> replicator.stop(); <END> } }</code><technical_language>Is a timing window replicator is removed listener, completes stop() is called? miss a finished event in case</technical_language>

Target:
protected void stopReplications() { synchronized (replicators) { for (Replicator replicator : replicators) { replicationListener.remove(replicator); replicator.stop(); } } }
Source:
<code>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(); <START> } catch (TemplateException e) { <END> e.printStackTrace(); } }</code><technical_language>missing final</technical_language>

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:
<code>public void assertNotIntrumented_should_throw_exception_when_jacoco_data_field_is_present() { <START> InstrSupport.assertNotInstrumented("$jacocoData", "Foo"); <END> }</code><technical_language>I worth add assertion for message especially change originates a user needs. In examples of catching regressions thanks assertions for error messages</technical_language>

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:
<code>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); <START> ChannelInputStream stream = new ChannelInputStream(versionedMetadata, () -> { <END> channel.pipeline().remove(ChannelInputStream.class); }, totalLength); channel.pipeline().addBefore(HeaderDecoder.NAME, ChannelInputStream.NAME, stream); stream.moveReadable(buf); complete(stream); } }</code><technical_language>Nitpick: braces needed</technical_language>

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:
<code>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(""); <START> for (String source : sources) { <END> classpath.append(source.substring(projectPath.length() + 1)).append(':'); } if (classpath.toString().isEmpty()) { classpath.append(appContext.getProjectsRoot().toString()).append(projectPath); } return classpath.toString(); } }); }</code><technical_language>new StringBuilder()</technical_language>

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:
<code>protected void executeQueryCommand() { InstanceType instance; GetVmTemplateParameters params = getParameters(); if (params.getName() != null) { <START> instance = DbFacade.getInstance().getVmTemplateDao() <END> .getInstanceByName(params.getName(), getUserID(), getParameters().isFiltered()); } else { instance = DbFacade.getInstance().getVmTemplateDao() .get(getParameters().getId(), getUserID(), getParameters().isFiltered()); } getQueryReturnValue().setReturnValue(instance); }</code><technical_language>injection of DAO (look in code for @Inject, lot of samples)</technical_language>

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:
<code>public void revertFile() throws IOException { <START> OutputStream fileOutputStream = Files.newOutputStream( <END> Paths.get("src/test/resources/metadata/testmetaOldFormat.xml")); fileOutputStream.write(testMetaOldFormat); fileOutputStream.close(); }</code><technical_language>Again, IOUtils</technical_language>

Target:
public void revertFile() throws IOException { IOUtils.write( testMetaOldFormat, Files.newOutputStream(Paths.get(pathOfOldMetaFormat))); }
Source:
<code>public void setFacet(@NotNull AndroidFacet facet) { if <START> (myConfigurationProvider == <END> 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(); }</code><technical_language>I preferable for a single place. do CloudTestingConfigurationProvider.isEnabled(myConfigProvider), return: CloudProviders.isEnabled() && configProvider.isCloudTestingOptionEnabled() i.e., android plugin a global setting enables/disables cloud deployment. Individually, plugin do (I necessary, is upto if want it). result combination of two. EDIT: next class, this is defined CloudProvider GoogleCloudProvider. In case need do is method static call i.e., myConfigProvider.isCloudTestingEnabled(), want CloudTestingProvider.isEnabled()</technical_language>

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:
<code>public void segmentsFinished(byte[] finishedSegments) { <START> if (trackSegments) { <END> 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)); } } }</code><technical_language>nitpick: if (trackeSegments && finishedSegments != null)</technical_language>

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:
<code>public NewDeviceRequestDto setNewDeviceRequestForUser(UUID userId, String yonaPassword, String newDeviceRequestPassword) { userService.updateUser(userId, ue -> { <START> User userEntity = userService.getValidatedUserById(ue.getId()); <END> 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(); }</code><technical_language>this a bit strange get userEntity instead of ue</technical_language>

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:
<code>private IStatus[] validateModel() { ArrayList<IStatus> warningsErrors = new ArrayList<IStatus>(); Iterator<String> i = mappedModel.keySet().iterator(); <START> while(i.hasNext()) { <END> 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()]); }</code><technical_language>faster do for(Map.Entry<String,Map<...>> entry : mappedModel.entrySet()) lookup mappedModel.get(serverType) entry.getValue() instead</technical_language>

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:
<code>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); <START> <END> 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); }</code><technical_language>deadlock cause</technical_language>

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:
<code><START> public Rev checkpoint(String noteId, String checkpointMsg) throws IOException { <END> LOG.info("Checkpoint feature isn't supported in {}", this.getClass().toString()); return null; }</code><technical_language>do think, is a reason do want a readable concise class name Revision here? Checkpoint concept is referred in API</technical_language>

Target:
public Revision checkpoint(String noteId, String checkpointMsg) throws IOException { LOG.info("Checkpoint feature isn't supported in {}", this.getClass().toString()); return null; }
Source:
<code>public void recreateAllSearchIndexes(List<Event> events) { mDb.beginTransaction(); try { <START> for (Event e : events) { <END> insertCallback(e); } } finally { mDb.setTransactionSuccessful(); } mDb.endTransaction(); }</code><technical_language>switch regular for avoid Iterator allocation, ditto for teams method</technical_language>

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:
<code>public Accumulator createAccumulator() { Accumulator accumulator; if (distinct) { accumulator = instantiateAccumulator( inputChannels.stream() .map(value -> value + 1) .collect(Collectors.toList()), Optional.of(0)); <START> List<Type> argumentTypes = new ArrayList<>(); <END> 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); }</code><technical_language>I a stream transform simpler</technical_language>

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:
<code>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()); <START> } <END></code><technical_language>if add a getter for RestApi.mUrl, worry MalformedURLException</technical_language>

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:
<code>public AutoCompletionCandidates doAutoCompleteLoggerName(@QueryParameter String value) { <START> List<String> candidateNames = new ArrayList<>(); <END> 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; }</code><technical_language>nit: a Set in order optimize candidateNames.contains(...) list lots of element (except for single letter search "org", "com", etc.) user difference</technical_language>

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:
<code>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(); <START> if (part != null && !part.trim().equals("")) { <END> if (part.equalsIgnoreCase(name)) { if (itr.hasNext()) { return itr.next(); } else { return null; } } } } return null; }</code><technical_language>!part.trim().isEmpty()</technical_language>

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:
<code>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) <START> .hasMessage("Events form a non-contiguous sequence"); <END> }</code><technical_language>Yeah, I this is I mean: throw immediately discover a discontinuity, validation pushed snapshot event cache</technical_language>

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:
<code>public void start(StartContext startContext) throws StartException { final char[] thePassword; if (base64) { byte[] value = Base64.getDecoder().decode(password); <START> String tempPassword = new String(value, StandardCharsets.UTF_8); <END> 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); } }; }</code><technical_language>a big deal, Base64.getDecoder().decode(string) ISO_8859_1 encoding default. UTF-8 work fine, I if wanted consistent decoder uses</technical_language>

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:
<code>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(); <START> officeObject = null; <END> } } else { return; } officeObject.showOfficeObjectInNativeEnvironment(); }</code><technical_language>This is dangerous do a null check on. NPEs in line 434. return</technical_language>

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:
<code>static String getSpanName(String commandName, @Nullable String collectionName) { <START> return commandName + (collectionName == null ? "" : (" " + collectionName)); <END> }</code><technical_language>return commandName if collection is null. expect JVM optimize stringbuilder for this pattern</technical_language>

Target:
static String getSpanName(String commandName, @Nullable String collectionName) { if (collectionName == null) return commandName; return commandName + " " + collectionName; }
Source:
<code>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"); <START> meta.addHalLink(reverseRouter.changePasswordPageCall(), "changePassword"); <END> meta.addHalLink(reverseRouter.changePasswordProcessCall(), "changePassword"); }</code><technical_language>hal links a map key is parameter. call is unnecessary</technical_language>

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:
<code>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; <START> if (t.resultStart + t.length == a.resultStart) <END> 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; } }</code><technical_language>Good question. I add() of sourceStart compare. I right, comparing sourceStart too. I fix this upload a new version</technical_language>

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:
<code>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(); <START> } <END> } } 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; } } }</code><technical_language>Alternately: ReferenceCountUtils.safeRelease(removedEntry)</technical_language>

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:
<code>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")) { <START> return RepositoryType.SVN; <END> } else if (stringURI.endsWith(".jar") || stringURI.endsWith(".gz") || stringURI.endsWith(".zip")) { return RepositoryType.ARCHIVE; } else { return RepositoryType.UNKNOWN; } }</code><technical_language>CVS</technical_language>

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:
<code>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; <START> <END> if (studentProfile == null) { studentProfile = StudentProfileAttributes.builder(studentId).build(); } StudentProfileData output = new StudentProfileData(name, studentProfile); return new JsonResult(output); }</code><technical_language>student unregistered student googleId null empty</technical_language>

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:
<code>private boolean isPemParsable(String type, String fileName) { if (PKCS7_TYPE.equals(type) || CERT_TYPE.equals(type) || PEM_TYPE.equals(type)) { return true; } <START> if (StringUtils.endsWithIgnoreCase(fileName, ".crt") <END> || StringUtils.endsWithIgnoreCase(fileName, ".key") || StringUtils.endsWithIgnoreCase(fileName, ".pem") || StringUtils.endsWithIgnoreCase(fileName, ".p7b")) { return true; } return false; }</code><technical_language>simplify if(cond1 || cond2...) return true return (cond1 || cond2...)</technical_language>

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")); }