auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected static ImmutableList<Ds3Element> convertAllElements( final ImmutableList<Ds3Element> elements, final NameMapper nameMapper) { if (elements == null || elements.isEmpty()) { return elements; } ImmutableList.Builder<Ds3Element> builder = ImmutableList.builder(); for (final Ds3Element element : elements) { final Ds3Element convertedElement = new Ds3Element( element.getName(), convertName(element.getType(), nameMapper), convertName(element.getComponentType(), nameMapper), convertAllAnnotations(element.getDs3Annotations(), nameMapper)); builder.add(convertedElement); } return builder.build(); }

Target:
protected static ImmutableList<Ds3Element> convertAllElements( final ImmutableList<Ds3Element> elements, final NameMapper nameMapper) { if (elements == null || elements.isEmpty()) { return elements; } final ImmutableList.Builder<Ds3Element> builder = ImmutableList.builder(); for (final Ds3Element element : elements) { final Ds3Element convertedElement = new Ds3Element( element.getName(), convertName(element.getType(), nameMapper), convertName(element.getComponentType(), nameMapper), convertAllAnnotations(element.getDs3Annotations(), nameMapper)); builder.add(convertedElement); } return builder.build(); }
Source:
public void start() { Optional.ofNullable(heartbeatScheduler.get()).ifPresent(Scheduler::start); }

Target:
public void start() { heartbeatMonitor().start(); }
Source:
public int get(int key) { if(map.get(key) != null) { DoubleLinkedList node = map.get(key); int result = node.value; deleteNode(node); addToHead(node); return result; } return -1; }

Target:
public int get(int key) { if(map.containsKey(key)) { DoubleLinkedList node = map.get(key); int result = node.value; deleteNode(node); addToHead(node); return result; } return -1; }
Source:
public void invoke(@NotNull Project project, Editor editor, @NotNull PsiElement element) throws IncorrectOperationException { Data data = getData(element); if (data == null) return; moveFieldReferenceExpressions(data); if (!data.needReplaceDeclarationWithShortVar()) return; data.getStructDeclaration() .replace(GoElementFactory.createShortVarDeclarationStatement(project, data.getStructVarName(), data.getCompositeLit().getText())); }

Target:
public void invoke(@NotNull Project project, Editor editor, @NotNull PsiElement element) throws IncorrectOperationException { Data data = getData(element); if (data == null) return; boolean needReplaceDeclarationWithShortVar = data.getCompositeLit() == null; GoCompositeLit compositeLit = needReplaceDeclarationWithShortVar ? createStructLiteral(data.getStructDefinition(), project) : data.getCompositeLit(); if (compositeLit == null || needReplaceDeclarationWithShortVar && data.getStructDeclaration() == null) return; moveFieldReferenceExpressions(data.getReferenceExpressions(), compositeLit.getLiteralValue(), data.getAssignment()); if (!needReplaceDeclarationWithShortVar) return; GoStatement shortVarStatement = GoElementFactory.createShortVarDeclarationStatement(project, data.getStructDefinition().getText(), compositeLit.getText()); data.getStructDeclaration().replace(shortVarStatement); }
Source:
void stop() { if (trace) log.tracef("Stop called on ReplicaSpliterator. Current segment %s", nextSegment); if (isConflictResolutionInProgress()) segmentRequestFuture.cancel(true); }

Target:
void stop() { if (trace) log.tracef("Stop called on ReplicaSpliterator. Current segment %s", nextSegment); if (segmentRequestFuture != null) segmentRequestFuture.cancel(true); }
Source:
public boolean isSameType(ItemStack inputStack) { if (getLocked()) { System.out.printf("+++ SUB#isSameType: locked: [%s]\n", lockedItem); return inputStack.getItem() == lockedItem; } if (inputStack != ItemStack.EMPTY) { return ItemUtils.isItemEqual(getStoredStack(), inputStack, true, true); } return false; }

Target:
public boolean isSameType(ItemStack inputStack) { if (isLocked()) { return ItemUtils.isItemEqual(lockedItemStack, inputStack, true, true); } if (inputStack != ItemStack.EMPTY) { return ItemUtils.isItemEqual(getStoredStack(), inputStack, true, true); } return false; }
Source:
private void scaffold(Iterator<RayMessage> msgIterator) { VKmer id = getVertexId(); RayValue vertex = getVertexValue(); requestScoreMsgs.clear(); aggregateScoreMsgs.clear(); while (msgIterator.hasNext()) { RayMessage msg = msgIterator.next(); switch (msg.getMessageType()) { case CONTINUE_WALK: startBranchComparison(msg); break; case REQUEST_KMER: sendKmerToWalkNodes(msg); break; case REQUEST_SCORE: RayMessage reqMsg = new RayMessage(); reqMsg.setAsCopy(msg); requestScoreMsgs.add(reqMsg); break; case AGGREGATE_SCORE: RayMessage aggMsg = new RayMessage(); aggMsg.setAsCopy(msg); aggregateScoreMsgs.add(aggMsg); break; case PRUNE_EDGE: vertex.getEdges(msg.getEdgeTypeBackToFrontier()).remove(msg.getSourceVertexId()); vertex.visited = false; break; case STOP: vertex.stopSearch = true; break; } } if (requestScoreMsgs.size() > 0) { sendScoresToFrontier(requestScoreMsgs); } if (aggregateScoreMsgs.size() > 0) { compareScoresAndPrune(aggregateScoreMsgs); } }

Target:
private void scaffold(Iterator<RayMessage> msgIterator) { VKmer id = getVertexId(); RayValue vertex = getVertexValue(); requestScoreMsgs.clear(); aggregateScoreMsgs.clear(); while (msgIterator.hasNext()) { RayMessage msg = msgIterator.next(); switch (msg.getMessageType()) { case CONTINUE_WALK: startBranchComparison(msg); break; case REQUEST_KMER: sendKmerToWalkNodes(msg); break; case REQUEST_SCORE: requestScoreMsgs.add(new RayMessage(msg)); break; case AGGREGATE_SCORE: aggregateScoreMsgs.add(new RayMessage(msg)); break; case PRUNE_EDGE: vertex.getEdges(msg.getEdgeTypeBackToFrontier()).remove(msg.getSourceVertexId()); vertex.visited = false; break; case STOP: vertex.stopSearch = true; break; } } if (requestScoreMsgs.size() > 0) { sendScoresToFrontier(requestScoreMsgs); } if (aggregateScoreMsgs.size() > 0) { compareScoresAndPrune(aggregateScoreMsgs); } }
Source:
public void test_descriptor() { DefaultSensorDescriptor sensorDescriptor = new DefaultSensorDescriptor(); sensor.describe(sensorDescriptor); assertThat(sensorDescriptor.name()).isEqualTo("Import of PMD issues"); MapSettings settings = new MapSettings(); assertThat(sensorDescriptor.configurationPredicate().test(new ConfigurationBridge(settings))).isFalse(); settings.setProperty(PmdSensor.REPORT_PROPERTY_KEY, "report.xml"); assertThat(sensorDescriptor.configurationPredicate().test(new ConfigurationBridge(settings))).isTrue(); }

Target:
public void test_descriptor() { DefaultSensorDescriptor sensorDescriptor = new DefaultSensorDescriptor(); sensor.describe(sensorDescriptor); assertThat(sensorDescriptor.name()).isEqualTo("Import of PMD issues"); MapSettings settings = new MapSettings(); assertThat(sensorDescriptor.configurationPredicate().test(settings.asConfig())).isFalse(); settings.setProperty(PmdSensor.REPORT_PROPERTY_KEY, "report.xml"); assertThat(sensorDescriptor.configurationPredicate().test(settings.asConfig())).isTrue(); }
Source:
public ResourcePools build() { if (resourcePools.isEmpty()) { throw new IllegalStateException("No resource pools defined"); } return new ResourcePoolsImpl(resourcePools); }

Target:
public ResourcePools build() { return new ResourcePoolsImpl(resourcePools); }
Source:
public RFuture<Void> setRateAsync(RateType type, long rate, long rateInterval, RateIntervalUnit unit) { return commandExecutor.evalWriteAsync(getName(), LongCodec.INSTANCE, RedisCommands.EVAL_BOOLEAN, "redis.call('hset', KEYS[1], 'rate', ARGV[1]);" + "redis.call('hset', KEYS[1], 'interval', ARGV[2]);" + "redis.call('hset', KEYS[1], 'type', ARGV[3]);" + "return redis.call('del', KEYS[2], KEYS[3]);", Arrays.asList(getName(), getValueName(), getPermitsName()), rate, unit.toMillis(rateInterval), type.ordinal()); }

Target:
public RFuture<Void> setRateAsync(RateType type, long rate, long rateInterval, RateIntervalUnit unit) { return commandExecutor.evalWriteAsync(getName(), LongCodec.INSTANCE, RedisCommands.EVAL_BOOLEAN, "redis.call('hset', KEYS[1], 'rate', ARGV[1]);" + "redis.call('hset', KEYS[1], 'interval', ARGV[2]);" + "redis.call('hset', KEYS[1], 'type', ARGV[3]);" + "redis.call('del', KEYS[2], KEYS[3]);", Arrays.asList(getName(), getValueName(), getPermitsName()), rate, unit.toMillis(rateInterval), type.ordinal()); }
Source:
public void checkSpecificAccessControl() { String courseId = getNonNullRequestParamValue(Const.ParamsNames.COURSE_ID); String feedbackSessionName = getNonNullRequestParamValue(Const.ParamsNames.FEEDBACK_SESSION_NAME); FeedbackSessionAttributes fs = logic.getFeedbackSession(feedbackSessionName, courseId); if (fs == null) { throw new EntityNotFoundException(new EntityDoesNotExistException("Feedback session is not found")); } Intent intent = Intent.valueOf(getNonNullRequestParamValue(Const.ParamsNames.INTENT)); switch (intent) { case INSTRUCTOR_RESULT: if (userInfo == null) { throw new UnauthorizedAccessException("Instructor account is required to access this resource"); } else { InstructorAttributes instructor = logic.getInstructorForGoogleId(courseId, userInfo.id); gateKeeper.verifyAccessible(instructor, fs); } break; case STUDENT_RESULT: if (userInfo == null && StringHelper.isEmpty(getRequestParamValue(Const.ParamsNames.REGKEY))) { throw new UnauthorizedAccessException("Student account is required to access this resource."); } StudentAttributes student = getStudent(courseId); gateKeeper.verifyAccessible(student, fs); if (!fs.isPublished()) { throw new UnauthorizedAccessException("This feedback session is not yet published."); } break; case INSTRUCTOR_SUBMISSION: case STUDENT_SUBMISSION: throw new InvalidHttpParameterException("Invalid intent for this action"); default: throw new InvalidHttpParameterException("Unknown intent " + intent); } }

Target:
public void checkSpecificAccessControl() { String courseId = getNonNullRequestParamValue(Const.ParamsNames.COURSE_ID); String feedbackSessionName = getNonNullRequestParamValue(Const.ParamsNames.FEEDBACK_SESSION_NAME); FeedbackSessionAttributes fs = logic.getFeedbackSession(feedbackSessionName, courseId); if (fs == null) { throw new EntityNotFoundException(new EntityDoesNotExistException("Feedback session is not found")); } Intent intent = Intent.valueOf(getNonNullRequestParamValue(Const.ParamsNames.INTENT)); switch (intent) { case INSTRUCTOR_RESULT: gateKeeper.verifyLoggedInUserPrivileges(); InstructorAttributes instructor = logic.getInstructorForGoogleId(courseId, userInfo.getId()); gateKeeper.verifyAccessible(instructor, fs); break; case STUDENT_RESULT: StudentAttributes student = getStudent(courseId); gateKeeper.verifyAccessible(student, fs); if (!fs.isPublished()) { throw new UnauthorizedAccessException("This feedback session is not yet published."); } break; case INSTRUCTOR_SUBMISSION: case STUDENT_SUBMISSION: throw new InvalidHttpParameterException("Invalid intent for this action"); default: throw new InvalidHttpParameterException("Unknown intent " + intent); } }
Source:
public final void apply(Project project) { TaskProvider<? extends Task> task = createTask(project); TaskProvider<DefaultTask> precommit = GradleUtils.maybeRegister(project.getTasks(), "precommit", DefaultTask.class, t -> { t.setGroup(JavaBasePlugin.VERIFICATION_GROUP); t.setDescription("Runs all non-test checks"); }); precommit.configure(t -> t.dependsOn(task)); project.getPluginManager().withPlugin("java", p -> { for (SourceSet sourceSet : GradleUtils.getJavaSourceSets(project)) { task.configure(t -> t.shouldRunAfter(sourceSet.getClassesTaskName())); } project.getTasks().named(LifecycleBasePlugin.CHECK_TASK_NAME).configure(t -> t.dependsOn(precommit)); project.getTasks().named(JavaPlugin.TEST_TASK_NAME).configure(t -> t.mustRunAfter(precommit)); }); }

Target:
public final void apply(Project project) { project.getPluginManager().apply(PrecommitTaskPlugin.class); TaskProvider<? extends Task> task = createTask(project); TaskProvider<Task> precommit = project.getTasks().named(PRECOMMIT_TASK_NAME); precommit.configure(t -> t.dependsOn(task)); project.getPluginManager() .withPlugin( "java", p -> { for (SourceSet sourceSet : GradleUtils.getJavaSourceSets(project)) { task.configure(t -> t.shouldRunAfter(sourceSet.getClassesTaskName())); } } ); }
Source:
private SharedRealm(OsRealmConfig osRealmConfig) { Capabilities capabilities = new AndroidCapabilities(); RealmNotifier realmNotifier = new AndroidRealmNotifier(this, capabilities); this.nativePtr = nativeGetSharedRealm(osRealmConfig.getNativePtr(), realmNotifier); this.osRealmConfig = osRealmConfig; this.schemaInfo = new OsSchemaInfo(nativeGetSchemaInfo(nativePtr), this); this.context = osRealmConfig.getContext(); this.context.addReference(this); this.isPhantomRef = true; this.capabilities = capabilities; this.realmNotifier = realmNotifier; nativeSetAutoRefresh(nativePtr, capabilities.canDeliverNotification()); }

Target:
private SharedRealm(OsRealmConfig osRealmConfig) { Capabilities capabilities = new AndroidCapabilities(); RealmNotifier realmNotifier = new AndroidRealmNotifier(this, capabilities); this.nativePtr = nativeGetSharedRealm(osRealmConfig.getNativePtr(), realmNotifier); this.osRealmConfig = osRealmConfig; this.schemaInfo = new OsSchemaInfo(nativeGetSchemaInfo(nativePtr), this); this.context = osRealmConfig.getContext(); this.context.addReference(this); this.capabilities = capabilities; this.realmNotifier = realmNotifier; nativeSetAutoRefresh(nativePtr, capabilities.canDeliverNotification()); }
Source:
public void tearDown() throws InterruptedException, ExecutionException, IOException { System.setOut(null); }

Target:
public void tearDown() throws InterruptedException, ExecutionException, IOException { DeleteDataset.deleteDataset(PROJECT_ID, datasetId); System.setOut(null); }
Source:
public JcrRepositoryHandle(JcrResourceAdapter ra, JcrManagedConnectionFactory mcf, ConnectionManager cm) throws ResourceException { System.out.println("Resource adaptor: " + ra); this.mcf = mcf; this.cm = cm; try { this.repository = ra.getRepository(); } catch (Exception e) { throw new ResourceException(e); } }

Target:
public JcrRepositoryHandle(JcrResourceAdapter ra, JcrManagedConnectionFactory mcf, ConnectionManager cm) throws ResourceException { this.mcf = mcf; this.cm = cm; try { this.repository = ra.getRepository(); } catch (Exception e) { throw new ResourceException(e); } }
Source:
private PatchList readPatchList(final PatchListKey key, final Repository repo) throws IOException { final PatchList pList = get(key, repo); if (key.isRebaseTransparent() && key.getOldId() != null) { final ObjectReader reader = repo.newObjectReader(); try { final RevWalk rw = new RevWalk(reader); final RevCommit b = rw.parseCommit(key.getNewId()); final RevCommit a = rw.parseCommit(key.getOldId()); if (Collections.disjoint(Arrays.asList(a.getParents()), Arrays.asList(b.getParents()))) { final Set<String> patchfileList = get( new PatchListKey(key.projectKey, null, key.getNewId(), key.getWhitespace()), repo).toPatchFileList(); patchfileList.addAll(get( new PatchListKey(key.projectKey, null, key.getOldId(), key .getWhitespace()), repo).toPatchFileList()); pList.retainAll(patchfileList); return pList; } } finally { reader.release(); } } return pList; }

Target:
private PatchList readPatchList(final PatchListKey key, final Repository repo) throws IOException { final PatchList pList = get(key, repo); if (key.isRebaseTransparent() && key.getOldId() != null) { final ObjectReader reader = repo.newObjectReader(); try { final RevWalk rw = new RevWalk(reader); final RevCommit b = rw.parseCommit(key.getNewId()); final RevCommit a = rw.parseCommit(key.getOldId()); if (Collections.disjoint(Arrays.asList(a.getParents()), Arrays.asList(b.getParents()))) { final Set<String> patchfileList = get( new PatchListKey(key.projectKey, null, key.getNewId(), key.getWhitespace()), repo).toFileList(); patchfileList.addAll(get( new PatchListKey(key.projectKey, null, key.getOldId(), key .getWhitespace()), repo).toFileList()); return pList.copyBy(patchfileList); } } finally { reader.release(); } } return pList; }
Source:
private static void populateUnresolvedDependencies(@NotNull DataNode<ProjectData> projectInfo, @NotNull Set<String> unresolvedDependencies) { String category = "Unresolved dependencies:"; for (String dep : unresolvedDependencies) { String url = "search" + dep; NotificationHyperlink hyperlink = new SearchInBuildFilesHyperlink(url, "Search", dep); projectInfo.createChild(AndroidProjectKeys.IMPORT_EVENT_MSG, new ProjectImportEventMessage(category, dep, hyperlink)); } }

Target:
private static void populateUnresolvedDependencies(@NotNull DataNode<ProjectData> projectInfo, @NotNull Set<String> unresolvedDependencies) { String category = "Unresolved dependencies:"; for (String dep : unresolvedDependencies) { String url = "search:" + dep; NotificationHyperlink hyperlink = new SearchInBuildFilesHyperlink(url, "Search", dep); projectInfo.createChild(AndroidProjectKeys.IMPORT_EVENT_MSG, new ProjectImportEventMessage(category, dep, hyperlink)); } }
Source:
public void getFieldByLanguage(String barcode, ArrayList<String> fields, final OnFieldByLanguageCallback fieldByLanguageCallback) { StringBuilder fieldQuery = new StringBuilder(); for (String s : fields) { fieldQuery.append(s); fieldQuery.append(","); } apiService.getFieldByLangCode(barcode, fieldQuery.toString()).enqueue(new Callback<JsonNode>() { @Override public void onResponse(Call<JsonNode> call, Response<JsonNode> response) { JsonNode responseNode = response.body(); HashMap<String,String> resultMap = new HashMap<>(); for (String field : fields) { if (responseNode.findValue("product").findValue(field) != null && (!responseNode.findValue("product").findValue(field).toString().equals(""))) { String value = responseNode.findValue("product").findValue(field).toString(); resultMap.put(field, value); } else { resultMap.put(field, null); } } fieldByLanguageCallback.onFieldByLanguageResponse(true,resultMap); } @Override public void onFailure(Call<JsonNode> call, Throwable t) { fieldByLanguageCallback.onFieldByLanguageResponse(false,null); } }); }

Target:
public void getFieldByLanguage(String barcode, ArrayList<String> fields, final OnFieldByLanguageCallback fieldByLanguageCallback) { StringBuilder fieldQuery = new StringBuilder(); for (String s : fields) { fieldQuery.append(s); fieldQuery.append(","); } apiService.getFieldByLangCode(barcode, fieldQuery.toString()).enqueue(new Callback<JsonNode>() { @Override public void onResponse(Call<JsonNode> call, Response<JsonNode> response) { JsonNode responseNode = response.body(); if (responseNode != null) { HashMap<String, String> resultMap = new HashMap<>(); for (String field : fields) { if (responseNode.findValue("product").findValue(field) != null && (!responseNode.findValue("product").findValue(field).toString().equals(""))) { String value = responseNode.findValue("product").findValue(field).toString(); resultMap.put(field, value); } else { resultMap.put(field, null); } } fieldByLanguageCallback.onFieldByLanguageResponse(true, resultMap); } } @Override public void onFailure(Call<JsonNode> call, Throwable t) { fieldByLanguageCallback.onFieldByLanguageResponse(false, null); } }); }
Source:
public DefaultNode(InetSocketAddress connectAddress, InternalDriverContext context) { this.connectAddress = connectAddress; this.metricUpdater = context.metricUpdaterFactory().newNodeUpdater(this); this.state = NodeState.UNKNOWN; this.distance = NodeDistance.IGNORED; this.rawTokens = Collections.emptySet(); this.extras = Collections.emptyMap(); }

Target:
public DefaultNode(InetSocketAddress connectAddress, InternalDriverContext context) { this.connectAddress = connectAddress; this.state = NodeState.UNKNOWN; this.distance = NodeDistance.IGNORED; this.rawTokens = Collections.emptySet(); this.extras = Collections.emptyMap(); this.metricUpdater = context.metricUpdaterFactory().newNodeUpdater(this); }
Source:
public void convertToIndexUpdatesAndApply( Iterable<NodeUpdates> updates, IndexUpdateMode updateMode ) throws IOException, IndexEntryConflictException { final List<IndexEntryUpdate<LabelSchemaDescriptor>> indexUpdates = new ArrayList<>(); for ( NodeUpdates nodeUpdate : updates ) { for ( IndexEntryUpdate<LabelSchemaDescriptor> indexUpdate : convertToIndexUpdates( nodeUpdate ) ) { indexUpdates.add( indexUpdate ); } } apply( indexUpdates, updateMode ); }

Target:
public void convertToIndexUpdatesAndApply( Iterable<NodeUpdates> updates, IndexUpdateMode updateMode ) throws IOException, IndexEntryConflictException { apply( Iterables.flatMap( this::convertToIndexUpdates, updates ), updateMode ); }
Source:
public void doRouteStatusChange(DocumentHeader header) { super.doRouteStatusChange(header); VendorDetail vendorDetail = (VendorDetail) getBusinessObject(); WorkflowDocument workflowDoc = header.getWorkflowDocument(); boolean isExistingNewVendor = getPaymentWorksVendorService().isExistingPaymentWorksVendorByDocumentNumber(this.getDocumentNumber()); if (workflowDoc.isFinal()) { processFinalizedWorkflowDocument(vendorDetail, isExistingNewVendor); } else if (workflowDoc.isDisapproved()) { if (StringUtils.equals(KFSConstants.MAINTENANCE_NEW_ACTION, this.getMaintenanceAction())) { if (isExistingNewVendor) { LOG.info("Updating new vendor request to vendor disapproved for document number: " + this.getDocumentNumber()); getPaymentWorksVendorService().updatePaymentWorksVendorProcessStatusByDocumentNumber(this.getDocumentNumber(), PaymentWorksConstants.ProcessStatus.VENDOR_DISAPPROVED); } } } }

Target:
public void doRouteStatusChange(DocumentHeader header) { super.doRouteStatusChange(header); VendorDetail vendorDetail = (VendorDetail) getBusinessObject(); WorkflowDocument workflowDoc = header.getWorkflowDocument(); boolean existingPaymentWorksVendor = getPaymentWorksVendorService().isExistingPaymentWorksVendorByDocumentNumber(this.getDocumentNumber()); if (workflowDoc.isProcessed()) { updatePaymentWorks(vendorDetail, existingPaymentWorksVendor); } else if (workflowDoc.isDisapproved()) { if (StringUtils.equals(KFSConstants.MAINTENANCE_NEW_ACTION, this.getMaintenanceAction())) { if (existingPaymentWorksVendor) { LOG.debug("Updating new vendor request to vendor disapproved for document number: " + this.getDocumentNumber()); getPaymentWorksVendorService().updatePaymentWorksVendorProcessStatusByDocumentNumber(this.getDocumentNumber(), PaymentWorksConstants.ProcessStatus.VENDOR_DISAPPROVED); } } } }
Source:
public void testSerialization () throws IOException { DeltaLengthByteArrayValuesWriter writer = new DeltaLengthByteArrayValuesWriter(64 * 1024, 64 * 1024, new DirectByteBufferAllocator()); DeltaLengthByteArrayValuesReader reader = new DeltaLengthByteArrayValuesReader(); Utils.writeData(writer, values); Binary[] bin = Utils.readData(reader, writer.getBytes().toByteArray(), values.length); for(int i =0; i< bin.length ; i++) { Assert.assertEquals(Binary.fromString(values[i]).toStringUsingUTF8(), bin[i].toStringUsingUTF8()); } }

Target:
public void testSerialization () throws IOException { DeltaLengthByteArrayValuesWriter writer = getDeltaLengthByteArrayValuesWriter(); DeltaLengthByteArrayValuesReader reader = new DeltaLengthByteArrayValuesReader(); Utils.writeData(writer, values); Binary[] bin = Utils.readData(reader, writer.getBytes().toByteArray(), values.length); for(int i =0; i< bin.length ; i++) { Assert.assertEquals(Binary.fromString(values[i]), bin[i]); } }
Source:
String toDMNString(final String years, final String months) { final YearsMonthsValue value = new YearsMonthsValue(); value.setYears(years); value.setMonths(months); return toDMNString(value); }

Target:
public String toDMNString(final String years, final String months) { final YearsMonthsValue value = new YearsMonthsValue(); value.setYears(years); value.setMonths(months); return toDMNString(value); }
Source:
public void update(Observable arg0, Object argN) { if (arg0 != player) { return; } final String arg1 = OoyalaNotification.getNameOrUnknown(argN); if (arg1 == OoyalaPlayer.TIME_CHANGED_NOTIFICATION_NAME) { return; } if (arg1 == OoyalaPlayer.ERROR_NOTIFICATION_NAME) { final String msg = "Error Event Received"; if (player != null && player.getError() != null) { Log.e(TAG, msg, player.getError()); } else { Log.e(TAG, msg); } return; } String text = "Notification Received: " + arg1 + " - state: " + player.getState(); log.writeToSdcardLog(text); Log.d(TAG, text); }

Target:
public void update(Observable arg0, Object argN) { if (arg0 != player) { return; } final String arg1 = OoyalaNotification.getNameOrUnknown(argN); if (arg1 == OoyalaPlayer.TIME_CHANGED_NOTIFICATION_NAME) { return; } if (arg1 == OoyalaPlayer.ERROR_NOTIFICATION_NAME) { final String msg = "Error Event Received"; if (player != null && player.getError() != null) { Log.e(TAG, msg, player.getError()); } else { Log.e(TAG, msg); } return; } String text = "Notification Received: " + arg1 + " - state: " + player.getState(); Log.d(TAG, text); if (writePermission) { log.writeToSdcardLog(text); } }
Source:
protected ResourceBundle getPluginResourceBundle() { Bundle bundle = FrameworkUtil.getBundle(PDETemplateSection.class); return Platform.getResourceBundle(bundle); }

Target:
protected ResourceBundle getPluginResourceBundle() { return Platform.getResourceBundle(bundle); }
Source:
public void addEvictedInstance(WorkflowExecutionContext context) throws FalconException { final String outputFeedPaths = context.getOutputFeedInstancePaths(); if (IGNORE.equals(outputFeedPaths)) { LOG.info("There were no evicted instances, nothing to record"); return; } LOG.info("Recording lineage for evicted instances {}", outputFeedPaths); String feedName = context.getOutputFeedNames(); String[] evictedFeedInstancePathList = context.getOutputFeedInstancePathsList(); String clusterName = context.getClusterName(); for (String evictedFeedInstancePath : evictedFeedInstancePathList) { LOG.info("Computing feed instance for : name= {}, path={}, in cluster: {}", feedName, evictedFeedInstancePath, clusterName); String feedInstanceName = getFeedInstanceName(feedName, clusterName, evictedFeedInstancePath, context.getNominalTimeAsISO8601()); Vertex feedInstanceVertex = addFeedInstance( feedInstanceName, context, feedName, clusterName); Map<RelationshipProperty, String> properties = new HashMap<RelationshipProperty, String>(); properties.put(RelationshipProperty.TIMESTAMP, context.getTimeStampAsISO8601()); addInstanceToEntity(feedInstanceVertex, clusterName, RelationshipType.CLUSTER_ENTITY, RelationshipLabel.FEED_CLUSTER_EVICTED_EDGE, properties); } }

Target:
public void addEvictedInstance(WorkflowExecutionContext context) throws FalconException { final String outputFeedPaths = context.getOutputFeedInstancePaths(); if (IGNORE.equals(outputFeedPaths)) { LOG.info("There were no evicted instances, nothing to record"); return; } LOG.info("Recording lineage for evicted instances {}", outputFeedPaths); String feedName = context.getOutputFeedNames(); String[] evictedFeedInstancePathList = context.getOutputFeedInstancePathsList(); String clusterName = context.getClusterName(); for (String evictedFeedInstancePath : evictedFeedInstancePathList) { LOG.info("Computing feed instance for : name= {}, path={}, in cluster: {}", feedName, evictedFeedInstancePath, clusterName); String feedInstanceName = getFeedInstanceName(feedName, clusterName, evictedFeedInstancePath, context.getNominalTimeAsISO8601()); Vertex feedInstanceVertex = addFeedInstance( feedInstanceName, context, feedName, clusterName); Map<RelationshipProperty, String> properties = edgePropertiesForIndexing(context); properties.put(RelationshipProperty.TIMESTAMP, context.getTimeStampAsISO8601()); addInstanceToEntity(feedInstanceVertex, clusterName, RelationshipType.CLUSTER_ENTITY, RelationshipLabel.FEED_CLUSTER_EVICTED_EDGE, properties); } }
Source:
public void copyShellFile(TarArchiveOutputStream tarOutputStream) throws IOException { ResourcePatternResolver resolver = new PathMatchingResourcePatternResolver(); Resource[] resources = resolver.getResources(getShellScriptsPath()); InputStream shellFileIs; byte[] shellFileBytes; for (Resource resource : resources) { shellFileIs = resource.getInputStream(); shellFileBytes = IOUtils.toByteArray(shellFileIs); IOUtils.closeQuietly(shellFileIs); addByteToTar(tarOutputStream, shellFileBytes, getBasePath() + FilenameUtils.getName(resource.getFilename()), shellFileBytes.length, EXEC); } }

Target:
public void copyShellFile(TarArchiveOutputStream tarOutputStream) throws IOException { ResourcePatternResolver resolver = new PathMatchingResourcePatternResolver(); Resource[] resources = resolver.getResources(getShellScriptsPath()); byte[] shellFileBytes; for (Resource resource : resources) { try (InputStream shellFileIs = resource.getInputStream()) { shellFileBytes = IOUtils.toByteArray(shellFileIs); addByteToTar(tarOutputStream, shellFileBytes, getBasePath() + FilenameUtils.getName(resource.getFilename()), shellFileBytes.length, EXEC); } } }
Source:
protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) { if (!DumpUtils.checkDumpAndUsageStatsPermission(mContext, TAG, pw)) { return; } boolean protoFormat = hasOption(args, "--proto"); ProtoOutputStream proto = null; CoreLibrary.DebugInfo coreLibraryDebugInfo = CoreLibrary.getDebugInfo(); addTimeZoneApkDebugInfo(coreLibraryDebugInfo); if (protoFormat) { proto = new ProtoOutputStream(fd); reportTimeZoneInfoProto(coreLibraryDebugInfo, proto); } else { reportTimeZoneInfo(coreLibraryDebugInfo, pw); } if (protoFormat) { proto.flush(); } }

Target:
protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) { if (!DumpUtils.checkDumpAndUsageStatsPermission(mContext, TAG, pw)) { return; } boolean protoFormat = hasOption(args, "--proto"); ProtoOutputStream proto = null; DebugInfo coreLibraryDebugInfo = CoreLibraryDebug.getDebugInfo(); addTimeZoneApkDebugInfo(coreLibraryDebugInfo); if (protoFormat) { proto = new ProtoOutputStream(fd); reportTimeZoneInfoProto(coreLibraryDebugInfo, proto); } else { reportTimeZoneInfo(coreLibraryDebugInfo, pw); } if (protoFormat) { proto.flush(); } }
Source:
public NotificationListener listenBucketNotification(String bucketName, String prefix, String suffix, String[] events) throws IOException, InvalidKeyException, NoSuchAlgorithmException, InsufficientDataException, InvalidResponseException, InternalException, NoResponseException, InvalidBucketNameException, XmlPullParserException, ErrorResponseException { Multimap<String, String> queryParamMap = HashMultimap.create(); queryParamMap.put("prefix", prefix); queryParamMap.put("suffix", suffix); for (String event : events) { queryParamMap.put("events", event); } HttpResponse response = executeReq(Method.GET, getRegion(bucketName), bucketName, "", null, queryParamMap, null, 0); return new NotificationListener(response.body().charStream()); }

Target:
public CloseableIterator<Result<NotificationInfo>> listenBucketNotification(String bucketName, String prefix, String suffix, String[] events) throws IOException, InvalidKeyException, NoSuchAlgorithmException, InsufficientDataException, InvalidResponseException, InternalException, NoResponseException, InvalidBucketNameException, XmlPullParserException, ErrorResponseException { Multimap<String, String> queryParamMap = HashMultimap.create(); queryParamMap.put("prefix", prefix); queryParamMap.put("suffix", suffix); for (String event : events) { queryParamMap.put("events", event); } HttpResponse response = executeReq(Method.GET, getRegion(bucketName), bucketName, "", null, queryParamMap, null, 0); return new CloseableIterator<Result<NotificationInfo>>() { Scanner scanner = new Scanner(response.body().charStream()).useDelimiter("\n"); String notificationString = null; ObjectMapper mapper = new ObjectMapper(); NotificationInfo notificationInfo = null; boolean isClosed = false; @Override public void close() throws IOException { if (!isClosed) { try { response.body().close(); scanner.close(); } finally { isClosed = true; } } } public boolean populate() { if (isClosed) { return false; } if (notificationString != null) { return true; } while (scanner.hasNext()) { notificationString = scanner.next().trim(); if ( !notificationString.equals("")) { break; } } if (notificationString == null || notificationString.equals("")) { try { close(); } catch (IOException e) { isClosed = true; } return false; } return true; } @Override public boolean hasNext() { return populate(); } @Override public Result<NotificationInfo> next() { if (isClosed) { throw new NoSuchElementException(); } if ((notificationString == null || notificationString.equals("")) && !populate() ) { throw new NoSuchElementException(); } try { notificationInfo = mapper.readValue(notificationString, NotificationInfo.class); return new Result<>(notificationInfo, null); } catch (JsonParseException e) { return new Result<>(null, e); } catch ( JsonMappingException e) { return new Result<>(null, e); } catch ( IOException e) { return new Result<>(null, e); } finally { notificationInfo = null; } } }; }
Source:
protected SCMRevision retrieve(@NonNull String thingName, @NonNull TaskListener listener) throws IOException, InterruptedException { MercurialInstallation inst = MercurialSCM.findInstallation(installation); if (inst == null) { listener.error("No configured Mercurial installation"); return null; } if (!inst.isUseCaches()) { listener.error("Mercurial installation " + installation + " does not support caches"); return null; } final Node node = Jenkins.getInstance(); if (node == null) { listener.error("Cannot retrieve the Jenkins master node"); return null; } Launcher launcher = node.createLauncher(listener); StandardUsernameCredentials credentials = getCredentials(); final FilePath cache = Cache.fromURL(source, credentials, inst.getMasterCacheRoot()).repositoryCache(inst, node, launcher, listener, true); if (cache == null) { listener.error("Could not use caches, not fetching branch heads"); return null; } final HgExe hg = new HgExe(inst, credentials, launcher, node, listener, new EnvVars()); try { String revision = hg.popen(cache, listener, true, new ArgumentListBuilder("id", "-r", thingName, "--id", "--branch")); String hash = revision.substring(0, revision.indexOf(' ')); String branch = revision.substring(revision.indexOf(' ')+1, revision.length()-1); return new MercurialRevision(new SCMHead(branch), hash); } finally { hg.close(); } }

Target:
protected SCMRevision retrieve(@NonNull String thingName, @NonNull TaskListener listener) throws IOException, InterruptedException { MercurialInstallation inst = MercurialSCM.findInstallation(installation); if (inst == null) { listener.error("No configured Mercurial installation"); return null; } if (!inst.isUseCaches()) { listener.error("Mercurial installation " + installation + " does not support caches"); return null; } final Node node = Jenkins.getActiveInstance(); Launcher launcher = node.createLauncher(listener); StandardUsernameCredentials credentials = getCredentials(); final FilePath cache = Cache.fromURL(source, credentials, inst.getMasterCacheRoot()).repositoryCache(inst, node, launcher, listener, true); if (cache == null) { listener.error("Could not use caches, not fetching branch heads"); return null; } final HgExe hg = new HgExe(inst, credentials, launcher, node, listener, new EnvVars()); try { String revision = hg.popen(cache, listener, true, new ArgumentListBuilder("log", "-r", "present("+thingName+")", "--template", "{node} {branch}")); if (revision.isEmpty()){ return null; } String hash = revision.substring(0, revision.indexOf(' ')); String branch = revision.substring(revision.indexOf(' ')+1, revision.length()); return new MercurialRevision(new SCMHead(branch), hash); } finally { hg.close(); } }
Source:
public int compareTo(BenchmarkResult benchmarkResult) { int cmp = type.index - benchmarkResult.type.index; if (cmp == 0) { long delta = this.time - benchmarkResult.time; if (delta > 0) { cmp = 1; } else if (delta < 0) { cmp = -1; } else { cmp = 0; } } return cmp; }

Target:
public int compareTo(BenchmarkResult benchmarkResult) { int cmp = Integer.compare(type.index, benchmarkResult.type.index); if (cmp == 0) { cmp = Long.compare(this.time, benchmarkResult.time); } return cmp; }
Source:
public String getItemsDescription(PurchaseRequest request){ String itemName = ""; ArrayList<PurchaseItem> items = request.getPurchaseList(); if(items.size() == 1) { return itemName + items.get(0).getItemName(); } else { itemName = items.get(0).getItemName(); for (int i = 1; i <= 3;i++){ if(i < items.size()){ itemName = itemName + ", " + items.get(i).getItemName(); } } if(items.size() > 3){ itemName += itemName + "..."; } return itemName; } }

Target:
public String getItemsDescription(PurchaseRequest request){ int limit = 3; ArrayList<PurchaseItem> items = request.getPurchaseList(); String itemName = items.get(0).getItemName(); for (int i = 1; i <= limit ;i++){ if(i < items.size()){ itemName = itemName + ", " + items.get(i).getItemName(); } } if(items.size() > limit ){ itemName += "..."; } return itemName; }
Source:
public void optimize(TupleExpr tupleExpr, Dataset dataset, BindingSet bindings) { if (conf instanceof MongoDBRdfConfiguration) { MongoDBRdfConfiguration mongoConf = (MongoDBRdfConfiguration) conf; SparqlToPipelineTransformVisitor pipelineVisitor = new SparqlToPipelineTransformVisitor(mongoConf); try { tupleExpr.visit(pipelineVisitor); } catch (Exception e) { logger.error("Error attempting to transform query using the aggregation pipeline", e); } } }

Target:
public void optimize(TupleExpr tupleExpr, Dataset dataset, BindingSet bindings) { SparqlToPipelineTransformVisitor pipelineVisitor = new SparqlToPipelineTransformVisitor(conf); try { tupleExpr.visit(pipelineVisitor); } catch (Exception e) { logger.error("Error attempting to transform query using the aggregation pipeline", e); } }
Source:
public void setStarred(TaskRepository taskRepository, String taskID, boolean starred) throws CoreException { GerritClient client = getClient(taskRepository); SaveStarredRequest saveStarRequest = new SaveStarredRequest(taskRepository, taskID, starred); try { client.saveStarred(saveStarRequest.getReviewId(), starred, null); } catch (GerritException e) { Status status = new Status(IStatus.ERROR, GerritCorePlugin.PLUGIN_ID, "Unable to set the starred, received", e); throw new CoreException(status); } }

Target:
public void setStarred(TaskRepository taskRepository, String taskID, boolean starred) throws CoreException { GerritClient client = getClient(taskRepository); SaveStarredRequest saveStarRequest = new SaveStarredRequest(taskRepository, taskID, starred); try { client.setStarred(saveStarRequest.getReviewId(), starred, null); } catch (GerritException e) { Status status = new Status(IStatus.ERROR, GerritCorePlugin.PLUGIN_ID, "Unable to set the starred, received", e); throw new CoreException(status); } }
Source:
public boolean isClosed() { final Status currentStatus = this.updateAndGetStatus(); return currentStatus == Status.CLOSED; }

Target:
public boolean isClosed() { final Status currentStatus = this.updateAndGetStatus(); return currentStatus != Status.OPEN; }
Source:
protected void initQualifiers(Set<Annotation> qualifiers) { if (qualifiers.isEmpty()) { this.qualifiers = DEFAULT_QUALIFIERS; } else { Set<Annotation> normalizedQualifiers = new HashSet<Annotation>(qualifiers.size() + 2); if (qualifiers.size() == 1) { if (qualifiers.iterator().next().annotationType().equals(Named.class)) { normalizedQualifiers.add(DefaultLiteral.INSTANCE); } } normalizedQualifiers.addAll(qualifiers); normalizedQualifiers.add(AnyLiteral.INSTANCE); if (name != null && normalizedQualifiers.remove(NamedLiteral.DEFAULT)) { normalizedQualifiers.add(new NamedLiteral(name)); } this.qualifiers = SharedObjectCache.instance(manager).getSharedSet(normalizedQualifiers); } }

Target:
protected void initQualifiers(Set<Annotation> qualifiers) { if (qualifiers.isEmpty()) { this.qualifiers = DEFAULT_QUALIFIERS; } else { ImmutableSet.Builder<Annotation> normalizedQualifiers = ImmutableSet.builder(); if (qualifiers.size() == 1 && qualifiers.iterator().next().annotationType().equals(Named.class)) { normalizedQualifiers.add(DefaultLiteral.INSTANCE); } for (Annotation annotation : qualifiers) { if (name != null && annotation.equals(NamedLiteral.DEFAULT)) { normalizedQualifiers.add(new NamedLiteral(name)); } else { normalizedQualifiers.add(annotation); } } normalizedQualifiers.add(AnyLiteral.INSTANCE); this.qualifiers = SharedObjectCache.instance(manager).getSharedSet(normalizedQualifiers.build()); } }
Source:
public WebServer(Config config) { initServer(config); ServletContextHandler servletHandler = new ServletContextHandler(ServletContextHandler.SESSIONS); int sessionTimeout = config.getInteger("web.sessionTimeout"); if (sessionTimeout > 0) { servletHandler.getSessionHandler().setMaxInactiveInterval(sessionTimeout); } initApi(config, servletHandler); if (config.getBoolean("web.console")) { servletHandler.addServlet(new ServletHolder(new ConsoleServlet()), "/console/*"); } initWebApp(config, servletHandler); servletHandler.setErrorHandler(new ErrorHandler() { @Override protected void handleErrorPage( HttpServletRequest request, Writer writer, int code, String message) throws IOException { writer.write("<!DOCTYPE<html><head><title>Error</title></head><html><body>" + code + " - " + HttpStatus.getMessage(code) + "</body></html>"); } }); HandlerList handlers = new HandlerList(); initClientProxy(config, handlers); handlers.addHandler(servletHandler); GzipHandler gzipHandler = new GzipHandler(); gzipHandler.setHandler(handlers); server.setHandler(gzipHandler); }

Target:
public WebServer(Config config) { initServer(config); ServletContextHandler servletHandler = new ServletContextHandler(ServletContextHandler.SESSIONS); int sessionTimeout = config.getInteger("web.sessionTimeout"); if (sessionTimeout > 0) { servletHandler.getSessionHandler().setMaxInactiveInterval(sessionTimeout); } initApi(config, servletHandler); if (config.getBoolean("web.console")) { servletHandler.addServlet(new ServletHolder(new ConsoleServlet()), "/console/*"); } initWebApp(config, servletHandler); servletHandler.setErrorHandler(new ErrorHandler() { @Override protected void handleErrorPage( HttpServletRequest request, Writer writer, int code, String message) throws IOException { writer.write("<!DOCTYPE<html><head><title>Error</title></head><html><body>" + code + " - " + HttpStatus.getMessage(code) + "</body></html>"); } }); HandlerList handlers = new HandlerList(); initClientProxy(config, handlers); handlers.addHandler(servletHandler); handlers.addHandler(new GzipHandler()); server.setHandler(handlers); }
Source:
public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null || getClass() != obj.getClass()) { return false; } if (!super.equals(obj)) { return false; } final Tag other = (Tag)obj; return Objects.equals(this.getId(), other.getId()) && Objects.equals(this.lastBuilt, other.lastBuilt); }

Target:
public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null || getClass() != obj.getClass()) { return false; } if (!super.equals(obj)) { return false; } final Tag other = (Tag)obj; return Objects.equals(this.getId(), other.getId()); }
Source:
public abstract @Nullable PcapPacket parseNextPacket() throws IOException, BadPcapFileException, BadPacketException; public abstract void skipNextPacket() throws IOException, BadPcapFileException; public abstract void seekPacket(long rank) throws IOException, BadPcapFileException; public synchronized long getTotalNbPackets() throws IOException, BadPcapFileException { if (fTotalNumberPackets == -1) { long rank = fCurrentRank; fCurrentRank = fFileIndex.floorKey(rank); while (hasNextPacket()) { skipNextPacket(); } fTotalNumberPackets = fCurrentRank; fCurrentRank = rank; seekPacket(rank); } return fTotalNumberPackets; }

Target:
public abstract @Nullable PcapPacket parseNextPacket() throws IOException, BadPcapFileException, BadPacketException; public abstract void skipNextPacket() throws IOException, BadPcapFileException; public abstract void seekPacket(long rank) throws IOException, BadPcapFileException; public abstract PcapTimestampScale getTimestampPrecision(); public synchronized long getTotalNbPackets() throws IOException, BadPcapFileException { if (fTotalNumberPackets == -1) { long rank = fCurrentRank; fCurrentRank = fFileIndex.floorKey(rank); while (hasNextPacket()) { skipNextPacket(); } fTotalNumberPackets = fCurrentRank; fCurrentRank = rank; seekPacket(rank); } return fTotalNumberPackets; }
Source:
public void unlock() { if (!this.localLock.isHeldByCurrentThread()) { throw new IllegalStateException("You do not own lock at " + this.lockKey); } if (this.localLock.getHoldCount() > 1) { this.localLock.unlock(); return; } try { if (!isAcquiredInThisProcess()) { throw new IllegalStateException("Lock was released in the store due to expiration."); } if (Thread.currentThread().isInterrupted()) { RedisLockRegistry.this.executor.execute(this::removeLockKey); } else { removeLockKey(); } if (logger.isDebugEnabled()) { logger.debug("Released lock; " + this); } } catch (Exception e) { ReflectionUtils.rethrowRuntimeException(e); } finally { this.localLock.unlock(); } }

Target:
public void unlock() { if (!this.localLock.isHeldByCurrentThread()) { throw new IllegalStateException("You do not own lock at " + this.lockKey); } if (this.localLock.getHoldCount() > 1) { this.localLock.unlock(); return; } try { if (!isAcquiredInThisProcess()) { throw new IllegalStateException("Lock was released in the store due to expiration. " + "The integrity of data protected by this lock may have been compromised."); } if (Thread.currentThread().isInterrupted()) { RedisLockRegistry.this.executor.execute(this::removeLockKey); } else { removeLockKey(); } if (logger.isDebugEnabled()) { logger.debug("Released lock; " + this); } } catch (Exception e) { ReflectionUtils.rethrowRuntimeException(e); } finally { this.localLock.unlock(); } }
Source:
private void startMapCameraSpinningAnimation(@NonNull final LatLng mapCameraTargetLocation) { animator = ValueAnimator.ofFloat(0, DESIRED_NUM_OF_SPINS * 360); animator.setDuration( DESIRED_NUM_OF_SPINS * DESIRED_SECONDS_PER_ONE_FULL_360_SPIN * 1000); animator.setInterpolator(new LinearInterpolator()); animator.setStartDelay(1000); animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator valueAnimator) { Float newBearingValue = (Float) valueAnimator.getAnimatedValue(); mapboxMap.animateCamera(CameraUpdateFactory .newCameraPosition(new CameraPosition.Builder() .target(new LatLng(mapCameraTargetLocation.getLatitude(), mapCameraTargetLocation.getLongitude())) .bearing(newBearingValue) .build())); } }); animator.start(); }

Target:
private void startMapCameraSpinningAnimation(@NonNull final LatLng mapCameraTargetLocation) { if (animator != null) { animator.cancel(); } animator = ValueAnimator.ofFloat(0, DESIRED_NUM_OF_SPINS * 360); animator.setDuration( DESIRED_NUM_OF_SPINS * DESIRED_SECONDS_PER_ONE_FULL_360_SPIN * 1000); animator.setInterpolator(new LinearInterpolator()); animator.setStartDelay(1000); animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator valueAnimator) { Float newBearingValue = (Float) valueAnimator.getAnimatedValue(); mapboxMap.moveCamera(CameraUpdateFactory .newCameraPosition(new CameraPosition.Builder() .target(new LatLng(mapCameraTargetLocation.getLatitude(), mapCameraTargetLocation.getLongitude())) .bearing(newBearingValue) .build())); } }); animator.start(); }