auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public BigtableAsyncAdmin(CommonConnection asyncConnection) throws IOException { LOG.debug("Creating BigtableAsyncAdmin"); this.options = asyncConnection.getOptions(); this.bigtableTableAdminClient = new BigtableTableAdminClient( asyncConnection.getSession().getTableAdminClient()); this.disabledTables = asyncConnection.getDisabledTables(); this.bigtableInstanceName = options.getInstanceName(); this.tableAdapter2x = new TableAdapter2x(options); this.asyncConnection = asyncConnection; this.configuration = asyncConnection.getConfiguration(); this.instanceName = InstanceName.of(bigtableInstanceName.getProjectId(), bigtableInstanceName.getInstanceId()); String clusterId = configuration.get(BigtableOptionsFactory.BIGTABLE_SNAPSHOT_CLUSTER_ID_KEY, null); if (clusterId != null) { bigtableSnapshotClusterName = bigtableInstanceName.toClusterName(clusterId); } }

Target:
public BigtableAsyncAdmin(CommonConnection asyncConnection) throws IOException { LOG.debug("Creating BigtableAsyncAdmin"); this.options = asyncConnection.getOptions(); this.bigtableTableAdminClient = new BigtableTableAdminClient( asyncConnection.getSession().getTableAdminClient()); this.disabledTables = asyncConnection.getDisabledTables(); this.bigtableInstanceName = options.getInstanceName(); this.tableAdapter2x = new TableAdapter2x(options); this.asyncConnection = asyncConnection; this.configuration = asyncConnection.getConfiguration(); String clusterId = configuration.get(BigtableOptionsFactory.BIGTABLE_SNAPSHOT_CLUSTER_ID_KEY, null); if (clusterId != null) { bigtableSnapshotClusterName = bigtableInstanceName.toClusterName(clusterId); } }
Source:
public void run() { connectionTimeout = config.getConnectionTimeout(); leakTask.updateLeakDetectionThreshold(config.getLeakDetectionThreshold()); final long now = clockSource.currentTime(); final long idleTimeout = config.getIdleTimeout(); if (now < previous || now > clockSource.plusMillis(previous, (2 * HOUSEKEEPING_PERIOD_MS))) { LOGGER.warn("{} - Unusual system clock change detected, soft-evicting connections from pool.", poolName); previous = now; softEvictConnections(); fillPool(); return; } previous = now; if (idleTimeout > 0L) { final List<PoolEntry> notInUseList = connectionBag.values(STATE_NOT_IN_USE); int removable = notInUseList.size() - config.getMinimumIdle(); if (removable > 0) { logPoolState("Before cleanup\t"); Collections.sort(notInUseList, new Comparator<PoolEntry>() { @Override public int compare(PoolEntry pe1, PoolEntry pe2) { return pe1.lastAccessed < pe2.lastAccessed ? -1 : pe1.lastAccessed > pe2.lastAccessed ? 1 : 0; } }); for (int i = 0; i < removable; i++) { PoolEntry poolEntry = notInUseList.get(i); if (clockSource.elapsedMillis(poolEntry.lastAccessed, now) > idleTimeout) { if (connectionBag.reserve(poolEntry)) { closeConnection(poolEntry, "(connection passed idleTimeout)"); } } } logPoolState("After cleanup\t"); } } fillPool(); }

Target:
public void run() { connectionTimeout = config.getConnectionTimeout(); leakTask.updateLeakDetectionThreshold(config.getLeakDetectionThreshold()); final long now = clockSource.currentTime(); final long idleTimeout = config.getIdleTimeout(); if (now < previous || now > clockSource.plusMillis(previous, (2 * HOUSEKEEPING_PERIOD_MS))) { LOGGER.warn("{} - Unusual system clock change detected, soft-evicting connections from pool.", poolName); previous = now; softEvictConnections(); fillPool(); return; } previous = now; if (idleTimeout > 0L) { final List<PoolEntry> notInUseList = connectionBag.values(STATE_NOT_IN_USE); int removable = notInUseList.size() - config.getMinimumIdle(); if (removable > 0) { logPoolState("Before cleanup\t"); Collections.sort(notInUseList, new Comparator<PoolEntry>() { @Override public int compare(final PoolEntry entryOne, final PoolEntry entryTwo) { return -1 * Long.compare(entryOne.lastAccessed, entryTwo.lastAccessed); } }); for (int i = 0; i < removable; i++) { final PoolEntry poolEntry = notInUseList.get(i); if (clockSource.elapsedMillis(poolEntry.lastAccessed, now) > idleTimeout) { if (connectionBag.reserve(poolEntry)) { closeConnection(poolEntry, "(connection passed idleTimeout)"); } } } logPoolState("After cleanup\t"); } } fillPool(); }
Source:
private BiConsumer<Throwable, Object> completeWithErrorPropagate() { return (error, event) -> { final PrivilegedEvent errorEvent = (PrivilegedEvent) ((MessagingException) error).getEvent(); System.out.println("propagating error... " + errorEvent.getContext().getDepthLevel()); errorEvent.getContext().error(error); }; }

Target:
private BiConsumer<Throwable, Object> completeWithErrorPropagate() { return (error, event) -> { final PrivilegedEvent errorEvent = (PrivilegedEvent) ((MessagingException) error).getEvent(); errorEvent.getContext().error(error); }; }
Source:
protected void loadDetachedPlugins() { StartupType startupType = Jenkins.getActiveInstance().getStartupType(); if (startupType == StartupType.UPGRADE) { VersionNumber lastExecVersion = new VersionNumber(StartupUtil.getLastExecVersion()); LOGGER.log(INFO, "Upgrading Jenkins. The last running version was {0}. This Jenkins is version {1}.", new Object[] {lastExecVersion, Jenkins.VERSION}); final List<ClassicPluginStrategy.DetachedPlugin> detachedPlugins = ClassicPluginStrategy.getDetachedPlugins(lastExecVersion); Set<String> loadedDetached = loadPluginsFromWar("/WEB-INF/detached-plugins", new FilenameFilter() { @Override public boolean accept(File dir, String name) { name = normalisePluginName(name); if (isPluginInstalled(name)) { return true; } for (ClassicPluginStrategy.DetachedPlugin detachedPlugin : detachedPlugins) { if (detachedPlugin.getShortName().equals(name)) { return true; } } return false; } }); LOGGER.log(INFO, "Upgraded Jenkins from version {0} to version {1}. Loaded detached plugins (and dependencies): {2}", new Object[] {lastExecVersion, Jenkins.VERSION, loadedDetached}); StartupUtil.saveLastExecVersion(); } }

Target:
protected void loadDetachedPlugins() { InstallState installState = Jenkins.getActiveInstance().getInstallState(); if (installState == InstallState.UPGRADE) { VersionNumber lastExecVersion = new VersionNumber(InstallUtil.getLastExecVersion()); LOGGER.log(INFO, "Upgrading Jenkins. The last running version was {0}. This Jenkins is version {1}.", new Object[] {lastExecVersion, Jenkins.VERSION}); final List<ClassicPluginStrategy.DetachedPlugin> detachedPlugins = ClassicPluginStrategy.getDetachedPlugins(lastExecVersion); Set<String> loadedDetached = loadPluginsFromWar("/WEB-INF/detached-plugins", new FilenameFilter() { @Override public boolean accept(File dir, String name) { name = normalisePluginName(name); if (ClassicPluginStrategy.isDetachedPlugin(name)) { VersionNumber installedVersion = getPluginVersion(rootDir, name); VersionNumber bundledVersion = getPluginVersion(dir, name); if (installedVersion != null && bundledVersion != null && installedVersion.isOlderThan(bundledVersion)) { return true; } } for (ClassicPluginStrategy.DetachedPlugin detachedPlugin : detachedPlugins) { if (detachedPlugin.getShortName().equals(name)) { return true; } } return false; } }); LOGGER.log(INFO, "Upgraded Jenkins from version {0} to version {1}. Loaded detached plugins (and dependencies): {2}", new Object[] {lastExecVersion, Jenkins.VERSION, loadedDetached}); InstallUtil.saveLastExecVersion(); } }
Source:
public static <T> Observable.Transformer<T, T> transformer(@Nonnull final String logTag, @Nonnull final String observableTag, @Nonnull final Logger logger) { return new Observable.Transformer<T, T>() { @Override public Observable<T> call(Observable<T> observable) { return observable .doOnNext(new Action1<T>() { @Override public void call(T value) { logger.logNext(logTag, observableTag + " -> onNext : " + value); } }) .doOnError(new Action1<Throwable>() { @Override public void call(Throwable throwable) { logger.logError(logTag, observableTag + " -> onError : " + throwable); } }) .doOnCompleted(new Action0() { @Override public void call() { logger.logCompleted(logTag, observableTag + " -> onCompleted"); } }); } }; }

Target:
public static <T> Observable.Transformer<T, T> transformer(@Nonnull final String logTag, @Nonnull final String observableTag, @Nonnull final Logger logger) { return new Observable.Transformer<T, T>() { @Override public Observable<T> call(Observable<T> observable) { return observable .doOnNext(new Action1<T>() { @Override public void call(T value) { logger.logNext(logTag, observableTag, value); } }) .doOnError(new Action1<Throwable>() { @Override public void call(Throwable throwable) { logger.logError(logTag, observableTag, throwable); } }) .doOnCompleted(new Action0() { @Override public void call() { logger.logCompleted(logTag, observableTag); } }); } }; }
Source:
public CRAMIterator(final InputStream inputStream, final ReferenceSource referenceSource) throws IOException { if (null == referenceSource) { this.referenceSource = new ReferenceSource(); } else this.referenceSource = referenceSource; this.countingInputStream = new CountingInputStream(inputStream); final CramContainerIterator containerIterator = new CramContainerIterator(this.countingInputStream); cramHeader = containerIterator.getCramHeader(); this.containerIterator = containerIterator; firstContainerOffset = this.countingInputStream.getCount(); records = new ArrayList<SAMRecord>(10000); normalizer = new CramNormalizer(cramHeader.getSamFileHeader(), referenceSource); parser = new ContainerParser(cramHeader.getSamFileHeader()); }

Target:
public CRAMIterator(final InputStream inputStream, final ReferenceSource referenceSource) throws IOException { if (null == referenceSource) { throw new CRAMException("A reference source is required for CRAM files"); } this.countingInputStream = new CountingInputStream(inputStream); this.referenceSource = referenceSource; final CramContainerIterator containerIterator = new CramContainerIterator(this.countingInputStream); cramHeader = containerIterator.getCramHeader(); this.containerIterator = containerIterator; firstContainerOffset = this.countingInputStream.getCount(); records = new ArrayList<SAMRecord>(10000); normalizer = new CramNormalizer(cramHeader.getSamFileHeader(), referenceSource); parser = new ContainerParser(cramHeader.getSamFileHeader()); }
Source:
public <T> T blocking(CompletionStage<T> request) { return null; }

Target:
public <T> T blocking(CompletionStage<T> request) { return delegate.blocking(request); }
Source:
public void testBuildBlobId() throws Exception { BlobId blobId = new BlobId(version, referenceType, referenceDatacenterId, referenceAccountId, referenceContainerId, referencePartitionId, referenceIsEncrypted); System.out.println(blobId.getID()); assertEquals("Wrong blobId version", version, getVersionFromBlobString(blobId.getID())); assertBlobIdFieldValues(version, blobId, referenceType, referenceDatacenterId, referenceAccountId, referenceContainerId, referencePartitionId, referenceIsEncrypted); }

Target:
public void testBuildBlobId() throws Exception { BlobId blobId = new BlobId(version, referenceType, referenceDatacenterId, referenceAccountId, referenceContainerId, referencePartitionId, referenceIsEncrypted); assertEquals("Wrong blobId version", version, getVersionFromBlobString(blobId.getID())); assertBlobIdFieldValues(version, blobId, referenceType, referenceDatacenterId, referenceAccountId, referenceContainerId, referencePartitionId, referenceIsEncrypted); }
Source:
private URL mergeUrl(URL providerUrl) { providerUrl = ClusterUtils.mergeUrl(providerUrl, queryMap); providerUrl = overrideWithConfigurator(providerUrl); providerUrl = providerUrl.addParameter(Constants.CHECK_KEY, String.valueOf(false)); this.overrideDirectoryUrl = this.overrideDirectoryUrl.addParametersIfAbsent(providerUrl.getParameters()); if ((providerUrl.getPath() == null || providerUrl.getPath() .length() == 0) && Constants.DOBBO_PROTOCOL.equals(providerUrl.getProtocol())) { String path = directoryUrl.getParameter(Constants.INTERFACE_KEY); if (path != null) { int i = path.indexOf('/'); if (i >= 0) { path = path.substring(i + 1); } i = path.lastIndexOf(':'); if (i >= 0) { path = path.substring(0, i); } providerUrl = providerUrl.setPath(path); } } return providerUrl; }

Target:
private URL mergeUrl(URL providerUrl) { providerUrl = ClusterUtils.mergeUrl(providerUrl, queryMap); providerUrl = overrideWithConfigurator(providerUrl); providerUrl = providerUrl.addParameter(Constants.CHECK_KEY, String.valueOf(false)); this.overrideDirectoryUrl = this.overrideDirectoryUrl.addParametersIfAbsent(providerUrl.getParameters()); if ((providerUrl.getPath() == null || providerUrl.getPath() .length() == 0) && Constants.DUBBO_PROTOCOL.equals(providerUrl.getProtocol())) { String path = directoryUrl.getParameter(Constants.INTERFACE_KEY); if (path != null) { int i = path.indexOf('/'); if (i >= 0) { path = path.substring(i + 1); } i = path.lastIndexOf(':'); if (i >= 0) { path = path.substring(0, i); } providerUrl = providerUrl.setPath(path); } } return providerUrl; }
Source:
private void populateGroupInfo(List<ImmutablePair<String, String>> contactInfo, Group group) { addInfo(contactInfo, DATA_NAME, group.getReference().getName()); DocumentReference documentReference = group.getReference(); try { XWikiDocument doc = (XWikiDocument) this.documentAccessBridge.getDocument(documentReference); BaseObject data = doc.getXObject(Group.CLASS_REFERENCE); addInfo(contactInfo, DATA_EMAIL, data.getStringValue(DATA_CONTACT)); } catch (Exception e) { logger.error("Could not find requested document"); } }

Target:
private void populateGroupInfo(List<ImmutablePair<String, String>> contactInfo, Group group) { addInfo(contactInfo, DATA_NAME, group.getReference().getName()); DocumentReference documentReference = group.getReference(); try { XWikiDocument doc = (XWikiDocument) this.documentAccessBridge.getDocument(documentReference); BaseObject data = doc.getXObject(Group.CLASS_REFERENCE); addInfo(contactInfo, DATA_EMAIL, data.getStringValue(ATTRIBUTE_EMAIL_GROUP)); } catch (Exception e) { logger.error("Could not find requested document"); } }
Source:
public void testSplitServerConfig() throws ConfigException { String[] nsa = ConfigUtils.splitServerConfig("[2001:db8:85a3:8d3:1319:8a2e:370:7348]:443"); assertEquals(nsa.length, 2, 0); }

Target:
public void testSplitServerConfig() throws ConfigException { String[] nsa = ConfigUtils.getHostAndPort("[2001:db8:85a3:8d3:1319:8a2e:370:7348]:443"); System.out.println(nsa[0]); assertEquals(nsa[0], "2001:db8:85a3:8d3:1319:8a2e:370:7348"); assertEquals(nsa[1], "443"); }
Source:
private static Path serialize(FormMetadata metaData) { try { Path formDir = metaData.getFormDir(); if (Files.exists(formDir)) { return write( getMetadataFile(metaData), MAPPER.writerWithDefaultPrettyPrinter().writeValueAsString(metaData.asJson(MAPPER)), CREATE, TRUNCATE_EXISTING ); } else { Files.createDirectory(formDir); return write( getMetadataFile(metaData), MAPPER.writerWithDefaultPrettyPrinter().writeValueAsString(metaData.asJson(MAPPER)), CREATE, TRUNCATE_EXISTING ); } } catch (IOException e) { throw new BriefcaseException("Couldn't produce JSON FormMetadata", e); } }

Target:
private static Path serialize(FormMetadata metaData) { try { Path formDir = metaData.getFormDir(); UncheckedFiles.createDirectories(formDir); return write( getMetadataFile(metaData), MAPPER.writerWithDefaultPrettyPrinter().writeValueAsString(metaData.asJson(MAPPER)), CREATE, TRUNCATE_EXISTING ); } catch (IOException e) { throw new BriefcaseException("Couldn't produce JSON FormMetadata", e); } }
Source:
void test_ctor_1arg_toosmall() { assertThrows(IllegalArgumentException.class, () -> new SetResponse(-1)); }

Target:
void test_ctor_1arg_toosmall() { try { new SetResponse(-1); fail("IllegalArgumentException not thrown"); } catch(IllegalArgumentException a){} }
Source:
public void testServer_ServerVersionMismatchException() { IgnoredException.addIgnoredException(ServerOperationException.class); serverNew.invoke(() -> { Cache cache = getCache(); assertThat(cache).isNotNull(); Region<Object, Object> region = cache.getRegion("regionA"); assertThat(region).isNotNull(); assertThatThrownBy(region::clear).isInstanceOf(ServerVersionMismatchException.class) .hasMessage(expectedMessage); }); }

Target:
public void testServer_ServerVersionMismatchException() { IgnoredException.addIgnoredException(ServerOperationException.class); serverNew.invoke(() -> { Cache cache = getCache(); assertThat(cache).isNotNull(); Region<String, String> region = cache.getRegion("regionA"); assertThat(region).isNotNull(); assertThatThrownBy(region::clear).isInstanceOf(ServerVersionMismatchException.class) .hasMessage(expectedMessage); assertThat(region.get("A")).isEqualTo("ValueA"); assertThat(region.get("B")).isEqualTo("ValueB"); }); }
Source:
public void testBug474072_missing() throws Exception { String url = FileLocator.find(new URL("platform:/plugin/org.eclipse.jface/$nl$/icons/full/message_error.png")) .toString(); url += "does-not-exist"; ResourceLocator.imageDescriptorFromBundle("org.eclipse.jface", url).orElseThrow(() -> new AssertionError()); }

Target:
public void testBug474072_missing() throws Exception { String url = FileLocator.find(new URL("platform:/plugin/org.eclipse.jface/$nl$/icons/full/message_error.png")) .toString(); url += "does-not-exist"; ImageDescriptor imageDescriptor = ResourceLocator.imageDescriptorFromBundle("org.eclipse.jface", url) .orElse(null); Image image = null; try { image = imageDescriptor.createImage(false); assertNull(image); } finally { if (image != null) { image.dispose(); } } }
Source:
private Row convertRowType(Row row, List<Tuple2<Integer, Column>> listConvertColumns, Accumulator<ApplySchemaStatistic> statisticAccumulator, StructType newSchema, boolean isDropRow) { statisticAccumulator.localValue().increaseLineProcessed(); Object[] rowData = toArray(row); boolean isFail = false; for (Tuple2<Integer, Column> convertColumn : listConvertColumns) { int colIndex = convertColumn._1(); Schema.ColumnType toType = convertColumn._2().getType(); Object colValue = rowData[colIndex]; if (colValue != null) { String columnData = colValue.toString().trim(); Object newColData = cast(columnData, toType); if (newColData == null) { statisticAccumulator.localValue().addColumnFailed(convertColumn._2().getName(), columnData); isFail = true; } rowData[colIndex] = newColData; } } if (isFail && isDropRow) { return null; } else { return new GenericRowWithSchema(rowData, newSchema); } }

Target:
private static Row convertRowType(Row row, List<Tuple2<Integer, Column>> listConvertColumns, Accumulator<ApplySchemaStatistic> statisticAccumulator, StructType newSchema, boolean isDropRow) { statisticAccumulator.localValue().increaseLineProcessed(); Object[] rowData = toArray(row); boolean isFail = false; for (Tuple2<Integer, Column> convertColumn : listConvertColumns) { int colIndex = convertColumn._1(); Schema.ColumnType toType = convertColumn._2().getType(); Object colValue = rowData[colIndex]; if (colValue != null) { String columnData = colValue.toString().trim(); Object newColData = cast(columnData, toType); if (newColData == null) { statisticAccumulator.localValue().addColumnFailed(convertColumn._2().getName(), columnData); isFail = true; } rowData[colIndex] = newColData; } } if (isFail && isDropRow) { return null; } else { return new GenericRowWithSchema(rowData, newSchema); } }
Source:
public void testDoPost() throws IOException, ServletException { when(request.getParameter("connectionName")).thenReturn("test-db-name"); when(request.getParameter("databaseType")).thenReturn(MySQLDatabaseService.DB_NAME); when(request.getParameter("databaseServer")).thenReturn(testDbConfig.getDatabaseHost()); when(request.getParameter("databasePort")).thenReturn("" + testDbConfig.getDatabasePort()); when(request.getParameter("databaseUser")).thenReturn(testDbConfig.getDatabaseUser()); when(request.getParameter("databasePassword")).thenReturn(testDbConfig.getDatabasePassword()); when(request.getParameter("initialDatabase")).thenReturn(testDbConfig.getDatabaseName()); StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); when(response.getWriter()).thenReturn(pw); SUT.doPost(request, response); String result = sw.getBuffer().toString().trim(); assertNotNull(result); assertFalse(result.isEmpty(), "Valid response Message expected!"); ObjectNode json = ParsingUtilities.mapper.readValue(result, ObjectNode.class); System.out.println("json:" + json); ArrayNode savedConnections = (ArrayNode) json.get("savedConnections"); Assert.assertNotNull(savedConnections); int len = savedConnections.size(); Assert.assertEquals(len, 1); }

Target:
public void testDoPost() throws IOException, ServletException { when(request.getParameter("connectionName")).thenReturn("test-db-name"); when(request.getParameter("databaseType")).thenReturn(MySQLDatabaseService.DB_NAME); when(request.getParameter("databaseServer")).thenReturn(testDbConfig.getDatabaseHost()); when(request.getParameter("databasePort")).thenReturn("" + testDbConfig.getDatabasePort()); when(request.getParameter("databaseUser")).thenReturn(testDbConfig.getDatabaseUser()); when(request.getParameter("databasePassword")).thenReturn(testDbConfig.getDatabasePassword()); when(request.getParameter("initialDatabase")).thenReturn(testDbConfig.getDatabaseName()); StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); when(response.getWriter()).thenReturn(pw); SUT.doPost(request, response); String result = sw.getBuffer().toString().trim(); assertNotNull(result); assertFalse(result.isEmpty(), "Valid response Message expected!"); ObjectNode json = ParsingUtilities.mapper.readValue(result, ObjectNode.class); ArrayNode savedConnections = (ArrayNode) json.get("savedConnections"); Assert.assertNotNull(savedConnections); int len = savedConnections.size(); Assert.assertEquals(len, 1); }
Source:
public boolean handlesMoveColumnsTo(final List<? extends MetaData> metaData) throws ModelSynchronizer.MoveColumnVetoException { final boolean isActionInsetFactFragment = isActionInsertFactFragment(metaData); if (!isActionInsetFactFragment) { return false; } final List<ActionCol52> columnsToMove = metaData.stream() .map(c -> (MoveColumnToMetaData) c) .map(MoveColumnToMetaData::getColumn) .map(c -> (ActionInsertFactCol52) c) .collect(Collectors.toList()); final String binding = ((ActionInsertFactCol52) columnsToMove.get(0)).getBoundName(); final int tgtIndex = ((MoveColumnToMetaData) metaData.get(0)).getTargetColumnIndex(); final List<BaseColumn> modelColumns = model.getExpandedColumns(); final AtomicBoolean result = new AtomicBoolean(true); model.getActionCols().stream() .filter(c -> !columnsToMove.contains(c)) .filter(c -> c instanceof ActionWorkItemInsertFactCol52) .map(c -> (ActionWorkItemInsertFactCol52) c) .filter(c -> c.getBoundName().equals(binding)) .map(modelColumns::indexOf) .filter(i -> i >= tgtIndex) .findFirst() .ifPresent(i -> result.set(false)); return result.get(); }

Target:
public boolean handlesMoveColumnsTo(final List<? extends MetaData> metaData) throws ModelSynchronizer.MoveColumnVetoException { final boolean isActionInsetFactFragment = isActionInsertFactFragment(metaData); if (!isActionInsetFactFragment) { return false; } final List<ActionCol52> columnsToMove = metaData.stream() .map(c -> (MoveColumnToMetaData) c) .map(MoveColumnToMetaData::getColumn) .map(c -> (ActionInsertFactCol52) c) .collect(Collectors.toList()); final String binding = ((ActionInsertFactCol52) columnsToMove.get(0)).getBoundName(); final int tgtIndex = ((MoveColumnToMetaData) metaData.get(0)).getTargetColumnIndex(); final List<BaseColumn> modelColumns = model.getExpandedColumns(); return model.getActionCols().stream() .filter(c -> !columnsToMove.contains(c)) .filter(c -> c instanceof ActionWorkItemInsertFactCol52) .map(c -> (ActionWorkItemInsertFactCol52) c) .filter(c -> c.getBoundName().equals(binding)) .map(modelColumns::indexOf) .noneMatch(i -> i >= tgtIndex); }
Source:
private void allQueriesForVms() { when(vmDao.getAllForVdsGroup(any(Guid.class))).thenReturn(new ArrayList<VM>()); }

Target:
private void allQueriesForVms() { when(vmDao.getAllForVdsGroup(any(Guid.class))).thenReturn(Collections.<VM> emptyList()); }
Source:
public List<SCMSource> getSCMSources() { return Collections.emptyList(); }

Target:
public List<SCMSource> getSCMSources() { Set<SCMSource> result = new HashSet<SCMSource>(); for (MultiBranchProject<?,?> child : getItems()) { result.addAll(child.getSCMSources()); } return new ArrayList<SCMSource>(result); }
Source:
protected SetMembers doExecute(BranchContext context) throws IOException { Options options = Options.builder() .putAll(options()) .put(SetMemberSearchRequestEvaluator.OptionKey.AFTER, searchAfter()) .put(SetMemberSearchRequestEvaluator.OptionKey.LIMIT, limit()) .build(); return context.service(SetMemberSearchRequestEvaluator.class) .evaluate(context.service(CodeSystemURI.class), context, options); }

Target:
protected SetMembers doExecute(BranchContext context) throws IOException { Options options = Options.builder() .putAll(options()) .put(SetMemberSearchRequestEvaluator.OptionKey.AFTER, searchAfter()) .put(SetMemberSearchRequestEvaluator.OptionKey.LIMIT, limit()) .put(SetMemberSearchRequestEvaluator.OptionKey.LOCALES, locales()) .put(SearchResourceRequest.OptionKey.SORT_BY, sortBy()) .build(); return context.service(SetMemberSearchRequestEvaluator.class) .evaluate(context.service(CodeSystemURI.class), context, options); }
Source:
public static void setup() throws InterruptedException { testUtil = new SparkTestUtil(PORT); server = new Server(); ServerConnector connector = new ServerConnector(server); connector.setIdleTimeout(1000 * 60 * 60); connector.setSoLingerTime(-1); connector.setPort(PORT); server.setConnectors(new Connector[] {connector}); WebAppContext bb = new WebAppContext(); bb.setServer(server); bb.setContextPath(CONTEXT_PATH); bb.setWar("src/test/webapp"); server.setHandler(bb); CountDownLatch latch = new CountDownLatch(1); executorService = Executors.newSingleThreadExecutor(); executorService.submit(() -> { try { LOGGER.info(">>> STARTING EMBEDDED JETTY SERVER for jUnit testing of SparkFilter"); server.start(); latch.countDown(); System.in.read(); } catch (Exception e) { e.printStackTrace(); System.exit(100); } }); latch.await(); }

Target:
public static void setup() throws InterruptedException { testUtil = new SparkTestUtil(PORT); server = new Server(); ServerConnector connector = new ServerConnector(server); connector.setIdleTimeout(1000 * 60 * 60); connector.setSoLingerTime(-1); connector.setPort(PORT); server.setConnectors(new Connector[] {connector}); WebAppContext bb = new WebAppContext(); bb.setServer(server); bb.setContextPath(CONTEXT_PATH); bb.setWar("src/test/webapp"); server.setHandler(bb); CountDownLatch latch = new CountDownLatch(1); executorService = Executors.newSingleThreadExecutor(); executorService.submit(() -> { try { LOGGER.info(">>> STARTING EMBEDDED JETTY SERVER for jUnit testing of SparkFilter"); server.start(); latch.countDown(); System.in.read(); } catch (Exception e) { try { latch.countDown(); server.stop(); } catch (Exception e1) { throw new RuntimeException(e1); } throw new RuntimeException(e); } }); latch.await(); }
Source:
private double pvbpCompoundedFlat(RatePaymentPeriod paymentPeriod, RatesProvider provider) { int nbCmp = paymentPeriod.getAccrualPeriods().size(); double[] rate = new double[nbCmp]; int i = 0; for (RateAccrualPeriod accrualPeriod : paymentPeriod.getAccrualPeriods()) { rate[i] = rawRate(accrualPeriod, provider); i++; } double df = provider.discountFactor(paymentPeriod.getCurrency(), paymentPeriod.getPaymentDate()); double rBar = 1.0; double[] cpaAccumulatedBar = new double[nbCmp + 1]; cpaAccumulatedBar[nbCmp] = paymentPeriod.getNotional() * df * rBar; double spreadBar = 0.0d; for (int j = nbCmp - 1; j >= 0; j--) { cpaAccumulatedBar[j] = (1.0d + paymentPeriod.getAccrualPeriods().get(j).getYearFraction() * rate[j] * paymentPeriod.getAccrualPeriods().get(j).getGearing()) * cpaAccumulatedBar[j + 1]; spreadBar += paymentPeriod.getAccrualPeriods().get(j).getYearFraction() * cpaAccumulatedBar[j + 1]; } return spreadBar; }

Target:
private double pvbpCompoundedFlat(RatePaymentPeriod paymentPeriod, RatesProvider provider) { int nbCmp = paymentPeriod.getAccrualPeriods().size(); double[] rate = paymentPeriod.getAccrualPeriods().stream() .mapToDouble(ap -> rawRate(ap, provider)) .toArray(); double df = provider.discountFactor(paymentPeriod.getCurrency(), paymentPeriod.getPaymentDate()); double rBar = 1.0; double[] cpaAccumulatedBar = new double[nbCmp + 1]; cpaAccumulatedBar[nbCmp] = paymentPeriod.getNotional() * df * rBar; double spreadBar = 0.0d; for (int j = nbCmp - 1; j >= 0; j--) { cpaAccumulatedBar[j] = (1.0d + paymentPeriod.getAccrualPeriods().get(j).getYearFraction() * rate[j] * paymentPeriod.getAccrualPeriods().get(j).getGearing()) * cpaAccumulatedBar[j + 1]; spreadBar += paymentPeriod.getAccrualPeriods().get(j).getYearFraction() * cpaAccumulatedBar[j + 1]; } return spreadBar; }
Source:
public static void main(String[] args) throws Exception { LogLevelAdjuster.register(); Lifecycle lifecycle = new Lifecycle(); lifecycle.addManagedInstance(BrokerNode.builder().build()); if (ComplexMetrics.getSerdeForType("hll") == null) { ComplexMetrics.registerSerde("hll", new HLLComplexMericSerde()); } HllAggregatorFactory.context = HllAggregatorFactory.CONTEXT.COMPLEX; try { lifecycle.start(); } catch (Throwable t) { log.info(t, "Throwable caught at startup, committing seppuku"); System.exit(2); } lifecycle.join(); }

Target:
public static void main(String[] args) throws Exception { LogLevelAdjuster.register(); Lifecycle lifecycle = new Lifecycle(); lifecycle.addManagedInstance(BrokerNode.builder().build()); HLLComplexMericSerde.registerHllSerde(); try { lifecycle.start(); } catch (Throwable t) { log.info(t, "Throwable caught at startup, committing seppuku"); System.exit(2); } lifecycle.join(); }
Source:
public void run() { mUserAccountRepository.login(mCredentials, new IRepositoryCallback<UserAccount>() { @Override public void onSuccess(UserAccount userAccount) { mCallback.onLoginSuccess(); } @Override public void onError(Throwable throwable) { if (throwable instanceof MalformedURLException || throwable instanceof UnknownHostException) { mMainExecutor.run(new Runnable() { @Override public void run() { mCallback.onServerURLNotValid(); } }); } else if (throwable instanceof InvalidCredentialsException) { mMainExecutor.run(new Runnable() { @Override public void run() { mCallback.onInvalidCredentials(); } }); } else if (throwable instanceof NetworkException) { mMainExecutor.run(new Runnable() { @Override public void run() { mCallback.onNetworkError(); } }); } } }); }

Target:
public void run() { mUserAccountRepository.login(mCredentials, new IRepositoryCallback<UserAccount>() { @Override public void onSuccess(UserAccount userAccount) { notifyOnSuccess(); } @Override public void onError(Throwable throwable) { if (throwable instanceof MalformedURLException || throwable instanceof UnknownHostException) { notifyOnServerURLNotValid(); } else if (throwable instanceof InvalidCredentialsException) { notifyOnInvalidCredentials(); } else if (throwable instanceof NetworkException) { notifyOnNetworkError(); } } }); }
Source:
protected void zoomEntries(@NonNull Iterable<@NonNull TimeGraphEntry> entries, long zoomStartTime, long zoomEndTime, long resolution, @NonNull IProgressMonitor monitor) { if (zoomEndTime < zoomStartTime || resolution < 0) { return; } boolean isZoomThread = Thread.currentThread() instanceof ZoomThread; List<@NonNull Long> times = StateSystemUtils.getTimes(zoomStartTime, zoomEndTime, resolution); Map<Long, ControlFlowEntry> controlFlowEntries = filterGroup(entries, zoomStartTime, zoomEndTime); SelectionTimeQueryFilter filter = new SelectionTimeQueryFilter(times , controlFlowEntries.keySet()); for (ITmfTrace trace : TmfTraceManager.getTraceSet(getTrace())) { ControlFlowDataProvider dataProvider = DataProviderManager.getInstance(). getDataProvider(trace, ControlFlowDataProvider.ID, ControlFlowDataProvider.class); if (dataProvider == null) { continue; } TmfModelResponse<List<ITimeGraphRowModel>> fetchRowModel = dataProvider.fetchRowModel(filter, monitor); List<ITimeGraphRowModel> model = fetchRowModel.getModel(); if (model != null) { for (ITimeGraphRowModel rowModel : model) { ControlFlowEntry controlFlowEntry = controlFlowEntries.get(rowModel.getEntryID()); if (controlFlowEntry != null) { List<ITimeEvent> events = createTimeEvents(controlFlowEntry, rowModel.getStates()); if (isZoomThread) { applyResults(() -> controlFlowEntry.setZoomedEventList(events)); } else { controlFlowEntry.setEventList(events); } } } } } }

Target:
protected void zoomEntries(@NonNull Iterable<@NonNull TimeGraphEntry> entries, long zoomStartTime, long zoomEndTime, long resolution, @NonNull IProgressMonitor monitor) { boolean isZoomThread = Thread.currentThread() instanceof ZoomThread; List<@NonNull Long> times = StateSystemUtils.getTimes(Long.min(zoomStartTime, zoomEndTime), Long.max(zoomStartTime, zoomEndTime), resolution); Map<Long, ControlFlowEntry> controlFlowEntries = filterGroup(entries, zoomStartTime, zoomEndTime); SelectionTimeQueryFilter filter = new SelectionTimeQueryFilter(times , controlFlowEntries.keySet()); for (ITmfTrace trace : TmfTraceManager.getTraceSet(getTrace())) { ControlFlowDataProvider dataProvider = DataProviderManager.getInstance(). getDataProvider(trace, ControlFlowDataProvider.ID, ControlFlowDataProvider.class); if (dataProvider == null) { continue; } TmfModelResponse<List<ITimeGraphRowModel>> fetchRowModel = dataProvider.fetchRowModel(filter, monitor); List<ITimeGraphRowModel> model = fetchRowModel.getModel(); if (model != null) { for (ITimeGraphRowModel rowModel : model) { ControlFlowEntry controlFlowEntry = controlFlowEntries.get(rowModel.getEntryID()); if (controlFlowEntry != null) { List<ITimeEvent> events = createTimeEvents(controlFlowEntry, rowModel.getStates()); if (isZoomThread) { applyResults(() -> controlFlowEntry.setZoomedEventList(events)); } else { controlFlowEntry.setEventList(events); } } } } } }
Source:
public void testACLNotSupported() throws Exception { Configuration conf = new Configuration(); conf.setBoolean(DFSConfigKeys.DFS_PROVIDED_ACLS_IMPORT_ENABLED, true); FileSystem fs = mock(FileSystem.class); when(fs.getAclStatus(any())).thenThrow(new UnsupportedOperationException()); Path root = mock(Path.class); when(root.getFileSystem(conf)).thenReturn(fs); FileStatus rootFileStatus = new FileStatus(0, true, 0, 0, 1, root); when(fs.getFileStatus(root)).thenReturn(rootFileStatus); FSTreeWalk fsTreeWalk = new FSTreeWalk(root, conf); for (TreePath treePath : fsTreeWalk) { fail("Unexpected successful traversal of remote FS: " + treePath); } }

Target:
public void testACLNotSupported() throws Exception { Configuration conf = new Configuration(); conf.setBoolean(DFSConfigKeys.DFS_PROVIDED_ACLS_IMPORT_ENABLED, true); FileSystem fs = mock(FileSystem.class); when(fs.getAclStatus(any())).thenThrow(new UnsupportedOperationException()); Path root = mock(Path.class); when(root.getFileSystem(conf)).thenReturn(fs); FileStatus rootFileStatus = new FileStatus(0, true, 0, 0, 1, root); when(fs.getFileStatus(root)).thenReturn(rootFileStatus); FSTreeWalk fsTreeWalk = new FSTreeWalk(root, conf); TreeWalk.TreeIterator iter = fsTreeWalk.iterator(); fail("Unexpected successful creation of iter: " + iter); }
Source:
public void restart() { visit("restart"); clickButton("Yes"); try { waitFor(driver, not(hasContent("Please wait")), JenkinsController.STARTUP_TIMEOUT); }catch(TimeoutException e) { visit(driver.getCurrentUrl()); waitFor(driver, hasContent("New Item"), 10); } }

Target:
public void restart() { visit("restart"); clickButton("Yes"); try { waitFor(driver, not(hasContent("Please wait")), JenkinsController.STARTUP_TIMEOUT); }catch(TimeoutException e) { visit(driver.getCurrentUrl()); waitFor(driver, hasElement(By.className("breadcrumbBarAnchor")), 10); } }
Source:
public boolean next(Void info) { Span currentSpan = traceAccessor.getCurrentSpan(); if (currentSpan == null) { return false; } String traceId = currentSpan.getTraceId(); UUID traceUuid = UUID.fromString(traceId); BigInteger traceAsInt = UuidToBigIntegerConverter.uuidToBigInt(traceUuid); BigInteger mod = traceAsInt.mod(MOD_DIVISOR); return mod.compareTo(percentageAsBigInteger()) <= 0; }

Target:
public boolean next(Void info) { Span currentSpan = traceAccessor.getCurrentSpan(); if (currentSpan == null) { return false; } return new UuidTraceIdToThresholdComparable(configuration.getPercentage(), converter) .compareTo(currentSpan.getTraceId()) <= 0; }
Source:
private List<LogMessage> getMessages(Severity severity){ activate(); ArrayList<LogMessage> messages = new ArrayList<>(); for(TreeItem item : new DefaultTree().getItems()){ if(severityMatch(item, severity)) { messages.add(new LogMessage(item, severity.getIStatus())); } } return messages; }

Target:
private List<LogMessage> getMessages(Severity severity) { activate(); WidgetIsFound isTreeFound = new WidgetIsFound(org.eclipse.swt.widgets.Tree.class, cTabItem.getFolder().getSWTWidget()); new WaitUntil(isTreeFound, TimePeriod.SHORT, false); Widget tree = isTreeFound.getWidget(); return tree != null ? getMessagesFromTree(tree, severity) : new ArrayList<>(); }
Source:
public Collection<Observation> addObservation(String registrationId, Observation observation) { List<Observation> removed = new ArrayList<>(); for (Observation obs : getObservations(registrationId)) { if (observation.getPath().equals(obs.getPath()) && !Arrays.equals(observation.getId(), obs.getId())) { removed.add(obs); } } if (!removed.isEmpty()) { try (Jedis j = pool.getResource()) { byte[] ep = j.get(toRegIdKey(registrationId)); if (ep == null) { return null; } byte[] lockValue = null; byte[] lockKey = toLockKey(ep); try { lockValue = RedisLock.acquire(j, lockKey); for (Observation obs : removed) { unsafeRemoveObservation(j, registrationId, obs.getId()); } } finally { RedisLock.release(j, lockKey, lockValue); } } } return removed; }

Target:
public Collection<Observation> addObservation(String registrationId, Observation observation) { List<Observation> removed = new ArrayList<>(); if (!removed.isEmpty()) { try (Jedis j = pool.getResource()) { byte[] ep = j.get(toRegIdKey(registrationId)); if (ep == null) { return null; } byte[] lockValue = null; byte[] lockKey = toLockKey(ep); try { lockValue = RedisLock.acquire(j, lockKey); for (Observation obs : getObservations(j, registrationId)) { if (observation.getPath().equals(obs.getPath()) && !Arrays.equals(observation.getId(), obs.getId())) { removed.add(obs); unsafeRemoveObservation(j, registrationId, obs.getId()); } } } finally { RedisLock.release(j, lockKey, lockValue); } } } return removed; }
Source:
public Object methodException(Context context, Class claz, String method, Exception e, Info info) { log.debug("Claz: " + claz.getName() + " method: " + method, e); if ("format".equals(method)) { return null; } try { throw e; } catch (Exception x) { x.printStackTrace(); } return info; }

Target:
public Object methodException(Context context, Class claz, String method, Exception e, Info info) { log.debug("Claz: " + claz.getName() + " method: " + method, e); if ("format".equals(method)) { return null; } return info; }
Source:
private void consumeFluid(Block fluid) { if (fluid.getType() == Material.STATIONARY_WATER) { fluid.setType(Material.AIR); return; } List<Block> list = Vein.find(fluid, RANGE, block -> isLiquid(block) && block.getType() == fluid.getType()); list.get(list.size() - 1).setType(Material.AIR); }

Target:
private void consumeFluid(Block fluid) { if (!fluid.isLiquid()) return; if (fluid.getType() == Material.WATER) { fluid.setType(Material.AIR); return; } List<Block> list = Vein.find(fluid, RANGE, block -> isLiquid(block) && block.getType() == fluid.getType()); list.get(list.size() - 1).setType(Material.AIR); }
Source:
public void getColumnCount() { assertThat(cursor.getColumnCount()).isEqualTo(2); cursor.setColumnNames(new ArrayList<String>()); assertThat(cursor.getColumnCount()).isEqualTo(0); cursor.setColumnNames(null); try { cursor.getColumnCount(); fail(); } catch (NullPointerException ignored) { } }

Target:
public void getColumnCount() { cursor.setResults(ALL_COLUMNS, new Object[0][ALL_COLUMNS.size()]); assertThat(cursor.getColumnCount()).isEqualTo(ALL_COLUMNS.size()); cursor.setResults(new ArrayList<String>(), new Object[0][0]); assertThat(cursor.getColumnCount()).isEqualTo(0); }
Source:
public void countLostEvent(TmfTimeRange timeRange, long nbLostEvents, boolean fullRange) { if (timeRange.getStartTime().getValue() < 0 || timeRange.getEndTime().getValue() < 0) { return; } int indexStart = (int) ((timeRange.getStartTime().getValue() - fFirstBucketTime) / fBucketDuration); int indexEnd = (int) ((timeRange.getEndTime().getValue() - fFirstBucketTime) / fBucketDuration); if (!fullRange) { if (timeRange.getEndTime().getValue() > fTimeLimit) { indexEnd = (int) ((fTimeLimit - fFirstBucketTime) / fBucketDuration); } indexEnd = Math.min(indexEnd, fLastBucket); } int nbBucketRange = (indexEnd - indexStart) + 1; int lostEventPerBucket = (int) Math.ceil((double) nbLostEvents / nbBucketRange); long lastLostCol = nbLostEvents - lostEventPerBucket * (nbBucketRange - 1); if (fullRange) { while (timeRange.getEndTime().getValue() >= fTimeLimit) { mergeBuckets(); } } for (int index = indexStart; index <= indexEnd && index < fLostEventsBuckets.length; index++) { if (index == (indexStart + nbBucketRange - 1)) { fLostEventsBuckets[index] += lastLostCol; } else { fLostEventsBuckets[index] += lostEventPerBucket; } } fNbEvents++; fireModelUpdateNotification(nbLostEvents); }

Target:
public void countLostEvent(TmfTimeRange timeRange, long nbLostEvents, boolean fullRange) { if (timeRange.getStartTime().getValue() < 0 || timeRange.getEndTime().getValue() < 0) { return; } if (fullRange) { while (timeRange.getEndTime().getValue() >= fTimeLimit) { mergeBuckets(); } } int indexStart = (int) ((timeRange.getStartTime().getValue() - fFirstBucketTime) / fBucketDuration); int indexEnd = (int) ((timeRange.getEndTime().getValue() - fFirstBucketTime) / fBucketDuration); int nbBucketRange = (indexEnd - indexStart) + 1; int lostEventPerBucket = (int) Math.ceil((double) nbLostEvents / nbBucketRange); long lastLostCol = Math.max(1, nbLostEvents - lostEventPerBucket * (nbBucketRange - 1)); for (int index = indexStart; index <= indexEnd && index < fLostEventsBuckets.length; index++) { if (index == (indexStart + nbBucketRange - 1)) { fLostEventsBuckets[index] += lastLostCol; } else { fLostEventsBuckets[index] += lostEventPerBucket; } } fNbEvents++; fireModelUpdateNotification(nbLostEvents); }
Source:
public void testForBrokenSaslHandshakeVersionBump() { assertEquals("It is not possible to easily bump SASL_HANDSHAKE schema without " + "due to improper version negotiation for clients < 2.5. " + "Please see <LINK_0>", ApiKeys.SASL_HANDSHAKE.latestVersion(), 1); }

Target:
public void testForBrokenSaslHandshakeVersionBump() { assertEquals("It is not possible to easily bump SASL_HANDSHAKE schema" + " due to improper version negotiation in clients < 2.5." + " Please see <LINK_0>", ApiKeys.SASL_HANDSHAKE.latestVersion(), 1); }
Source:
private static Set<Directive> expandDirective(@Nonnull Directive<? extends DirectiveValue> directive) { if (!(directive instanceof FetchDirective)) { return Collections.singleton(directive); } Set<Directive> directives = new LinkedHashSet<>(); directives.add(directive); Stream<SourceExpression> stream = (Stream<SourceExpression>) directive.values(); Set<SourceExpression> sources = stream.collect(Collectors.toCollection(LinkedHashSet::new)); if (directive instanceof ChildSrcDirective) { directives.add(new FrameSrcDirective(sources)); } else if (directive instanceof ScriptSrcDirective) { directives.add(new ScriptSrcElemDirective(sources)); directives.add(new ScriptSrcAttrDirective(sources)); directives.add(new WorkerSrcDirective(sources)); } else if (directive instanceof StyleSrcDirective) { directives.add(new StyleSrcElemDirective(sources)); directives.add(new StyleSrcAttrDirective(sources)); } return directives; }

Target:
private static Set<Directive> expandDirective(@Nonnull Directive<? extends DirectiveValue> directive) { if (!(directive instanceof FetchDirective)) { return Collections.singleton(directive); } Set<Directive> directives = new LinkedHashSet<>(); directives.add(directive); Stream<SourceExpression> stream = (Stream<SourceExpression>) directive.values(); Set<SourceExpression> sources = stream.collect(Collectors.toCollection(LinkedHashSet::new)); if (directive instanceof ChildSrcDirective) { directives.add(new FrameSrcDirective(sources)); directives.add(new WorkerSrcDirective(sources)); } else if (directive instanceof ScriptSrcDirective) { directives.add(new ScriptSrcElemDirective(sources)); directives.add(new ScriptSrcAttrDirective(sources)); directives.add(new WorkerSrcDirective(sources)); } else if (directive instanceof StyleSrcDirective) { directives.add(new StyleSrcElemDirective(sources)); directives.add(new StyleSrcAttrDirective(sources)); } return directives; }
Source:
public ResponseEntity<List<ExpenseDTO>> listAllExpensesByCategoryNameAndTimeInterval( @PathVariable("category_name") String categoryName, @PathVariable("currency") String currency, @PathVariable("start_time_millis") long startTimeMillis, @PathVariable("end_time_millis") long endTimeMillis) { AppUser user = userUtil.extractLoggedAppUserFromDatabase(); List<Expense> expenses = null; if (categoryName.equals("*")) { expenses = expenseDao.findByTimeInterval(user.getUsername(), new Timestamp(startTimeMillis), new Timestamp(endTimeMillis)); } else { expenses = expenseDao.findByTimeIntervalAndCategory(user.getUsername(), categoryName, new Timestamp(startTimeMillis), new Timestamp(endTimeMillis)); } if (expenses.isEmpty()) { return new ResponseEntity<List<ExpenseDTO>>(HttpStatus.NO_CONTENT); } return new ResponseEntity<List<ExpenseDTO>>(createExpenseDTOs(expenses), HttpStatus.OK); }

Target:
public ResponseEntity<List<ExpenseDTO>> listAllExpensesByCategoryNameAndTimeInterval( @PathVariable("category_name") String categoryName, @PathVariable("currency") String currency, @PathVariable("start_time_millis") long startTimeMillis, @PathVariable("end_time_millis") long endTimeMillis) { AppUser user = userUtil.extractLoggedAppUserFromDatabase(); List<Expense> expenses = null; if (categoryName.equals("*")) { expenses = expenseDao.findByTimeInterval(user.getUsername(), new Timestamp(startTimeMillis), new Timestamp(endTimeMillis)); } else { expenses = expenseDao.findByTimeIntervalAndCategory(user.getUsername(), categoryName, new Timestamp(startTimeMillis), new Timestamp(endTimeMillis)); } if (expenses.isEmpty()) { return new ResponseEntity<List<ExpenseDTO>>(HttpStatus.NO_CONTENT); } convertExpenseCurrencies(expenses, currency); return new ResponseEntity<List<ExpenseDTO>>(createExpenseDTOs(expenses), HttpStatus.OK); }