auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code><START> public String getAdvertisedHost() { <END> if(CLI_HOST_NAME != null) return CLI_HOST_NAME; try { return new URL(Jenkins.getInstanceOrNull().getRootUrl()).getHost(); } catch (MalformedURLException | NullPointerException e) { throw new IllegalStateException("Could not get Jenkins host name", e); } }</code><technical_language>if approach. unrestrict CLI_HOST_NAME do (read TcpSlaveAgentListener.class.getName()+".hostName" system property) rely a newer version of core</technical_language>

Target:
public String getAdvertisedHost() { if (CLI_HOST_NAME != null) { return CLI_HOST_NAME; } try { return new URL(Jenkins.get().getRootUrl()).getHost(); } catch (MalformedURLException | NullPointerException e) { throw new IllegalStateException("Could not get TcpSlaveAgentListener host name", e); } }
Source:
<code>public void append(JsonParser parser, BlockBuilder blockBuilder) throws IOException { if (parser.getCurrentToken() == JsonToken.VALUE_NULL) { blockBuilder.appendNull(); return; } <START> checkState(parser.currentToken() == START_OBJECT, "Expected a json object"); <END> BlockBuilder entryBuilder = blockBuilder.beginBlockEntry(); HashTable entryBuilderHashTable = new HashTable(keyType, entryBuilder); int position = 0; while (parser.nextToken() != END_OBJECT) { keyAppender.append(parser, entryBuilder); parser.nextToken(); valueAppender.append(parser, entryBuilder); if (!entryBuilderHashTable.addIfAbsent(position)) { throw new JsonCastException("Duplicate keys are not allowed"); } position += 2; } blockBuilder.closeEntry(); }</code><technical_language>checkCondition</technical_language>

Target:
public void append(JsonParser parser, BlockBuilder blockBuilder) throws IOException { if (parser.getCurrentToken() == JsonToken.VALUE_NULL) { blockBuilder.appendNull(); return; } if (parser.getCurrentToken() != START_OBJECT) { throw new JsonCastException(format("Expected a json object, but got %s", parser.getText())); } BlockBuilder entryBuilder = blockBuilder.beginBlockEntry(); HashTable entryBuilderHashTable = new HashTable(keyType, entryBuilder); int position = 0; while (parser.nextToken() != END_OBJECT) { keyAppender.append(parser, entryBuilder); parser.nextToken(); valueAppender.append(parser, entryBuilder); if (!entryBuilderHashTable.addIfAbsent(position)) { throw new JsonCastException("Duplicate keys are not allowed"); } position += 2; } blockBuilder.closeEntry(); }
Source:
<code>Consumer<Frame> grantedLeasesReceiver() { return f -> { <START> synchronized (lock) { <END> leaseReceived = true; if (pendingSentLease != null) { Lease lease = pendingSentLease; pendingSentLease = null; long now = System.currentTimeMillis(); int newTTl = (int) Math.max(lease.expiry() - now, 0); sendLease(new LeaseImpl(lease.getAllowedRequests(), newTTl, lease.getMetadata())); } leaseReceived(f); } }; }</code><technical_language>synchronized(ClientLeaseGranter.this) work instead of making a lock object</technical_language>

Target:
Consumer<Lease> grantedLeasesReceiver() { return f -> { synchronized (this) { leaseReceived = true; if (pendingSentLease != null) { Lease lease = pendingSentLease; pendingSentLease = null; long now = System.currentTimeMillis(); int newTTl = (int) Math.max(lease.expiry() - now, 0); sendLease(new LeaseImpl(lease.getAllowedRequests(), newTTl, lease.getMetadata())); } leaseReceived(f); } }; }
Source:
<code>public void setUp() throws Exception { BeanUtils.assertAutowiring(this); <START> m_bsmd = new Bsmd(); <END> m_bsmd.setBusinessServiceDao(m_businessServiceDao); m_bsmd.setAlarmDao(m_alarmDao); m_bsmd.setEventIpcManager(m_eventMgr); m_bsmd.setEventConfDao(m_eventConfDao); m_bsmd.setTransactionTemplate(m_template); m_bsmd.setVerifyReductionKeys(false); m_bsmd.setBusinessServiceStateMachine(new DefaultBusinessServiceStateMachine()); m_bsmd.afterPropertiesSet(); m_databasePopulator.populateDatabase(); m_anticipator = new EventAnticipator(); m_eventMgr.setEventAnticipator(m_anticipator); }</code><technical_language>spring bean use</technical_language>

Target:
public void setUp() throws Exception { BeanUtils.assertAutowiring(this); m_bsmd.setVerifyReductionKeys(false); m_bsmd.setEventIpcManager(m_eventMgr); m_databasePopulator.populateDatabase(); m_anticipator = new EventAnticipator(); m_eventMgr.setEventAnticipator(m_anticipator); }
Source:
<code>public static void main(String[] args) throws Exception { String dataLocation = "data/1K-pages.txt"; String templateLocation = "modules/ui/src/main/resources/spark/template/freemarker"; if (args.length == 2) { dataLocation = args[0]; templateLocation = args[1]; } log.info("Looking for data at {}", dataLocation); Path dataPath = Paths.get(dataLocation); if (Files.notExists(dataPath)) { log.info("Generating sample data at for dev server", dataPath); SampleData.generate(dataPath, 1000); } Path templatePath = Paths.get(templateLocation); if (Files.notExists(templatePath)) { log.info("Template location does not exits", templateLocation); throw new IllegalArgumentException("Template location does not exist"); } <START> DevServer devServer = new DevServer(dataPath, Paths.get("/tmp/"), 4567, templatePath); <END> devServer.start(); }</code><technical_language>Java 8 [new function create temp dir](<LINK_0></technical_language>

Target:
public static void main(String[] args) throws Exception { String dataLocation = "data/1K-pages.txt"; String templateLocation = "modules/ui/src/main/resources/spark/template/freemarker"; if (args.length == 2) { dataLocation = args[0]; templateLocation = args[1]; } log.info("Looking for data at {}", dataLocation); Path dataPath = Paths.get(dataLocation); if (Files.notExists(dataPath)) { log.info("Generating sample data at for dev server", dataPath); SampleData.generate(dataPath, 1000); } Path templatePath = Paths.get(templateLocation); if (Files.notExists(templatePath)) { log.info("Template location does not exits", templateLocation); throw new IllegalArgumentException("Template location does not exist"); } DevServer devServer = new DevServer(dataPath, 4567, templatePath, Files.createTempDirectory("webindex-dev-")); devServer.start(); }
Source:
<code>private List<Chunk> getBinChunks(Bin bin) { if (bin.containsChunks()) { return bin.getChunkList(); } if (bin.getBinNumber() < SRA_BIN_INDEX_OFFSET) { throw new RuntimeException("SRA only supports bins from the last level"); } int binNumber = bin.getBinNumber() - SRA_BIN_INDEX_OFFSET; long refOffset = recordRangleInfo.getReferenceOffsets().get(bin.getReferenceSequence()); <START> int firstChunkCorrection = binNumber == 0 ? 0 : -5000; <END> long binGlobalOffset = binNumber * SRA_BIN_SIZE + refOffset; long firstChunkNumber = (binGlobalOffset + firstChunkCorrection) / SRA_CHUNK_SIZE; long lastChunkNumber = (binGlobalOffset + SRA_BIN_SIZE - 1) / SRA_CHUNK_SIZE; List<Chunk> chunks = new ArrayList<Chunk>(); for (long chunkNumber = firstChunkNumber; chunkNumber <= lastChunkNumber; chunkNumber++) { chunks.add(new Chunk(chunkNumber * SRA_CHUNK_SIZE, (chunkNumber + 1) * SRA_CHUNK_SIZE)); } return chunks; }</code><technical_language>Extract this 5000 a named constant top of class, reflects assumptions max read length</technical_language>

Target:
private List<Chunk> getBinChunks(Bin bin) { if (bin.containsChunks()) { return bin.getChunkList(); } if (bin.getBinNumber() < SRA_BIN_INDEX_OFFSET) { throw new RuntimeException("SRA only supports bins from the last level"); } int binNumber = bin.getBinNumber() - SRA_BIN_INDEX_OFFSET; long refOffset = recordRangeInfo.getReferenceOffsets().get(bin.getReferenceSequence()); int firstChunkCorrection = binNumber == 0 ? 0 : -MAX_FRAGMENT_OVERLAP; long binGlobalOffset = binNumber * SRA_BIN_SIZE + refOffset; long firstChunkNumber = (binGlobalOffset + firstChunkCorrection) / SRA_CHUNK_SIZE; long lastChunkNumber = (binGlobalOffset + SRA_BIN_SIZE - 1) / SRA_CHUNK_SIZE; List<Chunk> chunks = new ArrayList<Chunk>(); for (long chunkNumber = firstChunkNumber; chunkNumber <= lastChunkNumber; chunkNumber++) { chunks.add(new Chunk(chunkNumber * SRA_CHUNK_SIZE, (chunkNumber + 1) * SRA_CHUNK_SIZE)); } return chunks; }
Source:
<code>private void syncGroupOffset() throws InterruptedException { for (String group : consumerGroups) { try { <START> List<Checkpoint> checkpoints = listConsumerGroupOffsets(group).entrySet().stream() .filter(x -> shouldCheckpointTopic(x.getKey().topic())) .map(x -> checkpoint(group, x.getKey(), x.getValue())) .filter(x -> x.downstreamOffset() > 0) END> .collect(Collectors.toList()); DescribeConsumerGroupsResult describedGroups = targetAdminClient.describeConsumerGroups( Lists.newArrayList(group)); for (Map.Entry<String, KafkaFuture<ConsumerGroupDescription>> entry : describedGroups.describedGroups().entrySet()) { ConsumerGroupDescription consumerGroupDescription = entry.getValue().get(); if (consumerGroupDescription.state().equals(ConsumerGroupState.EMPTY)) { alterGroupOffset(group, checkpoints); } } } catch (ExecutionException e) { log.error("Error querying offsets for consumer group on cluster {}.", group, sourceClusterAlias, e); } } }</code><technical_language>This part is duplicated -- DRYer? I suggest adding a checkpointsForGroup() method, in places</technical_language>

Target:
Map<String, Map<TopicPartition, OffsetAndMetadata>> syncGroupOffset() { Map<String, Map<TopicPartition, OffsetAndMetadata>> offsetToSyncAll = new HashMap<>(); for (Entry<String, Map<TopicPartition, OffsetAndMetadata>> group : getConvertedUpstreamOffset().entrySet()) { String consumerGroupId = group.getKey(); Map<TopicPartition, OffsetAndMetadata> convertedUpstreamOffset = group.getValue(); Map<TopicPartition, OffsetAndMetadata> offsetToSync = new HashMap<>(); Map<TopicPartition, OffsetAndMetadata> targetConsumerOffset = idleConsumerGroupsOffset.get(consumerGroupId); if (targetConsumerOffset == null) { syncGroupOffset(consumerGroupId, convertedUpstreamOffset); offsetToSyncAll.put(consumerGroupId, convertedUpstreamOffset); continue; } for (Entry<TopicPartition, OffsetAndMetadata> convertedEntry : convertedUpstreamOffset.entrySet()) { TopicPartition topicPartition = convertedEntry.getKey(); OffsetAndMetadata convertedOffset = convertedUpstreamOffset.get(topicPartition); if (!targetConsumerOffset.containsKey(topicPartition)) { offsetToSync.put(topicPartition, convertedOffset); continue; } long latestDownstreamOffset = targetConsumerOffset.get(topicPartition).offset(); if (latestDownstreamOffset >= convertedOffset.offset()) { log.trace("latestDownstreamOffset is larger than or equal to convertedUpstreamOffset for " + "TopicPartition {}", latestDownstreamOffset, convertedOffset.offset(), topicPartition); continue; } offsetToSync.put(topicPartition, convertedOffset); } if (offsetToSync.size() == 0) { log.trace("skip syncing the offset for consumer group: {}", consumerGroupId); continue; } syncGroupOffset(consumerGroupId, offsetToSync); offsetToSyncAll.put(consumerGroupId, offsetToSync); } idleConsumerGroupsOffset.clear(); return offsetToSyncAll; }
Source:
<code><START> public static InfluxDBException buildExceptionFromErrorMessage(final String errorMessage) { <END> if (errorMessage.contains(DATABASE_NOT_FOUND_ERROR)) { return new DatabaseNotFoundException(errorMessage); } if (errorMessage.contains(POINTS_BEYOND_RETENTION_POLICY_ERROR)) { return new PointsBeyondRetentionPolicyException(errorMessage); } if (errorMessage.contains(FIELD_TYPE_CONFLICT_ERROR)) { return new FieldTypeConflictException(errorMessage); } if (errorMessage.contains(UNABLE_TO_PARSE_ERROR)) { return new UnableToParseException(errorMessage); } if (errorMessage.contains(HINTED_HAND_OFF_QUEUE_NOT_EMPTY_ERROR)) { return new HintedHandOffQueueNotEmptyException(errorMessage); } if (errorMessage.contains(CACHE_MAX_MEMORY_SIZE_EXCEEDED_ERROR)) { return new CacheMaxMemorySizeExceededException(errorMessage); } if (errorMessage.contains(USER_REQUIRED_ERROR) || errorMessage.contains(USER_NOT_AUTHORIZED_ERROR) || errorMessage.contains(AUTHORIZATION_FAILED_ERROR) || errorMessage.contains(USERNAME_REQUIRED_ERROR)) { return new AuthorizationFailedException(errorMessage); } return new InfluxDBException(errorMessage); }</code><technical_language>public, if want test this below, write test in matching package</technical_language>

Target:
private static InfluxDBException buildExceptionFromErrorMessage(final String errorMessage) { if (errorMessage.contains(DATABASE_NOT_FOUND_ERROR)) { return new DatabaseNotFoundException(errorMessage); } if (errorMessage.contains(POINTS_BEYOND_RETENTION_POLICY_ERROR)) { return new PointsBeyondRetentionPolicyException(errorMessage); } if (errorMessage.contains(FIELD_TYPE_CONFLICT_ERROR)) { return new FieldTypeConflictException(errorMessage); } if (errorMessage.contains(UNABLE_TO_PARSE_ERROR)) { return new UnableToParseException(errorMessage); } if (errorMessage.contains(HINTED_HAND_OFF_QUEUE_NOT_EMPTY_ERROR)) { return new HintedHandOffQueueNotEmptyException(errorMessage); } if (errorMessage.contains(CACHE_MAX_MEMORY_SIZE_EXCEEDED_ERROR)) { return new CacheMaxMemorySizeExceededException(errorMessage); } if (errorMessage.contains(USER_REQUIRED_ERROR) || errorMessage.contains(USER_NOT_AUTHORIZED_ERROR) || errorMessage.contains(AUTHORIZATION_FAILED_ERROR) || errorMessage.contains(USERNAME_REQUIRED_ERROR)) { return new AuthorizationFailedException(errorMessage); } return new InfluxDBException(errorMessage); }
Source:
<code>public void sampleBoardAutoCreationTest() { assertEquals(panelControl.getNumberOfSavedBoards(), 0); clickMenu("Boards", "Auto-create", SAMPLE_BOARD); PlatformEx.waitOnFxThread(); assertNodeExists(hasText(SAMPLE_BOARD + " has been created and loaded.\n\n" + <START> "It is saved under the name \"" + SAMPLE_BOARD + "\".")); <END> click("OK"); assertEquals(panelControl.getPanelCount(), 3); assertEquals(panelControl.getCurrentlySelectedPanel(), Optional.of(0)); assertEquals(panelControl.getNumberOfSavedBoards(), 1); List<PanelInfo> panelInfos = panelControl.getCurrentPanelInfos(); assertEquals(panelInfos.get(0).getPanelFilter(), FIRST_SAMPLE_FILTER); assertEquals(panelInfos.get(1).getPanelFilter(), SECOND_SAMPLE_FILTER); assertEquals(panelInfos.get(2).getPanelFilter(), THIRD_SAMPLE_FILTER); assertEquals(panelInfos.get(0).getPanelName(), FIRST_SAMPLE_PANEL_NAME); assertEquals(panelInfos.get(1).getPanelName(), SECOND_SAMPLE_PANEL_NAME); assertEquals(panelInfos.get(2).getPanelName(), THIRD_SAMPLE_PANEL_NAME); }</code><technical_language>here. Also, this replaced waitUntilNodeAppears. Platform.runLater that</technical_language>

Target:
public void sampleBoardAutoCreationTest() { assertEquals(panelControl.getNumberOfSavedBoards(), 0); clickMenu("Boards", "Auto-create", SAMPLE_BOARD); waitUntilNodeAppears(SAMPLE_BOARD_DIALOG); click("OK"); assertEquals(panelControl.getPanelCount(), SAMPLE_PANEL_NAMES.size()); assertEquals(panelControl.getCurrentlySelectedPanel(), Optional.of(0)); assertEquals(panelControl.getNumberOfSavedBoards(), 1); List<PanelInfo> panelInfos = panelControl.getCurrentPanelInfos(); for (int i = 0; i < SAMPLE_PANEL_NAMES.size(); i++){ assertEquals(panelInfos.get(i).getPanelFilter(), SAMPLE_PANEL_FILTERS.get(i)); assertEquals(panelInfos.get(i).getPanelName(), SAMPLE_PANEL_NAMES.get(i)); } }
Source:
<code>public void configure(ClientDetailsServiceConfigurer clients) throws Exception { clients.inMemory() .withClient("my-trusted-client") .authorizedGrantTypes("custom", "password", "authorization_code", "refresh_token", "implicit") .authorities("ROLE_CLIENT", "ROLE_TRUSTED_CLIENT") .scopes("read", "write", "trust") .resourceIds("oauth2-resource") .accessTokenValiditySeconds(600) .redirectUris("https://anywhere") .and() .withClient("my-client-with-registered-redirect") .authorizedGrantTypes("authorization_code") .authorities("ROLE_CLIENT") .scopes("read", "trust") .resourceIds("oauth2-resource") .redirectUris("https://anywhere?key=value") .and() .withClient("my-client-with-secret") .authorizedGrantTypes("client_credentials", "password") .authorities("ROLE_CLIENT") .scopes("read") .resourceIds("oauth2-resource") .secret("secret") .and() <START> .withClient("my-client-with-unlimited-scopes") <END> .authorizedGrantTypes("password", "refresh_token"); }</code><technical_language>a configurations this new client is added. able add this new client in 1 2 configurations only</technical_language>

Target:
public void configure(ClientDetailsServiceConfigurer clients) throws Exception { clients.inMemory() .withClient("my-trusted-client") .authorizedGrantTypes("custom", "password", "authorization_code", "refresh_token", "implicit") .authorities("ROLE_CLIENT", "ROLE_TRUSTED_CLIENT") .scopes("read", "write", "trust") .resourceIds("oauth2-resource") .accessTokenValiditySeconds(600) .redirectUris("https://anywhere") .and() .withClient("my-client-with-registered-redirect") .authorizedGrantTypes("authorization_code") .authorities("ROLE_CLIENT") .scopes("read", "trust") .resourceIds("oauth2-resource") .redirectUris("https://anywhere?key=value") .and() .withClient("my-client-with-secret") .authorizedGrantTypes("client_credentials", "password") .authorities("ROLE_CLIENT") .scopes("read") .resourceIds("oauth2-resource") .secret("secret") .and() .withClient("my-client-with-empty-scopes") .authorizedGrantTypes("password", "refresh_token"); }
Source:
<code>private ServiceInfo parseServiceInfo(Map<String, Object> volumeServiceInfo) { ServiceInfo serviceInfo = new ServiceInfo(); if (volumeServiceInfo.containsKey(HOSTNAME)) { serviceInfo.setHostName((String) volumeServiceInfo.get(HOSTNAME)); } if (volumeServiceInfo.containsKey(STATUS)) { String brickStatus = (String) volumeServiceInfo.get(STATUS); if (brickStatus.toUpperCase().equals(ONLINE)) { serviceInfo.setStatus(GlusterStatus.UP); if (volumeServiceInfo.containsKey(PORT)) { serviceInfo.setPort(Integer.valueOf((String) volumeServiceInfo.get(PORT))); } if (volumeServiceInfo.containsKey(PID)) { serviceInfo.setPid(Integer.valueOf((String) volumeServiceInfo.get(PID))); <START> } <END> } else { serviceInfo.setStatus(GlusterStatus.DOWN); } } return serviceInfo; }</code><technical_language>setPort() setPid() accept primitive int Integer, is Integer.parseInt() Integer.valueOf() here</technical_language>

Target:
private ServiceInfo parseServiceInfo(Map<String, Object> volumeServiceInfo) { ServiceInfo serviceInfo = new ServiceInfo(); if (volumeServiceInfo.containsKey(HOSTNAME)) { serviceInfo.setHostName((String) volumeServiceInfo.get(HOSTNAME)); } if (volumeServiceInfo.containsKey(STATUS)) { String brickStatus = (String) volumeServiceInfo.get(STATUS); if (brickStatus.toUpperCase().equals(ONLINE)) { serviceInfo.setStatus(GlusterStatus.UP); if (volumeServiceInfo.containsKey(PORT)) { serviceInfo.setPort(Integer.parseInt((String) volumeServiceInfo.get(PORT))); } if (volumeServiceInfo.containsKey(PID)) { serviceInfo.setPid(Integer.parseInt((String) volumeServiceInfo.get(PID))); } } else { serviceInfo.setStatus(GlusterStatus.DOWN); } } return serviceInfo; }
Source:
<code>public void testGitHubBug208ParseError() throws Exception { String c = IOUtils.toString(this.getClass().getResourceAsStream("GitHubBug208.java"), <START> StandardCharsets.UTF_8); <END> parseJava15(c); }</code><technical_language>readAsString(...) instead</technical_language>

Target:
public void testGitHubBug208ParseError() { String c = readAsString("GitHubBug208.java"); parseJava15(c); }
Source:
<code>public static String getToken(final HttpServletRequest req){ String token; String encodedToken = req.getPathInfo(); if (Strings.isNullOrEmpty(encodedToken)) { <START> token = DEFAULT_TOKEN; } else { token = CharMatcher.is('/').trimLeadingFrom(Url.decode(encodedToken)); <END> } return token; }</code><technical_language>[optional] return result in cases eliminate 'token' variable</technical_language>

Target:
public static String getToken(final HttpServletRequest req){ String encodedToken = req.getPathInfo(); if (Strings.isNullOrEmpty(encodedToken)) { return DEFAULT_TOKEN; } else { return CharMatcher.is('/').trimLeadingFrom(Url.decode(encodedToken)); } }
Source:
<code>protected synchronized void handleEvent(CoordinatorEvent event) { _log.info("START: Handle event " + event.getType() + ", Instance: " + _adapter.getInstanceName()); try { switch (event.getType()) { case LEADER_DO_ASSIGNMENT: handleLeaderDoAssignment(); break; case HANDLE_ASSIGNMENT_CHANGE: handleAssignmentChange(); break; case HANDLE_ADD_OR_DELETE_DATASTREAM: handleDatastreamAddOrDelete(); break; case HANDLE_INSTANCE_ERROR: handleInstanceError((CoordinatorEvent.HandleInstanceError) event); break; default: String errorMessage = String.format("Unknown event type %s.", event.getType()); ErrorLogger.logAndThrowDatastreamRuntimeException(_log, errorMessage, null); break; } } catch (Exception e) { <START> _dynamicMetricsManager.createOrUpdateCounter(this.getClass(), "handleEvent", NUM_ERRORS, 1); <END> _log.error("ERROR: event + " + event + " failed.", e); } _log.info("END: Handle event " + event); }</code><technical_language>Do incrementing error based eventType sense here</technical_language>

Target:
protected synchronized void handleEvent(CoordinatorEvent event) { _log.info("START: Handle event " + event.getType() + ", Instance: " + _adapter.getInstanceName()); try { switch (event.getType()) { case LEADER_DO_ASSIGNMENT: handleLeaderDoAssignment(); break; case HANDLE_ASSIGNMENT_CHANGE: handleAssignmentChange(); break; case HANDLE_ADD_OR_DELETE_DATASTREAM: handleDatastreamAddOrDelete(); break; case HANDLE_INSTANCE_ERROR: handleInstanceError((CoordinatorEvent.HandleInstanceError) event); break; default: String errorMessage = String.format("Unknown event type %s.", event.getType()); ErrorLogger.logAndThrowDatastreamRuntimeException(_log, errorMessage, null); break; } } catch (Exception e) { _dynamicMetricsManager.createOrUpdateCounter(this.getClass(), "handleEvent-" + event.getType(), NUM_ERRORS, 1); _log.error("ERROR: event + " + event + " failed.", e); } _log.info("END: Handle event " + event); }
Source:
<code>private void resetAndStartScheduler() throws Exception { validateRunsInMainThread(); final CompletableFuture<Void> schedulerAssignedFuture; if (schedulerNG.requestJobStatus() == JobStatus.CREATED) { schedulerAssignedFuture = CompletableFuture.completedFuture(null); <START> schedulerNG.start(getMainThreadExecutor()); <END> } else { suspendAndClearSchedulerFields(new FlinkException("ExecutionGraph is being reset in order to be rescheduled.")); final JobManagerJobMetricGroup newJobManagerJobMetricGroup = jobMetricGroupFactory.create(jobGraph); final SchedulerNG newScheduler = createScheduler(executionDeploymentTracker, newJobManagerJobMetricGroup); schedulerAssignedFuture = schedulerNG.getTerminationFuture().handle( (ignored, throwable) -> { newScheduler.start(getMainThreadExecutor()); assignScheduler(newScheduler, newJobManagerJobMetricGroup); return null; } ); } schedulerAssignedFuture.thenRun(this::startScheduling); }</code><technical_language>If initialization, is call initialize setup? startScheduling</technical_language>

Target:
private void resetAndStartScheduler() throws Exception { validateRunsInMainThread(); final CompletableFuture<Void> schedulerAssignedFuture; if (schedulerNG.requestJobStatus() == JobStatus.CREATED) { schedulerAssignedFuture = CompletableFuture.completedFuture(null); schedulerNG.initialize(getMainThreadExecutor()); } else { suspendAndClearSchedulerFields(new FlinkException("ExecutionGraph is being reset in order to be rescheduled.")); final JobManagerJobMetricGroup newJobManagerJobMetricGroup = jobMetricGroupFactory.create(jobGraph); final SchedulerNG newScheduler = createScheduler(executionDeploymentTracker, newJobManagerJobMetricGroup); schedulerAssignedFuture = schedulerNG.getTerminationFuture().handle( (ignored, throwable) -> { newScheduler.initialize(getMainThreadExecutor()); assignScheduler(newScheduler, newJobManagerJobMetricGroup); return null; } ); } FutureUtils.assertNoException(schedulerAssignedFuture.thenRun(this::startScheduling)); }
Source:
<code>static boolean mustEncode(char ch) { <START> return (ch & 0xff) >= 128 || ch >= 0 && ch < 10 || ch >= 11 && ch < 32 || ch == '='; <END> }</code><technical_language>ch is >= 0 :-)</technical_language>

Target:
static boolean mustEncode(char ch) { return ch >= 128 || ch < 10 || ch >= 11 && ch < 32 || ch == '='; }
Source:
<code>public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); final LayoutInflater inflater = LayoutInflater.from(getActivity()); <START> ViewHolder holder; <END> final LinearLayout parent = (LinearLayout) view.findViewById(R.id.root); holder = createViewHolder(inflater, parent); holder.typeView.setIcon(FontAwesomeIcons.fa_file_text_o); holder.titleView.setText(R.string.handouts_title); holder.subtitleView.setText(R.string.handouts_subtitle); holder.rowView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (courseData != null) { environment.getRouter().showHandouts(getActivity(), courseData); } } }); holder = createViewHolder(inflater, parent); holder.typeView.setIcon(FontAwesomeIcons.fa_bullhorn); holder.titleView.setText(R.string.announcement_title); holder.subtitleView.setText(R.string.announcement_subtitle); holder.rowView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (courseData != null) { environment.getRouter().showCourseAnnouncement(getActivity(), courseData); } } }); }</code><technical_language>3 lines this: java final LayoutInflater inflater = LayoutInflater.from(getActivity()); final LinearLayout parent = (LinearLayout) view.findViewById(R.id.root); ViewHolder holder;</technical_language>

Target:
public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); final LayoutInflater inflater = LayoutInflater.from(getActivity()); final LinearLayout parent = (LinearLayout) view.findViewById(R.id.root); ViewHolder holder; holder = createViewHolder(inflater, parent); holder.typeView.setIcon(FontAwesomeIcons.fa_file_text_o); holder.titleView.setText(R.string.handouts_title); holder.subtitleView.setText(R.string.handouts_subtitle); holder.rowView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (courseData != null) { environment.getRouter().showHandouts(getActivity(), courseData); } } }); holder = createViewHolder(inflater, parent); holder.typeView.setIcon(FontAwesomeIcons.fa_bullhorn); holder.titleView.setText(R.string.announcement_title); holder.subtitleView.setText(R.string.announcement_subtitle); holder.rowView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (courseData != null) { environment.getRouter().showCourseAnnouncement(getActivity(), courseData); } } }); }
Source:
<code>public PollerFlux<OperationResult, List<FormPage>> beginRecognizeContent(Flux<ByteBuffer> form, long length, RecognizeOptions recognizeOptions) { try { Objects.requireNonNull(form, "'form' is required and cannot be null."); recognizeOptions = getRecognizeOptionsProperties(recognizeOptions); return new PollerFlux<>( recognizeOptions.getPollInterval(), streamActivationOperation( contentType -> service.analyzeLayoutAsyncWithResponseAsync(contentType, form, length) .map(response -> new OperationResult( parseModelId(response.getDeserializedHeaders().getOperationLocation()))), form, recognizeOptions.getContentType()), pollingOperation(service::getAnalyzeLayoutResultWithResponseAsync), (activationResponse, context) -> monoError(logger, new RuntimeException("Cancellation is not supported")), <START> fetchExtractContentResult()); <END> } catch (RuntimeException ex) { return PollerFlux.error(ex); } }</code><technical_language>update fetching operation here</technical_language>

Target:
public PollerFlux<OperationResult, List<FormPage>> beginRecognizeContent(Flux<ByteBuffer> form, long length, RecognizeOptions recognizeOptions) { return beginRecognizeContent(form, length, recognizeOptions, Context.NONE); }
Source:
<code>public void cachesGetRequest() throws Exception { final Map<String, String> headers = Collections.singletonMap( LastModifiedCachingWire.LAST_MODIFIED, LastModifiedCachingWireTest.LONG_AGO ); final MkContainer container = new MkGrizzlyContainer() .next( new MkAnswer.Simple( HttpURLConnection.HTTP_OK, headers.entrySet(), new byte[0] ) ) .next( new MkAnswer.Simple(HttpURLConnection.HTTP_NOT_MODIFIED), new IsAnything<MkQuery>(), Tv.TEN ).start(); try { final Request req = new JdkRequest(container.home()) .through(LastModifiedCachingWire.class); for (int idx = 0; idx < Tv.TEN; ++idx) { req.fetch().as(RestResponse.class) .assertStatus(HttpURLConnection.HTTP_OK); } } finally { container.stop(); } <START> MatcherAssert.assertThat( <END> container.queries(), Matchers.equalTo(Tv.TEN) ); }</code><technical_language>@piddubnyi move this line 91, finally</technical_language>

Target:
public void cachesGetRequest() throws Exception { final Map<String, String> headers = Collections.singletonMap( LastModifiedCachingWire.LAST_MODIFIED, "Wed, 15 Nov 1995 04:58:08 GMT" ); final MkContainer container = new MkGrizzlyContainer() .next( new MkAnswer.Simple( HttpURLConnection.HTTP_OK, headers.entrySet(), LastModifiedCachingWireTest.BODY.getBytes() ) ) .next( new MkAnswer.Simple(HttpURLConnection.HTTP_NOT_MODIFIED), new IsAnything<MkQuery>(), Tv.TEN ).start(); try { final Request req = new JdkRequest(container.home()) .through(LastModifiedCachingWire.class); for (int idx = 0; idx < Tv.TEN; ++idx) { req.fetch().as(RestResponse.class) .assertStatus(HttpURLConnection.HTTP_OK) .assertBody( Matchers.equalTo(LastModifiedCachingWireTest.BODY) ); } MatcherAssert.assertThat( container.queries(), Matchers.equalTo(Tv.TEN) ); } finally { container.stop(); } }
Source:
<code><START> public Image getImage(MUILabel element) { <END> return getImage(element, false); }</code><technical_language>WBWRenderer#getImage overrides this method; I pretty WBWRenderer#getImage(element) changed WBWRenderer#getImage(element, changed) too. @Lars this method changed public final prevent errors</technical_language>

Target:
public Image getImage(MUILabel element) { Image image = (Image) ((MUIElement) element).getTransientData().get( IPresentationEngine.OVERRIDE_ICON_IMAGE_KEY); if (image == null || image.isDisposed()) { image = getImageFromURI(getIconURI(element)); } if (image != null) { image = adornImage((MUIElement) element, image); } return image; }
Source:
<code>public void shouldCreateFailureTryWithResources7() { final Resource<Integer> resource1 = resource(1); final Resource<Integer> resource2 = resource(2); final Resource<Integer> resource3 = resource(3); final Resource<Integer> resource4 = resource(4); final Resource<Integer> resource5 = resource(5); final Resource<Integer> resource6 = resource(6); final Resource<Integer> resource7 = resource(7); <START> final Try<?> actual = Try.withResources(() -> resource1, () -> resource2, () -> resource3, () -> resource4, () -> resource5, () -> resource6, () -> resource7).of((i1, i2, i3, i4, i5, i6, i7) -> { throw new Error(); }); <END> assertThat(actual.isFailure()).isTrue(); assertThat(resource1.isClosed).isTrue(); assertThat(resource2.isClosed).isTrue(); assertThat(resource3.isClosed).isTrue(); assertThat(resource4.isClosed).isTrue(); assertThat(resource5.isClosed).isTrue(); assertThat(resource6.isClosed).isTrue(); assertThat(resource7.isClosed).isTrue(); }</code><technical_language>for full coverage want test this InterruptedException some other non-fatal exception. Please coverage of Try this commit for details :)</technical_language>

Target:
public void shouldCreateFailureTryWithResources7() { final Closeable<Integer> closeable1 = Closeable.of(1); final Closeable<Integer> closeable2 = Closeable.of(2); final Closeable<Integer> closeable3 = Closeable.of(3); final Closeable<Integer> closeable4 = Closeable.of(4); final Closeable<Integer> closeable5 = Closeable.of(5); final Closeable<Integer> closeable6 = Closeable.of(6); final Closeable<Integer> closeable7 = Closeable.of(7); final Try<?> actual = Try.withResources(() -> closeable1, () -> closeable2, () -> closeable3, () -> closeable4, () -> closeable5, () -> closeable6, () -> closeable7).of((i1, i2, i3, i4, i5, i6, i7) -> { throw new Error(); }); assertThat(actual.isFailure()).isTrue(); assertThat(closeable1.isClosed).isTrue(); assertThat(closeable2.isClosed).isTrue(); assertThat(closeable3.isClosed).isTrue(); assertThat(closeable4.isClosed).isTrue(); assertThat(closeable5.isClosed).isTrue(); assertThat(closeable6.isClosed).isTrue(); assertThat(closeable7.isClosed).isTrue(); }
Source:
<code>private Session getSession(URI sessionModelURI, boolean restore) { Session sessionFromURI; try { sessionFromURI = null; if (restore) { sessionFromURI = SessionManager.INSTANCE.getSession(sessionModelURI, new NullProgressMonitor()); } else { sessionFromURI = SessionManager.INSTANCE.getExistingSession(sessionModelURI); } if (sessionFromURI != null) { if (!sessionFromURI.isOpen()) { sessionFromURI.open(new NullProgressMonitor()); } IEditingSession uiSession = null; if (restore) { uiSession = SessionUIManager.INSTANCE.getOrCreateUISession(sessionFromURI); } else { uiSession = SessionUIManager.INSTANCE.getUISession(sessionFromURI); } if (uiSession != null <START> && uiSession.isOpen()) { <END> uiSession.open(); } } } catch (IllegalStateException e) { sessionFromURI = null; } catch (OperationCanceledException e) { sessionFromURI = null; } return sessionFromURI; }</code><technical_language>This negated</technical_language>

Target:
private Session getSession(URI sessionModelURI, boolean restore) { Session sessionFromURI; try { sessionFromURI = null; if (restore) { sessionFromURI = SessionManager.INSTANCE.getSession(sessionModelURI, new NullProgressMonitor()); } else { sessionFromURI = SessionManager.INSTANCE.getExistingSession(sessionModelURI); } if (sessionFromURI != null) { if (!sessionFromURI.isOpen()) { sessionFromURI.open(new NullProgressMonitor()); } IEditingSession uiSession = null; if (restore) { uiSession = SessionUIManager.INSTANCE.getOrCreateUISession(sessionFromURI); } else { uiSession = SessionUIManager.INSTANCE.getUISession(sessionFromURI); } if (uiSession != null && !uiSession.isOpen()) { uiSession.open(); } } } catch (IllegalStateException e) { sessionFromURI = null; } catch (OperationCanceledException e) { sessionFromURI = null; } return sessionFromURI; }
Source:
<code>private static List<IResource> collectRelatedChanges( IResource[] selectedResources, IWorkbenchPart part, IProgressMonitor monitor) throws InterruptedException, InvocationTargetException { <START> SubscriberScopeManager manager = GitScopeUtil.createScopeManager( <END> selectedResources, SubMonitor.convert(monitor, 50)); GitScopeOperation buildScopeOperation = GitScopeOperationFactory .getFactory().createGitScopeOperation(part, manager); buildScopeOperation.run(SubMonitor.convert(monitor, 50)); return buildScopeOperation.getRelevantResources(); }</code><technical_language>SubMonitor progress = SubMonitor.convert(monitor,2); pass progress.newChild(1) twice</technical_language>

Target:
private static List<IResource> collectRelatedChanges( IResource[] selectedResources, IWorkbenchPart part, IProgressMonitor monitor) throws InterruptedException, InvocationTargetException { SubMonitor progress = SubMonitor.convert(monitor, 2); SubscriberScopeManager manager = GitScopeUtil.createScopeManager( selectedResources, progress.newChild(1)); GitScopeOperation buildScopeOperation = GitScopeOperationFactory .getFactory().createGitScopeOperation(part, manager); buildScopeOperation.run(progress.newChild(1)); return buildScopeOperation.getRelevantResources(); }
Source:
<code>public void open(IProgressMonitor monitor) throws RemoteConnectionException { if (!isOpen()) { checkIsConfigured(); SubMonitor subMon = SubMonitor.convert(monitor, 60); Session session = newSession(fManager.getUserAuthenticator(this), subMon.newChild(10)); if (subMon.isCanceled()) { throw new RemoteConnectionException(Messages.JSchConnection_Connection_was_cancelled); } <START> loadEnv(subMon.newChild(10)); <END> if (!checkConfiguration(session, subMon.newChild(20))) { newSession(fManager.getUserAuthenticator(this), subMon.newChild(10)); loadEnv(subMon.newChild(10)); } fIsOpen = true; try { fWorkingDir = getCwd(subMon.newChild(10)); loadProperties(subMon.newChild(10)); } catch (RemoteConnectionException e) { fIsOpen = false; throw e; } fireConnectionChangeEvent(IRemoteConnectionChangeEvent.CONNECTION_OPENED); } }</code><technical_language>this result in calls loadEnv (the other in checkConfiguration)</technical_language>

Target:
public void open(IProgressMonitor monitor) throws RemoteConnectionException { if (!isOpen()) { checkIsConfigured(); SubMonitor subMon = SubMonitor.convert(monitor, 60); Session session = newSession(fManager.getUserAuthenticator(this), subMon.newChild(10)); if (subMon.isCanceled()) { throw new RemoteConnectionException(Messages.JSchConnection_Connection_was_cancelled); } fWorkingDir = getCwd(subMon.newChild(10)); if (!checkConfiguration(session, subMon.newChild(20))) { newSession(fManager.getUserAuthenticator(this), subMon.newChild(10)); loadEnv(subMon.newChild(10)); } fIsOpen = true; loadProperties(subMon.newChild(10)); fireConnectionChangeEvent(IRemoteConnectionChangeEvent.CONNECTION_OPENED); } }
Source:
<code>public HashMap setRoleTypesExpected() { <START> this.unsetTypeExpected(); <END> HashMap roleTypes = new HashMap(); roleTypes.put(1, TypeNames.STRING); roleTypes.put(2, TypeNames.INT); roleTypes.put(3, TypeNames.INT); roleTypes.put(4, TypeNames.INT); roleTypes.put(5, TypeNames.DATE); roleTypes.put(6, TypeNames.DATE); roleTypes.put(7, TypeNames.INT); roleTypes.put(8, TypeNames.STRING); return roleTypes; }</code><technical_language>need this anymore</technical_language>

Target:
public HashMap setRoleTypesExpected() { HashMap roleTypes = new HashMap(); roleTypes.put(1, TypeNames.STRING); roleTypes.put(2, TypeNames.INT); roleTypes.put(3, TypeNames.INT); roleTypes.put(4, TypeNames.INT); roleTypes.put(5, TypeNames.DATE); roleTypes.put(6, TypeNames.DATE); roleTypes.put(7, TypeNames.INT); roleTypes.put(8, TypeNames.STRING); return roleTypes; }
Source:
<code>protected boolean removeTransfer(InboundTransferTask inboundTransfer) { boolean found = false; synchronized (transferMapsLock) { if (trace) log.tracef("Removing inbound transfers from node %s for segments %s", inboundTransfer.getSegments(), inboundTransfer.getSource(), cacheName); List<InboundTransferTask> transfers = transfersBySource.get(inboundTransfer.getSource()); if (transfers != null && (found = transfers.remove(inboundTransfer)) && transfers.isEmpty()) { transfersBySource.remove(inboundTransfer.getSource()); } <START> inboundTransfer.getSegments().forEach((Integer segment) -> { <END> List<InboundTransferTask> innerTransfers = transfersBySegment.get(segment); if (innerTransfers != null && innerTransfers.remove(inboundTransfer) && innerTransfers.isEmpty()) { transfersBySegment.remove(segment); } }); } return found; }</code><technical_language>IMO for (Integer segment : ...) is clearer</technical_language>

Target:
protected boolean removeTransfer(InboundTransferTask inboundTransfer) { boolean found = false; synchronized (transferMapsLock) { if (trace) log.tracef("Removing inbound transfers from node %s for segments %s", inboundTransfer.getSegments(), inboundTransfer.getSource(), cacheName); List<InboundTransferTask> transfers = transfersBySource.get(inboundTransfer.getSource()); if (transfers != null && (found = transfers.remove(inboundTransfer)) && transfers.isEmpty()) { transfersBySource.remove(inboundTransfer.getSource()); } for (Integer segment : inboundTransfer.getSegments()) { List<InboundTransferTask> innerTransfers = transfersBySegment.get(segment); if (innerTransfers != null && innerTransfers.remove(inboundTransfer) && innerTransfers.isEmpty()) { transfersBySegment.remove(segment); } } } return found; }
Source:
<code>public EnglishLowerCase(final String string) { <START> this.value = string.toLowerCase(EnglishLowerCase.ENGLISH); <END> }</code><technical_language>@dalifreire Locale.ENGLISH right here</technical_language>

Target:
public EnglishLowerCase(final String string) { this.value = string; }
Source:
<code>protected ICommand getCreateCommand(CreateElementRequest req) { EObject owner = req.getContainer(); EReference eref = req.getContainmentFeature(); <START> if (eref == null) { return UnexecutableCommand.INSTANCE; } <END> if (owner instanceof Component && eref == UMLPackage.eINSTANCE.getClass_NestedClassifier() && req.getElementType().getEClass() == UMLPackage.eINSTANCE.getComponent()) { return UnexecutableCommand.INSTANCE; } return super.getCreateCommand(req); }</code><technical_language>Sorry, I suppose I clear. I meant == this check for null 'eref' returning unexecutable command necessary removed. idea superclass able do useful (for example, for a suitable reference try again). So, remove this null check works</technical_language>

Target:
protected ICommand getCreateCommand(CreateElementRequest req) { EObject owner = req.getContainer(); EReference eref = req.getContainmentFeature(); if (owner instanceof Component && eref == UMLPackage.eINSTANCE.getClass_NestedClassifier() && req.getElementType().getEClass() == UMLPackage.eINSTANCE.getComponent()) { return UnexecutableCommand.INSTANCE; } return super.getCreateCommand(req); }
Source:
<code>private void getColumnEncryptionProperties(String[] path, Map<ColumnPath, ColumnEncryptionProperties> columnPropertyMap, Configuration conf) throws ParquetCryptoRuntimeException { String pathName = String.join(".", path); <START> String columnKeyName = conf.get(pathName, null); <END> if (columnKeyName != null) { ColumnPath columnPath = ColumnPath.get(path); ColumnEncryptionProperties colEncProp = ColumnEncryptionProperties.builder(columnPath) .withKey(COL_KEY) .withKeyMetaData(COL_KEY_METADATA) .build(); columnPropertyMap.put(columnPath, colEncProp); } }</code><technical_language>I is a good practice column name a conf key directly. chance of collisions pretty high. I suggest adding a constant prefix</technical_language>

Target:
private void getColumnEncryptionProperties(String[] path, Map<ColumnPath, ColumnEncryptionProperties> columnPropertyMap, Configuration conf) throws ParquetCryptoRuntimeException { String pathName = String.join(".", path); String columnKeyName = conf.get(PATH_NAME_PREFIX + pathName, null); if (columnKeyName != null) { ColumnPath columnPath = ColumnPath.get(path); ColumnEncryptionProperties colEncProp = ColumnEncryptionProperties.builder(columnPath) .withKey(COL_KEY) .withKeyMetaData(COL_KEY_METADATA) .build(); columnPropertyMap.put(columnPath, colEncProp); } }
Source:
<code>void reportInternalBugsnagError(@NonNull Error error) { error.setAppData(appData.getAppDataSummary()); error.setDeviceData(deviceData.getDeviceDataSummary()); MetaData metaData = error.getMetaData(); Notifier notifier = Notifier.getInstance(); metaData.addToTab(INTERNAL_DIAGNOSTICS_TAB, "notifierName", notifier.getName()); metaData.addToTab(INTERNAL_DIAGNOSTICS_TAB, "notifierVersion", notifier.getVersion()); metaData.addToTab(INTERNAL_DIAGNOSTICS_TAB, "apiKey", config.getApiKey()); Object packageName = appData.getAppData().get("packageName"); metaData.addToTab(INTERNAL_DIAGNOSTICS_TAB, "packageName", packageName); final Report report = new Report(null, error); try { Async.run(new Runnable() { @Override public void run() { try { Delivery delivery = config.getDelivery(); if (delivery instanceof DefaultDelivery) { Map<String, String> headers = config.getErrorApiHeaders(); headers.put("Bugsnag-Internal-Error", "true"); <START> headers.remove(Configuration.HEADER_API_KEY); <END> DefaultDelivery defaultDelivery = (DefaultDelivery) delivery; defaultDelivery.deliver(config.getEndpoint(), report, headers); } } catch (Exception exception) { Logger.warn("Failed to report minimal error to Bugsnag", exception); } } }); } catch (RejectedExecutionException ignored) { } }</code><technical_language>I this needs removed</technical_language>

Target:
void reportInternalBugsnagError(@NonNull Error error) { error.setAppData(appData.getAppDataSummary()); error.setDeviceData(deviceData.getDeviceDataSummary()); MetaData metaData = error.getMetaData(); Notifier notifier = Notifier.getInstance(); metaData.addToTab(INTERNAL_DIAGNOSTICS_TAB, "notifierName", notifier.getName()); metaData.addToTab(INTERNAL_DIAGNOSTICS_TAB, "notifierVersion", notifier.getVersion()); metaData.addToTab(INTERNAL_DIAGNOSTICS_TAB, "apiKey", config.getApiKey()); Object packageName = appData.getAppData().get("packageName"); metaData.addToTab(INTERNAL_DIAGNOSTICS_TAB, "packageName", packageName); final Report report = new Report(null, error); try { Async.run(new Runnable() { @Override public void run() { try { Delivery delivery = config.getDelivery(); if (delivery instanceof DefaultDelivery) { Map<String, String> headers = config.getErrorApiHeaders(); headers.put("Bugsnag-Internal-Error", "true"); headers.remove(Configuration.HEADER_API_KEY); DefaultDelivery defaultDelivery = (DefaultDelivery) delivery; defaultDelivery.deliver(config.getEndpoint(), report, headers); } } catch (Exception exception) { Logger.warn("Failed to report internal error to Bugsnag", exception); } } }); } catch (RejectedExecutionException ignored) { } }
Source:
<code>public void widgetSelected(SelectionEvent e) { Table table = fTableViewer.getTable(); TableColumn prevSortcolumn = table.getSortColumn(); if (prevSortcolumn == fColumn) { flipSortDirection(); } table.setSortDirection(fDirection); table.setSortColumn(fColumn); Comparator<T> comparator; if (fDirection == SWT.DOWN) { comparator = fComparator; } else { comparator = checkNotNull(Collections.reverseOrder(fComparator)); } IContentProvider contentProvider = fTableViewer.getContentProvider(); if (contentProvider instanceof DeferredContentProvider) { DeferredContentProvider deferredContentProvider = (DeferredContentProvider) contentProvider; deferredContentProvider.setSortOrder(comparator); } else if (contentProvider instanceof ISortingLazyContentProvider) { long columnId = (long) fColumn.getData(COLUMN_ID_KEY); ISortingLazyContentProvider sortingLazyContentProvider = (ISortingLazyContentProvider) contentProvider; sortingLazyContentProvider.setSortOrder(columnId, fDirection == <START> SWT.DOWN ? true : false); <END> } else { fTableViewer.setComparator(new ElementComparator<>(comparator)); } }</code><technical_language>necessary</technical_language>

Target:
public void widgetSelected(SelectionEvent e) { Table table = fTableViewer.getTable(); TableColumn prevSortcolumn = table.getSortColumn(); if (prevSortcolumn == fColumn) { flipSortDirection(); } table.setSortDirection(fDirection); table.setSortColumn(fColumn); Comparator<T> comparator; if (fDirection == SWT.DOWN) { comparator = fComparator; } else { comparator = checkNotNull(Collections.reverseOrder(fComparator)); } IContentProvider contentProvider = fTableViewer.getContentProvider(); if (contentProvider instanceof DeferredContentProvider) { DeferredContentProvider deferredContentProvider = (DeferredContentProvider) contentProvider; deferredContentProvider.setSortOrder(comparator); } else if (contentProvider instanceof ISortingLazyContentProvider) { long columnId = (long) fColumn.getData(COLUMN_ID_KEY); ISortingLazyContentProvider sortingLazyContentProvider = (ISortingLazyContentProvider) contentProvider; sortingLazyContentProvider.setSortOrder(columnId, fDirection == SWT.DOWN); } else { fTableViewer.setComparator(new ElementComparator<>(comparator)); } }
Source:
<code>public Value getOrNilValue(int index) { <START> if (array.length < index && index >= 0) { <END> return array[index]; } return ImmutableNilValueImpl.get(); }</code><technical_language>This condition backwards. I index < array.length</technical_language>

Target:
public Value getOrNilValue(int index) { if (index < array.length && index >= 0) { return array[index]; } return ImmutableNilValueImpl.get(); }