auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public static <T> Set<IItemDescriptor<T>> getActiveItems(IItemRegistry<T> registry, String disabledItemPreferenceKey) { List<IItemDescriptor<T>> itemsDescriptor = ItemUtil.getItemsDescriptor(registry, disabledItemPreferenceKey, EMFCompareRCPPlugin.getDefault().getEMFComparePreferences()); if (itemsDescriptor == null) { <START> itemsDescriptor = Collections.emptyList(); <END> } Set<IItemDescriptor<T>> disableFactories = Sets.newHashSet(itemsDescriptor); Set<IItemDescriptor<T>> allFactories = Sets.newHashSet(registry.getItemDescriptors()); Set<IItemDescriptor<T>> activeFactory = Sets.difference(allFactories, disableFactories); return activeFactory; }</code><technical_language>do need carry here. Change this "return Sets.newLinkedHashSet(registry.getItemDescriptors());" need copy returned of registry.getItemDescriptors() a new Set, check beforehand</technical_language>

Target:
public static <T> Set<IItemDescriptor<T>> getActiveItems(IItemRegistry<T> registry, String disabledItemPreferenceKey) { List<IItemDescriptor<T>> itemsDescriptor = ItemUtil.getItemsDescriptor(registry, disabledItemPreferenceKey, EMFCompareRCPPlugin.getDefault().getEMFComparePreferences()); if (itemsDescriptor == null) { return Sets.newLinkedHashSet(registry.getItemDescriptors()); } Set<IItemDescriptor<T>> disableFactories = Sets.newHashSet(itemsDescriptor); Set<IItemDescriptor<T>> allFactories = Sets.newHashSet(registry.getItemDescriptors()); Set<IItemDescriptor<T>> activeFactory = Sets.difference(allFactories, disableFactories); return activeFactory; }
Source:
<code>public void render(RenderingStage renderingStage) { preRenderUpdate(renderingStage); if (renderingConfig.isDynamicShadows() && isFirstRenderingStageForCurrentFrame) { shadowMapNode.process(); } <START> worldReflectionNode.process(); END> graphicState.enableWireframeIf(renderingDebugConfig.isWireframe()); graphicState.initialClearing(); graphicState.preRenderSetupSceneOpaque(); renderBackdrop(); try (Activity ignored = PerformanceMonitor.startActivity("Render World")) { renderObjectsOpaque(); renderChunksOpaque(); renderChunksAlphaReject(); renderOverlays(); renderFirstPersonView(); graphicState.postRenderCleanupSceneOpaque(); renderLightGeometry(); renderChunksRefractiveReflective(); } graphicState.disableWireframeIf(renderingDebugConfig.isWireframe()); PerformanceMonitor.startActivity("Pre-post composite"); postProcessor.generateOutline(); postProcessor.generateAmbientOcclusionPasses(); postProcessor.generatePrePostComposite(); PerformanceMonitor.endActivity(); renderSimpleBlendMaterials(); PerformanceMonitor.startActivity("Post-Processing"); postProcessor.generateLightShafts(); postProcessor.initialPostProcessing(); postProcessor.downsampleSceneAndUpdateExposure(); postProcessor.generateToneMappedScene(); postProcessor.generateBloomPasses(); postProcessor.generateBlurPasses(); postProcessor.finalPostProcessing(renderingStage); PerformanceMonitor.endActivity(); playerCamera.updatePrevViewProjectionMatrix(); }</code><technical_language>In this section, move IF block shadowMapNode.process() method. Also, processing node explicitly, iterate list</technical_language>

Target:
public void render(RenderingStage renderingStage) { preRenderUpdate(renderingStage); renderingPipeline.forEach(Node::process); graphicState.enableWireframeIf(renderingDebugConfig.isWireframe()); graphicState.initialClearing(); graphicState.preRenderSetupSceneOpaque(); renderBackdrop(); try (Activity ignored = PerformanceMonitor.startActivity("Render World")) { renderObjectsOpaque(); renderChunksOpaque(); renderChunksAlphaReject(); renderOverlays(); renderFirstPersonView(); graphicState.postRenderCleanupSceneOpaque(); renderLightGeometry(); renderChunksRefractiveReflective(); } graphicState.disableWireframeIf(renderingDebugConfig.isWireframe()); PerformanceMonitor.startActivity("Pre-post composite"); postProcessor.generateOutline(); postProcessor.generateAmbientOcclusionPasses(); postProcessor.generatePrePostComposite(); PerformanceMonitor.endActivity(); renderSimpleBlendMaterials(); PerformanceMonitor.startActivity("Post-Processing"); postProcessor.generateLightShafts(); postProcessor.initialPostProcessing(); postProcessor.downsampleSceneAndUpdateExposure(); postProcessor.generateToneMappedScene(); postProcessor.generateBloomPasses(); postProcessor.generateBlurPasses(); postProcessor.finalPostProcessing(renderingStage); PerformanceMonitor.endActivity(); playerCamera.updatePrevViewProjectionMatrix(); }
Source:
<code>private Object readResolve() { <START> return Jenkins.getInstance().getItemByFullName(fullName); <END> }</code><technical_language>I this call happen Jenkins instance is null jobs fully loaded. handle this cases explicitly</technical_language>

Target:
private Object readResolve() { Jenkins j = Jenkins.getInstanceOrNull(); if (j == null) { return null; } return j.getItemByFullName(fullName); }
Source:
<code>public void runOperation(VariableMap variableMap, IProgressMonitor monitor) throws Exception { String script = variableMap.getString("Console"); String params = variableMap.getString("Parameters"); String filename = variableMap.getString("Filename"); boolean debug = variableMap.getBoolean("Debug"); boolean excel = variableMap.getBoolean("Excel"); if (Strings.isValid(script)) { <START> StringWriter writer = new StringWriter(); <END> OseeClient oseeClient = ServiceUtil.getOseeClient(); Properties props = getParameters(params); oseeClient.executeScript(script, props, debug, excel, writer); if (!excel) { log(writer.toString()); } else { IFile iFile = OseeData.getIFile(filename + Lib.getDateTimeString() + ".xml"); AIFile.writeToFile(iFile, Lib.stringToInputStream(writer.toString())); log("Excel XML file produced: "); log(iFile.getLocationURI().toASCIIString()); Program.launch(iFile.getLocation().toOSString()); } } else { log("Console was empty - Type script in console."); } }</code><technical_language>Depending output needs json excel create a writer write a file instead of receiving a string writing a file. want return Response instead of in a in execute script</technical_language>

Target:
public void runOperation(VariableMap variableMap, IProgressMonitor monitor) throws Exception { String script = variableMap.getString("Console"); String params = variableMap.getString("Parameters"); String filename = variableMap.getString("Filename"); boolean debug = variableMap.getBoolean("Debug"); boolean excel = variableMap.getBoolean("Excel"); if (Strings.isValid(script)) { Writer writer = null; MediaType mediaType = null; String outfile = null; if (excel) { outfile = filename + Lib.getDateTimeString() + ".xml"; mediaType = MediaType.APPLICATION_XML_TYPE; writer = new FileWriter(outfile); } else { mediaType = MediaType.APPLICATION_JSON_TYPE; writer = new StringWriter(); } try { OseeClient oseeClient = ServiceUtil.getOseeClient(); Properties props = getParameters(params); oseeClient.executeScript(script, props, debug, mediaType, writer); if (!excel) { log(writer.toString()); } else { log("Excel XML file produced: "); log(outfile); Program.launch(outfile); } } finally { writer.close(); } } else { log("Console was empty - Type script in console."); } }
Source:
<code>public boolean isOrderTypeInUse(OrderType orderType) { Criteria criteria = sessionFactory.getCurrentSession().createCriteria(Order.class); criteria.add(Restrictions.eq("orderType", orderType)); <START> if (criteria.list().size() > 0) { <END> return true; } return false; }</code><technical_language>this line i.e: return criteria.list() > 0</technical_language>

Target:
public boolean isOrderTypeInUse(OrderType orderType) { Criteria criteria = sessionFactory.getCurrentSession().createCriteria(Order.class); criteria.add(Restrictions.eq("orderType", orderType)); return criteria.list().size() > 0; }
Source:
<code>private void handleScreenTurnedOff() { mHardwareFingerprintUnavailableRetryCount = 0; mHardwareIrisUnavailableRetryCount = 0; final int count = mCallbacks.size(); for (int i = 0; i < count; i++) { KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get(); if (cb != null) { cb.onScreenTurnedOff(); } } <START> updateBiometricsListeningState(); <END> }</code><technical_language>question</technical_language>

Target:
private void handleScreenTurnedOff() { mHardwareFingerprintUnavailableRetryCount = 0; mHardwareIrisUnavailableRetryCount = 0; final int count = mCallbacks.size(); for (int i = 0; i < count; i++) { KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get(); if (cb != null) { cb.onScreenTurnedOff(); } } }
Source:
<code>private void createVolumeProfileDoc() throws DocumentException, IOException { createPdf = new CreatePdf(); ExportData exportData = getParameters().getExportData(); String userId = getParameters().getUserId(); GlusterVolumeProfileInfo profileInfo = getParameters().getProfileInfo(); String filePath = getParameters().getFilePath(); Date today = new Date(); if(filePath == null || filePath.isEmpty()) { filePath = "/home/ababu/" + getGlusterVolumeDao().getById(profileInfo.getVolumeId()).getName() + "-" + exportData.toString()+ "-" + today.getTime() + ".pdf"; } try { Document document = new Document(); ByteArrayOutputStream byteStream = new ByteArrayOutputStream(); PdfWriter.getInstance(document, byteStream); document.open(); createPdf.addMetaData(document, createMetaData(getGlusterVolumeDao().getById(profileInfo.getVolumeId()).getName(), userId)); addContent(document, profileInfo, exportData); document.close(); setSucceeded(true); VdcReturnValueBase returnValue = new VdcReturnValueBase(); returnValue.setDescription("Pdf Saved"); returnValue.setSucceeded(true); <START> setActionReturnValue(byteStream); <END> } catch (Exception e) { setSucceeded(false); setActionReturnValue(e.toString()); } }</code><technical_language>This be: setActionReturnValue(byteStream.toByteArray()); byte array action return value</technical_language>

Target:
private void createVolumeProfileDoc() throws DocumentException, IOException { createPdf = new CreatePdf(); ExportData exportData = getParameters().getExportData(); String userId = getParameters().getUserId(); GlusterVolumeProfileInfo profileInfo = getParameters().getProfileInfo(); try { Document document = new Document(); ByteArrayOutputStream byteStream = new ByteArrayOutputStream(); PdfWriter.getInstance(document, byteStream); document.open(); createPdf.addMetaData(document, createMetaData(getGlusterVolumeDao().getById(profileInfo.getVolumeId()).getName(), userId)); addContent(document, profileInfo, exportData); document.close(); setSucceeded(true); VdcReturnValueBase returnValue = new VdcReturnValueBase(); returnValue.setDescription("Pdf Saved"); returnValue.setSucceeded(true); setActionReturnValue(byteStream.toByteArray()); } catch (Exception e) { setSucceeded(false); setActionReturnValue(e.toString()); } }
Source:
<code>public void setContext(StructDefinition context) { <START> this.fContext = context; <END> }</code><technical_language>this</technical_language>

Target:
public void setContext(StructDefinition context) { fContext = context; }
Source:
<code>protected Option[] configureMavenRepos() { return options( editConfigurationFilePut( "etc/org.ops4j.pax.url.mvn.cfg", "org.ops4j.pax.url.mvn.repositories", "<LINK_2>," + "<LINK_4>," + "<LINK_10>," + "<LINK_7>," + "<LINK_8>," + "<LINK_5>," + "<LINK_0>," + "<LINK_6>," <START> + "<LINK_1>"), <END> when(System.getProperty(MVN_LOCAL_REPO) != null) .useOptions( editConfigurationFilePut( "etc/org.ops4j.pax.url.mvn.cfg", PAX_URL_MVN_LOCAL_REPO, System.getProperty(MVN_LOCAL_REPO)))); }</code><technical_language>I need include <LINK_3>/ in order get desired artifacts resolve properly</technical_language>

Target:
protected Option[] configureMavenRepos() { return options( editConfigurationFilePut( "etc/org.ops4j.pax.url.mvn.cfg", "org.ops4j.pax.url.mvn.repositories", "<LINK_2>," + "<LINK_4>," + "<LINK_10>," + "<LINK_7>," + "<LINK_8>," + "<LINK_5>," + "<LINK_0>," + "<LINK_6>," + "<LINK_1>," + "<LINK_3>"), when(System.getProperty(MVN_LOCAL_REPO) != null) .useOptions( editConfigurationFilePut( "etc/org.ops4j.pax.url.mvn.cfg", PAX_URL_MVN_LOCAL_REPO, System.getProperty(MVN_LOCAL_REPO)))); }
Source:
<code>public String getWorkflowDag(@ApiParam(value = "workflowId", required = true) @PathParam("workflowId") Long workflowId, @ApiParam(value = "workflowVersionId", required = true) @PathParam("workflowVersionId") Long workflowVersionId) { Workflow workflow = workflowDAO.findById(workflowId); WorkflowVersion workflowVersion = getWorkflowVersion(workflow, workflowVersionId); SourceFile mainDescriptor = getMainDescriptorFile(workflowVersion); String result = null; if(mainDescriptor != null) { File tmpDir = Files.createTempDir(); File tempMainDescriptor = null; try { <START> tempMainDescriptor = File.createTempFile("main", "descriptor", tmpDir); <END> Files.write(mainDescriptor.getContent(), tempMainDescriptor, StandardCharsets.UTF_8); File secondaryDescriptor; for (SourceFile secondaryFile : workflowVersion.getSourceFiles()) { if (!secondaryFile.getPath().equals(workflowVersion.getWorkflowPath())) { secondaryDescriptor = new File(tmpDir.getAbsolutePath(), secondaryFile.getPath()); Files.write(secondaryFile.getContent(), secondaryDescriptor, StandardCharsets.UTF_8); } } } catch (IOException e) { e.printStackTrace(); } if (workflow.getDescriptorType().equals("wdl")) { result = getContentWDL(tempMainDescriptor,"dag"); } else { result = getContentCWL(tempMainDescriptor, tmpDir,"dag"); } } return result; }</code><technical_language>Please change this store read files memory disk. avoid need catch IOException (which this code throws anyway) avoid possibility of filling tmp files</technical_language>

Target:
public String getWorkflowDag(@ApiParam(value = "workflowId", required = true) @PathParam("workflowId") Long workflowId, @ApiParam(value = "workflowVersionId", required = true) @PathParam("workflowVersionId") Long workflowVersionId) { Workflow workflow = workflowDAO.findById(workflowId); WorkflowVersion workflowVersion = getWorkflowVersion(workflow, workflowVersionId); SourceFile mainDescriptor = getMainDescriptorFile(workflowVersion); String result = null; if(mainDescriptor != null) { String descFileContent = mainDescriptor.getContent(); Map<String, String> secondaryDescContent = new HashMap<>(); File tmpDir = Files.createTempDir(); File tempMainDescriptor = null; try { tempMainDescriptor = File.createTempFile("main", "descriptor", tmpDir); Files.write(mainDescriptor.getContent(), tempMainDescriptor, StandardCharsets.UTF_8); for (SourceFile secondaryFile : workflowVersion.getSourceFiles()) { if (!secondaryFile.getPath().equals(workflowVersion.getWorkflowPath())) { secondaryDescContent.put(secondaryFile.getPath(),secondaryFile.getContent()); } } } catch (IOException e) { e.printStackTrace(); } if (workflow.getDescriptorType().equals("wdl")) { result = getContentWDL(tempMainDescriptor,Type.DAG); } else { result = getContentCWL(descFileContent, secondaryDescContent, Type.DAG); } } return result; }
Source:
<code>public void onSuccess(WorkflowExecutionContext context) throws FalconException { if (context.hasWorkflowSucceeded()) { <START> if (context.getEntityType().toString().equals(EntityType.FEED.toString())){ <END> updateSLAMonitoring(context.getClusterName(), context.getOutputFeedNamesList(), context.getOutputFeedInstancePathsList()); } if (context.getEntityType().toString().equals(EntityType.PROCESS.toString())){ EntitySLAMonitoringService.get().updateProcessSLAMonitoring(context.getClusterName(), context.getEntityName(), context.getNominalTimeAsISO8601(), context.getEntityType()); } } }</code><technical_language>context.getEntityType().equals(EntityType.FEED.name()) do</technical_language>

Target:
public void onSuccess(WorkflowExecutionContext context) throws FalconException { if (context.hasWorkflowSucceeded()) { if (context.getEntityType().toString().equals(EntityType.FEED.name())){ updateSLAMonitoring(context.getClusterName(), context.getOutputFeedNamesList(), context.getOutputFeedInstancePathsList()); } if (context.getEntityType().toString().equals(EntityType.PROCESS.name())){ EntitySLAMonitoringService.get().makeProcessInstanceAvailable(context.getClusterName(), context.getEntityName(), context.getNominalTimeAsISO8601(), context.getEntityType()); } } }
Source:
<code>public void testEqualsNull() { CodePoints cp1 = new CodePoints("ABCD"); <START> String str = null; <END> assertThat(cp1.equals(str), is(false)); }</code><technical_language>enough follows. java CodePoints cp2 = new CodePoints("ABCD"); cp2 = null; -> java CodePoints cp2 = null;</technical_language>

Target:
public void testEqualsNull() { CodePoints cp1 = new CodePoints("ABCD"); CodePoints cp2 = null; assertThat(cp1.equals(cp2), is(false)); }
Source:
<code>public void initialize(ServerConfiguration conf, LedgerManager ledgerManager, LedgerDirsManager ledgerDirsManager, LedgerDirsManager indexDirsManager, StateManager stateManager, CheckpointSource checkpointSource, Checkpointer checkpointer, StatsLogger statsLogger) throws IOException { super.initialize( conf, ledgerManager, ledgerDirsManager, indexDirsManager, stateManager, checkpointSource, checkpointer, statsLogger); if (conf.isEntryLogPerLedgerEnabled()) { this.flushExecutor = OrderedExecutor.newBuilder().numThreads(conf.getNumOfMemtableFlushThreads()) .name("MemtableFlushThreads").build(); <START> this.memTable = new EntryMemTableWithParallelFlusher(conf, checkpointSource, statsLogger, flushExecutor); <END> } else { this.memTable = new EntryMemTable(conf, checkpointSource, statsLogger); } this.scheduler = Executors.newSingleThreadScheduledExecutor( new ThreadFactoryBuilder() .setNameFormat("SortedLedgerStorage-%d") .setPriority((Thread.NORM_PRIORITY + Thread.MAX_PRIORITY) / 2).build()); this.stateManager = stateManager; }</code><technical_language>move flushExecutor EntryMemtableWithParallelFlusher if possible, MemTable implements AutoClose. #close EntryMemtable is a no-op, while #close EntryMemtableWithParallelFlusher is shutting executor. need this if-else checking in sorted ledger storage</technical_language>

Target:
public void initialize(ServerConfiguration conf, LedgerManager ledgerManager, LedgerDirsManager ledgerDirsManager, LedgerDirsManager indexDirsManager, StateManager stateManager, CheckpointSource checkpointSource, Checkpointer checkpointer, StatsLogger statsLogger) throws IOException { super.initialize( conf, ledgerManager, ledgerDirsManager, indexDirsManager, stateManager, checkpointSource, checkpointer, statsLogger); if (conf.isEntryLogPerLedgerEnabled()) { this.memTable = new EntryMemTableWithParallelFlusher(conf, checkpointSource, statsLogger); } else { this.memTable = new EntryMemTable(conf, checkpointSource, statsLogger); } this.scheduler = Executors.newSingleThreadScheduledExecutor( new ThreadFactoryBuilder() .setNameFormat("SortedLedgerStorage-%d") .setPriority((Thread.NORM_PRIORITY + Thread.MAX_PRIORITY) / 2).build()); this.stateManager = stateManager; }
Source:
<code>boolean internalExecute(String sql) throws SQLException { clearCurrentResults(); checkOpen(); ResultSet resultSet = null; <START> try (StatementClient client = connection().startQuery(sql, getStatementSessionProperties())) { <END> if (client.isFinished()) { QueryStatusInfo finalStatusInfo = client.finalStatusInfo(); if (finalStatusInfo.getError() != null) { throw resultsException(finalStatusInfo); } } executingClient.set(client); resultSet = new PrestoResultSet(client, maxRows.get(), progressConsumer); if (client.currentStatusInfo().getUpdateType() == null) { currentResult.set(resultSet); return true; } while (resultSet.next()) { } connection().updateSession(client); Long updateCount = client.finalStatusInfo().getUpdateCount(); currentUpdateCount.set((updateCount != null) ? updateCount : 0); currentUpdateType.set(client.finalStatusInfo().getUpdateType()); return false; } catch (ClientException e) { throw new SQLException(e.getMessage(), e); } catch (RuntimeException e) { throw new SQLException("Error executing query", e); } finally { executingClient.set(null); if (currentResult.get() == null) { if (resultSet != null) { resultSet.close(); } } } }</code><technical_language>This is incorrect. assign client a field if query is running. close if query finished</technical_language>

Target:
boolean internalExecute(String sql) throws SQLException { clearCurrentResults(); checkOpen(); StatementClient client = null; ResultSet resultSet = null; try { client = connection().startQuery(sql, getStatementSessionProperties()); if (client.isFinished()) { QueryStatusInfo finalStatusInfo = client.finalStatusInfo(); if (finalStatusInfo.getError() != null) { throw resultsException(finalStatusInfo); } } executingClient.set(client); resultSet = new PrestoResultSet(client, maxRows.get(), progressConsumer); if (client.currentStatusInfo().getUpdateType() == null) { currentResult.set(resultSet); return true; } while (resultSet.next()) { } connection().updateSession(client); Long updateCount = client.finalStatusInfo().getUpdateCount(); currentUpdateCount.set((updateCount != null) ? updateCount : 0); currentUpdateType.set(client.finalStatusInfo().getUpdateType()); return false; } catch (ClientException e) { throw new SQLException(e.getMessage(), e); } catch (RuntimeException e) { throw new SQLException("Error executing query", e); } finally { executingClient.set(null); if (currentResult.get() == null) { if (resultSet != null) { resultSet.close(); } if (client != null) { client.close(); } } } }
Source:
<code>public final void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException { String nextUrl = req.getParameter(Const.ParamsNames.NEXT_URL); if (nextUrl == null) { nextUrl = "/index.html"; } String expectedId = req.getParameter(Const.ParamsNames.HINT); String actualId = req.getParameter(Const.ParamsNames.USER_ID); String logoutUrl = Logic.getLogoutUrl(nextUrl); if (expectedId == null || actualId == null) { <START> resp.sendRedirect(logoutUrl); <END> } else { try { req.setAttribute(Const.ParamsNames.HINT, StringHelper.decrypt(expectedId)); req.setAttribute(Const.ParamsNames.USER_ID, StringHelper.decrypt(actualId)); req.setAttribute(Const.ParamsNames.NEXT_URL, logoutUrl); req.getRequestDispatcher(Const.ViewURIs.GOOGLE_ACCOUNT_HINT).forward(req, resp); } catch (Exception e) { resp.sendRedirect(logoutUrl); } } }</code><technical_language>early return avoid else clause? (to reduce nesting in main flow of method)</technical_language>

Target:
public final void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException { String nextUrl = req.getParameter(Const.ParamsNames.NEXT_URL); if (nextUrl == null) { nextUrl = "/index.html"; } String expectedId = req.getParameter(Const.ParamsNames.HINT); String actualId = req.getParameter(Const.ParamsNames.USER_ID); String logoutUrl = Logic.getLogoutUrl(nextUrl); if (expectedId == null || actualId == null) { resp.sendRedirect(logoutUrl); return; } try { req.setAttribute(Const.ParamsNames.HINT, StringHelper.decrypt(expectedId)); req.setAttribute(Const.ParamsNames.USER_ID, StringHelper.decrypt(actualId)); req.setAttribute(Const.ParamsNames.NEXT_URL, logoutUrl); req.getRequestDispatcher(Const.ViewURIs.GOOGLE_ACCOUNT_HINT).forward(req, resp); } catch (Exception e) { resp.sendRedirect(logoutUrl); } }
Source:
<code>public static List<String> getQuotaTypes(List<String> quotaTypes) { <START> if(quotaTypes.size() < 1) <END> throw new VoldemortException("Quota type not specified."); Set<String> validQuotaTypes = QuotaUtils.validQuotaTypes(); if(quotaTypes.size() == 1 && quotaTypes.get(0).equals(AdminUtils.QUOTATYPE_ALL)) { Iterator<String> iter = validQuotaTypes.iterator(); quotaTypes = Lists.newArrayList(); while(iter.hasNext()) { quotaTypes.add(iter.next()); } } else { for(String quotaType: quotaTypes) { if(!validQuotaTypes.contains(quotaType)) { Utils.croak("Specify a valid quota type from :" + validQuotaTypes); } } } return quotaTypes; }</code><technical_language>please add { } for 1 line of code</technical_language>

Target:
public static List<String> getQuotaTypes(List<String> quotaTypes) { if(quotaTypes.size() < 1) { throw new VoldemortException("Quota type not specified."); } Set<String> validQuotaTypes = QuotaUtils.validQuotaTypes(); if(quotaTypes.size() == 1 && quotaTypes.get(0).equals(AdminUtils.QUOTATYPE_ALL)) { Iterator<String> iter = validQuotaTypes.iterator(); quotaTypes = Lists.newArrayList(); while(iter.hasNext()) { quotaTypes.add(iter.next()); } } else { for(String quotaType: quotaTypes) { if(!validQuotaTypes.contains(quotaType)) { Utils.croak("Specify a valid quota type from :" + validQuotaTypes); } } } return quotaTypes; }
Source:
<code>public void testXmlDeniesDuplicateGroupConfig() { expectDuplicateElementError("group"); <START> String groupConfig = " <group>\n" <END> + " <name>foobar</name>\n" + " <password>dev-pass</password>\n" + " </group>\n"; buildConfig(HAZELCAST_START_TAG + groupConfig + groupConfig + HAZELCAST_END_TAG, null); }</code><technical_language>Super Minor: Format XMLs in this test (unless some autoformatting, etc., leave is): String groupConfig = " <group>\n" + " <name>foobar</name>\n" + " <password>dev-pass</password>\n" + " </group>\n";</technical_language>

Target:
public void testXmlDeniesDuplicateGroupConfig() { expectDuplicateElementError("group"); String groupConfig = "" + " <group>\n" + " <name>foobar</name>\n" + " <password>dev-pass</password>\n" + " </group>\n"; buildConfig(HAZELCAST_START_TAG + groupConfig + groupConfig + HAZELCAST_END_TAG); }
Source:
<code>private void processEvents() throws SQLException { Connection connection = null; PreparedStatement ps = null; ResultSet rs = null; List<EventAuditLogSubscriber> eventSubscribers = new ArrayList<>(); try { connection = ds.getConnection(); ps = connection .prepareStatement("select * from event_audit_log_subscriber_view " + "where audit_log_id <= (select max(audit_log_id) from audit_log)"); rs = ps.executeQuery(); while (rs.next()) { eventSubscribers.add(getEventAuditLogSubscriber(rs)); } } catch (SQLException e) { if (isConnectionException(e)){ handleQueryFailure(); } throw e; } finally { DbUtils.closeQuietly(rs, ps, connection); } DbUser dbUser; for (EventAuditLogSubscriber eventSubscriber:eventSubscribers) { dbUser = getUserByUserId(eventSubscriber.getsubscriber_id()); if (dbUser != null) { EventSender method = methodsMapper.getMethod(EventNotificationMethods.forValue(eventSubscriber.getmethod_id())); <START> EventSenderResult sendResult; <END> try { sendResult = method.send(eventSubscriber, dbUser.getemail()); } catch (Exception e) { log.error("Failed to dispatch message", e); sendResult = new EventSenderResult(); sendResult.setSent(false); sendResult.setReason(e.getMessage()); } addEventNotificationHistory(geteventNotificationHist(eventSubscriber, sendResult.isSent(), sendResult.getReason())); updateAuditLogEventProcessed(eventSubscriber); } } }</code><technical_language>change this? I needed (i.e - original code)</technical_language>

Target:
private void processEvents() throws SQLException { Connection connection = null; PreparedStatement ps = null; ResultSet rs = null; List<EventAuditLogSubscriber> eventSubscribers = new ArrayList<>(); try { connection = ds.getConnection(); ps = connection .prepareStatement("select * from event_audit_log_subscriber_view " + "where audit_log_id <= (select max(audit_log_id) from audit_log)"); rs = ps.executeQuery(); while (rs.next()) { eventSubscribers.add(getEventAuditLogSubscriber(rs)); } } catch (SQLException e) { if (isConnectionException(e)){ handleQueryFailure(); } throw e; } finally { DbUtils.closeQuietly(rs, ps, connection); } DbUser dbUser = null; for (EventAuditLogSubscriber eventSubscriber:eventSubscribers) { dbUser = getUserByUserId(eventSubscriber.getsubscriber_id()); if (dbUser != null) { EventSender method = methodsMapper.getMethod(EventNotificationMethods.forValue(eventSubscriber.getmethod_id())); EventSenderResult sendResult = null; try { sendResult = method.send(eventSubscriber, dbUser.getemail()); } catch (Exception e) { log.error("Failed to dispatch message", e); sendResult = new EventSenderResult(); sendResult.setSent(false); sendResult.setReason(e.getMessage()); } addEventNotificationHistory(geteventNotificationHist(eventSubscriber, sendResult.isSent(), sendResult.getReason())); updateAuditLogEventProcessed(eventSubscriber); } } }
Source:
<code>public void notifyCheckpointComplete(long checkpointId, OperatorChain<?, ?> operatorChain, Supplier<Boolean> isRunning) throws Exception { if (isRunning.get()) { LOG.debug("Notification of complete checkpoint for task {}", taskName); for (StreamOperatorWrapper<?, ?> operatorWrapper : operatorChain.getAllOperators(true)) { if (!operatorWrapper.isClosed()) { operatorWrapper.getStreamOperator().notifyCheckpointComplete(checkpointId); } } } else { LOG.debug("Ignoring notification of complete checkpoint for not-running task {}", taskName); <START> } <END> env.getTaskStateManager().notifyCheckpointComplete(checkpointId); }</code><technical_language>I if throw some exception</technical_language>

Target:
public void notifyCheckpointComplete(long checkpointId, OperatorChain<?, ?> operatorChain, Supplier<Boolean> isRunning) throws Exception { if (isRunning.get()) { LOG.debug("Notification of complete checkpoint for task {}", taskName); for (StreamOperatorWrapper<?, ?> operatorWrapper : operatorChain.getAllOperators(true)) { operatorWrapper.notifyCheckpointComplete(checkpointId); } } else { LOG.debug("Ignoring notification of complete checkpoint for not-running task {}", taskName); } env.getTaskStateManager().notifyCheckpointComplete(checkpointId); }
Source:
<code><START> public static Optional<Principal> createPrincipal(Optional<String> principal) <END> { return principal.map(name -> new InternalPrincipal(name)); }</code><technical_language>Put this static method instance methods</technical_language>

Target:
public static Optional<Principal> createPrincipal(Optional<String> principal) { return principal.map(InternalPrincipal::new); }
Source:
<code>public void doChangeMergedHook(final Change change, final Account account, final PatchSet patchSet, final ReviewDb db, String mergeResultRev) throws OrmException { final ChangeMergedEvent event = new ChangeMergedEvent(); final AccountState owner = accountCache.get(change.getOwner()); event.change = eventFactory.asChangeAttribute(change); event.submitter = eventFactory.asAccountAttribute(account); event.patchSet = eventFactory.asPatchSetAttribute(patchSet); event.newRev = mergeResultRev; fireEvent(change, event, db); final List<String> args = new ArrayList<>(); addArg(args, "--change", event.change.id); addArg(args, "--change-url", event.change.url); addArg(args, "--change-owner", getDisplayName(owner.getAccount())); addArg(args, "--project", event.change.project); addArg(args, "--branch", event.change.branch); addArg(args, "--topic", event.change.topic); addArg(args, "--submitter", getDisplayName(account)); addArg(args, "--commit", event.patchSet.revision); addArg(args, <START> "--new-rev", <END> mergeResultRev); runHook(change.getProject(), changeMergedHook, args); }</code><technical_language>nit: inconsistent ref-updated hook is called newrev hyphen</technical_language>

Target:
public void doChangeMergedHook(final Change change, final Account account, final PatchSet patchSet, final ReviewDb db, String mergeResultRev) throws OrmException { final ChangeMergedEvent event = new ChangeMergedEvent(); final AccountState owner = accountCache.get(change.getOwner()); event.change = eventFactory.asChangeAttribute(change); event.submitter = eventFactory.asAccountAttribute(account); event.patchSet = eventFactory.asPatchSetAttribute(patchSet); event.newRev = mergeResultRev; fireEvent(change, event, db); final List<String> args = new ArrayList<>(); addArg(args, "--change", event.change.id); addArg(args, "--change-url", event.change.url); addArg(args, "--change-owner", getDisplayName(owner.getAccount())); addArg(args, "--project", event.change.project); addArg(args, "--branch", event.change.branch); addArg(args, "--topic", event.change.topic); addArg(args, "--submitter", getDisplayName(account)); addArg(args, "--commit", event.patchSet.revision); addArg(args, "--newrev", mergeResultRev); runHook(change.getProject(), changeMergedHook, args); }
Source:
<code>private CorfuReplicationClusterManagerAdapter buildClusterManagerAdapter(String pluginConfigFilePath) { LogReplicationPluginConfig config = new LogReplicationPluginConfig(pluginConfigFilePath); File jar = new File(config.getTopologyManagerAdapterJARPath()); try (URLClassLoader child = new URLClassLoader(new URL[]{jar.toURI().toURL()}, this.getClass().getClassLoader())) { Class adapter = Class.forName(config.getTopologyManagerAdapterName(), true, child); <START> if (config.getTopologyConfigPath().isPresent()) { <END> String param = config.getTopologyConfigPath().get(); log.info("Using static config path: {}", param); Constructor declaredConstructor = adapter .getDeclaredConstructor(String.class); return (CorfuReplicationClusterManagerAdapter) declaredConstructor.newInstance(param); } else { return (CorfuReplicationClusterManagerAdapter) adapter.newInstance(); } } catch (Exception e) { log.error("Fatal error: Failed to create serverAdapter", e); throw new UnrecoverableCorfuError(e); } }</code><technical_language>static path for testing</technical_language>

Target:
private CorfuReplicationClusterManagerAdapter buildClusterManagerAdapter(String pluginConfigFilePath) { LogReplicationPluginConfig config = new LogReplicationPluginConfig(pluginConfigFilePath); File jar = new File(config.getTopologyManagerAdapterJARPath()); try (URLClassLoader child = new URLClassLoader(new URL[]{jar.toURI().toURL()}, this.getClass().getClassLoader())) { Class adapter = Class.forName(config.getTopologyManagerAdapterName(), true, child); return (CorfuReplicationClusterManagerAdapter) adapter.getDeclaredConstructor().newInstance(); } catch (Exception e) { log.error("Fatal error: Failed to create serverAdapter", e); throw new UnrecoverableCorfuError(e); } }
Source:
<code>protected void doStart() { logger.debug("Registering to receive notifications"); try { Assert.notNull(this.server, "MBeanServer is required."); Assert.notNull(this.objectNames, "An ObjectName is required."); Collection<ObjectName> objectNames = this.retrieveMBeanNames(); if (objectNames.size() < 1) { logger.error("No MBeans found matching ObjectName pattern(s): " + Arrays.asList(this.objectNames)); <START> } <END> for (ObjectName objectName : objectNames) { this.server.addNotificationListener(objectName, this, this.filter, this.handback); this.listenerRegistered = true; } } catch (InstanceNotFoundException e) { throw new IllegalStateException("Failed to find MBean instance.", e); } catch (IOException e) { throw new IllegalStateException("IOException on MBeanServerConnection.", e); } }</code><technical_language>need avoid running this normal start; if (this.contextRefresedEventProcessed) ..</technical_language>

Target:
protected void doStart() { if (!this.listenerRegisteredOnStartup.get()) { return; } logger.debug("Registering to receive notifications"); try { Assert.notNull(this.server, "MBeanServer is required."); Assert.notNull(this.objectNames, "An ObjectName is required."); Collection<ObjectName> objectNames = this.retrieveMBeanNames(); if (objectNames.size() < 1) { logger.error("No MBeans found matching ObjectName pattern(s): " + Arrays.asList(this.objectNames)); } for (ObjectName objectName : objectNames) { this.server.addNotificationListener(objectName, this, this.filter, this.handback); } } catch (InstanceNotFoundException e) { throw new IllegalStateException("Failed to find MBean instance.", e); } catch (IOException e) { throw new IllegalStateException("IOException on MBeanServerConnection.", e); } }
Source:
<code>public Deque<Transition<State, Alphabet>> getPath(State initialState, State finalState) { Deque<State> toProcess = new ArrayDeque<>(); <START> HashMap<State, Transition<State, Alphabet>> considered = new HashMap<>(); <END> toProcess.add(initialState); considered.put(initialState, null); State next; while (!toProcess.isEmpty()) { next = toProcess.remove(); for (Set<Transition<State, Alphabet>> transitions: getFrontTransitions(next)) { for (Transition<State, Alphabet> transition : transitions) { State endState = transition.getEnd(); if (endState.equals(finalState)) { Deque<Transition<State, Alphabet>> result = new ArrayDeque<>(); while (transition != null) { result.push(transition); transition = considered.get(transition.getStart()); } return result; } if (considered.containsKey(endState)) continue; considered.put(endState, transition); toProcess.add(endState); } } } return null; }</code><technical_language>Map<State,Transition<State,Alphabet>> considered = new HashMap<State,Transition<State,Alphabet>>();</technical_language>

Target:
public Deque<Transition<State, Alphabet>> getPath(State initialState, State finalState) { Deque<State> toProcess = new ArrayDeque<>(); Map<State, Transition<State, Alphabet>> considered = new HashMap<>(); toProcess.add(initialState); considered.put(initialState, null); State next; while (!toProcess.isEmpty()) { next = toProcess.remove(); for (Set<Transition<State, Alphabet>> transitions: getFrontTransitions(next)) { for (Transition<State, Alphabet> transition : transitions) { State endState = transition.getEnd(); if (endState.equals(finalState)) { Deque<Transition<State, Alphabet>> result = new ArrayDeque<>(); while (transition != null) { result.push(transition); transition = considered.get(transition.getStart()); } return result; } if (considered.containsKey(endState)) continue; considered.put(endState, transition); toProcess.add(endState); } } } return null; }
Source:
<code>protected void checkFile(@NotNull ErlangFile file, @NotNull ProblemsHolder problemsHolder) { Set<String> importedFunctionNames = ContainerUtil.newHashSet(); for (ErlangImportFunction f : file.getImportedFunctions()) { importedFunctionNames.add(ErlangPsiImplUtil.createFunctionPresentation(f)); } for (ErlangFunction function : file.getFunctions()) { String fullName = ErlangPsiImplUtil.createFunctionPresentation(function); if (importedFunctionNames.contains(fullName)) { problemsHolder.registerProblem(InspectionManager.getInstance(file.getProject()).createProblemDescriptor( function.getNameIdentifier(), <START> function.getFunctionClauseList().get(0).getArgumentDefinitionList().getOriginalElement(), <END> "Defining imported function '" + fullName + "'", ProblemHighlightType.GENERIC_ERROR_OR_WARNING, true, new ErlangRemoveFunctionFix(), new ErlangRemoveFunctionFromImportFixBase.ErlangRemoveFunctionFromAllImportsFix())); } } }</code><technical_language>do getOriginalElenent? ContainerUtil.first</technical_language>

Target:
protected void checkFile(@NotNull ErlangFile file, @NotNull ProblemsHolder problemsHolder) { Set<String> importedFunctionNames = ContainerUtil.newHashSet(); for (ErlangImportFunction f : file.getImportedFunctions()) { importedFunctionNames.add(ErlangPsiImplUtil.createFunctionPresentation(f)); } for (ErlangFunction function : file.getFunctions()) { String fullName = ErlangPsiImplUtil.createFunctionPresentation(function); if (importedFunctionNames.contains(fullName)) { problemsHolder.registerProblem(InspectionManager.getInstance(file.getProject()).createProblemDescriptor( function.getNameIdentifier(), ContainerUtil.getFirstItem(function.getFunctionClauseList()).getArgumentDefinitionList(), "Defining imported function '" + fullName + "'", ProblemHighlightType.GENERIC_ERROR_OR_WARNING, true, new ErlangRemoveFunctionFix(), new ErlangRemoveFunctionFromImportFixBase.ErlangRemoveFunctionFromAllImportsFix())); } } }
Source:
<code>private static boolean nullAgainstParam(ExpressionTree o1, ExpressionTree o2, LambdaExpressionTree tree) { <START> if (o1.is(Tree.Kind.NULL_LITERAL) && (o2.is(Tree.Kind.IDENTIFIER))) { <END> List<VariableTree> parameters = tree.parameters(); return parameters.size() == 1 && parameters.get(0).symbol().equals(((IdentifierTree) o2).symbol()); } return false; }</code><technical_language>(f) == null</technical_language>

Target:
private static boolean nullAgainstParam(ExpressionTree o1, ExpressionTree o2, LambdaExpressionTree tree) { if (o1.is(Tree.Kind.NULL_LITERAL) && o2.is(Tree.Kind.IDENTIFIER)) { List<VariableTree> parameters = tree.parameters(); return parameters.size() == 1 && parameters.get(0).symbol().equals(((IdentifierTree) o2).symbol()); } return false; }
Source:
<code>public void navigationChanged(Stack previous, Stack current) { String actionCode = null; register.setTargetHistoryToken(current.toString()); if (current.getAction() != null && FormHelper.REQUEST_INVITE_ACTION_NAME.equals(current.getAction())) { <START> username = null;; <END> setRequestInvite(Boolean.TRUE); } else { if (current.getAction() != null && FormHelper.COMPLETE_ACTION_NAME.equals(current.getAction()) && (actionCode = current.getParameter(FormHelper.CODE_PARAMETER_INDEX)) != null) { setRequestInvite(Boolean.FALSE); mRegisterForm.setEnabled(false); UserController.get().fetchUser(actionCode); } else { username = null; setRequestInvite(Boolean.TRUE); } } }</code><technical_language>Remove double semi-colon</technical_language>

Target:
public void navigationChanged(Stack previous, Stack current) { String actionCode = null; register.setTargetHistoryToken(current.toString()); if (current.getAction() != null && FormHelper.REQUEST_INVITE_ACTION_NAME.equals(current.getAction())) { username = null; setRequestInvite(Boolean.TRUE); } else { if (current.getAction() != null && FormHelper.COMPLETE_ACTION_NAME.equals(current.getAction()) && (actionCode = current.getParameter(FormHelper.CODE_PARAMETER_INDEX)) != null) { setRequestInvite(Boolean.FALSE); mRegisterForm.setEnabled(false); UserController.get().fetchUser(actionCode); } else { username = null; setRequestInvite(Boolean.TRUE); } } }
Source:
<code>private void setupKafka(String zkAddress) throws IOException { Properties brokerProps = new Properties(); brokerProps.setProperty("zookeeper.connect", zkAddress); brokerProps.setProperty("broker.id", "0"); brokerProps.setProperty("log.dirs", Files.createTempDirectory("kafka-").toAbsolutePath().toString()); brokerProps.setProperty("listeners", "PLAINTEXT://" + LOCALHOST + ":" + KAFKA_PORT); brokerProps.setProperty("replica.socket.timeout.ms", "1000"); brokerProps.setProperty("controller.socket.timeout.ms", "1000"); <START> brokerProps.setProperty("offsets.topic.replication.factor", "1"); <END> KafkaConfig config = new KafkaConfig(brokerProps); kafkaServer = TestUtils.createServer(config, Time.SYSTEM); kafkaServer.startup(); AdminUtils.createTopic( zkUtils, TEST_TOPIC, 1, 1, new Properties(), null); }</code><technical_language>I is contributing intermittent test failure, reduce churn broker startup reducing number of partitions for consumer offsets topic default of 50 1. brokerProps.setProperty("offsets.topic.num.partitions", "1");</technical_language>

Target:
private void setupKafka(String zkAddress) throws IOException { Properties brokerProps = new Properties(); brokerProps.setProperty("zookeeper.connect", zkAddress); brokerProps.setProperty("broker.id", "0"); brokerProps.setProperty("log.dirs", Files.createTempDirectory("kafka-").toAbsolutePath().toString()); brokerProps.setProperty("listeners", "PLAINTEXT://" + LOCALHOST + ":" + KAFKA_PORT); brokerProps.setProperty("replica.socket.timeout.ms", "1000"); brokerProps.setProperty("controller.socket.timeout.ms", "1000"); brokerProps.setProperty("offsets.topic.replication.factor", "1"); brokerProps.setProperty("offsets.topic.num.partitions", "1"); KafkaConfig config = new KafkaConfig(brokerProps); kafkaServer = TestUtils.createServer(config, Time.SYSTEM); kafkaServer.startup(); AdminUtils.createTopic( zkUtils, TEST_TOPIC, 1, 1, new Properties(), null); }
Source:
<code>public Log4j2LoggerAdapter() { try { org.apache.logging.log4j.Logger logger = LogManager.getRootLogger(); if (logger != null) { LoggerContext context = (LoggerContext)LogManager.getContext(false); Map<String, Appender> appenders = context.getConfiguration().getAppenders(); <START> Collection<Appender> appenderCollection = appenders.values(); <END> for (Appender appender : appenderCollection) { if (appender instanceof FileAppender) { FileAppender fileAppender = (FileAppender)appender; String fileName = fileAppender.getFileName(); file = new File(fileName); break; } } } }catch (Throwable t){ } }</code><technical_language>Collection is useless</technical_language>

Target:
public Log4j2LoggerAdapter() { }
Source:
<code><START> public PersonIdent(final String in) { <END> final int lt = in.indexOf('<'); if (lt == -1) throw new IllegalArgumentException(MessageFormat.format( JGitText.get().malformedpersonIdentString, in)); final int gt = in.indexOf('>', lt); if (gt == -1) throw new IllegalArgumentException(MessageFormat.format( JGitText.get().malformedpersonIdentString, in)); name = in.substring(0, lt).trim(); emailAddress = in.substring(lt + 1, gt).trim(); final int tzSeparator = lastIndexOfTrim(in, ' ', in.length() - 1); if (tzSeparator < gt) { when = 0; tzOffset = -1; return; } final int whenSeparator = Math.max(gt, lastIndexOfTrim(in, ' ', tzSeparator - 1)); if (whenSeparator >= tzSeparator - 1) { when = 0; tzOffset = -1; return; } final String tzHoursStr = in.substring(tzSeparator + 1, tzSeparator + 4).trim(); final int tzHours; if (tzHoursStr.charAt(0) == '+') tzHours = Integer.parseInt(tzHoursStr.substring(1)); else tzHours = Integer.parseInt(tzHoursStr); final int tzMins = Integer.parseInt(in.substring(tzSeparator + 4).trim()); when = Long.parseLong(in.substring(whenSeparator + 1, tzSeparator).trim()) * 1000; tzOffset = tzHours * 60 + tzMins; }</code><technical_language>This constructor out put out of misery. I if instead write as: PersonIdent = RawParseUtils.parsePersonIdent(Constants.encode("author " + in), 7); ... copy fields this ... a single routine parse canonical formatting. This constructor infrequently used, dropping UTF-8 byte[] upconverting String a major performance hit in exchange for implementation test maintain</technical_language>

Target:
public PersonIdent(final String in) { final PersonIdent self = RawParseUtils.parsePersonIdent(in); if (self == null) { throw new IllegalArgumentException(MessageFormat.format( JGitText.get().malformedpersonIdentString, in)); } this.name = self.name; this.emailAddress = self.emailAddress; this.when = self.when; this.tzOffset = self.tzOffset; }
Source:
<code>public void setContent(HTMLElement element) { <START> this.content.textContent = ""; <END> if (element != null) { this.content.appendChild(element); } }</code><technical_language>Out of interest do need do this</technical_language>

Target:
public void setContent(HTMLElement element) { this.domUtil.removeAllElementChildren(this.content); this.content.appendChild(element); }
Source:
<code><START> public byte[] getStartRow() { <END> return this.delegateScan.getStartRow(); }</code><technical_language>thinking cloning this byte[]? this getter is set a new start row for scan (by direct changing byte(s) in this byte[])</technical_language>

Target:
public byte[] getStartRow() { final byte[] startRow = this.delegateScan.getStartRow(); return Bytes.copy(startRow); }
Source:
<code>private KubernetesConnectionConfiguration prepareConfiguration() throws IOException { File account = File.createTempFile("kubernetes-test-account", ""); <START> new FileWriter(account).write("account-token"); <END> String accountFile = account.getAbsolutePath(); KubernetesConnectionConfiguration cfg = new KubernetesConnectionConfiguration(); cfg.setNamespace(namespace); cfg.setServiceName(service); cfg.setMasterUrl("https://localhost:" + mockServer.getLocalPort()); cfg.setAccountToken(accountFile); return cfg; }</code><technical_language>Close FileWriter</technical_language>

Target:
private KubernetesConnectionConfiguration prepareConfiguration() throws IOException { File account = File.createTempFile("kubernetes-test-account", ""); FileWriter fw = new FileWriter(account); fw.write("account-token"); fw.close(); String accountFile = account.getAbsolutePath(); KubernetesConnectionConfiguration cfg = new KubernetesConnectionConfiguration(); cfg.setNamespace(namespace); cfg.setServiceName(service); cfg.setMasterUrl("https://localhost:" + mockServer.getLocalPort()); cfg.setAccountToken(accountFile); return cfg; }