auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void startFailedAutoStartVmsImpl() { processVmsToAdd(); if (autoStartVmsToRestart.isEmpty()) { return; } final DateTime iterationStartTime = DateTime.getNow(); Collection<Guid> vmIds = autoStartVmsToRestart.keySet(); List<AutoStartVmToRestart> vmsToRestart = new ArrayList<>(autoStartVmsToRestart.values()); Map<Guid, VM> vms = vmDao.getVmsByIds(vmIds).stream() .collect(Collectors.toMap(VM::getId, vm -> vm)); <START> vmsToRestart.forEach(vmToRestart -> vmToRestart.setVm(vms.get(vmToRestart.getVmId()))); <END> if (considerPriority) { vmsToRestart.sort(Comparator.<AutoStartVmToRestart>comparingInt(a -> a.getVm().getPriority()).reversed()); } int neededPriority = Integer.MIN_VALUE; for (AutoStartVmToRestart autoStartVmToRestart : vmsToRestart) { boolean shouldRemoveVm = autoStartVmToRestart.isWaitingForUp() ? processStartingVm(autoStartVmToRestart) : processDownVm(autoStartVmToRestart, neededPriority, iterationStartTime); if (shouldRemoveVm) { autoStartVmsToRestart.remove(autoStartVmToRestart.getVmId()); } else { neededPriority = Math.max(neededPriority, autoStartVmToRestart.getVm().getPriority()); } } }</code><technical_language>this if statement is needed if consider priority</technical_language>

Target:
private void startFailedAutoStartVmsImpl() { processVmsToAdd(); if (autoStartVmsToRestart.isEmpty()) { return; } final DateTime iterationStartTime = DateTime.getNow(); Collection<Guid> vmIds = autoStartVmsToRestart.keySet(); List<AutoStartVmToRestart> vmsToRestart = new ArrayList<>(autoStartVmsToRestart.values()); Map<Guid, VM> vms = vmDao.getVmsByIds(vmIds).stream() .collect(Collectors.toMap(VM::getId, vm -> vm)); vmsToRestart.forEach(vmToRestart -> vmToRestart.setVm(vms.get(vmToRestart.getVmId()))); if (considerPriority) { vmsToRestart.sort(Comparator.<AutoStartVmToRestart>comparingInt(a -> a.getVm().getPriority()).reversed()); } int neededPriority = Integer.MIN_VALUE; for (AutoStartVmToRestart autoStartVmToRestart : vmsToRestart) { if (!autoStartVmToRestart.isWaitingForUp()) { if (processDownVm(autoStartVmToRestart, neededPriority, iterationStartTime)) { autoStartVmToRestart.setWaitingForUp(true); } } if (autoStartVmToRestart.isWaitingForUp()) { boolean shouldWaitForVm = considerPriority && autoStartVmToRestart.shouldWaitForVmUp(); if (!shouldWaitForVm) { autoStartVmsToRestart.remove(autoStartVmToRestart.getVmId()); continue; } } neededPriority = Math.max(neededPriority, autoStartVmToRestart.getVm().getPriority()); } }
Source:
<code>protected void begin() { super.begin(); controller = JumpingSumoDeviceController.getInstance(); deviceController = controller.getDeviceController(); if (deviceController != null) { deviceController.getFeatureJumpingSumo().sendAnimationsJump(ARCOMMANDS_JUMPINGSUMO_ANIMATIONS_JUMP_TYPE_ENUM.ARCOMMANDS_JUMPINGSUMO_ANIMATIONS_JUMP_TYPE_HIGH); Log.d(TAG, "send jump high command JS down"); } else { <START> Log.d(TAG, "error: send jump high command JS"); <END> } }</code><technical_language>This else branch code in it. for debugging purposes? If for logging fact deviceController null remove else completely (not get wrong: this remove null check - a find out if need it. )</technical_language>

Target:
protected void begin() { super.begin(); controller = JumpingSumoDeviceController.getInstance(); deviceController = controller.getDeviceController(); if (deviceController != null) { deviceController.getFeatureJumpingSumo().sendAnimationsJump(ARCOMMANDS_JUMPINGSUMO_ANIMATIONS_JUMP_TYPE_ENUM.ARCOMMANDS_JUMPINGSUMO_ANIMATIONS_JUMP_TYPE_HIGH); Log.d(TAG, "send jump high command JS down"); } }
Source:
<code>public String getFullPropertyString() { StringBuffer sb = new StringBuffer(); sb.append("bf=sub;"); sb.append(super.getFullPropertyString()); if (language != null && language.length() > 0) { sb.append("lang="); sb.append(escapeString(language)); sb.append(';'); } if (path != null && path.length() > 0) { sb.append("path="); sb.append(escapeString(path)); sb.append(';'); } if (compositionPageId != null && compositionPageId.length() > 0) { sb.append("cpgid="); sb.append(compositionPageId); sb.append(';'); } if (ancillaryPageId != null && ancillaryPageId.length() > 0) { sb.append("apgid="); sb.append(ancillaryPageId); sb.append(';'); } <START> if(this.forced == true) <END> { sb.append("forced="); sb.append("true"); sb.append(';'); } else { sb.append("forced="); sb.append("false"); sb.append(';'); } return sb.toString(); }</code><technical_language>change this block be: sb.append("forced="); sb.append(forced); sb.append(';');</technical_language>

Target:
public String getFullPropertyString() { StringBuffer sb = new StringBuffer(); sb.append("bf=sub;"); sb.append(super.getFullPropertyString()); if (language != null && language.length() > 0) { sb.append("lang="); sb.append(escapeString(language)); sb.append(';'); } if (path != null && path.length() > 0) { sb.append("path="); sb.append(escapeString(path)); sb.append(';'); } if (compositionPageId != null && compositionPageId.length() > 0) { sb.append("cpgid="); sb.append(compositionPageId); sb.append(';'); } if (ancillaryPageId != null && ancillaryPageId.length() > 0) { sb.append("apgid="); sb.append(ancillaryPageId); sb.append(';'); } sb.append("forced="); sb.append(forced); sb.append(';'); return sb.toString(); }
Source:
<code>public void onCreate() { instance = new WeakReference<>(this); addModule(new AndroidLoggerModule()); addModule(OkHttpModule.withCache(this)); super.onCreate(); RealmConfiguration realmConfiguration = new RealmConfiguration.Builder(this) .deleteRealmIfMigrationNeeded() .build(); Realm.setDefaultConfiguration(realmConfiguration); <START> realm = Realm.getDefaultInstance(); <END> realm.executeTransactionAsync( new DefaultDataTransaction(), new Realm.Transaction.OnSuccess() { @Override public void onSuccess() { log.debug("Loading default data successful"); } }, new Realm.Transaction.OnError() { @Override public void onError(Throwable error) { log.error("Error loading default data", error); } } ); TinyDB.getInstance().init(getApplicationContext()); TinyDB.getInstance().putBoolean(TinyDbKeys.FINISHED_LOAD_IN_MAP, true); }</code><technical_language>closing this realm instance is theoretically a resource leak. dangerous get closed properly app is killed, increase likelihood of app killed while is in background. want close in onSuccess/OnError of transaction below</technical_language>

Target:
public void onCreate() { instance = new WeakReference<>(this); addModule(new AndroidLoggerModule()); addModule(OkHttpModule.withCache(this)); super.onCreate(); RealmConfiguration realmConfiguration = new RealmConfiguration.Builder(this) .deleteRealmIfMigrationNeeded() .build(); Realm.setDefaultConfiguration(realmConfiguration); final Realm realm = Realm.getDefaultInstance(); realm.executeTransactionAsync( new DefaultDataTransaction(), new Realm.Transaction.OnSuccess() { @Override public void onSuccess() { log.debug("Loading default data successful"); realm.close(); } }, new Realm.Transaction.OnError() { @Override public void onError(Throwable error) { log.error("Error loading default data", error); realm.close(); } } ); TinyDB.getInstance().init(getApplicationContext()); TinyDB.getInstance().putBoolean(TinyDbKeys.FINISHED_LOAD_IN_MAP, true); }
Source:
<code>public String toString() { return <START> "Operation.Successful"; <END> }</code><technical_language>SUCCESSFUL</technical_language>

Target:
public String toString() { return "SUCCESSFUL"; }
Source:
<code>public void switchAndWrite(String text) { driver.switchTo().frame(miniEditorIframe); <START> waitForElementByElement(messageBodyField); <END> messageBodyField.sendKeys(text); }</code><technical_language>writeMiniEditor() method instead of waitForElementByElement(messageBodyField); messageBodyField.sendKeys(text);</technical_language>

Target:
public void switchAndWrite(String text) { waitForElementByElement(miniEditorIframe); driver.switchTo().frame(miniEditorIframe); waitForElementByElement(messageBodyField); messageBodyField.sendKeys(text); }
Source:
<code>public Iterable<Content> iterate(final String pattern, final String ref) throws IOException { final Iterable<XML> nodes = this.storage.xml().nodes( String.format("%s/content[@ref='%s']", this.xpath(), ref) ); <START> final Collection<Content> result = new LinkedList<Content>(); <END> for (final XML node : nodes) { final String path = node.xpath("path/text()").get(0); if (path.startsWith(pattern)) { result.add( this.mkContent(ref, path) ); } } return result; }</code><technical_language>I prefer ArrayList here, faster, smaller footprint need fast insertion in middle</technical_language>

Target:
public Iterable<Content> iterate(final String pattern, final String ref) throws IOException { final Collection<XML> nodes = this.storage.xml().nodes( String.format("%s/content[@ref='%s']", this.xpath(), ref) ); final Collection<Content> result = new ArrayList<Content>(nodes.size()); for (final XML node : nodes) { final String path = node.xpath("path/text()").get(0); if (path.startsWith(pattern)) { result.add( this.mkContent(ref, path) ); } } return result; }
Source:
<code>public RepositoryObject getParent() { <START> return null; <END> }</code><technical_language>implement this, exact for a binary return dataLoader.getParentObject(this);</technical_language>

Target:
public RepositoryObject getParent() { return dataLoader.getParentObject(this); }
Source:
<code>public Object getParameter(String name) { <START> final HostThread currentHostThread = fCurrentHostThread; <END> if (currentHostThread == null) { return null; } if (name.equals(CriticalPathModule.PARAM_WORKER)) { IAnalysisModule mod = getModule(); if ((mod != null) && (mod instanceof CriticalPathModule)) { LttngWorker worker = new LttngWorker(currentHostThread, "", 0); return worker; } return currentHostThread; } return null; }</code><technical_language>This code if, need do if parameter request is PARAM_WORKER</technical_language>

Target:
public Object getParameter(String name) { if (name.equals(CriticalPathModule.PARAM_WORKER)) { final HostThread currentHostThread = fCurrentHostThread; if (currentHostThread == null) { return null; } IAnalysisModule mod = getModule(); if ((mod != null) && (mod instanceof CriticalPathModule)) { LttngWorker worker = new LttngWorker(currentHostThread, "", 0); return worker; } return currentHostThread; } return null; }
Source:
<code>public static ReadCountCollection removeColumnsWithTooManyZeros(final ReadCountCollection readCounts, final int maximumColumnZeros, final Logger logger) { final RealMatrix counts = readCounts.counts(); final Set<String> columnsToKeep = IntStream.range(0, counts.getColumnDimension()).boxed() .filter(i -> countZeroes(counts.getColumn(i)) <= maximumColumnZeros) .map(i -> readCounts.columnNames().get(i)).collect(Collectors.toSet()); final int columnsToDropCount = readCounts.columnNames().size() - columnsToKeep.size(); if (columnsToDropCount == 0) { logger.info( String.format("No count column dropped due to zero counts; there is no column with a large number of targets with zero counts (<= %d of %d) ", maximumColumnZeros, readCounts.targets().size())); return readCounts; } else if (columnsToDropCount == readCounts.columnNames().size()) { throw new UserException.BadInput("The number of zeros per count column is too large resulting in all count columns to be dropped"); } else { logger.info( String.format("Some counts columns dropped, %d of %d, as they have too many targets with zeros (> %d of %d)." <START> , columnsToDropCount, readCounts.columnNames().size(), maximumColumnZeros, readCounts.targets().size())); <END> return readCounts.subsetColumns(columnsToKeep); } }</code><technical_language>move comma previous line</technical_language>

Target:
public static ReadCountCollection removeColumnsWithTooManyZeros(final ReadCountCollection readCounts, final int maximumColumnZeros, final Logger logger) { final RealMatrix counts = readCounts.counts(); final Set<String> columnsToKeep = IntStream.range(0, counts.getColumnDimension()).boxed() .filter(i -> countZeroes(counts.getColumn(i)) <= maximumColumnZeros) .map(i -> readCounts.columnNames().get(i)).collect(Collectors.toSet()); final int columnsToDropCount = readCounts.columnNames().size() - columnsToKeep.size(); if (columnsToDropCount == 0) { logger.info( String.format("There were no columns with a large number of targets with zero counts " + "(<= %d of %d) to drop", maximumColumnZeros, readCounts.targets().size())); return readCounts; } else if (columnsToDropCount == readCounts.columnNames().size()) { throw new UserException.BadInput("The number of zeros per count column is too large resulting in all count " + "columns to be dropped"); } else { final double droppedPercentage = ((double)(columnsToDropCount) / readCounts.columnNames().size()) * 100; logger.info(String.format("Some counts columns dropped (%d out of %d, %.2f%%) as they had too many targets with zeros (> %d of %d)", columnsToDropCount, readCounts.columnNames().size(), droppedPercentage, maximumColumnZeros, readCounts.targets().size())); return readCounts.subsetColumns(columnsToKeep); } }
Source:
<code>public synchronized void close() { if (closed) { return; } closed = true; <START> if (parentMemoryContext != null) { <END> parentMemoryContext.updateBytes(-usedBytes); } usedBytes = 0; }</code><technical_language>This if is redundant. Question for you, @nezihyigitbasi: Do IntelliJ "warning"s for this? If not, turn on</technical_language>

Target:
public synchronized void close() { if (closed) { return; } closed = true; parentMemoryContext.updateBytes(-usedBytes); usedBytes = 0; }
Source:
<code>public Partition getPartitionObj(int idx) throws Exception { return partitionObjs == null ? null : <START> (Partition)JSONMessageFactory.getTObj(partitionObjs.get(idx), Partition.class); <END> }</code><technical_language>Some of partitionObjs entries NULL if table is partitioned. Need handle it</technical_language>

Target:
public Partition getPartitionObj(int idx) throws Exception { return (partitionObjs == null ? null : (partitionObjs.get(idx) == null ? null : (Partition)JSONMessageFactory.getTObj(partitionObjs.get(idx), Partition.class))); }
Source:
<code>public static Pair<Integer, Integer> parseAudioSpecificConfig(byte[] audioSpecificConfig) { int audioObjectType = (audioSpecificConfig[0] >> 3) & 0x1F; <START> if (audioObjectType != 31) { <END> int byteOffset = audioObjectType == 5 || audioObjectType == 29 ? 1 : 0; int frequencyIndex = (audioSpecificConfig[byteOffset] & 0x7) << 1 | ((audioSpecificConfig[byteOffset + 1] >> 7) & 0x1); Assertions.checkState(frequencyIndex < 13); int sampleRate = AUDIO_SPECIFIC_CONFIG_SAMPLING_RATE_TABLE[frequencyIndex]; int channelCount = (audioSpecificConfig[byteOffset + 1] >> 3) & 0xF; return Pair.create(sampleRate, channelCount); } else { int frequencyIndex = (audioSpecificConfig[1] & 0x1E) >> 1; Assertions.checkState(frequencyIndex < 13); int sampleRate = AUDIO_SPECIFIC_CONFIG_SAMPLING_RATE_TABLE[frequencyIndex]; int channelCount = (audioSpecificConfig[1] & 0x01) << 2 | ((audioSpecificConfig[2] >> 6) & 0x03); return Pair.create(sampleRate, channelCount); } }</code><technical_language>(audioObjectType < 31) consistent buildAudioSpecificConfig()</technical_language>

Target:
public static Pair<Integer, Integer> parseAudioSpecificConfig(byte[] audioSpecificConfig) { int audioObjectType = (audioSpecificConfig[0] >> 3) & 0x1F; if (audioObjectType < 31) { int byteOffset = audioObjectType == 5 || audioObjectType == 29 ? 1 : 0; int frequencyIndex = (audioSpecificConfig[byteOffset] & 0x7) << 1 | ((audioSpecificConfig[byteOffset + 1] >> 7) & 0x1); Assertions.checkState(frequencyIndex < 13); int sampleRate = AUDIO_SPECIFIC_CONFIG_SAMPLING_RATE_TABLE[frequencyIndex]; int channelCount = AUDIO_SPECIFIC_CONFIG_CHANNEL_COUNT_TABLE[ (audioSpecificConfig[byteOffset + 1] >> 3) & 0xF]; return Pair.create(sampleRate, channelCount); } else { int frequencyIndex = (audioSpecificConfig[1] & 0x1E) >> 1; Assertions.checkState(frequencyIndex < 13); int sampleRate = AUDIO_SPECIFIC_CONFIG_SAMPLING_RATE_TABLE[frequencyIndex]; int channelCount = AUDIO_SPECIFIC_CONFIG_CHANNEL_COUNT_TABLE[ (audioSpecificConfig[1] & 0x01) << 3 | ((audioSpecificConfig[2] >> 5) & 0x07)]; return Pair.create(sampleRate, channelCount); } }
Source:
<code>public Pair<List<Guid>, Guid> balance(VDSGroup cluster, List<VDS> hosts, Map<String, String> parameters, ArrayList<String> messages) { final Pair<List<Guid>, Guid> migrationRule = super.balance(cluster, hosts, parameters, messages); List<VDS> allHosts = DbFacade.getInstance().getVdsDao().getAllForVdsGroup(cluster.getId()); Pair<VDS, VDSStatus> action = evaluatePowerManagementSituation( getDownHosts(allHosts, parameters), getMaintenanceHosts(allHosts, parameters), getEmptyHosts(allHosts, parameters), <START> parameters); <END> if (action != null) { processPmAction(action); } return migrationRule; }</code><technical_language>Single pass is needed here</technical_language>

Target:
public Pair<List<Guid>, Guid> balance(VDSGroup cluster, List<VDS> hosts, Map<String, String> parameters, ArrayList<String> messages) { final Pair<List<Guid>, Guid> migrationRule = super.balance(cluster, hosts, parameters, messages); List<VDS> allHosts = DbFacade.getInstance().getVdsDao().getAllForVdsGroup(cluster.getId()); List<VDS> emptyHosts = new ArrayList<>(); List<VDS> maintenanceHosts = new ArrayList<>(); List<VDS> downHosts = new ArrayList<>(); getHostLists(allHosts, parameters, emptyHosts, maintenanceHosts, downHosts); Pair<VDS, VDSStatus> action = evaluatePowerManagementSituation( downHosts, maintenanceHosts, emptyHosts, parameters); if (action != null) { processPmAction(action); } return migrationRule; }
Source:
<code>private List<String> readLines(final File file, final String encoding, final boolean tail, final int skip, final int numberOfLines) throws IOException { final List<String> lines; if (numberOfLines < 0) { lines = new ArrayList<String>(); } else { lines = new ArrayList<String>(numberOfLines); } final InputStream in; BufferedReader reader = null; try { if (tail) { in = new LogFileResourceDefinition.LifoFileInputStream(file); } else { in = new FileInputStream(file); } if (encoding == null) { <START> reader = new BufferedReader(new InputStreamReader(in, StandardCharsets.UTF_8)); <END> } else { reader = new BufferedReader(new InputStreamReader(in, encoding)); } int lineCount = 0; String line; while ((line = reader.readLine()) != null) { if (++lineCount <= skip) continue; if (lines.size() == numberOfLines) break; lines.add(line); } if (tail) { Collections.reverse(lines); } return lines; } finally { safeClose(reader); } }</code><technical_language>note above, this system default</technical_language>

Target:
private List<String> readLines(final File file, final String encoding, final boolean tail, final int skip, final int numberOfLines) throws IOException { final List<String> lines; if (numberOfLines < 0) { lines = new ArrayList<String>(); } else { lines = new ArrayList<String>(numberOfLines); } final InputStream in; BufferedReader reader = null; try { if (tail) { in = new LogFileResourceDefinition.LifoFileInputStream(file); } else { in = new FileInputStream(file); } if (encoding == null) { reader = new BufferedReader(new InputStreamReader(in)); } else { reader = new BufferedReader(new InputStreamReader(in, encoding)); } int lineCount = 0; String line; while ((line = reader.readLine()) != null) { if (++lineCount <= skip) continue; if (lines.size() == numberOfLines) break; lines.add(line); } if (tail) { Collections.reverse(lines); } return lines; } finally { safeClose(reader); } }
Source:
<code><START> public List<TmfAnalysisElement> getAvailableAnalysis() { <END> List<TmfAnalysisElement> list = new ArrayList<TmfAnalysisElement>(); IPath path = getProject().getTracesFolder().getPath(); if (fResource instanceof IFolder) { IFolder folder = (IFolder) fResource; path = folder.getFullPath(); } else if (fResource instanceof IFile) { IFile file = (IFile) fResource; path = path.append(file.getName()); } for (IAnalysisModule module : TmfAnalysisManager.getAnalysisModules(TmfExperiment.class).values()) { IFolder newresource = ResourcesPlugin.getWorkspace().getRoot().getFolder(path.append(module.getId())); TmfAnalysisElement analysis = new TmfAnalysisElement(module.getName(), newresource, this, module.getId()); list.add(analysis); } return list; }</code><technical_language>this experiments analysis modules with</technical_language>

Target:
public List<TmfAnalysisElement> getAvailableAnalysis() { List<TmfAnalysisElement> list = new ArrayList<TmfAnalysisElement>(); return list; }
Source:
<code>private void handleAccessRestrictionByImportPackage(IProject currentProject, ExportPackageDescription desc, AbstractClassResolutionCollector collector) { BundleDescription supplier = desc.getSupplier(); if (supplier != null) { String supplierId = supplier.getSymbolicName(); IPluginModelBase base = PluginRegistry.findModel(currentProject); BundleDescription bd = base.getBundleDescription(); BundleSpecification[] imports = bd.getRequiredBundles(); boolean supplierImported = false; <START> for (BundleSpecification import1 : imports) { <END> BundleDescription importSupplier = (BundleDescription) import1.getSupplier(); if (importSupplier != null && importSupplier.getSymbolicName().equals(supplierId)) { supplierImported = true; break; } } if (!supplierImported) { boolean proposeImportPackage = true; ImportPackageSpecification[] importPackages = bd.getImportPackages(); for (ImportPackageSpecification importPackage : importPackages) { if (desc.getName().equals(importPackage.getName())) { proposeImportPackage = false; break; } } if (proposeImportPackage) { collector.addResolutionModification(currentProject, desc); } collector.addRequireBundleModification(currentProject, desc, 16); } } }</code><technical_language>import1 is a nice name ;-)</technical_language>

Target:
private void handleAccessRestrictionByImportPackage(IProject currentProject, ExportPackageDescription desc, AbstractClassResolutionCollector collector) { BundleDescription supplier = desc.getSupplier(); if (supplier != null) { String supplierId = supplier.getSymbolicName(); IPluginModelBase base = PluginRegistry.findModel(currentProject); BundleDescription bd = base.getBundleDescription(); BundleSpecification[] imports = bd.getRequiredBundles(); boolean supplierImported = false; for (BundleSpecification importstatement : imports) { BundleDescription importSupplier = (BundleDescription) importstatement.getSupplier(); if (importSupplier != null && importSupplier.getSymbolicName().equals(supplierId)) { supplierImported = true; break; } } if (!supplierImported) { boolean proposeImportPackage = true; ImportPackageSpecification[] importPackages = bd.getImportPackages(); for (ImportPackageSpecification importPackage : importPackages) { if (desc.getName().equals(importPackage.getName())) { proposeImportPackage = false; break; } } if (proposeImportPackage) { collector.addResolutionModification(currentProject, desc); } collector.addRequireBundleModification(currentProject, desc, 16); } } }
Source:
<code>protected void recoverAndCommit(FlinkKafkaProducer.KafkaTransactionState transaction) { if (transaction.isTransactional()) { FlinkKafkaInternalProducer<byte[], byte[]> producer = null; try { producer = initTransactionalProducer(transaction.transactionalId, false); producer.resumeTransaction(transaction.producerId, transaction.epoch); producer.commitTransaction(); } catch (InvalidTxnStateException | ProducerFencedException ex) { LOG.warn("Encountered error while recovering transaction {}. " + "Presumably this transaction has been already committed before", ex, transaction); } finally { if (producer != null) { <START> producer.close(30, TimeUnit.SECONDS); <END> } } } }</code><technical_language>@aljoscha want close(3) instead of close(0) here, right? I I read code logic there. question for below</technical_language>

Target:
protected void recoverAndCommit(FlinkKafkaProducer.KafkaTransactionState transaction) { if (transaction.isTransactional()) { FlinkKafkaInternalProducer<byte[], byte[]> producer = null; try { producer = initTransactionalProducer(transaction.transactionalId, false); producer.resumeTransaction(transaction.producerId, transaction.epoch); producer.commitTransaction(); } catch (InvalidTxnStateException | ProducerFencedException ex) { LOG.warn("Encountered error while recovering transaction {}. " + "Presumably this transaction has been already committed before", ex, transaction); } finally { if (producer != null) { producer.close(0, TimeUnit.SECONDS); } } } }
Source:
<code>public boolean equals(Object o) { if (this == o) return true; if (o == null || !getClass().equals(o.getClass())) return false; TimeSeriesKey<?> that = (TimeSeriesKey<?>) o; <START> if (timestamp != that.timestamp) return false; <END> if (seqNum != that.seqNum) return false; return key != null ? key.equals(that.key) : that.key == null; }</code><technical_language>Good call</technical_language>

Target:
public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; TimeSeriesKey<?> that = (TimeSeriesKey<?>) o; if (timestamp != that.timestamp) return false; if (seqNum != that.seqNum) return false; return key != null ? key.equals(that.key) : that.key == null; }
Source:
<code>public GHPoint asPoint() { <START> return null; <END> }</code><technical_language>in asPointList need throw UnsupportedExc</technical_language>

Target:
public GHPoint asPoint() { throw new UnsupportedOperationException("Not supported"); }
Source:
<code>static Iterator<Integer> rangeClosedBy(int from, int toInclusive, int step) { if (step == 0) { throw new IllegalArgumentException("step cannot be 0"); } else if (from == toInclusive) { return of(from); } else if (Integer.signum(step) == Integer.signum(from - toInclusive)) { return empty(); } else { if (step > 0) { return new Iterator<Integer>() { int next = from; boolean overflow = false; @Override public boolean hasNext() { <START> return !overflow && next <= toInclusive; <END> } @Override public Integer next() { if (!hasNext()) { throw new NoSuchElementException(); } int curr = next; int r = curr + step; overflow = ((curr ^ r) & (step ^ r)) < 0; next = r; return curr; } }; } else { return new Iterator<Integer>() { int next = from; boolean overflow = false; @Override public boolean hasNext() { return !overflow && next >= toInclusive; } @Override public Integer next() { if (!hasNext()) { throw new NoSuchElementException(); } int curr = next; int r = curr + step; overflow = ((curr ^ r) & (step ^ r)) < 0; next = r; return curr; } }; } } }</code><technical_language>thumbs for solution</technical_language>

Target:
static Iterator<Integer> rangeClosedBy(int from, int toInclusive, int step) { if (step == 0) { throw new IllegalArgumentException("step cannot be 0"); } if (step > 0) { return new RangeIntForwardIterator(from, toInclusive, step, true); } else { return new RangeIntBackwardIterator(from, toInclusive, step, true); } }
Source:
<code>private static void simulateServerDelay() { long delay = getServerDelay(); if (delay > 0) { try { Thread.sleep(delay); } catch (InterruptedException e) { <START> logger.info("", e); <END> } } }</code><technical_language>Log _error_ _warn_</technical_language>

Target:
private static void simulateServerDelay() { long delay = getServerDelay(); if (delay > 0) { try { Thread.sleep(delay); } catch (InterruptedException e) { logger.warn("", e); } } }
Source:
<code>private ParquetReader(Configuration conf, Path file, ReadSupport<T> readSupport, Filter filter) throws IOException { this.readSupport = readSupport; this.filter = checkNotNull(filter, "filter"); this.conf = conf; FileSystem fs = file.getFileSystem(conf); List<FileStatus> statuses = Arrays.asList(fs.listStatus(file, HiddenFileFilter.INSTANCE)); List<Footer> footers = ParquetFileReader.readAllFootersInParallelUsingSummaryFiles(conf, statuses, false); this.footersIterator = footers.iterator(); globalMetaData = ParquetFileWriter.getGlobalMetaData(footers); MessageType schema = globalMetaData.getSchema(); Map<String, Set<String>> extraMetadata = globalMetaData.getKeyValueMetaData(); <START> readContext = readSupport.init(new InitContext(conf, extraMetadata, schema)); <END> }</code><technical_language>this in reader.initialize in record case. this consistent. happen in class in cases</technical_language>

Target:
private ParquetReader(Configuration conf, Path file, ReadSupport<T> readSupport, Filter filter) throws IOException { this.readSupport = readSupport; this.filter = checkNotNull(filter, "filter"); this.conf = conf; FileSystem fs = file.getFileSystem(conf); List<FileStatus> statuses = Arrays.asList(fs.listStatus(file, HiddenFileFilter.INSTANCE)); List<Footer> footers = ParquetFileReader.readAllFootersInParallelUsingSummaryFiles(conf, statuses, false); this.footersIterator = footers.iterator(); GlobalMetaData globalMetaData = ParquetFileWriter.getGlobalMetaData(footers); MessageType schema = globalMetaData.getSchema(); Map<String, Set<String>> extraMetadata = globalMetaData.getKeyValueMetaData(); readContext = readSupport.init(new InitContext(conf, extraMetadata, schema)); }
Source:
<code>public void declareOutputFields(OutputFieldsDeclarer declarer) { <START> for (String stream : ruleProcessorRuntime.getStreams()) { <END> declarer.declareStream(stream, new Fields(IotasEvent.IOTAS_EVENT)); } }</code><technical_language>is issue in ruleProcessorRuntime here. is initialized prepare is called in worker. However, declareOutputFields is called that(during construction of topology DAG for submission nimbus). @arunmahadevan mentioned able run topology successfully notifications. idea I missing here</technical_language>

Target:
public void declareOutputFields(OutputFieldsDeclarer declarer) { for (String stream : boltDependenciesFactory.createRuleProcessorRuntime().getStreams()) { declarer.declareStream(stream, new Fields(IotasEvent.IOTAS_EVENT)); } }
Source:
<code>public void validate_valid_3ds_flex_credentials() throws Exception { stubFor(post("/shopper/3ds/ddc.html").willReturn(ok())); var validIssuer = "54i0917n10va4428b69l5id0"; var validOrgUnitId = "57992i087n0v4849895alid2"; var validJwtMacKey = "4inva5l2-0133-4i82-d0e5-2024dbeddaa9"; <START> var payload = new ObjectMapper().writeValueAsString(Map.of( <END> "issuer", validIssuer, "organisational_unit_id", validOrgUnitId, "jwt_mac_key", validJwtMacKey)); givenSetup() .body(payload) .post(format(VALIDATE_3DS_FLEX_CREDENTIALS_URL, testAccount.getAccountId())) .then() .statusCode(200) .body("result", is("valid")); }</code><technical_language>move new ObjectMapper() @Before section reusing for tests I see</technical_language>

Target:
public void validate_valid_3ds_flex_credentials() throws Exception { stubFor(post("/shopper/3ds/ddc.html").willReturn(ok())); var validIssuer = "54i0917n10va4428b69l5id0"; var validOrgUnitId = "57992i087n0v4849895alid2"; var validJwtMacKey = "4inva5l2-0133-4i82-d0e5-2024dbeddaa9"; var payload = objectMapper.writeValueAsString(Map.of( "issuer", validIssuer, "organisational_unit_id", validOrgUnitId, "jwt_mac_key", validJwtMacKey)); givenSetup() .body(payload) .post(format(VALIDATE_3DS_FLEX_CREDENTIALS_URL, testAccount.getAccountId())) .then() .statusCode(200) .body("result", is("valid")); }
Source:
<code>public double compute(Vector a, Vector b) throws CardinalityException { <START> Set<Double> aSet = new HashSet<>(); <END> for (int i = 0; i < a.size(); i++) aSet.add(a.get(i)); double intersect = 0; for (int i = 0; i < b.size(); i++) if (aSet.contains(b.get(i))) ++intersect; return intersect / (a.size() + b.size() - intersect); }</code><technical_language>rename variable meaningful</technical_language>

Target:
@Override public double compute(Vector a, Vector b) throws CardinalityException { Set<Double> uniqueValues = new HashSet<>(); for (int i = 0; i < a.size(); i++) uniqueValues.add(a.get(i)); double intersect = 0; for (int i = 0; i < b.size(); i++) if (uniqueValues.contains(b.get(i))) ++intersect; return intersect / (a.size() + b.size() - intersect); }
Source:
<code>public void testMarkerOffset_Bug486610() { String code = getAboveComment(); loadCodeAndRun(code); IMarker marker = checkErrorLine(2); int start = marker.getAttribute(IMarker.CHAR_START, -1); int end = marker.getAttribute(IMarker.CHAR_END, -1); assertTrue(code.substring(start, end).equals("x\n = x")); <START> END> }</code><technical_language>NON_NLS is required in tests</technical_language>

Target:
public void testMarkerOffset_Bug486610() throws Exception { String code = getAboveComment(); loadCodeAndRun(code); IMarker marker = checkErrorLine(2); int start = marker.getAttribute(IMarker.CHAR_START, -1); int end = marker.getAttribute(IMarker.CHAR_END, -1); assertTrue(code.substring(start, end).equals("x\n = x")); }
Source:
<code>public Relationship byInode(final String inode){ Relationship rel = null; try { rel = cache.getRelationshipByInode(inode); if(rel != null) return rel; } catch (DotCacheException e) { Logger.debug(this.getClass(), "Unable to access the cache to obtain the relationship", e); } try { final DotConnect dc = new DotConnect(); dc.setSQL(sql.FIND_BY_INODE); dc.addParam(inode); List<Map<String, Object>> results; results = dc.loadObjectResults(); <START> if (results.size() == 0) { <END> throw new NotFoundInDbException("Relationship with inode: " + inode + " not found"); } rel = new DbRelationshipTransformer(results).from(); }catch (DotDataException e){ Logger.error(this, "Error getting Relationship with inode: " + inode, e); } if(rel!= null && InodeUtils.isSet(rel.getInode())) { cache.putRelationshipByInode(rel); } return rel; }</code><technical_language>change this for this: final List<Map<String, Object>> results = new DotConnect().sql(sql.FIND_BY_INODE). .addParam(inode). loadObjectResults(); if (results.isEmpty()) { throw new NotFoundInDbException("Relationship inode: " + inode + " found"); }</technical_language>

Target:
public Relationship byInode(final String inode){ Relationship rel = null; try { rel = cache.getRelationshipByInode(inode); if(rel != null) return rel; } catch (DotCacheException e) { Logger.debug(this.getClass(), "Unable to access the cache to obtain the relationship", e); } try { final List<Map<String, Object>> results = new DotConnect() .setSQL(sql.FIND_BY_INODE) .addParam(inode) .loadObjectResults(); if (results.isEmpty()) { throw new NotFoundInDbException("Relationship with inode: " + inode + " not found"); } rel = new DbRelationshipTransformer(results).from(); }catch (DotDataException e){ Logger.error(this, "Error getting Relationship with inode: " + inode, e); } if(rel!= null && InodeUtils.isSet(rel.getInode())) { cache.putRelationshipByInode(rel); } return rel; }
Source:
<code>public void testSkipStatsHint2() throws Exception { methodWatcher.executeQuery(format( "call SYSCS_UTIL.COLLECT_SCHEMA_STATISTICS('%s', false)", spliceSchemaWatcher.toString())); String query = "explain select * from --splice-properties joinOrder=fixed\n" + "t2 as X --splice-properties skipStats=true\n" + ",t2 as Y --splice-properties joinStrategy=BROADCAST,skipStats=false\n" + "where X.a2=Y.a2"; try(ResultSet resultSet = methodWatcher.executeQuery(query)){ int i = 1; double outputRowWithStats = 0; double outputRowWithoutStats = 0; while(resultSet.next()){ if (i == 4) { outputRowWithStats = parseOutputRows(resultSet.getString(1)); Assert.assertEquals(outputRowWithStats, 40960, 10); <START> } if (i == 5) { <END> outputRowWithoutStats = parseOutputRows(resultSet.getString(1)); Assert.assertNotEquals(outputRowWithStats, outputRowWithoutStats, 10); } } } }</code><technical_language>minor: else if ()</technical_language>

Target:
public void testSkipStatsHint2() throws Exception { methodWatcher.executeQuery(format( "call SYSCS_UTIL.COLLECT_SCHEMA_STATISTICS('%s', false)", spliceSchemaWatcher.toString())); String query = "explain select * from --splice-properties joinOrder=fixed\n" + "t2 as X --splice-properties skipStats=true\n" + ",t2 as Y --splice-properties joinStrategy=BROADCAST,skipStats=false\n" + "where X.a2=Y.a2"; try(ResultSet resultSet = methodWatcher.executeQuery(query)){ int i = 1; double outputRowWithStats = 0; double outputRowWithoutStats = 0; while(resultSet.next()){ if (i == 4) { outputRowWithStats = parseOutputRows(resultSet.getString(1)); Assert.assertEquals(outputRowWithStats, 40960, 10); } else if (i == 5) { outputRowWithoutStats = parseOutputRows(resultSet.getString(1)); Assert.assertNotEquals(outputRowWithStats, outputRowWithoutStats, 10); } } } }
Source:
<code>public void testRouterBasic() throws Exception { Properties props = RouterTestUtils.getProps(); VerifiableProperties verifiableProperties = new VerifiableProperties((props)); MockClusterMap mockClusterMap = new MockClusterMap(); BlobProperties putBlobProperties = new BlobProperties(100, "serviceId", "memberId", "contentType", false, Utils.Infinite_Time); Random random = new Random(); byte[] putUserMetadata = new byte[10]; random.nextBytes(putUserMetadata); byte[] putContent = new byte[100]; random.nextBytes(putContent); ReadableStreamChannel putChannel = new ByteBufferReadableStreamChannel(ByteBuffer.wrap(putContent)); Router router = new NonBlockingRouterFactory(verifiableProperties, mockClusterMap, new LoggingNotificationSystem()).getRouter(); router.putBlob(putBlobProperties, putUserMetadata, putChannel); router.getBlob("nonExistentblobId"); router.deleteBlob("nonExistentblobId"); router.close(); Future<String> future = router.putBlob(putBlobProperties, putUserMetadata, putChannel); <START> Assert.assertTrue(future.isDone()); <END> }</code><technical_language>check exception</technical_language>

Target:
public void testRouterBasic() throws Exception { Properties props = getNonBlockingRouterProperties(); VerifiableProperties verifiableProperties = new VerifiableProperties((props)); MockClusterMap mockClusterMap = new MockClusterMap(); Router router = new NonBlockingRouterFactory(verifiableProperties, mockClusterMap, new LoggingNotificationSystem()).getRouter(); BlobProperties putBlobProperties = new BlobProperties(100, "serviceId", "memberId", "contentType", false, Utils.Infinite_Time); Random random = new Random(); byte[] putUserMetadata = new byte[10]; random.nextBytes(putUserMetadata); byte[] putContent = new byte[100]; random.nextBytes(putContent); ReadableStreamChannel putChannel = new ByteBufferReadableStreamChannel(ByteBuffer.wrap(putContent)); router.putBlob(putBlobProperties, putUserMetadata, putChannel); router.getBlob("nonExistentBlobId"); router.getBlobInfo("nonExistentBlobid"); router.deleteBlob("nonExistentBlobId"); router.close(); Future<String> future = router.putBlob(putBlobProperties, putUserMetadata, putChannel); Assert.assertTrue(future.isDone()); RouterException e = (RouterException) ((FutureResult<String>) future).error(); Assert.assertEquals(e.getErrorCode(), RouterErrorCode.RouterClosed); }
Source:
<code><START> public Sample getBySampleBk(final String sampleBk) { <END> return (Sample) this.getSession().createCriteria(Sample.class, "sample") .add(Restrictions.eq("sampleBusinessKey", sampleBk)).uniqueResult(); }</code><technical_language>@cuenyad Add exception management</technical_language>

Target:
public Sample getBySampleBk(final String sampleBk){ Sample sample; try { sample = (Sample) this.getSession().createCriteria(Sample.class, "sample").add(Restrictions.eq("sampleBusinessKey", sampleBk)) .uniqueResult(); } catch (HibernateException he) { throw new MiddlewareException( "Unexpected error in executing getBySampleBk(sampleBusinessKey = " + sampleBk + ") query: " + he.getMessage(), he); } return sample; }
Source:
<code>public void testDefaults() { assertRecordedDefaults(recordDefaults(CacheConfig.class) .setCachingEnabled(false) .setCacheType(null) .setBaseDirectory(null) <START> .setValidationEnabled(false) <END> .setMaxInMemoryCacheSize(new DataSize(2, GIGABYTE))); }</code><technical_language>Added</technical_language>

Target:
public void testDefaults() { assertRecordedDefaults(recordDefaults(CacheConfig.class) .setCachingEnabled(false) .setCacheType(null) .setBaseDirectory(null) .setValidationEnabled(false)); }
Source:
<code>public boolean flush () { boolean success = false; ObjCRuntime.autoreleasepool(new Runnable() { @Override public void run() { if (!nsDictionary.writeToFileAtomically(file.getAbsolutePath(), false)) { Gdx.app.debug("IOSPreferences", "Failed to write NSDictionary to file " + file); } } }); <START> success = true; END> return success; }</code><technical_language>change line 188 final boolean[] success = {false};, success set line 194 success[0] = true; return success[0];. This pattern is in similar situations. leads allocation, if MOE is smart enough, optimize out. if - flush is a slow operation anyway, matter much</technical_language>

Target:
public boolean flush () { final boolean[] success = {false}; ObjCRuntime.autoreleasepool(new Runnable() { @Override public void run() { if (nsDictionary.writeToFileAtomically(file.getAbsolutePath(), false)) { success[0] = true; } else { Gdx.app.debug("IOSPreferences", "Failed to write NSDictionary to file " + file); } } }); return success[0]; }
Source:
<code>public T findOrMakePlaceHolder(String uuid){ T entity = findOne(uuid); if (null == entity){ <START> entity = getUnknownEntity(); <END> entity.setUuid(uuid); createOrUpdate(entity); } return entity; }</code><technical_language>this makeUnknown instead of getUnknown. I difference is makeUnknown create a new one, new insert date user. I getUnknown placeholders insert date user</technical_language>

Target:
public T findOrMakePlaceHolder(String uuid){ T entity = findOne(uuid); if (null == entity){ entity = makeUnknownEntity(); entity.setUuid(uuid); createOrUpdate(entity); } return entity; }
Source:
<code>protected Iterable<Text> getLines(int page) throws CommandException { if (!this.countIterator.hasNext()) { throw new CommandException(t("Already at end of iterator")); } if (page <= this.lastPage) { <START> throw new CommandException(t("You cannot go backwards in an IterablePagination.")); <END> } else if (page > this.lastPage + 1) { getLines(page - 1); } this.lastPage = page; if (getMaxContentLinesPerPage() <= 0) { return Lists.newArrayList(Iterators.transform(this.countIterator, new Function<Map.Entry<Text, Integer>, Text>() { @Nullable @Override public Text apply(Map.Entry<Text, Integer> input) { return input.getKey(); } })); } List<Text> ret = new ArrayList<>(getMaxContentLinesPerPage()); int addedLines = 0; while (addedLines <= getMaxContentLinesPerPage()) { if (!this.countIterator.hasNext()) { if (page > 1) { padPage(ret, addedLines, false); } break; } if (addedLines + this.countIterator.peek().getValue() > getMaxContentLinesPerPage()) { padPage(ret, addedLines, true); break; } Map.Entry<Text, Integer> ent = this.countIterator.next(); ret.add(ent.getKey()); addedLines += ent.getValue(); } return ret; }</code><technical_language>phrase this exception message a way? This sounds weird</technical_language>

Target:
protected Iterable<Text> getLines(int page) throws CommandException { if (!this.countIterator.hasNext()) { throw new CommandException(t("You're already at the end of the pagination list iterator.")); } if (page < 1) { throw new CommandException(t("Page %s does not exist!", page)); } if (page <= this.lastPage) { throw new CommandException(t("You cannot go to previous pages in an iterable pagination.")); } else if (page > this.lastPage + 1) { getLines(page - 1); } this.lastPage = page; if (getMaxContentLinesPerPage() <= 0) { return Lists.newArrayList(Iterators.transform(this.countIterator, new Function<Map.Entry<Text, Integer>, Text>() { @Nullable @Override public Text apply(Map.Entry<Text, Integer> input) { return input.getKey(); } })); } List<Text> ret = new ArrayList<>(getMaxContentLinesPerPage()); int addedLines = 0; while (addedLines <= getMaxContentLinesPerPage()) { if (!this.countIterator.hasNext()) { if (page > 1) { padPage(ret, addedLines, false); } break; } if (addedLines + this.countIterator.peek().getValue() > getMaxContentLinesPerPage()) { padPage(ret, addedLines, true); break; } Map.Entry<Text, Integer> ent = this.countIterator.next(); ret.add(ent.getKey()); addedLines += ent.getValue(); } return ret; }
Source:
<code>public boolean isAcceptableReplacement(Part part, boolean refit) { if ((part instanceof AmmoBin) && !(part instanceof LargeCraftAmmoBin)) { EquipmentPart eqpart = (EquipmentPart)part; EquipmentType et = eqpart.getType(); <START> return getType().equals(et) && ((AmmoBin)part).getFullShots() == getFullShots(); <END> } return false; }</code><technical_language>suggestion return getType().equals(et) && (((AmmoBin) part).getFullShots() == getFullShots());</technical_language>

Target:
public boolean isAcceptableReplacement(Part part, boolean refit) { if ((part instanceof AmmoBin) && !(part instanceof LargeCraftAmmoBin)) { EquipmentPart eqpart = (EquipmentPart)part; EquipmentType et = eqpart.getType(); return getType().equals(et) && (((AmmoBin) part).getFullShots() == getFullShots()); } return false; }
Source:
<code>private int getStartIndexFor(long t) throws TimeRangeException { if (fIntervals.isEmpty()) { return 0; } HTInterval dummy = new HTInterval(Long.MIN_VALUE, t, 0, TmfStateValue.nullValue()); int index = Collections.binarySearch(fIntervals, dummy, NODE_ORDER); <START> return index >= 0 ? index : -index - 1; <END> }</code><technical_language>add parentheses plz return (index >= 0 ? index : -index - 1);</technical_language>

Target:
private int getStartIndexFor(long t) throws TimeRangeException { if (fIntervals.isEmpty()) { return 0; } HTInterval dummy = new HTInterval(Long.MIN_VALUE, t, 0, TmfStateValue.nullValue()); int index = Collections.binarySearch(fIntervals, dummy, NODE_ORDER); return (index >= 0 ? index : -index - 1); }
Source:
<code><START> private Long queryResultToLong(QueryResult result) throws KeenQueryClientException { <END> if (result.isLong()) { return result.longValue(); } else { throw new KeenQueryClientException("Count Query Error: expected Long response type."); } }</code><technical_language>issue is Double vs. Long. Queries average, for example, return a Long value, KeenQueryClient's average() method returns a Double (because a Double). basically queryResultToDouble() queryResultToLong() methods do a more processing. solution is restructure DoubleResult LongResult inherit a NumericResult class, I put extra logic KeenQueryClient</technical_language>

Target:
private long queryResultToLong(QueryResult result) throws KeenQueryClientException { if (result == null) { throw new NullPointerException("Query Error: expected long response type but received null."); } if (result.isLong()) { return result.longValue(); } else { throw new IllegalStateException("Query Error: expected long response type."); } }
Source:
<code><START> public BatchExecutionMatcher(BatchExecution expectedBatchExecution) { <END> if (expectedBatchExecution == null) throw new IllegalArgumentException("null expectedBatchExecution"); this.expectedBatchExecution = expectedBatchExecution; }</code><technical_language>a factory method this package private people depend constructor? (the others too, a mistake)</technical_language>

Target:
BatchExecutionMatcher(BatchExecution expectedBatchExecution) { if (expectedBatchExecution == null) throw new IllegalArgumentException("null expectedBatchExecution"); this.expectedBatchExecution = expectedBatchExecution; }
Source:
<code>public void testWriteNewFile() throws IOException { OutputStream fos = new AtomicFileOutputStream(dstFile); assertFalse(dstFile.exists()); fos.write(TEST_STRING.getBytes()); fos.flush(); assertFalse(dstFile.exists()); fos.close(); assertTrue(dstFile.exists()); <START> String readBackData = FileUtils.readFileToString(dstFile, StandardCharsets.UTF_8); <END> assertEquals(TEST_STRING, readBackData); }</code><technical_language>UTF_8 is useful a static import, for readability</technical_language>

Target:
public void testWriteNewFile() throws IOException { OutputStream fos = new AtomicFileOutputStream(dstFile); assertFalse(dstFile.exists()); fos.write(TEST_STRING.getBytes()); fos.flush(); assertFalse(dstFile.exists()); fos.close(); assertTrue(dstFile.exists()); String readBackData = new String(Files.readAllBytes(dstFile.toPath()), UTF_8); assertEquals(TEST_STRING, readBackData); }