auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public CachingInputStream( FSDataInputStream inputStream, CacheManager cacheManager, Path path, boolean cacheValidationEnabled) { super(inputStream); this.inputStream = requireNonNull(inputStream, "inputStream is null"); this.cacheManager = requireNonNull(cacheManager, "cachingFileSystem is null"); this.path = requireNonNull(path, "path is null"); this.cacheValidationEnabled = cacheValidationEnabled; }

Target:
public CachingInputStream( FSDataInputStream inputStream, CacheManager cacheManager, Path path, boolean cacheValidationEnabled) { super(inputStream); this.inputStream = requireNonNull(inputStream, "inputStream is null"); this.cacheManager = requireNonNull(cacheManager, "cacheManager is null"); this.path = requireNonNull(path, "path is null"); this.cacheValidationEnabled = cacheValidationEnabled; }
Source:
public Object apply(ProjectResource resource) { ConfigInfo result = new ConfigInfo(); RefControl refConfig = resource.getControl() .controlForRef(GitRepositoryManager.REF_CONFIG); if (refConfig.isVisible()) { if (want("use_contributor_agreements")) { result.useContributorAgreements = project.isUseContributorAgreements(); } if (want("use_content_merge")) { result.useContentMerge = project.isUseContentMerge(); } if (want("use_signed_off_by")) { result.useSignedOffBy = project.isUseSignedOffBy(); } if (want("require_change_id")) { result.requireChangeID = project.isRequireChangeID(); } } return result; }

Target:
public ConfigInfo apply(ProjectResource resource) { ConfigInfo result = new ConfigInfo(); RefControl refConfig = resource.getControl() .controlForRef(GitRepositoryManager.REF_CONFIG); ProjectState project = resource.getControl().getProjectState(); if (refConfig.isVisible()) { result.useContributorAgreements = project.isUseContributorAgreements(); result.useContentMerge = project.isUseContentMerge(); result.useSignedOffBy = project.isUseSignedOffBy(); result.requireChangeId = project.isRequireChangeID(); } return result; }
Source:
protected Object handleRequestMessage(Message<?> message) { Object value = message; if (this.extractPayload) { value = message.getPayload(); } if (!(value instanceof byte[])) { if (value instanceof String && !serializerExplicitlySet) { value = stringSerializer.serialize((String) value); } else { value = ((RedisSerializer<Object>) serializer).serialize(value); } } String uuid = defaultIdGenerator.generateId().toString(); byte[] uuidByte; if (!serializerExplicitlySet) { uuidByte = stringSerializer.serialize(uuid); } else { uuidByte = ((RedisSerializer<Object>) serializer).serialize(uuid); } this.template.boundListOps(this.queueName).leftPush(uuidByte); this.template.boundListOps(uuid).leftPush(value); this.boundListOperations = template.boundListOps(uuid + QUEUE_NAME_SUFFIX); byte[] reply = (byte[]) this.boundListOperations.rightPop(this.receiveTimeout, TimeUnit.MILLISECONDS); if(reply != null && reply.length > 0) { Object replyMessage = this.serializer.deserialize(reply); if (replyMessage == null) { return null; } return this.getMessageBuilderFactory().withPayload(replyMessage).build(); } return null; }

Target:
protected Object handleRequestMessage(Message<?> message) { Object value = message; if (this.extractPayload) { value = message.getPayload(); } if (!(value instanceof byte[])) { if (value instanceof String && !serializerExplicitlySet) { value = stringSerializer.serialize((String) value); } else { value = ((RedisSerializer<Object>) serializer).serialize(value); } } String uuid = defaultIdGenerator.generateId().toString(); byte[] uuidByte = uuid.getBytes(); this.boundListOps.leftPush(uuidByte); this.template.boundListOps(uuid).leftPush(value); BoundListOperations<String, Object> boundListOperations = template.boundListOps(uuid + QUEUE_NAME_SUFFIX); byte[] reply = (byte[]) boundListOperations.rightPop(this.receiveTimeout, TimeUnit.MILLISECONDS); if(reply != null && reply.length > 0) { Object replyMessage = this.serializer.deserialize(reply); if (replyMessage == null) { return null; } if (this.extractPayload) { return this.getMessageBuilderFactory().withPayload(replyMessage).build(); } else { return replyMessage; } } return null; }
Source:
public void removeAll() throws TckRepositoryException { uow.begin(); final EntityManager manager = managerProvider.get(); manager.getTransaction().begin(); try { manager.createQuery(format("SELECT e FROM %s e", getEntityName(entityClass)), entityClass) .getResultList() .forEach(manager::remove); manager.getTransaction().commit(); } catch (RuntimeException x) { if (manager.getTransaction().isActive()) { manager.getTransaction().rollback(); } throw new TckRepositoryException(x.getLocalizedMessage(), x); } finally { uow.end(); } }

Target:
public void removeAll() throws TckRepositoryException { uow.begin(); final EntityManager manager = managerProvider.get(); try { manager.getTransaction().begin(); manager.createQuery(format("SELECT e FROM %s e", getEntityName(entityClass)), entityClass) .getResultList() .forEach(manager::remove); manager.getTransaction().commit(); } catch (RuntimeException x) { if (manager.getTransaction().isActive()) { manager.getTransaction().rollback(); } throw new TckRepositoryException(x.getLocalizedMessage(), x); } finally { uow.end(); } }
Source:
public boolean kill() { if (status.isKilled()) { return false; } status = SchedulerStatus.KILLED; pinger.interrupt(); schedulingThread.interrupt(); logger.info("Killing all running task processes..."); for (RunningTaskData taskData : jobs.getRunningTasks()) { NodeSet nodes = taskData.getTask().getExecuterInformation().getNodes(); try { taskData.getLauncher().kill(); } catch (Throwable t) { logger.error("Failed to terminate launcher", t); } try { infrastructure.getRMProxiesManager().getUserRMProxy(taskData.getUser(), taskData.getCredentials()) .releaseNodes(nodes, taskData.getTask().getCleaningScript(), null,null,null); } catch (Throwable t) { logger.error("Failed to release nodes", t); } } listenJobLogsSupport.shutdown(); infrastructure.shutdown(); listener.schedulerStateUpdated(SchedulerEvent.KILLED); return true; }

Target:
public boolean kill() { if (status.isKilled()) { return false; } status = SchedulerStatus.KILLED; pinger.interrupt(); schedulingThread.interrupt(); logger.info("Killing all running task processes..."); for (RunningTaskData taskData : jobs.getRunningTasks()) { NodeSet nodes = taskData.getTask().getExecuterInformation().getNodes(); try { taskData.getLauncher().kill(); } catch (Throwable t) { logger.error("Failed to terminate launcher", t); } try { infrastructure.getRMProxiesManager().getUserRMProxy(taskData.getUser(), taskData.getCredentials()) .releaseNodes(nodes, taskData.getTask().getCleaningScript()); } catch (Throwable t) { logger.error("Failed to release nodes", t); } } listenJobLogsSupport.shutdown(); infrastructure.shutdown(); listener.schedulerStateUpdated(SchedulerEvent.KILLED); return true; }
Source:
public void open_withCapabilitiesInInitialResponse_shouldNotIssuePreAuthCapabilitiesCommand() throws Exception { settings.setAuthType(AuthType.PLAIN); MockImapServer server = new MockImapServer(); server.output("* OK [CAPABILITY IMAP4 IMAP4REV1 AUTH=PLAIN]"); server.expect("1 AUTHENTICATE PLAIN"); server.output("+"); server.expect(ByteString.encodeUtf8("\000" + USERNAME + "\000" + PASSWORD).base64()); server.output("1 OK Success"); simplePostAuthenticationDialog(server, true, 2); ImapConnection imapConnection = startServerAndCreateImapConnection(server); imapConnection.open(); server.verifyConnectionStillOpen(); server.verifyInteractionCompleted(); }

Target:
public void open_withCapabilitiesInInitialResponse_shouldNotIssuePreAuthCapabilitiesCommand() throws Exception { settings.setAuthType(AuthType.PLAIN); MockImapServer server = new MockImapServer(); server.output("* OK [CAPABILITY IMAP4 IMAP4REV1 AUTH=PLAIN]"); server.expect("1 AUTHENTICATE PLAIN"); server.output("+"); server.expect(ByteString.encodeUtf8("\000" + USERNAME + "\000" + PASSWORD).base64()); server.output("1 OK Success"); postAuthenticationDialogRequestingCapabilities(server, 2); ImapConnection imapConnection = startServerAndCreateImapConnection(server); imapConnection.open(); server.verifyConnectionStillOpen(); server.verifyInteractionCompleted(); }
Source:
public BiFunction<String, Source, K> getProgramParser(KExceptionManager kem) { ParseInModule parseInModule = getParserModule(kompiledDefinition.mainSyntaxModule()); return getParser(parseInModule, programStartSymbol, kem); }

Target:
public BiFunction<String, Source, K> getProgramParser(KExceptionManager kem) { return getParser(kompiledDefinition.mainSyntaxModule(), programStartSymbol, kem); }
Source:
public UserProperty newInstance(User user) { return new DisplayTimezoneProperty( false, TIMEZONES.get(0) ); }

Target:
public UserProperty newInstance(User user) { return new DisplayTimezoneProperty( false, TimeZone.getDefault().getID() ); }
Source:
public synchronized boolean awaitTermination(long timeout, TimeUnit unit) throws InterruptedException { long now = System.nanoTime(); long end = now + unit.toNanos(timeout); while (!isTerminated() && (end - now) > 0L) { wait((end - now) / 1000L); now = System.nanoTime(); } return isTerminated(); }

Target:
public synchronized boolean awaitTermination(long timeout, TimeUnit unit) throws InterruptedException { long now = System.nanoTime(); long end = now + unit.toNanos(timeout); while (!isTerminated() && (end - now) > 0L) { wait(TimeUnit.NANOSECONDS.toMillis(end - now)); now = System.nanoTime(); } return isTerminated(); }
Source:
public void execute(JobExecutionContext context) throws JobExecutionException { String noteId = context.getJobDetail().getJobDataMap().getString("noteId"); Note note = notebook.getNote(noteId); note.runAll(); while (!note.isTerminated()) { try { Thread.sleep(1000); } catch (InterruptedException e) { logger.error(e.toString(), e); } } boolean releaseResource = false; try { Map<String, Object> config = note.getConfig(); if (config != null && config.containsKey("releaseresource")) { releaseResource = (boolean) note.getConfig().get("releaseresource"); } } catch (ClassCastException e) { logger.error(e.getMessage(), e); } if (releaseResource) { for (InterpreterSetting setting : notebook.getInterpreterSettingManager() .getInterpreterSettings(note.getId())) { try { notebook.getInterpreterSettingManager().restart(setting.getId()); } catch (InterpreterException e) { logger.warn("Fail to resetart interpreter: " + setting.getId(), e); } } } }

Target:
public void execute(JobExecutionContext context) throws JobExecutionException { String noteId = context.getJobDetail().getJobDataMap().getString("noteId"); Note note = notebook.getNote(noteId); note.runAll(); while (!note.isTerminated()) { try { Thread.sleep(1000); } catch (InterruptedException e) { logger.error(e.toString(), e); } } boolean releaseResource = false; try { Map<String, Object> config = note.getConfig(); if (config != null && config.containsKey("releaseresource")) { releaseResource = (boolean) note.getConfig().get("releaseresource"); } } catch (ClassCastException e) { logger.error(e.getMessage(), e); } if (releaseResource) { for (InterpreterSetting setting : notebook.getInterpreterSettingManager() .getInterpreterSettings(note.getId())) { try { notebook.getInterpreterSettingManager().restart(setting.getId()); } catch (InterpreterException e) { logger.error("Fail to restart interpreter: " + setting.getId(), e); } } } }
Source:
private void togglePostLike() { if (!isAdded() || !hasPost() || !NetworkUtils.checkConnection(getActivity())) { return; } boolean isAskingToLike = !mPost.isLikedByCurrentUser; ReaderIconCountView likeCount = (ReaderIconCountView) getView().findViewById(R.id.count_likes); likeCount.setSelected(isAskingToLike); ReaderAnim.animateLikeButton(likeCount.getImageView(), isAskingToLike); boolean success = ReaderPostActions.performLikeAction(mPost, isAskingToLike); if (!success) { likeCount.setSelected(!isAskingToLike); return; } mPost = ReaderPostTable.getPost(mPost.blogId, mPost.postId, false); refreshLikes(); refreshIconCounts(); if (isAskingToLike) { AnalyticsUtils.trackWithReaderPostDetails(AnalyticsTracker.Stat.READER_ARTICLE_LIKED, mPost); } else { AnalyticsUtils.trackWithReaderPostDetails(AnalyticsTracker.Stat.READER_ARTICLE_UNLIKED, mPost); } }

Target:
private void togglePostLike() { if (!isAdded() || !hasPost() || !NetworkUtils.checkConnection(getActivity())) { return; } boolean isAskingToLike = !mPost.isLikedByCurrentUser; ReaderIconCountView likeCount = (ReaderIconCountView) getView().findViewById(R.id.count_likes); likeCount.setSelected(isAskingToLike); ReaderAnim.animateLikeButton(likeCount.getImageView(), isAskingToLike); boolean success = ReaderPostActions.performLikeAction(mPost, isAskingToLike); if (!success) { likeCount.setSelected(!isAskingToLike); return; } mPost = ReaderPostTable.getBlogPost(mPost.blogId, mPost.postId, false); refreshLikes(); refreshIconCounts(); if (isAskingToLike) { AnalyticsUtils.trackWithReaderPostDetails(AnalyticsTracker.Stat.READER_ARTICLE_LIKED, mPost); } else { AnalyticsUtils.trackWithReaderPostDetails(AnalyticsTracker.Stat.READER_ARTICLE_UNLIKED, mPost); } }
Source:
void close() { closed = true; if (!client.isOutputClosed()) { client .sendClose(WebSocket.NORMAL_CLOSURE, CLIENT_DISCONNECT_MESSAGE) .exceptionally(logWebSocketError("Failed to close")); } }

Target:
void close() { closed = true; if (client != null && !client.isOutputClosed()) { client .sendClose(WebSocket.NORMAL_CLOSURE, CLIENT_DISCONNECT_MESSAGE) .exceptionally(logWebSocketError(Level.INFO, "Failed to close")); } }
Source:
private static boolean getWritePermission(int permission) { return permission / 2 % 2 == 1; }

Target:
private static boolean getWritePermission(int permission) { return (permission & 2) == 2; }
Source:
public Response addOrUpdateCompactionConfig( final DataSourceCompactionConfig newConfig, @PathParam("dataSource") String dataSource, @HeaderParam(AuditManager.X_DRUID_AUTHOR) @DefaultValue("") final String author, @HeaderParam(AuditManager.X_DRUID_COMMENT) @DefaultValue("") final String comment, @Context HttpServletRequest req ) { CoordinatorCompactionConfig current = manager.watch( CoordinatorCompactionConfig.CONFIG_KEY, CoordinatorCompactionConfig.class ).get(); final CoordinatorCompactionConfig newCompactionConfig; if (current != null) { final Map<String, DataSourceCompactionConfig> newConfigs = current .getCompactionConfigs() .stream() .collect(Collectors.toMap(DataSourceCompactionConfig::getDataSource, Function.identity())); newConfigs.put(dataSource, newConfig); newCompactionConfig = CoordinatorCompactionConfig.from(current, ImmutableList.copyOf(newConfigs.values())); } else { newCompactionConfig = CoordinatorCompactionConfig.from(ImmutableList.of(newConfig)); } if (!manager.set( CoordinatorCompactionConfig.CONFIG_KEY, newCompactionConfig, new AuditInfo(author, comment, req.getRemoteAddr()) )) { return Response.status(Response.Status.BAD_REQUEST).build(); } return Response.ok().build(); }

Target:
public Response addOrUpdateCompactionConfig( final DataSourceCompactionConfig newConfig, @PathParam("dataSource") String dataSource, @HeaderParam(AuditManager.X_DRUID_AUTHOR) @DefaultValue("") final String author, @HeaderParam(AuditManager.X_DRUID_COMMENT) @DefaultValue("") final String comment, @Context HttpServletRequest req ) { CoordinatorCompactionConfig current = manager.watch( CoordinatorCompactionConfig.CONFIG_KEY, CoordinatorCompactionConfig.class ).get(); final CoordinatorCompactionConfig newCompactionConfig; if (current != null) { final Map<String, DataSourceCompactionConfig> newConfigs = current .getCompactionConfigs() .stream() .collect(Collectors.toMap(DataSourceCompactionConfig::getDataSource, Function.identity())); newConfigs.put(dataSource, newConfig); newCompactionConfig = CoordinatorCompactionConfig.from(current, ImmutableList.copyOf(newConfigs.values())); } else { newCompactionConfig = CoordinatorCompactionConfig.from(ImmutableList.of(newConfig)); } final SetResult setResult = manager.set( CoordinatorCompactionConfig.CONFIG_KEY, newCompactionConfig, new AuditInfo(author, comment, req.getRemoteAddr()) ); if (setResult.isOk()) { return Response.ok().build(); } else { return Response.status(Response.Status.BAD_REQUEST).build(); } }
Source:
public void validateEnums(Host host) { if (host.isSetPowerManagement()) { if (host.getPowerManagement().isSetPmProxies()) { for (PmProxy proxy : host.getPowerManagement().getPmProxies().getPmProxy()) { validateEnum(PmProxyType.class, proxy.getType(), true); } } } if (host.isSetSsh()) { if (host.getSsh().isSetAuthenticationMethod()) { validateEnum(AuthenticationMethod.class, host.getSsh().getAuthenticationMethod(), true); } } }

Target:
public void validateEnums(Host host) { if (host.isSetPowerManagement()) { if (host.getPowerManagement().isSetPmProxies()) { for (PmProxy proxy : host.getPowerManagement().getPmProxies().getPmProxy()) { validateEnum(PmProxyType.class, proxy.getType(), true); } } } if (host.isSetSsh()) { sshValidator.validateEnums(host.getSsh()); } }
Source:
private List<PackageDescr> generatedResourcesToPackageDescr(Resource resource, List<PMMLResource> resources) throws DroolsParserException { List<PackageDescr> pkgDescrs = new ArrayList<>(); DrlParser parser = new DrlParser(configuration.getLanguageLevel()); for (PMMLResource res : resources) { for (String key: res.getRules().keySet()) { String src = res.getRules().get(key); PackageDescr descr = null; descr = parser.parse(false, src); if (descr != null) { descr.setResource(resource); pkgDescrs.add(descr); dumpGeneratedRule(descr,key,src); } else { addBuilderResult(new ParserError(resource, "Parser returned a null Package", 0, 0)); } } } return pkgDescrs; }

Target:
private List<PackageDescr> generatedResourcesToPackageDescr(Resource resource, List<PMMLResource> resources) throws DroolsParserException { List<PackageDescr> pkgDescrs = new ArrayList<>(); DrlParser parser = new DrlParser(configuration.getLanguageLevel()); for (PMMLResource res : resources) { for (Map.Entry<String, String> entry: res.getRules().entrySet()) { String key = entry.getKey(); String src = entry.getValue(); PackageDescr descr = null; descr = parser.parse(false, src); if (descr != null) { descr.setResource(resource); pkgDescrs.add(descr); dumpGeneratedRule(descr,key,src); } else { addBuilderResult(new ParserError(resource, "Parser returned a null Package", 0, 0)); } } } return pkgDescrs; }
Source:
public void handleCommand(ChannelUID channelUID, Command command) { if (command instanceof RefreshType) { logger.debug("Refreshing channel {}", channelUID); coapClient.asyncGet(this); return; } logger.warn("The controller is a read-only device and cannot handle commands."); }

Target:
public void handleCommand(ChannelUID channelUID, Command command) { if (command instanceof RefreshType) { logger.debug("Refreshing channel {}", channelUID); coapClient.asyncGet(this); return; } logger.debug("The controller is a read-only device and cannot handle commands."); }
Source:
protected void refreshContent(){ if (FluxCUtils.isSignedInWPComOrHasWPOrgSite(mAccountStore, mSiteStore)) { List<SiteModel> visibleSites = mSiteStore.getVisibleSites(); if (visibleSites.size() == 0) { ToastUtils.showToast(this, R.string.cant_share_no_visible_blog, ToastUtils.Duration.LONG); finish(); } else if (visibleSites.size() == 1 && isSharingText()) { share(ShareAction.SHARE_TO_POST, visibleSites.get(0).getId()); }else { initShareFragment(false); } } else { ActivityLauncher.loginForShareIntent(this); } }

Target:
private void refreshContent() { if (FluxCUtils.isSignedInWPComOrHasWPOrgSite(mAccountStore, mSiteStore)) { List<SiteModel> visibleSites = mSiteStore.getVisibleSites(); if (visibleSites.size() == 0) { ToastUtils.showToast(this, R.string.cant_share_no_visible_blog, ToastUtils.Duration.LONG); finish(); } else if (visibleSites.size() == 1 && isSharingText()) { share(ShareAction.SHARE_TO_POST, visibleSites.get(0).getId()); } else { initShareFragment(false); } } else { ActivityLauncher.loginForShareIntent(this); } }
Source:
public void resolvePropertiesNotSetAndOverrideTrue() { Map<String, String> originalProperties = new HashMap<>(); originalProperties.put("foo", "bar"); Map<String, String> resolvedProperties = cloudHubArtifactDeployer.resolveProperties(originalProperties, null, true); assertThat("originalProperties should have the same size", resolvedProperties.size(), equalTo(1)); assertThat("resolvedProperties should contains the (foo,bar) entry", resolvedProperties, hasEntry("foo", "bar")); }

Target:
public void resolvePropertiesNotSetAndOverrideTrue() { Map<String, String> resolvedProperties = cloudHubArtifactDeployer.resolveProperties(originalProperties, null, true); assertThat("originalProperties should have the same size", resolvedProperties.size(), equalTo(1)); assertThat("resolvedProperties should contains the (foo,bar) entry", resolvedProperties, hasEntry("foo", "bar")); }
Source:
public Iterable<Result<Upload>> listIncompleteUploads(String bucketName, String prefix) { return listIncompleteUploads(bucketName, prefix, true, true); }

Target:
public Iterable<Result<Upload>> listIncompleteUploads(String bucketName, String prefix) throws XmlPullParserException { return listIncompleteUploads(bucketName, prefix, true, true); }
Source:
private SimpleClientHttpRequestFactory streamingClientHttpRequestFactory() { val factory = new SimpleClientHttpRequestFactory(); factory.setReadTimeout(properties.getReadTimeoutSeconds() * 1000); factory.setConnectTimeout(properties.getConnectTimeoutSeconds() * 1000); factory.setOutputStreaming(true); factory.setBufferRequestBody(false); return factory; }

Target:
private SimpleClientHttpRequestFactory streamingClientHttpRequestFactory() { val factory = new SimpleClientHttpRequestFactory(); System.setProperty("sun.net.client.defaultConnectTimeout", Long.toString(properties.getConnectTimeoutSeconds() * 1000)); System.setProperty("sun.net.client.defaultReadTimeout", Long.toString(properties.getReadTimeoutSeconds() * 1000)); factory.setOutputStreaming(true); factory.setBufferRequestBody(false); return factory; }
Source:
public void renameContainer(final String containerId, final String name) throws DockerException, InterruptedException { WebTarget resource = resource() .path("containers").path(containerId).path("rename"); if (name != null) { checkArgument(CONTAINER_NAME_PATTERN.matcher(name).matches(), "Invalid container name: \"%s\"", name); resource = resource.queryParam("name", name); } log.info("Renaming container with id {}. New name {}.", containerId, name); try { request(POST, resource, resource.request()); } catch (DockerRequestException e) { switch (e.status()) { case 404: throw new ContainerNotFoundException(containerId, e); case 409: throw new ContainerRenameConflictException(containerId, name, e); default: throw e; } } }

Target:
public void renameContainer(final String containerId, final String name) throws DockerException, InterruptedException { WebTarget resource = resource() .path("containers").path(containerId).path("rename"); if (name == null) { throw new IllegalArgumentException("Cannot rename container to null"); } checkArgument(CONTAINER_NAME_PATTERN.matcher(name).matches(), "Invalid container name: \"%s\"", name); resource = resource.queryParam("name", name); log.info("Renaming container with id {}. New name {}.", containerId, name); try { request(POST, resource, resource.request()); } catch (DockerRequestException e) { switch (e.status()) { case 404: throw new ContainerNotFoundException(containerId, e); case 409: throw new ContainerRenameConflictException(containerId, name, e); default: throw e; } } }
Source:
private void ingestChildren(ContentContainerObject destObj, Resource parentResc, AccessGroupSet groupSet) throws DepositException, IOException { NodeIterator iterator = getChildIterator(parentResc); if (iterator == null) { return; } try { while (iterator.hasNext()) { Resource childResc = (Resource) iterator.next(); if (childResc.hasProperty(RDF.type, Cdr.Folder)) { ingestFolder(destObj, parentResc, childResc, groupSet); } else if (childResc.hasProperty(RDF.type, Cdr.Work)) { ingestWork(destObj, parentResc, childResc, groupSet); } else if (childResc.hasProperty(RDF.type, Cdr.FileObject) || !childResc.hasProperty(RDF.type)) { if (destObj instanceof WorkObject) { ingestFileObject(destObj, parentResc, childResc); } else { ingestFileObjectAsWork(destObj, parentResc, childResc); } } else if (childResc.hasProperty(RDF.type, Cdr.Collection)) { ingestCollection(destObj, parentResc, childResc, groupSet); } else if (childResc.hasProperty(RDF.type, Cdr.AdminUnit)) { ingestAdminUnit(destObj, parentResc, childResc, groupSet); } } } finally { iterator.close(); } }

Target:
private void ingestChildren(ContentContainerObject destObj, Resource parentResc, AccessGroupSet groupSet) throws DepositException, IOException { NodeIterator iterator = getChildIterator(parentResc); if (iterator == null) { return; } try { while (iterator.hasNext()) { Resource childResc = (Resource) iterator.next(); if (!childResc.hasProperty(RDF.type) || childResc.hasProperty(RDF.type, Cdr.FileObject)) { if (destObj instanceof WorkObject) { ingestFileObject(destObj, parentResc, childResc); } else { ingestFileObjectAsWork(destObj, parentResc, childResc); } } else if (childResc.hasProperty(RDF.type, Cdr.Folder)) { ingestFolder(destObj, parentResc, childResc, groupSet); } else if (childResc.hasProperty(RDF.type, Cdr.Work)) { ingestWork(destObj, parentResc, childResc, groupSet); } else if (childResc.hasProperty(RDF.type, Cdr.Collection)) { ingestCollection(destObj, parentResc, childResc, groupSet); } else if (childResc.hasProperty(RDF.type, Cdr.AdminUnit)) { ingestAdminUnit(destObj, parentResc, childResc, groupSet); } } } finally { iterator.close(); } }
Source:
private void createVolumeFromSnapshot(HostVO hostVO, SnapshotInfo snapshotInfo, boolean keepGrantedAccess) { SnapshotDetailsVO snapshotDetails = handleSnapshotDetails(snapshotInfo.getId(), "tempVolume", "create"); try { snapshotInfo.getDataStore().getDriver().createAsync(snapshotInfo.getDataStore(), snapshotInfo, null); } finally { _snapshotDetailsDao.remove(snapshotDetails.getId()); } CopyCmdAnswer copyCmdAnswer = performResignature(snapshotInfo, hostVO, keepGrantedAccess); if (copyCmdAnswer == null || !copyCmdAnswer.getResult()) { if (copyCmdAnswer != null && !StringUtils.isEmpty(copyCmdAnswer.getDetails())) { throw new CloudRuntimeException(copyCmdAnswer.getDetails()); } else { throw new CloudRuntimeException("Unable to perform host-side operation"); } } }

Target:
private void createVolumeFromSnapshot(HostVO hostVO, SnapshotInfo snapshotInfo, boolean keepGrantedAccess) { SnapshotDetailsVO snapshotDetails = handleSnapshotDetails(snapshotInfo.getId(), "tempVolume", "create"); try { snapshotInfo.getDataStore().getDriver().createAsync(snapshotInfo.getDataStore(), snapshotInfo, null); } finally { _snapshotDetailsDao.remove(snapshotDetails.getId()); } CopyCmdAnswer copyCmdAnswer = performResignature(snapshotInfo, hostVO, keepGrantedAccess); if (copyCmdAnswer == null || !copyCmdAnswer.getResult()) { if (copyCmdAnswer != null && !StringUtils.isEmpty(copyCmdAnswer.getDetails())) { throw new CloudRuntimeException(copyCmdAnswer.getDetails()); } else { throw new CloudRuntimeException("Unable to create volume from snapshot"); } } }
Source:
static void handleHyperloglogLog2mOverride(BrokerRequest brokerRequest, int hllLog2mOverride) { if (brokerRequest.getAggregationsInfo() != null) { for (AggregationInfo aggregationInfo : brokerRequest.getAggregationsInfo()) { switch (AggregationFunctionType.valueOf(aggregationInfo.getAggregationType().toUpperCase())) { case DISTINCTCOUNTHLL: case DISTINCTCOUNTHLLMV: case DISTINCTCOUNTRAWHLL: case DISTINCTCOUNTRAWHLLMV: if (aggregationInfo.getExpressionsSize() == 1) { aggregationInfo.addToExpressions(Integer.toString(hllLog2mOverride)); } } } } if (brokerRequest.getPinotQuery() != null && brokerRequest.getSelections() != null) { for (Expression expr : brokerRequest.getPinotQuery().getSelectList()) { updateDistinctCountHllExpr(expr, hllLog2mOverride); } } }

Target:
static void handleHyperloglogLog2mOverride(BrokerRequest brokerRequest, int hllLog2mOverride) { if (brokerRequest.getAggregationsInfo() != null) { for (AggregationInfo aggregationInfo : brokerRequest.getAggregationsInfo()) { switch (aggregationInfo.getAggregationType().toUpperCase()) { case "DISTINCTCOUNTHLL": case "DISTINCTCOUNTHLLMV": case "DISTINCTCOUNTRAWHLL": case "DISTINCTCOUNTRAWHLLMV": if (aggregationInfo.getExpressionsSize() == 1) { aggregationInfo.addToExpressions(Integer.toString(hllLog2mOverride)); } } } } if (brokerRequest.getPinotQuery() != null && brokerRequest.getPinotQuery().getSelectList() != null) { for (Expression expr : brokerRequest.getPinotQuery().getSelectList()) { updateDistinctCountHllExpr(expr, hllLog2mOverride); } } }
Source:
public Player(float x, float y, float z, float width, float height, AnimationBundle bundle, CMouse mouse, CKeyboard keyboard, CGamePad gamepad){ traits.add(new PositionTrait(this, x, y, z)); traits.add(new SizeTrait(this, width, height)); traits.add(new DrawableTrait(this, new Sprite())); animator = new AnimatorTrait(this, bundle.getAnimations()); animator.setState("basic"); traits.add(animator); hitboxes = new TimedHitboxTrait(this, bundle.getHitboxes()); traits.add(hitboxes); traits.add(new ControlTrait(this, mouse, keyboard, gamepad)); CBody body = new PlayerBody(width, height).init(new Vector2(x, y)); physical = new PhysicalTrait(this, body); traits.add(physical); traits.add(new DebugTrait(this)); traits.add(new UpdatableTrait(this) { @Override public void update(float delta) { ((Player)self).update(delta); } }); initializeTraits(); body.setFriction(1); }

Target:
public Player(float x, float y, float z, float width, float height, AnimationBundle bundle, CMouse mouse, CKeyboard keyboard, CGamePad gamepad){ traits.add(new PositionTrait(this, x, y, z)); traits.add(new SizeTrait(this, width, height)); traits.add(new DrawableTrait(this, new Sprite())); animator = new AnimatorTrait(this, bundle.getAnimations()); traits.add(animator); hitboxes = new TimedHitboxTrait(this, bundle.getHitboxes()); traits.add(hitboxes); traits.add(new ControlTrait(this, mouse, keyboard, gamepad)); CBody body = new PlayerBody(width, height).init(new Vector2(x, y)); physical = new PhysicalTrait(this, body); traits.add(physical); traits.add(new DebugTrait(this)); traits.add(new UpdatableTrait(this) { @Override public void update(float delta) { ((Player)self).update(delta); } }); initializeTraits(); body.setFriction(1); }
Source:
public ResponseEntity<Object> editLabel(@PathVariable("id") String id, @RequestParam("label") String label) { Map<String, Object> result = new HashMap<>(); result.put("action", "editLabel"); result.put("pid", id); PID pid = PIDs.get(id); try { service.editLabel(AgentPrincipals.createFromThread(), pid, label); } catch (Exception e) { result.put("error", e.getMessage()); Throwable t = e.getCause(); if (t instanceof AuthorizationException || t instanceof AccessRestrictionException) { return new ResponseEntity<>(result, HttpStatus.FORBIDDEN); } else { log.error("Failed to edit label for due to {}", pid, e); return new ResponseEntity<>(result, HttpStatus.INTERNAL_SERVER_ERROR); } } result.put("timestamp", System.currentTimeMillis()); return new ResponseEntity<>(result, HttpStatus.OK); }

Target:
public ResponseEntity<Object> editLabel(@PathVariable("id") String id, @RequestParam("label") String label) { Map<String, Object> result = new HashMap<>(); result.put("action", "editLabel"); result.put("pid", id); PID pid = PIDs.get(id); try { service.editLabel(AgentPrincipals.createFromThread(), pid, label); } catch (Exception e) { result.put("error", e.getMessage()); Throwable t = e.getCause(); if (t instanceof AuthorizationException || t instanceof AccessRestrictionException) { return new ResponseEntity<>(result, HttpStatus.FORBIDDEN); } else { log.error("Failed to edit label for {}", pid, e); return new ResponseEntity<>(result, HttpStatus.INTERNAL_SERVER_ERROR); } } result.put("timestamp", System.currentTimeMillis()); return new ResponseEntity<>(result, HttpStatus.OK); }
Source:
public boolean isDynamic() throws AlreadyExistsException { try { return mGroup.isDynamic(); } catch (Exception e) { throw ExceptionWrapper.wrap(e); } }

Target:
public boolean isDynamic() { try { return mGroup.isDynamic(); } catch (Exception e) { throw ExceptionWrapper.wrap(e); } }
Source:
public void parsesInvalidLastNameField() throws IOException { final MemberProfileJson memberprofilejson = Mockito.mock(MemberProfileJson.class); Mockito.when( memberprofilejson.fetch( Mockito.anyString(), Mockito.anyString(), Mockito.any(Href.class) ) ).thenReturn( Json.createReader( new FileInputStream( PsLinkedinTest.class.getResource( "linkedinTestUserInvalidLastName.json" ).getPath() ) ).readObject() ); MatcherAssert.assertThat( new PsLinkedin(memberprofilejson) .enter(REQUEST).next() .properties().get("last_name"), Matchers.is("?") ); }

Target:
public void parsesInvalidLastNameField() throws IOException { MatcherAssert.assertThat( new PsLinkedin( this.mockRequest( "linkedinTestUserInvalidLastName.json" ), "tapp", "tkey" ).enter(REQUEST).next() .properties().get("last_name"), Matchers.is("?") ); }
Source:
protected List<FormItem> modifyFormItemsAfterCreation(PluginDescriptor focusedInfrastructurePlugin, PluginDescriptor focusedPolicyPlugin) { List<PluginDescriptor.Field> policyDynamicFields = focusedPolicyPlugin.getConfigurableFields() .stream() .filter(PluginDescriptor.Field::isDynamic) .collect(Collectors.toList()); List<PluginDescriptor.Field> infrastructureDynamicIFields = focusedInfrastructurePlugin.getConfigurableFields() .stream() .filter(PluginDescriptor.Field::isDynamic) .collect(Collectors.toList()); List<PluginDescriptor.Field> allDynamicFields = new LinkedList<>(); allDynamicFields.addAll(policyDynamicFields); allDynamicFields.addAll(infrastructureDynamicIFields); List<FormItem> allFormItemsWithHiddenFields = new LinkedList<>(); for (FormItem formItem : this.allFormItems) { allFormItemsWithHiddenFields.add(formItem); if (allDynamicFields.stream() .noneMatch(field -> isPartOfDynamicFields(focusedInfrastructurePlugin, focusedPolicyPlugin, formItem, field))) { if (this.allFormItemsPerPlugin.keySet() .stream() .anyMatch(pluginName -> formItem.getName().startsWith(pluginName)) || formItem.getName().equals("infra") || formItem.getName().equals("policy")) { disableNonDynamicItem(allFormItemsWithHiddenFields, formItem); } } } return allFormItemsWithHiddenFields; }

Target:
protected List<FormItem> modifyFormItemsAfterCreation(PluginDescriptor focusedInfrastructurePlugin, PluginDescriptor focusedPolicyPlugin) { List<PluginDescriptor.Field> policyDynamicFields = focusedPolicyPlugin.getConfigurableFields() .stream() .filter(PluginDescriptor.Field::isDynamic) .collect(Collectors.toList()); List<PluginDescriptor.Field> infrastructureDynamicIFields = focusedInfrastructurePlugin.getConfigurableFields() .stream() .filter(PluginDescriptor.Field::isDynamic) .collect(Collectors.toList()); List<PluginDescriptor.Field> allDynamicFields = new LinkedList<>(); allDynamicFields.addAll(policyDynamicFields); allDynamicFields.addAll(infrastructureDynamicIFields); List<FormItem> allFormItemsWithHiddenFields = new LinkedList<>(); for (FormItem formItem : this.allFormItems) { allFormItemsWithHiddenFields.add(formItem); if (allDynamicFields.stream() .noneMatch(field -> isPartOfDynamicFields(focusedInfrastructurePlugin, focusedPolicyPlugin, formItem, field))) { if (this.allFormItemsPerPlugin.keySet() .stream() .anyMatch(pluginName -> formItem.getName().startsWith(pluginName)) || formItem.getName().equals(INFRASTRUCTURE_FORM_KEY) || formItem.getName().equals(POLICY_FORM_KEY)) { disableNonDynamicItem(allFormItemsWithHiddenFields, formItem); } } } return allFormItemsWithHiddenFields; }
Source:
private synchronized Optional<ConnectorId> getConnectorId(String catalogName) { Optional<Catalog> catalog = catalogByName.get(catalogName); if (catalog == null) { catalog = catalogManager.getCatalog(catalogName); catalogByName.put(catalogName, catalog); if (catalog.isPresent()) { registerCatalog(catalog.get()); } if (catalogManager.hasFederations(catalogName)) { Set<Optional<Catalog>> federatedCatalogs = catalogManager.getFederatedCatalogs(catalogName); if (!federatedCatalogs.stream().allMatch(Optional::isPresent)) { throw new IllegalStateException("Not all federated catalogs exist"); } federatedCatalogs.forEach(federatedCatalog -> registerCatalog(federatedCatalog.get())); } } return catalog.map(Catalog::getConnectorId); }

Target:
private synchronized Optional<ConnectorId> getConnectorId(String catalogName) { Optional<Catalog> catalog = catalogByName.get(catalogName); if (catalog == null) { catalog = catalogManager.getCatalog(catalogName); catalogByName.put(catalogName, catalog); if (catalog.isPresent()) { registerCatalog(catalog.get()); } if (companionCatalogs.containsKey(catalogName)) { Optional<Catalog> companionCatalog = catalogManager.getCatalog(companionCatalogs.get(catalogName)); checkArgument(companionCatalog.isPresent(), format("Invalid config, no catalog exists for catalog name %s: %s", catalogName, companionCatalogs.get(catalogName))); registerCatalog(companionCatalog.get()); } } return catalog.map(Catalog::getConnectorId); }
Source:
public void testJavaScriptJsonString() throws ParseException { StringHolder pattern = new StringHolder(); StringHolder input = new StringHolder("2019-01-18T12:42:03.409Z"); pattern.setValue(IValueFormatConstants.DEFAULT_DATE_PATTERN); ScoutAssert.assertThrows(ParseException.class, () -> new SimpleDateFormat(pattern.getValue()).parse(input.getValue())); ScoutAssert.assertThrows(ParseException.class, () -> new StrictSimpleDateFormat(pattern.getValue()).parse(input.getValue())); pattern.setValue(IValueFormatConstants.TIMESTAMP_PATTERN); ScoutAssert.assertThrows(ParseException.class, () -> new SimpleDateFormat(pattern.getValue()).parse(input.getValue())); ScoutAssert.assertThrows(ParseException.class, () -> new StrictSimpleDateFormat(pattern.getValue()).parse(input.getValue())); pattern.setValue(IValueFormatConstants.TIMESTAMP_WITH_TIMEZONE_PATTERN); ScoutAssert.assertThrows(ParseException.class, () -> new SimpleDateFormat(pattern.getValue()).parse(input.getValue())); ScoutAssert.assertThrows(ParseException.class, () -> new StrictSimpleDateFormat(pattern.getValue()).parse(input.getValue())); pattern.setValue(IValueFormatConstants.DATE_PATTERN); new SimpleDateFormat(pattern.getValue()).parse(input.getValue()); ScoutAssert.assertThrows(ParseException.class, () -> new StrictSimpleDateFormat(pattern.getValue()).parse(input.getValue())); }

Target:
public void testJavaScriptJsonString() throws ParseException { final StringHolder pattern = new StringHolder(); final String input = "2019-01-18T12:42:03.409Z"; pattern.setValue(IValueFormatConstants.DEFAULT_DATE_PATTERN); ScoutAssert.assertThrows(ParseException.class, () -> new SimpleDateFormat(pattern.getValue()).parse(input)); ScoutAssert.assertThrows(ParseException.class, () -> new StrictSimpleDateFormat(pattern.getValue()).parse(input)); pattern.setValue(IValueFormatConstants.TIMESTAMP_PATTERN); ScoutAssert.assertThrows(ParseException.class, () -> new SimpleDateFormat(pattern.getValue()).parse(input)); ScoutAssert.assertThrows(ParseException.class, () -> new StrictSimpleDateFormat(pattern.getValue()).parse(input)); pattern.setValue(IValueFormatConstants.TIMESTAMP_WITH_TIMEZONE_PATTERN); ScoutAssert.assertThrows(ParseException.class, () -> new SimpleDateFormat(pattern.getValue()).parse(input)); ScoutAssert.assertThrows(ParseException.class, () -> new StrictSimpleDateFormat(pattern.getValue()).parse(input)); pattern.setValue(IValueFormatConstants.DATE_PATTERN); new SimpleDateFormat(pattern.getValue()).parse(input); ScoutAssert.assertThrows(ParseException.class, () -> new StrictSimpleDateFormat(pattern.getValue()).parse(input)); }
Source:
public void evaluate() throws Throwable { IBeforeTest before = null; log.debug("Run before test extensions for test class " + testClass.getJavaClass().getName()); try { for (IBeforeTest bfr : befores) { before = bfr; if (before.hasToRun()){ log.debug("Run method runBeforeTest() of class " + before.getClass().getCanonicalName()); before.runBeforeTest(config, target, frameworkMethod); } } } catch (Throwable e) { log.error("Run method runBeforeTest() of class " + before.getClass().getCanonicalName() + " failed", e); if (isScreenshotRequired(e)) { createScreenshot("BeforeTestExt", before.getClass()); } throw e; } nextStatement.evaluate(); }

Target:
public void evaluate() throws Throwable { IBeforeTest before = null; log.debug("Run before test extensions for test class " + testClass.getJavaClass().getName()); try { for (IBeforeTest bfr : befores) { before = bfr; if (before.hasToRun()){ log.debug("Run method runBeforeTest() of class " + before.getClass().getCanonicalName()); before.runBeforeTest(config, target, frameworkMethod); } } } catch (Throwable e) { if(ScreenshotCapturer.shouldCaptureScreenshotOnException(e)){ log.error("Run method runBeforeTest() of class " + before.getClass().getCanonicalName() + " failed", e); createScreenshot("BeforeTestExt", before.getClass()); } throw e; } nextStatement.evaluate(); }
Source:
public Pair<FilterExpression, FilterExpression> visitAndExpression(final AndFilterExpression expression) { Pair<FilterExpression, FilterExpression> left = expression.getLeft().accept(this); Pair<FilterExpression, FilterExpression> right = expression.getRight().accept(this); if (isWhereExpression(left) && isWhereExpression(right)) { return Pair.of( new AndFilterExpression( extractWhereExpression(left), extractWhereExpression(right) ), null ); } else if (isHavingExpression(left) && isWhereExpression(right)) { return Pair.of( extractHavingExpression(left), extractWhereExpression(right) ); } else if (isWhereExpression(left) && isHavingExpression(right)) { return Pair.of( extractWhereExpression(left), extractHavingExpression(right) ); } else { return Pair.of( AndFilterExpression.withLeftAndRight( extractWhereExpression(left), extractWhereExpression(right) ), AndFilterExpression.withLeftAndRight( extractHavingExpression(left), extractHavingExpression(right) ) ); } }

Target:
public FilterConstraints visitAndExpression(final AndFilterExpression expression) { FilterConstraints left = expression.getLeft().accept(this); FilterConstraints right = expression.getRight().accept(this); if (left.isPureWhere() && right.isPureWhere()) { return FilterConstraints.pureWhere( new AndFilterExpression( left.getWhereExpression(), right.getWhereExpression() ) ); } else if (left.isPureHaving() && right.isPureHaving()) { return FilterConstraints.pureHaving( new AndFilterExpression( left.getHavingExpression(), right.getHavingExpression() ) ); } else { return FilterConstraints.withWhereAndHaving( AndFilterExpression.fromPair( left.getWhereExpression(), right.getWhereExpression() ), AndFilterExpression.fromPair( left.getHavingExpression(), right.getHavingExpression() ) ); } }
Source:
public MaxwellKinesisProducer(MaxwellContext context, String kinesisStream) { super(context); this.inflightMessages = new InflightMessageList(); this.kinesisStream = kinesisStream; KinesisProducerConfiguration config = KinesisProducerConfiguration.fromPropertiesFile("kinesis-producer-library.properties"); this.kinesisProducer = new KinesisProducer(config); }

Target:
public MaxwellKinesisProducer(MaxwellContext context, String kinesisStream) { super(context); String partitionKey = context.getConfig().producerPartitionKey; String partitionColumns = context.getConfig().producerPartitionColumns; String partitionFallback = context.getConfig().producerPartitionFallback; boolean kinesisMd5Keys = context.getConfig().kinesisMd5Keys; this.partitioner = new MaxwellKinesisPartitioner(partitionKey, partitionColumns, partitionFallback, kinesisMd5Keys); this.kinesisStream = kinesisStream; Path path = Paths.get("kinesis-producer-library.properties"); if(Files.exists(path) && Files.isRegularFile(path)) { KinesisProducerConfiguration config = KinesisProducerConfiguration.fromPropertiesFile(path.toString()); this.kinesisProducer = new KinesisProducer(config); } else { this.kinesisProducer = new KinesisProducer(); } }
Source:
public String exec(String service, String action, String callbackId, String arguments) throws JSONException { if (arguments == null) { PluginResult pluginResult = new PluginResult(PluginResult.Status.ERROR, "Null arguments"); jsMessageQueue.addPluginResult(pluginResult, callbackId); return jsMessageQueue.popAndEncode(); } jsMessageQueue.setPaused(true); try { boolean wasSync = pluginManager.exec(service, action, callbackId, arguments); String ret = ""; if (!NativeToJsMessageQueue.DISABLE_EXEC_CHAINING || wasSync) { ret = jsMessageQueue.popAndEncode(); } return ret; } finally { jsMessageQueue.setPaused(false); } }

Target:
public String exec(String service, String action, String callbackId, String arguments) throws JSONException { if (arguments == null) { return "@Null arguments."; } jsMessageQueue.setPaused(true); try { boolean wasSync = pluginManager.exec(service, action, callbackId, arguments); String ret = ""; if (!NativeToJsMessageQueue.DISABLE_EXEC_CHAINING || wasSync) { ret = jsMessageQueue.popAndEncode(); } return ret; } finally { jsMessageQueue.setPaused(false); } }
Source:
public Direction getFirstDirection() { switch (this.getMetadata()) { case 0: case 5: case 8: case 9: return Direction.NORTH; case 1: case 3: return Direction.EAST; case 4: case 6: case 7: return Direction.SOUTH; case 2: return Direction.WEST; default: throw new AssertionError(); } }

Target:
public Direction getFirstDirection() { return Constants.RailDirections.getFirstDirection((BlockRailBase.EnumRailDirection) (Object) this); }
Source:
public static void addInstagramExtensions(Activity activity, MediaFeedData item) { Map<String, Object> extensions = ensureExtensions(activity); addLocationExtension(activity, item); if(item.getLikes() != null) { Map<String, Object> likes = new HashMap<String, Object>(); likes.put("count", item.getLikes().getCount()); extensions.put("likes", likes); } extensions.put("hashtags", item.getTags()); Image standardResolution = new Image(); if(item.getType() == "image" && item.getImages() != null) { ImageData standardResolutionData = item.getImages().getStandardResolution(); standardResolution.setHeight((double)standardResolutionData.getImageHeight()); standardResolution.setWidth((double)standardResolutionData.getImageWidth()); standardResolution.setUrl(standardResolutionData.getImageUrl()); } else if(item.getType() == "video" && item.getVideos() != null) { VideoData standardResolutionData = item.getVideos().getStandardResolution(); standardResolution.setHeight((double)standardResolutionData.getHeight()); standardResolution.setWidth((double)standardResolutionData.getWidth()); standardResolution.setUrl(standardResolutionData.getUrl()); } extensions.put("image", standardResolution); }

Target:
public static void addInstagramExtensions(Activity activity, MediaFeedData item) { Map<String, Object> extensions = ensureExtensions(activity); addLocationExtension(activity, item); if(item.getLikes() != null) { Map<String, Object> likes = new HashMap<String, Object>(); likes.put("count", item.getLikes().getCount()); extensions.put("likes", likes); } extensions.put("hashtags", item.getTags()); Comments comments = item.getComments(); String commentsConcat = ""; for(CommentData commentData : comments.getComments()) { commentsConcat += " " + commentData.getText(); } if(item.getCaption() != null) { commentsConcat += " " + item.getCaption().getText(); } extensions.put("keywords", commentsConcat); }