auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void addWAL(final WAL wal) { if (null == wals.putIfAbsent(wal, new RollController(wal))) { wal.registerWALActionsListener(new WALActionsListener.Base() { @Override public void logRollRequested(WALActionsListener.RollRequestReason reason) { <START> RollController controller = wals.get(wal); <END> if (controller == null) { synchronized(wals) { controller = wals.get(wal); if (controller == null) { controller = new RollController(wal); wals.put(wal, controller); } } } controller.requestRoll(); synchronized(rollLog) { rollLog.set(true); rollLog.notifyAll(); } } }); } }</code><technical_language>I see.. of jdk 1.7 support, this is Findbugs complain</technical_language>

Target:
public void addWAL(final WAL wal) { if (null == wals.putIfAbsent(wal, new RollController(wal))) { wal.registerWALActionsListener(new WALActionsListener.Base() { @Override public void logRollRequested(WALActionsListener.RollRequestReason reason) { RollController controller = wals.get(wal); if (controller == null) { wals.putIfAbsent(wal, new RollController(wal)); controller = wals.get(wal); } controller.requestRoll(); synchronized(rollLog) { rollLog.set(true); rollLog.notifyAll(); } } }); } }
Source:
<code>private BigDecimal mean() { <START> BigDecimal sum = new BigDecimal(0.0); <END> int i = 0; decimalVals = new BigDecimal[valueVsCount.size()]; for (Entry<ImmutableBytesPtr, Integer> entry : valueVsCount.entrySet()) { BigDecimal colValue = (BigDecimal)PDataType.DECIMAL.toObject(entry.getKey()); sum = sum.add(colValue.multiply(new BigDecimal(entry.getValue()))); decimalVals[i++] = colValue; } return BigDecimalUtil.divide(sum, new BigDecimal(totalCount)); }</code><technical_language>BigDecimal.ZERO here</technical_language>

Target:
private BigDecimal mean() { BigDecimal sum = BigDecimal.ZERO; for (Entry<ImmutableBytesPtr, Integer> entry : valueVsCount.entrySet()) { BigDecimal colValue = (BigDecimal)PDataType.DECIMAL.toObject(entry.getKey()); sum = sum.add(colValue.multiply(new BigDecimal(entry.getValue()))); } return sum.divide(new BigDecimal(totalCount), PDataType.DEFAULT_MATH_CONTEXT); }
Source:
<code>public final void perform(GoogleRobotCredentials credentials, Run<?, ?> run, FilePath workspace, TaskListener listener) throws UploadException { if (!forResult(run.getResult())) { return; } try { BucketPath storagePrefix = new BucketPath(getBucket(), run, listener, moduleName()); if (storagePrefix.error()) { <START> return; <END> } UploadSpec uploads = getInclusions( run, checkNotNull(workspace), listener); if (uploads != null) { BuildGcsUploadReport links = BuildGcsUploadReport.of(run); links.addBucket(storagePrefix.bucket); initiateUploadsAtWorkspace(credentials, run, storagePrefix, uploads, listener); } } catch (InterruptedException e) { throw new UploadException(Messages.AbstractUpload_UploadException(), e); } catch (IOException e) { throw new UploadException(Messages.AbstractUpload_UploadException(), e); } }</code><technical_language>I this behavior this change, is intentional this method logs error message, completes successfully bucket name is invalid</technical_language>

Target:
public final void perform(GoogleRobotCredentials credentials, Run<?, ?> run, FilePath workspace, TaskListener listener) throws UploadException { if (!forResult(run.getResult())) { return; } try { String resolvedBucket = StorageUtil.replaceMacro(getBucket(), run, listener); BucketPath storagePrefix = new BucketPath(resolvedBucket); UploadSpec uploads = getInclusions( run, checkNotNull(workspace), listener); if (uploads != null) { BuildGcsUploadReport links = BuildGcsUploadReport.of(run); links.addBucket(storagePrefix.getBucket()); initiateUploadsAtWorkspace(credentials, run, storagePrefix, uploads, listener); } } catch (InterruptedException e) { throw new UploadException(Messages.AbstractUpload_UploadException(), e); } catch (IOException e) { throw new UploadException(Messages.AbstractUpload_UploadException(), e); } }
Source:
<code>public static QuantityType<?> operator_divide(Number x, QuantityType<?> y) { <START> QuantityType<?> xQuantity = new QuantityType<>("" + x.doubleValue()); <END> return operator_divide(xQuantity, y); }</code><technical_language>"" + x.doubleValue() - is this elegant get a String a double...? if is a usecase instantiate a QuantityType passing a unit, want add a constructor for double well)</technical_language>

Target:
public static QuantityType<?> operator_divide(Number x, QuantityType<?> y) { QuantityType<Dimensionless> xQuantity = new QuantityType<>(x, SmartHomeUnits.ONE); return operator_divide(xQuantity, y); }
Source:
<code>public Future<?> scheduleCancelLotsOutsideLoop(final ThreadState threadState) { for (int i = 1; i <= threadState.num; i++) { <START> threadState.eventLoop.schedule(NO_OP, i, TimeUnit.HOURS).cancel(false); <END> } return null; }</code><technical_language>ditto before</technical_language>

Target:
public Future<?> scheduleCancelLotsOutsideLoop(final ThreadState threadState) { final AbstractScheduledEventExecutor eventLoop = threadState.eventLoop; for (int i = 1; i <= threadState.num; i++) { eventLoop.schedule(NO_OP, i, TimeUnit.HOURS).cancel(false); } return null; }
Source:
<code>public void reset() { <START> hasParsedHeader = !firstRowIsHeader; <END> }</code><technical_language>This hasParsedHeader = false right? simpler</technical_language>

Target:
public void reset() { hasParsedHeader = false; }
Source:
<code>private Command addOrderLine(OrderId orderId) { final double price = 51.33; final Book book = Book.newBuilder() .setBookId(BookId.newBuilder().setISBN("978-0321125217").build()) .setAuthor("Eric Evans") .setTitle("Domain Driven Design.") .setPrice(price) .build(); final int quantity = 1; final double totalPrice = book.getPrice() * quantity; final OrderLine orderLine = OrderLine.newBuilder() .setProductId(Messages.toAny(book.getBookId())) .setQuantity(quantity) <START> .setTotal(totalPrice) <END> .build(); final AddOrderLine msg = AddOrderLine.newBuilder() .setOrderId(orderId) .setOrderLine(orderLine).build(); return commandFactory.create(msg); }</code><technical_language>Money here</technical_language>

Target:
private Command addOrderLine(OrderId orderId) { final int bookPriceUsd = 52; final Book book = Book.newBuilder() .setBookId(BookId.newBuilder().setISBN("978-0321125217").build()) .setAuthor("Eric Evans") .setTitle("Domain Driven Design.") .setPrice(newMoney(bookPriceUsd, USD)) .build(); final int quantity = 1; final Money totalPrice = newMoney(bookPriceUsd * quantity, USD); final OrderLine orderLine = OrderLine.newBuilder() .setProductId(Messages.toAny(book.getBookId())) .setQuantity(quantity) .setPrice(totalPrice) .build(); final AddOrderLine msg = AddOrderLine.newBuilder() .setOrderId(orderId) .setOrderLine(orderLine).build(); return commandFactory.create(msg); }
Source:
<code><START> public List<AnnotationMirror> getPostconditionAnnotation( <END> VariableElement elt, AField f, List<AnnotationMirror> preconds) { return getPreOrPostconditionAnnotation(elt, f, AFTER, preconds); }</code><technical_language>This returns null, implementation return empty list. intended. If clients expect null, please add @Nullable return type</technical_language>

Target:
public List<AnnotationMirror> getPostconditionAnnotation( VariableElement elt, AField f, List<AnnotationMirror> preconds) { return getPreOrPostconditionAnnotation(elt, f, BeforeOrAfter.AFTER, preconds); }
Source:
<code>public RowExpression visitSpecialForm(SpecialFormExpression specialForm, Form clauseJoiner) { if (!isConjunctionOrDisjunction(specialForm)) { return specialForm; } RowExpression left = specialForm.getArguments().get(0).accept(new ConvertNormalFormVisitor(), clauseJoiner); RowExpression right = specialForm.getArguments().get(1).accept(new ConvertNormalFormVisitor(), clauseJoiner); <START> <END> if (specialForm.getForm() == clauseJoiner) { return clauseJoiner == AND ? and(left, right) : or(left, right); } Form termJoiner = clauseJoiner == AND ? OR : AND; List<RowExpression> leftClauses = extractPredicates(clauseJoiner, left); List<RowExpression> rightClauses = extractPredicates(clauseJoiner, right); List<RowExpression> permutationClauses = new ArrayList<>(); leftClauses.forEach(leftClause -> rightClauses.forEach(rightClause -> permutationClauses.add(termJoiner == AND ? and(leftClause, rightClause) : or(leftClause, rightClause)))); return combinePredicates(clauseJoiner, unmodifiableList(permutationClauses)); }</code><technical_language>For argument, rewrite normal form clauseJoiner (instead of termJoiner? )</technical_language>

Target:
public RowExpression visitSpecialForm(SpecialFormExpression specialForm, Form clauseJoiner) { if (!isConjunctionOrDisjunction(specialForm)) { return specialForm; } RowExpression left = specialForm.getArguments().get(0).accept(new ConvertNormalFormVisitor(), clauseJoiner); RowExpression right = specialForm.getArguments().get(1).accept(new ConvertNormalFormVisitor(), clauseJoiner); if (specialForm.getForm() == clauseJoiner) { return clauseJoiner == AND ? and(left, right) : or(left, right); } Form termJoiner = clauseJoiner == AND ? OR : AND; List<RowExpression> leftClauses = extractPredicates(clauseJoiner, left); List<RowExpression> rightClauses = extractPredicates(clauseJoiner, right); List<RowExpression> permutationClauses = new ArrayList<>(); for (RowExpression leftClause : leftClauses) { for (RowExpression rightClause : rightClauses) { permutationClauses.add(termJoiner == AND ? and(leftClause, rightClause) : or(leftClause, rightClause)); } } return combinePredicates(clauseJoiner, unmodifiableList(permutationClauses)); }
Source:
<code>public DataContainer toContainer() { DataContainer data = super.toContainer(); data.set(Keys.ZOMBIE_TYPE, getType()); <START> if(getProfession().isPresent()) { <END> data.set(Keys.VILLAGER_ZOMBIE_PROFESSION.getQuery(), getProfession().get()); } return data; }</code><technical_language>if ( (space)</technical_language>

Target:
public DataContainer toContainer() { DataContainer data = super.toContainer(); data.set(Keys.ZOMBIE_TYPE.getQuery(), getType().getId()); if (getProfession().isPresent()) { data.set(Keys.VILLAGER_ZOMBIE_PROFESSION.getQuery(), getProfession().get().getId()); } return data; }
Source:
<code>public Collection<RecipientGroup> getRecipientGroups() { <START> return Collections.unmodifiableCollection(_groups); <END> }</code><technical_language>type of Guava's Immutable* types. need wrap here</technical_language>

Target:
public ImmutableSet<RecipientGroup> getRecipientGroups() { return _groups; }
Source:
<code>@Override public Response load(Uri uri, boolean localCacheOnly) throws IOException { com.squareup.okhttp.Request.Builder requestBuilder = new com.squareup.okhttp.Request.Builder().url(uri.toString()); if (localCacheOnly) { requestBuilder.addHeader("Cache-Control", "only-if-cached,max-age=" + Integer.MAX_VALUE); } com.squareup.okhttp.Response response = client.newCall(requestBuilder.build()).execute(); int responseCode = response.code(); if (responseCode >= 300) { throw new ResponseException(responseCode + " " + response.message(), localCacheOnly, responseCode); } boolean fromCache = response.cacheResponse() != null; ResponseBody responseBody = response.body(); <START> return new Response(responseBody.byteStream(), fromCache, responseBody.contentLength()); <END> }</code><technical_language>responseBody.contentLength() return default if header is missing? losing -1 above? is a reason for -1 respect request replaying</technical_language>

Target:
@Override public Response load(Uri uri, boolean localCacheOnly) throws IOException { com.squareup.okhttp.Request.Builder requestBuilder = new com.squareup.okhttp.Request.Builder().url(uri.toString()); if (localCacheOnly) { requestBuilder.addHeader("Cache-Control", "only-if-cached,max-age=" + Integer.MAX_VALUE); } com.squareup.okhttp.Response response = client.newCall(requestBuilder.build()).execute(); int responseCode = response.code(); if (responseCode >= 300) { response.body().close(); throw new ResponseException(responseCode + " " + response.message(), localCacheOnly, responseCode); } boolean fromCache = response.cacheResponse() != null; ResponseBody responseBody = response.body(); return new Response(responseBody.byteStream(), fromCache, responseBody.contentLength()); }
Source:
<code>public void sendOperation(final String targetEvalId, final DataOperation operation) { final Codec codec = serializer.getCodec(operation.getDataType()); if (operation.isFromLocalClient()) { resultHandler.registerOperation(operation); } try (final TraceScope traceScope = Trace.startSpan("SEND_REMOTE_OP")) { final TraceInfo traceInfo = TraceInfo.fromSpan(traceScope.getSpan()); final ByteBuffer inputData = operation.getInputData().isPresent() ? ByteBuffer.wrap(codec.encode(operation.getInputData().get())) : null; final Optional<String> origEvalID = operation.getOrigEvalId(); msgSender.get().sendRemoteOpMsg(origEvalID.get(), targetEvalId, operation.getOperationType(), operation.getDataType(), operation.getDataKey(), inputData, operation.getOperationId(), traceInfo); } if (operation.isFromLocalClient()) { try { operation.waitOperation(TIMEOUT_MS); } catch (final InterruptedException e) { LOG.log(Level.SEVERE, "Interrupted while waiting for executing remote operation", e); } finally { if (resultHandler.deregisterOperation(operation.getOperationId()) != null) { <START> LOG.log(Level.WARNING, "The operation {0} has no response in timeout.", operation.getOperationId()); <END> } } } }</code><technical_language>"The operation {OP_ID} response for {TIMEOUT_MS} ms"</technical_language>

Target:
void sendOperation(final String targetEvalId, final DataOperation operation) { final Codec codec = serializer.getCodec(operation.getDataType()); if (operation.isFromLocalClient()) { resultHandler.registerOperation(operation); } try (final TraceScope traceScope = Trace.startSpan("SEND_REMOTE_OP")) { final TraceInfo traceInfo = TraceInfo.fromSpan(traceScope.getSpan()); final ByteBuffer inputData = operation.getDataValue().isPresent() ? ByteBuffer.wrap(codec.encode(operation.getDataValue().get())) : null; msgSender.get().sendRemoteOpMsg((String) operation.getOrigEvalId().get(), targetEvalId, operation.getOperationType(), operation.getDataType(), operation.getDataKey(), inputData, operation.getOperationId(), traceInfo); } if (operation.isFromLocalClient()) { try { operation.waitOperation(TIMEOUT_MS); } catch (final InterruptedException e) { LOG.log(Level.SEVERE, "Interrupted while waiting for executing remote operation", e); } finally { if (resultHandler.deregisterOperation(operation.getOperationId()) != null) { LOG.log(Level.WARNING, "The operation {0} has no response for {1} ms.", new Object[]{operation.getOperationId(), TIMEOUT_MS}); } } } }
Source:
<code>public void testPostNewAppointmentAndGetAppointmentID() throws Exception { List<String> applicants = new ArrayList<>(); applicants.add("My test Appointment"); List<String> users = new ArrayList<>(); users.add("testUserId"); Appointment appointment = new Appointment(users, applicants, 555); String appointmentJson = jsonUtil.toJson(appointment); mockMvc.perform( post("/appointments") .contentType(MediaType.APPLICATION_JSON) .content(appointmentJson) ) .andExpect(content().contentType("application/json")) <START> .andExpect(content().string("4")) <END> .andExpect(status().isAccepted()); }</code><technical_language>return Id in body? I response Json</technical_language>

Target:
public void testPostNewAppointmentAndGetAppointmentID() throws Exception { List<String> applicants = new ArrayList<>(); applicants.add("My test Appointment"); List<String> users = new ArrayList<>(); users.add("testUserId"); Appointment appointment = new Appointment(users, applicants, 555); String appointmentJson = jsonUtil.toJson(appointment); String exptectedIdJson = jsonUtil.toJson(4); MvcResult ExpectingObject = mockMvc.perform( post("/appointments") .contentType(MediaType.APPLICATION_JSON) .content(appointmentJson) ) .andExpect(content().contentType("application/json")) .andExpect(status().isAccepted()) .andReturn(); String ExpectID = ExpectingObject.getResponse().getContentAsString(); assertEquals("Return Appointment ID in JSON in response to Post appointment request", exptectedIdJson, ExpectID); }
Source:
<code>public void serialize(PrecisionRecallState state, BlockBuilder out) { int requiredBytes = SizeOf.SIZE_OF_INT + SizeOf.SIZE_OF_INT; if (state.getTrueWeights() != null) { requiredBytes += state.getTrueWeights().getRequiredBytesForSerialization(); requiredBytes += state.getFalseWeights().getRequiredBytesForSerialization(); } SliceOutput sliceOut = Slices.allocate(requiredBytes).getOutput(); <START> sliceOut.appendInt(state.getNull() ? 1 : 0); <END> sliceOut.appendInt(state.getTrueWeights() == null ? 0 : 1); if (state.getTrueWeights() != null) { state.getTrueWeights().serialize(sliceOut); state.getFalseWeights().serialize(sliceOut); } VARBINARY.writeSlice(out, sliceOut.getUnderlyingSlice()); }</code><technical_language>Nit: appendByte</technical_language>

Target:
public void serialize(PrecisionRecallState state, BlockBuilder out) { int requiredBytes = SizeOf.SIZE_OF_BYTE; if (state.getTrueWeights() != null) { requiredBytes += state.getTrueWeights().getRequiredBytesForSerialization(); requiredBytes += state.getFalseWeights().getRequiredBytesForSerialization(); } SliceOutput sliceOut = Slices.allocate(requiredBytes).getOutput(); sliceOut.appendByte(state.getTrueWeights() == null ? 0 : 1); if (state.getTrueWeights() != null) { state.getTrueWeights().serialize(sliceOut); state.getFalseWeights().serialize(sliceOut); } VARBINARY.writeSlice(out, sliceOut.getUnderlyingSlice()); }
Source:
<code>private void runReadRequest(XdkRequestInfo requestInfo) { ChannelRecord record = requestInfo.channelRecord; try { Xdk xdk = getXdk(requestInfo.xdkAddress); if (xdk.isConnected()) { Object readResult = getReadResult(requestInfo.sensorName, xdk); final Optional<TypedValue<?>> typedValue = getTypedValue(requestInfo.dataType, readResult); if (!typedValue.isPresent()) { record.setChannelStatus(new ChannelStatus(FAILURE, "Error while converting the retrieved value to the defined typed", null)); record.setTimestamp(System.currentTimeMillis()); return; } record.setValue(typedValue.get()); record.setChannelStatus(new ChannelStatus(SUCCESS)); record.setTimestamp(System.currentTimeMillis()); } else { record.setChannelStatus(new ChannelStatus(FAILURE, "Unable to Connect...", null)); record.setTimestamp(System.currentTimeMillis()); <START> return; <END> } } catch (KuraBluetoothIOException | ConnectionException e) { record.setChannelStatus(new ChannelStatus(ChannelFlag.FAILURE, "Xdk Read Operation Failed", null)); record.setTimestamp(System.currentTimeMillis()); logger.warn(e.getMessage()); return; } }</code><technical_language>This return in catch block needed</technical_language>

Target:
private void runReadRequest(XdkRequestInfo requestInfo) { ChannelRecord record = requestInfo.channelRecord; try { Xdk xdk = getXdk(requestInfo.xdkAddress); if (xdk.isConnected()) { Object readResult = getReadResult(requestInfo.sensorName, xdk); final Optional<TypedValue<?>> typedValue = getTypedValue(requestInfo.dataType, readResult); if (!typedValue.isPresent()) { record.setChannelStatus(new ChannelStatus(FAILURE, "Error while converting the retrieved value to the defined typed", null)); record.setTimestamp(System.currentTimeMillis()); return; } record.setValue(typedValue.get()); record.setChannelStatus(new ChannelStatus(SUCCESS)); record.setTimestamp(System.currentTimeMillis()); } else { record.setChannelStatus(new ChannelStatus(FAILURE, "Unable to Connect...", null)); record.setTimestamp(System.currentTimeMillis()); } } catch (KuraBluetoothIOException | ConnectionException e) { record.setChannelStatus(new ChannelStatus(ChannelFlag.FAILURE, "Xdk Read Operation Failed", null)); record.setTimestamp(System.currentTimeMillis()); logger.warn(e.getMessage()); } }
Source:
<code>public void testVertexCentricQuery() { <START> int noVertices = 10000; <END> }</code><technical_language>is this wanted do here? this is previous PR called testVertexCentricQuery(10000)</technical_language>

Target:
public void testVertexCentricQuery() { testVertexCentricQuery(10000 ); }
Source:
<code>public Map list() { final Host host = getActiveHost(); <START> Map resultMap = getDoneStatus(); <END> List statusList = new ArrayList(); for (VM vm : host.getRunningVMs().values()) { Map vmMap = map(); vmMap.put("status", vm.getStatus().toString()); vmMap.put("vmId", vm.getId()); statusList.add(vmMap); } resultMap.put("vmList", statusList); return resultMap; }</code><technical_language>removed final</technical_language>

Target:
public Map list() { final Host host = getActiveHost(); final Map resultMap = getDoneStatus(); final List statusList = new ArrayList(); for (VM vm : host.getRunningVMs().values()) { Map vmMap = map(); vmMap.put("status", vm.getStatus().toString()); vmMap.put("vmId", vm.getId()); statusList.add(vmMap); } resultMap.put("vmList", statusList); return resultMap; }
Source:
<code>protected InternalCacheEntry<WrappedBytes, WrappedBytes> performRemove(long bucketHeadAddress, Object key) { WrappedByteArray wba = toWrapper(key); long prevAddress = 0; while (bucketHeadAddress != 0) { long nextAddress = offHeapEntryFactory.getNext(bucketHeadAddress); InternalCacheEntry<WrappedBytes, WrappedBytes> ice = offHeapEntryFactory.fromMemory(bucketHeadAddress); if (ice.getKey().equals(wba)) { entryRemoved(bucketHeadAddress); if (prevAddress != 0) { offHeapEntryFactory.setNext(prevAddress, nextAddress); } else { memoryLookup.putMemoryAddress(key, nextAddress); } size.decrementAndGet(); return ice; } prevAddress = bucketHeadAddress; <START> bucketHeadAddress = nextAddress; <END> } return null; }</code><technical_language>more small complaint: change bucketHeadAddress longer a head of list, a local variable for iteration</technical_language>

Target:
protected InternalCacheEntry<WrappedBytes, WrappedBytes> performRemove(long bucketHeadAddress, Object key) { WrappedByteArray wba = toWrapper(key); long prevAddress = 0; long address = bucketHeadAddress; while (address != 0) { long nextAddress = offHeapEntryFactory.getNext(address); InternalCacheEntry<WrappedBytes, WrappedBytes> ice = offHeapEntryFactory.fromMemory(address); if (ice.getKey().equals(wba)) { entryRemoved(address); if (prevAddress != 0) { offHeapEntryFactory.setNext(prevAddress, nextAddress); } else { memoryLookup.putMemoryAddress(key, nextAddress); } size.decrementAndGet(); return ice; } prevAddress = address; address = nextAddress; } return null; }
Source:
<code>private void logTasks() { <START> final StringBuilder stringBuilder = new StringBuilder(1024).append("\n\n"); <END> for (Task task : tasks.build()) { stringBuilder.append(String.format(" %-7s /tasks/%s (%s)\n", "POST", task.getName(), task.getClass().getCanonicalName())); } LOG.info(stringBuilder.toString()); }</code><technical_language>prefixing this "tasks" other logging routines here</technical_language>

Target:
private void logTasks() { final StringBuilder stringBuilder = new StringBuilder(1024).append("\n\n"); for (Task task : tasks.build()) { stringBuilder.append(String.format(" %-7s /tasks/%s (%s)\n", "POST", task.getName(), task.getClass().getCanonicalName())); } LOG.info("tasks = {}", stringBuilder.toString()); }
Source:
<code>private Mono<Void> appendBlock(Flux<ByteBuffer> blockData, long offset, long writeLength) { this.appendPositionAccessConditions.setAppendPosition(offset); return client.appendBlockWithResponse(blockData, writeLength, appendBlobAccessConditions) .then() .onErrorResume(t -> t instanceof IOException || t instanceof BlobStorageException, e -> { this.lastError = new IOException(e); <START> return null; <END> }); }</code><technical_language>this work? I noticed null returns. iirc, throw exception if a null is returned</technical_language>

Target:
private Mono<Void> appendBlock(Flux<ByteBuffer> blockData, long offset, long writeLength) { this.appendPositionAccessConditions.setAppendPosition(offset); return client.appendBlockWithResponse(blockData, writeLength, appendBlobAccessConditions) .then() .onErrorResume(t -> t instanceof IOException || t instanceof BlobStorageException, e -> { this.lastError = new IOException(e); return Mono.empty(); }); }
Source:
<code>private MappedClass addMappedClass(final MappedClass mc, final boolean validate) { addConverters(mc); <START> if (validate && !mc.isInterface()) { <END> mc.validate(this); } mappedClasses.put(mc.getClazz().getName(), mc); Set<MappedClass> mcs = mappedClassesByCollection.get(mc.getCollectionName()); if (mcs == null) { mcs = new CopyOnWriteArraySet<MappedClass>(); final Set<MappedClass> temp = mappedClassesByCollection.putIfAbsent(mc.getCollectionName(), mcs); if (temp != null) { mcs = temp; } } mcs.add(mc); return mc; }</code><technical_language>this change for? If necessary unit tested</technical_language>

Target:
private MappedClass addMappedClass(final MappedClass mc, final boolean validate) { addConverters(mc); if (validate) { mc.validate(this); } mappedClasses.put(mc.getClazz().getName(), mc); Set<MappedClass> mcs = mappedClassesByCollection.get(mc.getCollectionName()); if (mcs == null) { mcs = new CopyOnWriteArraySet<MappedClass>(); final Set<MappedClass> temp = mappedClassesByCollection.putIfAbsent(mc.getCollectionName(), mcs); if (temp != null) { mcs = temp; } } mcs.add(mc); return mc; }
Source:
<code>public void canFilterOutUninterestingMetrics() { MetricsManager differentManager = MetricsManagers.createAlwaysSafeAndFilteringForTests(); SweepOutcomeMetrics.registerTargeted( metricsManager, ImmutableMap.of("strategy", "thorough"), () -> false); <START> TargetedSweepMetrics targetedMetrics = TargetedSweepMetrics <END> .create(differentManager, mock(TimelockService.class), new InMemoryKeyValueService(true), TargetedSweepMetrics.MetricsConfiguration.builder() .millisBetweenRecomputingMetrics(Long.MAX_VALUE) .build()); SweepOutcomeMetrics.TARGETED_OUTCOMES.forEach(outcome -> { targetedMetrics.registerOccurrenceOf(ShardAndStrategy.thorough(1), outcome); assertThat(metricsManager).hasNotRegisteredTargetedOutcome(THOROUGH, outcome); }); }</code><technical_language>i din't understand need register SweepOutcomeMetrics all/ a metrics manager</technical_language>

Target:
public void canFilterOutUninterestingMetrics() { SweepOutcomeMetrics.registerTargeted( metricsManager, ImmutableMap.of("strategy", "thorough"), () -> false); TargetedSweepMetrics targetedMetrics = TargetedSweepMetrics .create(metricsManager, mock(TimelockService.class), new InMemoryKeyValueService(true), TargetedSweepMetrics.MetricsConfiguration.builder() .millisBetweenRecomputingMetrics(Long.MAX_VALUE) .build()); SweepOutcomeMetrics.TARGETED_OUTCOMES.forEach(outcome -> { targetedMetrics.registerOccurrenceOf(ShardAndStrategy.thorough(1), outcome); }); org.assertj.core.api.Assertions.assertThat(metricsManager.getPublishableMetrics().getMetrics()).isEmpty(); }
Source:
<code>public void showLoanRepaymentTransactions(List<LoanRepaymentRequest> loanRepaymentRequests) { mLoanRepaymentRequests = loanRepaymentRequests; if (loanRepaymentRequests.size() == 0) { ll_error.setVisibility(View.VISIBLE); <START> mNoPayloadText.setText("There is No LoanRepayment to Sync"); <END> mNoPayloadIcon.setImageResource(R.drawable.ic_assignment_turned_in_black_24dp); } else { mSyncLoanRepaymentAdapter.setLoanRepaymentRequests(loanRepaymentRequests); } }</code><technical_language>hardcoded strings</technical_language>

Target:
public void showLoanRepaymentTransactions(List<LoanRepaymentRequest> loanRepaymentRequests) { mLoanRepaymentRequests = loanRepaymentRequests; if (loanRepaymentRequests.size() == 0) { ll_error.setVisibility(View.VISIBLE); mNoPayloadText.setText(getActivity() .getResources().getString(R.string.no_repayment_to_sync)); mNoPayloadIcon.setImageResource(R.drawable.ic_assignment_turned_in_black_24dp); } else { mSyncLoanRepaymentAdapter.setLoanRepaymentRequests(loanRepaymentRequests); } }
Source:
<code>public static ProjectConfigDto toProjectConfig(Project project, UriBuilder serviceUriBuilder) throws ForbiddenException, ServerException, ProjectTypeConstraintException, ValueStorageException { String name = project.getName(); String path = project.getPath(); <START> ProjectConfigDto projectConfigDto = DtoFactory.getInstance().createDto(ProjectConfigDto.class); <END> projectConfigDto.withName(name).withPath(path); try { ProjectConfig config = project.getConfig(); projectConfigDto.withDescription(config.getDescription()); projectConfigDto.withMixins(config.getMixins()); projectConfigDto.withAttributes(config.getAttributes()); List<ProjectConfigDto> modules = config.getModules() .stream() .map(DtoConverter::toProjectConfigDto) .collect(Collectors.toList()); projectConfigDto.withModules(modules); projectConfigDto.withContentRoot(config.getContentRoot()); projectConfigDto.withType(config.getType()); projectConfigDto.withSource(toSourceDto(config.getSource())); projectConfigDto.setContentRoot(project.getContentRoot()); } catch (ServerException | ValueStorageException | ProjectTypeConstraintException exception) { projectConfigDto.withType(BaseProjectType.ID).withType("blank"); ProjectProblem projectProblem = DtoFactory.getInstance() .createDto(ProjectProblem.class) .withCode(1) .withMessage(exception.getMessage()); projectConfigDto.getProblems().add(projectProblem); } if (serviceUriBuilder != null) { projectConfigDto.withLinks(generateProjectLinks(project, serviceUriBuilder)); } return projectConfigDto; }</code><technical_language>a hint: In this case DtoFactory.newDto(ProjectConfigDto.class) for</technical_language>

Target:
public static ProjectConfigDto toProjectConfig(Project project, UriBuilder serviceUriBuilder) throws ForbiddenException, ServerException, ProjectTypeConstraintException, ValueStorageException { String name = project.getName(); String path = project.getPath(); ProjectConfigDto projectConfigDto = newDto(ProjectConfigDto.class); projectConfigDto.withName(name).withPath(path); try { ProjectConfig config = project.getConfig(); projectConfigDto.withDescription(config.getDescription()); projectConfigDto.withMixins(config.getMixins()); projectConfigDto.withAttributes(config.getAttributes()); List<ProjectConfigDto> modules = config.getModules() .stream() .map(DtoConverter::toProjectConfigDto) .collect(Collectors.toList()); projectConfigDto.withModules(modules); projectConfigDto.withContentRoot(config.getContentRoot()); projectConfigDto.withType(config.getType()); projectConfigDto.withSource(toSourceDto(config.getSource())); projectConfigDto.setContentRoot(project.getContentRoot()); } catch (ServerException | ValueStorageException | ProjectTypeConstraintException exception) { projectConfigDto.withType(BaseProjectType.ID).withType("blank"); ProjectProblem projectProblem = newDto(ProjectProblem.class).withCode(1).withMessage(exception.getMessage()); projectConfigDto.getProblems().add(projectProblem); } if (serviceUriBuilder != null) { projectConfigDto.withLinks(generateProjectLinks(project, serviceUriBuilder)); } return projectConfigDto; }
Source:
<code>CloudBlobStore(VerifiableProperties properties, PartitionId partitionId, CloudDestination cloudDestination, ClusterMap clusterMap, VcrMetrics vcrMetrics) throws IllegalStateException { CloudConfig cloudConfig = new CloudConfig(properties); ClusterMapConfig clusterMapConfig = new ClusterMapConfig(properties); this.clusterMap = clusterMap; this.cloudDestination = Objects.requireNonNull(cloudDestination, "cloudDestination is required"); this.partitionId = Objects.requireNonNull(partitionId, "partitionId is required"); this.vcrMetrics = Objects.requireNonNull(vcrMetrics, "vcrMetrics is required"); minTtlMillis = TimeUnit.DAYS.toMillis(cloudConfig.vcrMinTtlDays); requireEncryption = cloudConfig.vcrRequireEncryption; <START> recentBlobCache = Collections.synchronizedMap(new RecentBlobCache(1000, cloudConfig.recentBlobCacheLimit)); <END> String cryptoAgentFactoryClass = cloudConfig.cloudBlobCryptoAgentFactoryClass; try { cryptoAgentFactory = Utils.getObj(cryptoAgentFactoryClass, properties, clusterMapConfig.clusterMapClusterName, vcrMetrics.getMetricRegistry()); } catch (ReflectiveOperationException e) { throw new IllegalStateException("Unable to construct factory " + cryptoAgentFactoryClass, e); } this.cryptoAgent = cryptoAgentFactory.getCloudBlobCryptoAgent(); }</code><technical_language>1000 a static final int</technical_language>

Target:
CloudBlobStore(VerifiableProperties properties, PartitionId partitionId, CloudDestination cloudDestination, ClusterMap clusterMap, VcrMetrics vcrMetrics) throws IllegalStateException { CloudConfig cloudConfig = new CloudConfig(properties); ClusterMapConfig clusterMapConfig = new ClusterMapConfig(properties); this.clusterMap = clusterMap; this.cloudDestination = Objects.requireNonNull(cloudDestination, "cloudDestination is required"); this.partitionId = Objects.requireNonNull(partitionId, "partitionId is required"); this.vcrMetrics = Objects.requireNonNull(vcrMetrics, "vcrMetrics is required"); minTtlMillis = TimeUnit.DAYS.toMillis(cloudConfig.vcrMinTtlDays); requireEncryption = cloudConfig.vcrRequireEncryption; recentBlobCache = Collections.synchronizedMap(new RecentBlobCache(cloudConfig.recentBlobCacheLimit)); String cryptoAgentFactoryClass = cloudConfig.cloudBlobCryptoAgentFactoryClass; try { cryptoAgentFactory = Utils.getObj(cryptoAgentFactoryClass, properties, clusterMapConfig.clusterMapClusterName, vcrMetrics.getMetricRegistry()); } catch (ReflectiveOperationException e) { throw new IllegalStateException("Unable to construct factory " + cryptoAgentFactoryClass, e); } this.cryptoAgent = cryptoAgentFactory.getCloudBlobCryptoAgent(); }
Source:
<code>public boolean useAbstractConvertersForConversion(RelTraitSet fromTraits, RelTraitSet toTraits) { return !fromTraits.containsIfApplicable(Convention.NONE); <START> } <END></code><technical_language>this default implementation</technical_language>

Target:
public boolean useAbstractConvertersForConversion(RelTraitSet fromTraits, RelTraitSet toTraits) { return true; }
Source:
<code>public Set<User> getTeamMembersById(@PathVariable Long teamId) { <START> System.out.println("Calling normal method"); <END> Team team = teamService.getTeamById(teamId).orElseThrow(() -> new TeamNotFoundException(teamId)); return team.getMembers(); }</code><technical_language>Left-over syso's for logging purposes</technical_language>

Target:
public Set<User> getTeamMembersById(@PathVariable Long teamId) { Team team = teamService.getTeamById(teamId).orElseThrow(() -> new TeamNotFoundException(teamId)); return team.getMembers(); }
Source:
<code>public boolean hasHoldings(String identifier, BigDecimal amount) { try { <START> return hasAccount(identifier) && Economy.hasEnough(identifier, amount); <END> } catch (UserDoesNotExistException ignore) { return false; } }</code><technical_language>exception catch below, Economy.hasEnough throw</technical_language>

Target:
public boolean hasHoldings(String identifier, BigDecimal amount) { try { return Economy.hasEnough(identifier, amount); } catch (UserDoesNotExistException ignore) { return false; } }
Source:
<code>protected String createUUID() { <START> return (UUID.randomUUID().toString()); <END> }</code><technical_language>Unnecessary parentheses (and extra line break)</technical_language>

Target:
protected String createUUID() { return UUID.randomUUID().toString(); }
Source:
<code><START> public int length() { <END> return mCodes.size(); }</code><technical_language>I guess a name for this is codesCount</technical_language>

Target:
public int length() { return codePointCount(); }
Source:
<code>protected boolean canDoAction() { if (getParameters().getId() == null || !entityExists()) { <START> return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_VM_NOT_FOUND); <END> } return true; }</code><technical_language>message is specific vm..</technical_language>

Target:
protected boolean canDoAction() { if (getParameters().getId() == null || !entityExists()) { return failCanDoAction(getParameters().isVm() ? VdcBllMessages.ACTION_TYPE_FAILED_VM_NOT_FOUND : VdcBllMessages.ACTION_TYPE_FAILED_TEMPLATE_DOES_NOT_EXIST); } return true; }
Source:
<code>public void contextInitialized(ServletContextEvent sce) { FenixFramework.getDomainModel().registerDeletionListener(Person.class, (person) -> { Site homepageSite = person.getHomepage(); if (homepageSite != null) { person.setHomepage(null); homepageSite.getHomepageSite().delete(); } }); FenixFramework.getDomainModel().registerDeletionListener(Unit.class, (unit) -> { Site site = unit.getSite(); if (site != null) { unit.setSite(null); site.delete(); } }); CMSRenderer.addHandler(new HomepageRequestHandler()); CMSRenderer.addHandler(new UnitRequestHandler()); <START> Signal.register(ResultsImportationProcess.QUC_RESULTS_IMPORTED, ExecutionCourseQUCListener.createQUCComponent()) <END> }</code><technical_language>Missing ; end of instruction</technical_language>

Target:
public void contextInitialized(ServletContextEvent sce) { FenixFramework.getDomainModel().registerDeletionListener(Person.class, (person) -> { Site homepageSite = person.getHomepage(); if (homepageSite != null) { person.setHomepage(null); homepageSite.getHomepageSite().delete(); } }); FenixFramework.getDomainModel().registerDeletionListener(Unit.class, (unit) -> { Site site = unit.getSite(); if (site != null) { unit.setSite(null); site.delete(); } }); CMSRenderer.addHandler(new HomepageRequestHandler()); CMSRenderer.addHandler(new UnitRequestHandler()); Signal.register(UserProfile.USER_NAME_CHANGED, HomepageListener::updateName); Signal.register(ResultsImportationProcess.QUC_RESULTS_IMPORTED, (event) -> ExecutionCourseQUCListener.createQUCComponent()); }
Source:
<code>long saveOnlineDetectionData(JsonNode payloadNode, DatasetConfigDTO datasetConfigDTO, MetricConfigDTO metricConfigDTO) throws JsonProcessingException { JsonNode dataNode = payloadNode.get(DATA_FIELD); String timeColumnName = datasetConfigDTO.getTimeColumn(); String datasetName = datasetConfigDTO.getDataset(); String metricName = metricConfigDTO.getName(); <START> <END> ArrayNode columnsNode = dataNode.withArray(COLUMNS_FIELD); int[] colIndices = findTimeAndMetricColumns(columnsNode, timeColumnName, metricName); int timeColIdx = colIndices[0]; int metricColIdx = colIndices[1]; Preconditions.checkArgument(metricColIdx>=0 && timeColIdx>=0, String.format("metric: %s or time: %s not found in adhoc data.", metricName, timeColumnName)); OnlineDetectionDataDTO onlineDetectionDataDTO = new OnlineDetectionDataDTO(); onlineDetectionDataDTO.setDataset(datasetName); onlineDetectionDataDTO.setMetric(metricName); onlineDetectionDataDTO.setOnlineDetectionData(this.objectMapper.writeValueAsString(dataNode)); long id = onlineDetectionDataDAO.save(onlineDetectionDataDTO); LOG.info("Saved online data with dataset: and metric: {}", onlineDetectionDataDTO.getDataset(), onlineDetectionDataDTO.getMetric()); return id; }</code><technical_language>@jasonyanwenl This code good. docs users formatting for adhoc data, is future work for Thirdeye</technical_language>

Target:
OnlineDetectionDataDTO saveOnlineDetectionData(JsonNode payloadNode, DatasetConfigDTO datasetConfigDTO, MetricConfigDTO metricConfigDTO) throws JsonProcessingException { JsonNode dataNode = payloadNode.get(DATA_FIELD); String timeColumnName = datasetConfigDTO.getTimeColumn(); String datasetName = datasetConfigDTO.getDataset(); String metricName = metricConfigDTO.getName(); Preconditions.checkArgument(validateOnlineDetectionData(dataNode, timeColumnName, metricName), String.format("metric: %s or time: %s not found in adhoc data.", metricName, timeColumnName)); OnlineDetectionDataDTO onlineDetectionDataDTO = new OnlineDetectionDataDTO(); onlineDetectionDataDTO.setDataset(datasetName); onlineDetectionDataDTO.setMetric(metricName); onlineDetectionDataDTO.setOnlineDetectionData(this.objectMapper.writeValueAsString(dataNode)); onlineDetectionDataDAO.save(onlineDetectionDataDTO); LOG.info("Saved online data with dataset: and metric: {}", onlineDetectionDataDTO.getDataset(), onlineDetectionDataDTO.getMetric()); return onlineDetectionDataDTO; }
Source:
<code>public Object invoke(String name, Object[] args, String[] sig) throws MBeanException, ReflectionException { if (log.isDebugEnabled()) { log.debugf("Invoke method called on %s", name); } MBeanOperationInfo opInfo = null; for (IspnMBeanOperationInfo op : opInfos) { if (op.getOperationName().equals(name)) { opInfo = op; break; } } if (opInfo == null) { final String msg = "Operation " + name + " not amongst operations in " + opInfos; throw new MBeanException(new ServiceNotFoundException(msg), msg); } for (int i = 0; i < args.length; i++) { if (log.isDebugEnabled()) <START> log.debugf("Argument value before transformation: " + args[i] + " and its class: " + <END> args[i].getClass() + ". For method.invoke we need it to be class: " + sig[i]); if (sig[i].equals(Integer.class.getCanonicalName())) { args[i] = Integer.parseInt((String) args[i]); } if (sig[i].equals(Long.class.getCanonicalName())) { args[i] = Long.parseLong((String) args[i]); } } try { Class<?>[] classes = new Class[sig.length]; for (int i = 0; i < classes.length; i++) { classes[i] = ReflectionUtil.getClassForName(sig[i], null); } Method method = getObject().getClass().getMethod(opInfo.getName(), classes); return method.invoke(getObject(), args); } catch (Exception e) { throw new MBeanException(e); } }</code><technical_language>need string concatenation debug_f_, good call is guarded</technical_language>

Target:
public Object invoke(String name, Object[] args, String[] sig) throws MBeanException, ReflectionException { if (log.isDebugEnabled()) { log.debugf("Invoke method called on %s", name); } MBeanOperationInfo opInfo = null; for (IspnMBeanOperationInfo op : opInfos) { if (op.getOperationName().equals(name)) { opInfo = op; break; } } if (opInfo == null) { final String msg = "Operation " + name + " not amongst operations in " + opInfos; throw new MBeanException(new ServiceNotFoundException(msg), msg); } for (int i = 0; i < args.length; i++) { if (log.isDebugEnabled()) log.debugf("Argument value before transformation: %s and its class: %s. " + "For method.invoke we need it to be class: %s", args[i], args[i].getClass(), sig[i]); if (sig[i].equals(int.class.getCanonicalName())) { args[i] = Integer.parseInt((String) args[i]); } if (sig[i].equals(long.class.getCanonicalName())) { args[i] = Long.parseLong((String) args[i]); } } try { Class<?>[] classes = new Class[sig.length]; for (int i = 0; i < classes.length; i++) { classes[i] = ReflectionUtil.getClassForName(sig[i], null); } Method method = getObject().getClass().getMethod(opInfo.getName(), classes); return method.invoke(getObject(), args); } catch (Exception e) { throw new MBeanException(e); } }
Source:
<code>private Answer executeRequest(DeallocateVmVspCommand cmd) { try { isNuageVspGuruLoaded(); _nuageVspGuruClient.deallocate(cmd.getNetworkUuid(), cmd.getNicFromDdUuid(), cmd.getNicMacAddress(), cmd.getNicIp4Address(), cmd.isL3Network(), cmd.isSharedNetwork(), cmd.getVpcUuid(), cmd.getNetworksDomainUuid(), cmd.getVmInstanceName(), cmd.getVmUuid(), cmd.isExpungingState()); return new DeallocateVmVspAnswer(cmd, true, "Deallocated VM from Nuage VSP."); <START> } catch (Exception e) { <END> s_logger.error("Failure during " + cmd, e); return new DeallocateVmVspAnswer(cmd, e); } }</code><technical_language>unchecked checked exceptions caught? catching expected checked exceptions, allow unchecked exceptions simply bubble out</technical_language>

Target:
private Answer executeRequest(DeallocateVmVspCommand cmd) { try { isNuageVspGuruLoaded(); _nuageVspGuruClient.deallocate(cmd.getNetworkUuid(), cmd.getNicFromDdUuid(), cmd.getNicMacAddress(), cmd.getNicIp4Address(), cmd.isL3Network(), cmd.isSharedNetwork(), cmd.getVpcUuid(), cmd.getNetworksDomainUuid(), cmd.getVmInstanceName(), cmd.getVmUuid(), cmd.isExpungingState()); return new Answer(cmd, true, "Deallocated VM " + cmd.getVmInstanceName() + " on Nuage VSD " + _hostName); } catch (ExecutionException | ConfigurationException e) { s_logger.error("Failure during " + cmd + " on Nuage VSD " + _hostName, e); return new Answer(cmd, e); } }
Source:
<code>public boolean include(final TreeWalk walker) { <START> String walkString = walker.getPathString(); <END> if (fullpaths.contains(walkString)) return true; if (prefixes.contains(walkString)) return true; for (int i = walkString.indexOf('/'); i > 0; i = walkString .indexOf('/', i + 1)) { String prefix = walkString.substring(0, i); if (fullpaths.contains(prefix)) return true; } byte[] r = max.pathRaw; final int cmp = walker.isPathPrefix(r, r.length); if (cmp > 0) throw StopWalkException.INSTANCE; return false; }</code><technical_language>Ouch. getPathString is fast. a good implement this byte[] form? For example imagine compute a hash raw path buffer of TreeWalk. time reach a '/' hashing stops probes a private hash table implementation if PathFilter matches current hash code. If test isPathPrefix subset of PathFilter nodes. Similar implementation here, avoiding hideously slow byte[]->String conversion required perform 2 hash table lookups do split path '/' level individually... more hash table lookups</technical_language>

Target:
public boolean include(final TreeWalk walker) { byte[] rp = walker.getRawPath(); Hasher hasher = new Hasher(rp, walker.getPathLength()); while (hasher.hashNext()) { int hash = hasher.nextHash(); if (fullpaths.contains(rp, hasher.length(), hash)) return true; if (!hasher.hashNext()) if (prefixes.contains(rp, hasher.length(), hash)) return true; } final int cmp = walker.isPathPrefix(max, max.length); if (cmp > 0) throw StopWalkException.INSTANCE; return false; }
Source:
<code><START> public void testAutoLabeling() { <END> Map<String, String> envs = new TreeMap<String, String>(String.CASE_INSENSITIVE_ORDER); envs.put(HadoopSparkJob.SPARK_NODE_LABELING_ENV_VAR, Boolean.TRUE.toString()); envs.put(HadoopSparkJob.SPARK_AUTO_NODE_LABELING_ENV_VAR, Boolean.TRUE.toString()); envs.put(HadoopSparkJob.SPARK_DESIRED_NODE_LABEL_ENV_VAR, "test2"); envs.put(HadoopSparkJob.SPARK_MIN_MEM_VCORE_RATIO_ENV_VAR, "3"); URL url = getClass().getClassLoader().getResource("spark-defaults.conf"); envs.put(HadoopSparkJob.SPARK_PROPERTY_FILE_PATH_ENV_VAR, url.getPath()); setEnv(envs); Configuration.addDefaultResource("yarn-site.xml"); String[] argArray = new String[] { "--conf", "spark.yarn.queue=test", "--conf", "spark.yarn.executor.nodeLabelExpression=test", "--executor-cores", "2", "--executor-memory", "7G" }; argArray = HadoopSecureSparkWrapper.handleNodeLabeling(argArray); argArray = HadoopSecureSparkWrapper.removeNullsFromArgArray(argArray); Assert.assertTrue(argArray.length == 6); Assert.assertTrue(argArray[1].contains("test2")); }</code><technical_language>Explain goal of this test is</technical_language>

Target:
public void testAutoLabeling() { Map<String, String> envs = new TreeMap<String, String>(String.CASE_INSENSITIVE_ORDER); envs.put(HadoopSparkJob.SPARK_NODE_LABELING_ENV_VAR, Boolean.TRUE.toString()); envs.put(HadoopSparkJob.SPARK_AUTO_NODE_LABELING_ENV_VAR, Boolean.TRUE.toString()); envs.put(HadoopSparkJob.SPARK_DESIRED_NODE_LABEL_ENV_VAR, "test2"); envs.put(HadoopSparkJob.SPARK_MIN_MEM_VCORE_RATIO_ENV_VAR, "3"); setEnv(envs); Configuration.addDefaultResource("yarn-site.xml"); String[] argArray = new String[] { "--conf", "spark.yarn.queue=test", "--conf", "spark.yarn.executor.nodeLabelExpression=test", "--executor-cores", "2", "--executor-memory", "7G" }; argArray = HadoopSecureSparkWrapper.handleNodeLabeling(argArray); argArray = HadoopSecureSparkWrapper.removeNullsFromArgArray(argArray); Assert.assertTrue(argArray.length == 6); Assert.assertTrue(argArray[1].contains("test2")); }