auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private <V> void executeOperation(final LongKeyOperation<V> operation) { final List<LongRange> dataKeyRanges = operation.getDataKeyRanges(); try { routerLock.readLock().lock(); final Pair<Map<Integer, Pair<Long, Long>>, Map<String, List<Pair<Long, Long>>>> routingResult = router.route(LongRangeUtils.fromRangesToPairs(dataKeyRanges)); final Map<Integer, Pair<Long, Long>> localBlockToSubKeyRangeMap = routingResult.getFirst(); final Map<String, List<Pair<Long, Long>>> remoteEvalToSubKeyRangesMap = routingResult.getSecond(); final int numSubOps = remoteEvalToSubKeyRangesMap.size() + 1; resultAggregator.registerOp(operation, numSubOps); sendOperationToRemoteStores(operation, remoteEvalToSubKeyRangesMap); final Map<Long, V> localOutputData = executeLocalOperation(operation, localBlockToSubKeyRangeMap); resultAggregator.submitLocalResult(operation, localOutputData, Collections.EMPTY_LIST); } finally { <START> routerLock.readLock().unlock(); <END> } }</code><technical_language>Never. thread sleeps in L454 remote operations finished. unlock handling result</technical_language>

Target:
private <V> void executeOperation(final LongKeyOperation<V> operation) { final List<LongRange> dataKeyRanges = operation.getDataKeyRanges(); final Map<Long, V> localOutputData; routerLock.readLock().lock(); try { final Pair<Map<Integer, Pair<Long, Long>>, Map<String, List<Pair<Long, Long>>>> routingResult = router.route(LongRangeUtils.fromRangesToPairs(dataKeyRanges)); final Map<Integer, Pair<Long, Long>> localBlockToSubKeyRangeMap = routingResult.getFirst(); final Map<String, List<Pair<Long, Long>>> remoteEvalToSubKeyRangesMap = routingResult.getSecond(); final int numSubOps = remoteEvalToSubKeyRangesMap.size() + 1; resultAggregator.registerOp(operation, numSubOps); sendOperationToRemoteStores(operation, remoteEvalToSubKeyRangesMap); localOutputData = executeLocalOperation(operation, localBlockToSubKeyRangeMap); } finally { routerLock.readLock().unlock(); } resultAggregator.submitLocalResult(operation, localOutputData, Collections.EMPTY_LIST); }
Source:
<code>public void MobileLogin_003_failedLoginWrongLogin() { MobileBasePageObject mobile = new MobileBasePageObject(driver); mobile.openHome(wikiURL); mobile.openRandomPage(); <START> System.out.println(credentials.userName12); <END> MobileSpecialUserLogin login = mobile.loginFailedDropDown(mobile.getTimeStamp(), mobile.getTimeStamp()); login.verifyWrongLoginErrorMessage(); }</code><technical_language>remove this line</technical_language>

Target:
public void MobileLogin_003_failedLoginWrongLogin() { MobileBasePageObject mobile = new MobileBasePageObject(driver); mobile.openHome(wikiURL); mobile.openRandomPage(); MobileSpecialUserLogin login = mobile.loginFailedDropDown(mobile.getTimeStamp(), mobile.getTimeStamp()); login.verifyWrongLoginErrorMessage(); }
Source:
<code>public T[] getClones(int num) { <START> List<T> result = new ArrayList<>(); <END> for (int i = 0; i < num; i++) { result.add(getClone()); } return (T[])result.toArray(); }</code><technical_language>is list necessary? number of elements is passed, array allocated beginning, is necessary rely ArrayList determine final size of array</technical_language>

Target:
public T[] getClones(int num) { T[] ts = (T[])Array.newInstance(clazz, num); try (Input input = new Input(bin)) { for (int i = 0; i < ts.length; i++) { input.rewind(); ts[i] = kryo.readObject(input, clazz); } } return ts; }
Source:
<code>NamedTableNode(String alias, TableName name,List<ColumnDef> dyn_columns) { super(alias, name); if(dyn_columns != null){ this.dyn_columns = dyn_columns; }else{ <START> this.dyn_columns = new ArrayList<ColumnDef>(); <END> } }</code><technical_language>above, Collections.&lt;ColumnDef&gt;emptyList()</technical_language>

Target:
NamedTableNode(String alias, TableName name,List<ColumnDef> dyn_columns) { super(alias, name); if(dyn_columns != null){ this.dyncolumns = ImmutableList.copyOf(dyn_columns); }else{ this.dyncolumns = Collections.<ColumnDef>emptyList(); } }
Source:
<code>private void emailObservable() { <START> Observable<String> observable = RxTextView.textChanges(emailEditText).skip(1).debounce(600,TimeUnit.MILLISECONDS) .observeOn(AndroidSchedulers.mainThread()) .subscribeOn(AndroidSchedulers.mainThread()) .map(new Function<CharSequence, String>() { @Override public String apply(CharSequence charSequence) throws Exception { return charSequence.toString(); } }); observable.subscribe(new DisposableObserver<String>() { @Override public void onNext(String s) { checkValidEmail(s); } @Override public void onError(Throwable e) { } @Override public void onComplete() { } }); <END> }</code><technical_language>drastically reduce lines of code lambda expressions. RxTextView.textChanges(emailEditText) .skipInitialValue() .debounce(600,TimeUnit.MILLISECONDS) .observeOn(AndroidSchedulers.mainThread()) .map(CharSequence::toString) .subscribe(this::checkValidEmail, LOG::error);</technical_language>

Target:
private void emailObservable() { RxTextView.textChanges(emailEditText). skipInitialValue() .debounce(600, TimeUnit.MILLISECONDS) .observeOn(AndroidSchedulers.mainThread()) .subscribeOn(AndroidSchedulers.mainThread()) .map(CharSequence::toString) .subscribe(this::checkValidEmail, LOG::error); }
Source:
<code>public void should_create_span_instrumented_by_a_handler_interceptor() { Collection<String> names = names(); then(names).isNotEmpty(); then(this.arrayListSpanAccumulator.getSpans()).isNotEmpty(); <START> then(new ListOfSpans(this.arrayListSpanAccumulator.getSpans())).hasASpanWithTagKeyEqualTo("http.class.name"); <END> then(this.tracer.getCurrentSpan()).isNull(); }</code><technical_language>assert span name (since special code that)</technical_language>

Target:
public void should_create_span_instrumented_by_a_handler_interceptor() { Collection<String> names = names(); then(names).isNotEmpty(); then(this.arrayListSpanAccumulator.getSpans()).isNotEmpty(); Awaitility.await().until( () -> { then(new ListOfSpans(this.arrayListSpanAccumulator.getSpans())).hasASpanWithName("http:/reservations") .hasASpanWithTagKeyEqualTo("mvc.controller.class"); }); then(this.tracer.getCurrentSpan()).isNull(); then(ExceptionUtils.getLastException()).isNull(); }
Source:
<code>private EstablishingWebsocketConnectionStateDescriptor() { super(XmppWebsocketTransportModule.EstablishingWebsocketConnectionState.class); addPredeccessor(LookupRemoteConnectionEndpointsStateDescriptor.class); addSuccessor(ConnectedButUnauthenticatedStateDescriptor.class); <START> declareInferiortyTo(EstablishingTcpConnectionStateDescriptor.class); <END> }</code><technical_language>smack-websocket subproject access smack-tcp classes. This the, existent, String based methods declare inferiority precedence other states. this is part of this milestone's goals (something for phase)</technical_language>

Target:
private EstablishingWebsocketConnectionStateDescriptor() { super(XmppWebsocketTransportModule.EstablishingWebsocketConnectionState.class); addPredeccessor(LookupRemoteConnectionEndpointsStateDescriptor.class); addSuccessor(ConnectedButUnauthenticatedStateDescriptor.class); declareInferiorityTo("org.jivesoftware.smack.tcp.XmppTcpTransportModule$EstablishingTcpConnectionStateDescriptor"); }
Source:
<code>private void initWebView() { WebSettings webSettings = mWebView.getSettings(); webSettings.setJavaScriptEnabled(true); webSettings.setDefaultTextEncodingName("utf-8"); mWebView.setWebViewClient(new WebViewClient() { public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) { AppLog.e(T.EDITOR, description); } }); mWebView.setWebChromeClient(new WebChromeClient() { public boolean onConsoleMessage(ConsoleMessage cm) { AppLog.d(T.EDITOR, cm.message() + " -- From line " + cm.lineNumber() + " of " + cm.sourceId()); return true; } @Override public boolean onJsAlert(WebView view, String url, String message, JsResult result) { AppLog.d(T.EDITOR, message); return true; } @Override public void onConsoleMessage(String message, int lineNumber, String sourceId) { AppLog.d(T.EDITOR, message + " -- from line " + lineNumber + " of " + sourceId); } }); String htmlEditor = getHtmlEditor(); <START> mWebView.addJavascriptInterface(new JsCallbackHandler(), "nativeCallbackHandler"); <END> mWebView.loadDataWithBaseURL("file:/ enableWebDebugging(true); }</code><technical_language>nativeCallbackHandler a const</technical_language>

Target:
private void initWebView() { WebSettings webSettings = mWebView.getSettings(); webSettings.setJavaScriptEnabled(true); webSettings.setDefaultTextEncodingName("utf-8"); mWebView.setWebViewClient(new WebViewClient() { public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) { AppLog.e(T.EDITOR, description); } }); mWebView.setWebChromeClient(new WebChromeClient() { public boolean onConsoleMessage(ConsoleMessage cm) { AppLog.d(T.EDITOR, cm.message() + " -- From line " + cm.lineNumber() + " of " + cm.sourceId()); return true; } @Override public boolean onJsAlert(WebView view, String url, String message, JsResult result) { AppLog.d(T.EDITOR, message); return true; } @Override public void onConsoleMessage(String message, int lineNumber, String sourceId) { AppLog.d(T.EDITOR, message + " -- from line " + lineNumber + " of " + sourceId); } }); String htmlEditor = getHtmlFromFile("android-editor.html"); mWebView.addJavascriptInterface(new JsCallbackHandler(), JS_CALLBACK_HANDLER); mWebView.loadDataWithBaseURL("file:/ enableWebDebugging(true); }
Source:
<code><START> public boolean isClosed() { <END> return clientState.isClosedOrClosingIsTriggered(); }</code><technical_language>Rename method too</technical_language>

Target:
public boolean isClosed() { return clientState.isCloseTriggered(); }
Source:
<code>public boolean isUsable() { Boolean discardConn = getChannelHandlerContext().channel() .attr(ClientRequestResponseConverter.DISCARD_CONNECTION).get(); <START> if (!getChannelHandlerContext().channel().isActive() || null != discardConn && discardConn) { <END> return false; } long nowMillis = System.currentTimeMillis(); long idleTime = nowMillis - lastReturnToPoolTimeMillis; return idleTime < maxIdleTimeMillis; }</code><technical_language>simplified discardConn == Boolean.TRUE</technical_language>

Target:
public boolean isUsable() { Boolean discardConn = getChannelHandlerContext().channel() .attr(ClientRequestResponseConverter.DISCARD_CONNECTION).get(); if (!getChannelHandlerContext().channel().isActive() || Boolean.TRUE == discardConn) { return false; } long nowMillis = System.currentTimeMillis(); long idleTime = nowMillis - lastReturnToPoolTimeMillis; return idleTime < maxIdleTimeMillis; }
Source:
<code>public void prepare(Map<String, Object> config, TopologyContext context, OutputCollector collector) { this.collector = collector; <START> logger.info(String.format("Conn String: %s, PartitionMode: %s", boltConfig.getConnectionString(), <END> String.valueOf(boltConfig.getPartitionMode()))); try { executorService = Executors.newSingleThreadExecutor(); ehClient = EventHubClient.createSync(boltConfig.getConnectionString(), executorService); if (boltConfig.getPartitionMode()) { String partitionId = String.valueOf(context.getThisTaskIndex()); logger.info("Writing to partition id: " + partitionId); sender = ehClient.createPartitionSenderSync(partitionId); } } catch (Exception ex) { collector.reportError(ex); throw new RuntimeException(ex); } }</code><technical_language>logger do String.format inherently. for placeholders (e.g. logger.info("Connection String: {}", boltConfig.getConnectionString())</technical_language>

Target:
public void prepare(Map<String, Object> config, TopologyContext context, OutputCollector collector) { this.collector = collector; logger.info(String.format("Connection String: %s, PartitionMode: %s", removeSecretFromConnectionString(boltConfig.getConnectionString()), String.valueOf(boltConfig.getUseTaskIndexAsPartitionId()))); try { executorService = Executors.newSingleThreadExecutor(); ehClient = EventHubClient.createSync(boltConfig.getConnectionString(), executorService); if (boltConfig.getUseTaskIndexAsPartitionId()) { final String partitionId = String.valueOf(context.getThisTaskIndex()); logger.info("Writing to partition id: " + partitionId); sender = ehClient.createPartitionSenderSync(partitionId); } } catch (Exception ex) { collector.reportError(ex); throw new RuntimeException(ex); } }
Source:
<code><START> @Override public<K, V> KNNClassificationModel fit(DatasetBuilder<K, V> datasetBuilder, IgniteBiFunction<K, V, double[]> featureExtractor, IgniteBiFunction<K, V, Double> lbExtractor) { <END> PartitionDataBuilder<K, V, KNNPartitionContext, LabeledDataset<Double, LabeledVector>> partDataBuilder = new KNNPartitionDataBuilderOnHeap<>( featureExtractor, lbExtractor ); Dataset<KNNPartitionContext, LabeledDataset<Double, LabeledVector>> dataset = null; if (datasetBuilder != null) { dataset = datasetBuilder.build( (upstream, upstreamSize) -> new KNNPartitionContext(), partDataBuilder ); } return new KNNClassificationModel<>(dataset); }</code><technical_language>MB format 2 lines</technical_language>

Target:
@Override public <K, V> KNNClassificationModel fit(DatasetBuilder<K, V> datasetBuilder, IgniteBiFunction<K, V, double[]> featureExtractor, IgniteBiFunction<K, V, Double> lbExtractor) { PartitionDataBuilder<K, V, KNNPartitionContext, LabeledDataset<Double, LabeledVector>> partDataBuilder = new LabeledDatasetPartitionDataBuilderOnHeap<>( featureExtractor, lbExtractor ); Dataset<KNNPartitionContext, LabeledDataset<Double, LabeledVector>> dataset = null; if (datasetBuilder != null) { dataset = datasetBuilder.build( (upstream, upstreamSize) -> new KNNPartitionContext(), partDataBuilder ); } return new KNNClassificationModel<>(dataset); }
Source:
<code>public Object apply(ChangeResource rsrc, Input input) throws AuthException, InterruptedException, ExecutionException { <START> CurrentUser caller = rsrc.getControl().getCurrentUser(); if (!caller.getCapabilities().canAdministrateServer()) { throw new AuthException("index not permitted"); } <END> indexer.index(rsrc.getChange()).get(); return Response.none(); }</code><technical_language>This check is necessary @RequiresCapability</technical_language>

Target:
public Object apply(ChangeResource rsrc, Input input) throws AuthException, InterruptedException, ExecutionException { indexer.index(rsrc.getChange()).get(); return Response.none(); }
Source:
<code><START> public int hashCode() { <END> return this.toString().hashCode(); }</code><technical_language>sense rewrite equals avoid #toString this is a expensive equality check. allow for a more efficient #hashCode,</technical_language>

Target:
public int hashCode() { return Objects.hash(message, resourcePath, start, end, severity); }
Source:
<code>public boolean isStackCompliant(Consumer consumer, String stackId, List<Entitlement> entsToConsider) { Stream<EntitlementDTO> entStream = entsToConsider == null ? Stream.empty() : entsToConsider.stream() .map(this.translator.getStreamMapper(Entitlement.class, EntitlementDTO.class)); Stream<GuestIdDTO> guestIdStream = consumer.getGuestIds() == null ? Stream.empty() : consumer.getGuestIds().stream() .map(this.translator.getStreamMapper(GuestId.class, GuestIdDTO.class)); JsonJsContext args = new JsonJsContext(mapper); args.put("stack_id", stackId); args.put("consumer", this.translator.translate(consumer, ConsumerDTO.class)); args.put("entitlements", entStream.collect(Collectors.toSet())); args.put("log", log, false); <START> args.put("guestIds", guestIdStream.collect(Collectors.toList())); <END> return jsRules.runJsFunction(Boolean.class, "is_stack_compliant", args); }</code><technical_language>here. pass stream in needing collect it</technical_language>

Target:
public boolean isStackCompliant(Consumer consumer, String stackId, List<Entitlement> entsToConsider) { Stream<EntitlementDTO> entStream = entsToConsider == null ? Stream.empty() : entsToConsider.stream() .map(this.translator.getStreamMapper(Entitlement.class, EntitlementDTO.class)); Stream<GuestIdDTO> guestIdStream = consumer.getGuestIds() == null ? Stream.empty() : consumer.getGuestIds().stream() .map(this.translator.getStreamMapper(GuestId.class, GuestIdDTO.class)); JsonJsContext args = new JsonJsContext(mapper); args.put("stack_id", stackId); args.put("consumer", this.translator.translate(consumer, ConsumerDTO.class)); args.put("entitlements", entStream); args.put("log", log, false); args.put("guestIds", guestIdStream); return jsRules.runJsFunction(Boolean.class, "is_stack_compliant", args); }
Source:
<code>public List<FolderItem> getProjectAssets( final Project project ) { <START> if ( project == null ) { <END> return null; } final Package defaultPackage = projectService.resolveDefaultPackage( project ); return explorerServiceHelper.getAssetsRecursively( defaultPackage, new ActiveOptions( Option.BUSINESS_CONTENT ) ); }</code><technical_language>@paulovmr is a case for this</technical_language>

Target:
public List<FolderItem> getProjectAssets( final Project project ) { checkNotNull( "project", project ); final Package defaultPackage = projectService.resolveDefaultPackage( project ); return explorerServiceHelper.getAssetsRecursively( defaultPackage, new ActiveOptions( Option.BUSINESS_CONTENT ) ); }
Source:
<code>public void cleanup() { <START> int numRetries = NUM_VALIDATE_RETRIES; <END> while (numRetries-- > 0) { if (validate()) { LOG.log(Level.WARNING, "Validation success"); return; } try { Thread.sleep(VALIDATE_SLEEP_MS); } catch (final InterruptedException e) { LOG.log(Level.WARNING, "Interrupted while sleeping to compare the result with expected value", e); } } LOG.log(Level.WARNING, "Validation failed"); }</code><technical_language>name numRetries is a bit confusing; rename numRemainingRetries</technical_language>

Target:
public void cleanup() { int numRemainingRetries = NUM_VALIDATE_RETRIES; while (numRemainingRetries-- > 0) { if (validate()) { LOG.log(Level.INFO, "Validation success"); return; } try { Thread.sleep(VALIDATE_SLEEP_MS); } catch (final InterruptedException e) { LOG.log(Level.WARNING, "Interrupted while sleeping to compare the result with expected value", e); } } LOG.log(Level.WARNING, "Validation failed"); }
Source:
<code>public void createProject(IProject project, boolean defaults, boolean onFinish, IProgressMonitor monitor) throws CoreException { SubMonitor subMonitor = SubMonitor.convert(monitor, 100); setProjectDescription(project, defaults, onFinish, subMonitor.split(70)); doTemplatesPostProcess(project); doCustom(project); <START> monitor.worked(30); <END> }</code><technical_language>Is this correct monitor do "worked" on? I missed this in PS1 review</technical_language>

Target:
public void createProject(IProject project, boolean defaults, boolean onFinish, IProgressMonitor monitor) throws CoreException { SubMonitor subMonitor = SubMonitor.convert(monitor, 100); setProjectDescription(project, defaults, onFinish, subMonitor.split(70)); doTemplatesPostProcess(project); doCustom(project); subMonitor.worked(30); }
Source:
<code>private void resetLabels() { <START> if (Boolean.valueOf(Library.getProperty("org.zkoss.util.label.reload", "false"))) <END> Labels.reset(); }</code><technical_language>xxx.cache</technical_language>

Target:
private void resetLabels() { if (!Boolean.valueOf(Library.getProperty("org.zkoss.util.label.cache", "true"))) Labels.reset(); }
Source:
<code>public void testInfo() throws Exception { final Info info = sut.info(); <START> assertThat(info.driverStatus(), any(List.class)); <END> assertThat(info.executionDriver(), not(isEmptyOrNullString())); assertThat(info.initPath(), not(isEmptyOrNullString())); assertThat(info.kernelVersion(), not(isEmptyOrNullString())); assertThat(info.cpus(), instanceOf(int.class)); assertThat(info.memTotal(), instanceOf(long.class)); assertThat(info.storageDriver(), not(isEmptyOrNullString())); assertThat(info.sockets(), not(empty())); assertThat(info.memoryLimit(), not(nullValue())); assertThat(info.swapLimit(), not(nullValue())); }</code><technical_language>Yeah. I guess a bad test basically testing type-safety is a thing</technical_language>

Target:
public void testInfo() throws Exception { final Info info = sut.info(); assertThat(info.executionDriver(), not(isEmptyOrNullString())); assertThat(info.initPath(), not(isEmptyOrNullString())); assertThat(info.kernelVersion(), not(isEmptyOrNullString())); assertThat(info.storageDriver(), not(isEmptyOrNullString())); assertThat(info.sockets(), not(empty())); assertThat(info.memoryLimit(), not(nullValue())); assertThat(info.swapLimit(), not(nullValue())); }
Source:
<code>private void checkRecord(MockId id, BlobReadOptions options) throws IOException { List<BlobReadOptions> optionsList = new ArrayList<>(); optionsList.add(options); <START> MessageReadSet readSet = new StoreMessageReadSet(optionsList); <END> IndexValue value = state.getExpectedValue(id, true); assertEquals("Unexpected key in BlobReadOptions", id, options.getStoreKey()); assertEquals("Unexpected size in BlobReadOptions", value.getSize(), options.getSize()); assertEquals("Unexpected expiresAtMs in BlobReadOptions", value.getExpiresAtMs(), options.getExpiresAtMs()); if (state.index.hardDeleter.enabled.get() && !state.deletedKeys.contains(id)) { ByteBuffer readBuf = ByteBuffer.allocate((int) value.getSize()); ByteBufferOutputStream stream = new ByteBufferOutputStream(readBuf); WritableByteChannel channel = Channels.newChannel(stream); readSet.writeTo(0, channel, 0, value.getSize()); byte[] expectedData = state.getExpectedData(id, true); assertArrayEquals("Data obtained from reset does not match original", expectedData, readBuf.array()); } }</code><technical_language>minor: call Arrays.asList(options) Collections.singletonList(options), avoid previous lines</technical_language>

Target:
private void checkRecord(MockId id, BlobReadOptions options) throws IOException { MessageReadSet readSet = new StoreMessageReadSet(Arrays.asList(options)); IndexValue value = state.getExpectedValue(id, true); assertEquals("Unexpected key in BlobReadOptions", id, options.getStoreKey()); assertEquals("Unexpected size in BlobReadOptions", value.getSize(), options.getSize()); assertEquals("Unexpected expiresAtMs in BlobReadOptions", value.getExpiresAtMs(), options.getExpiresAtMs()); if (state.index.hardDeleter.enabled.get() && !state.deletedKeys.contains(id)) { ByteBuffer readBuf = ByteBuffer.allocate((int) value.getSize()); ByteBufferOutputStream stream = new ByteBufferOutputStream(readBuf); WritableByteChannel channel = Channels.newChannel(stream); readSet.writeTo(0, channel, 0, value.getSize()); byte[] expectedData = state.getExpectedData(id, true); assertArrayEquals("Data obtained from reset does not match original", expectedData, readBuf.array()); } }
Source:
<code>private void saveChanges() { if (!mConfigFile.canWrite() && !Util.fixAppDataPermissions(mContext)) { Log.w(TAG, "Failed to save updated config. Cannot change the owner of the config file."); return; } Log.i(TAG, "Writing updated config file"); File mConfigTempFile = Constants.getConfigTempFile(mContext); try { TransformerFactory transformerFactory = TransformerFactory.newInstance(); Transformer transformer = transformerFactory.newTransformer(); DOMSource domSource = new DOMSource(mConfig); StreamResult streamResult = new StreamResult(mConfigTempFile); transformer.transform(domSource, streamResult); } catch (TransformerException e) { Log.w(TAG, "Failed to save temporary config file", e); return; } try { mConfigFile.delete(); <START> mConfigTempFile.renameTo(mConfigFile); <END> } catch (Exception e) { Log.w(TAG, "Failed to rename temporary config file to original file"); } }</code><technical_language>RenameTo enough, need delete</technical_language>

Target:
private void saveChanges() { if (!mConfigFile.canWrite() && !Util.fixAppDataPermissions(mContext)) { Log.w(TAG, "Failed to save updated config. Cannot change the owner of the config file."); return; } Log.i(TAG, "Writing updated config file"); File mConfigTempFile = Constants.getConfigTempFile(mContext); try { TransformerFactory transformerFactory = TransformerFactory.newInstance(); Transformer transformer = transformerFactory.newTransformer(); DOMSource domSource = new DOMSource(mConfig); StreamResult streamResult = new StreamResult(mConfigTempFile); transformer.transform(domSource, streamResult); } catch (TransformerException e) { Log.w(TAG, "Failed to save temporary config file", e); return; } try { mConfigTempFile.renameTo(mConfigFile); } catch (Exception e) { Log.w(TAG, "Failed to rename temporary config file to original file"); } }
Source:
<code>public void visitClass(ClassTree tree) { <START> boolean generatesEquals = usesAnnotation(tree, GENERATE_EQUALS); <END> excludeLinesIfTrue(generatesEquals || usesAnnotation(tree, GENERATE_UNUSED_FIELD_RELATED_METHODS), tree, UnusedPrivateFieldCheck.class, PrivateFieldUsedLocallyCheck.class); excludeLinesIfTrue(usesAnnotation(tree, GENERATE_CONSTRUCTOR), tree, AtLeastOneConstructorCheck.class); excludeLinesIfTrue(generatesEquals, tree, EqualsNotOverriddenInSubclassCheck.class, EqualsNotOverridenWithCompareToCheck.class); excludeLinesIfTrue(generatesPrivateConstructor(tree), tree, UtilityClassWithPublicConstructorCheck.class); excludeLinesIfTrue(usesAnnotation(tree, UTILITY_CLASS), tree, BadFieldNameCheck.class, ConstantsShouldBeStaticFinalCheck.class); super.visitClass(tree); }</code><technical_language>If fix targets S1165, change behavior of other rules. This change sense though, rename PR reflect this, state targetting Lombok's annotations modifying fields modifier for example</technical_language>

Target:
public void visitClass(ClassTree tree) { boolean generatesEquals = usesAnnotation(tree, GENERATE_EQUALS); excludeLinesIfTrue(generatesEquals || usesAnnotation(tree, GENERATE_UNUSED_FIELD_RELATED_METHODS), tree, UnusedPrivateFieldCheck.class, PrivateFieldUsedLocallyCheck.class); excludeLinesIfTrue(usesAnnotation(tree, GENERATE_CONSTRUCTOR), tree, AtLeastOneConstructorCheck.class); excludeLinesIfTrue(generatesEquals, tree, EqualsNotOverriddenInSubclassCheck.class, EqualsNotOverridenWithCompareToCheck.class); excludeLinesIfTrue(generatesPrivateConstructor(tree), tree, UtilityClassWithPublicConstructorCheck.class); excludeLinesIfTrue(usesAnnotation(tree, UTILITY_CLASS), tree, BadFieldNameCheck.class, ConstantsShouldBeStaticFinalCheck.class); if(usesAnnotation(tree, GENERATES_MODIFIERS)) { tree.members().forEach(this::visitFieldModifierVariable); } super.visitClass(tree); }
Source:
<code>public void testLinkSize() throws IOException { ReactorSender reactorSender = new ReactorSender(entityPath, sender, handler, reactorProvider, tokenManager, messageSerializer, Duration.ofSeconds(1), new ExponentialAmqpRetryPolicy(new AmqpRetryOptions())); StepVerifier.create(reactorSender.getLinkSize()) .expectNext(1000) .verifyComplete(); StepVerifier.create(reactorSender.getLinkSize()) .expectNext(1000) .verifyComplete(); <START> verify(sender, times(1)).getRemoteMaxMessageSize(); <END> }</code><technical_language>unit tests test complex logic in ReactorSender operation.. (which eventually moved TransactionCoordinator)</technical_language>

Target:
public void testLinkSize() { ReactorSender reactorSender = new ReactorSender(entityPath, sender, handler, reactorProvider, tokenManager, messageSerializer, Duration.ofSeconds(1), new ExponentialAmqpRetryPolicy(new AmqpRetryOptions())); StepVerifier.create(reactorSender.getLinkSize()) .expectNext(1000) .verifyComplete(); StepVerifier.create(reactorSender.getLinkSize()) .expectNext(1000) .verifyComplete(); verify(sender, times(1)).getRemoteMaxMessageSize(); }
Source:
<code>public ValidationResult canDisableVirtioScsi(Collection<? extends Disk> vmDisks) { if (vmDisks == null) { vmDisks = getDiskDao().getAllForVm(vms.iterator().next().getId(), true); } return vmDisks.stream() .filter(d -> d.getDiskInterface() == DiskInterface.VirtIO_SCSI) .findFirst() <START> .map(x -> new ValidationResult(EngineMessage.CANNOT_DISABLE_VIRTIO_SCSI_PLUGGED_DISKS)) <END> .orElse(ValidationResult.VALID); }</code><technical_language>works smells, I this is a complete abuse of API</technical_language>

Target:
public ValidationResult canDisableVirtioScsi(Collection<? extends Disk> vmDisks) { if (vmDisks == null) { vmDisks = getDiskDao().getAllForVm(vms.iterator().next().getId(), true); } boolean isVirtioScsiDiskExist = vmDisks.stream().anyMatch(d -> d.getDiskInterface() == DiskInterface.VirtIO_SCSI); if (isVirtioScsiDiskExist) { return new ValidationResult(EngineMessage.CANNOT_DISABLE_VIRTIO_SCSI_PLUGGED_DISKS); } return ValidationResult.VALID; }
Source:
<code>public ConfigurationProvider(String adUserName, String adUserPassword, String domainName, String ldapSecurityAuthentication, String ldapServers, String adUserId, String ldapProviderTypes, String engineConfigExecutable, String engineConfigProperties, String ldapServerPort) { super(); configVals.put(AdUserName, adUserName); configVals.put(AdUserPassword, adUserPassword); configVals.put(DomainName, domainName); configVals.put(LDAPSecurityAuthentication, ldapSecurityAuthentication); configVals.put(LdapServers, ldapServers); configVals.put(AdUserId, adUserId); configVals.put(LDAPProviderTypes, ldapProviderTypes); <START> configVals.put(ConfigValues.LDAPServerPort, ldapServerPort); <END> this.engineConfigExecutable = engineConfigExecutable; this.engineConfigProperties = engineConfigProperties; }</code><technical_language>import well, code more readable, prefix ConfigValues</technical_language>

Target:
public ConfigurationProvider(String adUserName, String adUserPassword, String domainName, String ldapSecurityAuthentication, String ldapServers, String adUserId, String ldapProviderTypes, String engineConfigExecutable, String engineConfigProperties, String ldapServerPort) { super(); configVals.put(AdUserName, adUserName); configVals.put(AdUserPassword, adUserPassword); configVals.put(DomainName, domainName); configVals.put(LDAPSecurityAuthentication, ldapSecurityAuthentication); configVals.put(LdapServers, ldapServers); configVals.put(AdUserId, adUserId); configVals.put(LDAPProviderTypes, ldapProviderTypes); configVals.put(LDAPServerPort, ldapServerPort); this.engineConfigExecutable = engineConfigExecutable; this.engineConfigProperties = engineConfigProperties; }
Source:
<code>@BeforeClass public static void beforeClass() throws MalformedURLException, UnknownHostException { AppiumServiceBuilder appiumServiceBuilder = new AppiumServiceBuilder() .usingPort(4357); service = appiumServiceBuilder.build(); service.start(); <START> InetAddress ipadd =InetAddress.getLocalHost(); <END> String n=ipadd.toString(); String ip = n.substring(n.indexOf("/")+1); System.out.println("-------------------------------------------"); System.out.println("IP address :"+n.substring(n.indexOf("/")+1)); System.out.println(service.isRunning()); System.out.println("SERVICE_URL: " + service.getUrl()); System.out.println("-------------------------------------------"); if (service == null || !service.isRunning()) { throw new AppiumServerHasNotBeenStartedLocallyException( "An appium server node is not started!"); } File appDir = new File("src/test/java/io/appium/java_client"); File app = new File(appDir, "ApiDemos-debug.apk"); DesiredCapabilities capabilities = new DesiredCapabilities(); capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "Android Emulator"); capabilities.setCapability(MobileCapabilityType.APP, app.getAbsolutePath()); capabilities.setCapability(MobileCapabilityType.AUTOMATION_NAME, AutomationName.ANDROID_UIAUTOMATOR2); capabilities.setCapability("uiautomator2ServerInstallTimeout", 60000); driver = new AndroidDriver<>(service.getUrl(), capabilities); driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS); }</code><technical_language>this formatted</technical_language>

Target:
@BeforeClass public static void beforeClass() { service = AppiumDriverLocalService.buildDefaultService(); service.start(); if (service == null || !service.isRunning()) { throw new AppiumServerHasNotBeenStartedLocallyException( "An appium server node is not started!"); } File appDir = new File("src/test/java/io/appium/java_client"); File app = new File(appDir, "ApiDemos-debug.apk"); DesiredCapabilities capabilities = new DesiredCapabilities(); capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "Android Emulator"); capabilities.setCapability(MobileCapabilityType.APP, app.getAbsolutePath()); capabilities.setCapability(MobileCapabilityType.AUTOMATION_NAME, AutomationName.ANDROID_UIAUTOMATOR2); driver = new AndroidDriver<>(service.getUrl(), capabilities); driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS); }
Source:
<code>protected String determinePrincipalId(final RequestContext requestContext, final Credential credential) { if (StringUtils.isBlank(properties.getJdbc().getPrincipalIdAttribute())) { return credential.getId(); } @NonNull final Principal principal = WebUtils.getAuthentication(requestContext).getPrincipal(); final String pIdAttribName = properties.getJdbc().getPrincipalIdAttribute(); if (!principal.getAttributes().containsKey(pIdAttribName)) { throw new IllegalStateException("Principal attribute [" + pIdAttribName + "] cannot be found"); } final Object pIdAttributeValue = principal.getAttributes().get(pIdAttribName); final Set<Object> pIdAttributeValues = CollectionUtils.toCollection(pIdAttributeValue); if (pIdAttributeValues.size() != 1) { <START> throw new IllegalStateException("Principal attribute [" + pIdAttribName + "] was found, but its value [" <END> + pIdAttributeValue + "] is either empty or multi-valued"); } return pIdAttributeValues.iterator().next().toString(); }</code><technical_language>Multi-valued attributes error out; a warning is while continue "first" in list</technical_language>

Target:
protected String determinePrincipalId(final RequestContext requestContext, final Credential credential) { if (StringUtils.isBlank(properties.getJdbc().getPrincipalIdAttribute())) { return credential.getId(); } @NonNull final Principal principal = WebUtils.getAuthentication(requestContext).getPrincipal(); final String pIdAttribName = properties.getJdbc().getPrincipalIdAttribute(); if (!principal.getAttributes().containsKey(pIdAttribName)) { throw new IllegalStateException("Principal attribute [" + pIdAttribName + "] cannot be found"); } final Object pIdAttributeValue = principal.getAttributes().get(pIdAttribName); final Set<Object> pIdAttributeValues = CollectionUtils.toCollection(pIdAttributeValue); String principalId = ""; if (!pIdAttributeValues.isEmpty()) { principalId = pIdAttributeValues.iterator().next().toString().trim(); } if (pIdAttributeValues.size() > 1) { LOGGER.warn("Principal attribute was found, but its value is multi-valued. " + "Proceeding with the first element [{}]", pIdAttribName, pIdAttributeValue, principalId); } if (principalId.isEmpty()) { throw new IllegalStateException("Principal attribute [" + pIdAttribName + "] was found, but it is either empty" + " or multi-valued with an empty element"); } return principalId; }
Source:
<code>public ElasticsearchRecordSet(ElasticsearchSplit split, ElasticsearchConnectorConfig config, List<ElasticsearchColumnHandle> columnHandles) { this.split = requireNonNull(split, "split is null"); this.config = requireNonNull(config, "config is null"); <START> this.columnHandles = requireNonNull(columnHandles, "column handles is null"); <END> ImmutableList.Builder<Type> types = ImmutableList.builder(); for (ElasticsearchColumnHandle column : columnHandles) { types.add(column.getColumnType()); } this.columnTypes = types.build(); }</code><technical_language>columnHandles is null</technical_language>

Target:
public ElasticsearchRecordSet(ElasticsearchSplit split, ElasticsearchConnectorConfig config, List<ElasticsearchColumnHandle> columnHandles) { this.split = requireNonNull(split, "split is null"); this.config = requireNonNull(config, "config is null"); this.columnHandles = requireNonNull(columnHandles, "columnHandles is null"); this.columnTypes = columnHandles.stream() .map(ElasticsearchColumnHandle::getColumnType) .collect(toImmutableList()); }
Source:
<code>public static HpackEncoder newTestEncoder(boolean ignoreMaxHeaderListSize, long maxHeaderListSize, long maxHeaderTableSize) throws Http2Exception { <START> HpackEncoder hpackEncoder = new HpackEncoder(false, 16, true); <END> ByteBuf buf = Unpooled.buffer(); try { hpackEncoder.setMaxHeaderTableSize(buf, maxHeaderTableSize); hpackEncoder.setMaxHeaderListSize(maxHeaderListSize); } finally { buf.release(); } return hpackEncoder; }</code><technical_language>This change right</technical_language>

Target:
public static HpackEncoder newTestEncoder(boolean ignoreMaxHeaderListSize, long maxHeaderListSize, long maxHeaderTableSize) throws Http2Exception { HpackEncoder hpackEncoder = new HpackEncoder(false, 16, 0); ByteBuf buf = Unpooled.buffer(); try { hpackEncoder.setMaxHeaderTableSize(buf, maxHeaderTableSize); hpackEncoder.setMaxHeaderListSize(maxHeaderListSize); } finally { buf.release(); } return hpackEncoder; }
Source:
<code>public void testBuildCriteriaURI(ResourceContextImpl resourceContext, RecordTemplate criteria, String batchParameterName, URI uri, <START> URI expectedURI) throws CloneNotSupportedException <END> { URI generatedURI = BatchFinderResponseBuilder.buildCriteriaURI(resourceContext, criteria, batchParameterName, uri); Assert.assertEquals(generatedURI.toString(), expectedURI.toString()); }</code><technical_language>remove CloneNotSupportedException</technical_language>

Target:
public void testBuildCriteriaURI(ResourceContextImpl resourceContext, RecordTemplate criteria, String batchParameterName, URI uri, URI expectedURI) { URI generatedURI = BatchFinderResponseBuilder.buildCriteriaURI(resourceContext, criteria, batchParameterName, uri); Assert.assertEquals(generatedURI.toString(), expectedURI.toString()); }
Source:
<code>private Description describeCause(Throwable child) { return Description.createTestDescription(fTestClass, <START> "initializationError: " + child); <END> }</code><technical_language>Spaces in descriptions give some frameworks fits. throwable in stacktrace, leave out of description</technical_language>

Target:
private Description describeCause(Throwable child) { return Description.createTestDescription(fTestClass, "initializationError"); }
Source:
<code>public HeaderStore headerStore() { DbSource<byte[]> dataSource = keyValueDataSource("headers"); <START> WriteCache.BytesKey<byte[]> cache = new WriteCache.BytesKey<>( <END> new BatchSourceWriter<>(dataSource), WriteCache.CacheType.SIMPLE); cache.setFlushSource(true); dbFlushManager().addCache(cache); HeaderStore headerStore = new HeaderStore(); Source<byte[], byte[]> headers = cachedDbSource("header", new XorDataSource<>(cache, HashUtil.sha3("header".getBytes()))); Source<byte[], byte[]> index = cachedDbSource("index", new XorDataSource<>(cache, HashUtil.sha3("index".getBytes()))); headerStore.init(index, headers); return headerStore; }</code><technical_language>suggest simplify source pipeline in way: xorSource("header") \ cachedSource -> kvSource("headers") / xorSource("index")</technical_language>

Target:
public HeaderStore headerStore() { DbSource<byte[]> dataSource = headerSource(); WriteCache.BytesKey<byte[]> cache = new WriteCache.BytesKey<>( new BatchSourceWriter<>(dataSource), WriteCache.CacheType.SIMPLE); cache.setFlushSource(true); dbFlushManager().addCache(cache); HeaderStore headerStore = new HeaderStore(); Source<byte[], byte[]> headers = new XorDataSource<>(cache, HashUtil.sha3("header".getBytes())); Source<byte[], byte[]> index = new XorDataSource<>(cache, HashUtil.sha3("index".getBytes())); headerStore.init(index, headers); return headerStore; }
Source:
<code>protected final void setState(State state) { AlluxioEvent.MasterIsTransitioning <START> .fire(String.format("Old-State: %s, New-State: %s", mState, state)); <END> try (LockResource lr = new LockResource(mStateLock)) { mState = state; mStateCond.signalAll(); synchronized (mListeners) { mListeners.forEach(listener -> listener.get().accept(state)); } LOG.info("Primary selector transitioning to {}", state); } }</code><technical_language>fire joins multiple arguments, this split multiple strings</technical_language>

Target:
protected final void setState(State state) { AlluxioEvent.MasterIsTransitioning.fire( new Pair<>("OldState", mState), new Pair<>("NewState", state)); try (LockResource lr = new LockResource(mStateLock)) { mState = state; mStateCond.signalAll(); synchronized (mListeners) { mListeners.forEach(listener -> listener.get().accept(state)); } LOG.info("Primary selector transitioning to {}", state); } }
Source:
<code>private void generateTrainingData() throws Exception { switch (args.property.toLowerCase()) { case "birthdate": birthdate(); break; default: LOG.error("Cannot generate training data for property: {}", args.property); throw new IllegalArgumentException("Cannot generate training data for property: " + args.property + ". Supported properties are: " + supportedPropertiesStr); <START> } <END> }</code><technical_language>break 2 lines</technical_language>

Target:
private void generateTrainingData() throws IOException, ParseException, NoSuchMethodException { Method propertyFunction = null; try { propertyFunction = this.getClass().getDeclaredMethod(args.property); propertyFunction.invoke(this); } catch (NoSuchMethodException e) { String msg = "Cannot generate training data for property: " + args.property + ". Supported properties are: " + supportedPropertiesStr; LOG.error(msg); throw new IllegalArgumentException(msg); } catch (IllegalAccessException | InvocationTargetException e) { String msg = "Unable to call method: " + propertyFunction.getName(); LOG.error(msg, e); throw new IllegalArgumentException(msg); } }
Source:
<code>protected void firePropertyChange(final int propertyId) { Object[] <START> array = <END> getListeners(); for (Object element : array) { final IPropertyListener l = (IPropertyListener) element; SafeRunner.run(new SafeRunnable() { @Override public void run() { l.propertyChanged(this, propertyId); } }); } }</code><technical_language>rename 'listeners'</technical_language>

Target:
protected void firePropertyChange(final int propertyId) { for (Object listener : getListeners()) { final IPropertyListener propertyListener = (IPropertyListener) listener; SafeRunner.run(new SafeRunnable() { @Override public void run() { propertyListener.propertyChanged(this, propertyId); } }); } }
Source:
<code>public void test_create_user_as_regular_user_with_al_privileges() throws Exception { executeAsSuperuser("CREATE USER trillian"); executeAsSuperuser("GRANT AL TO trillian"); <START> assertBusy(() -> { <END> var userManager = internalCluster().getInstance(UserManager.class); var user = userManager.findUser("trillian"); assertThat(user, Matchers.notNullValue()); assertThat(user.hasPrivilege(Privilege.Type.AL, Privilege.Clazz.CLUSTER, null, "doc"), is(true)); }); executeAs("CREATE USER arthur", "trillian"); assertUserIsCreated("arthur"); executeAs("DROP USER arthur", "trillian"); assertUserDoesntExist("arthur"); }</code><technical_language>do need assertBusy here? assertUserIsCreated next statement fail anyway</technical_language>

Target:
public void test_create_user_as_regular_user_with_al_privileges() throws Exception { executeAsSuperuser("CREATE USER trillian"); executeAsSuperuser("GRANT AL TO trillian"); executeAs("CREATE USER arthur", "trillian"); assertUserIsCreated("arthur"); executeAs("DROP USER arthur", "trillian"); assertUserDoesntExist("arthur"); }
Source:
<code>public QueuedUpdateListener() { <START> updateDelayInterval = 5 * 1000; <END> }</code><technical_language>needs soft end, internal config</technical_language>

Target:
public QueuedUpdateListener() { updateDelayInterval = DEFAULT_UPDATE_DELAY; }
Source:
<code>private FileStatus[] listConstraintFilesInDBDir(FileSystem fs, Path dbDir) { try { <START> return fs.listStatus(new Path(dbDirs[0].getPath(), ReplicationSemanticAnalyzer.CONSTRAINTS_ROOT_DIR_NAME)); <END> } catch (FileNotFoundException e) { return new FileStatus[]{}; } catch (IOException e) { throw new RuntimeException(e); } }</code><technical_language>dbDir instead of dbDirs[0] array</technical_language>

Target:
private FileStatus[] listConstraintFilesInDBDir(FileSystem fs, Path dbDir) { try { return fs.listStatus(new Path(dbDir, ReplicationSemanticAnalyzer.CONSTRAINTS_ROOT_DIR_NAME)); } catch (FileNotFoundException e) { return new FileStatus[]{}; } catch (IOException e) { throw new RuntimeException(e); } }
Source:
<code>private Transfer retrieve( final ArtifactStore store, final String path, final boolean suppressFailures, final EventMetadata eventMetadata ) throws IndyWorkflowException { if ( store.getKey().getType() == StoreType.group ) { return null; } if ( !checkMask(store, path)) { return null; } Transfer target; final ConcreteResource res = new ConcreteResource( LocationUtils.toLocation( store ), path ); try { if ( store instanceof RemoteRepository ) { target = transfers.retrieve( res, suppressFailures, eventMetadata ); } <START> else if ( nfc.isMissing( res ) ) <END> { target = null; } else { target = transfers.getCacheReference( res ); if ( target == null || !target.exists() ) { logger.trace( "Resource not found when retrieved; added to NFC: {}", res ); nfc.addMissing( res ); target = null; } } } catch ( final TransferLocationException e ) { fileEventManager.fire( new IndyStoreErrorEvent( store.getKey(), e ) ); logger.warn( "Timeout / bad gateway: " + res + ". Reason: " + e.getMessage(), e ); target = null; } catch ( final TransferContentException e ) { logger.warn( "Content-Length mismatch: " + res + ". Reason: " + e.getMessage() + "\nNOTE: This may be a network error; will retry download on next request.", e ); target = null; } catch ( final TransferException e ) { logger.error( e.getMessage(), e ); throw new IndyWorkflowException( "Failed to retrieve path: from: {}. Reason: {}", e, path, store, e.getMessage() ); } return target; }</code><technical_language>put this condition in set? want attempt retrieval if in NFC, right? I mean, TransportManager checking NFC, I guess critical, a confusing read</technical_language>

Target:
private Transfer retrieve( final ArtifactStore store, final String path, final boolean suppressFailures, final EventMetadata eventMetadata ) throws IndyWorkflowException { if ( store.getKey().getType() == StoreType.group ) { return null; } if ( !PathMaskChecker.checkMask( store, path)) { return null; } final ConcreteResource res = new ConcreteResource( LocationUtils.toLocation( store ), path ); if ( nfc.isMissing( res ) ) { return null; } Transfer target; try { if ( store instanceof RemoteRepository ) { target = transfers.retrieve( res, suppressFailures, eventMetadata ); } else { target = transfers.getCacheReference( res ); if ( target == null || !target.exists() ) { logger.trace( "Resource not found when retrieved; added to NFC: {}", res ); nfc.addMissing( res ); target = null; } } } catch ( final TransferLocationException e ) { fileEventManager.fire( new IndyStoreErrorEvent( store.getKey(), e ) ); logger.warn( "Timeout / bad gateway: " + res + ". Reason: " + e.getMessage(), e ); target = null; } catch ( final TransferContentException e ) { logger.warn( "Content-Length mismatch: " + res + ". Reason: " + e.getMessage() + "\nNOTE: This may be a network error; will retry download on next request.", e ); target = null; } catch ( final TransferException e ) { logger.error( e.getMessage(), e ); throw new IndyWorkflowException( "Failed to retrieve path: from: {}. Reason: {}", e, path, store, e.getMessage() ); } return target; }
Source:
<code>public static EventAuthField deserialize(final ConsumerRecord<byte[], byte[]> record) { <START> final Header typeHeader = record.headers().lastHeader(EventAuthField.AUTH_PARAM_NAME); <END> if (null == typeHeader) { return null; } final Header valueHeader = record.headers().lastHeader(EventAuthField.AUTH_PARAM_VALUE); if (valueHeader == null) { return null; } return new EventAuthField( new String(typeHeader.value(), Charsets.UTF_8), new String(valueHeader.value(), Charsets.UTF_8)); }</code><technical_language>s/type/name</technical_language>

Target:
public static EventAuthField deserialize(final ConsumerRecord<byte[], byte[]> record) { final Header nameHeader = record.headers().lastHeader(EventAuthField.AUTH_PARAM_NAME); if (null == nameHeader) { return null; } final Header valueHeader = record.headers().lastHeader(EventAuthField.AUTH_PARAM_VALUE); if (valueHeader == null) { return null; } return new EventAuthField( new String(nameHeader.value(), Charsets.UTF_8), new String(valueHeader.value(), Charsets.UTF_8)); }