auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public List<InsightCard> getInsights(@Scope(OAuthScope.INSIGHTS_READ) final AccessToken accessToken) { LOGGER.debug("Returning list of insights for account id = {}", accessToken.accountId); final Boolean chronological = false; final DateTime queryDate = DateTime.now(DateTimeZone.UTC).plusDays(1); final ImmutableList<InsightCard> cards = insightsDAODynamoDB.getInsightsByDate(accessToken.accountId, queryDate, chronological, MAX_INSIGHTS_NUM); if (cards.size() == 0) { <START> final List<InsightCard> introCards = Lists.newArrayList(IntroductionInsights.getIntroductionCard(accessToken.accountId)); <END> this.insightsDAODynamoDB.insertListOfInsights(introCards); return insightCardsWithInfoPreview(introCards); } else { return insightCardsWithInfoPreview(cards); } }</code><technical_language>I change v1 behavior</technical_language>

Target:
public List<InsightCard> getInsights(@Scope(OAuthScope.INSIGHTS_READ) final AccessToken accessToken) { LOGGER.debug("Returning list of insights for account id = {}", accessToken.accountId); final Boolean chronological = false; final DateTime queryDate = DateTime.now(DateTimeZone.UTC).plusDays(1); final ImmutableList<InsightCard> cards = insightsDAODynamoDB.getInsightsByDate(accessToken.accountId, queryDate, chronological, MAX_INSIGHTS_NUM); if (cards.size() == 0) { final List<InsightCard> introCards = IntroductionInsights.getIntroCards(accessToken.accountId); this.insightsDAODynamoDB.insertListOfInsights(introCards); return insightCardsWithInfoPreview(introCards); } else { return insightCardsWithInfoPreview(cards); } }
Source:
<code><START> public ImageIcon getImageIcon() { <END> Image image = getImage(); return (image == null) ? null : new ImageIcon(image); }</code><technical_language>suggestion public @Nullable ImageIcon getImageIcon() {</technical_language>

Target:
public @Nullable ImageIcon getImageIcon() { Image image = getImage(); return (image == null) ? null : new ImageIcon(image); }
Source:
<code>public void signup() throws Exception { HudsonPrivateSecurityRealm securityRealm = new HudsonPrivateSecurityRealm(true, false, null); rule.jenkins.setSecurityRealm(securityRealm); JenkinsRule.WebClient wc = rule.createWebClient(); SignupPage signup = new SignupPage(wc.goTo("signup")); signup.enterUsername("alice"); signup.enterPassword("alice"); signup.enterFullName("Alice User"); signup.enterEmail("alice@nowhere.com"); HtmlPage success = signup.submit(rule); assertThat(success.getElementById("main-panel").getTextContent(), containsString("Success")); <START> assertThat(success.getAnchorByHref("/jenkins/user/me").getTextContent(), containsString("Alice User")); <END> assertEquals("Alice User", securityRealm.getUser("alice").getDisplayName()); }</code><technical_language>bug: url is ${rootURL}/me</technical_language>

Target:
public void signup() throws Exception { HudsonPrivateSecurityRealm securityRealm = new HudsonPrivateSecurityRealm(true, false, null); rule.jenkins.setSecurityRealm(securityRealm); JenkinsRule.WebClient wc = rule.createWebClient(); SignupPage signup = new SignupPage(wc.goTo("signup")); signup.enterUsername("alice"); signup.enterPassword("alice"); signup.enterFullName("Alice User"); signup.enterEmail("alice@nowhere.com"); HtmlPage success = signup.submit(rule); assertThat(success.getElementById("main-panel").getTextContent(), containsString("Success")); assertThat(success.getAnchorByHref("/jenkins/me").getTextContent(), containsString("Alice User")); assertEquals("Alice User", securityRealm.getUser("alice").getDisplayName()); }
Source:
<code>protected boolean validateCanUpdateReadOnly(DiskValidator diskValidator) { if (updateReadOnlyRequested()) { if(getVm().getStatus() != VMStatus.Down && vmDeviceForVm.getIsPlugged()) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_VM_IS_NOT_DOWN); } <START> if (!validateVmPoolProperties()) { <END> return false; } return validate(diskValidator.isReadOnlyPropertyCompatibleWithInterface()); } return true; }</code><technical_language>is needed if called line 176? mention in CDA run</technical_language>

Target:
protected boolean validateCanUpdateReadOnly(DiskValidator diskValidator) { if (updateReadOnlyRequested()) { if(getVm().getStatus() != VMStatus.Down && vmDeviceForVm.getIsPlugged()) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_VM_IS_NOT_DOWN); } return validate(diskValidator.isReadOnlyPropertyCompatibleWithInterface()); } return true; }
Source:
<code><START> public static void registerKey(Binder binder, Key<DruidNode> key) <END> { LifecycleModule.registerKey(binder, key); }</code><technical_language>I get rid of line above... announce discovery</technical_language>

Target:
public static void registerKey(Binder binder, Key<DruidNode> key) { DruidBinders.discoveryAnnouncementBinder(binder).addBinding().toInstance(new KeyHolder<>(key)); LifecycleModule.registerKey(binder, key); }
Source:
<code>public Implementation() { plugin = this; <START> pageRegistry = new PageRegistry(); pageRegistry.addPageProvider(new DefaultPageProvider()); <END> }</code><technical_language>done start()</technical_language>

Target:
public Implementation() { plugin = this; }
Source:
<code>public static <T extends Annotation> T createJsonQualifierImplementation( <START> final Class<T> annotationType) { <END> if (!annotationType.isAnnotationPresent(JsonQualifier.class)) { throw new IllegalArgumentException(annotationType + " does not have @JsonQualifier."); } if (annotationType.getDeclaredMethods().length != 0) { throw new IllegalArgumentException(annotationType + " must not declare methods."); } return (T) Proxy.newProxyInstance(annotationType.getClassLoader(), new Class<?>[] { annotationType }, new InvocationHandler() { @Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { String methodName = method.getName(); if (methodName.equals("annotationType")) { return annotationType; } if (methodName.equals("equals")) { Object o = args[0]; return o.getClass().isInstance(annotationType); } if (methodName.equals("hashCode")) { return 0; } if (methodName.equals("toString")) { return "@" + annotationType.getName() + "()"; } throw new AssertionError(); } }); }</code><technical_language>Confirm Annotation? annotationType.isAnnotation()</technical_language>

Target:
static <T extends Annotation> T createJsonQualifierImplementation(final Class<T> annotationType) { if (!annotationType.isAnnotation()) { throw new IllegalArgumentException(annotationType + " must be an annotation."); } if (!annotationType.isAnnotationPresent(JsonQualifier.class)) { throw new IllegalArgumentException(annotationType + " must have @JsonQualifier."); } if (annotationType.getDeclaredMethods().length != 0) { throw new IllegalArgumentException(annotationType + " must not declare methods."); } return (T) Proxy.newProxyInstance(annotationType.getClassLoader(), new Class<?>[] { annotationType }, new InvocationHandler() { @Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { String methodName = method.getName(); switch (methodName) { case "annotationType": return annotationType; case "equals": Object o = args[0]; return annotationType.isInstance(o); case "hashCode": return 0; case "toString": return "@" + annotationType.getName() + "()"; default: return method.invoke(proxy, args); } } }); }
Source:
<code>public Date getAutoExpireDate(DrugOrder drugOrder) { if (drugOrder.getDurationUnits() == null) return null; if (drugOrder.getNumRefills() != null && drugOrder.getNumRefills() > 0) return null; <START> String durationCode = getISO8601DurationCode(drugOrder.getDurationUnits().getConceptMappings()); <END> ISO8601Duration iso8601Duration = new ISO8601Duration(drugOrder.getDuration(), durationCode); return iso8601Duration.addToDate(drugOrder.getDateActivated(), drugOrder.getFrequency()); }</code><technical_language>need a null check return null immediately, calling addToDate a null</technical_language>

Target:
public Date getAutoExpireDate(DrugOrder drugOrder) { if (drugOrder.getDuration() == null || drugOrder.getDurationUnits() == null) return null; if (drugOrder.getNumRefills() != null && drugOrder.getNumRefills() > 0) return null; String durationCode = getISO8601DurationCode(drugOrder.getDurationUnits()); if (durationCode == null) return null; ISO8601Duration iso8601Duration = new ISO8601Duration(drugOrder.getDuration(), durationCode); return iso8601Duration.addToDate(drugOrder.getEffectiveStartDate(), drugOrder.getFrequency()); }
Source:
<code>public void testZooKeeperHostFallBackToSite() throws Exception { ClientConfiguration clientConfig = new ClientConfiguration(); Map<String,String> data = new HashMap<>(); data.put(Property.INSTANCE_ZK_HOST.getKey(), "site_hostname"); <START> AccumuloConfiguration conf = new ConfigurationCopy(data); <END> assertEquals("site_hostname", Shell.getZooKeepers(null, clientConfig)); }</code><technical_language>this configuration is created used. this test pass</technical_language>

Target:
public void testZooKeeperHostFallBackToSite() throws Exception { ClientConfiguration clientConfig = new ClientConfiguration(); assertFalse("Client config contains zk hosts", clientConfig.containsKey(ClientConfiguration.ClientProperty.INSTANCE_ZK_HOST.getKey())); assertEquals("ShellConfigTestZKHostValue", Shell.getZooKeepers(null, clientConfig)); }
Source:
<code>public Response getDatasourceRuleHistory( @QueryParam("interval") final String interval, @QueryParam("count") final Integer count ) { Interval theInterval = interval == null ? null : new Interval(interval); <START> if (theInterval == null && count != null && count > 0) { <END> return Response.ok( auditManager.fetchAuditHistory( CoordinatorDynamicConfig.CONFIG_KEY, CoordinatorDynamicConfig.CONFIG_KEY, count ) ) .build(); } return Response.ok( auditManager.fetchAuditHistory( CoordinatorDynamicConfig.CONFIG_KEY, CoordinatorDynamicConfig.CONFIG_KEY, theInterval ) ) .build(); }</code><technical_language>suggest bad request if count equal zero</technical_language>

Target:
public Response getDatasourceRuleHistory( @QueryParam("interval") final String interval, @QueryParam("count") final Integer count ) { Interval theInterval = interval == null ? null : new Interval(interval); if (theInterval == null && count != null) { try { return Response.ok( auditManager.fetchAuditHistory( CoordinatorDynamicConfig.CONFIG_KEY, CoordinatorDynamicConfig.CONFIG_KEY, count ) ) .build(); } catch (IllegalArgumentException e) { return Response.status(Response.Status.BAD_REQUEST) .entity(ImmutableMap.<String, Object>of("error", e.getMessage())) .build(); } } return Response.ok( auditManager.fetchAuditHistory( CoordinatorDynamicConfig.CONFIG_KEY, CoordinatorDynamicConfig.CONFIG_KEY, theInterval ) ) .build(); }
Source:
<code>public NewTableConfiguration withSplits(final SortedSet<Text> splits) { checkArgument(splits != null, "splits set is null"); checkArgument(splits.isEmpty() != true, "splits set is empty"); this.createInitialSplits = true; <START> this.splitProps = splits; <END> return this; }</code><technical_language>Personally I do splitProps = ImmuatbleSortedSet.copyOf(splits) here. This this API's behavior more predictable</technical_language>

Target:
public NewTableConfiguration withSplits(final SortedSet<Text> splits) { checkArgument(splits != null, "splits set is null"); checkArgument(!splits.isEmpty(), "splits set is empty"); this.splitProps = ImmutableSortedSet.copyOf(splits); return this; }
Source:
<code>public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.menu_search_lists: ((AppCompatActivity) requireActivity()) .startSupportActionMode(searchActionModeCallback); return true; case R.id.menu_sort: bottomSheetPresenter.show(getChildFragmentManager(), SortReadingListsDialog.newInstance(Prefs.getReadingListSortMode(ReadingList.SORT_BY_NAME_ASC))); return true; case R.id.create_list: String title = getString(R.string.reading_list_name_sample); List<String> existingTitles = new ArrayList<>(); for (ReadingList tempList : readingLists) { existingTitles.add(tempList.title()); } ReadingListTitleDialog.readingListTitleDialog(requireContext(), title, "", existingTitles, (text, description) -> { ReadingListDbHelper.instance().createList(text, description); updateLists(); }).show(); return true; case R.id.refresh: <START> swipeRefreshLayout.post(() <END> -> { swipeRefreshLayout.setRefreshing(true); refreshSync(this, swipeRefreshLayout); }); return true; default: return super.onOptionsItemSelected(item); } }</code><technical_language>rationale for post() here</technical_language>

Target:
public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.menu_search_lists: ((AppCompatActivity) requireActivity()) .startSupportActionMode(searchActionModeCallback); return true; case R.id.menu_sort: bottomSheetPresenter.show(getChildFragmentManager(), SortReadingListsDialog.newInstance(Prefs.getReadingListSortMode(ReadingList.SORT_BY_NAME_ASC))); return true; case R.id.create_list: String title = getString(R.string.reading_list_name_sample); List<String> existingTitles = new ArrayList<>(); for (ReadingList tempList : readingLists) { existingTitles.add(tempList.title()); } ReadingListTitleDialog.readingListTitleDialog(requireContext(), title, "", existingTitles, (text, description) -> { ReadingListDbHelper.instance().createList(text, description); updateLists(); }).show(); return true; case R.id.refresh: swipeRefreshLayout.setRefreshing(true); refreshSync(this, swipeRefreshLayout); return true; default: return super.onOptionsItemSelected(item); } }
Source:
<code>public Response optionalCommentOnLanguage(OsuApiUser apiUser) { <START> return new Message("[<LINK_2> marcostudios] e [<LINK_1> Howl] mi hanno insegnato l'italiano <3"); <END> }</code><technical_language>I prefer osu-profile links user-id cuz namechanges is a :P</technical_language>

Target:
public Response optionalCommentOnLanguage(OsuApiUser apiUser) { return new Message("[<LINK_2> - Marco -] e [<LINK_0> Howl] mi hanno insegnato l'italiano <3"); }
Source:
<code>public boolean select(Viewer viewer, Object parentElement, <START> Object element) { <END> if (!(element instanceof DisplayItem)) { return false; } if (actionSet == null) { return false; } return CustomizePerspectiveDialog.includeInSetStructure((DisplayItem) element, actionSet); }</code><technical_language>unnecessary linebreak</technical_language>

Target:
public boolean select(Viewer viewer, Object parentElement, Object element) { if (!(element instanceof DisplayItem) || actionSet == null) { return false; } return CustomizePerspectiveDialog.includeInSetStructure((DisplayItem) element, actionSet); }
Source:
<code>public AbstractLabelsetMetadata(String id) { <START> Assert.notNull(id, "Ruleset ID must not be null."); <END> this.id = id; }</code><technical_language>suggestion Assert.notNull(id, "Labelset ID null.");</technical_language>

Target:
public AbstractLabelsetMetadata(String id) { Assert.notNull(id, "Labelset ID must not be null."); this.id = id; }
Source:
<code>private void onNfsServerSelectionChange(UIMessages messages) { if(getNfsServers().getSelectedItem() == null) { return; } <START> int index = getProfileInfo().getNfsProfileDetails().indexOf(getNfsServers().getSelectedItem()); <END> List<GlusterVolumeProfileStats> nfsProfileStats = getProfileInfo().getNfsProfileDetails(); StatsInfo selectedNfsServerCummulativeProfile = nfsProfileStats.get(index).getProfileStats().get(0); StatsInfo selectedNfsServerIntervalProfile = nfsProfileStats.get(index).getProfileStats().get(1); populateCummulativeStatistics(selectedNfsServerCummulativeProfile.getFopStats(), getNfsServerProfileStats()); nfsProfileRunTime = String.copyValueOf((formatRunTime(messages, selectedNfsServerCummulativeProfile.getDurationFormatted(), selectedNfsServerIntervalProfile.getDurationFormatted())).toCharArray()); onPropertyChanged(new PropertyChangedEventArgs("nfsProfileRunTimeChanged")); nfsBytesRead = String.copyValueOf((formatDataRead(messages, selectedNfsServerCummulativeProfile.getTotalRead(), selectedNfsServerIntervalProfile.getTotalRead())).toCharArray()); onPropertyChanged(new PropertyChangedEventArgs("nfsProfileDataRead")); nfsBytesWritten = String.copyValueOf((formatDataWritten(messages, selectedNfsServerCummulativeProfile.getTotalWrite(), selectedNfsServerIntervalProfile.getTotalWrite())).toCharArray()); onPropertyChanged(new PropertyChangedEventArgs("nfsProfileDataWritten")); }</code><technical_language>index -1, if item is in list i suggest if item is found, return this method</technical_language>

Target:
private void onNfsServerSelectionChange(UIMessages messages) { if(getNfsServers().getSelectedItem() == null) { return; } int index = getProfileInfo().getNfsProfileDetails().indexOf(getNfsServers().getSelectedItem()); if(index < 0) { return; } List<GlusterVolumeProfileStats> nfsProfileStats = getProfileInfo().getNfsProfileDetails(); StatsInfo selectedNfsServerCummulativeProfile = nfsProfileStats.get(index).getProfileStats().get(0); StatsInfo selectedNfsServerIntervalProfile = nfsProfileStats.get(index).getProfileStats().get(1); populateCummulativeStatistics(selectedNfsServerCummulativeProfile.getFopStats(), getNfsServerProfileStats()); nfsProfileRunTime = formatRunTime(messages, selectedNfsServerCummulativeProfile.getDurationFormatted(), selectedNfsServerIntervalProfile.getDurationFormatted()); onPropertyChanged(new PropertyChangedEventArgs("nfsProfileRunTimeChanged")); nfsBytesRead = formatDataRead(messages, selectedNfsServerCummulativeProfile.getTotalRead(), selectedNfsServerIntervalProfile.getTotalRead()); onPropertyChanged(new PropertyChangedEventArgs("nfsProfileDataRead")); nfsBytesWritten = formatDataWritten(messages, selectedNfsServerCummulativeProfile.getTotalWrite(), selectedNfsServerIntervalProfile.getTotalWrite()); onPropertyChanged(new PropertyChangedEventArgs("nfsProfileDataWritten")); }
Source:
<code><START> abstract Object getValue(View view) throws InvocationTargetException, IllegalAccessException; <END> @Nullable ViewDebug.ExportedProperty getAnnotation() { return mAnnotation; }</code><technical_language>do need IllegalAccessException if calling setAccessible(true)</technical_language>

Target:
public abstract Object getValue(View view) throws InvocationTargetException, IllegalAccessException; public final @Nullable ViewDebug.ExportedProperty getAnnotation() { return mAnnotation; }
Source:
<code>public void testBadTTLs() throws IOException, KeeperException, InterruptedException { <START> Stat stat = new Stat(); <END> RequestHeader h = new RequestHeader(1, ZooDefs.OpCode.createTTL); String path = "/bad_ttl"; CreateTTLRequest request = new CreateTTLRequest(path, new byte[0], ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT_WITH_TTL.toFlag(), -100); CreateResponse response = new CreateResponse(); ReplyHeader r = zk.submitRequest(h, request, response, null); Assert.assertEquals("An invalid CreateTTLRequest should throw BadArguments", r.getErr(), Code.BADARGUMENTS.intValue()); Assert.assertNull("An invalid CreateTTLRequest should not result in znode creation", zk.exists(path, false)); }</code><technical_language>nit: is this needed</technical_language>

Target:
public void testBadTTLs() throws InterruptedException, KeeperException { RequestHeader h = new RequestHeader(1, ZooDefs.OpCode.createTTL); String path = "/bad_ttl"; CreateTTLRequest request = new CreateTTLRequest(path, new byte[0], ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT_WITH_TTL.toFlag(), -100); CreateResponse response = new CreateResponse(); ReplyHeader r = zk.submitRequest(h, request, response, null); Assert.assertEquals("An invalid CreateTTLRequest should throw BadArguments", r.getErr(), Code.BADARGUMENTS.intValue()); Assert.assertNull("An invalid CreateTTLRequest should not result in znode creation", zk.exists(path, false)); }
Source:
<code>public void decompress(ByteBuffer in, int numBytes, ByteBuffer out) { final byte[] bytes = new byte[numBytes]; in.get(bytes); try (final ResourceHolder<byte[]> outputBytesHolder = CompressedPools.getOutputBytes()) { final byte[] outputBytes = outputBytesHolder.get(); final int numDecompressedBytes = LZFDecoder.decode(bytes, outputBytes); out.put(outputBytes, 0, numDecompressedBytes); out.flip(); } catch (IOException e) { <START> log.error(e, "Error decompressing data"); <END> } }</code><technical_language>Is fine logging instead of rethrowing</technical_language>

Target:
public void decompress(ByteBuffer in, int numBytes, ByteBuffer out) { final byte[] bytes = new byte[numBytes]; in.get(bytes); try (final ResourceHolder<byte[]> outputBytesHolder = CompressedPools.getOutputBytes()) { final byte[] outputBytes = outputBytesHolder.get(); final int numDecompressedBytes = LZFDecoder.decode(bytes, outputBytes); out.put(outputBytes, 0, numDecompressedBytes); out.flip(); } catch (IOException e) { throw new RuntimeException(e); } }
Source:
<code>public StackTraceElement calcLocation(final String fqcnOfLogger) { <START> return walker.walk(s -> s.filter(LOCATOR.get().setFqcn(fqcnOfLogger)).findFirst()).get().toStackTraceElement(); <END> }</code><technical_language>want CallerLocator implement Function<Stream<StackWalker.StackFrame>, Optional<StackWalker.StackFrame>> avoid lambda allocation for s -> s.filter(LOCATOR.get().setFqcn(fqcnOfLogger)).findFirst() suggestion return walker.walk(LOCATOR.get().setFqcn(fqcnOfLogger)).get().toStackTraceElement(); this: java static final class CallerLocator implements Predicate<StackWalker.StackFrame>, Function<Stream<StackWalker.StackFrame>, Optional<StackWalker.StackFrame>> { private String fqcn; private boolean foundFqcn = false; private boolean foundLogger = false; CallerLocator setFqcn(String fqcn) { this.fqcn = fqcn; this.foundFqcn = false; this.foundLogger = false; return this; } @Override public boolean test(StackWalker.StackFrame t) { final String className = t.getClassName(); if (!foundLogger) { if (!foundFqcn) { foundFqcn = className.equals(fqcn); return false; } else if (!className.equals(fqcn)) { foundLogger = true; return true; } } return false; } @Override public Optional<StackWalker.StackFrame> apply(Stream<StackWalker.StackFrame> stackFrameStream) { return stackFrameStream.filter(this).findFirst(); } } helps if all, I looked allocation StackWalker internally</technical_language>

Target:
public StackTraceElement calcLocation(final String fqcnOfLogger) { FQCN.set(fqcnOfLogger); StackTraceElement element = walker.walk(LOCATOR).toStackTraceElement(); FQCN.set(null); return element; }
Source:
<code>private <T extends UiElement, M> M populateModel(T container, Class<M> model) { try { M newInstance = model.getConstructor().newInstance(); for (Field field : model.getDeclaredFields()) { if (field.isAnnotationPresent(org.mini2Dx.ui.annotation.UiElement.class)) { String fieldName = field.getName(); <START> String annotationId = field.getAnnotation(org.mini2Dx.ui.annotation.UiElement.class).id(); <END> String id = annotationId.length() > 0 ? annotationId : fieldName; UiElement element = container.getElementById(id); try { field.set(newInstance, field.getType().cast(element)); } catch (IllegalAccessException ex) { field.setAccessible(true); field.set(newInstance, field.getType().cast(element)); field.setAccessible(false); } } } return newInstance; } catch (NoSuchMethodException | IllegalAccessException | InstantiationException | InvocationTargetException e) { throw new MdxException("could not populate fields", e); } }</code><technical_language>Mdx.reflect.getAnnotation</technical_language>

Target:
private <T extends UiElement, M> M populateModel(T container, Class<M> model) { M newInstance = (M) Mdx.reflect.newInstance(model); for (Field field : Mdx.reflect.getDeclaredFields(model)) { if (field.isAnnotationPresent(org.mini2Dx.ui.annotation.UiElement.class)) { String fieldName = field.getName(); String annotationId = field .getDeclaredAnnotation(org.mini2Dx.ui.annotation.UiElement.class) .getAnnotation(org.mini2Dx.ui.annotation.UiElement.class) .id(); String id = annotationId.length() > 0 ? annotationId : fieldName; UiElement element = container.getElementById(id); field.set(newInstance, field.getType().cast(element)); } } return newInstance; }
Source:
<code>public ContentProviderOperation.Builder updatedBuilder(@NonNull TransactionContext transactionContext, @NonNull ContentProviderOperation.Builder builder) { return builder .withValue(TaskContract.Tasks.DTSTART, null) .withValue(TaskContract.Tasks.DUE, null) .withValue(TaskContract.Tasks.DURATION, null); <START> } <END></code><technical_language>A task times is currently allowed recur, RDATE, RRULE EXDATE set null</technical_language>

Target:
public ContentProviderOperation.Builder updatedBuilder(@NonNull TransactionContext transactionContext, @NonNull ContentProviderOperation.Builder builder) { return builder .withValue(TaskContract.Tasks.DTSTART, null) .withValue(TaskContract.Tasks.DUE, null) .withValue(TaskContract.Tasks.DURATION, null) .withValue(TaskContract.Tasks.TZ, null) .withValue(TaskContract.Tasks.IS_ALLDAY, null) .withValue(TaskContract.Tasks.RDATE, null) .withValue(TaskContract.Tasks.RRULE, null) .withValue(TaskContract.Tasks.EXDATE, null); }
Source:
<code>private void retrieveLeaderInformationFromZooKeeper() { synchronized (lock) { if (running) { try { LOG.debug("Leader node has changed."); ChildData childData = cache.getCurrentData(); String leaderAddress; UUID leaderSessionID; if (childData == null) { leaderAddress = null; leaderSessionID = null; } else { byte[] data = childData.getData(); if (data == null || data.length == 0) { leaderAddress = null; leaderSessionID = null; } else { ByteArrayInputStream bais = new ByteArrayInputStream(data); ObjectInputStream ois = new ObjectInputStream(bais); leaderAddress = ois.readUTF(); leaderSessionID = (UUID) ois.readObject(); } } <START> <END> notifyIfNewLeaderAddress(leaderAddress, leaderSessionID); } catch (Exception e) { leaderListener.handleError(new Exception("Could not handle node changed event.", e)); } } else { LOG.debug("Ignoring node change notification since the service has already been stopped."); } } }</code><technical_language>I assume implication of removing this throw is curator log exception anymore, reset interrupted flag. I wondering for a while if this implications, I assume is fine remove, leader listener handle exception in Flink anyways</technical_language>

Target:
private void retrieveLeaderInformationFromZooKeeper() { synchronized (lock) { if (running) { try { LOG.debug("Leader node has changed."); ChildData childData = cache.getCurrentData(); String leaderAddress; UUID leaderSessionID; if (childData == null) { leaderAddress = null; leaderSessionID = null; } else { byte[] data = childData.getData(); if (data == null || data.length == 0) { leaderAddress = null; leaderSessionID = null; } else { ByteArrayInputStream bais = new ByteArrayInputStream(data); ObjectInputStream ois = new ObjectInputStream(bais); leaderAddress = ois.readUTF(); leaderSessionID = (UUID) ois.readObject(); } } notifyIfNewLeaderAddress(leaderAddress, leaderSessionID); } catch (Exception e) { leaderListener.handleError(new Exception("Could not handle node changed event.", e)); ExceptionUtils.checkInterrupted(e); } } else { LOG.debug("Ignoring node change notification since the service has already been stopped."); } } }
Source:
<code><START> public YieldExpressionTree YIELD_EXPRESSION() { <END> return b.<YieldExpressionTree>nonterminal(Kind.YIELD_EXPRESSION) .is(f.yieldExpression( b.token(PHPKeyword.YIELD), EXPRESSION(), b.optional(f.newTuple1(b.token(PHPPunctuator.DOUBLEARROW), EXPRESSION())) )); }</code><technical_language>![MAJOR](<LINK_1> Rename this method name match regular expression '^[a-z][a-zA-Z0-9]*$'. [![rule](<LINK_2>](<LINK_0></technical_language>

Target:
public YieldExpressionTree YIELD_EXPRESSION() { return b.<YieldExpressionTree>nonterminal(Kind.YIELD_EXPRESSION) .is(f.yieldExpression( b.token(YIELD), EXPRESSION(), b.optional(f.newTuple1(b.token(DOUBLEARROW), EXPRESSION())) )); }
Source:
<code><START> public void testHashFile() throws IOException { <END> AnyLongObjectId id1 = LongObjectId.hash("test"); Path f = tmp.resolve("test"); JGitTestUtil.write(f.toFile(), "test"); AnyLongObjectId id2 = LongObjectId.hash(f); assertEquals("objects should be equals", id1, id2); }</code><technical_language>remove option hash a file test a stream instead</technical_language>

Target:
public void testHashFile() throws IOException { AnyLongObjectId id1 = LongObjectIdTestUtils.hash("test"); Path f = tmp.resolve("test"); JGitTestUtil.write(f.toFile(), "test"); AnyLongObjectId id2 = LongObjectIdTestUtils.hash(f); assertEquals("objects should be equals", id1, id2); }
Source:
<code>private TaskConfigurer getDefaultConfigurer() { verifyEnvironment(); int configurers = this.context.getBeanNamesForType(TaskConfigurer.class).length; if (configurers < 1) { TaskConfigurer taskConfigurer; if(!CollectionUtils.isEmpty(this.dataSources) && this.dataSources.size() == 1) { taskConfigurer = new DefaultTaskConfigurer( this.dataSources.iterator().next(), taskProperties.getTablePrefix(), context); } else { taskConfigurer = new DefaultTaskConfigurer( null, <START> taskProperties.getTablePrefix(), null); <END> } this.context.getBeanFactory().registerSingleton("taskConfigurer", taskConfigurer); return taskConfigurer; } else { if(configurers == 1) { return this.context.getBean(TaskConfigurer.class); } else { throw new IllegalStateException("Expected one TaskConfigurer but found " + configurers); } } }</code><technical_language>constructor is there, this need changed</technical_language>

Target:
private TaskConfigurer getDefaultConfigurer() { verifyEnvironment(); int configurers = this.context.getBeanNamesForType(TaskConfigurer.class).length; if (configurers < 1) { TaskConfigurer taskConfigurer; if(!CollectionUtils.isEmpty(this.dataSources) && this.dataSources.size() == 1) { taskConfigurer = new DefaultTaskConfigurer( this.dataSources.iterator().next(), taskProperties.getTablePrefix(), context); } else { taskConfigurer = new DefaultTaskConfigurer(taskProperties.getTablePrefix()); } this.context.getBeanFactory().registerSingleton("taskConfigurer", taskConfigurer); return taskConfigurer; } else { if(configurers == 1) { return this.context.getBean(TaskConfigurer.class); } else { throw new IllegalStateException("Expected one TaskConfigurer but found " + configurers); } } }
Source:
<code>public void findAll() throws Exception { getClient().perform(get("/api/config/submissiondefinitions")) <START> .andExpect(status().isForbidden()); <END> String token = getAuthToken(admin.getEmail(), password); getClient(token).perform(get("/api/config/submissiondefinitions")) .andExpect(status().isOk()) .andExpect(content().contentType(contentType)) .andExpect(jsonPath("$.page.size", is(20))) .andExpect(jsonPath("$.page.totalElements", greaterThanOrEqualTo(1))) .andExpect(jsonPath("$.page.totalPages", greaterThanOrEqualTo(1))) .andExpect(jsonPath("$.page.number", is(0))) .andExpect( jsonPath("$._links.search.href", is(REST_SERVER_URL + "config/submissiondefinitions/search"))) .andExpect(jsonPath("$._embedded.submissiondefinitions", hasSize(greaterThanOrEqualTo(1)))) ; }</code><technical_language>isUnauthorized 403</technical_language>

Target:
public void findAll() throws Exception { getClient().perform(get("/api/config/submissiondefinitions")) .andExpect(status().isUnauthorized()); String token = getAuthToken(admin.getEmail(), password); getClient(token).perform(get("/api/config/submissiondefinitions")) .andExpect(status().isOk()) .andExpect(content().contentType(contentType)) .andExpect(jsonPath("$.page.size", is(20))) .andExpect(jsonPath("$.page.totalElements", greaterThanOrEqualTo(1))) .andExpect(jsonPath("$.page.totalPages", greaterThanOrEqualTo(1))) .andExpect(jsonPath("$.page.number", is(0))) .andExpect( jsonPath("$._links.search.href", is(REST_SERVER_URL + "config/submissiondefinitions/search"))) .andExpect(jsonPath("$._embedded.submissiondefinitions", hasSize(greaterThanOrEqualTo(1)))) ; }
Source:
<code>private static boolean valueEquals(@Nullable Object value1, @Nullable Object value2) { if ((value1 == null) && (value2 == null)) { return true; } if ((value1 == null) || (value2 == null)) { return false; } Class<?> class1 = value1.getClass(); Class<?> class2 = value2.getClass(); if (class1.isArray() && class2.isArray() && class1.equals(class2)) { <START> if (class1.equals(int[].class) && class2.equals(int[].class)) { <END> return Arrays.equals((int[]) value1, (int[]) value2); } else if (class1.equals(float[].class) && class2.equals(float[].class)) { return Arrays.equals((float[]) value1, (float[]) value2); } else if (class1.equals(double[].class) && class2.equals(double[].class)) { return Arrays.equals((double[]) value1, (double[]) value2); } else if (class1.equals(boolean[].class) && class2.equals(boolean[].class)) { return Arrays.equals((boolean[]) value1, (boolean[]) value2); } else if (class1.equals(byte[].class) && class2.equals(byte[].class)) { return Arrays.equals((byte[]) value1, (byte[]) value2); } else if (class1.equals(short[].class) && class2.equals(short[].class)) { return Arrays.equals((short[]) value1, (short[]) value2); } else if (class1.equals(long[].class) && class2.equals(long[].class)) { return Arrays.equals((long[]) value1, (long[]) value2); } else if (class1.equals(char[].class) && class2.equals(char[].class)) { return Arrays.equals((char[]) value1, (char[]) value2); } else if (class1.equals(Object[].class) && class2.equals(Object[].class)) { return Arrays.equals((Object[]) value1, (Object[]) value2); } return false; } return (value1.equals(value2)); }</code><technical_language>need for comparators if suggestion above</technical_language>

Target:
private static boolean valueEquals(@Nullable Object value1, @Nullable Object value2) { if ((value1 == null) && (value2 == null)) { return true; } if ((value1 == null) || (value2 == null)) { return false; } Class<?> class1 = value1.getClass(); Class<?> class2 = value2.getClass(); if (class1.isArray() && class2.isArray() && class1.equals(class2)) { final int length = Array.getLength(value1); List<Object> left = new ArrayList<>(length); List<Object> right = new ArrayList<>(length); for( int i = 0; i < length; i++){ left.add(Array.get(value1, i)); right.add(Array.get(value2, i)); } return left.equals(right); } return (value1.equals(value2)); }
Source:
<code>public void write(JsonWriter out, DefaultProblem problem) throws IOException { JsonObject jsonObject = new JsonObject(); jsonObject.add("type", TYPE_ADAPTER.toJsonTree(problem.getType())); jsonObject.add("title", STRING.toJsonTree(problem.getTitle())); jsonObject.add("status", statusAdapter.toJsonTree(problem.getStatus())); jsonObject.add("detail", STRING.toJsonTree(problem.getDetail())); jsonObject.add("instance", TypeAdapters.URI.toJsonTree(problem.getInstance())); jsonObject.add("cause", throwableProblemAdapter.toJsonTree(problem.getCause())); JsonObject mapObject = mapAdapter.toJsonTree(problem.getParameters()).getAsJsonObject(); <START> Set<Map.Entry<String, JsonElement>> entries = mapObject.entrySet(); <END> for (Map.Entry<String, JsonElement> entry : entries) { jsonObject.add(entry.getKey(), entry.getValue()); } if (stacktrace) { String[] traces = Arrays.stream(problem.getStackTrace()) .map(StackTraceElement::toString).toArray(String[]::new); TypeAdapter<String[]> adapter = gson.getAdapter(String[].class); jsonObject.add("stacktrace", adapter.toJsonTree(traces)); } gson.getAdapter(JsonElement.class).write(out, jsonObject); }</code><technical_language>java mapObject.forEach(jsonObject::add);</technical_language>

Target:
public void write(JsonWriter out, DefaultProblem problem) throws IOException { JsonObject jsonObject = new JsonObject(); serializeType(jsonObject, problem.getType()); jsonObject.add("title", STRING.toJsonTree(problem.getTitle())); jsonObject.add("status", statusAdapter.toJsonTree(problem.getStatus())); jsonObject.add("detail", STRING.toJsonTree(problem.getDetail())); jsonObject.add("instance", URI.toJsonTree(problem.getInstance())); jsonObject.add("cause", throwableProblemAdapter.toJsonTree(problem.getCause())); JsonObject paramsField = mapAdapter.toJsonTree(problem.getParameters()).getAsJsonObject(); paramsField.entrySet().forEach(e -> jsonObject.add(e.getKey(), e.getValue())); serializeStackTrace(jsonObject, problem); gson.getAdapter(JsonElement.class).write(out, jsonObject); }
Source:
<code>public void initTable() throws Exception { ts = nextTimestamp(); <START> initATableValues("aTable", tenantId, getDefaultSplits(tenantId), null, ts, getUrl()); <END> if (indexDDL != null && indexDDL.length > 0) { Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts)); Connection conn = DriverManager.getConnection(getUrl(), props); for (String ddl : indexDDL) { conn.createStatement().execute(ddl); } } }</code><technical_language>need pass "aTable" here</technical_language>

Target:
public void initTable() throws Exception { ts = nextTimestamp(); initATableValues(ATABLE_NAME, tenantId, getDefaultSplits(tenantId), null, ts, getUrl()); if (indexDDL != null && indexDDL.length > 0) { Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts)); Connection conn = DriverManager.getConnection(getUrl(), props); for (String ddl : indexDDL) { conn.createStatement().execute(ddl); } } }
Source:
<code>public void subscriberContextPropagation() throws MuleException { final ContextPropagationChecker contextPropagationChecker = new ContextPropagationChecker(); onErrorPropagateHandler .setMessageProcessors(singletonList(contextPropagationChecker)); initialiseIfNeeded(onErrorPropagateHandler, muleContext); AtomicReference<Throwable> thownRef = new AtomicReference<>(); final Consumer<Exception> router = onErrorPropagateHandler .router(pub -> Flux.from(pub) .subscriberContext(contextPropagationChecker.contextPropagationFlag()), e -> { }, t -> thownRef.set(t)); when(mockException.getEvent()).thenReturn(muleEvent); router.accept(mockException); <START> assertThat(thownRef.get().getCause(), not(instanceOf(AssertionError.class))); <END> }</code><technical_language>verify throwRef.get() is mock exception</technical_language>

Target:
public void subscriberContextPropagation() throws MuleException { final ContextPropagationChecker contextPropagationChecker = new ContextPropagationChecker(); onErrorPropagateHandler .setMessageProcessors(singletonList(contextPropagationChecker)); initialiseIfNeeded(onErrorPropagateHandler, muleContext); AtomicReference<Throwable> thownRef = new AtomicReference<>(); final Consumer<Exception> router = onErrorPropagateHandler .router(pub -> Flux.from(pub) .subscriberContext(contextPropagationChecker.contextPropagationFlag()), e -> { }, t -> thownRef.set(t)); when(mockException.getEvent()).thenReturn(muleEvent); router.accept(mockException); assertThat(thownRef.get().getCause(), not(instanceOf(AssertionError.class))); assertThat(thownRef.get(), sameInstance(mockException)); }
Source:
<code>public GdbCommandTimeoutManager( ICommandControl commandControl ) { fCommandControl = commandControl; fListeners = new ListenerList(); <START> new GdbDebugOptions(GdbPlugin.getBundleContext()); <END> }</code><technical_language>Remove. This is done in plugin.start() method</technical_language>

Target:
public GdbCommandTimeoutManager( ICommandControl commandControl ) { fCommandControl = commandControl; fListeners = new ListenerList(); }
Source:
<code>public PutMessageStrategy create(Object payload) { if (payload instanceof ElementNSImpl) { return new BestEDUPutMessageStrategy(context.getMessageSender()); } if (!(payload instanceof String)) { throw new MeldingsUtvekslingRuntimeException("unknown payload class " + payload); } boolean isAppReceipt = ((String) payload).contains(APP_RECEIPT_INDICATOR); boolean isBestEDUMessage = ((String) payload).contains(MESSAGE_INDICATOR); if (isAppReceipt) { return new AppReceiptPutMessageStrategy(context.getEventlog()); <START> } else if (isBestEDUMessage) { <END> return new BestEDUPutMessageStrategy(context.getMessageSender() ); } else throw new MeldingsUtvekslingRuntimeException("Unknown String based payload " + payload); }</code><technical_language>isBestEDUMessage(payload)</technical_language>

Target:
public PutMessageStrategy create(Object payload) { if (isEPhorte(payload)) { return new BestEDUPutMessageStrategy(context.getMessageSender()); } if (isUnknown(payload)) { throw new MeldingsUtvekslingRuntimeException("unknown payload class " + payload); } if (isAppReceipt(payload)) { return new AppReceiptPutMessageStrategy(context.getEventlog()); } else if (isBestEDUMessage(payload)) { return new BestEDUPutMessageStrategy(context.getMessageSender()); } else throw new MeldingsUtvekslingRuntimeException("Unknown String based payload " + payload); }
Source:
<code>public void send(Message<?> message) throws Exception { synchronized (this.socketChannel) { if (this.bufferedOutputStream == null) { int writeBufferSize = this.socketChannel.socket().getSendBufferSize(); this.bufferedOutputStream = new BufferedOutputStream(this.getChannelOutputStream(), writeBufferSize > 0 ? writeBufferSize : 8192); } Object object = this.getMapper().fromMessage(message); <START> Assert.state(object != null, "Mapper mapped the message to 'null."); <END> this.lastSend = System.currentTimeMillis(); try { ((Serializer<Object>) this.getSerializer()).serialize(object, this.bufferedOutputStream); this.bufferedOutputStream.flush(); } catch (Exception e) { this.publishConnectionExceptionEvent(new MessagingException(message, "Failed TCP serialization", e)); this.closeConnection(true); throw e; } if (logger.isDebugEnabled()) { logger.debug(getConnectionId() + " Message sent " + message); } } }</code><technical_language>DITTO: suggestion Assert.state(object != null, "Mapper mapped message 'null'.");</technical_language>

Target:
public void send(Message<?> message) throws Exception { synchronized (this.socketChannel) { if (this.bufferedOutputStream == null) { int writeBufferSize = this.socketChannel.socket().getSendBufferSize(); this.bufferedOutputStream = new BufferedOutputStream(this.getChannelOutputStream(), writeBufferSize > 0 ? writeBufferSize : 8192); } Object object = this.getMapper().fromMessage(message); Assert.state(object != null, "Mapper mapped the message to 'null'."); this.lastSend = System.currentTimeMillis(); try { ((Serializer<Object>) this.getSerializer()).serialize(object, this.bufferedOutputStream); this.bufferedOutputStream.flush(); } catch (Exception e) { this.publishConnectionExceptionEvent(new MessagingException(message, "Failed TCP serialization", e)); this.closeConnection(true); throw e; } if (logger.isDebugEnabled()) { logger.debug(getConnectionId() + " Message sent " + message); } } }
Source:
<code>private void generate(int numMappers, int numPerMapper, int max, File out1) throws Exception { <START> int ret = ToolRunner.run(new Generate(), new String[] {"-D", "mapred.job.tracker=local", "-D", "fs.default.name=file:/ END> numPerMapper + "", max + "", out1.toURI().toString()}); Assert.assertEquals(0, ret); }</code><technical_language>Newer equivalent is fs.defaultFS</technical_language>

Target:
private void generate(int numMappers, int numPerMapper, int max, File out1) throws Exception { int ret = ToolRunner.run(new Generate(), new String[] {"-D", "mapred.job.tracker=local", "-D", "fs.defaultFS=file:/ numPerMapper + "", max + "", out1.toURI().toString()}); Assert.assertEquals(0, ret); }
Source:
<code>public void fail_to_filter_events_by_empty_field_name() { givenSequentialRecords(); final FieldFilter contextFieldFilter = FieldFilter.newBuilder() .setFieldPath( EventContext.class.getCanonicalName() + '.') .addValue(Any.getDefaultInstance()) .build(); final EventFilter eventFilter = EventFilter.newBuilder() .addContextFieldFilter(contextFieldFilter) .build(); final EventStreamQuery streamQuery = EventStreamQuery.newBuilder() .addFilter(eventFilter) .build(); final Iterator<Event> read = storage.iterator(streamQuery); <START> read.hasNext(); <END> read.next(); }</code><technical_language>if(read.hasNext()) { ... } else { Assert.fail(...) }</technical_language>

Target:
public void fail_to_filter_events_by_empty_field_name() { givenSequentialRecords(); final FieldFilter contextFieldFilter = FieldFilter.newBuilder() .setFieldPath( EventContext.class.getCanonicalName() + '.') .addValue(Any.getDefaultInstance()) .build(); final EventFilter eventFilter = EventFilter.newBuilder() .addContextFieldFilter(contextFieldFilter) .build(); final EventStreamQuery streamQuery = EventStreamQuery.newBuilder() .addFilter(eventFilter) .build(); final Iterator<Event> read = storage.iterator(streamQuery); if (read.hasNext()) { read.next(); } else { fail("Cannot ensure the element presence in the Event iterator."); } }
Source:
<code>public HttpToolResponse(HttpResponse response, long startTime) { this.response = response; this.startTime = startTime; try { ByteArrayOutputStream out = new ByteArrayOutputStream(); HttpEntity entity = response.getEntity(); if (entity != null) { entity.getContentLength(); durationMillisOfFirstResponse = System.currentTimeMillis() - startTime; ByteStreams.copy(entity.getContent(), out); content = out.toByteArray(); entity.getContentLength(); } else { <START> durationMillisOfFirstResponse = System.currentTimeMillis() - startTime; <END> content = new byte[0]; } durationMillisOfFullContent = System.currentTimeMillis() - startTime; if (log.isTraceEnabled()) log.trace("HttpPollValue latency "+Time.makeTimeStringRounded(durationMillisOfFirstResponse)+" / "+Time.makeTimeStringRounded(durationMillisOfFullContent)+", content size "+content.length); } catch (IOException e) { throw Throwables.propagate(e); } }</code><technical_language>Duration.since(startTime)</technical_language>

Target:
public HttpToolResponse(HttpResponse response, long startTime) { this.response = response; this.startTime = startTime; try { ByteArrayOutputStream out = new ByteArrayOutputStream(); HttpEntity entity = response.getEntity(); if (entity != null) { entity.getContentLength(); durationMillisOfFirstResponse = Duration.sinceUtc(startTime).toMilliseconds(); ByteStreams.copy(entity.getContent(), out); content = out.toByteArray(); entity.getContentLength(); } else { durationMillisOfFirstResponse = Duration.sinceUtc(startTime).toMilliseconds(); content = new byte[0]; } durationMillisOfFullContent = Duration.sinceUtc(startTime).toMilliseconds(); if (log.isTraceEnabled()) log.trace("HttpPollValue latency "+Time.makeTimeStringRounded(durationMillisOfFirstResponse)+" / "+Time.makeTimeStringRounded(durationMillisOfFullContent)+", content size "+content.length); } catch (IOException e) { throw Throwables.propagate(e); } }
Source:
<code><START> private Optional<List<Map<String, Object>>> findSubscriptions() { <END> try { return Optional.of(persistentStore.get(SubscriptionsPersistentStore.SUBSCRIPTIONS_TYPE)); } catch (PersistenceException e) { LOGGER.debug("Failed to get subscriptions for workspaces: {}", e.getMessage(), e); } return Optional.empty(); }</code><technical_language>I odd Optional collections return empty collection instead of empty Optional</technical_language>

Target:
private List<Map<String, Object>> findSubscriptions() { try { return persistentStore.get(SUBSCRIPTIONS_TYPE, "", 0, maxSubscriptions); } catch (PersistenceException e) { LOGGER.debug("Failed to get subscriptions for workspaces.", e); } return Collections.emptyList(); }