auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private static Object doClean(Object dirty, Map<Object, Object> processed) { if (dirty == null) { return null; } if (processed == null) { processed = new HashMap<>(); } if (processed.get(dirty) != null) { return processed.get(dirty); } if (isPrimitive(dirty)) { return dirty; } if (!processCollections(dirty, processed)) { for (String getterName : ReflectionUtils.getGetterNames(dirty)) { Object object = ReflectionUtils.get(dirty, getterName); if (object instanceof AbstractPersistentCollection) { ReflectionUtils.setIfPossible(dirty, getterName, doHibernateClean(object, processed)); } else { processed.put(dirty, dirty); doClean(object, processed); } } } return dirty; }

Target:
private static Object doClean(Object dirty, Map<Object, Object> processed) { if (dirty == null) { return null; } if (processed == null) { processed = new HashMap<>(); } if (isPrimitive(dirty)) { return dirty; } if (processed.get(dirty) != null) { return processed.get(dirty); } if (!processCollections(dirty, processed)) { for (Method getter : ReflectionUtils.getGetters(dirty.getClass())) { Object object = ReflectionUtils.get(dirty, getter); if (!dirty.equals(object)) { if (object instanceof AbstractPersistentCollection) { ReflectionUtils.setIfPossible(dirty, getter, doHibernateClean(object, processed)); } else { processed.put(object, doClean(object, processed)); } } } } return dirty; }
Source:
public void setTypeFontTitle(TrueTypeFont typeFontTitle) { this.typeFontTitle = typeFontTitle; }

Target:
protected void setTypeFontTitle(TrueTypeFont typeFontTitle) { this.typeFontTitle = typeFontTitle; }
Source:
public ServicePlacement withMaxReplicas(int maxReplicas) throws DockerClientException { if (maxReplicas >= 0) { this.maxReplicas = maxReplicas; } else { throw new DockerClientException("The Value for MaxReplicas must be greater or equal to 0"); } return this; }

Target:
public ServicePlacement withMaxReplicas(int maxReplicas) { if (maxReplicas < 0) { throw new IllegalArgumentException("The Value for MaxReplicas must be greater or equal to 0"); } this.maxReplicas = maxReplicas; return this; }
Source:
public Object removeProperty(final String key) { messageChanged(); Object oldValue = checkProperties().removeProperty(SimpleString.toSimpleString(key, getPropertyKeysPool())); if (oldValue != null) { messageChanged(); } return oldValue; }

Target:
public Object removeProperty(final String key) { return removeProperty(key(key)); }
Source:
public void test() { connect(); waitResponse(); JQuery listbox = jq(".z-listbox"); JQuery jqBar = jq(".z-listhead-bar"); assertEquals(listbox.eq(0).find(".z-listcell-content").eq(0).outerWidth() + jqBar.eq(0).outerWidth(), listbox.eq(0).width()); jq("$box1").scrollTop(100); waitResponse(); assertEquals(listbox.eq(0).find(".z-listcell-content").eq(0).outerWidth() + jqBar.eq(0).outerWidth(), listbox.eq(0).width()); assertEquals(listbox.eq(1).find(".z-listcell-content").eq(0).outerWidth(), listbox.eq(1).width()); }

Target:
public void test() { connect(); waitResponse(); JQuery listbox1 = jq("$box"); JQuery listbox2 = jq("$box2"); JQuery jqBar = jq(".z-listhead-bar"); assertEquals(listbox1.find(".z-listcell-content:eq(0)").outerWidth() + jqBar.eq(0).outerWidth(), listbox1.width()); listbox1.scrollTop(100); waitResponse(); assertEquals(listbox1.find(".z-listcell-content:eq(0)").outerWidth() + jqBar.eq(0).outerWidth(), listbox1.width()); assertEquals(listbox2.find(".z-listcell-content:eq(0)").outerWidth(), listbox2.width()); }
Source:
public void addInterceptor(int index, ChannelInterceptor interceptor) { super.addInterceptor(index, interceptor); if (interceptor instanceof ExecutorChannelInterceptor) { if (index < this.executorInterceptors.size()) { this.executorInterceptors.add(index, (ExecutorChannelInterceptor) interceptor); } else { this.executorInterceptors.add((ExecutorChannelInterceptor) interceptor); } this.executorInterceptorsSize++; } }

Target:
public void addInterceptor(int index, ChannelInterceptor interceptor) { super.addInterceptor(index, interceptor); if (interceptor instanceof ExecutorChannelInterceptor) { this.executorInterceptorsSize++; } }
Source:
public synchronized void addExchangeLocations(PlanFragmentId fragmentId, Set<RemoteTask> sourceTasks, boolean noMoreExchangeLocations) { requireNonNull(fragmentId, "fragmentId is null"); requireNonNull(sourceTasks, "sourceTasks is null"); RemoteSourceNode remoteSource = exchangeSources.get(fragmentId); checkArgument(remoteSource != null, "Unknown remote source %s. Known sources are %s", fragmentId, exchangeSources.keySet()); this.sourceTasks.putAll(remoteSource.getId(), sourceTasks); ImmutableSet.Builder<URI> locationsToDestroy = ImmutableSet.builder(); for (RemoteTask task : getAllTasks()) { if (task.getTaskStatus().getState().isDone()) { sourceTasks.stream() .map(sourceTask -> exchangeSourceLocation(task.getTaskId(), sourceTask.getTaskStatus().getSelf())).forEach(locationsToDestroy::add); } else { ImmutableMultimap.Builder<PlanNodeId, Split> newSplits = ImmutableMultimap.builder(); for (RemoteTask sourceTask : sourceTasks) { URI exchangeLocation = sourceTask.getTaskStatus().getSelf(); newSplits.put(remoteSource.getId(), createRemoteSplitFor(task.getTaskId(), exchangeLocation)); } task.addSplits(newSplits.build()); } } if (noMoreExchangeLocations) { completeSourceFragments.add(fragmentId); if (completeSourceFragments.containsAll(remoteSource.getSourceFragmentIds())) { completeSources.add(remoteSource.getId()); for (RemoteTask task : getAllTasks()) { task.noMoreSplits(remoteSource.getId()); } } } remoteTaskFactory.destroyExchangeSources(locationsToDestroy.build()); }

Target:
public synchronized void addExchangeLocations(PlanFragmentId fragmentId, Set<RemoteTask> sourceTasks, boolean noMoreExchangeLocations) { requireNonNull(fragmentId, "fragmentId is null"); requireNonNull(sourceTasks, "sourceTasks is null"); RemoteSourceNode remoteSource = exchangeSources.get(fragmentId); checkArgument(remoteSource != null, "Unknown remote source %s. Known sources are %s", fragmentId, exchangeSources.keySet()); this.sourceTasks.putAll(remoteSource.getId(), sourceTasks); ImmutableList.Builder<ExchangeBufferLocation> buffersToDestroy = ImmutableList.builder(); for (RemoteTask task : getAllTasks()) { if (task.getTaskStatus().getState().isDone()) { for (RemoteTask sourceTask : sourceTasks) { URI location = exchangeSourceLocation(task.getTaskId(), sourceTask.getTaskStatus().getSelf()); buffersToDestroy.add(new ExchangeBufferLocation(sourceTask.getTaskId(), location)); } } else { ImmutableMultimap.Builder<PlanNodeId, Split> newSplits = ImmutableMultimap.builder(); for (RemoteTask sourceTask : sourceTasks) { URI exchangeLocation = sourceTask.getTaskStatus().getSelf(); newSplits.put(remoteSource.getId(), createRemoteSplitFor(task.getTaskId(), exchangeLocation)); } task.addSplits(newSplits.build()); } } if (noMoreExchangeLocations) { completeSourceFragments.add(fragmentId); if (completeSourceFragments.containsAll(remoteSource.getSourceFragmentIds())) { completeSources.add(remoteSource.getId()); for (RemoteTask task : getAllTasks()) { task.noMoreSplits(remoteSource.getId()); } } } remoteTaskFactory.destroyExchangeSources(buffersToDestroy.build(), stateMachine::transitionToFailed); }
Source:
public boolean isQuestionFullyAnsweredByTeam(FeedbackQuestionAttributes question, String teamName) throws EntityDoesNotExistException { List<StudentAttributes> studentsInTeam = studentsLogic.getStudentsForTeam(question.courseId, teamName); int numberOfResponsesNeeded = question.numberOfEntitiesToGiveFeedbackTo; if (numberOfResponsesNeeded == Const.MAX_POSSIBLE_RECIPIENTS) { numberOfResponsesNeeded = getRecipientsForQuestion(question, teamName).size(); } for (StudentAttributes student : studentsInTeam) { List<FeedbackResponseAttributes> responses = frLogic.getFeedbackResponsesFromGiverForQuestion(question.getId(), student.email); for (FeedbackResponseAttributes response : responses) { if (response.giver.equals(student.email)) { numberOfResponsesNeeded -= 1; } } } return numberOfResponsesNeeded <= 0; }

Target:
public boolean isQuestionFullyAnsweredByTeam(FeedbackQuestionAttributes question, String teamName) throws EntityDoesNotExistException { List<StudentAttributes> studentsInTeam = studentsLogic.getStudentsForTeam(question.courseId, teamName); int numberOfPendingResponses = question.numberOfEntitiesToGiveFeedbackTo; if (numberOfPendingResponses == Const.MAX_POSSIBLE_RECIPIENTS) { numberOfPendingResponses = getRecipientsForQuestion(question, teamName).size(); } for (StudentAttributes student : studentsInTeam) { List<FeedbackResponseAttributes> responses = frLogic.getFeedbackResponsesFromGiverForQuestion(question.getId(), student.email); for (FeedbackResponseAttributes response : responses) { if (response.giver.equals(student.email)) { numberOfPendingResponses -= 1; } } } return numberOfPendingResponses <= 0; }
Source:
public ListenableFuture<?> process() { checkState(initialized.get(), "Driver is not initialized"); checkLockNotHeld("Can not process while holding the driver lock"); SettableFuture<?> future = driverBlockedFuture.get(); if (!future.isDone()) { return future; } Optional<ListenableFuture<?>> result = tryWithLock(100, TimeUnit.MILLISECONDS, () -> { ListenableFuture<?> sourceBlockedFuture = processInternal(); updateDriverBlockedFuture(sourceBlockedFuture); return driverBlockedFuture.get(); }); return result.orElse(NOT_BLOCKED); }

Target:
public ListenableFuture<?> process() { checkState(initialized.get(), "Driver is not initialized"); checkLockNotHeld("Can not process while holding the driver lock"); SettableFuture<?> blockedFuture = driverBlockedFuture.get(); if (!blockedFuture.isDone()) { return blockedFuture; } Optional<ListenableFuture<?>> result = tryWithLock(100, TimeUnit.MILLISECONDS, () -> { ListenableFuture<?> future = processInternal(); return updateDriverBlockedFuture(future); }); return result.orElse(NOT_BLOCKED); }
Source:
public OperationFuture<LoadBalancer> update(LoadBalancer loadBalancer, LoadBalancerConfig config) { loadBalancerClient.update( fetchDataCenterId(loadBalancer.getDataCenter()), findByRef(loadBalancer).getId(), new LoadBalancerRequest() .name(config.getName()) .description(config.getDescription()) .status(config.getStatus()) ); return new OperationFuture<>( loadBalancer, new NoWaitingJobFuture() ); }

Target:
public OperationFuture<LoadBalancer> update(LoadBalancer loadBalancer, LoadBalancerConfig config) { LoadBalancerMetadata loadBalancerMetadata = findByRef(loadBalancer); loadBalancerClient.update( loadBalancerMetadata.getDataCenterId(), loadBalancerMetadata.getId(), new LoadBalancerRequest() .name(config.getName()) .description(config.getDescription()) .status(config.getStatus()) ); return new OperationFuture<>( loadBalancer, new NoWaitingJobFuture() ); }
Source:
private ConnectionOptions getConnectionOptions() { configuration = configuration == null ? Configuration.getGlobalConfiguration().clone() : configuration; if (credentials == null) { final String connectionString = configuration.get(AZURE_EVENT_HUBS_CONNECTION_STRING); if (CoreUtils.isNullOrEmpty(connectionString)) { throw logger.logExceptionAsError(new IllegalArgumentException("Credentials have not been set. " + "They can be set using: connectionString(String), connectionString(String, String), " + "credentials(String, String, TokenCredential), or setting the environment variable '" + AZURE_EVENT_HUBS_CONNECTION_STRING + "' with a connection string")); } connectionString(connectionString); } if (proxyOptions == null) { proxyOptions = getDefaultProxyConfiguration(configuration); } if (proxyOptions != null && proxyOptions.isProxyAddressConfigured() && transport != AmqpTransportType.AMQP_WEB_SOCKETS) { throw logger.logExceptionAsError(new IllegalArgumentException( "Cannot use a proxy when TransportType is not AMQP Web Sockets.")); } final CbsAuthorizationType authorizationType = credentials instanceof EventHubSharedKeyCredential ? CbsAuthorizationType.SHARED_ACCESS_SIGNATURE : CbsAuthorizationType.JSON_WEB_TOKEN; return new ConnectionOptions(fullyQualifiedNamespace, credentials, authorizationType, transport, retryOptions, proxyOptions, scheduler, ""); }

Target:
private ConnectionOptions getConnectionOptions() { configuration = configuration == null ? Configuration.getGlobalConfiguration().clone() : configuration; if (credentials == null) { final String connectionString = configuration.get(AZURE_EVENT_HUBS_CONNECTION_STRING); if (CoreUtils.isNullOrEmpty(connectionString)) { throw logger.logExceptionAsError(new IllegalArgumentException("Credentials have not been set. " + "They can be set using: connectionString(String), connectionString(String, String), " + "credentials(String, String, TokenCredential), or setting the environment variable '" + AZURE_EVENT_HUBS_CONNECTION_STRING + "' with a connection string")); } connectionString(connectionString); } if (proxyOptions == null) { proxyOptions = getDefaultProxyConfiguration(configuration); } if (proxyOptions != null && proxyOptions.isProxyAddressConfigured() && transport != AmqpTransportType.AMQP_WEB_SOCKETS) { throw logger.logExceptionAsError(new IllegalArgumentException( "Cannot use a proxy when TransportType is not AMQP Web Sockets.")); } final CbsAuthorizationType authorizationType = credentials instanceof EventHubSharedKeyCredential ? CbsAuthorizationType.SHARED_ACCESS_SIGNATURE : CbsAuthorizationType.JSON_WEB_TOKEN; return new ConnectionOptions(fullyQualifiedNamespace, credentials, authorizationType, transport, retryOptions, proxyOptions, scheduler, null); }
Source:
public JSONObject getSnapshot() { JSONObject snapshot = new JSONObject(); snapshot.put(IMPLEMENTATION, HelixClusterManager.class.getName()); snapshot.put(CLUSTER_NAME, clusterName); snapshot.put(TIMESTAMP_MS, SystemTime.getInstance().milliseconds()); JSONArray datacentersJsonArray = new JSONArray(); dcIdToDcName.forEach((dcId, dcName) -> { JSONObject data = new JSONObject(); data.put(DATACENTER_NAME, dcName); data.put(DATACENTER_ID, dcId); JSONArray datanodesInDc = new JSONArray(); dcToNodes.get(dcName).forEach(mockDataNodeId -> datanodesInDc.put(mockDataNodeId.getSnapshot())); data.put(DATACENTER_NODES, datanodesInDc); datacentersJsonArray.put(data); }); snapshot.put(DATACENTERS, datacentersJsonArray); JSONArray partitionsJsonArray = new JSONArray(); getAllPartitionIds(null).forEach(partitionId -> partitionsJsonArray.put(partitionId.getSnapshot())); snapshot.put(PARTITIONS, partitionsJsonArray); return snapshot; }

Target:
public JSONObject getSnapshot() { JSONObject snapshot = new JSONObject(); snapshot.put(IMPLEMENTATION, HelixClusterManager.class.getName()); snapshot.put(CLUSTER_NAME, clusterName); snapshot.put(TIMESTAMP_MS, SystemTime.getInstance().milliseconds()); JSONArray datacentersJsonArray = new JSONArray(); dcIdToDcName.forEach((dcId, dcName) -> { JSONObject data = new JSONObject(); data.put(DATACENTER_NAME, dcName); data.put(DATACENTER_ID, dcId); JSONArray datanodesInDc = new JSONArray(); dcToNodes.get(dcName).forEach(node -> datanodesInDc.put(node.getSnapshot())); data.put(DATACENTER_NODES, datanodesInDc); datacentersJsonArray.put(data); }); snapshot.put(DATACENTERS, datacentersJsonArray); JSONArray partitionsJsonArray = new JSONArray(); getAllPartitionIds(null).forEach(partitionId -> partitionsJsonArray.put(partitionId.getSnapshot())); snapshot.put(PARTITIONS, partitionsJsonArray); return snapshot; }
Source:
public void getType() { OptionMap options = OptionMap.builder().getMap(); assertSame(Connector.Type.AJP, new UndertowConnector(new AjpListenerService(PathAddress.pathAddress("ajp-listner", "dummy"), "", options, OptionMap.EMPTY)).getType()); assertSame(Connector.Type.HTTP, new UndertowConnector(new HttpListenerService(PathAddress.pathAddress("http-listner", "dummy"), "" , options, OptionMap.EMPTY, false, false, false)).getType()); assertSame(Connector.Type.HTTPS, new UndertowConnector(new HttpsListenerService(PathAddress.pathAddress("https-listner", "dummy"), "", options, null, OptionMap.EMPTY, false)).getType()); }

Target:
public void getType() { OptionMap options = OptionMap.builder().getMap(); assertSame(Connector.Type.AJP, new UndertowConnector(new AjpListenerService(PathAddress.pathAddress(Constants.AJP_LISTENER, "dummy"), "", options, OptionMap.EMPTY)).getType()); assertSame(Connector.Type.HTTP, new UndertowConnector(new HttpListenerService(PathAddress.pathAddress(Constants.HTTP_LISTENER, "dummy"), "" , options, OptionMap.EMPTY, false, false, false)).getType()); assertSame(Connector.Type.HTTPS, new UndertowConnector(new HttpsListenerService(PathAddress.pathAddress(Constants.HTTPS_LISTENER, "dummy"), "", options, null, OptionMap.EMPTY, false)).getType()); }
Source:
protected RedirectResult createSpecificRedirectResult() { RedirectResult result = createRedirectResult(Const.ActionURIs.INSTRUCTOR_EDIT_INSTRUCTOR_FEEDBACK_PAGE); result.responseParams.put(Const.ParamsNames.COURSE_ID, moderatedInstructor.courseId); result.responseParams.put(Const.ParamsNames.FEEDBACK_SESSION_NAME, feedbackSessionName); result.responseParams.put(Const.ParamsNames.FEEDBACK_SESSION_MODERATED_STUDENT, moderatedInstructor.email); return result; }

Target:
protected RedirectResult createSpecificRedirectResult() { RedirectResult result = createRedirectResult(Const.ActionURIs.INSTRUCTOR_EDIT_INSTRUCTOR_FEEDBACK_PAGE); result.responseParams.put(Const.ParamsNames.COURSE_ID, moderatedInstructor.courseId); result.responseParams.put(Const.ParamsNames.FEEDBACK_SESSION_NAME, feedbackSessionName); result.responseParams.put(Const.ParamsNames.FEEDBACK_SESSION_MODERATED_PERSON, moderatedInstructor.email); return result; }
Source:
private RoomCount getRoomCount() { Map<Integer, String> temp = new HashMap<>(); temp.put(3, "%44"); temp.put(2, "%45"); temp.put(4, "%46"); temp.put(1, "%47"); temp.put(6, "%48"); temp.put(7, "%49"); temp.put(10, "%50"); temp.put(9, "%51"); temp.put(16, "%53"); temp.put(12, "%54"); temp.put(11, "%58"); temp.put(14, "%61"); temp.put(13, "%62"); temp.put(15, "%63"); int roomId = roomInstance.getRoom().getRoomId(); if (!temp.containsKey(roomId)) { return null; } Keeper player =worldState.getGameState().getPlayer(roomInstance.getOwnerId()); int total = player.getRoomControl().getTypeCount(roomInstance.getRoom()); return new RoomCount(temp.get(roomId), total); }

Target:
private RoomCount getRoomCount() { int roomId = roomInstance.getRoom().getRoomId(); if (!temp.containsKey(roomId)) { return null; } Keeper player = worldState.getGameState().getPlayer(roomInstance.getOwnerId()); int total = player.getRoomControl().getTypeCount(roomInstance.getRoom()); return new RoomCount(temp.get(roomId), total); }
Source:
public PredicateFinalStep visit(FullTextRangeExpr fullTextRangeExpr) { PropertyValueExpr propertyValueExpr = (PropertyValueExpr) fullTextRangeExpr.getChild(); String absoluteFieldPath = propertyValueExpr.getPropertyPath().asStringPath(); Object lower = fullTextRangeExpr.getLower(); Object upper = fullTextRangeExpr.getUpper(); boolean includeLower = fullTextRangeExpr.isIncludeLower(); boolean includeUpper = fullTextRangeExpr.isIncludeUpper(); if (lower == null && upper == null) { return predicateFactory.exists().field(absoluteFieldPath); } RangePredicateFieldMoreStep<?, ?> range = predicateFactory.range().field(absoluteFieldPath); if (lower != null && upper != null) { return range.between( lower, includeLower ? RangeBoundInclusion.INCLUDED : RangeBoundInclusion.EXCLUDED, upper, includeUpper ? RangeBoundInclusion.INCLUDED : RangeBoundInclusion.EXCLUDED); } if (lower != null && includeLower) { return range.atLeast(lower); } if (lower != null) { return range.greaterThan(lower); } if (includeUpper) { return range.atMost(upper); } return range.lessThan(upper); }

Target:
public PredicateFinalStep visit(FullTextRangeExpr fullTextRangeExpr) { PropertyValueExpr propertyValueExpr = (PropertyValueExpr) fullTextRangeExpr.getChild(); String absoluteFieldPath = propertyValueExpr.getPropertyPath().asStringPath(); Object lower = fullTextRangeExpr.getLower(); Object upper = fullTextRangeExpr.getUpper(); boolean includeLower = fullTextRangeExpr.isIncludeLower(); boolean includeUpper = fullTextRangeExpr.isIncludeUpper(); if (lower == null && upper == null) { return predicateFactory.exists().field(absoluteFieldPath); } RangePredicateFieldMoreStep<?, ?> range = predicateFactory.range().field(absoluteFieldPath); return range.between( lower, includeLower ? RangeBoundInclusion.INCLUDED : RangeBoundInclusion.EXCLUDED, upper, includeUpper ? RangeBoundInclusion.INCLUDED : RangeBoundInclusion.EXCLUDED); }
Source:
public Change insert() throws OrmException, IOException { ReviewDb db = dbProvider.get(); db.changes().beginTransaction(change.getId()); try { ChangeUtil.insertAncestors(db, patchSet.getId(), commit); db.patchSets().insert(Collections.singleton(patchSet)); db.changes().insert(Collections.singleton(change)); ChangeUtil.updateTrackingIds(db, change, trackingFooters, commit.getFooterLines()); LabelTypes labelTypes = refControl.getProjectControl().getLabelTypes(); approvalsUtil.addReviewers(db, labelTypes, change, patchSet, patchSetInfo, reviewers, Collections.<Account.Id> emptySet()); db.commit(); } finally { db.rollback(); } if (changeMessage != null) { db.changeMessages().insert(Collections.singleton(changeMessage)); } mergeabilityChecker.update(change); CheckedFuture<?, IOException> indexFuture = indexer.indexAsync(change); gitRefUpdated.fire(change.getProject(), patchSet.getRefName(), ObjectId.zeroId(), commit); if (runHooks) { hooks.doPatchsetCreatedHook(change, patchSet, db); } if (sendMail) { try { CreateChangeSender cm = createChangeSenderFactory.create(change); cm.setFrom(change.getOwner()); cm.setPatchSet(patchSet, patchSetInfo); cm.addReviewers(reviewers); cm.addExtraCC(extraCC); cm.send(); } catch (Exception err) { log.error("Cannot send email for new change " + change.getId(), err); } } indexFuture.checkedGet(); return change; }

Target:
public Change insert() throws OrmException, IOException { ReviewDb db = dbProvider.get(); db.changes().beginTransaction(change.getId()); try { ChangeUtil.insertAncestors(db, patchSet.getId(), commit); db.patchSets().insert(Collections.singleton(patchSet)); db.changes().insert(Collections.singleton(change)); ChangeUtil.updateTrackingIds(db, change, trackingFooters, commit.getFooterLines()); LabelTypes labelTypes = refControl.getProjectControl().getLabelTypes(); approvalsUtil.addReviewers(db, labelTypes, change, patchSet, patchSetInfo, reviewers, Collections.<Account.Id> emptySet()); db.commit(); } finally { db.rollback(); } if (changeMessage != null) { db.changeMessages().insert(Collections.singleton(changeMessage)); } final CheckedFuture<Boolean, IOException> mergeableFuture = mergeabilityChecker.updateAsync(change); mergeableFuture.addListener(new Runnable() { @Override public void run() { try { if (!mergeableFuture.checkedGet()) { indexer.index(change); } } catch (IOException e) { log.error("Failed to update mergeable flag for change " + change.getChangeId(), e); throw new RuntimeException(e); } } }, MoreExecutors.sameThreadExecutor()); gitRefUpdated.fire(change.getProject(), patchSet.getRefName(), ObjectId.zeroId(), commit); if (runHooks) { hooks.doPatchsetCreatedHook(change, patchSet, db); } if (sendMail) { try { CreateChangeSender cm = createChangeSenderFactory.create(change); cm.setFrom(change.getOwner()); cm.setPatchSet(patchSet, patchSetInfo); cm.addReviewers(reviewers); cm.addExtraCC(extraCC); cm.send(); } catch (Exception err) { log.error("Cannot send email for new change " + change.getId(), err); } } try { mergeableFuture.checkedGet(); } catch (IOException e) { indexer.index(change); throw e; } return change; }
Source:
public ContainsSearchQuerySpec( @JsonProperty("value") String value, @JsonProperty("caseSensitive") boolean caseSensitive ) { this.value = value; this.caseSensitive = caseSensitive; this.target = value == null || caseSensitive ? value : value.toLowerCase(); }

Target:
public ContainsSearchQuerySpec( @JsonProperty("value") String value, @JsonProperty("caseSensitive") boolean caseSensitive ) { this.value = value; this.caseSensitive = caseSensitive; }
Source:
protected AbstractLocalSearchResultProvider initializeResultProvider(PQuery query, QueryEvaluationHint hints) throws QueryProcessingException { return new LocalSearchResultProvider(this, context, query, planProvider, hints); }

Target:
protected abstract AbstractLocalSearchResultProvider initializeResultProvider(PQuery query, QueryEvaluationHint hints) throws QueryProcessingException; @Override public void dispose() { eAttributesByTypeForEClass.clear(); resultProviderCache.clear(); generalCache.purge(); }
Source:
public void validateNotAllowedMunitRunnerDependenciesWithCompileScope() throws Exception { Dependency dependencyMock = mock(Dependency.class); when(dependencyMock.getGroupId()).thenReturn("com.mulesoft.munit"); when(dependencyMock.getArtifactId()).thenReturn("munit-runner"); when(dependencyMock.getVersion()).thenReturn("0.0.0"); when(dependencyMock.getScope()).thenReturn("compile"); when(dependencyMock.getType()).thenReturn("jar"); when(dependencyMock.getClassifier()).thenReturn("mule-plugin"); when(projectMock.getDependencies()).thenReturn(singletonList(dependencyMock)); when(projectMock.getPackaging()).thenReturn(MULE_APPLICATION); doCallRealMethod().when(mojoMock).buildArtifactCoordinates(any()); doCallRealMethod().when(mojoMock).validateNotAllowedDependencies(); expectedException.expect(ValidationException.class); mojoMock.validateNotAllowedDependencies(); }

Target:
public void validateNotAllowedMunitRunnerDependenciesWithCompileScope() throws Exception { Dependency dependencyMock = mock(Dependency.class); final String version = "0.0.0"; when(dependencyMock.getGroupId()).thenReturn(MUNIT_GROUP_ID); when(dependencyMock.getArtifactId()).thenReturn(MUNIT_RUNNER_ARTIFACT_ID); when(dependencyMock.getVersion()).thenReturn(version); when(dependencyMock.getScope()).thenReturn("compile"); when(dependencyMock.getType()).thenReturn("jar"); when(dependencyMock.getClassifier()).thenReturn("mule-plugin"); when(projectMock.getDependencies()).thenReturn(singletonList(dependencyMock)); when(projectMock.getPackaging()).thenReturn(MULE_APPLICATION); doCallRealMethod().when(mojoMock).buildArtifactCoordinates(any()); doCallRealMethod().when(mojoMock).validateNotAllowedDependencies(); expectedException.expect(ValidationException.class); expectedException.expectMessage(format("%s:%s:%s", MUNIT_GROUP_ID, MUNIT_RUNNER_ARTIFACT_ID, version)); expectedException.expectMessage("should have scope \'test\', found \'compile\'"); mojoMock.validateNotAllowedDependencies(); }
Source:
public static void main(String...args) { Cli<BrooklynCommand> parser = buildCli(); try { log.debug("Parsing command line arguments: {}",args); BrooklynCommand command = parser.parse(args); log.debug("Executing command: {}", command); command.call(); } catch (ParseException pe) { System.err.println("Parse error: " + pe.getMessage()); System.err.println(getUsageInfo(parser)); System.exit(PARSE_ERROR); } catch (Exception e) { log.error("Execution error: {}\n{}" + e.getMessage(),e.getStackTrace()); System.err.println("Execution error: " + e.getMessage()); e.printStackTrace(); System.exit(EXECUTION_ERROR); } }

Target:
public static void main(String...args) { Client client = new Client(); try { client.run(args); } catch (ParseException pe) { LOG.error("Error parsing command "+ Arrays.toString(args), pe); System.err.println("Parse error: " + pe.getMessage()); System.err.println(getUsageInfo(parser)); System.exit(PARSE_ERROR); } catch (Exception e) { LOG.error("Error executing command "+ Arrays.toString(args), e); System.err.println("Execution error: " + e.getMessage()); System.exit(EXECUTION_ERROR); } }
Source:
public void testConnectorGracefullyShutdown() throws Exception { String testCluster = "testConnectorGracefullyShutdown"; String testConnectorType = "testConnectorType"; AtomicBoolean eventProcessed = new AtomicBoolean(false); Coordinator instance1 = createCoordinator(_zkConnectionString, testCluster, new Properties(), new DummyTransportProviderAdminFactory(), (event) -> { try { Thread.sleep(5000); eventProcessed.set(true); } catch (Exception ex) { } }); TestHookConnector connector1 = new TestHookConnector("connector1", testConnectorType); instance1.addConnector(testConnectorType, connector1, new BroadcastStrategy(Optional.empty()), false, new SourceBasedDeduper(), null); instance1.start(); instance1.onAssignmentChange(); instance1.stop(); Assert.assertTrue(eventProcessed.get()); }

Target:
public void testConnectorGracefullyShutdown() throws Exception { String testCluster = "testConnectorGracefullyShutdown"; String testConnectorType = "testConnectorType"; final CountDownLatch latch = new CountDownLatch(1); Coordinator instance = createCoordinator(_zkConnectionString, testCluster, new Properties(), new DummyTransportProviderAdminFactory(), (event) -> { try { Thread.sleep(1000); latch.countDown(); } catch (Exception ex) { } }); TestHookConnector connector = new TestHookConnector("connector1", testConnectorType); instance.addConnector(testConnectorType, connector, new BroadcastStrategy(Optional.empty()), false, new SourceBasedDeduper(), null); instance.start(); instance.onAssignmentChange(); instance.stop(); Assert.assertTrue(latch.getCount() < 1); }
Source:
public static void writeSimpleXMLTag(PrintWriter pw1, int indent, String name, boolean... values) { StringBuilder csv = new StringBuilder(); for (int i = 0; i < values.length; i++) { csv.append(values[i]); if (i < values.length - 1) { csv.append(","); } } pw1.println(indentStr(indent) + "<" + name + ">" + csv + "</" + name + ">"); }

Target:
public static void writeSimpleXMLTag(PrintWriter pw1, int indent, String name, boolean... values) { StringJoiner stringJoiner = new StringJoiner(",", "", ""); for (boolean value : values) { stringJoiner.add(Boolean.toString(value)); } pw1.println(indentStr(indent) + "<" + name + ">" + stringJoiner + "</" + name + ">"); }
Source:
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { boolean clear = false; if (args.length >= 1) { if (args[0].equalsIgnoreCase("clear")) { TFM_Util.adminAction(sender.getName(), "Clearing all invisible players", true); clear = true; } else { return false; } } List<String> players = new ArrayList<String>(); int clears = 0; for (Player player : server.getOnlinePlayers()) { if (player.hasPotionEffect(PotionEffectType.INVISIBILITY)) { players.add(player.getName()); if (clear && !TFM_AdminList.isSuperAdmin(player)) { player.removePotionEffect(PotionEffectType.INVISIBILITY); clears++; } } } if (players.isEmpty()) { playerMsg("There are no invisible players"); return true; } if (clear) { playerMsg("Cleared invisibility effect from " + clears + " players""); } else { playerMsg("Invisible players (" + players.size() + "): " + StringUtils.join(players, ", ")); } return true; }

Target:
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { boolean clear = false; if (args.length >= 1) { if (args[0].equalsIgnoreCase("clear")) { TFM_Util.adminAction(sender.getName(), "Clearing all invisible players", true); clear = true; } else { return false; } } List<String> players = new ArrayList<String>(); int clears = 0; for (Player player : server.getOnlinePlayers()) { if (player.hasPotionEffect(PotionEffectType.INVISIBILITY)) { players.add(player.getName()); if (clear && !TFM_AdminList.isSuperAdmin(player)) { player.removePotionEffect(PotionEffectType.INVISIBILITY); clears++; } } } if (players.isEmpty()) { playerMsg("There are no invisible players"); return true; } if (clear) { playerMsg("Cleared invisibility effect from " + clears + " players"); } else { playerMsg("Invisible players (" + players.size() + "): " + StringUtils.join(players, ", ")); } return true; }
Source:
public void removeListener() { if (!stereotypeList.isEmpty()) { for (Stereotype stereotype : stereotypeList) { Node compartment = helper.getStereotypeCompartment(hostView, stereotype); if (compartment != null && stereotype != null) { getDiagramEventBroker().removeNotificationListener(compartment, this); EList<Property> properties = stereotype.allAttributes(); for (Property property : properties) { getDiagramEventBroker().removeNotificationListener(helper.getStereotypeProperty(hostView, stereotype, property), this); } } } } }

Target:
public void removeListener() { if (!stereotypeList.isEmpty()) { for (Stereotype stereotype : stereotypeList) { Node compartment = helper.getStereotypeCompartment(hostView, stereotype); if (null != compartment && null != stereotype) { getDiagramEventBroker().removeNotificationListener(compartment, this); EList<Property> properties = stereotype.allAttributes(); for (Property property : properties) { getDiagramEventBroker().removeNotificationListener(helper.getStereotypeProperty(hostView, stereotype, property), this); } } } } }
Source:
public Subject getSubject(String username, String password, String ip) { AuthenticationTokenFactory tokenFactory = createBasicTokenFactory(); AuthenticationToken token = tokenFactory.fromUsernamePassword(username, password, ip); SecurityManager securityManager = getSecurityManager(); if (securityManager != null) { try { ((BaseAuthenticationToken) token).setAllowGuest(true); return securityManager.getSubject(token); } catch (SecurityServiceException | RuntimeException e) { LOGGER.info("Unable to request subject for user.", username, e); } } return null; }

Target:
public Subject getSubject(String username, String password, String ip) { AuthenticationTokenFactory tokenFactory = createBasicTokenFactory(); AuthenticationToken token = tokenFactory.fromUsernamePassword(username, password, ip); SecurityManager securityManager = getSecurityManager(); if (securityManager != null) { try { if (token instanceof BaseAuthenticationToken) { ((BaseAuthenticationToken) token).setAllowGuest(true); } return securityManager.getSubject(token); } catch (SecurityServiceException | RuntimeException e) { LOGGER.info("Unable to request subject for user.", username, e); } } return null; }
Source:
private String hash(final byte[] input) { try { if (_algorithm == Algorithm.CRC_32) { final CRC32 crc = new CRC32(); crc.update(input); return ""+crc.getValue(); } else { final MessageDigest messageDigest = MessageDigest.getInstance(_algorithm.toString()); messageDigest.update(input); final byte[] hash = messageDigest.digest(); return String.format("%032X", new BigInteger(1, hash)); } } catch (NoSuchAlgorithmException e) { throw new RuntimeException("Algorithm used for hashing was not recognized. " + e.getMessage()); } }

Target:
private String hash(final byte[] input) { try { final MessageDigest messageDigest = MessageDigest.getInstance(_algorithm.toString()); messageDigest.update(input); final byte[] hash = messageDigest.digest(); return DatatypeConverter.printHexBinary(hash); } catch (final NoSuchAlgorithmException e) { throw new RuntimeException("Algorithm used for hashing was not recognized. " + e.getMessage()); } }
Source:
public static int getTimePeriodDays(final TimePeriodType timePeriodType) { if (timePeriodType == TimePeriodType.OVER_TIME_1W) { return 7; } else if (timePeriodType == TimePeriodType.OVER_TIME_2W) { return 14; } else if (timePeriodType == TimePeriodType.OVER_TIME_1M) { return 30; } else if (timePeriodType == TimePeriodType.OVER_TIME_3M) { return 90; } else { return 365; } }

Target:
public static int getTimePeriodDays(final TimePeriodType timePeriodType) { if (PERIOD_TYPE_DAYS.containsKey(timePeriodType)) { return PERIOD_TYPE_DAYS.get(timePeriodType); } return 365; }
Source:
public void waitMarkersQuantityBetween( MarkerLocator markerLocator, int lowerBound, int upperBound, int timeout) { seleniumWebDriverHelper.waitSuccessCondition( driver -> { final int markersQuantity = getMarkersQuantity(markerLocator); final boolean isQuantityInLowerBound = lowerBound <= markersQuantity; final boolean isQuantityInUpperBound = upperBound >= markersQuantity; return isQuantityInLowerBound && isQuantityInUpperBound; }); }

Target:
public void waitMarkersQuantityBetween( MarkerLocator markerLocator, int lowerBound, int upperBound, int timeout) { seleniumWebDriverHelper.waitSuccessCondition( driver -> { final int markersQuantity = getMarkersQuantity(markerLocator); return lowerBound <= markersQuantity && upperBound >= markersQuantity; }); }
Source:
private Address createAddress(String hostname) throws IOException, URISyntaxException { URI uri = new URI("dummy://" + hostname); String host = uri.getHost(); int port = uri.getPort(); return new Address(host, port); }

Target:
private Address createAddress(String hostname) throws IOException { AddressUtil.AddressHolder addressHolder = AddressUtil.getAddressHolder(hostname); String scopedHostName = AddressHelper.getScopedHostName(addressHolder); return new Address(scopedHostName, addressHolder.getPort()); }
Source:
public boolean deleteMetadataRecord(String name) { return false; }

Target:
public boolean deleteMetadataRecord(String name) { boolean result = false; Iterator<DataStore> iter = delegateHandler.getAllDelegatesIterator(); while (iter.hasNext()) { DataStore ds = iter.next(); if (ds instanceof SharedDataStore) { result = result || ((SharedDataStore) ds).deleteMetadataRecord(name); } } return result; }
Source:
public static ISynchronizeService getSyncService(String syncServiceId) { ISynchronizeServiceDescriptor desc = SynchronizeServiceRegistry.getSynchronizeServiceDescriptor(syncServiceId); if(desc == null) return null; return desc.getService(); }

Target:
public static ISynchronizeService getSyncService(String syncServiceId) { ISynchronizeServiceDescriptor desc = SynchronizeServiceRegistry.getSynchronizeServiceDescriptor(syncServiceId); if(desc == null) { return null; } return desc.getService(); }
Source:
private void grantAccessToRequests(AuthenticatedUser au, List<DataFile> files) { boolean actionPerformed = false; DataverseRole fileDownloaderRole = roleService.findBuiltinRoleByAlias(DataverseRole.FILE_DOWNLOADER); for (DataFile file : files) { if (assignRole(au, file, fileDownloaderRole)) { file.getFileAccessRequesters().remove(au); List<FileAccessRequest> fileAccessRequests = fileAccessRequestService.findAllByAuthenticatedUserIdAndRequestState(au.getId(), FileAccessRequest.RequestState.CREATED); for(FileAccessRequest far : fileAccessRequests){ far.setStateGranted(); fileAccessRequestService.save(far); } file.setFileAccessRequests(fileAccessRequests); datafileService.save(file); actionPerformed = true; } } if (actionPerformed) { JsfHelper.addSuccessMessage(BundleUtil.getStringFromBundle("permission.fileAccessGranted", Arrays.asList(au.getDisplayInfo().getTitle()))); userNotificationService.sendNotification(au, new Timestamp(new Date().getTime()), UserNotification.Type.GRANTFILEACCESS, dataset.getId()); initMaps(); } }

Target:
private void grantAccessToRequests(AuthenticatedUser au, List<DataFile> files) { boolean actionPerformed = false; DataverseRole fileDownloaderRole = roleService.findBuiltinRoleByAlias(DataverseRole.FILE_DOWNLOADER); for (DataFile file : files) { if (assignRole(au, file, fileDownloaderRole)) { file.getFileAccessRequesters().remove(au); List<FileAccessRequest> fileAccessRequests = fileAccessRequestService.findAll(au.getId(), file.getId(), FileAccessRequest.RequestState.CREATED); for(FileAccessRequest far : fileAccessRequests){ far.setStateGranted(); fileAccessRequestService.save(far); } file.setFileAccessRequests(fileAccessRequests); datafileService.save(file); actionPerformed = true; } } if (actionPerformed) { JsfHelper.addSuccessMessage(BundleUtil.getStringFromBundle("permission.fileAccessGranted", Arrays.asList(au.getDisplayInfo().getTitle()))); userNotificationService.sendNotification(au, new Timestamp(new Date().getTime()), UserNotification.Type.GRANTFILEACCESS, dataset.getId()); initMaps(); } }
Source:
protected void onResume() { super.onResume(); Log.d(TAG, "onResumed called."); mWebView.onResume(); mWebView.resumeTimers(); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(mContext); Log.d(TAG, "display_options_units: " + prefs.getString("display_options_units", "0")); currentUnits = prefs.getString("display_options_units", "0").equals("0") ? 1 : Constants.MG_DL_TO_MMOL_L; boolean isLogarithmic = prefs.getString("display_verticle_axis", "0").equals("0") ? true : false; int sgv = (Integer) mTextSGV.getTag(R.string.display_sgv); int direction = (Integer) mTextSGV.getTag(R.string.display_trend); if (sgv != -1) { mTextSGV.setText(getSGVStringByUnit(sgv, TrendArrow.values()[direction])); } mWebView.loadUrl("javascript:updateUnits(" + Boolean.toString(currentUnits == Constants.MG_DL_TO_MMOL_L) +"," + Boolean.toString(isLogarithmic) + ","+ prefs.getString("display_low_range", "80") + "," + prefs.getString("display_high_range", "180") + ")"); mHandler.post(updateTimeAgo); if (statusBarIcons != null) { statusBarIcons.checkForRootOptionChanged(); } }

Target:
protected void onResume() { super.onResume(); Log.d(TAG, "onResumed called."); mWebView.onResume(); mWebView.resumeTimers(); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(mContext); final NightscoutPreferences preferences = new AndroidPreferences(prefs); Log.d(TAG, "display_options_units: " + preferences.isDisplayOptionsMgdl()); currentUnits = preferences.isDisplayOptionsMgdl() ? 1 : Constants.MG_DL_TO_MMOL_L; int sgv = (Integer) mTextSGV.getTag(R.string.display_sgv); int direction = (Integer) mTextSGV.getTag(R.string.display_trend); if (sgv != -1) { mTextSGV.setText(getSGVStringByUnit(sgv, TrendArrow.values()[direction])); } mWebView.loadUrl("javascript:updateUnits(" + Boolean.toString(!preferences.isDisplayOptionsMgdl()) +"," + Boolean.toString(preferences.isLogarithmic()) + ","+ preferences.displayLowRange() + "," + preferences.displayHighRange() + ")"); mHandler.post(updateTimeAgo); if (statusBarIcons != null) { statusBarIcons.checkForRootOptionChanged(); } }
Source:
public void processLeftData(final MistDataEvent input) { applyStatefulFunction.update((IN)input.getValue()); this.applyStatefulFunctionState = applyStatefulFunction.getCurrentState(); final OUT output = applyStatefulFunction.produceResult(); LOG.log(Level.FINE, "{0} updates the state to {1} with input {2}, and generates {3}", new Object[]{this.getClass().getName(), applyStatefulFunction.getCurrentState(), input, output}); input.setValue(output); outputEmitter.emitData(input); }

Target:
public void processLeftData(final MistDataEvent input) { applyStatefulFunction.update((IN)input.getValue()); final OUT output = applyStatefulFunction.produceResult(); LOG.log(Level.FINE, "{0} updates the state to {1} with input {2}, and generates {3}", new Object[]{this.getClass().getName(), applyStatefulFunction.getCurrentState(), input, output}); input.setValue(output); outputEmitter.emitData(input); }
Source:
private void doFetchPrincipalRecord(ExtMap input, ExtMap output) throws SQLException, IOException { int flags = input.get(Authz.InvokeKeys.QUERY_FLAGS, Integer.class, 0); Collection<ExtMap> principals = authorization.getResults( Formatter.format( "{} = {}", Schema.SEARCH_KEYS.get(Authz.PrincipalRecord.NAME), Formatter.escapeString( input.containsKey(Authz.InvokeKeys.PRINCIPAL) ? input.get(Authz.InvokeKeys.PRINCIPAL, String.class) : input.get(Authn.InvokeKeys.AUTH_RECORD, ExtMap.class) .get(Authn.AuthRecord.PRINCIPAL, String.class) ) ), new ExtMap().mput( Global.SearchContext.IS_PRINCIPAL, true ).mput( Global.SearchContext.WITH_GROUPS, (flags & Authz.QueryFlags.RESOLVE_GROUPS) != 0 ).mput( Global.SearchContext.RECURSIVE, (flags & Authz.QueryFlags.RESOLVE_GROUPS_RECURSIVE) != 0 ).mput( Global.SearchContext.PAGE_SIZE, 1 ).mput( Global.SearchContext.ALL_ATTRIBUTES, false ) ); output.put(Authz.InvokeKeys.PRINCIPAL_RECORD, principals.size() > 0 ? principals.iterator().next() : null ); ExtMap principalRecord = output.get(Authz.InvokeKeys.PRINCIPAL_RECORD); if (principalRecord != null && (flags & Authz.QueryFlags.RESOLVE_GROUPS_RECURSIVE) != 0) { Set<String> searchedGroups = new HashSet<>(); resolveNestedGroups(principalRecord.<List>get(Authz.PrincipalRecord.GROUPS), searchedGroups); } output.put(Base.InvokeKeys.RESULT, Base.InvokeResult.SUCCESS); output.put(Authz.InvokeKeys.STATUS, Authz.Status.SUCCESS); }

Target:
private void doFetchPrincipalRecord(ExtMap input, ExtMap output) throws SQLException, IOException { int flags = input.get(Authz.InvokeKeys.QUERY_FLAGS, Integer.class, 0); Collection<ExtMap> principals = authorization.getResults( Formatter.format( "{} = {}", Schema.SEARCH_KEYS.get(Authz.PrincipalRecord.NAME), Formatter.escapeString( input.containsKey(Authz.InvokeKeys.PRINCIPAL) ? input.get(Authz.InvokeKeys.PRINCIPAL, String.class) : input.get(Authn.InvokeKeys.AUTH_RECORD, ExtMap.class) .get(Authn.AuthRecord.PRINCIPAL, String.class) ) ), new ExtMap().mput( Global.SearchContext.IS_PRINCIPAL, true ).mput( Global.SearchContext.WITH_GROUPS, (flags & Authz.QueryFlags.RESOLVE_GROUPS) != 0 ).mput( Global.SearchContext.RECURSIVE, (flags & Authz.QueryFlags.RESOLVE_GROUPS_RECURSIVE) != 0 ).mput( Global.SearchContext.PAGE_SIZE, 1 ).mput( Global.SearchContext.ALL_ATTRIBUTES, false ) ); output.put(Authz.InvokeKeys.PRINCIPAL_RECORD, principals.size() > 0 ? principals.iterator().next() : null ); ExtMap principalRecord = output.get(Authz.InvokeKeys.PRINCIPAL_RECORD); if (principalRecord != null && (flags & Authz.QueryFlags.RESOLVE_GROUPS_RECURSIVE) != 0) { resolveNestedGroups( principalRecord.<List<ExtMap>>get(Authz.PrincipalRecord.GROUPS), new HashSet<String>() ); } output.put(Base.InvokeKeys.RESULT, Base.InvokeResult.SUCCESS); output.put(Authz.InvokeKeys.STATUS, Authz.Status.SUCCESS); }
Source:
public byte getFieldPosition() { return -1; }

Target:
public byte getFieldPosition() { return getByte(record + FIELD_POSITION_OFFSET); }
Source:
private void unZipCcz(String filePath) { if (mTargetPath != null) { new File(mTargetPath).delete(); } mTargetPath = CommCareApplication.instance().getAndroidFsTemp() + PropertyUtils.genUUID(); UnzipTask unzipTask = new sUnzipTask(); unzipTask.connect(mActivity); unzipTask.executeParallel(new String[]{filePath, mTargetPath}); mActivity.enableLoadingIndicator(); setCczSelectionVisibility(false); }

Target:
private void unZipCcz(String filePath) { mTargetPath = CczUtils.getCczTargetPath(); ZipUtils.UnzipFile(mActivity, filePath, mTargetPath); mActivity.enableLoadingIndicator(); setCczSelectionVisibility(false); }
Source:
public String getName() { return this.name; }

Target:
public String getName() { return name; }
Source:
void progress(String message, String color) { if (useColor) { progress(color + message + RESET); } else progress(message); }

Target:
void progress(String message, String color) { if (useColor) { progress(color + message + RESET); } else { progress(message); } }
Source:
public void testLoadLocalReplaysInBackground() throws Exception { var replays = Arrays.asList( ReplayInfoBeanBuilder.create().get(), ReplayInfoBeanBuilder.create().get(), ReplayInfoBeanBuilder.create().get() ); CountDownLatch loadedLatch = new CountDownLatch(1); ((TableView) instance.getRoot()).getItems().addListener((InvalidationListener) observable -> loadedLatch.countDown()); instance.loadLocalReplaysInBackground(); instance.onLocalReplaysChanged(new LocalReplaysChangedEvent(replays, new ArrayList<Replay>())); assertTrue(loadedLatch.await(5000, TimeUnit.MILLISECONDS)); assertThat(((TableView) instance.getRoot()).getItems().size(), is(3)); verifyZeroInteractions(notificationService); }

Target:
public void testLoadLocalReplaysInBackground() throws Exception { List<Replay> replays = Arrays.asList( ReplayInfoBeanBuilder.create().get(), ReplayInfoBeanBuilder.create().get(), ReplayInfoBeanBuilder.create().get() ); CountDownLatch loadedLatch = new CountDownLatch(1); instance.replayTableView.getItems().addListener((InvalidationListener) observable -> loadedLatch.countDown()); instance.loadLocalReplaysInBackground(); instance.onLocalReplaysChanged(new LocalReplaysChangedEvent(this, replays, new ArrayList<Replay>())); assertTrue(loadedLatch.await(5000, TimeUnit.MILLISECONDS)); assertThat(instance.replayTableView.getItems().size(), is(3)); verifyZeroInteractions(notificationService); }
Source:
public void getParticipantByAccountIdThrowsException() { AccountId accountId = AccountId.forEmail(STUDY.getIdentifier(), "email@email.com"); participantService.getParticipant(STUDY, accountId, true); verify(accountDao).getAccount(accountId); }

Target:
public void getParticipantByAccountIdThrowsException() { AccountId accountId = AccountId.forEmail(STUDY.getIdentifier(), "email@email.com"); participantService.getParticipant(STUDY, accountId, true); }