auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private static ZoneId getZoneId() { if (ZONE_ID == null) { ZONE_ID = ZoneId.of(Calendar.getInstance().getTimeZone().getID()); } return ZONE_ID; }

Target:
private static ZoneId getZoneId() { if (ZONE_ID == null) { ZONE_ID = ZoneId.systemDefault(); } return ZONE_ID; }
Source:
private void setOrgStyle() {MAcctSchema acctSchema = MAcctSchema.getClientAcctSchema(Env.getCtx(), Env.getAD_Client_ID(Env.getCtx()))[0]; if (acctSchema == null) { StringBuffer errorMessage = new StringBuffer(); errorMessage.append("@No Acctschema@"); FDialog.error(form.getWindowNo(), errorMessage.toString()); } MAcctSchemaElement acctElementOrg = acctSchema.getAcctSchemaElement(MAcctSchemaElement.ELEMENTTYPE_Organization); Boolean orgMandatory = acctElementOrg.isBalanced()?true:false; if (orgMandatory) lOrg.setStyle("color : red"); else lOrg.setStyle("color : black"); lPeriodTo.setStyle("color:red"); lCube.setStyle("color:red"); }

Target:
private void setOrgStyle() {MAcctSchema acctSchema = MAcctSchema.getClientAcctSchema(Env.getCtx(), Env.getAD_Client_ID(Env.getCtx()))[0]; if (acctSchema == null) { StringBuffer errorMessage = new StringBuffer(); errorMessage.append("@No Acctschema@"); FDialog.error(form.getWindowNo(), "FillMandatory", Msg.parseTranslation(Env.getCtx(), errorMessage.toString())); } MAcctSchemaElement acctElementOrg = acctSchema.getAcctSchemaElement(MAcctSchemaElement.ELEMENTTYPE_Organization); Boolean orgMandatory = acctElementOrg.isBalanced()?true:false; if (orgMandatory) lOrg.setStyle("color : red"); else lOrg.setStyle("color : black"); lPeriodTo.setStyle("color:red"); lCube.setStyle("color:red"); }
Source:
public String toString() { StringBuilder sb = new StringBuilder(); sb.append(frequency.name()); switch(frequency) { case WEEKLY: sb.append(" on ").append(getDaysCron()); case DAILY: sb.append(" at ").append(hour).append(":").append(mins); break; case NONE: } return sb.toString(); }

Target:
public String toString() { StringBuilder sb = new StringBuilder(); sb.append(frequency.name()); switch(frequency) { case WEEKLY: sb.append(" on ").append(getDaysCron()); sb.append(" at ").append(hour).append(":").append(mins); break; case DAILY: sb.append(" at ").append(hour).append(":").append(mins); break; case NONE: } return sb.toString(); }
Source:
private boolean validateSameArchitecture(List<VM> vmsToImport) { for (VM vm : vmsToImport) { if (!Objects.equals(vmsToImport.get(0).getClusterArch(), vm.getClusterArch())) { showErrorPopup(constants.sameArchitectureRequired()); return false; } } return true; }

Target:
private boolean validateSameArchitecture(List<VM> vmsToImport) { final ArchitectureType architectureOfFirst = vmsToImport.get(0).getClusterArch(); for (VM vm : vmsToImport) { if (!Objects.equals(architectureOfFirst, vm.getClusterArch())) { showErrorPopup(constants.sameArchitectureRequired()); return false; } } return true; }
Source:
protected ModelNode createAddSizeRotatingFileHandlerOperation(String handlerName, String formatterName, String fileName, String rotateSize, int maxBackupIndex) { ModelNode op = Util.createAddOperation(createSizeRotatingFileHandlerAddress(handlerName)); op.get(ModelDescriptionConstants.RELATIVE_TO).set("log.dir"); op.get(ModelDescriptionConstants.PATH).set(fileName); op.get(ModelDescriptionConstants.FORMATTER).set(formatterName); if (rotateSize != null) op.get(ModelDescriptionConstants.ROTATE_SIZE).set(rotateSize); op.get(ModelDescriptionConstants.MAX_BACKUP_INDEX).set(maxBackupIndex); return op; }

Target:
protected ModelNode createAddSizeRotatingFileHandlerOperation(String handlerName, String formatterName, String fileName, String rotateSize, int maxBackupIndex) { ModelNode op = Util.createAddOperation(createSizeRotatingFileHandlerAddress(handlerName)); op.get(ModelDescriptionConstants.RELATIVE_TO).set("log.dir"); op.get(ModelDescriptionConstants.PATH).set(fileName); op.get(ModelDescriptionConstants.FORMATTER).set(formatterName); if (rotateSize != null) { op.get(ModelDescriptionConstants.ROTATE_SIZE).set(rotateSize); } op.get(ModelDescriptionConstants.MAX_BACKUP_INDEX).set(maxBackupIndex); return op; }
Source:
public int normalizeStopTimesForPattern (int id, int beginWithSequence) throws SQLException { try { JDBCTableReader<PatternStop> patternStops = new JDBCTableReader(Table.PATTERN_STOP, dataSource, tablePrefix + ".", EntityPopulator.PATTERN_STOP); String patternId = getValueForId(id, "pattern_id", tablePrefix, Table.PATTERNS, connection); List<PatternStop> patternStopsToNormalize = new ArrayList<>(); for (PatternStop patternStop : patternStops.getOrdered(patternId)) { if (patternStop.stop_sequence >= beginWithSequence) { patternStopsToNormalize.add(patternStop); } } int stopTimesUpdated = updateStopTimesForPatternStops(patternStopsToNormalize, null); connection.commit(); return stopTimesUpdated; } catch (Exception e) { e.printStackTrace(); throw e; } finally { DbUtils.closeQuietly(connection); } }

Target:
public int normalizeStopTimesForPattern (int id, int beginWithSequence) throws SQLException { try { JDBCTableReader<PatternStop> patternStops = new JDBCTableReader( Table.PATTERN_STOP, dataSource, tablePrefix + ".", EntityPopulator.PATTERN_STOP ); String patternId = getValueForId(id, "pattern_id", tablePrefix, Table.PATTERNS, connection); List<PatternStop> patternStopsToNormalize = new ArrayList<>(); for (PatternStop patternStop : patternStops.getOrdered(patternId)) { if (patternStop.stop_sequence >= beginWithSequence) { patternStopsToNormalize.add(patternStop); } } int stopTimesUpdated = updateStopTimesForPatternStops(patternStopsToNormalize); connection.commit(); return stopTimesUpdated; } catch (Exception e) { e.printStackTrace(); throw e; } finally { DbUtils.closeQuietly(connection); } }
Source:
public void lock(final String reason) { final JsonStructure json = Json.createObjectBuilder() .add("lock_reason", reason) .build(); try{ this.request.method(Request.PUT).uri().path("/lock").back() .body().set(json).back() .fetch() .as(RestResponse.class) .assertStatus(HttpURLConnection.HTTP_NO_CONTENT); } catch (IOException error){} }

Target:
public void lock(final String reason) { final JsonStructure json = Json.createObjectBuilder() .add("lock_reason", reason) .build(); try { this.request.method(Request.PUT).uri().path("/lock").back() .body().set(json).back() .fetch() .as(RestResponse.class) .assertStatus(HttpURLConnection.HTTP_NO_CONTENT); } catch (final IOException error) { throw new IllegalStateException(error); } }
Source:
public void run() { boolean startupSuccessful = attemptStartup(); this.started = true; try { Thread.sleep(2000); } catch (InterruptedException e) { e.printStackTrace(); } if (startupSuccessful) { waitForStopSignal(); } else { stopAwait(); } }

Target:
public void run() { boolean startupSuccessful = attemptStartup(); this.operational = startupSuccessful; this.started = true; try { Thread.sleep(2000); } catch (InterruptedException e) { e.printStackTrace(); } if (startupSuccessful) { waitForStopSignal(); } else { stopAwait(); } }
Source:
public static boolean save(ResourceSet resourceSet) { try { for (final Resource resource : resourceSet.getResources()) { resource.save(null); } return true; } catch (final IOException e) { } return false; }

Target:
public static boolean save(ResourceSet resourceSet) { try { for (final Resource resource : resourceSet.getResources()) { resource.save(null); } return true; } catch (final IOException ex) { Activator.getDefault().getReportService().report( new StatusReport(new Status(IStatus.ERROR, Activator.PLUGIN_ID, ex.getMessage(), ex))); } return false; }
Source:
public void testWriteBehindQueueSize() throws Exception { class TestWriteBehindProvider extends WriteBehindProviderFactory.Provider { private WriteBehind writeBehind = null; @Override public <K, V> WriteBehind<K, V> createWriteBehindLoaderWriter(final CacheLoaderWriter<K, V> cacheLoaderWriter, final WriteBehindConfiguration configuration) { this.writeBehind = super.createWriteBehindLoaderWriter(cacheLoaderWriter, configuration); return writeBehind; } public WriteBehind getWriteBehind() { return writeBehind; } } TestWriteBehindProvider writeBehindProvider = new TestWriteBehindProvider(); WriteBehindTestLoaderWriter<String, String> loaderWriter = new WriteBehindTestLoaderWriter<String, String>(); CacheManager cacheManager = managerBuilder().using(writeBehindProvider).build(true); try { Cache<String, String> testCache = cacheManager.createCache("testAgedBatchedIsWritten", configurationBuilder() .add(new DefaultCacheLoaderWriterConfiguration(loaderWriter)) .add(newBatchedWriteBehindConfiguration(5, SECONDS, 2).build()) .buildConfig(String.class, String.class)); testCache.put("key1", "value"); assertThat(writeBehindProvider.getWriteBehind().getQueueSize(), is(1L)); } finally { cacheManager.close(); } }

Target:
public void testWriteBehindQueueSize() throws Exception { class TestWriteBehindProvider extends WriteBehindProviderFactory.Provider { private WriteBehind writeBehind = null; @Override public <K, V> WriteBehind<K, V> createWriteBehindLoaderWriter(final CacheLoaderWriter<K, V> cacheLoaderWriter, final WriteBehindConfiguration configuration) { this.writeBehind = super.createWriteBehindLoaderWriter(cacheLoaderWriter, configuration); return writeBehind; } public WriteBehind getWriteBehind() { return writeBehind; } } TestWriteBehindProvider writeBehindProvider = new TestWriteBehindProvider(); WriteBehindTestLoaderWriter<String, String> loaderWriter = new WriteBehindTestLoaderWriter<String, String>(); CacheManager cacheManager = managerBuilder().using(writeBehindProvider).build(true); try { Cache<String, String> testCache = cacheManager.createCache("testAgedBatchedIsWritten", configurationBuilder() .add(new DefaultCacheLoaderWriterConfiguration(loaderWriter)) .add(newBatchedWriteBehindConfiguration(5, SECONDS, 2).build()) .buildConfig(String.class, String.class)); testCache.put("key1", "value1"); assertThat(writeBehindProvider.getWriteBehind().getQueueSize(), is(1L)); testCache.put("key2", "value2"); } finally { cacheManager.close(); } }
Source:
Session noAriaSession() { return Session.builder(getQueryRunner().getDefaultSession()) .setSystemProperty(ARIA_SCAN, "false") .setSystemProperty(ARIA_FLAGS, "0") .setCatalogSessionProperty("hive", "aria_scan_enabled", "false") .build(); }

Target:
private Session noAriaSession() { return Session.builder(getQueryRunner().getDefaultSession()) .setSystemProperty(ARIA_SCAN, "false") .setSystemProperty(ARIA_FLAGS, "0") .setCatalogSessionProperty(HiveQueryRunner.HIVE_CATALOG, HiveSessionProperties.ARIA_SCAN_ENABLED, "false") .build(); }
Source:
protected void autoSelectGraphicsDevice() { if (getParameters().getGraphicsDevices().size() == 0 && getVdsGroup() != null) { OsRepository osRepository = SimpleDependecyInjector.getInstance().get(OsRepository.class); DisplayType defaultDisplayType = getParameters().getVmStaticData().getDefaultDisplayType(); int osId = getParameters().getVmStaticData().getOsId(); Version clusterVersion = getVdsGroup().getCompatibilityVersion(); List<GraphicsType> templateGraphics = VmDeviceUtils.getGraphicsTypesOfEntity(getVmTemplateId()); if (!VmValidationUtils.isGraphicsAndDisplaySupported(osId, clusterVersion, templateGraphics, defaultDisplayType)) { GraphicsType defaultGraphicsType = null; List<Pair<GraphicsType, DisplayType>> pairs = osRepository.getGraphicsAndDisplays(osId, clusterVersion); for (Pair<GraphicsType, DisplayType> pair : pairs) { if (pair.getSecond().equals(defaultDisplayType)) { defaultGraphicsType = pair.getFirst(); break; } } if (defaultGraphicsType != null) { VmDeviceType vmDisplayType = defaultDisplayType.getDefaultVmDeviceType(); GraphicsDevice defaultGraphicsDevice = new GraphicsDevice(vmDisplayType); getParameters().getGraphicsDevices().put(defaultGraphicsType, defaultGraphicsDevice); } } } }

Target:
protected void autoSelectGraphicsDevice() { if (getParameters().getGraphicsDevices().isEmpty() && getVdsGroup() != null) { DisplayType defaultDisplayType = getParameters().getVmStaticData().getDefaultDisplayType(); int osId = getParameters().getVmStaticData().getOsId(); Version clusterVersion = getVdsGroup().getCompatibilityVersion(); List<GraphicsType> templateGraphics = VmDeviceUtils.getGraphicsTypesOfEntity(getVmTemplateId()); if (!VmValidationUtils.isGraphicsAndDisplaySupported(osId, clusterVersion, templateGraphics, defaultDisplayType)) { GraphicsType defaultGraphicsType = null; List<Pair<GraphicsType, DisplayType>> pairs = osRepository.getGraphicsAndDisplays(osId, clusterVersion); for (Pair<GraphicsType, DisplayType> pair : pairs) { if (pair.getSecond().equals(defaultDisplayType)) { defaultGraphicsType = pair.getFirst(); break; } } if (defaultGraphicsType != null) { VmDeviceType vmDisplayType = defaultDisplayType.getDefaultVmDeviceType(); GraphicsDevice defaultGraphicsDevice = new GraphicsDevice(vmDisplayType); getParameters().getGraphicsDevices().put(defaultGraphicsType, defaultGraphicsDevice); } } } }
Source:
private Long getNumberOfCases(Session session) { try { Query q = session.createQuery( "select count (distinct doc.name) from XWikiDocument as doc, " + "BaseObject as obj, BaseObject consentObj, DBStringListProperty consentProp where " + HQL_BASE_PATIENT_FILTER); return (Long) q.uniqueResult(); } catch (Exception e) { this.logger.error("Error retrieving a list of patients for matching: {}", e); } return null; }

Target:
private Long getNumberOfCases(Session session) { try { Query q = session.createQuery( "select count (distinct doc.name) from " + HQL_BASE_MME_PATIENT_FILTER_FROM + " where " + HQL_BASE_MME_PATIENT_FILTER_WHERE); return (Long) q.uniqueResult(); } catch (Exception e) { this.logger.error("Error retrieving a list of patients for matching: {}", e); } return null; }
Source:
public void testOpsProhibitedOnSuspendedTxFromOtherThread() throws Exception { executeTestForAllCaches(new CI2Exc<Ignite, IgniteCache<Integer, Integer>>() { @Override public void applyx(Ignite ignite, final IgniteCache<Integer, Integer> cache) throws Exception { for (final CI1Exc<Transaction> txOperation : SUSPENDED_TX_PROHIBITED_OPS) { for (TransactionIsolation isolation : TransactionIsolation.values()) { final Transaction tx = ignite.transactions().txStart(transactionConcurrency(), isolation); cache.put(1, 1); tx.suspend(); multithreaded(new RunnableX() { @Override public void runx() throws Exception { GridTestUtils.assertThrowsWithCause(txOperation, tx, IgniteException.class); } }, 1); tx.resume(); tx.close(); assertNull(cache.get(1)); } } } }); }

Target:
public void testOpsProhibitedOnSuspendedTxFromOtherThread() throws Exception { executeTestForAllCaches(new CI2Exc<Ignite, IgniteCache<Integer, Integer>>() { @Override public void applyx(Ignite ignite, final IgniteCache<Integer, Integer> cache) throws Exception { for (final CI1<Transaction> txOperation : SUSPENDED_TX_PROHIBITED_OPS) { for (TransactionIsolation isolation : TransactionIsolation.values()) { final Transaction tx = ignite.transactions().txStart(transactionConcurrency(), isolation); cache.put(1, 1); tx.suspend(); multithreaded(() -> GridTestUtils.assertThrowsWithCause(txOperation, tx, IgniteException.class), 1); tx.resume(); tx.close(); assertNull(cache.get(1)); } } } }); }
Source:
protected void resetView(ITmfTrace viewTrace) { List<@NonNull TimeGraphEntry> entryList = getEntryList(viewTrace); super.resetView(viewTrace); if (entryList != null) { synchronized (fEntries) { for (TimeGraphEntry entry : entryList) { if (entry instanceof AggregateTraceEntry) { Collection<@NonNull ITimeGraphDataProvider<? extends TimeGraphEntryModel>> providers = ((AggregateTraceEntry) entry).getProviders(); for (ITimeGraphDataProvider<? extends TimeGraphEntryModel> provider : providers) { fEntries.row(provider).clear(); } } else if (entry instanceof TraceEntry) { fEntries.row(((TraceEntry) entry).getProvider()).clear(); } } } fAggregateGroup.clear(); } }

Target:
protected void resetView(ITmfTrace viewTrace) { List<@NonNull TimeGraphEntry> entryList = getEntryList(viewTrace); super.resetView(viewTrace); if (entryList != null) { synchronized (fEntries) { for (TimeGraphEntry entry : entryList) { if (entry instanceof AggregateTraceEntry) { Collection<@NonNull ITimeGraphDataProvider<? extends TimeGraphEntryModel>> providers = ((AggregateTraceEntry) entry).getProviders(); for (ITimeGraphDataProvider<? extends TimeGraphEntryModel> provider : providers) { fEntries.row(provider).clear(); } } else if (entry instanceof TraceEntry) { fEntries.row(((TraceEntry) entry).getProvider()).clear(); } } fAggregateEntries.row(viewTrace).clear(); } } }
Source:
private Optional<QueryOrdering> orderingFrom(Query<?> query) throws QueryParseException { Map params = query.getContext().getRequest().getParameterMap(); if (!params.containsKey("order_by")) { return Optional.empty(); } String[] orderByVals = ((String[]) params.get("order_by")); if (orderByVals[0] == null) { return Optional.empty(); } if (orderByVals.length > 1) { throw new QueryParseException("Cannot specify multiple order_by values"); } return Optional.ofNullable(QueryOrdering.fromOrderBy(orderByVals[0])); }

Target:
private Optional<QueryOrdering> orderingFrom(Query<?> query) throws QueryParseException { Map params = query.getContext().getRequest().getParameterMap(); if (!params.containsKey("order_by")) { return Optional.empty(); } String[] orderByVals = ((String[]) params.get("order_by")); if (orderByVals.length > 1) { throw new QueryParseException("Cannot specify multiple order_by values"); } if (orderByVals.length == 0) { return Optional.empty(); } return Optional.ofNullable(QueryOrdering.fromOrderBy(orderByVals[0])); }
Source:
public void test_store() throws Exception { int[] storeOpcodes = new int[] {Opcodes.ISTORE, Opcodes.LSTORE, Opcodes.FSTORE, Opcodes.DSTORE, Opcodes.ASTORE}; SymbolicValue sv = new SymbolicValue(); ProgramState startState = ProgramState.EMPTY_STATE.stackValue(sv); for (int opcode : storeOpcodes) { ProgramState programState = execute(new Instruction(opcode, 0), startState); assertThat(programState.getValue(0)).isEqualTo(sv); } }

Target:
public void test_store() throws Exception { int[] storeOpcodes = new int[] {Opcodes.ISTORE, Opcodes.LSTORE, Opcodes.FSTORE, Opcodes.DSTORE, Opcodes.ASTORE}; SymbolicValue sv = new SymbolicValue(); ProgramState startState = ProgramState.EMPTY_STATE.stackValue(sv); for (int opcode : storeOpcodes) { ProgramState programState = execute(new Instruction(opcode, 67), startState); assertThat(programState.getValue(67)).isEqualTo(sv); } }
Source:
public void run() { try { int failedCount = exchange.getFailedTransmissionCount() + 1; exchange.setFailedTransmissionCount(failedCount); if (message.isAcknowledged()) { LOGGER.log(Level.FINEST, "Timeout: message already acknowledged, cancel retransmission of {0}", message); return; } else if (message.isRejected()) { LOGGER.log(Level.FINEST, "Timeout: message already rejected, cancel retransmission of {0}", message); return; } else if (message.isCanceled()) { LOGGER.log(Level.FINEST, "Timeout: canceled (MID={0}), do not retransmit", message.getMID()); return; } else if (failedCount <= max_retransmit) { LOGGER.log(Level.FINER, "Timeout: retransmit message, failed: {0}, message: {1}", new Object[]{failedCount, message}); message.retransmitting(); if (!message.isCanceled()) retransmit(); } else { LOGGER.log(Level.FINE, "Timeout: retransmission limit reached, exchange failed, message: {0}", message); exchange.setTimedOut(); message.setTimedOut(true); OptionSet options = message.getOptions(); boolean isBlockwise = options.hasBlock1() || options.hasBlock2(); if (message instanceof Request && isBlockwise) { Request request = exchange.getRequest(); if (request != null && request.getMID() != message.getMID()) { request.setTimedOut(true); } } } } catch (Exception e) { LOGGER.log(Level.SEVERE, String.format("Exception in MessageObserver: %s", e.getMessage()), e); } }

Target:
public void run() { try { int failedCount = exchange.getFailedTransmissionCount() + 1; exchange.setFailedTransmissionCount(failedCount); if (message.isAcknowledged()) { LOGGER.log(Level.FINEST, "Timeout: message already acknowledged, cancel retransmission of {0}", message); return; } else if (message.isRejected()) { LOGGER.log(Level.FINEST, "Timeout: message already rejected, cancel retransmission of {0}", message); return; } else if (message.isCanceled()) { LOGGER.log(Level.FINEST, "Timeout: canceled (MID={0}), do not retransmit", message.getMID()); return; } else if (failedCount <= max_retransmit) { LOGGER.log(Level.FINER, "Timeout: retransmit message, failed: {0}, message: {1}", new Object[]{failedCount, message}); message.retransmitting(); if (!message.isCanceled()) retransmit(); } else { LOGGER.log(Level.FINE, "Timeout: retransmission limit reached, exchange failed, message: {0}", message); exchange.setTimedOut(); message.setTimedOut(true); OptionSet options = message.getOptions(); boolean isBlockwise = options.hasBlock1() || options.hasBlock2(); if (exchange.isOfLocalOrigin() && isBlockwise) { Request request = exchange.getRequest(); if (request != null && request.getMID() != message.getMID()) { request.setTimedOut(true); } } } } catch (Exception e) { LOGGER.log(Level.SEVERE, String.format("Exception in MessageObserver: %s", e.getMessage()), e); } }
Source:
synchronized static void cleanNotificationCache(final SQLiteDatabase writableDb) { new Thread(new Runnable() { @Override public void run() { Thread.currentThread().setPriority(Process.THREAD_PRIORITY_BACKGROUND); cleanCachedNotifications(writableDb); cleanCachedUniqueOutcomeEventNotifications(writableDb); } private void cleanCachedNotifications(SQLiteDatabase writableDb) { String whereStr = NotificationTable.COLUMN_NAME_CREATED_TIME + " < ?"; String sevenDaysAgoInSeconds = String.valueOf((System.currentTimeMillis() / 1_000L) - ONE_WEEK_IN_MILLIS); String[] whereArgs = new String[]{ sevenDaysAgoInSeconds }; writableDb.delete( NotificationTable.TABLE_NAME, whereStr, whereArgs); } private void cleanCachedUniqueOutcomeEventNotifications(SQLiteDatabase writableDb) { String whereStr = "NOT EXISTS(SELECT NULL FROM " + NotificationTable.TABLE_NAME + " n WHERE" + " n." + NotificationTable.COLUMN_NAME_NOTIFICATION_ID + " = " + CachedUniqueOutcomeNotificationTable.COLUMN_NAME_NOTIFICATION_ID + ")"; writableDb.delete( CachedUniqueOutcomeNotificationTable.TABLE_NAME, whereStr, null); } }, OS_DELETE_CACHED_NOTIFICATIONS_THREAD).start(); }

Target:
synchronized static void cleanNotificationCache(final SQLiteDatabase writableDb) { new Thread(new Runnable() { @Override public void run() { Thread.currentThread().setPriority(Process.THREAD_PRIORITY_BACKGROUND); cleanCachedNotifications(writableDb); cleanCachedUniqueOutcomeEventNotifications(writableDb); } }, OS_DELETE_CACHED_NOTIFICATIONS_THREAD).start(); }
Source:
private static long extractValue(@Nullable Object val) { if (val instanceof Number) { return ((Number) val).longValue(); } return -1; }

Target:
private static long extractValue(@Nullable Object val) { if (val instanceof Number) { return ((Number) val).longValue(); } return 0; }
Source:
public Map<?, ?> getSearchFilters(ArticleSearchQuery query, Multimap<String, String> urlParams) throws IOException { ArticleSearchQuery.Builder journalFacetQuery = ArticleSearchQuery.builder() .setFacet(JOURNAL_FACET_FIELD) .setCommonQueryParams(query); Map<?, ?> journalFacetResults = solrSearchService.search(journalFacetQuery.build()); SearchFilter journalFilter = searchFilterFactory .createSearchFilter(journalFacetResults, JOURNAL, urlParams); ArticleSearchQuery.Builder subjectAreaFacetQuery = ArticleSearchQuery.builder() .setFacet(SUBJECT_AREA_FACET_FIELD) .setCommonQueryParams(query); Map<?, ?> subjectAreaFacetResults = solrSearchService.search(subjectAreaFacetQuery.build()); SearchFilter subjectAreaFilter = searchFilterFactory .createSearchFilter(subjectAreaFacetResults, SUBJECT_AREA, urlParams); Map<String, SearchFilter> filters = new HashMap<>(); filters.put(JOURNAL, journalFilter); filters.put(SUBJECT_AREA, subjectAreaFilter); return filters; }

Target:
public Map<?, ?> getSearchFilters(ArticleSearchQuery query, Multimap<String, String> urlParams) throws IOException { ArticleSearchQuery.Builder journalFacetQuery = ArticleSearchQuery.builder() .setFacet(JOURNAL_FACET_FIELD) .setQuery(query.getQuery().orNull()) .setSimple(query.isSimple()) .setArticleTypes(query.getArticleTypes()) .setSubjects(query.getSubjects()) .setDateRange(query.getDateRange().orNull()); Map<?, ?> journalFacetResults = solrSearchService.search(journalFacetQuery.build()); SearchFilter journalFilter = searchFilterFactory .createSearchFilter(journalFacetResults, JOURNAL, urlParams); ArticleSearchQuery.Builder subjectAreaFacetQuery = ArticleSearchQuery.builder() .setFacet(SUBJECT_AREA_FACET_FIELD) .setQuery(query.getQuery().orNull()) .setSimple(query.isSimple()) .setArticleTypes(query.getArticleTypes()) .setDateRange(query.getDateRange().orNull()) .setJournalKeys(query.getJournalKeys()); Map<?, ?> subjectAreaFacetResults = solrSearchService.search(subjectAreaFacetQuery.build()); SearchFilter subjectAreaFilter = searchFilterFactory .createSearchFilter(subjectAreaFacetResults, SUBJECT_AREA, urlParams); Map<String, SearchFilter> filters = new HashMap<>(); filters.put(JOURNAL, journalFilter); filters.put(SUBJECT_AREA, subjectAreaFilter); return filters; }
Source:
public PageWithPosition getPage() { if (currentPage != null && !currentPage.isFinished()) { return currentPage; } if (blocked == null) { return null; } if (!isBlocked().isDone()) { return null; } if (pageSupplier.isFinished()) { return null; } Page page = requireNonNull(pageSupplier.pollPage(), "page is null"); currentPage = new PageWithPosition(page); return currentPage; }

Target:
public PageWithPosition getPage() { if (currentPage != null && !currentPage.isFinished()) { return currentPage; } if (blocked == null) { return null; } if (!isBlocked().isDone()) { return null; } if (pageSupplier.isFinished()) { localMemoryContext.setBytes(0); return null; } Page page = requireNonNull(pageSupplier.pollPage(), "page is null"); currentPage = new PageWithPosition(streamIndex, page); localMemoryContext.setBytes(currentPage.getPage().getRetainedSizeInBytes()); return currentPage; }
Source:
private boolean isDeduplicateObjects(Class<?> rootType) { Boolean dedup = config.isDeduplicateObjects(); if (dedup == null) { Mappings.TypeMapping classMapping = mappings.findOrCreateTypeMapping(rootType); if (classMapping != null && MappingType.CLASSMAPPING.equals(classMapping.getType())) { dedup = ClassMapping.class.cast(classMapping).isDeduplicateObjects(); } } return dedup != null ? dedup : false; }

Target:
private boolean isDeduplicateObjects(Class<?> rootType) { Boolean dedup = config.isDeduplicateObjects(); if (dedup == null) { if (!deduplicateMap.containsKey(rootType)){ JohnzonDeduplicateObjects jdo = rootType.getAnnotation(JohnzonDeduplicateObjects.class); if (Objects.nonNull(jdo)){ deduplicateMap.put(rootType, jdo.value()); } else { deduplicateMap.put(rootType, Boolean.FALSE); } } dedup = deduplicateMap.get(rootType); } return dedup != null ? dedup : false; }
Source:
String getPrompt() { if(lineBuffer != null) { return "> "; } StringBuilder buffer = new StringBuilder(); if (promptConnectPart == null) { buffer.append('['); String controllerHost = getControllerHost(); if (client != null) { if (domainMode) { buffer.append("domain@"); } else { buffer.append("standalone@"); } if (controllerHost != null) { buffer.append(controllerHost).append(':').append(getControllerPort()).append(' '); } else { buffer.append("embedded "); } promptConnectPart = buffer.toString(); } else { buffer.append("disconnected "); } } else { buffer.append(promptConnectPart); } if (getConfig().isColorOutput()) { Util.formatPrompt(buffer); } if (prefix.isEmpty()) { buffer.append('/'); } else { buffer.append(prefix.getNodeType()); final String nodeName = prefix.getNodeName(); if (nodeName != null) { buffer.append('=').append(nodeName); } } if (isBatchMode()) { String batchPrompt = " #"; if (getConfig().isColorOutput()) { batchPrompt = batchPrompt + "] "; batchPrompt = Util.formatBatchPrompt(batchPrompt); return buffer.append(batchPrompt).toString(); } } if (isWorkflowMode()) { String workflowPrompt = " ..."; if (getConfig().isColorOutput()) { workflowPrompt = workflowPrompt + "] "; workflowPrompt = Util.formatBatchPrompt(workflowPrompt); return buffer.append(workflowPrompt).toString(); } } buffer.append("] "); return buffer.toString(); }

Target:
String getPrompt() { if(lineBuffer != null) { return "> "; } StringBuilder buffer = new StringBuilder(); if (promptConnectPart == null) { buffer.append('['); String controllerHost = getControllerHost(); if (client != null) { if (domainMode) { buffer.append("domain@"); } else { buffer.append("standalone@"); } if (controllerHost != null) { buffer.append(controllerHost).append(':').append(getControllerPort()).append(' '); } else { buffer.append("embedded "); } promptConnectPart = buffer.toString(); } else { buffer.append("disconnected "); } } else { buffer.append(promptConnectPart); } if (isColorOutput()) { Util.formatPrompt(buffer); } if (prefix.isEmpty()) { buffer.append('/'); } else { buffer.append(prefix.getNodeType()); final String nodeName = prefix.getNodeName(); if (nodeName != null) { buffer.append('=').append(nodeName); } } if (isBatchMode()) { if (isColorOutput()) { buffer.append(Util.formatWorkflowPrompt(" #")); } else { buffer.append(" #"); } } if (isWorkflowMode()) { if (isColorOutput()) { buffer.append(Util.formatWorkflowPrompt(" ...")); } else { buffer.append(" ..."); } } buffer.append("] "); return buffer.toString(); }
Source:
public static void addDiskImageWithNoVmDevice(DiskImage image) { addDiskImageWithNoVmDevice(image, image.getActive(), new image_storage_domain_map(image.getImageId(), image.getStorageIds().get(0), image.getQuotaId(), image.getDiskProfileIds().get(0))); }

Target:
public static void addDiskImageWithNoVmDevice(DiskImage image) { addDiskImageWithNoVmDevice(image, image.getActive(), new image_storage_domain_map(image.getImageId(), image.getStorageIds().get(0), image.getQuotaId(), image.getDiskProfileId())); }
Source:
public void testGroupByRequireIntegerCoercion() { assertQuery("SELECT partkey, COUNT(DISTINCT shipdate), SUM(linenumber) FROM lineitem GROUP BY partkeyTestHivePushdownDistributedQuer"); }

Target:
public void testGroupByRequireIntegerCoercion() { assertQuery("SELECT partkey, COUNT(DISTINCT shipdate), SUM(linenumber) FROM lineitem GROUP BY partkey"); }
Source:
public String getTemplateName() { return "templates/generators/" + templateFileName; }

Target:
public String getTemplateName() { return TEMPLATE_BASE_PATH + templateFileName; }
Source:
public void initialize() { if (this.applicationDefinitions == null || this.applicationDefinitions.isEmpty()) { this.applicationDefinitions = getAppDefinitions(this.name, this.dslText); } }

Target:
public void initialize() { if (CollectionUtils.isEmpty(this.applicationDefinitions)) { this.applicationDefinitions = getAppDefinitions(this.name, this.dslText); } }
Source:
protected BlockStateContainer createBlockState() { return new ExtendedBlockState(this, PROPERTIES, UNLISTED_PROPERTIES); }

Target:
protected BlockStateContainer createBlockState() { return new BlockStateContainer.Builder(this).add(PROPERTY_TICKING).add(PROPERTY_MULTIPART_CONTAINER).build(); }
Source:
public boolean matchEvents() { if (!(fTraces.size() > 0)) { return false; } initMatching(); Job job = new Job(Messages.TmfEventMatching_MatchingEvents) { @Override protected IStatus run(final IProgressMonitor monitor) { for (ITmfTrace trace : fTraces) { monitor.beginTask(NLS.bind(Messages.TmfEventMatching_LookingEventsFrom, trace.getName()), IProgressMonitor.UNKNOWN); setName(NLS.bind(Messages.TmfEventMatching_RequestingEventsFrom, trace.getName())); EventMatchingBuildRequest request = new EventMatchingBuildRequest(TmfEventMatching.this, trace, monitor); trace.sendRequest(request); try { request.waitForCompletion(); } catch (InterruptedException e) { Activator.logInfo(e.getMessage()); } } return Status.OK_STATUS; } }; job.schedule(); try { job.join(); } catch (InterruptedException e) { } finalizeMatching(); return true; }

Target:
public boolean matchEvents() { if (!(fTraces.size() > 0)) { return false; } initMatching(); Job job = new Job(Messages.TmfEventMatching_MatchingEvents) { @Override protected IStatus run(final IProgressMonitor monitor) { SubMonitor subMonitor = SubMonitor.convert(monitor, fTraces.size()); for (ITmfTrace trace : fTraces) { subMonitor.beginTask(NLS.bind(Messages.TmfEventMatching_LookingEventsFrom, trace.getName()), IProgressMonitor.UNKNOWN); SubMonitor childMonitor = subMonitor.newChild(1); EventMatchingBuildRequest request = new EventMatchingBuildRequest(TmfEventMatching.this, trace, childMonitor); trace.sendRequest(request); try { request.waitForCompletion(); } catch (InterruptedException e) { Activator.logInfo(e.getMessage()); } if (childMonitor.isCanceled()) { return Status.CANCEL_STATUS; } } return Status.OK_STATUS; } }; job.schedule(); try { job.join(); } catch (InterruptedException e) { } finalizeMatching(); return true; }
Source:
public List<? extends PartitionId> getWritablePartitionIds() { List<Partition> partitions = partitionLayout.getWritablePartitions(); List<Partition> healthyPartitions = new ArrayList<Partition>(); for (Partition partition : partitions) { boolean up = true; for (Replica replica : partition.getReplicas()) { if (!replica.isUp()) { up = false; break; } } if (up) { healthyPartitions.add(partition); } } return healthyPartitions.isEmpty() ? partitions : healthyPartitions; }

Target:
public List<PartitionId> getWritablePartitionIds() { return partitionLayout.getWritablePartitions(); }
Source:
IdentityClient(String tenantId, String clientId, IdentityClientOptions options) { if (tenantId == null) { tenantId = "common"; } if (options == null) { options = new IdentityClientOptions(); } this.tenantId = tenantId; this.clientId = clientId; this.options = options; if (clientId == null) { this.publicClientApplication = null; } else { String authorityUrl = options.getAuthorityHost().replaceAll("/+$", "") + "/organizations/" + tenantId; PublicClientApplication.Builder publicClientApplicationBuilder = PublicClientApplication.builder(clientId); try { publicClientApplicationBuilder = publicClientApplicationBuilder.authority(authorityUrl); } catch (MalformedURLException e) { throw logger.logExceptionAsWarning(new IllegalStateException(e)); } HttpPipeline httpPipeline = options.getHttpPipeline(); if (httpPipeline != null) { httpPipelineAdapter = new HttpPipelineAdapter(httpPipeline); publicClientApplicationBuilder.httpClient(httpPipelineAdapter); } else { HttpClient httpClient = options.getHttpClient(); if (httpClient != null) { httpPipelineAdapter = new HttpPipelineAdapter(setupPipeline(httpClient)); publicClientApplicationBuilder.httpClient(httpPipelineAdapter); } else if (options.getProxyOptions() != null) { publicClientApplicationBuilder.proxy(proxyOptionsToJavaNetProxy(options.getProxyOptions())); } else { httpPipelineAdapter = new HttpPipelineAdapter(setupPipeline(httpClient)); publicClientApplicationBuilder.httpClient(httpPipelineAdapter); } } this.publicClientApplication = publicClientApplicationBuilder.build(); } }

Target:
IdentityClient(String tenantId, String clientId, IdentityClientOptions options) { if (tenantId == null) { tenantId = "common"; } if (options == null) { options = new IdentityClientOptions(); } this.tenantId = tenantId; this.clientId = clientId; this.options = options; if (clientId == null) { this.publicClientApplication = null; } else { String authorityUrl = options.getAuthorityHost().replaceAll("/+$", "") + "/organizations/" + tenantId; PublicClientApplication.Builder publicClientApplicationBuilder = PublicClientApplication.builder(clientId); try { publicClientApplicationBuilder = publicClientApplicationBuilder.authority(authorityUrl); } catch (MalformedURLException e) { throw logger.logExceptionAsWarning(new IllegalStateException(e)); } HttpPipeline httpPipeline = options.getHttpPipeline(); if (httpPipeline != null) { httpPipelineAdapter = new HttpPipelineAdapter(httpPipeline); publicClientApplicationBuilder.httpClient(httpPipelineAdapter); } else { HttpClient httpClient = options.getHttpClient(); if (httpClient != null) { httpPipelineAdapter = new HttpPipelineAdapter(setupPipeline(httpClient)); publicClientApplicationBuilder.httpClient(httpPipelineAdapter); } else if (options.getProxyOptions() != null) { publicClientApplicationBuilder.proxy(proxyOptionsToJavaNetProxy(options.getProxyOptions())); } else { httpPipelineAdapter = new HttpPipelineAdapter(setupPipeline(HttpClient.createDefault())); publicClientApplicationBuilder.httpClient(httpPipelineAdapter); } } this.publicClientApplication = publicClientApplicationBuilder.build(); } }
Source:
public String toString() { Method m = getMethod(); String cls = m.getDeclaringClass().getName(); StringBuilder result = new StringBuilder(cls + "." + m.getName() + "("); int i = 0; for (Class<?> p : m.getParameterTypes()) { if (i++ > 0) { result.append(", "); } result.append(p.getName()); } result.append(")"); return result.toString(); }

Target:
public String toString() { Method m = getMethod(); String cls = m.getDeclaringClass().getName(); StringBuffer result = new StringBuffer(cls + "." + m.getName() + "("); int i = 0; for (Class<?> p : m.getParameterTypes()) { if (i++ > 0) { result.append(", "); } result.append(p.getName()); } result.append(")"); return result.toString(); }
Source:
private static void checkGeometryToBingTilesLimits(OGCGeometry geometry, boolean pointOrRectangle, long tileCount) { if (pointOrRectangle) { checkCondition(tileCount <= 1_000_000, "The number of input tiles is too large (more than 1M) to compute a set of covering bing tiles."); } else { checkCondition((int) tileCount == tileCount, "The zoom level is too high to compute a set of covering bing tiles."); long complexity = tileCount * getPointCount(geometry.getEsriGeometry()); checkCondition(complexity <= 25_000_000, "The zoom level is too high or the geometry is too complex to compute a set of covering bing tiles. " + "Please use a lower zoom level or convert the geometry to its bounding box using the ST_Envelope function."); } }

Target:
private static void checkGeometryToBingTilesLimits(OGCGeometry geometry, boolean pointOrRectangle, long tileCount) { if (pointOrRectangle) { checkCondition(tileCount <= 1_000_000, "The number of input tiles is too large (more than 1M) to compute a set of covering Bing tiles."); } else { checkCondition((int) tileCount == tileCount, "The zoom level is too high to compute a set of covering Bing tiles."); long complexity = 0; try { complexity = Math.multiplyExact(tileCount, getPointCount(geometry.getEsriGeometry())); } catch (ArithmeticException e) { checkCondition(false, "The zoom level is too high or the geometry is too complex to compute a set of covering Bing tiles. " + "Please use a lower zoom level or convert the geometry to its bounding box using the ST_Envelope function."); } checkCondition(complexity <= 25_000_000, "The zoom level is too high or the geometry is too complex to compute a set of covering Bing tiles. " + "Please use a lower zoom level or convert the geometry to its bounding box using the ST_Envelope function."); } }
Source:
void shutdown() { cosmosAsyncContainer.delete().block(); logger.info("Deleted test container {}" , this.configuration.getCollectionId()); cosmosClient.close(); }

Target:
void shutdown() { if (this.databaseCreated) { cosmosAsyncDatabase.delete().block(); logger.info("Deleted temporary database created for this test", this.configuration.getDatabaseId()); } else if (this.collectionCreated) { cosmosAsyncContainer.delete().block(); logger.info("Deleted temporary collection created for this test", this.configuration.getCollectionId()); } cosmosClient.close(); }
Source:
public void testMaxAnticipationLimit() throws PagarMeException{ Limit limit = defaultRecipient.getMaxAnticipationLimit(new DateTime().plusDays(7), Timeframe.START); Assert.assertEquals((Integer)0, limit.getAmount()); Assert.assertEquals((Integer)0, limit.getAnticipationFee()); Assert.assertEquals((Integer)0, limit.getFee()); }

Target:
public void testMaxAnticipationLimit() throws PagarMeException, Exception { Limit limit = defaultRecipient.getMaxAnticipationLimit(PagarmeCalendar.getValidWeekday() , Timeframe.START); Assert.assertEquals((Integer)0, limit.getAmount()); Assert.assertEquals((Integer)0, limit.getAnticipationFee()); Assert.assertEquals((Integer)0, limit.getFee()); }
Source:
void stop() { try { send("quit"); } catch (NodeJsDebuggerException ignored) { } outputReader.interrupt(); process.destroy(); try { if (!process.waitFor(1, TimeUnit.MINUTES)) { LOG.error("NodeJs failed to stop"); } } catch (InterruptedException ignored) { } try { processWriter.close(); } catch (IOException e) { LOG.warn("Failed to close NodeJs process output stream", e); } observers.clear(); }

Target:
void stop() { try { send("quit"); } catch (NodeJsDebuggerException e) { LOG.warn(e.getMessage()); } executor.shutdown(); try { if (!executor.awaitTermination(10, TimeUnit.SECONDS)) { executor.shutdownNow(); if (!executor.awaitTermination(10, TimeUnit.SECONDS)) { LOG.warn("Unable to terminate main pool"); } } } catch (InterruptedException e) { LOG.warn(e.getMessage()); } process.destroy(); try { if (!process.waitFor(10, TimeUnit.SECONDS)) { LOG.error("Unable to terminate NodeJs"); } } catch (InterruptedException e) { LOG.warn(e.getMessage()); } try { processWriter.close(); } catch (IOException e) { LOG.warn("Failed to close NodeJs process output stream", e); } observers.clear(); }
Source:
private static void addCriteriaForSnmpParm(OnmsCriteria criteria, String snmpParm, String snmpParmValue, String snmpParmMatchType) { criteria.createAlias("node.ipInterfaces", "ipInterface"); criteria.add(Restrictions.ne("ipInterface.isManaged", "D")); criteria.createAlias("node.snmpInterfaces", "snmpInterface"); criteria.add(Restrictions.ne("snmpInterface.collect", "D")); if(snmpParmMatchType.equals("contains")) { criteria.add(Restrictions.ilike("snmpInterface.".concat(snmpParm), snmpParmValue, MatchMode.ANYWHERE)); } else if(snmpParmMatchType.equals("equals")) { final List<String> acceptedParamNames = Lists.newArrayList( "snmpphysaddr", "snmpifindex", "snmpifdescr", "snmpiftype", "snmpifname", "snmpifspeed", "snmpifadminstatus", "snmpifoperstatus", "snmpifalias", "snmpcollect", "snmplastcapsdpoll", "snmppoll", "snmplastsnmppoll"); final String snmpParameterName = ("snmp" + snmpParm).toLowerCase(); if (!acceptedParamNames.contains(snmpParameterName)) { throw new IllegalArgumentException("Provided parameter '" + snmpParm + "' is not supported"); } snmpParmValue = snmpParmValue.toLowerCase(); criteria.add(Restrictions.sqlRestriction("{alias}.nodeid in (select nodeid from snmpinterface where snmpcollect != 'D' and " + snmpParameterName + " = ?)", snmpParmValue, new StringType())); } }

Target:
private static void addCriteriaForSnmpParm(OnmsCriteria criteria, String snmpParm, String snmpParmValue, String snmpParmMatchType) { criteria.createAlias("node.ipInterfaces", "ipInterface"); criteria.add(Restrictions.ne("ipInterface.isManaged", "D")); criteria.createAlias("node.snmpInterfaces", "snmpInterface"); criteria.add(Restrictions.ne("snmpInterface.collect", "D")); if(snmpParmMatchType.equals("contains")) { criteria.add(Restrictions.ilike("snmpInterface.".concat(snmpParm), snmpParmValue, MatchMode.ANYWHERE)); } else if(snmpParmMatchType.equals("equals")) { final String snmpParameterName = ("snmp" + snmpParm).toLowerCase(); if (!ACCEPTED_SNMP_PARAM_NAMES.contains(snmpParameterName)) { throw new IllegalArgumentException("Provided parameter '" + snmpParm + "' is not supported"); } snmpParmValue = snmpParmValue.toLowerCase(); criteria.add(Restrictions.sqlRestriction("{alias}.nodeid in (select nodeid from snmpinterface where snmpcollect != 'D' and " + snmpParameterName + " = ?)", snmpParmValue, new StringType())); } }
Source:
public void fetchContributions() { Timber.d("fetch Contributions"); LiveData<List<Contribution>> liveDataContributions = repository.fetchContributions(); if(null!=lifeCycleOwner) { liveDataContributions.observe(lifeCycleOwner, this::showContributions); } if (NetworkUtils.isInternetConnectionEstablished(CommonsApplication.getInstance()) && shouldFetchContributions()) { Timber.d("fetching contributions: "); view.showProgress(true); this.user = sessionManager.getUserName(); view.showContributions(Collections.emptyList()); compositeDisposable.add(userClient.logEvents(user) .subscribeOn(ioThreadScheduler) .observeOn(mainThreadScheduler) .doOnNext(mwQueryLogEvent -> Timber.d("Received image %s", mwQueryLogEvent.title())) .filter(mwQueryLogEvent -> !mwQueryLogEvent.isDeleted()).doOnNext(mwQueryLogEvent -> Timber.d("Image %s passed filters", mwQueryLogEvent.title())) .map(image -> { Contribution contribution = new Contribution(null, null, image.title(), "", -1, image.date(), image.date(), user, user, "", "", STATE_COMPLETED); return contribution; }) .toList() .subscribe(this::saveContributionsToDB, error -> { Timber.e("Failed to fetch contributions: %s", error.getMessage()); })); } }

Target:
public void fetchContributions() { Timber.d("fetch Contributions"); LiveData<List<Contribution>> liveDataContributions = repository.fetchContributions(); if(null!=lifeCycleOwner) { liveDataContributions.observe(lifeCycleOwner, this::showContributions); } if (NetworkUtils.isInternetConnectionEstablished(CommonsApplication.getInstance()) && shouldFetchContributions()) { Timber.d("fetching contributions: "); view.showProgress(true); this.user = sessionManager.getUserName(); view.showContributions(Collections.emptyList()); compositeDisposable.add(userClient.logEvents(user) .subscribeOn(ioThreadScheduler) .observeOn(mainThreadScheduler) .doOnNext(mwQueryLogEvent -> Timber.d("Received image %s", mwQueryLogEvent.title())) .filter(mwQueryLogEvent -> !mwQueryLogEvent.isDeleted()).doOnNext(mwQueryLogEvent -> Timber.d("Image %s passed filters", mwQueryLogEvent.title())) .map(image -> { Contribution contribution = new Contribution(null, null, image.title(), "", -1, image.date(), image.date(), sessionManager.getAuthorName(), user, "", "", STATE_COMPLETED); return contribution; }) .toList() .subscribe(this::saveContributionsToDB, error -> { Timber.e("Failed to fetch contributions: %s", error.getMessage()); })); } }
Source:
public void testBuildImageIdWithBuildargs() throws Exception { requireDockerApiVersionAtLeast("1.21", "build args"); final String dockerDirectory = Paths.get(Resources.getResource("dockerDirectoryWithBuildargs").toURI()).toString(); final String buildargs = "{\"testargument\":\"22-12-2015\"}"; final BuildParam buildParam = BuildParam.create("buildargs", URLEncoder.encode(buildargs, "UTF-8")); sut.build( Paths.get(dockerDirectory), "test-buildargs", buildParam ); }

Target:
public void testBuildImageIdWithBuildargs() throws Exception { requireDockerApiVersionAtLeast("1.21", "build args"); final Path dockerDirectory = getResource("dockerDirectoryWithBuildargs"); final String buildargs = "{\"testargument\":\"22-12-2015\"}"; final BuildParam buildParam = BuildParam.create("buildargs", URLEncoder.encode(buildargs, "UTF-8")); sut.build(dockerDirectory, "test-buildargs", buildParam); }