auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public Serializee getSerializee() { return serializeeInstance.get(); }

Target:
public Serializee getSerializee() { return serializee; }
Source:
private void validateJson(String jsonInString) { try { ObjectMapper mapper = new ObjectMapper(); mapper.readTree(jsonInString); } catch(JsonProcessingException ex) { fail("Diagnostic string is not in json format"); } }

Target:
private void validateJson(String jsonInString) { try { OBJECT_MAPPER.readTree(jsonInString); } catch(JsonProcessingException ex) { fail("Diagnostic string is not in json format"); } }
Source:
private void createImpliedDependencies(QueryModel parent) { ObjList<QueryModel> models = parent.getJoinModels(); JoinContext jc; for (int i = 0, n = models.size(); i < n; i++) { QueryModel m = models.getQuick(i); if (m.getJoinType() == QueryModel.JOIN_ASOF || m.getJoinType() == QueryModel.JOIN_SPLICE || m.getJoinType() == QueryModel.JOIN_LT) { linkDependencies(parent, 0, i); if (m.getContext() == null) { m.setContext(jc = contextPool.next()); jc.parents.add(0); jc.slaveIndex = i; } } } }

Target:
private void createImpliedDependencies(QueryModel parent) { ObjList<QueryModel> models = parent.getJoinModels(); JoinContext jc; for (int i = 0, n = models.size(); i < n; i++) { QueryModel m = models.getQuick(i); if (joinsRequiringTimestamp[m.getJoinType()]) { linkDependencies(parent, 0, i); if (m.getContext() == null) { m.setContext(jc = contextPool.next()); jc.parents.add(0); jc.slaveIndex = i; } } } }
Source:
public static Collection<Object[]> getRegionShortcuts() { List<Object[]> params = new ArrayList<>(); params.add(new Object[] {PARTITION}); params.add(new Object[] {REPLICATE}); return params; }

Target:
public static Collection<Object[]> getRegionShortcuts() { List<Object[]> params = new ArrayList<>(); params.add(new Object[] {PARTITION}); return params; }
Source:
private X509Certificate getSelfSignedCert(final List<X509Certificate> certs) throws AuthenticationException { int count = 0; X509Certificate selfSignedCert = null; for (final X509Certificate x509Certificate : certs) { if (x509Certificate.getSubjectDN().equals(x509Certificate.getIssuerDN())) { selfSignedCert = x509Certificate; count ++; } } if (count > 1) { throw new AuthenticationException(ADALError.BROKER_APP_VERIFICATION_FAILED); } return selfSignedCert; }

Target:
private X509Certificate getSelfSignedCert(final List<X509Certificate> certs) throws AuthenticationException { int count = 0; X509Certificate selfSignedCert = null; for (final X509Certificate x509Certificate : certs) { if (x509Certificate.getSubjectDN().equals(x509Certificate.getIssuerDN())) { selfSignedCert = x509Certificate; count++; } } if (count > 1 || selfSignedCert == null) { throw new AuthenticationException(ADALError.BROKER_APP_VERIFICATION_FAILED, "Multiple self signed certs found or no self signed cert existed."); } return selfSignedCert; }
Source:
public void addDownloadedRecord(ServerReadingListRecord down) { final Boolean deleted = down.fields.getBoolean("deleted"); if (deleted == null || !deleted.booleanValue()) { additionsOrChanges.add(down); } addDeletion(down.getGUID()); }

Target:
public void addDownloadedRecord(ServerReadingListRecord down) { final Boolean deleted = down.fields.getBoolean("deleted"); if (deleted != null && deleted.booleanValue()) { addDeletion(down.getGUID()); } else { additionsOrChanges.add(down); } }
Source:
private Position decodePosition(DeviceSession deviceSession, ChannelBuffer buf, int length, Date time) { final Position position = new Position(); position.setProtocol(getProtocolName()); position.setDeviceId(deviceSession.getDeviceId()); position.setTime(time); int readBytes = 0; while (readBytes < length) { short tag = buf.readUnsignedByte(); switch (tag) { case TAG_LATITUDE: position.setLatitude(buf.readFloat()); position.setValid(true); break; case TAG_LONGITUDE: position.setLongitude(buf.readFloat()); position.setValid(true); break; case TAG_COORD_PARAMS: position.setCourse(buf.readUnsignedByte() * 2.0); position.setAltitude(buf.readUnsignedByte() * 10.0); byte satellites = buf.readByte(); position.set(Position.KEY_SATELLITES, satellites & 0x0F + (satellites >> 4) & 0x0F); position.setSpeed(buf.readUnsignedByte() * 1.852); break; default: buf.readBytes(4); break; } readBytes += 5; } return position; }

Target:
private Position decodePosition(DeviceSession deviceSession, ChannelBuffer buf, int length, Date time) { final Position position = new Position(); position.setProtocol(getProtocolName()); position.setDeviceId(deviceSession.getDeviceId()); position.setTime(time); int readBytes = 0; while (readBytes < length) { short tag = buf.readUnsignedByte(); switch (tag) { case TAG_LATITUDE: position.setLatitude(buf.readFloat()); position.setValid(true); break; case TAG_LONGITUDE: position.setLongitude(buf.readFloat()); position.setValid(true); break; case TAG_COORD_PARAMS: position.setCourse(buf.readUnsignedByte() * 2); position.setAltitude(buf.readUnsignedByte() * 10); byte satellites = buf.readByte(); position.set(Position.KEY_SATELLITES, satellites & 0x0F + (satellites >> 4) & 0x0F); position.setSpeed(buf.readUnsignedByte()); break; default: buf.readBytes(4); break; } readBytes += 5; } return position; }
Source:
private void commit(boolean recovering) throws IOException, StoreException { List<String> logSegmentNames = getTargetLogSegmentNames(); renameLogSegments(logSegmentNames); commitLogSegments(logSegmentNames, recovering); if (!recovering) { commitIndexSegments(logSegmentNames); if (srcIndex.hardDeleter != null) { srcIndex.hardDeleter.resume(); } } }

Target:
private void commit(boolean recovering) throws IOException, StoreException { List<String> logSegmentNames = getTargetLogSegmentNames(); renameLogSegments(logSegmentNames); addNewLogSegmentsToSrcLog(logSegmentNames, recovering); if (!recovering) { updateSrcIndex(logSegmentNames); } }
Source:
public void run() { GerritTrigger trigger = getGerritTrigger(); if (trigger == null) { return; } if (StringUtils.isEmpty(trigger.getTriggerConfigURL())) { return; } if (!trigger.getJob().isBuildable()) { return; } trigger.updateTriggerConfigURL(); }

Target:
public void run() { GerritTrigger trigger = getGerritTrigger(); if (trigger == null) { return; } if (StringUtils.isEmpty(trigger.getTriggerConfigURL())) { return; } if (trigger.getJob() != null && !trigger.getJob().isBuildable()) { return; } trigger.updateTriggerConfigURL(); }
Source:
private static Optional<org.spongepowered.api.profile.GameProfile> getProfileFromServer(UUID uuid) { CompletableFuture<org.spongepowered.api.profile.GameProfile> gameProfile = Sponge.getServer().getGameProfileManager().get(uuid); try { if (gameProfile.get() != null) { return Optional.of(gameProfile.get()); } else { return Optional.empty(); } } catch (InterruptedException | ExecutionException e) { return Optional.empty(); } }

Target:
private static Optional<org.spongepowered.api.profile.GameProfile> getProfileFromServer(UUID uuid) { CompletableFuture<org.spongepowered.api.profile.GameProfile> gameProfile = Sponge.getServer().getGameProfileManager().get(uuid); try { org.spongepowered.api.profile.GameProfile profile = gameProfile.get(); if (profile != null) { return Optional.of(profile); } else { return Optional.empty(); } } catch (InterruptedException | ExecutionException e) { SpongeHooks.logWarning("Error while getting profile for {}. {}", uuid, e); return Optional.empty(); } }
Source:
private void closeFile() throws Exception { TRACE.log(TraceLevel.DEBUG, "Close File"); if (fFileTimerThread != null) { if (Thread.currentThread() != fFileTimerThread) { TRACE.log(TraceLevel.DEBUG, "Stop file timer thread"); fFileTimerThread.interrupt(); } fFileTimerThread = null; } TRACE.log(TraceLevel.DEBUG, "Close file"); synchronized (this) { if (fFileToWrite != null) { boolean alreadyClosed = fFileToWrite.isClosed(); fFileToWrite.setExpired(); fFileToWrite.close(); if ( ! alreadyClosed) { String target = fFileToWrite.getPath(); boolean success = true; if ( ! tempFile.isEmpty() ) { target = currentFileName; if (getHdfsClient().exists(target)) { if (getHdfsClient().delete(target, false)) { TRACE.log(TraceLevel.DEBUG, "Sucessfully removed file: " + target); } else { TRACE.log(TraceLevel.ERROR, "Failed to removed file: " + target); } } if (getHdfsClient().rename(currentTempFileName, target)) { TRACE.log(TraceLevel.DEBUG, "Sucessfully renamed file: " + currentTempFileName +" to: " + target); } else { success = false; TRACE.log(TraceLevel.ERROR, "Failed to rename file: " + currentTempFileName +" to: " + target); } } if (hasOutputPort && success) { submitOnOutputPort(target, fFileToWrite.getSizeFromHdfs()); } } } } }

Target:
private void closeFile() throws Exception { TRACE.log(TraceLevel.DEBUG, "closeFile()"); if (fFileTimerThread != null) { if (Thread.currentThread() != fFileTimerThread) { TRACE.log(TraceLevel.DEBUG, "Stop file timer thread"); fFileTimerThread.interrupt(); } fFileTimerThread = null; } synchronized (this) { if (fFileToWrite != null) { boolean alreadyClosed = fFileToWrite.isClosed(); fFileToWrite.setExpired(); fFileToWrite.close(); if ( ! alreadyClosed) { String target = fFileToWrite.getPath(); boolean success = true; if ( ! tempFile.isEmpty() ) { target = currentFileName; if (getHdfsClient().exists(target)) { if (getHdfsClient().delete(target, false)) { TRACE.log(TraceLevel.DEBUG, "Successfully removed file: " + target); } else { TRACE.log(TraceLevel.ERROR, "Failed to removed file: " + target); } } if (getHdfsClient().rename(currentTempFileName, target)) { TRACE.log(TraceLevel.DEBUG, "Successfully renamed file: " + currentTempFileName +" to: " + target); } else { success = false; TRACE.log(TraceLevel.ERROR, "Failed to rename file: " + currentTempFileName +" to: " + target); } } if (hasOutputPort && success) { submitOnOutputPort(target, fFileToWrite.getSizeFromHdfs()); } } } } }
Source:
public Integer createUser(final UserDto userDto) { Integer idUserSaved = null; try { final Integer currentDate = Util.getCurrentDateAsIntegerValue(); final Person person = this.createPersonFromDto(userDto, new Person()); final WorkbenchUser user = new WorkbenchUser(); user.setPerson(person); user.setName(userDto.getUsername()); user.setPassword(userDto.getPassword()); user.setAccess(0); user.setAssignDate(currentDate); user.setCloseDate(currentDate); user.setInstalid(0); user.setStatus(userDto.getStatus()); user.setType(0); final List<UserRole> userRoles = new ArrayList<>(); if (userDto.getUserRoles() != null) { for (final UserRoleDto userRoleDto : userDto.getUserRoles()) { userRoles.add(this.buildNewUserRole(user, userRoleDto)); } } user.setRoles(userRoles); final Set<CropType> crops = new HashSet<>(); for (final CropDto crop : userDto.getCrops()) { final CropType cropType = new CropType(crop.getCropName()); crops.add(cropType); } person.setCrops(crops); final WorkbenchUser recordSaved = this.workbenchDaoFactory.getWorkbenchUserDAO().saveOrUpdate(user); idUserSaved = recordSaved.getUserid(); final UserInfo userInfo = new UserInfo(); userInfo.setUserId(user.getUserid()); userInfo.setLoginCount(0); this.workbenchDaoFactory.getUserInfoDAO().insertOrUpdateUserInfo(userInfo); } catch (final Exception e) { LOG.error(e.getMessage(), e); throw new MiddlewareRequestException("", "user.create.error", new String[] {userDto.getUsername()}); } return idUserSaved; }

Target:
public Integer createUser(final UserDto userDto) { try { final Integer currentDate = Util.getCurrentDateAsIntegerValue(); final Person person = this.createPersonFromDto(userDto, new Person()); final WorkbenchUser user = new WorkbenchUser(); user.setPerson(person); user.setName(userDto.getUsername()); user.setPassword(userDto.getPassword()); user.setAccess(0); user.setAssignDate(currentDate); user.setCloseDate(currentDate); user.setInstalid(0); user.setStatus(userDto.getStatus()); user.setType(0); final List<UserRole> userRoles = new ArrayList<>(); if (userDto.getUserRoles() != null) { for (final UserRoleDto userRoleDto : userDto.getUserRoles()) { userRoles.add(this.buildNewUserRole(user, userRoleDto)); } } user.setRoles(userRoles); final Set<CropType> crops = new HashSet<>(); for (final CropDto crop : userDto.getCrops()) { final CropType cropType = new CropType(crop.getCropName()); crops.add(cropType); } person.setCrops(crops); final WorkbenchUser recordSaved = this.workbenchDaoFactory.getWorkbenchUserDAO().saveOrUpdate(user); final UserInfo userInfo = new UserInfo(); userInfo.setUserId(user.getUserid()); userInfo.setLoginCount(0); this.workbenchDaoFactory.getUserInfoDAO().insertOrUpdateUserInfo(userInfo); return recordSaved.getUserid(); } catch (final Exception e) { LOG.error(e.getMessage(), e); throw new MiddlewareRequestException("", "user.create.error", new String[] {userDto.getUsername()}); } }
Source:
public boolean validate() { getName().validateEntity(new IValidation[] { new NotEmptyValidation(), new AsciiNameValidation() }); setIsValid(getIsValid() && getName().getIsValid()); return getIsValid(); }

Target:
public boolean validate() { getName().validateEntity(new IValidation[] { new NotEmptyValidation(), new AsciiNameValidation() }); getDescription().validateEntity(new IValidation[] { new AsciiOrNoneValidation() }); setIsValid(getIsValid() && getName().getIsValid() && getDescription().getIsValid()); return getIsValid(); }
Source:
public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } ClientSecurityConfig other = (ClientSecurityConfig) obj; if (identityConfig == null) { if (other.identityConfig != null) { return false; } } else if (!identityConfig.equals(other.identityConfig)) { return false; } return true; }

Target:
public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } ClientSecurityConfig other = (ClientSecurityConfig) obj; return Objects.equals(identityConfig, other.identityConfig); }
Source:
public void updateScanner() throws IOException { if (LOG.isDebugEnabled()) { SpliceLogUtils.debug(LOG, "updateScanner with hregionInfo=%s, tableName=%s, rootDir=%s, scan=%s", hri, htd.getNameAsString(), rootDir, scan); } if (flushed) { if (LOG.isDebugEnabled()) SpliceLogUtils.debug(LOG, "Flush occurred"); if (this.topCell != null) { if (LOG.isDebugEnabled()) SpliceLogUtils.debug(LOG, "setting start row to %s", topCell); scan.setStartRow(Bytes.add(CellUtil.cloneRow(topCell), Bytes.toBytes(0))); } } memScannerList.add(getMemStoreScanner()); this.region = openHRegion(); RegionScanner regionScanner = new CountingRegionScanner(HRegionUtil.getScanner(region, scan, memScannerList), region, scan); if (flushed) { if (scanner != null) scanner.close(); } scanner = regionScanner; }

Target:
public void updateScanner() throws IOException { if (LOG.isDebugEnabled()) { SpliceLogUtils.debug(LOG, "updateScanner with hregionInfo=%s, tableName=%s, rootDir=%s, scan=%s", hri, htd.getNameAsString(), rootDir, scan); } if (flushed) { if (LOG.isDebugEnabled()) SpliceLogUtils.debug(LOG, "Flush occurred"); if (this.topCell != null) { if (LOG.isDebugEnabled()) SpliceLogUtils.debug(LOG, "setting start row to %s", topCell); scan.setStartRow(Bytes.add(CellUtil.cloneRow(topCell), new byte[]{0})); } } memScannerList.add(getMemStoreScanner()); this.region = openHRegion(); RegionScanner regionScanner = new CountingRegionScanner(HRegionUtil.getScanner(region, scan, memScannerList), region, scan); if (flushed) { if (scanner != null) scanner.close(); } scanner = regionScanner; }
Source:
public Term parse(NonTerminal nt, int position) { NonTerminal startNt = new NonTerminal(new NonTerminalId("<start>"), new StateId("<start-entry>"), new StateId("<start-exit>")); NonTerminalState state = new NonTerminalState(new StateId("<start>"), startNt, nt, false); startNt.entryState.next.add(state); state.next.add(startNt.exitState); startNt.entryState.orderingInfo = new State.OrderingInfo(Integer.MIN_VALUE); startNt.exitState.orderingInfo = new State.OrderingInfo(Integer.MAX_VALUE); state.orderingInfo = new State.OrderingInfo(Integer.MAX_VALUE - 1); activateStateCall(s.getStateCall(new StateCall.Key(s.getNtCall( new NonTerminalCall.Key(startNt, position)), position, startNt.entryState)), Function.IDENTITY); for (StateReturn stateReturn = null; (stateReturn = s.stateReturnWorkList.dequeue()) != null;) { this.workListStep(stateReturn); } Ambiguity result = new Ambiguity(KSorts.K, new ArrayList<Term>()); for(StateReturn stateReturn : s.getNtCall(new NonTerminalCall.Key(nt,position)).exitStateReturns) { if (stateReturn.key.stateEnd == s.input.length()) { result.getContents().add(new KList(new Ambiguity( KSorts.K, stateReturn.function.applyToNull()))); } } return result; }

Target:
public Term parse(NonTerminal nt, int position) { NonTerminal startNt = new NonTerminal("<start>"); NonTerminalState state = new NonTerminalState("<start>", startNt, nt, false); startNt.entryState.next.add(state); state.next.add(startNt.exitState); startNt.entryState.orderingInfo = new State.OrderingInfo(Integer.MIN_VALUE); startNt.exitState.orderingInfo = new State.OrderingInfo(Integer.MAX_VALUE); state.orderingInfo = new State.OrderingInfo(Integer.MAX_VALUE - 1); activateStateCall(s.stateCalls.get(new StateCall.Key(s.ntCalls.get( new NonTerminalCall.Key(startNt, position)), position, startNt.entryState)), Function.IDENTITY); for (StateReturn stateReturn; (stateReturn = s.stateReturnWorkList.dequeue()) != null;) { this.workListStep(stateReturn); } Ambiguity result = new Ambiguity(KSorts.K, new ArrayList<Term>()); for(StateReturn stateReturn : s.ntCalls.get(new NonTerminalCall.Key(nt,position)).exitStateReturns) { if (stateReturn.key.stateEnd == s.input.length()) { result.getContents().add(new KList(new Ambiguity( KSorts.K, stateReturn.function.applyToNull()))); } } return result; }
Source:
protected void internalUpdateItem(String slaveName, InputRegister[] registers, String itemName) { for (ModbusBindingProvider provider : providers) { if ( !provider.providesBindingFor(itemName) ) { continue; } ModbusBindingConfig config = provider.getConfig(itemName); if ( !config.slaveName.equals(slaveName)) { continue; } String slaveValueType = modbusSlaves.get(slaveName).getValueType(); double rawDataMultiplier = modbusSlaves.get(slaveName).getRawDataMultiplier(); State newState = extractStateFromRegisters(registers, config.readRegister, slaveValueType); if (config.getItem() instanceof SwitchItem) { newState = newState.equals(DecimalType.ZERO) ? OnOffType.OFF : OnOffType.ON; } if (( rawDataMultiplier != 1 ) && (config.getItem() instanceof NumberItem)) { double tmpValue = (double)((DecimalType)newState).doubleValue() * rawDataMultiplier; newState = new DecimalType( String.valueOf(tmpValue) ); } State currentState = config.getItemState(); if (! newState.equals(currentState)) eventPublisher.postUpdate(itemName, newState); } }

Target:
protected void internalUpdateItem(String slaveName, InputRegister[] registers, String itemName) { for (ModbusBindingProvider provider : providers) { if ( !provider.providesBindingFor(itemName) ) { continue; } ModbusBindingConfig config = provider.getConfig(itemName); if ( !config.slaveName.equals(slaveName)) { continue; } String slaveValueType = modbusSlaves.get(slaveName).getValueType(); double rawDataMultiplier = modbusSlaves.get(slaveName).getRawDataMultiplier(); State newState = extractStateFromRegisters(registers, config.readRegister, slaveValueType); if (config.getItem() instanceof SwitchItem) { newState = newState.equals(DecimalType.ZERO) ? OnOffType.OFF : OnOffType.ON; } if (( rawDataMultiplier != 1 ) && (config.getItem() instanceof NumberItem)) { double tmpValue = (double)((DecimalType)newState).doubleValue() * rawDataMultiplier; newState = new DecimalType( String.valueOf(tmpValue) ); } State currentState = config.getItemState(); if (! newState.equals(currentState)) { eventPublisher.postUpdate(itemName, newState); } } }
Source:
public void beforeMethod() throws Exception { file = File.createTempFile("file", ".tmp"); concurrentFileLineConsumer = new ConcurrentFileLineConsumer(file); injectWriterMock(concurrentFileLineConsumer, writer); executor = Executors.newFixedThreadPool(5); }

Target:
public void beforeMethod() throws Exception { file = File.createTempFile("file", ".tmp"); concurrentFileLineConsumer = new ConcurrentFileLineConsumer(file); injectWriterMock(concurrentFileLineConsumer, writer); executor = Executors.newFixedThreadPool(3); }
Source:
public void testNestedDependencyChangeAndApplyCompletes() throws Exception { final AtomicBoolean hasRun = new AtomicBoolean(); WritableValue<Object> invalidator = new WritableValue<Object>(new Object(), null); final SideEffect innerSideEffect = SideEffect.createPaused(() -> { invalidator.getValue(); }).resume(); SideEffect.createPaused(() -> { assertFalse(hasRun.get()); hasRun.set(true); invalidator.setValue(new Object()); innerSideEffect.runIfDirty(); }).resume(); runAsync(); assertTrue(hasRun.get()); }

Target:
public void testNestedDependencyChangeAndApplyCompletes() throws Exception { AtomicBoolean hasRun = new AtomicBoolean(); WritableValue<Object> invalidator = new WritableValue<Object>(new Object(), null); ISideEffect innerSideEffect = SideEffect.create(() -> { invalidator.getValue(); }); SideEffect.createPaused(() -> { assertFalse(hasRun.get()); hasRun.set(true); invalidator.setValue(new Object()); innerSideEffect.runIfDirty(); }).resume(); runAsync(); assertTrue(hasRun.get()); }
Source:
public void connect() { connection = new WinrsConnection(options, mapper, workingDirectory); connection.connectToWinrsProxy(options); if (connection.getWinrsProxyConnection().getHostOperatingSystem() != WINDOWS) { connection.disconnectFromWinrsProxy(); throw new IllegalArgumentException(format("Cannot create a " + CIFS_PROTOCOL + ":%s connection with a winrs proxy that is not running Windows", cifsConnectionType.toString().toLowerCase())); } connected(); }

Target:
public void connect() { super.connect(); }
Source:
private List<RealWorldTestingUpload> parseCsvFile(MultipartFile file) throws ValidationException { try (BufferedReader reader = new BufferedReader(new InputStreamReader(file.getInputStream())); CSVParser parser = new CSVParser(reader, CSVFormat.EXCEL)) { List<CSVRecord> records = parser.getRecords(); if (records.size() <= 1 && doesHeaderRowExist(records)) { throw new ValidationException("The file appears to have a header line with no other information. " + "Please make sure there are at least two rows in the CSV file."); } records = removeEmptyRows(records); records = removeHeaderRow(records); List<RealWorldTestingUpload> rwts = records.stream().map(rec -> createRwtUploadFromCsvRecord(rec)) .collect(Collectors.toList()); return rwts; } catch (final IOException ioEx) { throw new ValidationException("Could not get input stream for uploaded file " + file.getName()); } }

Target:
private List<RealWorldTestingUpload> parseCsvFile(MultipartFile file) throws ValidationException { try (BufferedReader reader = new BufferedReader(new InputStreamReader(file.getInputStream())); CSVParser parser = new CSVParser(reader, CSVFormat.EXCEL)) { List<CSVRecord> records = parser.getRecords(); if (records.size() <= 1 && doesHeaderRowExist(records)) { throw new ValidationException(errorMessageUtil.getMessage("realWorldTesting.upload.headerOnly")); } records = removeHeaderRow(records); records = removeEmptyRows(records); if (records.size() == 0) { throw new ValidationException(errorMessageUtil.getMessage("realWorldTesting.upload.emptyFile")); } List<RealWorldTestingUpload> rwts = records.stream() .map(rec -> createRwtUploadFromCsvRecord(rec)) .collect(Collectors.toList()); return rwts; } catch (final IOException ioEx) { throw new ValidationException("Could not get input stream for uploaded file " + file.getName()); } }
Source:
public static String getBaseSecId(String secId) { if (secId == null) { return null; } if (!secId.contains(INTERNAL_SECONDARY_ID_SEPARATOR)) { if (isUUID(secId)) { return null; } return secId; } int lastIndexSepartor = secId.lastIndexOf(INTERNAL_SECONDARY_ID_SEPARATOR); String potentialUUID = secId.substring(lastIndexSepartor + 1); if (!isUUID(potentialUUID)) { return secId; } return secId.substring(0, lastIndexSepartor); }

Target:
public static String getBaseSecId(String secId) { if (secId == null) { return null; } int uuidSeparator = secId.lastIndexOf(INTERNAL_SECONDARY_ID_SEPARATOR); if (uuidSeparator == -1) { if (isUUID(secId)) { return null; } return secId; } String potentialUUID = secId.substring(uuidSeparator + 1); if (!isUUID(potentialUUID)) { return secId; } return secId.substring(0, uuidSeparator); }
Source:
public static MutableVirtualFile safeCreate(@Nonnull VirtualFile parent, @Nullable String name) { if (Strings.isEmpty(name)) { return null; } return new MutableVirtualFile(parent, name.replace('/', '_')); }

Target:
public static MutableVirtualFile safeCreate(@Nonnull VirtualFile parent, @Nullable String name) { if (Strings.isEmpty(name)) { return null; } return new MutableVirtualFile(parent, name.replaceAll(REGEX_ILLEGAL_FILE_CHARS, "_")); }
Source:
public RemoteATCommandWifiPacket(int frameID, IP32BitAddress destAddress, int transmitOptions, String command, String parameter) { this(frameID, destAddress, transmitOptions, command, parameter.getBytes()); }

Target:
public RemoteATCommandWifiPacket(int frameID, IP32BitAddress destAddress, int transmitOptions, String command, String parameter) { this(frameID, destAddress, transmitOptions, command, parameter == null ? null : parameter.getBytes()); }
Source:
public void testLayoutSyncDownFromConfig() throws JSONException { MobileSyncSDKManager.getInstance().setupUserSyncsFromDefaultConfig(); SyncState sync = syncManager.getSyncStatus("layoutSyncDown"); Assert.assertEquals("Wrong soup name", ACCOUNTS_SOUP, sync.getSoupName()); checkStatus(sync, SyncState.Type.syncDown, sync.getId(), new LayoutSyncDownTarget("Account", null, "Compact", null, null), SyncOptions.optionsForSyncDown(MergeMode.OVERWRITE), SyncState.Status.NEW, 0); }

Target:
public void testLayoutSyncDownFromConfig() throws JSONException { MobileSyncSDKManager.getInstance().setupUserSyncsFromDefaultConfig(); SyncState sync = syncManager.getSyncStatus("layoutSyncDown"); Assert.assertEquals("Wrong soup name", ACCOUNTS_SOUP, sync.getSoupName()); checkStatus(sync, SyncState.Type.syncDown, sync.getId(), new LayoutSyncDownTarget("Account", "Medium", "Compact", "Edit", null), SyncOptions.optionsForSyncDown(MergeMode.OVERWRITE), SyncState.Status.NEW, 0); }
Source:
public int place(World world, BlockPos pos, @Nonnull FluidStack fluidStack, boolean doPlace) { if (fluidStack.amount < Fluid.BUCKET_VOLUME) { return 0; } if (doPlace) { FluidUtil.destroyBlockOnFluidPlacement(world, pos); world.setBlockState(pos, this.getDefaultState(), Constants.BlockFlags.DEFAULT | Constants.BlockFlags.RERENDER_MAIN_THREAD); } return Fluid.BUCKET_VOLUME; }

Target:
public int place(World world, BlockPos pos, @Nonnull FluidStack fluidStack, boolean doPlace) { if (fluidStack.amount < Fluid.BUCKET_VOLUME) { return 0; } if (doPlace) { FluidUtil.destroyBlockOnFluidPlacement(world, pos); world.setBlockState(pos, this.getDefaultState(), Constants.BlockFlags.DEFAULT_AND_RERENDER); } return Fluid.BUCKET_VOLUME; }
Source:
public void announce( @NotNull(message = "body can't be NULL") final String body) { final AmazonSimpleEmailService aws = this.client.get(); String[] parts = new String[2]; Message message = null; if (body.startsWith("<html>") && body.endsWith("</html>")) { try { final InputSource source = new InputSource(new StringReader(body)); final DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); final DocumentBuilder dbuilder = dbf.newDocumentBuilder(); final Document document = dbuilder.parse(source); final XPathFactory xpathFactory = XPathFactory.newInstance(); final XPath xpath = xpathFactory.newXPath(); final String title = xpath .evaluate("/html/head/title", document); message = new Message() .withSubject(new Content().withData(title)) .withBody( new Body().withHtml(new Content().withData(body)) ); } catch (Exception ex) { throw new RuntimeException(ex.getMessage()); } } else { parts = body.split("\n", 2); message = new Message() .withSubject(new Content().withData(parts[0])) .withBody( new Body().withText(new Content().withData(parts[1])) ); } try { final SendEmailResult result = aws.sendEmail( new SendEmailRequest() .withSource(this.sender) .withReturnPath(this.sender) .withDestination( new Destination().withToAddresses(this.recipients) ) .withMessage(message) ); Logger.info( this, "#announce(..): sent SES email %s from %s to %s", result.getMessageId(), this.sender, this.recipients ); } finally { aws.shutdown(); } }

Target:
public void announce( @NotNull(message = "body can't be NULL") final String body) { final AmazonSimpleEmailService aws = this.client.get(); final Message message; if (body.startsWith("<html>") && body.endsWith("</html>")) { message = new Message() .withSubject(new Content() .withData(new SimpleXml(body) .xpath("/html/head/title/text()").get(0) ) ) .withBody(new Body() .withHtml(new Content().withData(body)) ); } else { final String[] parts = body.split("\n", 2); message = new Message() .withSubject(new Content().withData(parts[0])) .withBody( new Body().withText(new Content().withData(parts[1])) ); } try { final SendEmailResult result = aws.sendEmail( new SendEmailRequest() .withSource(this.sender) .withReturnPath(this.sender) .withDestination( new Destination().withToAddresses(this.recipients) ) .withMessage(message) ); Logger.info( this, "#announce(..): sent SES email %s from %s to %s", result.getMessageId(), this.sender, this.recipients ); } finally { aws.shutdown(); } }
Source:
public List<QualifiedObjectName> listViews(Session session, QualifiedTablePrefix prefix) { requireNonNull(prefix, "prefix is null"); Optional<CatalogMetadata> catalog = getOptionalCatalogMetadata(session, prefix.getCatalogName()); Set<QualifiedObjectName> views = new LinkedHashSet<>(); if (catalog.isPresent()) { CatalogMetadata catalogMetadata = catalog.get(); Optional<String> schemaName = prefix.getSchemaName(); for (ConnectorId connectorId : catalogMetadata.listConnectorIds()) { ConnectorMetadata metadata = catalogMetadata.getMetadataFor(connectorId); ConnectorSession connectorSession = session.toConnectorSession(connectorId); metadata.listViews(connectorSession, schemaName).stream() .map(convertFromSchemaTableName(prefix.getCatalogName())::apply) .forEach(views::add); } } return ImmutableList.copyOf(views); }

Target:
public List<QualifiedObjectName> listViews(Session session, QualifiedTablePrefix prefix) { requireNonNull(prefix, "prefix is null"); Optional<CatalogMetadata> catalog = getOptionalCatalogMetadata(session, prefix.getCatalogName()); Set<QualifiedObjectName> views = new LinkedHashSet<>(); if (catalog.isPresent()) { CatalogMetadata catalogMetadata = catalog.get(); for (ConnectorId connectorId : catalogMetadata.listConnectorIds()) { ConnectorMetadata metadata = catalogMetadata.getMetadataFor(connectorId); ConnectorSession connectorSession = session.toConnectorSession(connectorId); metadata.listViews(connectorSession, prefix.getSchemaName()).stream() .map(convertFromSchemaTableName(prefix.getCatalogName())) .filter(prefix::matches) .forEach(views::add); } } return ImmutableList.copyOf(views); }
Source:
public static Set<DistributionModuleGroup> getModuleGroups(String distribution, String version) { Set<DistributionModuleGroup> hs = new HashSet<>(); DistributionModuleGroup dmgSpark16 = new DistributionModuleGroup( CDH5100Constant.SPARK_KINESIS_MRREQUIRED_MODULE_GROUP.getModuleName(), true, new NestedComponentCondition(new MultiComponentCondition( new SparkStreamingLinkedNodeCondition(distribution, version).getCondition(), BooleanOperator.AND, spark16Condition))); DistributionModuleGroup dmgSpark21 = new DistributionModuleGroup( CDH5100Constant.SPARK2_KINESIS_MRREQUIRED_MODULE_GROUP.getModuleName(), true, new NestedComponentCondition(new MultiComponentCondition( new SparkStreamingLinkedNodeCondition(distribution, version).getCondition(), BooleanOperator.AND, spark21Condition))); hs.add(dmgSpark16); hs.add(dmgSpark21); return hs; }

Target:
public static Set<DistributionModuleGroup> getModuleGroups(String distribution, String version) { Set<DistributionModuleGroup> hs = new HashSet<>(); DistributionModuleGroup dmgSpark16 = new DistributionModuleGroup( CDH5100Constant.SPARK_KINESIS_MRREQUIRED_MODULE_GROUP.getModuleName(), true, new NestedComponentCondition(new MultiComponentCondition( new SparkStreamingLinkedNodeCondition(distribution, version).getCondition(), BooleanOperator.AND, spark16Condition))); hs.add(dmgSpark16); DistributionModuleGroup dmgSpark21 = new DistributionModuleGroup( CDH5100Constant.SPARK2_KINESIS_MRREQUIRED_MODULE_GROUP.getModuleName(), true, new NestedComponentCondition(new MultiComponentCondition( new SparkStreamingLinkedNodeCondition(distribution, version).getCondition(), BooleanOperator.AND, spark21Condition))); hs.add(dmgSpark21); return hs; }
Source:
public static List<String> extractValues(Collection<StructuredProperty> source, FieldApprover fieldApprover) { if (CollectionUtils.isNotEmpty(source)) { List<String> results = new ArrayList<String>(source.size()); for (StructuredProperty current : source) { if (fieldApprover.approve(current.getDataInfo())) { results.add(current.getValue()); } } return results; } else { return Collections.emptyList(); } }

Target:
public static List<String> extractValues(Collection<StructuredProperty> source, FieldApprover fieldApprover) { return source.stream() .filter(x -> fieldApprover.approve(x.getDataInfo())) .map(StructuredProperty::getValue) .collect(Collectors.toList()); }
Source:
protected void addAttribute(Composite composite, FormToolkit toolkit, TaskAttribute attribute) { if (peopleAttributes.contains(attribute)) { return; } AbstractAttributeEditor editor = createAttributeEditor(attribute); if (editor != null) { editor.createLabelControl(composite, toolkit); GridDataFactory.defaultsFor(editor.getLabelControl()) .indent(COLUMN_MARGIN, 0) .applyTo(editor.getLabelControl()); editor.createControl(composite, toolkit); getTaskEditorPage().getAttributeEditorToolkit().adapt(editor); GridDataFactory gridDataFactory = GridDataFactory.fillDefaults() .grab(true, false) .align(SWT.FILL, SWT.TOP) .indent(3, 0); if (editor instanceof MultiSelectionAttributeEditor) { gridDataFactory.hint(SWT.DEFAULT, 95); } gridDataFactory.applyTo(editor.getControl()); } }

Target:
protected void addAttribute(Composite composite, FormToolkit toolkit, TaskAttribute attribute) { AbstractAttributeEditor editor = createAttributeEditor(attribute); if (editor != null) { editor.createLabelControl(composite, toolkit); GridDataFactory.defaultsFor(editor.getLabelControl()) .indent(COLUMN_MARGIN, 0) .applyTo(editor.getLabelControl()); editor.createControl(composite, toolkit); getTaskEditorPage().getAttributeEditorToolkit().adapt(editor); GridDataFactory gridDataFactory = GridDataFactory.fillDefaults() .grab(true, false) .align(SWT.FILL, SWT.TOP) .indent(3, 0); if (editor instanceof MultiSelectionAttributeEditor) { gridDataFactory.hint(SWT.DEFAULT, 95); } gridDataFactory.applyTo(editor.getControl()); } }
Source:
public java.util.Optional<String> getUrlOverride(@Nonnull String service, @Nonnull Link quickLink) { return Optional.ofNullable( urlOverrides.get(Pair.of(service, quickLink.getName())) ); }

Target:
public Optional<String> getUrlOverride(@Nonnull String service, @Nonnull Link quickLink) { return Optional.ofNullable( urlOverrides.get(Pair.of(service, quickLink.getName())) ); }
Source:
public void testConstructorWithBuiltInTypeParameter() { final QName qname = new QName(BuiltInType.STRING); assertEquals(qname.getLocalPart(), BuiltInType.STRING.getName()); }

Target:
public void testConstructorWithBuiltInTypeParameter() { final QName qname = new QName(BuiltInType.STRING); assertEquals(qname.getLocalPart(), BuiltInType.STRING.getName()); assertEquals(qname.getNamespaceURI(), QName.NULL_NS_URI); }
Source:
public Response specPost(final SupervisorSpec spec, @Context final HttpServletRequest req) { return asLeaderWithSupervisorManager( new Function<SupervisorManager, Response>() { @Override public Response apply(SupervisorManager manager) { if (authConfig.isEnabled()) { Preconditions.checkArgument( spec.getDataSources() != null && spec.getDataSources().size() > 0, "No dataSources found to perform authorization checks" ); Access authResult = AuthorizationUtils.authorizeAllResourceActions( req, spec.getDataSources(), AuthorizationUtils.DATASOURCE_WRITE_RA_GENERATOR, authorizationManager ); if (!authResult.isAllowed()) { return Response.status(Response.Status.FORBIDDEN).header("Access-Check-Result", authResult).build(); } } manager.createOrUpdateAndStartSupervisor(spec); return Response.ok(ImmutableMap.of("id", spec.getId())).build(); } } ); }

Target:
public Response specPost(final SupervisorSpec spec, @Context final HttpServletRequest req) { return asLeaderWithSupervisorManager( new Function<SupervisorManager, Response>() { @Override public Response apply(SupervisorManager manager) { Preconditions.checkArgument( spec.getDataSources() != null && spec.getDataSources().size() > 0, "No dataSources found to perform authorization checks" ); Access authResult = AuthorizationUtils.authorizeAllResourceActions( req, Iterables.transform(spec.getDataSources(), AuthorizationUtils.DATASOURCE_WRITE_RA_GENERATOR), authorizerMapper ); if (!authResult.isAllowed()) { throw new ForbiddenException(authResult.toString()); } manager.createOrUpdateAndStartSupervisor(spec); return Response.ok(ImmutableMap.of("id", spec.getId())).build(); } } ); }
Source:
public BackgroundHiveSplitLoader( Table table, Iterable<HivePartitionMetadata> partitions, TupleDomain<? extends ColumnHandle> compactEffectivePredicate, Optional<BucketSplitInfo> bucketSplitInfo, ConnectorSession session, HdfsEnvironment hdfsEnvironment, NamenodeStats namenodeStats, DirectoryLister directoryLister, Executor executor, int loaderConcurrency, boolean recursiveDirWalkerEnabled) { this.table = table; this.compactEffectivePredicate = compactEffectivePredicate; this.bucketSplitInfo = bucketSplitInfo; this.loaderConcurrency = loaderConcurrency; this.session = session; this.hdfsEnvironment = hdfsEnvironment; this.namenodeStats = namenodeStats; this.directoryLister = directoryLister; this.recursiveDirWalkerEnabled = recursiveDirWalkerEnabled; this.executor = executor; this.partitions = new ConcurrentLazyQueue<>(partitions); this.hdfsContext = new HdfsContext(session, table.getDatabaseName(), table.getTableName()); this.corruptBucketing = "Hive table (" + table + ") is corrupt. It is declared as being bucketed, but the files do not match the bucketing declaration."; }

Target:
public BackgroundHiveSplitLoader( Table table, Iterable<HivePartitionMetadata> partitions, TupleDomain<? extends ColumnHandle> compactEffectivePredicate, Optional<BucketSplitInfo> bucketSplitInfo, ConnectorSession session, HdfsEnvironment hdfsEnvironment, NamenodeStats namenodeStats, DirectoryLister directoryLister, Executor executor, int loaderConcurrency, boolean recursiveDirWalkerEnabled) { this.table = table; this.compactEffectivePredicate = compactEffectivePredicate; this.bucketSplitInfo = bucketSplitInfo; this.loaderConcurrency = loaderConcurrency; this.session = session; this.hdfsEnvironment = hdfsEnvironment; this.namenodeStats = namenodeStats; this.directoryLister = directoryLister; this.recursiveDirWalkerEnabled = recursiveDirWalkerEnabled; this.executor = executor; this.partitions = new ConcurrentLazyQueue<>(partitions); this.hdfsContext = new HdfsContext(session, table.getDatabaseName(), table.getTableName()); }
Source:
public ViewHolder(View itemView) { super(itemView); SharedPreferences mPrefs = PreferenceManager.getDefaultSharedPreferences(itemView.getContext()); selectedListLayout = Integer.parseInt(mPrefs.getString(SettingsActivity.SP_FEED_LIST_LAYOUT, "0")); bodyForegroundColor = new ForegroundColorSpan(ContextCompat.getColor(itemView.getContext(), android.R.color.secondary_text_dark)); if(favIconHandler == null) { favIconHandler = new FavIconHandler(itemView.getContext()); } ButterKnife.bind(this, itemView); int[] attribute = new int[]{ R.attr.starredColor, R.attr.unstarredColor }; TypedArray array = starImageView.getContext().getTheme().obtainStyledAttributes(attribute); starColor = array.getColor(0, Color.TRANSPARENT); inactiveStarColor = array.getColor(1, Color.LTGRAY); array.recycle(); if(textViewSummary != null) { textSizeSummary = Math.round(textViewSummary.getTextSize()); } if(textViewTitle != null) { textSizeTitle = Math.round(textViewTitle.getTextSize()); } if(textViewBody != null) { textSizeBody = Math.round(textViewBody.getTextSize()); } if(textViewItemDate != null) { textSizeItemDate = Math.round(textViewItemDate.getTextSize()); } itemView.setOnClickListener(this); itemView.setOnLongClickListener(this); displayImageOptionsThumbnail = new DisplayImageOptions.Builder() .displayer(new SquareRoundedBitmapDisplayer(30)) .showImageOnLoading(R.drawable.feed_icon) .showImageForEmptyUri(R.drawable.feed_icon) .showImageOnFail(R.drawable.feed_icon) .cacheOnDisk(true) .cacheInMemory(true) .build(); }

Target:
public ViewHolder(View itemView) { super(itemView); SharedPreferences mPrefs = PreferenceManager.getDefaultSharedPreferences(itemView.getContext()); selectedListLayout = Integer.parseInt(mPrefs.getString(SettingsActivity.SP_FEED_LIST_LAYOUT, "0")); bodyForegroundColor = new ForegroundColorSpan(ContextCompat.getColor(itemView.getContext(), android.R.color.secondary_text_dark)); if(favIconHandler == null) { favIconHandler = new FavIconHandler(itemView.getContext()); } ButterKnife.bind(this, itemView); int[] attribute = new int[]{ R.attr.starredColor, R.attr.unstarredColor }; TypedArray array = starImageView.getContext().getTheme().obtainStyledAttributes(attribute); starColor = array.getColor(0, Color.TRANSPARENT); inactiveStarColor = array.getColor(1, Color.LTGRAY); array.recycle(); textSizeSummary = Math.round(textViewSummary.getTextSize()); textSizeTitle = Math.round(textViewTitle.getTextSize()); if(textViewBody != null) { textSizeBody = Math.round(textViewBody.getTextSize()); } textSizeItemDate = Math.round(textViewItemDate.getTextSize()); itemView.setOnClickListener(this); itemView.setOnLongClickListener(this); displayImageOptionsThumbnail = new DisplayImageOptions.Builder() .displayer(new SquareRoundedBitmapDisplayer(30)) .showImageOnLoading(R.drawable.feed_icon) .showImageForEmptyUri(R.drawable.feed_icon) .showImageOnFail(R.drawable.feed_icon) .cacheOnDisk(true) .cacheInMemory(true) .build(); }
Source:
public static boolean hasErrorPartitions(HelixDataAccessor dataAccessor, String clusterId, String instanceName) { PropertyKey.Builder propertyKeyBuilder = new PropertyKey.Builder(clusterId); PropertyKey liveInstanceKey = propertyKeyBuilder.liveInstance(instanceName); LiveInstance liveInstance = dataAccessor.getProperty(liveInstanceKey); if (liveInstance != null) { String sessionId = liveInstance.getEphemeralOwner(); for (PropertyKey key : getAllCurrentStateKeys(dataAccessor, instanceName, sessionId)) { CurrentState currentState = dataAccessor.getProperty(key); if (currentState != null && currentState.getPartitionStateMap().containsValue(HelixDefinedState.ERROR.name())) { _logger.warn(String.format("The instance %s has error partitions on it.", instanceName)); return true; } } } return false; }

Target:
public static boolean hasErrorPartitions(HelixDataAccessor dataAccessor, String clusterId, String instanceName) { PropertyKey.Builder propertyKeyBuilder = new PropertyKey.Builder(clusterId); PropertyKey liveInstanceKey = propertyKeyBuilder.liveInstance(instanceName); LiveInstance liveInstance = dataAccessor.getProperty(liveInstanceKey); if (liveInstance != null) { String sessionId = liveInstance.getEphemeralOwner(); PropertyKey currentStatesKey = propertyKeyBuilder.currentStates(instanceName, sessionId); List<String> resourceNames = dataAccessor.getChildNames(currentStatesKey); for (String resourceName : resourceNames) { PropertyKey key = propertyKeyBuilder.currentState(instanceName, sessionId, resourceName); CurrentState currentState = dataAccessor.getProperty(key); if (currentState != null && currentState.getPartitionStateMap().containsValue(HelixDefinedState.ERROR.name())) { _logger.warn(String.format("The instance %s has error partitions on it.", instanceName)); return true; } } } return false; }
Source:
public static void getDummyResult(byte[] rowKey, List<Cell> result) { result.clear(); KeyValue keyValue = KeyValueUtil.newKeyValue(rowKey, 0, rowKey.length, EMPTY_BYTE_ARRAY, EMPTY_BYTE_ARRAY, 0, EMPTY_BYTE_ARRAY, 0, EMPTY_BYTE_ARRAY.length); result.add(keyValue); }

Target:
public static void getDummyResult(byte[] rowKey, List<Cell> result) { KeyValue keyValue = KeyValueUtil.newKeyValue(rowKey, 0, rowKey.length, EMPTY_BYTE_ARRAY, EMPTY_BYTE_ARRAY, 0, EMPTY_BYTE_ARRAY, 0, EMPTY_BYTE_ARRAY.length); result.add(keyValue); }
Source:
private void fixFeedbackResponsesOfFeedbackSession(FeedbackSession session) throws InvalidParametersException, EntityDoesNotExistException { List<FeedbackResponseAttributes> feedbackResponseList = feedbackResponsesDb.getFeedbackResponsesForSession(session.getFeedbackSessionName(), session.getCourseId()); for (FeedbackResponseAttributes response : feedbackResponseList) { response.feedbackSessionName = StringHelper.removeExtraSpace(response.feedbackSessionName); feedbackResponsesDb.updateFeedbackResponse(response); } }

Target:
private void fixFeedbackResponsesOfFeedbackSession(FeedbackSession session) throws InvalidParametersException, EntityDoesNotExistException { Query q = getPm().newQuery(FeedbackResponse.class); q.declareParameters("String feedbackSessionNameParam, String courseIdParam"); q.setFilter("feedbackSessionName == feedbackSessionNameParam && " + "courseId == courseIdParam"); @SuppressWarnings("unchecked") List<FeedbackResponse> responses = (List<FeedbackResponse>) q.execute(session.getFeedbackSessionName(), session.getCourseId()); for (FeedbackResponse response : responses) { response.setFeedbackSessionName( StringHelper.removeExtraSpace(response.getFeedbackSessionName())); } getPm().close(); }
Source:
public void validateExistingManagedExternalId() { ExternalIdentifier externalIdentifier = new DynamoExternalIdentifier(); when(externalIdService.getExternalId(study.getStudyIdentifier(), "foo")).thenReturn(externalIdentifier); StudyParticipant participant = new StudyParticipant.Builder().withEmail("email@email.com") .withExternalId("foo").withId("id").withPassword("pAssword1@").build(); validator = new StudyParticipantValidator(externalIdService, study, false); study.setExternalIdValidationEnabled(true); Validate.entityThrowingException(validator, participant); }

Target:
public void validateExistingManagedExternalId() { when(externalIdService.getExternalId(study.getStudyIdentifier(), "foo")).thenReturn(EXT_ID); StudyParticipant participant = new StudyParticipant.Builder().withEmail("email@email.com") .withExternalId("foo").withId("id").withPassword("pAssword1@").build(); validator = new StudyParticipantValidator(externalIdService, study, false); study.setExternalIdValidationEnabled(true); Validate.entityThrowingException(validator, participant); }