auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void tryCommit(Producer<?, ?> producer, Map<? super EventMessage<?>, MonitorCallback> monitorCallbacks) { try { producer.commitTransaction(); monitorCallbacks.forEach((k, v) -> v.reportSuccess()); } catch (ProducerFencedException e) { <START> logger.warn("Unable to commit transaction", e); <END> throw new EventPublicationFailedException( "Event publication failed: Exception occurred while committing kafka transaction", e); } }</code><technical_language>I expect monitorCallbacks notified of failure here</technical_language>

Target:
private void tryCommit(Producer<?, ?> producer, Map<? super EventMessage<?>, MonitorCallback> monitorCallbacks) { try { producer.commitTransaction(); monitorCallbacks.forEach((k, v) -> v.reportSuccess()); } catch (ProducerFencedException e) { logger.warn("Unable to commit transaction", e); monitorCallbacks.forEach((k, v) -> v.reportFailure(e)); throw new EventPublicationFailedException( "Event publication failed: Exception occurred while committing kafka transaction", e); } }
Source:
<code>protected Map<String, Object> subsetMap(String prefix) { Map<String, Object> subset = new TreeMap<String, Object>(); for (Map.Entry<String, Object> e : configMap.entrySet()) { <START> if (e.getKey() != null && e.getKey().startsWith(prefix)) { <END> subset.put(e.getKey(), e.getValue()); } } return subset; }</code><technical_language>Good catch null check. I forgot Maps null a key</technical_language>

Target:
protected Map<String, String> subsetMap(String prefix) { Map<String, String> subset = new TreeMap<String, String>(); for (Map.Entry<String, String> e : configMap.entrySet()) { if (e.getKey() != null && e.getKey().startsWith(prefix)) { subset.put(e.getKey(), e.getValue()); } } return subset; }
Source:
<code>public Set<JobStatus> getStatuses() { <START> <END> Set<JobStatus> status = new HashSet<JobStatus>(); if (pending) { status.addAll(SchedulerDBManager.PENDING_JOB_STATUSES); } if (running) { status.addAll(SchedulerDBManager.RUNNING_JOB_STATUSES); } if (finished) { status.addAll(SchedulerDBManager.FINISHED_JOB_STATUSES); } return status; }</code><technical_language>I suggest define status variable instance variable initialize in constructor. This way, if a call getStatuses more pay price of executing logic multiple times</technical_language>

Target:
public Set<JobStatus> getStatuses() { return status; }
Source:
<code>private void buildIndex(HashMap<String, String> indexEntries) throws IOException { dirCache = new DirCache(db.getIndexFile(), db.getFS()); if (indexEntries != null) { assertTrue(dirCache.lock()); DirCacheEditor editor = dirCache.editor(); for (java.util.Map.Entry<String,String> e : indexEntries.entrySet()) { writeTrashFile(e.getKey(), e.getValue()); ObjectInserter inserter = db.newObjectInserter(); final ObjectId id = inserter.insert(Constants.OBJ_BLOB, e <START> .getValue().getBytes(Constants.CHARSET)); <END> editor.add(new DirCacheEditor.DeletePath(e.getKey())); editor.add(new DirCacheEditor.PathEdit(e.getKey()) { @Override public void apply(DirCacheEntry ent) { ent.setFileMode(FileMode.REGULAR_FILE); ent.setObjectId(id); ent.setUpdateNeeded(false); } }); } assertTrue(editor.commit()); } }</code><technical_language>code compile JDK 1.5. String.getBytes(Charset) 1.6. I wondering Hudson letting this - hudson builds configured run 1.6</technical_language>

Target:
private void buildIndex(HashMap<String, String> indexEntries) throws IOException { dirCache = new DirCache(db.getIndexFile(), db.getFS()); if (indexEntries != null) { assertTrue(dirCache.lock()); DirCacheEditor editor = dirCache.editor(); for (java.util.Map.Entry<String,String> e : indexEntries.entrySet()) { writeTrashFile(e.getKey(), e.getValue()); ObjectInserter inserter = db.newObjectInserter(); final ObjectId id = inserter.insert(Constants.OBJ_BLOB, Constants.encode(e.getValue())); editor.add(new DirCacheEditor.DeletePath(e.getKey())); editor.add(new DirCacheEditor.PathEdit(e.getKey()) { @Override public void apply(DirCacheEntry ent) { ent.setFileMode(FileMode.REGULAR_FILE); ent.setObjectId(id); ent.setUpdateNeeded(false); } }); } assertTrue(editor.commit()); } }
Source:
<code>protected void onPostExecute(UploadPostTaskResult result) { switch (result) { case ERROR: mPostUploadNotifier.incrementUploadedPostCountFromForegroundNotification(mPost); mPostUploadNotifier.updateNotificationErrorForPost(mPost, mSite, mErrorMessage, 0); finishUpload(); break; <START> case NOTHING_TO_UPLOAD: <END> mPostUploadNotifier.incrementUploadedPostCountFromForegroundNotification(mPost); finishUpload(); break; case PUSH_POST_DISPATCHED: break; } }</code><technical_language>I guessing work do in this case is necessary for cleanup. (just I missing in review)</technical_language>

Target:
protected void onPostExecute(UploadPostTaskResult result) { switch (result) { case ERROR: mPostUploadNotifier.incrementUploadedPostCountFromForegroundNotification(mPost); mPostUploadNotifier.updateNotificationErrorForPost(mPost, mSite, mErrorMessage, 0); finishUpload(); break; case NOTHING_TO_UPLOAD: mPostUploadNotifier.incrementUploadedPostCountFromForegroundNotification(mPost, true); finishUpload(); break; case PUSH_POST_DISPATCHED: break; } }
Source:
<code>public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; <START> throw new ProvisionException("Only one ArchaiusModule may be installed"); <END> }</code><technical_language>equals throw enforce a singleton module policy unintuitive. this add normal duplicate binding for Config error</technical_language>

Target:
public boolean equals(Object obj) { return this == obj; }
Source:
<code>public SerializingCopier(Serializer<T> serializer) { if (serializer == null) { <START> throw new NullPointerException("A " + SerializingCopier.class + " instance requires a " <END> + Serializer.class + " instance to copy!"); } this.serializer = serializer; }</code><technical_language>read this error message code sounds right, printed in log this: "A class org.ehcache.internal.copy.SerializingCopier instance requires a interface org.ehcache.spi.serialization.Serializer instance copy!" words _class_ _interface_ prepended FQNs error message sound weird. _my_ opinion</technical_language>

Target:
public SerializingCopier(Serializer<T> serializer) { if (serializer == null) { throw new NullPointerException("A " + SerializingCopier.class.getName() + " instance requires a " + Serializer.class.getName() + " instance to copy!"); } this.serializer = serializer; }
Source:
<code>public static void saveValuesDDL(QuestionDB question, OptionDB option, String module) { ValueDB value = question.getValueBySession(module); if (!option.getName().equals(Constants.DEFAULT_SELECT_OPTION)) { if (value == null) { value = new ValueDB(option, question, Session.getSurveyByModule(module)); value.save(); } else { value.setOption(option); value.setValue(option.getName()); value.setUploadDate(new Date()); value.update(); } <START> LayoutUtils.updateSurveyActionBarChartAddingQuestion(DashboardActivity.dashboardActivity.getSupportActionBar(), Session.getSurveyByModule(module).getId_survey(), question); <END> } else { if (value != null) { value.delete(); LayoutUtils.updateSurveyActionBarChartRemovingQuestion(DashboardActivity.dashboardActivity.getSupportActionBar(), Session.getSurveyByModule(module).getId_survey(), question); } } }</code><technical_language>Data Layer presentation dependencies</technical_language>

Target:
public static void saveValuesDDL(QuestionDB question, OptionDB option, String module) { ValueDB value = question.getValueBySession(module); if (!option.getName().equals(Constants.DEFAULT_SELECT_OPTION)) { if (value == null) { value = new ValueDB(option, question, Session.getSurveyByModule(module)); value.save(); DomainEventPublisher .instance() .publish(new ValueChangedEvent(Session.getSurveyByModule(module).getId_survey(), new Question(question.getId_question(), question.getCompulsory()),ValueChangedEvent.Action.INSERT)); } else { value.setOption(option); value.setValue(option.getName()); value.setUploadDate(new Date()); value.update(); } } else { if (value != null) { value.delete(); DomainEventPublisher .instance() .publish(new ValueChangedEvent(Session.getSurveyByModule(module).getId_survey(), new Question(question.getId_question(), question.getCompulsory()),ValueChangedEvent.Action.DELETE)); } } }
Source:
<code>public void setUp() <START> throws Exception <END> { catalogManager = new CatalogManager(); typeManager = new TypeRegistry(); transactionManager = createTestTransactionManager(catalogManager); tablePropertyManager = new TablePropertyManager(); testCatalog = createBogusTestingCatalog(CATALOG_NAME); catalogManager.registerCatalog(testCatalog); tablePropertyManager.addProperties(testCatalog.getConnectorId(), ImmutableList.of(stringSessionProperty("baz", "test property", null, false))); testSession = testSessionBuilder() .setCatalog(CATALOG_NAME) .setSchema(TINY_SCHEMA_NAME) .setTransactionId(transactionManager.beginTransaction(false)) .build(); metadata = new MockMetadata(typeManager, tablePropertyManager, testCatalog.getConnectorId()); }</code><technical_language>test class needs single threaded</technical_language>

Target:
public void setUp() throws Exception { catalogManager = new CatalogManager(); typeManager = new TypeRegistry(); transactionManager = createTestTransactionManager(catalogManager); tablePropertyManager = new TablePropertyManager(); testCatalog = createBogusTestingCatalog(CATALOG_NAME); catalogManager.registerCatalog(testCatalog); tablePropertyManager.addProperties(testCatalog.getConnectorId(), ImmutableList.of(stringSessionProperty("baz", "test property", null, false))); testSession = testSessionBuilder() .setTransactionId(transactionManager.beginTransaction(false)) .build(); metadata = new MockMetadata(typeManager, tablePropertyManager, testCatalog.getConnectorId()); }
Source:
<code>protected void createEmptyRepository() throws Exception { File gitDir = new File(new File(getTestDirectory(), EMPTY_REPOSITORY), Constants.DOT_GIT); <START> FileUtils.mkdirs(gitDir); <END> Repository myRepository = new FileRepository(gitDir); myRepository.create(); IProject firstProject = ResourcesPlugin.getWorkspace().getRoot() .getProject(EMPTY_PROJECT); if (firstProject.exists()) firstProject.delete(true, null); IProjectDescription desc = ResourcesPlugin.getWorkspace() .newProjectDescription(EMPTY_PROJECT); desc.setLocation(new Path(new File(myRepository.getWorkTree(), EMPTY_PROJECT).getPath())); firstProject.create(desc, null); firstProject.open(null); IFolder folder = firstProject.getFolder(FOLDER); folder.create(false, true, null); IFile textFile = folder.getFile(FILE1); textFile.create(new ByteArrayInputStream("Hello, world" .getBytes(firstProject.getDefaultCharset())), false, null); IFile textFile2 = folder.getFile(FILE2); textFile2.create(new ByteArrayInputStream("Some more content" .getBytes(firstProject.getDefaultCharset())), false, null); new ConnectProviderOperation(firstProject, gitDir).execute(null); }</code><technical_language>FileUtils.mkdir(gitDir) sice previous implementation create dirs recursive</technical_language>

Target:
protected void createEmptyRepository() throws Exception { File gitDir = new File(new File(getTestDirectory(), EMPTY_REPOSITORY), Constants.DOT_GIT); Repository myRepository = new FileRepository(gitDir); myRepository.create(); IProject firstProject = ResourcesPlugin.getWorkspace().getRoot() .getProject(EMPTY_PROJECT); if (firstProject.exists()) firstProject.delete(true, null); IProjectDescription desc = ResourcesPlugin.getWorkspace() .newProjectDescription(EMPTY_PROJECT); desc.setLocation(new Path(new File(myRepository.getWorkTree(), EMPTY_PROJECT).getPath())); firstProject.create(desc, null); firstProject.open(null); IFolder folder = firstProject.getFolder(FOLDER); folder.create(false, true, null); IFile textFile = folder.getFile(FILE1); textFile.create(new ByteArrayInputStream("Hello, world" .getBytes(firstProject.getDefaultCharset())), false, null); IFile textFile2 = folder.getFile(FILE2); textFile2.create(new ByteArrayInputStream("Some more content" .getBytes(firstProject.getDefaultCharset())), false, null); new ConnectProviderOperation(firstProject, gitDir).execute(null); }
Source:
<code>private static Folder getCreationMenuModel(final URI uri) throws URISyntaxException { Folder folder = null; Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(Resource.Factory.Registry.DEFAULT_EXTENSION, new XMIResourceFactoryImpl()); Resource resource = resourceSet.getResource(uri, true); <START> if (null != resource.getContents() && resource.getContents().get(0) instanceof Folder) { <END> folder = (Folder) resource.getContents().get(0); } return folder; }</code><technical_language>mast add a condition of contents size avoid existing empty file error</technical_language>

Target:
private static Folder getCreationMenuModel(final URI uri) throws URISyntaxException { Folder folder = null; Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(Resource.Factory.Registry.DEFAULT_EXTENSION, new XMIResourceFactoryImpl()); Resource resource = resourceSet.getResource(uri, true); if (null != resource.getContents() && 0 < resource.getContents().size() && resource.getContents().get(0) instanceof Folder) { folder = (Folder) resource.getContents().get(0); } return folder; }
Source:
<code>public void close() { if (handler != null) { <START> handler.removeCallbacksAndMessages(null); <END> } }</code><technical_language>set handler null? isValid() continue return true closed</technical_language>

Target:
public void close() { if (handler != null) { handler.removeCallbacksAndMessages(null); handler = null; } }
Source:
<code>private void populateDefaultTypeDefinitions(){ UserDefinedType boolType = new UserDefinedType("Bool", new PrimitiveType(PrimitiveType.PrimitiveKind.BOOLEAN)); UserDefinedType intType = new UserDefinedType("Int", new PrimitiveType(PrimitiveType.PrimitiveKind.INTEGER)); <START> UserDefinedType stringType = new UserDefinedType("String", new PrimitiveType(PrimitiveType.PrimitiveKind.STRING)); <END> try{ addTypeTypeDefinition(boolType); addTypeTypeDefinition(intType); addTypeTypeDefinition(stringType); }catch(MultipleDefinitionException mde){ throw new UndefinedBehaviourError("could not create default type definitions (" + mde.getMessage() + ")"); } }</code><technical_language>put a PrimitiveType in symbol table wrapping in a UserDefinedType. UserDefinedTypes reserved for actual types created user</technical_language>

Target:
private void populateDefaultTypeDefinitions(){ Type boolType = new BooleanType(); Type intType = new IntegerType(); Type stringType = new StringType(); try{ addUserDefinedTypeDefinition("Bool", boolType); addUserDefinedTypeDefinition("Int", intType); addUserDefinedTypeDefinition("String", stringType); }catch(MultipleDefinitionException mde){ throw new UndefinedBehaviourError("could not create default type definitions (" + mde.getMessage() + ")"); } }
Source:
<code>public void execute() { if (getRule() == null) { throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Invalid role permission rule provided"); } Role role = roleService.findRole(getRoleId()); if (role == null) { throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Invalid role id provided"); } CallContext.current().setEventDetails("Role id: " + role.getId() + ", rule:" + getRule() + ", permission: " + getPermission() + ", description: " + getDescription()); RolePermission rolePermission = roleService.createRolePermission(role, getRule(), getPermission(), getDescription()); if (rolePermission == null) { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create role permission"); } RolePermissionResponse response = new RolePermissionResponse(); response.setId(rolePermission.getUuid()); response.setRoleId(role.getUuid()); response.setRule(rolePermission.getRule()); response.setRulePermission(rolePermission.getPermission()); response.setDescription(rolePermission.getDescription()); response.setResponseName(getCommandName()); response.setObjectName("rolepermission"); setResponseObject(response); <START> } <END></code><technical_language>CreateRoleCmd; factor this block out for readability</technical_language>

Target:
public void execute() { final Role role = roleService.findRole(getRoleId()); if (role == null) { throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Invalid role id provided"); } CallContext.current().setEventDetails("Role id: " + role.getId() + ", rule:" + getRule() + ", permission: " + getPermission() + ", description: " + getDescription()); final RolePermission rolePermission = roleService.createRolePermission(role, getRule(), getPermission(), getDescription()); if (rolePermission == null) { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create role permission"); } setupResponse(rolePermission, role); }
Source:
<code>public Function<Set<String>, Set<String>> finisher() { <START> return null; <END> }</code><technical_language>null? a empty lambda avoid NPE</technical_language>

Target:
public Function<Set<String>, Set<String>> finisher() { return (inputSet) -> inputSet; }
Source:
<code>public void testInstanceBuildSingleCoreNodeps() throws SQLException, IOException, SolrServerException { String testName = "testInstanceBuildSingleCoreNodeps"; System.out.println("-------------------" + testName + "-------------------"); String[] args = new String[] { "--context=index-config_DEV.xml", "--cores=ma", "--nodeps" }; System.out.println("Command line = " + StringUtils.join(args, ",")); IndexerManager indexerManager = new IndexerManager(); try { indexerManager.initialise(args); } catch (IndexerException ie) { fail(ie.getLocalizedMessage()); } String[] actualCores = indexerManager.getCores().toArray(new String[0]); String[] expectedCores = new String[] { IndexerManager.ANATOMY_CORE}; assertArrayEquals(expectedCores, actualCores); <START> } <END></code><technical_language>Need validate test cases valid</technical_language>

Target:
public void testInstanceBuildSingleCoreNodeps() throws SQLException, IOException, SolrServerException { String testName = "testInstanceBuildSingleCoreNodeps"; System.out.println("-------------------" + testName + "-------------------"); String[] args = new String[] { "--cores=anatomy", "--nodeps" }; System.out.println("Command line = " + StringUtils.join(args, ",")); IndexerManager indexerManager = new IndexerManager(); try { indexerManager.initialise(args); } catch (IndexerException ie) { fail(ie.getLocalizedMessage()); } String[] actualCores = indexerManager.getCores().toArray(new String[0]); String[] expectedCores = new String[] { IndexerManager.ANATOMY_CORE}; assertArrayEquals(expectedCores, actualCores); try { indexerManager.run(); } catch (IndexerException ie) { fail(ie.getLocalizedMessage()); } }
Source:
<code><START> public boolean hasNext() { <END> try { if (currentProgrammes == null) { if (!programmeQueries.hasNext()) { return false; } currentResponse = client.execute(programmeQueries.next()); currentProgrammes = currentResponse.getResults(); return true; } else if (currentResponse.hasNext()) { currentProgrammes = currentResponse.getNext().getResults(); return true; } else if (!currentResponse.hasNext()) { if (!programmeQueries.hasNext()) { return false; } currentResponse = client.execute(programmeQueries.next()); currentProgrammes = currentResponse.getResults(); return true; } return false; } catch (GlycerinException e) { throw Throwables.propagate(e); } }</code><technical_language>This simplified currentResponse.hasNext(). literally need read pages current response, move next query if needed</technical_language>

Target:
public boolean hasNext() { try { if (currentResponse == null) { if (programmeQueries.hasNext()) { currentResponse = client.execute(programmeQueries.next()); return currentResponse.hasNext(); } else { return false; } } else if (currentResponse.hasNext()) { return true; } else { if (programmeQueries.hasNext()) { currentResponse = client.execute(programmeQueries.next()); return currentResponse.hasNext(); } else { return false; } } } catch (GlycerinException e) { throw Throwables.propagate(e); } }
Source:
<code>public Exporter(Collection col) { mCol = col; mDid = null; <START> mCids = null; <END> }</code><technical_language>unused... here</technical_language>

Target:
public Exporter(Collection col) { mCol = col; mDid = null; }
Source:
<code>public void handleReceive(@Nullable Resp response, @Nullable Throwable error, Span span) { <START> assert response != null || error != null : <END> "Either the response or error parameters may be null, but not both"; if (!(response instanceof HttpClientResponse)) { handleFinish(adapter, response, error, span); return; } HttpClientResponse clientResponse = (HttpClientResponse) response; Object unwrapped = clientResponse.unwrap(); if (unwrapped == null) { handleFinish(error, span); } else { handleFinish(new HttpClientResponse.Adapter(clientResponse), unwrapped, error, span); } }</code><technical_language>throw exception instead of assert bad code</technical_language>

Target:
public void handleReceive(@Nullable Resp response, @Nullable Throwable error, Span span) { if (response == null && error == null) { throw new IllegalArgumentException( "Either the response or error parameters may be null, but not both"); } if (!(response instanceof HttpClientResponse)) { handleFinish(adapter, response, error, span); return; } HttpClientResponse clientResponse = (HttpClientResponse) response; Object unwrapped = clientResponse.unwrap(); if (unwrapped == null) { handleFinish(error, span); } else { handleFinish(new HttpClientResponse.Adapter(clientResponse), unwrapped, error, span); } }
Source:
<code>private TableOperatorWrapper<?> visitTwoInputTransformation( TwoInputTransformation<RowData, RowData, RowData> transform) { Transformation<?> input1 = transform.getInput1(); Transformation<?> input2 = transform.getInput2(); int inputIdx1 = inputTransforms.indexOf(input1); int inputIdx2 = inputTransforms.indexOf(input2); TableOperatorWrapper<?> wrapper = new TableOperatorWrapper<>( transform.getOperatorFactory(), genSubOperatorName(transform), Arrays.asList(transform.getInputType1(), transform.getInputType2()), transform.getOutputType()); if (inputIdx1 >= 0 && inputIdx2 >= 0) { <START> orderedInputTransforms.add(input1); inputSpecs.add(createInputSpec(readOrders[inputIdx1], wrapper, 1)); orderedInputTransforms.add(input2); inputSpecs.add(createInputSpec(readOrders[inputIdx2], wrapper, 2)); headWrappers.add(wrapper); <END> } else if (inputIdx1 >= 0) { TableOperatorWrapper<?> inputWrapper = visit(input2); wrapper.addInput(inputWrapper, 2); orderedInputTransforms.add(input1); inputSpecs.add(createInputSpec(readOrders[inputIdx1], wrapper, 1)); headWrappers.add(wrapper); } else if (inputIdx2 >= 0) { TableOperatorWrapper<?> inputWrapper = visit(input1); wrapper.addInput(inputWrapper, 1); orderedInputTransforms.add(input2); inputSpecs.add(createInputSpec(readOrders[inputIdx2], wrapper, 2)); headWrappers.add(wrapper); } else { TableOperatorWrapper<?> inputWrapper1 = visit(input1); wrapper.addInput(inputWrapper1, 1); TableOperatorWrapper<?> inputWrapper2 = visit(input2); wrapper.addInput(inputWrapper2, 2); } return wrapper; }</code><technical_language>extract a function</technical_language>

Target:
private TableOperatorWrapper<?> visitTwoInputTransformation( TwoInputTransformation<RowData, RowData, RowData> transform) { Transformation<?> input1 = transform.getInput1(); Transformation<?> input2 = transform.getInput2(); int inputIdx1 = inputTransforms.indexOf(input1); int inputIdx2 = inputTransforms.indexOf(input2); TableOperatorWrapper<?> wrapper = new TableOperatorWrapper<>( transform.getOperatorFactory(), genSubOperatorName(transform), Arrays.asList(transform.getInputType1(), transform.getInputType2()), transform.getOutputType()); if (inputIdx1 >= 0 && inputIdx2 >= 0) { processInput(input1, inputIdx1, wrapper, 1); processInput(input2, inputIdx2, wrapper, 2); headWrappers.add(wrapper); } else if (inputIdx1 >= 0) { TableOperatorWrapper<?> inputWrapper = visit(input2); wrapper.addInput(inputWrapper, 2); processInput(input1, inputIdx1, wrapper, 1); headWrappers.add(wrapper); } else if (inputIdx2 >= 0) { TableOperatorWrapper<?> inputWrapper = visit(input1); wrapper.addInput(inputWrapper, 1); processInput(input2, inputIdx2, wrapper, 2); headWrappers.add(wrapper); } else { TableOperatorWrapper<?> inputWrapper1 = visit(input1); wrapper.addInput(inputWrapper1, 1); TableOperatorWrapper<?> inputWrapper2 = visit(input2); wrapper.addInput(inputWrapper2, 2); } return wrapper; }
Source:
<code>public boolean isStreamable() { <START> if (!preGroupedSymbols.isEmpty() && groupingSets.size() == 1) { <END> List<Symbol> groupingSet = Iterables.getOnlyElement(groupingSets); return !groupingSet.isEmpty() && Sets.newHashSet(preGroupedSymbols).equals(Sets.newHashSet(groupingSet)); } return false; }</code><technical_language>need check aggregations.isEmpty()</technical_language>

Target:
public boolean isStreamable() { return !preGroupedSymbols.isEmpty() && groupingSets.size() == 1 && !Iterables.getOnlyElement(groupingSets).isEmpty(); }
Source:
<code>public Boolean not(Boolean operand) { <START> return operand; <END> }</code><technical_language>changing this? If I remember fix issue respecting correctly</technical_language>

Target:
public Boolean not(Boolean operand) { return tags == null ? operand : false; }
Source:
<code>public EC2AbstractSlave(String name, String instanceId, String description, String remoteFS, int numExecutors, Mode mode, String labelString, ComputerLauncher launcher, RetentionStrategy<EC2Computer> retentionStrategy, String initScript, String tmpDir, List<? extends NodeProperty<?>> nodeProperties, String remoteAdmin, String jvmopts, boolean stopOnTerminate, String idleTerminationMinutes, List<EC2Tag> tags, String cloudName, boolean useDedicatedTenancy, int launchTimeout, AMITypeData amiType, ConnectionStrategy connectionStrategy, int maxTotalUses) throws FormException, IOException { super(name, remoteFS, launcher); setNumExecutors(numExecutors); setMode(mode); setLabelString(labelString); setRetentionStrategy(retentionStrategy); setNodeProperties(nodeProperties); this.instanceId = instanceId; this.templateDescription = description; this.initScript = initScript; this.tmpDir = tmpDir; this.remoteAdmin = remoteAdmin; this.jvmopts = jvmopts; this.stopOnTerminate = stopOnTerminate; this.idleTerminationMinutes = idleTerminationMinutes; this.tags = tags; <START> this.usePrivateDnsName = connectionStrategy != null && connectionStrategy.equals(ConnectionStrategy.PRIVATE_DNS); <END> this.useDedicatedTenancy = useDedicatedTenancy; this.cloudName = cloudName; this.launchTimeout = launchTimeout; this.amiType = amiType; this.maxTotalUses = maxTotalUses; readResolve(); fetchLiveInstanceData(true); }</code><technical_language>If this is enum, do: suggestion this.usePrivateDnsName = connectionStrategy == ConnectionStrategy.PRIVATE_DNS;</technical_language>

Target:
public EC2AbstractSlave(String name, String instanceId, String description, String remoteFS, int numExecutors, Mode mode, String labelString, ComputerLauncher launcher, RetentionStrategy<EC2Computer> retentionStrategy, String initScript, String tmpDir, List<? extends NodeProperty<?>> nodeProperties, String remoteAdmin, String jvmopts, boolean stopOnTerminate, String idleTerminationMinutes, List<EC2Tag> tags, String cloudName, boolean useDedicatedTenancy, int launchTimeout, AMITypeData amiType, ConnectionStrategy connectionStrategy, int maxTotalUses) throws FormException, IOException { super(name, remoteFS, launcher); setNumExecutors(numExecutors); setMode(mode); setLabelString(labelString); setRetentionStrategy(retentionStrategy); setNodeProperties(nodeProperties); this.instanceId = instanceId; this.templateDescription = description; this.initScript = initScript; this.tmpDir = tmpDir; this.remoteAdmin = remoteAdmin; this.jvmopts = jvmopts; this.stopOnTerminate = stopOnTerminate; this.idleTerminationMinutes = idleTerminationMinutes; this.tags = tags; this.usePrivateDnsName = connectionStrategy == ConnectionStrategy.PRIVATE_DNS; this.useDedicatedTenancy = useDedicatedTenancy; this.cloudName = cloudName; this.launchTimeout = launchTimeout; this.amiType = amiType; this.maxTotalUses = maxTotalUses; readResolve(); fetchLiveInstanceData(true); }
Source:
<code>private <T> T inReadOnlyTransaction(final TransactionCallback<T> callback) { return connector.getDBI().withHandle( new HandleCallback<T>() { @Override public T withHandle(Handle handle) throws Exception { final Connection connection = handle.getConnection(); final boolean readOnly = connection.isReadOnly(); connection.setReadOnly(true); T res = handle.inTransaction(callback); <START> connection.setReadOnly(readOnly); <END> return res; } } ); }</code><technical_language>inTransaction throw exception if fails, do if handle get thrown away? If get stuck in read-only mode</technical_language>

Target:
private <T> T inReadOnlyTransaction(final TransactionCallback<T> callback) { return connector.getDBI().withHandle( new HandleCallback<T>() { @Override public T withHandle(Handle handle) throws Exception { final Connection connection = handle.getConnection(); final boolean readOnly = connection.isReadOnly(); connection.setReadOnly(true); try { return handle.inTransaction(callback); } finally { try { connection.setReadOnly(readOnly); } catch (SQLException e) { log.error(e, "Unable to reset connection read-only state"); } } } } ); }
Source:
<code>protected GoVisitor buildGoVisitor(@NotNull final ProblemsHolder holder, @NotNull LocalInspectionToolSession session) { return new GoVisitor() { @Override public void visitConstDeclaration(@NotNull GoConstDeclaration o) { visitDeclaration(o); } @Override public void visitShortVarDeclaration(@NotNull GoShortVarDeclaration o) { visitDeclaration(o); } @Override <START> public void visitTypeDeclaration(@NotNull GoTypeDeclaration o) { <END> visitDeclaration(o); } @Override public void visitImportDeclaration(@NotNull GoImportDeclaration o) { visitDeclaration(o); } private void visitDeclaration (PsiElement o) { if (o.getChildren().length == 0 && GoDocumentationProvider.getCommentsForElement(o).isEmpty() && PsiTreeUtil.findChildrenOfType(o, PsiComment.class).isEmpty()) { holder.registerProblem(o, "Empty declaration <code>#ref</code> #loc", ProblemHighlightType.LIKE_UNUSED_SYMBOL, new GoDeleteQuickFix(QUICK_FIX_NAME, o.getClass())); } } }; }</code><technical_language>test missing for this case</technical_language>

Target:
protected GoVisitor buildGoVisitor(@NotNull final ProblemsHolder holder, @NotNull LocalInspectionToolSession session) { return new GoVisitor() { @Override public void visitConstDeclaration(@NotNull GoConstDeclaration o) { visitDeclaration(o); } @Override public void visitVarDeclaration(@NotNull GoVarDeclaration o) { visitDeclaration(o); } @Override public void visitTypeDeclaration(@NotNull GoTypeDeclaration o) { visitDeclaration(o); } @Override public void visitImportDeclaration(@NotNull GoImportDeclaration o) { visitDeclaration(o); } private void visitDeclaration (PsiElement o) { if (o.getChildren().length == 0 && GoDocumentationProvider.getCommentsForElement(o instanceof GoImportDeclaration && o.getPrevSibling() == null ? o.getParent() : o).isEmpty() && PsiTreeUtil.findChildrenOfType(o, PsiComment.class).isEmpty()) { holder.registerProblem(o, "Empty declaration <code>#ref</code> #loc", ProblemHighlightType.LIKE_UNUSED_SYMBOL, new GoDeleteQuickFix(QUICK_FIX_NAME, o.getClass())); } } }; }
Source:
<code>private HttpConnection postAndAssertNothingReadBeforeSettingBodyGenerator(CouchConfig config) throws Exception { HttpConnection conn = new HttpConnection("POST", config.getRootUri().toURL(), "application/json"); Assert.assertEquals(bis.available(), data.getBytes().length); conn.setRequestBody(new HttpConnection.InputStreamGenerator() { @Override public InputStream getInputStream() { return bis; } }); <START> Field interceptors = CouchClient.class.getDeclaredField("DEFAULT_REQUEST_INTERCEPTORS"); <END> interceptors.setAccessible(true); conn.requestInterceptors.addAll((Collection<? extends HttpConnectionRequestInterceptor>) interceptors.get(null)); return conn; }</code><technical_language>CouchClient is internal, I mind field DEFAULT_REQUEST_INTERCEPTORS public if in a other places, if in test code - you</technical_language>

Target:
private HttpConnection postAndAssertNothingReadBeforeSettingBodyGenerator(CouchConfig config) throws Exception { HttpConnection conn = new HttpConnection("POST", config.getRootUri().toURL(), "application/json"); Assert.assertEquals(bis.available(), data.getBytes().length); conn.setRequestBody(new HttpConnection.InputStreamGenerator() { @Override public InputStream getInputStream() { return bis; } }); conn.requestInterceptors.addAll(CouchClient.DEFAULT_REQUEST_INTERCEPTORS); return conn; }
Source:
<code><START> public CharSequence subSequence(int start, int end) { <END> if ((start < 0) || (start > end) || (end > this.length())) { throw new IndexOutOfBoundsException(); } if (start == end) return ""; List<CharSequence> result = new ArrayList<>(this.sequences.size()); int relativeStart = start; int relativeEnd = end; for (CharSequence sequence : this.sequences) { if ((relativeStart < sequence.length()) && (relativeEnd > 0)) { result.add(sequence.subSequence(Math.max(relativeStart, 0), Math.min(relativeEnd, sequence.length()))); } relativeStart -= sequence.length(); relativeEnd -= sequence.length(); } return (result.size() == 1) ? result.get(0) : new CompositeCharSequence(result); }</code><technical_language>read of this is this method meant called, complying interface contract. interface method is called SimpleRoutingSupport.parse invoking subSequence a String, of these. mentioning this a CharSequence[] allocation invocation a lot of SimpleRoutingSupport.parse call. relevant if call is instance of this class</technical_language>

Target:
public CharSequence subSequence(int start, int end) { if ((start < 0) || (start > end) || (end > this.length())) { throw new IndexOutOfBoundsException(); } if (start == end) return ""; List<CharSequence> result = null; int relativeStart = start; int relativeEnd = end; for (CharSequence sequence : this.sequences) { if ((relativeStart < sequence.length()) && (relativeEnd > 0)) { CharSequence subSequence = sequence.subSequence(Math.max(relativeStart, 0), Math.min(relativeEnd, sequence.length())); if (result == null) { if ((relativeStart >= 0) && (relativeEnd <= sequence.length())) { return subSequence; } result = new LinkedList<>(); } result.add(subSequence); } relativeStart -= sequence.length(); relativeEnd -= sequence.length(); } return new CompositeCharSequence(result); }
Source:
<code>public boolean accept(Key k, Value v) { if(v.getSize() > 0) { curMeta = metadataSerDe.deserialize(v.get()); int keep = 0; if(curMeta.size() == 0) return true; for (Map<String,Object> entry : curMeta) { long expiration = getExpiration(entry, -1); long timestamp = getTimestamp(entry, 0); if (!shouldExpire(expiration, timestamp)) <START> keep++; <END> } return keep > 0; } return true; }</code><technical_language>change this if statement if (!shouldExpire(expiration, timestamp) return true; This loop of metadata a count verify is greater 0</technical_language>

Target:
public boolean accept(Key k, Value v) { if(v.getSize() > 0) { curMeta = metadataSerDe.deserialize(v.get()); curKey = k; if(curMeta.size() == 0) return true; for (Map<String,Object> entry : curMeta) { long expiration = getExpiration(entry, -1); long timestamp = parseTimestamp(k, entry); if (!shouldExpire(expiration, timestamp)) return true; } return false; } return true; }
Source:
<code>public void addSettingsCodeSnippet() { ConfigurationAsyncClient client = getAsyncClient(); client.addSetting("prodDBConnection", "db_connection") .subscriberContext(Context.of(key1, value1, key2, value2)) .subscribe(response -> { <START> ConfigurationSetting result = response; <END> System.out.printf("Key: %s, Value: %s", result.key(), result.value()); }); END: com.azure.data.appconfiguration.configurationasyncclient.addSetting#string-string client.addSettingWithResponse("prodDBConnection", "db_connection") .subscriberContext(Context.of(key1, value1, key2, value2)) .subscribe(response -> { ConfigurationSetting responseResult = response.value(); System.out.printf("Key: %s, Value: %s", responseResult.key(), responseResult.value()); }); END: com.azure.data.appconfiguration.configurationasyncclient.addSettingWithResponse#string-string client.addSetting(new ConfigurationSetting().key("prodDBConnection").label("westUS").value("db_connection")) .subscriberContext(Context.of(key1, value1, key2, value2)) .subscribe(response -> { ConfigurationSetting resultSetting = response; System.out.printf("Key: %s, Value: %s", resultSetting.key(), resultSetting.value()); }); END: com.azure.data.appconfiguration.configurationasyncclient.addSetting#ConfigurationSetting client.addSettingWithResponse(new ConfigurationSetting().key("prodDBConnection").label("westUS") .value("db_connection")) .subscriberContext(Context.of(key1, value1, key2, value2)) .subscribe(response -> { ConfigurationSetting responseSetting = response.value(); System.out.printf("Key: %s, Value: %s", responseSetting.key(), responseSetting.value()); }); END: com.azure.data.appconfiguration.configurationasyncclient.addSettingWithResponse#ConfigurationSetting }</code><technical_language>For non-WithResponse examples do need this variable</technical_language>

Target:
public void addSettingsCodeSnippet() { ConfigurationAsyncClient client = getAsyncClient(); client.addSetting("prodDBConnection", "db_connection") .subscriberContext(Context.of(key1, value1, key2, value2)) .subscribe(response -> { System.out.printf("Key: %s, Value: %s", response.key(), response.value()); }); END: com.azure.data.appconfiguration.configurationasyncclient.addSetting#string-string client.addSetting(new ConfigurationSetting().key("prodDBConnection").label("westUS").value("db_connection")) .subscriberContext(Context.of(key1, value1, key2, value2)) .subscribe(response -> { System.out.printf("Key: %s, Value: %s", response.key(), response.value()); }); END: com.azure.data.appconfiguration.configurationasyncclient.addSetting#ConfigurationSetting client.addSettingWithResponse(new ConfigurationSetting().key("prodDBConnection").label("westUS") .value("db_connection")) .subscriberContext(Context.of(key1, value1, key2, value2)) .subscribe(response -> { ConfigurationSetting responseSetting = response.value(); System.out.printf("Key: %s, Value: %s", responseSetting.key(), responseSetting.value()); }); END: com.azure.data.appconfiguration.configurationasyncclient.addSettingWithResponse#ConfigurationSetting }
Source:
<code>public static Instant convertLocalDateTimeToInstant(LocalDateTime localDateTime, ZoneId timeZone) { if (localDateTime == null) { return null; } Instant timeInUtc = localDateTime.toInstant(ZoneOffset.UTC); if (isSpecialTime(timeInUtc)) { <START> return timeInUtc; <END> } return localDateTime.atZone(timeZone).toInstant(); }</code><technical_language>is necessary change this function well? Is in code this function is supposed handle special time</technical_language>

Target:
public static Instant convertLocalDateTimeToInstant(LocalDateTime localDateTime, ZoneId timeZone) { return localDateTime == null ? null : localDateTime.atZone(timeZone).toInstant(); }
Source:
<code>protected void scanFile(XmlFile file) { NodeList nodeList = evaluate(singleConnectionFactoryBeansExpression, file.getNamespaceUnawareDocument()); for (int i = 0; i < nodeList.getLength(); i++) { <START> if (!hasPropertyAsAttribute(nodeList.item(i)) && !hasPropertyAsChild(nodeList.item(i))) { <END> reportIssue(nodeList.item(i), "Add a \"reconnectOnException\" property, set to \"true\""); } } }</code><technical_language>create a var for nodeList.item(i)</technical_language>

Target:
protected void scanFile(XmlFile file) { evaluateAsList(singleConnectionFactoryBeansExpression, file.getNamespaceUnawareDocument()).forEach(bean -> { if (!hasPropertyAsAttribute(bean) && !hasPropertyAsChild(bean)) { reportIssue(bean, "Add a \"reconnectOnException\" property, set to \"true\""); } }); }
Source:
<code>public static Slice createHll(@SqlType(StandardTypes.BIGINT) long value) { <START> HyperLogLog hll = HyperLogLog.newInstance(ApproximateCountDistinctAggregation.standardErrorToBuckets(ApproximateSetAggregation.DEFAULT_STANDARD_ERROR)); <END> hll.add(value); return hll.serialize(); }</code><technical_language>I add some static imports: HyperLogLog hll = HyperLogLog.newInstance(standardErrorToBuckets(DEFAULT_STANDARD_ERROR));</technical_language>

Target:
public static Slice createHll(@SqlType(StandardTypes.BIGINT) long value) { HyperLogLog hll = HyperLogLog.newInstance(standardErrorToBuckets(DEFAULT_STANDARD_ERROR)); hll.add(value); return hll.serialize(); }
Source:
<code>public @Nullable Object resolve(@NonNull ISegment segment) { if (segment instanceof CalledFunction) { CalledFunction calledFunction = (CalledFunction) segment; ITmfTrace trace = TmfTraceManager.getInstance().getActiveTrace(); if (trace != null) { String symbolText; ISymbolProvider provider = SymbolProviderManager.getInstance().getSymbolProvider(trace); <START> ITmfStateValue symbol = ((ITmfStateValue) calledFunction.getSymbol()); <END> switch (symbol.getType()) { case LONG: Long longAddress = symbol.unboxLong(); symbolText = provider.getSymbolText(longAddress); if (symbolText == null) { return "0x" + Long.toHexString(longAddress); } return symbolText; case STRING: return symbol.unboxStr(); case INTEGER: Integer intAddress = symbol.unboxInt(); symbolText = provider.getSymbolText(intAddress); if (symbolText == null) { return "0x" + Integer.toHexString(intAddress); } return symbolText; case DOUBLE: case NULL: case CUSTOM: default: break; } } } return null; }</code><technical_language>need instanceof here</technical_language>

Target:
public @Nullable Object resolve(@NonNull ISegment segment) { if (segment instanceof CalledFunction) { CalledFunction calledFunction = (CalledFunction) segment; ITmfTrace trace = TmfTraceManager.getInstance().getActiveTrace(); if (trace != null) { String symbolText; ISymbolProvider provider = SymbolProviderManager.getInstance().getSymbolProvider(trace); if (calledFunction.getSymbol() instanceof ITmfStateValue) { ITmfStateValue symbol = ((ITmfStateValue) calledFunction.getSymbol()); switch (symbol.getType()) { case LONG: Long longAddress = symbol.unboxLong(); symbolText = provider.getSymbolText(longAddress); if (symbolText == null) { return "0x" + Long.toHexString(longAddress); } return symbolText; case STRING: return symbol.unboxStr(); case INTEGER: Integer intAddress = symbol.unboxInt(); symbolText = provider.getSymbolText(intAddress); if (symbolText == null) { return "0x" + Integer.toHexString(intAddress); } return symbolText; case DOUBLE: case NULL: case CUSTOM: default: break; } } } } return null; }
Source:
<code>public void testMismatchMessage() { <START> final String expected = new StringBuilder() <END> .append("header was: equalToIgnoringCase") .append("(\"content-type\") -> values: <[image/png]>") .toString(); final HmRqHeader matcher = new HmRqHeader( "content-type", "text/plain" ); final StringDescription description = new StringDescription(); final RqWithHeaders req = new RqWithHeaders(new RqFake(), "content-type: image/png"); matcher.matchesSafely(req); matcher.describeMismatchSafely(req, description); MatcherAssert.assertThat( description.toString(), Matchers.equalTo(expected) ); }</code><technical_language>@Happy-Neko This is a one-time variable. Please, inline</technical_language>

Target:
public void testMismatchMessage() { final HmRqHeader matcher = new HmRqHeader( "content-type", "text/plain" ); final StringDescription description = new StringDescription(); final RqWithHeaders req = new RqWithHeaders(new RqFake(), "content-type: image/png"); matcher.matchesSafely(req); matcher.describeMismatchSafely(req, description); MatcherAssert.assertThat( description.toString(), Matchers.equalTo(new StringBuilder() .append("header was: equalToIgnoringCase") .append("(\"content-type\") -> values: <[image/png]>") .toString() ) ); }
Source:
<code>public void circularBufferTTL() throws InterruptedException { <START> final int ttlInSeconds = 5; <END> final RedisCircularBuffer<UUID> buffer = new RedisCircularBuffer<>(rdbi, circularBufferKey, 5, new UUIDSerialHelper(), ttlInSeconds); buffer.clear(); assertTrue(buffer.isEmpty()); final UUID first = UUID.randomUUID(); final UUID second = UUID.randomUUID(); buffer.addAll(ImmutableList.of(first, second)); assertEquals(buffer.size(), 2); assertEquals(buffer.peek(), first); assertTrue(buffer.containsAll(ImmutableList.of(first, second))); Thread.sleep(ttlInSeconds * 1000); assertTrue(buffer.isEmpty()); }</code><technical_language>5 seconds is a long time sleep in a test, this 1</technical_language>

Target:
public void circularBufferTTL() { final int ttlInSeconds = 1; final RedisCircularBuffer<UUID> buffer = new RedisCircularBuffer<>(rdbi, circularBufferKey, 5, new UUIDSerialHelper(), ttlInSeconds); buffer.clear(); assertTrue(buffer.isEmpty()); final UUID first = UUID.randomUUID(); final UUID second = UUID.randomUUID(); buffer.addAll(ImmutableList.of(first, second)); assertEquals(buffer.size(), 2); assertEquals(buffer.peek(), first); assertTrue(buffer.containsAll(ImmutableList.of(first, second))); await().atMost(2, TimeUnit.SECONDS).until(buffer::isEmpty); }
Source:
<code>public void checkCustomizedHttpResponseHeaders(String headerConfig, Map<String, String> expectedHeaders) throws IOException { Map<String, String> workerProps = baseWorkerProps(); workerProps.put("offset.storage.file.filename", "/tmp"); workerProps.put(WorkerConfig.RESPONSE_HTTP_HEADERS_CONFIG, headerConfig); <START> WorkerConfig workerConfig = new StandaloneConfig(workerProps); <END> EasyMock.expect(herder.kafkaClusterId()).andReturn(KAFKA_CLUSTER_ID); EasyMock.expect(herder.plugins()).andStubReturn(plugins); EasyMock.expect(plugins.newPlugins(Collections.emptyList(), workerConfig, ConnectRestExtension.class)).andStubReturn(Collections.emptyList()); EasyMock.expect(herder.connectors()).andReturn(Arrays.asList("a", "b")); PowerMock.replayAll(); server = new RestServer(workerConfig); server.initializeServer(); server.initializeResources(herder); HttpRequest request = new HttpGet("/connectors"); CloseableHttpClient httpClient = HttpClients.createMinimal(); HttpHost httpHost = new HttpHost(server.advertisedUrl().getHost(), server.advertisedUrl().getPort()); CloseableHttpResponse response = httpClient.execute(httpHost, request); Assert.assertEquals(200, response.getStatusLine().getStatusCode()); if (!headerConfig.isEmpty()) { expectedHeaders.forEach((k, v) -> Assert.assertEquals(response.getFirstHeader(k).getValue(), v)); } else { Assert.assertNull(response.getFirstHeader("X-Frame-Options")); } response.close(); server.stop(); }</code><technical_language>advantage of ConfigDef.validator response.http.headers.config config key is this constructor call throw exception if invalid is used, sooner, too</technical_language>

Target:
private void checkCustomizedHttpResponseHeaders(String headerConfig, Map<String, String> expectedHeaders) throws IOException { Map<String, String> workerProps = baseWorkerProps(); workerProps.put("offset.storage.file.filename", "/tmp"); workerProps.put(WorkerConfig.RESPONSE_HTTP_HEADERS_CONFIG, headerConfig); WorkerConfig workerConfig = new DistributedConfig(workerProps); EasyMock.expect(herder.kafkaClusterId()).andReturn(KAFKA_CLUSTER_ID); EasyMock.expect(herder.plugins()).andStubReturn(plugins); EasyMock.expect(plugins.newPlugins(Collections.emptyList(), workerConfig, ConnectRestExtension.class)).andStubReturn(Collections.emptyList()); EasyMock.expect(herder.connectors()).andReturn(Arrays.asList("a", "b")); PowerMock.replayAll(); server = new RestServer(workerConfig); try { server.initializeServer(); server.initializeResources(herder); HttpRequest request = new HttpGet("/connectors"); try (CloseableHttpClient httpClient = HttpClients.createMinimal()) { HttpHost httpHost = new HttpHost(server.advertisedUrl().getHost(), server.advertisedUrl().getPort()); try (CloseableHttpResponse response = httpClient.execute(httpHost, request)) { Assert.assertEquals(200, response.getStatusLine().getStatusCode()); if (!headerConfig.isEmpty()) { expectedHeaders.forEach((k, v) -> Assert.assertEquals(response.getFirstHeader(k).getValue(), v)); } else { Assert.assertNull(response.getFirstHeader("X-Frame-Options")); } } } } finally { server.stop(); server = null; } }