Source:
private static String[] computePrettyName(final InvoiceItemType type, final DateTime transitionDate, @Nullable final String productName, @Nullable final String planName, @Nullable final String phaseName, @Nullable final String usageName, @Nullable final Catalog catalog) { final String[] result = new String[4]; final boolean computePrettyName = catalog != null && (type == InvoiceItemType.FIXED || type == InvoiceItemType.RECURRING || type == InvoiceItemType.TAX || type == InvoiceItemType.USAGE); String prettyProductName = null; String prettyPlanName = null; String prettyPlanPhaseName = null; String prettyUsageName = null; try { if (computePrettyName) { if (planName != null) { final DateTime KILLBILL_GENESIS = new DateTime(2019, 10, 28, 0, 0); final Plan plan = catalog.findPlan(planName, transitionDate, KILLBILL_GENESIS); if (plan != null) { prettyPlanName = plan.getPrettyName(); if (productName != null) { Preconditions.checkState(plan.getProduct().getName().equals(productName)); prettyProductName = plan.getProduct().getPrettyName(); } if (phaseName != null) { final PlanPhase planPhase = plan.findPhase(phaseName); if (planPhase != null) { prettyPlanPhaseName = planPhase.getPrettyName(); if (usageName != null) { Usage usage = null; for (Usage cur : planPhase.getUsages()) { if (cur.getName().equals(usageName)) { usage = cur; break; } } if (usage != null) { prettyUsageName = usage.getPrettyName(); } } } } } } } } catch (final CatalogApiException e) { log.warn("Failed to compute invoice pretty names:", e.getMessage()); } finally { result[0] = prettyProductName; result[1] = prettyPlanName; result[2] = prettyPlanPhaseName; result[3] = prettyUsageName; } return result; }

Target:
private static String[] computePrettyName(final InvoiceItemType type, final DateTime transitionDate, @Nullable final String productName, @Nullable final String planName, @Nullable final String phaseName, @Nullable final String usageName, @Nullable final Catalog catalog) { final String[] result = new String[4]; final boolean computePrettyName = catalog != null && (type == InvoiceItemType.FIXED || type == InvoiceItemType.RECURRING || type == InvoiceItemType.TAX || type == InvoiceItemType.USAGE); String prettyProductName = null; String prettyPlanName = null; String prettyPlanPhaseName = null; String prettyUsageName = null; try { if (computePrettyName) { if (planName != null) { final DateTime KILLBILL_GENESIS = new DateTime(2011, 10, 28, 0, 0, DateTimeZone.UTC); final Plan plan = catalog.findPlan(planName, transitionDate, KILLBILL_GENESIS); if (plan != null) { prettyPlanName = plan.getPrettyName(); if (productName != null) { Preconditions.checkState(plan.getProduct().getName().equals(productName)); prettyProductName = plan.getProduct().getPrettyName(); } if (phaseName != null) { final PlanPhase planPhase = plan.findPhase(phaseName); if (planPhase != null) { prettyPlanPhaseName = planPhase.getPrettyName(); if (usageName != null) { Usage usage = null; for (Usage cur : planPhase.getUsages()) { if (cur.getName().equals(usageName)) { usage = cur; break; } } if (usage != null) { prettyUsageName = usage.getPrettyName(); } } } } } } } } catch (final CatalogApiException e) { log.warn("Failed to compute invoice pretty names:", e.getMessage()); } finally { result[0] = prettyProductName; result[1] = prettyPlanName; result[2] = prettyPlanPhaseName; result[3] = prettyUsageName; } return result; }