auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>Builder memoryPolicy(@NonNull MemoryPolicy policy, @NonNull MemoryPolicy... additional) { if (policy == null) { throw new IllegalArgumentException("Memory policy cannot be null."); } this.memoryPolicy |= policy.index; if (additional == null) { throw new IllegalArgumentException("Memory policy cannot be null."); } <START> if (additional.length > 0) { <END> for (MemoryPolicy memoryPolicy : additional) { if (memoryPolicy == null) { throw new IllegalArgumentException("Memory policy cannot be null."); } this.memoryPolicy |= memoryPolicy.index; } } return this; }</code><technical_language>nit: this if check is necessary</technical_language>

Target:
Builder memoryPolicy(@NonNull MemoryPolicy policy, @NonNull MemoryPolicy... additional) { if (policy == null) { throw new NullPointerException("policy == null"); } if (additional == null) { throw new NullPointerException("additional == null"); } this.memoryPolicy |= policy.index; for (MemoryPolicy memoryPolicy : additional) { if (memoryPolicy == null) { throw new NullPointerException("memoryPolicy == null"); } this.memoryPolicy |= memoryPolicy.index; } return this; }
Source:
<code>protected void determineDebuggerPath(IDMContext dmc, String hostPath, final DataRequestMonitor<String> rm) { final IBreakpoints breakpoints = getServicesTracker().getService(IBreakpoints.class); <START> if (!(breakpoints instanceof MIBreakpoints)) { <END> rm.done(hostPath); return; } ISourceLookup sourceLookup = getServicesTracker().getService(ISourceLookup.class); ISourceLookupDMContext srcDmc = DMContexts.getAncestorOfType(dmc, ISourceLookupDMContext.class); if (sourceLookup == null || srcDmc == null) { rm.done(((MIBreakpoints)breakpoints).adjustDebuggerPath(hostPath)); return; } sourceLookup.getDebuggerPath(srcDmc, hostPath, new DataRequestMonitor<String>(getExecutor(), rm) { @Override protected void handleSuccess() { rm.done(((MIBreakpoints)breakpoints).adjustDebuggerPath(getData())); } }); }</code><technical_language>IMIBreakpointPathAdjuster instead of MIBreakpoints</technical_language>

Target:
protected void determineDebuggerPath(IDMContext dmc, String hostPath, final DataRequestMonitor<String> rm) { final IBreakpoints breakpoints = getServicesTracker().getService(IBreakpoints.class); if (!(breakpoints instanceof IMIBreakpointPathAdjuster)) { rm.done(hostPath); return; } ISourceLookup sourceLookup = getServicesTracker().getService(ISourceLookup.class); ISourceLookupDMContext srcDmc = DMContexts.getAncestorOfType(dmc, ISourceLookupDMContext.class); if (sourceLookup == null || srcDmc == null) { rm.done(((IMIBreakpointPathAdjuster)breakpoints).adjustDebuggerPath(hostPath)); return; } sourceLookup.getDebuggerPath(srcDmc, hostPath, new DataRequestMonitor<String>(getExecutor(), rm) { @Override protected void handleSuccess() { rm.done(((IMIBreakpointPathAdjuster)breakpoints).adjustDebuggerPath(getData())); } }); }
Source:
<code><START> private AsyncCompletionWaitor removeBreakpoint(final IBreakpointDMContext breakpoint) throws InterruptedException <END> { final AsyncCompletionWaitor waitor = new AsyncCompletionWaitor(); final RequestMonitor rm = new RequestMonitor(fBreakpointService.getExecutor(), null) { @Override protected void handleCompleted() { waitor.waitFinished(getStatus()); } }; fBreakpointService.getExecutor().submit(new Runnable() { @Override public void run() { fBreakpointService.removeBreakpoint(breakpoint, rm); } }); waitor.waitUntilDone(TestsPlugin.massageTimeout(2000)); return waitor; }</code><technical_language>a query instead</technical_language>

Target:
private void removeBreakpoint(final IBreakpointDMContext breakpoint) throws InterruptedException, ExecutionException { Query<Void> query = new Query<Void>() { @Override protected void execute(DataRequestMonitor<Void> rm) { fBreakpointService.removeBreakpoint(breakpoint, rm); } }; fBreakpointService.getExecutor().submit(query); query.get(); }
Source:
<code>private void updateRowBuffer(boolean isInsert) throws SQLException { for (Map.Entry<String, Object> entry : updateValues.entrySet()) { int columnIndex = findColumn(entry.getKey()) - 1; Object valueObject = entry.getValue(); setRowBufferColumn(columnIndex, valueObject); } if (isInsert) { <START> final ResultSet generatedKeys = insertStatement.getGeneratedKeys(); <END> generatedKeys.next(); int numKeys = primaryKeys.size(); for (int i = 0; i < numKeys; i++) { final PrimaryKey key = primaryKeys.get(i); int columnIndex = key.index - 1; Object valueObject = generatedKeys.getObject(key.name); setRowBufferColumn(columnIndex, valueObject); } } }</code><technical_language>closed #close()</technical_language>

Target:
private void updateRowBuffer(boolean isInsert) throws SQLException { for (Map.Entry<String, Object> entry : updateValues.entrySet()) { int columnIndex = findColumn(entry.getKey()) - 1; Object valueObject = entry.getValue(); setRowBufferColumn(columnIndex, valueObject); } if (isInsert) { final ResultSet generatedKeys = insertStatement.getGeneratedKeys(); try { generatedKeys.next(); int numKeys = primaryKeys.size(); for (int i = 0; i < numKeys; i++) { final PrimaryKey key = primaryKeys.get(i); int columnIndex = key.index - 1; Object valueObject = generatedKeys.getObject(key.name); setRowBufferColumn(columnIndex, valueObject); } } finally { generatedKeys.close(); } } }
Source:
<code>private boolean validateGroupNameChange(VDSGroup oldGroup) { VDSGroup vdsGroup = getVdsGroup(); if (StringHelper.EqOp(oldGroup.getname(), vdsGroup.getname())) { return true; } <START> VdsGroupDAO vdsGroupDAO = DbFacade.getInstance().getVdsGroupDAO(); <END> VDSGroup groupWithName = vdsGroupDAO.getByName(vdsGroup.getname()); if (groupWithName == null) { return true; } if (groupWithName.getId().equals(vdsGroup.getId())) { return true; } addCanDoActionMessage(VdcBllMessages.VDS_GROUP_CANNOT_DO_ACTION_NAME_IN_USE); return false; }</code><technical_language>Saggi, getVdsGropDAO() is implemented in parent class AuditLogableBase, instead set new parameter for vdsGroupDAO</technical_language>

Target:
private boolean validateGroupNameChange(VDSGroup oldGroup) { VDSGroup vdsGroup = getVdsGroup(); if (StringHelper.EqOp(oldGroup.getname(), vdsGroup.getname())) { return true; } VDSGroup groupWithName = getVdsGroupDAO().getByName(vdsGroup.getname()); if (groupWithName == null) { return true; } if (groupWithName.getId().equals(vdsGroup.getId())) { return true; } addCanDoActionMessage(VdcBllMessages.VDS_GROUP_CANNOT_DO_ACTION_NAME_IN_USE); return false; }
Source:
<code>public RelWriter explainTerms(RelWriter pw) { super.explainTerms(pw); pw.item("split", m_splitCount); <START> if (m_limit != null) { <END> pw.item("limit", m_limit); } if (m_offset != null) { pw.item("offset", m_offset); } return pw; }</code><technical_language>itemIf</technical_language>

Target:
public RelWriter explainTerms(RelWriter pw) { super.explainTerms(pw); pw.item("split", m_splitCount); pw.itemIf("limit", m_limit, m_limit != null); pw.itemIf("offset", m_offset, m_offset != null); return pw; }
Source:
<code>public static <K, A> PriorityQueue<K, A> priorityQueue(Equal<K> e, FingerTree<K, P2<K, A>> ft) { <START> return new PriorityQueue<K, A>(e, ft); <END> }</code><technical_language>nitpicking: new PriorityQueue<>(</technical_language>

Target:
public static <K, A> PriorityQueue<K, A> priorityQueue(Equal<K> e, FingerTree<K, P2<K, A>> ft) { return new PriorityQueue<>(e, ft); }
Source:
<code>public boolean canExecute() { if (selection != null && selection.size() > 1) { for (EObject tool : selection) { if (!(tool instanceof AbstractToolDescription)) { return false; } } <START> } <END> return true; }</code><technical_language>boolean canExecute = false; if (selection != null) { canExecute = Iterables.all(selection, Predicates.instanceof( AbstractToolDescription.class)); } return canExcute;</technical_language>

Target:
public boolean canExecute() { boolean canExecute = false; if (selection != null) { canExecute = Iterables.all(selection, Predicates.instanceOf(AbstractToolDescription.class)); } return canExecute; }
Source:
<code>public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String username = request.getParameter("wb-username"); String password = request.getParameter("wb-password"); String remember = request.getParameter("remember-credentials"); ConnectionManager manager = ConnectionManager.getInstance(); if (username != null && password != null) { manager.login(username, password, "on".equals(remember)); } else if ("true".equals(request.getParameter("logout"))) { manager.logout(); } response.setCharacterEncoding("UTF-8"); response.setHeader("Content-Type", "application/json"); StringWriter sb = new StringWriter(2048); JSONWriter writer = new JSONWriter(sb); try { writer.object(); <START> writer.key("logged_in"); <END> writer.value(manager.isLoggedIn()); writer.key("username"); writer.value(manager.getUsername()); writer.endObject(); } catch (JSONException e) { e.printStackTrace(); } respond(response, sb.toString()); }</code><technical_language>respond "logged_in" matter if is login in end</technical_language>

Target:
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String username = request.getParameter("wb-username"); String password = request.getParameter("wb-password"); String remember = request.getParameter("remember-credentials"); ConnectionManager manager = ConnectionManager.getInstance(); if (username != null && password != null) { manager.login(username, password, "on".equals(remember)); } else if ("true".equals(request.getParameter("logout"))) { manager.logout(); } response.setCharacterEncoding("UTF-8"); response.setHeader("Content-Type", "application/json"); StringWriter sb = new StringWriter(2048); JSONWriter writer = new JSONWriter(sb); try { writer.object(); writer.key("logged_in"); writer.value(manager.isLoggedIn()); writer.key("username"); writer.value(manager.getUsername()); writer.endObject(); } catch (JSONException e) { logger.error(e.getMessage()); } respond(response, sb.toString()); }
Source:
<code>public WorkflowResponse execute(WorkflowDTO workflowDTO) throws WorkflowException { if (log.isDebugEnabled()) { log.debug("Executing Application registration Workflow.."); } ApplicationRegistrationWorkflowDTO appRegDTO = (ApplicationRegistrationWorkflowDTO) workflowDTO; Application application = appRegDTO.getApplication(); String callBackURL = appRegDTO.getCallbackUrl(); String applicationCallbackUrl = application.getCallbackUrl(); String applicationDescription = application.getDescription(); String message="Approve request to create "+appRegDTO.getKeyType()+" keys for [ "+application.getName()+ " ] from application creator - "+appRegDTO.getUserName()+" with throttling tier - "+application.getTier() ; workflowDTO.setWorkflowDescription(message); workflowDTO.setMetadata("applicationName", application.getName()); workflowDTO.setMetadata("applicationTier", application.getTier()); workflowDTO.setMetadata("applicationCallbackUrl", applicationCallbackUrl != null ? applicationCallbackUrl : "?"); workflowDTO.setMetadata("applicationDescription", applicationDescription != null ? applicationDescription : "?"); workflowDTO.setMetadata("TenantDomain", appRegDTO.getTenantDomain()); workflowDTO.setMetadata("UserName", appRegDTO.getUserName()); workflowDTO.setMetadata("workflowExternalRef", appRegDTO.getExternalWorkflowReference()); workflowDTO.setMetadata("callBackURL", callBackURL != null ? callBackURL : "?"); workflowDTO.setMetadata("KeyType", appRegDTO.getKeyType()); workflowDTO.setProperties("Workflow Process","Registration Creation"); <START> <END> super.execute(workflowDTO); return new GeneralWorkflowResponse(); }</code><technical_language>metadata properties needed</technical_language>

Target:
public WorkflowResponse execute(WorkflowDTO workflowDTO) throws WorkflowException { if (log.isDebugEnabled()) { log.debug("Executing Application registration Workflow.."); } ApplicationRegistrationWorkflowDTO appRegDTO = (ApplicationRegistrationWorkflowDTO) workflowDTO; Application application = appRegDTO.getApplication(); String callBackURL = appRegDTO.getCallbackUrl(); String applicationCallbackUrl = application.getCallbackUrl(); String applicationDescription = application.getDescription(); String message = "Approve request to create " + appRegDTO.getKeyType() + " keys for [ " + application.getName() + " ] from application creator - " + appRegDTO.getUserName() + " with throttling tier - " + application.getTier(); workflowDTO.setWorkflowDescription(message); super.execute(workflowDTO); return new GeneralWorkflowResponse(); }
Source:
<code><START> public void removeRelatedAlarm(OnmsAlarm alarm) { <END> Optional<AlarmAssociation> alarmAssociation = m_associatedAlarms.stream().filter(associatedAlarm -> associatedAlarm.getRelatedAlarm().getId().equals(alarm.getId())).findFirst(); if (alarmAssociation.isPresent()) { m_associatedAlarms.remove(alarmAssociation.get()); } }</code><technical_language>Simplify method to: m_associatedAlarms.removeIf(associatedAlarm -> associatedAlarm.getRelatedAlarm().getId().equals(alarm.getId()));</technical_language>

Target:
public void removeRelatedAlarm(OnmsAlarm alarm) { m_associatedAlarms.removeIf(associatedAlarm -> associatedAlarm.getRelatedAlarm().getId().equals(alarm.getId())); }
Source:
<code>void convertWithoutResultEventData() { AttemptAuditEventResult source = makeAttemptAuditEventResult(null); AuditProto.AttemptAuditEventResult target = underTest.convert(source); assertGeneric(target); <START> assertThat(target.getEventTypeCase()).isEqualTo(AuditProto.AttemptAuditEventResult.EventTypeCase.EVENTTYPE_NOT_SET); <END> }</code><technical_language>I miss tests in for refactored converter classes</technical_language>

Target:
void convertWithoutResultEventData() { AttemptAuditEventResult source = makeAttemptAuditEventResult(null); AuditProto.AttemptAuditEventResult target = underTest.convert(source); assertEquals(target, result); verify(mockBuilder, times(1)).build(); verify(builderProvider, times(1)).getNewAttemptAuditEventResultBuilder(); verify(mockAttemptAuditEventResultBuilderUpdater, never()).update(any(), any()); }
Source:
<code><START> public boolean waitInvisibility(By elementLocator, int timeout) { <END> return webDriverWaitFactory.get(timeout).until(invisibilityOfElementLocated(elementLocator)); }</code><technical_language>returning boolean type is useless return **true**, throw timeout exception</technical_language>

Target:
public void waitInvisibility(By elementLocator, int timeout) { webDriverWaitFactory.get(timeout).until(invisibilityOfElementLocated(elementLocator)); }
Source:
<code>public void run() { log.debug("HostProcess.run"); try { hostProcessStartTime = System.currentTimeMillis(); pluginFactory.reset(); synchronized (mapPluginStats) { for (Plugin plugin : pluginFactory.getPending()) { mapPluginStats.put(plugin.getId(), new PluginStats(plugin.getName())); } } for (StructuralNode startNode : startNodes) { traverse( startNode, true, node -> { <START> if (canScanNode(node) && bestNodeForUrl(node)) { <END> messagesIdsToAppScan.add(node.getHistoryReference().getHistoryId()); } }); getAnalyser().start(startNode); } nodeInScopeCount = messagesIdsToAppScan.size(); if (!messagesIdsToAppScan.isEmpty()) { messageIdToHostScan = messagesIdsToAppScan.get(0); } logScanInfo(); Plugin plugin; while (!isStop() && pluginFactory.existPluginToRun()) { checkPause(); if (isStop()) { break; } plugin = pluginFactory.nextPlugin(); if (plugin != null) { plugin.setDelayInMs(this.scannerParam.getDelayInMs()); plugin.setTechSet(this.techSet); processPlugin(plugin); } else { Util.sleep(1000); } } threadPool.waitAllThreadComplete(300000); } catch (Exception e) { log.error("An error occurred while active scanning:", e); stop(); } finally { notifyHostProgress(null); notifyHostComplete(); getHttpSender().shutdown(); } }</code><technical_language>This check work properly for cases, nodes included default (e.g. out of scope, filters, recurse) discard temporary node beforehand. example in issue, nodes scanned if select node "3" disable recurse. safer de-duplicate of them</technical_language>

Target:
public void run() { log.debug("HostProcess.run"); try { hostProcessStartTime = System.currentTimeMillis(); pluginFactory.reset(); synchronized (mapPluginStats) { for (Plugin plugin : pluginFactory.getPending()) { mapPluginStats.put(plugin.getId(), new PluginStats(plugin.getName())); } } for (StructuralNode startNode : startNodes) { Map<String, Integer> historyIdsToAdd = new LinkedHashMap<>(); traverse( startNode, true, node -> { if (canScanNode(node)) { int nodeHistoryId = node.getHistoryReference().getHistoryId(); if (node.getMethod().equals(HttpRequestHeader.GET)) { boolean nodeSeen = historyIdsToAdd.containsKey(nodeHash(node)); if (!nodeSeen || !isTemporary(node)) { historyIdsToAdd.put(nodeHash(node), nodeHistoryId); } } else { messagesIdsToAppScan.add(nodeHistoryId); } } }); messagesIdsToAppScan.addAll(historyIdsToAdd.values()); getAnalyser().start(startNode); } nodeInScopeCount = messagesIdsToAppScan.size(); if (!messagesIdsToAppScan.isEmpty()) { messageIdToHostScan = messagesIdsToAppScan.get(0); } logScanInfo(); Plugin plugin; while (!isStop() && pluginFactory.existPluginToRun()) { checkPause(); if (isStop()) { break; } plugin = pluginFactory.nextPlugin(); if (plugin != null) { plugin.setDelayInMs(this.scannerParam.getDelayInMs()); plugin.setTechSet(this.techSet); processPlugin(plugin); } else { Util.sleep(1000); } } threadPool.waitAllThreadComplete(300000); } catch (Exception e) { log.error("An error occurred while active scanning:", e); stop(); } finally { notifyHostProgress(null); notifyHostComplete(); getHttpSender().shutdown(); } }
Source:
<code>public String sanitizePath(@Nullable String path) { path = Strings.trim(path); if (Strings.isEmpty(path)) { return ""; } if (path.contains("\\")) { <START> path = path.replace("\\", "/"); <END> } if (path.contains(" path = path.replaceAll("/+", "/"); } if (path.startsWith("/")) { path = path.substring(1); } if (path.endsWith("/")) { path = path.substring(0, path.length() - 1); } return path; }</code><technical_language>ReplaceAll</technical_language>

Target:
public String sanitizePath(@Nullable String path) { path = Strings.trim(path); if (Strings.isEmpty(path)) { return ""; } path = SANITIZE_SLASHES.matcher(path).replaceAll("/"); if (path.startsWith("/")) { path = path.substring(1); } if (path.endsWith("/")) { path = path.substring(0, path.length() - 1); } return path; }
Source:
<code>private void doVisitToken(FullIdent ident, boolean isStatic, boolean previous) { final String name = ident.getText(); final int groupIdx = getGroupNumber(name); final int line = ident.getLineNo(); if (groupIdx == lastGroup || !beforeFirstImport && isAlphabeticallySortableStaticImport(isStatic)) { doVisitTokenInSameGroup(isStatic, previous, name, line); } else if (groupIdx > lastGroup) { if (!beforeFirstImport && separated && line - lastImportLine < 2) { log(line, MSG_SEPARATION, name); } } else { log(line, MSG_ORDERING, name); } <START> checkRedundantSeparation(groupIdx, isStatic, line, name); <END> lastGroup = groupIdx; lastImport = name; }</code><technical_language>checkSeparatorInGroup</technical_language>

Target:
private void doVisitToken(FullIdent ident, boolean isStatic, boolean previous) { final String name = ident.getText(); final int groupIdx = getGroupNumber(name); final int line = ident.getLineNo(); if (groupIdx == lastGroup || !beforeFirstImport && isAlphabeticallySortableStaticImport(isStatic)) { doVisitTokenInSameGroup(isStatic, previous, name, line); } else if (groupIdx > lastGroup) { if (!beforeFirstImport && separated && line - lastImportLine < 2) { log(line, MSG_SEPARATION, name); } } else { log(line, MSG_ORDERING, name); } if (checkSeparatorInGroup(groupIdx, isStatic, line)) { log(line, MSG_SEPARATED_IN_GROUP, name); } lastGroup = groupIdx; lastImport = name; }
Source:
<code>protected void executeCommand() { <START> ThreadPoolUtil.execute(new Runnable() { <END> @Override public void run() { setVdsStatus(VDSStatus.Installing); try (final VdsDeploy vdsDeploy = new VdsDeploy("ovirt-host-mgmt", getVds(), false)) { vdsDeploy.addUnit( new VdsDeployPKIUnit(), new VdsDeployVmconsoleUnit(true) ); String correlationId = CorrelationIdTracker.getCorrelationId(); if (StringUtils.isEmpty(correlationId)) { correlationId = LoggedUtils.getObjectId(getVds()); } vdsDeploy.setCorrelationId(correlationId); vdsDeploy.useDefaultKeyPair(); vdsDeploy.execute(); logEvent(AuditLogType.HOST_CERTIFICATION_ENROLLMENT); } catch (final Exception e) { log.error("Failed to enroll certificate for host '{}': {}", getVds().getName(), e.getMessage()); log.error("Exception", e); logEvent(AuditLogType.HOST_CERTIFICATION_ENROLLMENT_FAILED); } finally { setVdsStatus(VDSStatus.Maintenance); } } private void logEvent(AuditLogType eventType) { AuditLogableBase event = new AuditLogableBase(); event.setVds(getVds()); event.setUserName(getUserName()); auditLogDirector.log(event, eventType); } }); setSucceeded(true); }</code><technical_language>I familiar agent design, this async task instead of plain thread</technical_language>

Target:
protected void executeCommand() { CommandCoordinatorUtil.executeAsyncCommand(VdcActionType.HostEnrollCertificateInternal, getParameters(), cloneContextAndDetachFromParent()); setSucceeded(true); }
Source:
<code>private byte[] stringToByte(String mediaId) { if (!mHmap.containsValue(mediaId)) { <START> int key = <END> mHmap.size() + 1; mHmap.put(key, mediaId); return intToByteArray(key); } else { for (int key : mHmap.keySet()) { if (mHmap.get(key).equals(mediaId)) { return intToByteArray(key); } } } return null; }</code><technical_language>rename uid this code clearer</technical_language>

Target:
private byte[] stringToByte(String mediaId) { if (!mHmap.containsValue(mediaId)) { int uid = mHmap.size(); mHmap.put(uid, mediaId); return intToByteArray(uid); } else { for (int uid : mHmap.keySet()) { if (mHmap.get(uid).equals(mediaId)) { return intToByteArray(uid); } } } return null; }
Source:
<code><START> public void testEncodeIllegalCharacters() throws WriterException { <END> int illegalArgument = 0; try { BitMatrix result = new EAN8Writer().encode("96385abc", BarcodeFormat.EAN_8, 0, 0); } catch (IllegalArgumentException e) { illegalArgument = 1; } assertEquals(illegalArgument, 1); }</code><technical_language>able write @Test(expected = WriterException.class) body of test is line exception</technical_language>

Target:
public void testEncodeIllegalCharacters() throws WriterException { new EAN8Writer().encode("96385abc", BarcodeFormat.EAN_8, 0, 0); }
Source:
<code>private File createTemporaryCopyOf(File file) throws IOException { File tempFolder = Files.createTempDir(); FileUtils.copyDirectory(file, tempFolder); return tempFolder; <START> } <END></code><technical_language>a list of directories delete in a @TearDown method. Currently this leaves junk in /tmp</technical_language>

Target:
private File createTemporaryCopyOf(File file) throws IOException { File tempFolder = Files.createTempDir(); FileUtils.copyDirectory(file, tempFolder); tempFolder.deleteOnExit(); return tempFolder; }
Source:
<code>public WebSocketClientWrapper(final URI uri, final Proxy proxy, final WebSocketListener webSocketListener) throws SSLException { super(uri); if (uri.getScheme().equals(WSS_SCHEME)) { try { SSLContext sslContext = null; sslContext = SSLContext.getInstance("TLS"); sslContext.init(null, null, null); final SSLSocketFactory factory = sslContext.getSocketFactory(); setSocket(factory.createSocket()); } catch (final IOException e) { throw new SSLException(e); } catch (final NoSuchAlgorithmException e) { throw new SSLException(e); } catch (final KeyManagementException e) { throw new SSLException(e); } } this.webSocketListener = webSocketListener; <START> if (proxy != null){ <END> this.setProxy(proxy); } }</code><technical_language>Space ) { please. consider defaulting PusherOptions.proxy java.net.Proxy.NOPROXY null removing this conditional</technical_language>

Target:
public WebSocketClientWrapper(final URI uri, final Proxy proxy, final WebSocketListener webSocketListener) throws SSLException { super(uri); if (uri.getScheme().equals(WSS_SCHEME)) { try { SSLContext sslContext = null; sslContext = SSLContext.getInstance("TLS"); sslContext.init(null, null, null); final SSLSocketFactory factory = sslContext.getSocketFactory(); setSocket(factory.createSocket()); } catch (final IOException e) { throw new SSLException(e); } catch (final NoSuchAlgorithmException e) { throw new SSLException(e); } catch (final KeyManagementException e) { throw new SSLException(e); } } this.webSocketListener = webSocketListener; setProxy(proxy); }
Source:
<code>public synchronized boolean recover(TaskId taskId) { <START> checkState(groupedLifespanScheduler.isPresent(), "Non grouped execution is not recoverable"); <END> if (anySourceSchedulingFinished) { throw new UnsupportedOperationException("Recover after any source scheduling finished is not supported"); } return groupedLifespanScheduler.get().retryFailedTask(taskId.getId(), sourceSchedulers); }</code><technical_language>i understand error message</technical_language>

Target:
public synchronized void recover(TaskId taskId) { checkState(groupedLifespanScheduler.isPresent(), "groupedLifespanScheduler is not present for recoverable grouped execution"); if (anySourceSchedulingFinished) { throw new IllegalStateException("Recover after any source scheduling finished is not supported"); } groupedLifespanScheduler.get().onTaskFailed(taskId.getId(), sourceSchedulers); }
Source:
<code>protected Iterator<ServiceRecord> getServiceRecords(MarketoService marketoService, PluginTask task) { List<String> extractedFields = task.getExtractedFields(); Iterable<ObjectNode> requestLists; if (isUserInputLists(task)) { <START> final String[] idsStr = StringUtils.split(task.getListIds().get(), ID_LIST_SEPARATOR_CHAR); <END> Function<Set<String>, Iterable<ObjectNode>> getListIds = (ids) -> marketoService.getListsByIds(ids); requestLists = super.getObjectsByIds(idsStr, task.getSkipInvalidList(), getListIds); } else { requestLists = marketoService.getLists(); } extractedFields.remove(MarketoUtils.LIST_ID_COLUMN_NAME); return FluentIterable.from(marketoService.getAllListLead(extractedFields, requestLists)).transform(MarketoUtils.TRANSFORM_OBJECT_TO_JACKSON_SERVICE_RECORD_FUNCTION).iterator(); }</code><technical_language>this list space, i validate it. For exam: " , , , , "</technical_language>

Target:
protected Iterator<ServiceRecord> getServiceRecords(MarketoService marketoService, PluginTask task) { List<String> extractedFields = task.getExtractedFields(); Iterable<ObjectNode> listsToRequest; if (isUserInputLists(task)) { final String[] idsStr = StringUtils.split(task.getListIds().get(), ID_LIST_SEPARATOR_CHAR); Function<Set<String>, Iterable<ObjectNode>> getListIds = (ids) -> marketoService.getListsByIds(ids); listsToRequest = super.getObjectsByIds(idsStr, getListIds); } else { listsToRequest = marketoService.getLists(); } extractedFields.remove(MarketoUtils.LIST_ID_COLUMN_NAME); return FluentIterable.from(marketoService.getAllListLead(extractedFields, listsToRequest)).transform(MarketoUtils.TRANSFORM_OBJECT_TO_JACKSON_SERVICE_RECORD_FUNCTION).iterator(); }
Source:
<code><START> public boolean isWms() { <END> return (this.getService().equalsIgnoreCase(OgcNaming.SERVICE_WMS)) ? true : false; }</code><technical_language>Pleasse add checks null in other methods</technical_language>

Target:
public boolean isWms() { return this.getService() != null && this.getService().equalsIgnoreCase(OgcNaming.SERVICE_WMS); }
Source:
<code>public void checkpointAndTrimStandby() { String metadataTableName = LogReplicationMetadataManager.TABLE_PREFIX_NAME + DefaultClusterManager.DEFAULT_STANDBY_CLUSTER_NAME; CorfuTable<LogReplicationMetadata.LogReplicationMetadataKey, LogReplicationMetadata.LogReplicationMetadataVal> metadataTableStandby = standbyRuntime.getObjectsView().build() .setTypeToken(new TypeToken<CorfuTable<LogReplicationMetadata.LogReplicationMetadataKey, LogReplicationMetadata.LogReplicationMetadataVal>>() { }) .setStreamName(TableRegistry.getFullyQualifiedTableName(LogReplicationMetadataManager.NAMESPACE, metadataTableName)) .open(); List<CorfuTable> toCheckpoint = new ArrayList<>(); toCheckpoint.add(mapAStandby); toCheckpoint.add(metadataTableStandby); System.out.println("**** Checkpoint and trim ... on standby"); CorfuRuntime standbyCPRuntime = new CorfuRuntime(standbyEndpoint).connect(); checkpoint(standbyCPRuntime, toCheckpoint); <START> } <END></code><technical_language>shouldnt do for streamNames table</technical_language>

Target:
public void checkpointAndTrimStandby() { String metadataTableName = LogReplicationMetadataManager.TABLE_PREFIX_NAME + DefaultClusterManager.DEFAULT_STANDBY_CLUSTER_NAME; CorfuTable<LogReplicationMetadata.LogReplicationMetadataKey, LogReplicationMetadata.LogReplicationMetadataVal> metadataTableStandby = standbyRuntime.getObjectsView().build() .setTypeToken(new TypeToken<CorfuTable<LogReplicationMetadata.LogReplicationMetadataKey, LogReplicationMetadata.LogReplicationMetadataVal>>() { }) .setStreamName(TableRegistry.getFullyQualifiedTableName(LogReplicationMetadataManager.NAMESPACE, metadataTableName)) .open(); List<CorfuTable> toCheckpoint = new ArrayList<>(); toCheckpoint.add(mapAStandby); toCheckpoint.add(metadataTableStandby); System.out.println("**** Checkpoint and trim ... on standby"); CorfuRuntime standbyCPRuntime = new CorfuRuntime(standbyEndpoint).connect(); checkpointAndTrim(standbyCPRuntime, toCheckpoint); }
Source:
<code>if (System.getProperty("opensim.port") != null) { int port = Integer.parseInt(System.getProperty("opensim.port")); if (port > 80 && port < 9000) { <START> SERVER_PORT = port; <END> } }</code><technical_language>Consider emitting a warning if port is range</technical_language>

Target:
if (System.getProperty("opensim.port") != null) { int port = Integer.parseInt(System.getProperty("opensim.port")); if (port > 80 && port < 9000) { SERVER_PORT = port; } else System.out.println("Port number outside range (80 , 9000): port 8002 will be used"); }
Source:
<code>public SetSesssionSoftLimitCommandParameters() { <START> super(); <END> }</code><technical_language>needed, empty c'tor is for satisfying gwt. modifier reduced</technical_language>

Target:
SetSesssionSoftLimitCommandParameters() { super(); }
Source:
<code><START> private EngineLock createLockForRunVmCommand(Guid vmId) { <END> return new EngineLock( Collections.singletonMap( vmId.toString(), LockMessagesMatchUtil.makeLockingPair( LockingGroup.VM, VdcBllMessages.ACTION_TYPE_FAILED_OBJECT_LOCKED.name())), null); }</code><technical_language>please extract lock logic some shard place in run vm command, if change this sync'd</technical_language>

Target:
private EngineLock createLockForRunVmCommand(Guid vmId) { return new RunVmCommandBase.RunVmLock(vmId); }
Source:
<code>private void removeDocker() throws Exception{ if (docker != null) { docker.killContainer(widlflyContId); docker.removeContainer(widlflyContId); <START> <END> docker.close(); } }</code><technical_language>I guess pulled image is left machine intentionally, right</technical_language>

Target:
private void removeDocker() throws Exception{ if (docker != null) { docker.killContainer(widlflyContId); docker.removeContainer(widlflyContId); docker.removeImage(config.imageName()); docker.close(); } }
Source:
<code>public StopVmCommandBase(T parameters) { super(parameters); <START> setStoragePoolId(getVm().getstorage_pool_id()); <END> }</code><technical_language>A DB call constuctor - a good practice</technical_language>

Target:
public StopVmCommandBase(T parameters) { super(parameters); }
Source:
<code>public JavaSymbolicKRun(Context context) throws KRunExecutionException { definition = (Definition) BinaryLoader.load( new File(context.kompiled, JavaSymbolicBackend.DEFINITION_FILENAME).toString()); if (definition == null) { throw new KRunExecutionException("cannot load definition"); } <START> builtins = new BuiltinFunction(definition); <END> this.context = definition.context(); this.context.kompiled = context.kompiled; this.context.globalOptions = context.globalOptions; transformer = new KILtoBackendJavaKILTransformer(this.context); }</code><technical_language>calling this constructor in a couple places. Is necessary construct more BuiltinFunction object definition</technical_language>

Target:
public JavaSymbolicKRun(Context context) throws KRunExecutionException { definition = (Definition) BinaryLoader.load( new File(context.kompiled, JavaSymbolicBackend.DEFINITION_FILENAME).toString()); if (definition == null) { throw new KRunExecutionException("cannot load definition"); } this.context = definition.context(); this.context.kompiled = context.kompiled; this.context.globalOptions = context.globalOptions; transformer = new KILtoBackendJavaKILTransformer(this.context); }
Source:
<code>public void testInvalidTopologyId() { TriangleOrderManager triangleOrderManager = new TriangleOrderManager(); triangleOrderManager.updateCacheTopology(mockCacheTopology(1)); try { triangleOrderManager.next(0, 0); fail("Exception expected!"); } catch (OutdatedTopologyException e) { <START> log.debug("exception", e); <END> } try { triangleOrderManager.next(1, 2); fail("Exception expected!"); } catch (OutdatedTopologyException e) { log.debug("exception", e); } try { triangleOrderManager.next(newSegmentMap(), 0); fail("Exception expected!"); } catch (OutdatedTopologyException e) { log.debug("exception", e); } try { triangleOrderManager.next(newSegmentMap(), 2); fail("Exception expected!"); } catch (OutdatedTopologyException e) { log.debug("exception", e); } }</code><technical_language>I suggest Exceptions.expectException()</technical_language>

Target:
public void testInvalidTopologyId() { TriangleOrderManager triangleOrderManager = new TriangleOrderManager(4); triangleOrderManager.updateCacheTopology(mockCacheTopology(1)); try { triangleOrderManager.next(0, 0); fail("Exception expected!"); } catch (OutdatedTopologyException e) { Exceptions.assertException(OutdatedTopologyException.class, e); } try { triangleOrderManager.next(1, 2); fail("Exception expected!"); } catch (OutdatedTopologyException e) { Exceptions.assertException(OutdatedTopologyException.class, e); } try { triangleOrderManager.next(newSegmentMap(), 0); fail("Exception expected!"); } catch (OutdatedTopologyException e) { Exceptions.assertException(OutdatedTopologyException.class, e); } try { triangleOrderManager.next(newSegmentMap(), 2); fail("Exception expected!"); } catch (OutdatedTopologyException e) { Exceptions.assertException(OutdatedTopologyException.class, e); } }
Source:
<code>public Put getNextDataRowState(ImmutableBytesPtr rowKeyPtr) { Pair<Put, Put> rowState = dataRowStates.get(rowKeyPtr); if (rowState != null) { <START> return dataRowStates.get(rowKeyPtr).getSecond(); <END> } return null; }</code><technical_language>nit: rowState.getSecond(). need pull out of hashmap a time</technical_language>

Target:
public Put getNextDataRowState(ImmutableBytesPtr rowKeyPtr) { Pair<Put, Put> rowState = dataRowStates.get(rowKeyPtr); if (rowState != null) { return rowState.getSecond(); } return null; }
Source:
<code>public static IType unmarshal(short firstBytes, ITypeMarshalBuffer buffer) throws CoreException { <START> final short SECOND_LAST_FLAG= ITypeMarshalBuffer.LAST_FLAG / 2; <END> final boolean haveModifiers= (firstBytes & ITypeMarshalBuffer.LAST_FLAG) != 0; final boolean haveAssociatedNumericalValue= (firstBytes & SECOND_LAST_FLAG) != 0; int modifiers= 0; int kind= (firstBytes & (SECOND_LAST_FLAG - 1)) / ITypeMarshalBuffer.FIRST_FLAG; if (haveModifiers) modifiers= buffer.getByte(); CPPBasicType result = new CPPBasicType(Kind.values()[kind], modifiers); if (haveAssociatedNumericalValue) result.setAssociatedNumericalValue(buffer.getLong()); return result; }</code><technical_language>is bit left FLAG7 LAST_FLAG. sense define ITypeMarshalBuffer.FLAG8 instead of SECOND_LAST_FLAG</technical_language>

Target:
public static IType unmarshal(short firstBytes, ITypeMarshalBuffer buffer) throws CoreException { final boolean haveModifiers= (firstBytes & ITypeMarshalBuffer.LAST_FLAG) != 0; final boolean haveAssociatedNumericalValue= (firstBytes & ITypeMarshalBuffer.SECOND_LAST_FLAG) != 0; int modifiers= 0; int kind= (firstBytes & (ITypeMarshalBuffer.SECOND_LAST_FLAG - 1)) / ITypeMarshalBuffer.FIRST_FLAG; if (haveModifiers) modifiers= buffer.getByte(); CPPBasicType result = new CPPBasicType(Kind.values()[kind], modifiers); if (haveAssociatedNumericalValue) result.setAssociatedNumericalValue(buffer.getLong()); return result; }
Source:
<code>public void testFnCalendarOperation() throws OperationException { try (OperationContext ctx = new OperationContext(session)) { ctx.setInput(new Date()); Object result = automationService.run(ctx, "Scripting.TestFnCalendar"); <START> assertTrue(result instanceof DateWrapper); <END> } }</code><technical_language>do asserting date too</technical_language>

Target:
public void testFnCalendarOperation() throws OperationException { try (OperationContext ctx = new OperationContext(session)) { Date now = new Date(); ctx.setInput(now); DateWrapper result = (DateWrapper) automationService.run(ctx, "Scripting.TestFnCalendar"); assertEquals(now, result.getDate()); } }
Source:
<code>public void testFailingPreRebaseHookBlocksRebase() throws Exception { assumeSupportedPlatform(); Hook h = Hook.PRE_REBASE; writeHookFile(h.getName(), "#!/bin/sh\necho \"test\"\n\necho 1>&2 \"stderr\"\nexit 1"); Git git = Git.wrap(db); RevCommit first = git.commit().setMessage("initial commit").call(); createBranch(first, "refs/heads/branch1"); git.commit().setMessage("second commit").call(); checkoutBranch("refs/heads/branch1"); ByteArrayOutputStream out = new ByteArrayOutputStream(); try { git.rebase().setUpstream("refs/heads/master") .setHookOutputStream(new PrintStream(out)).call(); fail("expected pre-rebase hook to abort commit"); } catch (RejectRebaseException e) { assertEquals("unexpected error message from pre-rebase hook", "Rebase rejected by \"pre-rebase\" hook.\nstderr\n", e.getMessage()); assertEquals("unexpected output from pre-rebase hook", "test\n", out.toString()); } catch (Throwable e) { <START> fail("unexpected exception thrown by pre-rebase hook: " + e); <END> } }</code><technical_language>I agree. Done</technical_language>

Target:
public void testFailingPreRebaseHookBlocksRebase() throws Exception { assumeSupportedPlatform(); Hook h = Hook.PRE_REBASE; writeHookFile(h.getName(), "#!/bin/sh\necho \"test\"\n\necho 1>&2 \"stderr\"\nexit 1"); Git git = Git.wrap(db); RevCommit first = git.commit().setMessage("initial commit").call(); createBranch(first, "refs/heads/branch1"); git.commit().setMessage("second commit").call(); checkoutBranch("refs/heads/branch1"); ByteArrayOutputStream out = new ByteArrayOutputStream(); try { git.rebase().setUpstream("refs/heads/master") .setHookOutputStream(new PrintStream(out)).call(); fail("expected pre-rebase hook to abort commit"); } catch (RejectRebaseException e) { assertEquals("unexpected error message from pre-rebase hook", "Rebase rejected by \"pre-rebase\" hook.\nstderr\n", e.getMessage()); assertEquals("unexpected output from pre-rebase hook", "test\n", out.toString()); } }
Source:
<code>private ChangeLink createParentChangeLink() { PatchSet.Id parentChange = patchList.get(0).getKey().getParentKey(); <START> return parentChange != null <END> ? new ChangeLink("Back to the patch", psid.getParentKey()) : null; }</code><technical_language>This possible. parentChange null</technical_language>

Target:
private ChangeLink createParentChangeLink() { return new ChangeLink(PatchUtil.C.upToChange(), psid.getParentKey()); }
Source:
<code>public String changePublisherConfiguration(Map<String, Object> model, HttpServletRequest request, HttpServletResponse response, @PathVariable("appSlug") String slug) throws IOException { Reader reader = new InputStreamReader(request.getInputStream()); <START> Gson deserializer = new GsonBuilder() <END> .registerTypeAdapter(Publisher.class, new PublisherKeyDeserializer()) .create(); PublisherConfiguration configuration = deserializer.fromJson(reader, PublisherConfiguration.class); Application app = manager.setPublisherConfiguration(slug, configuration); model.put("application", modelBuilder.build(app)); return APPLICATION_TEMPLATE; }</code><technical_language>need create a new deserializer for request</technical_language>

Target:
public String changePublisherConfiguration(Map<String, Object> model, HttpServletRequest request, HttpServletResponse response, @PathVariable("appSlug") String slug) throws IOException { Reader reader = new InputStreamReader(request.getInputStream()); PublisherConfiguration configuration = publisherKeyDeserializer.fromJson(reader, PublisherConfiguration.class); Application app = manager.setPublisherConfiguration(slug, configuration); model.put("application", modelBuilder.build(app)); return APPLICATION_TEMPLATE; }
Source:
<code>public void updateForLocation(String pid, String location, Map<String, Object> configurationTable) throws IOException { if (pid == null || pid.length() < 1) { throw new IOException("Argument pid cannot be null or empty"); } if (configurationTable == null) { throw new IOException("Argument configurationTable cannot be null"); } for (Entry<String, Object> curEntry : configurationTable.entrySet()) { Object value = curEntry.getValue(); <START> if (value instanceof JSONArray && ((JSONArray)value).size() == 0) { <END> curEntry.setValue(""); } else if (value == null) { curEntry.setValue(""); } } Dictionary<String, Object> configurationProperties = new Hashtable<String, Object>( configurationTable); Configuration config = configurationAdmin.getConfiguration(pid, location); config.update(configurationProperties); }</code><technical_language>JSONArray extends ArrayList, this if block replaced CollectionUtils.isEmpty()</technical_language>

Target:
public void updateForLocation(String pid, String location, Map<String, Object> configurationTable) throws IOException { if (pid == null || pid.length() < 1) { throw new IOException("Argument pid cannot be null or empty"); } if (configurationTable == null) { throw new IOException("Argument configurationTable cannot be null"); } for (Entry<String, Object> curEntry : configurationTable.entrySet()) { Object value = curEntry.getValue(); if (value == null || (value instanceof ArrayList && CollectionUtils.sizeIsEmpty(value))) { curEntry.setValue(""); } } Dictionary<String, Object> configurationProperties = new Hashtable<String, Object>( configurationTable); Configuration config = configurationAdmin.getConfiguration(pid, location); config.update(configurationProperties); }
Source:
<code>public <T> T get(int index) { <START> throw new UnsupportedOperationException("Should not be called."); <END> }</code><technical_language>matter much, throw IndexOutOfBoundsException("index=" + index). operation a missing implementation - implemented, valid index called with. in EmptyRowBatch.getRow()</technical_language>

Target:
public <T> T get(int index) { throw new IndexOutOfBoundsException(getClass().getName() + " has no columns"); }
Source:
<code>public String update(MetaModel metaModel, Map<String, Object> attributes) { StringBuilder query = new StringBuilder().append("UPDATE ").append(metaModel.getTableName()).append(' '); if (attributes.isEmpty()) { appendEmptyRow(metaModel, query); } else { query.append("SET "); Iterator<String> keysetIt = attributes.keySet().iterator(); Iterator<Object> valueIt = attributes.values().iterator(); <START> <END> while (valueIt.hasNext()) { query.append(keysetIt.next() + " = "); appendValue(query, valueIt.next()); if (valueIt.hasNext()) { query.append(", "); } else{ query.append(" "); } } String idName = metaModel.getIdName(); query.append("WHERE ").append(idName).append(" = " + attributes.get(idName)); } return query.toString(); }</code><technical_language>attributes.entrySet() instead of separately keySet() values()</technical_language>

Target:
public String update(MetaModel metaModel, Map<String, Object> attributes) { StringBuilder query = new StringBuilder().append("UPDATE ").append(metaModel.getTableName()).append(' '); if (attributes.isEmpty()) { throw new NoSuchElementException("No attributes set, can't create an update statement."); } else { query.append("SET "); String idName = metaModel.getIdName(); Map<String, Object> attributesWithoutId = new CaseInsensitiveMap<Object>(); attributesWithoutId.putAll(attributes); attributesWithoutId.remove(idName); Iterator<Entry<String, Object>> attributesIt = attributesWithoutId.entrySet().iterator(); for (;;) { Entry<String, Object> attribute = attributesIt.next(); String key = attribute.getKey(); Object val = attribute.getValue(); query.append(key + " = "); appendValue(query, val); if (attributesIt.hasNext()) { query.append(", "); } else { break; } } query.append(" WHERE ").append(idName).append(" = " + attributes.get(idName)); } return query.toString(); }
Source:
<code>public void shouldFormatUniquenessConstraints() { <START> final int[] propertyKeyIds = new int[]{42}; <END> assertEquals( "new UniquenessConstraint( SchemaDescriptorFactory.forLabel( 23, 42 ) )", formatArgument( new UniquenessConstraint( SchemaDescriptorFactory.forLabel( 23, propertyKeyIds ) ) ) ); }</code><technical_language>needed</technical_language>

Target:
public void shouldFormatUniquenessConstraints() { assertEquals( "new UniquenessConstraint( SchemaDescriptorFactory.forLabel( 23, 42 ) )", formatArgument( new UniquenessConstraint( SchemaDescriptorFactory.forLabel( 23, 42 ) ) ) ); }
Source:
<code>public Map<String, Double> toMap() { Map<String, Double> metricValues = new HashMap<>(); for (Field field : this.getClass().getDeclaredFields()) try { metricValues.put(field.getName(), field.getDouble(this)); } catch (IllegalAccessException e) { <START> e.printStackTrace(); <END> } return metricValues; }</code><technical_language>I exception hiding is valid behavior for this class</technical_language>

Target:
public Map<String, Double> toMap() { Map<String, Double> metricValues = new HashMap<>(); for (Field field : getClass().getDeclaredFields()) try { metricValues.put(field.getName(), field.getDouble(this)); } catch (IllegalAccessException e) { e.printStackTrace(); } return metricValues; }
Source:
<code>public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { int lastVisibleItem = firstVisibleItem + visibleItemCount; int size = getCards().size(); if ((size > 0) && (firstVisibleItem < size) && ((lastVisibleItem - 1) < size)) { String firstAns = getCards().get(firstVisibleItem).get("answer"); String lastAns = getCards().get(lastVisibleItem - 1).get("answer"); <START> if (firstAns != null && "".equals(firstAns) || lastAns != null && lastAns.equals("")) { <END> showProgressBar(); long currentTime = SystemClock.elapsedRealtime (); if ((currentTime - mLastRenderStart > 300 || lastVisibleItem >= totalItemCount)) { mLastRenderStart = currentTime; DeckTask.cancelTask(DeckTask.TASK_TYPE_RENDER_BROWSER_QA); DeckTask.launchDeckTask(DeckTask.TASK_TYPE_RENDER_BROWSER_QA, mRenderQAHandler, new DeckTask.TaskData(new Object[]{getCards(), firstVisibleItem, visibleItemCount})); } } } }</code><technical_language>Remove null check do yoda of if expression</technical_language>

Target:
public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { int lastVisibleItem = firstVisibleItem + visibleItemCount; int size = getCards().size(); if ((size > 0) && (firstVisibleItem < size) && ((lastVisibleItem - 1) < size)) { String firstAns = getCards().get(firstVisibleItem).get("answer"); String lastAns = getCards().get(lastVisibleItem - 1).get("answer"); if ("".equals(firstAns) || "".equals(lastAns)) { showProgressBar(); long currentTime = SystemClock.elapsedRealtime (); if ((currentTime - mLastRenderStart > 300 || lastVisibleItem >= totalItemCount)) { mLastRenderStart = currentTime; DeckTask.cancelTask(DeckTask.TASK_TYPE_RENDER_BROWSER_QA); DeckTask.launchDeckTask(DeckTask.TASK_TYPE_RENDER_BROWSER_QA, mRenderQAHandler, new DeckTask.TaskData(new Object[]{getCards(), firstVisibleItem, visibleItemCount})); } } } }
Source:
<code>@Override public void error(@NonNull Throwable caught) { <START> if (caught instanceof OfflineClient.OfflineException) { appendCard(new OfflineCard()); } <END> requestNextCard(wiki); }</code><technical_language>This good cover for usage of feed</technical_language>

Target:
@Override public void error(@NonNull Throwable caught) { requestNextCard(wiki); }