auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>InsertSourceFromCells(TransactionContext txnCtx, Functions functions, DocTableInfo table, String indexName, GeneratedColumns.Validation validation, List<Reference> targets) { <START> this.targets = new ArrayList<>(targets); <END> this.defaultValues = addDefaults( this.targets, table, new EvaluatingNormalizer( functions, RowGranularity.CLUSTER, null, null), txnCtx); ReferencesFromInputRow referenceResolver = new ReferencesFromInputRow(this.targets, table.partitionedByColumns(), indexName); InputFactory inputFactory = new InputFactory(functions); if (table.generatedColumns().isEmpty()) { generatedColumns = GeneratedColumns.empty(); } else { generatedColumns = new GeneratedColumns<>( inputFactory, txnCtx, validation, referenceResolver, this.targets, table.generatedColumns() ); } checks = new CheckConstraints<>(txnCtx, inputFactory, referenceResolver, table); }</code><technical_language>Is this safe for re-use? In TransportShardUpsertAction create a single InsertSourceFromCells instance for multiple params. if is a null early isn't</technical_language>

Target:
InsertSourceFromCells(TransactionContext txnCtx, Functions functions, DocTableInfo table, String indexName, GeneratedColumns.Validation validation, List<Reference> targets) { Tuple<List<Reference>, Object[]> allTargetColumnsAndDefaults = addDefaults(targets, table, txnCtx, functions); this.targets = allTargetColumnsAndDefaults.v1(); this.defaultValues = allTargetColumnsAndDefaults.v2(); ReferencesFromInputRow referenceResolver = new ReferencesFromInputRow(this.targets, table.partitionedByColumns(), indexName); InputFactory inputFactory = new InputFactory(functions); if (table.generatedColumns().isEmpty()) { generatedColumns = GeneratedColumns.empty(); } else { generatedColumns = new GeneratedColumns<>( inputFactory, txnCtx, validation, referenceResolver, this.targets, table.generatedColumns() ); } checks = new CheckConstraints<>(txnCtx, inputFactory, referenceResolver, table); }
Source:
<code>public void addPage(Page page) { if (canProcessDictionary(page)) { <START> boolean done = new AddDictionaryWork(page).process(); <END> verify(done); return; } boolean done = new AddPageWork(page).process(); verify(done); }</code><technical_language>cmt msg: "Adapt new Work interface MultiChannelGroupByHash." "adapt" is right word, changing Work interface. "Apply"? "Use .. in"</technical_language>

Target:
public Work<?> addPage(Page page) { currentPageSizeInBytes = page.getRetainedSizeInBytes(); return canProcessDictionary(page) ? new AddDictionaryPageWork(page) : new AddNonDictionaryPageWork(page); }
Source:
<code>private void closeSession(KeycloakSession session) { KeycloakTransactionManager transactionManager = session.getTransactionManager(); <START> if (transactionManager != null) { <END> if ((transactionManager instanceof SupportsPostponedCommit) && ((SupportsPostponedCommit) transactionManager).isPostponedCommit()) { transactionManager.commit(); } else if (transactionManager.isActive()){ transactionManager.rollback(); } } session.close(); Resteasy.clearContextData(); }</code><technical_language>suggestion if (transactionManager != null && transactionManager.isActive()) {</technical_language>

Target:
private void closeSession(KeycloakSession session) { KeycloakTransactionManager transactionManager = session.getTransactionManager(); try { if (transactionManager != null && transactionManager.isActive()) { if ((transactionManager instanceof SupportsPostponedCommit) && ((SupportsPostponedCommit) transactionManager).isPostponedCommit()) { transactionManager.commit(); } else { transactionManager.rollback(); } } } finally { session.close(); Resteasy.clearContextData(); } }
Source:
<code>public BloomFilter readBloomFilter(ColumnChunkMetaData meta) throws IOException { long bloomFilterOffset = meta.getBloomFilterOffset(); f.seek(bloomFilterOffset); BloomFilterHeader bloomFilterHeader = Util.readBloomFilterHeader(f); int numBytes = bloomFilterHeader.getNumBytes(); <START> if ( numBytes <= 0 || numBytes > BlockSplitBloomFilter.DEFAULT_MAXIMUM_BYTES) { <END> return null; } if (!bloomFilterHeader.getHash().isSetXXHASH() || !bloomFilterHeader.getAlgorithm().isSetBLOCK() || !bloomFilterHeader.getCompression().isSetUNCOMPRESSED()) { return null; } byte[] bitset = new byte[numBytes]; f.readFully(bitset); return new BlockSplitBloomFilter(bitset); }</code><technical_language>is good return null in case of bloom filter is compatible supported this implementation. This this is compatible format changes add other bloom filter related options. However, clue a newer bloom filter is used. I suggest adding warn logs actual problem bloomFilterHeader itself. (Thrift generates proper toString implementation for objects.)</technical_language>

Target:
public BloomFilter readBloomFilter(ColumnChunkMetaData meta) throws IOException { long bloomFilterOffset = meta.getBloomFilterOffset(); f.seek(bloomFilterOffset); BloomFilterHeader bloomFilterHeader; try { bloomFilterHeader = Util.readBloomFilterHeader(f); } catch (IOException e) { LOG.warn("read no bloom filter"); return null; } int numBytes = bloomFilterHeader.getNumBytes(); if (numBytes <= 0 || numBytes > BlockSplitBloomFilter.UPPER_BOUND_BYTES) { LOG.warn("the read bloom filter size is wrong, size is {}", bloomFilterHeader.getNumBytes()); return null; } if (!bloomFilterHeader.getHash().isSetXXHASH() || !bloomFilterHeader.getAlgorithm().isSetBLOCK() || !bloomFilterHeader.getCompression().isSetUNCOMPRESSED()) { LOG.warn("the read bloom filter is not supported yet, algorithm = {}, hash = {}, compression = {}", bloomFilterHeader.getAlgorithm(), bloomFilterHeader.getHash(), bloomFilterHeader.getCompression()); return null; } byte[] bitset = new byte[numBytes]; f.readFully(bitset); return new BlockSplitBloomFilter(bitset); }
Source:
<code>public Response add(Step step) { <START> validateParameters(step, "Type", "status" , "description"); <END> String id; if (step.isSetParentStep()) { id = step.getParentStep().getId(); } else { id = jobId.toString(); } return performCreate(VdcActionType.AddExternalStep, new AddExternalStepParameters(Guid.createGuidFromString(id), step.getDescription(),StepMapper.map(step.getType()), JobMapper.map(step.getStatus(), null)), new QueryIdResolver<Guid>(VdcQueryType.GetStepByStepId, IdQueryParameters.class)); }</code><technical_language>s/Type/type s/status/status.state</technical_language>

Target:
public Response add(Step step) { validateParameters(step, "type", "status.state" , "description"); String id; if (step.isSetParentStep() && step.getParentStep().getId() != null) { id = step.getParentStep().getId(); } else { id = jobId.toString(); } return performCreate(VdcActionType.AddExternalStep, new AddExternalStepParameters(asGuid(id), step.getDescription(),StepMapper.map(StepEnum.fromValue(step.getType())), JobMapper.map(step.getStatus(), null)), new QueryIdResolver<Guid>(VdcQueryType.GetStepByStepId, IdQueryParameters.class)); }
Source:
<code>public boolean updateNode(Node n) throws IOException { <START> if ( nodes.updateNode(n) ){ <END> getQueue().scheduleMaintenance(); return true; }; return false; }</code><technical_language>this done in Nodes.updateNode() - route setNodes() addNodes() removeNodes()</technical_language>

Target:
public boolean updateNode(Node n) throws IOException { return nodes.updateNode(n); }
Source:
<code>public int hashCode() { return Objects .hash(id, containerName, command, entrypoint, image, dependsOn, environment, expose, ports, labels, <START> links, <END> volumes, volumesFrom, memLimit, build, networks); }</code><technical_language>This wrong for 2 equal instances, consider example: java CheServiceImpl s1 = new CheServiceImpl(); CheServiceImpl s2 = new CheServiceImpl(); s1.getLinks(); assert sq.equals(s2); // <- this fail. Explanation: empty ArrayList#hashCode returns 1, while Object.hashCode(null) returns 0 :cry:</technical_language>

Target:
public int hashCode() { return Objects.hash(getId(), getContainerName(), getCommand(), getEntrypoint(), getImage(), getDependsOn(), getEnvironment(), getExpose(), getPorts(), getLabels(), getLinks(), getVolumes(), getVolumesFrom(), getMemLimit(), getBuild(), getNetworks()); }
Source:
<code><START> public void evaluateFastReplyTo() { <END> this.usingFastReplyTo = false; if (this.replyQueue == null || AddressUtils.AMQ_RABBITMQ_REPLY_TO.equals(this.replyQueue.getName())) { try { execute(new ChannelCallback<Void>() { @Override public Void doInRabbit(Channel channel) throws Exception { channel.queueDeclarePassive(AddressUtils.AMQ_RABBITMQ_REPLY_TO); return null; } }); this.usingFastReplyTo = true; } catch (Exception e) { if (replyQueue != null) { logger.error("Broker does not support fast replies via 'amq.rabbitmq.reply-to', temporary " + "queues will be used:" + e.getMessage() + "."); } else { if (logger.isDebugEnabled()) { logger.debug("Broker does not support fast replies via 'amq.rabbitmq.reply-to', temporary " + "queues will be used:" + e.getMessage() + "."); } } RabbitTemplate.this.replyQueue = null; } } this.evaluatedFastReplyTo = true; }</code><technical_language>this method public..</technical_language>

Target:
private void evaluateFastReplyTo() { this.usingFastReplyTo = false; if (this.replyQueue == null || AddressUtils.AMQ_RABBITMQ_REPLY_TO.equals(this.replyQueue.getName())) { try { execute(new ChannelCallback<Void>() { @Override public Void doInRabbit(Channel channel) throws Exception { channel.queueDeclarePassive(AddressUtils.AMQ_RABBITMQ_REPLY_TO); return null; } }); this.usingFastReplyTo = true; } catch (Exception e) { if (replyQueue != null) { logger.error("Broker does not support fast replies via 'amq.rabbitmq.reply-to', temporary " + "queues will be used:" + e.getMessage() + "."); } else { if (logger.isDebugEnabled()) { logger.debug("Broker does not support fast replies via 'amq.rabbitmq.reply-to', temporary " + "queues will be used:" + e.getMessage() + "."); } } RabbitTemplate.this.replyQueue = null; } } this.evaluatedFastReplyTo = true; }
Source:
<code>public void testValidationFailsDiskConnectedToRunningVm() { VM vm = new VM(); vm.setStatus(VMStatus.Up); VmDevice vmDevice = new VmDevice(); vmDevice.setPlugged(true); List<Pair<VM, VmDevice>> vms = <START> Collections.singletonList(new Pair(vm, <END> vmDevice)); doReturn(vms).when(vmDao).getVmsWithPlugInfo(diskId); ValidateTestUtils.runAndAssertValidateFailure(command, EngineMessage.ACTION_TYPE_FAILED_VM_IS_NOT_DOWN); }</code><technical_language>raw types - new Pair<>(vm, vmDevice)</technical_language>

Target:
public void testValidationFailsDiskConnectedToRunningVm() { VM vm = new VM(); vm.setStatus(VMStatus.Up); VmDevice vmDevice = new VmDevice(); vmDevice.setPlugged(true); List<Pair<VM, VmDevice>> vms = Collections.singletonList(new Pair<>(vm, vmDevice)); doReturn(vms).when(vmDao).getVmsWithPlugInfo(diskId); ValidateTestUtils.runAndAssertValidateFailure(command, EngineMessage.ACTION_TYPE_FAILED_VM_IS_NOT_DOWN); }
Source:
<code>public static void init() { if (!initialized_ && !loading_) { scrollers_ = new HashMap<>(); loading_ = true; virtualScrollerLoader_.addCallback(() -> { try { initialized_ = true; loading_ = false; } catch (JavaScriptException e) { <START> Debug.log(e.getMessage()); <END> } }); } }</code><technical_language>clear loading_ flag here? (doesn't effects correctness consistent?)</technical_language>

Target:
public static void init() { if (!initialized_ && !loading_) { scrollers_ = new HashMap<>(); loading_ = true; virtualScrollerLoader_.addCallback(() -> { loading_ = false; try { initialized_ = true; } catch (JavaScriptException e) { Debug.log(e.getMessage()); } }); } }
Source:
<code>private void execute() { if (fFinishedLatch.getCount() == 0) { return; } synchronized (syncObj) { if (fStarted) { return; } fStarted = true; } if (fTrace != null) { fTrace.notifyPendingRequest(true); } fJob = new Job(NLS.bind(Messages.TmfAbstractAnalysisModule_RunningAnalysis, getName())) { @Override protected IStatus run(final IProgressMonitor monitor) { try { monitor.beginTask("", IProgressMonitor.UNKNOWN); broadcast(new TmfStartAnalysisSignal(TmfAbstractAnalysisModule.this, TmfAbstractAnalysisModule.this)); fAnalysisCancelled = !executeAnalysis(monitor); if (fTrace != null) { <START> fTrace.notifyPendingRequest(false); <END> } } catch (TmfAnalysisException e) { Activator.logError("Error executing analysis with trace " + getTrace().getName(), e); } finally { synchronized (syncObj) { monitor.done(); setAnalysisCompleted(); } } if (!fAnalysisCancelled) { return Status.OK_STATUS; } return Status.CANCEL_STATUS; } @Override protected void canceling() { TmfAbstractAnalysisModule.this.canceling(); } }; fJob.schedule(); }</code><technical_language>I I this is this relies analysis module's developer forget decrement request flag else blocks forever. default behavior is block. add a function analysisHasRequest() { return false; } notifyPendingRequest(true) occur if analysisHasRequest is true. way, developer controls calls. if overwrites method decrement pending request flag. And, if ignores methods, a request, then, well... coalesced end of world. catch a review if code gerrit ;-)</technical_language>

Target:
private void execute() { if (fFinishedLatch.getCount() == 0) { return; } synchronized (syncObj) { if (fStarted) { return; } fStarted = true; } if (fTrace != null) { fTrace.notifyPendingRequest(true); setNotifyRequestNeeded(true); } fJob = new Job(NLS.bind(Messages.TmfAbstractAnalysisModule_RunningAnalysis, getName())) { @Override protected IStatus run(final IProgressMonitor monitor) { try { monitor.beginTask("", IProgressMonitor.UNKNOWN); broadcast(new TmfStartAnalysisSignal(TmfAbstractAnalysisModule.this, TmfAbstractAnalysisModule.this)); fAnalysisCancelled = !executeAnalysis(monitor); if ((fTrace != null) && isNotifyRequestNeeded()) { fTrace.notifyPendingRequest(false); setNotifyRequestNeeded(false); } } catch (TmfAnalysisException e) { Activator.logError("Error executing analysis with trace " + getTrace().getName(), e); } finally { synchronized (syncObj) { monitor.done(); setAnalysisCompleted(); } } if (!fAnalysisCancelled) { return Status.OK_STATUS; } return Status.CANCEL_STATUS; } @Override protected void canceling() { TmfAbstractAnalysisModule.this.canceling(); } }; fJob.schedule(); }
Source:
<code>protected IResource getResource(IPath path) { if (path != null) { IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); <START> if (path.getDevice() == null) { return root.findMember(path); } <END> IFile file = root.getFileForLocation(path); if (file != null) { return file; } if (!"jar".equalsIgnoreCase(path.getFileExtension())) { IContainer container = root.getContainerForLocation(path); if (container != null) { return container; } } } return null; }</code><technical_language>move this place return. Linux/Mac "device" part is null</technical_language>

Target:
protected IResource getResource(IPath path) { if (path != null) { IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); IFile file = root.getFileForLocation(path); if (file != null) { return file; } if (getType() != ARCHIVE) { IContainer container = root.getContainerForLocation(path); if (container != null) { return container; } } if (path.getDevice() == null) { return root.findMember(path); } } return null; }
Source:
<code>HashMap<String, Object> deleteClient(Model model, @RequestParam("profileIdentifier") String profileIdentifier, @RequestParam("clientUUID") String[] clientUUID) throws Exception { logger.info("Attempting to remove clients from the profile: ", profileIdentifier); logger.info("Attempting to remove the following clients: {}", Arrays.toString(clientUUID)); HashMap<String, Object> valueHash = new HashMap<String, Object>(); Integer profileId = ControllerUtils.convertProfileIdentifier(profileIdentifier); for( int i = 0; i < clientUUID.length; i++ ) { if (clientUUID[i].compareTo(Constants.PROFILE_CLIENT_DEFAULT_ID) == 0) throw new Exception("Default client cannot be deleted"); clientService.remove(profileId, clientUUID[i]); <START> valueHash.put("clients", clientService.findAllClients(profileId)); <END> } return valueHash; }</code><technical_language>Move this line of loop</technical_language>

Target:
HashMap<String, Object> deleteClient(Model model, @RequestParam("profileIdentifier") String profileIdentifier, @RequestParam("clientUUID") String[] clientUUID) throws Exception { logger.info("Attempting to remove clients from the profile: ", profileIdentifier); logger.info("Attempting to remove the following clients: {}", Arrays.toString(clientUUID)); HashMap<String, Object> valueHash = new HashMap<String, Object>(); Integer profileId = ControllerUtils.convertProfileIdentifier(profileIdentifier); for( int i = 0; i < clientUUID.length; i++ ) { if (clientUUID[i].compareTo(Constants.PROFILE_CLIENT_DEFAULT_ID) == 0) throw new Exception("Default client cannot be deleted"); clientService.remove(profileId, clientUUID[i]); } valueHash.put("clients", clientService.findAllClients(profileId)); return valueHash; }
Source:
<code>public void testValidate() { FtraceTrace ftraceTrace = new FtraceTrace(); IStatus status = ftraceTrace.validate(null, <START> "res/android_ftrace_trace_output_14_01_18"); <END> assertEquals(0, status.getSeverity()); }</code><technical_language>I this file</technical_language>

Target:
public void testValidate() { FtraceTrace ftraceTrace = new FtraceTrace(); IStatus status = ftraceTrace.validate(null, "res/trace-android-sched"); assertEquals(0, status.getSeverity()); }
Source:
<code>public boolean isUnifiable(Index index) { return index instanceof TopIndex || equals(index) || (index instanceof TokenIndex && <START> kLabel.sorts().contains(((TokenIndex) index).sort())); <END> }</code><technical_language>is this doing</technical_language>

Target:
public boolean isUnifiable(Index index) { return index instanceof TopIndex || equals(index); }
Source:
<code>public void test_DnDPackageFromMC2DiagramBlank2() throws Exception { openRepresentation2(); try { openErrorLogViewByAPI(); SWTBot errorLogBot = bot.viewByTitle("Error Log").bot(); int rowCount = errorLogBot.tree().rowCount(); DndUtil util = new DndUtil(bot.getDisplay()); final SWTBotTreeItem ecoreTreeItem = semanticResourceNode.expandNode(ROOTPACKAGE_NAME) .getNode(CONTAINER_TO_DRAG_P1); <START> System.out.println("Cas1 --> \"P1\" = " + ecoreTreeItem.getText()); <END> util.dragAndDrop(ecoreTreeItem, editor.getCanvas()); bot.waitUntil(new DiagramWithChildrensCondition(editor, 1)); assertEquals("An error message was generated !", rowCount, errorLogBot.tree().rowCount()); } finally { closeErrorLogView(); } }</code><technical_language>remove</technical_language>

Target:
public void test_DnDPackageFromMC2DiagramBlank2() throws Exception { openRepresentation2(); try { openErrorLogViewByAPI(); SWTBot errorLogBot = bot.viewByTitle("Error Log").bot(); int rowCount = errorLogBot.tree().rowCount(); DndUtil util = new DndUtil(bot.getDisplay()); final SWTBotTreeItem ecoreTreeItem = semanticResourceNode.expandNode(ROOTPACKAGE_NAME) .getNode(CONTAINER_TO_DRAG_P1); util.dragAndDrop(ecoreTreeItem, editor.getCanvas()); bot.waitUntil(new DiagramWithChildrensCondition(editor, 1)); assertEquals("An error message was generated !", rowCount, errorLogBot.tree().rowCount()); } finally { closeErrorLogView(); } }
Source:
<code>public void messageArrived(final String topic, final MqttMessage message) { final List<MQTTDataGenerator> dataGeneratorList = dataGeneratorListMap.get(topic); if (dataGeneratorList != null) { <START> dataGeneratorList.forEach(dataGenerator -> dataGenerator.emitData(message)); <END> } }</code><technical_language>need synchronize this write performed concurrently</technical_language>

Target:
public void messageArrived(final String topic, final MqttMessage message) { final Queue<MQTTDataGenerator> dataGeneratorList = dataGeneratorListMap.get(topic); if (dataGeneratorList != null) { dataGeneratorList.forEach(dataGenerator -> dataGenerator.emitData(message)); } }
Source:
<code>private void addGatewayUserFacingCertAndFqdn(GatewayConfig gatewayConfig, Cluster cluster, Map<String, Object> gateway) { boolean userFacingCertHasBeenGenerated = isNotEmpty(gatewayConfig.getUserFacingCert()) && isNotEmpty(gatewayConfig.getUserFacingKey()); if (userFacingCertHasBeenGenerated) { gateway.put("userfacingcert_configured", Boolean.TRUE); gateway.put("userfacingkey", cluster.getStack().getSecurityConfig().getUserFacingKey()); gateway.put("userfacingcert", cluster.getStack().getSecurityConfig().getUserFacingCert()); } String fqdn = null; if (cluster.getStack().getLoadBalancers() != null && cluster.getStack().getLoadBalancers().size() > 0) { fqdn = (cluster.getStack().getLoadBalancers().stream() .filter(lb -> lb.getType() == LoadBalancerType.PUBLIC).findAny() <START> .orElse(cluster.getStack().getLoadBalancers().iterator().next())) <END> .getFqdn(); } if (fqdn == null) { fqdn = cluster.getFqdn(); } if (isNotEmpty(fqdn)) { gateway.put("userfacingfqdn", fqdn); String[] fqdnParts = fqdn.split("\\.", 2); if (fqdnParts.length == 2) { gateway.put("userfacingdomain", Pattern.quote(fqdnParts[1])); } } }</code><technical_language>This orElse is internal filter method, correct? hard parse as-is, indented level calls stream(), stream(). change indentation, break this call out lines easier read</technical_language>

Target:
private void addGatewayUserFacingCertAndFqdn(GatewayConfig gatewayConfig, Cluster cluster, Map<String, Object> gateway) { boolean userFacingCertHasBeenGenerated = isNotEmpty(gatewayConfig.getUserFacingCert()) && isNotEmpty(gatewayConfig.getUserFacingKey()); if (userFacingCertHasBeenGenerated) { gateway.put("userfacingcert_configured", Boolean.TRUE); gateway.put("userfacingkey", cluster.getStack().getSecurityConfig().getUserFacingKey()); gateway.put("userfacingcert", cluster.getStack().getSecurityConfig().getUserFacingCert()); } String fqdn = loadBalancerConfigService.getLoadBalancerUserFacingFQDN(cluster.getStack().getId()); fqdn = isEmpty(fqdn) ? cluster.getFqdn() : fqdn; if (isNotEmpty(fqdn)) { gateway.put("userfacingfqdn", fqdn); String[] fqdnParts = fqdn.split("\\.", 2); if (fqdnParts.length == 2) { gateway.put("userfacingdomain", Pattern.quote(fqdnParts[1])); } } }
Source:
<code>public void validateObservationValues(Workbook workbook, String instanceNumber) throws WorkbookParserException { Locale locale = LocaleContextHolder.getLocale(); if (workbook.getObservations() != null) { List<MeasurementRow> observations = new ArrayList<MeasurementRow>(); if (instanceNumber != null && "".equalsIgnoreCase(instanceNumber)) { observations = workbook.getObservations(); } else { observations = workbook.isNursery() ? workbook.getObservations() : WorkbookUtil.filterObservationsByTrialInstance( workbook.getObservations(), instanceNumber); } for (MeasurementRow row : observations) { for (MeasurementData data : row.getDataList()) { MeasurementVariable variate = data.getMeasurementVariable(); if (!this.isValidValue(variate, data.getValue(), data.getcValueId(), true)) { throw new WorkbookParserException(this.messageSource.getMessage(ValidationServiceImpl.ERROR_NUMERIC_VARIABLE_VALUE, <START> new Object[] {variate.getName()}, locale)); <END> } } } } }</code><technical_language>Hey @mderamos replace data.getValue() array adding actual error message before? more actual data inform user of, more powerful message is helps user locate exact source of problem</technical_language>

Target:
public void validateObservationValues(Workbook workbook, String instanceNumber) throws WorkbookParserException { Locale locale = LocaleContextHolder.getLocale(); if (workbook.getObservations() != null) { List<MeasurementRow> observations = new ArrayList<MeasurementRow>(); if (instanceNumber != null && "".equalsIgnoreCase(instanceNumber)) { observations = workbook.getObservations(); } else { observations = workbook.isNursery() ? workbook.getObservations() : WorkbookUtil.filterObservationsByTrialInstance( workbook.getObservations(), instanceNumber); } for (MeasurementRow row : observations) { for (MeasurementData data : row.getDataList()) { MeasurementVariable variate = data.getMeasurementVariable(); if (!this.isValidValue(variate, data.getValue(), data.getcValueId(), true)) { throw new WorkbookParserException(this.messageSource.getMessage(ValidationServiceImpl.ERROR_NUMERIC_VARIABLE_VALUE, new Object[] {variate.getName(), data.getValue()}, locale)); } } } } }
Source:
<code>private void handleParameter(Symbol parameter, boolean springInjectionAnnotated) { Type leastSpecificType = findLeastSpecificType(parameter); if (parameter.type() != leastSpecificType && !leastSpecificType.is("java.lang.Object") <START> && !(springInjectionAnnotated && parameter.type().is("java.util.Collection"))) { <END> String suggestedType = getSuggestedType(springInjectionAnnotated, leastSpecificType); reportIssue(parameter.declaration(), String.format("Use '%s' here; it is a more general type than '%s'.", suggestedType, parameter.type().name())); } }</code><technical_language>matter of style choices I tend this part of && implemented a filter of stream parameters stream</technical_language>

Target:
private void handleParameter(Symbol parameter, boolean springInjectionAnnotated) { Type leastSpecificType = findLeastSpecificType(parameter); if (parameter.type() != leastSpecificType && !leastSpecificType.is("java.lang.Object")) { String suggestedType = getSuggestedType(springInjectionAnnotated, leastSpecificType); reportIssue(parameter.declaration(), String.format("Use '%s' here; it is a more general type than '%s'.", suggestedType, parameter.type().name())); } }
Source:
<code>public void after() { getContext().unbindService(serviceConnection); remoteMessenger = null; ActivityManager.RunningAppProcessInfo info = getRemoteProcessInfo(); if (info != null) { android.os.Process.killProcess(info.pid); } int counter = 10; while (getRemoteProcessInfo() != null) { if (counter == 0) { <START> assertTrue("The remote process is still alive.", false); <END> } try { Thread.sleep(300); } catch (InterruptedException e) { throw new RuntimeException(e); } counter--; } }</code><technical_language>fail("")</technical_language>

Target:
public void after() { getContext().unbindService(serviceConnection); ActivityManager.RunningAppProcessInfo info = getRemoteProcessInfo(); if (info != null) { android.os.Process.killProcess(info.pid); } int counter = 10; while (getRemoteProcessInfo() != null) { if (counter == 0) { fail("The remote process is still alive."); } try { Thread.sleep(300); } catch (InterruptedException e) { throw new RuntimeException(e); } counter--; } }
Source:
<code>public Object invoke(MethodInvocation invocation) throws Throwable { String timerTag = buildTimerTag(invocation.getMethod().getAnnotation(Timed.class), invocation.getMethod()); final Timer.Context timer = metricRegistry.timer(timerTag).time(); Object result; try { result = invocation.proceed(); if (result instanceof Promise<?>) { <START> ((Promise<?>) result).result(v -> timer.stop()); <END> } else { timer.stop(); } } catch (Exception e) { timer.stop(); throw e; } return result; }</code><technical_language>This right, promise subscribed twice. mind rebasing [new time() method I added Promise](<LINK_0></technical_language>

Target:
public Object invoke(MethodInvocation invocation) throws Throwable { String timerTag = buildTimerTag(invocation.getMethod().getAnnotation(Timed.class), invocation.getMethod()); final Timer timer = metricRegistry.timer(timerTag); final Timer.Context timerContext = timer.time(); Object result; try { result = invocation.proceed(); if (result instanceof Promise<?>) { result = ((Promise<?>) result).time(duration -> timer.update(duration.getNano(), TimeUnit.NANOSECONDS) ); } else { timerContext.stop(); } } catch (Exception e) { timerContext.stop(); throw e; } return result; }
Source:
<code>static void writeModel(NaiveBayesModel model) throws IOException { ensureTextClassifierFolderExists(); <START> FileWriter fw = new FileWriter(new File(MODEL_PATH)); <END> PlainTextNaiveBayesModelWriter modelWriter; modelWriter = new PlainTextNaiveBayesModelWriter(model, new BufferedWriter(fw)); modelWriter.persist(); fw.close(); }</code><technical_language>this throws exception file writer get closed, consider a try resources</technical_language>

Target:
static void writeModel(NaiveBayesModel model) throws IOException { ensureTextClassifierFolderExists(); try (FileWriter fw = new FileWriter(new File(MODEL_PATH))) { PlainTextNaiveBayesModelWriter modelWriter; modelWriter = new PlainTextNaiveBayesModelWriter(model, new BufferedWriter(fw)); modelWriter.persist(); } }
Source:
<code>public static byte[] serialize(ClientCommunicatorRequest request) { <START> int size = request.getMsgBytes().length + 8; <END> ByteBuffer buffer = ByteBuffer.allocate(size). putInt(request.getRequestType().ordinal()). putInt(request.getRequestSequenceNumber()). put(request.getMsgBytes()); return buffer.array(); }</code><technical_language>(2 \* Integer.BYTES)</technical_language>

Target:
public static byte[] serialize(ClientCommunicatorRequest request) { int size = request.getMsgBytes().length + 2 * 4; ByteBuffer buffer = ByteBuffer.allocate(size). putInt(request.getRequestType().ordinal()). putInt(request.getRequestSequenceNumber()). put(request.getMsgBytes()); return buffer.array(); }
Source:
<code>private static void upgradeTableDesc(org.apache.hadoop.hive.metastore.api.Table tableObj, MetaData rv, EximUtil.SemanticAnalyzerWrapperContext x) throws IOException, TException, HiveException { x.getLOG().debug("converting table " + tableObj.getTableName() + " of type " + tableObj.getTableType() + " with para " + tableObj.getParameters()); <START> TableType tableType = TableType.valueOf(tableObj.getTableType()); <END> HiveStrictManagedMigration.TableMigrationOption migrationOption = HiveStrictManagedMigration.determineMigrationTypeAutomatically(tableObj, tableType, null, x.getConf(), x.getHive().getMSC(), true); HiveStrictManagedMigration.migrateTable(tableObj, tableType, migrationOption, false, getHiveUpdater(x.getConf()), x.getHive().getMSC(), x.getConf()); x.getLOG().debug("converted table " + tableObj.getTableName() + " of type " + tableObj.getTableType() + " with para " + tableObj.getParameters()); }</code><technical_language>Do need TableType.valueOf</technical_language>

Target:
private static void upgradeTableDesc(org.apache.hadoop.hive.metastore.api.Table tableObj, MetaData rv, EximUtil.SemanticAnalyzerWrapperContext x) throws IOException, TException, HiveException { x.getLOG().debug("Converting table " + tableObj.getTableName() + " of type " + tableObj.getTableType() + " with para " + tableObj.getParameters()); TableType tableType = TableType.valueOf(tableObj.getTableType()); HiveStrictManagedMigration.TableMigrationOption migrationOption = HiveStrictManagedMigration.determineMigrationTypeAutomatically(tableObj, tableType, null, x.getConf(), x.getHive().getMSC(), true); HiveStrictManagedMigration.migrateTable(tableObj, tableType, migrationOption, false, getHiveUpdater(x.getConf()), x.getHive().getMSC(), x.getConf()); x.getLOG().debug("Converted table " + tableObj.getTableName() + " of type " + tableObj.getTableType() + " with para " + tableObj.getParameters()); }
Source:
<code>public String getMessage() { StringBuilder sb = new StringBuilder(); switch (type) { case MODULE_TYPE: sb.append("[Module Type"); break; case TEMPLATE: sb.append("[Template"); break; case RULE: <START> sb.append("[RuleImpl"); <END> break; default: break; } if (id != null) sb.append(" " + id); sb.append("] " + super.getMessage()); return sb.toString(); }</code><technical_language>Rule RuleImpl (see above)</technical_language>

Target:
public String getMessage() { StringBuilder sb = new StringBuilder(); switch (type) { case MODULE_TYPE: sb.append("[Module Type"); break; case TEMPLATE: sb.append("[Template"); break; case RULE: sb.append("[Rule"); break; default: break; } if (id != null) { sb.append(" " + id); } sb.append("] " + super.getMessage()); return sb.toString(); }
Source:
<code>public void testBeforeJobDocument() throws Exception { String csvFile = "data"+File.separator+"OrderLines.csv"; JobRunner jobRunner = new JobRunner(); String[] roles = { "admin" }; jobRunner.setRoles(roles); JSONDocumentManager jsonMgr = client.newJSONDocumentManager(); try (InputStream csvStream = openStream(csvFile); InputStream jobStream = openStream(JobRunner.jobFileFor(csvFile));) { jobRunner.run(client, csvStream, jobStream); ObjectMapper objectMapper = new ObjectMapper(); ObjectNode jobControlObj = (ObjectNode) objectMapper.readTree(jobStream); ObjectNode jobDef = (ObjectNode) jobControlObj.get("job"); String beforeDocId = JobRunner.getBeforeJobDocumentUri(jobDef.path("id").asText()); assertNotNull(jsonMgr.exists(beforeDocId)); DocumentMetadataHandle beforeDocumentMetadata = new DocumentMetadataHandle(); JacksonHandle readHandle = new JacksonHandle(); assertNotNull(jsonMgr.read(beforeDocId, beforeDocumentMetadata, readHandle)); assertTrue(beforeDocumentMetadata.getCollections().contains(JobRunner.getJobCollection(jobDef.path("id").asText()))); assertTrue(beforeDocumentMetadata.getCollections().contains("/beforeJob")); assertTrue(beforeDocumentMetadata.getPermissions().containsKey("admin")); assertTrue(beforeDocumentMetadata.getPermissions().get("admin").contains(Capability.READ)); assertTrue(beforeDocumentMetadata.getPermissions().get("admin").contains(Capability.UPDATE)); <START> <END> } catch(Exception ex) { ex.printStackTrace(); } }</code><technical_language>assertions properties of populated readHandle</technical_language>

Target:
public void testBeforeJobDocument() throws Exception { String csvFile = "data"+File.separator+"OrderLines.csv"; JobRunner jobRunner = new JobRunner(); String[] roles = { "admin" }; jobRunner.setRoles(roles); JSONDocumentManager jsonMgr = client.newJSONDocumentManager(); try (InputStream csvStream = openStream(csvFile); InputStream jobStream = openStream(JobRunner.jobFileFor(csvFile));) { jobRunner.run(client, csvStream, jobStream); ObjectMapper objectMapper = new ObjectMapper(); ObjectNode jobControlObj = (ObjectNode) objectMapper.readTree(jobStream); ObjectNode jobDef = (ObjectNode) jobControlObj.get("job"); String beforeDocId = JobRunner.getBeforeJobDocumentUri(jobDef.path("id").asText()); assertNotNull(jsonMgr.exists(beforeDocId)); DocumentMetadataHandle beforeDocumentMetadata = new DocumentMetadataHandle(); JacksonHandle readHandle = new JacksonHandle(); assertNotNull(jsonMgr.read(beforeDocId, beforeDocumentMetadata, readHandle)); assertTrue(beforeDocumentMetadata.getCollections().contains(JobRunner.getJobCollection(jobDef.path("id").asText()))); assertTrue(beforeDocumentMetadata.getCollections().contains("/beforeJob")); assertTrue(beforeDocumentMetadata.getPermissions().containsKey("admin")); assertTrue(beforeDocumentMetadata.getPermissions().get("admin").contains(Capability.READ)); assertTrue(beforeDocumentMetadata.getPermissions().get("admin").contains(Capability.UPDATE)); JsonNode readHandleNode = readHandle.get(); assertNotNull(readHandleNode); assertNotNull(readHandleNode.fields()); } catch(Exception ex) { ex.printStackTrace(); } }
Source:
<code>private void addLayoutCombo(Composite parent) <START> { <END> Composite c2 = new Composite(parent, SWT.NONE); c2.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); GridLayout layout = new GridLayout(2, false); layout.marginWidth = 0; c2.setLayout(layout); ComboFieldEditor layoutEditor = new ComboFieldEditor(LAYOUT, Utilities.getString("ComparePreferencePage.layout.label"), new String[][]{getEntry(ICompareUIConstants.PREF_VALUE_RIGHT_TO_LEFT), getEntry(ICompareUIConstants.PREF_VALUE_LEFT_TO_RIGHT)}, c2); layoutEditor.fillIntoGrid(c2, 2); layoutEditor.setPreferenceStore(fOverlayStore); editors.add(layoutEditor); layoutEditor.setPropertyChangeListener(new IPropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent event) { if (fCompareConfiguration != null) { fCompareConfiguration.setProperty(LAYOUT, event.getNewValue()); } } }); }</code><technical_language>Trailing tabs</technical_language>

Target:
private void addLayoutCombo(Composite parent) { Composite c2 = new Composite(parent, SWT.NONE); c2.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); GridLayout layout = new GridLayout(2, false); layout.marginWidth = 0; c2.setLayout(layout); ComboFieldEditor layoutEditor = new ComboFieldEditor(LAYOUT, Utilities.getString("ComparePreferencePage.layout.label"), new String[][]{ getLayoutEntry( ICompareUIConstants.PREF_VALUE_RIGHT_TO_LEFT), getLayoutEntry( ICompareUIConstants.PREF_VALUE_LEFT_TO_RIGHT)}, c2); layoutEditor.fillIntoGrid(c2, 2); layoutEditor.setPreferenceStore(fOverlayStore); editors.add(layoutEditor); layoutEditor.setPropertyChangeListener(new IPropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent event) { if (fCompareConfiguration != null) { fCompareConfiguration.setProperty(LAYOUT, event.getNewValue()); } } }); }
Source:
<code>public synchronized String registerProcessorAndGetId(final Object data) { if (ephemeralPath == null) { ephemeralPath = <START> zkClient.createEphemeralSequential(keyBuilder.getProcessorsPath() + "/processor-", data); <END> return ephemeralPath; } else { return ephemeralPath; } }</code><technical_language>constant for "/processor-" defined in ZkKeyBuilder</technical_language>

Target:
public synchronized String registerProcessorAndGetId(final Object data) { if (ephemeralPath == null) { ephemeralPath = zkClient.createEphemeralSequential( keyBuilder.getProcessorsPath() + "/", data); return ephemeralPath; } else { return ephemeralPath; } }
Source:
<code>protected Supplier<?> putSupplier(Map<String,String> map, int key) { return (()-> { <START> int bucket = key % stripedLock.size(); <END> Lock lock = stripedLock.get(bucket); try { lock.tryLock(); map.put("key" + key, "value" + key); } catch (Exception e) { this.putSupplier(map, key); } finally { try { lock.unlock(); } catch (Exception e) } return null; }); }</code><technical_language>Please check indentation here</technical_language>

Target:
protected Supplier<?> putSupplier(Map<String,String> map, int key) { return (()-> { int bucket = key % stripedLock.size(); Lock lock = stripedLock.get(bucket); lock.lock(); try { return map.put("key" + key, "value" + key); } finally { lock.unlock(); } }); }
Source:
<code>default int getGroupedJobInitializerCacheSize() { <START> return 10; <END> }</code><technical_language>a bit low. I doubt GroupedJobInitializer memory easily increase a bit default (like 100 maybe). need check nodes created a jobs run in XWiki Standard. extension side is root "extension" node 1 namespace (so in practice 1 par wiki). potentially a lot more for refactoring module root "refactoring" node node for element of EntityReference is manipulated</technical_language>

Target:
default int getGroupedJobInitializerCacheSize() { return 100; }
Source:
<code>void setBelongsToRecentIndexSegment(boolean belongsToRecentIndexSegment) { <START> this.belongsToRecentIndexSegment.compareAndSet(false, belongsToRecentIndexSegment); <END> }</code><technical_language>this. belongsToRecentIndexSegment = this. belongsToRecentIndexSegment || belongsToRecentIndexSegment compareAndSet() (which is in multithreading scenarios) is needed</technical_language>

Target:
void setBelongsToRecentIndexSegment(boolean belongsToRecentIndexSegment) { this.belongsToRecentIndexSegment = this.belongsToRecentIndexSegment || belongsToRecentIndexSegment; }
Source:
<code>public void addNotificationEvent(NotificationEvent entry) throws MetaException { if (addNotificationEventModifier != null) { Boolean success = addNotificationEventModifier.apply(entry); if ((success != null) && !success) { throw new MetaException("InjectableBehaviourObjectStore: Invalid addNotificationEvent operation on DB: " <START> + entry.getDbName() + " table: " + entry.getTableName() + " event : " + entry.getEventType()); <END> } } else { super.addNotificationEvent(entry); } }</code><technical_language>DB table name need set always. String.valueOf(entry.getDbName()) return "null" string if null</technical_language>

Target:
public void addNotificationEvent(NotificationEvent entry) throws MetaException { if (addNotificationEventModifier != null) { Boolean success = addNotificationEventModifier.apply(entry); if ((success != null) && !success) { throw new MetaException("InjectableBehaviourObjectStore: Invalid addNotificationEvent operation on DB: " + entry.getDbName() + " table: " + entry.getTableName() + " event : " + entry.getEventType()); } } super.addNotificationEvent(entry); }
Source:
<code>private void addBarrierParticipantPath() { new ZKAsyncCreateHandler(m_barrierParticipantsPath, null, CreateMode.PERSISTENT) { @Override public void run() { if (checkForCommonKeeperExceptions(m_resultCode)) { try { initializeStateMachine(m_startingMemberSet); if (m_pendingStateMachineInits.decrementAndGet() == 0) { m_initComplete.set(true); } } catch (KeeperException.SessionExpiredException e) { m_done.set(true); <START> m_initComplete.set(false); <END> } catch (KeeperException.ConnectionLossException e) { m_done.set(true); m_initComplete.set(false); } catch (InterruptedException e) { m_done.set(true); } catch (Exception e) { org.voltdb.VoltDB.crashLocalVoltDB( "Unexpected failure in initializeInstances.", true, e); m_done.set(true); m_initComplete.set(false); } } } }; }</code><technical_language>BUG? decrementAndGet set future 0</technical_language>

Target:
private void addBarrierParticipantPath() { new ZKAsyncCreateHandler(m_barrierParticipantsPath, null, CreateMode.PERSISTENT) { @Override public void run() { if (noCommonKeeperExceptions(m_resultCode)) { try { initializeStateMachine(m_startingMemberSet); if (m_pendingStateMachineInits.decrementAndGet() == 0) { m_initComplete.set(true); } } catch (KeeperException.SessionExpiredException | KeeperException.ConnectionLossException e) { initializationFailed(); } catch (InterruptedException e) { initializationFailed(); } catch (Exception e) { org.voltdb.VoltDB.crashLocalVoltDB( "Unexpected failure in initializeInstances.", true, e); initializationFailed(); } } } }; }
Source:
<code>protected void populateResults(final LocalDate startDate, final LocalDate endDate, final Iterable<InvoiceItem> billedItems, final BigDecimal billedUsage, final BigDecimal toBeBilledUsage, final UsageInArrearDetail toBeBilledUsageDetails, final boolean areAllBilledItemsWithDetails, final List<InvoiceItem> result) { <START> if (!billedItems.iterator().hasNext() || billedUsage.compareTo(toBeBilledUsage) < 0) { <END> final BigDecimal amountToBill = areAllBilledItemsWithDetails ? toBeBilledUsage : toBeBilledUsage.subtract(billedUsage); if (amountToBill.compareTo(BigDecimal.ZERO) > 0) { if (UsageDetailMode.DETAIL == usageDetailMode) { for (UsageConsumableInArrearTierUnitDetail toBeBilledUsageDetail : ((UsageConsumableInArrearDetail) toBeBilledUsageDetails).getTierDetails()) { final InvoiceItem item = new UsageInvoiceItem(invoiceId, accountId, getBundleId(), getSubscriptionId(), getPlanName(), getPhaseName(), usage.getName(), startDate, endDate, toBeBilledUsageDetail.getAmount(), toBeBilledUsageDetail.getTierPrice(), getCurrency(), toBeBilledUsageDetail.getQuantity(), null); result.add(item); } } else { final String itemDetails = areAllBilledItemsWithDetails ? toBeBilledUsageDetails.toJson(objectMapper) : null; final InvoiceItem item = new UsageInvoiceItem(invoiceId, accountId, getBundleId(), getSubscriptionId(), getPlanName(), getPhaseName(), usage.getName(), startDate, endDate, amountToBill, null, getCurrency(), null, itemDetails); result.add(item); } } } }</code><technical_language>remark !billedItems.iterator().hasNext(). Also, billedUsage.compareTo(toBeBilledUsage) < 0 extracted methods, in implementations: if (billedUsage.compareTo(toBeBilledUsage) < 0) { populateResults(...); }</technical_language>

Target:
protected void populateResults(final LocalDate startDate, final LocalDate endDate, final Iterable<InvoiceItem> billedItems, final BigDecimal billedUsage, final BigDecimal toBeBilledUsage, final UsageInArrearDetail toBeBilledUsageDetails, final boolean areAllBilledItemsWithDetails, final List<InvoiceItem> result) { if (!billedItems.iterator().hasNext() || billedUsage.compareTo(toBeBilledUsage) < 0) { final BigDecimal amountToBill = areAllBilledItemsWithDetails ? toBeBilledUsage : toBeBilledUsage.subtract(billedUsage); if (amountToBill.compareTo(BigDecimal.ZERO) > 0) { if (UsageDetailMode.DETAIL == usageDetailMode) { for (UsageConsumableInArrearTierUnitDetail toBeBilledUsageDetail : ((UsageConsumableInArrearDetail) toBeBilledUsageDetails).getTierDetails()) { final InvoiceItem item = new UsageInvoiceItem(invoiceId, accountId, getBundleId(), getSubscriptionId(), getPlanName(), getPhaseName(), usage.getName(), startDate, endDate, toBeBilledUsageDetail.getAmount(), toBeBilledUsageDetail.getTierPrice(), getCurrency(), toBeBilledUsageDetail.getQuantity(), null); result.add(item); } } else { final String itemDetails = toBeBilledUsageDetails.toJson(objectMapper); final InvoiceItem item = new UsageInvoiceItem(invoiceId, accountId, getBundleId(), getSubscriptionId(), getPlanName(), getPhaseName(), usage.getName(), startDate, endDate, amountToBill, null, getCurrency(), null, itemDetails); result.add(item); } } } }
Source:
<code>public void execute(Tuple input, BasicOutputCollector collector) { try { Thread.sleep(1000); } catch (InterruptedException e) { <START> Throwables.propagate(e); <END> } }</code><technical_language>throw</technical_language>

Target:
public void execute(Tuple input, BasicOutputCollector collector) { try { Thread.sleep(1000); } catch (InterruptedException e) { throw Throwables.propagate(e); } }
Source:
<code>public boolean canMoveToMaintenance(VDS vds) { boolean retVal = true; for ( MonitoringStrategy monitoringStrategy : strategies ) { retVal = retVal && monitoringStrategy.canMoveToMaintenance(vds); <START> if (retVal) { <END> break; } } return retVal; }</code><technical_language>braek if retVal is false? (and this is opinion) i easier understand if return false is false: for ( MonitoringStrategy monitoringStrategy : strategies ) { if (!monitoringStrategy.canMoveToMaintenance(vds)) return false; } return true;</technical_language>

Target:
public boolean canMoveToMaintenance(VDS vds) { for ( MonitoringStrategy monitoringStrategy : strategies ) { if (!monitoringStrategy.canMoveToMaintenance(vds)) { return false; } } return true; }
Source:
<code><START> public HashMap<String, <END> ArrayList<Order>> getBuyOrders() { return buyOrders; }</code><technical_language>this method changed private</technical_language>

Target:
private HashMap<String, ArrayList<Order>> getBuyOrders() { return buyOrders; }
Source:
<code>public static void init() { System.setProperty("zookeeper.authProvider.1", "org.apache.zookeeper.server.auth.SASLAuthenticationProvider"); try { File tmpDir = createTmpDir(); File saslConfFile = new File(tmpDir, "jaas.conf"); FileWriter fwriter = new FileWriter(saslConfFile); <START> fwriter.write("" + "Server {\n" <END> + " org.apache.zookeeper.server.auth.DigestLoginModule required\n" + " user_super=\"test\";\n" + "};\n" + "Client {\n" + " org.apache.zookeeper.server.auth.DigestLoginModule required\n" + " username=\"super\"\n" + " password=\"test\";\n" + "};" + "\n"); fwriter.close(); System.setProperty("java.security.auth.login.config", saslConfFile.getAbsolutePath()); } catch (IOException e) { } }</code><technical_language>Nit: if change is accident not, this readability worse</technical_language>

Target:
public static void init() { System.setProperty("zookeeper.authProvider.1", "org.apache.zookeeper.server.auth.SASLAuthenticationProvider"); try { File tmpDir = createTmpDir(); File saslConfFile = new File(tmpDir, "jaas.conf"); String jaasContent = getJaasFileContent(); FileWriter fwriter = new FileWriter(saslConfFile); fwriter.write(jaasContent); fwriter.close(); System.setProperty("java.security.auth.login.config", saslConfFile.getAbsolutePath()); } catch (IOException e) { } }