auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void getContents() throws IOException, SignatureException, URISyntaxException, XmlProcessingException, InterruptedException { final String bucketName = "test_get_contents"; try { client.putBucket(new PutBucketRequest(bucketName)); loadBookTestData(client, bucketName); final Ds3ClientHelpers helpers = Ds3ClientHelpers.wrap(client); final Ds3ClientHelpers.Job job = helpers.startReadAllJob(bucketName); final UUID jobId = job.getJobId(); job.transfer(new Ds3ClientHelpers.ObjectChannelBuilder() { @Override public SeekableByteChannel buildChannel(final String key) throws IOException { final Path filePath = Files.createTempFile("ds3", key); return Files.newByteChannel(filePath, StandardOpenOption.DELETE_ON_CLOSE, StandardOpenOption.WRITE); } }); final JobStatus expectedJobStatus = JobStatus.COMPLETED; assertThat(JobStatusHelper.getJobStatusWithRetries(client, jobId, expectedJobStatus), is(JobStatus.COMPLETED)); } finally { deleteAllContents(client, bucketName); } }

Target:
public void getContents() throws IOException, SignatureException, URISyntaxException, XmlProcessingException, InterruptedException { final String bucketName = "test_get_contents"; try { client.putBucket(new PutBucketRequest(bucketName)); loadBookTestData(client, bucketName); final Ds3ClientHelpers helpers = Ds3ClientHelpers.wrap(client); final Ds3ClientHelpers.Job job = helpers.startReadAllJob(bucketName); final UUID jobId = job.getJobId(); job.transfer(new Ds3ClientHelpers.ObjectChannelBuilder() { @Override public SeekableByteChannel buildChannel(final String key) throws IOException { final Path filePath = Files.createTempFile("ds3", key); return Files.newByteChannel(filePath, StandardOpenOption.DELETE_ON_CLOSE, StandardOpenOption.WRITE); } }); assertThat(JobStatusHelper.getJobStatusWithRetries(client, jobId, JobStatus.COMPLETED), is(JobStatus.COMPLETED)); } finally { deleteAllContents(client, bucketName); } }
Source:
public void removeServiceProviders() throws Exception { NewOperator operator = newOperator().build(); Object operID = operRepository.create(operator); NewServiceProvider newSP = newServiceProvider().build(); Object spID = providerRepository.create(newSP); List<ID> spIDs = Lists.newArrayList(new ID(spID)); operRepository.assignServiceProviders(new ID(operID), spIDs); operRepository.removeServiceProviders(new ID(operID), spIDs); List<ServiceProvider> got = operRepository.findServiceProviders(new ID(operID)); List<ServiceProvider> want = Lists.newArrayList(); assertThat(got, deepEquals(want)); }

Target:
public void removeServiceProviders() throws Exception { NewOperator operator = newOperator().build(); Object operID = operRepository.create(operator); NewServiceProvider newSP = newServiceProvider().build(); Object spID = providerRepository.create(newSP); List<ID> spIDs = Lists.newArrayList(new ID(spID)); operRepository.assignServiceProviders(new ID(operID), spIDs); operRepository.removeServiceProviders(new ID(operID), spIDs); List<ServiceProvider> got = operRepository.findServiceProviders(new ID(operID)); assertTrue(got.isEmpty()); }
Source:
public List<AuditEvent> resolveVirtualAttributeValueChange(PerunSessionImpl sess, AuditEvent message) throws InternalErrorException, AttributeNotExistsException, WrongAttributeAssignmentException { List<AuditEvent> resolvingMessages = new ArrayList<>(); if (message == null) return resolvingMessages; User user = null; try { if (message instanceof UserExtSourceAddedToUser) { user = ((UserExtSourceAddedToUser) message).getUser(); sess.getPerunBl().getUsersManagerBl().checkUserExists(sess, user); resolvingMessages.add(resolveEvent(sess, user)); } else if (message instanceof UserExtSourceRemovedFromUser) { user = ((UserExtSourceRemovedFromUser) message).getUser(); sess.getPerunBl().getUsersManagerBl().checkUserExists(sess, user); resolvingMessages.add(resolveEvent(sess, user)); } else if (message instanceof UserExtSourceUpdated) { resolvingMessages.add(resolveEvent(sess, sess.getPerunBl().getUsersManagerBl().getUserById( sess, ((UserExtSourceUpdated) message).getUserExtSource().getUserId()))); } } catch (UserNotExistsException e) { throw new ConsistencyErrorException("User "+user+" associated with "+message.getName()+" event no longer exists while resolving virtual attribute value change for LoA.", e); } return resolvingMessages; }

Target:
public List<AuditEvent> resolveVirtualAttributeValueChange(PerunSessionImpl sess, AuditEvent message) throws InternalErrorException, AttributeNotExistsException, WrongAttributeAssignmentException { List<AuditEvent> resolvingMessages = new ArrayList<>(); if (message == null) return resolvingMessages; User user = null; try { if (message instanceof UserExtSourceAddedToUser) { user = ((UserExtSourceAddedToUser) message).getUser(); sess.getPerunBl().getUsersManagerBl().checkUserExists(sess, user); resolvingMessages.add(resolveEvent(sess, user)); } else if (message instanceof UserExtSourceRemovedFromUser) { user = ((UserExtSourceRemovedFromUser) message).getUser(); sess.getPerunBl().getUsersManagerBl().checkUserExists(sess, user); resolvingMessages.add(resolveEvent(sess, user)); } else if (message instanceof UserExtSourceUpdated) { resolvingMessages.add(resolveEvent(sess, sess.getPerunBl().getUsersManagerBl().getUserById( sess, ((UserExtSourceUpdated) message).getUserExtSource().getUserId()))); } } catch (UserNotExistsException e) { log.warn("User associated with event no longer exists while resolving virtual attribute value change for LoA.", user, message.getName()); } return resolvingMessages; }
Source:
public Map<Long, Long> get(Iterable<Long> startTimestamps) { Map<T, List<Long>> queryMap = StreamSupport.stream(startTimestamps.spliterator(), false) .collect(Collectors.groupingBy(timestampToServiceKey)); Set<T> extraKeys = Sets.difference(queryMap.keySet(), keyedServices.keySet()); if (!extraKeys.isEmpty()) { throw new SafeIllegalStateException("A batch of timestamps produced some transaction service keys which" + " are unknown: {}. Known transaction service keys were {}.", SafeArg.of("timestamps", startTimestamps), SafeArg.of("extraKeys", extraKeys), SafeArg.of("knownServiceKeys", keyedServices.keySet())); } return queryMap.entrySet() .stream() .map(entry -> keyedServices.get(entry.getKey()).get(entry.getValue())) .flatMap(longLongMap -> longLongMap.entrySet().stream()) .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)); }

Target:
public Map<Long, Long> get(Iterable<Long> startTimestamps) { Map<T, List<Long>> queryMap = StreamSupport.stream(startTimestamps.spliterator(), false) .collect(Collectors.groupingBy(timestampToServiceKey)); Set<T> unknownKeys = Sets.difference(queryMap.keySet(), keyedServices.keySet()); if (!unknownKeys.isEmpty()) { throw new SafeIllegalStateException("A batch of timestamps produced some transaction service keys which" + " are unknown: {}. Known transaction service keys were {}.", SafeArg.of("timestamps", startTimestamps), SafeArg.of("unknownKeys", unknownKeys), SafeArg.of("knownServiceKeys", keyedServices.keySet())); } return queryMap.entrySet() .stream() .map(entry -> keyedServices.get(entry.getKey()).get(entry.getValue())) .collect(HashMap::new, Map::putAll, Map::putAll); }
Source:
MessageFormatFlags getOperationFlag() { switch (options.getOperationType()) { case Data: return MessageFormatFlags.Blob; default: return MessageFormatFlags.All; } }

Target:
MessageFormatFlags getOperationFlag() { return options.getOperationType() == GetBlobOptions.OperationType.Data ? MessageFormatFlags.Blob : MessageFormatFlags.All; }
Source:
public List<GitReferenceUpdatedListener.Update> getUpdates() { GitReferenceUpdatedListener.Update update = new GitReferenceUpdatedListener.Update() { public String getRefName() { return ref; } @Override public String getOldObjectId() { return oldObjectId; } @Override public String getNewObjectId() { return newObjectId; } }; return ImmutableList.of(update); }

Target:
public List<GitReferenceUpdatedListener.Update> getUpdates() { GitReferenceUpdatedListener.Update update = new GitReferenceUpdatedListener.Update() { @Override public String getRefName() { return ref; } @Override public String getOldObjectId() { return oldObjectId; } @Override public String getNewObjectId() { return newObjectId; } }; return ImmutableList.of(update); }
Source:
private static double totalCost(final int numWorker, final int numDataBlocks, final int numModelBlocks, final int availableEvaluators, final List<EvaluatorSummary> workers, final List<EvaluatorSummary> servers) { final double workerUnitCostInvSum = workers.subList(0, numWorker).stream() .mapToDouble(worker -> worker.unitCostInv) .sum(); final double compCost = numDataBlocks / workerUnitCostInvSum; final double serverUnitCostInvSum = servers.subList(0, availableEvaluators - numWorker).stream() .mapToDouble(server -> server.unitCostInv) .sum(); final double commCost = numModelBlocks / serverUnitCostInvSum * numWorker; return compCost + (commCost * numMiniBatchPerItr); }

Target:
private double totalCost(final int numWorker, final int numDataBlocks, final int numModelBlocks, final int availableEvaluators, final List<EvaluatorSummary> workers, final List<EvaluatorSummary> servers) { final double workerThroughputSum = workers.subList(0, numWorker).stream() .mapToDouble(worker -> worker.throughput) .sum(); final double compCost = numDataBlocks / workerThroughputSum; final double serverThroughputSum = servers.subList(0, availableEvaluators - numWorker).stream() .mapToDouble(server -> server.throughput) .sum(); final double commCost = numModelBlocks / serverThroughputSum * numWorker; return compCost + (commCost * numMiniBatchPerItr); }
Source:
public boolean visit(FieldAccess node) { char[] fieldName = node.getName().getIdentifier().toCharArray(); char[] superName = new char[0]; Expression expression = node.getExpression(); switch (expression.getNodeType()) { case ASTNode.THIS_EXPRESSION : superName = contextNames.isEmpty() ? null : contextNames.peek(); break; case ASTNode.SIMPLE_NAME : superName = ((SimpleName) expression).getIdentifier().toCharArray(); break; case ASTNode.FIELD_ACCESS : superName = ((FieldAccess) expression).getName().getIdentifier().toCharArray(); break; } if (node.getParent().getNodeType() != ASTNode.FUNCTION_INVOCATION) { if (node.getParent().getNodeType() == ASTNode.ASSIGNMENT && ((Assignment) node.getParent()).getRightHandSide() == node) { indexer.addFieldReference(fieldName); } if (isFieldDeclaration(superName, fieldName)) { indexer.addFieldDeclaration(null, fieldName, superName, 0, false); } else { indexer.addFieldReference(fieldName); } } return true; }

Target:
public boolean visit(FieldAccess node) { char[] fieldName = node.getName().getIdentifier().toCharArray(); char[] superName = new char[0]; Expression expression = node.getExpression(); if (expression == null) { return true; } switch (expression.getNodeType()) { case ASTNode.THIS_EXPRESSION : superName = contextNames.isEmpty() ? null : contextNames.peek(); break; case ASTNode.SIMPLE_NAME : superName = ((SimpleName) expression).getIdentifier().toCharArray(); break; case ASTNode.FIELD_ACCESS : superName = ((FieldAccess) expression).getName().getIdentifier().toCharArray(); break; } if (node.getParent().getNodeType() != ASTNode.FUNCTION_INVOCATION) { if (node.getParent().getNodeType() == ASTNode.ASSIGNMENT && ((Assignment) node.getParent()).getRightHandSide() == node) { indexer.addFieldReference(fieldName); } if (isFieldDeclaration(superName, fieldName)) { indexer.addFieldDeclaration(null, fieldName, superName, 0, false); contextNames.push(fieldName); anonymousNameAvailable = true; } else { indexer.addFieldReference(fieldName); } } return true; }
Source:
public boolean addListener(String type, long id, ClassLoaderListener classLoaderListener) { final VirtualClassLoader localClassLoader = ((VirtualClassLoader) getLocalClassLoader(type, id)); return localClassLoader.addListener(classLoaderListener); }

Target:
public boolean addListener(String type, long id, ClassLoaderListener classLoaderListener) { final VirtualClassLoader localClassLoader = getLocalClassLoader(type, id); return localClassLoader.addListener(classLoaderListener); }
Source:
public URI getOutputChannel() throws InfrastructureException { try { return URI.create(websocketOutputEndpoint); } catch (UriBuilderException | IllegalArgumentException ex) { throw new InternalInfrastructureException( "Failed to get the output channel because: " + ex.getLocalizedMessage()); } }

Target:
public URI getOutputChannel() throws InfrastructureException { try { return URI.create(websocketOutputEndpoint); } catch (IllegalArgumentException ex) { throw new InternalInfrastructureException( "Failed to get the output channel because: " + ex.getLocalizedMessage()); } }
Source:
public TopicThreads call( ) throws Exception{ try { if(courseId!=null){ String view; if (filter == DiscussionPostsFilter.UNREAD) view = "unread"; else if (filter == DiscussionPostsFilter.UNANSWERED) view = "unanswered"; else view = ""; String order; if (orderBy == DiscussionPostsSort.LAST_ACTIVITY_AT) order = "last_activity_at"; else if (orderBy == DiscussionPostsSort.VOTE_COUNT) order = "vote_count"; else order = "comment_count"; int pageSize = pagination.pageSize(); int page = pagination.numOfPagesLoaded() + 1; return environment.getDiscussionAPI().getFollowingThreadList(courseId, view, order, pageSize, page); } } catch (Exception ex) { handle(ex); logger.error(ex, true); } return null; }

Target:
public TopicThreads call() throws Exception { try { if (courseId != null) { int pageSize = pagination.pageSize(); int page = pagination.numOfPagesLoaded() + 1; return environment.getDiscussionAPI().getFollowingThreadList(courseId, filter.getQueryParamValue(), orderBy.getQueryParamValue(), pageSize, page); } } catch (Exception ex) { handle(ex); logger.error(ex, true); } return null; }
Source:
private static Set<String> getChainHeadFromAllSegments(Layout layout) { List<Layout.LayoutSegment> segments = layout.getSegments(); validateSegments(layout.getSegments()); return segments.stream() .map(Layout.LayoutSegment::getFirstStripe) .map(Layout.LayoutStripe::getLogServers) .map(strip -> strip.get(0)) .collect(Collectors.toSet()); }

Target:
private static Set<String> getChainHeadFromAllSegments(Layout layout) { validateSegments(layout.getSegments()); List<Layout.LayoutSegment> segments = layout.getSegments(); return segments.stream() .map(Layout.LayoutSegment::getFirstStripe) .map(Layout.LayoutStripe::getLogServers) .map(strip -> strip.get(0)) .collect(Collectors.toSet()); }
Source:
public boolean onSingleTapConfirmed(MotionEvent event) { new PageBookmarkTask(getActivity()).execute(mPageNumber); return true; }

Target:
public boolean onSingleTapConfirmed(MotionEvent event) { new TogglePageBookmarkTask().execute(mPageNumber); return true; }
Source:
protected EnvVars buildEnv(AbstractProject<?, ?> job) { EnvVars env = new EnvVars(); for (EnvironmentContributor contributor : EnvironmentContributor.all()) { try { contributor.buildEnvironmentFor(job, env, TaskListener.NULL); } catch (Throwable t) { LOGGER.debug("{} failed to build env ({}), skipping", contributor.getClass(), t.getMessage(), t); } } return env; }

Target:
protected EnvVars buildEnv(AbstractProject<?, ?> job) { EnvVars env = new EnvVars(); for (EnvironmentContributor contributor : EnvironmentContributor.all()) { try { contributor.buildEnvironmentFor(job, env, TaskListener.NULL); } catch (Exception e) { LOGGER.debug("{} failed to build env ({}), skipping", contributor.getClass(), e.getMessage(), e); } } return env; }
Source:
public void bridgeStatusChanged(ThingStatusInfo bridgeStatusInfo) { if (bridgeStatusInfo.getStatus() == ThingStatus.ONLINE && getThing().getStatusInfo().getStatusDetail() == ThingStatusDetail.BRIDGE_OFFLINE) { updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.NONE); } else if (bridgeStatusInfo.getStatus() == ThingStatus.OFFLINE) { updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.BRIDGE_OFFLINE); } }

Target:
public void bridgeStatusChanged(ThingStatusInfo bridgeStatusInfo) { if (bridgeStatusInfo.getStatus() == ThingStatus.ONLINE && getThing().getStatusInfo().getStatusDetail() == ThingStatusDetail.BRIDGE_OFFLINE) { updateStatus(ThingStatus.ONLINE, ThingStatusDetail.NONE); } else if (bridgeStatusInfo.getStatus() == ThingStatus.OFFLINE) { updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.BRIDGE_OFFLINE); } }
Source:
private void storeCache(final boolean move) { if (progress.isShowing()) { showToast(res.getString(R.string.err_detail_still_working)); return; } if (Settings.getChooseList()) { new StoredList.UserInterface(this).promptForListSelection(R.string.list_title, new Action1<Integer>() { @Override public void call(final Integer selectedListId) { storeCacheInList(selectedListId, move); } }, true, cache.getLists()); } else { storeCacheInList(StoredList.TEMPORARY_LIST.id, move); } }

Target:
private void storeCache(final boolean move) { if (progress.isShowing()) { showToast(res.getString(R.string.err_detail_still_working)); return; } if (Settings.getChooseList()) { new StoredList.UserInterface(this).promptForListSelection(R.string.list_title, new Action1<Integer>() { @Override public void call(final Integer selectedListId) { storeCacheInList(selectedListId, move); } }, true, cache.getLists()); } else { storeCacheInList(StoredList.STANDARD_LIST_ID, move); } }
Source:
public boolean getBoolean(String fieldName) { long columnIndex = proxyState.getRow$realm().getColumnIndex(fieldName); RealmFieldType columnType = proxyState.getRow$realm().getColumnType(columnIndex); if (columnType != RealmFieldType.BOOLEAN) { throw new IllegalArgumentException(fieldName + " is not a boolean, but a " + columnType); } return proxyState.getRow$realm().getBoolean(columnIndex); }

Target:
public boolean getBoolean(String fieldName) { long columnIndex = proxyState.getRow$realm().getColumnIndex(fieldName); checkFieldType(fieldName, columnIndex, RealmFieldType.BOOLEAN); return proxyState.getRow$realm().getBoolean(columnIndex); }
Source:
public void testBadFutureType() throws Exception { ServerThread localServer = start(); Client client = ClientFactory.createClient(); client.createConnection("localhost"); ClientResponseImpl response = null; try { response = (ClientResponseImpl) client.callProcedure("TestNTProcs$NTProcWithBadTypeFuture"); } catch (ProcCallException e) { response = (ClientResponseImpl) e.getClientResponse(); } assertEquals(ClientResponse.GRACEFUL_FAILURE, response.getStatus()); System.out.println("Client got failure response"); System.out.println(response.toJSONString()); localServer.shutdown(); localServer.join(); }

Target:
public void testBadFutureType() throws Exception { ServerThread localServer = start(); Client client = ClientFactory.createClient(); client.createConnection("localhost"); ClientResponseImpl response = null; try { response = (ClientResponseImpl) client.callProcedure("TestNTProcs$NTProcWithBadTypeFuture"); } catch (ProcCallException e) { response = (ClientResponseImpl) e.getClientResponse(); } assertEquals(ClientResponse.GRACEFUL_FAILURE, response.getStatus()); assertTrue(response.getStatusString().contains("was not an acceptible VoltDB return type")); System.out.println("Client got failure response"); System.out.println(response.toJSONString()); localServer.shutdown(); localServer.join(); }
Source:
public boolean canDelete() { try { XWikiDocument doc = new XWikiDocument(); doc.setFullName(getFullName(), this.context); if (!hasAccessLevel(ADMIN_RIGHT, getFullName()) && !hasAccessLevel("delete", getFullName())) { return false; } String waitdays; if (hasAccessLevel(ADMIN_RIGHT, getFullName())) { waitdays = getXWikiContext().getWiki().Param("xwiki.store.recyclebin.adminWaitDays", "0"); } else { waitdays = getXWikiContext().getWiki().Param("xwiki.store.recyclebin.waitDays", "7"); } int seconds = (int) (Double.parseDouble(waitdays) * 24 * 60 * 60 + 0.5); Calendar cal = Calendar.getInstance(); cal.setTime(getDate()); cal.add(Calendar.SECOND, seconds); return cal.before(Calendar.getInstance()); } catch (Exception ex) { LOGGER.warn("Exception while checking if entry can be removed from the recycle bin", getId(), ex); return false; } }

Target:
public boolean canDelete() { try { XWikiDocument doc = new XWikiDocument(); doc.setFullName(getFullName(), this.context); if (!hasAccessLevel("delete", getFullName())) { return false; } String waitdays; if (hasAccessLevel(ADMIN_RIGHT, getFullName())) { waitdays = getXWikiContext().getWiki().Param("xwiki.store.recyclebin.adminWaitDays", "0"); } else { waitdays = getXWikiContext().getWiki().Param("xwiki.store.recyclebin.waitDays", "7"); } int seconds = (int) (Double.parseDouble(waitdays) * 24 * 60 * 60 + 0.5); Calendar cal = Calendar.getInstance(); cal.setTime(getDate()); cal.add(Calendar.SECOND, seconds); return cal.before(Calendar.getInstance()); } catch (Exception ex) { LOGGER.warn("Exception while checking if entry can be removed from the recycle bin", getId(), ex); return false; } }
Source:
public JsonArray execJson() { throw new NotImplementedException("JSON queries not implemented for remote calls") ; }

Target:
public JsonArray execJson() { throw new NotImplemented("JSON queries not implemented for remote calls") ; }
Source:
private void assertGetResult(StorageDomain result) { assertNotNull(result); assertEquals(existingDomain, result); assertEquals("Wrong committed disk size", 8, result.getCommittedDiskSize()); assertEquals("Wrong actual disk size", 4, result.getActualImagesSize()); assertEquals("Wrong first metadata device", FixturesTool.LUN_ID_OF_DOMAIN_METADATA, result.getFirstMetadataDevice()); assertEquals("Wrong vg metadata device", FixturesTool.LUN_ID_OF_DOMAIN_VG_METADATA, result.getVgMetadataDevice()); assertEquals("Wrong shared status", StorageDomainSharedStatus.Active, result.getStorageDomainSharedStatus()); assertEquals("Wrong backup flag status", false, result.isBackup()); }

Target:
private void assertGetResult(StorageDomain result) { assertNotNull(result); assertEquals(existingDomain, result); assertEquals("Wrong committed disk size", 8, result.getCommittedDiskSize()); assertEquals("Wrong actual disk size", 4, result.getActualImagesSize()); assertEquals("Wrong first metadata device", FixturesTool.LUN_ID_OF_DOMAIN_METADATA, result.getFirstMetadataDevice()); assertEquals("Wrong vg metadata device", FixturesTool.LUN_ID_OF_DOMAIN_VG_METADATA, result.getVgMetadataDevice()); assertEquals("Wrong shared status", StorageDomainSharedStatus.Active, result.getStorageDomainSharedStatus()); assertEquals("Wrong backup flag status", true, result.isBackup()); }
Source:
private static FeedItem createFeedItem(Feed feed, DocumentFile file, Context context) { String uuid = UUID.randomUUID().toString(); MediaMetadataRetriever mediaMetadataRetriever = new MediaMetadataRetriever(); mediaMetadataRetriever.setDataSource(context, file.getUri()); String dateStr = mediaMetadataRetriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_DATE); Date date = null; if (!TextUtils.isEmpty(dateStr)) { try { SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMdd'T'HHmmss", Locale.getDefault()); date = simpleDateFormat.parse(dateStr); } catch (ParseException parseException) { } } if (date == null) { date = new Date(file.lastModified()); } FeedItem item = new FeedItem(0, file.getName(), uuid, file.getName(), date, FeedItem.UNPLAYED, feed); item.setAutoDownload(false); String durationStr = mediaMetadataRetriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_DURATION); String title = mediaMetadataRetriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_TITLE); if (!TextUtils.isEmpty(title)) { item.setTitle(title); } long duration = Long.parseLong(durationStr); long size = file.length(); FeedMedia media = new FeedMedia(0, item, (int) duration, 0, size, file.getType(), file.getUri().toString(), file.getUri().toString(), false, null, 0, 0); media.setHasEmbeddedPicture(mediaMetadataRetriever.getEmbeddedPicture() != null); item.setMedia(media); return item; }

Target:
private static FeedItem createFeedItem(Feed feed, DocumentFile file, Context context) { String uuid = UUID.randomUUID().toString(); MediaMetadataRetriever mediaMetadataRetriever = new MediaMetadataRetriever(); mediaMetadataRetriever.setDataSource(context, file.getUri()); String dateStr = mediaMetadataRetriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_DATE); Date date = null; if (!TextUtils.isEmpty(dateStr)) { try { SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMdd'T'HHmmss", Locale.getDefault()); date = simpleDateFormat.parse(dateStr); } catch (ParseException parseException) { date = DateUtils.parse(dateStr); if (date == null) { date = new Date(file.lastModified()); } } } else { date = new Date(file.lastModified()); } FeedItem item = new FeedItem(0, file.getName(), uuid, file.getName(), date, FeedItem.UNPLAYED, feed); item.setAutoDownload(false); String durationStr = mediaMetadataRetriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_DURATION); String title = mediaMetadataRetriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_TITLE); if (!TextUtils.isEmpty(title)) { item.setTitle(title); } long duration = Long.parseLong(durationStr); long size = file.length(); FeedMedia media = new FeedMedia(0, item, (int) duration, 0, size, file.getType(), file.getUri().toString(), file.getUri().toString(), false, null, 0, 0); media.setHasEmbeddedPicture(mediaMetadataRetriever.getEmbeddedPicture() != null); item.setMedia(media); return item; }
Source:
public MockRestAdapter(String token, final String responseString, final HashMap<String, String> headers) { this.exceptionReference = new AtomicReference<>(); this.requestReference = new AtomicReference<>(); this.resultReference = new AtomicReference<>(); this.mockRestAdapter = new BitreserveRestAdapter(token); this.restAdapter = new RestAdapter.Builder().setEndpoint(GlobalConfigurations.API_SERVER_URL) .setRequestInterceptor(this.mockRestAdapter.getBitreserveRequestInterceptor(token)) .setClient(new Client() { @Override public Response execute(Request request) throws IOException { requestReference.set(request); return new Response("some/url", 200, "reason", new ArrayList<Header>() {{ if (headers != null) { for (Map.Entry<String, String> entry : headers.entrySet()) { String key = entry.getKey(); String value = entry.getValue(); add(new retrofit.client.Header(key, value)); } } }}, new TypedByteArray("application/json", TextUtils.isEmpty(responseString) ? new byte[0] : responseString.getBytes())); } }).build(); this.mockRestAdapter.setAdapter(this.restAdapter); }

Target:
public MockRestAdapter(String token, final String responseString, final HashMap<String, String> headers) { this.exceptionReference = new AtomicReference<>(); this.requestReference = new AtomicReference<>(); this.resultReference = new AtomicReference<>(); this.mockRestAdapter = new BitreserveRestAdapter(token); this.restAdapter = new RestAdapter.Builder().setEndpoint(GlobalConfigurations.API_SERVER_URL) .setRequestInterceptor(this.mockRestAdapter.getBitreserveRequestInterceptor(token)) .setClient(new Client() { @Override public Response execute(Request request) throws IOException { requestReference.set(request); return new Response("some/url", 200, "reason", new ArrayList<Header>() {{ if (headers != null) { for (Map.Entry<String, String> entry : headers.entrySet()) { String key = entry.getKey(); String value = entry.getValue(); add(new retrofit.client.Header(key, value)); } } }}, new TypedByteArray("application/json", responseString == null ? new byte[0] : responseString.getBytes())); } }).build(); this.mockRestAdapter.setAdapter(this.restAdapter); }
Source:
protected void configure() { install(new XDocLoader.Module()); factory(XDocProjectConfig.Factory.class); DynamicMap.mapOf(binder(), Formatter.class); bind(Formatter.class) .annotatedWith(Exports.named(AsciidocFormatter.NAME)) .to(AsciidocFormatter.class); bind(Formatter.class) .annotatedWith(Exports.named(MarkdownFormatter.NAME)) .to(MarkdownFormatter.class); bind(Formatter.class) .annotatedWith(Exports.named(PlainTextFormatter.NAME)) .to(PlainTextFormatter.class); DynamicSet.bind(binder(), ProjectWebLink.class) .to(XDocWebLink.class); DynamicSet.bind(binder(), BranchWebLink.class) .to(XDocWebLink.class); DynamicSet.bind(binder(), FileWebLink.class) .to(XDocFileWebLink.class); DynamicSet.bind(binder(), TopMenu.class).toInstance(new TopMenu() { @Override public List<MenuEntry> getEntries() { StringBuilder url = new StringBuilder(); url.append("/plugins/"); url.append(pluginName); url.append(XDocServlet.PATH_PREFIX); url.append("${projectName}"); return Lists.newArrayList(new MenuEntry(GerritTopMenu.PROJECTS, Lists.newArrayList(new MenuItem("Readme", url.toString())))); } }); }

Target:
protected void configure() { install(new XDocLoader.Module()); factory(XDocProjectConfig.Factory.class); DynamicMap.mapOf(binder(), Formatter.class); bind(Formatter.class) .annotatedWith(Exports.named(AsciidoctorFormatter.NAME)) .to(AsciidoctorFormatter.class); bind(Formatter.class) .annotatedWith(Exports.named(MarkdownFormatter.NAME)) .to(MarkdownFormatter.class); bind(Formatter.class) .annotatedWith(Exports.named(PlainTextFormatter.NAME)) .to(PlainTextFormatter.class); DynamicSet.bind(binder(), ProjectWebLink.class) .to(XDocWebLink.class); DynamicSet.bind(binder(), BranchWebLink.class) .to(XDocWebLink.class); DynamicSet.bind(binder(), FileWebLink.class) .to(XDocFileWebLink.class); DynamicSet.bind(binder(), TopMenu.class).toInstance(new TopMenu() { @Override public List<MenuEntry> getEntries() { StringBuilder url = new StringBuilder(); url.append("/plugins/"); url.append(pluginName); url.append(XDocServlet.PATH_PREFIX); url.append("${projectName}"); return Lists.newArrayList(new MenuEntry(GerritTopMenu.PROJECTS, Lists.newArrayList(new MenuItem("Readme", url.toString())))); } }); }
Source:
public void onError(Throwable e) { Disposable d = get(); if (d != DisposableHelper.DISPOSED && compareAndSet(d, DisposableHelper.DISPOSED)) { DisposableHelper.dispose(task); actual.onError(e); } }

Target:
public void onError(Throwable e) { Disposable d = get(); if (d != DisposableHelper.DISPOSED && compareAndSet(d, DisposableHelper.DISPOSED)) { DisposableHelper.dispose(task); actual.onError(e); } else { RxJavaPlugins.onError(e); } }
Source:
private String calculateZone(String zoneFromRequest, FreeIpaAndClient freeIpaAndClient) throws FreeIpaClientException { Optional<String> optionalZone = Optional.ofNullable(zoneFromRequest); String zone = optionalZone.orElse(freeIpaAndClient.getFreeIpa().getDomain()); boolean providedZoneDifferentThanDefault = !freeIpaAndClient.getFreeIpa().getDomain().equals(StringUtils.removeEnd(zone, ".")); if (optionalZone.isPresent() && providedZoneDifferentThanDefault) { validateZoneExists(optionalZone.get(), freeIpaAndClient.getClient()); } return zone; }

Target:
private String calculateZone(String zoneFromRequest, FreeIpaAndClient freeIpaAndClient) throws FreeIpaClientException { Optional<String> optionalZone = Optional.ofNullable(zoneFromRequest); String zone = optionalZone.orElse(freeIpaAndClient.getFreeIpa().getDomain()); boolean providedZoneDifferentThanDefault = !freeIpaAndClient.getFreeIpa().getDomain().equals(StringUtils.removeEnd(zone, ".")); if (optionalZone.isPresent() && providedZoneDifferentThanDefault) { LOGGER.debug("Zone is provided in the request and different from the default one [{}]", zone, freeIpaAndClient.getFreeIpa().getDomain()); validateZoneExists(optionalZone.get(), freeIpaAndClient.getClient()); } return zone; }
Source:
Resource getTotalReserved() { Resource totalReserved = getReservedContainer() != null ? Resources.clone(getReservedContainer().getAllocatedResource()) : Resource.newInstance(0, 0); Resources.addTo(totalReserved, totalResourcesPreempted); return totalReserved; }

Target:
Resource getTotalReserved() { Resource totalReserved = Resources.clone(getReservedContainer() != null ? getReservedContainer().getAllocatedResource() : Resource.newInstance(0, 0)); Resources.addTo(totalReserved, totalResourcesPreempted); return totalReserved; }
Source:
public ActionResult<Void> resume(@PathKeysParam PathKeys pathKeys, @ActionParam("force") @Optional("false") boolean force) { String datastreamName = pathKeys.getAsString(KEY_NAME); Datastream datastream = _store.getDatastream(datastreamName); LOG.info("Received request to resume datastream {}", datastream); if (datastream == null) { _errorLogger.logAndThrowRestLiServiceException(HttpStatus.S_404_NOT_FOUND, "Datastream to resume does not exist: " + datastreamName); } if (!DatastreamStatus.PAUSED.equals(datastream.getStatus()) && !DatastreamStatus.STOPPED.equals(datastream.getStatus())) { _errorLogger.logAndThrowRestLiServiceException(HttpStatus.S_405_METHOD_NOT_ALLOWED, "Datastream is not paused, cannot resume: " + datastreamName); } List<Datastream> datastreamsToResume = force ? getGroupedDatastreams(datastream) : Collections.singletonList(datastream); LOG.info("Resuming datastreams {}", datastreamsToResume); for (Datastream d : datastreamsToResume) { try { if (DatastreamStatus.PAUSED.equals(datastream.getStatus()) || DatastreamStatus.STOPPED.equals(datastream.getStatus())) { d.setStatus(DatastreamStatus.READY); _store.updateDatastream(d.getName(), d, true); } else { LOG.warn("Will not resume datastream {}, as it is already in PAUSED/STOPPED state", d); } } catch (DatastreamException e) { _errorLogger.logAndThrowRestLiServiceException(HttpStatus.S_500_INTERNAL_SERVER_ERROR, "Could not update datastream to resume: " + d.getName(), e); } } LOG.info("Completed request for resuming datastream {}", datastream); return new ActionResult<>(HttpStatus.S_200_OK); }

Target:
public ActionResult<Void> resume(@PathKeysParam PathKeys pathKeys, @ActionParam("force") @Optional("false") boolean force) { String datastreamName = pathKeys.getAsString(KEY_NAME); Datastream datastream = _store.getDatastream(datastreamName); LOG.info("Received request to resume datastream {}", datastream); if (datastream == null) { _errorLogger.logAndThrowRestLiServiceException(HttpStatus.S_404_NOT_FOUND, "Datastream to resume does not exist: " + datastreamName); } if (!DatastreamStatus.PAUSED.equals(datastream.getStatus()) && !DatastreamStatus.STOPPED.equals(datastream.getStatus())) { _errorLogger.logAndThrowRestLiServiceException(HttpStatus.S_405_METHOD_NOT_ALLOWED, "Datastream is not paused or stopped, cannot resume: " + datastreamName); } List<Datastream> datastreamsToResume = force ? getGroupedDatastreams(datastream) : Collections.singletonList(datastream); LOG.info("Resuming datastreams {}", datastreamsToResume); for (Datastream d : datastreamsToResume) { try { if (DatastreamStatus.PAUSED.equals(datastream.getStatus()) || DatastreamStatus.STOPPED.equals(datastream.getStatus())) { d.setStatus(DatastreamStatus.READY); _store.updateDatastream(d.getName(), d, true); } else { LOG.warn("Will not resume datastream {}, as it is not already in PAUSED/STOPPED state", d); } } catch (DatastreamException e) { _errorLogger.logAndThrowRestLiServiceException(HttpStatus.S_500_INTERNAL_SERVER_ERROR, "Could not update datastream to resume: " + d.getName(), e); } } LOG.info("Completed request for resuming datastream {}", datastream); return new ActionResult<>(HttpStatus.S_200_OK); }
Source:
public byte[] getCacheKey() { byte[] delegateCacheKey = delegate.getCacheKey(); return ByteBuffer.allocate(1 + delegateCacheKey.length) .put(AggregatorUtil.SUPPRESSED_AGG_CACHE_TYPE_ID) .put(delegateCacheKey) .array(); }

Target:
public byte[] getCacheKey() { CacheKeyBuilder cacheKeyBuilder = new CacheKeyBuilder(AggregatorUtil.SUPPRESSED_AGG_CACHE_TYPE_ID); cacheKeyBuilder.appendCacheable(delegate); return cacheKeyBuilder.build(); }
Source:
public String toStringSpecific() { return NLS.bind("Core Node, {0} children {1}", nbChildren, Arrays.toString(Arrays.copyOf(children, nbChildren))); }

Target:
public String toStringSpecific() { return String.format("Core Node, %d children %s", nbChildren, Arrays.toString(Arrays.copyOf(children, nbChildren))); }
Source:
private void createSolrCore() throws IOException, SolrServerException { String url = HttpSolrClientFactory.getDefaultHttpsAddress(); final HttpClientBuilder builder = HttpClients.custom() .setDefaultCookieStore(new BasicCookieStore()) .setMaxConnTotal(128) .setMaxConnPerRoute(32); if (StringUtils.startsWithIgnoreCase(url, "https")) { builder.setSSLSocketFactory( new SSLConnectionSocketFactory( HttpSolrClientFactory.getSslContext(), HttpSolrClientFactory.getProtocols(), HttpSolrClientFactory.getCipherSuites(), SSLConnectionSocketFactory.BROWSER_COMPATIBLE_HOSTNAME_VERIFIER)); } final String solrDataDir = HttpSolrClientFactory.getSolrDataDir(); if (solrDataDir != null) { ConfigurationStore.getInstance().setDataDirectoryPath(solrDataDir); } HttpSolrClientFactory.createSolrCore(url, coreName, null, builder.build()); }

Target:
private void createSolrCore() throws IOException, SolrServerException { httpBuilder = new org.codice.solr.factory.impl.HttpClientBuilder(encryptionService); String url = getBackupUrl(); final String solrDataDir = getSolrDataDir(); ConfigurationStore.getInstance().setDataDirectoryPath(solrDataDir); HttpSolrClientFactory.createSolrCore(url, coreName, null, httpBuilder.get().build()); }
Source:
private ClassLoader buildCoreClassLoader() throws IOException { List<URL> urls = new ArrayList<>(); List<DependenciesTxt> overrides = new ArrayList<>(); DependenciesTxt core = new DependenciesTxt(getClass().getClassLoader().getResourceAsStream("dependencies.txt")); File[] plugins = new File(home, "plugins").listFiles(); if (plugins!=null) { for (File p : plugins) { String n = p.getName(); if (p.isFile() && (n.endsWith(".jpi") || n.endsWith(".hpi"))) { try { new Plugin(p).process(core, urls, overrides); } catch (IOException e) { LOGGER.log(WARNING, "Skipping "+p, e); } } } } Set<String> jars = context.getResourcePaths("/WEB-INF/jars"); if (jars==null || jars.isEmpty()) { throw new IllegalStateException("No WEB-INF/jars"); } OUTER: for (String jar : jars) { if (!jar.endsWith(".jar")) continue; String justName = jar.substring(jar.lastIndexOf('/')+1); Dependency d = core.fromFileName(justName); if (d==null) { LOGGER.log(INFO, "Allowing unexpected core jar file without override check: "+jar); } else { for (DependenciesTxt o : overrides) { if (o.contains(d.ga)) continue OUTER; } } urls.add(context.getResource(jar)); } return new URLClassLoader(urls.toArray(new URL[urls.size()]),Thread.currentThread().getContextClassLoader()); }

Target:
private ClassLoader buildCoreClassLoader() throws IOException { List<URL> urls = new ArrayList<>(); DependenciesTxt core = new DependenciesTxt(getClass().getClassLoader().getResourceAsStream("dependencies.txt")); File[] plugins = new File(home, "plugins").listFiles(); if (plugins!=null) { for (File p : plugins) { String n = p.getName(); if (p.isFile() && (n.endsWith(".jpi") || n.endsWith(".hpi"))) { try { new Plugin(p).process(core, urls, overrides); } catch (IOException e) { LOGGER.log(WARNING, "Skipping "+p, e); } } } } Set<String> jars = context.getResourcePaths("/WEB-INF/jars"); if (jars==null || jars.isEmpty()) { throw new IllegalStateException("No WEB-INF/jars"); } for (String jar : jars) { if (!jar.endsWith(".jar")) continue; String justName = jar.substring(jar.lastIndexOf('/')+1); Dependency d = core.fromFileName(justName); if (d==null) { LOGGER.log(INFO, "Allowing unexpected core jar file without override check: "+jar); } else { if (overrides.isOverridden(d)) continue; } urls.add(context.getResource(jar)); } return new URLClassLoader(urls.toArray(new URL[urls.size()]),Thread.currentThread().getContextClassLoader()); }
Source:
protected void run() throws Exception { org.eclipse.jgit.api.Status status = new Git(db).status().call(); Collection<String> added = status.getAdded(); Collection<String> changed = status.getChanged(); Collection<String> removed = status.getRemoved(); Collection<String> modified = status.getModified(); Collection<String> missing = status.getMissing(); Collection<String> untracked = status.getUntracked(); int nbToBeCommitted = added.size() + changed.size() + removed.size(); if (nbToBeCommitted > 0) { out.println("# " + CLIText.get().toBeCommitted); printList(CLIText.get().newFile, added); printList(CLIText.get().modified, changed); printList(CLIText.get().removed, removed); } int nbNotStagedForCommit = modified.size() + missing.size(); if (nbNotStagedForCommit > 0) { out.println("# " + CLIText.get().notStagedForCommit); printList(CLIText.get().modified, modified); printList(CLIText.get().removed, missing); } int nbUntracked = untracked.size(); if (showUntracked && nbUntracked > 0) { out.println("# " + CLIText.get().untrackedFiles); printList(CLIText.get().untracked, untracked); } out.println(MessageFormat.format(CLIText.get().summaryStatus, nbToBeCommitted, nbNotStagedForCommit, nbUntracked)); }

Target:
protected void run() throws Exception { final Ref head = db.getRef(Constants.HEAD); if (head != null && head.isSymbolic()) { String branch = Repository.shortenRefName(head.getLeaf().getName()); out.println(MessageFormat.format("# " + CLIText.get().onBranch, branch)); } else out.println("# " + CLIText.get().notOnAnyBranch); org.eclipse.jgit.api.Status status = new Git(db).status().call(); Collection<String> added = status.getAdded(); Collection<String> changed = status.getChanged(); Collection<String> removed = status.getRemoved(); Collection<String> modified = status.getModified(); Collection<String> missing = status.getMissing(); Collection<String> untracked = status.getUntracked(); Collection<String> unmerged = status.getConflicting(); int nbToBeCommitted = added.size() + changed.size() + removed.size(); if (nbToBeCommitted > 0) { out.println("# " + CLIText.get().toBeCommitted); printList(CLIText.get().newFile, added); printList(CLIText.get().modified, changed); printList(CLIText.get().removed, removed); } int nbNotStagedForCommit = modified.size() + missing.size(); if (nbNotStagedForCommit > 0) { out.println("# " + CLIText.get().notStagedForCommit); printList(CLIText.get().modified, modified); printList(CLIText.get().removed, missing); } int nbUnmerged = unmerged.size(); if (nbUnmerged > 0) { out.println("# " + CLIText.get().unmergedPaths); printList(unmerged); } int nbUntracked = untracked.size(); if (showUntracked && nbUntracked > 0) { out.println("# " + CLIText.get().untrackedFiles); printList(untracked); } out.println(MessageFormat.format(CLIText.get().summaryStatus, nbToBeCommitted, nbNotStagedForCommit, nbUnmerged, nbUntracked)); }
Source:
public String toString() { final StringBuilder out = new StringBuilder(); out.append(this.argument.toString()); out.append(" -> "); out.append(this.result.toString()); return out.toString(); }

Target:
public String toString() { return String.format("%s -> %s", argument, result); }
Source:
private String sendToZeppelinHub(HttpMethod method, String url, String json, boolean withResponse) throws IOException { InputStreamResponseListener listener = new InputStreamResponseListener(); Response response; String data; Request request = client.newRequest(url).method(method).header(ZEPPELIN_TOKEN_HEADER, token); if ((method.equals(HttpMethod.PUT) || method.equals(HttpMethod.POST)) && !StringUtils.isBlank(json)) { request.content(new StringContentProvider(json, "UTF-8"), "application/json;charset=UTF-8"); } return withResponse ? sendToZeppelinHub(request) : sendToZeppelinHubWithoutResponseBody(request); }

Target:
private String sendToZeppelinHub(HttpMethod method, String url, String json, boolean withResponse) throws IOException { Request request = client.newRequest(url).method(method).header(ZEPPELIN_TOKEN_HEADER, token); if ((method.equals(HttpMethod.PUT) || method.equals(HttpMethod.POST)) && !StringUtils.isBlank(json)) { request.content(new StringContentProvider(json, "UTF-8"), "application/json;charset=UTF-8"); } return withResponse ? sendToZeppelinHub(request) : sendToZeppelinHubWithoutResponseBody(request); }
Source:
public Path convert(Path outputFile) throws GoGoDuckException { List<String> outputCommand = new ArrayList<String>(); String baseFilename = FilenameUtils.getBaseName(String.valueOf(outputFile)); String txtFilename = baseFilename + ".txt"; outputCommand.add(ncpdqPath + " -U " + outputFile.toString() + " tmp"); outputCommand.add("mv tmp " + outputFile.toString()); outputCommand.add(ncksPath + " --no_nm_prn -a " + outputFile.toString() + " > " + txtFilename); try { executeCommands(outputCommand, outputFile); String outputFileAsCsvString = parseNcks(txtFilename); Path tmpPath = Paths.get(txtFilename); Files.delete(tmpPath); String csvFilename = baseFilename + "." + extension; File csvFile = new File(csvFilename); FileUtils.writeStringToFile(csvFile, outputFileAsCsvString); return csvFile.toPath(); } catch (Exception e) { throw new GoGoDuckException(String.format("Could not convert output to csv: '%s'", e.getMessage())); } }

Target:
public Path convert(Path outputFile) throws GoGoDuckException { String baseFilename = FilenameUtils.getBaseName(String.valueOf(outputFile)); try { File unpackedNetCDF = unpackNetCDF(outputFile.toFile()); Path csvPath = executeNcksAndOutputToFile(baseFilename, unpackedNetCDF.toPath()); Files.delete(unpackedNetCDF.toPath()); return csvPath; } catch (Exception e) { throw new GoGoDuckException(String.format("Could not convert output to csv: '%s'", e.getMessage())); } }
Source:
public void withPublicKeyWhenUsingCustomTypeHeaderThenSuccessfullyDecodes() throws Exception { RSAPublicKey publicKey = TestKeys.DEFAULT_PUBLIC_KEY; RSAPrivateKey privateKey = TestKeys.DEFAULT_PRIVATE_KEY; JWSHeader header = new JWSHeader.Builder(JWSAlgorithm.RS256).type(new JOSEObjectType("JWS")).build(); JWTClaimsSet claimsSet = new JWTClaimsSet.Builder() .expirationTime(Date.from(Instant.now().plusSeconds(60))) .build(); SignedJWT signedJwt = signedJwt(privateKey, header, claimsSet); NimbusJwtDecoder decoder = withPublicKey(publicKey) .signatureAlgorithm(SignatureAlgorithm.RS256) .jwtProcessorCustomizer(p -> p.setJWSTypeVerifier((type, context) -> {})) .build(); assertThat(decoder.decode(signedJwt.serialize()).containsClaim(JwtClaimNames.EXP)).isNotNull(); }

Target:
public void withPublicKeyWhenUsingCustomTypeHeaderThenSuccessfullyDecodes() throws Exception { RSAPublicKey publicKey = TestKeys.DEFAULT_PUBLIC_KEY; RSAPrivateKey privateKey = TestKeys.DEFAULT_PRIVATE_KEY; JWSHeader header = new JWSHeader.Builder(JWSAlgorithm.RS256).type(new JOSEObjectType("JWS")).build(); JWTClaimsSet claimsSet = new JWTClaimsSet.Builder() .expirationTime(Date.from(Instant.now().plusSeconds(60))) .build(); SignedJWT signedJwt = signedJwt(privateKey, header, claimsSet); NimbusJwtDecoder decoder = withPublicKey(publicKey) .signatureAlgorithm(SignatureAlgorithm.RS256) .jwtProcessorCustomizer(p -> p.setJWSTypeVerifier(new DefaultJOSEObjectTypeVerifier<>(new JOSEObjectType("JWS")))) .build(); assertThat(decoder.decode(signedJwt.serialize()).containsClaim(JwtClaimNames.EXP)).isNotNull(); }
Source:
public View getViewForHighlighting(Object element) { if (getHost() instanceof AndroidDescriptorHost) { final AndroidDescriptorHost host = (AndroidDescriptorHost) getHost(); final Dialog dialog = (Dialog) element; return host.getHighlightingView(dialog.getWindow()); } return null; }

Target:
public View getViewForHighlighting(Object element) { final Descriptor.Host host = getHost(); if (host instanceof AndroidDescriptorHost) { final Dialog dialog = (Dialog) element; return ((AndroidDescriptorHost) host).getHighlightingView(dialog.getWindow()); } return null; }
Source:
public void addNodeToken(String nodeUrl, String token) throws RMException { if (allNodes.containsKey(nodeUrl)) { RMNode rmNode = allNodes.get(nodeUrl); rmNode.addToken(token); } else { throw new RMException("Unkonwn node " + nodeUrl); } }

Target:
public void addNodeToken(String nodeUrl, String token) throws RMException { if (allNodes.containsKey(nodeUrl)) { RMNode rmNode = allNodes.get(nodeUrl); checkNodeAdminPermission(rmNode, caller); rmNode.addToken(token); } else { throw new RMException("Unknown node " + nodeUrl); } }