auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public static PatchEnvironmentRequest fromJSON(JsonReader jsonReader) { List<String> pipelineToAdd = extractListFromJson(jsonReader, "pipelines", "add"); List<String> pipelineToRemove = extractListFromJson(jsonReader, "pipelines", "remove"); List<String> agentsToAdd = extractListFromJson(jsonReader, "agents", "add"); List<String> agentsToRemove = extractListFromJson(jsonReader, "agents", "remove"); List<String> envVariablesToRemove = extractListFromJson(jsonReader, "environment_variables", "remove"); List<EnvironmentVariableConfig> environmentVariablesToAdd = new ArrayList<>(); <START> if (jsonReader.hasJsonObject("environment_variables")) { <END> jsonReader.readJsonObject("environment_variables").readArrayIfPresent("add", array -> array.forEach(envVariable -> environmentVariablesToAdd .add(EnvironmentVariableRepresenter.fromJSON(envVariable.getAsJsonObject())) )); } PatchEnvironmentRequest patchRequest = new PatchEnvironmentRequest( pipelineToAdd, pipelineToRemove, agentsToAdd, agentsToRemove, environmentVariablesToAdd, envVariablesToRemove ); return patchRequest; }</code><technical_language>BulkUpdateRequestRepresenter for a of writing this</technical_language>

Target:
public static PatchEnvironmentRequest fromJSON(JsonReader jsonReader) { List<String> pipelineToAdd = new ArrayList<>(); List<String> pipelineToRemove = new ArrayList<>(); List<String> agentsToAdd = new ArrayList<>(); List<String> agentsToRemove = new ArrayList<>(); List<EnvironmentVariableConfig> envVariablesToAdd = new ArrayList<>(); List<String> envVariableToRemove = new ArrayList<>(); jsonReader.optJsonObject("pipelines").ifPresent(reader -> { pipelineToAdd.addAll(reader.readStringArrayIfPresent("add").orElse(emptyList())); pipelineToRemove.addAll(reader.readStringArrayIfPresent("remove").orElse(emptyList())); }); jsonReader.optJsonObject("agents").ifPresent(reader -> { agentsToAdd.addAll(reader.readStringArrayIfPresent("add").orElse(emptyList())); agentsToRemove.addAll(reader.readStringArrayIfPresent("remove").orElse(emptyList())); }); jsonReader.optJsonObject("environment_variables").ifPresent(reader -> { envVariableToRemove.addAll(reader.readStringArrayIfPresent("remove").orElse(emptyList())); reader.readArrayIfPresent("add", array -> array.forEach(envVariable -> envVariablesToAdd .add(EnvironmentVariableRepresenter.fromJSON(envVariable.getAsJsonObject())) )); }); PatchEnvironmentRequest patchRequest = new PatchEnvironmentRequest( pipelineToAdd, pipelineToRemove, agentsToAdd, agentsToRemove, envVariablesToAdd, envVariableToRemove ); return patchRequest; }
Source:
<code>public void testForceDeleteArtifactAllowed(@MavenRepository(repositoryId = REPOSITORY_WITH_FORCE_DELETE_1) Repository repository, @MavenTestArtifact(repositoryId = REPOSITORY_WITH_FORCE_DELETE_1, id = "org.carlspring.strongbox:test-artifact-to-trash", versions = "1.1") Path artifactPath) throws IOException { final String storageId = repository.getStorage().getId(); final String repositoryId = repository.getId(); final RootRepositoryPath repositoryPath = repositoryPathResolver.resolve(repository); final String artifactPathStr = repositoryPath.relativize(artifactPath).toString(); <START> final RepositoryPath artifactRepositoryPath = repositoryPathResolver.resolve(repository, artifactPathStr); <END> client.delete(storageId, repositoryId, artifactPathStr, true); final Path artifactFileInTrash = RepositoryFiles.trash(artifactRepositoryPath); final Path repositoryDir = repositoryPath.resolve(repositoryId).resolve(".trash"); assertFalse(Files.exists(artifactFileInTrash), "Failed to delete artifact during a force delete operation!"); assertFalse(Files.exists(repositoryDir.resolve(artifactPathStr)), "Failed to delete artifact during a force delete operation!"); }</code><technical_language>above, injected artifactPath parameter directly</technical_language>

Target:
public void testForceDeleteArtifactAllowed(@MavenRepository(repositoryId = REPOSITORY_WITH_FORCE_DELETE_1) Repository repository, @MavenTestArtifact(repositoryId = REPOSITORY_WITH_FORCE_DELETE_1, id = "org.carlspring.strongbox:test-artifact-to-trash", versions = "1.1") Path artifactPath) throws IOException { final String storageId = repository.getStorage().getId(); final String repositoryId = repository.getId(); final RepositoryPath artifactRepositoryPath = (RepositoryPath) artifactPath.normalize(); final String artifactRepositoryPathStr = RepositoryFiles.relativizePath(artifactRepositoryPath); client.delete(storageId, repositoryId, artifactRepositoryPathStr, true); final Path artifactFileInTrash = RepositoryFiles.trash(artifactRepositoryPath); final RootRepositoryPath repositoryPath = repositoryPathResolver.resolve(repository); final Path repositoryDir = repositoryPath.resolve(repositoryId).resolve(".trash"); assertFalse(Files.exists(artifactFileInTrash), "Failed to delete artifact during a force delete operation!"); assertFalse(Files.exists(repositoryDir.resolve(artifactRepositoryPathStr)), "Failed to delete artifact during a force delete operation!"); }
Source:
<code>public void saveTo(ConfigurationSection cs) { Validate.isTrue(isValid(), "Could not save admin entry: " + name + ". Entry not valid!"); cs.set("username", name); cs.set("active", active); cs.set("rank", rank.toString()); cs.set("ips", Lists.newArrayList(ips)); cs.set("last_login", FUtil.dateToString(lastLogin)); cs.set("login_message", loginMessage); <START> cs.set("commandspy_isactive", commandSpyStatus); <END> }</code><technical_language>commandspy</technical_language>

Target:
public void saveTo(ConfigurationSection cs) { Validate.isTrue(isValid(), "Could not save admin entry: " + name + ". Entry not valid!"); cs.set("username", name); cs.set("active", active); cs.set("rank", rank.toString()); cs.set("ips", Lists.newArrayList(ips)); cs.set("last_login", FUtil.dateToString(lastLogin)); cs.set("login_message", loginMessage); cs.set("commandspy", commandSpy); }
Source:
<code>private String getAllDataFromAttribute(final LnClientConnection conn, final int classNumber, final DataObject obisCode, final int attributeValue) throws ProtocolAdapterException, IOException, TimeoutException { if (!obisCode.isByteArray()) { this.throwUnexpectedTypeProtocolAdapterException(); } final byte[] obisCodeByteArray = obisCode.value(); if (obisCodeByteArray.length != OBIS_CODE_BYTE_ARRAY_LENGTH) { this.throwUnexpectedTypeProtocolAdapterException(); } final AttributeAddress attributeAddress = new AttributeAddress(classNumber, this.createObisCode(obisCodeByteArray), attributeValue); <START> LOGGER.info("Retrieving configuration objects data for class id: {}, obis code: {}, attribute id: {}", <END> classNumber, obisCodeByteArray, attributeValue); final List<GetResult> getResultList = conn.get(attributeAddress); final GetResult getResult = getResultList.get(0); LOGGER.info("ResultCode: {}", getResult.resultCode()); return this.dlmsHelper.getDebugInfo(getResult.resultData()); }</code><technical_language>Change log level debug</technical_language>

Target:
private String getAllDataFromAttribute(final LnClientConnection conn, final int classNumber, final DataObject obisCode, final int attributeValue) throws ProtocolAdapterException, IOException, TimeoutException { if (!obisCode.isByteArray()) { this.throwUnexpectedTypeProtocolAdapterException(); } final byte[] obisCodeByteArray = obisCode.value(); if (obisCodeByteArray.length != OBIS_CODE_BYTE_ARRAY_LENGTH) { this.throwUnexpectedTypeProtocolAdapterException(); } final AttributeAddress attributeAddress = new AttributeAddress(classNumber, this.createObisCode(obisCodeByteArray), attributeValue); LOGGER.debug("Retrieving configuration objects data for class id: {}, obis code: {}, attribute id: {}", classNumber, obisCodeByteArray, attributeValue); final List<GetResult> getResultList = conn.get(attributeAddress); final GetResult getResult = getResultList.get(0); LOGGER.debug("ResultCode: {}", getResult.resultCode()); return this.dlmsHelper.getDebugInfo(getResult.resultData()); }
Source:
<code>public PublicKey getPublicKey(String kid, URL url) { if (!checkRemote(url)) { return null; } <START> Map<String, RSAPublicKey> urlKeys = keys.get(url); <END> if (urlKeys == null) { return null; } PublicKey pk = urlKeys.get(kid); if (pk == null) { log.warn("Unknown kid: " + kid); return null; } return pk; }</code><technical_language>this in a synchronized block. checkRemote method refactored slightly returns key if null otherwise</technical_language>

Target:
public PublicKey getPublicKey(String kid, URL url) { Map<String, RSAPublicKey> urlKeys = checkRemote(url); if (urlKeys == null) { return null; } PublicKey pk = urlKeys.get(kid); if (pk == null) { log.warn("Unknown kid: " + kid); return null; } return pk; }
Source:
<code>public boolean isSet(String key) { <START> Attribute a = map.get(key); return a != null ? a.getState() == State.SET : false; <END> }</code><technical_language>replace lines return (getState(key) == State.SET)</technical_language>

Target:
public boolean isSet(String key) { return (getState(key) == State.SET); }
Source:
<code>private void maybeWriteToChannel() { if (firstChunk.isComplete() && readCalled) { while (operationException.get() == null && chunkIndexToBuffer.containsKey(indexOfNextChunkToWriteOut)) { ByteBuffer chunkBuf = chunkIndexToBuffer.remove(indexOfNextChunkToWriteOut); <START> asyncWritableChannel.write(chunkBuf, chunkAsyncWriteCallback); <END> indexOfNextChunkToWriteOut++; } if (operationException.get() != null || numChunksWrittenOut.get() == numChunksTotal) { completeRead(); } } }</code><technical_language>orthogonal question, if this (or other statement really) throw a RuntimeException, catch is behavior? is right behavior</technical_language>

Target:
private void maybeWriteToChannel() { if (firstChunk.isComplete() && readCalled) { while (operationException.get() == null && chunkIndexToBuffer.containsKey(indexOfNextChunkToWriteOut)) { ByteBuffer chunkBuf = chunkIndexToBuffer.remove(indexOfNextChunkToWriteOut); asyncWritableChannel.write(chunkBuf, chunkAsyncWriteCallback); indexOfNextChunkToWriteOut++; } if (operationException.get() != null || numChunksWrittenOut == numChunksTotal) { completeRead(); } } }
Source:
<code>public String getUrl(int requestId, CheckerInfo checkerInfo) { <START> return String.format(URL, checkerInfo.getCurrencyBase().toLowerCase(), checkerInfo.getCurrencyCounter().toLowerCase()); <END> }</code><technical_language>Please getCurrencyBaseLowerCase() getCurrencyCounterLowerCase() checkerInfo</technical_language>

Target:
public String getUrl(int requestId, CheckerInfo checkerInfo) { return String.format(URL, checkerInfo.getCurrencyBaseLowerCase(), checkerInfo.getCurrencyCounterLowerCase()); }
Source:
<code>public static Parameter summaryYears() { return new ParameterBuilder() .name("summaryYears") .description("Select summary data for 1, 5, or all years.") .modelRef(new ModelRef("string")) .parameterType("query") <START> .required(false) <END> .allowableValues(new AllowableListValues(Arrays.asList("1", "5", "all"), "LIST")) .build(); }</code><technical_language>this required ParameterBuilder a default value? (Could add text description default value.)</technical_language>

Target:
public static Parameter summaryYears() { return new ParameterBuilder() .name("summaryYears") .description("Select summary data for 1, 5, or all years. If no summary year is selected, all years is returned by default.") .modelRef(new ModelRef("string")) .parameterType("query") .required(false) .allowableValues(new AllowableListValues(Arrays.asList("1", "5", "all"), "LIST")) .build(); }
Source:
<code>protected Node[] createNodes(AbstractFile t) { Node[] node = new Node[1]; <START> if(t.isDir()){ <END> return node; } else { node[0] = new DataResultFilterNode(new FileNode(t, false), DirectoryTreeTopComponent.findInstance().getExplorerManager()); return node; } }</code><technical_language>This check is necessary, do compute MD5 hashes for directories</technical_language>

Target:
protected Node[] createNodes(AbstractFile t) { Node[] node = new Node[1]; node[0] = new DataResultFilterNode(new FileNode(t, false), DirectoryTreeTopComponent.findInstance().getExplorerManager()); return node; }
Source:
<code><START> public static void tryWipeCache() { <END> try { SQLiteDatabase userDb = CommCareApplication.instance().getUserDbHandle(); if (userDb != null) { SqlStorage.wipeTable(userDb, TABLE_NAME); } String username = CommCareApplication.instance().getSession().getLoggedInUser().getUsername(); setEntityCacheWipedPref(username, CommCareApplication.instance().getCurrentApp().getAppRecord().getVersionNumber()); } catch (SessionUnavailableException e) { e.printStackTrace(); } }</code><technical_language>Is expected behavior of this function wipes cache immediately *or* triggers a setting required cache wipe a time? Right comfortable guaranteed execution of process Session exception path here. chat voice that</technical_language>

Target:
public static void tryWipeCache() { SQLiteDatabase userDb = CommCareApplication.instance().getUserDbHandle(); SqlStorage.wipeTable(userDb, TABLE_NAME); String uuid = CommCareApplication.instance().getSession().getLoggedInUser().getUniqueId(); setEntityCacheWipedPref(uuid, CommCareApplication.instance().getCurrentApp().getAppRecord().getVersionNumber()); }
Source:
<code>public Node toRootNode() { if (zippers.size() == 0) { return commonRoot; } List<AstZipper> curZippers = new ArrayList<>(zippers); while (curZippers.size() > 1) { List<AstZipper> deepestZippers = getDeepestZippers(curZippers); Map<Node, List<AstZipper>> sameParent = zipperWithSameParent(deepestZippers); List<AstZipper> newZippers = new ArrayList<>(); for (Map.Entry<Node, List<AstZipper>> entry : sameParent.entrySet()) { AstZipper newZipper = moveUp(entry.getKey(), entry.getValue()); newZippers.add(newZipper); } curZippers.removeAll(deepestZippers); curZippers.addAll(newZippers); } <START> assertTrue(curZippers.size() == 1, "illegal state"); <END> return curZippers.get(0).toRoot(); }</code><technical_language>assertion message - state precondition message</technical_language>

Target:
public Node toRootNode() { if (zippers.size() == 0) { return commonRoot; } List<AstZipper> curZippers = new ArrayList<>(zippers); while (curZippers.size() > 1) { List<AstZipper> deepestZippers = getDeepestZippers(curZippers); Map<Node, List<AstZipper>> sameParent = zipperWithSameParent(deepestZippers); List<AstZipper> newZippers = new ArrayList<>(); for (Map.Entry<Node, List<AstZipper>> entry : sameParent.entrySet()) { AstZipper newZipper = moveUp(entry.getKey(), entry.getValue()); Optional<AstZipper> zipperToBeReplaced = curZippers.stream().filter(zipper -> zipper.getCurNode() == entry.getKey()).findFirst(); zipperToBeReplaced.ifPresent(curZippers::remove); newZippers.add(newZipper); } curZippers.removeAll(deepestZippers); curZippers.addAll(newZippers); } assertTrue(curZippers.size() == 1, "unexpected state: all zippers must share the same root node"); return curZippers.get(0).toRoot(); }
Source:
<code>public void checkContainers() throws InterruptedException { long minIntervalMs = getMinIntervalMs(); for (String containerPath : getCandidates()) { long startMs = Time.currentElapsedTime(); ByteBuffer path = ByteBuffer.wrap(containerPath.getBytes()); Request request = new Request(null, 0, 0, ZooDefs.OpCode.deleteContainer, path, null); try { <START> LOG.info(String.format("Attempting to delete candidate container: %s", <END> containerPath)); requestProcessor.processRequest(request); } catch (Exception e) { LOG.error(String.format("Could not delete container: %s" , containerPath), e); } long elapsedMs = Time.currentElapsedTime() - startMs; long waitMs = minIntervalMs - elapsedMs; if (waitMs > 0) { Thread.sleep(waitMs); } } }</code><technical_language>this a log message LOG.info("Attempting delete candidate container: {}", container Path);</technical_language>

Target:
public void checkContainers() throws InterruptedException { long minIntervalMs = getMinIntervalMs(); for (String containerPath : getCandidates()) { long startMs = Time.currentElapsedTime(); ByteBuffer path = ByteBuffer.wrap(containerPath.getBytes()); Request request = new Request(null, 0, 0, ZooDefs.OpCode.deleteContainer, path, null); try { LOG.info("Attempting to delete candidate container: {}", containerPath); requestProcessor.processRequest(request); } catch (Exception e) { LOG.error("Could not delete container: {}", containerPath, e); } long elapsedMs = Time.currentElapsedTime() - startMs; long waitMs = minIntervalMs - elapsedMs; if (waitMs > 0) { Thread.sleep(waitMs); } } }
Source:
<code>protected TimeGraphMarkerAxis createTimeGraphMarkerAxis(Composite parent, @NonNull TimeGraphColorScheme colorScheme, @NonNull ITimeDataProvider timeProvider) { TimeGraphMarkerAxisExtension timeGraphMarkerAxis = new TimeGraphMarkerAxisExtension(parent, colorScheme, timeProvider); Tree tree = fTreeViewer.getTree(); tree.addPaintListener(new <START> PaintListener() <END> { @Override public void paintControl(PaintEvent e) { Rectangle bounds = timeGraphMarkerAxis.getAxisBounds(); e.gc.setBackground(timeGraphMarkerAxis.getBackground()); timeGraphMarkerAxis.drawMarkerAxis(bounds, bounds.width, e.gc); } }); tree.addMouseListener(new MouseAdapter() { @Override public void mouseDown(MouseEvent e) { Rectangle bounds = timeGraphMarkerAxis.getAxisBounds(); if (bounds.contains(e.x, e.y)) { timeGraphMarkerAxis.mouseDown(e, bounds, bounds.width); } } }); tree.getHorizontalBar().addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { tree.redraw(); } }); return timeGraphMarkerAxis; }</code><technical_language>lambda</technical_language>

Target:
protected TimeGraphMarkerAxis createTimeGraphMarkerAxis(Composite parent, @NonNull TimeGraphColorScheme colorScheme, @NonNull ITimeDataProvider timeProvider) { TimeGraphMarkerAxisExtension timeGraphMarkerAxis = new TimeGraphMarkerAxisExtension(parent, colorScheme, timeProvider); Tree tree = fTreeViewer.getTree(); tree.addPaintListener(e -> { Rectangle bounds = timeGraphMarkerAxis.getAxisBounds(); e.gc.setBackground(timeGraphMarkerAxis.getBackground()); timeGraphMarkerAxis.drawMarkerAxis(bounds, bounds.width, e.gc); }); tree.addMouseListener(new MouseAdapter() { @Override public void mouseDown(MouseEvent e) { Rectangle bounds = timeGraphMarkerAxis.getAxisBounds(); if (bounds.contains(e.x, e.y)) { timeGraphMarkerAxis.mouseDown(e, bounds, bounds.width); } } }); tree.getHorizontalBar().addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { tree.redraw(); } }); return timeGraphMarkerAxis; }
Source:
<code>void sync(int sourceRepoIndex, int destRepoIndex, AuthenticationInfo subject) throws IOException { LOG.info("Sync started"); NotebookAuthorization auth = NotebookAuthorization.getInstance(); NotebookRepo srcRepo = getRepo(sourceRepoIndex); NotebookRepo dstRepo = getRepo(destRepoIndex); List <NoteInfo> allSrcNotes = srcRepo.list(subject); List <NoteInfo> srcNotes = auth.filterByUser(allSrcNotes, subject); List <NoteInfo> dstNotes = dstRepo.list(subject); Map<String, List<String>> noteIds = notesCheckDiff(srcNotes, srcRepo, dstNotes, dstRepo, subject); List<String> pushNoteIds = noteIds.get(pushKey); List<String> pullNoteIds = noteIds.get(pullKey); List<String> delDstNoteIds = noteIds.get(delDstKey); if (!pushNoteIds.isEmpty()) { LOG.info("Notes with the following IDs will be pushed"); for (String id : pushNoteIds) { LOG.info("ID : " + id); } <START> pushNotes(subject, pushNoteIDs, srcRepo, dstRepo, false); <END> } else { LOG.info("Nothing to push"); } if (!pullNoteIds.isEmpty()) { LOG.info("Notes with the following IDs will be pulled"); for (String id : pullNoteIds) { LOG.info("ID : " + id); } pushNotes(subject, pullNoteIDs, dstRepo, srcRepo, true); } else { LOG.info("Nothing to pull"); } if (!delDstNoteIds.isEmpty()) { LOG.info("Notes with the following IDs will be deleted from dest"); for (String id : delDstNoteIds) { LOG.info("ID : " + id); } deleteNotes(subject, delDstNoteIds, dstRepo); } else { LOG.info("Nothing to delete from dest"); } LOG.info("Sync ended"); }</code><technical_language>pushNoteIDs -> pushNoteIds</technical_language>

Target:
void sync(int sourceRepoIndex, int destRepoIndex, AuthenticationInfo subject) throws IOException { LOG.info("Sync started"); NotebookAuthorization auth = NotebookAuthorization.getInstance(); NotebookRepo srcRepo = getRepo(sourceRepoIndex); NotebookRepo dstRepo = getRepo(destRepoIndex); List <NoteInfo> allSrcNotes = srcRepo.list(subject); List <NoteInfo> srcNotes = auth.filterByUser(allSrcNotes, subject); List <NoteInfo> dstNotes = dstRepo.list(subject); Map<String, List<String>> noteIds = notesCheckDiff(srcNotes, srcRepo, dstNotes, dstRepo, subject); List<String> pushNoteIds = noteIds.get(pushKey); List<String> pullNoteIds = noteIds.get(pullKey); List<String> delDstNoteIds = noteIds.get(delDstKey); if (!pushNoteIds.isEmpty()) { LOG.info("Notes with the following IDs will be pushed"); for (String id : pushNoteIds) { LOG.info("ID : " + id); } pushNotes(subject, pushNoteIds, srcRepo, dstRepo, false); } else { LOG.info("Nothing to push"); } if (!pullNoteIds.isEmpty()) { LOG.info("Notes with the following IDs will be pulled"); for (String id : pullNoteIds) { LOG.info("ID : " + id); } pushNotes(subject, pullNoteIds, dstRepo, srcRepo, true); } else { LOG.info("Nothing to pull"); } if (!delDstNoteIds.isEmpty()) { LOG.info("Notes with the following IDs will be deleted from dest"); for (String id : delDstNoteIds) { LOG.info("ID : " + id); } deleteNotes(subject, delDstNoteIds, dstRepo); } else { LOG.info("Nothing to delete from dest"); } LOG.info("Sync ended"); }
Source:
<code>public TrackingContext(String clientCorrelationID) { if ((clientCorrelationID.length() > MAX_CLIENT_CORRELATION_ID_LENGTH) || (!clientCorrelationID.matches(CLIENT_CORRELATION_ID_PATTERN))) { this.clientCorrelationID = DEFAULT_FS_AZURE_CLIENT_CORRELATION_ID; LOG.debug("Invalid config provided; correlation id not included in header."); } else if (clientCorrelationID.length() > 0) { this.clientCorrelationID = clientCorrelationID + ":"; <START> LOG.debug("Client correlation id has been validated and set successfully."); <END> } else { this.clientCorrelationID = DEFAULT_FS_AZURE_CLIENT_CORRELATION_ID; LOG.debug( "Correlation id not provided in config, hence excluded from header."); } }</code><technical_language>Log incur a perf cost log for failure cases. Success case log omitted</technical_language>

Target:
public TrackingContext(String clientCorrelationID) { if (clientCorrelationID == null) clientCorrelationID = EMPTY_STRING; if ((clientCorrelationID.length() > MAX_CLIENT_CORRELATION_ID_LENGTH) || (!clientCorrelationID.matches(CLIENT_CORRELATION_ID_PATTERN))) { this.clientCorrelationID = EMPTY_STRING; LOG.debug("Invalid config provided; correlation id not included in header."); } else if (clientCorrelationID.length() > 0) { this.clientCorrelationID = clientCorrelationID + ":"; } else { this.clientCorrelationID = EMPTY_STRING; } }
Source:
<code>public static boolean start() throws IOException, InterruptedException, NoSuchFieldException, IllegalAccessException { if (!new File(getPathSpec()).exists() || !new File(getPathFixture()).exists()) { return false; } if (process != null && isAlive(process)) { System.out.println(String.format("stripe-mock is already running, port = %s", port)); return true; } else { process = null; port = null; pid = null; } ProcessBuilder processBuilder = new ProcessBuilder() .command( "stripe-mock", "-http-port", "0", "-spec", getPathSpec(), "-fixtures", getPathFixture(), <START> "-strict-version-check" <END> ); try { process = processBuilder.start(); } catch (IOException e) { System.out.println(String.format( "Error while starting stripe-mock, fixtures = %s and %s, error message = %s", getPathSpec(), getPathFixture(), e.getMessage() )); System.exit(1); } pid = getProcessId(process); if (isAlive(process)) { System.out.println(String.format("Started stripe-mock, PID = %s", pid)); System.out.println("Finding port bound to stripe-mock..."); port = detectBoundPort(process); if (port == null) { System.out.println(String.format("Unable to find port for stripe-mock, PID = %s", pid)); System.exit(1); } } else { System.out.println( String.format("stripe-mock terminated early, exit value = %d", process.exitValue())); System.exit(1); } return true; }</code><technical_language>Flagging do in other libs</technical_language>

Target:
public static boolean start() throws IOException, InterruptedException, NoSuchFieldException, IllegalAccessException { if (!new File(getPathSpec()).exists() || !new File(getPathFixture()).exists()) { return false; } if (process != null && isAlive(process)) { System.out.println(String.format("stripe-mock is already running, port = %s", port)); return true; } else { process = null; port = null; pid = null; } ProcessBuilder processBuilder = new ProcessBuilder() .command( "stripe-mock", "-http-port", "0", "-spec", getPathSpec(), "-fixtures", getPathFixture() ); try { process = processBuilder.start(); } catch (IOException e) { System.out.println(String.format( "Error while starting stripe-mock, fixtures = %s and %s, error message = %s", getPathSpec(), getPathFixture(), e.getMessage() )); System.exit(1); } pid = getProcessId(process); if (isAlive(process)) { System.out.println(String.format("Started stripe-mock, PID = %s", pid)); System.out.println("Finding port bound to stripe-mock..."); port = detectBoundPort(process); if (port == null) { System.out.println(String.format("Unable to find port for stripe-mock, PID = %s", pid)); System.exit(1); } } else { System.out.println( String.format("stripe-mock terminated early, exit value = %d", process.exitValue())); System.exit(1); } return true; }
Source:
<code>private static void clip3primeEndsTo5primeEnds(final SAMRecord pos, final SAMRecord neg, final boolean hardClipReads, final boolean useUnclippedEnds) { final int negEnd = useUnclippedEnds? neg.getUnclippedEnd() : neg.getEnd(); final int posStart = useUnclippedEnds? pos.getUnclippedStart() : pos.getStart(); final int posLastUnclipped = getReadPositionAtReferencePositionIgnoreSoftClips(pos, negEnd); int negFirstBaseToClip = getReadPositionAtReferencePositionIgnoreSoftClips(neg, posStart - 1); negFirstBaseToClip = negFirstBaseToClip > 0 ? (neg.getReadLength() + 1) - negFirstBaseToClip : 0; if(posLastUnclipped > 0 && posLastUnclipped < pos.getReadLength()) { clip3PrimeEndOfRead(pos, posLastUnclipped + 1, hardClipReads); } if(negFirstBaseToClip > 0) { clip3PrimeEndOfRead(neg, negFirstBaseToClip, hardClipReads); } }</code><technical_language>mix 3' 5' here? I confused</technical_language>

Target:
private static void clip3primeEndsTo5primeEnds(final SAMRecord pos, final SAMRecord neg, final boolean hardClipReads, final boolean useUnclippedEnds) { final int negEnd = useUnclippedEnds? neg.getUnclippedEnd() : neg.getEnd(); final int posStart = useUnclippedEnds? pos.getUnclippedStart() : pos.getStart(); final int pos3PrimeMostUnclipped = getReadPositionAtReferencePositionIgnoreSoftClips(pos, negEnd); if (pos3PrimeMostUnclipped > 0 && pos3PrimeMostUnclipped < pos.getReadLength()) { final int pos5PrimeMostClipped = pos3PrimeMostUnclipped + 1; clip3PrimeEndOfRead(pos, pos5PrimeMostClipped, hardClipReads); } final int neg5PrimeMostBaseToClipPositionFromStart = getReadPositionAtReferencePositionIgnoreSoftClips(neg, posStart - 1); final int negFirstBaseFrom5PrimeEndToClip = neg5PrimeMostBaseToClipPositionFromStart > 0 ? (neg.getReadLength() + 1) - neg5PrimeMostBaseToClipPositionFromStart : 0; if (negFirstBaseFrom5PrimeEndToClip > 0) { clip3PrimeEndOfRead(neg, negFirstBaseFrom5PrimeEndToClip, hardClipReads); } }
Source:
<code>protected void handleDemandLoadException(Resource resource, IOException exception) throws RuntimeException { try { super.handleDemandLoadException(resource, exception); <START> } catch (Exception e) { <END> } }</code><technical_language>catch "org.eclipse.emf.common.util.WrappedException" instead of "any Exceptions". this sufficient</technical_language>

Target:
protected void handleDemandLoadException(Resource resource, IOException exception) throws RuntimeException { try { super.handleDemandLoadException(resource, exception); } catch (RuntimeException e) { } }
Source:
<code>public BookmarkEventRequest(ISegmentStore<ISegment> bookmarks) { super(bookmarks); <START> fCategories.put(CATEGORY, fDefaultColors.get(0)); <END> }</code><technical_language>i remove this line here, marker show</technical_language>

Target:
public BookmarkEventRequest(ISegmentStore<ISegment> bookmarks) { super(bookmarks); fCategories.put(LOG_CATEGORY, new RGBA(0, 0, 0, 100)); fCategories.put(STDOUT_CATEGORY, new RGBA(90, 90, 90, 70)); }
Source:
<code>protected Control createDialogArea(Composite parent) { parent.getShell().setText(TITLE); Composite composite = new Composite(parent, SWT.FULL_SELECTION); GridLayout layout = new GridLayout(1, false); composite.setLayout(layout); createViewer(composite); composite.pack(); <START> return composite; <END> }</code><technical_language>good user resize dialog box. If do set a minimum size</technical_language>

Target:
protected Control createDialogArea(Composite parent) { getShell().setText(TITLE); Composite composite = (Composite) super.createDialogArea(parent); createViewer(composite); return composite; }
Source:
<code>public void onResume() { super.onResume(); if (controller.needRefreshBookmarkedPictures()) { gridView.setVisibility(GONE); if (gridAdapter != null) { gridAdapter.clear(); <START> ((CategoryImagesCallback) getContext()).viewPagerNotifyDataSetChanged(); <END> } initList(); } }</code><technical_language>Instead of casting context CategoryImagesCallback, consider passing callback fragment</technical_language>

Target:
public void onResume() { super.onResume(); if (controller.needRefreshBookmarkedPictures()) { gridView.setVisibility(GONE); if (gridAdapter != null) { gridAdapter.clear(); ((BookmarksActivity) getContext()).viewPagerNotifyDataSetChanged(); } initList(); } }
Source:
<code>public List<String> getChildrenIds() { <START> return session.getAllChildrenIds(id); <END> }</code><technical_language>Ok I reread final code I name getChildrenIds, new method "exclude" args is distinct enough. changing mind times. applies other getAll* methods renamed..</technical_language>

Target:
public List<String> getChildrenIds() { return session.getChildrenIds(id); }
Source:
<code>private static Set<String> getRootQualifiers(ResourceTypes resourceTypes) { return resourceTypes.getRoots().stream() .map(ResourceType::getQualifier) <START> .filter(q -> !DEPRECATED_QUALIFIERS.contains(q)) <END> .collect(Collectors.toCollection(TreeSet::new)); }</code><technical_language>I LIBRARY more</technical_language>

Target:
private static Set<String> getRootQualifiers(ResourceTypes resourceTypes) { return resourceTypes.getRoots().stream() .map(ResourceType::getQualifier) .collect(Collectors.toCollection(TreeSet::new)); }
Source:
<code>public AutoCloseableLock lock(ByteArrayWrapper key) throws InterruptedException { if (key == null) { throw new IllegalArgumentException("key cannot be null"); } KeyHashIdentifier lockKey = new KeyHashIdentifier(key.toBytes()); Lock lock = new ReentrantLock(); Lock oldLock = weakReferencesTolocks.putIfAbsent(lockKey, lock); if (oldLock != null) { lock = oldLock; <START> lockKey = getReferenceToLockKey(lockKey); <END> } if (!lock.tryLock(timeoutMS, TimeUnit.MILLISECONDS)) { throw new TimeoutException("Couldn't get lock for " + lockKey.toString()); } return new AutoCloseableLock(lockKey, lock); }</code><technical_language>I understand this logic. If weakReferencesTolocks.putIfAbsent(lockKey, lock) returns a value, a reference lockKey. I mistaken this</technical_language>

Target:
public AutoCloseableLock lock(ByteArrayWrapper key) throws InterruptedException { if (key == null) { throw new IllegalArgumentException("key cannot be null"); } KeyHashIdentifier lockKey = new KeyHashIdentifier(key.toBytes()); KeyHashIdentifier referencedKey = lockKey; Lock lock = new ReentrantLock(); do { Lock oldLock = weakReferencesTolocks.putIfAbsent(lockKey, lock); if (oldLock != null) { lock = oldLock; referencedKey = getReferenceToLockKey(lockKey); } } while (referencedKey == null); if (!lock.tryLock(timeoutMS, TimeUnit.MILLISECONDS)) { throw new TimeoutException("Couldn't get lock for " + lockKey.toString()); } return new AutoCloseableLock(referencedKey, lock); }
Source:
<code>public static void extractTarFile(String tarFileName, String targetFolder) throws Exception { Exception exception = null; byte[] buf = new byte[8192]; TarFile tarFile = null; try { tarFile = new TarFile(tarFileName); Enumeration<TarEntry> enumeration = tarFile.entries(); while (enumeration.hasMoreElements()) { TarEntry entry = enumeration.nextElement(); File file = new File(targetFolder, entry.getName()); if (entry.getFileType() == TarEntry.DIRECTORY) { if (!file.exists()) { file.mkdir(); } } else { if (!file.getParentFile().exists()) { file.getParentFile().mkdirs(); } InputStream zin = tarFile.getInputStream(entry); OutputStream fout = new FileOutputStream(file); File dir = file.getParentFile(); if (dir.isDirectory() && !dir.exists()) { dir.mkdirs(); } try { while (true) { int bytesRead = zin.read(buf); if (bytesRead == -1) { break; } fout.write(buf, 0, bytesRead); } fout.flush(); } catch (Exception e) { exception = e; return; <START> } finally { <END> zin.close(); fout.close(); } } } } catch (Exception e) { exception = e; } finally { try { tarFile.close(); } catch (IOException e) { } if (exception != null) { throw exception; } } }</code><technical_language>"try - catch" closure for zin fout</technical_language>

Target:
public static void extractTarFile(String tarFileName, String targetFolder) throws Exception { Exception exception = null; byte[] buf = new byte[8192]; TarFile tarFile = null; try { tarFile = new TarFile(tarFileName); Enumeration<TarEntry> enumeration = tarFile.entries(); while (enumeration.hasMoreElements()) { TarEntry entry = enumeration.nextElement(); File file = new File(targetFolder, entry.getName()); if (entry.getFileType() == TarEntry.DIRECTORY) { if (!file.exists()) { file.mkdir(); } } else { if (!file.getParentFile().exists()) { file.getParentFile().mkdirs(); } InputStream zin = tarFile.getInputStream(entry); OutputStream fout = new FileOutputStream(file); File dir = file.getParentFile(); if (dir.isDirectory() && !dir.exists()) { dir.mkdirs(); } try { while (true) { int bytesRead = zin.read(buf); if (bytesRead == -1) { break; } fout.write(buf, 0, bytesRead); } fout.flush(); } catch (Exception e) { exception = e; return; } finally { if (zin != null) { try { zin.close(); } catch (Exception e) { } } if (fout != null) { try { fout.close(); } catch (Exception e) { } } } } } } catch (Exception e) { exception = e; } finally { if (tarFile != null) { try { tarFile.close(); } catch (IOException e) { } } if (exception != null) { throw exception; } } }
Source:
<code>public void testGetPartitionSplitsTableNotReadablePartition() throws Exception { try (Transaction transaction = newTransaction()) { ConnectorMetadata metadata = transaction.getMetadata(); ConnectorSession session = newSession(); ConnectorTableHandle tableHandle = getTableHandle(metadata, tableNotReadable); assertNotNull(tableHandle); ColumnHandle dsColumn = metadata.getColumnHandles(session, tableHandle).get("ds"); assertNotNull(dsColumn); Domain domain = Domain.singleValue(createUnboundedVarcharType(), utf8Slice("2012-12-30")); TupleDomain<ColumnHandle> tupleDomain = TupleDomain.withColumnDomains(ImmutableMap.of(dsColumn, domain)); List<ConnectorTableLayoutResult> tableLayoutResults = metadata.getTableLayouts(session, tableHandle, new Constraint<>(tupleDomain, bindings -> true), Optional.empty()); try { getSplitCount(splitManager.getSplits(transaction.getTransactionHandle(), session, getOnlyElement(tableLayoutResults).getTableLayout().getHandle())); fail("Expected PartitionOfflineException"); } catch (HiveNotReadableException e) { <START> assertEquals(e.getTableName(), tableNotReadable); <END> assertEquals(e.getPartition(), Optional.empty()); } } }</code><technical_language>Validate error message</technical_language>

Target:
public void testGetPartitionSplitsTableNotReadablePartition() throws Exception { try (Transaction transaction = newTransaction()) { ConnectorMetadata metadata = transaction.getMetadata(); ConnectorSession session = newSession(); ConnectorTableHandle tableHandle = getTableHandle(metadata, tableNotReadable); assertNotNull(tableHandle); ColumnHandle dsColumn = metadata.getColumnHandles(session, tableHandle).get("ds"); assertNotNull(dsColumn); Domain domain = Domain.singleValue(createUnboundedVarcharType(), utf8Slice("2012-12-30")); TupleDomain<ColumnHandle> tupleDomain = TupleDomain.withColumnDomains(ImmutableMap.of(dsColumn, domain)); List<ConnectorTableLayoutResult> tableLayoutResults = metadata.getTableLayouts(session, tableHandle, new Constraint<>(tupleDomain, bindings -> true), Optional.empty()); try { getSplitCount(splitManager.getSplits(transaction.getTransactionHandle(), session, getOnlyElement(tableLayoutResults).getTableLayout().getHandle(), UNGROUPED_SCHEDULING)); fail("Expected HiveNotReadableException"); } catch (HiveNotReadableException e) { assertEquals(e.getMessage(), "Table 'default.presto_test_not_readable' is not readable: reason for not readable"); assertEquals(e.getTableName(), tableNotReadable); assertEquals(e.getPartition(), Optional.empty()); } } }
Source:
<code>public boolean isDiscontinued(Date checkDate) { if (dateStopped != null && autoExpireDate != null && dateStopped.after(autoExpireDate)) { throw new APIException("Order.error.invalidDateStoppedAndAutoExpireDate", (Object[]) null); } if (isVoided()) { return false; } if (checkDate == null) { checkDate = new Date(); } <START> if (dateActivated == null || !isActivated(checkDate) || dateStopped == null) { <END> return false; } return checkDate.after(dateStopped); }</code><technical_language>isActivated() checks if dateActivated == null, need check if is null</technical_language>

Target:
public boolean isDiscontinued(Date checkDate) { if (dateStopped != null && autoExpireDate != null && dateStopped.after(autoExpireDate)) { throw new APIException("Order.error.invalidDateStoppedAndAutoExpireDate", (Object[]) null); } if (isVoided()) { return false; } if (checkDate == null) { checkDate = new Date(); } if (!isActivated(checkDate) || dateStopped == null) { return false; } return checkDate.after(dateStopped); }
Source:
<code>private void putLightOnOff(String message) { coapClient.setURI( "coap://" + COAP_SERVER_IP_ADDRESS + ":" + COAP_SERVER_PORT + "/InternetOfTiny/actuators/actuator1"); StringBuilder coapLightSwitch = new StringBuilder(); <START> if (message.compareTo("ON") == 0) { <END> coapLightSwitch.append(",1,pp,100,"); } else if (message.compareTo("OFF") == 0) { coapLightSwitch.append(",1,pp,0,"); } CoapResponse clientResponse = coapClient.put(coapLightSwitch.toString(), TEXT_PLAIN); logger.debug(clientResponse.advanced().getSource().toString()); }</code><technical_language>message.equals("ON")</technical_language>

Target:
private void putLightOnOff(String message) { coapClient .setURI("coap://" + coapServerIpAddress + ":" + coapServerPort + "/InternetOfTiny/actuators/actuator1"); String coapLightSwitch; if (message.equals("ON")) { coapLightSwitch = new String(",1,pp,100,"); } else if (message.equals("OFF")) { coapLightSwitch = new String(",1,pp,0,"); } else { coapLightSwitch = new String(""); } if (!coapLightSwitch.isEmpty()) { CoapResponse clientResponse = coapClient.put(coapLightSwitch, TEXT_PLAIN); logger.debug(clientResponse.advanced().getSource().toString()); } }
Source:
<code>public static String strictSanitize(String original) { <START> return strictSanitizer.apply(original); <END> }</code><technical_language>return STRICT_SANITIZER.sanitize(original); This result benefit of needing extra static variable, reducing applications footprint resulting byte code more efficient indirection invoke underlying sanitize() method. criticism is applicable of CMS_SANITIZER.sanitize(origin)</technical_language>

Target:
public static String strictSanitize(String original) { return STRICT_SANITIZER.sanitize(original); }
Source:
<code>public String get(final String key) { String language = (String) (null != request && null != request.getSession()? <START> request.getSession().getAttribute(com.dotmarketing.util.WebKeys.HTMLPAGE_LANGUAGE):null); <END> if (language == null) { language = String.valueOf(langAPI.getDefaultLanguage().getId()); } return get(key, language); }</code><technical_language>LanguageWebApi.getLanguage(request)</technical_language>

Target:
public String get(final String key) { Language foundLanguage = WebAPILocator.getLanguageWebAPI().getLanguage(request); return get(key, String.valueOf(foundLanguage.getId())); }
Source:
<code>private boolean isVmUsingScsiReservation() { List<VmDevice> devices <START> = getDbFacade().getVmDeviceDao().getVmDeviceByVmIdAndType(getVmId(), <END> VmDeviceGeneralType.DISK); for (VmDevice device : devices) { if (device.getIsPlugged() && device.isUsingScsiReservation()) { return true; } } return false; }</code><technical_language>getVmDeviceDao() instead of getDbFacade().getVmDeviceDao()</technical_language>

Target:
private boolean isVmUsingScsiReservation() { List<VmDevice> devices = getVmDeviceDao().getVmDeviceByVmIdAndType(getVmId(), VmDeviceGeneralType.DISK); for (VmDevice device : devices) { if (device.getIsPlugged() && device.isUsingScsiReservation()) { return true; } } return false; }
Source:
<code>public Boolean run() { <START> if (!isAdministrator()) { <END> return Boolean.FALSE; } long start = System.currentTimeMillis(); WorkManager workManager = Framework.getService(WorkManager.class); AuditLogger auditLogger = Framework.getService(AuditLogger.class); boolean waitForAuditStoredInEs = waitForAudit && Framework.isBooleanPropertyTrue(AUDIT_ELASTICSEARCH_ENABLED); try { if (!workManager.awaitCompletion(timeout, TimeUnit.SECONDS)) { throw new TimeoutException(); } if (waitForAuditStoredInEs && !auditLogger.await(computeRemainingTime(start), TimeUnit.SECONDS)) { throw new TimeoutException(); } esa.prepareWaitForIndexing().get(computeRemainingTime(start), TimeUnit.SECONDS); } catch (TimeoutException | InterruptedException | ExecutionException e) { if (ExceptionUtils.hasInterruptedCause(e)) { Thread.currentThread().interrupt(); } return Boolean.FALSE; } if (refresh) { esa.refreshRepositoryIndex(repo.getRepositoryName()); if (waitForAuditStoredInEs) { esa.getClient().refresh(esa.getIndexNameForType(ElasticSearchConstants.ENTRY_TYPE)); } } return Boolean.TRUE; }</code><technical_language>Usually, this is done XML contribution, for Elasticsearch.Index in <LINK_0></technical_language>

Target:
public Boolean run() { long start = System.currentTimeMillis(); WorkManager workManager = Framework.getService(WorkManager.class); AuditLogger auditLogger = Framework.getService(AuditLogger.class); boolean waitForAuditStoredInEs = waitForAudit && Framework.isBooleanPropertyTrue(AUDIT_ELASTICSEARCH_ENABLED); try { if (!workManager.awaitCompletion(timeout, TimeUnit.SECONDS)) { throw new TimeoutException(); } if (waitForAuditStoredInEs && !auditLogger.await(computeRemainingTime(start), TimeUnit.SECONDS)) { throw new TimeoutException(); } esa.prepareWaitForIndexing().get(computeRemainingTime(start), TimeUnit.SECONDS); } catch (TimeoutException | InterruptedException | ExecutionException e) { if (ExceptionUtils.hasInterruptedCause(e)) { Thread.currentThread().interrupt(); } return Boolean.FALSE; } if (refresh) { esa.refreshRepositoryIndex(repo.getRepositoryName()); if (waitForAuditStoredInEs) { esa.getClient().refresh(esa.getIndexNameForType(ElasticSearchConstants.ENTRY_TYPE)); } } return Boolean.TRUE; }
Source:
<code>static public void println() { synchronized (histories) { if (skipReport()) return; System.out.print("Statistics: "); for (Map.Entry<Tag, History> entry : histories.entrySet()) { Tag tag = entry.getKey(); History history = entry.getValue(); <START> System.out.print(tag + "Cnt " + history.cnt + " "); <END> System.out.print(tag + "Sum " + history.total + " "); System.out.print(tag + "Avg " + (float) history.total / history.cnt + " "); } System.out.println(); } }</code><technical_language>logging here, a level (TRACE DEBUG). If disabled statistics even</technical_language>

Target:
static public void println() { if(!LOG.isDebugEnabled()) return; synchronized (histories) { if (skipReport()) return; StringBuffer tobelogged = new StringBuffer("Statistics: "); for (Map.Entry<Tag, History> entry : histories.entrySet()) { Tag tag = entry.getKey(); History history = entry.getValue(); tobelogged.append(tag + "Cnt " + history.cnt + " "); tobelogged.append(tag + "Sum " + history.total + " "); tobelogged.append(tag + "Avg " + (float) history.total / history.cnt + " "); } LOG.debug(tobelogged); } }
Source:
<code>public void testVcfSorted(final boolean disableSort) { final File liftOutputFile = new File(OUTPUT_DATA_PATH, "lift-delete-me.vcf"); final File rejectOutputFile = new File(OUTPUT_DATA_PATH, "reject-delete-me.vcf"); final File input = new File(TEST_DATA_PATH, "testLiftoverBiallelicIndels.vcf"); liftOutputFile.deleteOnExit(); rejectOutputFile.deleteOnExit(); final String[] args = new String[]{ "INPUT=" + input.getAbsolutePath(), "OUTPUT=" + liftOutputFile.getAbsolutePath(), "REJECT=" + rejectOutputFile.getAbsolutePath(), "CHAIN=" + CHAIN_FILE, "REFERENCE_SEQUENCE=" + REFERENCE_FILE, "CREATE_INDEX=" + (!disableSort), "DISABLE_SORT=" + disableSort }; Assert.assertEquals(runPicardCommandLine(args), 0); try (final VCFFileReader liftReader = new VCFFileReader(liftOutputFile, !disableSort)) { <START> final VCFHeader header = liftReader.getFileHeader(); <END> Assert.assertNotNull(header.getOtherHeaderLine("reference")); try (final CloseableIterator<VariantContext> iter = liftReader.iterator()) { Assert.assertEquals(iter.stream().count(), 5L); } } }</code><technical_language>please spaces, tabs indent</technical_language>

Target:
public void testVcfSorted(final boolean disableSort) { final File liftOutputFile = new File(OUTPUT_DATA_PATH, "lift-delete-me.vcf"); final File rejectOutputFile = new File(OUTPUT_DATA_PATH, "reject-delete-me.vcf"); final File input = new File(TEST_DATA_PATH, "testLiftoverBiallelicIndels.vcf"); liftOutputFile.deleteOnExit(); rejectOutputFile.deleteOnExit(); final String[] args = new String[]{ "INPUT=" + input.getAbsolutePath(), "OUTPUT=" + liftOutputFile.getAbsolutePath(), "REJECT=" + rejectOutputFile.getAbsolutePath(), "CHAIN=" + CHAIN_FILE, "REFERENCE_SEQUENCE=" + REFERENCE_FILE, "CREATE_INDEX=" + (!disableSort), "DISABLE_SORT=" + disableSort }; Assert.assertEquals(runPicardCommandLine(args), 0); try (final VCFFileReader inputReader = new VCFFileReader(input, false)) { final VCFHeader header = inputReader.getFileHeader(); Assert.assertNull(header.getOtherHeaderLine("reference")); } try (final VCFFileReader liftReader = new VCFFileReader(liftOutputFile, !disableSort)) { final VCFHeader header = liftReader.getFileHeader(); Assert.assertNotNull(header.getOtherHeaderLine("reference")); try (final CloseableIterator<VariantContext> iter = liftReader.iterator()) { Assert.assertEquals(iter.stream().count(), 5L); } } }