auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected boolean validateCanUpdateReadOnly(DiskValidator diskValidator) { if (updateReadOnlyRequested()) { if(getVm().getStatus() != VMStatus.Down && vmDeviceForVm.getIsPlugged()) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_VM_IS_NOT_DOWN); } if (!validateVmPoolProperties()) { return false; } return validate(diskValidator.isReadOnlyPropertyCompatibleWithInterface()); } return true; }

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:
public static void registerKey(Binder binder, Key<DruidNode> key) { LifecycleModule.registerKey(binder, key); }

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

Target:
public Implementation() { plugin = this; }
Source:
public static <T extends Annotation> T createJsonQualifierImplementation( final Class<T> annotationType) { 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(); } }); }

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:
public Date getAutoExpireDate(DrugOrder drugOrder) { if (drugOrder.getDurationUnits() == null) return null; if (drugOrder.getNumRefills() != null && drugOrder.getNumRefills() > 0) return null; String durationCode = getISO8601DurationCode(drugOrder.getDurationUnits().getConceptMappings()); ISO8601Duration iso8601Duration = new ISO8601Duration(drugOrder.getDuration(), durationCode); return iso8601Duration.addToDate(drugOrder.getDateActivated(), drugOrder.getFrequency()); }

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:
public void testZooKeeperHostFallBackToSite() throws Exception { ClientConfiguration clientConfig = new ClientConfiguration(); Map<String,String> data = new HashMap<>(); data.put(Property.INSTANCE_ZK_HOST.getKey(), "site_hostname"); AccumuloConfiguration conf = new ConfigurationCopy(data); assertEquals("site_hostname", Shell.getZooKeepers(null, clientConfig)); }

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:
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 && count > 0) { 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(); }

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:
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; this.splitProps = splits; return this; }

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:
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.post(() -> { swipeRefreshLayout.setRefreshing(true); refreshSync(this, swipeRefreshLayout); }); return true; default: return super.onOptionsItemSelected(item); } }

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:
public Response optionalCommentOnLanguage(OsuApiUser apiUser) { return new Message("[<LINK_2> marcostudios] e [<LINK_1> Howl] mi hanno insegnato l'italiano <3"); }

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

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:
public AbstractLabelsetMetadata(String id) { Assert.notNull(id, "Ruleset ID must not be null."); this.id = id; }

Target:
public AbstractLabelsetMetadata(String id) { Assert.notNull(id, "Labelset ID must not be null."); this.id = id; }
Source:
private void onNfsServerSelectionChange(UIMessages messages) { if(getNfsServers().getSelectedItem() == null) { return; } int index = getProfileInfo().getNfsProfileDetails().indexOf(getNfsServers().getSelectedItem()); 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")); }

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:
abstract Object getValue(View view) throws InvocationTargetException, IllegalAccessException; @Nullable ViewDebug.ExportedProperty getAnnotation() { return mAnnotation; }

Target:
public abstract Object getValue(View view) throws InvocationTargetException, IllegalAccessException; public final @Nullable ViewDebug.ExportedProperty getAnnotation() { return mAnnotation; }
Source:
public void testBadTTLs() throws IOException, KeeperException, InterruptedException { Stat stat = new Stat(); 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)); }

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:
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) { log.error(e, "Error decompressing data"); } }

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:
public StackTraceElement calcLocation(final String fqcnOfLogger) { return walker.walk(s -> s.filter(LOCATOR.get().setFqcn(fqcnOfLogger)).findFirst()).get().toStackTraceElement(); }

Target:
public StackTraceElement calcLocation(final String fqcnOfLogger) { FQCN.set(fqcnOfLogger); StackTraceElement element = walker.walk(LOCATOR).toStackTraceElement(); FQCN.set(null); return element; }
Source:
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(); String annotationId = field.getAnnotation(org.mini2Dx.ui.annotation.UiElement.class).id(); 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); } }

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:
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); }

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:
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)); } } else { LOG.debug("Ignoring node change notification since the service has already been stopped."); } } }

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:
public YieldExpressionTree YIELD_EXPRESSION() { return b.<YieldExpressionTree>nonterminal(Kind.YIELD_EXPRESSION) .is(f.yieldExpression( b.token(PHPKeyword.YIELD), EXPRESSION(), b.optional(f.newTuple1(b.token(PHPPunctuator.DOUBLEARROW), EXPRESSION())) )); }

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:
public void testHashFile() throws IOException { 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); }

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:
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, taskProperties.getTablePrefix(), null); } 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); } } }

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:
public void findAll() throws Exception { getClient().perform(get("/api/config/submissiondefinitions")) .andExpect(status().isForbidden()); 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)))) ; }

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:
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)) { if (class1.equals(int[].class) && class2.equals(int[].class)) { 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)); }

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:
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(); Set<Map.Entry<String, JsonElement>> entries = mapObject.entrySet(); 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); }

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:
public void initTable() throws Exception { ts = nextTimestamp(); initATableValues("aTable", 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); } } }

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:
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))); }

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:
public GdbCommandTimeoutManager( ICommandControl commandControl ) { fCommandControl = commandControl; fListeners = new ListenerList(); new GdbDebugOptions(GdbPlugin.getBundleContext()); }

Target:
public GdbCommandTimeoutManager( ICommandControl commandControl ) { fCommandControl = commandControl; fListeners = new ListenerList(); }
Source:
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()); } else if (isBestEDUMessage) { return new BestEDUPutMessageStrategy(context.getMessageSender() ); } else throw new MeldingsUtvekslingRuntimeException("Unknown String based payload " + payload); }

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:
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); } } }

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:
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.default.name=file:/ numPerMapper + "", max + "", out1.toURI().toString()}); Assert.assertEquals(0, ret); }

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:
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); read.hasNext(); read.next(); }

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:
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 { durationMillisOfFirstResponse = System.currentTimeMillis() - startTime; 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); } }

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:
private Optional<List<Map<String, Object>>> findSubscriptions() { 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(); }

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(); }
Source:
public void setAlarms() { reminders = db.getReminders(); enableBootReceiver(db.areRemindersActive()); for (int i = 0; i < reminders.size(); i++) { Reminder reminder = reminders.get(i); Intent intent = new Intent(context, GlucosioBroadcastReceiver.class); intent.putExtra("metric", reminder.getMetric()); PendingIntent alarmIntent = PendingIntent.getBroadcast(context, (int) reminder.getId(), intent, 0); if (reminder.isActive()) { Calendar cal = Calendar.getInstance(); cal.setTime(reminder.getAlarmTime()); alarmMgr.setRepeating(AlarmManager.RTC_WAKEUP, cal.getTimeInMillis(), AlarmManager.INTERVAL_DAY, alarmIntent); } else { alarmMgr.cancel(alarmIntent); } } }

Target:
public void setAlarms() { List<Reminder> reminders = db.getReminders(); int activeRemindersCount = 0; for (int i = 0; i < reminders.size(); i++) { Reminder reminder = reminders.get(i); Intent intent = new Intent(context, GlucosioBroadcastReceiver.class); intent.putExtra("metric", reminder.getMetric()); intent.putExtra("glucosio_reminder", true); PendingIntent alarmIntent = PendingIntent.getBroadcast(context, (int) reminder.getId(), intent, 0); if (reminder.isActive()) { activeRemindersCount++; Calendar calNow = Calendar.getInstance(); Calendar calAlarm = Calendar.getInstance(); calAlarm.setTime(reminder.getAlarmTime()); calAlarm.set(Calendar.SECOND, 0); DateTime now = new DateTime(calNow.getTime()); DateTime reminderDate = new DateTime(calAlarm); if (reminderDate.isBefore(now)) { calAlarm.set(Calendar.DATE, calNow.get(Calendar.DATE)); calAlarm.add(Calendar.DATE, 1); } Log.d("Glucosio", "Added reminder on " + calAlarm.get(Calendar.DAY_OF_MONTH) + " at " + calAlarm.get(Calendar.HOUR) + ":" + calAlarm.get(Calendar.MINUTE)); alarmMgr.setRepeating(AlarmManager.RTC_WAKEUP, calAlarm.getTimeInMillis(), AlarmManager.INTERVAL_DAY, alarmIntent); } else { alarmMgr.cancel(alarmIntent); } } enableBootReceiver(activeRemindersCount > 0); }
Source:
public Map<String,Project> getProjects() { Map<String,Project> projects = (Map<String,Project>)getConfigurationValue("projects"); return projects; }

Target:
public Map<String,Project> getProjects() { return (Map<String,Project>)getConfigurationValue("projects"); }
Source:
public void setBinaryData(Object answer, PendingCalloutInterface pendingCalloutInterface) { FormIndex questionFormIndex = pendingCalloutInterface.getPendingCalloutFormIndex(); if (questionFormIndex == null) { Logger.log(LogTypes.TYPE_ERROR_ASSERTION, "Unable to find question widget to attach pending data to."); return; } for (QuestionWidget q : widgets) { if (questionFormIndex.equals(q.getFormId())) { q.setBinaryData(answer); return; } } Logger.log(LogTypes.TYPE_ERROR_ASSERTION, "Unable to find question widget to attach pending data to."); }

Target:
public void setBinaryData(Object answer, PendingCalloutInterface pendingCalloutInterface) { FormIndex questionFormIndex = pendingCalloutInterface.getPendingCalloutFormIndex(); if (questionFormIndex == null) { Logger.log(LogTypes.SOFT_ASSERT, "No pending callout index was set when trying to attach pending data."); return; } for (QuestionWidget q : widgets) { if (questionFormIndex.equals(q.getFormId())) { q.setBinaryData(answer); return; } } Logger.log(LogTypes.SOFT_ASSERT, "Unable to find question widget to attach pending data to."); }
Source:
public synchronized void addAddressToTunnelInterface( int tunnelResourceId, LinkAddress localAddr) { UserRecord userRecord = mUserResourceTracker.getUserRecord(Binder.getCallingUid()); TunnelInterfaceRecord tunnelInterfaceInfo = userRecord.mTunnelInterfaceRecords.getResourceOrThrow(tunnelResourceId); try { mSrvConfig .getNetdInstance() .interfaceAddAddress( tunnelInterfaceInfo.mInterfaceName, localAddr.getAddress().getHostAddress(), localAddr.getPrefixLength()); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } catch (ServiceSpecificException e) { rethrowFromServiceSpecificException(e); } }

Target:
public synchronized void addAddressToTunnelInterface( int tunnelResourceId, LinkAddress localAddr) { enforceNetworkStackPermission(); UserRecord userRecord = mUserResourceTracker.getUserRecord(Binder.getCallingUid()); TunnelInterfaceRecord tunnelInterfaceInfo = userRecord.mTunnelInterfaceRecords.getResourceOrThrow(tunnelResourceId); try { mSrvConfig .getNetdInstance() .interfaceAddAddress( tunnelInterfaceInfo.mInterfaceName, localAddr.getAddress().getHostAddress(), localAddr.getPrefixLength()); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } catch (ServiceSpecificException e) { throw new IllegalArgumentException(e); } }
Source:
public static Boolean notExists( EvaluationContext ctx, List tests, Object target) { for (Object test : tests) { Boolean r = applyUnaryTest(ctx, test, target); if (r != null && r) return false; } return true; }

Target:
public static Boolean notExists( EvaluationContext ctx, List tests, Object target) { for (Object test : tests) { Boolean r = applyUnaryTest(ctx, test, target); if (r == null || r) return false; } return true; }
Source:
public WorkflowState getState(String state) { for (WorkflowState s : getStates()) { if (state.equals(s.name())) { return s; } } throw new IllegalStateException("No state '" + state + "' in workflow definiton " + getType()); }

Target:
public WorkflowState getState(String state) { for (WorkflowState s : getStates()) { if (Objects.equals(s.name(), state)) { return s; } } throw new IllegalStateException("No state '" + state + "' in workflow definiton " + getType()); }
Source:
private void setSessionUser(Session session) { try { User user = getUserResource().getUserByNameAndDomain(session.getUser().getUserName(), session.getUser().getDomain().getName()); if (user != null) { session.getUser().setId(user.getId()); session.getUser().setHref(user.getHref()); session.getUser().getDomain().setId(user.getDomain().getId()); session.getUser().getDomain().setHref(user.getDomain().getHref()); } } catch (WebApplicationException ex) { } }

Target:
private void setSessionUser(Session session) { User user = getUserResource().getUserByNameAndDomain(session.getUser().getUserName(), session.getUser().getDomain().getName()); if (user != null) { session.getUser().setId(user.getId()); session.getUser().setHref(user.getHref()); session.getUser().getDomain().setId(user.getDomain().getId()); session.getUser().getDomain().setHref(user.getDomain().getHref()); } }
Source:
private void generateMissingColumnsCheck(MethodSpec.Builder methodBuilder) { methodBuilder.addStatement( "$1T<$2T> missingTableCqlNames = findMissingColumnsCql(expectedCqlNames, (($3T) tableMetadata.get()).getColumns().keySet())", List.class, CqlIdentifier.class, DefaultTableMetadata.class); CodeBlock missingCqlColumnExceptionMessage = CodeBlock.of( "String.format(\"The CQL ks.table: %s.%s has missing columns: %s that are defined in the entity class: %s\", " + "keyspaceId, tableId, missingTableCqlNames, entityClassName)"); methodBuilder.beginControlFlow("if (!missingTableCqlNames.isEmpty())"); methodBuilder.addStatement( "throw new $1T($2L)", IllegalArgumentException.class, missingCqlColumnExceptionMessage); methodBuilder.endControlFlow(); }

Target:
private void generateMissingColumnsCheck(MethodSpec.Builder methodBuilder) { methodBuilder.addComment("validation of all columns"); methodBuilder.addStatement( "$1T<$2T> missingTableCqlNames = findMissingCqlIdentifiers(expectedCqlNames, tableMetadata.get().getColumns().keySet())", List.class, CqlIdentifier.class); CodeBlock missingCqlColumnExceptionMessage = CodeBlock.of( "String.format(\"The CQL ks.table: %s.%s has missing columns: %s that are defined in the entity class: %s\", " + "keyspaceId, tableId, missingTableCqlNames, entityClassName)"); methodBuilder.beginControlFlow("if (!missingTableCqlNames.isEmpty())"); methodBuilder.addStatement( "throw new $1T($2L)", IllegalArgumentException.class, missingCqlColumnExceptionMessage); methodBuilder.endControlFlow(); }
Source:
private String getKeyTrustStoreAttribute(String sysPropName, KeyOrTrustStoreType store, String valueType, boolean throwForNull) { String sysProp = System.getProperty(sysPropName); if (StringUtils.isNotBlank(sysProp)) { return sysProp.trim(); } else { String value = null; if (store!=null) { value = valueType.equals("path") ? store.getPath() : store.getPassword(); } if (StringUtils.isBlank(value) && throwForNull) { throw new RuntimeException( "To enable HTTPS, keystore must be configured with password in deployment file or using system property"); } else { return (value!=null) ? value.trim() : value; } } }

Target:
private String getKeyTrustStoreAttribute(String sysPropName, KeyOrTrustStoreType store, String valueType, boolean throwForNull) { String sysProp = System.getProperty(sysPropName); if (StringUtils.isNotBlank(sysProp)) { return sysProp.trim(); } else { String value = null; if (store!=null) { value = "path".equals(valueType) ? store.getPath() : store.getPassword(); } if (StringUtils.isBlank(value) && throwForNull) { throw new IllegalArgumentException( "To enable HTTPS, keystore must be configured with password in deployment file or using system property. " + sysPropName); } else { return value; } } }
Source:
public Set<BlockType> getCategorisedByName(String category) { return CLIWorldEdit.inst.getFileRegistries().getDataFile().blocktags.getOrDefault(category, new ArrayList<>()).stream() .map(BlockType.REGISTRY::get) .collect(Collectors.toSet()); }

Target:
public Set<BlockType> getCategorisedByName(String category) { return CLIWorldEdit.inst.getFileRegistries().getDataFile().blocktags.getOrDefault(category, Collections.emptyList()).stream() .map(BlockType.REGISTRY::get) .collect(Collectors.toSet()); }