auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void killTask(ExecutorDriver driver, TaskID taskId) { String taskIdString = taskId.getValue(); LOGGER.debug("killTask received for taskId: " + taskIdString); TaskStatus status; <START> if (!taskIdString.contains(MyriadExecutorAuxService.YARN_CONTAINER_TASK_ID_PREFIX)) { <END> synchronized (containerIds) { for (String containerId : containerIds) { Protos.TaskID containerTaskId = Protos.TaskID.newBuilder().setValue( MyriadExecutorAuxService.YARN_CONTAINER_TASK_ID_PREFIX + containerId).build(); status = TaskStatus.newBuilder().setTaskId(containerTaskId).setState(TaskState.TASK_KILLED).build(); driver.sendStatusUpdate(status); } } status = TaskStatus.newBuilder().setTaskId(taskId).setState(TaskState.TASK_KILLED).build(); driver.sendStatusUpdate(status); LOGGER.info("NodeManager shutdown after receiving" + " KillTask for taskId " + taskId.getValue()); Runtime.getRuntime().exit(0); } else { status = TaskStatus.newBuilder().setTaskId(taskId).setState(TaskState.TASK_KILLED).build(); driver.sendStatusUpdate(status); synchronized (containerIds) { if (containerIds.remove(taskIdString.substring(MyriadExecutorAuxService.YARN_CONTAINER_FULL_PREFIX.length(), taskIdString.length()))) { LOGGER.debug("Removed task from containerIds"); } } LOGGER.debug("Killing " + taskId); } }</code><technical_language>I understand need change taskId.toString() taskId.getValue() introduce YARN_CONTAINER_FULL_PREFIX. please explain</technical_language>

Target:
public void killTask(ExecutorDriver driver, TaskID taskId) { String taskIdString = taskId.toString(); LOGGER.debug("killTask received for taskId: " + taskIdString); TaskStatus status; if (!taskIdString.contains(MyriadExecutorAuxService.YARN_CONTAINER_TASK_ID_PREFIX)) { synchronized (containerIds) { for (String containerId : containerIds) { Protos.TaskID containerTaskId = Protos.TaskID.newBuilder().setValue( MyriadExecutorAuxService.YARN_CONTAINER_TASK_ID_PREFIX + containerId).build(); status = TaskStatus.newBuilder().setTaskId(containerTaskId).setState(TaskState.TASK_KILLED).build(); driver.sendStatusUpdate(status); } } status = TaskStatus.newBuilder().setTaskId(taskId).setState(TaskState.TASK_KILLED).build(); driver.sendStatusUpdate(status); LOGGER.info("NodeManager shutdown after receiving KILL_TASK for taskId {}", taskIdString); Runtime.getRuntime().exit(0); } else { status = TaskStatus.newBuilder().setTaskId(taskId).setState(TaskState.TASK_KILLED).build(); driver.sendStatusUpdate(status); synchronized (containerIds) { if (containerIds.remove(taskIdString.substring(MyriadExecutorAuxService.YARN_CONTAINER_FULL_PREFIX.length(), taskIdString.length()))) { LOGGER.debug("Removed taskId from containerIds", taskIdString); } } LOGGER.debug("Killing " + taskId); } }
Source:
<code>private <K extends Exception> void handleException(int numTries, InetSocketAddress host, Exception ex) throws K { if (isRetriableException(ex) || isRetriableWithBackoffException(ex)) { if (numTries >= MAX_TRIES_TOTAL) { if (ex instanceof TTransportException && ex.getCause() != null && (ex.getCause().getClass() == SocketException.class)) { log.error(CONNECTION_FAILURE_MSG, numTries, ex); String errorMsg = MessageFormatter.format(CONNECTION_FAILURE_MSG, numTries).getMessage(); throw (K) new TTransportException(((TTransportException) ex).getType(), errorMsg, ex); } else { log.error("Tried to connect to cassandra times.", SafeArg.of("numTries", numTries), ex); throw (K) ex; } } else { <START> log.warn("Error occurred talking to cassandra. Attempt of {}. Exception message was: : {}", <END> SafeArg.of("numTries", numTries), SafeArg.of("maxTotalTries", MAX_TRIES_TOTAL), SafeArg.of("exceptionClass", ex.getClass().getTypeName()), ex.getMessage()); if (isConnectionException(ex) && numTries >= MAX_TRIES_SAME_HOST) { addToBlacklist(host); } } } else { throw (K) ex; } }</code><technical_language>log exception time</technical_language>

Target:
private <K extends Exception> void handleException(int numTries, InetSocketAddress host, Exception ex) throws K { if (isRetriableException(ex) || isRetriableWithBackoffException(ex)) { if (numTries >= MAX_TRIES_TOTAL) { if (ex instanceof TTransportException && ex.getCause() != null && (ex.getCause().getClass() == SocketException.class)) { log.error(CONNECTION_FAILURE_MSG, numTries, ex); String errorMsg = MessageFormatter.format(CONNECTION_FAILURE_MSG, numTries).getMessage(); throw (K) new TTransportException(((TTransportException) ex).getType(), errorMsg, ex); } else { log.error("Tried to connect to cassandra times.", SafeArg.of("numTries", numTries), ex); throw (K) ex; } } else { if (numTries > 1) { log.warn("Error occurred talking to cassandra. Attempt of {}. Exception message was: : {}", SafeArg.of("numTries", numTries), SafeArg.of("maxTotalTries", MAX_TRIES_TOTAL), SafeArg.of("exceptionClass", ex.getClass().getTypeName()), UnsafeArg.of("exceptionMessage", ex.getMessage())); } else { log.warn("Error occurred talking to cassandra. Attempt of {}.", SafeArg.of("numTries", numTries), SafeArg.of("maxTotalTries", MAX_TRIES_TOTAL), ex); } if (isConnectionException(ex) && numTries >= MAX_TRIES_SAME_HOST) { addToBlacklist(host); } } } else { throw (K) ex; } }
Source:
<code><START> public Object clone() { <END> final RetryOptions cloned = (RetryOptions) getRetryOptions().clone(); return new ExponentialRetryPolicy(cloned); }</code><technical_language>Return type ExponentialRetryPolicy</technical_language>

Target:
public RetryPolicy clone() { final RetryOptions cloned = getRetryOptions().clone(); return new ExponentialRetryPolicy(cloned); }
Source:
<code>private MainJava() { <START> throw new AssertionError("Instantiating utility class"); <END> }</code><technical_language>Do get compiler pmd error if remove line throws exception? I get wanting default constructor private, cleaner if method simply empty</technical_language>

Target:
private MainJava() { }
Source:
<code>public void onButtonClicked(JogPanelButtonEnum button) { switch (button) { case BUTTON_XNEG: jogService.adjustManualLocationXY(-1, 0); break; case BUTTON_XPOS: jogService.adjustManualLocationXY(1, 0); break; case BUTTON_YNEG: jogService.adjustManualLocationXY(0, -1); break; case BUTTON_YPOS: jogService.adjustManualLocationXY(0, 1); break; case BUTTON_DIAG_XNEG_YNEG: jogService.adjustManualLocationXY(-1, -1); break; case BUTTON_DIAG_XNEG_YPOS: jogService.adjustManualLocationXY(-1, 1); break; case BUTTON_DIAG_XPOS_YNEG: jogService.adjustManualLocationXY(1, -1); break; case BUTTON_DIAG_XPOS_YPOS: jogService.adjustManualLocationXY(1, 1); break; case BUTTON_ZNEG: jogService.adjustManualLocationZ(-1); break; case BUTTON_ZPOS: jogService.adjustManualLocationZ(1); break; case BUTTON_TOGGLE_UNIT: if (jogService.getUnits() == UnitUtils.Units.MM) { jogService.setUnits(UnitUtils.Units.INCH); } else { jogService.setUnits(UnitUtils.Units.MM); } break; case BUTTON_LARGER_STEP: jogService.setStepSizeXY(jogService.getStepSizeXY() * 10); <START> jogService.setStepSizeZ(jogService.getStepSizeZ() * 5); <END> break; case BUTTON_SMALLER_STEP: jogService.setStepSizeXY(jogService.getStepSizeXY() / 10); jogService.setStepSizeZ(jogService.getStepSizeZ() / 5); break; default: } }</code><technical_language>switch this existing 'jogService.multiplyXYStepSize(), jogService.multiplyZStepSize()? divide methods</technical_language>

Target:
public void onButtonClicked(JogPanelButtonEnum button) { switch (button) { case BUTTON_XNEG: jogService.adjustManualLocationXY(-1, 0); break; case BUTTON_XPOS: jogService.adjustManualLocationXY(1, 0); break; case BUTTON_YNEG: jogService.adjustManualLocationXY(0, -1); break; case BUTTON_YPOS: jogService.adjustManualLocationXY(0, 1); break; case BUTTON_DIAG_XNEG_YNEG: jogService.adjustManualLocationXY(-1, -1); break; case BUTTON_DIAG_XNEG_YPOS: jogService.adjustManualLocationXY(-1, 1); break; case BUTTON_DIAG_XPOS_YNEG: jogService.adjustManualLocationXY(1, -1); break; case BUTTON_DIAG_XPOS_YPOS: jogService.adjustManualLocationXY(1, 1); break; case BUTTON_ZNEG: jogService.adjustManualLocationZ(-1); break; case BUTTON_ZPOS: jogService.adjustManualLocationZ(1); break; case BUTTON_TOGGLE_UNIT: if (jogService.getUnits() == UnitUtils.Units.MM) { jogService.setUnits(UnitUtils.Units.INCH); } else { jogService.setUnits(UnitUtils.Units.MM); } break; case BUTTON_LARGER_STEP: jogService.multiplyXYStepSize(); jogService.multiplyZStepSize(); break; case BUTTON_SMALLER_STEP: jogService.divideXYStepSize(); jogService.divideZStepSize(); break; default: } }
Source:
<code>protected void onPostExecute(SiteList[] updatedSiteLists) { <START> if (updatedSiteLists != null) { <END> mAllSites = updatedSiteLists[0]; mSites = updatedSiteLists[1]; notifyDataSetChanged(); } mIsTaskRunning = false; if (mDataLoadedListener != null) { mDataLoadedListener.onAfterLoad(); } }</code><technical_language>I understand purpose of change is streamline change in class variables happen late in time possible, issue notifyDatSetChanged() signal right that. enclose 3 lines in a synchronized block 3 packed in atomic action</technical_language>

Target:
protected void onPostExecute(SiteList[] updatedSiteLists) { if (updatedSiteLists != null) { mAllSites = updatedSiteLists[0]; mSites = updatedSiteLists[1]; notifyDataSetChanged(); } if (mDataLoadedListener != null) { mDataLoadedListener.onAfterLoad(); } }
Source:
<code>public boolean isPartitionedOn(Collection<Symbol> columns, Set<Symbol> knownConstants) { return arguments.stream() <START> .filter(ArgumentBinding::isCoalesce) <END> .count() == 0 && arguments.stream() .filter(ArgumentBinding::isVariable) .map(ArgumentBinding::getColumn) .filter(symbol -> !knownConstants.contains(symbol)) .allMatch(columns::contains); }</code><technical_language>This is hard read combines multiline expressions. Please break separate expressions suitable variables for value</technical_language>

Target:
public boolean isPartitionedOn(Collection<Symbol> columns, Set<Symbol> knownConstants) { for (ArgumentBinding argument : arguments) { if (argument.isConstant()) { continue; } if (!argument.isVariable()) { return false; } if (!knownConstants.contains(argument.getColumn()) && !columns.contains(argument.getColumn())) { return false; } } return true; }
Source:
<code>public static boolean isEmptyDRId (long drId) { <START> return ((drId >>> 63) == 1L) && !(drId == -1); <END> }</code><technical_language>!=, is simpler</technical_language>

Target:
public static boolean isEmptyDRId (long drId) { return ((drId >>> 63) == 1L) && (drId != -1); }
Source:
<code>public void takeLeadership(CuratorFramework client) throws Exception { setState(State.PRIMARY); if (client.checkExists().forPath(mLeaderFolder + mName) != null) { LOG.info("Deleting zk path: {}{}", mLeaderFolder, mName); client.delete().forPath(mLeaderFolder + mName); } LOG.info("Creating zk path: {}{}", mLeaderFolder, mName); client.create().creatingParentsIfNeeded().withMode(CreateMode.EPHEMERAL) .forPath(mLeaderFolder + mName); LOG.info("{} is now the leader.", mName); try { mLeaderZkSessionId = client.getZookeeperClient().getZooKeeper().getSessionId(); waitForState(State.SECONDARY); } finally { LOG.warn("{} relinquishing leadership.", mName); LOG.info("The current leader is {}", mLeaderSelector.getLeader().getId()); LOG.info("All participants: {}", mLeaderSelector.getParticipants()); client.delete().forPath(mLeaderFolder + mName); <START> mLeaderZkSessionId = -1; <END> } }</code><technical_language>a constant for -1, set in constructor</technical_language>

Target:
public void takeLeadership(CuratorFramework client) throws Exception { setState(State.PRIMARY); if (client.checkExists().forPath(mLeaderFolder + mName) != null) { LOG.info("Deleting zk path: {}{}", mLeaderFolder, mName); client.delete().forPath(mLeaderFolder + mName); } LOG.info("Creating zk path: {}{}", mLeaderFolder, mName); client.create().creatingParentsIfNeeded().withMode(CreateMode.EPHEMERAL) .forPath(mLeaderFolder + mName); LOG.info("{} is now the leader.", mName); try { mLeaderZkSessionId = client.getZookeeperClient().getZooKeeper().getSessionId(); LOG.info(String.format("Taken leadership under session Id: %x", mLeaderZkSessionId)); waitForState(State.SECONDARY); } finally { LOG.warn("{} relinquishing leadership.", mName); LOG.info("The current leader is {}", mLeaderSelector.getLeader().getId()); LOG.info("All participants: {}", mLeaderSelector.getParticipants()); client.delete().forPath(mLeaderFolder + mName); mLeaderZkSessionId = NOT_A_LEADER; } }
Source:
<code>public void checkSymmetry(Iterator<SymmetryCheckerMessage> msgIterator) { while (msgIterator.hasNext()) { SymmetryCheckerMessage incomingMsg = msgIterator.next(); EDGETYPE neighborToMe = EDGETYPE.fromByte(incomingMsg.getFlag()); boolean exist = getVertexValue().getEdges(neighborToMe).contains(incomingMsg.getSourceVertexId()); if (!exist) { getVertexValue().setState(State.ERROR_NODE); return; } boolean edgesAreSame = true; <START> for (VKmer kmer : incomingMsg.getEdges()) { <END> if (!getVertexValue().getEdges(neighborToMe).contains(kmer)) { edgesAreSame = false; break; } } if (!edgesAreSame) getVertexValue().setState(State.ERROR_NODE); } }</code><technical_language>need compare vertex.edge msg.edge one. checking if vertex.edge contains msg.edge is enough. I mark vertices if is asymmetric. In this code, is marked vertex</technical_language>

Target:
public void checkSymmetry(Iterator<SymmetryCheckerMessage> msgIterator) { while (msgIterator.hasNext()) { SymmetryCheckerMessage incomingMsg = msgIterator.next(); EDGETYPE neighborToMe = EDGETYPE.fromByte(incomingMsg.getFlag()); boolean exist = getVertexValue().getEdges(neighborToMe).contains(incomingMsg.getSourceVertexId()); if (!exist) { getVertexValue().setState(State.ERROR_NODE); return; } boolean edgesAreSame = true; for (VKmer kmer : incomingMsg.getEdges()) { if (!getVertexValue().getEdges(neighborToMe).contains(kmer)) { edgesAreSame = false; break; } } for (VKmer kmer : getVertexValue().getEdges(neighborToMe)) { if (!incomingMsg.getEdges().contains(kmer)) { edgesAreSame = false; break; } } if (!edgesAreSame) getVertexValue().setState(State.ERROR_NODE); } }
Source:
<code>void shouldFailWithNonExistentProviderName( IndexCreator creator ) throws KernelException { SchemaWrite schemaWrite = schemaWriteInNewTransaction(); try { <START> schemaWrite.indexCreate( forLabel( 0, 0 ), "something-completely-different" ); <END> fail( "Should have failed" ); } catch ( IllegalArgumentException e ) { } }</code><technical_language>I meant creator here</technical_language>

Target:
void shouldFailWithNonExistentProviderName( IndexCreator creator ) throws KernelException { SchemaWrite schemaWrite = schemaWriteInNewTransaction(); try { creator.create( schemaWrite, forLabel( 0, 0 ), "something-completely-different" ); fail( "Should have failed" ); } catch ( IllegalArgumentException e ) { } }
Source:
<code>public void processClientSettingsEvent(C15PacketClientSettings packet, CallbackInfo ci) { <START> PlayerChangeClientSettingsEvent event = SpongeEventFactory.createPlayerChangeClientSettingsEvent(Cause.of(NamedCause.source(this)), <END> (ChatVisibility) (Object) this.chatVisibility, this.skinParts, this.getLocale(), this, this.chatColours, this.viewDistance); SpongeImpl.postEvent(event); }</code><technical_language>event is supposed new values, creating of ones</technical_language>

Target:
public void processClientSettingsEvent(C15PacketClientSettings packet, CallbackInfo ci) { PlayerChangeClientSettingsEvent event = SpongeEventFactory.createPlayerChangeClientSettingsEvent(Cause.of(NamedCause.source(this)), (ChatVisibility) (Object) packet.getChatVisibility(), SkinUtil.fromFlags(packet.getModelPartFlags()), LanguageUtil.LOCALE_CACHE.getUnchecked(packet.getLang()), this, packet.isColorsEnabled(), packet.view); SpongeImpl.postEvent(event); }
Source:
<code>protected ResultMetadata convert(RequestStatusMetaData requestStatusMetaData) { if (requestStatusMetaData == null) { return null; } <START> if (!DeleteStatusMetaData.class.isInstance(requestStatusMetaData)) { <END> throw new IllegalArgumentException("RequestStatusDetails is not of type DeleteStatusDetails. requestStatusMetaData.getClass= " + requestStatusMetaData.getClass()); } DeleteStatusMetaData statusDetails = (DeleteStatusMetaData) requestStatusMetaData; DeleteResultMetadata resultDetails = new DeleteResultMetadata(); resultDetails.addDeletedKeys(statusDetails.getDeletedKeys()); resultDetails.addExceptions(statusDetails.getExceptionForKeys()); return resultDetails; }</code><technical_language>please, form !(requestStatusMetaData instanceof DeleteStatusMetaData)</technical_language>

Target:
protected ResultMetadata convert(RequestStatusMetaData requestStatusMetaData) { if (requestStatusMetaData == null) { return null; } if (!(requestStatusMetaData instanceof DeleteStatusMetaData)) { throw new IllegalArgumentException( String.format("Wrong status details class received - expecting: %s; actual: %s", DeleteStatusMetaData.class, requestStatusMetaData.getClass())); } DeleteStatusMetaData statusDetails = (DeleteStatusMetaData) requestStatusMetaData; DeleteResultMetadata resultDetails = new DeleteResultMetadata(); resultDetails.addDeletedKeys(statusDetails.getDeletedKeys()); resultDetails.addExceptions(statusDetails.getExceptionForKeys()); return resultDetails; }
Source:
<code><START> private String addCachePrefix(String content) { <END> return CACHE_PREFIX + content; }</code><technical_language>Nitpick: this static, depend instance fields/methods. prefix calls this method this. (I part of personal style prefix this thou mandatory in places :-)</technical_language>

Target:
private static String addCachePrefix(String content) { return CACHE_PREFIX + content; }
Source:
<code>public Collection<ActivityEvent> getEvents(ActivityScope scope) { Assert.isNotNull(scope, "Task scope should not be null."); <START> events.addAll(new ReviewTaskProvider().getReviews(((TaskActivityScope) scope).getTask().getTaskId())); <END> return events; }</code><technical_language>Querying of provider implemented in ActivityStream invoking query() method providers</technical_language>

Target:
public Collection<ActivityEvent> getEvents(ActivityScope scope) { return events; }
Source:
<code><START> public List<CorrelationIdentifier> findCorrelationIds(Scope... scope) { <END> List<CorrelationIdentifier> ret = null; for (int i=0; i < correlationIds.size(); i++) { CorrelationIdentifier cid = correlationIds.get(i); for (int j=0; j < scope.length; j++) { if (cid.getScope() == scope[j]) { if (ret == null) { ret = new ArrayList<CorrelationIdentifier>(); } ret.add(cid); } } } return ret == null ? Collections.emptyList() : ret; }</code><technical_language>this defined Set<Scope></technical_language>

Target:
public List<CorrelationIdentifier> findCorrelationIds(Scope... scope) { List<CorrelationIdentifier> ret = null; for (int i=0; i < correlationIds.size(); i++) { CorrelationIdentifier cid = correlationIds.get(i); for (int j=0; j < scope.length; j++) { if (cid.getScope() == scope[j]) { if (ret == null) { ret = new ArrayList<CorrelationIdentifier>(); } if (!ret.contains(cid)) { ret.add(cid); } } } } return ret == null ? Collections.emptyList() : ret; }
Source:
<code>public static Collection<FunctionDesc> loadHiveUDFs(TajoConf conf) { ArrayList<FunctionDesc> funcList = new ArrayList<>(); String udfdir = conf.getVar(TajoConf.ConfVars.HIVE_UDF_DIR); try { <START> FileSystem localFS = FileSystem.getLocal(conf); <END> Path udfPath = new Path(udfdir); if (!localFS.isDirectory(udfPath)) { return null; } for (FileStatus fstatus : localFS.listStatus(udfPath, (Path path) -> path.getName().endsWith(".jar"))) { URL[] urls = new URL[]{new URL("jar:" + fstatus.getPath().toUri().toURL() + "!/")}; Set<Class<? extends UDF>> udfClasses = getSubclassesFromJarEntry(urls, UDF.class); if (udfClasses != null) { buildFunctionsFromUDF(udfClasses, funcList, "jar:"+urls[0].getPath()); } } } catch (IOException e) { throw new TajoInternalError(e); } return funcList; }</code><technical_language>Hive basically assumes Jar files stored HDFS. need support it</technical_language>

Target:
public static Optional<List<FunctionDesc>> loadHiveUDFs(TajoConf conf) { ArrayList<FunctionDesc> funcList = new ArrayList<>(); String udfdir = conf.getVar(TajoConf.ConfVars.HIVE_UDF_DIR); try { FileSystem fs = FileSystem.getLocal(conf); Path udfPath = new Path(udfdir); if (!fs.isDirectory(udfPath)) { LOG.warn("Hive UDF directory doesn't exist : "+udfdir); return Optional.empty(); } URL urls = Arrays.stream(fs.listStatus(udfPath, (Path path) -> path.getName().endsWith(".jar"))) .map(fstatus -> { try { return new URL("jar:" + fstatus.getPath().toUri().toURL() + "!/"); } catch (MalformedURLException e) { e.printStackTrace(); } return null; }) .toArray(URL[]::new); Set<Class<? extends UDF>> udfClasses = getSubclassesFromJarEntry(urls, UDF.class); buildFunctionsFromUDF(udfClasses, funcList, "jar:"+urls[0].getPath()); } catch (IOException e) { throw new TajoInternalError(e); } return Optional.of(funcList); }
Source:
<code>synchronized public static Number nativeCreate() { <START> long nativePtr = nextNativePtr++; <END> NATIVE_PTR_TO_PARCEL.put(nextNativePtr, new ByteBuffer()); return castNativePtr(nextNativePtr); }</code><technical_language>do need nativePtr? Is anywhere</technical_language>

Target:
synchronized public static Number nativeCreate() { long nativePtr = nextNativePtr++; NATIVE_PTR_TO_PARCEL.put(nativePtr, new ByteBuffer()); return castNativePtr(nativePtr); }
Source:
<code>private boolean processAnnotations(RoundEnvironment roundEnv) { for (Element classElement : roundEnv.getElementsAnnotatedWith(RealmClass.class)) { if (!Utils.isImplementingMarkerInterface(classElement)) { Utils.error("A RealmClass annotated object must implement RealmModel or derive from RealmObject.", classElement); <START> } <END> if (!classElement.getKind().equals(ElementKind.CLASS)) { Utils.error("The RealmClass annotation can only be applied to classes.", classElement); return false; } ClassMetaData metadata = new ClassMetaData(processingEnv, (TypeElement) classElement); if (!metadata.isModelClass()) { continue; } Utils.note("Processing class " + metadata.getSimpleClassName()); if (!metadata.generate()) { return false; } classesToValidate.add(metadata); backlinksToValidate.addAll(metadata.getBacklinkFields()); RealmProxyInterfaceGenerator interfaceGenerator = new RealmProxyInterfaceGenerator(processingEnv, metadata); try { interfaceGenerator.generate(); } catch (IOException e) { Utils.error(e.getMessage(), classElement); } RealmProxyClassGenerator sourceCodeGenerator = new RealmProxyClassGenerator(processingEnv, metadata); try { sourceCodeGenerator.generate(); } catch (IOException e) { Utils.error(e.getMessage(), classElement); } catch (UnsupportedOperationException e) { Utils.error(e.getMessage(), classElement); } } return true; }</code><technical_language>Missing return false</technical_language>

Target:
private boolean processAnnotations(RoundEnvironment roundEnv) { for (Element classElement : roundEnv.getElementsAnnotatedWith(RealmClass.class)) { if (!Utils.isImplementingMarkerInterface(classElement)) { Utils.error("A RealmClass annotated object must implement RealmModel or derive from RealmObject.", classElement); return false; } if (!classElement.getKind().equals(ElementKind.CLASS)) { Utils.error("The RealmClass annotation can only be applied to classes.", classElement); return false; } ClassMetaData metadata = new ClassMetaData(processingEnv, (TypeElement) classElement); if (!metadata.isModelClass()) { continue; } Utils.note("Processing class " + metadata.getSimpleClassName()); if (!metadata.generate()) { return false; } classesToValidate.add(metadata); backlinksToValidate.addAll(metadata.getBacklinkFields()); RealmProxyInterfaceGenerator interfaceGenerator = new RealmProxyInterfaceGenerator(processingEnv, metadata); try { interfaceGenerator.generate(); } catch (IOException e) { Utils.error(e.getMessage(), classElement); } RealmProxyClassGenerator sourceCodeGenerator = new RealmProxyClassGenerator(processingEnv, metadata); try { sourceCodeGenerator.generate(); } catch (IOException e) { Utils.error(e.getMessage(), classElement); } catch (UnsupportedOperationException e) { Utils.error(e.getMessage(), classElement); } } return true; }
Source:
<code>public List<? extends MetadataInterface> getMetadataInclDefaultDisplay(DocStructInterface inStruct, String inLanguage, boolean inIsPerson, Process inProzess) { List<MetadataTypeInterface> displayMetadataTypes = inStruct.getDisplayMetadataTypes(); if (displayMetadataTypes != null) { for (MetadataTypeInterface mdt : displayMetadataTypes) { if (!(inStruct.getAllMetadataByType(mdt) != null && inStruct.getAllMetadataByType(mdt).size() != 0)) { try { if (mdt.isPerson()) { PersonInterface p = UghImplementation.INSTANCE.createPerson(mdt); p.setRole(mdt.getName()); inStruct.addPerson(p); } else { MetadataInterface md = UghImplementation.INSTANCE.createMetadata(mdt); inStruct.addMetadata(md); } } catch (DocStructHasNoTypeException | MetadataTypeNotAllowedException e) { logger.error(e); } } } } if (inIsPerson) { <START> List<PersonInterface> personInterfaces = inStruct.getAllPersons(); <END> if (personInterfaces != null && !inProzess.getRuleset().isOrderMetadataByRuleset()) { Collections.sort(personInterfaces, new MetadataComparator(inLanguage)); } return personInterfaces; } else { List<MetadataInterface> metadataInterface = inStruct.getAllMetadata(); if (metadataInterface != null && !inProzess.getRuleset().isOrderMetadataByRuleset()) { Collections.sort(metadataInterface, new MetadataComparator(inLanguage)); } return getAllVisibleMetadataHack(inStruct); } }</code><technical_language>Interfaces appended variable name</technical_language>

Target:
public List<? extends MetadataInterface> getMetadataInclDefaultDisplay(DocStructInterface inStruct, String inLanguage, boolean inIsPerson, Process inProzess) { List<MetadataTypeInterface> displayMetadataTypes = inStruct.getDisplayMetadataTypes(); if (displayMetadataTypes != null) { for (MetadataTypeInterface mdt : displayMetadataTypes) { if (!(inStruct.getAllMetadataByType(mdt) != null && inStruct.getAllMetadataByType(mdt).size() != 0)) { try { if (mdt.isPerson()) { PersonInterface p = UghImplementation.INSTANCE.createPerson(mdt); p.setRole(mdt.getName()); inStruct.addPerson(p); } else { MetadataInterface md = UghImplementation.INSTANCE.createMetadata(mdt); inStruct.addMetadata(md); } } catch (DocStructHasNoTypeException | MetadataTypeNotAllowedException e) { logger.error(e); } } } } if (inIsPerson) { List<PersonInterface> person = inStruct.getAllPersons(); if (person != null && !inProzess.getRuleset().isOrderMetadataByRuleset()) { Collections.sort(person, new MetadataComparator(inLanguage)); } return person; } else { List<MetadataInterface> metadata = inStruct.getAllMetadata(); if (metadata != null && !inProzess.getRuleset().isOrderMetadataByRuleset()) { Collections.sort(metadata, new MetadataComparator(inLanguage)); } return getAllVisibleMetadataHack(inStruct); } }
Source:
<code>private byte[] generateSecureRandomBytesWithLength(int length) { byte[] randBytes = new byte[length]; <START> new SecureRandom().nextBytes(randBytes); <END> return randBytes; }</code><technical_language>tempted this class level. In addition, do need apply <LINK_0> recommend users do</technical_language>

Target:
private byte[] generateSecureRandomBytesWithLength(int length) { byte[] randBytes = new byte[length]; secureRandom.nextBytes(randBytes); return randBytes; }
Source:
<code>private void bindToBrokerAccountService(final Context context, final Callback<BrokerAccountServiceConnection> callback, final BrokerEvent brokerEvent) { Logger.v(TAG, "Binding to BrokerAccountService for caller uid: " + android.os.Process.myUid()); final Intent brokerAccountServiceToBind = getIntentForBrokerAccountService(context); final BrokerAccountServiceConnection connection = new BrokerAccountServiceConnection(); if (brokerEvent != null) { connection.setTelemetryEvent(brokerEvent); brokerEvent.setBrokerAccountServerStartsBinding(); } final CallbackExecutor<BrokerAccountServiceConnection> callbackExecutor = new CallbackExecutor<>(callback); mPendingConnections.put(connection, callbackExecutor); final boolean serviceBound = context.bindService(brokerAccountServiceToBind, connection, Context.BIND_AUTO_CREATE); Logger.v(TAG, "The status for brokerAccountService bindService call is: " + Boolean.valueOf(serviceBound)); if (brokerEvent != null) { brokerEvent.setBrokerAccountServiceBindingSucceed(serviceBound); } if (!serviceBound) { connection.unBindService(context); <START> callback.onError(new AuthenticationException(ADALError.BROKER_BIND_SERVICE_FAILED)); <END> } }</code><technical_language>add error log here</technical_language>

Target:
private void bindToBrokerAccountService(final Context context, final Callback<BrokerAccountServiceConnection> callback, final BrokerEvent brokerEvent) { Logger.v(TAG, "Binding to BrokerAccountService for caller uid: " + android.os.Process.myUid()); final Intent brokerAccountServiceToBind = getIntentForBrokerAccountService(context); final BrokerAccountServiceConnection connection = new BrokerAccountServiceConnection(); if (brokerEvent != null) { connection.setTelemetryEvent(brokerEvent); brokerEvent.setBrokerAccountServerStartsBinding(); } final CallbackExecutor<BrokerAccountServiceConnection> callbackExecutor = new CallbackExecutor<>(callback); mPendingConnections.put(connection, callbackExecutor); final boolean serviceBound = context.bindService(brokerAccountServiceToBind, connection, Context.BIND_AUTO_CREATE); Logger.v(TAG, "The status for brokerAccountService bindService call is: " + Boolean.valueOf(serviceBound)); if (brokerEvent != null) { brokerEvent.setBrokerAccountServiceBindingSucceed(serviceBound); } if (!serviceBound) { connection.unBindService(context); Logger.e(TAG, "Failed to bind service to broker app", "'bindService' returned false", ADALError.BROKER_BIND_SERVICE_FAILED); callback.onError(new AuthenticationException(ADALError.BROKER_BIND_SERVICE_FAILED)); } }
Source:
<code>protected void executeVdsBrokerCommand() { vmListReturn = getBroker().getExternalVmList(getParameters().getUrl(), getParameters().getUsername(), getParameters().getPassword(), getParameters().getNamesOfVms()); proceedProxyReturnValue(); List<VM> vms = new ArrayList<>(); List<VM> notDownVms = new ArrayList<>(); for (Map<String, Object> map : vmListReturn.vmList) { VM vm = VdsBrokerObjectsBuilder.buildVmsDataFromExternalProvider(map); if (vm != null) { vm.setOrigin(getParameters().getOriginType()); if <START> (vm.getOrigin() == OriginType.KVM && VmDeviceCommonUtils.isVirtIoScsiDiskInterfaceExists(vm.getStaticData())) { <END> VmDeviceCommonUtils.addVirtIoScsiDevice(vm.getStaticData()); } vms.add(vm); if (!vm.isDown()) { notDownVms.add(vm); } } } logNonDownVms(notDownVms); setReturnValue(vms); }</code><technical_language>please separate 2 'if' statements - more changes VM configuration in case of origin=KVM (the empty cd-rom shmuel is adding)</technical_language>

Target:
protected void executeVdsBrokerCommand() { vmListReturn = getBroker().getExternalVmList(getParameters().getUrl(), getParameters().getUsername(), getParameters().getPassword(), getParameters().getNamesOfVms()); proceedProxyReturnValue(); List<VM> vms = new ArrayList<>(); List<VM> notDownVms = new ArrayList<>(); for (Map<String, Object> map : vmListReturn.vmList) { VM vm = VdsBrokerObjectsBuilder.buildVmsDataFromExternalProvider(map); if (vm != null) { vm.setOrigin(getParameters().getOriginType()); if (vm.getOrigin() == OriginType.KVM) { if (VmDeviceCommonUtils.isVirtIoScsiDiskInterfaceExists(vm.getStaticData())) { VmDeviceCommonUtils.addVirtIoScsiDevice(vm.getStaticData()); } } vms.add(vm); if (!vm.isDown()) { notDownVms.add(vm); } } } logNonDownVms(notDownVms); setReturnValue(vms); }
Source:
<code>SetSaslClientFactoryAuthenticationConfiguration(final AuthenticationConfiguration parent, final Supplier<SaslClientFactory> saslClientFactorySupplier) { <START> super(parent.without(SetSaslClientFactoryAuthenticationConfiguration.class)); <END> this.saslClientFactorySupplier = saslClientFactorySupplier; }</code><technical_language>"without" is redundant base class ensures class exist chain</technical_language>

Target:
SetSaslClientFactoryAuthenticationConfiguration(final AuthenticationConfiguration parent, final Supplier<SaslClientFactory> saslClientFactorySupplier) { super(parent); this.saslClientFactorySupplier = saslClientFactorySupplier; }
Source:
<code>void parseServerAddress(Connection connection, Span span) { try { URI url = URI.create(connection.getMetaData().getURL().substring(5)); <START> String actualServiceName = remoteServiceName; <END> final Matcher matcher = URL_SERVICE_NAME_FINDER.matcher(url.toString()); if(matcher.find() && matcher.groupCount() == 1) { final String parsedServiceName = matcher.group(1); if(parsedServiceName != null && !parsedServiceName.isEmpty()) { actualServiceName = parsedServiceName; } } Endpoint.Builder builder = Endpoint.builder().port(url.getPort()); boolean parsed = builder.parseIp(url.getHost()); if (actualServiceName == null || "".equals(actualServiceName)) { String databaseName = connection.getCatalog(); if (databaseName != null && !databaseName.isEmpty()) { builder.serviceName(databaseName); } else { if (!parsed) return; builder.serviceName(""); } } else { builder.serviceName(actualServiceName); } span.remoteEndpoint(builder.build()); } catch (Exception e) { } }</code><technical_language>rename field defaultRemoteServiceName</technical_language>

Target:
void parseServerAddress(Connection connection, Span span) { try { URI url = URI.create(connection.getMetaData().getURL().substring(5)); String defaultRemoteServiceName = remoteServiceName; Matcher matcher = URL_SERVICE_NAME_FINDER.matcher(url.toString()); if (matcher.find() && matcher.groupCount() == 1) { String parsedServiceName = matcher.group(1); if (parsedServiceName != null && !parsedServiceName.isEmpty()) { defaultRemoteServiceName = parsedServiceName; } } Endpoint.Builder builder = Endpoint.builder().port(url.getPort()); boolean parsed = builder.parseIp(url.getHost()); if (defaultRemoteServiceName == null || "".equals(defaultRemoteServiceName)) { String databaseName = connection.getCatalog(); if (databaseName != null && !databaseName.isEmpty()) { builder.serviceName(databaseName); } else { if (!parsed) return; builder.serviceName(""); } } else { builder.serviceName(defaultRemoteServiceName); } span.remoteEndpoint(builder.build()); } catch (Exception e) { } }
Source:
<code>public AuditAssociationQuery<? extends AuditQuery> traverseRelation( String associationName, JoinType joinType, String alias) { if ( !selectEntitiesOnly ) { throw new IllegalStateException( "Audit association queries only permitted while selecting only entities." ); } AbstractAuditAssociationQuery<AuditQueryImplementor> query = associationQueryMap.get( associationName ); if ( query == null ) { query = new RevisionsOfEntityAssociationQuery<>( enversService, versionsReader, this, qb, associationName, joinType, aliasToEntityNameMap, REFERENCED_ENTITY_ALIAS, alias ); addAssociationQuery( associationName, query ); <START> } <END> return query; }</code><technical_language>In this case, Map's computeIfAbsent better, follows: associationQueryMap.computeIfAbsent( associationName, name -> new RevisionsOfEntityAssociationQuery<>( enversService, versionsReader, this, qb, associationName, joinType, aliasToEntityNameMap, REFERENCED_ENTITY_ALIAS, alias ) ); Note putIfAbsent is a choice for want run constructor is absent</technical_language>

Target:
public AuditAssociationQuery<? extends AuditQuery> traverseRelation( String associationName, JoinType joinType, String alias) { if ( !selectEntitiesOnly ) { throw new IllegalStateException( "Audit association queries are only permitted when the query is created with selectEntitiesOnly: true." ); } return associationQueryMap.computeIfAbsent( associationName, name -> { AbstractAuditAssociationQuery<AuditQueryImplementor> query = new RevisionsOfEntityAssociationQuery<>( enversService, versionsReader, this, qb, name, joinType, aliasToEntityNameMap, REFERENCED_ENTITY_ALIAS, alias); addAssociationQuery( name, query ); return query; } ); }
Source:
<code>private SimpleObject getVisits(RequestContext context, String patientParameter, String includeInactiveParameter, Date minStartDate) { <START> boolean includeAll = Boolean.parseBoolean(context.getParameter("includeAll")); <END> Collection<Patient> patients = patientParameter == null ? null : Arrays.asList(getPatient(patientParameter)); boolean includeInactive = includeInactiveParameter == null ? true : Boolean.parseBoolean(includeInactiveParameter); return new NeedsPaging<Visit>(Context.getVisitService().getVisits(null, patients, null, null, minStartDate, null, null, null, null, includeInactive, includeAll), context).toSimpleObject(this); }</code><technical_language>Validate boolean input request</technical_language>

Target:
private SimpleObject getVisits(RequestContext context, String patientParameter, String includeInactiveParameter, Date minStartDate) { Collection<Patient> patients = patientParameter == null ? null : Arrays.asList(getPatient(patientParameter)); boolean includeInactive = includeInactiveParameter == null ? true : Boolean.parseBoolean(includeInactiveParameter); return new NeedsPaging<Visit>(Context.getVisitService().getVisits(null, patients, null, null, minStartDate, null, null, null, null, includeInactive, context.getIncludeAll()), context).toSimpleObject(this); }
Source:
<code><START> public void testExtractChunkLabel() <END> { String input = "```{r testingChunks, echo=FALSE}"; String result = ChunkContextUi.extractChunkLabel(input); assertTrue(result.equals("testingChunks")); }</code><technical_language>add a couple more increase code coverage -- in label, another in options? {r echo=TRUE} {r thisisalabel}</technical_language>

Target:
public void testExtractChunkLabel() { List<Pair<String, String>> testList = new ArrayList<>(); testList.add(new Pair<>("```{r echo=FALSE}", "")); testList.add(new Pair<>("```{r testingChunks}", "testingChunks")); testList.add(new Pair<>("```{r testingChunks, echo=FALSE}", "testingChunks")); for (Pair<String, String> td : testList) { String result = ChunkContextUi.extractChunkLabel(td.first); assertTrue(result.equals(td.second)); } }
Source:
<code>public QueryResult<Alert> query(final AlertQuery query) { assertIsOpen(); LOGGER.debug() .setMessage("Querying") .addData("query", query) .log(); final PagedList<models.ebean.Alert> pagedAlerts = _alertQueryGenerator.createAlertQuery(query); <START> final String etag = Long.toHexString(pagedAlerts.getList().stream() <END> .map(alert -> alert.getUpdatedAt().after(alert.getCreatedAt()) ? alert.getUpdatedAt() : alert.getCreatedAt()) .max(Timestamp::compareTo) .orElse(new Timestamp(0)) .getTime()); final List<Alert> values = new ArrayList<>(); pagedAlerts.getList().forEach(ebeanAlert -> { final Alert result = new DefaultAlert.Builder() .setCluster(ebeanAlert.getCluster()) .setContext(ebeanAlert.getContext()) .setId(ebeanAlert.getUuid()) .setMetric(ebeanAlert.getMetric()) .setName(ebeanAlert.getName()) .setOperator(ebeanAlert.getOperator()) .setPeriod(Period.seconds(ebeanAlert.getPeriod())) .setService(ebeanAlert.getService()) .setStatistic(ebeanAlert.getStatistic()) .setValue(new DefaultQuantity.Builder() .setValue(ebeanAlert.getQuantityValue()) .setUnit(ebeanAlert.getQuantityUnit()) .build()) .setExtensions(mergeExtensions(ebeanAlert.getNagiosExtension())) .build(); values.add(result); }); return new DefaultQueryResult<>(values, pagedAlerts.getTotalRowCount(), etag); }</code><technical_language>So, this work is. Unfortunately, place this is broken. gist of problem is etag needs represent entire state of resource, in this case table. Lets talk alternatives</technical_language>

Target:
public QueryResult<Alert> query(final AlertQuery query) { assertIsOpen(); LOGGER.debug() .setMessage("Querying") .addData("query", query) .log(); final PagedList<models.ebean.Alert> pagedAlerts = _alertQueryGenerator.createAlertQuery(query); final Long etag = _alertQueryGenerator.getEtag(); final List<Alert> values = new ArrayList<>(); pagedAlerts.getList().forEach(ebeanAlert -> values.add(convertFromEbeanAlert(ebeanAlert))); return new DefaultQueryResult<>(values, pagedAlerts.getTotalRowCount(), etag.toString()); }
Source:
<code>public void testPartialRead() throws IOException { GoogleCloudStorage rawStorage = createGoogleCloudStorage(); <START> final int segmentSize = 553; final int segmentCount = 5; <END> StorageResourceId resourceId = new StorageResourceId(BUCKET_NAME, "testReadPartialObjects_Object"); byte[] data = writeObject(rawStorage, resourceId, segmentCount * segmentSize); byte[][] readSegments = new byte[segmentCount][segmentSize]; try (SeekableByteChannel readChannel = rawStorage.open(resourceId)) { for (int i = 0; i < segmentCount; i++) { ByteBuffer segmentBuffer = ByteBuffer.wrap(readSegments[i]); int bytesRead = readChannel.read(segmentBuffer); assertThat(bytesRead).isEqualTo(segmentSize); byte[] expectedSegment = Arrays.copyOfRange( data, i * segmentSize, (i * segmentSize) + segmentSize ); assertWithMessage("Unexpected segment data read.") .that(readSegments[i]) .isEqualTo(expectedSegment); } } }</code><technical_language>final modifiers for local variables redundant</technical_language>

Target:
public void testPartialRead() throws IOException { GoogleCloudStorage rawStorage = createGoogleCloudStorage(); int segmentSize = 553; int segmentCount = 5; StorageResourceId resourceId = new StorageResourceId(BUCKET_NAME, "testReadPartialObjects_Object"); byte[] data = writeObject(rawStorage, resourceId, segmentCount * segmentSize); byte[][] readSegments = new byte[segmentCount][segmentSize]; try (SeekableByteChannel readChannel = rawStorage.open(resourceId)) { for (int i = 0; i < segmentCount; i++) { ByteBuffer segmentBuffer = ByteBuffer.wrap(readSegments[i]); int bytesRead = readChannel.read(segmentBuffer); assertThat(bytesRead).isEqualTo(segmentSize); byte[] expectedSegment = Arrays.copyOfRange( data, i * segmentSize, i * segmentSize + segmentSize); assertWithMessage("Unexpected segment data read.") .that(readSegments[i]) .isEqualTo(expectedSegment); } } }
Source:
<code>public void redirectCarriesQueryAndFragment() throws IOException { MatcherAssert.assertThat( new RsPrint( new TkRedirect("<LINK_0>").act( new RqFake("GET", "/hi?a=1#test") ) ).print(), <START> Matchers.equalTo( <END> Joiner.on(TkRedirectTest.NEWLINE).join( "HTTP/1.1 303 See Other", String.format( TkRedirectTest.LOCATION, "<LINK_0>&a=1#test" ), "", "" ) ) ); }</code><technical_language>@neonailol clearer HmRsHeader("Location", ...)</technical_language>

Target:
public void redirectCarriesQueryAndFragment() throws IOException { MatcherAssert.assertThat( new TkRedirect("<LINK_0>").act( new RqFake("GET", "/hi?a=1#test") ), new HmRsHeader( "Location", "<LINK_0>&a=1#test" ) ); }
Source:
<code>private void parseV2Location(String remoteFile) { Path remoteFilePath = Paths.get(remoteFile); parseV2Prefix(remoteFilePath); <START> assert remoteFilePath.getNameCount() >= 8; <END> int name_count_idx = 3; type = BackupFileType.valueOf(remoteFilePath.getName(name_count_idx++).toString()); setLastModified( Instant.ofEpochMilli( Long.parseLong(remoteFilePath.getName(name_count_idx++).toString()))); if (type == BackupFileType.SST_V2) { keyspace = remoteFilePath.getName(name_count_idx++).toString(); columnFamily = remoteFilePath.getName(name_count_idx++).toString(); } setCompression( ICompression.CompressionAlgorithm.valueOf( remoteFilePath.getName(name_count_idx++).toString())); setEncryption( IFileCryptography.CryptographyAlgorithm.valueOf( remoteFilePath.getName(name_count_idx++).toString())); fileName = remoteFilePath.getName(name_count_idx).toString(); }</code><technical_language>prod test fleet Priams do run assertions enabled, this assertion help, enable assertions ( I big fan of enabling in prod) validations</technical_language>

Target:
private void parseV2Location(String remoteFile) { Path remoteFilePath = Paths.get(remoteFile); parseV2Prefix(remoteFilePath); if (remoteFilePath.getNameCount() < 8) throw new IndexOutOfBoundsException( String.format( "Too few elements (expected: [%d]) in path: %s", 8, remoteFilePath)); int name_count_idx = 3; type = BackupFileType.valueOf(remoteFilePath.getName(name_count_idx++).toString()); setLastModified( Instant.ofEpochMilli( Long.parseLong(remoteFilePath.getName(name_count_idx++).toString()))); if (type == BackupFileType.SST_V2) { keyspace = remoteFilePath.getName(name_count_idx++).toString(); columnFamily = remoteFilePath.getName(name_count_idx++).toString(); } setCompression( ICompression.CompressionAlgorithm.valueOf( remoteFilePath.getName(name_count_idx++).toString())); setEncryption( IFileCryptography.CryptographyAlgorithm.valueOf( remoteFilePath.getName(name_count_idx++).toString())); fileName = remoteFilePath.getName(name_count_idx).toString(); }
Source:
<code>public void runNextStage() { if (finished) { Logger.debug(LOG_TAG, "All stages complete."); return; } stageIndex++; try{ <START> stages.get(stageIndex).execute(this); <END> Log.d(LOG_TAG, "running stage " + stages.get(stageIndex).toString()); } catch (Exception e) { Logger.error(LOG_TAG, "Exception in stage " + stages.get(stageIndex), e); abort("Stage exception."); } }</code><technical_language>treat stages a queue, pop go. eliminate some memory usage counter, totally prevent multiple uses</technical_language>

Target:
public void runNextStage() { if (finished || stages.size() == 0) { Logger.debug(LOG_TAG, "All stages complete."); return; } JPakeStage nextStage = null; try{ nextStage = stages.remove(); Logger.debug(LOG_TAG, "starting stage " + nextStage.toString()); nextStage.execute(this); } catch (Exception e) { Logger.error(LOG_TAG, "Exception in stage " + nextStage, e); abort("Stage exception."); } }
Source:
<code>public void testReserveNeverExhaustsPool() { ChannelPool pool = new ChannelPool(new Channel[] { null, null }, null); <START> for (int i = 0; i < 10; i++) { <END> pool.reserveChannel(); assertTrue(pool.size() > 0); } }</code><technical_language>nit: pool.reserveChannel(); for (int i = 0; i < 10; i++) { pool.reserveChannel(); assertEquals(1, pool.size()); }</technical_language>

Target:
public void testReserveNeverExhaustsPool() { ChannelPool pool = new ChannelPool(new Channel[] { null, null }, null); for (int i = 0; i < 10; i++) { pool.reserveChannel(); assertEquals(1, pool.size()); } }