auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public AbstractSpeechSynthesisMeta() { addPeer("audioFile", "AudioFile", "audioFile"); addCategory("speech"); addDependency("org.myrobotlab.audio", "voice-effects", "1.0", "zip"); addDependency("javazoom", "jlayer", "1.0.1"); addDependency("com.googlecode.soundlibs", "mp3spi", "1.9.5.4"); }

Target:
public AbstractSpeechSynthesisMeta() { addPeer("audioFile", "AudioFile", "audioFile"); addCategory("speech"); addDependency("org.myrobotlab.audio", "voice-effects", "1.0", "zip"); }
Source:
public void testInsertDynamicNullArrayInBulk() throws Exception { execute("create table foo (value integer) with (number_of_replicas=0, column_policy = 'dynamic')"); var listWithNull = new ArrayList<>(1); listWithNull.add(null); long[] rowCounts = execute("insert into foo (bar) values (?)", new Object[][]{ new Object[]{listWithNull}, new Object[]{List.of(1, 2)}, }); refresh(); assertThat(rowCounts[0], is(1L)); assertThat(rowCounts[1], is(1L)); waitForMappingUpdateOnAll("foo", "bar"); execute("select data_type from information_schema.columns where table_name = 'foo' and column_name = 'bar'"); assertThat(response.rows()[0][0], is("bigint_array")); }

Target:
public void testInsertDynamicNullArrayInBulk() throws Exception { execute("create table foo (value integer) with (number_of_replicas=0, column_policy = 'dynamic')"); var listWithNull = new ArrayList<>(1); listWithNull.add(null); long[] rowCounts = execute("insert into foo (bar) values (?)", new Object[][]{ new Object[]{listWithNull}, new Object[]{List.of(1, 2)}, }); assertThat(rowCounts[0], is(1L)); assertThat(rowCounts[1], is(1L)); waitForMappingUpdateOnAll("foo", "bar"); execute("select data_type from information_schema.columns where table_name = 'foo' and column_name = 'bar'"); assertThat(response.rows()[0][0], is("bigint_array")); }
Source:
private String getTeamStr(ArtifactReadable action) { String results = action.getSoleAttributeAsString(AtsAttributeTypes.TeamDefinition, ""); if (Strings.isValid(results)) { results = atsServer.getArtifactByGuid(results).getName(); } else { ArtifactReadable teamWf = getParentTeamWf(action); if (teamWf != null) { return getTeamStr(teamWf); } } return results; }

Target:
private String getTeamStr(ArtifactReadable action) { String results = action.getSoleAttributeAsString(AtsAttributeTypes.TeamDefinition, ""); if (Strings.isValid(results)) { results = atsServer.getArtifactByGuid(results).getName(); } else { ArtifactReadable teamWf = getParentTeamWf(action); if (teamWf != null) { results = getTeamStr(teamWf); } } return results; }
Source:
public SqlArrayTypes register(Class<?> elementType, String sqlTypeName) { final Optional<SqlArrayType<?>> arrayType = Optional.of(SqlArrayType.of(sqlTypeName, Function.identity())); return register((type, c) -> elementType == type ? arrayType : Optional.empty()); }

Target:
public SqlArrayTypes register(Class<?> elementType, String sqlTypeName) { return register(SqlArrayTypeFactory.of(elementType, sqlTypeName, Function.identity())); }
Source:
public void objectValue(DistinctQueryType queryType) { String resource = String.format("{ " + "\"id\": \"%s\", " + "\"mypk\": \"%s\", " + "\"sgmts\": [[6519456, 1471916863], [2498434, 1455671440]]" + "}", 117546, "xxyyzz-abc"); DistinctMap distinctMap = DistinctMap.create(queryType, null); Utils.ValueHolder<String> outHash = new Utils.ValueHolder<>(); boolean add = distinctMap.add(resource, outHash); assertThat(add).as("Value should be added first time").isTrue(); boolean add2 = distinctMap.add(resource, outHash); assertThat(add2).as("same value should not be added again").isFalse(); resource = String.format("{ " + "\"id\": \"%s\", " + "\"mypk\": \"%s\", " + "\"sgmts\": [[6519456, 1471916863], [2498434, 1455671440]]" + "}", 117546, "xxy%zz-abc"); boolean add3 = distinctMap.add(resource, outHash); assertThat(add3).as("different value should be added again").isTrue(); }

Target:
public void objectValue(DistinctQueryType queryType) { String resourceString = String.format("{ " + "\"id\": \"%s\", " + "\"mypk\": \"%s\", " + "\"sgmts\": [[6519456, 1471916863], [2498434, 1455671440]]" + "}", 117546, "xxyyzz-abc"); Document resource = new Document(resourceString); DistinctMap distinctMap = DistinctMap.create(queryType, null); Utils.ValueHolder<String> outHash = new Utils.ValueHolder<>(); boolean add = distinctMap.add(resource, outHash); assertThat(add).as("Value should be added first time").isTrue(); boolean add2 = distinctMap.add(resource, outHash); assertThat(add2).as("same value should not be added again").isFalse(); resourceString = String.format("{ " + "\"id\": \"%s\", " + "\"mypk\": \"%s\", " + "\"sgmts\": [[6519456, 1471916863], [2498434, 1455671440]]" + "}", 117546, "xxy%zz-abc"); resource = new Document(resourceString); boolean add3 = distinctMap.add(resource, outHash); assertThat(add3).as("different value should be added again").isTrue(); }
Source:
private void handleAnyChildSPMTaskCompletion(boolean succeeded) { List<Guid> childCommandIds = CommandCoordinatorUtil.getChildCommandIds(getCommandId()); if (childCommandIds.isEmpty()) { return; } Guid currentChildId = childCommandIds.get(0); log.info("Handling child command completion", currentChildId); if (!Guid.isNullOrEmpty(currentChildId)) { CommandBase<?> command = CommandCoordinatorUtil.retrieveCommand(currentChildId); CommandEntity cmdEntity = CommandCoordinatorUtil.getCommandEntity(currentChildId); if (command != null && cmdEntity != null && !cmdEntity.isCallbackNotified()) { if (!succeeded) { command.getParameters().setTaskGroupSuccess(false); } Backend.getInstance().endAction(VdcActionType.ExtendImageSize, command.getParameters(), cloneContextAndDetachFromParent()); if (succeeded && CommandCoordinatorUtil.getCommandEntity(currentChildId) != null) { CommandCoordinatorUtil.getCommandEntity(currentChildId).setCallbackNotified(true); } } } }

Target:
private void handleAnyChildSPMTaskCompletion(boolean succeeded) { List<Guid> childCommandIds = CommandCoordinatorUtil.getChildCommandIds(getCommandId()); if (childCommandIds.isEmpty()) { return; } Guid currentChildId = childCommandIds.get(0); log.info("Handling child command completion", currentChildId); if (!Guid.isNullOrEmpty(currentChildId)) { CommandBase<?> command = CommandCoordinatorUtil.retrieveCommand(currentChildId); CommandEntity cmdEntity = CommandCoordinatorUtil.getCommandEntity(currentChildId); if (command != null && cmdEntity != null && !cmdEntity.isCallbackNotified()) { if (!succeeded) { command.getParameters().setTaskGroupSuccess(false); } Backend.getInstance().endAction(VdcActionType.ExtendImageSize, command.getParameters(), cloneContextAndDetachFromParent()); if (succeeded && cmdEntity != null) { cmdEntity.setCallbackNotified(true); } } } }
Source:
public static ProtocolType valueOf(int ordinal) { return ProtocolType.values()[ordinal]; }

Target:
public static ProtocolType valueOf(int ordinal) { return PROTOCOL_TYPES[ordinal]; }
Source:
public void setDensity(int density) { if(density < 150 || density > 1200) { throw new IllegalArgumentException("Invalid density value"); } this.density = density; }

Target:
public void setDensity(int density) { if(density < 150 || density > 1200) { throw new IllegalArgumentException("Invalid density value. Valid range of values is 150-1200."); } this.density = density; }
Source:
private static <T> Predicate<T> isEmpty(String field, RequestScope requestScope) { return (T entity) -> { Object val = getFieldValue(entity, field, requestScope); if (val == null) { return true; } if (val instanceof String) { return ((String) val).isEmpty(); } if (val instanceof Collection<?>) { return ((Collection<?>) val).isEmpty(); } if (val instanceof Map<?, ?>) { return ((Map<?, ?>) val).isEmpty(); } return false; }; }

Target:
private static <T> Predicate<T> isEmpty(String field, RequestScope requestScope) { return (T entity) -> { Object val = getFieldValue(entity, field, requestScope); if (val == null) { return false; } if (val instanceof Collection<?>) { return ((Collection<?>) val).isEmpty(); } if (val instanceof Map<?, ?>) { return ((Map<?, ?>) val).isEmpty(); } return false; }; }
Source:
private void send(LanguageServer server, String path, FileChangeType changeType) { RegisteredProject project = projectManager.getClosestOrNull(path); if (project == null) { return; } DidChangeWatchedFilesParams params = new DidChangeWatchedFilesParams( Collections.singletonList(new FileEvent(prefixURI(path), changeType))); server.getWorkspaceService().didChangeWatchedFiles(params); }

Target:
private void send(LanguageServer server, String path, FileChangeType changeType) { DidChangeWatchedFilesParams params = new DidChangeWatchedFilesParams( Collections.singletonList(new FileEvent(prefixURI(path), changeType))); server.getWorkspaceService().didChangeWatchedFiles(params); }
Source:
private void runWithLock(Command command) { String className = this.getClass().getName(); String lockName = className + ".lock"; String markerName = className + ".done"; TimeUnit lastAccessTimeUnit = TimeUnit.SECONDS; int lastAccessThreshold = 1; File dir = ((JGitPathImpl) navigationFS.getPath("/")) .getFileSystem() .getGit() .getRepository() .getDirectory() .getParentFile(); File marker = new File(dir, markerName); FileSystemLock lock = FileSystemLockManager .getInstance() .getFileSystemLock( dir, lockName, lastAccessTimeUnit, lastAccessThreshold); try { lock.lock(); if (!marker.exists()) { marker.createNewFile(); command.execute(); } } catch (java.io.IOException e) { LOGGER.error(e.getMessage(), e); } finally { lock.unlock(); } }

Target:
private void runWithLock(Command command) { String lockName = "data-migration.lock"; String markerName = "data-migration.done"; TimeUnit lastAccessTimeUnit = TimeUnit.SECONDS; int lastAccessThreshold = 1; File dir = ((JGitPathImpl) navigationFS.getPath("/")) .getFileSystem() .getGit() .getRepository() .getDirectory() .getParentFile(); File marker = new File(dir, markerName); FileSystemLock lock = FileSystemLockManager .getInstance() .getFileSystemLock( dir, lockName, lastAccessTimeUnit, lastAccessThreshold); try { lock.lock(); if (!marker.exists()) { marker.createNewFile(); command.execute(); } } catch (java.io.IOException e) { LOGGER.error(e.getMessage(), e); } finally { lock.unlock(); } }
Source:
public void deleteFeedbackSessionsForCourse(String courseId) { frcLogic.deleteFeedbackResponseCommentsForCourse(courseId); frLogic.deleteFeedbackResponsesForCourse(courseId); fqLogic.deleteFeedbackQuestionsForCourse(courseId); List<FeedbackSessionAttributes> fsList = getFeedbackSessionsForCourse(courseId); fsDb.deleteEntities(fsList); }

Target:
public void deleteFeedbackSessionsForCourse(String courseId) { fsDb.deleteFeedbackSessionsForCourse(courseId); }
Source:
public void testSearchByVariable() { Map<String, Object> data = new HashMap<>(); data.put("name", "my first case"); CaseFileInstance caseFile = caseService.newCaseFileInstance(deploymentUnit.getIdentifier(), EMPTY_CASE_P_ID, data); String caseId = caseService.startCase(deploymentUnit.getIdentifier(), EMPTY_CASE_P_ID, caseFile); Map<String, Object> vars = new HashMap<>(); vars.put("name", "my first case"); List<ProcessInstanceWithVarsDesc> process = advanceCaseRuntimeDataService.queryCaseByVariables(emptyMap(), vars, new QueryContext()); assertEquals(process.size(), 1); assertEquals(process.get(0).getVariables().get("name"), "my first case"); assertNotNull(caseId); assertEquals(FIRST_CASE_ID, caseId); if (caseId != null) { caseService.cancelCase(caseId); } }

Target:
public void testSearchByVariable() { Map<String, Object> data = new HashMap<>(); data.put("name", "my first case"); CaseFileInstance caseFile = caseService.newCaseFileInstance(deploymentUnit.getIdentifier(), EMPTY_CASE_P_ID, data); String caseId = caseService.startCase(deploymentUnit.getIdentifier(), EMPTY_CASE_P_ID, caseFile); List<QueryParam> vars = list(equalsTo("name", "my first case")); List<ProcessInstanceWithVarsDesc> process = advanceCaseRuntimeDataService.queryCaseByVariables(emptyList(), vars, new QueryContext()); assertEquals(1, process.size()); assertEquals("my first case", process.get(0).getExtraData().get("name")); assertNotNull(caseId); assertEquals(FIRST_CASE_ID, caseId); caseService.cancelCase(caseId); }
Source:
public int getVersion() { return 2; }

Target:
public int getVersion() { return 3; }
Source:
public Map<SystemStreamPartition, List<IncomingMessageEnvelope>> poll(Set<SystemStreamPartition> systemStreamPartitions, long timeout) throws InterruptedException { long stopTime = clock.currentTimeMillis() + timeout; Map<SystemStreamPartition, List<IncomingMessageEnvelope>> messagesToReturn = new HashMap<SystemStreamPartition, List<IncomingMessageEnvelope>>(); metrics.incPoll(); for (SystemStreamPartition systemStreamPartition : systemStreamPartitions) { BlockingQueue<IncomingMessageEnvelope> queue = bufferedMessages.get(systemStreamPartition); List<IncomingMessageEnvelope> outgoingList = new ArrayList<IncomingMessageEnvelope>(queue.size()); if (queue.size() > 0) { queue.drainTo(outgoingList); } else if (timeout != 0) { IncomingMessageEnvelope envelope = null; long timeRemaining = stopTime - clock.currentTimeMillis(); if (timeout == SystemConsumer.BLOCK_ON_OUTSTANDING_MESSAGES) { while (envelope == null && !isAtHead(systemStreamPartition) && !isConsumerFailed()) { metrics.incBlockingPoll(systemStreamPartition); envelope = queue.poll(1000, TimeUnit.MILLISECONDS); } } else if (timeout > 0 && timeRemaining > 0) { metrics.incBlockingTimeoutPoll(systemStreamPartition); envelope = queue.poll(timeRemaining, TimeUnit.MILLISECONDS); } if (envelope != null) { outgoingList.add(envelope); queue.drainTo(outgoingList); } } if (outgoingList.size() > 0) { messagesToReturn.put(systemStreamPartition, outgoingList); subtractSizeOnQDrain(systemStreamPartition, outgoingList); } } return messagesToReturn; }

Target:
public Map<SystemStreamPartition, List<IncomingMessageEnvelope>> poll(Set<SystemStreamPartition> systemStreamPartitions, long timeout) throws InterruptedException { long stopTime = clock.currentTimeMillis() + timeout; Map<SystemStreamPartition, List<IncomingMessageEnvelope>> messagesToReturn = new HashMap<SystemStreamPartition, List<IncomingMessageEnvelope>>(); metrics.incPoll(); for (SystemStreamPartition systemStreamPartition : systemStreamPartitions) { BlockingQueue<IncomingMessageEnvelope> queue = bufferedMessages.get(systemStreamPartition); List<IncomingMessageEnvelope> outgoingList = new ArrayList<IncomingMessageEnvelope>(queue.size()); if (queue.size() > 0) { queue.drainTo(outgoingList); } else if (timeout != 0) { IncomingMessageEnvelope envelope = null; long timeRemaining = stopTime - clock.currentTimeMillis(); if (timeout == SystemConsumer.BLOCK_ON_OUTSTANDING_MESSAGES) { while (envelope == null && !isAtHead(systemStreamPartition)) { if (this.failureCause != null) { String message = String.format("%s: Consumer has stopped.", this); throw new SamzaException(message, this.failureCause); } metrics.incBlockingPoll(systemStreamPartition); envelope = queue.poll(1000, TimeUnit.MILLISECONDS); } } else if (timeout > 0 && timeRemaining > 0) { metrics.incBlockingTimeoutPoll(systemStreamPartition); envelope = queue.poll(timeRemaining, TimeUnit.MILLISECONDS); } if (envelope != null) { outgoingList.add(envelope); queue.drainTo(outgoingList); } } if (outgoingList.size() > 0) { messagesToReturn.put(systemStreamPartition, outgoingList); subtractSizeOnQDrain(systemStreamPartition, outgoingList); } } return messagesToReturn; }
Source:
public Iterable<User> iterate() { return null; }

Target:
public Iterable<User> iterate() { throw new UnsupportedOperationException(); }
Source:
public List<Role> getGrantedRoles(Permission permission) { List<Role> roles = Collections.emptyList(); Connection conn = null; PreparedStatement ps = null; ResultSet resultSet = null; String query = "SELECT * FROM ROLE_PERMISSIONS WHERE APP_NAME = ? AND PERMISSION_STRING = ?"; try { conn = getConnection(); ps = conn.prepareStatement(query); ps.setString(1, permission.getAppName()); ps.setString(2, permission.getPermissionString()); if (log.isDebugEnabled()) { log.debug("Executing query: " + query); } resultSet = ps.executeQuery(); while (resultSet.next()) { roles.add(new Role(resultSet.getString("ROLE_ID"), "")); } } catch (SQLException e) { throw new PermissionException("Unable to get roles assigned for the permission " + permission + ". [Query=" + query + "]", e); } finally { closeConnection(conn, ps, resultSet); } return roles; }

Target:
public List<Role> getGrantedRoles(Permission permission) { List<Role> roles = new ArrayList<>(); Connection conn = null; PreparedStatement ps = null; ResultSet resultSet = null; String query = "SELECT ROLE_ID FROM ROLE_PERMISSIONS WHERE APP_NAME = ? AND PERMISSION_STRING = ?"; try { conn = getConnection(); ps = conn.prepareStatement(query); ps.setString(1, permission.getAppName()); ps.setString(2, permission.getPermissionString()); if (log.isDebugEnabled()) { log.debug("Executing query: " + query); } resultSet = ps.executeQuery(); while (resultSet.next()) { roles.add(new Role(resultSet.getString("ROLE_ID"), "")); } } catch (SQLException e) { throw new PermissionException("Unable to get roles assigned for the permission " + permission + ". [Query=" + query + "]", e); } finally { closeConnection(conn, ps, resultSet); } return roles; }
Source:
public static Date parseISO8601(String dateString) throws ParseException { Date date = new Date(); SimpleDateFormat sdf = new SimpleDateFormat(ISO8601_FORMAT_STRING, Locale.ENGLISH); sdf.setTimeZone(TimeZone.getTimeZone("UTC")); date.setTime(sdf.parse(dateString).getTime()); return date; }

Target:
public static Date parseISO8601(String dateString) throws ParseException { Date date = new Date(); SimpleDateFormat sdf = new SimpleDateFormat(ISO8601_FORMAT_STRING, Locale.ROOT); sdf.setTimeZone(TimeZone.getTimeZone("UTC")); date.setTime(sdf.parse(dateString).getTime()); return date; }
Source:
public void checkAndCreate() { String uuid = organization.getUuid(); QualityProfileDto writtenDto = factory.checkAndCreate(dbSession, organization, new QProfileName("xoo", "P1")); dbSession.commit(); dbSession.clearCache(); assertThat(writtenDto.getOrganizationUuid()).isEqualTo(uuid); assertThat(writtenDto.getKey()).isNotNull(); assertThat(writtenDto.getName()).isEqualTo("P1"); assertThat(writtenDto.getLanguage()).isEqualTo("xoo"); assertThat(writtenDto.getId()).isNotNull(); QualityProfileDto readDto = db.qualityProfileDao().selectByNameAndLanguage("P1", "xoo", dbSession); assertThat(readDto.getOrganizationUuid()).isEqualTo(uuid); assertThat(readDto.getName()).isEqualTo(writtenDto.getName()); assertThat(readDto.getKey()).startsWith(writtenDto.getKey()); assertThat(readDto.getLanguage()).isEqualTo(writtenDto.getLanguage()); assertThat(readDto.getId()).isEqualTo(writtenDto.getId()); assertThat(readDto.getParentKee()).isNull(); assertThat(db.qualityProfileDao().selectAll(dbSession)).hasSize(1); }

Target:
public void checkAndCreate() { String uuid = organization.getUuid(); QualityProfileDto writtenDto = factory.checkAndCreate(dbSession, organization, new QProfileName("xoo", "P1")); dbSession.commit(); dbSession.clearCache(); assertThat(writtenDto.getOrganizationUuid()).isEqualTo(uuid); assertThat(writtenDto.getKey()).isNotEmpty(); assertThat(writtenDto.getName()).isEqualTo("P1"); assertThat(writtenDto.getLanguage()).isEqualTo("xoo"); assertThat(writtenDto.getId()).isNotNull(); QualityProfileDto readDto = db.qualityProfileDao().selectByNameAndLanguage("P1", "xoo", dbSession); assertEqual(writtenDto, readDto); assertThat(db.qualityProfileDao().selectAll(dbSession, organization)).hasSize(1); }
Source:
public void testInsertTaskWithStartAndDue() { RowSnapshot<TaskLists> taskList = new VirtualRowSnapshot<>(new LocalTaskListsTable(mAuthority)); RowSnapshot<Tasks> task = new VirtualRowSnapshot<>(new TaskListScoped(taskList, new TasksTable(mAuthority))); DateTime start = DateTime.now(); DateTime due = start.addDuration(new Duration(1, 1, 0)); assertThat(new Seq<>( new Put<>(taskList, new EmptyRowData<TaskLists>()), new Put<>(task, new TimeData(start, due)) ), resultsIn(mClient, new Assert<>(task, new TimeData(start, due)), new AssertRelated<>( new InstanceTable(mAuthority), Instances.TASK_ID, task, new InstanceData( start.shiftTimeZone(TimeZone.getDefault()), due.shiftTimeZone(TimeZone.getDefault()), absent(), Instances.INSTANCE_STATUS_NEXT)) )); }

Target:
public void testInsertTaskWithStartAndDue() { RowSnapshot<TaskLists> taskList = new VirtualRowSnapshot<>(new LocalTaskListsTable(mAuthority)); RowSnapshot<Tasks> task = new VirtualRowSnapshot<>(new TaskListScoped(taskList, new TasksTable(mAuthority))); DateTime start = DateTime.now(); DateTime due = start.addDuration(new Duration(1, 1, 0)); assertThat(new Seq<>( new Put<>(taskList, new EmptyRowData<TaskLists>()), new Put<>(task, new TimeData(start, due)) ), resultsIn(mClient, new Assert<>(task, new TimeData(start, due)), new AssertRelated<>( new InstanceTable(mAuthority), Instances.TASK_ID, task, new Composite<Instances>( new InstanceTestData( start.shiftTimeZone(TimeZone.getDefault()), due.shiftTimeZone(TimeZone.getDefault()), absent(), 0), new CharSequenceRowData<>(Tasks.TZ, "UTC")) ))); }
Source:
public static Exception extractExecutionExceptionCause(Exception e) { if (!(e instanceof ExecutionException)) { return e; } Throwable cause = e.getCause(); return cause == null ? e : (cause instanceof Exception ? (Exception) cause : new Exception(cause)); }

Target:
public static Exception extractExecutionExceptionCause(Exception e) { Throwable cause = e.getCause(); if (!(e instanceof ExecutionException) || cause == null) { return e; } return cause instanceof Exception ? (Exception) cause : new Exception(cause); }
Source:
public ToIntFunction<ConnectorSplit> getSplitBucketFunction( ConnectorTransactionHandle transactionHandle, ConnectorSession session, ConnectorPartitioningHandle partitioningHandle) { return value -> ((HiveSplit) value).getBucketNumber() .orElseThrow(() -> new IllegalStateException("Bucket number not set in split")); }

Target:
public ToIntFunction<ConnectorSplit> getSplitBucketFunction( ConnectorTransactionHandle transactionHandle, ConnectorSession session, ConnectorPartitioningHandle partitioningHandle) { return value -> ((HiveSplit) value).getBucketNumber() .orElseThrow(() -> new IllegalArgumentException("Bucket number not set in split")); }
Source:
public void testCleanReindex() throws Exception { PID fileObjPid = makePid(); FileObject fileObj =repoObjFactory.createFileObject(fileObjPid, null); PID parentPid = makePid(); WorkObject work = repoObjFactory.createWorkObject(parentPid, null); work.addMember(fileObj); MvcResult result = mvc.perform(post("/edit/solr/reindex/" + parentPid.getUUID(), false)) .andExpect(status().is2xxSuccessful()) .andReturn(); Map<String, Object> respMap = getMapFromResponse(result); assertEquals(parentPid.getUUID(), respMap.get("pid")); assertEquals("reindex", respMap.get("action")); assertFalse(respMap.containsKey("error")); }

Target:
public void testCleanReindex() throws Exception { PID parentPid = makePid(); MvcResult result = mvc.perform(post("/edit/solr/reindex/" + parentPid.getUUID(), false)) .andExpect(status().is2xxSuccessful()) .andReturn(); Map<String, Object> respMap = getMapFromResponse(result); assertEquals(parentPid.getUUID(), respMap.get("pid")); assertEquals("reindex", respMap.get("action")); assertFalse(respMap.containsKey("error")); }
Source:
public static String dryRun(Config cfg) { return cfg.getStringValue(ConfigKeys.get("DRY_RUN")); }

Target:
public static Boolean dryRun(Config cfg) { return cfg.getBooleanValue(ConfigKeys.get("DRY_RUN"), false); }
Source:
public Response totpKeyGenExternal(@Context HttpServletRequest request) { TOTPManager totpManager = (TOTPManager) PrivilegedCarbonContext.getThreadLocalCarbonContext().getOSGiService (TOTPManager.class); if (totpManager != null) { String username = request.getParameter("username"); TOTPDTO totpdto = null; try { totpdto = totpManager.generateTOTPKey(username); String json = createJsonPayload(totpdto.getSecretkey(), totpdto.getQRCodeURL()); return Response.ok(json, MediaType.APPLICATION_JSON_TYPE).build(); } catch (TOTPException e) { log.error("TOTPKeyGenerator endpoint could not generate the key for the user : "+username,e); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity("Error when generating the key") .type(MediaType.APPLICATION_JSON_TYPE).build(); } } else { log.error("TOTPKeyGenerator endpoint could not generate the key"); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity("Error when generating the key") .type(MediaType.APPLICATION_JSON_TYPE).build(); } }

Target:
public Response totpKeyGenExternal(@Context HttpServletRequest request) { TOTPManager totpManager = (TOTPManager) PrivilegedCarbonContext.getThreadLocalCarbonContext().getOSGiService (TOTPManager.class); if (totpManager != null) { String username = CharacterEncoder.getSafeText(request.getParameter("username")); TOTPDTO totpdto = null; try { totpdto = totpManager.generateTOTPKey(username); String json = createJsonPayload(totpdto.getSecretkey(), totpdto.getQRCodeURL()); return Response.ok(json, MediaType.APPLICATION_JSON_TYPE).build(); } catch (TOTPException e) { log.error("TOTPKeyGenerator endpoint could not generate the key for the user : " + username,e); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity("Error when generating the key") .type(MediaType.APPLICATION_JSON_TYPE).build(); } } else { log.error("TOTPKeyGenerator endpoint could not generate the key"); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity("Error when generating the key") .type(MediaType.APPLICATION_JSON_TYPE).build(); } }
Source:
public SystemConsumer getConsumer(String systemName, Config config, MetricsRegistry registry) { EventHubConfig eventHubConfig = new EventHubConfig(config, systemName); return new EventHubSystemConsumer(eventHubConfig, new EventHubClientWrapperFactory(), getSerdesMap(eventHubConfig), registry); }

Target:
public SystemConsumer getConsumer(String systemName, Config config, MetricsRegistry registry) { EventHubConfig eventHubConfig = new EventHubConfig(config); return new EventHubSystemConsumer(eventHubConfig, systemName, new EventHubClientManagerFactory(), getInterceptorsMap(eventHubConfig, systemName), registry); }
Source:
private boolean isMetadataExpired() { return !(cacheDuration == null || Instant.now().isAfter(created.plus(cacheDuration))); }

Target:
private boolean isMetadataExpired() { if (getCacheDuration() == null) { return false; } if (getCacheDuration().isZero()) { return true; } return Instant.now().isAfter(created.plus(getCacheDuration())); }
Source:
public void onUpdateProgress(int currentProgress, int duration, int bufferPercent) { updateProgress(currentProgress, duration, bufferPercent); if (!shouldUpdateOnProgress) return; resetNotification(); if(Build.VERSION.SDK_INT >= 26 ) updateNotificationThumbnail(); if (bigNotRemoteView != null) { if(cachedDuration != duration) { cachedDuration = duration; cachedDurationString = getTimeString(duration); } bigNotRemoteView.setProgressBar(R.id.notificationProgressBar, duration, currentProgress, false); bigNotRemoteView.setTextViewText(R.id.notificationTime, getTimeString(currentProgress) + " / " + cachedDurationString); } if (notRemoteView != null) { notRemoteView.setProgressBar(R.id.notificationProgressBar, duration, currentProgress, false); } updateNotification(-1); }

Target:
public void onUpdateProgress(int currentProgress, int duration, int bufferPercent) { updateProgress(currentProgress, duration, bufferPercent); if (!shouldUpdateOnProgress) return; resetNotification(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O ) updateNotificationThumbnail(); if (bigNotRemoteView != null) { if(cachedDuration != duration) { cachedDuration = duration; cachedDurationString = getTimeString(duration); } bigNotRemoteView.setProgressBar(R.id.notificationProgressBar, duration, currentProgress, false); bigNotRemoteView.setTextViewText(R.id.notificationTime, getTimeString(currentProgress) + " / " + cachedDurationString); } if (notRemoteView != null) { notRemoteView.setProgressBar(R.id.notificationProgressBar, duration, currentProgress, false); } updateNotification(-1); }
Source:
void testTryWithResourcesConnectsThenReceivesEvent() throws InterruptedException { server.expect() .withPath("/api/v1/namespaces/test/pods?fieldSelector=metadata.name%3Dpod1&resourceVersion=1&watch=true") .andUpgradeToWebSocket().open() .waitFor(EVENT_WAIT_PERIOD_MS).andEmit(new WatchEvent(pod1, "DELETED")) .waitFor(EVENT_WAIT_PERIOD_MS).andEmit(outdatedEvent()).done().once(); final CountDownLatch deleteLatch = new CountDownLatch(1); final CountDownLatch closeLatch = new CountDownLatch(1); final Watcher<Pod> watcher = new Watcher<Pod>() { @Override public void eventReceived(Action action, Pod resource) { if (action != DELETED) { fail(); } deleteLatch.countDown(); } @Override public void onClose(WatcherException cause) { assertEquals(410, cause.asClientException().getCode()); closeLatch.countDown(); } }; try (Watch watch = client.pods().withName("pod1").withResourceVersion("1").watch(watcher)) { assertNotNull(watch); assertTrue(deleteLatch.await(10, TimeUnit.SECONDS)); assertTrue(closeLatch.await(10, TimeUnit.SECONDS)); } }

Target:
void testTryWithResourcesConnectsThenReceivesEvent() throws InterruptedException { server.expect() .withPath("/api/v1/namespaces/test/pods?fieldSelector=metadata.name%3Dpod1&resourceVersion=1&watch=true") .andUpgradeToWebSocket().open() .waitFor(EVENT_WAIT_PERIOD_MS).andEmit(new WatchEvent(pod1, "DELETED")) .waitFor(EVENT_WAIT_PERIOD_MS).andEmit(outdatedEvent()).done().once(); final CountDownLatch deleteLatch = new CountDownLatch(1); final CountDownLatch closeLatch = new CountDownLatch(1); final Watcher<Pod> watcher = new Watcher<Pod>() { @Override public void eventReceived(Action action, Pod resource) { if (action != DELETED) { fail(); } deleteLatch.countDown(); } @Override public void onClose(WatcherException cause) { assertTrue(cause.isHttpGone()); closeLatch.countDown(); } }; try (Watch watch = client.pods().withName("pod1").withResourceVersion("1").watch(watcher)) { assertNotNull(watch); assertTrue(deleteLatch.await(10, TimeUnit.SECONDS)); assertTrue(closeLatch.await(10, TimeUnit.SECONDS)); } }
Source:
public Location findPortal(Location destination) { Location minLoc = null; double minDistance = Double.MAX_VALUE; final int blockX = destination.getBlockX(); final int blockZ = destination.getBlockZ(); for (int x = blockX - searchRadius; x < (blockX + searchRadius); x++) { for (int z = blockZ - searchRadius; z < (blockZ + searchRadius); z++) { for (int y = 127; y >= 0; y--) { final Block toCompare = world.getBlockAt(x, y, z); if (toCompare.getType() == Material.PORTAL && toCompare.getRelative(BlockFace.DOWN).getType() != Material.PORTAL ) { final Location location = toCompare.getLocation(); double distance = RayUtil.getRayBetween(location, destination).length(); if (distance < minDistance) { minDistance = distance; minLoc = location; } } } } } return minLoc; }

Target:
public Location findPortal(Location destination) { Location minLoc = null; double minDistance = Double.MAX_VALUE; final int maxY = world.getEnvironment() == World.Environment.NETHER ? 127 : 255; final int blockX = destination.getBlockX(); final int blockZ = destination.getBlockZ(); for (int x = blockX - searchRadius; x < (blockX + searchRadius); x++) { for (int z = blockZ - searchRadius; z < (blockZ + searchRadius); z++) { for (int y = maxY; y >= 0; y--) { final Block toCompare = world.getBlockAt(x, y, z); if (toCompare.getType() == Material.PORTAL && toCompare.getRelative(BlockFace.DOWN).getType() != Material.PORTAL ) { final Location location = toCompare.getLocation(); double distance = RayUtil.getRayBetween(location, destination).length(); if (distance < minDistance) { minDistance = distance; minLoc = location; } } } } } return minLoc; }
Source:
void errorOutWriteLacKey(final CompletionKey key, final int rc) { LOG.info("Removing completion key: {}", key); final WriteLacCompletion writeLacCompletion = (WriteLacCompletion)completionObjects.remove(key); if (null == writeLacCompletion) { return; } executor.submitOrdered(writeLacCompletion.ledgerId, new SafeRunnable() { @Override public void safeRun() { String bAddress = "null"; Channel c = channel; if (c != null) { bAddress = c.getRemoteAddress().toString(); } LOG.debug("Could not write request writeLac for ledgerId: bookie: {}", new Object[] { writeLacCompletion.ledgerId, bAddress}); writeLacCompletion.cb.writeLacComplete(rc, writeLacCompletion.ledgerId, addr, writeLacCompletion.ctx); } }); }

Target:
void errorOutWriteLacKey(final CompletionKey key, final int rc) { LOG.debug("Removing completion key: {}", key); final WriteLacCompletion writeLacCompletion = (WriteLacCompletion)completionObjects.remove(key); if (null == writeLacCompletion) { return; } executor.submitOrdered(writeLacCompletion.ledgerId, new SafeRunnable() { @Override public void safeRun() { String bAddress = "null"; Channel c = channel; if (c != null) { bAddress = c.getRemoteAddress().toString(); } LOG.debug("Could not write request writeLac for ledgerId: bookie: {}", new Object[] { writeLacCompletion.ledgerId, bAddress}); writeLacCompletion.cb.writeLacComplete(rc, writeLacCompletion.ledgerId, addr, writeLacCompletion.ctx); } }); }
Source:
public ErrorsAndDMNModelAsSerialized(List<Message> messages, Definitions definitions) { super(); this.messages = Collections.unmodifiableList(messages); this.definitions = definitions; }

Target:
public ErrorsAndDMNModelAsSerialized(List<Message> messages, Definitions definitions) { this.messages = Collections.unmodifiableList(messages); this.definitions = definitions; }
Source:
protected void refreshVisuals() { Connector connector = (Connector) getNotationView(); NamedStyle namedStyle = connector.getNamedStyle(NotationPackage.Literals.INT_VALUE_STYLE, "delta"); if (namedStyle instanceof IntValueStyle) { refreshArrowDelta((IntValueStyle) namedStyle); } else { ((DurationLinkFigure) getFigure()).setArrowPositionDelta(0); } super.refreshVisuals(); }

Target:
protected void refreshVisuals() { refreshArrowDelta(); super.refreshVisuals(); }
Source:
protected BlobServiceClient buildBlobServiceClient(HttpClient httpClient, Configuration configuration, RequestRetryOptions retryOptions, AzureCloudConfig azureCloudConfig) throws MalformedURLException, InterruptedException, ExecutionException { IAuthenticationResult iAuthenticationResult = getAccessTokenByClientCredentialGrant(azureCloudConfig); return new BlobServiceClientBuilder().credential(new TokenCredential() { @Override public Mono<AccessToken> getToken(TokenRequestContext request) { return Mono.just(new AccessToken(iAuthenticationResult.accessToken(), iAuthenticationResult.expiresOnDate().toInstant().atOffset(OffsetDateTime.now().getOffset()))); } }) .endpoint(azureCloudConfig.azureStorageEndpoint) .httpClient(httpClient) .retryOptions(retryOptions) .configuration(configuration) .buildClient(); }

Target:
protected BlobServiceClient buildBlobServiceClient(HttpClient httpClient, Configuration configuration, RequestRetryOptions retryOptions, AzureCloudConfig azureCloudConfig) throws MalformedURLException, InterruptedException, ExecutionException { IAuthenticationResult iAuthenticationResult = getAccessTokenByClientCredentialGrant(azureCloudConfig); TokenCredential tokenCredential = new TokenCredential() { @Override public Mono<AccessToken> getToken(TokenRequestContext request) { return Mono.just(new AccessToken(iAuthenticationResult.accessToken(), iAuthenticationResult.expiresOnDate().toInstant().atOffset(OffsetDateTime.now().getOffset()))); } }; return new BlobServiceClientBuilder().credential(tokenCredential) .endpoint(azureCloudConfig.azureStorageEndpoint) .httpClient(httpClient) .retryOptions(retryOptions) .configuration(configuration) .buildClient(); }
Source:
public static void postAnswer(Topic topic, Post post) throws PermissionsDeniedException, CouldNotOpenPageException, ValidationException { openRequiredTopic(topic); postPage.getMessageField().clear(); postPage.getMessageField().sendKeys(post.getPostContent()); postPage.clickAnswerToTopicButton(); assertTopicPostFormValid(); topic.addPost(post); info("Answer to topic [" + topic.getTitle() + "] was left"); }

Target:
public static void postAnswer(Topic topic, Post post) throws PermissionsDeniedException, CouldNotOpenPageException, ValidationException { openRequiredTopic(topic); postPage.fillPostBody(post.getPostContent()); postPage.clickAnswerToTopicButton(); assertTopicPostFormValid(); topic.addPost(post); info("Answer to topic [" + topic.getTitle() + "] was left"); }
Source:
protected void applyValidation() { Display.getDefault().asyncExec(new Runnable() { @Override public void run() { if (getControls().size() == 0 || getControls().values().iterator().next().isDisposed()) { return; } Label validationIcon = null; switch (getControls().size()) { case 3: validationIcon = Label.class.cast(getControls().get( new SWTGridCell(0, 1, CustomControlSWTRenderer.this))); break; default: break; } final VDiagnostic diag = getVElement().getDiagnostic(); if (validationIcon != null && !validationIcon.isDisposed() && diag != null) { validationIcon.setImage(getValidationIcon(diag.getHighestSeverity())); validationIcon.setToolTipText(diag.getMessage()); } if (swtCustomControl != null) { swtCustomControl.applyValidation(); } } }); }

Target:
protected void applyValidation() { Display.getDefault().asyncExec(new Runnable() { @Override public void run() { if (getControls().size() == 0 || getControls().values().iterator().next().isDisposed()) { return; } Label validationIcon = null; switch (getControls().size()) { case 3: validationIcon = Label.class.cast(getControls().get( new SWTGridCell(0, 1, CustomControlSWTRenderer.this))); break; default: break; } final VDiagnostic diag = getVElement().getDiagnostic(); if (diag != null && validationIcon != null && !validationIcon.isDisposed()) { validationIcon.setImage(getValidationIcon(diag.getHighestSeverity())); validationIcon.setToolTipText(diag.getMessage()); } if (swtCustomControl != null) { swtCustomControl.applyValidation(); } } }); }
Source:
public Collection<Class<?>> getProvidedServiceTypes() { return Collections.singletonList(DetailedServerStateImpl.class); }

Target:
public Collection<Class<?>> getProvidedServiceTypes() { return Collections.singletonList(DetailedServerState.class); }
Source:
public synchronized ListenableFuture identify(LDUser user) { if (user == null || user.getKey() == null) { Log.w(TAG, "identify called with null user or null user key!"); } ListenableFuture doneFuture = userManager.setCurrentUser(user); sendEvent(new IdentifyEvent(user)); return doneFuture; }

Target:
public synchronized ListenableFuture<Void> identify(LDUser user) { if (user == null) { return Futures.immediateFailedFuture(new LaunchDarklyException("User cannot be null")); } if (user.getKey() == null) { Log.w(TAG, "identify called with null user or null user key!"); } ListenableFuture<Void> doneFuture = userManager.setCurrentUser(user); sendEvent(new IdentifyEvent(user)); return doneFuture; }
Source:
private Boolean testBeaconHelper(String chromosome, int start, String allele, List<String> datasetIds) { String url = String.format("/v1/ga4gh/beacon?referenceName=%s&start=%d&allele=%s&datasetIds=%s", chromosome, start, allele, String.join(",", datasetIds)); ResponseEntity<GA4GHBeaconResponse> response = restTemplate.getForEntity( url, GA4GHBeaconResponse.class); assertEquals(HttpStatus.OK, response.getStatusCode()); GA4GHBeaconResponse ga4GHBeaconResponse = response.getBody(); return ga4GHBeaconResponse.isExists(); }

Target:
private boolean testBeaconHelper(String chromosome, int start, String allele, List<String> datasetIds) { String url = String.format("/v1/ga4gh/beacon?referenceName=%s&start=%d&allele=%s&datasetIds=%s", chromosome, start, allele, String.join(",", datasetIds)); ResponseEntity<GA4GHBeaconResponse> response = restTemplate.getForEntity( url, GA4GHBeaconResponse.class); assertEquals(HttpStatus.OK, response.getStatusCode()); GA4GHBeaconResponse ga4ghBeaconResponse = response.getBody(); return ga4ghBeaconResponse.isExists(); }
Source:
public EntityReference resolveRelativeEntityReference(String name, EntityType type) { EntityReference ref = relativeRefResolver.resolve(name, type); LOGGER.debug("resolveRelativeEntityReference: for [" + name + "] got reference [" + ref + "]"); return ref; }

Target:
public EntityReference resolveRelativeEntityReference(String name, EntityType type) { EntityReference ref = relativeRefResolver.resolve(name, type); LOGGER.debug("resolveRelativeEntityReference: for '{}' got ref '{}'", name, ref); return ref; }
Source:
public String getName() { Preconditions.checkState( (name == null && userRole.equals(UserRole.HOST)) || (name != null && !userRole.equals(UserRole.HOST)), "All user roles will have a name except the 'HOST' role (lobby watcher)"); return name; }

Target:
public String getName() { Preconditions.checkState( (name == null) == userRole.equals(UserRole.HOST), "All user roles will have a name except the 'HOST' role (lobby watcher)"); return name; }
Source:
protected void buildProject(IProject proj) throws CoreException { IWorkspace wsp = ResourcesPlugin.getWorkspace(); final IProject curProject = proj; ISchedulingRule rule = wsp.getRuleFactory().buildRule(); Job buildJob = new Job("project build job") { @Override protected IStatus run(IProgressMonitor monitor) { try { curProject.build(IncrementalProjectBuilder.FULL_BUILD, null); } catch (CoreException e) { fail(e.getStatus().getMessage()); } catch (OperationCanceledException e) { fail(NLS.bind(Messages.getString("AbstractTest.Build_cancelled"), curProject.getName(), e.getMessage())); } catch(Exception e) { e.printStackTrace(); fail(e.getLocalizedMessage()); } return Status.OK_STATUS; } }; try { buildJob.setRule(rule); buildJob.schedule(); buildJob.join(); IStatus status = buildJob.getResult(); if (status.getCode() != IStatus.OK) { fail(NLS.bind(Messages.getString("AbstractTest.Build_failed"), curProject.getName(), status.getMessage())); } } catch (InterruptedException e) { fail(NLS.bind(Messages.getString("AbstractTest.Build_interrupted"), curProject.getName(), e.getMessage())); } catch(Exception e) { fail(e.getLocalizedMessage()); } IWorkspaceRunnable runnable = new IWorkspaceRunnable() { public void run(IProgressMonitor monitor) throws CoreException { curProject.refreshLocal(IResource.DEPTH_INFINITE, null); } }; wsp.run(runnable, wsp.getRoot(), IWorkspace.AVOID_UPDATE, null); }

Target:
protected void buildProject(IProject proj) throws CoreException { IWorkspace wsp = ResourcesPlugin.getWorkspace(); final IProject curProject = proj; ISchedulingRule rule = wsp.getRuleFactory().buildRule(); Job buildJob = new Job("project build job") { @Override protected IStatus run(IProgressMonitor monitor) { try { curProject.build( IncrementalProjectBuilder.FULL_BUILD, null); } catch (CoreException e) { fail(e.getStatus().getMessage()); } catch (OperationCanceledException e) { fail(NLS.bind(Messages.getString("AbstractTest.Build_cancelled"), curProject.getName(), e.getMessage())); } return Status.OK_STATUS; } }; buildJob.setRule(rule); buildJob.schedule(); try { buildJob.join(); } catch (InterruptedException e) { fail(NLS.bind(Messages.getString("AbstractTest.Build_interrupted"), curProject.getName(), e.getMessage())); } IStatus status = buildJob.getResult(); if (status.getCode() != IStatus.OK) { fail(NLS.bind(Messages.getString("AbstractTest.Build_failed"), curProject.getName(), status.getMessage())); } IWorkspaceRunnable runnable = new IWorkspaceRunnable() { public void run(IProgressMonitor monitor) throws CoreException { curProject.refreshLocal(IResource.DEPTH_INFINITE, null); } }; wsp.run(runnable, wsp.getRoot(), IWorkspace.AVOID_UPDATE, null); }
Source:
private void doSearch() { final String query = searchBox.getText().trim(); if (query.length() == 0 || Gerrit.C.searchHint().equals(query)) { return; } searchBox.setFocus(false); if (query.matches("^[1-9][0-9]*$")) { final Change.Id ck = Change.Id.parse(query); Gerrit.display(Link.toChange(ck), new ChangeScreen(ck)); } else if (query.contains("owner:")) { Gerrit.display(Link.toOwnerQuery(query), true ); } else if (query.contains("reviewer:")) { Gerrit.display(Link.toReviewerQuery(query), true ); } else { Gerrit.display(Link.toChangeQuery(query), true); } }

Target:
private void doSearch() { final String query = searchBox.getText().trim(); if (query.length() == 0 || Gerrit.C.searchHint().equals(query)) { return; } searchBox.setFocus(false); if (query.matches("^[1-9][0-9]*$")) { final Change.Id ck = Change.Id.parse(query); Gerrit.display(Link.toChange(ck), new ChangeScreen(ck)); } else { Gerrit.display(Link.toChangeQuery(query), true); } }
Source:
public void getCashPointsByLocation_shouldNotReturnRetiredCashpointsUnlessSpecified() throws Exception { CashPoint cashPoint = service.getById(2); cashPoint.setRetired(true); cashPoint.setRetireReason("reason"); service.save(cashPoint); Location location = Context.getLocationService().getLocation(2); Context.flushSession(); List<CashPoint> cashPoints = service.getCashPointsByLocation(location,false); Assert.assertNotNull(cashPoints); Assert.assertEquals(0,cashPoints.size()); for (CashPoint cashpoint : cashPoints) { if(cashpoint.getId().equals(cashPoint.getId())) { Assert.fail("The retired item was incorrectly returned."); } } cashPoints = service.getCashPointsByLocation(location,false); Assert.assertNotNull(cashPoints); Assert.assertEquals(0,cashPoints.size()); }

Target:
public void getCashPointsByLocation_shouldNotReturnRetiredCashpointsUnlessSpecified() throws Exception { CashPoint cashPoint = service.getById(0); cashPoint.setRetired(true); cashPoint.setRetireReason("reason"); service.save(cashPoint); Location location = Context.getLocationService().getLocation(0); Context.flushSession(); List<CashPoint> cashPoints = service.getCashPointsByLocation(location,false); Assert.assertNotNull(cashPoints); Assert.assertEquals(2,cashPoints.size()); Assert.assertEquals(4,(int)Iterators.get(cashPoints.iterator(),0).getId()); Assert.assertEquals(5,(int)Iterators.get(cashPoints.iterator(),1).getId()); List<CashPoint> cashPoints1 = service.getCashPointsByLocation(location,true); Assert.assertNotNull(cashPoints1); Assert.assertEquals(3,cashPoints1.size()); Assert.assertEquals(0,(int)Iterators.get(cashPoints1.iterator(),0).getId()); }
Source:
private int ilog(int a) { if (a <= 0) { return 0; } int n = 0; while (a > 0) { a >>= 1; n++; } return n; }

Target:
private int ilog(int a) { if (a <= 0) { return 0; } return 32 - Integer.numberOfLeadingZeros(a); }