auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void prepareWorkspace() { if (!projectHelper.projectExists(PROJECT_NAME)) { CDIProjectWizard cw = new CDIProjectWizard(); cw.open(); WebProjectFirstPage fp = new WebProjectFirstPage(cw); fp.setProjectName(PROJECT_NAME); if (CDIVersion.equals("2.0")) { new DefaultCombo(2).setSelection("Dynamic Web Project with CDI 2.0 (Contexts and Dependency Injection)"); } fp.setTargetRuntime(sr.getRuntimeName()); if (isJavaLE8() || CDIVersion.equals("1.0")) { fp.activateFacet("1.8", "Java"); } else { fp.activateFacet("11", "Java"); } fp.activateFacet(CDIVersion, "CDI (Contexts and Dependency Injection)"); cw.finish(); new WaitUntil(new JobIsRunning(), TimePeriod.DEFAULT, false); new WaitWhile(new JobIsRunning(), TimePeriod.LONG); setWorkspaceDefaultJREForJava8(); } }

Target:
public void prepareWorkspace() { if (!projectHelper.projectExists(PROJECT_NAME)) { CDIProjectWizard pw = new CDIProjectWizard(); pw.open(); WebProjectFirstPage fp = new WebProjectFirstPage(pw); fp.setProjectName(PROJECT_NAME); if (CDIVersion.equals("2.0")) { new DefaultCombo(2).setSelection("Dynamic Web Project with CDI 2.0 (Contexts and Dependency Injection)"); } fp.setTargetRuntime(sr.getRuntimeName()); activateFacets(fp); fp.activateFacet(CDIVersion, "CDI (Contexts and Dependency Injection)"); pw.finish(); new WaitWhile(new JobIsRunning(), TimePeriod.LONG); } }
Source:
protected String getToExpression(ConversionContext conversionContext) { return "new java.sql.Timestamp( <SOURCE>.getTime() )"; }

Target:
protected String getToExpression(ConversionContext conversionContext) { return "new Timestamp( <SOURCE>.getTime() )"; }
Source:
public Type visitGroupingOperation(GroupingOperation node, StackableAstVisitorContext<Context> context) { if (node.getGroupingColumns().size() > MAX_NUMBER_GROUPING_ARGUMENTS) { throw new SemanticException(INVALID_PROCEDURE_ARGUMENTS, node, "GROUPING supports up to 63 column arguments"); } for (Expression columnArgument : node.getGroupingColumns()) { process(columnArgument, context); } expressionTypes.put(node, INTEGER); return INTEGER; }

Target:
public Type visitGroupingOperation(GroupingOperation node, StackableAstVisitorContext<Context> context) { if (node.getGroupingColumns().size() > MAX_NUMBER_GROUPING_ARGUMENTS_BIGINT) { throw new SemanticException(INVALID_PROCEDURE_ARGUMENTS, node, String.format("GROUPING supports up to %d column arguments", MAX_NUMBER_GROUPING_ARGUMENTS_BIGINT)); } for (Expression columnArgument : node.getGroupingColumns()) { process(columnArgument, context); } if (node.getGroupingColumns().size() <= MAX_NUMBER_GROUPING_ARGUMENTS_INTEGER) { expressionTypes.put(node, INTEGER); return INTEGER; } else { expressionTypes.put(node, BIGINT); return BIGINT; } }
Source:
public TaskManifest findTaskManifestById(Long id) { TaskExecution taskExecution = this.taskExplorer.getTaskExecution(id); return this.dataflowTaskExecutionMetadataDao.getLatestManifest(taskExecution.getTaskName()); }

Target:
public TaskManifest findTaskManifestById(Long id) { TaskExecution taskExecution = this.taskExplorer.getTaskExecution(id); return this.dataflowTaskExecutionMetadataDao.findManifestById(taskExecution.getExecutionId()); }
Source:
public static BondMode getBondMode(String bondOptions){ if(bondOptions == null){ return BOND0; } String bondModeValue = findMode(bondOptions); if (bondModeValue == null){ return BOND0; } for (BondMode bondMode : BondMode.values()){ if (bondMode.getValue().equals(bondModeValue)){ return bondMode; } } return BOND0; }

Target:
public static BondMode getBondMode(String bondOptions){ if(bondOptions == null){ return null; } String bondModeValue = findMode(bondOptions); if (bondModeValue == null){ return null; } for (BondMode bondMode : BondMode.values()){ if (bondMode.getValue().equals(bondModeValue)){ return bondMode; } } return null; }
Source:
public void createPaymentRefund_responseWith400_whenConnectorResponseIsErrorDueToAmountRequestedIsNotAvailableForRefund() throws IOException { int amount = 1000; String externalChargeId = "charge_12345"; connectorMock.respondWithChargeFound(amount, GATEWAY_ACCOUNT_ID, externalChargeId, null, null, null, null, null, null, null, SupportedLanguage.ENGLISH, Boolean.FALSE,null, new RefundSummary("available", REFUND_AMOUNT_AVAILABLE, 1000), null, CARD_DETAILS); connectorMock.respondBadRequest_whenCreateARefund("full", amount, REFUND_AMOUNT_AVAILABLE, GATEWAY_ACCOUNT_ID, externalChargeId); String refundRequest = "{\"amount\":" + amount + "}"; InputStream body = postPaymentRefundAndThen(API_KEY, externalChargeId, refundRequest) .statusCode(400) .contentType(JSON) .extract() .body().asInputStream(); JsonAssert.with(body) .assertThat("$.*", hasSize(2)) .assertThat("$.code", is("P0603")) .assertThat("$.description", is("The payment is not available for refund. Payment refund status: full")); }

Target:
public void createPaymentRefund_responseWith400_whenConnectorResponseIsErrorDueToAmountRequestedIsNotAvailableForRefund() throws IOException { int amount = 1000; String externalChargeId = "charge_12345"; connectorMock.respondWithChargeFound(amount, GATEWAY_ACCOUNT_ID, externalChargeId, null, null, null, null, null, null, null, SupportedLanguage.ENGLISH, false, null, new RefundSummary("available", REFUND_AMOUNT_AVAILABLE, 1000), null, CARD_DETAILS); connectorMock.respondBadRequest_whenCreateARefund("full", amount, REFUND_AMOUNT_AVAILABLE, GATEWAY_ACCOUNT_ID, externalChargeId); String refundRequest = "{\"amount\":" + amount + "}"; InputStream body = postPaymentRefundAndThen(API_KEY, externalChargeId, refundRequest) .statusCode(400) .contentType(JSON) .extract() .body().asInputStream(); JsonAssert.with(body) .assertThat("$.*", hasSize(2)) .assertThat("$.code", is("P0603")) .assertThat("$.description", is("The payment is not available for refund. Payment refund status: full")); }
Source:
private String resolveNodeToTypeString(ASTNode node) { IBinding b = resolveNodeToBinding(node); if (b != null) { return new String(b.getName()); } return OBJECT_SIGNATURE; }

Target:
private String resolveNodeToTypeString(ASTNode node) { ITypeBinding b = resolveNodeToBinding(node); if (b != null) { return new String(b.getQualifiedName()); } return OBJECT_SIGNATURE; }
Source:
public static <K, V> void putIfAbsentDataContainer(InternalCacheEntry<K, V> ice, DataContainer<K, V> dataContainer, TimeService timeService, int segment) { if (ice == null) { throw new NullPointerException("Entry must be non null"); } K key = ice.getKey(); DataContainer.ComputeAction<K, V> putIfAbsentOrExpired = (k, oldEntry, factory) -> { if (oldEntry != null && (!oldEntry.canExpire() || !oldEntry.isExpired(timeService.wallClockTime()))) { return oldEntry; } return ice; }; if (segment != SEGMENT_NOT_PROVIDED && dataContainer instanceof InternalDataContainer) { ((InternalDataContainer<K, V>) dataContainer).compute(segment, key, putIfAbsentOrExpired); } else { dataContainer.compute(key, putIfAbsentOrExpired); } }

Target:
public static <K, V> void putIfAbsentDataContainer(InternalCacheEntry<K, V> ice, DataContainer<K, V> dataContainer, TimeService timeService, int segment) { K key = ice.getKey(); DataContainer.ComputeAction<K, V> putIfAbsentOrExpired = (k, oldEntry, factory) -> { if (oldEntry != null && (!oldEntry.canExpire() || !oldEntry.isExpired(timeService.wallClockTime()))) { return oldEntry; } return ice; }; if (segment != SEGMENT_NOT_PROVIDED && dataContainer instanceof InternalDataContainer) { ((InternalDataContainer<K, V>) dataContainer).compute(segment, key, putIfAbsentOrExpired); } else { dataContainer.compute(key, putIfAbsentOrExpired); } }
Source:
private static void setUnsafe(boolean value) throws Exception { UnsafeAvailChecker.overrideUnsafeAvail(value); Field field = UnsafeAvailChecker.class.getDeclaredField("unaligned"); field.setAccessible(true); Field modifiersField = Field.class.getDeclaredField("modifiers"); modifiersField.setAccessible(true); int oldModifiers = field.getModifiers(); modifiersField.setInt(field, oldModifiers & ~Modifier.FINAL); try { field.set(null, value); } finally { modifiersField.setInt(field, oldModifiers); } assertEquals(UnsafeAvailChecker.unaligned(), value); }

Target:
private static void setUnsafe(boolean value) throws Exception { Field field = Bytes.class.getDeclaredField("UNSAFE_UNALIGNED"); field.setAccessible(true); Field modifiersField = Field.class.getDeclaredField("modifiers"); modifiersField.setAccessible(true); int oldModifiers = field.getModifiers(); modifiersField.setInt(field, oldModifiers & ~Modifier.FINAL); try { field.set(null, value); } finally { modifiersField.setInt(field, oldModifiers); } assertEquals(Bytes.UNSAFE_UNALIGNED, value); }
Source:
private void countDownChildren(RootProcedureState<TEnvironment> procStack, Procedure<TEnvironment> procedure) { Procedure<TEnvironment> parent = procedures.get(procedure.getParentProcId()); if (parent == null) { assert procStack.isRollingback(); return; } if (parent.tryRunnable()) { store.update(parent); scheduler.addFront(parent); LOG.info("Finished subprocedure pid={}, resume processing parent {}", procedure.getProcId(), parent.toString().replace("pid=","ppid=")); return; } }

Target:
private void countDownChildren(RootProcedureState<TEnvironment> procStack, Procedure<TEnvironment> procedure) { Procedure<TEnvironment> parent = procedures.get(procedure.getParentProcId()); if (parent == null) { assert procStack.isRollingback(); return; } if (parent.tryRunnable()) { store.update(parent); scheduler.addFront(parent); LOG.info("Finished subprocedure (pid={}), resume processing parent (ppid={})", procedure.getProcId(), parent.getProcId()); return; } }
Source:
private void managePrestartedVmsInPool(vm_pools vmPool) { int prestartedVms; int missingPrestartedVms; int vmsToPrestart; Guid vmGuid; prestartedVms = VmPoolCommandBase.getNumOfPrestartedVmsInPool(vmPool.getvm_pool_id()); missingPrestartedVms = vmPool.getPrestartedVms() - prestartedVms; if (missingPrestartedVms > 0) { int batchSize = Config.<Integer> GetValue(ConfigValues.VmPoolMonitorBatchSize); if (missingPrestartedVms > batchSize) { vmsToPrestart = batchSize; } else { vmsToPrestart = missingPrestartedVms; } log.infoFormat("Missing {0} prestarted Vms, attempting to prestart {1} Vms", missingPrestartedVms, vmsToPrestart); for (int i = 0; i < vmsToPrestart; i++) { vmGuid = VmPoolCommandBase.getNonPrestartedVmToAttach(vmPool.getvm_pool_id()); if (vmGuid != Guid.Empty) { if (!prestartVm(vmGuid)) { break; } } else { log.infoFormat("No Vms avaialable for prestarting"); break; } } } }

Target:
private void managePrestartedVmsInPool(vm_pools vmPool) { int prestartedVms; int missingPrestartedVms; int numOfVmsToPrestart; prestartedVms = VmPoolCommandBase.getNumOfPrestartedVmsInPool(vmPool.getvm_pool_id()); missingPrestartedVms = vmPool.getPrestartedVms() - prestartedVms; if (missingPrestartedVms > 0) { int batchSize = Config.<Integer> GetValue(ConfigValues.VmPoolMonitorBatchSize); if (missingPrestartedVms > batchSize) { numOfVmsToPrestart = batchSize; } else { numOfVmsToPrestart = missingPrestartedVms; } log.infoFormat("VmPool {0} is missing {1} prestarted Vms, attempting to prestart {2} Vms", vmPool.getvm_pool_id(), missingPrestartedVms, numOfVmsToPrestart); prestartVms(vmPool, numOfVmsToPrestart); } }
Source:
private List<VariableInstanceLog> filterLastVarInstanceLogs(List<VariableInstanceLog> varLogs) { List<VariableInstanceLog> retVarLogs = new ArrayList<>(); Map<String, List<VariableInstanceLog>> varlogsMap = new HashMap<String, List<VariableInstanceLog>>(); for( VariableInstanceLog vlog : varLogs ) { if( !varlogsMap.containsKey(vlog.getVariableId()) ) { ArrayList<VariableInstanceLog> varlogsList = new ArrayList<VariableInstanceLog>(); varlogsList.add( vlog ); varlogsMap.put( vlog.getVariableId(), varlogsList ); } else { varlogsMap.get( vlog.getVariableId() ).add( vlog ); } } for( Map.Entry<String, List<VariableInstanceLog>> entry : varlogsMap.entrySet() ) { List<VariableInstanceLog> value = entry.getValue(); Collections.sort(value, Collections.reverseOrder(new VariableInstanceLogIDComparator())); entry.getValue().subList(1, entry.getValue().size()).clear(); retVarLogs.addAll( entry.getValue() ); } return retVarLogs; }

Target:
private List<VariableInstanceLog> filterLastVarInstanceLogs(List<VariableInstanceLog> varLogs) { List<VariableInstanceLog> retVarLogs = new ArrayList<>(); Map<String, List<VariableInstanceLog>> varlogsMap = new HashMap<String, List<VariableInstanceLog>>(); for( VariableInstanceLog vlog : varLogs ) { if( !varlogsMap.containsKey(vlog.getVariableId()) ) { ArrayList<VariableInstanceLog> varlogsList = new ArrayList<VariableInstanceLog>(); varlogsList.add( vlog ); varlogsMap.put( vlog.getVariableId(), varlogsList ); } else { varlogsMap.get( vlog.getVariableId() ).add( vlog ); } } for( Map.Entry<String, List<VariableInstanceLog>> entry : varlogsMap.entrySet() ) { List<VariableInstanceLog> value = entry.getValue(); if(value != null && value.size() > 0) { Collections.sort(value, Collections.reverseOrder(new VariableInstanceLogIDComparator())); retVarLogs.add(value.get(0)); } } return retVarLogs; }
Source:
public MockMediaGateway() { super(); system = context().system(); connectionToEndpointMap = new ConcurrentHashMap<ActorRef, ActorRef>(); connEndpointMap = new ConcurrentHashMap<String, String>(); }

Target:
public MockMediaGateway() { super(); system = context().system(); connEndpointMap = new ConcurrentHashMap<String, String>(); }
Source:
public void execute(ActivityExecution execution) throws Exception { List<EventSubscriptionEntity> subscriptions = ((ExecutionEntity)execution).getEventSubscriptions(); for(EventSubscriptionEntity subscription: subscriptions) { if(Context.getCommandContext().getAttribute(subscription.getEventName()) != null) { subscription.eventReceived(null, false); } } }

Target:
public void execute(ActivityExecution execution) throws Exception { List<EventSubscriptionEntity> subscriptions = ((ExecutionEntity)execution).getEventSubscriptions(); if(!subscriptions.isEmpty()) { EventSubscriptionEntity subscription = subscriptions.get(0); if(isSignalEventAlreadyFired(execution, subscription)) { subscription.eventReceived(null, false); } } }
Source:
public void doWrite(Query query) throws Exception { for (final Result result : query.getResults()) { if (result.getValues() != null) { for (final Map.Entry<String, Object> resultValue : result.getValues().entrySet()) { final String name = JmxUtils.getKeyString2(query, result, resultValue, getTypeNames(), null); final String value = resultValue.getValue().toString(); log.debug("Sending Ganglia metric {}={}", host+": "+ name, value); new GMetric( host, port, addressingMode, ttl, v31, null, spoofedHostName ).announce( name, value, getType(resultValue.getValue()), units, slope, tmax, dmax, groupName ); } } } }

Target:
public void doWrite(Query query) throws Exception { for (final Result result : query.getResults()) { if (result.getValues() != null) { for (final Map.Entry<String, Object> resultValue : result.getValues().entrySet()) { final String name = JmxUtils.getKeyString2(query, result, resultValue, getTypeNames(), null); final String value = resultValue.getValue().toString(); log.debug("Sending Ganglia metric {}={}", name, value); new GMetric( host, port, addressingMode, ttl, v31, null, spoofedHostName ).announce( name, value, getType(resultValue.getValue()), units, slope, tmax, dmax, groupName ); } } } }
Source:
public synchronized void close() { if (!open) { return; } open = false; closeOpenIterators(); if (configSetter != null) { configSetter.close(name, userSpecifiedOptions); configSetter = null; } dbAccessor.close(); db.close(); userSpecifiedOptions.close(); wOptions.close(); fOptions.close(); filter.close(); cache.close(); dbAccessor = null; userSpecifiedOptions = null; wOptions = null; fOptions = null; db = null; filter = null; cache = null; }

Target:
public synchronized void close() { if (!open) { return; } open = false; closeOpenIterators(); if (configSetter != null) { configSetter.close(name, userSpecifiedOptions); configSetter = null; } dbAccessor.close(); userSpecifiedOptions.close(); wOptions.close(); fOptions.close(); db.close(); filter.close(); cache.close(); dbAccessor = null; userSpecifiedOptions = null; wOptions = null; fOptions = null; db = null; filter = null; cache = null; }
Source:
public void onListItemClick(ListView lv, View v, int position, long id) { if(position == 0){ switchFragment(new PlaylistFragment()); } else if(position == 1) switchFragment(new MusicLibraryFragment()); }

Target:
public void onListItemClick(ListView lv, View v, int position, long id) { if(DRAWER.get(PLAYLIST) == position){ switchFragment(new PlaylistFragment()); } else if(DRAWER.get(MUSICLIBRARY) == position){ switchFragment(new MusicLibraryFragment()); } }
Source:
private EventTypeProxy convert(final EventType et) { return new EventTypeProxy( et, JsonUtils.serializeDateTime(objectMapper, et.getUpdatedAt()) ); }

Target:
private VersionedEventType convert(final EventType et) { return new VersionedEventType( et, JsonUtils.serializeDateTime(objectMapper, et.getUpdatedAt()) ); }
Source:
private String selectFirstEntityTypeAsTarget(List<String> entityTypeIds) { Optional<String> findFirst = entityTypeIds.stream().findFirst(); if (findFirst.isPresent()) { return findFirst.get(); } else { throw new IllegalStateException("There are no entities available!"); } }

Target:
private String selectFirstEntityTypeAsTarget(List<String> entityTypeIds) { return entityTypeIds.stream() .findFirst() .orElseThrow(() -> new IllegalStateException("There are no entities available!")); }
Source:
long consumerLag() { return consumerLag; }

Target:
private long consumerLag() { return consumerLag; }
Source:
public boolean canConnectRedstone(IBlockState state, IBlockAccess world, BlockPos pos, @Nullable EnumFacing side) { if (side == null) return false; TilePipeHolder tile = getPipe(world, pos, false); if (tile != null) { PipePluggable pluggable = tile.getPluggable(side.getOpposite()); return pluggable != null && pluggable.definition == BCTransportPlugs.gate; } return false; }

Target:
public boolean canConnectRedstone(IBlockState state, IBlockAccess world, BlockPos pos, @Nullable EnumFacing side) { if (side == null) return false; TilePipeHolder tile = getPipe(world, pos, false); if (tile != null) { PipePluggable pluggable = tile.getPluggable(side.getOpposite()); return pluggable != null && pluggable.canConnectToRedstone(side); } return false; }
Source:
public void testNotCachingOfResultForOtherResolveOption() throws Exception { Bndrun bndrun = Bndrun.createBndrun(workspace, IO.getFile(tmp, "resolver.bndrun")); bndrun.setProperty("-resolve", "manual"); bndrun.unsetProperty("-runbundles"); RunResolution.clearCache(bndrun.getWorkspace()); ProjectLauncher pl = bndrun.getProjectLauncher(); assertNotNull(pl); Collection<Container> runbundles = pl.getProject() .getRunbundles(); assertThat(runbundles).isEmpty(); if (IO.isWindows()) assertThat(bndrun.check()).isTrue(); else assertThat(bndrun.check("Download java.io.FileNotFoundException:")).isTrue(); }

Target:
public void testNotCachingOfResultForOtherResolveOption() throws Exception { Bndrun bndrun = Bndrun.createBndrun(workspace, IO.getFile(tmp, "resolver.bndrun")); bndrun.setProperty("-resolve", "manual"); bndrun.unsetProperty("-runbundles"); RunResolution.clearCache(bndrun.getWorkspace()); ProjectLauncher pl = bndrun.getProjectLauncher(); assertNotNull(pl); Collection<Container> runbundles = pl.getProject() .getRunbundles(); assertThat(runbundles).isEmpty(); assertThat(bndrun.check("(Download java.io.FileNotFoundException:)?")).isTrue(); }
Source:
public SoulStrings(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{X}{B}"); Effect effect = new DoUnlessAnyPlayerPaysEffect( new ReturnFromGraveyardToHandTargetEffect(), new VariableManaCost() ); this.getSpellAbility().addEffect(effect); this.getSpellAbility().addTarget(new TargetCardInGraveyard(2, new FilterCreatureCard("creature cards from your graveyard"))); }

Target:
public SoulStrings(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{X}{B}"); Effect effect = new DoUnlessAnyPlayerPaysEffect( new ReturnFromGraveyardToHandTargetEffect(), new VariableManaCost() ); this.getSpellAbility().addEffect(effect); this.getSpellAbility().addTarget(new TargetCardInYourGraveyard(2, new FilterCreatureCard("creature cards from your graveyard"))); }
Source:
public void resolveTaxon() throws IndexBuilderException { logger.info("Resolving taxa"); final Collection<TaxonConceptInstance> allInstances = this.instances.values(); final Set<RankType> rs = allInstances.parallelStream().map(TaxonConceptInstance::getRank).collect(Collectors.toSet()); List<RankType> ranks = new ArrayList<>(rs); Collections.sort(ranks, (r1, r2) -> r1.getSortOrder() - r2.getSortOrder()); long prevResolved = 0; long resolved = 0; do { for (RankType rank : ranks) { Set<TaxonConcept> concepts = allInstances.parallelStream().filter(instance -> instance.getRank() == rank).map(TaxonConceptInstance::getContainer).collect(Collectors.toSet()); concepts.parallelStream().forEach(tc -> tc.resolveTaxon(this)); } prevResolved = resolved; resolved = allInstances.stream().filter(instance -> instance.isResolved()).count(); logger.debug("Resolved " + prevResolved + " -> " + resolved); } while (resolved != prevResolved); Set<TaxonConcept> unresolvedConcepts = allInstances.parallelStream().map(TaxonConceptInstance::getContainer).filter(tc -> !tc.isResolved()).collect(Collectors.toSet()); logger.info("Found " + unresolvedConcepts.size() + " un-resolved concepts"); unresolvedConcepts.parallelStream().forEach(tc -> { tc.resolveTaxon(this); this.report(IssueType.PROBLEM, "taxonConcept.unresolved", tc); }); logger.info("Finished resolving taxa"); }

Target:
public void resolveTaxon() throws IndexBuilderException { logger.info("Resolving taxa"); final Collection<TaxonConceptInstance> allInstances = this.instances.values(); final Set<RankType> rs = allInstances.stream().map(TaxonConceptInstance::getRank).collect(Collectors.toSet()); List<RankType> ranks = new ArrayList<>(rs); Collections.sort(ranks, (r1, r2) -> r1.getSortOrder() - r2.getSortOrder()); long prevResolved = 0; long resolved = 0; do { for (RankType rank : ranks) { Set<TaxonConcept> concepts = allInstances.stream().filter(instance -> instance.getRank() == rank).map(TaxonConceptInstance::getContainer).collect(Collectors.toSet()); concepts.parallelStream().forEach(tc -> tc.resolveTaxon(this)); } prevResolved = resolved; resolved = allInstances.stream().filter(instance -> instance.isResolved()).count(); logger.debug("Resolved " + prevResolved + " -> " + resolved); } while (resolved != prevResolved); Set<TaxonConcept> unresolvedConcepts = allInstances.stream().map(TaxonConceptInstance::getContainer).filter(tc -> !tc.isResolved()).collect(Collectors.toSet()); logger.info("Found " + unresolvedConcepts.size() + " un-resolved concepts"); unresolvedConcepts.parallelStream().forEach(tc -> { tc.resolveTaxon(this); this.report(IssueType.PROBLEM, "taxonConcept.unresolved", tc); }); logger.info("Finished resolving taxa"); }
Source:
private void setEntryTypeForReturnAndClose(Optional<BibEntryType> entryType) { type = entryType.map(BibEntryType::getType).orElse(null); viewModel.stopFetching(); this.basePanel.frame().getGlobalSearchBar().endSearch(); this.close(); }

Target:
private void setEntryTypeForReturnAndClose(Optional<BibEntryType> entryType) { type = entryType.map(BibEntryType::getType).orElse(null); viewModel.stopFetching(); this.stateManager.clearSearchQuery(); this.close(); }
Source:
private void emitInsertObjectToRealmMethod(JavaWriter writer) throws IOException { writer.emitAnnotation("Override"); writer.beginMethod( "void", "insertToRealm", EnumSet.of(Modifier.PUBLIC), "Realm", "realm", "RealmModel", "type", "Map<RealmModel, Long>", "cache"); writer.emitSingleLineComment("This cast is correct because obj is either"); writer.emitSingleLineComment("generated by RealmProxy or the original type extending directly from RealmObject"); writer.emitStatement("@SuppressWarnings(\"unchecked\") Class<RealmModel> clazz = (Class<RealmModel>) ((type instanceof RealmObjectProxy) ? type.getClass().getSuperclass() : type.getClass())"); writer.emitEmptyLine(); emitMediatorSwitch(new ProxySwitchStatement() { @Override public void emitStatement(int i, JavaWriter writer) throws IOException { writer.emitStatement("%s.insert(realm, (%s) type, cache)", proxyClasses.get(i), simpleModelClasses.get(i)); } }, writer, false); writer.endMethod(); writer.emitEmptyLine(); }

Target:
private void emitInsertObjectToRealmMethod(JavaWriter writer) throws IOException { writer.emitAnnotation("Override"); writer.beginMethod( "void", "insert", EnumSet.of(Modifier.PUBLIC), "Realm", "realm", "RealmModel", "object", "Map<RealmModel, Long>", "cache"); writer.emitSingleLineComment("This cast is correct because obj is either"); writer.emitSingleLineComment("generated by RealmProxy or the original type extending directly from RealmObject"); writer.emitStatement("@SuppressWarnings(\"unchecked\") Class<RealmModel> clazz = (Class<RealmModel>) ((object instanceof RealmObjectProxy) ? object.getClass().getSuperclass() : object.getClass())"); writer.emitEmptyLine(); emitMediatorSwitch(new ProxySwitchStatement() { @Override public void emitStatement(int i, JavaWriter writer) throws IOException { writer.emitStatement("%s.insert(realm, (%s) object, cache)", proxyClasses.get(i), simpleModelClasses.get(i)); } }, writer, false); writer.endMethod(); writer.emitEmptyLine(); }
Source:
public void changePassword(User user, String newPassword) throws APIException { changePassword(user, null, newPassword); }

Target:
public void changePassword(User user, String newPassword) throws APIException { dao.changePassword(user, newPassword); }
Source:
public void setUp() throws Exception { super.setUp(); when(Config.GetValue(ConfigValues.DefaultTimeZone)).thenReturn("Israel Standard Time"); }

Target:
public void setUp() throws Exception { super.setUp(); when(Config.GetValue(ConfigValues.DefaultTimeZone)).thenReturn(DEFAULT_TIME_ZONE); }
Source:
public DataSegment( @JsonProperty("dataSource") String dataSource, @JsonProperty("interval") Interval interval, @JsonProperty("version") String version, @JsonProperty("loadSpec") Map<String, Object> loadSpec, @JsonProperty("dimensions") @JsonDeserialize(using = CommaListJoinDeserializer.class) List<String> dimensions, @JsonProperty("metrics") @JsonDeserialize(using = CommaListJoinDeserializer.class) List<String> metrics, @JsonProperty("shardSpec") ShardSpec shardSpec, @JsonProperty("binaryVersion") Integer binaryVersion, @JsonProperty("size") long size ) { final Predicate<String> nonEmpty = new Predicate<String>() { @Override public boolean apply(String input) { return input != null && !input.isEmpty(); } }; this.dataSource = STRING_INTERNER.intern(dataSource); this.interval = interval; this.loadSpec = loadSpec; this.version = version; this.dimensions = dimensions == null ? ImmutableList.<String>of() : internFn(Lists.newArrayList(Iterables.filter(dimensions, nonEmpty))); this.metrics = metrics == null ? ImmutableList.<String>of() : internFn(Lists.newArrayList(Iterables.filter(metrics, nonEmpty))); this.shardSpec = (shardSpec == null) ? NoneShardSpec.INSTANCE : shardSpec; this.binaryVersion = binaryVersion; this.size = size; this.identifier = makeDataSegmentIdentifier( this.dataSource, this.interval.getStart(), this.interval.getEnd(), this.version, this.shardSpec ); }

Target:
public DataSegment( @JsonProperty("dataSource") String dataSource, @JsonProperty("interval") Interval interval, @JsonProperty("version") String version, @JsonProperty("loadSpec") Map<String, Object> loadSpec, @JsonProperty("dimensions") @JsonDeserialize(using = CommaListJoinDeserializer.class) List<String> dimensions, @JsonProperty("metrics") @JsonDeserialize(using = CommaListJoinDeserializer.class) List<String> metrics, @JsonProperty("shardSpec") ShardSpec shardSpec, @JsonProperty("binaryVersion") Integer binaryVersion, @JsonProperty("size") long size ) { final Predicate<String> nonEmpty = new Predicate<String>() { @Override public boolean apply(String input) { return input != null && !input.isEmpty(); } }; this.dataSource = STRING_INTERNER.intern(dataSource); this.interval = interval; this.loadSpec = loadSpec; this.version = version; this.dimensions = dimensions == null ? ImmutableList.<String>of() : LIST_INTERNER.intern(Ordering.natural() .immutableSortedCopy(Iterables.filter(dimensions, nonEmpty))); this.metrics = metrics == null ? ImmutableList.<String>of() : LIST_INTERNER.intern(Ordering.natural().immutableSortedCopy(Iterables.filter(metrics, nonEmpty))); this.shardSpec = (shardSpec == null) ? NoneShardSpec.INSTANCE : shardSpec; this.binaryVersion = binaryVersion; this.size = size; this.identifier = makeDataSegmentIdentifier( this.dataSource, this.interval.getStart(), this.interval.getEnd(), this.version, this.shardSpec ); }
Source:
public void testPostEvent() throws Exception { OcspChecker ocspChecker = new OcspChecker(factory, eventAdmin); Response response = mock(Response.class); ocspChecker.createOcspResponse(response); verify(eventAdmin, times(1)).postEvent(any()); }

Target:
public void testPostEvent() throws Exception { OcspChecker ocspChecker = new OcspChecker(factory, eventAdmin); Response response = mock(Response.class); ocspChecker.createOcspResponse(response); }
Source:
public void disable() { if (useDefaultDisplayVsync) { vsyncSampler.removeObserver(); } unregisterDisplayListener(); }

Target:
public void disable() { if (useDefaultDisplayVsync) { vsyncSampler.removeObserver(); if (defaultDisplayListener != null) defaultDisplayListener.unregister(); } }
Source:
public Object getInternalProperty(String key) { Configuration firstMatchingConfiguration = null; for (Configuration config : configList) { try { if (config.containsKey(key)) { firstMatchingConfiguration = config; break; } } catch (Exception e) { e.printStackTrace(); } } if (firstMatchingConfiguration != null) { return firstMatchingConfiguration.getProperty(key); } else { return null; } }

Target:
public Object getInternalProperty(String key) { Configuration firstMatchingConfiguration = null; for (Configuration config : configList) { try { if (config.containsKey(key)) { firstMatchingConfiguration = config; break; } } catch (Exception e) { logger.error("Error when trying to get value for key " + key + " from " + config + ", will continue to try the next one."); } } if (firstMatchingConfiguration != null) { return firstMatchingConfiguration.getProperty(key); } else { return null; } }
Source:
public void refresh(IResource[] resources, int depth, IProgressMonitor monitor) throws TeamException { for (IResource resource : resources) { if (resource.getType() == IResource.ROOT) { GitSyncCache newCache = GitSyncCache.getAllData(gsds, monitor); cache.merge(newCache); super.refresh(resources, depth, monitor); return; } } List<String> paths = new ArrayList<String>(); for (IResource resource : resources) { IProject project = resource.getProject(); if (gsds.contains(project)) { String path = RepositoryMapping.getMapping(project) .getRepoRelativePath(resource); if (!path.equals("")) { paths.add(path); } } } if (!paths.isEmpty()) { GitSyncCache newCache = GitSyncCache.getAllData(gsds, paths, monitor); cache.merge(newCache); } super.refresh(resources, depth, monitor); }

Target:
public void refresh(IResource[] resources, int depth, IProgressMonitor monitor) throws TeamException { for (IResource resource : resources) { if (resource.getType() == IResource.ROOT) { GitSyncCache newCache = GitSyncCache.getAllData(gsds, monitor); cache.merge(newCache); super.refresh(resources, depth, monitor); return; } } List<String> paths = new ArrayList<String>(); for (IResource resource : resources) { IProject project = resource.getProject(); if (gsds.contains(project)) { RepositoryMapping mapping = RepositoryMapping .getMapping(project); if (mapping != null) { String path = mapping.getRepoRelativePath(resource); if (path.length() != 0) { paths.add(path); } } } } if (!paths.isEmpty()) { GitSyncCache newCache = GitSyncCache.getAllData(gsds, paths, monitor); cache.merge(newCache); } super.refresh(resources, depth, monitor); }
Source:
public <T> T tryWritingVault(Supplier<T> action) throws Retry.ActionFailedException { Optional<Span> optionalSpan = initSpan("write"); return optionalSpan.map(span -> { try (Scope ignored = tracer.activateSpan(span)) { try { return action.get(); } catch (RuntimeException e) { LOGGER.error("Exception during writing vault", e); span.setTag(TracingUtil.ERROR, true); span.setTag(TracingUtil.MESSAGE, e.getMessage()); metricService.incrementMetricCounter(MetricType.VAULT_READ_FAILED); throw new Retry.ActionFailedException(e.getMessage()); } } finally { span.finish(); } }).orElseGet(action::get); }

Target:
public <T> T tryWritingVault(Supplier<T> action) throws Retry.ActionFailedException { return executeVaultOperationWithTrace(action, "write", MetricType.VAULT_WRITE_FAILED); }
Source:
public void testIsWorkspaceMetacard() { MetacardImpl metacard = new MetacardImpl(); metacard.setTags(ImmutableSet.of("workspace")); boolean isWorkspace = WorkspaceMetacardImpl.isWorkspaceMetacard(metacard); assertTrue(isWorkspace); }

Target:
public void testIsWorkspaceMetacard() { MetacardImpl metacard = new MetacardImpl(); metacard.setTags(ImmutableSet.of("workspace")); boolean isWorkspace = WorkspaceMetacardImpl.isWorkspaceMetacard(metacard); assertThat(isWorkspace, is(true)); }
Source:
public static long arrayPosition( @TypeParameter("T") Type type, @OperatorDependency(operator = EQUAL, argumentTypes = {"T", "T"}) MethodHandle equalMethodHandle, @SqlType("array(T)") Block array, @SqlType("T") Block element) { int size = array.getPositionCount(); for (int i = 0; i < size; i++) { if (!array.isNull(i)) { Object arrayValue = type.getObject(array, i); try { Boolean result = (Boolean) equalMethodHandle.invoke(arrayValue, element); if (result == null) { throw new PrestoException(NOT_SUPPORTED, "array_position does not support element of array type that contains null"); } if (result) { return i + 1; } } catch (Throwable t) { throw internalError(t); } } } return 0; }

Target:
public static long arrayPosition( @TypeParameter("T") Type type, @OperatorDependency(operator = EQUAL, argumentTypes = {"T", "T"}) MethodHandle equalMethodHandle, @SqlType("array(T)") Block array, @SqlType("T") Block element) { int size = array.getPositionCount(); for (int i = 0; i < size; i++) { if (!array.isNull(i)) { Object arrayValue = type.getObject(array, i); try { Boolean result = (Boolean) equalMethodHandle.invoke(arrayValue, element); if (result == null) { throw new PrestoException(NOT_SUPPORTED, "array_position does not support elements of complex types that contain null"); } if (result) { return i + 1; } } catch (Throwable t) { throw internalError(t); } } } return 0; }
Source:
public void addTrackers(Collection<Tracker> trackers) { if (!storage.isPropertySet(TRACKERS)) this.clearTrackers(); storage.get(TRACKERS).addAll(trackers); }

Target:
public Project addTrackers(Collection<Tracker> trackers) { if (!storage.isPropertySet(TRACKERS)) storage.set(TRACKERS, new HashSet<>()); storage.get(TRACKERS).addAll(trackers); return this; }
Source:
private boolean noteTextSizeIsWithinLimit(String noteText) { return (noteText.length() <= PaymentWorksConstants.NOTE_TEXT_DEFAULT_MAX_LENGTH); }

Target:
private boolean noteTextSizeIsWithinLimit(String noteText) { return (noteTextIsNotBlank(noteText) && (noteText.length() <= PaymentWorksConstants.NOTE_TEXT_DEFAULT_MAX_LENGTH)); }
Source:
protected Collection<String> mapToColumnNames(String propertyName) { Locale locale = getLocale(); List<String> columnName = new ArrayList<>(5); columnName.add(propertyName); StringBuilder propertyNameWithUnderscores = new StringBuilder(); propertyNameWithUnderscores.append(propertyName.substring(0, 1)); for (int i = 1; i < propertyName.length(); i++) { String s = propertyName.substring(i, i + 1); String slc = s.toLowerCase(locale); if (!s.equals(slc)) { propertyNameWithUnderscores.append("_").append(slc); } else { propertyNameWithUnderscores.append(s); } } columnName.add(propertyNameWithUnderscores.toString()); return columnName; }

Target:
protected Collection<String> mapToColumnNames(String propertyName) { Locale locale = getLocale(); List<String> columnNames = new ArrayList<>(5); columnNames.add(propertyName); StringBuilder propertyNameWithUnderscores = new StringBuilder(); propertyNameWithUnderscores.append(propertyName.substring(0, 1)); for (int i = 1; i < propertyName.length(); i++) { String s = propertyName.substring(i, i + 1); String slc = s.toLowerCase(locale); if (!s.equals(slc)) { propertyNameWithUnderscores.append("_").append(slc); } else { propertyNameWithUnderscores.append(s); } } columnNames.add(propertyNameWithUnderscores.toString()); return columnNames; }
Source:
public String binaryName() { return this.typeWrapper.elements().getBinaryName(element).toString(); }

Target:
public String binaryName() { return this.type.binaryName(); }
Source:
private static void providerExample(BlobStoreContext context) throws IOException { GlacierClient client = context.unwrapApi(GlacierClient.class); final String vaultName = UUID. randomUUID().toString() + "_providerExample"; client.createVault(vaultName); Payload payload = new ByteSourcePayload(buildData(16)); payload.getContentMetadata().setContentType(PLAIN_TEXT_UTF_8.toString()); payload.getContentMetadata().setContentLength(16L); String archiveId = client.uploadArchive(vaultName, payload); JobRequest archiveRetrievalJobRequest = ArchiveRetrievalJobRequest.builder() .archiveId(archiveId) .description("retrieval job") .build(); String jobId = client.initiateJob(vaultName, archiveRetrievalJobRequest); try { new BasePollingStrategy(client).waitForSuccess(vaultName, jobId); Payload result = client.getJobOutput(vaultName, jobId); InputStream is = result.openStream(); try { String data = CharStreams.toString(new InputStreamReader(is, "UTF-8")); System.out.println("The retrieved payload is: " + data); } finally { is.close(); } } catch (InterruptedException e) { Throwables.propagate(e); } }

Target:
private static void providerExample(BlobStoreContext context) throws IOException { GlacierClient client = context.unwrapApi(GlacierClient.class); final String vaultName = "jclouds_providerExample_" + UUID.randomUUID().toString(); client.createVault(vaultName); Payload payload = new ByteSourcePayload(buildData(16)); payload.getContentMetadata().setContentType(PLAIN_TEXT_UTF_8.toString()); payload.getContentMetadata().setContentLength(16L); String archiveId = client.uploadArchive(vaultName, payload); JobRequest archiveRetrievalJobRequest = ArchiveRetrievalJobRequest.builder() .archiveId(archiveId) .description("retrieval job") .build(); String jobId = client.initiateJob(vaultName, archiveRetrievalJobRequest); try { new BasePollingStrategy(client).waitForSuccess(vaultName, jobId); Payload result = client.getJobOutput(vaultName, jobId); System.out.println("The retrieved payload is: " + Strings2.toStringAndClose(result.openStream())); } catch (InterruptedException e) { Throwables.propagate(e); } }
Source:
protected Map<String, Object> getIcon(DocumentReference groupReference) { Map<String, Object> icon = new HashMap<>(); XWikiContext xcontext = this.xcontextProvider.get(); try { XWikiDocument groupProfileDocument = xcontext.getWiki().getDocument(groupReference, xcontext); XWikiAttachment avatarAttachment = getFirstImageAttachment(groupProfileDocument, xcontext); if (avatarAttachment != null) { icon.put(META_DATA_ICON, xcontext.getWiki().getURL(avatarAttachment.getReference(), "download", "width=30&height=30&keepAspectRatio=true", null, xcontext)); } } catch (XWikiException e) { this.logger.warn( "Failed to read the avatar of group [{}]. Root cause is [{}]. Using the default avatar instead.", groupReference.getName(), ExceptionUtils.getRootCauseMessage(e)); } if (!icon.containsKey(META_DATA_ICON)) { icon.put(META_DATA_ICON, xcontext.getWiki().getSkinFile("icons/xwiki/noavatargroup.png", true, xcontext)); } return icon; }

Target:
protected Map<String, Object> getIcon(DocumentReference groupReference) { Map<String, Object> icon = new HashMap<>(); XWikiContext xcontext = this.xcontextProvider.get(); try { XWikiDocument groupProfileDocument = xcontext.getWiki().getDocument(groupReference, xcontext); XWikiAttachment avatarAttachment = getFirstImageAttachment(groupProfileDocument, xcontext); if (avatarAttachment != null) { icon.put(IconManager.META_DATA_URL, xcontext.getWiki().getURL(avatarAttachment.getReference(), "download", "width=30&height=30&keepAspectRatio=true", null, xcontext)); icon.put(IconManager.META_DATA_ICON_SET_TYPE, IconType.IMAGE.name()); } } catch (XWikiException e) { this.logger.warn( "Failed to read the avatar of group [{}]. Root cause is [{}]. Using the default avatar instead.", groupReference.getName(), ExceptionUtils.getRootCauseMessage(e)); } if (!icon.containsKey(IconManager.META_DATA_URL)) { try { icon = this.iconManager.getMetaData(DEFAULT_ICON_NAME); } catch (IconException e) { this.logger.warn("Error getting the icon [{}]. Root cause is [{}].", DEFAULT_ICON_NAME, ExceptionUtils.getRootCause(e)); } } return icon; }
Source:
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_webview_with_paddings, container, false); announcementWebView = view.findViewById(R.id.webview); URLInterceptorWebViewClient client = new URLInterceptorWebViewClient( getActivity(), announcementWebView); client.setAllLinksAsExternal(true); return view; }

Target:
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_webview_with_paddings, container, false); webView = view.findViewById(R.id.webview); URLInterceptorWebViewClient client = new URLInterceptorWebViewClient( getActivity(), webView); client.setAllLinksAsExternal(true); return view; }
Source:
public String getSummary() { String buckets = ""; Histogram intervalHistogram = getIntervalHistogramAndAccumulate(); if (histogramLogWriter != null) { histogramLogWriter.outputIntervalHistogram(intervalHistogram); } if (addstatus) { buckets += getStatusCounts(); } DecimalFormat d = new DecimalFormat("#.##"); return "[" + getName() + ": Count=" + intervalHistogram.getTotalCount() + ", Max=" + intervalHistogram.getMaxValue() + ", Min=" + intervalHistogram.getMinValue() + ", Avg=" + d.format(intervalHistogram.getMean()) + ", 90=" + d.format(intervalHistogram.getValueAtPercentile(90)) + ", 99=" + d.format(intervalHistogram.getValueAtPercentile(99)) + ", 99.9=" + d.format(intervalHistogram.getValueAtPercentile(99.9)) + ", 99.99=" + d.format(intervalHistogram.getValueAtPercentile(99.99)) + buckets +"]"; }

Target:
public String getSummary() { Histogram intervalHistogram = getIntervalHistogramAndAccumulate(); if (histogramLogWriter != null) { histogramLogWriter.outputIntervalHistogram(intervalHistogram); } String buckets = getStatusCounts(); DecimalFormat d = new DecimalFormat("#.##"); return "[" + getName() + ": Count=" + intervalHistogram.getTotalCount() + ", Max=" + intervalHistogram.getMaxValue() + ", Min=" + intervalHistogram.getMinValue() + ", Avg=" + d.format(intervalHistogram.getMean()) + ", 90=" + d.format(intervalHistogram.getValueAtPercentile(90)) + ", 99=" + d.format(intervalHistogram.getValueAtPercentile(99)) + ", 99.9=" + d.format(intervalHistogram.getValueAtPercentile(99.9)) + ", 99.99=" + d.format(intervalHistogram.getValueAtPercentile(99.99)) + buckets +"]"; }
Source:
public <T> void notifyReadyAsync( Callable<T> callable, BiConsumer<T, Throwable> handler, long initialDelayMs, long periodMs) { workerExecutor.scheduleAtFixedRate(() -> { try { T result = callable.call(); executorToNotify.execute(() -> handler.accept(result, null)); } catch (Throwable t) { LOG.error("Unexpected exception", t); executorToNotify.execute(() -> handler.accept(null, t)); } }, initialDelayMs, periodMs, TimeUnit.MILLISECONDS); }

Target:
public <T> void notifyReadyAsync( Callable<T> callable, BiConsumer<T, Throwable> handler, long initialDelayMs, long periodMs) { workerExecutor.scheduleAtFixedRate(() -> { try { T result = callable.call(); executorToNotify.execute(() -> handler.accept(result, null)); } catch (Throwable t) { executorToNotify.execute(() -> handler.accept(null, t)); } }, initialDelayMs, periodMs, TimeUnit.MILLISECONDS); }
Source:
private boolean parseSingleRedirect(BashPsiBuilder builder, boolean inCheckMode, boolean allowHeredoc) { PsiBuilder.Marker marker = builder.mark(); IElementType firstToken = builder.getTokenType(); boolean firstIsInt = firstToken == INTEGER_LITERAL; IElementType secondToken; if (firstIsInt) { builder.advanceLexer(); secondToken = builder.rawLookup(0); } else { secondToken = firstToken; } if (!redirectionSet.contains(secondToken)) { marker.drop(); return false; } if (validBeforeFiledescriptor.contains(secondToken) && ParserUtil.hasNextTokens(builder, true, secondToken, FILEDESCRIPTOR)) { ParserUtil.getTokenAndAdvance(builder, true); PsiBuilder.Marker descriptorMarker = builder.mark(); ParserUtil.getTokenAndAdvance(builder, true); descriptorMarker.done(FILEDESCRIPTOR); marker.done(REDIRECT_ELEMENT); return true; } builder.advanceLexer(); if (allowHeredoc && heredocStarters.contains(secondToken)) { if (inCheckMode) { marker.drop(); return builder.getTokenType() == HEREDOC_MARKER_START; } if (builder.getTokenType() != HEREDOC_MARKER_START) { marker.drop(); return false; } marker.drop(); ParserUtil.markTokenAndAdvance(builder, HEREDOC_START_ELEMENT); if (!builder.getParsingState().getHeredocMarkersIndexSet().contains(builder.rawTokenIndex())) { builder.getParsingState().pushHeredocMarker(builder.rawTokenIndex()); } return true; } boolean ok = Parsing.word.parseWord(builder); if (ok) { marker.done(REDIRECT_ELEMENT); } else { marker.drop(); builder.error("Invalid redirect"); if (builder.getTokenType() != LINE_FEED) { builder.advanceLexer(); } } return true; }

Target:
private boolean parseSingleRedirect(BashPsiBuilder builder, boolean inCheckMode, boolean allowHeredoc) { PsiBuilder.Marker marker = builder.mark(); IElementType firstToken = builder.getTokenType(); boolean firstIsInt = firstToken == INTEGER_LITERAL; IElementType secondToken; if (firstIsInt) { builder.advanceLexer(); secondToken = builder.rawLookup(0); } else { secondToken = firstToken; } if (!redirectionSet.contains(secondToken)) { marker.drop(); return false; } if (validBeforeFiledescriptor.contains(secondToken) && ParserUtil.hasNextTokens(builder, true, secondToken, FILEDESCRIPTOR)) { ParserUtil.getTokenAndAdvance(builder, true); PsiBuilder.Marker descriptorMarker = builder.mark(); ParserUtil.getTokenAndAdvance(builder, true); descriptorMarker.done(FILEDESCRIPTOR); marker.done(REDIRECT_ELEMENT); return true; } builder.advanceLexer(); if (allowHeredoc && heredocStarters.contains(secondToken)) { if (inCheckMode) { marker.drop(); return builder.getTokenType() == HEREDOC_MARKER_START; } if (builder.getTokenType() != HEREDOC_MARKER_START) { marker.drop(); return false; } marker.drop(); ParserUtil.markTokenAndAdvance(builder, HEREDOC_START_ELEMENT); builder.getParsingState().pushHeredocMarker(builder.rawTokenIndex()); return true; } boolean ok = Parsing.word.parseWord(builder); if (ok) { marker.done(REDIRECT_ELEMENT); } else { marker.drop(); builder.error("Invalid redirect"); if (builder.getTokenType() != LINE_FEED) { builder.advanceLexer(); } } return true; }