auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void run() { for (BlobStore store : stores) { if (store.isStarted()) { try { store.maybeResumeCompaction(); } catch (Exception e) { <START> logger.error("Compaction of store failed on resume. Continuing with the next store", store, e); <END> storesToSkip.add(store); } } } while (enabled.get()) { try { long startTimeMs = time.milliseconds(); for (BlobStore store : stores) { try { if (!enabled.get()) { break; } if (store.isStarted() && !storesToSkip.contains(store)) { CompactionDetails details = getCompactionDetails(store); if (details != null) { store.compact(details); } } } catch (Exception e) { logger.error("Compaction of store failed. Continuing with the next store", store, e); storesToSkip.add(store); } } long timeElapsed = time.milliseconds() - startTimeMs; lock.lock(); try { time.await(waitCondition, waitTimeMs - timeElapsed); } finally { lock.unlock(); } } catch (Exception e) { logger.error("Compaction execution encountered an error either during wait. Continuing", e); } } }</code><technical_language>Is this unstable state calls for manual investigation</technical_language>

Target:
public void run() { for (BlobStore store : stores) { if (store.isStarted()) { try { store.maybeResumeCompaction(); } catch (Exception e) { logger.error("Compaction of store failed on resume. Continuing with the next store", store, e); storesToSkip.add(store); } } } while (enabled) { try { long startTimeMs = time.milliseconds(); for (BlobStore store : stores) { try { if (!enabled) { break; } if (store.isStarted() && !storesToSkip.contains(store)) { CompactionDetails details = getCompactionDetails(store); if (details != null) { store.compact(details); } } } catch (Exception e) { logger.error("Compaction of store failed. Continuing with the next store", store, e); storesToSkip.add(store); } } lock.lock(); try { if (enabled) { long timeElapsed = time.milliseconds() - startTimeMs; time.await(waitCondition, waitTimeMs - timeElapsed); } } finally { lock.unlock(); } } catch (Exception e) { logger.error("Compaction execution encountered an error either during wait. Continuing", e); } } }
Source:
<code>public void insert(ExecRow inputRow) throws StandardException { if (SanityManager.DEBUG) { SanityManager.ASSERT(state != STATE_DRAIN, "you cannot insert rows after starting to drain"); } state = STATE_INSERT; if(uniqueIndexCreated) { if(isRowAlreadyExist(inputRow)) return; } numRowsIn++; if (lastArraySlot + 1 < rowArray.length) { rowArray[++lastArraySlot] = cloneRow(inputRow); return; } if (!conglomCreated) { TransactionController tc = activation.getTransactionController(); int collation_ids[] = null; CID = tc.createConglomerate(false, "heap", inputRow.getRowArray(), null, collation_ids, properties, TransactionController.IS_TEMPORARY | <START> TransactionController.IS_KEPT, 0); <END> conglomCreated = true; cc = tc.openConglomerate(CID, false, TransactionController.OPENMODE_FORUPDATE, TransactionController.MODE_TABLE, TransactionController.ISOLATION_SERIALIZABLE); } int status = 0; status = cc.insert(inputRow); if (SanityManager.DEBUG) { if (status != 0) { SanityManager.THROWASSERT("got funky status ("+status+") back from "+ "ConglomerateConstroller.insert()"); } } }</code><technical_language>constant (also in this file)</technical_language>

Target:
public void insert(ExecRow inputRow) throws StandardException { if (SanityManager.DEBUG) { SanityManager.ASSERT(state != STATE_DRAIN, "you cannot insert rows after starting to drain"); } state = STATE_INSERT; if(uniqueIndexCreated) { if(isRowAlreadyExist(inputRow)) return; } numRowsIn++; if (lastArraySlot + 1 < rowArray.length) { rowArray[++lastArraySlot] = cloneRow(inputRow); return; } if (!conglomCreated) { TransactionController tc = activation.getTransactionController(); int collation_ids[] = null; CID = tc.createConglomerate(false, "heap", inputRow.getRowArray(), null, collation_ids, properties, TransactionController.IS_TEMPORARY | TransactionController.IS_KEPT, Conglomerate.Priority.NORMAL); conglomCreated = true; cc = tc.openConglomerate(CID, false, TransactionController.OPENMODE_FORUPDATE, TransactionController.MODE_TABLE, TransactionController.ISOLATION_SERIALIZABLE); } int status = 0; status = cc.insert(inputRow); if (SanityManager.DEBUG) { if (status != 0) { SanityManager.THROWASSERT("got funky status ("+status+") back from "+ "ConglomerateConstroller.insert()"); } } }
Source:
<code>public StorageRequestAuthorizer( Class<? extends AuthorizationHandler> handlerClass, Map<String, String> properties) <START> throws ReflectiveOperationException { <END> checkNotNull(handlerClass, NULL_HANDLER_MSG); authorizationHandler = handlerClass.getDeclaredConstructor().newInstance(); authorizationHandler.setProperties(properties); }</code><technical_language>variable name in message: handlerClass null</technical_language>

Target:
public StorageRequestAuthorizer( Class<? extends AuthorizationHandler> handlerClass, Map<String, String> properties) { checkNotNull(handlerClass, NULL_HANDLER_MSG); try { authorizationHandler = handlerClass.getDeclaredConstructor().newInstance(); } catch (ReflectiveOperationException e) { throw new RuntimeException("Can not instantiate authorization handler.", e); } authorizationHandler.setProperties(properties); }
Source:
<code>private static Model readPom( File file ) throws Exception { MavenXpp3Reader reader = new MavenXpp3Reader(); <START> return reader.read( new FileReader( file ) ); <END> }</code><technical_language>FileReader; handle encodings properly</technical_language>

Target:
private static Model readPom( File file ) throws Exception { MavenXpp3Reader reader = new MavenXpp3Reader(); return reader.read( new FileInputStream( file ) ); }
Source:
<code><START> public MockAssignmentMetadataStore() { <END> super(Mockito.mock(BucketDataAccessor.class), ""); }</code><technical_language>test class in package</technical_language>

Target:
MockAssignmentMetadataStore() { super(Mockito.mock(BucketDataAccessor.class), ""); }
Source:
<code>public void close() { <START> if (TRACK_CURSOR_PROVIDER_CLOSE) { <END> closerResponsible = new Exception("Responsible for closing the stream."); } closed.set(true); }</code><technical_language>do this setting closed flag</technical_language>

Target:
public void close() { closed.set(true); if (trackCursorProviderClose) { closerResponsible = new Exception("Responsible for closing the stream."); } }
Source:
<code>public boolean isInternal() { return getParentNode() <START> .filter(parent -> parent instanceof Name) <END> .map(parent -> (Name) parent) .flatMap(Name::getQualifier) .map(parentNameQualifier -> parentNameQualifier == this) .orElse(false); }</code><technical_language>I powers push a rewritten version of this method :-)</technical_language>

Target:
public boolean isInternal() { return getParentNode() .filter(parent -> parent instanceof Name) .isPresent(); }
Source:
<code>protected void setHeaders(HttpUriRequest httpUriRequest) throws IOException { setTokenHeader(httpUriRequest); setContentTypeHeader(httpUriRequest); setAcceptHeader(httpUriRequest); Map<String, String> headers = this.configuration.getHeaders(); for (Map.Entry<String, String> header : headers.entrySet()) { <START> Header authHeader = new BasicHeader(header.getKey(), header.getValue()); <END> httpUriRequest.setHeader(authHeader); } }</code><technical_language>guaranteed this is authHeader, a name is extraHeader similar</technical_language>

Target:
protected void setHeaders(HttpUriRequest httpUriRequest) throws IOException { setTokenHeader(httpUriRequest); setContentTypeHeader(httpUriRequest); setAcceptHeader(httpUriRequest); Map<String, String> headers = this.configuration.getHeaders(); if (headers != null) { for (Map.Entry<String, String> header : headers.entrySet()) { Header extraHeader = new BasicHeader(header.getKey(), header.getValue()); httpUriRequest.setHeader(extraHeader); } } }
Source:
<code>@Override protected void beforeTestsStarted() throws Exception { startGridsMultiThreaded(3); <START> startGrid(); <END> }</code><technical_language>start client grid startClientGrid() called</technical_language>

Target:
@Override protected void beforeTestsStarted() throws Exception { startGridsMultiThreaded(3); startClientGrid(); }
Source:
<code><START> protected boolean isReady() { <END> return IronSource.isRewardedVideoAvailable(); }</code><technical_language>@artemkuzmenko Extend CustomEventRewardedVideo override hasVideoAvailable() instead of isReady()</technical_language>

Target:
protected boolean isReady() { return IronSource.isISDemandOnlyRewardedVideoAvailable(mInstanceId); }
Source:
<code>public void channelConnected(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception { if (LOG.isTraceEnabled()) { LOG.trace("Channel connected " + e); } NettyServerCnxn cnxn = null; <START> if (serverCnxnClassCtr != null) { <END> try { cnxn = serverCnxnClassCtr.newInstance(ctx.getChannel(), zkServer, NettyServerCnxnFactory.this); } catch (InstantiationException e1) { LOG.debug("Can not instantiate class for " + serverCnxnClassCtr.getName() + ". Using NettyServerCnxn"); } catch (IllegalAccessException e1) { LOG.debug("IllegalAccessException for " + serverCnxnClassCtr.getName() + ". Using NettyServerCnxn"); } catch (InvocationTargetException e1) { LOG.debug("InvocationTargetException for " + serverCnxnClassCtr.getName() + ". Using NettyServerCnxn"); } catch (Throwable t) { LOG.debug("Unknown Exception while dealing with: . Using NettyServerCnxn", serverCnxnClassCtr.getName()); } } if (cnxn == null) { cnxn = new NettyServerCnxn(ctx.getChannel(), zkServer, NettyServerCnxnFactory.this); } ctx.setAttachment(cnxn); if (secure) { SslHandler sslHandler = ctx.getPipeline().get(SslHandler.class); ChannelFuture handshakeFuture = sslHandler.handshake(); handshakeFuture.addListener(new CertificateVerifier(sslHandler, cnxn)); } else { allChannels.add(ctx.getChannel()); addCnxn(cnxn); } }</code><technical_language>for NIO, lets set serverCnxnClassCtr NettyServerCnxn default</technical_language>

Target:
public void channelConnected(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception { if (LOG.isTraceEnabled()) { LOG.trace("Channel connected " + e); } NettyServerCnxn cnxn = null; try { cnxn = serverCnxnClassCtr.newInstance(ctx.getChannel(), zkServer, NettyServerCnxnFactory.this); } catch (Throwable t) { throw new IOException("Exception while trying to instantiate " + serverCnxnClassCtr.getName(), t); } ctx.setAttachment(cnxn); if (secure) { SslHandler sslHandler = ctx.getPipeline().get(SslHandler.class); ChannelFuture handshakeFuture = sslHandler.handshake(); handshakeFuture.addListener(new CertificateVerifier(sslHandler, cnxn)); } else { allChannels.add(ctx.getChannel()); addCnxn(cnxn); } }
Source:
<code>protected boolean verifyConnectionLost(MIOutput output) { boolean shouldTerminate = false; for (MIOOBRecord oobr : output.getMIOOBRecords()) { if (oobr instanceof MIConsoleStreamOutput) { MIConsoleStreamOutput out = (MIConsoleStreamOutput) oobr; String str = out.getString(); if (str != null && str.startsWith("Ending remote debugging")) { shouldTerminate = true; break; } } else if (oobr instanceof MILogStreamOutput) { MILogStreamOutput out = (MILogStreamOutput) oobr; String str = out.getString().trim(); if (str != null && str.startsWith("Remote connection closed")) { shouldTerminate = true; break; } } } if (!shouldTerminate) { MIResultRecord rr = output.getMIResultRecord(); if (rr != null) { String state = rr.getResultClass(); if ("error".equals(state)) { MIResult[] results = rr.getMIResults(); for (MIResult result : results) { String var = result.getVariable(); if (var.equals("msg")) { MIValue value = result.getMIValue(); if (value instanceof MIConst) { String str = ((MIConst)value).getCString(); if (str != null && str.startsWith("Remote connection closed")) { shouldTerminate = true; } } } } } } } <START> if (shouldTerminate) { <END> terminate(new ImmediateRequestMonitor() { @Override protected void handleErrorOrWarning() { GdbPlugin.getDefault().getLog().log(getStatus()); super.handleErrorOrWarning(); }; }); } return false; }</code><technical_language>I extract code in brackets another protected method - "connectionClosed()", for instance. pass reason of closing attribute. Overriding this method allow clients do else terminating session. do think</technical_language>

Target:
protected boolean verifyConnectionLost(MIOutput output) { boolean connectionLost = false; for (MIOOBRecord oobr : output.getMIOOBRecords()) { if (oobr instanceof MIConsoleStreamOutput) { MIConsoleStreamOutput out = (MIConsoleStreamOutput) oobr; String str = out.getString(); if (str != null && str.startsWith("Ending remote debugging")) { connectionLost = true; break; } } else if (oobr instanceof MILogStreamOutput) { MILogStreamOutput out = (MILogStreamOutput) oobr; String str = out.getString().trim(); if (str != null && str.startsWith("Remote connection closed")) { connectionLost = true; break; } } } if (!connectionLost) { MIResultRecord rr = output.getMIResultRecord(); if (rr != null) { String state = rr.getResultClass(); if ("error".equals(state)) { MIResult[] results = rr.getMIResults(); for (MIResult result : results) { String var = result.getVariable(); if (var.equals("msg")) { MIValue value = result.getMIValue(); if (value instanceof MIConst) { String str = ((MIConst)value).getCString(); if (str != null && str.startsWith("Remote connection closed")) { connectionLost = true; } } } } } } } if (connectionLost) { connectionLost(); return true; } return false; }
Source:
<code>private void validate() throws UnloggedFailure { if (active && inactive) { throw new UnloggedFailure(1, "--active and --inactive options are mutually exclusive."); } if (clearHttpPassword && !Strings.isNullOrEmpty(httpPassword)) { throw new UnloggedFailure(1, "--http-password and --clear-http-password options are mutually " + "exclusive."); } if (addSshKeys.contains("-") && deleteSshKeys.contains("-")) { throw new UnloggedFailure(1, "Only one option may use the stdin"); } if (deleteSshKeys.contains("ALL")) { deleteSshKeys = Collections.singletonList("ALL"); } if (deleteEmails.contains("ALL")) { deleteEmails = Collections.singletonList("ALL"); } <START> if (!Strings.isNullOrEmpty(preferredEmail) && !deleteEmails.isEmpty()) { if (deleteEmails.contains(preferredEmail)) { throw new UnloggedFailure(1, "--preferred-email and --delete-email options are mutually " + "exclusive for the same email address."); } } <END> }</code><technical_language>just: if (deleteEmails.contains(preferredEmail)) { throw new UnloggedFailure(1, "--preferred-email --delete-email options mutually " + "exclusive for email address."); }</technical_language>

Target:
private void validate() throws UnloggedFailure { if (active && inactive) { throw new UnloggedFailure(1, "--active and --inactive options are mutually exclusive."); } if (clearHttpPassword && !Strings.isNullOrEmpty(httpPassword)) { throw new UnloggedFailure(1, "--http-password and --clear-http-password options are mutually " + "exclusive."); } if (addSshKeys.contains("-") && deleteSshKeys.contains("-")) { throw new UnloggedFailure(1, "Only one option may use the stdin"); } if (deleteSshKeys.contains("ALL")) { deleteSshKeys = Collections.singletonList("ALL"); } if (deleteEmails.contains("ALL")) { deleteEmails = Collections.singletonList("ALL"); } if (deleteEmails.contains(preferredEmail)) { throw new UnloggedFailure(1, "--preferred-email and --delete-email options are mutually " + "exclusive for the same email address."); } }
Source:
<code>public void tearDown() throws UserStoreException { clearTestUsers(); <START> testDirectoryServer.stopLdapService(); <END> }</code><technical_language>happen #clearTestUsers threw exception? LDAP port open? #stopLdapService need a finally block</technical_language>

Target:
public void tearDown() throws UserStoreException { try { clearTestUsers(); } finally { testDirectoryServer.stopLdapService(); } }
Source:
<code>public void run(String... strings) throws Exception { <START> System.out.println(">>> Starting Audit App... "); <END> }</code><technical_language>@erdemedeiros remove system outs</technical_language>

Target:
public void run(String... strings) throws Exception { }
Source:
<code>public void testConstructor_defaultConstructor_fieldsShouldHaveCorrectDefaultValues() { FeedbackRankOptionsQuestionDetails rankDetails = new FeedbackRankOptionsQuestionDetails(); assertEquals(FeedbackQuestionType.RANK_OPTIONS, rankDetails.getQuestionType()); assertTrue(rankDetails.getMinOptionsToBeRanked() == FeedbackRankQuestionDetails.NO_VALUE); <START> assertTrue(rankDetails.getMaxOptionsToBeRanked() == FeedbackRankQuestionDetails.NO_VALUE); <END> assertFalse(rankDetails.areDuplicatesAllowed()); }</code><technical_language>assertEquals instead</technical_language>

Target:
public void testConstructor_defaultConstructor_fieldsShouldHaveCorrectDefaultValues() { FeedbackRankOptionsQuestionDetails rankDetails = new FeedbackRankOptionsQuestionDetails(); assertEquals(FeedbackQuestionType.RANK_OPTIONS, rankDetails.getQuestionType()); assertEquals(rankDetails.getMinOptionsToBeRanked(), FeedbackRankQuestionDetails.NO_VALUE); assertEquals(rankDetails.getMaxOptionsToBeRanked(), FeedbackRankQuestionDetails.NO_VALUE); assertFalse(rankDetails.areDuplicatesAllowed()); }
Source:
<code>private String notLocalizedKey(Enum<?> key, MissingResourceException e) { <START> String logString = "Missing Enum resource '" + key + "'."; END> if (e != null) { logString += " " + e.getLocalizedMessage(); } logger.info(logString); return key.name(); }</code><technical_language>is missing space:)</technical_language>

Target:
private String notLocalizedKey(Enum<?> key, MissingResourceException e) { String logString = "Missing Enum resource '" + key + "'."; if (e != null) { logString += " " + e.getLocalizedMessage(); } logger.warning(logString); return key.name(); }
Source:
<code>private RestRequest buildSoapRequest(String sessionId, String body) throws UnsupportedEncodingException { Map<String, String> customHeaders = new HashMap<String, String>(); customHeaders.put("SOAPAction", "\"\""); RequestBody requestBody = RequestBody.create(MEDIA_TYPE_XML, String.format(REQUEST_TEMPLATE, sessionId, body)); <START> return new RestRequest(RestRequest.RestMethod.POST, "/services/Soap/u/36.0", requestBody, customHeaders); <END> }</code><technical_language>change this "/services/Soap/u/" + ApiVersionStrings.getVersionNumber(context)? easier update API versions in 1 place</technical_language>

Target:
private RestRequest buildSoapRequest(String sessionId, String body) throws UnsupportedEncodingException { Map<String, String> customHeaders = new HashMap<String, String>(); customHeaders.put("SOAPAction", "\"\""); RequestBody requestBody = RequestBody.create(MEDIA_TYPE_XML, String.format(REQUEST_TEMPLATE, sessionId, body)); String version = ApiVersionStrings.getVersionNumber(SalesforceSDKManager.getInstance().getAppContext()).substring(1); ; return new RestRequest(RestRequest.RestMethod.POST, "/services/Soap/u/" + version, requestBody, customHeaders); }
Source:
<code>public void cleanup() { <START> if(this.streamEstimator != null) { <END> this.streamEstimator.reset(); } }</code><technical_language>streamEstimator null right</technical_language>

Target:
public void cleanup() { this.streamEstimator.reset(); }
Source:
<code>public void prepareFromRequest(PlaceRequest request) { super.prepareFromRequest(request); <START> name = request.getParameter("value", "noSelection"); <END> getView().setName(name); }</code><technical_language>Extract constant</technical_language>

Target:
public void prepareFromRequest(PlaceRequest request) { super.prepareFromRequest(request); name = request.getParameter(NameTokens.VALUE_PARAM, "noSelection"); getView().setName(name); }
Source:
<code>public synchronized InternalIndex addOrGetIndex(IndexConfig indexConfig, StoreAdapter partitionStoreAdapter) { String name = indexConfig.getName(); assert name != null; assert !name.isEmpty(); InternalIndex index = indexesByName.get(name); if (index != null) { return index; } index = indexProvider.createIndex( indexConfig, extractors, serializationService, indexCopyBehavior, stats.createPerIndexStats(indexConfig.getType() == IndexType.SORTED, usesCachedQueryableEntries), partitionStoreAdapter ); indexesByName.put(name, index); attributeIndexRegistry.register(index); converterCache.invalidate(index); indexes = indexesByName.values().toArray(EMPTY_INDEXES); <START> if (index.getComponents().length > 0) { <END> InternalIndex[] oldCompositeIndexes = compositeIndexes; InternalIndex[] newCompositeIndexes = Arrays.copyOf(oldCompositeIndexes, oldCompositeIndexes.length + 1); newCompositeIndexes[oldCompositeIndexes.length] = index; compositeIndexes = newCompositeIndexes; } return index; }</code><technical_language>1, 0</technical_language>

Target:
public synchronized InternalIndex addOrGetIndex(IndexConfig indexConfig, StoreAdapter partitionStoreAdapter) { String name = indexConfig.getName(); assert name != null; assert !name.isEmpty(); InternalIndex index = indexesByName.get(name); if (index != null) { return index; } index = indexProvider.createIndex( indexConfig, extractors, serializationService, indexCopyBehavior, stats.createPerIndexStats(indexConfig.getType() == IndexType.SORTED, usesCachedQueryableEntries), partitionStoreAdapter ); indexesByName.put(name, index); attributeIndexRegistry.register(index); converterCache.invalidate(index); indexes = indexesByName.values().toArray(EMPTY_INDEXES); if (index.getComponents().length > 1) { InternalIndex[] oldCompositeIndexes = compositeIndexes; InternalIndex[] newCompositeIndexes = Arrays.copyOf(oldCompositeIndexes, oldCompositeIndexes.length + 1); newCompositeIndexes[oldCompositeIndexes.length] = index; compositeIndexes = newCompositeIndexes; } return index; }
Source:
<code>private void adjustSequencesDueToFailedBatch(ProducerBatch batch) { <START> if (!topicPartitionBookkeeper.contains(batch.topicPartition) || !hasProducerIdAndEpoch(batch.producerId(), batch.producerEpoch())) <END> return; log.debug("producerId: {}, send to partition failed fatally. Reducing future sequence numbers by {}", batch.producerId(), batch.topicPartition, batch.recordCount); int currentSequence = sequenceNumber(batch.topicPartition); currentSequence -= batch.recordCount; if (currentSequence < 0) throw new IllegalStateException("Sequence number for partition " + batch.topicPartition + " is going to become negative: " + currentSequence); setNextSequence(batch.topicPartition, currentSequence); topicPartitionBookkeeper.getPartition(batch.topicPartition).resetSequenceNumbers(inFlightBatch -> { if (inFlightBatch.baseSequence() < batch.baseSequence()) return; int newSequence = inFlightBatch.baseSequence() - batch.recordCount; if (newSequence < 0) throw new IllegalStateException("Sequence number for batch with sequence " + inFlightBatch.baseSequence() + " for partition " + batch.topicPartition + " is going to become negative: " + newSequence); log.info("Resetting sequence number of batch with current sequence for partition to {}", inFlightBatch.baseSequence(), batch.topicPartition, newSequence); inFlightBatch.resetProducerState(new ProducerIdAndEpoch(inFlightBatch.producerId(), inFlightBatch.producerEpoch()), newSequence, inFlightBatch.isTransactional()); }); }</code><technical_language>adding condition</technical_language>

Target:
private void adjustSequencesDueToFailedBatch(ProducerBatch batch) { if (!topicPartitionBookkeeper.contains(batch.topicPartition)) return; log.debug("producerId: {}, send to partition failed fatally. Reducing future sequence numbers by {}", batch.producerId(), batch.topicPartition, batch.recordCount); int currentSequence = sequenceNumber(batch.topicPartition); currentSequence -= batch.recordCount; if (currentSequence < 0) throw new IllegalStateException("Sequence number for partition " + batch.topicPartition + " is going to become negative: " + currentSequence); setNextSequence(batch.topicPartition, currentSequence); topicPartitionBookkeeper.getPartition(batch.topicPartition).resetSequenceNumbers(inFlightBatch -> { if (inFlightBatch.baseSequence() < batch.baseSequence()) return; int newSequence = inFlightBatch.baseSequence() - batch.recordCount; if (newSequence < 0) throw new IllegalStateException("Sequence number for batch with sequence " + inFlightBatch.baseSequence() + " for partition " + batch.topicPartition + " is going to become negative: " + newSequence); log.info("Resetting sequence number of batch with current sequence for partition to {}", inFlightBatch.baseSequence(), batch.topicPartition, newSequence); inFlightBatch.resetProducerState(new ProducerIdAndEpoch(inFlightBatch.producerId(), inFlightBatch.producerEpoch()), newSequence, inFlightBatch.isTransactional()); }); }
Source:
<code>public String asSummaryString() { Map<String, Object> params = new LinkedHashMap<>(); params.put("identifier", viewIdentifier); <START> params.put("IfExists", ifExists); <END> params.put("isTemporary", isTemporary); return OperationUtils.formatWithChildren( "DROP VIEW", params, Collections.emptyList(), Operation::asSummaryString); }</code><technical_language>IfExists => ifExists</technical_language>

Target:
public String asSummaryString() { Map<String, Object> params = new LinkedHashMap<>(); params.put("identifier", viewIdentifier); params.put("ifExists", ifExists); params.put("isTemporary", isTemporary); return OperationUtils.formatWithChildren( "DROP VIEW", params, Collections.emptyList(), Operation::asSummaryString); }
Source:
<code>public BlurredAmbientOcclusionNode(Context context) { displayResolutionDependentFBOs = context.get(DisplayResolutionDependentFBOs.class); Config config = context.get(Config.class); <START> <END> RenderingConfig renderingConfig = config.getRendering(); renderingConfig.subscribe(RenderingConfig.SSAO, this); requiresCondition(renderingConfig::isSsao); addDesiredStateChange(new EnableMaterial(SSAO_BLURRED_MATERIAL)); ssaoBlurredMaterial = getMaterial(SSAO_BLURRED_MATERIAL); requiresFBO(new FBOConfig(SSAO_FBO, FULL_SCALE, FBO.Type.DEFAULT), displayResolutionDependentFBOs); requiresFBO(new FBOConfig(SSAO_BLURRED_FBO, FULL_SCALE, FBO.Type.DEFAULT), displayResolutionDependentFBOs); addDesiredStateChange(new BindFBO(SSAO_BLURRED_FBO, displayResolutionDependentFBOs)); addDesiredStateChange(new SetViewportToSizeOf(SSAO_BLURRED_FBO, displayResolutionDependentFBOs)); update(); displayResolutionDependentFBOs.subscribe(this); addDesiredStateChange(new SetInputTextureFromFBO(TEXTURE_SLOT_0, SSAO_FBO, ColorTexture, displayResolutionDependentFBOs, SSAO_BLURRED_MATERIAL, "tex")); }</code><technical_language>Unnecessary empty line. Moved line work though</technical_language>

Target:
public BlurredAmbientOcclusionNode(Context context) { super(context); RenderingConfig renderingConfig = context.get(Config.class).getRendering(); renderingConfig.subscribe(RenderingConfig.SSAO, this); requiresCondition(renderingConfig::isSsao); addDesiredStateChange(new EnableMaterial(SSAO_BLURRED_MATERIAL)); ssaoBlurredMaterial = getMaterial(SSAO_BLURRED_MATERIAL); displayResolutionDependentFBOs = context.get(DisplayResolutionDependentFBOs.class); requiresFBO(new FBOConfig(SSAO_FBO, FULL_SCALE, FBO.Type.DEFAULT), displayResolutionDependentFBOs); requiresFBO(new FBOConfig(SSAO_BLURRED_FBO, FULL_SCALE, FBO.Type.DEFAULT), displayResolutionDependentFBOs); addDesiredStateChange(new BindFBO(SSAO_BLURRED_FBO, displayResolutionDependentFBOs)); addDesiredStateChange(new SetViewportToSizeOf(SSAO_BLURRED_FBO, displayResolutionDependentFBOs)); update(); displayResolutionDependentFBOs.subscribe(this); addDesiredStateChange(new SetInputTextureFromFBO(TEXTURE_SLOT_0, SSAO_FBO, ColorTexture, displayResolutionDependentFBOs, SSAO_BLURRED_MATERIAL, "tex")); }
Source:
<code><START> private boolean checkOpenShiftHealth(IServer server, int timeout) throws OpenShiftNotReadyPollingException { <END> ServiceManagerEnvironment adb = ServiceManagerEnvironment.getOrLoadServiceManagerEnvironment(server, true); if( adb == null ) { return false; } boolean returnVal = false; String url = "https://" + adb.getOpenShiftHost() + ":" + adb.getOpenShiftPort() + "/healthz/ready"; try { HttpURLConnection con = (HttpURLConnection) new URL(url).openConnection(); con.setRequestMethod("HEAD"); con.setConnectTimeout(timeout); con.setReadTimeout(timeout); int response = con.getResponseCode(); con.disconnect(); returnVal = response == HttpURLConnection.HTTP_OK; } catch(MalformedURLException murle) { CDKCoreActivator.pluginLog().logError(murle.getMessage(), murle); returnVal = false; } catch(IOException ioe) { returnVal = false; } if( returnVal == false ) { throw new OpenShiftNotReadyPollingException(CDKCoreActivator.statusFactory().errorStatus(CDKCoreActivator.PLUGIN_ID, "The CDK VM is up and running, but OpenShift is unreachable at url " + url, null, OpenShiftNotReadyPollingException.OPENSHIFT_UNREACHABLE_CODE)); } return returnVal; }</code><technical_language>method a health url parameter, ~unit tested</technical_language>

Target:
private boolean checkOpenShiftHealth(IServer server, int timeout) throws OpenShiftNotReadyPollingException { ServiceManagerEnvironment adb = ServiceManagerEnvironment.getOrLoadServiceManagerEnvironment(server, true); if( adb == null ) { return false; } String url = adb.getOpenShiftHost() + ":" + adb.getOpenShiftPort() + "/healthz/ready"; return checkOpenShiftHealth(url, timeout); }
Source:
<code>static SecurityTrade parseTrade(CsvRow row, TradeInfo info, CsvInfoResolver resolver) { String securityIdScheme = row.findValue(SECURITY_ID_SCHEME_FIELD).orElse(DEFAULT_SECURITY_SCHEME); String securityIdValue = row.getValue(SECURITY_ID_FIELD); SecurityId securityId = SecurityId.of(securityIdScheme, securityIdValue); Optional<Double> quantityOpt = row.findValue(QUANTITY_FIELD).map(s -> LoaderUtils.parseDouble(s)); double price = LoaderUtils.parseDouble(row.getValue(PRICE_FIELD)); if (quantityOpt.isPresent()) { return SecurityTrade.of(info, securityId, quantityOpt.get(), price); } double longQuantity = parseQuantity(row, LONG_QUANTITY_FIELD); double shortQuantity = parseQuantity(row, SHORT_QUANTITY_FIELD); <START> double quantity = longQuantity - shortQuantity; <END> return SecurityTrade.of(info, securityId, quantity, price); }</code><technical_language>throw exception create a failure if quantity, short quantity long quantity populated. Silently setting quantity 0 feels dangerous; reasonable expect clients provide a quantity (can manually set 0 in input if needed)</technical_language>

Target:
static SecurityTrade parseTrade(CsvRow row, TradeInfo info, CsvInfoResolver resolver) { String securityIdScheme = row.findValue(SECURITY_ID_SCHEME_FIELD).orElse(DEFAULT_SECURITY_SCHEME); String securityIdValue = row.getValue(SECURITY_ID_FIELD); SecurityId securityId = SecurityId.of(securityIdScheme, securityIdValue); double price = LoaderUtils.parseDouble(row.getValue(PRICE_FIELD)); DoublesPair quantity = parseQuantity(row); return SecurityTrade.of(info, securityId, quantity.getFirst() - quantity.getSecond(), price); }
Source:
<code>public void visitNode(Tree node) { String value = ((LiteralTree) node).value().replaceAll("\\\\\\\\u", "\\\\z"); <START> value = value.substring(1, value.length() - 1); <END> if (value.isEmpty()) { return; } Matcher matcher = UNICODE_ESCAPED_CHAR.matcher(value); List<String> matches = getAllMatches(matcher); if (!matches.isEmpty()) { boolean notOnlyUnicodeEscaped = !matcher.replaceAll("").isEmpty(); if (notOnlyUnicodeEscaped && Iterables.any(matches, IS_PRINTABLE_ESCAPED_UNICODE)) { addIssue(node, "Remove this Unicode escape sequence and use the character instead."); } } }</code><technical_language>Please trimQuotes method in LiteralUtils : <LINK_0></technical_language>

Target:
public void visitNode(Tree node) { String value = LiteralUtils.trimQuotes(((LiteralTree) node).value()); if (value.isEmpty()) { return; } Matcher matcher = UNICODE_ESCAPED_CHAR.matcher(value.replaceAll("\\\\\\\\u", "\\\\z")); List<String> matches = getAllMatches(matcher); if (!matches.isEmpty()) { boolean notOnlyUnicodeEscaped = !matcher.replaceAll("").isEmpty(); if (notOnlyUnicodeEscaped && Iterables.any(matches, IS_PRINTABLE_ESCAPED_UNICODE)) { addIssue(node, "Remove this Unicode escape sequence and use the character instead."); } } }
Source:
<code>public void testServerToNodeMetadata() { server.enqueue( new MockResponse().setBody(stringFromResource("/compute/server.json")) ); <START> Server serverObject = api.serverApi().get("mock"); <END> NodeMetadata expected = fnNodeMetadata.apply(serverObject); assertNotNull(expected); NodeMetadata actual = new NodeMetadataBuilder() .group("docker001") .ids(serverObject.id()) .name(serverObject.name()) .backendStatus("AVAILABLE") .status(NodeMetadata.Status.RUNNING) .hardware(new HardwareBuilder() .ids("cpu=4,ram=4096,disk=40") .name("cpu=4,ram=4096,disk=40") .ram((int) serverObject.hardware().ram()) .processor(new Processor(serverObject.hardware().coresPerProcessor(), 1d)) .hypervisor("kvm") .volume(new VolumeBuilder() .bootDevice(true) .size(40f) .id("c04a2198-7e60-4bc0-b869-6e9c9dbcb8e1") .durable(true) .type(Volume.Type.LOCAL) .build()) .build()) .operatingSystem(new OperatingSystem.Builder() .description(OsFamily.LINUX.value()) .family(OsFamily.LINUX) .build()) .location(new LocationBuilder() .id("usa") .description("us") .scope(LocationScope.REGION) .metadata(ImmutableMap.<String, Object>of( "version", "10", "state", "AVAILABLE")) .parent(new LocationBuilder() .id("de") .description("Germany") .scope(LocationScope.PROVIDER) .build()) .build()) .publicAddresses(ImmutableList.<String>of("173.252.120.6")) .build(); assertEquals(actual, expected); }</code><technical_language>is need mock api calls implement this test</technical_language>

Target:
public void testServerToNodeMetadata() { server.enqueue( new MockResponse().setBody(stringFromResource("/compute/server.json")) ); Server serverObject = api.serverApi().get("mock"); NodeMetadata expected = fnNodeMetadata.apply(serverObject); assertNotNull(expected); NodeMetadata actual = new NodeMetadataBuilder() .group("docker001") .ids(serverObject.id()) .name(serverObject.name()) .backendStatus("AVAILABLE") .status(NodeMetadata.Status.RUNNING) .hardware(new HardwareBuilder() .ids("cpu=4,ram=4096,disk=40") .name("cpu=4,ram=4096,disk=40") .ram((int) serverObject.hardware().ram()) .processor(new Processor(serverObject.hardware().coresPerProcessor(), 1d)) .hypervisor("kvm") .volume(new VolumeBuilder() .bootDevice(true) .size(40f) .id("c04a2198-7e60-4bc0-b869-6e9c9dbcb8e1") .durable(true) .type(Volume.Type.LOCAL) .build()) .build()) .operatingSystem(new OperatingSystem.Builder() .description(OsFamily.LINUX.value()) .family(OsFamily.LINUX) .build()) .location(new LocationBuilder() .id("908DC2072407C94C8054610AD5A53B8C") .description("us") .scope(LocationScope.REGION) .metadata(ImmutableMap.<String, Object>of( "version", "10", "state", "AVAILABLE")) .parent(new LocationBuilder() .id("de") .description("Germany") .scope(LocationScope.PROVIDER) .build()) .build()) .publicAddresses(ImmutableList.<String>of("173.252.120.6")) .build(); assertEquals(actual, expected); }
Source:
<code>private void performDiskUpdate(final boolean unlockImage) { final Disk diskToUpdate = getDiskDao().get(getParameters().getDiskId()); TransactionSupport.executeInNewTransaction(new TransactionMethod<Object>() { @Override public Object runInTransaction() { getVmStaticDAO().incrementDbGeneration(getVm().getId()); updateSnapshotIdOnShareableChange(diskToUpdate, getNewDisk()); clearAddressOnInterfaceChange(diskToUpdate, getNewDisk()); <START> diskToUpdate.setBoot(getNewDisk().isBoot()); <END> diskToUpdate.setDiskInterface(getNewDisk().getDiskInterface()); diskToUpdate.setPropagateErrors(getNewDisk().getPropagateErrors()); diskToUpdate.setWipeAfterDelete(getNewDisk().isWipeAfterDelete()); diskToUpdate.setDiskAlias(getNewDisk().getDiskAlias()); diskToUpdate.setDiskDescription(getNewDisk().getDiskDescription()); diskToUpdate.setShareable(getNewDisk().isShareable()); getBaseDiskDao().update(diskToUpdate); if (diskToUpdate.getDiskStorageType() == DiskStorageType.IMAGE) { DiskImage diskImage = (DiskImage) diskToUpdate; diskImage.setQuotaId(getQuotaId()); if (unlockImage && diskImage.getImageStatus() == ImageStatus.LOCKED) { diskImage.setImageStatus(ImageStatus.OK); } getImageDao().update(diskImage.getImage()); } updateVmDisksAndDevice(); setSucceeded(true); return null; } private void clearAddressOnInterfaceChange(Disk diskToUpdate, Disk diskWithUserChanges) { if (diskToUpdate.getDiskInterface() != diskWithUserChanges.getDiskInterface()) { getVmDeviceDao().clearDeviceAddress(getVmDeviceDao().get(new VmDeviceId(diskToUpdate.getId(), getVmId())) .getDeviceId()); } } }); }</code><technical_language>consider moving setters of diskToUpdate a separate method for more readable code. prepare object diskToUpdate transaction is opened alive</technical_language>

Target:
private void performDiskUpdate(final boolean unlockImage) { final Disk disk = getDiskDao().get(getParameters().getDiskId()); applyUserChanges(disk); TransactionSupport.executeInNewTransaction(new TransactionMethod<Object>() { @Override public Object runInTransaction() { getVmStaticDAO().incrementDbGeneration(getVm().getId()); clearAddressOnInterfaceChange(disk, getNewDisk()); getBaseDiskDao().update(disk); if (disk.getDiskStorageType() == DiskStorageType.IMAGE) { DiskImage diskImage = (DiskImage) disk; diskImage.setQuotaId(getQuotaId()); if (unlockImage && diskImage.getImageStatus() == ImageStatus.LOCKED) { diskImage.setImageStatus(ImageStatus.OK); } getImageDao().update(diskImage.getImage()); } updateVmDisksAndDevice(); setSucceeded(true); return null; } private void clearAddressOnInterfaceChange(Disk diskToUpdate, Disk diskWithUserChanges) { if (diskToUpdate.getDiskInterface() != diskWithUserChanges.getDiskInterface()) { getVmDeviceDao().clearDeviceAddress(getVmDeviceDao().get(new VmDeviceId(diskToUpdate.getId(), getVmId())) .getDeviceId()); } } }); }
Source:
<code>public V computeIfPresent(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction) { checkNotNull(key, NULL_KEY_IS_NOT_ALLOWED); checkNotNull(key, NULL_BIFUNCTION_IS_NOT_ALLOWED); <START> if (SerializationUtil.isClassStaticAndSerializable(remappingFunction)) { <END> BiFunctionExecutingEntryProcessor<K, V> ep = new BiFunctionExecutingEntryProcessor<>(remappingFunction); return executeOnKeyInternal(key, ep); } else { return computeIfPresentLocally(key, remappingFunction); } }</code><technical_language>This is tricky again. client is aware of version of cluster is connected to. happen function is serializable static is cluster cluster members fail deserialise it. Unfortunately, this is other option for user a serializable function calling client upgrade member versions. I a good idea tackle this. a poor-man's solution (but, infinite loop now), avoid this optimisation client simply computeIfPresentLocally in cases. WDYT? cc @sancar</technical_language>

Target:
public V computeIfPresent(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction) { checkNotNull(key, NULL_KEY_IS_NOT_ALLOWED); checkNotNull(key, NULL_BIFUNCTION_IS_NOT_ALLOWED); return computeIfPresentLocally(key, remappingFunction); }
Source:
<code>public void shouldNotSeeFilteredEntries() throws Exception { IndexEntryUpdate<SchemaIndexDescriptor>[] updates = layoutUtil.someUpdatesNoDuplicateValues(); processAll( updates ); layoutUtil.sort( updates ); IndexReader reader = accessor.newReader(); NodeValueIterator iter = new NodeValueIterator(); <START> IndexQuery.ExactPredicate filter = IndexQuery.exact( 0, updates[1].values()[0].asObjectCopy() ); <END> IndexQuery rangeQuery = layoutUtil.rangeQuery( valueOf( updates[0] ), true, valueOf( updates[2] ), true ); IndexProgressor.NodeValueClient filterClient = filterClient( iter, filter ); reader.query( filterClient, IndexOrder.NONE, rangeQuery ); assertTrue( iter.hasNext() ); assertEquals( entityIdOf( updates[1] ), iter.next() ); assertFalse( iter.hasNext() ); }</code><technical_language>valueOf( updates[1] ).asObjectCopy()</technical_language>

Target:
public void shouldNotSeeFilteredEntries() throws Exception { IndexEntryUpdate<SchemaIndexDescriptor>[] updates = layoutUtil.someUpdatesNoDuplicateValues(); processAll( updates ); layoutUtil.sort( updates ); IndexReader reader = accessor.newReader(); NodeValueIterator iter = new NodeValueIterator(); IndexQuery.ExactPredicate filter = IndexQuery.exact( 0, valueOf( updates[1]) ); IndexQuery rangeQuery = layoutUtil.rangeQuery( valueOf( updates[0] ), true, valueOf( updates[2] ), true ); IndexProgressor.NodeValueClient filterClient = filterClient( iter, filter ); reader.query( filterClient, IndexOrder.NONE, rangeQuery ); assertTrue( iter.hasNext() ); assertEquals( entityIdOf( updates[1] ), iter.next() ); assertFalse( iter.hasNext() ); }
Source:
<code>protected Object convertSingleValue(Object value) { if (value instanceof ByteBuffer) { ByteBuffer byteBufferValue = (ByteBuffer) value; byte[] bytesValue = new byte[byteBufferValue.remaining()]; byteBufferValue.get(bytesValue); return bytesValue; } <START> if (value instanceof Number) { <END> return value; } return value.toString(); }</code><technical_language>preserve byte[] suggestion if (value instanceof Number || instanceof byte[]) {</technical_language>

Target:
protected Object convertSingleValue(Object value) { if (value instanceof ByteBuffer) { ByteBuffer byteBufferValue = (ByteBuffer) value; byte[] bytesValue = new byte[byteBufferValue.remaining()]; byteBufferValue.get(bytesValue); return bytesValue; } if (value instanceof Number || value instanceof byte[]) { return value; } return value.toString(); }
Source:
<code>private long conferenceAge() { if(sid != null){ final ConferenceDetailRecordsDao dao = storage.getConferenceDetailRecordsDao(); ConferenceDetailRecord cdr = dao.getConferenceDetailRecord(sid); if(cdr == null){ if(logger.isDebugEnabled()) logger.debug(String.format("Conference cdr is null for sid: %s", sid)); }else{ <START> return DateTime.now().getMillis()-cdr.getDateCreated().getMillis(); <END> } } return 0; }</code><technical_language>assume JVM/OS nodes in cluster clock synced? nodes configured sync system clock a central server regularly</technical_language>

Target:
private long conferenceAge() { if(sid != null){ final ConferenceDetailRecordsDao dao = storage.getConferenceDetailRecordsDao(); ConferenceDetailRecord cdr = dao.getConferenceDetailRecord(sid); if(cdr == null){ logger.warning(String.format("Conference cdr is null for sid: %s", sid)); }else{ return DateTime.now().getMillis()-cdr.getDateCreated().getMillis(); } } return 0; }
Source:
<code>public static LocalTimeValue truncate( TemporalUnit unit, TemporalValue input, MapValue fields, Supplier<ZoneId> defaultZone ) { LocalTime localTime = input.getLocalTimePart(); LocalTime truncatedLT; try { truncatedLT = localTime.truncatedTo( unit ); } catch ( UnsupportedTemporalTypeException e ) { <START> throw new UnsupportedTemporalUnitException( e.getMessage() ); <END> } if ( fields.size() == 0 ) { return localTime( truncatedLT ); } else { Map<String,AnyValue> updatedFields = fields.getMapCopy(); truncatedLT = updateFieldMapWithConflictingSubseconds( updatedFields, unit, truncatedLT ); if ( updatedFields.size() == 0 ) { return localTime( truncatedLT ); } updatedFields.put( "time", localTime( truncatedLT ) ); return build( VirtualValues.map( updatedFields ), defaultZone ); } }</code><technical_language>pass in e (and Exception types accept optional cause)</technical_language>

Target:
public static LocalTimeValue truncate( TemporalUnit unit, TemporalValue input, MapValue fields, Supplier<ZoneId> defaultZone ) { LocalTime localTime = input.getLocalTimePart(); LocalTime truncatedLT; try { truncatedLT = localTime.truncatedTo( unit ); } catch ( UnsupportedTemporalTypeException e ) { throw new UnsupportedTemporalUnitException( e.getMessage(), e ); } if ( fields.size() == 0 ) { return localTime( truncatedLT ); } else { Map<String,AnyValue> updatedFields = fields.getMapCopy(); truncatedLT = updateFieldMapWithConflictingSubseconds( updatedFields, unit, truncatedLT ); if ( updatedFields.size() == 0 ) { return localTime( truncatedLT ); } updatedFields.put( "time", localTime( truncatedLT ) ); return build( VirtualValues.map( updatedFields ), defaultZone ); } }
Source:
<code>public void initializeVisualizer() { fEventListener = new MulticoreVisualizerEventListener(this); m_cpuCoreContextsCache = new ArrayList<IDMContext>(); m_visualizerInstanceId = getViewer().getView().getViewSite().getSecondaryId(); if (m_visualizerInstanceId == null) { m_visualizerInstanceId = "0"; } <START> initializePersistentParameters(); <END> }</code><technical_language>Pass visualizerId method. this avoid method moved a place visualizerInstanceId is set</technical_language>

Target:
public void initializeVisualizer() { fEventListener = new MulticoreVisualizerEventListener(this); m_cpuCoreContextsCache = new ArrayList<IDMContext>(); m_visualizerInstanceId = getViewer().getView().getViewSite().getSecondaryId(); if (m_visualizerInstanceId == null) { m_visualizerInstanceId = "0"; } initializePersistentParameters(m_visualizerInstanceId); }
Source:
<code>public Attributes getAttributes() { if (attrs != null) return attrs; if (attributesNodeProvider == null) { throw new IllegalStateException( "The tree walk should have one AttributesNodeProvider set in order to compute the git attributes."); } WorkingTreeIterator workingTreeIterator = getCurrentTreeNode( WorkingTreeIterator.class); DirCacheIterator dirCacheIterator = getCurrentTreeNode( DirCacheIterator.class); CanonicalTreeParser other = getCurrentTreeNode( CanonicalTreeParser.class); if (workingTreeIterator == null && dirCacheIterator == null && other == null) { return new Attributes(); } String path = currentHead.getEntryPathString(); final boolean isDir = FileMode.TREE.equals(currentHead.mode); Attributes attributes = new Attributes(); try { if (macroExpander == null) { AttributesNode globalNode = attributesNodeProvider .getGlobalAttributesNode(); AttributesNode infoNode = attributesNodeProvider .getInfoAttributesNode(); AttributesNode rootNode = getRootAttributesNode(); macroExpander = new MacroExpander(globalNode, infoNode, rootNode); } <START> macroExpander.mergeInfoAttributes(path, isDir, attributes); getPerDirectoryEntryAttributes(path, isDir, operationType, workingTreeIterator, dirCacheIterator, other, attributes); macroExpander.mergeGlobalAttributes(path, isDir, attributes); <END> } catch (IOException e) { throw new JGitInternalException("Error while parsing attributes", e); } for (Attribute a : attributes.getAll()) { if (a.getState() == State.UNSPECIFIED) attributes.remove(a.getKey()); } return attributes; }</code><technical_language>MacroExpander info global nodes. TreeWalk care call this in correct order. knowledge merge current,info,global hidden in MacroExpander</technical_language>

Target:
public Attributes getAttributes() { if (attrs != null) return attrs; if (attributesNodeProvider == null) { throw new IllegalStateException( "The tree walk should have one AttributesNodeProvider set in order to compute the git attributes."); } try { if (macroExpander == null) { macroExpander = new MacroExpander(this); } attrs = macroExpander.getAttributes(); return attrs; } catch (IOException e) { throw new JGitInternalException("Error while parsing attributes", e); } }
Source:
<code>public void dropTopic(String destinationUri) { <START> String topicName = URI.create(destinationUri).getPath(); <END> AdminUtils.deleteTopic(new ZkClient(_zkAddress), topicName); }</code><technical_language>validation</technical_language>

Target:
public void dropTopic(String destinationUri) { Objects.requireNonNull(destinationUri, "destinationuri should not null"); String topicName = URI.create(destinationUri).getPath(); try { if(AdminUtils.topicExists(_zkClient, topicName)) { AdminUtils.deleteTopic(_zkClient, topicName); } else { LOG.warn(String.format("Trying to delete topic %s that doesn't exist", topicName)); } } catch(Throwable e) { LOG.error(String.format("Deleting topic %s failed with exception %s", topicName, e)); throw e; } }
Source:
<code>private static void addOptions(Tad target, Enum<?>[] values) { final List<Option> options = target.getOption(); for (Enum<?> value : values) { Toption option = new Toption(); <START> option.setLabel(value.name()); <END> option.setValue(value.name()); options.add(option); } }</code><technical_language>extract value.name() a local var</technical_language>

Target:
private static void addOptions(Tad target, Enum<?>[] values) { final List<Option> options = target.getOption(); for (Enum<?> value : values) { final String name = value.name(); final Toption option = new Toption(); option.setLabel(name); option.setValue(name); options.add(option); } }