auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void handle(@Nonnull CorfuPayloadMsg<OrchestratorMsg> msg, @Nonnull ChannelHandlerContext ctx, @Nonnull IServerRouter r) { OrchestratorMsg orchReq = msg.getPayload(); IWorkflow workflow; switch (orchReq.getRequest().getType()) { case QUERY: query(msg, ctx, r); break; case ADD_NODE: workflow = new AddNodeWorkflow((AddNodeRequest) orchReq.getRequest(), streamLog); dispatch(workflow, msg, ctx, r); break; case REMOVE_NODE: workflow = new RemoveNodeWorkflow((RemoveNodeRequest) orchReq.getRequest()); dispatch(workflow, msg, ctx, r); break; case HEAL_NODE: workflow = new HealNodeWorkflow((HealNodeRequest) orchReq.getRequest(), streamLog); dispatch(workflow, msg, ctx, r); <START> break; <END> case FORCE_REMOVE_NODE: workflow = new ForceRemoveWorkflow((ForceRemoveNodeRequest) orchReq.getRequest()); dispatch(workflow, msg, ctx, r); break; case RESTORE_REDUNDANCY_MERGE_SEGMENTS: workflow = new RestoreRedundancyMergeSegmentsWorkflow( (RestoreRedundancyMergeSegmentsRequest) orchReq.getRequest(), streamLog); dispatch(workflow, msg, ctx, r); break; default: log.error("handle: Unknown request type {}", orchReq.getRequest().getType()); } }</code><technical_language>I this necessary. conflate HEAL_NODE, differ in layout changes, small worth a code path. I cleaner HealNodeToLayout idempotent</technical_language>

Target:
public void handle(@Nonnull CorfuPayloadMsg<OrchestratorMsg> msg, @Nonnull ChannelHandlerContext ctx, @Nonnull IServerRouter r) { OrchestratorMsg orchReq = msg.getPayload(); IWorkflow workflow; switch (orchReq.getRequest().getType()) { case QUERY: query(msg, ctx, r); break; case ADD_NODE: workflow = new AddNodeWorkflow((AddNodeRequest) orchReq.getRequest()); dispatch(workflow, msg, ctx, r); break; case REMOVE_NODE: workflow = new RemoveNodeWorkflow((RemoveNodeRequest) orchReq.getRequest()); dispatch(workflow, msg, ctx, r); break; case HEAL_NODE: workflow = new HealNodeWorkflow((HealNodeRequest) orchReq.getRequest()); dispatch(workflow, msg, ctx, r); break; case FORCE_REMOVE_NODE: workflow = new ForceRemoveWorkflow((ForceRemoveNodeRequest) orchReq.getRequest()); dispatch(workflow, msg, ctx, r); break; case RESTORE_REDUNDANCY_MERGE_SEGMENTS: workflow = new RestoreRedundancyMergeSegmentsWorkflow( (RestoreRedundancyMergeSegmentsRequest) orchReq.getRequest()); dispatch(workflow, msg, ctx, r); break; default: log.error("handle: Unknown request type {}", orchReq.getRequest().getType()); } }
Source:
<code>public boolean isValidInput() { boolean isValidInput = super.isValidInput(); if(isValidInput){ if(!InputValidationUtil.isValidEmail(getCurrentValue().getAsString())){ handleError(getView().getResources().getString(R.string.error_invalid_email)); return false; } } return true; <START> } <END></code><technical_language>Logically incorrect, if super returns <code>false</code>, this logic return <code>true</code>. validation first, return <code>false</code> if validation fails, return <code>super.isValidInput()</code></technical_language>

Target:
public boolean isValidInput() { boolean isValidInput = super.isValidInput(); if(isValidInput){ if(!InputValidationUtil.isValidEmail(getCurrentValue().getAsString())){ handleError(getView().getResources().getString(R.string.error_invalid_email)); isValidInput = false; } } return isValidInput; }
Source:
<code>public void copy(RenderableElement other) { <START> this.texture = other.texture; this.drawableLevel = other.drawableLevel; this.relativePosition = other.relativePosition.cpy(); this.relativeAngle = other.relativeAngle; this.width = other.width; this.height = other.height; this.tint = other.tint; <END> }</code><technical_language>Recheck some of please. In Java, non-primitives references, lines making deep copies do .cpy() done for relativePosition. width, height, relativeAngle relativePosition deep copies this code. texture, drawableLevel, tint clone() methods</technical_language>

Target:
public void copy(RenderableElement other) { this.texture = new TextureAtlas.AtlasRegion(other.texture); this.drawableLevel = other.drawableLevel; this.relativePosition = other.relativePosition.cpy(); this.relativeAngle = other.relativeAngle; this.width = other.width; this.height = other.height; this.tint = other.tint.cpy(); }
Source:
<code>private void reloadOnce() throws IOException { Map<String, ReftableReader> current = stack.stream() .collect(Collectors.toMap(e -> e.name, e -> e.reftableReader)); stack.clear(); ReftableReader last = null; try (BufferedReader br = new BufferedReader( new InputStreamReader(new FileInputStream(stackPath), UTF_8))) { String line; while ((line = br.readLine()) != null) { StackEntry entry = new StackEntry(); entry.name = line; if (current.containsKey(line)) { entry.reftableReader = current.remove(line); } else { File subtable = new File(reftableDir, line); FileInputStream is; try { is = new FileInputStream(subtable); } catch (FileNotFoundException e) { throw new RetryException(); } entry.reftableReader = new ReftableReader( BlockSource.from(is)); } if (last != null) { if (last.maxUpdateIndex() >= entry.reftableReader .minUpdateIndex()) { throw new IllegalStateException(String.format( <START> "index numbers not increasing %s: min %d, last max %d", <END> line, entry.reftableReader.minUpdateIndex(), last.maxUpdateIndex())); } } last = entry.reftableReader; stack.add(entry); } } catch (FileNotFoundException e) { } catch (Exception e) { close(); throw e; } finally { current.values().forEach(r -> { try { r.close(); } catch (IOException e) { } }); } }</code><technical_language>externalize error message</technical_language>

Target:
private void reloadOnce() throws IOException { Map<String, ReftableReader> current = stack.stream() .collect(Collectors.toMap(e -> e.name, e -> e.reftableReader)); stack.clear(); ReftableReader last = null; try (BufferedReader br = new BufferedReader( new InputStreamReader(new FileInputStream(stackPath), UTF_8))) { String line; while ((line = br.readLine()) != null) { StackEntry entry = new StackEntry(); entry.name = line; if (current.containsKey(line)) { entry.reftableReader = current.remove(line); } else { File subtable = new File(reftableDir, line); FileInputStream is; try { is = new FileInputStream(subtable); } catch (FileNotFoundException e) { throw new RetryException(); } entry.reftableReader = new ReftableReader( BlockSource.from(is)); } if (last != null) { if (last.maxUpdateIndex() >= entry.reftableReader .minUpdateIndex()) { throw new IllegalStateException(MessageFormat.format( JGitText.get().indexNumbersNotIncreasing, line, Long.valueOf( entry.reftableReader.minUpdateIndex()), Long.valueOf(last.maxUpdateIndex()))); } } last = entry.reftableReader; stack.add(entry); } } catch (FileNotFoundException e) { } catch (Exception e) { close(); throw e; } finally { current.values().forEach(r -> { try { r.close(); } catch (IOException e) { LOG.error(e.getMessage(), e); } }); } }
Source:
<code>public StoneColumnFamily(BlockFamilyDefinition definition, BlockBuilderHelper blockBuilder) { super(definition, blockBuilder); blocks = new TByteObjectHashMap<Block>(); blockUri = new BlockUri(definition.getUrn()); registerBlock(blockUri, definition, blockBuilder,"standby", (byte) 0 , Collections.singleton(Rotation.none())); registerBlock(blockUri, definition, blockBuilder,"bottom", SideBitFlag.getSide(Side.TOP) , Collections.singleton(Rotation.none())); registerBlock(blockUri, definition, blockBuilder,"top", SideBitFlag.getSide(Side.BOTTOM) , Collections.singleton(Rotation.none())); registerBlock(blockUri, definition, blockBuilder,"middle", SideBitFlag.getSides(Side.TOP, Side.BOTTOM) , Collections.singleton(Rotation.none())); <START> <END> this.setCategory(definition.getCategories()); }</code><technical_language>remove extra spaces</technical_language>

Target:
public StoneColumnFamily(BlockFamilyDefinition definition, BlockBuilderHelper blockBuilder) { super(definition, blockBuilder); BlockUri blockUri; blocks = new TByteObjectHashMap<Block>(); blockUri = new BlockUri(definition.getUrn()); registerBlock(blockUri, definition, blockBuilder,"standby", (byte) 0 , Collections.singleton(Rotation.none())); registerBlock(blockUri, definition, blockBuilder,"bottom", SideBitFlag.getSide(Side.TOP) , Collections.singleton(Rotation.none())); registerBlock(blockUri, definition, blockBuilder,"top", SideBitFlag.getSide(Side.BOTTOM) , Collections.singleton(Rotation.none())); registerBlock(blockUri, definition, blockBuilder,"middle", getSides(Side.TOP, Side.BOTTOM) , Collections.singleton(Rotation.none())); this.setCategory(definition.getCategories()); }
Source:
<code>public void setup() { metadata = getQueryRunner().getMetadata(); builder = new PlanBuilder(new PlanNodeIdAllocator(), metadata); ConnectorId connectorId = getCurrentConnectorId(); TableHandle nationTableHandle = new TableHandle( connectorId, new TpchTableHandle("nation", 1.0), TestingTransactionHandle.create(), <START> Optional.of(TestingHandle.INSTANCE)); <END> TableLayoutHandle nationTableLayoutHandle = new TableLayoutHandle(connectorId, TestingTransactionHandle.create(), new TpchTableLayoutHandle((TpchTableHandle) nationTableHandle.getConnectorHandle(), TupleDomain.all())); TpchColumnHandle nationkeyColumnHandle = new TpchColumnHandle("nationkey", BIGINT); symbol = new Symbol("nationkey"); tableScanNode = builder.tableScan(nationTableHandle, ImmutableList.of(symbol), ImmutableMap.of(symbol, nationkeyColumnHandle), Optional.of(nationTableLayoutHandle)); }</code><technical_language>discussion :)</technical_language>

Target:
public void setup() { metadata = getQueryRunner().getMetadata(); builder = new PlanBuilder(new PlanNodeIdAllocator(), metadata); ConnectorId connectorId = getCurrentConnectorId(); TpchTableHandle nationTpchTableHandle = new TpchTableHandle("nation", 1.0); TableHandle nationTableHandle = new TableHandle( connectorId, nationTpchTableHandle, TestingTransactionHandle.create(), Optional.of(new TpchTableLayoutHandle(nationTpchTableHandle, TupleDomain.all()))); TpchColumnHandle nationkeyColumnHandle = new TpchColumnHandle("nationkey", BIGINT); symbol = new Symbol("nationkey"); tableScanNode = builder.tableScan(nationTableHandle, ImmutableList.of(symbol), ImmutableMap.of(symbol, nationkeyColumnHandle)); }
Source:
<code>public static ActivitiMessageEvent createMessageEvent(ActivitiEventType type, DelegateExecution execution, <START> String messageName, <END> String correlationKey, Object payload) { ActivitiMessageEventImpl newEvent = new ActivitiMessageEventImpl(type); newEvent.setMessageName(messageName); newEvent.setMessageCorrelationKey(correlationKey); newEvent.setMessageData(payload); if (execution != null) { newEvent.setActivityId(execution.getCurrentActivityId()); newEvent.setExecutionId(execution.getId()); newEvent.setProcessDefinitionId(execution.getProcessDefinitionId()); newEvent.setProcessInstanceId(execution.getProcessInstanceId()); newEvent.setMessageBusinessKey(execution.getProcessInstanceBusinessKey()); if (execution.getCurrentFlowElement() instanceof FlowNode) { FlowNode flowNode = (FlowNode) execution.getCurrentFlowElement(); newEvent.setActivityType(parseActivityType(flowNode)); newEvent.setBehaviorClass(parseActivityBehavior(flowNode)); newEvent.setActivityName(flowNode.getName()); } } return newEvent; }</code><technical_language>wrap latest parameters a class reduce amount of parameters for this method? this method (that takes ActivitiEventType parameter) private create explicit methods (createMessageReceivedEvent, createMessageWaitingEvent createMessageSentEvent)</technical_language>

Target:
private static ActivitiMessageEvent createMessageEvent(ActivitiEventType type, DelegateExecution execution, String messageName, String correlationKey, Object payload) { ActivitiMessageEventImpl newEvent = new ActivitiMessageEventImpl(type); newEvent.setMessageName(messageName); newEvent.setMessageCorrelationKey(correlationKey); newEvent.setMessageData(payload); if (execution != null) { newEvent.setActivityId(execution.getCurrentActivityId()); newEvent.setExecutionId(execution.getId()); newEvent.setProcessDefinitionId(execution.getProcessDefinitionId()); newEvent.setProcessInstanceId(execution.getProcessInstanceId()); newEvent.setMessageBusinessKey(execution.getProcessInstanceBusinessKey()); if (execution.getCurrentFlowElement() instanceof FlowNode) { FlowNode flowNode = (FlowNode) execution.getCurrentFlowElement(); newEvent.setActivityType(parseActivityType(flowNode)); newEvent.setBehaviorClass(parseActivityBehavior(flowNode)); newEvent.setActivityName(flowNode.getName()); } } return newEvent; }
Source:
<code>public void addText(String text) { <START> if (text == null) { <END> return; } List<String> paragraphs = Arrays.asList(text.split("\\r?\\n", -1)); for (String paragraph : paragraphs) { String remainder = paragraph; while (remainder != null && !remainder.isEmpty()) { String[] split = remainder.split(" ", 2); String word = split[0]; if (split.length > 1) { remainder = split[1]; } else { remainder = null; } addWord(word); } if (remainder != null) { addWord(remainder); } endLine(); } }</code><technical_language>Suggest replace precondition. Null added - is a bug handled of this</technical_language>

Target:
public void addText(String text) { List<String> paragraphs = Arrays.asList(text.split("\\r?\\n", -1)); for (String paragraph : paragraphs) { String remainder = paragraph; while (remainder != null && !remainder.isEmpty()) { String[] split = remainder.split(" ", 2); String word = split[0]; if (split.length > 1) { remainder = split[1]; } else { remainder = null; } addWord(word); } if (remainder != null) { addWord(remainder); } endLine(); } }
Source:
<code>protected void registerMockEntryForRead(long ledgerId, long entryId, BookieSocketAddress bookieSocketAddress, byte[] entryData, long lastAddConfirmed) throws BKException{ if (failedBookies.contains(bookieSocketAddress)) { <START> throw BKException.create(NoBookieAvailableException); <END> } getMockLedgerContentsInBookie(ledgerId, bookieSocketAddress).put(entryId, new MockEntry(entryData, lastAddConfirmed)); }</code><technical_language>This is error, this is a mock setup method, is business logic, reading/writing this point. error manifests line 396 is correct behaviour. I this simply drop this 'if' block remove 'throws' clause</technical_language>

Target:
protected void registerMockEntryForRead(long ledgerId, long entryId, BookieSocketAddress bookieSocketAddress, byte[] entryData, long lastAddConfirmed) { getMockLedgerContentsInBookie(ledgerId, bookieSocketAddress).put(entryId, new MockEntry(entryData, lastAddConfirmed)); }
Source:
<code>public List<VmNumaNode> getVmNumaNodes(VM vm) { int numOfVmCpus = vm.getNumOfCpus(); int vcpus = FeatureSupported.supportedInConfig(ConfigValues.HotPlugCpuSupported, vm.getCompatibilityVersion(), vm.getClusterArch()) ? VmCpuCountHelper.calcMaxVCpu(vm, vm.getClusterCompatibilityVersion()) : numOfVmCpus; List<VmNumaNode> vmNumaNodes = vmNumaNodeDao.getAllVmNumaNodeByVmId(vm.getId()); if (!vmNumaNodes.isEmpty()) { if (vcpus != numOfVmCpus) { int numaCount = vmNumaNodes.size(); int index = -1; <START> for (VmNumaNode vmNode : vmNumaNodes) { <END> for (Integer cpuId : vmNode.getCpuIds()) { if (index < cpuId) { index = cpuId; } } } for (VmNumaNode vmNode : vmNumaNodes) { if (numaCount <= 0) { break; } for (int i = vmNode.getCpuIds().size(); i < vcpus / numaCount; i++) { vmNode.getCpuIds().add(++index); } vcpus -= vcpus / numaCount; --numaCount; } } return vmNumaNodes; } if (FeatureSupported.hotPlugMemory(vm.getCompatibilityVersion(), vm.getClusterArch())) { VmNumaNode vmNode = new VmNumaNode(); vmNode.setIndex(0); vmNode.setMemTotal(vm.getMemSizeMb()); for (int i = 0; i < vcpus; i++) { vmNode.getCpuIds().add(i); } return Collections.singletonList(vmNode); } return Collections.emptyList(); }</code><technical_language>point is "inflate" numa node size automatically here. point is "honor" sizes roughly, defined user. adding equal amount good enough. big big, small get bigger, smaller big one:)</technical_language>

Target:
public List<VmNumaNode> getVmNumaNodes(VM vm) { int numOfVmCpus = vm.getNumOfCpus(); int vcpus = FeatureSupported.supportedInConfig(ConfigValues.HotPlugCpuSupported, vm.getCompatibilityVersion(), vm.getClusterArch()) ? VmCpuCountHelper.calcMaxVCpu(vm, vm.getClusterCompatibilityVersion()) : numOfVmCpus; int offlineCpus = vcpus - numOfVmCpus; List<VmNumaNode> vmNumaNodes = vmNumaNodeDao.getAllVmNumaNodeByVmId(vm.getId()); if (!vmNumaNodes.isEmpty()) { if (offlineCpus > 0) { int numaCount = vmNumaNodes.size(); int index = numOfVmCpus; for (VmNumaNode vmNode : vmNumaNodes) { if (numaCount <= 0) { break; } for (int i = vmNode.getCpuIds().size(); i < vcpus / numaCount; i++) { vmNode.getCpuIds().add(index++); } vcpus -= vcpus / numaCount; --numaCount; } } return vmNumaNodes; } if (offlineCpus > 0) { VmNumaNode vmNode = new VmNumaNode(); vmNode.setIndex(0); vmNode.setMemTotal(vm.getMemSizeMb()); for (int i = 0; i < vcpus; i++) { vmNode.getCpuIds().add(i); } return Collections.singletonList(vmNode); } return Collections.emptyList(); }
Source:
<code>public boolean matchesFilter(@Nullable FluidStack fluidStack) { <START> if (fluidStack == null) { <END> return filter == null || filter.get() == null; } if (filter != null) { return Conditions.check(filter.get(), fluidStack, Fluids::areEqual); } return true; }</code><technical_language>need able set tank contents null</technical_language>

Target:
public boolean matchesFilter(@Nullable FluidStack fluidStack) { if (fluidStack == null) return true; if (filter != null) { return Conditions.check(filter.get(), fluidStack, Fluids::areEqual); } return true; }
Source:
<code>public void freeId( long id ) { if ( freeIdCondition.getAsBoolean() ) { idContainer.freeId( id ); <START> } <END> }</code><technical_language>Do a feel for probability of here, condition is false</technical_language>

Target:
public synchronized void freeId( long id ) { idContainer.freeId( id ); }
Source:
<code>public void loadLocale(final LOCALE locale) { Map<String, String> results = null; if (I18N_CUSTOM_DIR != null) { results = loadLocale(locale, FileUtils.listDir(I18N_CUSTOM_DIR)); } <START> if (results == null || results.isEmpty()) { <END> results = loadLocale(getStreams(locale)); } setLocale(locale, results); }</code><technical_language>this support fact add new language modify some file, files custom directory complete/overwrite files classpath</technical_language>

Target:
public void loadLocale(final LOCALE locale) { Map<String, String> results = loadLocale(getStreams(locale)); if (I18N_CUSTOM_DIR != null) { results.putAll(loadLocale(locale, FileUtils.listDir(I18N_CUSTOM_DIR))); } setLocale(locale, results); }
Source:
<code>public String getServiceAddress() { <START> return "<LINK_0>"; <END> }</code><technical_language>hardcoded</technical_language>

Target:
public String getServiceAddress() { return new CacheManager(null).ServiceAddress; }
Source:
<code>public void onQueueClosed() { if (!queueVisible) return; <START> animateView(queueLayout, SLIDE_AND_ALPHA, false, <END> DEFAULT_CONTROLS_DURATION, 0, () -> { queueLayout.setTranslationY(-queueLayout.getHeight() * 5); }); queueVisible = false; }</code><technical_language>suggestion animateView(queueLayout, SLIDE_AND_ALPHA, false,</technical_language>

Target:
public void onQueueClosed() { if (!queueVisible) { return; } animateView(queueLayout, SLIDE_AND_ALPHA, false, DEFAULT_CONTROLS_DURATION, 0, () -> { queueLayout.setTranslationY(-queueLayout.getHeight() * 5); }); queueVisible = false; playPauseButton.requestFocus(); }
Source:
<code>public static Framework getFramework(Configuration jobConf) { if (jobConf.get(Constants.PIG_CONF_KEY) != null) { return Framework.PIG; } if ((jobConf.get(Constants.CASCADING_FLOW_ID_CONF_KEY) != null) && (jobConf.get(Constants.CASCADING_FLOW_ID_CONF_KEY).length() != 0)) { return Framework.SCALDING; } <START> if ((jobConf.get(Constants.FRAMEWORK_CONF_KEY) != null) <END> && (Constants.FRAMEWORK_CONF_SPARK_VALUE .equalsIgnoreCase(jobConf.get(Constants.FRAMEWORK_CONF_KEY)))) { return Framework.SPARK; } return Framework.NONE; }</code><technical_language>This null check is necessary, String.equalsIgnoreCase() checks for null returns false if is false</technical_language>

Target:
public static Framework getFramework(Configuration jobConf) { if (jobConf.get(Constants.PIG_CONF_KEY) != null) { return Framework.PIG; } if ((jobConf.get(Constants.CASCADING_FLOW_ID_CONF_KEY) != null) && (jobConf.get(Constants.CASCADING_FLOW_ID_CONF_KEY).length() != 0)) { return Framework.SCALDING; } if (Constants.FRAMEWORK_CONF_SPARK_VALUE .equalsIgnoreCase(jobConf.get(Constants.FRAMEWORK_CONF_KEY))) { return Framework.SPARK; } return Framework.NONE; }
Source:
<code>RealmAsyncTask logOutAsync(RealmUser user, Callback<RealmUser> callback) { checkLooperThread("Asynchronous log out is only possible from looper threads."); return new Request<RealmUser>(SyncManager.NETWORK_POOL_EXECUTOR, callback) { @Override public RealmUser run() throws ObjectServerError { <START> RealmLog.error("Log out user"); <END> logOut(user); return user; } }.start(); }</code><technical_language>suggestion RealmLog.info("Log out user " + user.getEmail());</technical_language>

Target:
RealmAsyncTask logOutAsync(RealmUser user, Callback<RealmUser> callback) { checkLooperThread("Asynchronous log out is only possible from looper threads."); return new Request<RealmUser>(SyncManager.NETWORK_POOL_EXECUTOR, callback) { @Override public RealmUser run() throws ObjectServerError { logOut(user); return user; } }.start(); }
Source:
<code>static UserDTO createInstance(User userEntity) { if (userEntity == null) { <START> return null; <END> } return new UserDTO(userEntity.getID(), userEntity.getFirstName(), userEntity.getLastName(), userEntity.getMobileNumber(), userEntity.isMobileNumberConfirmed()); }</code><technical_language>fix this level of caller? a weird contract pass a null a createInstance method get null back</technical_language>

Target:
static UserDTO createInstance(User userEntity) { if (userEntity == null) { throw new IllegalArgumentException("userEntity cannot be null"); } return new UserDTO(userEntity.getID(), userEntity.getFirstName(), userEntity.getLastName(), userEntity.getMobileNumber(), userEntity.isMobileNumberConfirmed()); }
Source:
<code>public PingThread(Channel channel, long timeout, long interval) { <START> this(channel, 4*60*1000 , interval, false); <END> }</code><technical_language>bug: this pass timeout supplied replace else..</technical_language>

Target:
public PingThread(Channel channel, long timeout, long interval) { super("Ping thread for channel "+channel); this.channel = channel; this.timeout = timeout; this.interval = interval; setDaemon(true); }
Source:
<code>protected void autonomousMain() throws AutonomousModeOverException, InterruptedException { Elevator.setBottom.event(); waitUntil(Elevator.atBottom); Rollers.open.set(true); Rollers.direction.set(false); Rollers.running.set(true); waitUntil(BooleanMixing.invert(AutoLoader.crateInPosition)); waitForTime(timeout); Rollers.running.set(false); <START> running.set(false); <END> }</code><technical_language>this issue if this get called - for example, if some error occurs? able start AutoEjector again..</technical_language>

Target:
protected void autonomousMain() throws AutonomousModeOverException, InterruptedException { try { Elevator.setBottom.event(); waitUntil(Elevator.atBottom); Rollers.open.set(true); Rollers.direction.set(false); Rollers.running.set(true); waitUntil(BooleanMixing.invert(AutoLoader.crateInPosition)); waitForTime(timeout); Rollers.running.set(false); } finally { running.set(false); } }
Source:
<code><START> public static KeyBuilder.RowStep builder() { <END> return new KeyBuilder.AbstractKeyBuilder(true); }</code><technical_language>Need add @since tags new methods in Key</technical_language>

Target:
public static KeyBuilder.RowStep builder() { return new KeyBuilder.KeyBuilderImpl(true); }
Source:
<code>public Bullet(int id, TranslatedPoint position, double radius, Vector2 velocity, int damage, Type type, Image image, int ownerId) { super(id); this.ownerId = ownerId; this.type = type; this.damage = damage; this.setBody(new Body(this, position, radius, radius, BODYTYPE)); this.setPhysics(new Physics(this, velocity.getMagnitude())); getPhysics().setVelocity(velocity); this.view = new View(this, image); lifeTime = 5; new Thread(() -> { timer = new Timer(); timer.start(); while ((timer.getDuration() < 1000 * lifeTime)) { try { Thread.sleep(20); } catch (Exception e) { e.printStackTrace(); } } <START> notifyObservers(Observation.EXTERMINATION); <END> }).start(); ; }</code><technical_language>call destroy instead</technical_language>

Target:
public Bullet(int id, TranslatedPoint position, double radius, Vector2 velocity, int damage, Type type, Image image, int ownerId) { super(id); this.ownerId = ownerId; this.type = type; this.damage = damage; this.setBody(new Body(this, position, radius, radius, BODYTYPE)); this.setPhysics(new Physics(this, velocity.getMagnitude())); getPhysics().setVelocity(velocity); this.view = new View(this, image); lifeTime = 5; new Thread(() -> { timer = new Timer(); timer.start(); while ((timer.getDuration() < 1000 * lifeTime)) { try { Thread.sleep(20); } catch (Exception e) { e.printStackTrace(); } } destroy(); }).start(); ; }
Source:
<code>protected void run() { try (Git git = new Git(db)) { <START> if (null == command) { <END> RemoteListCommand cmd = git.remoteList(); List<RemoteConfig> remotes = cmd.call(); print(remotes); } else switch (command) { case "add": { RemoteAddCommand cmd = git.remoteAdd(); cmd.setName(name); cmd.setUri(new URIish(uri)); cmd.call(); break; } case "remove": case "rm": { RemoteRemoveCommand cmd = git.remoteRemove(); cmd.setRemoteName(name); cmd.call(); break; } case "set-url": { RemoteSetUrlCommand cmd = git.remoteSetUrl(); cmd.setRemoteName(name); cmd.setRemoteUri(new URIish(uri)); cmd.setUriType(push ? UriType.PUSH : UriType.FETCH); cmd.call(); break; } case "update": Fetch fetch = new Fetch(); fetch.init(db, gitdir); StringWriter osw = new StringWriter(); fetch.outw = new ThrowingPrintWriter(osw); StringWriter esw = new StringWriter(); fetch.errw = new ThrowingPrintWriter(esw); List<String> fetchArgs = new ArrayList<>(); if (verbose) { fetchArgs.add("--verbose"); } if (prune) { fetchArgs.add("--prune"); } if (name != null) { fetchArgs.add(name); } fetch.execute(fetchArgs.toArray(new String[0])); fetch.outw.flush(); fetch.errw.flush(); outw.println(osw.toString()); errw.println(esw.toString()); break; default: throw new JGitInternalException(MessageFormat .format(CLIText.get().unknownSubcommand, command)); } } catch (Exception e) { throw die(e.getMessage(), e); } }</code><technical_language>Unnecessary Yoda condition</technical_language>

Target:
protected void run() { try (Git git = new Git(db)) { if (command == null) { RemoteListCommand cmd = git.remoteList(); List<RemoteConfig> remotes = cmd.call(); print(remotes); } else { switch (command) { case "add": { RemoteAddCommand cmd = git.remoteAdd(); cmd.setName(name); cmd.setUri(new URIish(uri)); cmd.call(); break; } case "remove": case "rm": { RemoteRemoveCommand cmd = git.remoteRemove(); cmd.setRemoteName(name); cmd.call(); break; } case "set-url": { RemoteSetUrlCommand cmd = git.remoteSetUrl(); cmd.setRemoteName(name); cmd.setRemoteUri(new URIish(uri)); cmd.setUriType(push ? UriType.PUSH : UriType.FETCH); cmd.call(); break; } case "update": Fetch fetch = new Fetch(); fetch.init(db, gitdir); StringWriter osw = new StringWriter(); fetch.outw = new ThrowingPrintWriter(osw); StringWriter esw = new StringWriter(); fetch.errw = new ThrowingPrintWriter(esw); List<String> fetchArgs = new ArrayList<>(); if (verbose) { fetchArgs.add("--verbose"); } if (prune) { fetchArgs.add("--prune"); } if (name != null) { fetchArgs.add(name); } fetch.execute(fetchArgs.toArray(new String[0])); fetch.outw.flush(); fetch.errw.flush(); outw.println(osw.toString()); errw.println(esw.toString()); break; default: throw new JGitInternalException(MessageFormat .format(CLIText.get().unknownSubcommand, command)); } } } catch (Exception e) { throw die(e.getMessage(), e); } }
Source:
<code>public void buildPolicySchema() throws SAXException { if (!"true".equalsIgnoreCase((String) configHolder.getEngineProperties().get( EntitlementExtensionBuilder.PDP_SCHEMA_VALIDATION))) { log.warn("PDP schema validation disabled."); return; } String[] schemaNSs = new String[]{PDPConstants.XACML_1_POLICY_XMLNS, PDPConstants.XACML_2_POLICY_XMLNS, PDPConstants.XACML_3_POLICY_XMLNS}; for (String schemaNS : schemaNSs) { String schemaFile; if (PDPConstants.XACML_1_POLICY_XMLNS.equals(schemaNS)) { schemaFile = PDPConstants.XACML_1_POLICY_SCHEMA_FILE; } else if (PDPConstants.XACML_2_POLICY_XMLNS.equals(schemaNS)) { schemaFile = PDPConstants.XACML_2_POLICY_SCHEMA_FILE; } else { schemaFile = PDPConstants.XACML_3_POLICY_SCHEMA_FILE; } InputStream schemaFileStream = EntitlementExtensionBuilder.class .getResourceAsStream("/" + schemaFile); SchemaFactory schemaFactory = SchemaFactory .newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); Schema schema = schemaFactory.newSchema(new StreamSource(schemaFileStream)); configHolder.getPolicySchemaMap().put(schemaNS, schema); <START> IdentityIOStreamUtils.closeInputStream(schemaFileStream); <END> } }</code><technical_language>try finally clauses</technical_language>

Target:
public void buildPolicySchema() throws SAXException { if (!"true".equalsIgnoreCase((String) configHolder.getEngineProperties().get( EntitlementExtensionBuilder.PDP_SCHEMA_VALIDATION))) { log.warn("PDP schema validation disabled."); return; } String[] schemaNSs = new String[]{PDPConstants.XACML_1_POLICY_XMLNS, PDPConstants.XACML_2_POLICY_XMLNS, PDPConstants.XACML_3_POLICY_XMLNS}; for (String schemaNS : schemaNSs) { String schemaFile; if (PDPConstants.XACML_1_POLICY_XMLNS.equals(schemaNS)) { schemaFile = PDPConstants.XACML_1_POLICY_SCHEMA_FILE; } else if (PDPConstants.XACML_2_POLICY_XMLNS.equals(schemaNS)) { schemaFile = PDPConstants.XACML_2_POLICY_SCHEMA_FILE; } else { schemaFile = PDPConstants.XACML_3_POLICY_SCHEMA_FILE; } InputStream schemaFileStream = EntitlementExtensionBuilder.class.getResourceAsStream("/" + schemaFile); try{ SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); Schema schema = schemaFactory.newSchema(new StreamSource(schemaFileStream)); configHolder.getPolicySchemaMap().put(schemaNS, schema); } finally { IdentityIOStreamUtils.closeInputStream(schemaFileStream); } } }
Source:
<code>private Contentlet getContentlet(final UrlMapContext urlMapContext) throws DotSecurityException { Contentlet matchingContentlet = null; try { final List<Matches> matchesFound = this.findMatch(urlMapContext.getUri()); if (!matchesFound.isEmpty()) { <START> for (Matches matches : matchesFound) { <END> final Structure structure = CacheLocator.getContentTypeCache() .getStructureByInode(matches.getPatternChange().getStructureInode()); final Field hostField = this.findHostField(structure); matchingContentlet = this .getContentlet(matches, structure, hostField, urlMapContext); if (null != matchingContentlet) { break; } } } } catch (DotDataException e) { Logger.error(this.getClass(), String.format("Error processing URL [%s]", urlMapContext.getUri()), e); return null; } return matchingContentlet; }</code><technical_language>set final</technical_language>

Target:
private Contentlet getContentlet(final UrlMapContext urlMapContext) throws DotSecurityException { Contentlet matchingContentlet = null; try { final List<Matches> matchesFound = this.findMatch(urlMapContext.getUri()); if (!matchesFound.isEmpty()) { for (final Matches matches : matchesFound) { final Structure structure = CacheLocator.getContentTypeCache() .getStructureByInode(matches.getPatternChange().getStructureInode()); final Field hostField = this.findHostField(structure); matchingContentlet = this .getContentlet(matches, structure, hostField, urlMapContext); if (null != matchingContentlet) { break; } } } } catch (DotDataException e) { Logger.error(this.getClass(), String.format("Error processing URL [%s]", urlMapContext.getUri()), e); return null; } return matchingContentlet; }
Source:
<code>public void withoutSSLVerification() throws InterruptedException { String username = UUID.randomUUID().toString(); String password = "password"; SyncUser user = SyncUser.login(SyncCredentials.usernamePassword(username, password, true), Constants.AUTH_URL); final SyncConfiguration configOld = configurationFactory.createSyncConfigurationBuilder(user, Constants.USER_REALM) .schema(StringOnly.class) .build(); Realm realm = Realm.getInstance(configOld); realm.beginTransaction(); realm.createObject(StringOnly.class).setChars("Foo"); realm.commitTransaction(); SystemClock.sleep(TimeUnit.SECONDS.toMillis(2)); realm.close(); user.logout(); Realm.deleteRealm(configOld); user = SyncUser.login(SyncCredentials.usernamePassword(username, password), Constants.AUTH_URL); <START> SyncConfiguration config = new SyncConfiguration.Builder(user, Constants.USER_REALM_SECURE) <END> .schema(StringOnly.class) .waitForInitialRemoteData() .disableSSLVerification() .build(); realm = Realm.getInstance(config); RealmResults<StringOnly> all = realm.where(StringOnly.class).findAll(); try { assertEquals(1, all.size()); assertEquals("Foo", all.get(0).getChars()); } finally { realm.close(); } }</code><technical_language>configurationFactory.createSyncConfigurationBuilder here</technical_language>

Target:
public void withoutSSLVerification() throws InterruptedException { String username = UUID.randomUUID().toString(); String password = "password"; SyncUser user = SyncUser.login(SyncCredentials.usernamePassword(username, password, true), Constants.AUTH_URL); final SyncConfiguration configOld = configurationFactory.createSyncConfigurationBuilder(user, Constants.USER_REALM) .schema(StringOnly.class) .build(); Realm realm = Realm.getInstance(configOld); realm.beginTransaction(); realm.createObject(StringOnly.class).setChars("Foo"); realm.commitTransaction(); SystemClock.sleep(TimeUnit.SECONDS.toMillis(2)); realm.close(); user.logout(); Realm.deleteRealm(configOld); user = SyncUser.login(SyncCredentials.usernamePassword(username, password), Constants.AUTH_URL); SyncConfiguration config = configurationFactory.createSyncConfigurationBuilder(user, Constants.USER_REALM_SECURE) .schema(StringOnly.class) .waitForInitialRemoteData() .disableSSLVerification() .build(); realm = Realm.getInstance(config); RealmResults<StringOnly> all = realm.where(StringOnly.class).findAll(); try { assertEquals(1, all.size()); assertEquals("Foo", all.get(0).getChars()); } finally { realm.close(); } }
Source:
<code>private void forceCloseContainer(final ContainerInfo container, final Set<ContainerReplica> replicas) { Preconditions.assertTrue(container.getState() == LifeCycleState.QUASI_CLOSED); final int replicationFactor = container.getReplicationFactor().getNumber(); final List<ContainerReplica> quasiClosedReplicas = replicas.stream() .filter(r -> r.getState() == State.QUASI_CLOSED) .collect(Collectors.toList()); <START> final long uniqueQuasiClosedReplicaCount = quasiClosedReplicas <END> .stream() .map(ContainerReplica::getOriginDatanodeId) .distinct() .count(); if (uniqueQuasiClosedReplicaCount > (replicationFactor / 2)) { final Long sequenceId = quasiClosedReplicas.stream() .map(ContainerReplica::getSequenceId) .max(Long::compare) .orElse(-1L); quasiClosedReplicas.stream() .filter(r -> sequenceId != -1L) .filter(replica -> replica.getSequenceId().equals(sequenceId)) .forEach(replica -> sendCloseCommand( container, replica.getDatanodeDetails(), true)); } }</code><technical_language>do distinct origin datanode Id. map(ContainerReplica::getOriginDatanodeId) return a stream of OriginDatanodeId do distinct it</technical_language>

Target:
private void forceCloseContainer(final ContainerInfo container, final Set<ContainerReplica> replicas) { Preconditions.assertTrue(container.getState() == LifeCycleState.QUASI_CLOSED); final List<ContainerReplica> quasiClosedReplicas = replicas.stream() .filter(r -> r.getState() == State.QUASI_CLOSED) .collect(Collectors.toList()); final Long sequenceId = quasiClosedReplicas.stream() .map(ContainerReplica::getSequenceId) .max(Long::compare) .orElse(-1L); LOG.info("Force closing container with BCSID {}," + " which is in QUASI_CLOSED state.", container.containerID(), sequenceId); quasiClosedReplicas.stream() .filter(r -> sequenceId != -1L) .filter(replica -> replica.getSequenceId().equals(sequenceId)) .forEach(replica -> sendCloseCommand( container, replica.getDatanodeDetails(), true)); }
Source:
<code>public Map<String, ComponentMetrics> get() { Map<String, ComponentMetrics> result = new HashMap<>(); String[] boltComponents = topologyProvider.getBoltNames(); for (String boltComponent : boltComponents) { String[] boltInstanceNames = packingPlanProvider.getBoltInstanceNames(boltComponent); Duration duration = getDuration(BackPressureSensor.class.getSimpleName()); Map<String, InstanceMetrics> instanceMetrics = new HashMap<>(); for (String boltInstanceName : boltInstanceNames) { String metric = this.metricName + boltInstanceName; Map<String, ComponentMetrics> stmgrResult = metricsProvider.getComponentMetrics( metric, duration, COMPONENT_STMGR); HashMap<String, InstanceMetrics> streamManagerResult = stmgrResult.get(COMPONENT_STMGR).getMetrics(); InstanceMetrics stmgrInstanceResult = streamManagerResult.values().iterator().next(); double averageBp = stmgrInstanceResult.getMetricValueSum(metric) / duration.getSeconds(); <START> averageBp = averageBp > 1000 ? 1000 : averageBp; <END> InstanceMetrics boltInstanceMetric = new InstanceMetrics(boltInstanceName, this.metricName, averageBp); instanceMetrics.put(boltInstanceName, boltInstanceMetric); } ComponentMetrics componentMetrics = new ComponentMetrics(boltComponent, instanceMetrics); result.put(boltComponent, componentMetrics); } return result; }</code><technical_language>clarify 1000 is chosen cap</technical_language>

Target:
public Map<String, ComponentMetrics> get() { Map<String, ComponentMetrics> result = new HashMap<>(); String[] boltComponents = topologyProvider.getBoltNames(); for (String boltComponent : boltComponents) { String[] boltInstanceNames = packingPlanProvider.getBoltInstanceNames(boltComponent); Duration duration = getDuration(); Map<String, InstanceMetrics> instanceMetrics = new HashMap<>(); for (String boltInstanceName : boltInstanceNames) { String metric = getMetricName() + boltInstanceName; Map<String, ComponentMetrics> stmgrResult = metricsProvider.getComponentMetrics( metric, duration, COMPONENT_STMGR); HashMap<String, InstanceMetrics> streamManagerResult = stmgrResult.get(COMPONENT_STMGR).getMetrics(); InstanceMetrics stmgrInstanceResult = streamManagerResult.values().iterator().next(); double averageBp = stmgrInstanceResult.getMetricValueSum(metric) / duration.getSeconds(); averageBp = averageBp > 1000 ? 1000 : averageBp; InstanceMetrics boltInstanceMetric = new InstanceMetrics(boltInstanceName, getMetricName(), averageBp); instanceMetrics.put(boltInstanceName, boltInstanceMetric); } ComponentMetrics componentMetrics = new ComponentMetrics(boltComponent, instanceMetrics); result.put(boltComponent, componentMetrics); } return result; }
Source:
<code>private void processLocalSnapshotStartStageResult(UUID id, Map<UUID, SnapshotOperationResponse> res, Map<UUID, Exception> err) { if (cctx.kernalContext().clientNode()) return; SnapshotOperationRequest snpReq = clusterSnpReq; if (snpReq == null || !snpReq.rqId.equals(id)) { synchronized (snpOpMux) { if (clusterSnpFut != null && clusterSnpFut.rqId.equals(id)) { clusterSnpFut.onDone(new IgniteCheckedException("Snapshot operation has not been fully completed " + "[err=" + err + ", snpReq=" + snpReq + ']')); clusterSnpFut = null; } return; } } if (isLocalNodeCoordinator(cctx.discovery())) { Set<UUID> missed = new HashSet<>(snpReq.bltNodes); missed.removeAll(res.keySet()); missed.removeAll(err.keySet()); boolean cancelled = err.values().stream() .anyMatch(e -> e instanceof IgniteFutureCancelledCheckedException); if (cancelled) { snpReq.err = new IgniteFutureCancelledCheckedException("Execution of snapshot tasks " + "has been cancelled by external process [err=" + err + ", missed=" + missed + ']'); <START> } else if (!F.isEmpty(err) || !missed.isEmpty()) { <END> snpReq.err = new IgniteCheckedException("Execution of local snapshot tasks fails or them haven't been executed " + "due to some of nodes left the cluster. Uncompleted snapshot will be deleted " + "[err=" + err + ", missed=" + missed + ']'); } endSnpProc.start(UUID.randomUUID(), snpReq); } }</code><technical_language>else a new line</technical_language>

Target:
private void processLocalSnapshotStartStageResult(UUID id, Map<UUID, SnapshotOperationResponse> res, Map<UUID, Exception> err) { if (cctx.kernalContext().clientNode()) return; SnapshotOperationRequest snpReq = clusterSnpReq; boolean cancelled = err.values().stream().anyMatch(e -> e instanceof IgniteFutureCancelledCheckedException); if (snpReq == null || !snpReq.rqId.equals(id)) { synchronized (snpOpMux) { if (clusterSnpFut != null && clusterSnpFut.rqId.equals(id)) { if (cancelled) { clusterSnpFut.onDone(new IgniteFutureCancelledCheckedException("Execution of snapshot tasks " + "has been cancelled by external process [err=" + err + ", snpReq=" + snpReq + ']')); } else { clusterSnpFut.onDone(new IgniteCheckedException("Snapshot operation has not been fully completed " + "[err=" + err + ", snpReq=" + snpReq + ']')); } clusterSnpFut = null; } return; } } if (isLocalNodeCoordinator(cctx.discovery())) { Set<UUID> missed = new HashSet<>(snpReq.bltNodes); missed.removeAll(res.keySet()); missed.removeAll(err.keySet()); if (cancelled) { snpReq.err = new IgniteFutureCancelledCheckedException("Execution of snapshot tasks " + "has been cancelled by external process [err=" + err + ", missed=" + missed + ']'); } else if (!F.isEmpty(err) || !missed.isEmpty()) { snpReq.err = new IgniteCheckedException("Execution of local snapshot tasks fails or them haven't been executed " + "due to some of nodes left the cluster. Uncompleted snapshot will be deleted " + "[err=" + err + ", missed=" + missed + ']'); } endSnpProc.start(UUID.randomUUID(), snpReq); } }
Source:
<code>public void canParseRuntimeDeprecatedConfigType() throws IOException { <START> KeyValueServiceRuntimeConfig config = <END> AtlasDbConfigs.OBJECT_MAPPER.readValue("type: cassandra", KeyValueServiceRuntimeConfig.class); }</code><technical_language>I want form for this test deprecated version. I change tests deserialise KeyValueServiceRuntimeConfig.class instead of semi-concrete CassandraKeyValueServiceRuntimeConfig test ensure right</technical_language>

Target:
public void canParseRuntimeDeprecatedConfigType() throws IOException { KeyValueServiceRuntimeConfig config = AtlasDbConfigs.OBJECT_MAPPER.readValue("type: CassandraKeyValueServiceRuntimeConfig", KeyValueServiceRuntimeConfig.class); }
Source:
<code>private boolean showRetreatDialog( final String message, final Collection<Territory> possible, final AtomicReference<Territory> retreatTo) { final String yes = possible.size() == 1 ? "Retreat to " + possible.iterator().next().getName() : "Retreat"; final String no = "Remain"; final String cancel = "Ask Me Later"; final String[] options = {yes, no, cancel}; final int choice = JOptionPane.showOptionDialog( BattleDisplay.this, message, "Retreat?", JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE, null, options, no); if (choice == -1) { return false; } if (choice == JOptionPane.CANCEL_OPTION) { return false; } if (choice == JOptionPane.NO_OPTION) { return true; } if (possible.size() == 1) { retreatTo.set(possible.iterator().next()); return true; } final RetreatComponent comp = new RetreatComponent(possible); final int option = JOptionPane.showConfirmDialog( BattleDisplay.this, comp, message, JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE, null); if (option == JOptionPane.OK_OPTION) { if (comp.getSelection() != null) { retreatTo.set(comp.getSelection()); return true; } } <START> return false; <END> }</code><technical_language>Avoid return statements this method</technical_language>

Target:
private boolean showRetreatDialog( final String message, final Collection<Territory> possible, final AtomicReference<Territory> retreatTo) { final String yes = possible.size() == 1 ? "Retreat to " + possible.iterator().next().getName() : "Retreat"; final String no = "Remain"; final String cancel = "Ask Me Later"; final String[] options = {yes, no, cancel}; final int choice = JOptionPane.showOptionDialog( BattleDisplay.this, message, "Retreat?", JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE, null, options, no); if (choice == JOptionPane.CLOSED_OPTION || choice == JOptionPane.CANCEL_OPTION) { return false; } if (choice == JOptionPane.NO_OPTION) { return true; } if (possible.size() == 1) { retreatTo.set(possible.iterator().next()); return true; } final RetreatComponent comp = new RetreatComponent(possible); final int option = JOptionPane.showConfirmDialog( BattleDisplay.this, comp, message, JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE, null); if (option == JOptionPane.OK_OPTION) { if (comp.getSelection() != null) { retreatTo.set(comp.getSelection()); return true; } } return false; }
Source:
<code>protected final void computeRanges(List<? extends Input.Tok> toks) { int lineI = 0; for (Input.Tok tok : toks) { String txt = tok.getOriginalText(); int lineI0 = lineI; lineI += Newlines.count(txt); int k = tok.getIndex(); if (k >= 0) { addToRanges(range0s, lineI0, k); for (int i = lineI0; i <= lineI; i++) { addToRanges(ranges, i, k); } <START> addToRanges(range1s, lineI, k); <END> } } }</code><technical_language>@winteryoung explain for changed argument lineIO lineI here? immediately obvious correct</technical_language>

Target:
protected final void computeRanges(List<? extends Input.Tok> toks) { int lineI = 0; for (Input.Tok tok : toks) { String txt = tok.getOriginalText(); int lineI0 = lineI; lineI += Newlines.count(txt); int k = tok.getIndex(); if (k >= 0) { for (int i = lineI0; i <= lineI; i++) { addToRanges(ranges, i, k); } } } }
Source:
<code>public BleScanListener() { Log.d(TAG, "Start BleScanListener()"); BluetoothAdapter bleAdaptor = BluetoothAdapter.getDefaultAdapter(); if (bleAdaptor == null) { Log.e(TAG, "BluetoothAdapter is Null"); return; } else { if (!bleAdaptor.isEnabled()) { Log.d(TAG, "BluetoothAdapter is NOT enabled, enable now"); bleAdaptor.enable(); if (!bleAdaptor.isEnabled()) { Log.e(TAG, "Can't enable Bluetooth"); return; } } } mBleScanner = bleAdaptor.getBluetoothLeScanner(); mScanFilterList = new ArrayList<ScanFilter>(); ScanFilter <START> scanDeviceName = <END> new ScanFilter.Builder().setDeviceName("dummy").build(); mScanFilterList.add(scanDeviceName); Log.d(TAG, "End BleScanListener()"); }</code><technical_language>named scanFilterDeviceName for readability, this is a</technical_language>

Target:
public BleScanListener() { Log.d(TAG, "Start BleScanListener()"); BluetoothAdapter bleAdaptor = BluetoothAdapter.getDefaultAdapter(); if (bleAdaptor == null) { Log.e(TAG, "BluetoothAdapter is Null"); return; } else { if (!bleAdaptor.isEnabled()) { Log.d(TAG, "BluetoothAdapter is NOT enabled, enable now"); bleAdaptor.enable(); if (!bleAdaptor.isEnabled()) { Log.e(TAG, "Can't enable Bluetooth"); return; } } } mBleScanner = bleAdaptor.getBluetoothLeScanner(); mScanFilterList = new ArrayList<ScanFilter>(); ScanFilter scanFilterDeviceName = new ScanFilter.Builder().setDeviceName("dummy").build(); mScanFilterList.add(scanFilterDeviceName); Log.d(TAG, "End BleScanListener()"); }