auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private List<InlineHyperlink> getLinks() { if (contentTable instanceof SideBySideTable) { InlineHyperlink toUnifiedDiffLink = new InlineHyperlink(); toUnifiedDiffLink.setHTML(new ImageResourceRenderer().render(Gerrit.RESOURCES.unifiedDiff())); toUnifiedDiffLink.setTargetHistoryToken(getUnifiedDiffUrl()); toUnifiedDiffLink.setTitle(PatchUtil.C.unifiedDiff()); return Collections.singletonList(toUnifiedDiffLink); } else if (contentTable instanceof UnifiedDiffTable) { InlineHyperlink toSideBySideDiffLink = new InlineHyperlink(); toSideBySideDiffLink.setHTML(new ImageResourceRenderer().render(Gerrit.RESOURCES.sideBySideDiff())); toSideBySideDiffLink.setTargetHistoryToken(getSideBySideDiffUrl()); toSideBySideDiffLink.setTitle(PatchUtil.C.sideBySideDiff()); return Collections.singletonList(toSideBySideDiffLink); } else { <START> return Collections.emptyList(); <END> } }</code><technical_language>not: throw new IllegalStateException("unknown table type");</technical_language>

Target:
private List<InlineHyperlink> getLinks() { if (contentTable instanceof SideBySideTable) { InlineHyperlink toUnifiedDiffLink = new InlineHyperlink(); toUnifiedDiffLink.setHTML(new ImageResourceRenderer().render(Gerrit.RESOURCES.unifiedDiff())); toUnifiedDiffLink.setTargetHistoryToken(getUnifiedDiffUrl()); toUnifiedDiffLink.setTitle(PatchUtil.C.unifiedDiff()); return Collections.singletonList(toUnifiedDiffLink); } else if (contentTable instanceof UnifiedDiffTable) { InlineHyperlink toSideBySideDiffLink = new InlineHyperlink(); toSideBySideDiffLink.setHTML(new ImageResourceRenderer().render(Gerrit.RESOURCES.sideBySideDiff())); toSideBySideDiffLink.setTargetHistoryToken(getSideBySideDiffUrl()); toSideBySideDiffLink.setTitle(PatchUtil.C.sideBySideDiff()); return Collections.singletonList(toSideBySideDiffLink); } else { throw new IllegalStateException("unknown table type: " + contentTable.getClass().getSimpleName()); } }
Source:
<code>public void releaseStore(Store<?, ?> resource) { SoftLockValueCombinedSerializerLifecycleHelper helper = createdStores.remove(resource); if (helper == null) { throw new IllegalArgumentException("Given store is not managed by this provider : " + resource); } if (resource instanceof XAStore) { XAStore<?, ?> xaStore = (XAStore<?, ?>) resource; xaStore.transactionManagerWrapper.unregisterXAResource(xaStore.uniqueXAResourceId, xaStore.recoveryXaResource); underlyingStoreProvider.releaseStore(xaStore.underlyingStore); try { <START> Serializer<?> serializer = helper.softLockSerializerRef.getAndSet(null); <END> if(serializer instanceof CompactJavaSerializer) { ((CompactJavaSerializer)serializer).close(); } else if(serializer instanceof CompactPersistentJavaSerializer) { ((CompactPersistentJavaSerializer)serializer).close(); } xaStore.journal.close(); } catch (IOException ioe) { throw new RuntimeException(ioe); } } else { underlyingStoreProvider.releaseStore(resource); } }</code><technical_language>is some weird code type - Serializer held AtomicReference is of a single type need closed. I recommend changing reference of more specific type SoftLockSerializer dropping if block other guy need Closeable</technical_language>

Target:
public void releaseStore(Store<?, ?> resource) { SoftLockValueCombinedSerializerLifecycleHelper helper = createdStores.remove(resource); if (helper == null) { throw new IllegalArgumentException("Given store is not managed by this provider : " + resource); } if (resource instanceof XAStore) { XAStore<?, ?> xaStore = (XAStore<?, ?>) resource; xaStore.transactionManagerWrapper.unregisterXAResource(xaStore.uniqueXAResourceId, xaStore.recoveryXaResource); underlyingStoreProvider.releaseStore(xaStore.underlyingStore); helper.softLockSerializerRef.set(null); try { xaStore.journal.close(); } catch (IOException ioe) { throw new RuntimeException(ioe); } } else { underlyingStoreProvider.releaseStore(resource); } }
Source:
<code>public boolean readFullyOnRequest() { <START> return false; <END> }</code><technical_language>throw assertion here, i do in code</technical_language>

Target:
public boolean readFullyOnRequest() { throw new AssertionError("not implemented"); }
Source:
<code>private void updateLoop() { long lastRead = systemTicker.read(); while (true) { try { Thread.sleep(loopSleepMillis); long currentRead = systemTicker.read(); update(currentRead - lastRead); lastRead = currentRead; } <START> catch (RuntimeException | Error e) { <END> log.error("Exception while monitoring VM runtime", e); } catch (InterruptedException e) { return; } } }</code><technical_language>catch InterruptedException, catch Throwable</technical_language>

Target:
private void updateLoop() { long lastRead = systemTicker.read(); while (true) { try { Thread.sleep(loopSleepMillis); sleepObjectAllocation = lastRead; long currentRead = systemTicker.read(); long sleepDuration = currentRead - lastRead; lastRead = currentRead; if (sleepDuration < 0) { if (badSystemNanoTime.compareAndSet(false, true)) { log.warn("Possible kernel or JVM bug: system nano time moved backwards"); } continue; } long sleepDelta = sleepDuration - loopSleepMillis; if (sleepDelta < 0) { continue; } update(sleepDuration); } catch (InterruptedException e) { return; } catch (RuntimeException | Error e) { log.error("Exception while monitoring VM runtime", e); } } }
Source:
<code>public Object fetch(Object value) throws IllegalStateException { checkConfig(); if (value != null && value instanceof String) { REF ref = REF.fromValue((String) value); if (ref != null) { try (CloseableCoreSession session = CoreInstance.openCoreSession(ref.repo)) { try { DocumentModel doc; DocumentRef documentRef; switch (mode) { case ID_REF: documentRef = new IdRef(ref.ref); break; case PATH_REF: documentRef = new PathRef(ref.ref); break; default: throw new UnsupportedOperationException(); } if (!session.exists(documentRef)) { return null; } <START> doc = session.getDocument(documentRef); <END> doc.detach(true); return doc; } catch (DocumentNotFoundException e) { return null; } } catch (LocalException le) { return null; } } } return null; }</code><technical_language>Remove empty lines</technical_language>

Target:
public Object fetch(Object value) throws IllegalStateException { checkConfig(); if (value != null && value instanceof String) { REF ref = REF.fromValue((String) value); if (ref != null) { try (CloseableCoreSession session = CoreInstance.openCoreSession(ref.repo)) { DocumentModel doc; DocumentRef docRef; switch (mode) { case ID_REF: docRef = new IdRef(ref.ref); break; case PATH_REF: docRef = new PathRef(ref.ref); break; default: throw new UnsupportedOperationException(); } if (!session.exists(docRef)) { return null; } doc = session.getDocument(docRef); doc.detach(true); return doc; } catch (LocalException le) { return null; } } } return null; }
Source:
<code>private static boolean isVCF(final Path outPath) { <START> return outPath != null && outPath.toString().endsWith(IOUtil.VCF_FILE_EXTENSION); <END> }</code><technical_language>I careful check extensions paths, I careful Path.getFileName() instead of toString() of possibility of trailing url query strings. currently instance of Path api supports that, I suspect in future painless plan for it</technical_language>

Target:
private static boolean isVCF(final Path outPath) { return outPath != null && outPath.getFileName().toString().endsWith(IOUtil.VCF_FILE_EXTENSION); }
Source:
<code>boolean send(final String message) { if (!shutdown) { if (qSize.get() < qCapacity) { messages.offer(message); qSize.incrementAndGet(); return true; } <START> } <END> return false; }</code><technical_language>sense catch InterruptedException in <LINK_0></technical_language>

Target:
boolean send(final String message) { if (!shutdown) { if (qsize.get() < qcapacity) { messages.offer(message); qsize.incrementAndGet(); return true; } } return false; }
Source:
<code>public static TailsResponse getAllTails(Layout layout, CorfuRuntime runtime) { Set<TailsResponse> luResponses = new HashSet<>(); Layout.LayoutSegment segment = layout.getLatestSegment(); if (segment.getReplicationMode().equals(Layout.ReplicationMode.CHAIN_REPLICATION)) { for (Layout.LayoutStripe stripe : segment.getStripes()) { TailsResponse res = CFUtils.getUninterruptibly( <START> runtime.getLayoutView().getRuntimeLayout(layout) <END> .getLogUnitClient(stripe.getLogServers().get(0)) .getTails()); luResponses.add(res); } } else if (segment.getReplicationMode() .equals(Layout.ReplicationMode.QUORUM_REPLICATION)) { throw new UnsupportedOperationException(); } return aggregateLogUnitTails(luResponses); }</code><technical_language>magic number</technical_language>

Target:
public static TailsResponse getAllTails(Layout layout, CorfuRuntime runtime) { Set<TailsResponse> luResponses = new HashSet<>(); Layout.LayoutSegment segment = layout.getLatestSegment(); if (segment.getReplicationMode() == Layout.ReplicationMode.CHAIN_REPLICATION) { for (Layout.LayoutStripe stripe : segment.getStripes()) { TailsResponse res = CFUtils.getUninterruptibly( runtime.getLayoutView().getRuntimeLayout(layout) .getLogUnitClient(stripe.getLogServers().get(DEFAULT_LOGUNIT)) .getAllTails()); luResponses.add(res); } } else if (segment.getReplicationMode() == Layout.ReplicationMode.QUORUM_REPLICATION) { throw new UnsupportedOperationException(); } return aggregateLogUnitTails(luResponses); }
Source:
<code>public UnsupportedMetadataVersionException(String message) { <START> super(StatusCode.UNSUPPORTED_METADATA_VERSION, message); <END> }</code><technical_language>I this is a behavior change</technical_language>

Target:
public UnsupportedMetadataVersionException(String message) { super(StatusCode.UNSUPPORTED_METADATA_VERSION, String.format(message)); }
Source:
<code>private int getInstancePriority(WorkflowInstance instance) { <START> return instance.priority != null ? instance.priority.intValue() : 0; <END> }</code><technical_language>if column is null in database, need this null check</technical_language>

Target:
private short getInstancePriority(WorkflowInstance instance) { return instance.priority != null ? instance.priority.shortValue() : 0; }
Source:
<code>public static void saveKeyValueToFluo(JavaPairRDD<Key, Value> data, JavaSparkContext ctx, Connector conn, FluoConfiguration fluoConfig, Path fluoTempDir, Path failuresDir) throws Exception { Job job = Job.getInstance(ctx.hadoopConfiguration()); FileSystem hdfs = FileSystem.get(ctx.hadoopConfiguration()); if (hdfs.exists(fluoTempDir)) { hdfs.delete(fluoTempDir, true); } if (!hdfs.exists(failuresDir)) { hdfs.mkdirs(failuresDir); } AccumuloFileOutputFormat.setOutputPath(job, fluoTempDir); data.saveAsNewAPIHadoopFile(fluoTempDir.toString(), Key.class, Value.class, AccumuloFileOutputFormat.class, job.getConfiguration()); conn.tableOperations().importDirectory(fluoConfig.getAccumuloTable(), fluoTempDir.toString(), failuresDir.toString(), false); <START> log.info("Imported data at into Fluo app {}", fluoTempDir, fluoConfig.getApplicationName()); <END> }</code><technical_language>change Fluo app Fluo table</technical_language>

Target:
public static void saveKeyValueToFluo(JavaPairRDD<Key, Value> data, JavaSparkContext ctx, Connector conn, FluoConfiguration fluoConfig, Path fluoTempDir, Path failuresDir) throws Exception { Job job = Job.getInstance(ctx.hadoopConfiguration()); FileSystem hdfs = FileSystem.get(ctx.hadoopConfiguration()); if (hdfs.exists(fluoTempDir)) { hdfs.delete(fluoTempDir, true); } if (!hdfs.exists(failuresDir)) { hdfs.mkdirs(failuresDir); } AccumuloFileOutputFormat.setOutputPath(job, fluoTempDir); data.saveAsNewAPIHadoopFile(fluoTempDir.toString(), Key.class, Value.class, AccumuloFileOutputFormat.class, job.getConfiguration()); conn.tableOperations().importDirectory(fluoConfig.getAccumuloTable(), fluoTempDir.toString(), failuresDir.toString(), false); log.info("Imported data at into Fluo table {}", fluoTempDir, fluoConfig.getApplicationName()); }
Source:
<code>private ItunesEpfFileUpdater( String username, String password, String feedPath, String localFilesPath, S3Client s3Client ) { this.username = checkNotNull(username); this.password = checkNotNull(password); this.feedPath = checkNotNull(feedPath); this.localFilesPath = checkNotNull(localFilesPath); <START> this.s3client = s3Client; <END> }</code><technical_language>checkNotNull</technical_language>

Target:
private ItunesEpfFileUpdater( String username, String password, String feedPath, String localFilesPath, S3Client s3Client ) { this.username = checkNotNull(username); this.password = checkNotNull(password); this.feedPath = checkNotNull(feedPath); this.localFilesPath = checkNotNull(localFilesPath); this.s3client = checkNotNull(s3Client); }
Source:
<code>public RestSessionCollection getSessions( @QueryParam("last_id") Long lastId, @QueryParam("page_size") Integer pageSize, @QueryParam("page_number") Integer pageNumber) { int validPageSize = QueryParamValidator.validatePageSize(Optional.fromNullable(pageSize), MAX_SESSIONS_PAGE_SIZE, DEFAULT_SESSIONS_PAGE_SIZE); return tm.begin(() -> { ProjectStore rs = rm.getProjectStore(getSiteId()); SessionStore ss = sm.getSessionStore(getSiteId()); Integer sessionRecordsNumber = ss.getTotalSessionsCount(Optional.fromNullable(lastId)); <START> Integer page = Optional.fromNullable(pageNumber).or(1); <END> List<StoredSessionWithLastAttempt> sessions = ss.getSessions(validPageSize, Optional.fromNullable(lastId), page); return RestModels.sessionCollection(rs, sessions, sessionRecordsNumber); }); }</code><technical_language>variable name _page_ is uncertain. define QueryParamValidator.validatePageNumber change name validPageNumber</technical_language>

Target:
public RestSessionCollection getSessions( @QueryParam("last_id") Long lastId, @QueryParam("page_size") Integer pageSize, @QueryParam("page_number") Integer pageNumber) { int validPageSize = QueryParamValidator.validatePageSize(Optional.fromNullable(pageSize), MAX_SESSIONS_PAGE_SIZE, DEFAULT_SESSIONS_PAGE_SIZE); int validPageNumber = QueryParamValidator.validatePageNumber(Optional.fromNullable(pageNumber), DEFAULT_PAGE_NUMBER); return tm.begin(() -> { ProjectStore rs = rm.getProjectStore(getSiteId()); SessionStore ss = sm.getSessionStore(getSiteId()); Integer sessionRecordsNumber = ss.getSessionsCount(Optional.fromNullable(lastId)); List<StoredSessionWithLastAttempt> sessions = ss.getSessions(validPageSize, validPageNumber, Optional.fromNullable(lastId)); return RestModels.sessionCollection(rs, sessions, sessionRecordsNumber); }); }
Source:
<code>public void testUnmarshallSubprocessLevelEventWithEdgesEmptyProperties() throws Exception { Diagram<Graph, Metadata> diagram = unmarshall(marshaller, BPMN_CATCHING_INTERMEDIATE_EVENT_FILE_PATH); assertDiagram(diagram, AMOUNT_OF_NODES_IN_DIAGRAM); IntermediateErrorEventCatching emptySubprocessEvent = getCatchingIntermediateNodeById(diagram, EMPTY_WITH_OUTGOING_EDGE_SUBPROCESS_LEVEL_EVENT_ID, HAS_NO_INCOME_EDGE, HAS_OUTGOING_EDGE); assertGeneralSet(emptySubprocessEvent.getGeneral(), EMPTY_VALUE, EMPTY_VALUE); <START> assertErrorEventExecutionSet(emptySubprocessEvent.getExecutionSet(), EMPTY_VALUE, CANCELLING, ""); <END> assertDataIOSet(emptySubprocessEvent.getDataIOSet(), EMPTY_VALUE); }</code><technical_language>suggestion assertErrorEventExecutionSet(emptySubprocessEvent.getExecutionSet(), EMPTY_VALUE, CANCELLING, EMPTY_VALUE);</technical_language>

Target:
public void testUnmarshallSubprocessLevelEventWithEdgesEmptyProperties() throws Exception { Diagram<Graph, Metadata> diagram = unmarshall(marshaller, BPMN_CATCHING_INTERMEDIATE_EVENT_FILE_PATH); assertDiagram(diagram, AMOUNT_OF_NODES_IN_DIAGRAM); IntermediateErrorEventCatching emptySubprocessEvent = getCatchingIntermediateNodeById(diagram, EMPTY_WITH_OUTGOING_EDGE_SUBPROCESS_LEVEL_EVENT_ID, HAS_NO_INCOME_EDGE, HAS_OUTGOING_EDGE); assertGeneralSet(emptySubprocessEvent.getGeneral(), EMPTY_VALUE, EMPTY_VALUE); assertErrorEventExecutionSet(emptySubprocessEvent.getExecutionSet(), EMPTY_VALUE, CANCELLING, EMPTY_VALUE); assertDataIOSet(emptySubprocessEvent.getDataIOSet(), EMPTY_VALUE); }
Source:
<code>private boolean nextBatch(VectorizedRowBatch columnarBatch) throws IOException { <START> initRowBatch(); <END> columnarBatch.reset(); if (rowsReturned >= totalRowCount) { return false; } checkEndOfRowGroup(); int num = (int) Math.min(VectorizedRowBatch.DEFAULT_SIZE, totalCountLoadedSoFar - rowsReturned); for (int i = 0; i < columnReaders.length; ++i) { if (columnReaders[i] == null) { continue; } columnarBatch.cols[colsToInclude.get(i)].isRepeating = true; columnReaders[i].readBatch(num, columnarBatch.cols[colsToInclude.get(i)], columnTypesList.get(colsToInclude.get(i))); } rowsReturned += num; columnarBatch.size = num; return true; }</code><technical_language>call initRowBatch here</technical_language>

Target:
private boolean nextBatch(VectorizedRowBatch columnarBatch) throws IOException { columnarBatch.reset(); if (rowsReturned >= totalRowCount) { return false; } checkEndOfRowGroup(); int num = (int) Math.min(VectorizedRowBatch.DEFAULT_SIZE, totalCountLoadedSoFar - rowsReturned); for (int i = 0; i < columnReaders.length; ++i) { if (columnReaders[i] == null) { continue; } columnarBatch.cols[colsToInclude.get(i)].isRepeating = true; columnReaders[i].readBatch(num, columnarBatch.cols[colsToInclude.get(i)], columnTypesList.get(colsToInclude.get(i))); } rowsReturned += num; columnarBatch.size = num; return true; }
Source:
<code>private String retrieveParameterValueFromServletContextConfiguration(final FilterConfig filterConfig, final String propertyName) { <START> final String value2 = filterConfig.getServletContext().getInitParameter(propertyName); <END> if (CommonUtils.isNotBlank(value2)) { logger.info("Property loaded from ServletContext.getInitParameter with value [{}]", propertyName, value2); return value2; } return null; }</code><technical_language>This instead of value2 here..</technical_language>

Target:
private String retrieveParameterValueFromServletContextConfiguration(final FilterConfig filterConfig, final String propertyName) { final String value = filterConfig.getServletContext().getInitParameter(propertyName); if (CommonUtils.isNotBlank(value)) { logger.info("Property loaded from ServletContext.getInitParameter with value [{}]", propertyName, value); return value; } return null; }
Source:
<code>DataType discardDataTypeProperties() { return dataTypeManager .withDataType(getDataType()) .withName(getOldName()) .withType(getOldType()) .withConstraint(getOldConstraint()) <START> .withConstraintType(getConstraintType()) <END> .asList(getOldIsList()) .get(); }</code><technical_language>@danielzhe discussed Slack, need _old_ ;-)</technical_language>

Target:
DataType discardDataTypeProperties() { return dataTypeManager .withDataType(getDataType()) .withName(getOldName()) .withType(getOldType()) .withConstraint(getOldConstraint()) .withConstraintType(getOldConstraintType()) .asList(getOldIsList()) .get(); }
Source:
<code>public List<HasMetadata> createProjectAndRoleBindings(String name, String description, String displayName, String adminUser, String requestingUser) { List<HasMetadata> result = new ArrayList<>(); Project project = getProject(name, description, displayName, requestingUser); List<HasMetadata> projectRoleBindings = getNewProjectRoleBindings(name, adminUser); <START> ProjectOperationsImpl projectOperations = new ProjectOperationsImpl(client, OpenShiftConfig.wrap(config)); <END> result.add(projectOperations.create(project)); NamespaceVisitFromServerGetWatchDeleteRecreateWaitApplicableListImpl listOp = new NamespaceVisitFromServerGetWatchDeleteRecreateWaitApplicableListImpl(client, config, getNamespace(), null, false, false, new ArrayList<>(), projectRoleBindings, null, DeletionPropagation.BACKGROUND, true) {}; result.addAll(listOp.createOrReplace()); return result; }</code><technical_language>Is creating a new ProjectOperationsImpl instance necessary</technical_language>

Target:
public List<HasMetadata> createProjectAndRoleBindings(String name, String description, String displayName, String adminUser, String requestingUser) { List<HasMetadata> result = new ArrayList<>(); Project project = initProject(name, description, displayName, requestingUser); List<HasMetadata> projectRoleBindings = initRoleBindings(name, adminUser); result.add(create(project)); NamespaceVisitFromServerGetWatchDeleteRecreateWaitApplicableListImpl listOp = new NamespaceVisitFromServerGetWatchDeleteRecreateWaitApplicableListImpl(client, config, getNamespace(), null, false, false, new ArrayList<>(), projectRoleBindings, null, DeletionPropagation.BACKGROUND, true) {}; result.addAll(listOp.createOrReplace()); return result; }
Source:
<code>protected void upgradeSystemTables() throws StandardException { ConglomerateController heapCC = null; try { TabInfoImpl tII = sdd.getNonCoreTIByNumber(DataDictionary.SYSTRIGGERS_CATALOG_NUM); TableDescriptor td = sdd.getTableDescriptor( tII.getCatalogRowFactory().getCatalogName(), sdd.getSystemSchemaDescriptor(), tc ); long conglomID = td.getHeapConglomerateId(); heapCC=tc.openConglomerate(conglomID, false,0, TransactionController.MODE_RECORD, TransactionController.ISOLATION_REPEATABLE_READ); if (heapCC instanceof HBaseController) { HBaseController hCC = (HBaseController)heapCC; if (hCC.getConglomerate().getFormat_ids().length >= <START> SYSTRIGGERSRowFactory.SYSTRIGGERS_COLUMN_COUNT) { <END> return; } } heapCC.close(); heapCC = null; sdd.upgrade_addColumns(tII.getCatalogRowFactory(), new int[]{19,20}, tc); SpliceLogUtils.info(LOG, "Catalog upgraded: updated system table sys.systriggers"); } catch (Exception e) { SpliceLogUtils.info(LOG, "Attempt to upgrade sys.systriggers failed. Please check if it has already been upgraded and contains the correct number of columns: 18."); } finally { if (heapCC != null) heapCC.close(); } }</code><technical_language>I a "hardcoded" here, instead of referring SYSTRIGGERSRowFactory.SYSTRIGGERS_COLUMN_COUNT (it a static copies current SYSTRIGGERSRowFactory.SYSTRIGGERS_COLUMN_COUNT value) if add more columns systriggers this code _triggered_ again</technical_language>

Target:
protected void upgradeSystemTables() throws StandardException { ConglomerateController heapCC = null; try { TabInfoImpl tII = sdd.getNonCoreTIByNumber(DataDictionary.SYSTRIGGERS_CATALOG_NUM); TableDescriptor td = sdd.getTableDescriptor( tII.getCatalogRowFactory().getCatalogName(), sdd.getSystemSchemaDescriptor(), tc ); long conglomID = td.getHeapConglomerateId(); heapCC=tc.openConglomerate(conglomID, false,0, TransactionController.MODE_RECORD, TransactionController.ISOLATION_REPEATABLE_READ); if (heapCC instanceof HBaseController) { HBaseController hCC = (HBaseController)heapCC; if (hCC.getConglomerate().getFormat_ids().length >= 20) { return; } } heapCC.close(); heapCC = null; sdd.upgrade_addColumns(tII.getCatalogRowFactory(), new int[]{19,20}, tc); SpliceLogUtils.info(LOG, "Catalog upgraded: updated system table sys.systriggers"); } catch (Exception e) { SpliceLogUtils.info(LOG, "Attempt to upgrade sys.systriggers failed. Please check if it has already been upgraded and contains the correct number of columns: 20."); } finally { if (heapCC != null) heapCC.close(); } }
Source:
<code>for (int i = 0; i < NB_BOND; ++i) { LocalDate endDate = START_DATE[i].plus(BOND_TENOR[i]); PeriodicSchedule periodSchedule = PeriodicSchedule.of( START_DATE[i], endDate, Frequency.P6M, BUSINESS_ADJUST, StubConvention.SHORT_INITIAL, false); FixedCouponBond product = FixedCouponBond.builder() .dayCount(DAY_COUNT) .fixedRate(RATE[i]) .legalEntityId(ISSUER_ID) .currency(USD) .notional(NOTIONAL) .periodicSchedule(periodSchedule) .settlementDateOffset(SETTLEMENT_DAYS) .yieldConvention(YIELD_CONVENTION) .exCouponPeriod(EX_COUPON) .build(); BOND_PRODUCT[i] = product; <START> Security<FixedCouponBond> bondSecurity = UnitSecurity.builder(product).standardId(BOND_SECURITY_ID).build(); <END> BOND_SECURITY_LINK[i] = SecurityLink.resolved(bondSecurity); }</code><technical_language>bond "Security ID"</technical_language>

Target:
for (int i = 0; i < NB_BOND; ++i) { LocalDate endDate = START_DATE[i].plus(BOND_TENOR[i]); PeriodicSchedule periodSchedule = PeriodicSchedule.of( START_DATE[i], endDate, Frequency.P6M, BUSINESS_ADJUST, StubConvention.SHORT_INITIAL, false); FixedCouponBond product = FixedCouponBond.builder() .dayCount(DAY_COUNT) .fixedRate(RATE[i]) .legalEntityId(ISSUER_ID) .currency(USD) .notional(NOTIONAL) .periodicSchedule(periodSchedule) .settlementDateOffset(SETTLEMENT_DAYS) .yieldConvention(YIELD_CONVENTION) .exCouponPeriod(EX_COUPON) .build(); BOND_PRODUCT[i] = product; Security<FixedCouponBond> bondSecurity = UnitSecurity.builder(product).standardId(BOND_SECURITY_ID[i]).build(); BOND_SECURITY_LINK[i] = SecurityLink.resolved(bondSecurity); }
Source:
<code>protected Notification createNotification(Intent inboundIntent) { this.parseIntent(inboundIntent); <START> if (this.data == null || this.data.silent) { <END> return null; } this.buildNotificationFromData(); final Notification n = builderToNotification(); if (!data.sticky) { n.flags |= Notification.FLAG_AUTO_CANCEL; } return n; }</code><technical_language>useful put this conditional log a message showing a message. E.g. MPLog.d(LOGTAG, "Notification shown 'mp_silent = true'")</technical_language>

Target:
protected Notification createNotification(Intent inboundIntent) { this.parseIntent(inboundIntent); if (this.data.silent) { MPLog.i(LOGTAG, "Notification will not be shown because \'mp_silent = true\'"); return null; } if (null == this.data) { return null; } this.buildNotificationFromData(); final Notification n = builderToNotification(); if (!data.sticky) { n.flags |= Notification.FLAG_AUTO_CANCEL; } return n; }
Source:
<code>public void updateNotification(Notification notification) { Notification cachedNotification = getUserNotificationByType(notification.getUserId(), notification.getType()); if (cachedNotification != null) { if (cachedNotification.getWeb() != notification.getWeb() || cachedNotification.getMail() != notification.getMail() || !cachedNotification.getAttributes().equals(notification.getAttributes())) { if (!notification.getWeb() && !notification.getMail() && notification.getAttributes().isEmpty()) { try { dataManager.removeNotification(cachedNotification); } catch (SQLException error) { Log.warning(error); } notificationsLock.writeLock().lock(); try { getUserNotificationsUnsafe(notification.getUserId()).remove(cachedNotification); } finally { notificationsLock.writeLock().unlock(); } } else { notificationsLock.writeLock().lock(); try { cachedNotification.setWeb(notification.getWeb()); cachedNotification.setMail(notification.getMail()); cachedNotification.setAttributes(notification.getAttributes()); } finally { notificationsLock.writeLock().unlock(); } try { dataManager.updateNotification(cachedNotification); } catch (SQLException error) { Log.warning(error); } } } else { notification.setId(cachedNotification.getId()); } <START> } else if (notification.getWeb() || notification.getMail() || !notification.getAttributes().isEmpty()) { <END> try { dataManager.addNotification(notification); } catch (SQLException error) { Log.warning(error); } notificationsLock.writeLock().lock(); try { getUserNotificationsUnsafe(notification.getUserId()).add(notification); } finally { notificationsLock.writeLock().unlock(); } } }</code><technical_language>Do need check for attributes here</technical_language>

Target:
public void updateNotification(Notification notification) { Notification cachedNotification = getUserNotificationByType(notification.getUserId(), notification.getType()); if (cachedNotification != null) { if (cachedNotification.getWeb() != notification.getWeb() || cachedNotification.getMail() != notification.getMail()) { if (!notification.getWeb() && !notification.getMail()) { try { dataManager.removeNotification(cachedNotification); } catch (SQLException error) { Log.warning(error); } notificationsLock.writeLock().lock(); try { getUserNotificationsUnsafe(notification.getUserId()).remove(cachedNotification); } finally { notificationsLock.writeLock().unlock(); } } else { notificationsLock.writeLock().lock(); try { cachedNotification.setWeb(notification.getWeb()); cachedNotification.setMail(notification.getMail()); cachedNotification.setAttributes(notification.getAttributes()); } finally { notificationsLock.writeLock().unlock(); } try { dataManager.updateNotification(cachedNotification); } catch (SQLException error) { Log.warning(error); } } } else { notification.setId(cachedNotification.getId()); } } else if (notification.getWeb() || notification.getMail()) { try { dataManager.addNotification(notification); } catch (SQLException error) { Log.warning(error); } notificationsLock.writeLock().lock(); try { getUserNotificationsUnsafe(notification.getUserId()).add(notification); } finally { notificationsLock.writeLock().unlock(); } } }
Source:
<code>public void visitNode(Tree tree) { MethodTree methodTree = (MethodTree) tree; <START> ClassJavaType clt; <END> String name = "Object"; if (hasSemantic() && isCompareToMethod(methodTree) && Boolean.FALSE.equals(methodTree.isOverriding())) { clt = (ClassJavaType) methodTree.symbol().owner().type(); if (isComparableImplemented(clt)) { ClassJavaType comparableType = clt.superTypes().stream().filter(supertype -> supertype.is("java.lang.Comparable")).findFirst().get(); if (comparableType.isParameterized()) { ParametrizedTypeJavaType ptjt = (ParametrizedTypeJavaType) comparableType; name = ptjt.substitution(ptjt.typeParameters().get(0)).symbol().name(); } reportIssue((Tree) methodTree.parameters(), "Refactor this method so that its argument is of type '" + name + "'."); } } }</code><technical_language>variable declarations body of next if statement</technical_language>

Target:
public void visitNode(Tree tree) { MethodTree methodTree = (MethodTree) tree; if (hasSemantic() && isCompareToMethod(methodTree) && Boolean.FALSE.equals(methodTree.isOverriding())) { ClassJavaType ownerType = (ClassJavaType) methodTree.symbol().owner().type(); ownerType.superTypes().stream().filter(supertype -> supertype.is("java.lang.Comparable")).findFirst().ifPresent( comparableType -> { String name = "Object"; if (comparableType.isParameterized()) { ParametrizedTypeJavaType ptjt = (ParametrizedTypeJavaType) comparableType; name = ptjt.substitution(ptjt.typeParameters().get(0)).symbol().name(); } reportIssue(methodTree.parameters().get(0), "Refactor this method so that its argument is of type '" + name + "'."); }); } }
Source:
<code>protected void deleteCitationCollectionOrder(CitationCollectionOrder citationCollectionOrder) { String statement = "delete from " + m_collectionOrderTableName + " where (" + m_collectionTableId + " = ? AND " + <START> "LOCATION = ? AND SECTION_TYPE = ? AND VALUE = ? )"; <END> Object fields[] = new Object[4]; fields[0] = citationCollectionOrder.getCollectionId(); fields[1] = citationCollectionOrder.getLocation(); fields[2] = citationCollectionOrder.getSectiontype(); fields[3] = citationCollectionOrder.getValue(); boolean ok = m_sqlService.dbWrite(statement, fields); }</code><technical_language>want delete location, if type match matter</technical_language>

Target:
protected void deleteCitationCollectionOrder(CitationCollectionOrder citationCollectionOrder) { String statement = "delete from " + m_collectionOrderTableName + " where (" + m_collectionTableId + " = ? AND " + "LOCATION = ? )"; Object fields[] = new Object[2]; fields[0] = citationCollectionOrder.getCollectionId(); fields[1] = citationCollectionOrder.getLocation(); boolean ok = m_sqlService.dbWrite(statement, fields); }
Source:
<code>public void testInterfaceExtension() { List<ClassReference> references = ASTProcessor.analyze(getLibraryPaths(), getSourcePaths(), Paths.get("src/test/resources/testclasses/simple/EventServer.java")); for (ClassReference reference : references) { <START> System.out.println("Reference: " + reference); <END> } Assert.assertTrue(references.contains(new ClassReference("java.rmi.Remote", TypeReferenceLocation.INHERITANCE, 6, 0, 117, "public interface EventServer extends Remote {"))); }</code><technical_language>This is a debug println removed</technical_language>

Target:
public void testInterfaceExtension() { List<ClassReference> references = ASTProcessor.analyze(getLibraryPaths(), getSourcePaths(), Paths.get("src/test/resources/testclasses/simple/EventServer.java")); Assert.assertTrue(references.contains(new ClassReference("java.rmi.Remote", ResolutionStatus.RESOLVED, TypeReferenceLocation.INHERITANCE, 6, 0, 117, "public interface EventServer extends Remote {"))); }
Source:
<code><START> static <T> Future<T> ofCallable(Callable<? extends T> computation) { <END> return of(DEFAULT_EXECUTOR_SERVICE, computation::call); }</code><technical_language>Please add a java Objects.requireNonNull(computation, "computation is null");</technical_language>

Target:
static <T> Future<T> ofCallable(Callable<? extends T> computation) { Objects.requireNonNull(computation, "computation is null"); return of(DEFAULT_EXECUTOR_SERVICE, computation::call); }
Source:
<code>public void initialize() { GatewayConfig configuration = getConfigAs(GatewayConfig.class); if (configuration.host == null || configuration.host.isEmpty()) { updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR, "Host must be specified in the configuration!"); return; } if (configuration.code == null || configuration.code.isEmpty()) { updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR, "Security code must be provided in the configuration!"); return; } <START> this.gatewayURI = "coaps://" + configuration.host + ":" + configuration.port + " END> try { URI uri = new URI(gatewayURI); deviceClient = new TradfriCoapClient(uri); } catch (URISyntaxException e) { logger.debug("Illegal gateway URI `{}`: {}", gatewayURI, e.getMessage()); updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR, e.getMessage()); return; } DtlsConnectorConfig.Builder builder = new DtlsConnectorConfig.Builder(new InetSocketAddress(0)); builder.setPskStore(new StaticPskStore("", configuration.code.getBytes())); dtlsConnector = new DTLSConnector(builder.build()); endPoint = new CoapEndpoint(dtlsConnector, NetworkConfig.getStandard()); deviceClient.setEndpoint(endPoint); updateStatus(ThingStatus.UNKNOWN); scheduler.scheduleWithFixedDelay(() -> { startScan(); }, 0, 1, TimeUnit.MINUTES); }</code><technical_language>reasons this is a double-/</technical_language>

Target:
public void initialize() { GatewayConfig configuration = getConfigAs(GatewayConfig.class); if (configuration.host == null || configuration.host.isEmpty()) { updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR, "Host must be specified in the configuration!"); return; } if (configuration.code == null || configuration.code.isEmpty()) { updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR, "Security code must be provided in the configuration!"); return; } this.gatewayURI = "coaps://" + configuration.host + ":" + configuration.port + " try { URI uri = new URI(gatewayURI); deviceClient = new TradfriCoapClient(uri); } catch (URISyntaxException e) { logger.debug("Illegal gateway URI `{}`: {}", gatewayURI, e.getMessage()); updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR, e.getMessage()); return; } DtlsConnectorConfig.Builder builder = new DtlsConnectorConfig.Builder(new InetSocketAddress(0)); builder.setPskStore(new StaticPskStore("", configuration.code.getBytes())); dtlsConnector = new DTLSConnector(builder.build()); endPoint = new CoapEndpoint(dtlsConnector, NetworkConfig.getStandard()); deviceClient.setEndpoint(endPoint); updateStatus(ThingStatus.UNKNOWN); scanJob = scheduler.scheduleWithFixedDelay(() -> { startScan(); }, 0, 1, TimeUnit.MINUTES); }
Source:
<code>public void start() { super.start(); if (!config.simpleCache()) { this.distExecutorService = SecurityActions.getDefaultExecutorService(cache.wired()); } if (filterIndexingServiceProviders == null) { <START> Collection<FilterIndexingServiceProvider> providers = ServiceFinder.load(FilterIndexingServiceProvider.class); <END> filterIndexingServiceProviders = new ArrayList<>(providers.size()); for (FilterIndexingServiceProvider provider : providers) { componentRegistry.wireDependencies(provider, false); provider.start(); filterIndexingServiceProviders.add(provider); } } }</code><technical_language>a conflict :)</technical_language>

Target:
public void start() { super.start(); if (!config.simpleCache()) { this.distExecutorService = SecurityActions.getDefaultExecutorService(cache.wired()); } Collection<FilterIndexingServiceProvider> providers = ServiceFinder.load(FilterIndexingServiceProvider.class); filterIndexingServiceProviders = new ArrayList<>(providers.size()); for (FilterIndexingServiceProvider provider : providers) { componentRegistry.wireDependencies(provider, false); provider.start(); filterIndexingServiceProviders.add(provider); } }
Source:
<code>private List<Event> createRefundEvents(RefundStateTransition refundStateTransition) throws EventCreationException { RefundHistory refundHistory = refundDao.getRefundHistoryByRefundExternalIdAndRefundStatus( refundStateTransition.getRefundExternalId(), refundStateTransition.getRefundStatus()) .orElseThrow(() -> new EventCreationException(refundStateTransition.getIdentifier())); Event refundEvent = createRefundEvent(refundHistory, refundStateTransition.getStateTransitionEventClass()); Optional<Event> refundAvailabilityEvent = createRefundAvailabilityUpdatedEvent( refundHistory.getChargeEntity().getExternalId(), <START> refundHistory.getHistoryEndDate(), <END> refundStateTransition.getStateTransitionEventClass() ); return Stream.of(Optional.of(refundEvent), refundAvailabilityEvent) .flatMap(Optional::stream) .collect(Collectors.toList()); }</code><technical_language>historyEndDate null. change historyStartDate</technical_language>

Target:
private List<Event> createRefundEvents(RefundStateTransition refundStateTransition) throws EventCreationException { RefundHistory refundHistory = refundDao.getRefundHistoryByRefundExternalIdAndRefundStatus( refundStateTransition.getRefundExternalId(), refundStateTransition.getRefundStatus()) .orElseThrow(() -> new EventCreationException(refundStateTransition.getIdentifier())); Event refundEvent = createRefundEvent(refundHistory, refundStateTransition.getStateTransitionEventClass()); Optional<Event> refundAvailabilityEvent = createRefundAvailabilityUpdatedEvent( refundHistory.getChargeEntity().getExternalId(), refundHistory.getHistoryStartDate(), refundStateTransition.getStateTransitionEventClass() ); return Stream.of(Optional.of(refundEvent), refundAvailabilityEvent) .flatMap(Optional::stream) .collect(Collectors.toList()); }
Source:
<code>private TDigest( double compression, double min, double max, double totalWeight, int centroidCount, double[] means, double[] weights, boolean needsMerge, boolean backwards) { checkArgument(compression >= 10, "compression factor too small (< 10)"); this.compression = compression; this.maxSize = (int) (10 * compression); this.totalWeight = totalWeight; this.min = min; this.max = max; this.centroidCount = centroidCount; this.means = means; <START> this.weights = weights; <END> this.needsMerge = needsMerge; this.backwards = backwards; }</code><technical_language>null checks</technical_language>

Target:
private TDigest( double compression, double min, double max, double totalWeight, int centroidCount, double[] means, double[] weights, boolean needsMerge, boolean backwards) { checkArgument(compression >= 10, "compression factor too small (< 10)"); this.compression = compression; this.maxSize = (int) (10 * compression); this.totalWeight = totalWeight; this.min = min; this.max = max; this.centroidCount = centroidCount; this.means = requireNonNull(means, "means is null"); this.weights = requireNonNull(weights, "weights is null"); this.needsMerge = needsMerge; this.backwards = backwards; }
Source:
<code>public void testRepo() { <START> SharedPreferences sharedPref = getSharedPrefs(InstrumentationRegistry.getContext()); <END> User pre = User.builder() .name(UUID.randomUUID().toString()) .id(UUID.randomUUID().toString()) .email(UUID.randomUUID().toString()) .build(); User.Repo repo = new User.Repo(sharedPref); repo.set(pre); User post = repo.get(); assertThat(post, is(not(nullValue()))); assertThat(post.getId(), is(pre.getId())); assertThat(post.getEmail(), is(pre.getEmail())); assertThat(post.getName(), is(pre.getName())); repo.set(null); assertThat(repo.get(), is(nullValue())); }</code><technical_language>worth sharedPref.edit().clear().commit() here</technical_language>

Target:
public void testRepo() { SharedPreferences sharedPref = getSharedPrefs(InstrumentationRegistry.getContext()); sharedPref.edit().clear().apply(); User pre = new User.Builder() .name(UUID.randomUUID().toString()) .id(UUID.randomUUID().toString()) .email(UUID.randomUUID().toString()) .build(); User.Repo repo = new User.Repo(sharedPref); assertThat(repo.get(),is(nullValue())); repo.set(pre); User post = repo.get(); assertThat(post, is(not(nullValue()))); assertThat(post.getId(), is(pre.getId())); assertThat(post.getEmail(), is(pre.getEmail())); assertThat(post.getName(), is(pre.getName())); repo.set(null); assertThat(repo.get(), is(nullValue())); }
Source:
<code>protected void encryptData(Property property, boolean encrypt) { if (property.getStoredValue() == null) { return; } String oldValue = String.valueOf(property.getStoredValue()); <START> if (encrypt) { property.setStoredValue(ComponentEncryption.encrypt(oldValue)); } else { if (ComponentEncryption.isEncrypted(oldValue)) { property.setStoredValue(ComponentEncryption.decrypt(oldValue)); return; } super.encryptData(property, encrypt); } <END> }</code><technical_language>I rewrite this a return statement, e.g.: if (encrypt) { ... } else if (ComponentEncryption.isEncrypted(oldValue)) { ... } else { // fallback.... }</technical_language>

Target:
protected void encryptData(Property property, boolean encrypt) { if (property.getStoredValue() == null) { return; } String storedValue = String.valueOf(property.getStoredValue()); if (encrypt) { property.setStoredValue(ComponentEncryption.encrypt(storedValue)); } else { if (ComponentEncryption.isEncrypted(storedValue)) { property.setStoredValue(ComponentEncryption.decrypt(storedValue)); } else { super.encryptData(property, encrypt); } } }
Source:
<code>protected Events executeStateAction(final ExecutionContext executionContext) { log.info("Shutting down..."); try { log.info("Attempting to archive job folder..."); final String archiveLocationURIString = jobRequestArguments.getArchiveLocation(); <START> if (!TextUtils.isBlank(archiveLocationURIString)) { <END> archivalService.archive( executionContext.getJobDirectory(), new URI(archiveLocationURIString) ); } else { log.info("Archiving of job folder cannot be done to a empty location"); } log.info("Job folder archived to: " + archiveLocationURIString); } catch (ArchivalException | URISyntaxException e) { log.error("Error archiving job folder", e); } return Events.SHUTDOWN_COMPLETE; }</code><technical_language>StringUtils.isBlank in rest of codebase</technical_language>

Target:
protected Events executeStateAction(final ExecutionContext executionContext) { log.info("Shutting down..."); try { final JobSpecification jobSpecification = executionContext.getJobSpecification(); final String archiveLocation = jobSpecification.getArchiveLocation().orElse(null); if (StringUtils.isNotBlank(archiveLocation)) { log.info("Attempting to archive job folder to: " + archiveLocation); archivalService.archive( executionContext.getJobDirectory().toPath(), new URI(archiveLocation) ); } else { log.info("Job folder archival location is empty. Skipping archiving the job folder."); } log.info("Job folder archived to: " + archiveLocation); } catch (ArchivalException | URISyntaxException e) { log.error("Error archiving job folder", e); } return Events.SHUTDOWN_COMPLETE; }
Source:
<code>public void testAddProvidedStorage() throws Exception { BlockInfo blockInfo = new BlockInfoContiguous((short) 3); DatanodeStorageInfo storage = mock(DatanodeStorageInfo.class); when(storage.getStorageType()).thenReturn(StorageType.PROVIDED); boolean added = blockInfo.addStorage(storage, blockInfo); Assert.assertTrue(added); Assert.assertEquals(storage, blockInfo.getStorageInfo(0)); Assert.assertTrue(blockInfo.isProvided()); <START> <END> blockInfo = new BlockInfoContiguous((short) 3); storage = mock(DatanodeStorageInfo.class); when(storage.getStorageType()).thenReturn(StorageType.DISK); added = blockInfo.addStorage(storage, blockInfo); Assert.assertTrue(added); Assert.assertEquals(storage, blockInfo.getStorageInfo(0)); Assert.assertFalse(blockInfo.isProvided()); }</code><technical_language>splitting this test a name describes testing in each? Another option a blockInfo for chunk</technical_language>

Target:
public void testAddProvidedStorage() throws Exception { BlockInfo blockInfo = new BlockInfoContiguous((short) 3); DatanodeStorageInfo providedStorage = mock(DatanodeStorageInfo.class); when(providedStorage.getStorageType()).thenReturn(StorageType.PROVIDED); boolean added = blockInfo.addStorage(providedStorage, blockInfo); Assert.assertTrue(added); Assert.assertEquals(providedStorage, blockInfo.getStorageInfo(0)); Assert.assertTrue(blockInfo.isProvided()); }
Source:
<code>public boolean doesDataExist(ItemStack itemStack) { <START> return true; <END> }</code><technical_language>Do _all_ itemstacks some form of durability</technical_language>

Target:
public boolean doesDataExist(ItemStack itemStack) { return itemStack.getItem().isDamageable(); }
Source:
<code>public DynamicTabAdapter(Tab tab, Context context) { this.lInflater = LayoutInflater.from(context); this.context = context; this.id_layout = R.layout.form_without_score; this.navigationController = initNavigationController(tab); this.readOnly = Session.getSurvey() != null && !Session.getSurvey().isInProgress(); this.isSwipeAdded=false; if(!readOnly){ Question question=navigationController.getCurrentQuestion(); <START> Value value = question.getValueBySession(); <END> if(value!=null) { comeFromReview(); } } int totalPages=navigationController.getCurrentQuestion().getTotalQuestions(); if(readOnly){ if(Session.getSurvey()!=null){ Question lastQuestion=Session.getSurvey().findLastSavedQuestion(); if(lastQuestion!=null){ totalPages=lastQuestion.getTotalQuestions(); } } } navigationController.setTotalPages(totalPages); isClicked=false; }</code><technical_language>@idelcano minor is need assign question.getValueBySession() value. do if (question.getValueBySession()!=null)</technical_language>

Target:
public DynamicTabAdapter(Tab tab, Context context) { this.lInflater = LayoutInflater.from(context); this.context = context; this.id_layout = R.layout.form_without_score; this.navigationController = initNavigationController(tab); this.readOnly = Session.getSurvey() != null && !Session.getSurvey().isInProgress(); this.isSwipeAdded=false; if(!readOnly){ Question question=navigationController.getCurrentQuestion(); if(question.getValueBySession()!=null) { goToLastQuestion(); } } int totalPages=navigationController.getCurrentQuestion().getTotalQuestions(); if(readOnly){ if(Session.getSurvey()!=null){ Question lastQuestion=Session.getSurvey().findLastSavedQuestion(); if(lastQuestion!=null){ totalPages=lastQuestion.getTotalQuestions(); } } } navigationController.setTotalPages(totalPages); isClicked=false; }
Source:
<code>public void init() { final InstanceInfo self = instanceInfoProvider.get(); discoveryClientProvider.get().registerRefreshCallback(new RefreshCallback() { @Override public void postRefresh(DiscoveryClient discoveryClient) { for (Application app : discoveryClient.getApplications().getRegisteredApplications()) { <START> InstanceInfo remoteSelf = app.getByInstanceId(self.getId()); <END> if (remoteSelf != null) { setIsUp(remoteSelf.getStatus().equals(InstanceStatus.UP)); return; } } setIsUp(false); } private void setIsUp(boolean isUp) { if (upStatus.compareAndSet(!isUp, isUp)) { LOG.info("Discovery upStatus change to " + isUp); subject.onNext(isUp); } } }); }</code><technical_language>assumption is multiple applications instance id. DiscoveryClient.getInstanceById() returning a list of instances for id. want find out why</technical_language>

Target:
public void init() { try { eventBus.registerSubscriber(this); currentStatus.compareAndSet(InstanceInfo.InstanceStatus.UNKNOWN, client.getInstanceRemoteStatus()); } catch (InvalidSubscriberException e) { LOG.error("Error registring for discovery status change events.", e); } }