auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
DruidCoordinator( DruidCoordinatorConfig config, ZkPathsConfig zkPaths, JacksonConfigManager configManager, MetadataSegmentManager metadataSegmentManager, ServerInventoryView serverInventoryView, MetadataRuleManager metadataRuleManager, CuratorFramework curator, ServiceEmitter emitter, ScheduledExecutorFactory scheduledExecutorFactory, IndexingServiceClient indexingServiceClient, LoadQueueTaskMaster taskMaster, ServiceAnnouncer serviceAnnouncer, DruidNode self, ConcurrentMap<String, LoadQueuePeon> loadQueuePeonMap, Set<DruidCoordinatorHelper> indexingServiceHelpers, BalancerStrategyFactory factory, LookupCoordinatorManager lookupCoordinatorManager, DruidLeaderSelector coordLeaderSelector ) { this.config = config; this.zkPaths = zkPaths; this.configManager = configManager; this.metadataSegmentManager = metadataSegmentManager; this.serverInventoryView = serverInventoryView; this.metadataRuleManager = metadataRuleManager; this.curator = curator; this.emitter = emitter; this.indexingServiceClient = indexingServiceClient; this.taskMaster = taskMaster; this.serviceAnnouncer = serviceAnnouncer; this.self = self; this.indexingServiceHelpers = indexingServiceHelpers; this.exec = scheduledExecutorFactory.create(1, "Coordinator-Exec--%d"); this.loadManagementPeons = loadQueuePeonMap; this.factory = factory; this.lookupCoordinatorManager = lookupCoordinatorManager; this.coordLeaderSelector = coordLeaderSelector; this.segmentCompactor = new DruidCoordinatorSegmentCompactor(indexingServiceClient); this.dataSourcesSnapshot = metadataSegmentManager.getDataSourcesSnapshot(); }

Target:
DruidCoordinator( DruidCoordinatorConfig config, ZkPathsConfig zkPaths, JacksonConfigManager configManager, MetadataSegmentManager metadataSegmentManager, ServerInventoryView serverInventoryView, MetadataRuleManager metadataRuleManager, CuratorFramework curator, ServiceEmitter emitter, ScheduledExecutorFactory scheduledExecutorFactory, IndexingServiceClient indexingServiceClient, LoadQueueTaskMaster taskMaster, ServiceAnnouncer serviceAnnouncer, DruidNode self, ConcurrentMap<String, LoadQueuePeon> loadQueuePeonMap, Set<DruidCoordinatorHelper> indexingServiceHelpers, BalancerStrategyFactory factory, LookupCoordinatorManager lookupCoordinatorManager, DruidLeaderSelector coordLeaderSelector ) { this.config = config; this.zkPaths = zkPaths; this.configManager = configManager; this.metadataSegmentManager = metadataSegmentManager; this.serverInventoryView = serverInventoryView; this.metadataRuleManager = metadataRuleManager; this.curator = curator; this.emitter = emitter; this.indexingServiceClient = indexingServiceClient; this.taskMaster = taskMaster; this.serviceAnnouncer = serviceAnnouncer; this.self = self; this.indexingServiceHelpers = indexingServiceHelpers; this.exec = scheduledExecutorFactory.create(1, "Coordinator-Exec--%d"); this.loadManagementPeons = loadQueuePeonMap; this.factory = factory; this.lookupCoordinatorManager = lookupCoordinatorManager; this.coordLeaderSelector = coordLeaderSelector; this.segmentCompactor = new DruidCoordinatorSegmentCompactor(indexingServiceClient); }
Source:
Resources getResourcesForSubId(@NonNull final Context c, final int subId) { return SubscriptionManager.getResourcesForSubId(c, subId); }

Target:
Resources getResourcesForSubId(@NonNull final Context c, final int subId) { final Resources res = SubscriptionManager.getResourcesForSubId(c, subId); if (isSpecificRoamingMccMnc()) { final Configuration config = res.getConfiguration(); config.mcc = 311; config.mnc = 480; return mContext.createConfigurationContext(config).getResources(); } return res; }
Source:
public static int setKey(RowKeySchema schema, List<List<KeyRange>> slots, int[] position, Bound bound, byte[] key, int byteOffset, int slotStartIndex, int slotEndIndex) { int offset = byteOffset; boolean incrementKey = bound == Bound.UPPER; boolean incrementAtEnd = false; for (int i = slotStartIndex; i < slotEndIndex; i++) { KeyRange range = slots.get(i).get(position[i]); boolean isFixedWidth = schema.getField(i).getType().isFixedWidth(); if ( range.isUnbound(bound) && ( bound == Bound.UPPER || isFixedWidth) ){ break; } incrementKey = (!range.isInclusive(bound) && bound == Bound.LOWER) || (range.isSingleKey() && range.isInclusive(bound) && bound == Bound.UPPER); incrementAtEnd = incrementAtEnd || (!range.isSingleKey() && range.isInclusive(bound) && bound == Bound.UPPER); byte[] bytes = range.getRange(bound); System.arraycopy(bytes, 0, key, offset, bytes.length); offset += bytes.length; if (i < schema.getMaxFields()-1 && !isFixedWidth) { key[offset++] = QueryConstants.SEPARATOR_BYTE; } if (!range.isSingleKey() && incrementKey) { if (!ByteUtil.nextKey(key, offset)) { return -byteOffset; } incrementKey = false; } } if (incrementAtEnd || incrementKey) { if (!ByteUtil.nextKey(key, offset)) { return -byteOffset; } } return offset - byteOffset; }

Target:
public static int setKey(RowKeySchema schema, List<List<KeyRange>> slots, int[] position, Bound bound, byte[] key, int byteOffset, int slotStartIndex, int slotEndIndex) { int offset = byteOffset; boolean singleInclusiveUpperKeyAtEnd = false; boolean rangeExclusiveUpperKey = false; boolean isFixedWidth = false; for (int i = slotStartIndex; i < slotEndIndex; i++) { KeyRange range = slots.get(i).get(position[i]); isFixedWidth = schema.getField(i).getType().isFixedWidth(); if ( range.isUnbound(bound) && ( bound == Bound.UPPER || isFixedWidth) ){ break; } singleInclusiveUpperKeyAtEnd = range.isSingleKey() && range.isInclusive(bound) && bound == Bound.UPPER; rangeExclusiveUpperKey = rangeExclusiveUpperKey || (!range.isSingleKey() && range.isInclusive(bound) && bound == Bound.UPPER); byte[] bytes = range.getRange(bound); System.arraycopy(bytes, 0, key, offset, bytes.length); offset += bytes.length; if (i < schema.getMaxFields()-1 && !isFixedWidth) { key[offset++] = QueryConstants.SEPARATOR_BYTE; } if (!range.isSingleKey() && !range.isInclusive(bound) && bound == Bound.LOWER) { if (!ByteUtil.nextKey(key, offset)) { return -byteOffset; } } } if (singleInclusiveUpperKeyAtEnd || rangeExclusiveUpperKey) { if (!ByteUtil.nextKey(key, offset)) { return -byteOffset; } } return offset - byteOffset; }
Source:
private List<String> determineContentStatus(DocumentIndexingPackage dip) throws IndexingException { List<String> status = new ArrayList<>(); ContentObject obj = dip.getContentObject(); Resource resc = obj.getResource(); if (resc.hasProperty(Cdr.hasMods)) { status.add(FacetConstants.CONTENT_DESCRIBED); } else { status.add(FacetConstants.CONTENT_NOT_DESCRIBED); } if (resc.hasProperty(Cdr.invalidTerm)) { status.add(FacetConstants.INVALID_VOCAB_TERM); } if (obj instanceof WorkObject) { if (((WorkObject) obj).getPrimaryObject() == null) { status.add(FacetConstants.NO_PRIMARY_OBJECT); } } if (resc.hasProperty(Cdr.unpublished)) { status.add(FacetConstants.UNPUBLISHED); } return status; }

Target:
private List<String> determineContentStatus(DocumentIndexingPackage dip) throws IndexingException { List<String> status = new ArrayList<>(); ContentObject obj = dip.getContentObject(); Resource resc = obj.getResource(); if (resc.hasProperty(Cdr.hasMods)) { status.add(FacetConstants.CONTENT_DESCRIBED); } else { status.add(FacetConstants.CONTENT_NOT_DESCRIBED); } if (resc.hasProperty(Cdr.invalidTerm)) { status.add(FacetConstants.INVALID_VOCAB_TERM); } if (obj instanceof WorkObject) { if (!resc.hasProperty(Cdr.primaryObject)) { status.add(FacetConstants.NO_PRIMARY_OBJECT); } } if (resc.hasProperty(Cdr.unpublished)) { status.add(FacetConstants.UNPUBLISHED); } return status; }
Source:
public void compactInternally() { if (config.enableOracleEnterpriseFeatures()) { try { conns.get().executeUnregisteredQuery( "ALTER TABLE " + oracleTableNameGetter.getInternalShortTableName(conns, tableRef) + " MOVE ONLINE"); } catch (PalantirSqlException e) { log.error("Tried to clean up bloat after a sweep operation," + " but underlying Oracle database or configuration does not support this" + " (Enterprise Edition that requires this user to be able to perform DDL operations)" + " feature online. Since this can't be automated in your configuration," + " good practice would be do to occasional offline manual maintenance of rebuilding" + " IOT tables to compensate for bloat. You can contact Palantir Support if you'd" + " like more information. Underlying error was: {}", tableRef, e.getMessage()); } catch (TableMappingNotFoundException e) { throw new RuntimeException(e); } } else if (config.enableShrinkOnOracleStandardEdition()) { oracleShrinkExecutor.shrinkAsync(tableRef); } }

Target:
public void compactInternally() { if (config.enableOracleEnterpriseFeatures()) { try { conns.get().executeUnregisteredQuery( "ALTER TABLE " + oracleTableNameGetter.getInternalShortTableName(conns, tableRef) + " MOVE ONLINE"); } catch (PalantirSqlException e) { log.error("Tried to clean up bloat after a sweep operation," + " but underlying Oracle database or configuration does not support this" + " (Enterprise Edition that requires this user to be able to perform DDL operations)" + " feature online. Since this can't be automated in your configuration," + " good practice would be do to occasional offline manual maintenance of rebuilding" + " IOT tables to compensate for bloat. You can contact Palantir Support if you'd" + " like more information. Underlying error was: {}", LoggingArgs.tableRef(tableRef), UnsafeArg.of("exception message", e.getMessage())); } catch (TableMappingNotFoundException e) { throw new RuntimeException(e); } } else if (config.shrinkConfig().enableShrinkOnOracleStandardEdition()) { oracleShrinkExecutor.shrinkAsync(tableRef); } }
Source:
public ValidationResult validate(ConfigKey key, String value) { if (StringUtils.isBlank(value)) { return new ValidationResult(false, "The MAC address range cannot be empty."); } String[] ranges = value.split("[,]", -1); for (String range : ranges) { String[] rangeParts = range.split("[-]", -1); if (rangeParts.length == 2) { String rangeStart = rangeParts[0].toLowerCase(); String rangeEnd = rangeParts[1].toLowerCase(); if (!validateRangePart(rangeStart) || !validateRangePart(rangeEnd) || rangeStart.compareTo(rangeEnd) > 0) { return new ValidationResult(false, "The entered range is invalid. " + StringUtils.join(rangeParts, '-') + " should be in a format of AA:AA:AA:AA:AA:AA-BB:BB:BB:BB:BB:BB,..."); } } else { return new ValidationResult(false, "The entered value is in imporper format. " + value + " should be in a format of AA:AA:AA:AA:AA:AA-BB:BB:BB:BB:BB:BB,..."); } } return new ValidationResult(true); }

Target:
public ValidationResult validate(ConfigKey key, String value) { if (StringUtils.isBlank(value)) { return new ValidationResult(false, "The MAC address range cannot be empty."); } String[] ranges = value.split(","); for (String range : ranges) { String[] rangeParts = range.split("-"); if (rangeParts.length == 2) { String rangeStart = rangeParts[0].toLowerCase(); String rangeEnd = rangeParts[1].toLowerCase(); if (!validateRangePart(rangeStart) || !validateRangePart(rangeEnd) || rangeStart.compareTo(rangeEnd) > 0) { return new ValidationResult(false, "The entered range is invalid. " + StringUtils.join(rangeParts, '-') + " should be in a format of AA:AA:AA:AA:AA:AA-BB:BB:BB:BB:BB:BB,..."); } } else { return new ValidationResult(false, "The entered value is in imporper format. " + value + " should be in a format of AA:AA:AA:AA:AA:AA-BB:BB:BB:BB:BB:BB,..."); } } return new ValidationResult(true); }
Source:
public CommandResult exec(ContextAwareCommandInvocation invocation) { if (help) { invocation.println(invocation.getHelpInfo()); } CommandInputLine cmd = new CommandInputLine(Shutdown.CMD) .arg(TYPE, Shutdown.Cluster.CMD); return invocation.execute(Collections.singletonList(cmd)); }

Target:
public CommandResult exec(ContextAwareCommandInvocation invocation) { if (help) { invocation.println(invocation.getHelpInfo()); } CommandInputLine cmd = new CommandInputLine(Shutdown.CMD) .arg(TYPE, Shutdown.Cluster.CMD); return invocation.execute(cmd); }
Source:
public Object apply(RevisionResource resource) throws AuthException, BadRequestException, ResourceConflictException, Exception { PatchSet basePatchSet = null; if (base != null) { RevisionResource baseResource = revisions.get().parse( resource.getChangeResource(), IdString.fromUrl(base)); basePatchSet = baseResource.getPatchSet(); } return fileInfoJson.toFileInfoMap( resource.getChange(), resource.getPatchSet(), basePatchSet); }

Target:
public Object apply(RevisionResource resource) throws ResourceNotFoundException, OrmException, PatchListNotAvailableException { PatchSet basePatchSet = null; if (base != null) { RevisionResource baseResource = revisions.get().parse( resource.getChangeResource(), IdString.fromDecoded(base)); basePatchSet = baseResource.getPatchSet(); } return fileInfoJson.toFileInfoMap( resource.getChange(), resource.getPatchSet(), basePatchSet); }
Source:
public Map toMap() { Set<String> instanceVariableNames = ReflectionHelper.getFieldNamesToTypes(this).keySet(); Map<String, Object> result = new HashMap<>(); for(String name : instanceVariableNames) { try { result.put(name, ReflectionHelper.invokeGetter(name, this)); } catch (NoSuchMethodException|InvocationTargetException|IllegalAccessException e) { throw new StorageException(e); } } return result; }

Target:
public Map<String, Object> toMap() { Set<String> instanceVariableNames = ReflectionHelper.getFieldNamesToTypes(this).keySet(); Map<String, Object> fieldToVal = new HashMap<>(); for(String fieldName : instanceVariableNames) { try { Object val = ReflectionHelper.invokeGetter(fieldName, this); fieldToVal.put(fieldName, val); if(LOG.isTraceEnabled()) { LOG.trace("toMap: Adding fieldName = ", fieldName, val); } } catch (NoSuchMethodException|InvocationTargetException|IllegalAccessException e) { throw new StorageException(e); } } return fieldToVal; }
Source:
public StringBuilder GetTagNameAndChildrenNames() { StringBuilder builder = new StringBuilder(); builder.append(StringFormat.format("'%1$s'", gettag_name())); for (tags tag : _children) { builder.append("," + tag.GetTagNameAndChildrenNames()); } return builder; }

Target:
public StringBuilder GetTagNameAndChildrenNames() { StringBuilder builder = new StringBuilder(); builder.append("'").append(gettag_name()).append("'"); for (tags tag : _children) { builder.append("," + tag.GetTagNameAndChildrenNames()); } return builder; }
Source:
protected String getEntityVersionLabel(String separator) { return elvis(entity.getClass().getSimpleName(), entity.getClass().getName())+(!getVersion().equals(NO_VERSION_INFO) ? separator+getVersion() : ""); }

Target:
protected String getEntityVersionLabel(String separator) { return elvis(entity.getClass().getSimpleName(), entity.getClass().getName())+(!NO_VERSION_INFO.equals(getVersion()) ? separator+getVersion() : ""); }
Source:
public void remove() { bitSet.clear(index); }

Target:
public void remove() { PartitionIdSet.this.remove(index); }
Source:
public ViatraQueryEngineImpl(ViatraQueryEngineManager manager, QueryScope scope, ViatraQueryEngineOptions engineOptions) throws ViatraQueryException { super(); this.manager = manager; this.scope = scope; this.lifecycleProvider = new LifecycleProvider(this, getLogger()); this.modelUpdateProvider = new ModelUpdateProvider(this, getLogger()); this.engineContext = scope.createEngineContext(this, taintListener, getLogger()); if (engineOptions != null){ QueryEvaluationHint engineOptionsDefaultHints = engineOptions.getEngineDefaultHints(); if (engineOptionsDefaultHints != null && engineOptionsDefaultHints.getQueryBackendFactory() != null){ this.engineDefaultHint = new QueryEvaluationHint(engineOptionsDefaultHints.getQueryBackendFactory(), ImmutableMap.copyOf(engineOptionsDefaultHints.getBackendHints())); }else{ this.engineDefaultHint = new QueryEvaluationHint(new ReteBackendFactory(), Collections.<String, Object>emptyMap()); } if (engineOptions.getDefaultCachingBackendFactory() != null){ this.defaultCachingBackendFactory = engineOptions.getDefaultCachingBackendFactory(); }else{ this.defaultCachingBackendFactory = new ReteBackendFactory(); } }else{ this.engineDefaultHint = new QueryEvaluationHint(new ReteBackendFactory(), Collections.<String, Object>emptyMap());; this.defaultCachingBackendFactory = new ReteBackendFactory(); } }

Target:
public ViatraQueryEngineImpl(ViatraQueryEngineManager manager, QueryScope scope, ViatraQueryEngineOptions engineOptions) throws ViatraQueryException { super(); this.manager = manager; this.scope = scope; this.lifecycleProvider = new LifecycleProvider(this, getLogger()); this.modelUpdateProvider = new ModelUpdateProvider(this, getLogger()); this.engineContext = scope.createEngineContext(this, taintListener, getLogger()); if (engineOptions != null){ this.engineOptions = engineOptions; }else{ this.engineOptions = new ViatraQueryEngineOptions( new QueryEvaluationHint(new ReteBackendFactory(), Collections.<String, Object>emptyMap()), new ReteBackendFactory()); } }
Source:
private Component createToolBar() { JToolBar toolPanel = new JToolBar(); toolPanel.setFloatable(false); this.toolbar = JMeterToolBar.createToolbar(true); GuiPackage guiInstance = GuiPackage.getInstance(); guiInstance.setMainToolbar(toolbar); toolPanel.add(toolbar); toolPanel.add(Box.createRigidArea(new Dimension(5, 15))); toolPanel.add(Box.createGlue()); toolPanel.add(testTimeDuration); toolPanel.add(Box.createRigidArea(new Dimension(5, 15))); toolPanel.add(warnIndicator); warnIndicator.setText("0"); toolPanel.add(Box.createRigidArea(new Dimension(5, 15))); toolPanel.add(activeAndTotalThreads); toolPanel.add(Box.createRigidArea(new Dimension(5, 15))); toolPanel.add(runningIndicator); return toolPanel; }

Target:
private Component createToolBar() { JMeterToolBar toolPanel = JMeterToolBar.createToolbar(true); this.toolbar = toolPanel; GuiPackage guiInstance = GuiPackage.getInstance(); guiInstance.setMainToolbar(toolbar); toolPanel.add(Box.createRigidArea(new Dimension(5, 15))); toolPanel.add(Box.createGlue()); toolPanel.add(testTimeDuration); toolPanel.add(Box.createRigidArea(new Dimension(5, 15))); toolPanel.add(warnIndicator); warnIndicator.setText("0"); toolPanel.add(Box.createRigidArea(new Dimension(5, 15))); toolPanel.add(activeAndTotalThreads); toolPanel.add(Box.createRigidArea(new Dimension(5, 15))); toolPanel.add(runningIndicator); return toolPanel; }
Source:
private static File processBitmapForSharing(final Context context, final Bitmap bmp, final String imageFileName, final boolean recycleBmp) { File dir = clearFolder(context); if (dir == null) { return null; } dir.mkdirs(); ByteArrayOutputStream bytes = new ByteArrayOutputStream(); bmp.compress(Bitmap.CompressFormat.JPEG, JPEG_QUALITY, bytes); if (recycleBmp) { bmp.recycle(); } File f = new File(dir, cleanFileName(imageFileName)); try { FileOutputStream fo = new FileOutputStream(f); fo.write(bytes.toByteArray()); fo.close(); } catch (IOException e) { displayOnCatchMessage(e, context); } return f; }

Target:
private static File processBitmapForSharing(final Context context, final Bitmap bmp, final String imageFileName, final boolean recycleBmp) throws IOException { File dir = clearFolder(context); if (dir == null) { return null; } dir.mkdirs(); ByteArrayOutputStream bytes = new ByteArrayOutputStream(); bmp.compress(Bitmap.CompressFormat.JPEG, JPEG_QUALITY, bytes); if (recycleBmp) { bmp.recycle(); } File f = new File(dir, cleanFileName(imageFileName)); FileOutputStream fo = new FileOutputStream(f); fo.write(bytes.toByteArray()); fo.close(); return f; }
Source:
private void buildEpisodeCleanupPreference() { final Resources res = ui.getActivity().getResources(); ListPreference pref = (ListPreference) ui.findPreference(UserPreferences.PREF_EPISODE_CLEANUP); String[] values = res.getStringArray( R.array.episode_cleanup_values); String[] entries = new String[values.length]; for (int x = 0; x < values.length; x++) { float v = Float.parseFloat(values[x]); if (v == UserPreferences.EPISODE_CLEANUP_QUEUE) { entries[x] = res.getString(R.string.episode_cleanup_queue_removal); } else if (v == UserPreferences.EPISODE_CLEANUP_NULL){ entries[x] = res.getString(R.string.episode_cleanup_never); } else if (v == 0) { entries[x] = res.getString(R.string.episode_cleanup_after_listening); } else if (v > 0 && v < 1) { int numHours = Converter.numberOfDaysFloatToNumberOfHours(v); entries[x] = res.getQuantityString(R.plurals.episode_cleanup_hours_after_listening, numHours, numHours); } else { int vInt = (int)v; entries[x] = res.getQuantityString(R.plurals.episode_cleanup_days_after_listening, vInt, vInt); } } pref.setEntries(entries); }

Target:
private void buildEpisodeCleanupPreference() { final Resources res = ui.getActivity().getResources(); ListPreference pref = (ListPreference) ui.findPreference(UserPreferences.PREF_EPISODE_CLEANUP); String[] values = res.getStringArray( R.array.episode_cleanup_values); String[] entries = new String[values.length]; for (int x = 0; x < values.length; x++) { int v = Integer.parseInt(values[x]); if (v == UserPreferences.EPISODE_CLEANUP_QUEUE) { entries[x] = res.getString(R.string.episode_cleanup_queue_removal); } else if (v == UserPreferences.EPISODE_CLEANUP_NULL){ entries[x] = res.getString(R.string.episode_cleanup_never); } else if (v == 0) { entries[x] = res.getString(R.string.episode_cleanup_after_listening); } else if (v > 0 && v < 24) { entries[x] = res.getQuantityString(R.plurals.episode_cleanup_hours_after_listening, v, v); } else { int numDays = (int)(v / 24); entries[x] = res.getQuantityString(R.plurals.episode_cleanup_days_after_listening, numDays, numDays); } } pref.setEntries(entries); }
Source:
public void onLivePacket(IMediaStream stream, AMFPacket packet) { final int DEFAULT_CODEC = -1; if (FLVUtils.isVideoKeyFrame(packet)) { WMSProperties properties = getConnectionProperties(stream); if(properties == null) return; String streamName = stream.getName(); String entryId = getEntryIdFromStreamName(streamName); if(entryId == null){ logger.info("Stream [" + streamName + "] does not match entry id"); return; } long pts = packet.getAbsTimecode(); int codec = properties.getPropertyInt(LiveStreamEntry.CLIENT_PROPERTY_CODEC_TYPE, DEFAULT_CODEC); if ((codec == IVHost.CODEC_VIDEO_H264 || codec == IVHost.CODEC_VIDEO_H265) && packet.getSize() >= 5) pts += BufferUtils.byteArrayToLong(packet.getData(), 2, 3); ILiveStreamManager liveManager = KalturaServer.getManager(ILiveStreamManager.class); Map<String, List<Long>> defaultValue = new HashMap<String, List<Long>>(); Map<String, List<Long>> streamsPtses = (Map<String, List<Long>>)liveManager.getMetadata(entryId, KNOWN_PTS, defaultValue); addPts(streamsPtses, streamName, pts); compareStreams(streamsPtses, streamName, pts); cleanOldPtses(streamsPtses, streamName, pts); } }

Target:
public void onLivePacket(IMediaStream stream, AMFPacket packet) { final int DEFAULT_CODEC = -1; if (FLVUtils.isVideoKeyFrame(packet)) { WMSProperties properties = getConnectionProperties(stream); if(properties == null) return; String streamName = stream.getName(); String entryId = getEntryIdFromStreamName(streamName); if(entryId == null){ logger.warn("Stream [" + streamName + "] does not match entry id"); return; } long pts = packet.getAbsTimecode(); int codec = properties.getPropertyInt(LiveStreamEntry.CLIENT_PROPERTY_CODEC_TYPE, DEFAULT_CODEC); if ((codec == IVHost.CODEC_VIDEO_H264 || codec == IVHost.CODEC_VIDEO_H265) && packet.getSize() >= 5) pts += BufferUtils.byteArrayToLong(packet.getData(), 2, 3); ILiveStreamManager liveManager = KalturaServer.getManager(ILiveStreamManager.class); Map<String, List<Long>> defaultValue = new HashMap<String, List<Long>>(); Map<String, List<Long>> streamsPtses = (Map<String, List<Long>>)liveManager.getOrAddMetadata(entryId, KNOWN_PTS, defaultValue); addPtsToStream(streamsPtses, streamName, pts); if(ptsAppearInAllStreams(streamsPtses, streamName, pts)) { removePtsFromStreams(streamsPtses, pts); } handleOldPtses(streamsPtses, streamName, pts); } }
Source:
public void testMountNamespaces() throws Exception { final int rootMountIdOfInit = getMountEntry("1", "/").mountId; final int rootMountIdOfVold = getMountEntry("$(pidof vold)", "/").mountId; if (isApexUpdatable()) { Assert.assertNotEquals(rootMountIdOfInit, rootMountIdOfVold); } else { Assert.assertEquals(rootMountIdOfInit, rootMountIdOfVold); } }

Target:
public void testMountNamespaces() throws Exception { final int rootMountIdOfInit = getMountEntry("1", "/").mountId; final int rootMountIdOfVold = getMountEntry("$(pidof vold)", "/").mountId; if (isApexUpdatable()) { Assert.assertNotEquals("device supports updatable APEX, but is not using multiple mount namespaces", rootMountIdOfInit, rootMountIdOfVold); } else { Assert.assertEquals("device supports updatable APEX, but is using multiple mount namespaces", rootMountIdOfInit, rootMountIdOfVold); } }
Source:
String getUsage() { return "decommissionbookie [-bookieid <bookieaddress>]"; }

Target:
String getUsage() { return CMD_DECOMMISSIONBOOKIE + " [-bookieid <bookieaddress>]"; }
Source:
public ITmfTrace getTrace() { ITmfProjectModelElement parent = getParent(); IResource resource = getElementUnderTraceFolder().getResource(); if (parent instanceof TmfExperimentElement) { return lookupExperimentTrace((TmfExperimentElement) parent, resource); } return lookupSingleTrace(resource); }

Target:
public ITmfTrace getTrace() { ITmfProjectModelElement parent = getParent(); if (parent instanceof TmfExperimentElement) { ITmfTrace parentTrace = ((TmfExperimentElement) parent).getTrace(); if (parentTrace == null) { return null; } for (ITmfEventProvider sibling : parentTrace.getChildren()) { if (sibling instanceof ITmfTrace) { ITmfTrace siblingTrace = (ITmfTrace) sibling; if (getElementUnderTraceFolder().getResource().equals(siblingTrace.getResource())) { return siblingTrace; } } } return null; } return super.getTrace(); }
Source:
public void whenExceedMaxConsumersNumThen429() throws IOException, InterruptedException, ExecutionException, TimeoutException { final String etName = NakadiTestUtils.createEventType().getName(); final List<CompletableFuture<Integer>> statusCodeFutures = range(0, 8) .mapToObj(x -> createConsumingConnection(etName)) .collect(Collectors.toList()); assertThat("first 5 connections should be accepted", countStatusCode(statusCodeFutures, HttpStatus.OK.value()), equalTo(5)); assertThat("last 3 connections should be rejected", countStatusCode(statusCodeFutures, HttpStatus.TOO_MANY_REQUESTS.value()), equalTo(3)); }

Target:
public void whenExceedMaxConsumersNumThen429() throws IOException, InterruptedException, ExecutionException, TimeoutException { final String etName = NakadiTestUtils.createEventType().getName(); final List<CompletableFuture<HttpURLConnection>> connectionFutures = range(0, 8) .mapToObj(x -> createConsumingConnection(etName)) .collect(Collectors.toList()); assertThat("first 5 connections should be accepted", countStatusCode(connectionFutures, HttpStatus.OK.value()), equalTo(5)); assertThat("last 3 connections should be rejected", countStatusCode(connectionFutures, HttpStatus.TOO_MANY_REQUESTS.value()), equalTo(3)); for (final CompletableFuture<HttpURLConnection> conn : connectionFutures) { if (conn.get().getResponseCode() == HttpStatus.OK.value()) { conn.get().disconnect(); break; } } Thread.sleep(1000); final List<CompletableFuture<HttpURLConnection>> moreConnectionFutures = range(0, 3) .mapToObj(x -> createConsumingConnection(etName)) .collect(Collectors.toList()); assertThat("one more connection should be accepted", countStatusCode(moreConnectionFutures, HttpStatus.OK.value()), equalTo(1)); assertThat("other 2 connections should be rejected as we had only one new free slot", countStatusCode(moreConnectionFutures, HttpStatus.TOO_MANY_REQUESTS.value()), equalTo(2)); }
Source:
public void testLeastBytesUsedLocationSelectorStrategy() throws Exception { List<StorageLocation> storageLocations = new ArrayList<>(); final File localStorageFolder1 = tmpFolder.newFolder("local_storage_folder_1"); final File localStorageFolder2 = tmpFolder.newFolder("local_storage_folder_2"); final File localStorageFolder3 = tmpFolder.newFolder("local_storage_folder_3"); StorageLocation storageLocation1 = new StorageLocation(localStorageFolder1, 10000000000L, null); storageLocations.add(storageLocation1); storageLocations.add(new StorageLocation(localStorageFolder2, 10000000000L, null)); storageLocations.add(new StorageLocation(localStorageFolder3, 10000000000L, null)); StorageLocationSelectorStrategy leastBytesUsedStrategy = new LeastBytesUsedStorageLocationSelectorStrategy(storageLocations); storageLocation1.reserve("tmp_loc1", "__seg1", 1024L); Iterator<StorageLocation> locations = leastBytesUsedStrategy.getLocations(); StorageLocation loc1 = locations.next(); Assert.assertTrue("The next element of the iterator should point to path local_storage_folder_2", loc1.getPath().equals(localStorageFolder2)); StorageLocation loc2 = locations.next(); Assert.assertTrue("The next element of the iterator should point to path local_storage_folder_3", loc2.getPath().equals(localStorageFolder3)); StorageLocation loc3 = locations.next(); System.out.println(loc3); Assert.assertTrue("The next element of the iterator should point to path local_storage_folder_3", loc3.getPath().equals(localStorageFolder1)); }

Target:
public void testLeastBytesUsedLocationSelectorStrategy() throws Exception { List<StorageLocation> storageLocations = new ArrayList<>(); final File localStorageFolder1 = tmpFolder.newFolder("local_storage_folder_1"); final File localStorageFolder2 = tmpFolder.newFolder("local_storage_folder_2"); final File localStorageFolder3 = tmpFolder.newFolder("local_storage_folder_3"); StorageLocation storageLocation1 = new StorageLocation(localStorageFolder1, 10000000000L, null); storageLocations.add(storageLocation1); storageLocations.add(new StorageLocation(localStorageFolder2, 10000000000L, null)); storageLocations.add(new StorageLocation(localStorageFolder3, 10000000000L, null)); StorageLocationSelectorStrategy leastBytesUsedStrategy = new LeastBytesUsedStorageLocationSelectorStrategy(storageLocations); storageLocation1.reserve("tmp_loc1", "__seg1", 1024L); Iterator<StorageLocation> locations = leastBytesUsedStrategy.getLocations(); StorageLocation loc1 = locations.next(); Assert.assertEquals("The next element of the iterator should point to path local_storage_folder_2", localStorageFolder2, loc1.getPath()); StorageLocation loc2 = locations.next(); Assert.assertEquals("The next element of the iterator should point to path local_storage_folder_3", localStorageFolder3, loc2.getPath()); StorageLocation loc3 = locations.next(); Assert.assertEquals("The next element of the iterator should point to path local_storage_folder_1", localStorageFolder1, loc3.getPath()); }
Source:
private Map<Long, Chain> decodeChainMapEntries(StructDecoder<Void> decoder) { StructArrayDecoder<? extends StructDecoder<?>> entriesDecoder = decoder.structs(CHAIN_MAP_ENTRIES_SUB_STRUCT); if (entriesDecoder != null) { int len = entriesDecoder.length(); Map<Long, Chain> chainMap = (len < 16) ? new HashMap<>() : new HashMap<>((int) ((float) len / 0.75f + 1.0f)); for (int i = 0; i < len; i++) { StructDecoder<?> entryDecoder = entriesDecoder.next(); Long key = entryDecoder.int64(KEY_FIELD); StructDecoder<?> chainDecoder = entryDecoder.struct(CHAIN_FIELD); Chain chain = ChainCodec.decode(chainDecoder); chainMap.put(key, chain); entryDecoder.end(); } return chainMap; } else { return Collections.emptyMap(); } }

Target:
private Map<Long, Chain> decodeChainMapEntries(StructDecoder<Void> decoder) { StructArrayDecoder<? extends StructDecoder<?>> entriesDecoder = decoder.structs(CHAIN_MAP_ENTRIES_SUB_STRUCT); if (entriesDecoder != null) { int len = entriesDecoder.length(); Map<Long, Chain> chainMap = new HashMap<>((int) ((float) len / 0.75f + 1.0f)); for (int i = 0; i < len; i++) { StructDecoder<?> entryDecoder = entriesDecoder.next(); Long key = entryDecoder.int64(KEY_FIELD); StructDecoder<?> chainDecoder = entryDecoder.struct(CHAIN_FIELD); Chain chain = ChainCodec.decode(chainDecoder); chainMap.put(key, chain); entryDecoder.end(); } return chainMap; } else { return Collections.emptyMap(); } }
Source:
private void dereferencePage(SerializedPage pageSplit, Lifespan lifespan) { long outstandingPageCount = outstandingPageCountPerLifespan.get(lifespan).decrementAndGet(); if (outstandingPageCount == 0 && noMorePagesForLifespan.contains(lifespan)) { checkState(lifespanCompletionCallback != null); lifespanCompletionCallback.accept(lifespan); } checkState(totalBufferedPages.decrementAndGet() >= 0); memoryManager.updateMemoryUsage(-pageSplit.getRetainedSizeInBytes()); }

Target:
private void dereferencePage(SerializedPage pageSplit, Lifespan lifespan) { long outstandingPageCount = outstandingPageCountPerLifespan.get(lifespan).decrementAndGet(); if (outstandingPageCount == 0 && noMorePagesForLifespan.contains(lifespan)) { checkState(lifespanCompletionCallback != null, "lifespanCompletionCallback is not null"); lifespanCompletionCallback.accept(lifespan); } checkState(totalBufferedPages.decrementAndGet() >= 0); memoryManager.updateMemoryUsage(-pageSplit.getRetainedSizeInBytes()); }
Source:
public void setPriority(final TableName tn) { if (!tn.isSystemTable() && !PhoenixDatabaseMetaData.SYSTEM_TABLE_NAMES.contains(tn.getNameAsString())) { setPriority(this.priority); } else { super.setPriority(tn); } }

Target:
public void setPriority(final TableName tn) { if (!tn.isSystemTable() && !SchemaUtil.isSystemTable(tn.getName())) { setPriority(this.priority); } else { super.setPriority(tn); } }
Source:
public String[] getAvailableClusterGroups() throws Exception { HPCCWsTopologyClient hpccWsTopologyClient = HPCCWsTopologyClient.get(connection); try { if (hpccWsTopologyClient != null) return hpccWsTopologyClient.getValidTargetGroupNames(); else throw new Exception("Could not initialize HPCC WsTopology Client"); } catch (Exception e) { e.printStackTrace(); } catch (org.hpccsystems.ws.client.wrappers.ArrayOfEspExceptionWrapper e) { e.toString(); } return null; }

Target:
public String[] getAvailableClusterGroups() throws Exception { HPCCWsTopologyClient hpccWsTopologyClient = HPCCWsTopologyClient.get(connection); try { if (hpccWsTopologyClient != null) return hpccWsTopologyClient.getValidTargetGroupNames(); else throw new Exception("Could not initialize HPCC WsTopology Client"); } catch (Exception e) { e.printStackTrace(); } catch (org.hpccsystems.ws.client.wrappers.ArrayOfEspExceptionWrapper e) { log.error(e.toString()); } return null; }
Source:
public static Class getSchemaForRelDataType(TupleSchemaRegistry registry, String schemaName, RelDataType rowType) { if (rowType.isStruct()) { TupleSchemaRegistry.Schema newSchema = registry.createNewSchema(schemaName); for (RelDataTypeField field : rowType.getFieldList()) { RelDataType type = field.getType(); newSchema.addField(OperatorUtils.getValidFieldName(field), convertPrimitiveToSqlType(type)); } try { newSchema.generateBean(); } catch (IOException | JSONException e) { throw new RuntimeException("Failed t generate schema", e); } return newSchema.beanClass; } else { throw new UnsupportedOperationException("Not struct row type is not implemented."); } }

Target:
public static Class getSchemaForRelDataType(TupleSchemaRegistry registry, String schemaName, RelDataType rowType) { if (rowType.isStruct()) { TupleSchemaRegistry.Schema newSchema = registry.createNewSchema(schemaName); for (RelDataTypeField field : rowType.getFieldList()) { RelDataType type = field.getType(); newSchema.addField(OperatorUtils.getValidFieldName(field), convertPrimitiveToSqlType(type)); } try { newSchema.generateBean(); } catch (IOException | JSONException e) { throw new RuntimeException("Failed to generate schema", e); } return newSchema.beanClass; } else { throw new UnsupportedOperationException("Non-struct row type is not implemented."); } }
Source:
public boolean savePhonenumber() { boolean actionResult = false; if (isValidPatientId()) { try { Phonenumber phonenumber = readPhonenumber(); phonenumber.setPatient(withPatient); actionResult = loadTestDataService.savePhonenumber(phonenumber); if (actionResult) { addPatientInfoMessages("Save Phonenumber Successful: " + phonenumber.getPhonenumberId()); clearInputsPhonenumbers(); } } catch (LoadTestDataException e) { logPatientError("Patient Phonenumber", e); } } else { addPatientErrorMessages("Phonenumber cannot be save: patient does not exist."); } return actionResult; }

Target:
public boolean savePhonenumber() { boolean actionResult = false; if (isValidPatientId()) { try { Phonenumber phonenumber = readPhonenumber(); phonenumber.setPatient(withPatient); actionResult = loadTestDataService.savePhonenumber(phonenumber); if (actionResult) { addPatientInfoMessages(msgForSaveSuccess("phonenumber", phonenumber.getPhonenumberId())); clearInputsPhonenumbers(); } } catch (LoadTestDataException e) { logPatientError("Patient Phonenumber", e); } } else { addPatientErrorMessages(msgForInvalidPatient("Phonenumber")); } return actionResult; }
Source:
public void provision(Environment envConfig, CheServicesEnvironmentImpl internalEnv) throws EnvironmentException { String devMachineName = envConfig.getMachines() .entrySet() .stream() .filter(entry -> entry.getValue() .getAgents() != null && entry.getValue() .getAgents() .contains("org.eclipse.che.ws-agent")) .map(Map.Entry::getKey) .findAny() .orElseThrow(() -> new EnvironmentException( "ws-machine is not found on agents applying")); String projectFolderVolume; try { if (Strings.isNullOrEmpty(volumesOptions)) { projectFolderVolume = format("%s:%s", workspaceFolderPathProvider.getPath(internalEnv.getWorkspaceId()), projectFolderPath); } else { projectFolderVolume = format("%s:%s:%s", workspaceFolderPathProvider.getPath(internalEnv.getWorkspaceId()), projectFolderPath, volumesOptions); } } catch (IOException e) { throw new EnvironmentException("Error occurred on resolving path to files of workspace " + internalEnv.getWorkspaceId()); } internalEnv.getServices() .get(devMachineName) .getVolumes() .add(SystemInfo.isWindows() ? pathEscaper.escapePath(projectFolderVolume) : projectFolderVolume); super.provision(envConfig, internalEnv); }

Target:
public void provision(Environment envConfig, CheServicesEnvironmentImpl internalEnv) throws EnvironmentException { String devMachineName = envConfig.getMachines() .entrySet() .stream() .filter(entry -> entry.getValue() .getAgents() != null && entry.getValue() .getAgents() .contains("org.eclipse.che.ws-agent")) .map(Map.Entry::getKey) .findAny() .orElseThrow(() -> new EnvironmentException( "ws-machine is not found on agents applying")); String projectFolderVolume; try { projectFolderVolume = format("%s:%s%s", workspaceFolderPathProvider.getPath(internalEnv.getWorkspaceId()), projectFolderPath, projectsVolumeOptions); } catch (IOException e) { throw new EnvironmentException("Error occurred on resolving path to files of workspace " + internalEnv.getWorkspaceId()); } internalEnv.getServices() .get(devMachineName) .getVolumes() .add(SystemInfo.isWindows() ? pathEscaper.escapePath(projectFolderVolume) : projectFolderVolume); super.provision(envConfig, internalEnv); }
Source:
public void sampleTest() throws IOException { InputStream sampleInputStream = getClass().getClassLoader().getResourceAsStream( "analysis/haskell/sample.hs"); ByteArrayOutputStream sampleOutputStream = new ByteArrayOutputStream(); Definitions defs = new Definitions(); defs.addTag(6, "x'y'", "functions", "x'y' = let f' = 1; g'h = 2 in f' + g'h", 0, 0); int actLOC; try { actLOC = writeHaskellXref(sampleInputStream, new PrintStream(sampleOutputStream), defs); } finally { sampleInputStream.close(); sampleOutputStream.close(); } InputStream expectedInputStream = getClass().getClassLoader().getResourceAsStream( "analysis/haskell/sampleXrefExpected.html"); ByteArrayOutputStream expectedOutputSteam = new ByteArrayOutputStream(); try { byte buffer[] = new byte[8192]; int numBytesRead; do { numBytesRead = expectedInputStream.read(buffer, 0, buffer.length); if (numBytesRead > 0) { expectedOutputSteam.write(buffer, 0, numBytesRead); } } while (numBytesRead >= 0); } finally { expectedInputStream.close(); expectedOutputSteam.close(); } String actual[] = new String(sampleOutputStream.toByteArray(), "UTF-8"). replaceAll("\\r", "").split("\n"); String expected[] = new String(expectedOutputSteam.toByteArray(), "UTF-8"). replaceAll("\\r", "").split("\n"); assertLinesEqual("Haskell sampleTest()", expected, actual); assertEquals("Haskell LOC", 3, actLOC); }

Target:
public void sampleTest() throws IOException { InputStream sampleInputStream = getClass().getClassLoader().getResourceAsStream( "analysis/haskell/sample.hs"); ByteArrayOutputStream sampleOutputStream = new ByteArrayOutputStream(); Definitions defs = new Definitions(); defs.addTag(6, "x'y'", "functions", "x'y' = let f' = 1; g'h = 2 in f' + g'h", 0, 0); int actLOC; try { actLOC = writeHaskellXref(sampleInputStream, new PrintStream(sampleOutputStream), defs); } finally { sampleInputStream.close(); sampleOutputStream.close(); } InputStream expectedInputStream = getClass().getClassLoader().getResourceAsStream( "analysis/haskell/sampleXrefExpected.html"); ByteArrayOutputStream expectedOutputSteam = new ByteArrayOutputStream(); try { byte buffer[] = new byte[8192]; int numBytesRead; do { numBytesRead = expectedInputStream.read(buffer, 0, buffer.length); if (numBytesRead > 0) { expectedOutputSteam.write(buffer, 0, numBytesRead); } } while (numBytesRead >= 0); } finally { expectedInputStream.close(); expectedOutputSteam.close(); } String actual[] = new String(sampleOutputStream.toByteArray(), "UTF-8").split("\\r?\\n"); String expected[] = new String(expectedOutputSteam.toByteArray(), "UTF-8").split("\\r?\\n"); assertLinesEqual("Haskell sampleTest()", expected, actual); assertEquals("Haskell LOC", 3, actLOC); }
Source:
public void onEvent(RuntimeStatusEvent event) { if (event.isFailed()) { RuntimeState state = runtimes.remove(event.getIdentity().getWorkspaceId()); if (state != null) { String workspaceId = state.runtime.getContext().getIdentity().getWorkspaceId(); publishWorkspaceStatusEvent( workspaceId, STOPPED, RUNNING, "Error occurs on workspace runtime stop. Error: " + event.getError()); setAbnormalStopAttributes(workspaceId, event.getError()); } } }

Target:
public void onEvent(RuntimeStatusEvent event) { if (event.isFailed()) { String workspaceId = event.getIdentity().getWorkspaceId(); RuntimeState state = runtimes.remove(workspaceId); if (state != null) { publishWorkspaceStatusEvent( workspaceId, STOPPED, RUNNING, "Error occurs on workspace runtime stop. Error: " + event.getError()); setAbnormalStopAttributes(workspaceId, event.getError()); } } }
Source:
private void writeToChannelVersionOne(WritableByteChannel channel) throws IOException { try (ReadableByteChannel from = Channels.newChannel(combineStreams().getInput())) { ByteStreams.copy(from, channel); return; } }

Target:
private void writeToChannelVersionOne(WritableByteChannel channel) throws IOException { try (ReadableByteChannel from = Channels.newChannel(combineStreams().getInput())) { ByteStreams.copy(from, channel); } }
Source:
public boolean equals(Object o) { boolean equals = false; if (ObjectUtils.isNotNull(o) && o instanceof CloudCheckrWrapper) { CloudCheckrWrapper otherWrapper = (CloudCheckrWrapper) o; equals = total.equals(otherWrapper.total) && maximum.equals(otherWrapper.getMaximum()) && minimum.equals(otherWrapper.getMinimum()) && average.equals(otherWrapper.getAverage()) && CollectionUtils.isEqualCollection(groupLevels, otherWrapper.getCostsByAccounts()) && CollectionUtils.isEqualCollection(groupingByTimes, otherWrapper.getGroupingByTimes()); } return equals; }

Target:
public boolean equals(Object o) { boolean equals = false; if (ObjectUtils.isNotNull(o) && o instanceof CloudCheckrWrapper) { CloudCheckrWrapper otherWrapper = (CloudCheckrWrapper) o; equals = CollectionUtils.isEqualCollection(costsByGroup, otherWrapper.getCostsByGroup()) && CollectionUtils.isEqualCollection(costsByTime, otherWrapper.getCostsByTime()) && Objects.equals(total, otherWrapper.getTotal()) && Objects.equals(maximum, otherWrapper.getMaximum()) && Objects.equals(minimum, otherWrapper.getMinimum()) && Objects.equals(average, otherWrapper.getAverage()); } return equals; }
Source:
public static void setEnv(Map<String, String> newenv) throws Exception { Class[] classes = Collections.class.getDeclaredClasses(); Map<String, String> env = System.getenv(); for (Class cl : classes) { if ("java.util.Collections$UnmodifiableMap".equals(cl.getName())) { Field field = cl.getDeclaredField("m"); field.setAccessible(true); Object obj = field.get(env); Map<String, String> map = (Map<String, String>) obj; map.clear(); map.putAll(newenv); } } }

Target:
private void setEnv(Map<String, String> newenv) throws Exception { Class[] classes = Collections.class.getDeclaredClasses(); Map<String, String> env = System.getenv(); for (Class cl : classes) { if ("java.util.Collections$UnmodifiableMap".equals(cl.getName())) { Field field = cl.getDeclaredField("m"); field.setAccessible(true); Object obj = field.get(env); Map<String, String> map = (Map<String, String>) obj; map.clear(); map.putAll(newenv); } } }
Source:
private List<FileInfo> listProfiles() { List<FileInfo> files = new ArrayList<>(); File[] profiles = profileDir.listFiles(); if(profiles != null) { for (File file : profileDir.listFiles()) { files.add(new FileInfo(file)); } Collections.sort(files, new Comparator<FileInfo>() { public int compare(FileInfo a, FileInfo b) { return -a.modified.compareTo(b.modified); } }); } return files; }

Target:
private List<FileInfo> listProfiles() { List<FileInfo> files = new ArrayList<>(); File[] profiles = profileDir.listFiles(); if (profiles != null) { for (File file : profiles) { files.add(new FileInfo(file)); } Collections.sort(files, new Comparator<FileInfo>() { public int compare(FileInfo a, FileInfo b) { return -a.modified.compareTo(b.modified); } }); } return files; }
Source:
public List<SentMessage> getSentMessages(User user) throws DAOException { List<SentMessage> sentMessages = sessionFactory.getCurrentSession().createCriteria(SentMessage.class).list(); List<SentMessage> usersMessages = new ArrayList<>(); for (SentMessage sentMessage : sentMessages) { if (sentMessage.getSenderId().equals(user.getUserId())) usersMessages.add(sentMessage); } if (usersMessages.size() == 0) return null; return usersMessages; }

Target:
public List<SentMessage> getSentMessages(User user) throws DAOException { return null; }
Source:
private void assertRowKeysWithRegex(Table table, String[] rowRegEx, String rowPrefix, String[] rowKeys, int[] expected) throws IOException { FilterList filtersList = new FilterList(FilterList.Operator.MUST_PASS_ONE); for (String con : rowRegEx) { filtersList.addFilter(new RowFilter(CompareOp.EQUAL, new RegexStringComparator(con))); } Scan scan = new Scan(); scan.setFilter(filtersList); try (ResultScanner scanner = table.getScanner(scan)) { Result[] results = scanner.next(10); for (int i = 0; i < results.length; i++) { Assert.assertArrayEquals(results[i].getRow(), Bytes.toBytes(rowPrefix + rowKeys[expected[i]])); } } }

Target:
private void assertRowKeysWithRegex(Table table, String[] rowRegEx, String rowPrefix, String[] rowKeys, int[] expected) throws IOException { FilterList filtersList = new FilterList(FilterList.Operator.MUST_PASS_ONE); for (String condition : rowRegEx) { filtersList.addFilter(new RowFilter(CompareOp.EQUAL, new RegexStringComparator(rowPrefix + condition))); } Scan scan = new Scan(); scan.setFilter(filtersList); try (ResultScanner scanner = table.getScanner(scan)) { Result[] results = scanner.next(rowKeys.length); assertEquals(expected.length, results.length); for (int i = 0; i < results.length; i++) { Assert.assertArrayEquals(Bytes.toBytes(rowPrefix + rowKeys[expected[i]]), results[i].getRow()); } Assert.assertNull(scanner.next()); } }
Source:
public ContentProviderClient provideDepictsContentProviderClient(Context context) { return context.getContentResolver().acquireContentProviderClient("fr.free.nrw.commons.beta.depicts.contentprovider"); }

Target:
public ContentProviderClient provideDepictsContentProviderClient(Context context) { return context.getContentResolver().acquireContentProviderClient(BuildConfig.DEPICTION_AUTHORITY); }