Source:
<code>public List<Category> getCategoriesFromContent(Contentlet contentlet, User user, boolean respectFrontendRoles) throws DotDataException, DotSecurityException { <START> final List<Category> cats = new ArrayList<>(); <END> final List<com.dotmarketing.portlets.structure.model.Field> fields = new LegacyFieldTransformer( APILocator.getContentTypeAPI(APILocator.systemUser()). find(contentlet.getContentType().inode()).fields()).asOldFieldList(); for (com.dotmarketing.portlets.structure.model.Field field : fields) { if (field.getFieldType().equals(com.dotmarketing.portlets.structure.model.Field.FieldType.CATEGORY.toString())) { String catValue = contentlet.getStringProperty(field.getVelocityVarName()); if (UtilMethods.isSet(catValue)) { for (String categoryIdKeyOrVar : catValue.split("\\s*,\\s*")) { Category category = APILocator.getCategoryAPI() .find(categoryIdKeyOrVar, user, respectFrontendRoles); if (category != null && InodeUtils.isSet(category.getCategoryId())) { cats.add(category); } else { category = APILocator.getCategoryAPI() .findByKey(categoryIdKeyOrVar, user, respectFrontendRoles); if (category != null && InodeUtils .isSet(category.getCategoryId())) { cats.add(category); } else { try { category = findByVariable(categoryIdKeyOrVar, user, respectFrontendRoles); if (category != null && InodeUtils.isSet(category.getCategoryId())) { cats.add(category); } } catch (DotDataException e) { Logger.error(this, "Error finding category by variable. " + "Var name: " + categoryIdKeyOrVar, e); } } } } } } } return UtilMethods.isSet(cats)?cats:null; }</code><technical_language>rename categories</technical_language>

Target:
public List<Category> getCategoriesFromContent(Contentlet contentlet, User user, boolean respectFrontendRoles) throws DotDataException, DotSecurityException { final List<Category> categories = new ArrayList<>(); final List<com.dotmarketing.portlets.structure.model.Field> fields = new LegacyFieldTransformer( APILocator.getContentTypeAPI(APILocator.systemUser()). find(contentlet.getContentType().inode()).fields()).asOldFieldList(); for (com.dotmarketing.portlets.structure.model.Field field : fields) { if (field.getFieldType().equals(com.dotmarketing.portlets.structure.model.Field.FieldType.CATEGORY.toString())) { final String catValue = contentlet.getStringProperty(field.getVelocityVarName()); if (UtilMethods.isSet(catValue)) { for (final String categoryIdKeyOrVar : catValue.split("\\s*,\\s*")) { Category category = APILocator.getCategoryAPI() .find(categoryIdKeyOrVar, user, respectFrontendRoles); if (category != null && InodeUtils.isSet(category.getCategoryId())) { categories.add(category); } else { category = APILocator.getCategoryAPI() .findByKey(categoryIdKeyOrVar, user, respectFrontendRoles); if (category != null && InodeUtils .isSet(category.getCategoryId())) { categories.add(category); } else { try { category = findByVariable(categoryIdKeyOrVar, user, respectFrontendRoles); if (category != null && InodeUtils.isSet(category.getCategoryId())) { categories.add(category); } } catch (DotDataException e) { Logger.error(this, "Error finding category by variable. " + "Var name: " + categoryIdKeyOrVar, e); } } } } } } } return UtilMethods.isSet(categories)?categories:null; }