auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void reportIssue(CatchTree catchTree, CatchTree catchTreeToBeCompared) { String typeName = typeName(catchTreeToBeCompared.parameter().type()); String message = "Combine this catch with the one for \"" + typeName + "\", which has the same body." + context.getJavaVersion().java7CompatibilityMessage(); List<JavaFileScannerContext.Location> flow = Lists.newArrayList(new JavaFileScannerContext.Location("Combine with this catch", catchTreeToBeCompared)); reportIssue(catchTree.parameter(), message, flow, null); }

Target:
private void reportIssue(CatchTree catchTree, CatchTree catchTreeToBeCompared) { String message = "Combine this catch with the one at line " + catchTreeToBeCompared.catchKeyword().line() + ", which has the same body." + context.getJavaVersion().java7CompatibilityMessage(); List<JavaFileScannerContext.Location> flow = Lists.newArrayList(new JavaFileScannerContext.Location("Combine with this catch", catchTreeToBeCompared)); reportIssue(catchTree.parameter(), message, flow, null); }
Source:
protected String getContextId(String name) { boolean includeHostName = camelContext != null && camelContext.getManagementStrategy().getManagementAgent().getIncludeHostName(); if (includeHostName != null && includeHostName) { return hostName + "/" + (name != null ? name : VALUE_UNKNOWN); } else { return name != null ? name : VALUE_UNKNOWN; } }

Target:
protected String getContextId(String name) { boolean includeHostName = camelContext != null && camelContext.getManagementStrategy().getManagementAgent().getIncludeHostName(); if (includeHostName) { return hostName + "/" + (name != null ? name : VALUE_UNKNOWN); } else { return name != null ? name : VALUE_UNKNOWN; } }
Source:
public boolean publishEvent(Event event) throws NotifierException { try { APIEvent apiEvent = (APIEvent) event; ObjectMapper mapper = new ObjectMapper(); String jsonString = mapper.writeValueAsString(apiEvent); byte[] bytesEncoded = Base64.encodeBase64(jsonString.getBytes()); Object[] objects = new Object[]{apiEvent.getType(), apiEvent.getTimeStamp(), new String(bytesEncoded)}; APIUtil.publishEventToStream(APIConstants.NOTIFICATION_STREAM_ID, APIConstants.NOTIFICATION_EVENT_PUBLISHER, objects); return true; } catch (Exception e) { throw new NotifierException(e); } }

Target:
public boolean publishEvent(Event event) throws NotifierException { try { APIEvent apiEvent = (APIEvent) event; byte[] bytesEncoded = Base64.encodeBase64(new Gson().toJson(apiEvent).getBytes()); Object[] objects = new Object[]{apiEvent.getType(), apiEvent.getTimeStamp(), new String(bytesEncoded)}; org.wso2.carbon.databridge.commons.Event payload = new org.wso2.carbon.databridge.commons.Event( APIConstants.NOTIFICATION_STREAM_ID, System.currentTimeMillis(), null, null, objects); APIUtil.publishEvent(APIConstants.NOTIFICATION_EVENT_PUBLISHER, null, payload); return true; } catch (Exception e) { throw new NotifierException(e); } }
Source:
static RangeCondition<Long> forDiscreteRange(long min, long max, long step) { if (max < min || step < 0) { throw new IllegalArgumentException(); } long increment = Math.max(step, 1L); Set<Long> times = new TreeSet<>(); for (long t = min; t < max; t += increment) { times.add(t); } times.add(max); return fromCollection(times); }

Target:
static RangeCondition<Long> forDiscreteRange(long min, long max, long step) { if (max < min || step < 0) { throw new IllegalArgumentException("Invalid range: max should be < min and step >= 0 (max: " + max + ", min:" + min + ", step: " + step + ')'); } long increment = Math.max(step, 1L); Set<Long> times = new TreeSet<>(); for (long t = min; t < max; t += increment) { times.add(t); } times.add(max); return fromCollection(times); }
Source:
public List<Citation> getByCitationNumberAndDOB(String citationNumber, LocalDate dob) { UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(tylerConfiguration.rootUrl) .queryParam("citationNumber", citationNumber).queryParam("dob", dob.format(dobFormatter)); HttpHeaders headers = new HttpHeaders(); headers.add("apikey", tylerConfiguration.apiKey); HttpEntity<?> query = new HttpEntity<>(headers); ResponseEntity<List<TylerCitation>> tylerCitationsResponse = null; ParameterizedTypeReference<List<TylerCitation>> type = new ParameterizedTypeReference<List<TylerCitation>>() { }; URI uri = builder.build().encode().toUri(); List<TylerCitation> tylerCitations = null; try { tylerCitationsResponse = restTemplate.exchange(uri, HttpMethod.GET, query, type); tylerCitations = tylerCitationsResponse.getBody(); } catch (HttpClientErrorException ex) { System.out.println(ex.getMessage()); System.out.print(ex.getResponseBodyAsString()); } return tylerTransformer.citationsFromTylerCitations(tylerCitations); }

Target:
public List<Citation> getByCitationNumberAndDOB(String citationNumber, LocalDate dob) { UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(tylerConfiguration.rootUrl) .queryParam("citationNumber", citationNumber).queryParam("dob", dob.format(dobFormatter)); return performRestTemplateCall(builder.build().encode().toUri()); }
Source:
public IPv4Address apply(VdsNetworkInterface nic) { IPv4Address ipv4Address = new IPv4Address(); if (nic.getIpv4BootProtocol() == Ipv4BootProtocol.STATIC_IP) { ipv4Address.setAddress("".equals(nic.getIpv4Address()) ? null : nic.getIpv4Address()); ipv4Address.setNetmask("".equals(nic.getIpv4Subnet()) ? null : nic.getIpv4Subnet()); ipv4Address.setGateway("".equals(nic.getIpv4Gateway()) ? null : nic.getIpv4Gateway()); } ipv4Address.setBootProtocol(nic.getIpv4BootProtocol()); return ipv4Address; }

Target:
public IPv4Address apply(VdsNetworkInterface nic) { IPv4Address ipv4Address = new IPv4Address(); if (nic.getIpv4BootProtocol() == Ipv4BootProtocol.STATIC_IP) { ipv4Address.setAddress(nic.getIpv4Address()); ipv4Address.setNetmask(nic.getIpv4Subnet()); ipv4Address.setGateway(nic.getIpv4Gateway()); } ipv4Address.setBootProtocol(nic.getIpv4BootProtocol()); return ipv4Address; }
Source:
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { if (!stopped.get()) { future.cancel(true); future = executor.schedule(this::sendEvent, timeout, TimeUnit.MILLISECONDS); LOG.info("Idling workspace " + WorkspaceIdProvider.getWorkspaceId() + " scheduled [timeout=" + timeout / 1000 + " seconds]"); } chain.doFilter(request, response); }

Target:
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { if (!stopped.get()) { future.cancel(true); future = executor.schedule(this::sendEvent, timeout, TimeUnit.MILLISECONDS); } chain.doFilter(request, response); }
Source:
private void alertIfLowDiskSpaceOnHost() { Map<String, Long> disksUsage = _vds.getLocalDisksUsage(); if (disksUsage == null || disksUsage.isEmpty()) { return; } List<String> disksWithLowSpace = new ArrayList<String>(); List<String> disksWithCriticallyLowSpace = new ArrayList<String>(); final Integer lowSpace = Config.<Integer> GetValue(ConfigValues.VdsLowFreeSpace); final Integer criticallyLowSpace = Config.<Integer> GetValue(ConfigValues.VdsCriticallyLowFreeSpace); for (Entry<String, Long> diskUsage : disksUsage.entrySet()) { if (diskUsage.getValue() <= criticallyLowSpace) { disksWithCriticallyLowSpace.add(diskUsage.getKey()); } else if (diskUsage.getValue() <= lowSpace) { disksWithLowSpace.add(diskUsage.getKey()); } } logLowDiskSpaceOnHostDisks(disksWithLowSpace, lowSpace, AuditLogType.VDS_LOW_DISK_SPACE); logLowDiskSpaceOnHostDisks(disksWithCriticallyLowSpace, criticallyLowSpace, AuditLogType.VDS_LOW_DISK_SPACE_ERROR); }

Target:
private void alertIfLowDiskSpaceOnHost() { Map<String, Long> disksUsage = _vds.getLocalDisksUsage(); if (disksUsage == null || disksUsage.isEmpty()) { return; } List<String> disksWithLowSpace = new ArrayList<String>(); List<String> disksWithCriticallyLowSpace = new ArrayList<String>(); for (Entry<String, Long> diskUsage : disksUsage.entrySet()) { if (diskUsage.getValue() != null) { if (diskUsage.getValue() <= LOW_SPACE_CRITICAL_THRESHOLD) { disksWithCriticallyLowSpace.add(diskUsage.getKey()); } else if (diskUsage.getValue() <= LOW_SPACE_THRESHOLD) { disksWithLowSpace.add(diskUsage.getKey()); } } } logLowDiskSpaceOnHostDisks(disksWithLowSpace, LOW_SPACE_THRESHOLD, AuditLogType.VDS_LOW_DISK_SPACE); logLowDiskSpaceOnHostDisks(disksWithCriticallyLowSpace, LOW_SPACE_CRITICAL_THRESHOLD, AuditLogType.VDS_LOW_DISK_SPACE_ERROR); }
Source:
public void testMultipleChannels() { List<MySignal> signals = new ArrayList<>(); signals.add(new MySignal(sender, 0)); signals.add(new MySignal(sender, 0)); signals.add(new MySignal(sender, 0)); signals.add(new MySignal(sender, 1)); signals.add(new MySignal(sender, 1)); signals.add(new MySignal(sender, 1)); signals.add(new MySignal(sender, 2)); signals.add(new MySignal(sender, 2)); signals.add(new MySignal(sender, 2)); Collections.shuffle(signals); synchronized(this) { for (MySignal sig : signals) { sender.sendSignal(sig); } } sleep(1250); for (int nb : listener.nbReceived) { assertEquals(1, nb); } }

Target:
public void testMultipleChannels() { List<MySignal> signals = new ArrayList<>(); signals.add(new MySignal(sender, 0)); signals.add(new MySignal(sender, 0)); signals.add(new MySignal(sender, 0)); signals.add(new MySignal(sender, 1)); signals.add(new MySignal(sender, 1)); signals.add(new MySignal(sender, 1)); signals.add(new MySignal(sender, 2)); signals.add(new MySignal(sender, 2)); signals.add(new MySignal(sender, 2)); Collections.shuffle(signals); synchronized(this) { for (MySignal sig : signals) { sender.sendSignal(sig); } } sleep(2000); for (int nb : listener.nbReceived) { assertEquals(1, nb); } }
Source:
public List<SchemaDescriptor> getAllSchemas(TransactionController tc) throws StandardException{ List<SchemaDescriptor> lists =new ArrayList<>(); TabInfoImpl ti=coreInfo[SYSSCHEMAS_CORE_NUM]; SYSSCHEMASRowFactory rf=(SYSSCHEMASRowFactory)ti.getCatalogRowFactory(); ScanController sc=tc.openScan( ti.getHeapConglomerate(), false, 0, TransactionController.MODE_RECORD, TransactionController.ISOLATION_REPEATABLE_READ, null, null, 0, null, null, 0); ExecRow outRow=rf.makeEmptyRow(); SchemaDescriptor schemaDescr; while(sc.fetchNext(outRow.getRowArray())){ schemaDescr=(SchemaDescriptor)rf.buildDescriptor(outRow,null,this); lists.add(schemaDescr); } sc.close(); return lists; }

Target:
public List<SchemaDescriptor> getAllSchemas(TransactionController tc) throws StandardException{ List<SchemaDescriptor> lists =new ArrayList<>(); TabInfoImpl ti=coreInfo[SYSSCHEMAS_CORE_NUM]; SYSSCHEMASRowFactory rf=(SYSSCHEMASRowFactory)ti.getCatalogRowFactory(); try (ScanController sc = tc.openScan( ti.getHeapConglomerate(), false, 0, TransactionController.MODE_RECORD, TransactionController.ISOLATION_REPEATABLE_READ, null, null, 0, null, null, 0)) { ExecRow outRow = rf.makeEmptyRow(); SchemaDescriptor schemaDescr; while (sc.fetchNext(outRow.getRowArray())) { schemaDescr = (SchemaDescriptor) rf.buildDescriptor(outRow, null, this); lists.add(schemaDescr); } } return lists; }
Source:
public void onPostChanged(OnPostChanged event) { AppLog.e(T.API, "causeOfChange: " + event.causeOfChange); if (event.causeOfChange instanceof CauseOfOnPostChanged.RemoteAutoSavePost) { int postLocalId = ((RemoteAutoSavePost) event.causeOfChange).getLocalPostId(); PostModel post = mPostStore.getPostByLocalPostId(postLocalId); SiteModel site = mSiteStore.getSiteByLocalId(post.getLocalSiteId()); sShouldRemoteAutoSavePosts.remove(postLocalId); mPostUploadNotifier.incrementUploadedPostCountFromForegroundNotification(post); mPostUploadNotifier.updateNotificationSuccessForPost(post, site, false); finishUpload(); } }

Target:
public void onPostChanged(OnPostChanged event) { if (event.causeOfChange instanceof CauseOfOnPostChanged.RemoteAutoSavePost) { int postLocalId = ((RemoteAutoSavePost) event.causeOfChange).getLocalPostId(); PostModel post = mPostStore.getPostByLocalPostId(postLocalId); SiteModel site = mSiteStore.getSiteByLocalId(post.getLocalSiteId()); sShouldRemoteAutoSavePosts.remove(postLocalId); mPostUploadNotifier.incrementUploadedPostCountFromForegroundNotification(post); mPostUploadNotifier.updateNotificationSuccessForPost(post, site, false); finishUpload(); } }
Source:
private void setPeristentExportTriggers(Table table) { if (token.tokenType != Tokens.EXPORT) { return; } String target = readMigrateTarget(); List<String> triggers = new ArrayList<>(); read(); if (token.tokenType == Tokens.ON) { read(); while (token.tokenType != Tokens.OPENBRACKET) { if (token.tokenType == Tokens.DELETE) { triggers.add(Tokens.T_DELETE); } else if (token.tokenType == Tokens.INSERT) { triggers.add(Tokens.T_INSERT); } else if (token.tokenType == Tokens.UPDATE) { triggers.add(Tokens.T_UPDATE); } else if (token.tokenType == Tokens.UPDATEOLD) { triggers.add(Tokens.T_UPDATEOLD); } else if (token.tokenType == Tokens.UPDATENEW) { triggers.add(Tokens.T_UPDATENEW); } else if (token.tokenType != Tokens.COMMA){ throw unexpectedToken(); } read(); } if (triggers.contains(Tokens.T_UPDATE) && (triggers.contains(Tokens.T_UPDATEOLD) || triggers.contains(Tokens.T_UPDATENEW))){ throw unexpectedToken("Cann't combine " + Tokens.T_UPDATE + " with " + Tokens.T_UPDATEOLD + " or " + Tokens.T_UPDATENEW); } if (triggers.contains(Tokens.T_UPDATEOLD) && triggers.contains(Tokens.T_UPDATENEW)) { throw unexpectedToken("Use " + Tokens.T_UPDATE + " instead of both " + Tokens.T_UPDATEOLD + " and " + Tokens.T_UPDATENEW); } } if (triggers.isEmpty()) { triggers= Arrays.asList("INSERT"); } target = target.toUpperCase(); PersistentExport export = new PersistentExport(target, triggers); table.persistentExport = export; }

Target:
private void setPeristentExportTriggers(Table table) { if (token.tokenType != Tokens.EXPORT) { return; } String target = readMigrateTarget(); List<String> triggers = readExportTrigger(false); target = target.toUpperCase(); PersistentExport export = new PersistentExport(target, triggers); table.persistentExport = export; }
Source:
private void readCheckerEnablementVerifier() { IExtensionPoint ep = getExtensionPoint(CHECKER_ENABLEMENT_EXTENSION_POINT_NAME); for (IConfigurationElement ce : ep.getConfigurationElements()) { try { checkerEnablementVerifier = (ICheckerEnablementVerifier) ce.createExecutableExtension(CLASS_ATTR); } catch (CoreException e) { CodanCorePlugin.log(e); } } }

Target:
private void readCheckerEnablementVerifier() { IExtensionPoint ep = getExtensionPoint(CHECKER_ENABLEMENT_EXTENSION_POINT_NAME); for (IConfigurationElement ce : ep.getConfigurationElements()) { try { checkerEnablementVerifiers.add((ICheckerEnablementVerifier) ce.createExecutableExtension(CLASS_ATTR)); } catch (CoreException e) { CodanCorePlugin.log(e); } } }
Source:
private <T> void registerComponentGauges() { Gauge.Builder<?> builder = Gauge.builder("spring.integration.channels", this, (c) -> this.applicationContext.getBeansOfType(MessageChannel.class).size()); builder.tags(this.componentCountTagProvider.apply("channels")) .description("The Number of Message Channels") .register(this.meterRegistry); builder = Gauge.builder("spring.integration.handlers", this, (c) -> this.applicationContext.getBeansOfType(MessageHandler.class).size()); builder.tags(this.componentCountTagProvider.apply("handlers")) .description("The Number of Message Handlers") .register(this.meterRegistry); builder = Gauge.builder("spring.integration.sources", this, (c) -> this.applicationContext.getBeansOfType(MessageSource.class).size()); builder.tags(this.componentCountTagProvider.apply("sources")) .description("The number of Message Sources") .register(this.meterRegistry); }

Target:
private void registerComponentGauges() { Gauge.Builder<?> builder = Gauge.builder("spring.integration.channels", this, (c) -> this.applicationContext.getBeansOfType(MessageChannel.class).size()); builder.tags(this.componentCountTagProvider.apply("channels")) .description("The Number of Message Channels") .register(this.meterRegistry); builder = Gauge.builder("spring.integration.handlers", this, (c) -> this.applicationContext.getBeansOfType(MessageHandler.class).size()); builder.tags(this.componentCountTagProvider.apply("handlers")) .description("The Number of Message Handlers") .register(this.meterRegistry); builder = Gauge.builder("spring.integration.sources", this, (c) -> this.applicationContext.getBeansOfType(MessageSource.class).size()); builder.tags(this.componentCountTagProvider.apply("sources")) .description("The number of Message Sources") .register(this.meterRegistry); }
Source:
public void playerWin(Player p) { if (GameMode.DISABLED == mode) return; Player win = activePlayers.get(0); win.teleport(SettingsManager.getInstance().getLobbySpawn()); restoreInv(win); msgmgr.broadcastFMessage(PrefixType.INFO, "game.playerwin","arena-"+gameID, "victim-"+p.getName(), "player-"+win.getName()); LobbyManager.getInstance().display(new String[] { win.getName(), "", "Won the ", "Survival Games!" }, gameID); mode = GameMode.FINISHING; if(config.getBoolean("reward.enabled", false)){ win.getInventory().addItem(new ItemStack(config.getInt("reward.item"), config.getInt("reward.amount"))); } clearSpecs(); win.setHealth(p.getMaxHealth()); win.setFoodLevel(20); win.setFireTicks(0); win.setFallDistance(0); sm.playerWin(win, gameID, new Date().getTime() - startTime); sm.saveGame(gameID, win, getActivePlayers() + getInactivePlayers(), new Date().getTime() - startTime); activePlayers.clear(); inactivePlayers.clear(); spawns.clear(); loadspawns(); LobbyManager.getInstance().updateWall(gameID); }

Target:
public void playerWin(Player p) { if (GameMode.DISABLED == mode) return; Player win = activePlayers.get(0); win.teleport(SettingsManager.getInstance().getLobbySpawn()); restoreInv(win); msgmgr.broadcastFMessage(PrefixType.INFO, "game.playerwin","arena-"+gameID, "victim-"+p.getName(), "player-"+win.getName()); LobbyManager.getInstance().display(new String[] { win.getName(), "", "Won the ", "Survival Games!" }, gameID); mode = GameMode.FINISHING; if(config.getBoolean("reward.enabled", false)){ List<String> items = config.getStringList("reward.contents"); for(int i=0; i<=(items.size()-1); i++){ ItemStack item = ItemReader.read(items.get(i)); win.getInventory().addItem(item); } } clearSpecs(); win.setHealth(p.getMaxHealth()); win.setFoodLevel(20); win.setFireTicks(0); win.setFallDistance(0); sm.playerWin(win, gameID, new Date().getTime() - startTime); sm.saveGame(gameID, win, getActivePlayers() + getInactivePlayers(), new Date().getTime() - startTime); activePlayers.clear(); inactivePlayers.clear(); spawns.clear(); loadspawns(); LobbyManager.getInstance().updateWall(gameID); }
Source:
public SimpleExpression<A> getValue() { if (value == null) { value = Expressions.template(target.getType(), "{0} over ({1})", (List<?>) ImmutableList.of(target, super.getValue())); } return value; }

Target:
public SimpleExpression<A> getValue() { SimpleExpression<A> value = this.value; if (value == null) { this.value = value = Expressions.template(target.getType(), "{0} over ({1})", (List<?>) ImmutableList.of(target, super.getValue())); } return value; }
Source:
public void myGroups(final AsyncCallback<List<GroupDetail>> callback) { run(callback, new Action<List<GroupDetail>>() { public List<GroupDetail> run(final ReviewDb db) throws OrmException, NoSuchGroupException, Failure { List<GroupDetail> groups = new ArrayList<GroupDetail>(); try { for(AccountGroup group : myGroupsFactory.create().call()) { groups.add(groupDetailFactory.create(group.getId()).call()); } } catch (Exception e) { throw new Failure(e); } return groups; } }); }

Target:
public void myGroups(final AsyncCallback<List<GroupDetail>> callback) { run(callback, new Action<List<GroupDetail>>() { public List<GroupDetail> run(final ReviewDb db) throws OrmException, NoSuchGroupException, Failure { List<GroupDetail> groupDetails = new ArrayList<GroupDetail>(); for(AccountGroup group : myGroupsFactory.create().call()) { groupDetails.add(groupDetailFactory.create(group.getId()).call()); } return groupDetails; } }); }
Source:
public SnapshotFileBatchTextSinkConfig(String name, @Nullable String basePath, @Nullable String delimiter) { super(name, basePath, null); this.delimiter = delimiter == null ? "\t" : delimiter; }

Target:
public SnapshotFileBatchTextSinkConfig(String name, @Nullable String basePath, @Nullable String delimiter) { super(name, basePath, null); this.delimiter = delimiter; }
Source:
public static BlockState adapt(BlockData blockData) { checkNotNull(blockData); int cacheKey = WorldEditPlugin.getInstance().getBukkitImplAdapter() != null ? WorldEditPlugin.getInstance().getBukkitImplAdapter().getInternalBlockStateId(blockData) .orElseGet(() -> blockData.getAsString().hashCode()) : blockData.getAsString().hashCode(); return blockStateCache.computeIfAbsent(cacheKey, input -> { try { return WorldEdit.getInstance().getBlockFactory().parseFromInput(blockData.getAsString(), TO_BLOCK_CONTEXT).toImmutableState(); } catch (InputParseException e) { e.printStackTrace(); return null; } }); }

Target:
public static BlockState adapt(BlockData blockData) { checkNotNull(blockData); if (WorldEditPlugin.getInstance().getBukkitImplAdapter() == null) { return blockStateStringCache.computeIfAbsent(blockData.getAsString(), input -> { try { return WorldEdit.getInstance().getBlockFactory().parseFromInput(input, TO_BLOCK_CONTEXT).toImmutableState(); } catch (InputParseException e) { e.printStackTrace(); return null; } }); } else { return blockStateCache.computeIfAbsent( WorldEditPlugin.getInstance().getBukkitImplAdapter().getInternalBlockStateId(blockData).orElseGet( () -> blockData.getAsString().hashCode() ), input -> { try { return WorldEdit.getInstance().getBlockFactory().parseFromInput(blockData.getAsString(), TO_BLOCK_CONTEXT).toImmutableState(); } catch (InputParseException e) { e.printStackTrace(); return null; } }); } }
Source:
public void extractColumns(QueryContext query) { Set<String> columns = new HashSet<>(); for (ExpressionContext expression : query._selectExpressions) { expression.getColumns(columns); } if (query._filter != null) { query._filter.getColumns(columns); } if (query._groupByExpressions != null) { for (ExpressionContext expression : query._groupByExpressions) { expression.getColumns(columns); } } if (query._havingFilter != null) { query._havingFilter.getColumns(columns); } if (query._orderByExpressions != null) { for (OrderByExpressionContext orderByExpression : query._orderByExpressions) { orderByExpression.getColumns(columns); } } if (query._aggregationFunctions != null) { for (AggregationFunction aggregationFunction : query._aggregationFunctions) { List<ExpressionContext> inputExpressions = aggregationFunction.getInputExpressions(); for (ExpressionContext expression : inputExpressions) { expression.getColumns(columns); } } } query._columns = columns; }

Target:
private void extractColumns(QueryContext query) { Set<String> columns = new HashSet<>(); for (ExpressionContext expression : query._selectExpressions) { expression.getColumns(columns); } if (query._filter != null) { query._filter.getColumns(columns); } if (query._groupByExpressions != null) { for (ExpressionContext expression : query._groupByExpressions) { expression.getColumns(columns); } } if (query._havingFilter != null) { query._havingFilter.getColumns(columns); } if (query._orderByExpressions != null) { for (OrderByExpressionContext orderByExpression : query._orderByExpressions) { orderByExpression.getColumns(columns); } } if (query._aggregationFunctions != null) { for (AggregationFunction aggregationFunction : query._aggregationFunctions) { List<ExpressionContext> inputExpressions = aggregationFunction.getInputExpressions(); for (ExpressionContext expression : inputExpressions) { expression.getColumns(columns); } } } query._columns = columns; }
Source:
public void validate(Factory factory) throws ForbiddenException, ServerException { Author author = factory.getCreator(); if (author == null || author.getUserId() == null) { throw new ServerException(format("Invalid factory without author stored. Please contact the support about the factory ID '%s'", factory.getId())); } final String userId = EnvironmentContext.getCurrent().getSubject().getUserId(); if (userId == null || !userId.equals(author.getUserId())) { throw new ForbiddenException(format("You are not authorized for the factory '%s'", factory.getId())); } }

Target:
public void validate(Factory factory) throws ForbiddenException, ServerException { Author author = factory.getCreator(); if (author == null || author.getUserId() == null) { throw new ServerException(format("Invalid factory without author stored. Please contact the support about the factory ID '%s'", factory.getId())); } final String userId = EnvironmentContext.getCurrent().getSubject().getUserId(); if (!author.getUserId().equals(userId)) { throw new ForbiddenException(format("You are not authorized for the factory '%s'", factory.getId())); } }
Source:
public <T> T getValue(ConfigValues name, String version) { T returnValue; Map<String, Object> values = null; if ((values = _vdcOptionCache.get(name.toString())) != null && (values.containsKey(version) || values.containsKey("general"))) { returnValue = (T) values.get(version); } else { VdcOption option = new VdcOption(); option.setoption_name(name.toString()); option.setoption_value(null); returnValue = (T) getValue(option); if (values != null) { values.put(version, returnValue); } else { Map<String, Object> defaultValues = new HashMap<String, Object>(); defaultValues.put(version, returnValue); _vdcOptionCache.put(option.getoption_name(), defaultValues); log.debug("Adding new value to configuration cache."); } log.debugFormat("Didn't find the value of {0} in DB for version {1} - using default: {2}", name, version, returnValue); } return returnValue; }

Target:
public <T> T getValue(ConfigValues name, String version) { T returnValue; Map<String, Object> values = null; if ((values = _vdcOptionCache.get(name.toString())) != null && (values.containsKey(version))) { returnValue = (T) values.get(version); } else { VdcOption option = new VdcOption(); option.setoption_name(name.toString()); option.setoption_value(null); returnValue = (T) getValue(option); if (values != null) { values.put(version, returnValue); } else { Map<String, Object> defaultValues = new HashMap<String, Object>(); defaultValues.put(version, returnValue); _vdcOptionCache.put(option.getoption_name(), defaultValues); log.debug("Adding new value to configuration cache."); } log.debugFormat("Didn't find the value of {0} in DB for version {1} - using default: {2}", name, version, returnValue); } return returnValue; }
Source:
public void restoreState() { File stateFile = getWorkingSetStateFile(); if (stateFile != null && stateFile.exists()) { try { restoreInProgress = true; FileInputStream input = new FileInputStream(stateFile); try (BufferedReader reader = new BufferedReader(new InputStreamReader(input, StandardCharsets.UTF_8))) { IMemento memento = XMLMemento.createReadRoot(reader); restoreWorkingSetState(memento); restoreMruList(memento); } } catch (IOException | WorkbenchException e) { handleInternalError(e, WorkbenchMessages.ProblemRestoringWorkingSetState_title, WorkbenchMessages.ProblemRestoringWorkingSetState_message); } finally { restoreInProgress = false; } if (savePending) { saveState(); savePending = false; } } }

Target:
public void restoreState() { File stateFile = getWorkingSetStateFile(); if (stateFile != null && stateFile.exists()) { try { restoreInProgress = true; try (FileInputStream input = new FileInputStream(stateFile); BufferedReader reader = new BufferedReader( new InputStreamReader(input, StandardCharsets.UTF_8))) { IMemento memento = XMLMemento.createReadRoot(reader); restoreWorkingSetState(memento); restoreMruList(memento); } } catch (IOException | WorkbenchException e) { handleInternalError(e, WorkbenchMessages.ProblemRestoringWorkingSetState_title, WorkbenchMessages.ProblemRestoringWorkingSetState_message); } finally { restoreInProgress = false; } if (savePending) { saveState(); savePending = false; } } }
Source:
public AnAction[] getChildren( @Nullable AnActionEvent e) { if (sessionManager == null && connectionService == null) { SarosPluginContext.initComponent(this); } if (e == null || sessionManager.getSession() != null) { return new AnAction[0]; } if (!isSharableResource(e)) { return new AnAction[0]; } Roster roster = connectionService.getRoster(); if (roster == null) { return new AnAction[0]; } int userCount = 0; List<AnAction> list = new ArrayList<>(); for (RosterEntry rosterEntry : roster.getEntries()) { Presence presence = roster.getPresence(rosterEntry.getUser()); if (presence.getType() == Presence.Type.available) { list.add(new ShareWithUserAction(new JID(rosterEntry.getUser()), userCount)); userCount++; } } return list.toArray(new AnAction[0]); }

Target:
public AnAction[] getChildren( @Nullable AnActionEvent e) { if (sessionManager == null && connectionService == null) { SarosPluginContext.initComponent(this); } if (e == null || sessionManager.getSession() != null) { return new AnAction[0]; } if (!isSharableResource(e)) { return new AnAction[0]; } Roster roster = connectionService.getRoster(); if (roster == null) { return new AnAction[0]; } int userCount = 1; List<AnAction> list = new ArrayList<>(); for (RosterEntry rosterEntry : roster.getEntries()) { Presence presence = roster.getPresence(rosterEntry.getUser()); if (presence.getType() == Presence.Type.available) { list.add(new ShareWithUserAction(new JID(rosterEntry.getUser()), userCount)); userCount++; } } return list.toArray(new AnAction[0]); }
Source:
public static CosmosClientBuilder cloneCosmosClientBuilder(CosmosClientBuilder builder) { CosmosClientBuilder copy = new CosmosClientBuilder(); copy.endpoint(builder.getEndpoint()) .key(builder.getKey()) .directMode(builder.getDirectConnectionConfig()) .gatewayMode(builder.getGatewayConnectionConfig()) .consistencyLevel(builder.getConsistencyLevel()) .keyCredential(builder.getKeyCredential()) .permissions(builder.getPermissions()) .authorizationTokenResolver(builder.getAuthorizationTokenResolver()) .resourceToken(builder.getResourceToken()) .contentResponseOnWriteEnabled(builder.isContentResponseOnWriteEnabled()) .userAgentSuffix(builder.getUserAgentSuffix()) .throttlingRetryOptions(builder.getThrottlingRetryOptions()) .preferredRegions(builder.getPreferredRegions()) .endpointDiscoverEnabled(builder.isEndpointDiscoveryEnabled()) .multipleWriteRegionsEnabled(builder.isMultipleWriteRegionsEnabled()) .readRequestsFallbackEnabled(builder.isReadRequestsFallbackEnabled()); return copy; }

Target:
public static CosmosClientBuilder cloneCosmosClientBuilder(CosmosClientBuilder builder) { CosmosClientBuilder copy = new CosmosClientBuilder(); copy.endpoint(builder.getEndpoint()) .key(builder.getKey()) .directMode(builder.getDirectConnectionConfig()) .gatewayMode(builder.getGatewayConnectionConfig()) .consistencyLevel(builder.getConsistencyLevel()) .keyCredential(builder.getKeyCredential()) .permissions(builder.getPermissions()) .authorizationTokenResolver(builder.getAuthorizationTokenResolver()) .resourceToken(builder.getResourceToken()) .contentResponseOnWriteEnabled(builder.isContentResponseOnWriteEnabled()) .userAgentSuffix(builder.getUserAgentSuffix()) .throttlingRetryOptions(builder.getThrottlingRetryOptions()) .preferredRegions(builder.getPreferredRegions()) .endpointDiscoveryEnabled(builder.isEndpointDiscoveryEnabled()) .multipleWriteRegionsEnabled(builder.isMultipleWriteRegionsEnabled()) .readRequestsFallbackEnabled(builder.isReadRequestsFallbackEnabled()); return copy; }
Source:
private static void sanityCheckReplicationFactor(KsDef ks, CassandraKeyValueServiceConfig config, Set<String> dcs) { Map<String, String> strategyOptions = Maps.newHashMap(ks.getStrategy_options()); for (String dc : dcs) { if (strategyOptions.get(dc) == null) { logErrorOrThrow("The datacenter for this cassandra cluster is invalid. " + " failed dc: " + dc + " strategyOptions: " + strategyOptions, config.ignoreBadDatacenterConfigurationChecks()); } } String dc = dcs.iterator().next(); int currentRf = Integer.parseInt(strategyOptions.get(dc)); if (currentRf != config.replicationFactor()) { throw new UnsupportedOperationException("Your current Cassandra keyspace (" + ks.getName() + ") has a replication factor not matching your Atlas Cassandra configuration." + " Change them to match, but be mindful of what steps you'll need to" + " take to correctly repair or cleanup existing data in your cluster."); } }

Target:
private static void sanityCheckReplicationFactor(KsDef ks, CassandraKeyValueServiceConfig config, Set<String> dcs) { Map<String, String> strategyOptions = Maps.newHashMap(ks.getStrategy_options()); for (String dc : dcs) { if (strategyOptions.get(dc) == null) { logErrorOrThrow("The datacenter for this cassandra cluster is invalid. " + " failed dc: " + dc + " strategyOptions: " + strategyOptions, config.ignoreDatacenterConfigurationChecks()); } } if (Integer.parseInt(strategyOptions.get(dcs.iterator().next())) != config.replicationFactor()) { throw new UnsupportedOperationException("Your current Cassandra keyspace (" + ks.getName() + ") has a replication factor not matching your Atlas Cassandra configuration." + " Change them to match, but be mindful of what steps you'll need to" + " take to correctly repair or cleanup existing data in your cluster."); } }
Source:
protected boolean requiresRuntime(OperationContext context) { return context.isDefaultRequiresRuntime() && context.getRunningMode() != RunningMode.ADMIN_ONLY; }

Target:
protected boolean requiresRuntime(OperationContext context) { return context.isDefaultRequiresRuntime(); }
Source:
public void switchListById(int id) { if (id < 0) { return; } StoredList list = cgData.getList(id); if (list == null) { return; } listId = list.id; title = list.title; Settings.saveLastList(listId); showProgress(true); showFooterLoadingCaches(); final List<Geocache> caches = adapter.getCheckedCaches(); cgData.moveToList(caches, listId); currentLoader = (AbstractSearchLoader) getSupportLoaderManager().initLoader(CacheListType.OFFLINE.ordinal(), new Bundle(), this); currentLoader.reset(); currentLoader.startLoading(); invalidateOptionsMenuCompatible(); }

Target:
public void switchListById(int id) { if (id < 0) { return; } StoredList list = cgData.getList(id); if (list == null) { return; } listId = list.id; title = list.title; Settings.saveLastList(listId); showProgress(true); showFooterLoadingCaches(); cgData.moveToList(adapter.getCheckedCaches(), listId); currentLoader = (AbstractSearchLoader) getSupportLoaderManager().initLoader(CacheListType.OFFLINE.ordinal(), new Bundle(), this); currentLoader.reset(); currentLoader.startLoading(); invalidateOptionsMenuCompatible(); }
Source:
public int getWindowFunctionExpressionCount() { return 0; }

Target:
public int getWindowFunctionExpressionCount() { return m_windowFunctionExpressions.size(); }
Source:
public void handle(HttpServletRequest request, HttpServletResponse response, AccessDeniedException accessDeniedException) throws IOException, ServletException { BufferedRequestWrapper bufferedRequest = new BufferedRequestWrapper(request); log.debug(MessageFormat.format("requestXML:{0},uri:{1}", bufferedRequest.getInputStreamString(), request.getRequestURI())); BaseResponseDto dto = mobileAppTokenProvider.generateResponseDto(ReturnMessage.UNAUTHORIZED); response.setContentType("application/json; charset=UTF-8"); response.setCharacterEncoding(StandardCharsets.UTF_8.name()); PrintWriter out = response.getWriter(); String jsonString = objectMapper.writeValueAsString(dto); out.print(jsonString); }

Target:
public void handle(HttpServletRequest request, HttpServletResponse response, AccessDeniedException accessDeniedException) throws IOException, ServletException { BufferedRequestWrapper bufferedRequest = new BufferedRequestWrapper(request); log.debug(MessageFormat.format("[Access Denied] uri: {0} body: {1}",request.getRequestURI(),bufferedRequest.getInputStreamString())); BaseResponseDto dto = mobileAppTokenProvider.generateResponseDto(ReturnMessage.UNAUTHORIZED); response.setContentType("application/json; charset=UTF-8"); response.setCharacterEncoding(StandardCharsets.UTF_8.name()); PrintWriter out = response.getWriter(); String jsonString = objectMapper.writeValueAsString(dto); out.print(jsonString); }
Source:
public Set<String> getSelectedRecipients() { return Optional.ofNullable(selectedRecipients).orElse(new HashSet<>()); }

Target:
public Set<String> getSelectedRecipients() { return Optional.ofNullable(selectedRecipients).orElseGet(HashSet::new); }
Source:
public void testGetNumericWithoutArg() throws SQLException { assumeCallableStatementsSupported(); try (CallableStatement call = con.prepareCall(func + pkgName + "getNumericWithoutArg () }")) { call.registerOutParameter(1, Types.NUMERIC); call.execute(); assertEquals(new BigDecimal(42), call.getObject(1, BigDecimal.class)); } }

Target:
public void testGetNumericWithoutArg() throws SQLException { try (CallableStatement call = con.prepareCall(func + pkgName + "getNumericWithoutArg () }")) { call.registerOutParameter(1, Types.NUMERIC); call.execute(); assertEquals(new BigDecimal(42), call.getObject(1, BigDecimal.class)); } }
Source:
private void extendAndInvalidateLine() { mPolyline.addPoint(new GeoPoint(40.0, -11.0)); mPolyline.addPoint(new GeoPoint(40.5, -11.5)); mPolyline.addPoint(new GeoPoint(41.0, -11.0)); mPolyline.addPoint(new GeoPoint(41.5, -11.5)); mMapping.add(80.f); mMapping.add(60.f); mMapping.add(100.f); mMapping.add(100.f); mContainer.add(80.f); mContainer.add(60.f); mContainer.add(100.f); mContainer.add(100.f); mMapping.init(0,100, 0,120); mContainer.refresh(); mMapView.invalidate(); textViewCurrentLocation.setText("New scalar range from 0 to 100\nfor hue ranging from 0 to 120."); btnProceed.setText("Reset Polyline"); }

Target:
private void extendAndInvalidateLine() { addDataToPolyline(mExtendedData); mMapping.init(MIN_SCALAR, MAX_SCALAR_EXTENDED, MIN_HUE, MAX_HUE); mContainer.refresh(); mMapView.invalidate(); textInformation.setText(String.format(mInformation, MIN_SCALAR, MAX_SCALAR_EXTENDED, MIN_HUE , MAX_HUE)); btnProceed.setText(sReset); }
Source:
public static <T extends Enum<T>> T resolve(Class<T> type, String token) { try { return Enum.valueOf(type, token.toUpperCase()); } catch (Exception e) { Exceptions.propagateIfFatal(e); try { @SuppressWarnings("unchecked") T[] values = (T[]) type.getMethod("values").invoke(null); for (T v: values) if (v.name().equalsIgnoreCase(token)) return v; throw e; } catch (Exception e2) { throw Exceptions.propagate(e2); } } }

Target:
public static <T extends Enum<T>> T resolve(Class<T> type, String token) { try { return Enum.valueOf(type, token.toUpperCase()); } catch (Exception e) { Exceptions.propagateIfFatal(e); try { for (T v: type.getEnumConstants()) if (v.name().equalsIgnoreCase(token)) return v; throw e; } catch (Exception e2) { throw Exceptions.propagate(e2); } } }
Source:
public void updateSharedScope(Scope sharedScope, String tenantDomain) throws APIManagementException { int tenantId = APIUtil.getTenantIdFromTenantDomain(tenantDomain); Map<String, KeyManagerDto> tenantKeyManagers = KeyManagerHolder.getTenantKeyManagers(tenantDomain); for (Map.Entry<String, KeyManagerDto> keyManagerEntry : tenantKeyManagers.entrySet()) { KeyManager keyManager = keyManagerEntry.getValue().getKeyManager(); if (keyManager != null) { try{ keyManager.updateScope(sharedScope); }catch (APIManagementException e){ log.error("Error while Updating Shared Scope " + sharedScope.getKey() + " from KeyManager " + keyManagerEntry.getKey(), e); } } } scopesDAO.updateScope(sharedScope, tenantId); }

Target:
public void updateSharedScope(Scope sharedScope, String tenantDomain) throws APIManagementException { int tenantId = APIUtil.getTenantIdFromTenantDomain(tenantDomain); Map<String, KeyManagerDto> tenantKeyManagers = KeyManagerHolder.getTenantKeyManagers(tenantDomain); for (Map.Entry<String, KeyManagerDto> keyManagerEntry : tenantKeyManagers.entrySet()) { KeyManager keyManager = keyManagerEntry.getValue().getKeyManager(); if (keyManager != null) { try { keyManager.updateScope(sharedScope); } catch (APIManagementException e) { log.error("Error while Updating Shared Scope " + sharedScope.getKey() + " from Key Manager " + keyManagerEntry.getKey(), e); } } } updateScope(sharedScope, tenantId); }
Source:
public String configureConnector(String connName, Map<String, String> connConfig) { String url = endpointForResource(String.format("connectors/%s/config", connName)); ObjectMapper mapper = new ObjectMapper(); String content; try { content = mapper.writeValueAsString(connConfig); } catch (IOException e) { throw new ConnectException("Could not serialize connector configuration and execute PUT request"); } Response response = executePut(url, content); if (response.getStatus() < Response.Status.BAD_REQUEST.getStatusCode()) { return responseToString(response); } throw new ConnectRestException(response.getStatus(), "Could not execute PUT request"); }

Target:
public String configureConnector(String connName, Map<String, String> connConfig) { String url = endpointForResource(String.format("connectors/%s/config", connName)); ObjectMapper mapper = new ObjectMapper(); String content; try { content = mapper.writeValueAsString(connConfig); } catch (IOException e) { throw new ConnectException("Could not serialize connector configuration and execute PUT request"); } Response response = requestPut(url, content); if (response.getStatus() < Response.Status.BAD_REQUEST.getStatusCode()) { return responseToString(response); } throw new ConnectRestException(response.getStatus(), "Could not execute PUT request"); }
Source:
private TaskTracker forExistingTable(AddPartitionDesc lastPartitionReplicated) throws Exception { boolean encounteredTheLastReplicatedPartition = (lastPartitionReplicated == null); Map<String, String> lastReplicatedPartSpec = null; if (!encounteredTheLastReplicatedPartition) { lastReplicatedPartSpec = lastPartitionReplicated.getPartition(0).getPartSpec(); LOG.info("Start processing from partition info spec : {}", StringUtils.mapToString(lastReplicatedPartSpec)); } Iterator<AddPartitionDesc> partitionIterator = event.partitionDescriptions(tableDesc).iterator(); while (!encounteredTheLastReplicatedPartition && partitionIterator.hasNext()) { AddPartitionDesc addPartitionDesc = partitionIterator.next(); Map<String, String> currentSpec = addPartitionDesc.getPartition(0).getPartSpec(); encounteredTheLastReplicatedPartition = lastReplicatedPartSpec.equals(currentSpec); } while (partitionIterator.hasNext() && tracker.canAddMoreTasks()) { AddPartitionDesc addPartitionDesc = partitionIterator.next(); Map<String, String> partSpec = addPartitionDesc.getPartition(0).getPartSpec(); Task<?> ptnRootTask = null; LoadOpType opType = getLoadOpType(partSpec); switch (opType) { case LOAD_NEW: break; case LOAD_REPLACE: ptnRootTask = dropPartitionTask(table, partSpec); break; case LOAD_INVALID: throw new InvalidOperationException("Load not allowed on table " + table.getFullyQualifiedName() + " for partition " + partSpec + " as it was already bootstrap loaded from another dump."); case LOAD_SKIP: continue; } addPartition(partitionIterator.hasNext(), addPartitionDesc, ptnRootTask); } return tracker; }

Target:
private TaskTracker forExistingTable(AddPartitionDesc lastPartitionReplicated) throws Exception { boolean encounteredTheLastReplicatedPartition = (lastPartitionReplicated == null); Map<String, String> lastReplicatedPartSpec = null; if (!encounteredTheLastReplicatedPartition) { lastReplicatedPartSpec = lastPartitionReplicated.getPartition(0).getPartSpec(); LOG.info("Start processing from partition info spec : {}", StringUtils.mapToString(lastReplicatedPartSpec)); } Iterator<AddPartitionDesc> partitionIterator = event.partitionDescriptions(tableDesc).iterator(); while (!encounteredTheLastReplicatedPartition && partitionIterator.hasNext()) { AddPartitionDesc addPartitionDesc = partitionIterator.next(); Map<String, String> currentSpec = addPartitionDesc.getPartition(0).getPartSpec(); encounteredTheLastReplicatedPartition = lastReplicatedPartSpec.equals(currentSpec); } while (partitionIterator.hasNext() && tracker.canAddMoreTasks()) { AddPartitionDesc addPartitionDesc = partitionIterator.next(); Map<String, String> partSpec = addPartitionDesc.getPartition(0).getPartSpec(); Task<?> ptnRootTask = null; ReplLoadOpType loadPtnType = getLoadPartitionType(partSpec); switch (loadPtnType) { case LOAD_NEW: break; case LOAD_REPLACE: ptnRootTask = dropPartitionTask(table, partSpec); break; case LOAD_SKIP: continue; default: break; } addPartition(partitionIterator.hasNext(), addPartitionDesc, ptnRootTask); } return tracker; }
Source:
private int decodeFlags(Map<String, String> applicationAttributes) { int applicationFlags = 0; for (Pair<String, Integer> pair : asList( Pair.create("android:allowBackup", FLAG_ALLOW_BACKUP), Pair.create("android:allowClearUserData", FLAG_ALLOW_CLEAR_USER_DATA), Pair.create("android:allowTaskReparenting", FLAG_ALLOW_TASK_REPARENTING), Pair.create("android:debuggable", FLAG_DEBUGGABLE), Pair.create("android:hasCode", FLAG_HAS_CODE), Pair.create("android:killAfterRestore", FLAG_KILL_AFTER_RESTORE), Pair.create("android:persistent", FLAG_PERSISTENT), Pair.create("android:resizeable", FLAG_RESIZEABLE_FOR_SCREENS), Pair.create("android:restoreAnyVersion", FLAG_RESTORE_ANY_VERSION), Pair.create("android:largeScreens", FLAG_SUPPORTS_LARGE_SCREENS), Pair.create("android:normalScreens", FLAG_SUPPORTS_NORMAL_SCREENS), Pair.create("android:anyDensity", FLAG_SUPPORTS_SCREEN_DENSITIES), Pair.create("android:smallScreens", FLAG_SUPPORTS_SMALL_SCREENS), Pair.create("android:testOnly", FLAG_TEST_ONLY), Pair.create("android:vmSafeMode", FLAG_VM_SAFE_MODE) )) { if ("true".equals(applicationAttributes.get(pair.first))) { applicationFlags |= pair.second; } } return applicationFlags; }

Target:
private int decodeFlags(Map<String, String> applicationAttributes) { int applicationFlags = 0; for (Pair<String, Integer> pair : APPLICATION_FLAGS) { if ("true".equals(applicationAttributes.get(pair.first))) { applicationFlags |= pair.second; } } return applicationFlags; }
Source:
ByteBuf duplicate() { return (slice == srcBuf ? srcBuf : srcBuf.slice()).duplicate(); }

Target:
ByteBuf duplicate() { return srcBuf.duplicate(); }
Source:
public SAMFileSpan removeContentsBefore(final SAMFileSpan fileSpan) { if(fileSpan == null) return clone(); if(!(fileSpan instanceof BAMFileSpan)) throw new SAMException("Unable to compare "); final BAMFileSpan bamFileSpan = (BAMFileSpan)fileSpan; if(bamFileSpan.isEmpty()) return clone(); validateSorted(); final BAMFileSpan trimmedChunkList = new BAMFileSpan(); long chunkStart = bamFileSpan.chunks.get(0).getChunkStart(); for(final Chunk chunkToTrim: chunks) { if(chunkToTrim.getChunkEnd() > chunkStart) { if(chunkToTrim.getChunkStart() >= chunkStart) { trimmedChunkList.add(chunkToTrim.clone()); } else { trimmedChunkList.add(new Chunk(chunkStart,chunkToTrim.getChunkEnd())); } } } return trimmedChunkList; }

Target:
public SAMFileSpan removeContentsBefore(final SAMFileSpan fileSpan) { if(fileSpan == null) return clone(); if(!(fileSpan instanceof BAMFileSpan)) throw new SAMException("Unable to compare "); final BAMFileSpan bamFileSpan = (BAMFileSpan)fileSpan; if(bamFileSpan.isEmpty()) return clone(); validateSorted(); final BAMFileSpan trimmedChunkList = new BAMFileSpan(); final long chunkStart = bamFileSpan.chunks.get(0).getChunkStart(); for(final Chunk chunkToTrim: chunks) { if(chunkToTrim.getChunkEnd() > chunkStart) { if(chunkToTrim.getChunkStart() >= chunkStart) { trimmedChunkList.add(chunkToTrim.clone()); } else { trimmedChunkList.add(new Chunk(chunkStart,chunkToTrim.getChunkEnd())); } } } return trimmedChunkList; }