auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public TypedValue getTypedValue(boolean deserializeValue, boolean asTransientValue) { if (Context.getCommandContext() != null) { if (cachedValue != null && cachedValue instanceof SerializableValue) { SerializableValue serializableValue = (SerializableValue) cachedValue; if(deserializeValue && !serializableValue.isDeserialized()) { cachedValue = null; } } if (cachedValue != null && ((asTransientValue && !cachedValue.isTransient()) || !asTransientValue && cachedValue.isTransient())) { cachedValue = null; } } if (cachedValue == null && errorMessage == null) { try { cachedValue = getSerializer().readValue(valueFields, deserializeValue, asTransientValue); if (notifyOnImplicitUpdates && isMutableValue(cachedValue)) { Context.getCommandContext().registerCommandContextListener(this); } } catch (RuntimeException e) { this.errorMessage = e.getMessage(); throw e; } } return cachedValue; }

Target:
public TypedValue getTypedValue(boolean deserializeValue, boolean asTransientValue) { if (Context.getCommandContext() != null) { if (cachedValue != null && cachedValue instanceof SerializableValue) { SerializableValue serializableValue = (SerializableValue) cachedValue; if(deserializeValue && !serializableValue.isDeserialized()) { cachedValue = null; } } if (cachedValue != null && (asTransientValue ^ cachedValue.isTransient())) { cachedValue = null; } } if (cachedValue == null && errorMessage == null) { try { cachedValue = getSerializer().readValue(valueFields, deserializeValue, asTransientValue); if (notifyOnImplicitUpdates && isMutableValue(cachedValue)) { Context.getCommandContext().registerCommandContextListener(this); } } catch (RuntimeException e) { this.errorMessage = e.getMessage(); throw e; } } return cachedValue; }
Source:
public void updateIndex( String resource, GeoEntryExtractor geoEntryExtractor, boolean create, ProgressCallback progressCallback) throws GeoEntryExtractionException, GeoNamesRemoteDownloadException { if (StringUtils.isBlank(resource)) { LOGGER.debug("The resource was null or empty."); return; } if (resourceProcessed(resource)) { LOGGER.trace("{} has already been processed", resource); return; } final List<GeoEntry> geoEntries = new ArrayList<>(); final GeoEntryExtractor.ExtractionCallback extractionCallback = new GeoEntryExtractor.ExtractionCallback() { @Override public void extracted(final GeoEntry newEntry) { geoEntries.add(newEntry); } @Override public void updateProgress(final int progress) { if (progressCallback != null) { progressCallback.updateProgress(progress); } } }; geoEntryExtractor.pushGeoEntriesToExtractionCallback(resource, extractionCallback); if (CollectionUtils.isEmpty(geoEntries)) { LOGGER.debug("No metacards were created from the resource."); return; } updateIndex(geoEntries, create, progressCallback, resource); LOGGER.trace("All data created for: {}", resource); fileProcessingComplete(resource); }

Target:
public void updateIndex( String resource, GeoEntryExtractor geoEntryExtractor, boolean create, ProgressCallback progressCallback) throws GeoEntryIndexingException, GeoEntryExtractionException, GeoNamesRemoteDownloadException { if (StringUtils.isBlank(resource)) { LOGGER.debug("The resource was null or empty."); return; } if (resourceProcessed(resource)) { LOGGER.trace("{} has already been processed", resource); return; } List<Metacard> metacardList = new ArrayList<>(); final GeoEntryExtractor.ExtractionCallback extractionCallback = new GeoEntryExtractor.ExtractionCallback() { @Override public void extracted(final GeoEntry newEntry) throws GeoEntryIndexingException { Metacard metacard = transformGeoEntryToMetacard(newEntry); if (metacard != null) { metacardList.add(metacard); } } @Override public void updateProgress(final int progress) { if (progressCallback != null) { progressCallback.updateProgress(progress); } } }; if (create) { RetryPolicy retryPolicy = new RetryPolicy() .withDelay(10, TimeUnit.SECONDS) .withMaxDuration(5, TimeUnit.MINUTES) .retryOn(Exception.class); Failsafe.with(retryPolicy) .run(() -> removeGeoNamesMetacardsFromCatalog(resource, extractionCallback)); } geoEntryExtractor.pushGeoEntriesToExtractionCallback(resource, extractionCallback); if (CollectionUtils.isEmpty(metacardList)) { LOGGER.debug("No Metacards were created from the resource."); return; } executeCreateMetacardRequest(metacardList); LOGGER.trace("All data created for: {}", resource); fileProcessingComplete(resource); }
Source:
private static void resolveActiveNic(VDS vds){ InetAddress mgmt = null; try { mgmt = InetAddress.getByName(vds.getHostName()); } catch (SecurityException ex) { log.warn("Fail to resolve host ip by name '{}', Details: '{}' ", vds.getHostName(), ex.toString()); log.debug("Exception", ex); return; } catch (UnknownHostException ex) { log.warn("Fail to resolve host ip by name '{}', Details: '{}' ", vds.getHostName(), ex.toString()); log.debug("Exception", ex); return; } String mgmtAdd = mgmt.getHostAddress().trim(); for (VdsNetworkInterface iface : vds.getInterfaces()) { if (iface.getAddress().equals(mgmtAdd)){ vds.setActiveNic(iface.getName()); } } }

Target:
private static String resolveActiveNic(VDS vds){ InetAddress mgmt = null; try { mgmt = InetAddress.getByName(vds.getHostName()); } catch (Exception ex) { log.warn("Fail to resolve host ip by name '{}', Details: '{}' ", vds.getHostName(), ex.toString()); log.debug("Exception", ex); return null; } final String mgmtAdd = mgmt.getHostAddress().trim(); for (VdsNetworkInterface iface : vds.getInterfaces()) { if (iface.getAddress().equals(mgmtAdd)){ vds.setActiveNic(iface.getName()); return mgmtAdd; } } return mgmtAdd; }
Source:
public Object getChromedriverArgs() { return getCapability(AndroidMobileCapabilityType.CHROMEDRIVER_ARGS); }

Target:
public List<String> getChromedriverArgs() { return (List<String>) getCapability(AndroidMobileCapabilityType.CHROMEDRIVER_ARGS); }
Source:
public int hashCode() { int result = super.hashCode(); result = ~~result; result = 31 * result + (defaultValue != null ? defaultValue.hashCode() : 0); result = ~~result; return result; }

Target:
public int hashCode() { return HashUtil.combineHashCodes(Objects.hashCode(defaultValue)); }
Source:
public void testLoopback() { final InterfaceParams ifParams = InterfaceParams.getByName("lo"); assertTrue(ifParams != null); assertEquals("lo", ifParams.name); assertTrue(ifParams.index > 0); assertTrue(ifParams.macAddr != null); assertTrue(ifParams.defaultMtu >= NetworkConstants.ETHER_MTU); }

Target:
public void testLoopback() { final InterfaceParams ifParams = InterfaceParams.getByName("lo"); assertNotNull(ifParams); assertEquals("lo", ifParams.name); assertTrue(ifParams.index > 0); assertNotNull(ifParams.macAddr); assertTrue(ifParams.defaultMtu >= NetworkConstants.ETHER_MTU); }
Source:
public void insertRollups(List<SingleRollupWriteContext> writeContexts) { if (writeContexts.size() == 0) { return; } Map<ResultSetFuture, SingleRollupWriteContext> futureLocatorMap = new HashMap<ResultSetFuture, SingleRollupWriteContext>(); Timer.Context ctx = Instrumentation.getWriteTimerContext( writeContexts.get( 0 ).getDestinationCF().getName() ); try { Timer.Context writeOnlyTimer = startWriteTimer(); try { for (SingleRollupWriteContext writeContext : writeContexts) { Rollup rollup = writeContext.getRollup(); Locator locator = writeContext.getLocator(); Granularity granularity = writeContext.getGranularity(); int ttl = getTtl(locator, rollup.getRollupType(), granularity); RollupType rollupType = writeContext.getRollup().getRollupType(); DAbstractMetricIO io = getIO(rollupType.name().toLowerCase(), granularity); ResultSetFuture future = io.putAsync(locator, writeContext.getTimestamp(), rollup, writeContext.getGranularity(), ttl); futureLocatorMap.put(future, writeContext); } } finally { writeOnlyTimer.stop(); } try { for (final ResultSetFuture future : futureLocatorMap.keySet()) { final SingleRollupWriteContext writeContext = futureLocatorMap.get(future); Timer.Context resultsWaitTimer = startWaitResultsTimer(); try { future.getUninterruptibly().all(); } catch (Exception ex) { Instrumentation.markWriteError(); LOG.error(String.format("error writing locator %s, granularity %s, timestamp %d", writeContext.getLocator(), writeContext.getGranularity(), writeContext.getTimestamp()), ex); } finally { resultsWaitTimer.stop(); } } } finally { } } finally { ctx.stop(); } }

Target:
public void insertRollups(List<SingleRollupWriteContext> writeContexts) { if (writeContexts.size() == 0) { return; } Map<ResultSetFuture, SingleRollupWriteContext> futureLocatorMap = new HashMap<ResultSetFuture, SingleRollupWriteContext>(); Timer.Context ctx = Instrumentation.getWriteTimerContext( writeContexts.get( 0 ).getDestinationCF().getName() ); try { for (SingleRollupWriteContext writeContext : writeContexts) { Rollup rollup = writeContext.getRollup(); Locator locator = writeContext.getLocator(); Granularity granularity = writeContext.getGranularity(); int ttl = getTtl(locator, rollup.getRollupType(), granularity); RollupType rollupType = writeContext.getRollup().getRollupType(); DAbstractMetricIO io = getIO(rollupType.name().toLowerCase(), granularity); ResultSetFuture future = io.putAsync(locator, writeContext.getTimestamp(), rollup, writeContext.getGranularity(), ttl); futureLocatorMap.put(future, writeContext); } for (final ResultSetFuture future : futureLocatorMap.keySet()) { try { future.getUninterruptibly().all(); } catch (Exception ex) { Instrumentation.markWriteError(); final SingleRollupWriteContext writeContext = futureLocatorMap.get(future); LOG.error(String.format("error writing locator %s, granularity %s, timestamp %d", writeContext.getLocator(), writeContext.getGranularity(), writeContext.getTimestamp()), ex); } } } finally { ctx.stop(); } }
Source:
private synchronized void drawHistory() { if (null == coordinates) { return; } historyObjs.removeAll(); final ArrayList<Location> paintHistory = getHistory(); paintHistory.add(coordinates); final int size = paintHistory.size(); if (size == 1) { return; } Location prev = paintHistory.get(0); int current = 1; while (current < size) { final List<LatLng> points = new ArrayList<>(MAX_HISTORY_POINTS); points.add(new LatLng(prev.getLatitude(), prev.getLongitude())); boolean paint = false; while (!paint && current < size) { final Location now = paintHistory.get(current); current++; if (now.distanceTo(prev) < LINE_MAXIMUM_DISTANCE_METERS) { points.add(new LatLng(now.getLatitude(), now.getLongitude())); } else { paint = true; } prev = now; } if (points.size() > 1) { historyObjs.addPolyline(new PolylineOptions() .addAll(points) .color(0xFFFFFFFF) .width(DisplayUtils.getThinLineWidth() / 2f) .zIndex(ZINDEX_HISTORY) ); historyObjs.addPolyline(new PolylineOptions() .addAll(points) .color(trailColor) .width(DisplayUtils.getThinLineWidth()) .zIndex(ZINDEX_HISTORY_SHADOW) ); } } }

Target:
private synchronized void drawHistory() { if (null == coordinates) { return; } historyObjs.removeAll(); final ArrayList<Location> paintHistory = getHistory(); paintHistory.add(coordinates); final int size = paintHistory.size(); if (size == 1) { return; } Location prev = paintHistory.get(0); int current = 1; while (current < size) { final List<LatLng> points = new ArrayList<>(MAX_HISTORY_POINTS); points.add(new LatLng(prev.getLatitude(), prev.getLongitude())); boolean paint = false; while (!paint && current < size) { final Location now = paintHistory.get(current); current++; if (now.distanceTo(prev) < LINE_MAXIMUM_DISTANCE_METERS) { points.add(new LatLng(now.getLatitude(), now.getLongitude())); } else { paint = true; } prev = now; } if (points.size() > 1) { historyObjs.addPolyline(new PolylineOptions() .addAll(points) .color(0xFFFFFFFF) .width(DisplayUtils.getThinLineInsetWidth()) .zIndex(ZINDEX_HISTORY) ); historyObjs.addPolyline(new PolylineOptions() .addAll(points) .color(trailColor) .width(DisplayUtils.getThinLineWidth()) .zIndex(ZINDEX_HISTORY_SHADOW) ); } } }
Source:
public void init() { try { MockVaadinServlet servlet = (MockVaadinServlet) getServlet(); servlet.service = this; ServletConfig config = Mockito.mock(ServletConfig.class); ServletContext context = Mockito.mock(ServletContext.class); Mockito.when(config.getServletContext()).thenReturn(context); Mockito.when(lookup.lookup(ResourceProvider.class)) .thenReturn(resourceProvider); Mockito.when(context.getAttribute(Lookup.class.getName())) .thenReturn(lookup); if ( getServlet().getServletConfig() ==null) { getServlet().init(config); } super.init(); } catch (ServiceException | ServletException e) { throw new RuntimeException(e); } }

Target:
public void init() { try { MockVaadinServlet servlet = (MockVaadinServlet) getServlet(); servlet.service = this; if (getServlet().getServletConfig() == null) { ServletConfig config = Mockito.mock(ServletConfig.class); ServletContext context = Mockito.mock(ServletContext.class); Mockito.when(config.getServletContext()).thenReturn(context); Mockito.when(lookup.lookup(ResourceProvider.class)) .thenReturn(resourceProvider); Mockito.when(context.getAttribute(Lookup.class.getName())) .thenReturn(lookup); getServlet().init(config); } super.init(); } catch (ServiceException | ServletException e) { throw new RuntimeException(e); } }
Source:
protected boolean setAndValidateDiskProfiles() { if (getParameters().getVmTemplate().getDiskList() != null) { Map<DiskImage, Guid> map = new HashMap<>(); for (Disk disk : getParameters().getVmTemplate().getDiskList()) { if (disk instanceof DiskImage) { DiskImage diskImage = (DiskImage) disk; map.put(diskImage, imageToDestinationDomainMap.get(diskImage.getId())); } } return validate(DiskProfileHelper.setAndValidateDiskProfiles(map)); } return true; }

Target:
protected boolean setAndValidateDiskProfiles() { if (getParameters().getVmTemplate().getDiskList() != null) { Map<DiskImage, Guid> map = new HashMap<>(); for (DiskImage diskImage : getParameters().getVmTemplate().getDiskList()) { if (diskImage.getDiskStorageType() == DiskStorageType.IMAGE) { map.put(diskImage, imageToDestinationDomainMap.get(diskImage.getId())); } } return validate(DiskProfileHelper.setAndValidateDiskProfiles(map)); } return true; }
Source:
@Override public <T> IgniteInternalFuture<EntryProcessorResult<T>> invokeAsync( final K key, final EntryProcessor<K, V, T> entryProcessor, final Object... args) throws EntryProcessorException { A.notNull(key, "key", entryProcessor, "entryProcessor"); if (keyCheck) validateCacheKey(key); IgniteInternalFuture<?> fut = asyncOp(new AsyncOp() { @Override public IgniteInternalFuture op(GridNearTxLocal tx, AffinityTopologyVersion readyTopVer) { Map<? extends K, EntryProcessor<K, V, Object>> invokeMap = Collections.singletonMap(key, (EntryProcessor<K, V, Object>)entryProcessor); return tx.invokeAsync(ctx, readyTopVer, invokeMap, args); } @Override public String toString() { return S.toString("invokeAsync", "key", key, true, "entryProcessor", entryProcessor, false); } }); IgniteInternalFuture<GridCacheReturn> fut0 = (IgniteInternalFuture<GridCacheReturn>)fut; return fut0.chain(new CX1<IgniteInternalFuture<GridCacheReturn>, EntryProcessorResult<T>>() { @Override public EntryProcessorResult<T> applyx(IgniteInternalFuture<GridCacheReturn> fut) throws IgniteCheckedException { GridCacheReturn ret = fut.get(); Map<K, EntryProcessorResult<T>> resMap = ret.value(); if (resMap != null) { assert resMap.isEmpty() || resMap.size() == 1 : resMap.size(); return resMap.isEmpty() ? new CacheInvokeResult<T>() : resMap.values().iterator().next(); } return new CacheInvokeResult<>(); } }); }

Target:
@Override public <T> IgniteInternalFuture<EntryProcessorResult<T>> invokeAsync( final K key, final EntryProcessor<K, V, T> entryProcessor, final Object... args) throws EntryProcessorException { A.notNull(key, "key", entryProcessor, "entryProcessor"); if (keyCheck) validateCacheKey(key); IgniteInternalFuture<?> fut = asyncOp(new AsyncOp() { @Override public IgniteInternalFuture op(GridNearTxLocal tx, AffinityTopologyVersion readyTopVer) { Map<? extends K, EntryProcessor<K, V, Object>> invokeMap = Collections.singletonMap(key, (EntryProcessor<K, V, Object>)entryProcessor); return tx.invokeAsync(ctx, readyTopVer, invokeMap, args); } @Override public String toString() { return S.toString("invokeAsync", "key", key, true, "entryProcessor", entryProcessor, false); } }); IgniteInternalFuture<GridCacheReturn> fut0 = (IgniteInternalFuture<GridCacheReturn>)fut; return fut0.chain(new CX1<IgniteInternalFuture<GridCacheReturn>, EntryProcessorResult<T>>() { @Override public EntryProcessorResult<T> applyx(IgniteInternalFuture<GridCacheReturn> fut) throws IgniteCheckedException { GridCacheReturn ret = fut.get(); Map<K, EntryProcessorResult<T>> resMap = ret.value(); if (resMap != null) { assert resMap.isEmpty() || resMap.size() == 1 : resMap.size(); return resMap.isEmpty() ? new CacheInvokeResult<>() : resMap.values().iterator().next(); } return new CacheInvokeResult<>(); } }); }
Source:
private static ThirdPartyContext newContext(String name, boolean multitenant) { BoundedContext context = notStoringEvents(name, multitenant).build(); context.integrationBus() .notifyOfCurrentNeeds(); return new ThirdPartyContext(context); }

Target:
private static ThirdPartyContext newContext(String name, boolean multitenant) { checkNotEmptyOrBlank(name); BoundedContext context = notStoringEvents(name, multitenant).build(); context.integrationBus() .notifyOthers(); return new ThirdPartyContext(context); }
Source:
public String toString() { return String.format("%s, diskId = %s", super.toString(), disk.getId()); }

Target:
public String toString() { return String.format("%s, diskId = %s, addressMap = %s", super.toString(), disk.getId(), getAddressMap()); }
Source:
protected Product validateProductReferences(Product entity) { for (Map.Entry<String, String> entry : entity.getAttributes().entrySet()) { this.attributeValidator.validate(entry.getKey(), entry.getValue()); } if (entity.getProductContent() != null) { for (ProductContent pc : entity.getProductContent()) { if (pc.getContent() == null) { throw new IllegalStateException( "Product contains a ProductContent with a null content reference"); } pc.setProduct(entity); } } if (entity.getBranding() != null) { for (Branding brand : entity.getBranding()) { if (brand.getProductId() == null || brand.getName() == null || brand.getType() == null) { throw new IllegalStateException( "Product contains a Branding with a null product id, name or type."); } } } return entity; }

Target:
protected Product validateProductReferences(Product entity) { for (Map.Entry<String, String> entry : entity.getAttributes().entrySet()) { this.attributeValidator.validate(entry.getKey(), entry.getValue()); } if (entity.getProductContent() != null) { for (ProductContent pc : entity.getProductContent()) { if (pc.getContent() == null) { throw new IllegalStateException( "Product contains a ProductContent with a null content reference"); } pc.setProduct(entity); } } if (entity.getBranding() != null) { for (ProductBranding brand : entity.getBranding()) { if (brand.getProductId() == null || brand.getName() == null || brand.getType() == null) { throw new IllegalStateException( "Product contains a Branding with a null product id, name or type."); } brand.setProduct(entity); } } return entity; }
Source:
public void verifyPseudoConflictDetection() throws IOException { final IComparisonScope scope = new DefaultComparisonScope(rightAndLeftModel, rightAndLeftModel, origin); final Comparison comparison = EMFCompare.builder().build().compare(scope); EList<Conflict> conflicts = comparison.getConflicts(); assertEquals(numberOfConflicts, conflicts.size()); for (Conflict conflict : conflicts) { assertEquals(ConflictKind.PSEUDO, conflict.getKind()); } }

Target:
public void verifyPseudoConflictDetection() throws IOException { final IComparisonScope scope = new DefaultComparisonScope(left, right, origin); final Comparison comparison = EMFCompare.builder().build().compare(scope); EList<Conflict> conflicts = comparison.getConflicts(); assertEquals(numberOfConflicts, conflicts.size()); for (Conflict conflict : conflicts) { assertEquals(ConflictKind.PSEUDO, conflict.getKind()); } }
Source:
public String toString () { StringBuilder result = new StringBuilder(); for (int i = 0; i < data.length; i += 3) { result.append(Float.toString(data[i])).append(", ").append(Float.toString(data[i + 1])).append(", ").append(Float.toString(data[i + 2])).append("\n"); } return result.toString(); }

Target:
public String toString () { StringBuilder result = new StringBuilder(); for (int i = 0; i < data.length; i += 3) { result.append(data[i]).append(", ").append(data[i + 1]).append(", ").append(data[i + 2]).append("\n"); } return result.toString(); }
Source:
public boolean equals(Object o) { if ( this == o ) { return true; } if ( o == null || getClass() != o.getClass() ) { return false; } TypeArgumentConstraintLocation that = (TypeArgumentConstraintLocation) o; if ( !typeParameter.equals( that.typeParameter ) ) { return false; } if ( delegate != null ? !delegate.equals( that.delegate ) : that.delegate != null ) { return false; } if ( !typeForValidatorResolution.equals( that.typeForValidatorResolution ) ) { return false; } return true; }

Target:
public boolean equals(Object o) { if ( this == o ) { return true; } if ( o == null || getClass() != o.getClass() ) { return false; } TypeArgumentConstraintLocation that = (TypeArgumentConstraintLocation) o; if ( !typeParameter.equals( that.typeParameter ) ) { return false; } if ( !delegate.equals( that.delegate ) ) { return false; } return true; }
Source:
private boolean checkLunsInStorageDomain(List<String> lunIds, StorageDomain storageDomain) { List<LUNs> lunsFromDb = getLunDao().getAllForVolumeGroup(getStorageDomain().getStorage()); Set<String> lunsList = new HashSet<>(lunIds); for (LUNs lun : lunsFromDb) { if (lunsList.contains(lun.getLUN_id())) { lunsList.remove(lun.getLUN_id()); } } return lunsList.isEmpty(); }

Target:
private boolean checkLunsInStorageDomain(List<String> lunIds, StorageDomain storageDomain) { List<LUNs> lunsFromDb = getLunDao().getAllForVolumeGroup(getStorageDomain().getStorage()); Set<String> lunsSet = new HashSet<>(lunIds); for (LUNs lun : lunsFromDb) { if (lunsSet.contains(lun.getLUN_id())) { lunsSet.remove(lun.getLUN_id()); } } return lunsSet.isEmpty(); }
Source:
public long getAvgExecutionTime() { long avgExecTime = -1; try { synchronized (this) { avgExecTime = totalExecutionTime / invocationCnt; } } catch (Exception e) { if (invocationCnt == 0 && totalExecutionTime == 0) { avgExecTime = 0; } } return avgExecTime; }

Target:
public long getAvgExecutionTime() { long avgExecTime = -1; synchronized (this) { try { avgExecTime = totalExecutionTime / invocationCnt; } catch (Exception e) { if (invocationCnt == 0 && totalExecutionTime == 0) { avgExecTime = 0; } } } return avgExecTime; }
Source:
public void visitCallExpression(PyCallExpressionTree pyCallExpressionTree) { super.visitCallExpression(pyCallExpressionTree); Symbol symbol = symbolTable.getSymbol(pyCallExpressionTree.callee()); if(symbol != null) { System.out.println(symbol.qualifiedName()); funcNames.add(symbol.qualifiedName()); } }

Target:
public void visitCallExpression(PyCallExpressionTree pyCallExpressionTree) { super.visitCallExpression(pyCallExpressionTree); Symbol symbol = symbolTable.getSymbol(pyCallExpressionTree.callee()); if(symbol != null) { funcNames.add(symbol.qualifiedName()); } }
Source:
public boolean deleteBlog(Context ctx, int id) { int rowsAffected = db.delete(BLOGS_TABLE, "id=?", new String[]{Integer.toString(id)}); deleteQuickPressShortcutsForLocalTableBlogId(ctx, id); deleteAllPostsForLocalTableBlogId(id); PeopleTable.deletePeopleForBlog(id); return (rowsAffected > 0); }

Target:
public boolean deleteBlog(Context ctx, int id) { int rowsAffected = db.delete(BLOGS_TABLE, "id=?", new String[]{Integer.toString(id)}); deleteQuickPressShortcutsForLocalTableBlogId(ctx, id); deleteAllPostsForLocalTableBlogId(id); PeopleTable.deletePeopleForLocalBlogId(id); return (rowsAffected > 0); }
Source:
public static Set<DistributionModuleGroup> getModuleGroups() { Set<DistributionModuleGroup> hs = new HashSet<>(); hs.add(new DistributionModuleGroup(HDInsight36Constant.SPARK_MODULE_GROUP.getModuleName(), false, condition)); hs.add(new DistributionModuleGroup(HDInsight36Constant.BIGDATALAUNCHER_MODULE_GROUP.getModuleName())); hs.add(new DistributionModuleGroup(HDInsight36Constant.HDINSIGHT36COMMON_MODULE_GROUP.getModuleName(), false, condition)); return hs; }

Target:
public static Set<DistributionModuleGroup> getModuleGroups() { Set<DistributionModuleGroup> hs = new HashSet<>(); hs.add(new DistributionModuleGroup(HDInsight36Constant.SPARK_MODULE_GROUP.getModuleName(), false, condition)); hs.add(new DistributionModuleGroup(HDInsight36Constant.BIGDATALAUNCHER_MODULE_GROUP.getModuleName(), false, condition)); hs.add(new DistributionModuleGroup(HDInsight36Constant.HDINSIGHT36COMMON_MODULE_GROUP.getModuleName(), false, condition)); return hs; }
Source:
public SnmpAgentConfig getAgentConfig(final InetAddress address, String location) { final SnmpAgentConfigProxyMapper mapper = SnmpAgentConfigProxyMapper.getInstance(); final SnmpAgentAddress agentAddress = mapper.getAddress(address); final String addressString = str(address); if (agentAddress == null) { LOG.debug( "No agent address mapping found for {}! Try adding a @JUnitSnmpAgent(host=\"{}\", resource=\"...\" entry...", addressString, addressString); return super.getAgentConfig(address); } final SnmpAgentConfig config = new SnmpAgentConfig(agentAddress.getAddress()); config.setProxyFor(address); config.setPort(agentAddress.getPort()); LOG.debug("proxying -> {}", addressString, agentAddress); return config; }

Target:
public SnmpAgentConfig getAgentConfig(final InetAddress address, String location) { final SnmpAgentConfigProxyMapper mapper = SnmpAgentConfigProxyMapper.getInstance(); final SnmpAgentAddress agentAddress = mapper.getAddress(address); final String addressString = str(address); if (agentAddress == null) { LOG.debug( "No agent address mapping found for {}! Try adding a @JUnitSnmpAgent(host=\"{}\", resource=\"...\" entry...", addressString, addressString); return super.getAgentConfig(address, location); } final SnmpAgentConfig config = new SnmpAgentConfig(agentAddress.getAddress()); config.setProxyFor(address); config.setPort(agentAddress.getPort()); LOG.debug("proxying -> {}", addressString, agentAddress); return config; }
Source:
public int getAvailableWidth(int requestedOffset) { int totalWidth = fTimeAlignedComposite.getSize().x; int availableWidth = totalWidth - requestedOffset; return availableWidth; }

Target:
public int getAvailableWidth(int requestedOffset) { return fTimeAlignedComposite.getSize().x - requestedOffset; }
Source:
void putTicket() { imageioClient.putTicket(imageTicket); }

Target:
void putTicket() { assertDoesNotThrow(() -> imageioClient.putTicket(imageTicket)); }
Source:
public void testBrownAndBlack() { String[] input = { "brown", "black" }; int expected = 10; int received = resistorColorDuo.colorCode(input); assertEquals(expected, received); }

Target:
public void testBrownAndBlack() { String[] input = { "brown", "black" }; int expected = 10; int actual = resistorColorDuo.value(input); assertEquals(expected, actual); }
Source:
public void processBarrier(CheckpointBarrier barrier, InputChannelInfo channelInfo) throws IOException { long barrierId = barrier.getId(); if (currentCheckpointId > barrierId || (currentCheckpointId == barrierId && !isCheckpointPending())) { return; } if (currentCheckpointId < barrierId) { if (isCheckpointPending()) { cancelSubsumedCheckpoint(barrierId); } markCheckpointStart(barrier.getTimestamp()); currentCheckpointId = barrierId; numBarriersReceived = 0; allBarriersReceivedFuture = new CompletableFuture<>(); checkpointCoordinator.initCheckpoint(barrierId, barrier.getCheckpointOptions()); for (final InputGate gate : inputGates) { for (int index = 0, numChannels = gate.getNumberOfInputChannels(); index < numChannels; index++) { gate.getChannel(index).checkpointStarted(barrier); } } notifyCheckpoint(barrier, 0); } if (currentCheckpointId == barrierId) { LOG.debug("{}: Received barrier from channel @ {}.", taskName, channelInfo, barrierId); if (++numBarriersReceived == numOpenChannels) { allBarriersReceivedFuture.complete(null); for (final InputGate gate : inputGates) { for (int index = 0, numChannels = gate.getNumberOfInputChannels(); index < numChannels; index++) { gate.getChannel(index).checkpointStopped(currentCheckpointId); } } } } }

Target:
public void processBarrier(CheckpointBarrier barrier, InputChannelInfo channelInfo) throws IOException { long barrierId = barrier.getId(); if (currentCheckpointId > barrierId || (currentCheckpointId == barrierId && !isCheckpointPending())) { return; } if (currentCheckpointId < barrierId) { if (isCheckpointPending()) { cancelSubsumedCheckpoint(barrierId); } markCheckpointStart(barrier.getTimestamp()); currentCheckpointId = barrierId; numBarriersReceived = 0; allBarriersReceivedFuture = new CompletableFuture<>(); checkpointCoordinator.initCheckpoint(barrierId, barrier.getCheckpointOptions()); for (final InputGate gate : inputGates) { for (int index = 0, numChannels = gate.getNumberOfInputChannels(); index < numChannels; index++) { gate.getChannel(index).checkpointStarted(barrier); } } notifyCheckpoint(barrier, 0); } if (currentCheckpointId == barrierId) { LOG.debug("{}: Received barrier from channel @ {}.", taskName, channelInfo, barrierId); if (++numBarriersReceived == numOpenChannels) { allBarriersReceivedFuture.complete(null); resetPendingCheckpoint(barrierId); } } }
Source:
private void onEnd(WorkflowExecutionContext context){ if (Boolean.parseBoolean(ENABLE_POSTPROCESSING)) { return; } while(0<blockingQueue.remainingCapacity()){ try { LOG.debug("Sleeping, no capacity in threadpool...."); TimeUnit.MILLISECONDS.sleep(500); } catch (InterruptedException e) { e.printStackTrace(); } } executorService.execute(new LogMover(context)); }

Target:
private void onEnd(WorkflowExecutionContext context){ if (Boolean.parseBoolean(ENABLE_POSTPROCESSING)) { return; } while(0<blockingQueue.remainingCapacity()){ try { LOG.trace("Sleeping, no capacity in threadpool...."); TimeUnit.MILLISECONDS.sleep(500); } catch (InterruptedException e) { LOG.error("Exception in LogMoverService", e); } } executorService.execute(new LogMover(context)); }
Source:
public static <T> void shuffleHead(@NonNull T[] elements, int n) { shuffleHead(elements, n, ThreadLocalRandom.current()::nextInt); }

Target:
public static <T> void shuffleHead(@NonNull T[] elements, int n) { shuffleHead(elements, n, ThreadLocalRandom.current()); }
Source:
public void testSqlCaseStorage() { try { PrototypeFactory mPrototypeFactory = new PrototypeFactory(); mPrototypeFactory.addClass(Case.class); String storageKey = "TFCase"; String username = "sql-storage-test"; caseStorage = new SqliteIndexedStorageUtility<Case>(Case.class, username, storageKey); caseStorage.write(a); Case readCase = caseStorage.read(1); assertEquals("a_case_name", readCase.getName()); assertEquals(1, readCase.getID()); assertEquals(1, caseStorage.getNumRecords()); int bID = caseStorage.add(b); readCase = caseStorage.read(bID); assertEquals(bID, readCase.getID()); assertEquals("b_case_id", readCase.getCaseId()); assertEquals(2, caseStorage.getNumRecords()); int id = caseStorage.add(c); assertEquals(3, caseStorage.getNumRecords()); readCase = caseStorage.getRecordForValue("case-id", "c_case_id"); assertEquals(id, readCase.getID()); assertEquals(caseStorage.getIDsForValue("case-type", "case_type_ipsum").size(), 3); caseStorage.remove(1); assertEquals(2, caseStorage.getNumRecords()); try { caseStorage.read(1); org.junit.Assert.fail(); } catch(NullPointerException e){ } Iterator iterator = caseStorage.iterator(); while(iterator.hasNext()){ Case mCase = (Case)iterator.next(); String caseId = mCase.getCaseId(); assertTrue(caseId.equals("b_case_id") || caseId.equals("c_case_id")); } caseStorage.removeAll(); assertEquals(0, caseStorage.getNumRecords()); } catch (Exception e) { e.printStackTrace(); fail("Unexpected exception " + e.getMessage()); } finally { SqlSandboxUtils.deleteDatabaseFolder(); } }

Target:
public void testSqlCaseStorage() { try { PrototypeFactory mPrototypeFactory = new PrototypeFactory(); mPrototypeFactory.addClass(Case.class); String storageKey = "TFCase"; String username = "sql-storage-test"; caseStorage = new SqliteIndexedStorageUtility<Case>(Case.class, username, storageKey); caseStorage.write(a); Case readCase = caseStorage.read(1); assertEquals("a_case_name", readCase.getName()); assertEquals(1, readCase.getID()); assertEquals(1, caseStorage.getNumRecords()); int bID = caseStorage.add(b); readCase = caseStorage.read(bID); assertEquals(bID, readCase.getID()); assertEquals("b_case_id", readCase.getCaseId()); assertEquals(2, caseStorage.getNumRecords()); int id = caseStorage.add(c); assertEquals(3, caseStorage.getNumRecords()); readCase = caseStorage.getRecordForValue("case-id", "c_case_id"); assertEquals(id, readCase.getID()); assertEquals(caseStorage.getIDsForValue("case-type", "case_type_ipsum").size(), 3); caseStorage.remove(1); assertEquals(2, caseStorage.getNumRecords()); try { caseStorage.read(1); org.junit.Assert.fail(); } catch(NullPointerException e){ } for (Case mCase : caseStorage) { String caseId = mCase.getCaseId(); assertTrue(caseId.equals("b_case_id") || caseId.equals("c_case_id")); } caseStorage.removeAll(); assertEquals(0, caseStorage.getNumRecords()); } catch (Exception e) { e.printStackTrace(); fail("Unexpected exception " + e.getMessage()); } finally { SqlSandboxUtils.deleteDatabaseFolder(); } }
Source:
private List<List<MetadataField>> getMetadataFieldsList(org.dspace.core.Context context, List<String> query_field) throws SQLException { List<List<MetadataField>> listFieldList = new ArrayList<List<MetadataField>>(); for(String s: query_field) { ArrayList<MetadataField> fields = new ArrayList<MetadataField>(); listFieldList.add(fields); if (s.equals("*")) { continue; } String schema = ""; String element = ""; String qualifier = null; String[] parts = s.split("\\."); if (parts.length>0) { schema = parts[0]; } if (parts.length>1) { element = parts[1]; } if (parts.length>2) { qualifier = parts[2]; } if ("*".equals(qualifier)) { for(MetadataField mf: metadataFieldService.findByUnqualifiedElement(context, schema, element)){ fields.add(mf); } } else { MetadataField mf = metadataFieldService.findByElement(context, schema, element, qualifier); if (mf != null) { fields.add(mf); } } } return listFieldList; }

Target:
private List<List<MetadataField>> getMetadataFieldsList(org.dspace.core.Context context, List<String> query_field) throws SQLException { List<List<MetadataField>> listFieldList = new ArrayList<List<MetadataField>>(); for(String s: query_field) { ArrayList<MetadataField> fields = new ArrayList<MetadataField>(); listFieldList.add(fields); if (s.equals("*")) { continue; } String schema = ""; String element = ""; String qualifier = null; String[] parts = s.split("\\."); if (parts.length>0) { schema = parts[0]; } if (parts.length>1) { element = parts[1]; } if (parts.length>2) { qualifier = parts[2]; } if (Item.ANY.equals(qualifier)) { for(MetadataField mf: metadataFieldService.findFieldsByElementNameUnqualified(context, schema, element)){ fields.add(mf); } } else { MetadataField mf = metadataFieldService.findByElement(context, schema, element, qualifier); if (mf != null) { fields.add(mf); } } } return listFieldList; }
Source:
public void close() { synchronized(factory.cnxns){ factory.removeCnxn(this); if (zkServer != null) { zkServer.removeCnxn(this); } closeSock(); if (sk != null) { try { sk.cancel(); } catch (Exception e) { if (LOG.isDebugEnabled()) { LOG.debug("ignoring exception during selectionkey cancel", e); } } } } }

Target:
public void close() { factory.removeCnxn(this); if (zkServer != null) { zkServer.removeCnxn(this); } closeSock(); if (sk != null) { try { sk.cancel(); } catch (Exception e) { if (LOG.isDebugEnabled()) { LOG.debug("ignoring exception during selectionkey cancel", e); } } } }
Source:
public RegistryResponseType registerDocumentSetB(RegisterDocumentSetRequestType request, AssertionType assertion, NhinTargetSystemType targetSystem, NhincConstants.GATEWAY_API_LEVEL apiLevel) { LOG.debug("Begin registerDocumentSetb"); RegistryResponseType response = new RegistryResponseType(); try { String url = getWebServiceProxyHelper().getUrlFromTargetSystemByGatewayAPILevel(targetSystem, NhincConstants.NHINC_XDS_SERVICE_NAME, apiLevel); ServicePortDescriptor<DocumentRegistryXDSPortType> portDescriptor = new NhinDocDataSubmissionServicePortDescriptor(); CONNECTClient<DocumentRegistryXDSPortType> client = getCONNECTClientSecured(portDescriptor, assertion, url, targetSystem.getHomeCommunity().getHomeCommunityId(), NhincConstants.NHINC_XDS_SERVICE_NAME); client.enableMtom(); response = (RegistryResponseType) client.invokePort(DocumentRegistryXDSPortType.class, "documentRegistryXDSRegisterDocumentSetB", request); } catch (LargePayloadException lpe) { LOG.error("Failed to send message.", lpe); response = getMessageGeneratorUtils().createMissingDocumentRegistryResponse(); } catch (Exception ex) { LOG.error("Error calling registerDocumentSetB: " + ex.getMessage(), ex); response = getMessageGeneratorUtils().createRegistryErrorResponseWithAckFailure(ex.getMessage()); } LOG.debug("End registerDocumentSetb"); return response; }

Target:
public RegistryResponseType registerDocumentSetB(RegisterDocumentSetRequestType request, AssertionType assertion, NhinTargetSystemType targetSystem, NhincConstants.GATEWAY_API_LEVEL apiLevel) { LOG.debug("Begin registerDocumentSetb"); RegistryResponseType response = new RegistryResponseType(); try { String url = getWebServiceProxyHelper().getUrlFromTargetSystemByGatewayAPILevel(targetSystem, NhincConstants.NHINC_XDS_SERVICE_NAME, apiLevel); ServicePortDescriptor<DocumentRegistryXDSPortType> portDescriptor = new NhinDocDataSubmissionServicePortDescriptor(); CONNECTClient<DocumentRegistryXDSPortType> client = getCONNECTClientSecured(portDescriptor, assertion, url, targetSystem.getHomeCommunity().getHomeCommunityId(), NhincConstants.NHINC_XDS_SERVICE_NAME); response = (RegistryResponseType) client.invokePort(DocumentRegistryXDSPortType.class, "documentRegistryXDSRegisterDocumentSetB", request); } catch (Exception ex) { LOG.error("Error calling registerDocumentSetB: {}", ex.getMessage(), ex); response = getMessageGeneratorUtils().createRegistryErrorResponseWithAckFailure(ex.getMessage()); } LOG.debug("End registerDocumentSetb"); return response; }
Source:
public void testUpdateExample() { createExampleIntent(); String exampleText = "Howdy " + UUID.randomUUID().toString(); String exampleText2 = "Howdy " + UUID.randomUUID().toString(); CreateExampleOptions createOptions = new CreateExampleOptions.Builder(workspaceId, exampleIntent, exampleText) .build(); service.createExample(createOptions).execute(); try { UpdateExampleOptions updateOptions = new UpdateExampleOptions.Builder(workspaceId, exampleIntent, exampleText) .newText(exampleText2) .build(); Example response = service.updateExample(updateOptions).execute(); assertNotNull(response); assertNotNull(response.getExampleText()); assertEquals(response.getExampleText(), exampleText2); } catch (Exception ex) { fail(ex.getMessage()); } finally { DeleteExampleOptions deleteOptions = new DeleteExampleOptions.Builder(workspaceId, exampleIntent, exampleText2) .build(); service.deleteExample(deleteOptions).execute(); } }

Target:
public void testUpdateExample() { createExampleIntent(); String exampleText = "Howdy " + UUID.randomUUID().toString(); String exampleText2 = "Howdy " + UUID.randomUUID().toString(); CreateExampleOptions createOptions = new CreateExampleOptions.Builder(workspaceId, exampleIntent, exampleText) .build(); service.createExample(createOptions).execute(); try { Mentions mentions = new Mentions(); mentions.setEntity("entity"); mentions.setLocation(Arrays.asList(0L, 10L)); List<Mentions> mentionsList = new ArrayList<>(); mentionsList.add(mentions); UpdateExampleOptions updateOptions = new UpdateExampleOptions.Builder(workspaceId, exampleIntent, exampleText) .newText(exampleText2) .newMentions(mentionsList) .build(); Example response = service.updateExample(updateOptions).execute(); assertNotNull(response); assertNotNull(response.getExampleText()); assertEquals(response.getExampleText(), exampleText2); assertEquals(response.getMentions(), mentionsList); } catch (Exception ex) { fail(ex.getMessage()); } finally { DeleteExampleOptions deleteOptions = new DeleteExampleOptions.Builder(workspaceId, exampleIntent, exampleText2) .build(); service.deleteExample(deleteOptions).execute(); } }
Source:
public Map<String, Boolean> getCollaboratorRoles(String userName, String projectId) { Map<String, Boolean> collaboratorRolesMap = new HashMap<String, Boolean>(); collaboratorRolesMap.put(RoleNames.ROLE_PROJ_COLLABORATOR_ADMIN, false); collaboratorRolesMap.put(RoleNames.ROLE_PROJ_COLLABORATOR_CONTRIBUTOR, false); collaboratorRolesMap.put(RoleNames.ROLE_PROJ_COLLABORATOR_EDITOR, false); List<String> userDBRoles = accessManager.getProjectCollaboratorRoles(userName, projectId); for (int i = 0; i < userDBRoles.size(); i++) { collaboratorRolesMap.put( roleManager.getQuadrigaRoleByDbId(IQuadrigaRoleManager.PROJECT_ROLES, userDBRoles.get(i)).getId(), true); } return collaboratorRolesMap; }

Target:
public List<String> getCollaboratorRoles(String userName, String projectId) { List<String> userDBRoles = accessManager.getProjectCollaboratorRoles(userName, projectId); List<String> collaboratorRoles = new ArrayList<String>(); userDBRoles.forEach(userDBRole -> collaboratorRoles .add(roleManager.getQuadrigaRoleByDbId(IQuadrigaRoleManager.PROJECT_ROLES, userDBRole).getId())); return collaboratorRoles; }
Source:
SweepOutcome runOnce() { Optional<TableToSweep> tableToSweepOptional = getTableToSweep(); if (!tableToSweepOptional.isPresent()) { log.debug("Skipping sweep because no table has enough new writes to be worth sweeping at the moment."); return SweepOutcome.NOTHING_TO_SWEEP; } TableToSweep tableToSweep = tableToSweepOptional.get(); SweepBatchConfig batchConfig = sweepBatchConfigSource.getAdjustedSweepConfig(); if (StreamTableType.isStreamStoreValueTable(tableToSweep.getTableRef())) { batchConfig = SweepBatchConfig.min(batchConfig, STREAM_STORE_BATCH_CONFIG); } try { specificTableSweeper.runOnceAndSaveResults(tableToSweep, batchConfig); return SweepOutcome.SUCCESS; } catch (InsufficientConsistencyException e) { log.warn("Could not sweep because not all nodes of the database are online.", e); return SweepOutcome.NOT_ENOUGH_DB_NODES_ONLINE; } catch (RuntimeException e) { specificTableSweeper.getSweepMetrics().sweepError(); return determineCauseOfFailure(e, tableToSweep); } }

Target:
SweepOutcome runOnce() { Optional<TableToSweep> tableToSweep = getTableToSweep(); if (!tableToSweep.isPresent()) { log.debug("Skipping sweep because no table has enough new writes to be worth sweeping at the moment."); return SweepOutcome.NOTHING_TO_SWEEP; } SweepBatchConfig batchConfig = sweepBatchConfigSource.getAdjustedSweepConfig(); try { specificTableSweeper.runOnceAndSaveResults(tableToSweep.get(), batchConfig); return SweepOutcome.SUCCESS; } catch (InsufficientConsistencyException e) { log.warn("Could not sweep because not all nodes of the database are online.", e); return SweepOutcome.NOT_ENOUGH_DB_NODES_ONLINE; } catch (RuntimeException e) { specificTableSweeper.getSweepMetrics().sweepError(); return determineCauseOfFailure(e, tableToSweep.get()); } }
Source:
TopologySchedulingResources(Cluster cluster, TopologyDetails td) { remainingResourcesSet = false; metrics = new ResourceMetrics(new StormMetricsRegistry()); clusterAvailableResources = cluster.getNonBlacklistedClusterAvailableResources(Collections.emptyList()); clusterAvailableMemory = clusterAvailableResources.getTotalMemoryMb(); topologyRequiredResources = td.getApproximateTotalResources(); topologyRequiredNonSharedMemory = td.getRequestedNonSharedOffHeap() + td.getRequestedNonSharedOnHeap(); topologySharedMemoryLowerBound = td.getRequestedSharedOffHeap() + td.getRequestedSharedOnHeap(); setScheduledTopologyResources(cluster, td); }

Target:
TopologySchedulingResources(Cluster cluster, TopologyDetails td) { remainingResourcesAreSet = false; clusterAvailableResources = cluster.getNonBlacklistedClusterAvailableResources(Collections.emptyList()); clusterAvailableMemory = clusterAvailableResources.getTotalMemoryMb(); topologyRequiredResources = td.getApproximateTotalResources(); topologyRequiredNonSharedMemory = td.getRequestedNonSharedOffHeap() + td.getRequestedNonSharedOnHeap(); topologySharedMemoryLowerBound = td.getRequestedSharedOffHeap() + td.getRequestedSharedOnHeap(); setScheduledTopologyResources(cluster, td); }
Source:
public Set<String> getRoleViews(final String id) { String ref = getReference(id); LinkedHashSet<String> roleIds = new LinkedHashSet<String>(); AuthzGroup realm = null; try { realm = m_authzGroupService.getAuthzGroup(ref); } catch (GroupNotDefinedException e) { return roleIds; } if (realm == null) { return roleIds; } Set<Role> roles = realm.getRoles(); for (Role role : roles) { roleIds.add(role.getId()); } return roleIds; }

Target:
public Set<String> getRoleViews(final String id) { String ref = getReference(id); LinkedHashSet<String> roleIds = new LinkedHashSet<String>(); AuthzGroup realm = null; try { realm = m_authzGroupService.getAuthzGroup(ref); } catch (GroupNotDefinedException e) { return roleIds; } Set<Role> roles = realm.getRoles(); for (Role role : roles) { roleIds.add(role.getId()); } return roleIds; }
Source:
public void testZstdConfWithMr() throws Exception { JobConf jobConf = new JobConf(); Configuration conf = new Configuration(); jobConf.setInt(ZstandardCodec.PARQUET_COMPRESS_ZSTD_LEVEL, 18); jobConf.setInt(ZstandardCodec.PARQUET_COMPRESS_ZSTD_LEVEL, 4); RunningJob mapRedJob = runMapReduceJob(CompressionCodecName.ZSTD, jobConf, conf); assert(mapRedJob.isSuccessful()); }

Target:
public void testZstdConfWithMr() throws Exception { long fileSizeLowLevel = runMrWithConf(1); CodecFactory.CODEC_BY_NAME.clear(); long fileSizeHighLevel = runMrWithConf(22); Assert.assertTrue(fileSizeLowLevel > fileSizeHighLevel); }
Source:
public void saveOrUpdateCohorts(List<Cohort> cohorts) throws CohortSaveException { try { for(Cohort cohort: cohorts){ if(cohortService.getCohortByUuid(cohort.getUuid()) == null){ cohortService.saveCohort(cohort); } else { cohortService.updateCohort(cohort); } } cohortService.saveCohorts(cohorts); } catch (IOException e) { throw new CohortSaveException(e); } }

Target:
public void saveOrUpdateCohorts(List<Cohort> cohorts) throws CohortSaveException { try { for(Cohort cohort:cohorts){ if(StringUtils.isEmpty(cohort.getUuid())){ cohortService.saveCohort(cohort); } else { cohortService.updateCohort(cohort); } } } catch (IOException e) { throw new CohortSaveException(e); } }
Source:
public void testDesanitizeFromHtmlSet() { Set<String> sanitizedHtml = generateSanitizedHtmlSet(); Set<String> desanitizedHtml = generateUnsanitizedHtmlSet(); assertEquals(desanitizedHtml, SanitizationHelper.desanitizeFromHtml(sanitizedHtml)); assertEquals(new HashSet<>(), SanitizationHelper.desanitizeFromHtml(new HashSet<>())); assertEquals(null, SanitizationHelper.desanitizeFromHtml((Set<String>) null)); }

Target:
public void testDesanitizeFromHtmlSet() { Set<String> sanitizedHtml = new HashSet<>(Arrays.asList( "apple &lt;", "banana &#39; dogs ", "rollercoasters &amp; tycoons", "", null) ); Set<String> desanitizedHtml = new HashSet<>(Arrays.asList( "apple <", "banana ' dogs ", "rollercoasters & tycoons", "", null) ); assertEquals(desanitizedHtml, SanitizationHelper.desanitizeFromHtml(sanitizedHtml)); assertEquals(new HashSet<>(), SanitizationHelper.desanitizeFromHtml(new HashSet<>())); assertNull(SanitizationHelper.desanitizeFromHtml((Set<String>) null)); }