auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void populateExchangeWithBreadcrumbFromMessageContext(MessageContext messageContext, Exchange exchange) { SaajSoapMessage saajSoap = (SaajSoapMessage) messageContext.getRequest(); SOAPMessage soapMesssageRequest = null; if (saajSoap != null) { <START> soapMesssageRequest = saajSoap.getSaajMessage(); <END> if (soapMesssageRequest != null) { MimeHeaders mimeHeaders = soapMesssageRequest.getMimeHeaders(); if (mimeHeaders != null) { String[] breadcrumbIdHeaderValues = mimeHeaders.getHeader(Exchange.BREADCRUMB_ID); if (breadcrumbIdHeaderValues != null && breadcrumbIdHeaderValues.length >= 1) { exchange.getIn().setHeader(Exchange.BREADCRUMB_ID, breadcrumbIdHeaderValues[0]); } } } } }</code><technical_language>Spotted a simple typo there: soapMesssageRequest -> soapMessageRequest</technical_language>

Target:
private void populateExchangeWithBreadcrumbFromMessageContext(MessageContext messageContext, Exchange exchange) { SaajSoapMessage saajSoap = (SaajSoapMessage) messageContext.getRequest(); SOAPMessage soapMessageRequest = null; if (saajSoap != null) { soapMessageRequest = saajSoap.getSaajMessage(); if (soapMessageRequest != null) { MimeHeaders mimeHeaders = soapMessageRequest.getMimeHeaders(); if (mimeHeaders != null) { String[] breadcrumbIdHeaderValues = mimeHeaders.getHeader(Exchange.BREADCRUMB_ID); if (breadcrumbIdHeaderValues != null && breadcrumbIdHeaderValues.length >= 1) { exchange.getIn().setHeader(Exchange.BREADCRUMB_ID, breadcrumbIdHeaderValues[0]); } } } } }
Source:
<code>public void testExplicitCloseFrameSentWhenClientChannelClosed() throws Exception { WebSocketCloseStatus closeStatus = WebSocketCloseStatus.INVALID_PAYLOAD_DATA; EmbeddedChannel client = createClient(); EmbeddedChannel server = createServer(); assertFalse(server.writeInbound(client.readOutbound())); assertFalse(client.writeInbound(server.readOutbound())); <START> client.writeOutbound(new CloseWebSocketFrame(closeStatus)); <END> client.close(); assertFalse(server.writeInbound(client.readOutbound())); assertFalse(client.isOpen()); assertFalse(server.isOpen()); CloseWebSocketFrame closeMessage = decode(server.<ByteBuf>readOutbound(), CloseWebSocketFrame.class); assertEquals(closeMessage.statusCode(), closeStatus.code()); closeMessage.release(); assertFalse(client.finishAndReleaseAll()); assertFalse(server.finishAndReleaseAll()); }</code><technical_language>assert return</technical_language>

Target:
public void testExplicitCloseFrameSentWhenClientChannelClosed() throws Exception { WebSocketCloseStatus closeStatus = WebSocketCloseStatus.INVALID_PAYLOAD_DATA; EmbeddedChannel client = createClient(); EmbeddedChannel server = createServer(); assertFalse(server.writeInbound(client.readOutbound())); assertFalse(client.writeInbound(server.readOutbound())); assertTrue(client.writeOutbound(new CloseWebSocketFrame(closeStatus))); client.close(); assertFalse(server.writeInbound(client.readOutbound())); assertFalse(client.isOpen()); assertFalse(server.isOpen()); CloseWebSocketFrame closeMessage = decode(server.<ByteBuf>readOutbound(), CloseWebSocketFrame.class); assertEquals(closeMessage.statusCode(), closeStatus.code()); closeMessage.release(); assertFalse(client.finishAndReleaseAll()); assertFalse(server.finishAndReleaseAll()); }
Source:
<code>public static boolean isAvailable(PathFragment binary) { Subprocess process; try { process = new SubprocessBuilder() .setArgv(binary.getPathString(), "-h") .setStdout(StreamAction.STREAM) .redirectErrorStream(true) .setWorkingDirectory(new File(".")) .start(); } catch (IOException e) { <START> log.warning("Windows sandbox binary at " + binary + " seems to be missing; got error " + e); <END> return false; } ByteArrayOutputStream outErrBytes = new ByteArrayOutputStream(); try { ByteStreams.copy(process.getInputStream(), outErrBytes); } catch (IOException e) { try { outErrBytes.write(("Failed to read stdout: " + e).getBytes()); } catch (IOException e2) { } } String outErr = outErrBytes.toString().replaceFirst("\n$", ""); int exitCode = waitForProcess(process); if (exitCode == 0) { return true; } else { log.warning( "Windows sandbox binary at " + binary + " returned non-zero exit code " + exitCode + " and output " + outErr); return false; } }</code><technical_language>nit: remove "got error" part put ":" separate e's message</technical_language>

Target:
public static boolean isAvailable(PathFragment binary) { Subprocess process; try { process = new SubprocessBuilder() .setArgv(binary.getPathString(), "-h") .setStdout(StreamAction.STREAM) .redirectErrorStream(true) .setWorkingDirectory(new File(".")) .start(); } catch (IOException e) { log.warning("Windows sandbox binary at " + binary + " seems to be missing; got error: " + e); return false; } ByteArrayOutputStream outErrBytes = new ByteArrayOutputStream(); try { ByteStreams.copy(process.getInputStream(), outErrBytes); } catch (IOException e) { try { outErrBytes.write(("Failed to read stdout: " + e).getBytes("UTF-8")); } catch (IOException e2) { } } String outErr = outErrBytes.toString().replaceFirst("\n$", ""); int exitCode = SandboxHelpers.waitForProcess(process); if (exitCode == 0) { return true; } else { log.warning( "Windows sandbox binary at " + binary + " returned non-zero exit code " + exitCode + " and output " + outErr); return false; } }
Source:
<code>private boolean renderQueryOutput(PrintStream out, OutputFormat outputFormat, boolean interactive) { StatusPrinter statusPrinter = null; @SuppressWarnings("resource") PrintStream errorChannel = interactive ? out : System.err; if (interactive) { statusPrinter = new StatusPrinter(client, out, debug); statusPrinter.printInitialStatusUpdates(); } else { waitForData(); } if (client.isRunning() || (client.isFinished() && client.finalStatusInfo().getError() == null)) { QueryStatusInfo results = client.isRunning() ? client.currentStatusInfo() : client.finalStatusInfo(); if (results.getUpdateType() != null) { renderUpdate(errorChannel, results); } else if (results.getColumns() == null) { errorChannel.printf("Query %s has no columns\n", results.getId()); return false; } else { renderResults(out, outputFormat, interactive, results.getColumns()); } } checkState(!client.isRunning()); if (statusPrinter != null) { statusPrinter.printFinalInfo(); } if (client.isClientAborted()) { errorChannel.println("Query aborted by user"); return false; } if (client.isClientError()) { errorChannel.println("Query is gone (server restarted?)"); return false; } verify(client.isFinished()); <START> renderWarnings(errorChannel); <END> if (client.finalStatusInfo().getError() != null) { renderFailure(errorChannel); return false; } return true; }</code><technical_language>Warnings render soon query executes. early allows user a choice of continue cancel query</technical_language>

Target:
private boolean renderQueryOutput(PrintStream out, OutputFormat outputFormat, boolean interactive) { StatusPrinter statusPrinter = null; @SuppressWarnings("resource") PrintStream errorChannel = interactive ? out : System.err; WarningsPrinter warningsPrinter = new PrintStreamWarningsPrinter(System.err); if (interactive) { statusPrinter = new StatusPrinter(client, out, debug); statusPrinter.printInitialStatusUpdates(); } else { processInitialStatusUpdates(warningsPrinter); } if (client.isRunning() || (client.isFinished() && client.finalStatusInfo().getError() == null)) { QueryStatusInfo results = client.isRunning() ? client.currentStatusInfo() : client.finalStatusInfo(); if (results.getUpdateType() != null) { renderUpdate(errorChannel, results); } else if (results.getColumns() == null) { errorChannel.printf("Query %s has no columns\n", results.getId()); return false; } else { renderResults(out, outputFormat, interactive, results.getColumns()); } } checkState(!client.isRunning()); if (statusPrinter != null) { new PrintStreamWarningsPrinter(System.err).print(client.finalStatusInfo().getWarnings(), true, true); statusPrinter.printFinalInfo(); } else { warningsPrinter.print(client.finalStatusInfo().getWarnings(), true, true); } if (client.isClientAborted()) { errorChannel.println("Query aborted by user"); return false; } if (client.isClientError()) { errorChannel.println("Query is gone (server restarted?)"); return false; } verify(client.isFinished()); if (client.finalStatusInfo().getError() != null) { renderFailure(errorChannel); return false; } return true; }
Source:
<code>public Object writeReplace(final Object original) { if (original instanceof URIAffinity) { return Affinity.NONE; } else if (original == Affinity.LOCAL) { <START> return new NodeAffinity(connection.getRemoteEndpointName()); <END> } else if (original instanceof AbstractEJBMetaData) { return new EJBMetaDataImpl((AbstractEJBMetaData<?, ?>) original); } else if (original instanceof RemoteExceptionCause) { return ((RemoteExceptionCause) original).toPlainThrowable(); } return original; }</code><technical_language>This reversed me: a local affinity local system, want send peer, affinity send peer refer (which is "nodeAffinity" is equal to). this change, affinity refers peer, receive a node affinity pointing themselves</technical_language>

Target:
public Object writeReplace(final Object original) { if (original instanceof URIAffinity) { return Affinity.NONE; } else if (original == Affinity.LOCAL) { return thisNodeAffinity; } else if (original instanceof AbstractEJBMetaData) { return new EJBMetaDataImpl((AbstractEJBMetaData<?, ?>) original); } else if (original instanceof RemoteExceptionCause) { return ((RemoteExceptionCause) original).toPlainThrowable(); } return original; }
Source:
<code>private void partitionDimensionList( QueryableIndex index, StorageAdapter storageAdapter, List<DimensionSpec> dimensions, List<DimensionSpec> bitmapDims, List<DimensionSpec> nonBitmapDims ) { List<DimensionSpec> dimsToSearch; if (dimensions == null || dimensions.isEmpty()) { dimsToSearch = Lists.newArrayList(Iterables.transform( storageAdapter.getAvailableDimensions(), Druids.DIMENSION_IDENTITY )); } else { dimsToSearch = dimensions; } if (index != null) { for (DimensionSpec spec : dimsToSearch) { <START> if (spec.getDimension().equals(Column.TIME_COLUMN_NAME)) { <END> bitmapDims.add(spec); continue; } ColumnCapabilities capabilities = storageAdapter.getColumnCapabilities(spec.getDimension()); if (capabilities == null) { continue; } if (capabilities.hasBitmapIndexes()) { bitmapDims.add(spec); } else { nonBitmapDims.add(spec); } } } else { nonBitmapDims.addAll(dimsToSearch); } }</code><technical_language>This suspicious. time column bitmaps</technical_language>

Target:
private void partitionDimensionList( QueryableIndex index, StorageAdapter storageAdapter, List<DimensionSpec> dimensions, List<DimensionSpec> bitmapDims, List<DimensionSpec> nonBitmapDims ) { List<DimensionSpec> dimsToSearch; if (dimensions == null || dimensions.isEmpty()) { dimsToSearch = Lists.newArrayList(Iterables.transform( storageAdapter.getAvailableDimensions(), Druids.DIMENSION_IDENTITY )); } else { dimsToSearch = dimensions; } if (index != null) { for (DimensionSpec spec : dimsToSearch) { ColumnCapabilities capabilities = storageAdapter.getColumnCapabilities(spec.getDimension()); if (capabilities == null) { continue; } if (capabilities.hasBitmapIndexes()) { bitmapDims.add(spec); } else { nonBitmapDims.add(spec); } } } else { nonBitmapDims.addAll(dimsToSearch); } }
Source:
<code>protected void onResume() { Timber.d("onResume()"); super.onResume(); mActivityPaused = false; if (mSyncOnResume) { Timber.i("Performing Sync on Resume"); sync(); mSyncOnResume = false; } else if (colIsOpen()) { selectNavigationItem(R.id.nav_decks); updateDeckList(); setTitle(getResources().getString(R.string.app_name)); } <START> getCol().loadAfterGUIInBackground(); <END> }</code><technical_language>is this needed</technical_language>

Target:
protected void onResume() { Timber.d("onResume()"); super.onResume(); mActivityPaused = false; if (mSyncOnResume) { Timber.i("Performing Sync on Resume"); sync(); mSyncOnResume = false; } else if (colIsOpen()) { selectNavigationItem(R.id.nav_decks); updateDeckList(); setTitle(getResources().getString(R.string.app_name)); } CollectionTask.launchCollectionTask(CollectionTask.TASK_TYPE_LOAD_LAZY_COLLECTION); }
Source:
<code>private ArrayList<ArrayList> loadFromEf(int efType) { ArrayList<ArrayList> results = new ArrayList<ArrayList>(); List<AdnRecord> adnRecords = null; if (DBG) log("loadFromEf: efType=" + efType); try { IIccPhoneBook iccIpb = IIccPhoneBook.Stub.asInterface( ServiceManager.getService("simphonebook")); if (iccIpb != null) { adnRecords = iccIpb.getAdnRecordsInEf(efType); } } catch (RemoteException ex) { } catch (SecurityException ex) { if (DBG) log(ex.toString()); } if (adnRecords != null) { int N = adnRecords.size(); <START> if (DBG) <END> log("adnRecords.size=" + N); List<AdnRecord> newAdn = new ArrayList<AdnRecord>(); for (int i = 0; i < N; i++) { AdnRecord record = adnRecords.get(i); if (!record.isEmpty()) { newAdn.add(record); } } Collections.sort(newAdn, mAdnComparator); if (DBG) log("loadFromEf: results =" + newAdn); N = newAdn.size(); for (int i = 0; i < N; i++) { loadRecord((AdnRecord) newAdn.get(i), results); } } else { Log.w(TAG, "Cannot load ADN records"); results.clear(); } if (DBG) log("loadFromEf: return results"); return results; }</code><technical_language>Please wrap in curly brackets { }, write in line</technical_language>

Target:
private ArrayList<ArrayList> loadFromEf(int efType) { ArrayList<ArrayList> results = new ArrayList<ArrayList>(); List<AdnRecord> adnRecords = null; AdnComparator adnComparator = new AdnComparator(); if (DBG) log("loadFromEf: efType=" + efType); try { IIccPhoneBook iccIpb = IIccPhoneBook.Stub.asInterface( ServiceManager.getService("simphonebook")); if (iccIpb != null) { adnRecords = iccIpb.getAdnRecordsInEf(efType); } } catch (RemoteException ex) { } catch (SecurityException ex) { if (DBG) log(ex.toString()); } if (adnRecords != null) { int N = adnRecords.size(); if (DBG) log("adnRecords.size=" + N); List<AdnRecord> newAdn = new ArrayList<AdnRecord>(); for (int i = 0; i < N; i++) { AdnRecord record = adnRecords.get(i); if (!record.isEmpty()) { newAdn.add(record); } } Collections.sort(newAdn, adnComparator); if (DBG) log("loadFromEf: results =" + newAdn); N = newAdn.size(); for (int i = 0; i < N; i++) { loadRecord((AdnRecord) newAdn.get(i), results); } } else { Log.w(TAG, "Cannot load ADN records"); results.clear(); } if (DBG) log("loadFromEf: return results"); return results; }
Source:
<code>public void testSimple() throws SQLException { <START> PostgreSQLContainer postgres = new PostgreSQLContainer(); <END> postgres.start(); try { ResultSet resultSet = performQuery(postgres,"SELECT 1"); int resultSetInt = resultSet.getInt(1); assertEquals("A basic SELECT query succeeds", 1, resultSetInt); } finally { postgres.stop(); } }</code><technical_language>wrap container creation in test-with-resources block, this omit finally block. try (PostgreSQLContainer postgres = new PostgreSQLContainer();) { postgres.start() // do test, call stop needed }</technical_language>

Target:
public void testSimple() throws SQLException { try (PostgreSQLContainer postgres = new PostgreSQLContainer<>()) { postgres.start(); ResultSet resultSet = performQuery(postgres, "SELECT 1"); int resultSetInt = resultSet.getInt(1); assertEquals("A basic SELECT query succeeds", 1, resultSetInt); } }
Source:
<code>private Builder createMetaBuilder(MessageTemplate config) { <START> Integer ttl = config == null ? null : config.getTtl(); <END> return new MetaMessage.Builder(ttl, clock.instant(), this.serviceDetails, clock); }</code><technical_language>Please put ternary operator brackets</technical_language>

Target:
private Builder createMetaBuilder(MessageTemplate config) { Integer ttl = (config == null) ? null : config.getTtl(); return new MetaMessage.Builder(ttl, clock.instant(), this.serviceDetails, clock); }
Source:
<code>public boolean isPluginLoaded(String pluginId) { <START> for (GoPluginExtension extension : extensions) { <END> if (extension.canHandlePlugin(pluginId)) { return true; } } return false; }</code><technical_language>PR appears want display a error if plugin is loaded plugin implement plugin-settings. If case, more straightforward ways of finding if plugin loaded instead of iterating extension everytime. easy track kind of information in DefaultPluginManager ask for it</technical_language>

Target:
public boolean isPluginLoaded(String pluginId) { return pluginManager.isPluginLoaded(pluginId); }
Source:
<code>public Note merge(Note base, Note ours, Note theirs, ObjectReader reader, ObjectInserter inserter) throws IOException { if (ours == null) { return theirs; } if (theirs == null) { return ours; } if (ours.getData().equals(theirs.getData())) { return ours; } ObjectLoader lo = reader.open(ours.getData()); byte[] sep = new byte[] {'\n'}; ObjectLoader lt = reader.open(theirs.getData()); UnionInputStream union = new UnionInputStream( lo.openStream(), new ByteArrayInputStream(sep), lt.openStream()); ObjectId noteData = inserter.insert(Constants.OBJ_BLOB, lo.getSize() + sep.length + lt.getSize(), union); <START> union.close(); <END> return new Note(ours, noteData); }</code><technical_language>a try-with-resources block</technical_language>

Target:
public Note merge(Note base, Note ours, Note theirs, ObjectReader reader, ObjectInserter inserter) throws IOException { if (ours == null) { return theirs; } if (theirs == null) { return ours; } if (ours.getData().equals(theirs.getData())) { return ours; } ObjectLoader lo = reader.open(ours.getData()); byte[] sep = new byte[] {'\n'}; ObjectLoader lt = reader.open(theirs.getData()); try (UnionInputStream union = new UnionInputStream( lo.openStream(), new ByteArrayInputStream(sep), lt.openStream())) { ObjectId noteData = inserter.insert(Constants.OBJ_BLOB, lo.getSize() + sep.length + lt.getSize(), union); return new Note(ours, noteData); } }
Source:
<code>public void onPartitionsRevoked(final Collection<TopicPartition> partitions) { log.debug("Current state {}: revoked partitions because of consumer rebalance.\n" + "\tcurrently assigned active tasks: {}\n" + "\tcurrently assigned standby tasks: {}\n", streamThread.state(), partitions, taskManager.activeTaskIds(), taskManager.standbyTaskIds()); if (streamThread.setState(State.PARTITIONS_REVOKED) != null && !partitions.isEmpty()) { final long start = time.milliseconds(); try { taskManager.handleRevocation(partitions); <START> } catch (final Throwable t) { <END> throw new TaskMigratedException("Error caught during partitions revocation", t); } finally { log.info("partition revocation took ms.", time.milliseconds() - start); } } }</code><technical_language>Side remark: great catch Throwable reinterpret it, encompasses Error Exception. I.e., catch OutOfMemoryError wrap a TaskMigratedException, bad. do changing side catch RuntimeException Exception</technical_language>

Target:
public void onPartitionsRevoked(final Collection<TopicPartition> partitions) { log.debug("Current state {}: revoked partitions because of consumer rebalance.\n" + "\tcurrently assigned active tasks: {}\n" + "\tcurrently assigned standby tasks: {}\n", streamThread.state(), partitions, taskManager.activeTaskIds(), taskManager.standbyTaskIds()); if (streamThread.setState(State.PARTITIONS_REVOKED) != null && !partitions.isEmpty()) { final long start = time.milliseconds(); try { taskManager.handleRevocation(partitions); } finally { log.info("partition revocation took ms.", time.milliseconds() - start); } } }
Source:
<code>public static void assertException(Class<? extends Throwable> exceptionClass, String messageRegex, Throwable t) { assertException(exceptionClass, t); Pattern pattern = Pattern.compile(messageRegex); if (!pattern.matcher(t.getMessage()).matches()) { <START> t.printStackTrace(); <END> fail("Wrong exception message: expected:<" + messageRegex + ">, actual:<" + t.getMessage() + ">"); } }</code><technical_language>throwing here? This Surefire print out stacktrace</technical_language>

Target:
public static void assertException(Class<? extends Throwable> exceptionClass, String messageRegex, Throwable t) { assertException(exceptionClass, t); Pattern pattern = Pattern.compile(messageRegex); if (!pattern.matcher(t.getMessage()).matches()) { throw new AssertionError( "Wrong exception message: expected:<" + messageRegex + ">, actual:<" + t.getMessage() + ">", t); } }
Source:
<code>public void test_fxml_construction_of_area() { Object obj = null; try { obj = FXMLLoader.load( getClass().getResource( "FxmlTest.fxml" ) ); } <START> catch ( Exception EX ) { EX.printStackTrace(); } <END> org.junit.Assert.assertNotNull( obj ); }</code><technical_language>a catch here. Rather, test method propagate thrown exception: java @Test public void testSomething() throws IOException { // longer need try catch statements // try { FXMLLoader.load(); // } catch (IOException EX) Also, throw exception FXMLLoader.load throw, base Exception class other exceptions based</technical_language>

Target:
public void test_fxml_construction_of_area() throws IOException, LoadException { Object obj = FXMLLoader.load( getClass().getResource( "FxmlTest.fxml" ) ); org.junit.Assert.assertNotNull( obj ); }
Source:
<code>public void doWrite(Server server, Query query, ImmutableList<Result> results) throws Exception { if (createDatabase) influxDB.createDatabase(database); BatchPoints batchPoints = BatchPoints.database(database).retentionPolicy(retentionPolicy) .tag(TAG_HOSTNAME, server.getSource()).consistency(writeConsistency).build(); for (Result result : results) { HashMap<String, Object> filteredValues = newHashMap(Maps.filterValues(result.getValues(), isNotNaN)); if (!filteredValues.isEmpty()) { <START> Map<String, String> resultTagsToApply = buildResultTagMap(result); <END> resultTagsToApply.put("_jmx_port", server.getPort()); Point point = Point.measurement(result.getKeyAlias()).time(result.getEpoch(), MILLISECONDS) .tag(resultTagsToApply).fields(filteredValues).build(); batchPoints.point(point); } } influxDB.write(batchPoints); }</code><technical_language>This is a change of behaviour. prefer if controlled a flag current behaviour is preserved default new behaviour enabled for users want it. If current behaviour sense _jmx_port published a tag, add a warn log message users update configuration</technical_language>

Target:
public void doWrite(Server server, Query query, ImmutableList<Result> results) throws Exception { if (createDatabase) influxDB.createDatabase(database); BatchPoints batchPoints = BatchPoints.database(database).retentionPolicy(retentionPolicy) .tag(TAG_HOSTNAME, server.getSource()).consistency(writeConsistency).build(); for (Result result : results) { HashMap<String, Object> filteredValues = newHashMap(Maps.filterValues(result.getValues(), isNotNaN)); if (!filteredValues.isEmpty()) { filteredValues.put("_jmx_port", Integer.parseInt(server.getPort())); Map<String, String> resultTagsToApply = buildResultTagMap(result); Point point = Point.measurement(result.getKeyAlias()).time(result.getEpoch(), MILLISECONDS) .tag(resultTagsToApply).fields(filteredValues).build(); batchPoints.point(point); } } influxDB.write(batchPoints); }
Source:
<code>public String getUploaderRetries() { <START> return getString("secor.upload.retries", "5"); <END> }</code><technical_language>add this property in secor.common.properties default value. prefer setting default in properties file instead of java class. Is default 3 5</technical_language>

Target:
public String getUploaderRetries() { return getString("secor.upload.retries"); }
Source:
<code><START> public void addWriter(String owner, PublicKeyHash writer) { <END> try (PreparedStatement insert = conn.prepareStatement(commands.insertOrIgnoreCommand("INSERT ", "INTO writers (key_hash) VALUES(?)"))) { insert.setBytes(1, writer.toBytes()); insert.executeUpdate(); } catch (SQLException sqe) { LOG.log(Level.WARNING, sqe.getMessage(), sqe); throw new RuntimeException(sqe); } int userId = getUserId(owner); int writerId = getWriterId(writer); try (PreparedStatement insert = conn.prepareStatement(commands.insertOrIgnoreCommand("INSERT ", "INTO writerusage (writer_id, user_id, direct_size) VALUES(?, ?, ?)"))) { insert.setInt(1, writerId); insert.setInt(2, userId); insert.setInt(3, 0); insert.executeUpdate(); } catch (SQLException sqe) { LOG.log(Level.WARNING, sqe.getMessage(), sqe); throw new RuntimeException(sqe); } }</code><technical_language>sql statments in a db transaction</technical_language>

Target:
public void addWriter(String owner, PublicKeyHash writer) { try (Connection conn = getConnection(); PreparedStatement writerInsert = conn.prepareStatement(commands.insertOrIgnoreCommand("INSERT ", "INTO writers (key_hash) VALUES(?)")); PreparedStatement userSelect = conn.prepareStatement("SELECT id FROM users WHERE name = ?;"); PreparedStatement writerSelect = conn.prepareStatement("SELECT id FROM writers WHERE key_hash = ?;"); PreparedStatement usageInsert = conn.prepareStatement(commands.insertOrIgnoreCommand("INSERT ", "INTO writerusage (writer_id, user_id, direct_size) VALUES(?, ?, ?)"))) { writerInsert.setBytes(1, writer.toBytes()); writerInsert.executeUpdate(); userSelect.setString(1, owner); ResultSet resultSet = userSelect.executeQuery(); resultSet.next(); int userId = resultSet.getInt(1); writerSelect.setBytes(1, writer.toBytes()); ResultSet writerRes = writerSelect.executeQuery(); writerRes.next(); int writerId = writerRes.getInt(1); usageInsert.setInt(1, writerId); usageInsert.setInt(2, userId); usageInsert.setInt(3, 0); usageInsert.executeUpdate(); } catch (SQLException sqe) { LOG.log(Level.WARNING, sqe.getMessage(), sqe); throw new RuntimeException(sqe); } }
Source:
<code>private static String md5(byte[] buffer) { try { MessageDigest md = MessageDigest.getInstance("MD5"); md.update(buffer); byte[] digest = md.digest(); <START> return new String(FlexBase64.encodeBytes(digest, 0, digest.length, false), Charset.forName("US-ASCII")); <END> } catch (NoSuchAlgorithmException e) { throw new InternalError("MD5 not supported on this platform"); } }</code><technical_language>This StandardCharsets</technical_language>

Target:
private static String md5(byte[] buffer) { try { MessageDigest md = MessageDigest.getInstance("MD5"); md.update(buffer); byte[] digest = md.digest(); return new String(FlexBase64.encodeBytes(digest, 0, digest.length, false), StandardCharsets.US_ASCII); } catch (NoSuchAlgorithmException e) { throw new InternalError("MD5 not supported on this platform"); } }
Source:
<code>private OptionElement readOption(char keyValueSeparator) { boolean isExtension = (peekChar() == '['); boolean isParenthesized = (peekChar() == '('); String name = readName(); if (isExtension) { name = "[" + name + "]"; } String subName = null; char c = readChar(); if (c == '.') { subName = readName(); c = readChar(); } if (c != keyValueSeparator) { throw unexpected("expected '" + keyValueSeparator + "' in option"); } Object value = readValue(); Object valueOrSubOption = subName != null ? OptionElement.create(subName, value) : value; <START> return OptionElement.create(name, valueOrSubOption); <END> }</code><technical_language>isParenthesized is unused remove right</technical_language>

Target:
private OptionElement readOption(char keyValueSeparator) { boolean isExtension = (peekChar() == '['); boolean isParenthesized = (peekChar() == '('); String name = readName(); if (isExtension) { name = "[" + name + "]"; } String subName = null; char c = readChar(); if (c == '.') { subName = readName(); c = readChar(); } if (c != keyValueSeparator) { throw unexpected("expected '" + keyValueSeparator + "' in option"); } Object value = readValue(); Object valueOrSubOption = subName != null ? OptionElement.create(subName, value) : value; return OptionElement.create(name, valueOrSubOption, isParenthesized); }
Source:
<code>public void handleRecordMessage( Value[] fields ) { StreamCollector collector = collectors.get( responseId ); if ( collector != null ) { collector.record( fields ); } <START> logger.debug( "S: RecordMessage{%s}", Arrays.asList( fields ) ); <END> }</code><technical_language>move this a separate MessageHandler, LoggingMessageHandler, include if debug logging is enabled</technical_language>

Target:
public void handleRecordMessage( Value[] fields ) { StreamCollector collector = collectors.get( responseId ); if ( collector != null ) { collector.record( fields ); } }
Source:
<code>protected Value<Boolean> constructValue(Boolean actualValue) { <START> return new SpongeValue<>(Keys.IS_ADULT, false, actualValue); <END> }</code><technical_language>default true</technical_language>

Target:
protected Value<Boolean> constructValue(Boolean actualValue) { return new SpongeValue<>(Keys.IS_ADULT, true, actualValue); }
Source:
<code>public String getRecipientNames(Set<String> recipients, String courseId, String studentEmail, CourseRoster roster) { StringBuilder namesStringBuilder = new StringBuilder(); int i = 0; for (String recipient : recipients) { if (i == recipients.size() - 1 && recipients.size() > 1) { namesStringBuilder.append(" and "); } else if ( i > 0 && i < recipients.size() - 1 && recipients.size() > 2) { namesStringBuilder.append(", "); } StudentAttributes student = roster.getStudentForEmail(recipient); if (studentEmail != null && recipient.equals(studentEmail)) { namesStringBuilder.append("you"); } else if (courseId.equals(recipient)) { namesStringBuilder.append("All Students In This Course"); } else if(student != null){ if (recipients.size() == 1) { namesStringBuilder.append(student.name + " (" + student.team + ", " + student.email + ")"); } else { namesStringBuilder.append(student.name); } } else { namesStringBuilder.append(recipient); } i++; } String namesString = namesStringBuilder.toString(); return namesString; <START> } <END></code><technical_language>Some missing/extra whitespace in code (not in strings)</technical_language>

Target:
public String getRecipientNames(Set<String> recipients, String courseId, String studentEmail, CourseRoster roster) { StringBuilder namesStringBuilder = new StringBuilder(); int i = 0; for (String recipient : recipients) { if (i == recipients.size() - 1 && recipients.size() > 1) { namesStringBuilder.append(" and "); } else if (i > 0 && i < recipients.size() - 1 && recipients.size() > 2) { namesStringBuilder.append(", "); } StudentAttributes student = roster.getStudentForEmail(recipient); if (studentEmail != null && recipient.equals(studentEmail)) { namesStringBuilder.append("you"); } else if (courseId.equals(recipient)) { namesStringBuilder.append("all students in this course"); } else if (student != null) { if (recipients.size() == 1) { namesStringBuilder.append(student.name + " (" + student.team + ", " + student.email + ")"); } else { namesStringBuilder.append(student.name); } } else { namesStringBuilder.append(recipient); } i++; } String namesString = namesStringBuilder.toString(); return namesString; }
Source:
<code>protected Control createDialogArea(Composite parent) { Composite area = (Composite) super.createDialogArea(parent); Composite container = new Composite(area, SWT.NONE); container.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); container.setLayout(new GridLayout(2, false)); Label filterLabel = new Label(container, SWT.NONE); filterLabel.setText(Messages.FilterInputDialog_filter_input_label); textFilter = new Text(container, SWT.BORDER); textFilter.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false)); textFilter.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent e) { checkInput(); } }); Label placeholder = new Label(container, SWT.NONE); <START> placeholder.setText(""); END> Label noteLabel = new Label(container, SWT.NONE); noteLabel.setText(Messages.FilterInputDialog_note_label); return area; }</code><technical_language>is this necessary</technical_language>

Target:
protected Control createDialogArea(Composite parent) { Composite area = (Composite) super.createDialogArea(parent); Composite container = new Composite(area, SWT.NONE); container.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); container.setLayout(new GridLayout(2, false)); Label filterLabel = new Label(container, SWT.NONE); filterLabel.setText(Messages.FilterInputDialog_filter_input_label); textFilter = new Text(container, SWT.BORDER); textFilter.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false)); textFilter.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent e) { checkInput(); } }); new Label(container, SWT.NONE); Label noteLabel = new Label(container, SWT.NONE); noteLabel.setText(Messages.FilterInputDialog_note_label); return area; }
Source:
<code>public URI toURI(String path) { try { if (project.hasNature(SYNC_NATURE)) return remoteRes.getActiveLocationURI(); } catch (CoreException e) { <START> e.printStackTrace(); <END> } return manager.toURI(path); }</code><technical_language>Again, print stack trace. Handle properly</technical_language>

Target:
public URI toURI(String path) { return manager.toURI(path); }
Source:
<code><START> public LocalDateTime toLocalDateTimeBin(byte[] bytes) throws PSQLException { <END> if (bytes.length != 8) { throw new PSQLException(GT.tr("Unsupported binary encoding of {0}.", "timestamp"), PSQLState.BAD_DATETIME_FORMAT); } long secs; int nanos; if (usesDouble) { double time = ByteConverter.float8(bytes, 0); if (time == Double.POSITIVE_INFINITY) { return LocalDateTime.MAX; } else if (time == Double.NEGATIVE_INFINITY) { return LocalDateTime.MIN; } secs = (long) time; nanos = (int) ((time - secs) * 1000000); } else { long time = ByteConverter.int8(bytes, 0); if (time == Long.MAX_VALUE) { return LocalDateTime.MAX; } else if (time == Long.MIN_VALUE) { return LocalDateTime.MIN; } secs = time / 1000000; nanos = (int) (time - secs * 1000000); } if (nanos < 0) { secs--; nanos += 1000000; } nanos *= 1000; secs = toJavaSecs(secs); return LocalDateTime.ofEpochSecond(secs, nanos, ZoneOffset.UTC); }</code><technical_language>is required? a copy&paste Timestamp code</technical_language>

Target:
public LocalDateTime toLocalDateTimeBin(byte[] bytes) throws PSQLException { ParsedBinaryTimestamp parsedTimestamp = this.toParsedTimestampBin(null, bytes, true); if (parsedTimestamp.infinity == Infinity.POSITIVE) { return LocalDateTime.MAX; } else if (parsedTimestamp.infinity == Infinity.NEGATIVE) { return LocalDateTime.MAX; } return LocalDateTime.ofEpochSecond(parsedTimestamp.millis / 1000L, parsedTimestamp.nanos, ZoneOffset.UTC); }
Source:
<code>private synchronized void reloadData() { _allDatastreamTasks = new HashMap<>(); List<String> connectorTypes = _zkclient.getChildren(_path); connectorTypes.forEach(connectorType -> { if (!_allDatastreamTasks.containsKey(connectorType)) { _allDatastreamTasks.put(connectorType, new ArrayList<>()); } String path = KeyBuilder.connector(_cluster, connectorType); List<String> tasksForConnector = _zkclient.getChildren(path); tasksForConnector.forEach(taskName -> { <START> String p = KeyBuilder.connectorTask(_cluster, connectorType, taskName); <END> String content = _zkclient.ensureReadData(p); DatastreamTask t = DatastreamTask.fromJson(content); _allDatastreamTasks.get(connectorType).add(t); }); }); }</code><technical_language>convert this lambda a regular for loop. try avoid lambda is more statement. I is hard debug Java lambdas</technical_language>

Target:
private synchronized void reloadData() { _allDatastreamTasks = new HashMap<>(); List<String> connectorTypes = _zkclient.getChildren(_path); for (String connectorType: connectorTypes) { if (!_allDatastreamTasks.containsKey(connectorType)) { _allDatastreamTasks.put(connectorType, new ArrayList<>()); } String path = KeyBuilder.connector(_cluster, connectorType); List<String> tasksForConnector = _zkclient.getChildren(path); for (String taskName: tasksForConnector) { String p = KeyBuilder.connectorTask(_cluster, connectorType, taskName); String content = _zkclient.ensureReadData(p); DatastreamTask t = DatastreamTask.fromJson(content); _allDatastreamTasks.get(connectorType).add(t); } } }
Source:
<code>public String describeFirstNonRequestableCapability() { <START> final long nonRequestable = (mNetworkCapabilities & NON_REQUESTABLE_CAPABILITIES); <END> if (nonRequestable != 0) { return capabilityNameOf(BitUtils.unpackBits(nonRequestable)[0]); } if (mLinkUpBandwidthKbps != 0 || mLinkDownBandwidthKbps != 0) return "link bandwidth"; if (hasSignalStrength()) return "signalStrength"; return null; }</code><technical_language>need check unwanted list well. like: final long nonRequestable = (mNetworkCapabilities | mUnwantedNetworkCapabilities) & NON_REQUESTABLE_CAPABILITIES;</technical_language>

Target:
public String describeFirstNonRequestableCapability() { final long nonRequestable = (mNetworkCapabilities | mUnwantedNetworkCapabilities) & NON_REQUESTABLE_CAPABILITIES; if (nonRequestable != 0) { return capabilityNameOf(BitUtils.unpackBits(nonRequestable)[0]); } if (mLinkUpBandwidthKbps != 0 || mLinkDownBandwidthKbps != 0) return "link bandwidth"; if (hasSignalStrength()) return "signalStrength"; return null; }
Source:
<code>public void shouldMapAllFieldsInGtf() throws Exception { GeneLineMapper lineMapper = new GeneLineMapper(); for (String gtfLine : GtfStaticTestData.GTF_CONTENT.split(GtfStaticTestData.GTF_LINE_SPLIT)) { if (!gtfLine.startsWith(GtfStaticTestData.GTF_COMMENT_LINE)) { FeatureCoordinates gene = lineMapper.mapLine(gtfLine, 0); assertNotNull(gene.getChromosome()); <START> } <END> } }</code><technical_language>I left this checking chromosome? I tested this four: assertNotNull(gene.getId()); assertNotNull(gene.getChromosome()); assertNotNull(gene.getStart()); assertNotNull(gene.getEnd());</technical_language>

Target:
public void shouldMapAllFieldsInGtf() throws Exception { GeneLineMapper lineMapper = new GeneLineMapper(); for (String gtfLine : GtfStaticTestData.GTF_CONTENT.split(GtfStaticTestData.GTF_LINE_SPLIT)) { if (!gtfLine.startsWith(GtfStaticTestData.GTF_COMMENT_LINE)) { FeatureCoordinates gene = lineMapper.mapLine(gtfLine, 0); assertNotNull(gene.getId()); assertNotNull(gene.getChromosome()); assertNotNull(gene.getStart()); assertNotNull(gene.getEnd()); } } }
Source:
<code>public static void installDummyPlugin() throws Exception { <START> RestAssured.baseURI = "http://" + System.getProperty("rest.server","localhost") ; <END> RestAssured.port = 7080; RestAssured.basePath = "/rest/"; RestAssured.authentication = basic("rhqadmin","rhqadmin"); InputStream in = PluginsTest.class.getClassLoader().getResourceAsStream("dummy-rhq-plugin.xml"); ByteArrayOutputStream baos = new ByteArrayOutputStream(); int data; while ((data = in.read())!=-1) { baos.write(data); } byte[] bytes = baos.toByteArray(); in.close(); baos.close(); String handle = given() .auth().preemptive().basic("rhqadmin", "rhqadmin") .body(bytes) .contentType(ContentType.BINARY) .header(acceptJson) .expect() .statusCode(201) .log().ifError() .when() .post("/content/fresh").body().path("value"); @SuppressWarnings("unchecked") Map<String, Object> plugin = given() .header(acceptJson) .param("handle", handle) .param("name", "dummy-rhq-plugin.xml") .expect() .statusCode(200) .log().ifError() .when() .put("/plugins").jsonPath().get("find { p -> p.name == 'Dummy' }"); Assert.assertEquals(plugin.get("name"), "Dummy"); DUMMY_PLUGIN_ID = (Integer) plugin.get("id"); }</code><technical_language>Re-use RestAssured.\* AbstractBase</technical_language>

Target:
public static void installDummyPlugin() throws Exception { setupRestAssured(); InputStream in = PluginsTest.class.getClassLoader().getResourceAsStream("dummy-rhq-plugin.xml"); ByteArrayOutputStream baos = new ByteArrayOutputStream(); int data; while ((data = in.read())!=-1) { baos.write(data); } byte[] bytes = baos.toByteArray(); in.close(); baos.close(); String handle = given() .auth().preemptive().basic("rhqadmin", "rhqadmin") .body(bytes) .contentType(ContentType.BINARY) .header(acceptJson) .expect() .statusCode(201) .log().ifError() .when() .post("/content/fresh").body().path("value"); @SuppressWarnings("unchecked") Map<String, Object> plugin = given() .header(acceptJson) .param("handle", handle) .param("name", "dummy-rhq-plugin.xml") .expect() .statusCode(200) .log().ifError() .when() .put("/plugins").jsonPath().get("find { p -> p.name == 'Dummy' }"); Assert.assertEquals(plugin.get("name"), "Dummy"); DUMMY_PLUGIN_ID = (Integer) plugin.get("id"); }
Source:
<code>private Result<?> calculate(CalculationMarketData calculationData) { ImmutableSet<Measure> measures = ImmutableSet.of(getMeasure()); <START> Map<Measure, Result<ScenarioResult<?>>> map = function.calculate(target, measures, calculationData); <END> if (!map.containsKey(getMeasure())) { return Result.failure( FailureReason.CALCULATION_FAILED, "Function '{}' did not return requested measure '{}'", function.getClass().getName(), getMeasure()); } return map.get(getMeasure()); }</code><technical_language>Is intention change CalculationTask CalculationResult handle multiple values in a PR</technical_language>

Target:
private Result<?> calculate(CalculationMarketData calculationData) { ImmutableSet<Measure> measures = ImmutableSet.of(getMeasure()); Map<Measure, Result<?>> map = function.calculate(target, measures, calculationData); if (!map.containsKey(getMeasure())) { return Result.failure( FailureReason.CALCULATION_FAILED, "Function '{}' did not return requested measure '{}'", function.getClass().getName(), getMeasure()); } return map.get(getMeasure()); }
Source:
<code><START> private static String getYarnApiAddress(Configuration conf) { <END> Set<String> yarnApiAddresses = getYarnApiAddresses(conf); try { for (String yarnApiAddress : yarnApiAddresses) { if (successfulConnection(yarnApiAddress)) { return yarnApiAddress; } } } catch (IOException e) { LOG.error("Error getting yarn api address:", e); } return ""; }</code><technical_language>If Optional (which represents notion get RM), turn [these lines](<LINK_0> getYarnApiAddress(conf).map(x -> getYarnAppInfo(x, appId))</technical_language>

Target:
private static Optional<String> getYarnApiAddress(Configuration conf) { Set<String> yarnApiAddresses = getYarnApiAddresses(conf); try { for (String yarnApiAddress : yarnApiAddresses) { if (successfulConnection(yarnApiAddress)) { return Optional.of(yarnApiAddress); } } } catch (IOException e) { LOG.error("Error getting yarn api address:", e); } return Optional.empty(); }
Source:
<code>public void tearDown() { for (Entry<String, TransportClient> entry : clients.entrySet()) { <START> entry.getValue().close(); <END> } clients.clear(); tableColumns.clear(); }</code><technical_language>guava Closer close of clients (just in case if of throws a runtime exception in middle of loop)</technical_language>

Target:
public void tearDown() { try (Closer closer = Closer.create()) { for (Entry<String, TransportClient> entry : clients.entrySet()) { closer.register(entry.getValue()); } closer.register(clients::clear); closer.register(() -> executor.shutdown()); } catch (IOException e) { throw new UncheckedIOException(e); } }
Source:
<code>private VoltDBLAggregate( RelOptCluster cluster, RelTraitSet traitSet, RelNode child, boolean indicator, ImmutableBitSet groupSet, List<ImmutableBitSet> groupSets, List<AggregateCall> aggCalls) { <START> super(cluster, traitSet, child, indicator, groupSet, groupSets, aggCalls); <END> }</code><technical_language>VoltDBL* relations assert presence of VoltDBLRel.VOLTDB_LOGICAL in input trait set VoltDBCalc does</technical_language>

Target:
private VoltDBLAggregate( RelOptCluster cluster, RelTraitSet traitSet, RelNode child, boolean indicator, ImmutableBitSet groupSet, List<ImmutableBitSet> groupSets, List<AggregateCall> aggCalls) { super(cluster, traitSet, child, indicator, groupSet, groupSets, aggCalls); assert traitSet.contains(VoltDBLRel.VOLTDB_LOGICAL); }
Source:
<code>public GraphMLReader create() { <START> if (this.xmlInputFactory() == null) { <END> this.inputFactory = XMLInputFactory.newInstance(); } return new GraphMLReader(this); }</code><technical_language>this line compile? xmlInputFactory a method is it? remove parenthesis do: if (this.xmlInputFactory == null) {</technical_language>

Target:
public GraphMLReader create() { if (this.inputFactory == null) { this.inputFactory = XMLInputFactory.newInstance(); } return new GraphMLReader(this); }
Source:
<code>protected final SocketSession getConnectionFromState(final MultiConnectionState state) { if (this.getParentServer() == null) { <START> LOG.info("null parent"); <END> return null; } return this.getParentServer().getIdToConnection().get(state); }</code><technical_language>change "parent server exist is null"</technical_language>

Target:
protected final SocketSession getConnectionFromState(final MultiConnectionState state) { if (this.getParentServer() == null) { LOG.info("parent server does not exist and is null"); return null; } return this.getParentServer().getIdToConnection().get(state); }
Source:
<code>public void setVisibility_throwsWithMeaningfulMessage() { exception.expect(UnsupportedOperationException.class); exception.expectMessage(CoreMatchers.allOf( CoreMatchers.containsString( "Cannot change Text component visibiltiy"), CoreMatchers.containsString( <START> "because it doesn't represent an HTML Element"))); <END> new Text("").setVisible(false); }</code><technical_language>Alright</technical_language>

Target:
public void setVisibility_throwsWithMeaningfulMessage() { exception.expect(UnsupportedOperationException.class); exception.expectMessage(CoreMatchers.allOf( CoreMatchers.containsString( "Cannot change Text component visibility"), CoreMatchers.containsString( "because it doesn't represent an HTML Element"))); new Text("").setVisible(false); }
Source:
<code>public static void createSystemTemporaryDir() throws IOException { <START> TMP.create(); <END> dumpDirectory = TMP.newFolder(); }</code><technical_language>Unnecessary; implied registered a @ClassRule (called TemporaryFolder.before)</technical_language>

Target:
public static void createSystemTemporaryDir() { dumpDirectory = new File( TMP, "dump" ); assertThat( dumpDirectory.mkdir() ) .isTrue(); }
Source:
<code>public void removeAllTechJobsFor(Person tech) { if (tech == null || tech.getId() == null) { return; } getHangar().forEachUnit(u -> { <START> if (tech == u.getTech()) { <END> u.removeTech(); } if ((u.getRefit() != null) && (tech == u.getRefit().getTech())) { u.getRefit().setTech(null); } }); for (Part p : getParts()) { if (tech == p.getTech()) { p.setTech(null); } } for (Force f : forceIds.values()) { if (tech.getId().equals(f.getTechID())) { f.setTechID(null); } } }</code><technical_language>suggestion if (tech.equals(u.getTech())) {</technical_language>

Target:
public void removeAllTechJobsFor(Person tech) { if (tech == null || tech.getId() == null) { return; } getHangar().forEachUnit(u -> { if (tech.equals(u.getTech())) { u.removeTech(); } if ((u.getRefit() != null) && tech.equals(u.getRefit().getTech())) { u.getRefit().setTech(null); } }); for (Part p : getParts()) { if (tech.equals(p.getTech())) { p.setTech(null); } } for (Force f : forceIds.values()) { if (tech.getId().equals(f.getTechID())) { f.setTechID(null); } } }
Source:
<code>abstract protected void write(Writer writer, List<PlotItem> dataset) throws IOException; @Override public void show(CollectedDataNode node) { FileDialog fileDialog = new FileDialog(getDisplay().getActiveShell(), SWT.SAVE); fileDialog.setText("Export to " + this.export_type.toUpperCase()); <START> String[] filter = { "*." + this.export_type, "*.*" }; <END> fileDialog.setFilterExtensions(filter); String fileName = fileDialog.open(); if (fileName != null && fileName.length() > 0) { PlotDataParser parser = new PlotDataParser(node); DataParserResult result = parser.parseEntries(); try (Writer writer = new BufferedWriter(new OutputStreamWriter( new FileOutputStream(fileName), "UTF-8"))) { write(writer, result.dataset); } catch (IOException e) { e.printStackTrace(); } } }</code><technical_language>this.export_type -> export_type</technical_language>

Target:
abstract protected void write(Writer writer, List<PlotItem> dataset) throws IOException; @Override public void show(CollectedDataNode node) { FileDialog fileDialog = new FileDialog(getDisplay().getActiveShell(), SWT.SAVE); fileDialog.setText("Export to " + exportFormat.toUpperCase()); String[] filter = { "*." + exportFormat.toLowerCase(), "*.*" }; fileDialog.setFilterExtensions(filter); String fileName = fileDialog.open(); if (fileName != null && fileName.length() > 0) { PlotDataParser parser = new PlotDataParser(node); DataParserResult result = parser.parseEntries(); try (Writer writer = new BufferedWriter( new OutputStreamWriter(new FileOutputStream(fileName), "UTF-8"))) { write(writer, result.dataset); } catch (IOException e) { e.printStackTrace(); } } }