auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public ResponseEntity<String> viewTextfile(@RequestParam("txtid") String txtId, HttpServletResponse response, HttpServletRequest request) throws QuadrigaAccessException { response.setContentType("text/plain"); response.setCharacterEncoding("UTF-8"); String respMessage = null; try { respMessage = tfManager.retrieveTextFileContent(txtId); <START> String decodedRespMsg = StringEscapeUtils.unescapeXml(respMessage); <END> return new ResponseEntity<String>(decodedRespMsg, HttpStatus.OK); } catch (FileStorageException e) { logger.error(e.getMessage()); respMessage = "Error while retrieving the file content"; return new ResponseEntity<String>(respMessage, HttpStatus.NOT_FOUND); } }</code><technical_language>Is text escaped stored? needs unescaped storing, if submits XML file, actual XML file is stored, bad for reusability purposes</technical_language>

Target:
public ResponseEntity<String> viewTextfile(@RequestParam("txtid") String txtId, HttpServletResponse response, HttpServletRequest request) throws QuadrigaAccessException { response.setContentType("text/plain"); response.setCharacterEncoding("UTF-8"); String respMessage = null; try { respMessage = tfManager.retrieveTextFileContent(txtId); return new ResponseEntity<String>(respMessage, HttpStatus.OK); } catch (FileStorageException e) { logger.error(e.getMessage()); respMessage = "Error while retrieving the file content"; return new ResponseEntity<String>(respMessage, HttpStatus.NOT_FOUND); } }
Source:
<code>public ListenableFuture<TaskStatus> run(final Task task) { RemoteTaskRunnerWorkItem runningTask = runningTasks.get(task.getId()); if (runningTask != null) { ZkWorker zkWorker = findWorkerRunningTask(task.getId()); if (zkWorker == null) { <START> log.error("Got task %s that is running but no worker is actually running it?", task.getId()); <END> runningTasks.remove(task.getId()); } else { log.info("Task[%s] already running on %s.", task.getId(), zkWorker.getWorker().getHost()); TaskStatus status = zkWorker.getRunningTasks().get(task.getId()); if (status.isComplete()) { taskComplete(runningTask, zkWorker, task.getId(), status); } return runningTask.getResult(); } } RemoteTaskRunnerWorkItem pendingTask = pendingTasks.get(task.getId()); if (pendingTask != null) { log.info("Assigned a task[%s] that is already pending, not doing anything", task.getId()); return pendingTask.getResult(); } RemoteTaskRunnerWorkItem taskRunnerWorkItem = new RemoteTaskRunnerWorkItem( task, SettableFuture.<TaskStatus>create() ); addPendingTask(taskRunnerWorkItem); return taskRunnerWorkItem.getResult(); }</code><technical_language>bad is this state? Is alert worthy</technical_language>

Target:
public ListenableFuture<TaskStatus> run(final Task task) { RemoteTaskRunnerWorkItem runningTask = runningTasks.get(task.getId()); if (runningTask != null) { ZkWorker zkWorker = findWorkerRunningTask(task.getId()); if (zkWorker == null) { log.makeAlert("Told to run task that is in the running queue but no worker is actually running it?!") .addData("taskId", task.getId()) .emit(); runningTasks.remove(task.getId()); } else { log.info("Task[%s] already running on %s.", task.getId(), zkWorker.getWorker().getHost()); TaskStatus status = zkWorker.getRunningTasks().get(task.getId()); if (status.isComplete()) { taskComplete(runningTask, zkWorker, task.getId(), status); } return runningTask.getResult(); } } RemoteTaskRunnerWorkItem pendingTask = pendingTasks.get(task.getId()); if (pendingTask != null) { log.info("Assigned a task[%s] that is already pending, not doing anything", task.getId()); return pendingTask.getResult(); } RemoteTaskRunnerWorkItem taskRunnerWorkItem = new RemoteTaskRunnerWorkItem( task, SettableFuture.<TaskStatus>create() ); addPendingTask(taskRunnerWorkItem); return taskRunnerWorkItem.getResult(); }
Source:
<code><START> private static @NonNull InputStream readFilePath(@NonNull FilePath index) throws IOException, InterruptedException { <END> InputStream stream = index.read(); assert stream != null; return stream; }</code><technical_language>do Glick-style annotations. If method returns @NonNull @NonNull line preceding access modifiers access modifiers return type</technical_language>

Target:
private static InputStream readFilePath(@NonNull FilePath index) throws IOException, InterruptedException { InputStream stream = index.read(); assert stream != null; return stream; }
Source:
<code>public static StarlarkInt xor(StarlarkInt x, StarlarkInt y) { if (x instanceof Int32 && y instanceof Int32) { <START> int xl = ((Int32) x).v; <END> int yl = ((Int32) y).v; return StarlarkInt.of(xl ^ yl); } try { long xl = x.toLongFast(); long yl = y.toLongFast(); return StarlarkInt.of(xl ^ yl); } catch (Overflow unused) { } BigInteger xbig = x.toBigInteger(); BigInteger ybig = y.toBigInteger(); BigInteger zbig = xbig.xor(ybig); return StarlarkInt.of(zbig); }</code><technical_language>xl called xi for int. Ditto throughout</technical_language>

Target:
public static StarlarkInt xor(StarlarkInt x, StarlarkInt y) { try { long xl = x.toLongFast(); long yl = y.toLongFast(); return StarlarkInt.of(xl ^ yl); } catch (Overflow unused) { } BigInteger xbig = x.toBigInteger(); BigInteger ybig = y.toBigInteger(); BigInteger zbig = xbig.xor(ybig); return StarlarkInt.of(zbig); }
Source:
<code>private void processCommandLine(String[] args) { if (args == null || args.length == 0) return; String <START> arg; <END> for (int i = 0; i < args.length; i++) { if (i == args.length - 1 || args[i + 1].startsWith("-")) continue; arg = args[++i]; if (args[i - 1].equalsIgnoreCase(KEYRING)) keyringFile = arg; if (args[i - 1].equalsIgnoreCase(PASSWORD)) password = arg; } }</code><technical_language>this is unrelated main change increases scope of variable. is performance improvement if meant that</technical_language>

Target:
private void processCommandLine(String[] args) { if (args == null || args.length == 0) return; for (int i = 0; i < args.length; i++) { if (i == args.length - 1 || args[i + 1].startsWith("-")) continue; String arg = args[++i]; if (args[i - 1].equalsIgnoreCase(KEYRING)) keyringFile = arg; if (args[i - 1].equalsIgnoreCase(PASSWORD)) password = arg; } }
Source:
<code>private FSQueue createNewQueues(FSQueueType queueType, FSParentQueue topParent, List<String> newQueueNames) { AllocationConfiguration queueConf = scheduler.getAllocationConfiguration(); Iterator<String> i = newQueueNames.iterator(); FSParentQueue parent = topParent; FSQueue queue = null; while (i.hasNext()) { FSParentQueue newParent = null; String queueName = i.next(); SchedulingPolicy policy = scheduler.getAllocationConfiguration(). getSchedulingPolicy(queueName); try { parent.getPolicy().isChildPolicyAllowed(policy); } catch (AllocationConfigurationException ex) { LOG.error("Can't create queue '" + queueName + "'.", ex); return null; } if (!i.hasNext() && (queueType != FSQueueType.PARENT)) { FSLeafQueue leafQueue = new FSLeafQueue(queueName, scheduler, parent); leafQueues.add(leafQueue); queue = leafQueue; } else { newParent = new FSParentQueue(queueName, scheduler, parent); queue = newParent; } try { <START> policy.initialize(scheduler.getClusterResource()); <END> queue.setPolicy(policy); } catch (AllocationConfigurationException ex) { LOG.error("Failed to set the scheduling policy!", ex); } parent.addChildQueue(queue); setChildResourceLimits(parent, queue, queueConf); queues.put(queue.getName(), queue); parent = newParent; } return queue; }</code><technical_language>Initialize setPolicy</technical_language>

Target:
private FSQueue createNewQueues(FSQueueType queueType, FSParentQueue topParent, List<String> newQueueNames) { AllocationConfiguration queueConf = scheduler.getAllocationConfiguration(); Iterator<String> i = newQueueNames.iterator(); FSParentQueue parent = topParent; FSQueue queue = null; while (i.hasNext()) { FSParentQueue newParent = null; String queueName = i.next(); SchedulingPolicy childPolicy = scheduler.getAllocationConfiguration(). getSchedulingPolicy(queueName); if (!parent.getPolicy().isChildPolicyAllowed(childPolicy)) { LOG.error("Can't create queue '" + queueName + "'."); return null; } if (!i.hasNext() && (queueType != FSQueueType.PARENT)) { FSLeafQueue leafQueue = new FSLeafQueue(queueName, scheduler, parent); leafQueues.add(leafQueue); queue = leafQueue; } else { if (childPolicy instanceof FifoPolicy) { LOG.error("Can't create queue '" + queueName + "', since " + FifoPolicy.NAME + " is only for leaf queues."); return null; } newParent = new FSParentQueue(queueName, scheduler, parent); queue = newParent; } parent.addChildQueue(queue); setChildResourceLimits(parent, queue, queueConf); queues.put(queue.getName(), queue); parent = newParent; } return queue; }
Source:
<code>public void testAccessCheck() { final WinNT.GENERIC_MAPPING mapping = new WinNT.GENERIC_MAPPING(); mapping.genericRead = new DWORD(FILE_GENERIC_READ); mapping.genericWrite = new DWORD(FILE_GENERIC_WRITE); mapping.genericExecute = new DWORD(FILE_GENERIC_EXECUTE); mapping.genericAll = new DWORD(FILE_ALL_ACCESS); final Memory securityDescriptorMemoryPointer = new Memory(1); final PRIVILEGE_SET privileges = new PRIVILEGE_SET(1); privileges.PrivilegeCount = new DWORD(0); final DWORDByReference privilegeLength = new DWORDByReference(new DWORD(privileges.size())); final DWORDByReference grantedAccess = new DWORDByReference(); final BOOLByReference result = new BOOLByReference(); final boolean status = Advapi32.INSTANCE.AccessCheck(securityDescriptorMemoryPointer, null, new DWORD(FILE_GENERIC_READ), mapping, privileges, privilegeLength, grantedAccess, result); assertFalse(status); assertFalse(result.getValue().booleanValue()); <START> assertEquals("The handle is invalid.", Kernel32Util.formatMessage(W32Errors.HRESULT_FROM_WIN32(Kernel32.INSTANCE.GetLastError()))); <END> }</code><technical_language>thing, promise. check Kernel32.INSTANCE.GetLastError() is INVALID_HANDLE that. This fail a non-US-English system</technical_language>

Target:
public void testAccessCheck() { final GENERIC_MAPPING mapping = new GENERIC_MAPPING(); mapping.genericRead = new DWORD(FILE_GENERIC_READ); mapping.genericWrite = new DWORD(FILE_GENERIC_WRITE); mapping.genericExecute = new DWORD(FILE_GENERIC_EXECUTE); mapping.genericAll = new DWORD(FILE_ALL_ACCESS); final Memory securityDescriptorMemoryPointer = new Memory(1); final PRIVILEGE_SET privileges = new PRIVILEGE_SET(1); privileges.PrivilegeCount = new DWORD(0); final DWORDByReference privilegeLength = new DWORDByReference(new DWORD(privileges.size())); final DWORDByReference grantedAccess = new DWORDByReference(); final BOOLByReference result = new BOOLByReference(); final boolean status = Advapi32.INSTANCE.AccessCheck(securityDescriptorMemoryPointer, null, new DWORD(FILE_GENERIC_READ), mapping, privileges, privilegeLength, grantedAccess, result); assertFalse(status); assertFalse(result.getValue().booleanValue()); assertEquals(WinError.ERROR_INVALID_HANDLE, Kernel32.INSTANCE.GetLastError()); }
Source:
<code>public void foreverBrickTest() throws InterpretationException { <START> <END> addLoopAtPosition(R.string.brick_forever, 2); checkIfBrickAtPositionShowsString(1, R.string.brick_repeat); checkIfBrickAtPositionShowsString(2, R.string.brick_forever); checkIfBrickAtPositionShowsString(3, R.string.brick_change_y_by); checkIfBrickAtPositionShowsString(4, R.string.brick_loop_end); checkIfBrickAtPositionShowsString(5, R.string.brick_loop_end); deleteBrickAtPosition(2); checkSetUpBrickArrangement(); }</code><technical_language>please remove newlines of functions</technical_language>

Target:
public void foreverBrickTest() throws InterpretationException { addBrickAtPosition(ForeverBrick.class, 2, R.string.category_control); checkIfBrickAtPositionShowsString(1, R.string.brick_repeat); checkIfBrickAtPositionShowsString(2, R.string.brick_forever); checkIfBrickAtPositionShowsString(3, R.string.brick_change_y_by); checkIfBrickAtPositionShowsString(4, R.string.brick_loop_end); checkIfBrickAtPositionShowsString(5, R.string.brick_loop_end); deleteBrickAtPosition(2); checkSetUpBrickArrangement(); }
Source:
<code>byte[] getByteBodyContents() { if (bytePayload != null) return bytePayload; String body = payload; if (body == null && !bodyParams.isEmpty()) { body = URLUtils.formURLEncodeMap(bodyParams); if (!this.headers.containsKey(CONTENT_TYPE)) <START> this.addHeader(CONTENT_TYPE, "application/x-www-form-urlencoded"); <END> } try { return body.getBytes(getCharset()); } catch(UnsupportedEncodingException uee) { throw new OAuthException("Unsupported Charset: "+getCharset(), uee); } }</code><technical_language>charset parameter set for Content-Type header? java this.addHeader(CONTENT_TYPE, "application/x-www-form-urlencoded; charset=" + getCharset());</technical_language>

Target:
byte[] getByteBodyContents() { if (bytePayload != null) return bytePayload; String body = payload; if (body == null && !bodyParams.isEmpty()) { body = URLUtils.formURLEncodeMap(bodyParams); if (!this.headers.containsKey(CONTENT_TYPE)) this.addHeader(CONTENT_TYPE, "application/x-www-form-urlencoded; charset=" + getCharset() + ";"); } try { return body.getBytes(getCharset()); } catch(UnsupportedEncodingException uee) { throw new OAuthException("Unsupported Charset: "+getCharset(), uee); } }
Source:
<code>public void deleteEntity(DeleteOption deleteOption) { String selectedEntity = getSelectedEntityTitle(); LOG.info("deleteEntity {}, mode={} ...", selectedEntity, deleteOption); deleteDropdownMenu.click(); switch (deleteOption) { case DATA: deleteDataButton.click(); break; case DATA_AND_METADATA: deleteDataMetadataBtn.click(); break; default: break; } WebDriverWait wait = new WebDriverWait(driver, 60); <START> wait.until(ExpectedConditions.elementToBeClickable(confirmButton)); <END> confirmButton.click(); spinner().waitTillDone(20, TimeUnit.SECONDS); }</code><technical_language>is this slow</technical_language>

Target:
public void deleteEntity(DeleteOption deleteOption) { String selectedEntity = getSelectedEntityTitle(); LOG.info("deleteEntity {}, mode={} ...", selectedEntity, deleteOption); deleteDropdownMenu.click(); switch (deleteOption) { case DATA: deleteDataButton.click(); break; case DATA_AND_METADATA: deleteDataMetadataBtn.click(); break; default: break; } confirmButton.click(); spinner().waitTillDone(20, TimeUnit.SECONDS); }
Source:
<code>final AsyncFunction<ResultSet, R> iterate() { <START> return rs -> { <END> Preconditions.checkArgument(rs != null, "ResultSet should not be null when iterating"); R currentResult = resultSetVisitor.visit(rs); boolean wasLastPage = rs.getExecutionInfo().getPagingState() == null; if (wasLastPage) { return Futures.immediateFuture(currentResult); } else { ListenableFuture<ResultSet> future = rs.fetchMoreResults(); return Futures.transformAsync(future, iterate(), executor); } }; }</code><technical_language>rs -> resultSet please</technical_language>

Target:
final AsyncFunction<ResultSet, R> iterate() { return resultSet -> { Preconditions.checkArgument(resultSet != null, "ResultSet should not be null when iterating"); rowStreamAccumulator.accumulateRowStream(Streams.stream(resultSet) .limit(resultSet.getAvailableWithoutFetching())); boolean wasLastPage = resultSet.getExecutionInfo().getPagingState() == null; if (wasLastPage) { return Futures.immediateFuture(rowStreamAccumulator.result()); } else { ListenableFuture<ResultSet> future = resultSet.fetchMoreResults(); return Futures.transformAsync(future, iterate(), executor); } }; }
Source:
<code>public void shouldFindServerGivenListOfServersContainsServerWithNullType() throws CoreException { <START> IServer os3Server = mockOS3Server("os3", "someService"); <END> IServer[] servers = new IServer[] { mockServer("null", null), os3Server, mockServer("as7", mockServerType(IJBossToolingConstants.SERVER_AS_70)) }; IServer serverFound = OpenShiftServerUtils.findServerForService("someService", servers); assertThat(serverFound).isEqualTo(os3Server); }</code><technical_language>![CRITICAL](<LINK_0> 'Severity: CRITICAL') Define a constant instead of duplicating this literal "someService" 8 times. [![rule](<LINK_2>](<LINK_1></technical_language>

Target:
public void shouldFindServerGivenListOfServersContainsServerWithNullType() throws CoreException { IServer os3Server = mockOS3Server("os3", "someService"); IServer[] servers = new IServer[] { mockServer("null", null), os3Server, mockServer("as7", mockServerType(IJBossToolingConstants.SERVER_AS_70)) }; IServer serverFound = OpenShiftServerUtils.findServerForService("someService", servers); assertThat(serverFound).isSameAs(os3Server); }
Source:
<code>public byte[] persistToBytes() { byte[] result = new byte[] { 0, 0, 0, 0 }; <START> result[0] |= (shard() & 0xFF) >> 2; <END> if (dedicatedRow()) { result[0] |= 0x40; } if (conservative()) { result[0] |= 0x80; } result[1] |= dedicatedRowNumber(); result[1] |= (shard() << 6) & 0xFF; return result; }</code><technical_language>Strictly speaking, needed shard() 0 255 right</technical_language>

Target:
public byte[] persistToBytes() { byte[] result = new byte[] { 0, 0, 0, 0 }; result[0] |= (shard() & BYTE_MASK) >> 2; if (dedicatedRow()) { result[0] |= USE_DEDICATED_ROWS_MASK; } if (conservative()) { result[0] |= SWEEP_STRATEGY_MASK; } result[1] |= dedicatedRowNumber() & DEDICATED_ROW_NUMBER_MASK; result[1] |= (shard() << 6) & BYTE_MASK; return result; }
Source:
<code>private void waitForTaskReleaseOrForceIfOwnerIsDead(DatastreamTask task, long timeoutMs, String lockPath) { boolean deadOwner = false; if (_zkclient.exists(lockPath)) { String owner = _zkclient.readData(lockPath, true); if (owner != null && owner.equals(_instanceName)) { LOG.info("{} already owns the lock on {}", _instanceName, task); return; } long waitTimeout = timeoutMs; if (timeoutMs >= _debounceTimerMs) { <START> if (_liveInstancesProvider != null && !getLiveInstances().contains(owner)) { <END> LOG.info("dead owner found for the lock on the task {}", owner, task.getDatastreamTaskName()); deadOwner = true; } else { waitForTaskRelease(task, timeoutMs - _debounceTimerMs, lockPath); if (!_zkclient.exists(lockPath)) { return; } owner = _zkclient.readData(lockPath, true); if (owner != null && _liveInstancesProvider != null && !getLiveInstances().contains(owner)) { LOG.info("dead owner found for the lock on the task after waiting ms", owner, task.getDatastreamTaskName(), timeoutMs - _debounceTimerMs); deadOwner = true; } } waitTimeout = _debounceTimerMs; } waitForTaskRelease(task, waitTimeout, lockPath); if (deadOwner && _zkclient.exists(lockPath)) { String tempOwner = _zkclient.readData(lockPath, true); if (tempOwner != null && tempOwner.equals(owner)) { _zkclient.delete(lockPath); } } } }</code><technical_language>check for owner != null too</technical_language>

Target:
private void waitForTaskReleaseOrForceIfOwnerIsDead(DatastreamTask task, long timeoutMs, String lockPath) { boolean deadOwner = false; if (_zkclient.exists(lockPath)) { String owner = _zkclient.readData(lockPath, true); long waitTimeout = timeoutMs; if (timeoutMs >= _debounceTimerMs) { if (owner != null && _liveInstancesProvider != null && !getLiveInstances().contains(owner)) { LOG.info("dead owner found for the lock on the task {}", owner, task.getDatastreamTaskName()); deadOwner = true; } else { waitForTaskRelease(task, timeoutMs - _debounceTimerMs, lockPath); if (!_zkclient.exists(lockPath)) { return; } owner = _zkclient.readData(lockPath, true); if (owner != null && _liveInstancesProvider != null && !getLiveInstances().contains(owner)) { LOG.info("dead owner found for the lock on the task after waiting ms", owner, task.getDatastreamTaskName(), timeoutMs - _debounceTimerMs); deadOwner = true; } } waitTimeout = _debounceTimerMs; } waitForTaskRelease(task, waitTimeout, lockPath); if (deadOwner && _zkclient.exists(lockPath)) { String tempOwner = _zkclient.readData(lockPath, true); if (tempOwner != null && tempOwner.equals(owner)) { _zkclient.delete(lockPath); } else { LOG.warn("Not deleting the lock for the task since the owner changed from dead owner to {}.", task.getDatastreamTaskName(), owner, tempOwner); } } } }
Source:
<code>public void acquirePartitionLockLazily() throws IOException { if (partitionKeyLock != null) { return; } Object partitionKey = getPartitionKey(); channelManager.acquireChannelLock(partitionKey); Object prevKey = partitionKeyLockField.getAndSet(this, partitionKey); if (prevKey != null) { channelManager.releaseChannelLock(prevKey); releasePartitionKeyLock(); <START> throw new AssertionError("unreachable"); <END> } if (isDone()) { releasePartitionKeyLock(); } }</code><technical_language>throw new IllegalStateException("Trying acquire partition lock twice. Please report.")</technical_language>

Target:
public void acquirePartitionLockLazily() throws IOException { if (partitionKeyLock != null) { return; } Object partitionKey = getPartitionKey(); connectionSemaphore.acquireChannelLock(partitionKey); Object prevKey = partitionKeyLockField.getAndSet(this, partitionKey); if (prevKey != null) { connectionSemaphore.releaseChannelLock(prevKey); releasePartitionKeyLock(); throw new IllegalStateException("Trying to acquire partition lock concurrently. Please report."); } if (isDone()) { releasePartitionKeyLock(); } }
Source:
<code>public Status getStatusHTTP(@Context final HttpServletRequest req) { Access access = authorizationCheck(req, Action.READ); if (!access.isAllowed()) { log.warn("Authorization failure."); <START> return null; <END> } return status; }</code><technical_language>is this log.warn returning null instead of a code 403? Code 403 more sense me. If return do that, try either, - switch return type Response - or, define a ForbiddenException ExceptionMapper<ForbiddenException> in manner of CustomExceptionMapper; throw ForbiddenException</technical_language>

Target:
public Status getStatusHTTP(@Context final HttpServletRequest req) { authorizationCheck(req, Action.READ); return status; }
Source:
<code>public SecretCreateResponse createSecret(final SecretSpec secret) throws DockerException, InterruptedException { assertApiVersionIsAbove("1.25"); final WebTarget resource = resource().path("secrets").path("create"); try { return request(POST, SecretCreateResponse.class, resource, resource.request(APPLICATION_JSON_TYPE), Entity.json(secret)); } catch (DockerRequestException dre) { switch (dre.status()) { case 409: throw new DockerException("Name conflicts with an existing object.", dre); <START> case 503: <END> throw new DockerException("Server not part of swarm.", dre); default: throw dre; } } }</code><technical_language>Is this correct? [API docs](<LINK_0>, this 406, docs wrong</technical_language>

Target:
public SecretCreateResponse createSecret(final SecretSpec secret) throws DockerException, InterruptedException { assertApiVersionIsAbove("1.25"); final WebTarget resource = resource().path("secrets").path("create"); try { return request(POST, SecretCreateResponse.class, resource, resource.request(APPLICATION_JSON_TYPE), Entity.json(secret)); } catch (DockerRequestException dre) { switch (dre.status()) { case 406: throw new DockerException("Server not part of swarm.", dre); case 409: throw new ConflictException("Name conflicts with an existing object.", dre); default: throw dre; } } }
Source:
<code>public void testBeforeNoTimezone() throws IOException { BundleFilterTimeRange filter1 = Configs.decodeObject(BundleFilterTimeRange.class, BEFORE_160923); BundleFilterTimeRange filter2 = Configs.decodeObject(BundleFilterTimeRange.class, BEFORE_150925); assertTrue("Expected true since filtered out later than 160923", filter1.filter(bundle)); <START> assertFalse("Expected false since filtered out later than 150925", filter2.filter(bundle)); <END> }</code><technical_language>messages "later than" - of wrong</technical_language>

Target:
public void testBeforeNoTimezone() throws IOException { BundleFilterTimeRange filter1 = Configs.decodeObject(BundleFilterTimeRange.class, BEFORE_160923); BundleFilterTimeRange filter2 = Configs.decodeObject(BundleFilterTimeRange.class, BEFORE_150925); assertTrue("Expected true since 160922 is earlier than 160923", filter1.filter(bundle)); assertFalse("Expected false since 160922 is later than 150925", filter2.filter(bundle)); }
Source:
<code>public void displayView(StringBuffer buffer, String name, String prefix, BaseCollection object, XWikiContext context) { String result; BaseProperty prop = (BaseProperty) object.safeget(name); if (prop != null) { result = prop.toText(); } else { result = ""; } <START> buffer.append(context.getDoc().getRenderedInlineContent(result, context.getDoc().getSyntax().toIdString())); <END> }</code><technical_language>here, StringClass deal wiki content, TeatArea does. do is escape html this **plain text** contains</technical_language>

Target:
public void displayView(StringBuffer buffer, String name, String prefix, BaseCollection object, XWikiContext context) { BaseProperty property = (BaseProperty) object.safeget(name); if (property != null) { buffer.append(XMLUtils.escapeElementText(property.toText())); } }
Source:
<code>private void loadUsers() { int i = 0; File[] path = usersFolderFile.listFiles(); if (path != null) { for (File file : path) { if (file.isDirectory() || file.length() == 0) { file.delete(); i++; continue; } <START> if (!FunnyGuilds.USERNAME_PATTERN.matcher(StringUtils.removeEnd(file.getName(), ".yml")).matches()) { <END> FunnyGuilds.getInstance().getPluginLogger().warning("Skipping loading of user file '" + file.getName() + "'. Name is invalid."); continue; } User user = FlatUser.deserialize(file); if (user == null) { file.delete(); i++; } else { user.wasChanged(); } } } if (i > 0) { FunnyGuilds.getInstance().getPluginLogger().warning("Repaired conflicts: " + i); } FunnyGuilds.getInstance().getPluginLogger().info("Loaded users: " + UserUtils.getUsers().size()); }</code><technical_language>Replace UserUtils.validateUsername(String)</technical_language>

Target:
private void loadUsers() { int i = 0; File[] path = usersFolderFile.listFiles(); if (path != null) { for (File file : path) { if (file.isDirectory() || file.length() == 0) { file.delete(); i++; continue; } if (!UserUtils.validateUsername(StringUtils.removeEnd(file.getName(), ".yml"))) { FunnyGuilds.getInstance().getPluginLogger().warning("Skipping loading of user file '" + file.getName() + "'. Name is invalid."); continue; } User user = FlatUser.deserialize(file); if (user == null) { file.delete(); i++; } else { user.wasChanged(); } } } if (i > 0) { FunnyGuilds.getInstance().getPluginLogger().warning("Repaired conflicts: " + i); } FunnyGuilds.getInstance().getPluginLogger().info("Loaded users: " + UserUtils.getUsers().size()); }
Source:
<code>Resource getConfigFile(String configFileLocation ) throws IOException { File file = new File(configFileLocation); Resource resource; <START> if( file.isAbsolute() ){ <END> if( file.canRead() ){ return Files.asResource(file); } else { throw new IOException("Cannot read file: "+file.getCanonicalPath()); } } return null; }</code><technical_language>points respecting coding conventions (space in if condition, else in line if closing brace)</technical_language>

Target:
Resource getConfigFile(String configFileLocation) throws IOException { File file = new File(configFileLocation); if (file.isAbsolute()) { if (file.canRead()) { return Files.asResource(file); } else { throw new IOException("Cannot read file: " + file.getCanonicalPath()); } } return null; }
Source:
<code>public LRUCache(int capacity) { this.capacity = capacity; count = 0; <START> map = new HashMap<>(); <END> head = new DoubleLinkedList(0, 0); tail = new DoubleLinkedList(0, 0); head.next = tail; tail.pre = head; head.pre = null; tail.next = null; }</code><technical_language>initialized map line 24, again</technical_language>

Target:
public LRUCache(int capacity) { this.capacity = capacity; count = 0; head = new DoubleLinkedList(0, 0); tail = new DoubleLinkedList(0, 0); head.next = tail; tail.pre = head; head.pre = null; tail.next = null; }
Source:
<code><START> private String expectedDiff() { <END> return extractDiff(expected); }</code><technical_language>I personally prefer if methods "external API" public. Yes, outer class call private methods directly, IDEs show public methods differently, filter out non-public methods browsing, etc</technical_language>

Target:
public String expectedDiff() { return extractDiff(expected); }
Source:
<code>public void run() { try { currentInterval = intervalQueue.take(); while (currentInterval.getStartTime() != -1) { getSHT().insertInterval(currentInterval); currentInterval <START> = intervalQueue.take(); <END> } if (currentInterval.getAttribute() != -1) { throw new IllegalStateException(); } getSHT().closeTree(currentInterval.getEndTime()); return; } catch (TimeRangeException e) { Activator.getDefault().logError("Error starting the state system", e); } }</code><technical_language>For a short time, interval is out of queue returning method written volatile variable yet. I reproduced exception this patch</technical_language>

Target:
public void run() { try { intervalQueue.takeIntoAtomicReference(currentInterval); HTInterval interval = currentInterval.get(); while (interval.getStartTime() != -1) { getSHT().insertInterval(interval); intervalQueue.takeIntoAtomicReference(currentInterval); interval = currentInterval.get(); } if (interval.getAttribute() != -1) { throw new IllegalStateException(); } getSHT().closeTree(interval.getEndTime()); return; } catch (TimeRangeException e) { Activator.getDefault().logError("Error starting the state system", e); } }
Source:
<code>public void indexReturnsAllEventsWhenNoParameters(EventsInteractor mockedEventsInteractor) { Result result = eventsController.index(); assertEquals(Helpers.OK, Helpers.status(result)); assertEquals("application/json", Helpers.contentType(result)); String json = Helpers.contentAsString(result); JsonNode jsonNode = Json.parse(json); assertTrue(jsonNode.isArray()); JsonNode eventDto1 = jsonNode.get(0); <START> JsonNode eventDto2 = jsonNode.get(1); <END> JsonNode event1 = eventDto1.get("event"); JsonNode event2 = eventDto2.get("event"); assertEquals(tempEventsList.size(), jsonNode.size()); assertEquals(FIRST_EVENT_ID, event1.get("id").asLong()); assertEquals(EventsTestHelper.FIRST_RANDOM_SPORT, event1.get("sport").get("name").asText()); assertEquals(SECOND_EVENT_ID, event2.get("id").asLong()); assertEquals(EventsTestHelper.SECOND_RANDOM_SPORT, event2.get("sport").get("name").asText()); verify(mockedEventsInteractor).search(refEq(eventSearchCriteria)); }</code><technical_language>magic numbers</technical_language>

Target:
public void indexReturnsAllEventsWhenNoParameters(EventsInteractor mockedEventsInteractor) { Result result = eventsController.index(); assertEquals(Helpers.OK, Helpers.status(result)); assertEquals("application/json", Helpers.contentType(result)); String json = Helpers.contentAsString(result); JsonNode jsonNode = Json.parse(json); assertTrue(jsonNode.isArray()); JsonNode eventDto1 = jsonNode.get(0); JsonNode eventDto2 = jsonNode.get(1); JsonNode event1 = eventDto1.get("event"); JsonNode event2 = eventDto2.get("event"); assertEquals(tempEventsList.size(), jsonNode.size()); assertEquals(NUMBER_OF_TICKETS, eventDto1.get("ticketCount").getIntValue()); assertEquals(FIRST_EVENT_ID, event1.get("id").getLongValue()); assertEquals(EventsTestHelper.FIRST_RANDOM_SPORT, event1.get("sport").get("name").asText()); assertEquals(NUMBER_OF_TICKETS, eventDto2.get("ticketCount").getIntValue()); assertEquals(SECOND_EVENT_ID, event2.get("id").getLongValue()); assertEquals(EventsTestHelper.SECOND_RANDOM_SPORT, event2.get("sport").get("name").asText()); verify(mockedEventsInteractor).search(refEq(eventSearchCriteria)); }
Source:
<code>public boolean copyNonEditableFieldsToDestination(Object source, Object destination, boolean hotsetEnabled) { Class<?> cls = source.getClass(); while (!cls.equals(Object.class)) { for (Field srcFld : cls.getDeclaredFields()) { try { if (!Modifier.isFinal(srcFld.getModifiers()) && !IsFieldUpdatable(srcFld.getName()) && (!isHotsetField(srcFld.getName()) || <START> (isHotsetField(srcFld.getName()) <END> && !hotsetEnabled))) { srcFld.setAccessible(true); Field dstFld = cls.getDeclaredField(srcFld.getName()); dstFld.setAccessible(true); dstFld.set(destination, srcFld.get(source)); } } catch (Exception exp) { log.errorFormat("Failed to copy non editable field {0}, error: {1}", srcFld.getName(), exp.getMessage()); return false; } } cls = cls.getSuperclass(); } return true; }</code><technical_language>wrong.. this is true: !isHotsetField(srcFld.getName()) || (isHotsetField(srcFld.getName()) I be: !isHotsetField(srcFld.getName()) || !hotsetEnabled right</technical_language>

Target:
public boolean copyNonEditableFieldsToDestination(Object source, Object destination, boolean hotsetEnabled) { Class<?> cls = source.getClass(); while (!cls.equals(Object.class)) { for (Field srcFld : cls.getDeclaredFields()) { try { if (!Modifier.isFinal(srcFld.getModifiers()) && !IsFieldUpdatable(srcFld.getName()) && (!isHotsetField(srcFld.getName()) || !hotsetEnabled)) { srcFld.setAccessible(true); Field dstFld = cls.getDeclaredField(srcFld.getName()); dstFld.setAccessible(true); dstFld.set(destination, srcFld.get(source)); } } catch (Exception exp) { log.errorFormat("Failed to copy non editable field {0}, error: {1}", srcFld.getName(), exp.getMessage()); return false; } } cls = cls.getSuperclass(); } return true; }
Source:
<code>private byte[] handleInputReadSiMessage(byte[] message, byte[] messageNumber) { byte[] reply = null; replyRequired = true; boolean msgValid = true; int port = -1; if (!isMessageLengthValid(message, 11)) { msgValid = false; } else { port = message[7]; } if (!msgValid) { reply = new byte[3]; reply[0] = messageNumber[0]; reply[1] = messageNumber[1]; reply[2] = DIRECT_REPLY_ERROR; } else { portSensorMode[port] = message[9]; if (message[3] == 1) { reply = new byte[4]; } else if (message[3] == 4) { reply = new byte[7]; } else { throw new MindstormsException("read siValue with unusual length"); } reply[0] = messageNumber[0]; reply[1] = messageNumber[1]; reply[2] = DIRECT_REPLY; if (message[3] == 1) { <START> byte value = (byte) portSensorValue[port]; <END> reply[3] = value; } else if (message[3] == 4) { byte[] floatValueAsByte = ByteBuffer.allocate(4).order(ByteOrder.LITTLE_ENDIAN).putFloat(portSensorValue[port]).array(); for (int i = 0; i < floatValueAsByte.length; i++) { reply[3 + i] = floatValueAsByte[i]; } } } return reply; }</code><technical_language>lines moved if/else block</technical_language>

Target:
private byte[] handleInputReadSiMessage(byte[] message, byte[] messageNumber) { byte[] reply = null; replyRequired = true; boolean msgValid = true; int port = -1; if (!isMessageLengthValid(message, 11)) { msgValid = false; } else { port = message[7]; } if (!msgValid) { reply = new byte[3]; reply[0] = messageNumber[0]; reply[1] = messageNumber[1]; reply[2] = DIRECT_REPLY_ERROR; } else { portSensorMode[port] = message[9]; if (message[3] == 1) { reply = new byte[4]; byte value = (byte) portSensorValue[port]; reply[3] = value; } else if (message[3] == 4) { reply = new byte[7]; byte[] floatValueAsByte = ByteBuffer.allocate(4).order(ByteOrder.LITTLE_ENDIAN).putFloat(portSensorValue[port]).array(); for (int i = 0; i < floatValueAsByte.length; i++) { reply[3 + i] = floatValueAsByte[i]; } } else { throw new MindstormsException("read siValue with unusual length"); } reply[0] = messageNumber[0]; reply[1] = messageNumber[1]; reply[2] = DIRECT_REPLY; } return reply; }
Source:
<code>public static byte[] toByteArray(final HttpEntity entity) throws IOException { Args.notNull(entity, "Entity"); try (final InputStream inStream = entity.getContent()) { if (inStream == null) { return null; } <START> final ByteArrayBuffer buffer = new ByteArrayBuffer(getCheckedContentLength(entity)); <END> final byte[] tmp = new byte[DEFAULT_BYTE_BUFFER_SIZE]; int l; while ((l = inStream.read(tmp)) != -1) { buffer.append(tmp, 0, l); } return buffer.toByteArray(); } }</code><technical_language>if Content-Length is 500_000_000? create a buffer size</technical_language>

Target:
public static byte[] toByteArray(final HttpEntity entity) throws IOException { Args.notNull(entity, "Entity"); final int contentLength = toContentLength((int) Args.checkContentLength(entity)); try (final InputStream inStream = entity.getContent()) { if (inStream == null) { return null; } final ByteArrayBuffer buffer = new ByteArrayBuffer(contentLength); final byte[] tmp = new byte[DEFAULT_BYTE_BUFFER_SIZE]; int l; while ((l = inStream.read(tmp)) != -1) { buffer.append(tmp, 0, l); } return buffer.toByteArray(); } }
Source:
<code>public boolean supports(String databaseType) { return databaseType.equals(PostgreSQLContainer.NAME) <START> || databaseType.equals(PostgisContainer.NAME); <END> }</code><technical_language>This AFAIK lead creation of a PostgreSQLContainer postgis is in JDBC url</technical_language>

Target:
public boolean supports(String databaseType) { return databaseType.equals(PostgreSQLContainer.NAME); }
Source:
<code>private void sendChannelReadOnlyEvent() { Request request = new Request(); <START> request.setEvent(true); <END> request.setData(Request.READONLY_EVENT); request.setTwoWay(false); request.setVersion(Version.getProtocolVersion()); Collection<Channel> channels = getChannels(); for (Channel channel : channels) { try { if (channel.isConnected()) { channel.send(request, getUrl().getParameter(Constants.CHANNEL_READONLYEVENT_SENT_KEY, true)); } } catch (RemotingException e) { logger.warn("send cannot write message error.", e); } } }</code><technical_language>original setEvent is necessary keep, end setEvent methods: java void setEvent(bool); void setEvent(String);</technical_language>

Target:
private void sendChannelReadOnlyEvent() { Request request = new Request(); request.setEvent(Request.READONLY_EVENT); request.setTwoWay(false); request.setVersion(Version.getProtocolVersion()); Collection<Channel> channels = getChannels(); for (Channel channel : channels) { try { if (channel.isConnected()) { channel.send(request, getUrl().getParameter(Constants.CHANNEL_READONLYEVENT_SENT_KEY, true)); } } catch (RemotingException e) { logger.warn("send cannot write message error.", e); } } }
Source:
<code>public T[] postMatch(Class declaring, AccessibleObject target) { <START> if(cachedPostMatch == null || declaring != null || target != null) { <END> List<Match> matches = new ArrayList<Match>(); for (InterceptorFactory factory : interceptors) { Match match = factory.postMatch(declaring, target); if (match != null) { matches.add(match); } } cachedPostMatch = createArray(matches); } return cachedPostMatch; }</code><technical_language>understanding is proposal is cache result of postMatch(null, null), is a common scenario. If case, this if (cachedPostMatch == null && declaring == null && target == null) ? understanding do</technical_language>

Target:
public T[] postMatch(Class declaring, AccessibleObject target) { if(cachedPostMatch != null && declaring == null && target == null) { return cachedPostMatch; } List<Match> matches = new ArrayList<Match>(); for (InterceptorFactory factory : interceptors) { Match match = factory.postMatch(declaring, target); if (match != null) { matches.add(match); } } final T[] array = createArray(matches); if(declaring == null && target == null) { cachedPostMatch = array; } return array; }
Source:
<code>public DashboardResource parse(ProjectResource parent, String id) throws ResourceNotFoundException, IOException, ConfigInvalidException { ProjectControl myCtl = parent.getControl(); if ("default".equals(id)) { return DashboardResource.projectDefault(myCtl); } List<String> parts = Lists.newArrayList( Splitter.on(':').limit(2).split(id)); if (parts.size() != 2) { throw new ResourceNotFoundException(id); } String ref = URLDecoder.decode(parts.get(0), "UTF-8"); String path = URLDecoder.decode(parts.get(1), "UTF-8"); Set<Project.NameKey> seen = Sets.newHashSet(); Project.NameKey name = myCtl.getProject().getNameKey(); ProjectControl ctl = myCtl; seen.add(name); do { try { return parse(ctl, ref, path, myCtl); <START> } catch (Exception e) { <END> try { ProjectState ps = ctl.getProjectState().getParentState(); if (ps == null) { break; } name = ps.getProject().getNameKey(); if (!seen.add(name)) { break; } ctl = projectFactory.controlFor(name, ctl.getCurrentUser()); } catch (NoSuchProjectException pnf) { throw new ResourceNotFoundException(id); } } } while (ctl != null); throw new ResourceNotFoundException(id); }</code><technical_language>I this turning exception a walk tree. if dashboard is defined in a project, object files corrupt read walk tree for another dashboard of name</technical_language>

Target:
public DashboardResource parse(ProjectResource parent, String id) throws ResourceNotFoundException, IOException, ConfigInvalidException { ProjectControl myCtl = parent.getControl(); if ("default".equals(id)) { return DashboardResource.projectDefault(myCtl); } List<String> parts = Lists.newArrayList( Splitter.on(':').limit(2).split(id)); if (parts.size() != 2) { throw new ResourceNotFoundException(id); } String ref = URLDecoder.decode(parts.get(0), "UTF-8"); String path = URLDecoder.decode(parts.get(1), "UTF-8"); Set<Project.NameKey> seen = Sets.newHashSet(); Project.NameKey name = myCtl.getProject().getNameKey(); ProjectControl ctl = myCtl; seen.add(name); do { try { return parse(ctl, ref, path, myCtl); } catch (AmbiguousObjectException e) { throw new ResourceNotFoundException(id); } catch (IncorrectObjectTypeException e) { throw new ResourceNotFoundException(id); } catch (ResourceNotFoundException e) { try { ProjectState ps = ctl.getProjectState().getParentState(); if (ps == null) { break; } name = ps.getProject().getNameKey(); if (!seen.add(name)) { break; } ctl = projectFactory.controlFor(name, ctl.getCurrentUser()); } catch (NoSuchProjectException pnf) { throw new ResourceNotFoundException(id); } } } while (ctl != null); throw new ResourceNotFoundException(id); }
Source:
<code>public void apply(Project project) { SarosEclipseExtension e = project.getExtensions().create(EXTENSION_NAME, SarosEclipseExtension.class); project.afterEvaluate( <START> (p) -> { <END> configureEclipseAfterEvaluate(p, e); }); }</code><technical_language>Unnecessary braces</technical_language>

Target:
public void apply(Project project) { SarosEclipseExtension e = project.getExtensions().create(EXTENSION_NAME, SarosEclipseExtension.class); project.afterEvaluate(p -> configureEclipseAfterEvaluate(p, e)); }
Source:
<code>public void streamEventsbyName() throws IOException, InterruptedException { List<ServerSentEvent<String>> events = getServerSentEvents(ACTUATOR_STREAM_CIRCUITBREAKER_EVENTS + "/backendA"); CircuitBreakerEventsEndpointResponse circuitBreakerEventsBefore = circuitBreakerEvents(ACTUATOR_CIRCUITBREAKEREVENTS + "/backendA"); dummyService.doSomething(false); Thread.sleep(1000); try { dummyService.doSomething(true); } catch (IOException ex) { } CircuitBreakerEventsEndpointResponse circuitBreakerEventsAfter = circuitBreakerEvents(ACTUATOR_CIRCUITBREAKEREVENTS + "/backendA"); Thread.sleep(1000); <START> assert (circuitBreakerEventsBefore.getCircuitBreakerEvents().size() < circuitBreakerEventsAfter.getCircuitBreakerEvents().size()); <END> assert (events.size() == 2); }</code><technical_language>Please AssertJ</technical_language>

Target:
public void streamEventsbyName() throws IOException, InterruptedException { List<ServerSentEvent<String>> events = getServerSentEvents(ACTUATOR_STREAM_CIRCUITBREAKER_EVENTS + "/backendB"); CircuitBreakerEventsEndpointResponse circuitBreakerEventsBefore = circuitBreakerEvents(ACTUATOR_CIRCUITBREAKEREVENTS + "/backendB"); publishEvents(); CircuitBreakerEventsEndpointResponse circuitBreakerEventsAfter = circuitBreakerEvents(ACTUATOR_CIRCUITBREAKEREVENTS + "/backendB"); Thread.sleep(1000); assertThat (circuitBreakerEventsBefore.getCircuitBreakerEvents().size()).isLessThan(circuitBreakerEventsAfter.getCircuitBreakerEvents().size()); assertThat (events.size()).isEqualTo(2); }
Source:
<code>private AliasResolvingEquivalenceGenerator(Builder builder) { this.resolver = checkNotNull(builder.resolver); this.publishers = checkNotNull(builder.publishers); this.lookupEntryStore = checkNotNull(builder.lookupEntryStore); this.namespacesSet = checkNamespacesSet(checkNotNull(builder.namespacesSet)); this.aliasMatchingScore = checkNotNull(builder.aliasMatchingScore); <START> this.includeUnpublishedContent = builder.includeUnpublishedContent; <END> this.cls = checkNotNull(builder.cls); }</code><technical_language>add a checkNotNull builder field a Boolean. This sets field instead of defaulting false</technical_language>

Target:
private AliasResolvingEquivalenceGenerator(Builder builder) { this.resolver = checkNotNull(builder.resolver); this.publishers = checkNotNull(builder.publishers); this.lookupEntryStore = checkNotNull(builder.lookupEntryStore); this.namespacesSet = checkNamespacesSet(builder.namespacesSet); this.aliasMatchingScore = checkNotNull(builder.aliasMatchingScore); this.includeUnpublishedContent = checkNotNull(builder.includeUnpublishedContent); this.cls = checkNotNull(builder.cls); }
Source:
<code>public IgnoreConditionCreator(Class<?> aTestClass, ConditionalRun[] annotation) { this.mTestClass = aTestClass; this.conditionType = new ArrayList<>(annotation.length); <START> for (int i = 0; i < annotation.length; i++) { <END> this.conditionType.add(i, annotation[i].condition()); } }</code><technical_language>addAll() work</technical_language>

Target:
public IgnoreConditionCreator(Class<?> aTestClass, ConditionalRun[] annotation) { this.mTestClass = aTestClass; this.conditionTypes = new ArrayList<>(annotation.length); for (int i = 0; i < annotation.length; i++) { this.conditionTypes.add(i, annotation[i].condition()); } }
Source:
<code>private void updateDrawerNavigation() { if (getSupportActionBar() == null) return; final Toolbar toolbar = findViewById(R.id.toolbar); final DrawerLayout drawer = findViewById(R.id.drawer_layout); final Fragment fragment = getSupportFragmentManager().findFragmentById(R.id.fragment_holder); if (fragment instanceof MainFragment) { getSupportActionBar().setDisplayHomeAsUpEnabled(false); if (toggle != null) { toggle.syncState(); toolbar.setNavigationOnClickListener(v -> drawer.openDrawer(GravityCompat.START)); drawer.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNDEFINED); } return; } if (fragment instanceof SearchFragment) { getSupportActionBar().setDisplayHomeAsUpEnabled(false); if (toggle != null) { drawer.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED); <START> getSupportActionBar().setDisplayHomeAsUpEnabled(true); <END> toolbar.setNavigationOnClickListener(v -> onHomeButtonPressed()); } return; } }</code><technical_language>Question: setting HomeAsUpEnabled false true</technical_language>

Target:
private void updateDrawerNavigation() { if (getSupportActionBar() == null) return; final Toolbar toolbar = findViewById(R.id.toolbar); final DrawerLayout drawer = findViewById(R.id.drawer_layout); final Fragment fragment = getSupportFragmentManager().findFragmentById(R.id.fragment_holder); if (fragment instanceof SearchFragment) { if (toggle != null) { drawer.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED); getSupportActionBar().setDisplayHomeAsUpEnabled(true); toolbar.setNavigationOnClickListener(v -> onHomeButtonPressed()); return; } } else { if (toggle != null) { getSupportActionBar().setDisplayHomeAsUpEnabled(false); toggle.syncState(); toolbar.setNavigationOnClickListener(v -> drawer.openDrawer(GravityCompat.START)); drawer.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNDEFINED); } return; } }
Source:
<code>public void rewind() throws IOException { super.rewind(); for (int i=size-1;i>=0;i--) { File fi = getNumberedFileName(i); if (fi.exists()) { File next = getNumberedFileName(i+1); if (!next.delete()){ <START> throw new IOException(String.format("Could not delete %s", next.getAbsolutePath())); <END> } fi.renameTo(next); } } }</code><technical_language>do this behaviour is right</technical_language>

Target:
public void rewind() throws IOException { super.rewind(); for (int i=size-1;i>=0;i--) { File fi = getNumberedFileName(i); if (fi.exists()) { File next = getNumberedFileName(i+1); next.delete(); fi.renameTo(next); } } }