auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void add(FeatureEntry entry, SimpleFeatureCollection collection) throws IOException { FeatureEntry e = new FeatureEntry(); e.init(entry); if (e.getBounds() == null) { e.setBounds(collection.getBounds()); } create(e, collection.getSchema()); Transaction tx = new DefaultTransaction(); try { SimpleFeatureWriter w = writer(e, true, null, tx); SimpleFeatureIterator it = collection.features(); try { while (it.hasNext()) { SimpleFeature f = it.next(); SimpleFeature g = w.next(); for (PropertyDescriptor pd : collection.getSchema().getDescriptors()) { String name = pd.getName().getLocalPart(); if (pd.getType().getBinding() == Boolean.class) { int bool = (Boolean)(f.getAttribute(name)) ? 1 : 0; g.setAttribute(name, bool); } else { g.setAttribute(name, f.getAttribute(name)); } } w.write(); } } finally { w.close(); it.close(); } tx.commit(); } catch (Exception ex) { tx.rollback(); throw new IOException(ex); } finally { tx.close(); } entry.init(e); }

Target:
public void add(FeatureEntry entry, SimpleFeatureCollection collection) throws IOException { FeatureEntry e = new FeatureEntry(); e.init(entry); if (e.getBounds() == null) { e.setBounds(collection.getBounds()); } create(e, collection.getSchema()); Transaction tx = new DefaultTransaction(); try { SimpleFeatureWriter w = writer(e, true, null, tx); SimpleFeatureIterator it = collection.features(); try { while (it.hasNext()) { SimpleFeature f = it.next(); SimpleFeature g = w.next(); for (PropertyDescriptor pd : collection.getSchema().getDescriptors()) { String name = pd.getName().getLocalPart(); if (pd.getType().getBinding() == Boolean.class) { int bool = 0; if (f.getAttribute(name) != null) { bool = (Boolean)(f.getAttribute(name)) ? 1 : 0; } g.setAttribute(name, bool); } else { g.setAttribute(name, f.getAttribute(name)); } } w.write(); } } finally { w.close(); it.close(); } tx.commit(); } catch (Exception ex) { tx.rollback(); throw new IOException(ex); } finally { tx.close(); } entry.init(e); }
Source:
public static boolean isConstraintInPayload(final Map constraints, final Map payload) { for (Object key : constraints.keySet()) { if (!payload.containsKey(key) || payload.get(key) == null) { log.info("Webhook trigger ignored. Item " + key.toString() + " was not found in payload"); return false; } if (!constraints.get(key).equals("") && (!constraints.get(key).equals(payload.get(key)))){ log.info("Webhook trigger ignored. Value of item " + key.toString() + " in payload does not match constraint"); return false; } } return true; }

Target:
public static boolean isConstraintInPayload(final Map constraints, final Map payload) { for (Object key : constraints.keySet()) { if (!payload.containsKey(key) || payload.get(key) == null) { log.info("Webhook trigger ignored. Item " + key.toString() + " was not found in payload"); return false; } if (constraints.get(key) != null && !matches(constraints.get(key).toString(), payload.get(key).toString()) ) { log.info("Webhook trigger ignored. Value of item " + key.toString() + " (" + payload.get(key) + ") in payload does not match constraint " + constraints.get(key)); return false; } } return true; }
Source:
public static Snapshot map(org.ovirt.engine.core.common.businessentities.Snapshot entity, Snapshot template) { Snapshot model = template != null ? template : new Snapshot(); model.setId(entity.getId().toString()); if (entity.getDescription() != null) { model.setDescription(entity.getDescription()); } return model; }

Target:
public static Snapshot map(org.ovirt.engine.core.common.businessentities.Snapshot entity, Snapshot template) { Snapshot model = template != null ? template : new Snapshot(); model.setId(entity.getId().toString()); if (entity.getDescription() != null) { model.setDescription(entity.getDescription()); } if (entity.getCreationDate() != null) { model.setDate(DateMapper.map(entity.getCreationDate(), null)); } return model; }
Source:
default boolean allowRetry(Throwable exception) { if ( exception instanceof KeeperException) { final int rc = ((KeeperException) exception).code().intValue(); return (rc == KeeperException.Code.CONNECTIONLOSS.intValue()) || (rc == KeeperException.Code.OPERATIONTIMEOUT.intValue()) || (rc == KeeperException.Code.SESSIONMOVED.intValue()) || (rc == KeeperException.Code.SESSIONEXPIRED.intValue()) || (rc == -13); } return false; }

Target:
default boolean allowRetry(Throwable exception) { if ( exception instanceof KeeperException) { final int rc = ((KeeperException) exception).code().intValue(); return (rc == KeeperException.Code.CONNECTIONLOSS.intValue()) || (rc == KeeperException.Code.OPERATIONTIMEOUT.intValue()) || (rc == KeeperException.Code.SESSIONMOVED.intValue()) || (rc == KeeperException.Code.SESSIONEXPIRED.intValue()); } return false; }
Source:
private URI determineApplicationModelURI(IApplicationContext appContext) { Optional<String> appModelPath = getArgValue(IWorkbench.XMI_URI_ARG, appContext, false); String appModelPathValue = appModelPath.filter(path -> path.isEmpty()).orElseGet(() -> { Bundle brandingBundle = appContext.getBrandingBundle(); if (brandingBundle != null) { return brandingBundle.getSymbolicName() + "/" + E4Application.APPLICATION_MODEL_PATH_DEFAULT; } else { Logger logger = new WorkbenchLogger(PLUGIN_ID); logger.error(new Exception(), "applicationXMI parameter not set and no branding plugin defined. "); } return null; }); URI applicationModelURI = null; if (URIHelper.isPlatformURI(appModelPathValue)) { applicationModelURI = URI.createURI(appModelPathValue, true); } else { applicationModelURI = URI.createPlatformPluginURI(appModelPathValue, true); } return applicationModelURI; }

Target:
private URI determineApplicationModelURI(IApplicationContext appContext) { Optional<String> appModelPath = getArgValue(IWorkbench.XMI_URI_ARG, appContext, false); String appModelPathValue = appModelPath.filter(path -> !path.isEmpty()).orElseGet(() -> { Bundle brandingBundle = appContext.getBrandingBundle(); if (brandingBundle != null) { return brandingBundle.getSymbolicName() + "/" + E4Application.APPLICATION_MODEL_PATH_DEFAULT; } else { Logger logger = new WorkbenchLogger(PLUGIN_ID); logger.error(new Exception(), "applicationXMI parameter not set and no branding plugin defined. "); } return null; }); URI applicationModelURI = null; if (URIHelper.isPlatformURI(appModelPathValue)) { applicationModelURI = URI.createURI(appModelPathValue, true); } else { applicationModelURI = URI.createPlatformPluginURI(appModelPathValue, true); } return applicationModelURI; }
Source:
public void register(ExtensionBuilder builder) { builder.observer(ConfigurationRegistrar.class); builder.service(ConfigurationPlaceholderResolver.class, ConfigurationSysPropResolver.class); builder.service(ConfigurationPlaceholderResolver.class, ClasspathConfigurationPlaceholderResolver.class); }

Target:
public void register(ExtensionBuilder builder) { builder.observer(ConfigurationRegistrar.class); builder.service(ConfigurationPlaceholderResolver.class, SystemPropertiesConfigurationPlaceholderResolver.class); builder.service(ConfigurationPlaceholderResolver.class, ClasspathConfigurationPlaceholderResolver.class); }
Source:
public ColumnMatchResult validate(Column column, ChecksumResult controlResult, ChecksumResult testResult) { checkColumnType(column); ImmutableList<String> aliases = ImmutableList.<String>builder() .add(getChecksumAlias(column)) .addAll(getFields(column).stream() .map(field -> getChecksumAlias(column, field)) .collect(Collectors.toList())) .build(); return new ColumnMatchResult( aliases.stream().allMatch(alias -> Objects.equals(controlResult.getChecksum(alias), testResult.getChecksum(alias))), prepareMatchMessage(aliases, controlResult, testResult)); }

Target:
public ColumnMatchResult validate(Column column, ChecksumResult controlResult, ChecksumResult testResult) { checkColumnType(column); List<Field> fields = getFields(column); List<String> aliases = ImmutableList.<String>builder() .add(getChecksumAlias(column)) .addAll(IntStream.range(0, fields.size()) .mapToObj(index -> getChecksumAlias(column, fields.get(index), index)) .collect(Collectors.toList())) .build(); return new ColumnMatchResult( aliases.stream().allMatch(alias -> Objects.equals(controlResult.getChecksum(alias), testResult.getChecksum(alias))), prepareMatchMessage(aliases, controlResult, testResult)); }
Source:
public ViewerCell getNeighbor(int directionMask, boolean sameLevel) { ViewerRow row; if ((directionMask & ABOVE) == ABOVE) { row = this.row.getNeighbor(ViewerRow.ABOVE, sameLevel); } else if ((directionMask & BELOW) == BELOW) { row = this.row.getNeighbor(ViewerRow.BELOW, sameLevel); } else { row = this.row; } if (row != null) { int columnIndex; columnIndex = getVisualIndex(); int modifier = 0; if ((directionMask & LEFT) == LEFT) { modifier = -1; } else if ((directionMask & RIGHT) == RIGHT) { modifier = 1; } columnIndex += modifier; if (columnIndex >= 0 && columnIndex < row.getColumnCount()) { ViewerCell cell = row.getCellAtVisualIndex(columnIndex); if (cell != null) { while (columnIndex < row.getColumnCount() - 1 && columnIndex > 0) { if (cell.isVisible()) { break; } columnIndex += modifier; cell = row.getCellAtVisualIndex(columnIndex); if (cell == null) { break; } } } return cell; } } return null; }

Target:
public ViewerCell getNeighbor(int directionMask, boolean sameLevel) { ViewerRow row; if ((directionMask & ABOVE) == ABOVE) { row = this.row.getNeighbor(ViewerRow.ABOVE, sameLevel); } else if ((directionMask & BELOW) == BELOW) { row = this.row.getNeighbor(ViewerRow.BELOW, sameLevel); } else { row = this.row; } if (row != null) { int columnIndex; columnIndex = getVisualIndex(); int modifier = 0; if ((directionMask & LEFT) == LEFT) { modifier = -1; } else if ((directionMask & RIGHT) == RIGHT) { modifier = 1; } columnIndex += modifier; if (columnIndex >= 0 && columnIndex < row.getColumnCount()) { ViewerCell cell = row.getCellAtVisualIndex(columnIndex); while (cell != null && columnIndex < row.getColumnCount() - 1 && columnIndex > 0) { if (cell.isVisible()) { break; } columnIndex += modifier; cell = row.getCellAtVisualIndex(columnIndex); } return cell; } } return null; }
Source:
protected void updateScores() { if (!StorageService.instance.isGossipActive()) return; if (!registered) { if (MessagingService.instance() != null) { MessagingService.instance().register(this); registered = true; } } this.scores = calculateScores(samples); }

Target:
protected void updateScores() { if (!StorageService.instance.isGossipActive() || !MessagingService.instance().isListening()) { return; } this.scores = calculateScores(samples); }
Source:
default Set<EntityHit> getIntersectingEntities(Entity looker, double distance, Predicate<EntityHit> filter) { final Vector3d rotation = looker.getRotation(); final Vector3d direction = Quaterniond.fromAxesAnglesDeg(rotation.getX(), -rotation.getY(), rotation.getZ()).getDirection(); final Optional<EyeLocationProperty> data = looker.getProperty(EyeLocationProperty.class); final Vector3d start = data.map(EyeLocationProperty::getValue).orElse(looker.getLocation().getPosition()); return getIntersectingEntities(start, direction, distance, filter); }

Target:
default Set<EntityHit> getIntersectingEntities(Entity looker, double distance, Predicate<EntityHit> filter) { checkNotNull(looker, "looker"); final Vector3d rotation = looker.getRotation(); final Vector3d direction = Quaterniond.fromAxesAnglesDeg(rotation.getX(), -rotation.getY(), rotation.getZ()).getDirection(); final Optional<EyeLocationProperty> data = looker.getProperty(EyeLocationProperty.class); final Vector3d start = data.map(EyeLocationProperty::getValue).orElse(looker.getLocation().getPosition()); return getIntersectingEntities(start, direction, distance, filter); }
Source:
public void strSubstitutorTest() { Map<String, String> data = new HashMap<String, String>(6); data.put("value", "1234"); data.put("field_format", "String"); StrSubstitutor sub = new StrSubstitutor(data); String message = "The value ${value} in row ${row_number} and column ${column_number} is not type ${field_type} and format ${field_format}"; String result = sub.replace(message); System.out.println("XXXXXXXX:" + result); Assert.assertTrue(result.contains("1234")); }

Target:
public void strSubstitutorTest() { Map<String, String> data = new HashMap<String, String>(6); data.put("value", "1234"); data.put("field_format", "String"); StrSubstitutor sub = new StrSubstitutor(data); String message = "The value ${value} in row ${row_number} and column ${column_number} is not type ${field_type} and format ${field_format}"; String result = sub.replace(message); Assert.assertTrue(result.contains("1234")); }
Source:
private static Optional<Path> sourcesJarPath(Project project) { return PantsBspData.importsFor(project).stream().findFirst() .map(path -> Paths.get(path.getBspPath().toString(), ".bloop", "sources-jar")); }

Target:
private static Optional<Path> sourcesJarPath(Project project) { return bspDir(project).map(path -> Paths.get(path, ".bloop", "sources-jar")); }
Source:
protected byte[] idSubmodule(File directory, Entry e) { final String gitDirPath = e.getName() + "/" + Constants.DOT_GIT; final File submoduleGitDir = new File(directory, gitDirPath); if (!submoduleGitDir.isDirectory()) return zeroid; final ObjectId head; try { RepositoryBuilder builder = new RepositoryBuilder(); builder.setMustExist(true); builder.setFS(FS.DETECTED); builder.setGitDir(submoduleGitDir); head = builder.build().resolve(Constants.HEAD); } catch (IOException exception) { return zeroid; } if (head == null) return zeroid; final byte[] id = new byte[Constants.OBJECT_ID_LENGTH]; head.copyRawTo(id, 0); return id; }

Target:
protected byte[] idSubmodule(File directory, Entry e) { final String gitDirPath = e.getName() + "/" + Constants.DOT_GIT; final File submoduleGitDir = new File(directory, gitDirPath); if (!submoduleGitDir.isDirectory()) return zeroid; final Repository submoduleRepo; try { FS fs = repository != null ? repository.getFS() : FS.DETECTED; submoduleRepo = new RepositoryBuilder().setGitDir(submoduleGitDir) .setMustExist(true).setFS(fs).setMustExist(true).build(); } catch (IOException exception) { return zeroid; } final ObjectId head; try { head = submoduleRepo.resolve(Constants.HEAD); } catch (IOException exception) { return zeroid; } finally { submoduleRepo.close(); } if (head == null) return zeroid; final byte[] id = new byte[Constants.OBJECT_ID_LENGTH]; head.copyRawTo(id, 0); return id; }
Source:
public void trackStartup() { if (hasTrackedStartup == false) { trackEvent("Application-Startup", null, null); hasTrackedStartup = true; } }

Target:
public void trackStartup() { if (!hasTrackedStartup) { trackEvent("Application-Startup", null, null); hasTrackedStartup = true; } }
Source:
public static String trimString(String string, int maxMessageLength) { if (string == null) { return null; } else if (string.length() > maxMessageLength) { return string.substring(0, maxMessageLength); } else { return string; } }

Target:
public static String trimString(String string, int maxMessageLength) { if (string == null) { return null; } else if (string.length() > maxMessageLength) { return string.substring(0, maxMessageLength - 3) + "..."; } else { return string; } }
Source:
public void onRenderFinished(RenderFinishedEvent event) { dependencyManager_.withRMarkdown("R Notebook", "Opening R Notebook", new Command() { @Override public void execute() { if (initialChunkDefs_ != null) { for (int i = 0; i < initialChunkDefs_.length(); i++) { createChunkOutput(initialChunkDefs_.get(i)); } if (initialChunkDefs_.length() > 0) loadInitialChunkOutput(); initialChunkDefs_ = null; editingTarget_.addEditorThemeStyleChangedHandler( TextEditingTargetNotebook.this); lastPlotWidth_ = notebookDoc_.getChunkRenderedWidth(); if (lastPlotWidth_ == 0) { lastPlotWidth_ = getPlotWidth(); } } else { syncHeightTimer_.schedule(250); } } }); }

Target:
public void onRenderFinished(RenderFinishedEvent event) { dependencyManager_.withRMarkdown("R Notebook", "Opening R Notebook", new CommandWithArg<Boolean>() { @Override public void execute(Boolean arg) { if (initialChunkDefs_ != null) { for (int i = 0; i < initialChunkDefs_.length(); i++) { createChunkOutput(initialChunkDefs_.get(i)); } if (initialChunkDefs_.length() > 0) loadInitialChunkOutput(); initialChunkDefs_ = null; editingTarget_.addEditorThemeStyleChangedHandler( TextEditingTargetNotebook.this); lastPlotWidth_ = notebookDoc_.getChunkRenderedWidth(); if (lastPlotWidth_ == 0) { lastPlotWidth_ = getPlotWidth(); } } else { syncHeightTimer_.schedule(250); } } } ); }
Source:
public static Tenor of(Period period) { ArgChecker.notNull(period, "period"); int days = period.getDays(); long months = period.toTotalMonths(); if (months > 0 && days > 0) { return new Tenor(period, period.toString().substring(1)); } else if (months > 0) { return ofMonths(Math.toIntExact(months)); } else if (days > 0) { return ofDays(days); } else { throw new IllegalArgumentException("Period must not be negative or zero"); } }

Target:
public static Tenor of(Period period) { ArgChecker.notNull(period, "period"); int days = period.getDays(); long months = period.toTotalMonths(); if (months == 0 && days != 0) { return ofDays(days); } return new Tenor(period, period.toString().substring(1)); }
Source:
void doCompactEntryLogs(double threshold) { LOG.info("Do compaction to compact those files lower than {}", threshold); Comparator<EntryLogMetadata> usageComparator = (m1, m2) -> { double usage1 = m1.getUsage(); double usage2 = m2.getUsage(); return Double.compare(usage1, usage2); }; List<EntryLogMetadata> logsToCompact = new ArrayList<EntryLogMetadata>(); logsToCompact.addAll(entryLogMetaMap.values()); Collections.sort(logsToCompact, usageComparator); for (EntryLogMetadata meta : logsToCompact) { if (meta.getUsage() >= threshold) { break; } if (LOG.isDebugEnabled()) { LOG.debug("Compacting entry log below threshold {}", meta.getEntryLogId(), threshold); } compactEntryLog(meta); if (!running) { return; } } }

Target:
void doCompactEntryLogs(double threshold) { LOG.info("Do compaction to compact those files lower than {}", threshold); List<EntryLogMetadata> logsToCompact = new ArrayList<EntryLogMetadata>(); logsToCompact.addAll(entryLogMetaMap.values()); logsToCompact.sort(Comparator.comparing(EntryLogMetadata::getUsage)); for (EntryLogMetadata meta : logsToCompact) { if (meta.getUsage() >= threshold) { break; } if (LOG.isDebugEnabled()) { LOG.debug("Compacting entry log below threshold {}", meta.getEntryLogId(), threshold); } compactEntryLog(meta); if (!running) { return; } } }
Source:
public static ValueType fromString(String name) { if (name == null) { return ValueType.STRING; } return valueOf(name.toUpperCase()); }

Target:
public static ValueType fromString(String name) { if (name == null) { return null; } return valueOf(name.toUpperCase()); }
Source:
private void placeSlimefunBlock(SlimefunItem sfItem, ItemStack item, Block block, Dispenser dispenser) { BlockPlacerPlaceEvent e = new BlockPlacerPlaceEvent(dispenser.getBlock(), item, block); Bukkit.getPluginManager().callEvent(e); if(!dispenser.getInventory().getViewers().isEmpty()){ e.setCancelled(true); } if (!e.isCancelled()) { boolean hasItemHandler = sfItem.callItemHandler(BlockPlaceHandler.class, handler -> { if (handler.isBlockPlacerAllowed()) { block.setType(item.getType()); block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, item.getType()); BlockStorage.store(block, sfItem.getId()); handler.onBlockPlacerPlace(e); if (dispenser.getInventory().containsAtLeast(item, 2)) { dispenser.getInventory().removeItem(new CustomItem(item, 1)); } else { SlimefunPlugin.runSync(() -> dispenser.getInventory().removeItem(item), 2L); } } }); if (!hasItemHandler) { block.setType(item.getType()); block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, item.getType()); BlockStorage.store(block, sfItem.getId()); if (dispenser.getInventory().containsAtLeast(item, 2)) { dispenser.getInventory().removeItem(new CustomItem(item, 1)); } else { SlimefunPlugin.runSync(() -> dispenser.getInventory().removeItem(item), 2L); } } } }

Target:
private void placeSlimefunBlock(SlimefunItem sfItem, ItemStack item, Block block, Dispenser dispenser) { BlockPlacerPlaceEvent e = new BlockPlacerPlaceEvent(dispenser.getBlock(), item, block); Bukkit.getPluginManager().callEvent(e); if (!e.isCancelled()) { boolean hasItemHandler = sfItem.callItemHandler(BlockPlaceHandler.class, handler -> { if (handler.isBlockPlacerAllowed()) { block.setType(item.getType()); block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, item.getType()); BlockStorage.store(block, sfItem.getId()); handler.onBlockPlacerPlace(e); if (dispenser.getInventory().containsAtLeast(item, 2)) { dispenser.getInventory().removeItem(new CustomItem(item, 1)); } else { SlimefunPlugin.runSync(() -> dispenser.getInventory().removeItem(item), 2L); } } }); if (!hasItemHandler) { block.setType(item.getType()); block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, item.getType()); BlockStorage.store(block, sfItem.getId()); if (dispenser.getInventory().containsAtLeast(item, 2)) { dispenser.getInventory().removeItem(new CustomItem(item, 1)); } else { SlimefunPlugin.runSync(() -> dispenser.getInventory().removeItem(item), 2L); } } } }
Source:
public View create(Context context, View convertView, ViewGroup parent, LayoutInflater inflater) { willCreate(); View v = inflater.inflate(R .layout.global_actions_grid_item, parent, false); ImageView icon = (ImageView) v.findViewById(R.id.icon); TextView messageView = (TextView) v.findViewById(R.id.message); TextView statusView = (TextView) v.findViewById(R.id.status); final boolean enabled = isEnabled(); if (messageView != null) { messageView.setText(mMessageResId); messageView.setEnabled(enabled); messageView.setSelected(true); } boolean on = ((mState == State.On) || (mState == State.TurningOn)); if (icon != null) { icon.setImageDrawable(context.getDrawable( (on ? mEnabledIconResId : mDisabledIconResid))); icon.setEnabled(enabled); } if (statusView != null) { statusView.setText(on ? mEnabledStatusMessageResId : mDisabledStatusMessageResId); statusView.setVisibility(View.VISIBLE); statusView.setEnabled(enabled); } v.setEnabled(enabled); return v; }

Target:
public View create(Context context, View convertView, ViewGroup parent, LayoutInflater inflater) { willCreate(); View v = inflater.inflate(com.android.systemui.R .layout.global_actions_grid_item, parent, false); ImageView icon = (ImageView) v.findViewById(R.id.icon); TextView messageView = (TextView) v.findViewById(R.id.message); final boolean enabled = isEnabled(); boolean on = ((mState == State.On) || (mState == State.TurningOn)); if (messageView != null) { messageView.setText(on ? mEnabledStatusMessageResId : mDisabledStatusMessageResId); messageView.setEnabled(enabled); messageView.setSelected(true); } if (icon != null) { icon.setImageDrawable(context.getDrawable( (on ? mEnabledIconResId : mDisabledIconResid))); icon.setEnabled(enabled); } v.setEnabled(enabled); return v; }
Source:
private void sendViaPatch(MessageContext msgContext, URL url, String soapActionString) throws AxisFault { HttpClient httpClient = getHttpClient(msgContext); PatchMethod patchMethod = new PatchMethod(); MessageFormatter messageFormatter = populateCommonProperties(msgContext, url, patchMethod, httpClient, soapActionString); patchMethod.setRequestEntity(new AxisRequestEntity(messageFormatter, msgContext, format, soapActionString, chunked, isAllowedRetry)); if (!httpVersion.equals(HTTPConstants.HEADER_PROTOCOL_10) && chunked) { patchMethod.setContentChunked(true); } String soapAction = messageFormatter.formatSOAPAction(msgContext, format, soapActionString); if (soapAction != null && !msgContext.isDoingREST()) { patchMethod.setRequestHeader(HTTPConstants.HEADER_SOAP_ACTION, soapAction); } try { executeMethod(httpClient, msgContext, url, patchMethod); handleResponse(msgContext, patchMethod); } catch (IOException e) { log.info("Unable to sendViaPatch to url[" + url + " ]", e); throw AxisFault.makeFault(e); } finally { cleanup(msgContext, patchMethod); } }

Target:
private void sendViaPatch(MessageContext msgContext, URL url, String soapActionString) throws AxisFault { HttpClient httpClient = getHttpClient(msgContext); PatchMethod patchMethod = new PatchMethod(); MessageFormatter messageFormatter = populateCommonProperties(msgContext, url, patchMethod, httpClient, soapActionString); patchMethod.setRequestEntity(new AxisRequestEntity(messageFormatter, msgContext, format, soapActionString, chunked, isAllowedRetry)); if (!httpVersion.equals(HTTPConstants.HEADER_PROTOCOL_10) && chunked) { patchMethod.setContentChunked(true); } String soapAction = messageFormatter.formatSOAPAction(msgContext, format, soapActionString); if (soapAction != null && !msgContext.isDoingREST()) { patchMethod.setRequestHeader(HTTPConstants.HEADER_SOAP_ACTION, soapAction); } try { executeMethod(httpClient, msgContext, url, patchMethod); handleResponse(msgContext, patchMethod); } catch (IOException e) { String message = "Unable to sendViaPatch to url[" + url + " ]"; throw new AxisFault(message,e); } finally { cleanup(msgContext, patchMethod); } }
Source:
public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, int offset) { for(Image image : disposableImages) { image.dispose(); } disposableImages.clear(); checkInfoAndJob(viewer.getDocument()); if (info == null) { try { this.findInfoJob.getValue().join(COMPLETION_TIMEOUT, new NullProgressMonitor()); } catch (InterruptedException e) { LanguageServerPlugin.logError(e); } } ICompletionProposal[] res = new ICompletionProposal[0]; CompletableFuture<Either<List<CompletionItem>, CompletionList>> request = null; try { if (info != null) { TextDocumentPositionParams param = LSPEclipseUtils.toTextDocumentPosistionParams(info.getFileUri(), offset, info.getDocument()); request = info.getLanguageClient().getTextDocumentService().completion(param); res = toProposals(offset, request.get()); } } catch (Exception ex) { LanguageServerPlugin.logError(ex); if (request != null) { res = toProposals(offset, request.getNow(Either.forLeft(Collections.emptyList()))); this.errorMessage = ex.getMessage(); } } return res; }

Target:
public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, int offset) { checkInfoAndJob(viewer.getDocument()); if (info == null) { try { this.findInfoJob.getValue().join(COMPLETION_TIMEOUT, new NullProgressMonitor()); } catch (InterruptedException e) { LanguageServerPlugin.logError(e); } } ICompletionProposal[] res = new ICompletionProposal[0]; CompletableFuture<Either<List<CompletionItem>, CompletionList>> request = null; try { if (info != null) { TextDocumentPositionParams param = LSPEclipseUtils.toTextDocumentPosistionParams(info.getFileUri(), offset, info.getDocument()); request = info.getLanguageClient().getTextDocumentService().completion(param); res = toProposals(offset, request.get()); } } catch (Exception ex) { LanguageServerPlugin.logError(ex); if (request != null) { res = toProposals(offset, request.getNow(Either.forLeft(Collections.emptyList()))); this.errorMessage = ex.getMessage(); } } return res; }
Source:
private DbUser getDbUser() { DbUser dbUser = null; switch (getParameters().getQueryType()) { case ByInternalId: dbUser = dbUserDao.get(getParameters().getUserId()); break; case ByPrincipalName: dbUser = getDbUserForPrincipalName(getParameters().getPrincipalName(), getParameters().getAuthzName()); break; case ByExternalId: dbUser = dbUserDao.getByExternalId(getParameters().getAuthzName(), getParameters().getExternalId()); break; } if (dbUser == null) { throw new RuntimeException("User not found in database"); } return dbUser; }

Target:
private DbUser getDbUser() { DbUser dbUser = null; switch (getParameters().getQueryType()) { case ByInternalId: logInfo = String.format("for internal id %s", getParameters().getUserId()); dbUser = dbUserDao.get(getParameters().getUserId()); break; case ByPrincipalName: logInfo = String.format("for principal name: %s, authz name: %s", getParameters().getPrincipalName(), getParameters().getAuthzName()); dbUser = getDbUserForPrincipalName(getParameters().getPrincipalName(), getParameters().getAuthzName()); break; case ByExternalId: logInfo = String.format("for external id: %s, authz name: %s", getParameters().getExternalId(), getParameters().getAuthzName()); dbUser = dbUserDao.getByExternalId(getParameters().getAuthzName(), getParameters().getExternalId()); break; } if (dbUser == null) { throw new EngineException(EngineError.PRINCIPAL_NOT_FOUND, "User not found in database"); } return dbUser; }
Source:
public static void importNodes( int numRunners, Input input, BatchingNeoStores stores, IdMapper idMapper, ExecutionMonitor executionMonitor, Monitor monitor ) throws IOException { importData( NODE_IMPORT_NAME, numRunners, input.nodes(), stores, () -> new NodeImporter( stores, idMapper, monitor ), executionMonitor, new MemoryUsageStatsProvider( stores, idMapper ) ); }

Target:
public static void importNodes( int numRunners, Input input, BatchingNeoStores stores, IdMapper idMapper, ExecutionMonitor executionMonitor, Monitor monitor ) throws IOException { Supplier<EntityImporter> importers = () -> new NodeImporter( stores, idMapper, monitor ); importData( NODE_IMPORT_NAME, numRunners, input.nodes(), stores, importers, executionMonitor, new MemoryUsageStatsProvider( stores, idMapper ) ); }
Source:
public void processImpl() { try { CIBACacheAuthReqIds cibaCacheAuthReqIds = grantService.getCacheCibaAuthReqIds(); for (Map.Entry<String, Long> entry : cibaCacheAuthReqIds.getAuthReqIds().entrySet()) { Date now = new Date(); if (entry.getValue() < now.getTime()) { CIBAGrant cibaGrant = authorizationGrantList.getCIBAGrant(entry.getKey()); if (cibaGrant != null) { processExpiredRequest(cibaGrant); } authorizationGrantList.removeCibaGrantFromProcessorCache(entry.getKey()); } } } catch (Exception e) { log.error("Failed to process CIBA request from cache.", e); } }

Target:
public void processImpl() { try { int chunkSize = appConfiguration.getBackchannelRequestsProcessorJobChunkSize() <= 0 ? CHUNK_SIZE : appConfiguration.getBackchannelRequestsProcessorJobChunkSize(); List<CIBARequest> expiredRequests = cibaRequestService.loadExpiredByStatus( CIBAGrantUserAuthorization.AUTHORIZATION_PENDING, chunkSize); expiredRequests.forEach(cibaRequest -> cibaRequestService.updateStatus(cibaRequest, CIBAGrantUserAuthorization.AUTHORIZATION_IN_PROCESS)); for (CIBARequest expiredRequest : expiredRequests) { CIBAGrant cibaGrant = authorizationGrantList.getCIBAGrant(expiredRequest.getAuthReqId()); if (cibaGrant != null) { executorService.execute(() -> processExpiredRequest(cibaGrant, expiredRequest.getAuthReqId()) ); } cibaRequestService.removeCibaRequest(expiredRequest); } } catch (Exception e) { log.error("Failed to process CIBA request from cache.", e); } }
Source:
public static void UpdateBiosSystemInformation(XmlRpcStruct biosInfo, VDS vds){ vds.sethost_manufacturer(AssignStringValue(biosInfo, VdsProperties.host_manufacturer)); vds.sethost_product_name(AssignStringValue(biosInfo, VdsProperties.host_product_name)); vds.sethost_version(AssignStringValue(biosInfo, VdsProperties.host_version)); vds.sethost_serial_number(AssignStringValue(biosInfo, VdsProperties.host_serial_number)); vds.sethost_uuid(AssignStringValue(biosInfo, VdsProperties.host_uuid)); vds.sethost_family(AssignStringValue(biosInfo, VdsProperties.host_family)); DbFacade.getInstance().getVdsStaticDao().update(vds.getStaticData()); }

Target:
public static void UpdateBiosSystemInformation(XmlRpcStruct biosInfo, VDS vds){ vds.setBiosManufacturer(AssignStringValue(biosInfo, VdsProperties.biosManufacturer)); vds.setBiosProductName(AssignStringValue(biosInfo, VdsProperties.biosProductName)); vds.setBiosVersion(AssignStringValue(biosInfo, VdsProperties.biosVersion)); vds.setBiosSerialNumber(AssignStringValue(biosInfo, VdsProperties.biosSerialNumber)); vds.setBiosUUID(AssignStringValue(biosInfo, VdsProperties.biosUUID)); vds.setBiosFamily(AssignStringValue(biosInfo, VdsProperties.biosFamily)); DbFacade.getInstance().getVdsStaticDao().update(vds.getStaticData()); }
Source:
private String getErrorMessage(String name, String description) { if (savingComponentWithComponents()) { return "To be saved as a component, the configuration must have no components of its own."; } if (name.length() == 0) { return "Name cannot be blank"; } if (!name.matches("^[a-zA-Z].*")) { return "Name must start with a letter"; } if (!name.matches("[a-zA-Z0-9_]*")) { return "Name must only contain alphanumeric characters and underscores"; } if (nameMatchesCurrentConfig(name)) { return "Name matches the current configuration"; } try { if (compInProtectionMode(name) && !model.isInManagerMode()) { return "Component with the name already exisist, try again in Manager mode to overwrite it"; } if (configInProtectionMode(name) && !model.isInManagerMode()) { return "Configuration with the name already exsist, try again in Manager mode to overwrite it"; } } catch (ManagerModePvNotConnectedException e) { MessageDialog error = new MessageDialog(this.getShell(), "Error", null, e.getMessage(), MessageDialog.ERROR, new String[] {"OK"},0); error.open(); } BlockServerNameValidator configDescritpionRules = Configurations.getInstance() .variables().configDescriptionRules.getValue(); SummaryDescriptionValidator descriptionValidator = new SummaryDescriptionValidator(null, configDescritpionRules); IStatus status = descriptionValidator.validate(description); if (!status.isOK()) { return status.getMessage(); } return ""; }

Target:
private String getErrorMessage(String name, String description) { if (savingComponentWithComponents()) { return "To be saved as a component, the configuration must have no components of its own."; } if (name.length() == 0) { return "Name cannot be blank"; } if (!name.matches("^[a-zA-Z].*")) { return "Name must start with a letter"; } if (!name.matches("[a-zA-Z0-9_]*")) { return "Name must only contain alphanumeric characters and underscores"; } if (nameMatchesCurrentConfig(name)) { return "Name matches the current configuration"; } try { if (compInProtectionMode(name) && !model.isInManagerMode()) { return "Component with the name already exists, try again in Manager mode to overwrite it"; } if (configInProtectionMode(name) && !model.isInManagerMode()) { return "Configuration with the name already exists, try again in Manager mode to overwrite it"; } } catch (ManagerModePvNotConnectedException e) { MessageDialog error = new MessageDialog(this.getShell(), "Error", null, e.getMessage(), MessageDialog.ERROR, new String[] {"OK"},0); error.open(); } BlockServerNameValidator configDescritpionRules = Configurations.getInstance() .variables().configDescriptionRules.getValue(); SummaryDescriptionValidator descriptionValidator = new SummaryDescriptionValidator(null, configDescritpionRules); IStatus status = descriptionValidator.validate(description); if (!status.isOK()) { return status.getMessage(); } return ""; }
Source:
protected Set<ConstraintCheckIssue> doCheck(Element element, AnnotationMirror annotation) { String lang = (String) annotationApiHelper.getAnnotationValue( annotation, "lang" ).getValue(); String script = (String) annotationApiHelper.getAnnotationValue( annotation, "script" ).getValue(); String reportOn = annotationApiHelper.getAnnotationValue( annotation, "reportOn" ) != null ? (String) annotationApiHelper.getAnnotationValue( annotation, "reportOn" ).getValue() : ""; String alias = annotationApiHelper.getAnnotationValue( annotation, "alias" ) != null ? (String) annotationApiHelper.getAnnotationValue( annotation, "alias" ).getValue() : "_this"; Set<ConstraintCheckIssue> issues = CollectionHelper.newHashSet(); if ( ( lang.trim().length() == 0 ) || ( script.trim().length() == 0 ) || ( alias.trim().length() == 0 ) ) { issues.add( ConstraintCheckIssue.error( element, annotation, "INVALID_SCRIPT_ASSERT_ANNOTATION_PARAMETERS" ) ); } if ( !reportOn.isEmpty() ) { boolean hasReportOnField = false; for ( Element member : elementUtils.getAllMembers( (TypeElement) element ) ) { if ( !member.getKind().isField() ) { continue; } if ( member.getSimpleName().toString().equals( reportOn ) ) { hasReportOnField = true; } } if ( !hasReportOnField ) { issues.add( ConstraintCheckIssue.error( element, annotation, "INVALID_SCRIPT_ASSERT_REPORT_ON_ANNOTATION_PARAMETERS", reportOn ) ); } } return issues; }

Target:
protected Set<ConstraintCheckIssue> doCheck(Element element, AnnotationMirror annotation) { String lang = (String) annotationApiHelper.getAnnotationValue( annotation, "lang" ).getValue(); String script = (String) annotationApiHelper.getAnnotationValue( annotation, "script" ).getValue(); String alias = annotationApiHelper.getAnnotationValue( annotation, "alias" ) != null ? (String) annotationApiHelper.getAnnotationValue( annotation, "alias" ).getValue() : "_this"; if ( ( lang.trim().length() == 0 ) || ( script.trim().length() == 0 ) || ( alias.trim().length() == 0 ) ) { return CollectionHelper.asSet( ConstraintCheckIssue.error( element, annotation, "INVALID_SCRIPT_ASSERT_ANNOTATION_PARAMETERS" ) ); } return Collections.emptySet(); }
Source:
public static KijiTableImportDescriptor createFromEffectiveJson(InputStream istream) throws IOException { try { final TableImportDescriptorDesc desc = readTableImportMappingDescFromJSON(istream); final KijiTableImportDescriptor layout = new KijiTableImportDescriptor(desc); return layout; } finally { IOUtils.closeQuietly(istream); } }

Target:
public static KijiTableImportDescriptor createFromEffectiveJson(InputStream istream) throws IOException { try { final TableImportDescriptorDesc desc = readTableImportMappingDescFromJSON(istream); final KijiTableImportDescriptor layout = new KijiTableImportDescriptor(desc); return layout; } finally { ResourceUtils.closeOrLog(istream); } }
Source:
public Address read(Long id) { LOG.debug("AddressDAO.read() - Begin"); if (id == null) { LOG.info("-- id Parameter is required for Address Query --"); LOG.debug("AddressDAO.read() - End"); return null; } Address foundRecord = super.read(id, Address.class); LOG.debug("AddressDAO.read() - End"); return foundRecord; }

Target:
public Address read(Long id) { LOG.trace("AddressDAO.read() - Begin"); if (id == null) { LOG.trace("-- id Parameter is required for Address Query --"); LOG.trace("AddressDAO.read() - End"); return null; } Address foundRecord = super.read(id, Address.class); LOG.trace("AddressDAO.read() - End"); return foundRecord; }
Source:
private boolean isAnnotationPresentAnywhere(Class<?> clazz) { Set<Annotation> processedAnnotations = new HashSet<>(); return Arrays.stream( clazz.getDeclaredAnnotations() ) .anyMatch( annotation -> isAnnotationAllowed( annotation, processedAnnotations ) ) || Arrays.stream( clazz.getDeclaredFields() ) .flatMap( field -> Arrays.stream( field.getDeclaredAnnotations() ) ) .anyMatch( annotation -> isAnnotationAllowed( annotation, processedAnnotations ) ) || Arrays.stream( clazz.getDeclaredConstructors() ) .flatMap( this::fromExecutable ) .anyMatch( annotation -> isAnnotationAllowed( annotation, processedAnnotations ) ) || Arrays.stream( clazz.getDeclaredMethods() ) .flatMap( this::fromExecutable ) .anyMatch( annotation -> isAnnotationAllowed( annotation, processedAnnotations ) ); }

Target:
private boolean isAnnotationPresentAnywhere(Class<?> clazz) { Set<Annotation> processedAnnotations = new HashSet<>(); if ( isAnnotationPresentIn( clazz.getDeclaredAnnotations(), processedAnnotations ) ) { return true; } for ( Field field : clazz.getDeclaredFields() ) { if ( isAnnotationPresent( field.getAnnotatedType(), processedAnnotations ) ) { return true; } if ( isAnnotationPresentIn( field.getDeclaredAnnotations(), processedAnnotations ) ) { return true; } } for ( Constructor<?> constructor : clazz.getDeclaredConstructors() ) { if ( isAnnotationPresentOn( constructor, processedAnnotations ) ) { return true; } } for ( Method method : clazz.getDeclaredMethods() ) { if ( isAnnotationPresentOn( method, processedAnnotations ) ) { return true; } } return false; }
Source:
private Map<String, GlusterServiceStatus> mergeServiceStatusMaps(List<Map<String, GlusterServiceStatus>> serviceStatusMaps) { Map<String, GlusterServiceStatus> serviceStatusMap = new HashMap<String, GlusterServiceStatus>(); for (Map<String, GlusterServiceStatus> pairResult : serviceStatusMaps) { for (Entry<String, GlusterServiceStatus> entry : pairResult.entrySet()) { String serviceName = entry.getKey(); GlusterServiceStatus status = entry.getValue(); GlusterServiceStatus alreadyFoundStatus = serviceStatusMap.get(serviceName); if (alreadyFoundStatus == null) { serviceStatusMap.put(serviceName, status); } else if (alreadyFoundStatus != status && alreadyFoundStatus != GlusterServiceStatus.MIXED) { serviceStatusMap.put(serviceName, GlusterServiceStatus.MIXED); } } } return serviceStatusMap; }

Target:
private Map<String, GlusterServiceStatus> mergeServiceStatusMaps(List<Map<String, GlusterServiceStatus>> serviceStatusMaps) { Map<String, GlusterServiceStatus> mergedServiceStatusMap = new HashMap<String, GlusterServiceStatus>(); for (Map<String, GlusterServiceStatus> serviceStatusMap : serviceStatusMaps) { for (Entry<String, GlusterServiceStatus> entry : serviceStatusMap.entrySet()) { String serviceName = entry.getKey(); GlusterServiceStatus status = entry.getValue(); GlusterServiceStatus alreadyFoundStatus = mergedServiceStatusMap.get(serviceName); if (alreadyFoundStatus == null) { mergedServiceStatusMap.put(serviceName, status); } else if (alreadyFoundStatus != status && alreadyFoundStatus != GlusterServiceStatus.MIXED) { mergedServiceStatusMap.put(serviceName, GlusterServiceStatus.MIXED); } } } return mergedServiceStatusMap; }
Source:
private ConcurrentHashMap<String, ClientRegistration> toConcurrentMap(List<ClientRegistration> registrations) { final ConcurrentHashMap<String, ClientRegistration> result = new ConcurrentHashMap<>(); for (ClientRegistration registration : registrations) { result.put(registration.getRegistrationId(), registration); } return result; }

Target:
private ConcurrentHashMap<String, ClientRegistration> toConcurrentMap(List<ClientRegistration> registrations) { ConcurrentHashMap<String, ClientRegistration> result = new ConcurrentHashMap<>(); for (ClientRegistration registration : registrations) { result.put(registration.getRegistrationId(), registration); } return result; }
Source:
public static final void assertJenkinsInQuietMode(final JenkinsRule j) { await().pollInterval(250, TimeUnit.MILLISECONDS) .atMost(10, TimeUnit.SECONDS) .until(() -> j.jenkins.get().getQueue().isBlockedByShutdown(task)); }

Target:
public static final void assertJenkinsInQuietMode(final JenkinsRule j) { await().pollInterval(250, TimeUnit.MILLISECONDS) .atMost(10, TimeUnit.SECONDS) .until(() -> j.jenkins.getQueue().isBlockedByShutdown(task)); }
Source:
public void onTrimMemory(final int level) { boolean evictBitmaps = false; switch (level) { case TRIM_MEMORY_COMPLETE: case TRIM_MEMORY_MODERATE: case TRIM_MEMORY_RUNNING_MODERATE: case TRIM_MEMORY_RUNNING_CRITICAL: case TRIM_MEMORY_RUNNING_LOW: evictBitmaps = true; break; case TRIM_MEMORY_BACKGROUND: case TRIM_MEMORY_UI_HIDDEN: onAppGoesToBackground(); break; default: break; } if (evictBitmaps && mBitmapCache != null) { mBitmapCache.evictAll(); } }

Target:
public void onTrimMemory(final int level) { boolean evictBitmaps = false; switch (level) { case TRIM_MEMORY_COMPLETE: case TRIM_MEMORY_MODERATE: case TRIM_MEMORY_RUNNING_MODERATE: case TRIM_MEMORY_RUNNING_CRITICAL: case TRIM_MEMORY_RUNNING_LOW: evictBitmaps = true; break; case TRIM_MEMORY_UI_HIDDEN: onAppGoesToBackground(); break; case TRIM_MEMORY_BACKGROUND: default: break; } if (evictBitmaps && mBitmapCache != null) { mBitmapCache.evictAll(); } }
Source:
DistributedDelayQueue ( CuratorFramework client, QueueConsumer<T> consumer, QueueSerializer<T> serializer, String queuePath, ThreadFactory threadFactory, Executor executor, int minItemsBeforeRefresh, String lockPath, int maxItems, boolean putInBackground, int finalFlushMs ) { Preconditions.checkArgument(minItemsBeforeRefresh >= 0, "minItemsBeforeRefresh cannot be negative"); queue = new DistributedQueue<T> ( client, consumer, serializer, queuePath, threadFactory, executor, minItemsBeforeRefresh, true, lockPath, maxItems, putInBackground, finalFlushMs ) { @Override protected long getDelay(String itemNode) { return getDelay(itemNode, System.currentTimeMillis()); } protected long getDelay(String itemNode, long sortTime) { long epoch = getEpoch(itemNode); return epoch - sortTime; } @Override protected void sortChildren(List<String> children) { final long sortTime = System.currentTimeMillis(); Collections.sort ( children, new Comparator<String>() { @Override public int compare(String o1, String o2) { long diff = getDelay(o1, sortTime) - getDelay(o2, sortTime); return (diff < 0) ? -1 : ((diff > 0) ? 1 : 0); } } ); } }; }

Target:
DistributedDelayQueue ( CuratorFramework client, QueueConsumer<T> consumer, QueueSerializer<T> serializer, String queuePath, ThreadFactory threadFactory, Executor executor, int minItemsBeforeRefresh, String lockPath, int maxItems, boolean putInBackground, int finalFlushMs ) { Preconditions.checkArgument(minItemsBeforeRefresh >= 0, "minItemsBeforeRefresh cannot be negative"); queue = new DistributedQueue<T> ( client, consumer, serializer, queuePath, threadFactory, executor, minItemsBeforeRefresh, true, lockPath, maxItems, putInBackground, finalFlushMs ) { @Override protected long getDelay(String itemNode) { return getDelay(itemNode, System.currentTimeMillis()); } private long getDelay(String itemNode, long sortTime) { long epoch = getEpoch(itemNode); return epoch - sortTime; } @Override protected void sortChildren(List<String> children) { final long sortTime = System.currentTimeMillis(); Collections.sort ( children, new Comparator<String>() { @Override public int compare(String o1, String o2) { long diff = getDelay(o1, sortTime) - getDelay(o2, sortTime); return (diff < 0) ? -1 : ((diff > 0) ? 1 : 0); } } ); } }; }
Source:
public T one(final String id) { try { return reactiveSupport.one(id).block(); } catch(DocumentNotFoundException dnfe){ dnfe.printStackTrace(); return null; } }

Target:
public T one(final String id) { return reactiveSupport.one(id).block(); }
Source:
public void testGetTrackInfo() throws Exception { prepareLooper(); final List<SessionPlayer.TrackInfo> testTracks = MediaTestUtils.createTrackInfoList(); Bundle playerConfig = RemoteMediaSession.createMockPlayerConnectorConfigForTrackInfo(testTracks); mRemoteSession.updatePlayer(playerConfig); MediaController controller = createController(mRemoteSession.getToken()); List<SessionPlayer.TrackInfo> testTracksFromController = controller.getTrackInfo(); for (int i = 0; i < testTracks.size(); i++) { SessionPlayer.TrackInfo track = testTracks.get(i); SessionPlayer.TrackInfo trackFromController = testTracksFromController.get(i); assertEquals(track, trackFromController); assertEquals(track.getId(), trackFromController.getId()); assertEquals(track.getLanguage(), trackFromController.getLanguage()); assertEquals(track.getTrackType(), trackFromController.getTrackType()); } }

Target:
public void testGetTrackInfo() throws Exception { prepareLooper(); final List<SessionPlayer.TrackInfo> testTracks = MediaTestUtils.createTrackInfoList(); Bundle playerConfig = RemoteMediaSession.createMockPlayerConnectorConfigForTrackInfo(testTracks); mRemoteSession.updatePlayer(playerConfig); MediaController controller = createController(mRemoteSession.getToken()); List<SessionPlayer.TrackInfo> testTracksFromController = controller.getTrackInfo(); assertEquals(testTracks.size(), testTracksFromController.size()); for (int i = 0; i < testTracks.size(); i++) { SessionPlayer.TrackInfo track = testTracks.get(i); SessionPlayer.TrackInfo trackFromController = testTracksFromController.get(i); assertEquals(track, trackFromController); assertEquals(track.getLanguage(), trackFromController.getLanguage()); assertEquals(track.getTrackType(), trackFromController.getTrackType()); } }
Source:
public void createRelationship(PID subject, Property property, Resource object) { String sparqlUpdate = SparqlUpdateHelper.createSparqlReplace(subject.getRepositoryPath(), property, object); persistTripleToFedora(subject, sparqlUpdate); }

Target:
public void createRelationship(PID subject, Property property, Resource object) { String sparqlUpdate = SparqlUpdateHelper.createSparqlInsert(subject.getRepositoryPath(), property, object); persistTripleToFedora(subject, sparqlUpdate); }