Source:
<code>public Integer createSampleListFolder(final String folderName, final Integer parentId, final User createdBy, final String programUUID) { Preconditions.checkNotNull(folderName); Preconditions.checkNotNull(parentId); Preconditions.checkNotNull(createdBy,"createdBy can not be empty"); Preconditions.checkNotNull(programUUID); Preconditions.checkArgument(!folderName.isEmpty(), "folderName can not be empty"); Preconditions.checkArgument(!programUUID.isEmpty(), "programUUID can not be empty"); final SampleList parentList; if (0 == parentId) { parentList = this.sampleListDao.getRootSampleList(); } else { parentList = this.sampleListDao.getById(parentId); } if (parentList == null) { <START> Preconditions.checkArgument(false,"Parent Folder does not exist"); <END> } if (!parentList.isFolder()) { Preconditions.checkArgument(false,"Specified parentID is not a folder"); } final SampleList uniqueSampleListName = this.sampleListDao.getSampleListByParentAndName(folderName, parentList.getId(), programUUID); if (uniqueSampleListName != null) { Preconditions.checkArgument(false, "Folder name should be unique within the same directory"); } try { final SampleList sampleFolder = new SampleList(); sampleFolder.setCreatedDate(new Date()); sampleFolder.setCreatedBy(createdBy); sampleFolder.setDescription(null); sampleFolder.setListName(folderName); sampleFolder.setNotes(null); sampleFolder.setHierarchy(parentList); sampleFolder.setType(SampleListType.FOLDER); sampleFolder.setProgramUUID(programUUID); return this.sampleListDao.save(sampleFolder).getId(); } catch (HibernateException e) { throw new MiddlewareQueryException("Error in createSampleListFolder in SampleListServiceImpl: " + e.getMessage(), e); } }</code><technical_language>I wont replace throwing exceptions preconditions preconditions designed check attributes of method. In case need replace it, if condition removed. applies preconditions changes in this PR</technical_language>

Target:
public Integer createSampleListFolder(final String folderName, final Integer parentId, final User createdBy, final String programUUID) { Preconditions.checkNotNull(folderName); Preconditions.checkNotNull(parentId); Preconditions.checkNotNull(createdBy, "createdBy can not be empty"); Preconditions.checkNotNull(programUUID); Preconditions.checkArgument(!folderName.isEmpty(), "folderName can not be empty"); Preconditions.checkArgument(!programUUID.isEmpty(), "programUUID can not be empty"); final SampleList parentList; if (0 == parentId) { parentList = this.sampleListDao.getRootSampleList(); } else { parentList = this.sampleListDao.getById(parentId); } Preconditions.checkArgument(parentList != null, "Parent Folder does not exist"); Preconditions.checkArgument(parentList.isFolder(), "Specified parentID is not a folder"); final SampleList uniqueSampleListName = this.sampleListDao.getSampleListByParentAndName(folderName, parentList.getId(), programUUID); Preconditions.checkArgument(uniqueSampleListName == null, "Folder name should be unique within the same directory"); try { final SampleList sampleFolder = new SampleList(); sampleFolder.setCreatedDate(new Date()); sampleFolder.setCreatedBy(createdBy); sampleFolder.setDescription(null); sampleFolder.setListName(folderName); sampleFolder.setNotes(null); sampleFolder.setHierarchy(parentList); sampleFolder.setType(SampleListType.FOLDER); sampleFolder.setProgramUUID(programUUID); return this.sampleListDao.save(sampleFolder).getId(); } catch (final HibernateException e) { throw new MiddlewareQueryException("Error in createSampleListFolder in SampleListServiceImpl: " + e.getMessage(), e); } }