auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void check() throws Exception { startGrids(NODES_COUNT); grid(0).cluster().active(true); grid(0).createCache(DEFAULT_CACHE_NAME); runSql("CREATE TABLE PUBLIC.FOO (A INT, B INT, C INT PRIMARY KEY) WITH \"CACHE_NAME=FOO\""); List<String> createIndexQueries = Arrays.asList( "CREATE INDEX ON PUBLIC.FOO (a)", "CREATE INDEX ON PUBLIC.FOO (b)", "CREATE INDEX ON PUBLIC.FOO (c)", "CREATE INDEX \"idx\" ON PUBLIC.FOO (a)", "CREATE INDEX \"IDX\" ON PUBLIC.FOO (a)", "CREATE INDEX \"iDx\" ON PUBLIC.FOO (a)", "CREATE INDEX \"\" ON PUBLIC.FOO (a)", "CREATE INDEX \" \" ON PUBLIC.FOO (a)" ); for (String sql : createIndexQueries) runSql(sql); List<String> expIndexNames = Arrays.asList( "foo_a_asc_idx", "foo_b_asc_idx", "foo_c_asc_idx", "idx", "IDX", "iDx", "", " " ); Collections.sort(expIndexNames); checkIndexes(expIndexNames); for (String sql : createIndexQueries) { GridTestUtils.assertThrows( log, () -> { runSql(sql); return null; }, useJdbc ? SQLException.class : IgniteSQLException.class, "Index already exists" ); } checkIndexes(expIndexNames); stopAllGrids(); startGrids(NODES_COUNT); checkIndexes(expIndexNames); }

Target:
private void check() throws Exception { startGrids(NODES_COUNT); grid(0).cluster().active(true); grid(0).createCache(DEFAULT_CACHE_NAME); runSql("CREATE TABLE PUBLIC.FOO (A INT, B INT, C INT PRIMARY KEY) WITH \"CACHE_NAME=FOO\""); List<String> createIndexQueries = Arrays.asList( "CREATE INDEX ON PUBLIC.FOO (a)", "CREATE INDEX ON PUBLIC.FOO (b)", "CREATE INDEX ON PUBLIC.FOO (c)", "CREATE INDEX \"idx\" ON PUBLIC.FOO (a)", "CREATE INDEX \"IDX\" ON PUBLIC.FOO (a)", "CREATE INDEX \"iDx\" ON PUBLIC.FOO (a)", "CREATE INDEX \"\" ON PUBLIC.FOO (a)", "CREATE INDEX \" \" ON PUBLIC.FOO (a)" ); for (String sql : createIndexQueries) runSql(sql); List<String> expIndexNames = Arrays.asList( "foo_a_asc_idx", "foo_b_asc_idx", "foo_c_asc_idx", "idx", "IDX", "iDx", "", " " ); Collections.sort(expIndexNames); checkIndexes(expIndexNames); for (String sql : createIndexQueries) { Throwable e = GridTestUtils.assertThrows( log, () -> { runSql(sql); return null; }, useJdbc ? SQLException.class : IgniteSQLException.class, "Index already exists" ); int errorCode = useJdbc ? ((SQLException)e).getErrorCode() : ((IgniteSQLException)e).statusCode(); assertEquals(IgniteQueryErrorCode.INDEX_ALREADY_EXISTS, errorCode); } checkIndexes(expIndexNames); stopAllGrids(); startGrids(NODES_COUNT); checkIndexes(expIndexNames); }
Source:
private PsiDirectory getViewsDirectory(Project project, PsiFile psiFile) { String basePath = project.getBasePath(); PsiDirectory directory = psiFile.getContainingDirectory(); while(directory != null && !directory.getVirtualFile().getPath().equals(basePath)) { if(directory.getName().equals("views") || directory.getName().equals("templates")) { return directory; } if(directory.getParentDirectory() != null) { directory = directory.getParentDirectory(); } else { break; } } for(TemplatePath templatePath : ViewCollector.getPaths(project)) { final VirtualFile templateDir = VfsUtil.findRelativeFile(templatePath.getPath(), project.getBaseDir()); if(templateDir != null) { return PsiManager.getInstance(psiFile.getProject()).findDirectory(templateDir); } } return directory; }

Target:
private TargetViewFolder getViewsDirectory(Project project, PsiFile psiFile) { PsiDirectory firstExistingTemplatePath = null; String firstExistingTemplatePathNamespace = null; for(TemplatePath templatePath : ViewCollector.getPaths(project)) { final VirtualFile templateDir = templatePath.getRelativePath(project); if(templateDir != null) { PsiDirectory psiDirectory = PsiManager.getInstance(project).findDirectory(templateDir); if(psiFile.getVirtualFile().getPath().startsWith(templateDir.getPath() + "/")) { return new TargetViewFolder(psiDirectory, templatePath.getNamespace()); } if(firstExistingTemplatePath == null) { firstExistingTemplatePath = psiDirectory; firstExistingTemplatePathNamespace = templatePath.getNamespace(); } } } if(firstExistingTemplatePath != null) { return new TargetViewFolder(firstExistingTemplatePath, firstExistingTemplatePathNamespace); } return new TargetViewFolder(PsiManager.getInstance(project).findDirectory(project.getBaseDir()), null); }
Source:
public Collection<String> entityInitials() { return ImmutableList.of("Q", "P"); }

Target:
public Collection<String> entityInitials() { return WIKIBASE_INITIALS; }
Source:
private void sortAgenciesWithNoReportsToAgency(List<RassXmlAgencyEntry> agencies, AgenciesSortHelper agencySortHelper) { for (RassXmlAgencyEntry entry : agencies) { if (StringUtils.isBlank(entry.getReportsToAgencyNumber())) { agencySortHelper.agencyNumberInSortedList.add(entry.getNumber()); agencySortHelper.sortedAgencies.add(entry); } else { agencySortHelper.leftOverAgencies.add(entry); } } LOG.debug("sortAgenciesWithNoReportsToAgency, number of angencies without reports to agencies: " + agencySortHelper.sortedAgencies.size()); }

Target:
private void sortAgenciesWithNoReportsToAgency(List<RassXmlAgencyEntry> agencies, AgenciesSortHelper agencySortHelper) { for (RassXmlAgencyEntry entry : agencies) { if (StringUtils.isBlank(entry.getReportsToAgencyNumber())) { agencySortHelper.agencyNumberInSortedList.add(entry.getNumber()); agencySortHelper.sortedAgencies.add(entry); } else { agencySortHelper.unsortedAgencies.add(entry); } } LOG.debug("sortAgenciesWithNoReportsToAgency, number of angencies without reports to agencies: " + agencySortHelper.sortedAgencies.size()); }
Source:
public HeaderField(String caption) { super(caption); label = new Header(""); }

Target:
public HeaderField(String caption) { super(caption); super.setLabel(new Header("")); }
Source:
public final void run() { if (running) { return; } if (!Bukkit.isPrimaryThread()) { return; } if (!SlimefunPlugin.isEnabled()) { return; } final ArrayBlockingQueue<Runnable> syncTasks = new ArrayBlockingQueue<>(32); Bukkit.getScheduler().runTaskAsynchronously( SlimefunPlugin.instance(), () -> this.tick(syncTasks) ); processSyncTasks(syncTasks); }

Target:
public final void run() { if (running) { processSyncTasks(); return; } if (!Bukkit.isPrimaryThread()) { return; } new Thread(() -> this.tick(), "Slimefun Async Ticker Thread").start(); processSyncTasks(); }
Source:
public void restoreSnapshot(TeamSnapshot s) { synchronized (coreLock) { if (s.getId() != getId()) { return; } boolean ended = s.getFieldingAdvancePending(); set(Value.FIELDING_ADVANCE_PENDING, ended); updateTeamJams(); if (scoreBoard.isInJam()) { set(Value.CALLOFF, false); set(Value.INJURY, false); } } }

Target:
public void restoreSnapshot(TeamSnapshot s) { synchronized (coreLock) { if (s.getId() != getId()) { return; } set(Value.FIELDING_ADVANCE_PENDING, s.getFieldingAdvancePending()); updateTeamJams(); if (scoreBoard.isInJam()) { set(Value.CALLOFF, false); set(Value.INJURY, false); } } }
Source:
private void updatePrimaryButtonEnabledStatus() { View view = getView(); if (view != null) { String currentPassword = mPasswordInput.getEditText().getText().toString(); getPrimaryButton().setEnabled(!currentPassword.trim().isEmpty()); } }

Target:
private void updatePrimaryButtonEnabledStatus() { String currentPassword = mPasswordInput.getEditText().getText().toString(); getPrimaryButton().setEnabled(!currentPassword.trim().isEmpty()); }
Source:
private static boolean isAddressValid(InetAddress addr) { ServerSocket ss; try { ss = new ServerSocket(); ss.setSoTimeout(250); } catch (IOException e) { throw Exceptions.propagate(e); } try { ss.bind(new InetSocketAddress(addr, 0)); return true; } catch (IOException e) { Exceptions.propagateIfFatal(e); if (log.isTraceEnabled()) log.trace("Binding on failed, interface could be down, being reconfigured, file handle exhaustion, port exhaustion, etc.", addr); return false; } finally { try { ss.close(); } catch (IOException e) { Exceptions.propagateIfFatal(e); } } }

Target:
private static boolean isAddressValid(InetAddress addr) { ServerSocket ss; try { ss = new ServerSocket(); ss.setSoTimeout(250); } catch (IOException e) { throw Exceptions.propagate(e); } try { ss.bind(new InetSocketAddress(addr, 0)); return true; } catch (IOException e) { if (log.isTraceEnabled()) log.trace("Binding on failed, interface could be down, being reconfigured, file handle exhaustion, port exhaustion, etc.", addr); return false; } finally { closeQuietly(ss); } }
Source:
public EventTypeSchema getSchemaVersion(final String name, final String version) throws NoSuchSchemaException, InternalNakadiException { final String sql = "SELECT ets_schema_object FROM zn_data.event_type_schema " + "WHERE ets_event_type_name = ? AND ets_schema_object ->> 'version' = ?"; try { return jdbcTemplate.queryForObject(sql, new Object[]{name, version}, new SchemaRowMapper()); } catch (EmptyResultDataAccessException e) { throw new NoSuchSchemaException("EventType \"" + name + "\" has no schema with version \"" + version + "\"", e); } }

Target:
public EventTypeSchema getSchemaVersion(final String name, final String version) throws NoSuchSchemaException { final String sql = "SELECT ets_schema_object FROM zn_data.event_type_schema " + "WHERE ets_event_type_name = ? AND ets_schema_object ->> 'version' = ?"; try { return jdbcTemplate.queryForObject(sql, new Object[]{name, version}, new SchemaRowMapper()); } catch (EmptyResultDataAccessException e) { throw new NoSuchSchemaException("EventType \"" + name + "\" has no schema with version \"" + version + "\"", e); } }
Source:
public void apply(final List<StringBuilder> values, final AdvancingSource source, final String capturedText) { for (StringBuilder value : values) { String newValue = ""; if ((source.getBreedingMethod().getMtype().equals("DER") || source.getBreedingMethod().getMtype().equals("MAN")) && source.getGermplasm().getGpid2() != 0) { final String attributeName = capturedText.substring(1, capturedText.length()-1).split("\\.")[1]; newValue = germplasmDataManager.getAttributeValue(Integer.parseInt(source.getGermplasm().getGid()), attributeName); } this.replaceExpressionWithValue(value, newValue); } }

Target:
public void apply(final List<StringBuilder> values, final AdvancingSource source, final String capturedText) { for (StringBuilder value : values) { String newValue = ""; if ((source.getBreedingMethod().getMtype().equals(AppConstants.METHOD_TYPE_DER.getString()) || source.getBreedingMethod().getMtype().equals(AppConstants.METHOD_TYPE_MAN.getString())) && source.getGermplasm().getGpid2() != 0) { final String attributeName = capturedText.substring(1, capturedText.length()-1).split("\\.")[1]; newValue = germplasmDataManager.getAttributeValue(Integer.parseInt(source.getGermplasm().getGid()), attributeName); } this.replaceExpressionWithValue(value, newValue); } }
Source:
public void preClean() { readZKTimestamp = EnvironmentEdgeManager.currentTime(); try { wals = queueStorage.getAllWALs(); } catch (ReplicationException e) { LOG.warn("Failed to read zookeeper, skipping checking deletable files"); if (e.getCause() instanceof KeeperException.ConnectionLossException || e.getCause() instanceof KeeperException.SessionExpiredException || e.getCause() instanceof KeeperException.UnknownSessionException) { try { reconnectAfterKeeperException(); wals = queueStorage.getAllWALs(); return ; } catch (IOException | ReplicationException ex) { LOG.warn("Failed to reconnect zookeeper or load all wal in replication queues.", ex); } } wals = null; } }

Target:
public void preClean() { readZKTimestamp = EnvironmentEdgeManager.currentTime(); try { wals = queueStorage.getAllWALs(); } catch (ReplicationException e) { if (e.getCause() instanceof KeeperException.ConnectionLossException || e.getCause() instanceof KeeperException.SessionExpiredException || e.getCause() instanceof KeeperException.UnknownSessionException) { try { reconnectAfterKeeperException(); wals = queueStorage.getAllWALs(); return ; } catch (IOException | ReplicationException ex) { LOG.warn("Failed to reconnect zookeeper or load all wal in replication queues.", ex); } } LOG.warn("Failed to read zookeeper, skipping checking deletable files", e); wals = null; } }
Source:
public boolean isInstructorAllowedToModify() { for (int i = 0; i < getRecoveryCourses().getRows().size(); i++) { RecoveryCoursesTableRow course = getRecoveryCourses().getRows().get(i); if (!instructorsForCourses.get(course.getCourseId()) .isAllowedForPrivilege(Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_COURSE)) { return false; } } return true; }

Target:
public boolean isInstructorAllowedToModify() { return getRecoveryCourses().getRows().stream() .allMatch(course -> instructorsForCourses.get(course.getCourseId()) .isAllowedForPrivilege(Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_COURSE)); }
Source:
public List<Alteration> findMutationsByConsequenceAndPosition(Gene gene, VariantConsequence consequence, int start, int end, List<Alteration> alterations) { Set<Alteration> result = new HashSet<>(); if(gene != null && consequence != null) { for(String cons: consequence.getTerm().split("\\s*,\\s*")) { VariantConsequence tmpConsequence = VariantConsequenceUtils.findVariantConsequenceByTerm(cons); if (alterations != null && alterations.size() > 0) { Set<Alteration> filter = new HashSet<>(); for (Alteration alteration : alterations) { if (alteration.getGene().equals(gene) && alteration.getConsequence() != null && alteration.getConsequence().equals(tmpConsequence) && alteration.getProteinStart() <= start && alteration.getProteinEnd() >= end) { filter.add(alteration); } } result.addAll(filter); } else { List<Alteration> queryResult = getDao().findMutationsByConsequenceAndPosition(gene, tmpConsequence, start, end); if(queryResult != null) { result.addAll(queryResult); } } } } return new ArrayList<>(result); }

Target:
public List<Alteration> findMutationsByConsequenceAndPosition(Gene gene, VariantConsequence consequence, int start, int end, List<Alteration> alterations) { Set<Alteration> result = new HashSet<>(); if(gene != null && consequence != null) { for(String cons: consequence.getTerm().split("\\s*,\\s*")) { VariantConsequence tmpConsequence = VariantConsequenceUtils.findVariantConsequenceByTerm(cons); if (alterations != null && alterations.size() > 0) { for (Alteration alteration : alterations) { if (alteration.getGene().equals(gene) && alteration.getConsequence() != null && alteration.getConsequence().equals(tmpConsequence) && alteration.getProteinStart() <= start && alteration.getProteinEnd() >= end) { result.add(alteration); } } } else { List<Alteration> queryResult = getDao().findMutationsByConsequenceAndPosition(gene, tmpConsequence, start, end); if(queryResult != null) { result.addAll(queryResult); } } } } return new ArrayList<>(result); }
Source:
public @ResponseBody List<ExperimentDto> list() throws IOException { Collection<Experiment> experiments = experimentService.list(); return experiments.stream().map(expt -> Dtos.asDto(expt)).collect(Collectors.toList()); }

Target:
public @ResponseBody List<ExperimentDto> list() throws IOException { Collection<Experiment> experiments = experimentService.list(); return experiments.stream().map(Dtos::asDto).collect(Collectors.toList()); }
Source:
private Constraint shortenDrivingTimePerMillisecondSquared(ConstraintFactory constraintFactory) { return constraintFactory.from(RockShow.class) .filter(r -> r.getPreviousStandstill() != null) .penalizeConfigurableLong(SHORTEN_DRIVING_TIME_PER_MILLISECOND_SQUARED, r -> (long) Math.pow(r.getDrivingTimeFromPreviousStandstill(), 2)); }

Target:
private Constraint shortenDrivingTimePerMillisecondSquared(ConstraintFactory constraintFactory) { return constraintFactory.from(RockShow.class) .filter(rockShow -> rockShow.getPreviousStandstill() != null) .penalizeConfigurableLong(SHORTEN_DRIVING_TIME_PER_MILLISECOND_SQUARED, rockShow -> rockShow.getDrivingTimeFromPreviousStandstill() * rockShow.getDrivingTimeFromPreviousStandstill()); }
Source:
private String extractSubject(Map<String, Object> sessionAttributes) { return Stream.of(sessionAttributes.get(SecurityConstants.SECURITY_TOKEN_KEY)) .filter(SecurityTokenHolder.class::isInstance) .map(SecurityTokenHolder.class::cast) .map(SecurityTokenHolder::getPrincipals) .filter(Objects::nonNull) .map(PrincipalCollection.class::cast) .map(principalCollection -> new SessionToken(principalCollection, null, "127.0.0.1")) .map(this::extractSubject) .filter(Objects::nonNull) .map(SubjectUtils::getName) .findFirst() .orElse(null); }

Target:
private String extractSubject(Map<String, Object> sessionAttributes) { return Stream.of(sessionAttributes.get(SecurityConstants.SECURITY_TOKEN_KEY)) .filter(SecurityTokenHolder.class::isInstance) .map(SecurityTokenHolder.class::cast) .map(SecurityTokenHolder::getPrincipals) .filter(Objects::nonNull) .map(PrincipalCollection.class::cast) .map(principalCollection -> new SessionToken(null, principalCollection, "127.0.0.1")) .map(this::extractSubject) .filter(Objects::nonNull) .map(SubjectUtils::getName) .findFirst() .orElse(null); }
Source:
public void testOffsetFetchRequestBuilderToString() { List<Boolean> stableFlags = Arrays.asList(true, false); for (Boolean requireStable : stableFlags) { String allTopicPartitionsString = new OffsetFetchRequest.Builder("someGroup", requireStable, null).toString(); assertTrue(allTopicPartitionsString.contains("groupId='someGroup', topics=null, requireStable=" + requireStable.toString())); String string = new OffsetFetchRequest.Builder("group1", requireStable, Collections.singletonList(new TopicPartition("test11", 1))).toString(); assertTrue(string.contains("test11")); assertTrue(string.contains("group1")); assertTrue(string.contains(requireStable.toString())); } }

Target:
public void testOffsetFetchRequestBuilderToString() { List<Boolean> stableFlags = Arrays.asList(true, false); for (Boolean requireStable : stableFlags) { String allTopicPartitionsString = new OffsetFetchRequest.Builder("someGroup", requireStable, null).toString(); assertTrue(allTopicPartitionsString.contains("groupId='someGroup', topics=null, requireStable=" + requireStable.toString())); String string = new OffsetFetchRequest.Builder("group1", requireStable, Collections.singletonList(new TopicPartition("test11", 1))).toString(); assertTrue(string.contains("test11")); assertTrue(string.contains("group1")); assertTrue(string.contains("requireStable=" + requireStable.toString())); } }
Source:
public LinkedHashMap<VariableReferenceExpression, DruidColumnHandle> getAssignments() { LinkedHashMap<VariableReferenceExpression, DruidColumnHandle> result = new LinkedHashMap<>(); selections.entrySet().stream().forEach(entry -> { VariableReferenceExpression variable = entry.getKey(); Selection selection = entry.getValue(); DruidColumnHandle handle = selection.getOrigin() == Origin.TABLE_COLUMN ? new DruidColumnHandle(selection.getDefinition(), variable.getType(), DruidColumnHandle.DruidColumnType.REGULAR) : new DruidColumnHandle(variable, DruidColumnHandle.DruidColumnType.DERIVED); result.put(variable, handle); }); return result; }

Target:
public Map<VariableReferenceExpression, DruidColumnHandle> getAssignments() { Map<VariableReferenceExpression, DruidColumnHandle> result = new LinkedHashMap<>(); selections.entrySet().forEach(entry -> { VariableReferenceExpression variable = entry.getKey(); Selection selection = entry.getValue(); DruidColumnHandle handle = selection.getOrigin() == Origin.TABLE_COLUMN ? new DruidColumnHandle(selection.getDefinition(), variable.getType(), DruidColumnHandle.DruidColumnType.REGULAR) : new DruidColumnHandle(variable, DruidColumnHandle.DruidColumnType.DERIVED); result.put(variable, handle); }); return result; }
Source:
public void unsubscribe() { State oldState; State newState; do { oldState = state.get(); if (oldState.isUnsubscribed) { return; } newState = oldState.unsubscribe(); } while (!state.compareAndSet(oldState, newState)); unsubscribeActualIfApplicable(newState); }

Target:
public void unsubscribe() { State oldState; State newState; final AtomicReference<State> localState = this.state; do { oldState = localState.get(); if (oldState.isUnsubscribed) { return; } newState = oldState.unsubscribe(); } while (!localState.compareAndSet(oldState, newState)); unsubscribeActualIfApplicable(newState); }
Source:
protected boolean validateDestStorage() { StorageDomainValidator validator = new StorageDomainValidator(getStorageDomain()); if (!validate(validator.isDomainExistAndActive()) || !validate(validator.domainIsValidDestination())) { return false; } if (getParameters().getOperation() == ImageOperation.Move && getImage().isShareable() && getStorageDomain().getStorageType().equals(StorageType.GLUSTERFS)) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_CANT_MOVE_SHAREABLE_DISK_TO_GLUSTERFS, String.format("$%1$s %2$s", "diskAlias", getImage().getDiskAlias())); } return true; }

Target:
protected boolean validateDestStorage() { StorageDomainValidator validator = new StorageDomainValidator(getStorageDomain()); if (!validate(validator.isDomainExistAndActive()) || !validate(validator.domainIsValidDestination())) { return false; } if (getParameters().getOperation() == ImageOperation.Move && getImage().isShareable() && getStorageDomain().getStorageType() == StorageType.GLUSTERFS ) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_CANT_MOVE_SHAREABLE_DISK_TO_GLUSTERFS, String.format("$%1$s %2$s", "diskAlias", getImage().getDiskAlias())); } return true; }
Source:
public void detonateBomb(Bomb bomb){ bomb.setDetonated(); for (Point p : grid.getAffectedExplosionSquares(bomb)){ for (Entity entity : grid.get(p)){ if (entity.isDestructible()){ if (entity instanceof Player){ killPlayer((Player) entity); } else { grid.remove(entity); } } } } }

Target:
public synchronized void detonateBomb(Bomb bomb){ bomb.setDetonated(); for (Point p : grid.getAffectedExplosionSquares(bomb)){ for (Entity entity : grid.get(p)){ if (entity instanceof Player){ killPlayer((Player) entity); } else if (entity instanceof Bomb && !((Bomb)entity).isDetonated()){ detonateBomb((Bomb)entity); } else if (entity.isDestructible()){ grid.remove(entity); } } } }
Source:
private static void testListIterator(List<String> test) { ListIterator<String> iterator = test.listIterator(0); assertTrue(iterator.hasNext()); assertFalse(iterator.hasPrevious()); try { iterator.previous(); fail("Should not get here"); } catch (NoSuchElementException e) { } iterator.next(); assertEquals("yo", iterator.next()); assertEquals("yo", iterator.previous()); assertEquals("Hola", iterator.previous()); try { iterator.previous(); fail("Should not get here"); } catch (NoSuchElementException e) { } assertEquals("Hola", iterator.next()); assertEquals("yo", iterator.next()); assertEquals("quiero", iterator.next()); assertEquals("un", iterator.next()); assertEquals("UNSUPPORTEDOPERATIONEXCEPTION!", iterator.next()); try { iterator.next(); fail("Should not get here"); } catch (NoSuchElementException e) { } assertEquals("UNSUPPORTEDOPERATIONEXCEPTION!", iterator.previous()); assertEquals(3, iterator.previousIndex()); assertEquals(4, iterator.nextIndex()); try { iterator.remove(); fail("Should not get here"); } catch (UnsupportedOperationException e) { } try { iterator.set("hej"); fail("Should not get here"); } catch (UnsupportedOperationException e) { } try { iterator.add("hi"); fail("Should not get here"); } catch (UnsupportedOperationException e) { } }

Target:
private static void testListIterator(List<String> test) { ListIterator<String> iterator = test.listIterator(0); assertTrue(iterator.hasNext()); assertFalse(iterator.hasPrevious()); try { iterator.previous(); fail("Should not get here"); } catch (NoSuchElementException e) { } assertEquals("Hola", iterator.next()); assertEquals("yo", iterator.next()); assertEquals("yo", iterator.previous()); assertEquals("Hola", iterator.previous()); try { iterator.previous(); fail("Should not get here"); } catch (NoSuchElementException e) { } assertEquals("Hola", iterator.next()); assertEquals("yo", iterator.next()); assertEquals("quiero", iterator.next()); assertEquals("un", iterator.next()); assertEquals("UNSUPPORTEDOPERATIONEXCEPTION!", iterator.next()); try { iterator.next(); fail("Should not get here"); } catch (NoSuchElementException e) { } assertEquals("UNSUPPORTEDOPERATIONEXCEPTION!", iterator.previous()); assertEquals(3, iterator.previousIndex()); assertEquals(4, iterator.nextIndex()); try { iterator.remove(); fail("Should not get here"); } catch (UnsupportedOperationException e) { } try { iterator.set("hej"); fail("Should not get here"); } catch (UnsupportedOperationException e) { } try { iterator.add("hi"); fail("Should not get here"); } catch (UnsupportedOperationException e) { } }
Source:
public void write_record_bulk() { RecordStorage<I> storage = getStorage(); int bulkSize = 5; Map<I, EntityRecordWithColumns> initial = new HashMap<>(bulkSize); for (int i = 0; i < bulkSize; i++) { I id = newId(); EntityRecord record = newStorageRecord(id); initial.put(id, EntityRecordWithColumns.of(record)); } storage.write(initial); Collection<EntityRecord> actual = newArrayList( storage.readMultiple(initial.keySet()) ); Collection<EntityRecord> expected = Collections2.transform(initial.values(), EntityRecordWithColumns::getRecord); assertEquals(expected.size(), actual.size()); assertTrue(actual.containsAll(expected)); close(storage); }

Target:
public void write_record_bulk() { RecordStorage<I> storage = getStorage(); int bulkSize = 5; Map<I, EntityRecordWithColumns> initial = new HashMap<>(bulkSize); for (int i = 0; i < bulkSize; i++) { I id = newId(); EntityRecord record = newStorageRecord(id); initial.put(id, EntityRecordWithColumns.of(record)); } storage.write(initial); Collection<EntityRecord> actual = newArrayList( storage.readMultiple(initial.keySet()) ); Collection<EntityRecord> expected = initial.values() .stream() .map(recordWithColumns -> recordWithColumns != null ? recordWithColumns.getRecord() : null) .collect(Collectors.toList()); assertEquals(expected.size(), actual.size()); assertTrue(actual.containsAll(expected)); close(storage); }
Source:
private void onGetCall(Object message, ActorRef self, ActorRef sender) throws ServletParseException { GetCall getCall = (GetCall)message; String location = getCall.getIdentifier(); if (logger.isDebugEnabled()) { logger.debug("MonitoringService onGetCall, location: "+location); } if (location != null) { if (logger.isDebugEnabled()) { logger.debug("onGetCall Before: callLocationMap: "+ callLocationMap.toString()); } ActorRef call = callLocationMap.get(location); if (logger.isDebugEnabled()) { logger.debug("onGetCall After: callLocationMap: "+ callLocationMap.toString()); } if(call == null && location.indexOf("@") != -1 && location.indexOf(":") != -1) { if (logger.isDebugEnabled()) { logger.debug("onGetCall Another try on removing the user part from " + location); } int indexOfAt = location.indexOf("@"); int indexOfColumn = location.indexOf(":"); String newLocation = location.substring(0, indexOfColumn+1).concat(location.substring(indexOfAt+1)); call = callLocationMap.get(newLocation); if (logger.isDebugEnabled()) { logger.debug("onGetCall call " + call + " found for new Location " + newLocation); } } if (call != null) { sender.tell(call, sender()); } else { if (logger.isDebugEnabled()) { logger.debug("MonitoringService onGetCall, Call is null"); } } } else { if (logger.isDebugEnabled()) { logger.debug("MonitoringService onGetCall, GetCall identifier location is null"); } } }

Target:
private void onGetCall(Object message, ActorRef self, ActorRef sender) throws ServletParseException { GetCall getCall = (GetCall)message; String location = getCall.getIdentifier(); if (logger.isDebugEnabled()) { logger.debug("MonitoringService onGetCall, location: "+location); } if (location != null) { ActorRef call = callLocationMap.get(location); if(call == null && location.indexOf("@") != -1 && location.indexOf(":") != -1) { if (logger.isDebugEnabled()) { logger.debug("onGetCall Another try on removing the user part from " + location); } int indexOfAt = location.indexOf("@"); int indexOfColumn = location.indexOf(":"); String newLocation = location.substring(0, indexOfColumn+1).concat(location.substring(indexOfAt+1)); call = callLocationMap.get(newLocation); if (logger.isDebugEnabled()) { logger.debug("onGetCall call " + call + " found for new Location " + newLocation); } } if (call != null) { sender.tell(call, sender()); } else { if (logger.isDebugEnabled()) { logger.debug("MonitoringService onGetCall, Call is null"); } } } else { if (logger.isDebugEnabled()) { logger.debug("MonitoringService onGetCall, GetCall identifier location is null"); } } }
Source:
private UnweightedDoubleReservoirSample(UnweightedDoubleReservoirSample other) { this.count = other.count; this.samples = new double[other.samples.length]; System.arraycopy(other.samples, 0, samples, 0, samples.length); }

Target:
private UnweightedDoubleReservoirSample(UnweightedDoubleReservoirSample other) { this.seenCount = other.seenCount; this.samples = Arrays.copyOf(requireNonNull(other.samples, "samples is null"), other.samples.length); }
Source:
private FileStatus[] listFilesInDir(Path path) throws IOException { boolean done = false; int repeat = 0; FileStatus[] files = null; while (!done) { try { files = dataFileSystem.listStatus(path, p -> { String name = p.getName(); return !name.startsWith("_") && !name.startsWith("."); }); done = true; } catch (IOException e) { if (++repeat == MAX_IO_ERROR_RETRY) { throw e; } dataFileSystem = path.getFileSystem(hiveConf); } } return files; }

Target:
private FileStatus[] listFilesInDir(Path path) throws IOException { return dataFileSystem.listStatus(path, p -> { String name = p.getName(); return !name.startsWith("_") && !name.startsWith("."); }); }
Source:
public void canClickOnStyledText() throws Exception { bot.checkBox("Listen").select(); styledText = bot.styledTextInGroup("StyledText"); styledText.setText("This is sample text"); bot.button("Clear").click(); styledText.click(0, 5); verifyNotifyClick(); }

Target:
public void canClickOnStyledText() throws Exception { final int line = 0, column = 5; bot.checkBox("Listen").select(); styledText = bot.styledTextInGroup("StyledText"); styledText.setText("This is sample text"); bot.button("Clear").click(); styledText.click(line, column); verifyNotifyClick(0); assertEquals(new Position(line, column), styledText.cursorPosition(true)); verifyNotifyClick(0); }
Source:
private static Map<IFile, Long> createModificationStampMap(List<IResource> files) { Map<IFile, Long> map= new HashMap<IFile, Long>(); for (Iterator<IResource> iter= files.iterator(); iter.hasNext(); ) { IFile file= (IFile)iter.next(); map.put(file, new Long(file.getModificationStamp())); } return map; }

Target:
private static Map<IFile, Long> createModificationStampMap(List<IResource> files) { Map<IFile, Long> map= new HashMap<IFile, Long>(); for (IResource file : files) { map.put((IFile) file, file.getModificationStamp()); } return map; }
Source:
private boolean firstCollectionOpen() { if (CollectionHelper.hasStorageAccessPermission(this)) { return CollectionHelper.getInstance().getColSafe(this) != null; } else if (mClosedWelcomeMessage) { ActivityCompat.requestPermissions(this, new String[] {Manifest.permission.WRITE_EXTERNAL_STORAGE}, REQUEST_STORAGE_PERMISSION); return false; } else { new MaterialDialog.Builder(this) .title(R.string.collection_load_welcome_request_permissions_title) .titleGravity(GravityEnum.CENTER) .content(R.string.collection_load_welcome_request_permissions_details) .positiveText(R.string.dialog_ok) .onPositive((innerDialog, innerWhich) -> { ActivityCompat.requestPermissions(this, new String[] {Manifest.permission.WRITE_EXTERNAL_STORAGE}, REQUEST_STORAGE_PERMISSION); this.mClosedWelcomeMessage = true; }) .cancelable(false) .canceledOnTouchOutside(false) .show(); return false; } }

Target:
private boolean firstCollectionOpen() { if (CollectionHelper.hasStorageAccessPermission(this)) { return CollectionHelper.getInstance().getColSafe(this) != null; } else if (mClosedWelcomeMessage) { ActivityCompat.requestPermissions(this, new String[] {Manifest.permission.WRITE_EXTERNAL_STORAGE}, REQUEST_STORAGE_PERMISSION); return false; } else { new MaterialDialog.Builder(this) .title(R.string.collection_load_welcome_request_permissions_title) .titleGravity(GravityEnum.CENTER) .content(R.string.collection_load_welcome_request_permissions_details) .positiveText(R.string.dialog_ok) .onPositive((innerDialog, innerWhich) -> { this.mClosedWelcomeMessage = true; ActivityCompat.requestPermissions(this, new String[] {Manifest.permission.WRITE_EXTERNAL_STORAGE}, REQUEST_STORAGE_PERMISSION); }) .cancelable(false) .canceledOnTouchOutside(false) .show(); return false; } }
Source:
public void ValidationStereotypesListClass4Test() { EList<Stereotype> appliedStereotypes = class4.getAppliedStereotypes(); List<Stereotype> expectedStereotypes = new ArrayList<Stereotype>(); expectedStereotypes.add(stereotype3); expectedStereotypes.add(stereotype1); assertEquals(appliedStereotypes, expectedStereotypes); }

Target:
public void ValidationStereotypesListClass4Test() { EList<Stereotype> appliedStereotypes = class4.getAppliedStereotypes(); List<Stereotype> expectedStereotypes = new ArrayList<Stereotype>(); expectedStereotypes.add(stereotype3); expectedStereotypes.add(stereotype1); assertEquals("The stereotypes applied on the class must be the same as the expected stereotypes.", appliedStereotypes, expectedStereotypes); }
Source:
public boolean hasSameFaultDomains(String host1, String host2) { if (!hostToRackMap.keySet().contains(host1) || !hostToRackMap.keySet().contains(host2)) { hostToRackMap = computeHostToFaultDomainMap(); state.hostToFaultDomainCacheUpdates.incrementAndGet(); } return hostToRackMap.get(host1).toString().equals(hostToRackMap.get(host2).toString()); }

Target:
public boolean hasSameFaultDomains(String host1, String host2) { if (!hostToRackMap.keySet().contains(host1) || !hostToRackMap.keySet().contains(host2)) { hostToRackMap = computeHostToFaultDomainMap(); hostToFaultDomainCacheUpdates.inc(); } return hostToRackMap.get(host1).equals(hostToRackMap.get(host2)); }
Source:
public T get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException { try { T v = future.get(timeout, unit); onceToCircuitbreaker.applyOnce(cb -> nanosecondTimer.elapsed( time -> cb.onSuccess(time, TimeUnit.NANOSECONDS))); return v; } catch (CancellationException | InterruptedException e) { onceToCircuitbreaker.applyOnce(cb -> cb.releasePermission()); throw e; } catch (Exception e) { onceToCircuitbreaker.applyOnce(cb -> nanosecondTimer.elapsed( time -> cb.onError(time, TimeUnit.NANOSECONDS, e))); throw e; } finally { future.cancel(true); } }

Target:
public T get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException { try { T v = future.get(timeout, unit); onceToCircuitbreaker.applyOnce(cb -> cb.onSuccess(System.nanoTime() - start, TimeUnit.NANOSECONDS)); return v; } catch (CancellationException | InterruptedException e) { onceToCircuitbreaker.applyOnce(cb -> cb.releasePermission()); throw e; } catch (Exception e) { onceToCircuitbreaker.applyOnce(cb -> cb.onError(System.nanoTime() - start, TimeUnit.NANOSECONDS, e)); throw e; } }
Source:
private void installConfigurationFile(String fileLocation, String finalname, boolean override) throws IOException { finalname = substFinalName(finalname); File file = new File(finalname); if (!file.getCanonicalPath().startsWith(System.getProperty("karaf.base"))) { throw new IOException("Configuration file path must be in the container"); } if (file.exists()) { if (!override) { LOGGER.debug("Configuration file already exists, don't override it", finalname); return; } else { LOGGER.info("Configuration file already exists, overriding it", finalname); } } else { LOGGER.info("Creating configuration file {}", finalname); } try ( InputStream is = new BufferedInputStream(new URL(fileLocation).openStream()) ) { if (!file.exists()) { File parentFile = file.getParentFile(); if (parentFile != null) { parentFile.mkdirs(); } file.createNewFile(); } try ( FileOutputStream fop = new FileOutputStream(file) ) { StreamUtils.copy(is, fop); } } catch (RuntimeException | MalformedURLException e) { LOGGER.error(e.getMessage()); throw e; } }

Target:
private void installConfigurationFile(String fileLocation, String finalname, boolean override) throws IOException { finalname = substFinalName(finalname); File file = new File(finalname); if (!file.getCanonicalPath().startsWith(System.getProperty("karaf.etc"))) { throw new IOException("Configuration file path must be in the 'karaf.etc' directory"); } if (file.exists()) { if (!override) { LOGGER.debug("Configuration file already exists, don't override it", finalname); return; } else { LOGGER.info("Configuration file already exists, overriding it", finalname); } } else { LOGGER.info("Creating configuration file {}", finalname); } try ( InputStream is = new BufferedInputStream(new URL(fileLocation).openStream()) ) { if (!file.exists()) { File parentFile = file.getParentFile(); if (parentFile != null) { parentFile.mkdirs(); } file.createNewFile(); } try ( FileOutputStream fop = new FileOutputStream(file) ) { StreamUtils.copy(is, fop); } } catch (RuntimeException | MalformedURLException e) { LOGGER.error(e.getMessage()); throw e; } }
Source:
public AsyncHttpClient get() { HttpClientConfig config = injector.getInstance(Key.get(HttpClientConfig.class, annotation)); NettyAsyncHttpClientConfig asyncConfig = injector.getInstance(Key.get(NettyAsyncHttpClientConfig.class, annotation)); Set<HttpRequestFilter> filters = injector.getInstance(filterKey(annotation)); NettyAsyncHttpClientIoPoolProvider poolProvider; if (injector.getExistingBinding(Key.get(NettyAsyncHttpClientIoPoolProvider.class, annotation)) != null) { poolProvider = injector.getInstance(Key.get(NettyAsyncHttpClientIoPoolProvider.class, annotation)); log.info("Http Client %s uses private IO thread pool", name); } else { log.info("Http Client %s uses shared IO thread pool", name); poolProvider = injector.getInstance(NettyAsyncHttpClientIoPoolProvider.class); } NettyAsyncHttpClient client = new NettyAsyncHttpClient(name, poolProvider, config, asyncConfig, filters); clients.add(client); return client; }

Target:
public AsyncHttpClient get() { HttpClientConfig config = injector.getInstance(Key.get(HttpClientConfig.class, annotation)); NettyAsyncHttpClientConfig asyncConfig = injector.getInstance(Key.get(NettyAsyncHttpClientConfig.class, annotation)); Set<HttpRequestFilter> filters = injector.getInstance(filterKey(annotation)); NettyIoPool ioPool; if (injector.getExistingBinding(Key.get(NettyIoPool.class, annotation)) != null) { ioPool = injector.getInstance(Key.get(NettyIoPool.class, annotation)); log.debug("HttpClient %s uses private IO thread pool", name); } else { log.debug("HttpClient %s uses shared IO thread pool", name); ioPool = injector.getInstance(NettyIoPool.class); } NettyAsyncHttpClient client = new NettyAsyncHttpClient(name, ioPool, config, asyncConfig, filters); clients.add(client); return client; }
Source:
protected IStatus run(IProgressMonitor monitor) { if (stopped) { return Status.OK_STATUS; } currentAlpha += increment; if (currentAlpha <= 0) { currentAlpha = 0; } else if (currentAlpha >= 255) { currentAlpha = 255; } Display.getDefault().syncExec(new Runnable() { public void run() { if (stopped) { return; } if (shell.isDisposed()) { stopped = true; return; } shell.setAlpha(currentAlpha); if (fadeListener != null) { fadeListener.faded(shell, currentAlpha); } } }); if (currentAlpha == 0 || currentAlpha == 255) { stopped = true; } reschedule(); return Status.OK_STATUS; }

Target:
protected IStatus run(IProgressMonitor monitor) { if (stopped) { return Status.OK_STATUS; } currentAlpha += increment; if (currentAlpha <= 0) { currentAlpha = 0; } else if (currentAlpha >= 255) { currentAlpha = 255; } Display.getDefault().syncExec(new Runnable() { @Override public void run() { if (stopped) { return; } if (shell.isDisposed()) { stopped = true; return; } shell.setAlpha(currentAlpha); if (fadeListener != null) { fadeListener.faded(shell, currentAlpha); } } }); if (currentAlpha == 0 || currentAlpha == 255) { stopped = true; } reschedule(); return Status.OK_STATUS; }
Source:
public ConditionEvaluationResult evaluateExecutionCondition(ExtensionContext extensionContext) { Optional<Method> testMethod = extensionContext.getTestMethod(); if (!testMethod.isPresent()) { return enabled(""); } Class<?> testClass = extensionContext.getRequiredTestClass(); List<ConnectorFeature> classRequires = getClassRequiredFeatures(testMethod.get().getDeclaringClass()); Set<ConnectorFeature> requiredFeatures = Stream.concat( streamOfRequired(testMethod.get()), classRequires.stream()) .distinct() .collect(toImmutableSet()); Set<ConnectorFeature> supportedFeatures = streamOfSupported(testClass) .distinct() .collect(toImmutableSet()); Set<ConnectorFeature> missingFeatures = Sets.difference(requiredFeatures, supportedFeatures); return missingFeatures.isEmpty() ? enabled("All required features present") : disabled("Missing required features: " + Joiner.on(", ").join(missingFeatures)); }

Target:
public ConditionEvaluationResult evaluateExecutionCondition(ExtensionContext extensionContext) { Optional<Method> testMethod = extensionContext.getTestMethod(); if (!testMethod.isPresent()) { return enabled(""); } Class<?> testClass = extensionContext.getRequiredTestClass(); List<ConnectorFeature> classRequires = getClassRequiredFeatures(testMethod.get().getDeclaringClass()); Set<ConnectorFeature> requiredFeatures = Stream.concat( streamOfRequired(testMethod.get()), classRequires.stream()) .collect(toImmutableSet()); Set<ConnectorFeature> supportedFeatures = streamOfSupported(testClass) .collect(toImmutableSet()); Set<ConnectorFeature> missingFeatures = Sets.difference(requiredFeatures, supportedFeatures); return missingFeatures.isEmpty() ? enabled("All required features present") : disabled("Missing required features: " + Joiner.on(", ").join(missingFeatures)); }
Source:
private Appender<ILoggingEvent> createAsyncAppender(final Appender<ILoggingEvent> appender) { final AsyncAppender asyncAppender = new AsyncAppender(); asyncAppender.setContext(_loggerContext); asyncAppender.setDiscardingThreshold(0); asyncAppender.setName("query-log-async"); asyncAppender.setQueueSize(500); asyncAppender.addAppender(appender); return asyncAppender; }

Target:
private Appender<ILoggingEvent> createAsyncAppender(final Appender<ILoggingEvent> appender) { final AsyncAppender asyncAppender = new AsyncAppender(); asyncAppender.setContext(_loggerContext); asyncAppender.setDiscardingThreshold(0); asyncAppender.setName("query-log-async"); asyncAppender.setQueueSize(QUEUE_SIZE); asyncAppender.addAppender(appender); return asyncAppender; }
Source:
public SubTabNetworkVmView(SearchableDetailModelProvider<PairQueryable<VmNetworkInterface, VM>, NetworkListModel, NetworkVmListModel> modelProvider) { super(modelProvider); viewRadioGroup = new ViewRadioGroup<>(Arrays.asList(NetworkVmFilter.values())); viewRadioGroup.setSelectedValue(NetworkVmFilter.running); viewRadioGroup.addChangeHandler(selected -> { onRadioButtonChange(selected); }); initTable(); initWidget(getTableContainer()); }

Target:
public SubTabNetworkVmView(SearchableDetailModelProvider<PairQueryable<VmNetworkInterface, VM>, NetworkListModel, NetworkVmListModel> modelProvider) { super(modelProvider); viewRadioGroup = new ViewRadioGroup<>(Arrays.asList(NetworkVmFilter.values())); viewRadioGroup.setSelectedValue(NetworkVmFilter.running); viewRadioGroup.addChangeHandler(selected -> onRadioButtonChange(selected)); initTable(); initWidget(getTableContainer()); }
Source:
private boolean createSchema() { try { RequestProcessor.sendPostRequestWithFile(CONTROLLER_URL + "/schemas", new File(_schemaFileName)); return true; } catch (Exception e) { System.out.println(e.getMessage()); return false; } }

Target:
private boolean createSchema() { try { ControllerTest.sendPostRequest( ControllerRequestURLBuilder.baseUrl(ClusterDescriptor.CONTROLLER_URL).forSchemaCreate(), FileUtils.readFileToString(new File(_schemaFileName))); return true; } catch (IOException e) { LOGGER.error("Failed to create schema with file: {}", _schemaFileName, e); return false; } }
Source:
public void enableCertFileReloading() throws IOException { LOG.info("enabling cert file reloading"); ZKConfig config = new ZKConfig(); String keyStoreLocation = config.getProperty(sslKeystoreLocationProperty); if (keyStoreLocation != null && !keyStoreLocation.isEmpty()) { final Path filePath = Paths.get(keyStoreLocation).toAbsolutePath(); Path parentPath = filePath.getParent(); if (parentPath == null) { throw new IOException( "Key store path does not have a parent: " + filePath); } FileChangeWatcher newKeyStoreFileWatcher = new FileChangeWatcher( parentPath, watchEvent -> { handleWatchEvent(filePath, watchEvent); }); if (keyStoreFileWatcher != null) { keyStoreFileWatcher.stop(); } keyStoreFileWatcher = newKeyStoreFileWatcher; keyStoreFileWatcher.start(); } String trustStoreLocation = config.getProperty(sslTruststoreLocationProperty); if (trustStoreLocation != null && !trustStoreLocation.isEmpty()) { final Path filePath = Paths.get(trustStoreLocation).toAbsolutePath(); Path parentPath = filePath.getParent(); if (parentPath == null) { throw new IOException( "Trust store path does not have a parent: " + filePath); } FileChangeWatcher newTrustStoreFileWatcher = new FileChangeWatcher( parentPath, watchEvent -> { handleWatchEvent(filePath, watchEvent); }); if (trustStoreFileWatcher != null) { trustStoreFileWatcher.stop(); } trustStoreFileWatcher = newTrustStoreFileWatcher; trustStoreFileWatcher.start(); } }

Target:
public void enableCertFileReloading() throws IOException { LOG.info("enabling cert file reloading"); ZKConfig config = new ZKConfig(); FileChangeWatcher newKeyStoreFileWatcher = newFileChangeWatcher(config.getProperty(sslKeystoreLocationProperty)); if (newKeyStoreFileWatcher != null) { if (keyStoreFileWatcher != null) { keyStoreFileWatcher.stop(); } keyStoreFileWatcher = newKeyStoreFileWatcher; keyStoreFileWatcher.start(); } FileChangeWatcher newTrustStoreFileWatcher = newFileChangeWatcher(config.getProperty(sslTruststoreLocationProperty)); if (newTrustStoreFileWatcher != null) { if (trustStoreFileWatcher != null) { trustStoreFileWatcher.stop(); } trustStoreFileWatcher = newTrustStoreFileWatcher; trustStoreFileWatcher.start(); } }
Source:
Executor getRenamedFilesExecutor(final File file, String sinceRevision) throws IOException { String abs = file.getCanonicalPath(); String filename = ""; if (abs.length() > directoryName.length()) { filename = abs.substring(directoryName.length() + 1); } ensureCommand(CMD_PROPERTY_KEY, CMD_FALLBACK); List<String> cmd = new ArrayList<>(); cmd.add(RepoCommand); cmd.add("log"); cmd.add("-M8"); cmd.add("--summary"); cmd.add(ABBREV_LOG); cmd.add("--name-status"); cmd.add("--oneline"); if (file.isFile()) { cmd.add("--follow"); } if (sinceRevision != null) { cmd.add(sinceRevision + ".."); } if (filename.length() > 0) { cmd.add("--"); cmd.add(filename); } return new Executor(cmd, new File(getDirectoryName()), sinceRevision != null); }

Target:
Executor getRenamedFilesExecutor(final File file, String sinceRevision) throws IOException { ensureCommand(CMD_PROPERTY_KEY, CMD_FALLBACK); List<String> cmd = new ArrayList<>(); cmd.add(RepoCommand); cmd.add("log"); cmd.add("--find-renames=8"); cmd.add("--summary"); cmd.add(ABBREV_LOG); cmd.add("--name-status"); cmd.add("--oneline"); if (file.isFile()) { cmd.add("--follow"); } if (sinceRevision != null) { cmd.add(sinceRevision + ".."); } if (file.getCanonicalPath().length() > directoryName.length() + 1) { cmd.add("--"); cmd.add(file.getCanonicalPath().substring(directoryName.length() + 1)); } return new Executor(cmd, new File(getDirectoryName()), sinceRevision != null); }