auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>protected final Cluster getRuntimeCluster(String host, int port) throws Exception { try (DiagnosticService diagnosticService = DiagnosticServiceFactory.fetch( InetSocketAddress.createUnresolved(host, port), getClass().getSimpleName(), OP_TIMEOUT, <START> OP_TIMEOUT, <END> null)) { return diagnosticService.getProxy(TopologyService.class).getRuntimeNodeContext().getCluster(); } }</code><technical_language>overridable getOperationTimeout() method instead</technical_language>

Target:
protected final Cluster getRuntimeCluster(String host, int port) throws Exception { try (DiagnosticService diagnosticService = DiagnosticServiceFactory.fetch( InetSocketAddress.createUnresolved(host, port), getClass().getSimpleName(), getConnectionTimeout(), getConnectionTimeout(), null)) { return diagnosticService.getProxy(TopologyService.class).getRuntimeNodeContext().getCluster(); } }
Source:
<code>public void setClientAuthenticationMethodAsString(String auth) { <START> this.clientAuthenticationMethod.parse(auth); <END> }</code><technical_language>I this work returned parsed is used. I expected: this.clientAuthenticationMethod = ClientAuthenticationMethod.parse(auth);</technical_language>

Target:
public void setClientAuthenticationMethodAsString(String auth) { this.clientAuthenticationMethod = ClientAuthenticationMethod.parse(auth); }
Source:
<code>public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); checkUpgradePreferences(this); ((SyncthingActivity) getActivity()).registerOnServiceConnectedListener(this); mIsCreate = ((SettingsActivity) getActivity()).getIsCreate(); setHasOptionsMenu(true); if (mIsCreate) { addPreferencesFromResource(R.xml.device_settings_create); } else { addPreferencesFromResource(R.xml.device_settings_edit); } mDeviceId = findPreference("device_id"); mDeviceId.setOnPreferenceChangeListener(this); mName = (EditTextPreference) findPreference("name"); mName.setOnPreferenceChangeListener(this); mAddresses = (EditTextPreference) findPreference("addresses"); mAddresses.setOnPreferenceChangeListener(this); mCompression = (ListPreference) findPreference("compression"); mCompression.setOnPreferenceChangeListener(this); mIntroducer = (CheckBoxPreference) findPreference("introducer"); mIntroducer.setOnPreferenceChangeListener(this); if (!mIsCreate) { mVersion = findPreference("version"); mVersion.setSummary("?"); mCurrentAddress = findPreference("current_address"); mCurrentAddress.setSummary("?"); } if (mIsCreate) { if (savedInstanceState != null) { mDevice = (RestApi.Device) savedInstanceState.getSerializable("device"); } else { mDevice = new RestApi.Device(); mDevice.Name = ""; mDevice.DeviceID = ""; mDevice.Addresses = "dynamic"; <START> mDevice.Compression = "always"; <END> ((EditTextPreference) mDeviceId).setText(mDevice.DeviceID); } } }</code><technical_language>metadata default</technical_language>

Target:
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ((SyncthingActivity) getActivity()).registerOnServiceConnectedListener(this); mIsCreate = ((SettingsActivity) getActivity()).getIsCreate(); setHasOptionsMenu(true); if (mIsCreate) { addPreferencesFromResource(R.xml.device_settings_create); } else { addPreferencesFromResource(R.xml.device_settings_edit); } mDeviceId = findPreference("device_id"); mDeviceId.setOnPreferenceChangeListener(this); mName = (EditTextPreference) findPreference("name"); mName.setOnPreferenceChangeListener(this); mAddresses = (EditTextPreference) findPreference("addresses"); mAddresses.setOnPreferenceChangeListener(this); mCompression = (ListPreference) findPreference("compression"); mCompression.setOnPreferenceChangeListener(this); mIntroducer = (CheckBoxPreference) findPreference("introducer"); mIntroducer.setOnPreferenceChangeListener(this); if (!mIsCreate) { mVersion = findPreference("version"); mVersion.setSummary("?"); mCurrentAddress = findPreference("current_address"); mCurrentAddress.setSummary("?"); } if (mIsCreate) { if (savedInstanceState != null) { mDevice = (RestApi.Device) savedInstanceState.getSerializable("device"); } else { mDevice = new RestApi.Device(); mDevice.Name = ""; mDevice.DeviceID = ""; mDevice.Addresses = "dynamic"; mDevice.Compression = "always"; ((EditTextPreference) mDeviceId).setText(mDevice.DeviceID); } } }
Source:
<code>public String getValue(TreeItem object) { if (webClientProperties.isUserCommentAvailable()) { <START> if ((object.get(NAME).equals(USER_COMMENT)||object.get(NAME).equals(SESSION_TAGS)) && !field.equals(NAME)) { <END> String toShow = object.get(field).replaceAll("\n", "<br>"); return "<img src=\"" + JaggerResources.INSTANCE.getPencilImage().getSafeUri().asString() + "\" height=\"15\" width=\"15\">" + "<ins font-size='10px'>double click to edit</ins><br><br>" + toShow; } } return object.get(field); }</code><technical_language>I separate property for ability tag/untag sessions</technical_language>

Target:
public String getValue(TreeItem object) { String penImageResource = "<img src=\"" + JaggerResources.INSTANCE.getPencilImage().getSafeUri().asString() + "\" height=\"15\" width=\"15\">" + "<ins font-size='10px'>double click to edit</ins><br><br>"; String toShow; if (webClientProperties.isUserCommentAvailable()) { if (object.get(NAME).equals(USER_COMMENT) && !field.equals(NAME)) { toShow = object.get(field).replaceAll("\n", "<br>"); return penImageResource+toShow; } } if (webClientProperties.isTagsAvailable()) { if (object.get(NAME).equals(SESSION_TAGS) && !field.equals(NAME)) { toShow = object.get(field).replaceAll("\n", "<br>"); return penImageResource+toShow; } } return object.get(field); }
Source:
<code>private void initTicket() { for (Event event : eventDao.list()) { for (Category category : event.getCategories()) { int numberOfTickets = category.getNumberOfTickets(); while (numberOfTickets > 0) { String strSection = ""; <START> int seat = -1; <END> if (category.getType() == CategoryType.SEAT) { strSection = "Niveau " + (new Random().nextInt(2) + 1) * 100; seat = numberOfTickets; } Ticket ticket = new Ticket(event.getId(), category.getId(), strSection, seat); ticketDao.create(ticket); numberOfTickets--; } } } }</code><technical_language>pk -1</technical_language>

Target:
private void initTicket() { for (Event event : eventDao.list()) { for (Category category : event.getCategories()) { int numberOfTickets = category.getNumberOfTickets(); while (numberOfTickets > 0) { Ticket ticket; if (category.getType() == CategoryType.SEAT) { ticket = TicketFactory.createAvailableSeatTicket( event.getId(), category.getId(), (numberOfTickets % 2 == 0) ? "Niveau 100" : "Niveau 200", numberOfTickets); } else { ticket = TicketFactory.createAvailableGeneralAdmissionTicket( event.getId(), category.getId()); } ticketDao.create(ticket); numberOfTickets--; } } } }
Source:
<code>public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_search, container, false); this.setHasOptionsMenu(true); ButterKnife.inject(this, view); apiClient = new MITAPIClient(getActivity()); recentSearches = new ArrayList<>(); sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getActivity().getApplicationContext()); Set<String> set = sharedPreferences.getStringSet(NEWS_SEARCH_HISTORY, null); <START> if (set != null) { <END> recentSearches.addAll(set); mitSearchAdapter = new MITSearchAdapter(getActivity().getApplicationContext(), recentSearches, this); recentSearchListView.setAdapter(mitSearchAdapter); } return view; }</code><technical_language>mitSearchAdapter instantiated array of size 0 if set == null</technical_language>

Target:
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_search, container, false); this.setHasOptionsMenu(true); ButterKnife.inject(this, view); apiClient = new MITAPIClient(getActivity()); recentSearches = new ArrayList<>(); sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getActivity().getApplicationContext()); Set<String> set = sharedPreferences.getStringSet(NEWS_SEARCH_HISTORY, null); if (set != null) { recentSearches.addAll(set); } mitSearchAdapter = new MITSearchAdapter(getActivity().getApplicationContext(), recentSearches, this); recentSearchListView.setAdapter(mitSearchAdapter); return view; }
Source:
<code>public String simplifyHostname(String hostname) { for (String domainName : domainNamesToRemove) { <START> if (domainName != null && !domainName.isEmpty()) { if (domainName.charAt(0) != '.') { <END> domainName = "." + domainName; } hostname = hostname.replace(domainName, ""); } } return String.format("%s_%d", hostname, port); }</code><technical_language>minor: I suggest this: if (domainName != null) { domainName = domainName.trim(); if (!domainName.isEmpty() && domainName.charAt(0) != '.') { ... } ... }</technical_language>

Target:
public String simplifyHostname(String hostname) { for (String domainName : domainNamesToRemove) { if (domainName != null && !(domainName = domainName.trim()).isEmpty()) { if (domainName.charAt(0) != '.') { domainName = "." + domainName; } hostname = hostname.replace(domainName, ""); } } return String.format("%s_%d", hostname, port); }
Source:
<code>public Tracer createTracer(String serviceName) { Configuration.SenderConfiguration senderConfiguration = reporterConfig.getSenderConfiguration(); if(outboundSocketBindingSupplier.get() != null) { senderConfiguration.withAgentHost(outboundSocketBindingSupplier.get().getUnresolvedDestinationAddress()) .withAgentPort(outboundSocketBindingSupplier.get().getDestinationPort()); } <START> return new Configuration(serviceName) <END> .withCodec(codecConfig) .withReporter(reporterConfig) .withSampler(samplerConfig) .withTraceId128Bit(traceId128Bit) .withTracerTags(tracerTags) .getTracerBuilder() .withManualShutdown() .build(); }</code><technical_language>I this is used, want do more like. final OutboundSocketBinding binding = outboundSocketBindingSupplier.get(); if(outboundSocketBindingSupplier.get() != null) { senderConfiguration.withAgentHost(binding.getUnresolvedDestinationAddress()) .withAgentPort(binding.getDestinationPort()); } I overhead of get() is in MSC, a single get() better</technical_language>

Target:
public Tracer createTracer(String serviceName) { Configuration.SenderConfiguration senderConfiguration = reporterConfig.getSenderConfiguration(); OutboundSocketBinding outboundSocketBinding = outboundSocketBindingSupplier.get(); if(outboundSocketBinding != null) { senderConfiguration.withAgentHost(outboundSocketBinding.getUnresolvedDestinationAddress()) .withAgentPort(outboundSocketBinding.getDestinationPort()); } return new Configuration(serviceName) .withCodec(codecConfig) .withReporter(reporterConfig) .withSampler(samplerConfig) .withTraceId128Bit(traceId128Bit) .withTracerTags(tracerTags) .getTracerBuilder() .withManualShutdown() .build(); }
Source:
<code>public void registered(final ExecutorDriver driver, final ExecutorInfo executorInfo, final FrameworkInfo frameworkInfo, final SlaveInfo slaveInfo) { <START> if (LOGGER.isDebugEnabled()) <END> LOGGER.debug("registered(driver : {}, executorInfo : {}, frameworkInfo : {}, slaveInfo : {})", driver, protoToString(executorInfo), protoToString(frameworkInfo), protoToString(slaveInfo)); this.executorInfo = executorInfo; }</code><technical_language>Please add curly braces if statements</technical_language>

Target:
public void registered(final ExecutorDriver driver, final ExecutorInfo executorInfo, final FrameworkInfo frameworkInfo, final SlaveInfo slaveInfo) { if (LOGGER.isDebugEnabled()) { LOGGER.debug("registered(driver : {}, executorInfo : {}, frameworkInfo : {}, slaveInfo : {})", driver, protoToString(executorInfo), protoToString(frameworkInfo), protoToString(slaveInfo)); } this.executorInfo = executorInfo; }
Source:
<code>public Iterable<DBObject> getComplianceForTimespan(Date startDate, Date endDate, List<String> consumerIds, List<String> owners) { BasicDBObjectBuilder queryBuilder = BasicDBObjectBuilder.start(); if (owners != null && !owners.isEmpty()) { queryBuilder.add("consumer.owner.key", new BasicDBObject("$in", owners)); } BasicDBObjectBuilder dateQueryBuilder = BasicDBObjectBuilder.start(); if (startDate != null) { dateQueryBuilder.add("$gt", startDate); } if (endDate != null) { dateQueryBuilder.add("$lte", endDate); } if (startDate != null || endDate != null) { queryBuilder.add("status.date", dateQueryBuilder.get()); } BasicDBObject projections = new BasicDBObject(); projections.put("consumer", 1); projections.put("status", 1); projections.put("_id", 0); BasicDBObject project = new BasicDBObject("$project", projections); DBObject query = new BasicDBObject("$match", queryBuilder.get()); DBObject sort = new BasicDBObject("$sort", new BasicDBObject("status.date", 1)); AggregationOutput output = collection.aggregate(Arrays.asList( query, project, sort )); <START> return output.results(); <END> }</code><technical_language>change this method query initially for matching IDs pull status records ID. If hit error I did</technical_language>

Target:
public DBCursor getComplianceForTimespan(Date startDate, Date endDate, List<String> consumerIds, List<String> owners) { BasicDBObjectBuilder queryBuilder = BasicDBObjectBuilder.start(); if (owners != null && !owners.isEmpty()) { queryBuilder.add("consumer.owner.key", new BasicDBObject("$in", owners)); } BasicDBObjectBuilder dateQueryBuilder = BasicDBObjectBuilder.start(); if (startDate != null) { dateQueryBuilder.add("$gt", startDate); } if (endDate != null) { dateQueryBuilder.add("$lte", endDate); } if (startDate != null || endDate != null) { queryBuilder.add("status.date", dateQueryBuilder.get()); } BasicDBObject projections = new BasicDBObject("_id", 1); BasicDBObject project = new BasicDBObject("$project", projections); DBObject query = new BasicDBObject("$match", queryBuilder.get()); DBObject sort = new BasicDBObject("$sort", new BasicDBObject("status.date", 1)); AggregationOutput output = collection.aggregate(Arrays.asList( query, project, sort )); List<ObjectId> resultIds = getObjectIds(output.results()); return collection.find(new BasicDBObject("_id", new BasicDBObject("$in", resultIds))); }
Source:
<code>public void update(SpriteBase sprite) { int plaats = sprites.indexOf(sprite); <START> if (plaats >= 0) { <END> ImageView image = images.get(sprites.indexOf(sprite)); image.relocate(sprite.getX(), sprite.getY()); if (sprite.getSpriteChanged()) { image.setImage(new Image( getClass().getResource(sprite.getImagePath()).toExternalForm())); sprite.setSpriteChanged(false); } image.setRotate(sprite.getR()); } }</code><technical_language>is this needed? If this is done of errors, problem fixed update is called be. <bug</technical_language>

Target:
public void update(SpriteBase sprite) { int place = sprites.indexOf(sprite); if (place >= 0) { ImageView image = images.get(sprites.indexOf(sprite)); image.relocate(sprite.getX(), sprite.getY()); if (sprite.getSpriteChanged()) { image.setImage(new Image( getClass().getResource(sprite.getImagePath()).toExternalForm())); sprite.setSpriteChanged(false); } image.setRotate(sprite.getR()); } }
Source:
<code>private Mono<Void> afterProcessChanges(ChangeFeedObserverContext context) { this.processedDocCount ++; if (this.isCheckpointNeeded()) { return context.checkpoint() .onErrorResume(throwable -> { <START> logger.warn("Checkpoint failed; this worker will be killed", throwable); <END> return Mono.error(throwable); }) .doOnSuccess( (Void) -> { this.processedDocCount = 0; this.lastCheckpointTime = ZonedDateTime.now(ZoneId.of("UTC")); }) .then(); } return Mono.empty(); }</code><technical_language>logger.error ? logger.debug</technical_language>

Target:
private Mono<Void> afterProcessChanges(ChangeFeedObserverContext context) { this.processedDocCount ++; if (this.isCheckpointNeeded()) { return context.checkpoint() .doOnError(throwable -> { logger.warn("Checkpoint failed; this worker will be killed", throwable); }) .doOnSuccess( (Void) -> { this.processedDocCount = 0; this.lastCheckpointTime = ZonedDateTime.now(ZoneId.of("UTC")); }) .then(); } return Mono.empty(); }
Source:
<code>public List<ClientModel> getClients() { <START> return cacheSession.getClients(this, 0, cacheSession.getClientsCount(this).intValue()); <END> }</code><technical_language>Realm overloaded method getClients(this), calls getClients(this, null, null). This approach result in extra query get client counts first, list clients</technical_language>

Target:
public List<ClientModel> getClients() { return cacheSession.getClients(this); }
Source:
<code>public Optional<WetData> from(DataHolder dataHolder) { if (this.supports(dataHolder)) { <START> SpongeWetData wetData = new SpongeWetData(dataHolder.get(Keys.IS_WET).get()); <END> return Optional.<WetData>of(wetData); } return Optional.absent(); }</code><technical_language>delegate processor. do this yourself</technical_language>

Target:
public Optional<WetData> from(DataHolder dataHolder) { if (this.supports(dataHolder)) { if (dataHolder instanceof EntityWolf) { EntityWolf wolf = (EntityWolf) dataHolder; SpongeWetData data = new SpongeWetData(wolf.isWet()); return Optional.<WetData>of(data); } else if ((dataHolder instanceof ItemStack)) { ItemStack stack = (ItemStack) dataHolder; if (stack.getItem().equals(ItemTypes.SPONGE)) { SpongeWetData data = new SpongeWetData(stack.getItemDamage() == 1); return Optional.<WetData>of(data); } } } return Optional.empty(); }
Source:
<code>private AsyncRetryMetrics(Iterable<AsyncRetry> retries) { <START> this(retries, DEFAULT_PREFIX); <END> }</code><technical_language>need a default prefix for AsyncRetry</technical_language>

Target:
private AsyncRetryMetrics(Iterable<AsyncRetry> retries) { this(retries, DEFAULT_PREFIX_ASYNC); }
Source:
<code>public boolean hasAllOutputs(TableScanNode node) { Optional<List<ColumnHandle>> columns = layout.getColumns(); if (!columns.isPresent()) { return true; } Set<ColumnHandle> nodeColumnHandles = node.getOutputSymbols().stream() .map(node.getAssignments()::get) .collect(toImmutableSet()); <START> return nodeColumnHandles.containsAll(columns.get()); <END> }</code><technical_language>changed LCH.containsAll(TSCH) TSCH.containsAll(LCH)</technical_language>

Target:
public boolean hasAllOutputs(TableScanNode node) { if (!layout.getColumns().isPresent()) { return true; } Set<ColumnHandle> columns = ImmutableSet.copyOf(layout.getColumns().get()); List<ColumnHandle> nodeColumnHandles = node.getOutputSymbols().stream() .map(node.getAssignments()::get) .collect(toImmutableList()); return columns.containsAll(nodeColumnHandles); }
Source:
<code>protected SourceFileStore findSourceFileStoreForValidator(final ValidatorSourceRepositorySotre validatorSourceStore, final String validatorId, final ValidatorDescriptor descriptor) { final AbstractFileStore child = validatorSourceStore.getChild(descriptor.getClassName()); if (child == null) { <START> throw new RuntimeException("Validator class " + descriptor.getClassName() + " not found for validator definition " + validatorId + "!"); <END> } if (!(child instanceof SourceFileStore)) { throw new RuntimeException("Invalid validator definition " + validatorId + "!"); } return (SourceFileStore) child; }</code><technical_language>I Runtime exception is choice. FileNotFoundExcpetion</technical_language>

Target:
protected SourceFileStore findSourceFileStoreForValidator(final ValidatorSourceRepositorySotre validatorSourceStore, final String validatorId, final ValidatorDescriptor descriptor) throws FileNotFoundException { final AbstractFileStore child = validatorSourceStore.getChild(descriptor.getClassName()); if (child == null) { throw new FileNotFoundException("Validator class " + descriptor.getClassName() + " not found for validator definition " + validatorId + "!"); } if (!(child instanceof SourceFileStore)) { throw new RuntimeException("Invalid validator definition " + validatorId + "!"); } return (SourceFileStore) child; }
Source:
<code>void doPaint(GC gc, ILineRange visibleLines) { Display display= fCachedTextWidget.getDisplay(); int y= -JFaceTextUtil.getHiddenTopLinePixels(fCachedTextWidget); boolean isWrapActive= fCachedTextWidget.getWordWrap(); int lastLine= end(visibleLines); if (fCachedNumberOfLines < lastLine) { <START> int digits= computeNumberOfDigits(lastLine); <END> if (fCachedNumberOfDigits < digits) { if (updateNumberOfDigits()) { computeIndentations(); layout(true); return; } } } for (int line= visibleLines.getStartLine(); line < lastLine; line++) { int widgetLine= JFaceTextUtil.modelLineToWidgetLine(fCachedTextViewer, line); if (widgetLine == -1) continue; final int offsetAtLine= fCachedTextWidget.getOffsetAtLine(widgetLine); int lineHeight= fCachedTextWidget.getLineHeight(offsetAtLine); paintLine(line, y, lineHeight, gc, display); if (!isWrapActive) { y+= lineHeight; } else { int charCount= fCachedTextWidget.getCharCount(); if (offsetAtLine == charCount) continue; final int offsetEnd= offsetAtLine + fCachedTextWidget.getLine(widgetLine).length(); if (offsetEnd == charCount) continue; y+= fCachedTextWidget.getTextBounds(offsetAtLine, offsetEnd).height; } } }</code><technical_language>This break LogicalLineNumberRulerColumn in EGit introduced in <LINK_0> . Besides, update fCachedNumberOfLines. call computeNumberOfDigits() instead</technical_language>

Target:
void doPaint(GC gc, ILineRange visibleLines) { Display display= fCachedTextWidget.getDisplay(); int y= -JFaceTextUtil.getHiddenTopLinePixels(fCachedTextWidget); boolean isWrapActive= fCachedTextWidget.getWordWrap(); int lastLine= end(visibleLines); for (int line= visibleLines.getStartLine(); line < lastLine; line++) { int widgetLine= JFaceTextUtil.modelLineToWidgetLine(fCachedTextViewer, line); if (widgetLine == -1) continue; final int offsetAtLine= fCachedTextWidget.getOffsetAtLine(widgetLine); int lineHeight= fCachedTextWidget.getLineHeight(offsetAtLine); paintLine(line, y, lineHeight, gc, display); if (!isWrapActive) { y+= lineHeight; } else { int charCount= fCachedTextWidget.getCharCount(); if (offsetAtLine == charCount) continue; final int offsetEnd= offsetAtLine + fCachedTextWidget.getLine(widgetLine).length(); if (offsetEnd == charCount) continue; y+= fCachedTextWidget.getTextBounds(offsetAtLine, offsetEnd).height; } } }
Source:
<code>public void refresh() { try { if (workItem.getCreatedBy() == null) { origLabel.setText("Error: No originator identified."); origLabel.setForeground(Displays.getSystemColor(SWT.COLOR_RED)); } else { User origUser = AtsClientService.get().getUserServiceClient().getOseeUser(workItem.getCreatedBy()); userIconLabel.setImage(FrameworkArtifactImageProvider.getUserImage(Arrays.asList(origUser))); origLabel.setText(workItem.getCreatedBy().getName()); origLabel.setForeground(Displays.getSystemColor(SWT.COLOR_BLACK)); } if (workItem.isCancelled() || workItem.isCompleted()) { <START> origLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); <END> } origLabel.getParent().getParent().layout(); } catch (OseeCoreException ex) { Label errorLabel = editor.getToolkit().createLabel(this, "Error: " + ex.getLocalizedMessage()); errorLabel.setForeground(Displays.getSystemColor(SWT.COLOR_RED)); OseeLog.log(Activator.class, Level.SEVERE, ex); } }</code><technical_language>117 moved 59. this line needs done do cancelled/completed. Remove 116</technical_language>

Target:
public void refresh() { try { if (workItem.getCreatedBy() == null) { origLabel.setText("Error: No originator identified."); origLabel.setForeground(Displays.getSystemColor(SWT.COLOR_RED)); } else { User origUser = AtsClientService.get().getUserServiceClient().getOseeUser(workItem.getCreatedBy()); userIconLabel.setImage(FrameworkArtifactImageProvider.getUserImage(Arrays.asList(origUser))); origLabel.setText(workItem.getCreatedBy().getName()); origLabel.setForeground(Displays.getSystemColor(SWT.COLOR_BLACK)); } origLabel.getParent().getParent().layout(); } catch (OseeCoreException ex) { Label errorLabel = editor.getToolkit().createLabel(this, "Error: " + ex.getLocalizedMessage()); errorLabel.setForeground(Displays.getSystemColor(SWT.COLOR_RED)); OseeLog.log(Activator.class, Level.SEVERE, ex); } }
Source:
<code>private String buildConflictingMessage(MergeResult mergeResult) { <START> final StringBuilder messageBuildder = new StringBuilder(); <END> final Integer returnCode; for (String conflictingFile : mergeResult.getConflicts().keySet()) { messageBuildder.append("Auto-merging failed in ").append(conflictingFile).append(EOL); messageBuildder.append("Automatic merge failed; fix conflicts and then commit the result.") .append(conflictingFile).append(EOL); } return messageBuildder.toString(); }</code><technical_language>Unused variable</technical_language>

Target:
private String buildConflictingMessage(MergeResult mergeResult) { final StringBuilder messageBuildder = new StringBuilder(); for (String conflictingFile : mergeResult.getConflicts().keySet()) { messageBuildder.append("Auto-merging failed in ").append(conflictingFile).append(EOL); messageBuildder.append("Automatic merge failed; fix conflicts and then commit the result.") .append(conflictingFile).append(EOL); } return messageBuildder.toString(); }
Source:
<code>private String currentDateAndTime() { LocalDateTime rightNow = LocalDateTime.now(); <START> DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofLocalizedDateTime(FormatStyle.MEDIUM).withLocale(Locale.UK); <END> return dateTimeFormatter.format(rightNow).replaceAll("[- .:]", "_"); }</code><technical_language>UK</technical_language>

Target:
private String currentDateAndTime() { LocalDateTime rightNow = LocalDateTime.now(); DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofLocalizedDateTime(FormatStyle.MEDIUM).withLocale(Locale.getDefault()); return dateTimeFormatter.format(rightNow).replaceAll("[- .:,]", "_"); }
Source:
<code>public InfiniteIncrementNumberPublisher(final Executor executor) { super(new Iterable<Integer>() { @Override public Iterator<Integer> iterator() { return new Iterator<Integer>() { private int at = 0; @Override public boolean hasNext() { return true; } <START> @Override public Integer next() { return at++; } <END> }; } }, executor); }</code><technical_language>add good ol' friend remove() :wink: (Current correct for scala.collection.Iterator :-)) // override abstract method remove() in java.util.Iterator</technical_language>

Target:
public InfiniteIncrementNumberPublisher(final Executor executor) { super(new Iterable<Integer>() { @Override public Iterator<Integer> iterator() { return new Iterator<Integer>() { private int at = 0; @Override public boolean hasNext() { return true; } @Override public Integer next() { return at++; } @Override public void remove() { throw new UnsupportedOperationException(); } }; } }, executor); }
Source:
<code>public QueryResponse getBrowsableStudies(@RequestParam("species") String species) throws IllegalOpenCGACredentialsException, IOException { MultiMongoDbFactory.setDatabaseNameForCurrentThread(DBAdaptorConnector.getDBName(species)); List<VariantStudySummary> uniqueStudies = variantStudySummaryRepository.findBy(); <START> QueryResult<VariantStudySummary> result = new QueryResult<>(); <END> result.setResult(uniqueStudies); result.setNumResults(uniqueStudies.size()); result.setNumTotalResults(uniqueStudies.size()); return setQueryResponse(result); }</code><technical_language>usages in addition in [RegionWSServer](<LINK_0> this QueryResult initialization is redundant. this small code block extracted a method in parent class</technical_language>

Target:
public QueryResponse getBrowsableStudies(@RequestParam("species") String species) throws IllegalOpenCGACredentialsException, IOException { MultiMongoDbFactory.setDatabaseNameForCurrentThread(DBAdaptorConnector.getDBName(species)); List<VariantStudySummary> uniqueStudies = variantStudySummaryRepository.findBy(); QueryResult<VariantStudySummary> result = Utils.buildQueryResult(uniqueStudies); return setQueryResponse(result); }
Source:
<code>@Override public boolean tryAcquire(long timeout, TimeUnit unit) throws InterruptedException { boolean clusterPermitted = clusterSemaphore.tryAcquire(timeout, unit); boolean poolPermitted = false; if (clusterPermitted) { poolPermitted = poolSemaphore.tryAcquire(timeout, unit); } if (poolPermitted) { return true; <START> } else { <END> clusterSemaphore.release(); return false; } }</code><technical_language>I this else if (clusterPermitted); otherwise, unintentionally increase number of permits</technical_language>

Target:
@Override public boolean tryAcquire(long timeout, TimeUnit unit) throws InterruptedException { boolean clusterPermitted = clusterSemaphore.tryAcquire(timeout, unit); boolean poolPermitted = false; if (clusterPermitted) { try { poolPermitted = poolSemaphore.tryAcquire(timeout, unit); } catch(InterruptedException e) { clusterSemaphore.release(); throw e; } } if (poolPermitted) { return true; } else if (clusterPermitted) { clusterSemaphore.release(); } return false; }
Source:
<code>private void checkDataIntegrity() throws StoreException { byte[] byteArray; if (serEntries.hasArray()) { byteArray = serEntries.array(); } else { serEntries.position(0); byteArray = new byte[serEntries.capacity()]; serEntries.get(byteArray, 0, serEntries.capacity()); } Crc32 crc = new Crc32(); <START> crc.update(byteArray, 0, byteArray.length - CRC_FIELD_LENGTH); <END> ByteBuffer bb = ByteBuffer.wrap(Arrays.copyOfRange(byteArray, byteArray.length - CRC_FIELD_LENGTH, byteArray.length)); if (crc.getValue() != bb.getLong()) { throw new StoreException("IndexSegment : " + indexFile.getAbsolutePath() + " crc check does not match", StoreErrorCodes.Index_Creation_Failure); } }</code><technical_language>copy bytebuffer byte array, Crc32 a method update CRC ByteBuffer matter if heap bytebuffer direct bytebuffer</technical_language>

Target:
private void checkDataIntegrity() throws StoreException { serEntries.position(0); serEntries.limit(serEntries.capacity() - CRC_FIELD_LENGTH); Crc32 crc = new Crc32(); crc.update(serEntries.slice()); serEntries.limit(serEntries.capacity()); if (crc.getValue() != serEntries.getLong(serEntries.capacity() - CRC_FIELD_LENGTH)) { throw new StoreException("IndexSegment : " + indexFile.getAbsolutePath() + " crc check does not match", StoreErrorCodes.Index_Creation_Failure); } }
Source:
<code>public List<RichMember> call(ApiCaller ac, Deserializer parms) throws PerunException { if(parms.contains("vo")) { if(parms.contains("allowedStatuses")) { return ac.getMembersManager().findCompleteRichMembers(ac.getSession(), ac.getVoById(parms.readInt("vo")), parms.readList("attrsNames", String.class), parms.readList("allowedStatuses", String.class), parms.readString("searchString")); } else { boolean onlySponsored = false; if(parms.contains("onlySponsored")) onlySponsored = parms.readBoolean("onlySponsored"); return ac.getMembersManager().findCompleteRichMembers(ac.getSession(), <START> ac.getVoById(parms.readInt("vo")), <END> parms.readList("attrsNames", String.class), parms.readString("searchString"), onlySponsored); } } else { if(parms.contains("allowedStatuses")) { if(parms.contains("group")) { return ac.getMembersManager().findCompleteRichMembers(ac.getSession(), ac.getGroupById(parms.readInt("group")), parms.readList("attrsNames", String.class), parms.readList("allowedStatuses", String.class), parms.readString("searchString"), parms.readBoolean("lookingInParentGroup")); } else { return ac.getMembersManager().findCompleteRichMembers(ac.getSession(), parms.readList("attrsNames", String.class), parms.readList("allowedStatuses", String.class), parms.readString("searchString")); } } else { return ac.getMembersManager().findCompleteRichMembers(ac.getSession(), ac.getGroupById(parms.readInt("group")), parms.readList("attrsNames", String.class), parms.readString("searchString"), parms.readBoolean("lookingInParentGroup")); } } }</code><technical_language>split existing rpc docs for this branch (I doc) add version new param onlySponsored. added OpenApi, sure, if this part of API done. If not, necessary add right now, done later</technical_language>

Target:
public Void call(ApiCaller ac, Deserializer parms) throws PerunException { ac.stateChangingCheck(); ac.getMembersManager().deleteMember(ac.getSession(), ac.getMemberById(parms.readInt("member"))); return null; }
Source:
<code><START> public void visit( long relationshipId, int typeId, long startNodeId, long endNodeId ) throws RuntimeException <END> { setId( relationshipId ); setType( typeId ); setFirstNode( startNodeId ); setSecondNode( endNodeId ); }</code><technical_language>Unecessary RuntimeException</technical_language>

Target:
public void visit( long relationshipId, int typeId, long startNodeId, long endNodeId ) { setId( relationshipId ); initialize( true, NO_ID, startNodeId, endNodeId, typeId, NO_ID, NO_ID, NO_ID, NO_ID, false, false ); }
Source:
<code>public CharSequence apply(Object upstream, Options options) { if (upstream instanceof String) { String address = ((String) upstream); LOG.trace("Trying to resolve a String upstream of {}", address); String resolved = resolver.resolveUpstreamDNS(address).or(address); LOG.trace("Resolved to {}", address, resolved); return resolved; } else if (upstream instanceof UpstreamInfo) { UpstreamInfo upstreamInfo = ((UpstreamInfo) upstream); LOG.trace("Trying to resolve an UpstreamInfo upstream of with upstreamInfo.getResolvedUpstream() = {}, resolver.resolveUpstreamDNS(upstreamInfo.getUpstream()) = {}, upstreamInfo.getUpstream() = {}", upstreamInfo, upstreamInfo <START> .getResolvedUpstream(), resolver.resolveUpstreamDNS(upstreamInfo.getUpstream()), upstreamInfo.getUpstream()); <END> String resolved = upstreamInfo.getResolvedUpstream().or(resolver.resolveUpstreamDNS(upstreamInfo.getUpstream())).or(upstreamInfo.getUpstream()); LOG.trace("Resolved to {}", upstreamInfo, resolved); return resolved; } else { LOG.error("resolveHostname called with invalid context and options {}", upstream, options); throw new IllegalArgumentException(String.format("Don't know how to process upstream %s", upstream.toString())); } }</code><technical_language>this trace line call resolveUpstreamDNS storing in a variable for logging</technical_language>

Target:
public CharSequence apply(Object upstream, Options options) { if (upstream instanceof String) { String address = ((String) upstream); LOG.trace("Trying to resolve a String upstream of {}", address); String resolved = resolver.resolveUpstreamDNS(address).or(address); LOG.trace("Resolved to {}", address, resolved); return resolved; } else if (upstream instanceof UpstreamInfo) { UpstreamInfo upstreamInfo = ((UpstreamInfo) upstream); final Optional<String> maybeResolvedUpstream = resolver.resolveUpstreamDNS(upstreamInfo.getUpstream()); LOG.trace( "Trying to resolve an UpstreamInfo upstream of with upstreamInfo.getResolvedUpstream() = {}, resolver.resolveUpstreamDNS(upstreamInfo.getUpstream()) = {}, upstreamInfo.getUpstream() = {}", upstreamInfo, upstreamInfo.getResolvedUpstream(), maybeResolvedUpstream, upstreamInfo.getUpstream() ); String resolved = upstreamInfo.getResolvedUpstream().or(maybeResolvedUpstream).or(upstreamInfo.getUpstream()); LOG.trace("Resolved to {}", upstreamInfo, resolved); return resolved; } else { LOG.error("resolveHostname called with invalid context and options {}", upstream, options); throw new IllegalArgumentException(String.format("Don't know how to process upstream %s", upstream.toString())); } }
Source:
<code>private void computeAndApplyCharge(final ContainerStartData startData, long endTime, boolean remove) throws IOException { synchronized (startData) { Long quotaTime = new Long(0); if (remove) { quotaTime = containerQuotaTime.remove(startData.getContainerId()); if (endTime - startData.getStartTime() < minRunTime) { endTime = startData.getStartTime() + minRunTime - quotaTime; } } else { quotaTime = containerQuotaTime.get(startData.getContainerId()); } if (quotaTime == null) { LOG.error("No container should reach this point without having a quotaTime"); return; } final Map<String, Long> resourcesMap = new HashMap<>(); long usedMillis = endTime - quotaTime; Resource resource = startData.getAllocatedResource(); for (ResourceInformation entry : resource.getResources()) { resourcesMap.put(entry.getName(), entry.getValue()); } <START> LightWeightRequestHandler quotaSchedulerHandler = new LightWeightRequestHandler(YARNOperationType.OTHER) { <END> @Override public Object performTask() throws IOException { connector.beginTransaction(); connector.writeLock(); computeAndApplyChargeInt(startData.getContainerId(), resourcesMap, usedMillis); connector.commit(); return null; } }; quotaSchedulerHandler.handle(); if (!remove) { containerQuotaTime.put(startData.getContainerId(), endTime); } } }</code><technical_language>Is safe if moved DB operation of synchronized block database handle concurrency</technical_language>

Target:
private void computeAndApplyCharge(final ContainerStartData startData, long endTime, boolean remove) throws IOException { Long quotaTime = new Long(0); if (remove) { quotaTime = containerQuotaTime.remove(startData.getContainerId()); if (endTime - startData.getStartTime() < minRunTime) { endTime = startData.getStartTime() + minRunTime - quotaTime; } } else { quotaTime = containerQuotaTime.get(startData.getContainerId()); } if (quotaTime == null) { LOG.error("No container should reach this point without having a quotaTime"); return; } final Map<String, Long> resourcesMap = new HashMap<>(); long usedMillis = endTime - quotaTime; Resource resource = startData.getAllocatedResource(); for (ResourceInformation entry : resource.getResources()) { resourcesMap.put(entry.getName(), entry.getValue()); } LightWeightRequestHandler quotaSchedulerHandler = new LightWeightRequestHandler(YARNOperationType.OTHER) { @Override public Object performTask() throws IOException { connector.beginTransaction(); connector.writeLock(); computeAndApplyChargeInt(startData.getContainerId(), resourcesMap, usedMillis); connector.commit(); return null; } }; quotaSchedulerHandler.handle(); if (!remove) { containerQuotaTime.put(startData.getContainerId(), endTime); } }
Source:
<code>public static void main(String args[]) { try { VerifiableProperties verifiableProperties = StoreToolsUtil.getVerifiableProperties(args); DumpDataTool dumpDataTool = new DumpDataTool(verifiableProperties); dumpDataTool.doOperation(); <START> } catch (Exception e) { <END> logger.error("Closed with exception ", e); } }</code><technical_language>exception caught</technical_language>

Target:
public static void main(String args[]) throws Exception { VerifiableProperties verifiableProperties = StoreToolsUtil.getVerifiableProperties(args); DumpDataTool dumpDataTool = new DumpDataTool(verifiableProperties); dumpDataTool.doOperation(); }
Source:
<code>public void addResourceHandlers(ResourceHandlerRegistry registry) { int cachePeriod; if (environment.equals("development")) { cachePeriod = 0; } else { cachePeriod = 31536000; } registry .addResourceHandler(PATTERN_CSS) .addResourceLocations("/css/", "classpath:/css/") .setCachePeriod(cachePeriod); registry .addResourceHandler(PATTERN_IMG) .addResourceLocations("/img/", "classpath:/img/") .setCachePeriod(cachePeriod); registry .addResourceHandler(PATTERN_JS) .addResourceLocations("/js/", "classpath:/js/") .setCachePeriod(cachePeriod); registry .addResourceHandler(PATTERN_MOLGENIS_UI) <START> .addResourceLocations("/ui/", "classpath:/@molgenis-ui/") <END> .setCachePeriod(3600); registry .addResourceHandler(PATTERN_FONTS) .addResourceLocations("/fonts/", "classpath:/fonts/") .setCachePeriod(cachePeriod); registry .addResourceHandler(PATTERN_SWAGGER) .addResourceLocations("/swagger/", "classpath:/swagger/") .setCachePeriod(cachePeriod); registry .addResourceHandler("/generated-doc/**") .addResourceLocations("/generated-doc/") .setCachePeriod(3600); registry .addResourceHandler("/html/**") .addResourceLocations("/html/", "classpath:/html/") .setCachePeriod(3600); FileStore fileStore = fileStore(); registry .addResourceHandler("/" + PATH_SEGMENT_APPS + "/**") .addResourceLocations( "file:/ registry .addResourceHandler("/webjars/**") .addResourceLocations("classpath:/META-INF/resources/webjars/") .setCachePeriod(3600) .resourceChain(true); }</code><technical_language>need match, this serve resources</technical_language>

Target:
public void addResourceHandlers(ResourceHandlerRegistry registry) { int cachePeriod; if (environment.equals("development")) { cachePeriod = 0; } else { cachePeriod = 31536000; } registry .addResourceHandler(PATTERN_CSS) .addResourceLocations("/css/", "classpath:/css/") .setCachePeriod(cachePeriod); registry .addResourceHandler(PATTERN_IMG) .addResourceLocations("/img/", "classpath:/img/") .setCachePeriod(cachePeriod); registry .addResourceHandler(PATTERN_JS) .addResourceLocations("/js/", "classpath:/js/") .setCachePeriod(cachePeriod); registry .addResourceHandler(PATTERN_MOLGENIS_UI) .addResourceLocations("/ui/@molgenis-ui/", "classpath:/ui/@molgenis-ui/") .setCachePeriod(3600); registry .addResourceHandler(PATTERN_FONTS) .addResourceLocations("/fonts/", "classpath:/fonts/") .setCachePeriod(cachePeriod); registry .addResourceHandler(PATTERN_SWAGGER) .addResourceLocations("/swagger/", "classpath:/swagger/") .setCachePeriod(cachePeriod); registry .addResourceHandler("/generated-doc/**") .addResourceLocations("/generated-doc/") .setCachePeriod(3600); registry .addResourceHandler("/html/**") .addResourceLocations("/html/", "classpath:/html/") .setCachePeriod(3600); FileStore fileStore = fileStore(); registry .addResourceHandler("/" + PATH_SEGMENT_APPS + "/**") .addResourceLocations( "file:/ registry .addResourceHandler("/webjars/**") .addResourceLocations("classpath:/META-INF/resources/webjars/") .setCachePeriod(3600) .resourceChain(true); }
Source:
<code>public void receiveCollisionEvent(HorizontalCollisionEvent collisionEvent, EntityRef oreon, MinionMoveComponent moveComponent) { if (lastCollisionLocation == null) { lastCollisionLocation = collisionEvent.getLocation(); } else { <START> if (lastCollisionLocation.getX() == collisionEvent.getLocation().getX() && lastCollisionLocation.getZ() == collisionEvent.getLocation().getZ()) { <END> logger.info("oreon stuck"); moveComponent.target = null; oreon.saveComponent(moveComponent); abandonTask(oreon); } else { lastCollisionLocation = null; } } }</code><technical_language>comparing floating-point values '=='. work of time. In this case, BaseVector3f.equals() some extra logic in there. a lot shorter easier read. if (lastCollisionLocation..equals(collisionEvent.getLocation())) { I guess question is checking Y location matters. If do want consider Y location, code BaseVector3f.equals() a approach. return Float.floatToIntBits(getX()) == Float.floatToIntBits(other.getX()) && Float.floatToIntBits(getY()) == Float.floatToIntBits(other.getY()) && Float.floatToIntBits(getZ()) == Float.floatToIntBits(other.getZ());</technical_language>

Target:
public void receiveCollisionEvent(HorizontalCollisionEvent collisionEvent, EntityRef oreon, MinionMoveComponent moveComponent) { if (lastCollisionLocation == null) { lastCollisionLocation = collisionEvent.getLocation(); } else { if (isSameCollisionLocation(lastCollisionLocation, collisionEvent.getLocation())) { logger.info("oreon stuck"); moveComponent.target = null; oreon.saveComponent(moveComponent); abandonTask(oreon); } else { lastCollisionLocation = null; } } }
Source:
<code>public void testFetchDuringCooperativeRebalance() { buildFetcher(); subscriptions.subscribe(singleton(topicName), listener); subscriptions.assignFromSubscribed(singleton(tp0)); subscriptions.seek(tp0, 0); client.updateMetadata(initialUpdateResponse); assertEquals(1, fetcher.sendFetches()); subscriptions.assignFromSubscribed(singleton(tp0)); client.prepareResponse(fullFetchResponse(tp0, this.records, Errors.NONE, 100L, 0)); consumerClient.poll(time.timer(0)); <START> assertFalse(fetcher.fetchedRecords().isEmpty()); <END> }</code><technical_language>assert expected fetchedRecords</technical_language>

Target:
public void testFetchDuringCooperativeRebalance() { buildFetcher(); subscriptions.subscribe(singleton(topicName), listener); subscriptions.assignFromSubscribed(singleton(tp0)); subscriptions.seek(tp0, 0); client.updateMetadata(initialUpdateResponse); assertEquals(1, fetcher.sendFetches()); subscriptions.assignFromSubscribed(singleton(tp0)); client.prepareResponse(fullFetchResponse(tp0, this.records, Errors.NONE, 100L, 0)); consumerClient.poll(time.timer(0)); Map<TopicPartition, List<ConsumerRecord<byte[], byte[]>>> fetchedRecords = fetchedRecords(); assertEquals(1, fetchedRecords.size()); assertEquals(3, fetchedRecords.get(tp0).size()); }
Source:
<code>boolean needsUpdate(LedgerMetadata metadata) throws Exception; } MetadataUpdateLoop(LedgerManager lm, long ledgerId, Supplier<LedgerMetadata> currentLocalValue, NeedsUpdatePredicate needsTransformation, Function<LedgerMetadata, LedgerMetadata> transform, BiPredicate<LedgerMetadata, LedgerMetadata> updateLocalValue) { this.lm = lm; this.ledgerId = ledgerId; this.currentLocalValue = currentLocalValue; this.needsTransformation = needsTransformation; this.transform = transform; this.updateLocalValue = updateLocalValue; this.logContext = String.format("UpdateLoop(ledgerId=%d,loopId=%s)", <START> ledgerId, UUID.randomUUID().toString().substring(0, 8)); <END> }</code><technical_language>System.identityHashcode</technical_language>

Target:
boolean needsUpdate(LedgerMetadata metadata) throws Exception; } interface MetadataTransform { LedgerMetadata transform(LedgerMetadata metadata) throws Exception; }
Source:
<code>private void validateRemoteHosts() { try { <START> if (getCapabilities().has("hostMachines")) { <END> JSONArray hostMachines = getHostMachineObject(); for (Object hostMachine : hostMachines) { JSONObject hostMachineJson = ((JSONObject) hostMachine); boolean isCloud = hostMachineJson.has("isCloud"); if (isCloud) { isCloud = hostMachineJson.getBoolean("isCloud"); } String machineIP = (String) hostMachineJson.get("machineIP"); if (isCloud || InetAddress.getByName(machineIP).isReachable(5000)) { LOGGER.info("ATD is Running on " + machineIP); } else { FigletHelper.figlet("Unable to connect to Remote Host " + machineIP); throw new ConnectException(); } } } } catch (Exception e) { e.printStackTrace(); } }</code><technical_language>hasHostMachines() instead</technical_language>

Target:
private void validateRemoteHosts() { try { if (!hasHostMachines()) { return; } JSONArray hostMachines = getHostMachineObject(); for (Object hostMachine : hostMachines) { JSONObject hostMachineJson = ((JSONObject) hostMachine); boolean isCloud = hostMachineJson.has("isCloud"); if (isCloud) { isCloud = hostMachineJson.getBoolean("isCloud"); } String machineIP = (String) hostMachineJson.get("machineIP"); if (isCloud || InetAddress.getByName(machineIP).isReachable(5000)) { LOGGER.info("ATD is Running on " + machineIP); } else { FigletHelper.figlet("Unable to connect to Remote Host " + machineIP); throw new ConnectException(); } } } catch (Exception e) { throw new RuntimeException("Provide hostMachine in Caps.json for execution"); } }