auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private RefactoringStatus checkNonAbstractMembersInDestinationClasses(IMember[] membersToPushDown, IType[] destinationClassesForNonAbstract) throws JavaModelException { RefactoringStatus result= new RefactoringStatus(); List<IMember> list= new ArrayList<>(); list.addAll(Arrays.asList(membersToPushDown)); list.removeAll(Arrays.asList(getAbstractMembers(membersToPushDown))); IMember[] nonAbstractMembersToPushDown= list.toArray(new IMember[list.size()]); for (IType <START> t : <END> destinationClassesForNonAbstract) { result.merge(MemberCheckUtil.checkMembersInDestinationType(nonAbstractMembersToPushDown, t)); } return result; }</code><technical_language>rename type</technical_language>

Target:
private RefactoringStatus checkNonAbstractMembersInDestinationClasses(IMember[] membersToPushDown, IType[] destinationClassesForNonAbstract) throws JavaModelException { RefactoringStatus result= new RefactoringStatus(); List<IMember> list= new ArrayList<>(); list.addAll(Arrays.asList(membersToPushDown)); list.removeAll(Arrays.asList(getAbstractMembers(membersToPushDown))); IMember[] nonAbstractMembersToPushDown= list.toArray(new IMember[list.size()]); for (IType type : destinationClassesForNonAbstract) { result.merge(MemberCheckUtil.checkMembersInDestinationType(nonAbstractMembersToPushDown, type)); } return result; }
Source:
<code>protected void beforeTest() { beforeTestSetup(); <START> client = clientSetup(pipeline -> new KeyClientBuilder() .vaultUrl(getEndpoint()) .pipeline(pipeline) .buildClient()); <END> }</code><technical_language>This deleted</technical_language>

Target:
protected void beforeTest() { beforeTestSetup(); }
Source:
<code>private static void forbidSystemExitCall() { <START> final SecurityManager securityManager = new SecurityManager() { <END> @Override public void checkExit(int status) { super.checkExit(status); throw new ExitTrappedException(); } @Override public void checkPermission(Permission permission) { } @Override public void checkPermission(Permission var1, Object var2) { } @Override public void checkSecurityAccess(String var1) { } @Override public void checkConnect(String var1, int var2, Object var3) { } @Override public void checkWrite(String var1) { } @Override public void checkDelete(String var1) { } @Override public void checkConnect(String var1, int var2) { } @Override public void checkLink(String var1) { } @Override public void checkRead(FileDescriptor var1) { } @Override public void checkAccess(Thread var1) { } @Override public void checkAccess(ThreadGroup var1) { } @Override public void checkCreateClassLoader() { } @Override public void checkListen(int var1) { } @Override public void checkAccept(String var1, int var2) { } @Override public void checkMulticast(InetAddress var1) { } @Override public void checkMulticast(InetAddress var1, byte var2) { } @Override public void checkPropertiesAccess() { } @Override public void checkPropertyAccess(String var1) { } @Override public void checkPackageAccess(String var1) { } @Override public void checkPackageDefinition(String var1) { } @Override public void checkSetFactory() { } }; System.setSecurityManager(securityManager); }</code><technical_language>create time? create put in place evaluate</technical_language>

Target:
private static void forbidSystemExitCall() { System.setSecurityManager(securityManager); }
Source:
<code>static BitmapHunter forRequest(Picasso picasso, Dispatcher dispatcher, Cache cache, Stats stats, Action action) { Request request = action.getRequest(); List<RequestHandler> requestHandlers = picasso.getRequestHandlers(); if (requestHandlers != null && !requestHandlers.isEmpty()) { for (RequestHandler requestHandler : requestHandlers) { if (request.resourceId != 0 && !(requestHandler instanceof ResourceRequestHandler)) { continue; } if (requestHandler.canHandleRequest(request)) { return new BitmapHunter(picasso, dispatcher, cache, stats, action, requestHandler); } } } <START> throw new IllegalStateException("Unrecognized type of URI: " + request.uri); <END> }</code><technical_language>This message is a bit full Request is pick a handler now</technical_language>

Target:
static BitmapHunter forRequest(Picasso picasso, Dispatcher dispatcher, Cache cache, Stats stats, Action action) { Request request = action.getRequest(); List<RequestHandler> requestHandlers = picasso.getRequestHandlers(); final int count = requestHandlers.size(); for (int i = 0; i < count; i++) { RequestHandler requestHandler = requestHandlers.get(i); if (requestHandler.canHandleRequest(request)) { return new BitmapHunter(picasso, dispatcher, cache, stats, action, requestHandler); } } throw new IllegalStateException("Unrecognized type of request: " + request); }
Source:
<code>public DialogWithTitle(String title) { <START> this.title = title; <END> }</code><technical_language>this(new WithTextMatcher(title) removing title attribute</technical_language>

Target:
public DialogWithTitle(String title) { this(new WithTextMatcher(title)); }
Source:
<code>public String build(final Date prev, final Date current) throws IOException { final DateFormat format = new SimpleDateFormat( "yyyy-MM-dd'T'HH:mm'Z'", Locale.ENGLISH ); format.setTimeZone(TimeZone.getTimeZone("UTC")); final Collection<String> lines = new LinkedList<>(); final Map<String, String> params = new MapOf<String, String>( new MapEntry<String, String>("since", format.format(prev)), new MapEntry<String, String>("until", format.format(current)) ); <START> final List<RepoCommit.Smart> commits = new ListOf<>( <END> new Smarts<RepoCommit.Smart>( this.repo.commits().iterate(params) ) ); int count = 0; for (final RepoCommit.Smart commit : commits) { if (count >= CommitsLog.MAX) { lines.add( String.format( " * and %d more...", commits.size() - CommitsLog.MAX ) ); break; } lines.add(CommitsLog.asText(commit)); ++count; } return new JoinedText( "\n", lines ).asString(); }</code><technical_language>@filfreire SolidList instead</technical_language>

Target:
public String build(final Date prev, final Date current) throws IOException { final DateFormat format = new SimpleDateFormat( "yyyy-MM-dd'T'HH:mm'Z'", Locale.ENGLISH ); format.setTimeZone(TimeZone.getTimeZone("UTC")); final Collection<String> lines = new LinkedList<>(); final Map<String, String> params = new SolidMap<String, String>( new MapEntry<String, String>("since", format.format(prev)), new MapEntry<String, String>("until", format.format(current)) ); final SolidList<Smart> commits = new SolidList<>( new Smarts<RepoCommit.Smart>( this.repo.commits().iterate(params) ) ); int count = 0; for (final RepoCommit.Smart commit : commits) { if (count >= CommitsLog.MAX) { lines.add( String.format( " * and %d more...", commits.size() - CommitsLog.MAX ) ); break; } lines.add(CommitsLog.asText(commit)); ++count; } return new JoinedText( "\n", lines ).asString(); }
Source:
<code>private boolean canAdd(IPluginModelBase candidate) { ISiteBundle[] currentBundles = fModel.getSite().getBundles(); IPluginBase candidateBundle = candidate.getPluginBase(); for (ISiteBundle currentBundle : currentBundles) { <START> if (currentBundle.getId().equals(candidateBundle.getId()) && (currentBundle.getVersion() == null <END> || currentBundle.getVersion().equals(candidateBundle.getVersion()))) return false; } return true; }</code><technical_language>I extract candidateBundle.getId() candidateBundle.getVersion() cycle</technical_language>

Target:
private boolean canAdd(IPluginModelBase candidate) { ISiteBundle[] currentBundles = fModel.getSite().getBundles(); IPluginBase candidateBundle = candidate.getPluginBase(); String candidateId = candidateBundle.getId(); String candidateVersion = candidateBundle.getVersion(); for (ISiteBundle currentBundle : currentBundles) { if (currentBundle.getId().equals(candidateId) && (currentBundle.getVersion() == null || currentBundle.getVersion().equals(candidateVersion))) return false; } return true; }
Source:
<code>public static Optional<String> getShortScienceSearchURL(BibEntry entry) { return entry.getField(StandardField.TITLE).map(title -> { URIBuilder uriBuilder; try { uriBuilder = new URIBuilder(SHORTSCIENCE_SEARCH_URL); } catch (URISyntaxException e) { <START> throw new AssertionError("ShortScience URL is invalid."); <END> } uriBuilder.addParameter("q", title); return uriBuilder.toString(); }); }</code><technical_language>Please pass original exception parameter. in case</technical_language>

Target:
public static Optional<String> getShortScienceSearchURL(BibEntry entry) { return entry.getField(StandardField.TITLE).map(title -> { URIBuilder uriBuilder; try { uriBuilder = new URIBuilder(SHORTSCIENCE_SEARCH_URL); } catch (URISyntaxException e) { throw new AssertionError("ShortScience URL is invalid.", e); } uriBuilder.addParameter("q", title); return uriBuilder.toString(); }); }
Source:
<code>public static FieldRef wrap(final Field f) { return new FieldRef() { @Override public <T extends Annotation> T getAnnotation(Class<T> type) { return f.getAnnotation(type); } @Override public String getName() { return f.getName(); } @Override public Object get(Object instance) throws IllegalAccessException { try { return f.get(instance); } catch (IllegalAccessException e) { <START> LOGGER.warning(e.getMessage() + ", please report to the respective component"); <END> f.setAccessible(true); return f.get(instance); } } @Override public boolean isStatic() { return Modifier.isStatic(f.getModifiers()); } @Override public Class<?> getReturnType() { return f.getType(); } @Override public String getSignature() { String prefix = isStatic() ? "staticField" : "field"; return StringUtils.join(Arrays.asList(prefix, f.getDeclaringClass().getName(), getName()), ' '); } @Override public String getQualifiedName() { return f.getDeclaringClass().getName()+"."+getName(); } @Override public boolean isRoutable() { return Modifier.isPublic(f.getModifiers()); } }; }</code><technical_language>suggestion LOGGER.log(Level.WARNING, "please report respective component", e);</technical_language>

Target:
public static FieldRef wrap(final Field f) { return new FieldRef() { @Override public <T extends Annotation> T getAnnotation(Class<T> type) { return f.getAnnotation(type); } @Override public String getName() { return f.getName(); } @Override public Object get(Object instance) throws IllegalAccessException { try { return f.get(instance); } catch (IllegalAccessException e) { LOGGER.log(Level.WARNING, "Please report to the respective component", e); f.setAccessible(true); return f.get(instance); } } @Override public boolean isStatic() { return Modifier.isStatic(f.getModifiers()); } @Override public Class<?> getReturnType() { return f.getType(); } @Override public String getSignature() { String prefix = isStatic() ? "staticField" : "field"; return StringUtils.join(Arrays.asList(prefix, f.getDeclaringClass().getName(), getName()), ' '); } @Override public String getQualifiedName() { return f.getDeclaringClass().getName()+"."+getName(); } @Override public boolean isRoutable() { return Modifier.isPublic(f.getModifiers()); } }; }
Source:
<code>public static Cohort intersect(Cohort a, Cohort b) { Cohort ret = new Cohort(); ret.setName("(" + (a == null ? "NULL" : a.getName()) + " * " + (b == null ? "NULL" : b.getName()) + ")"); List<CohortMembership> cohortMemberships = new ArrayList<CohortMembership>(); for(CohortMembership a_member: a.getMemberships()){ for(CohortMembership b_member: b.getMemberships()){ if(a_member.getPatientId() == b_member.getPatientId()){ if(a_member.getStartDate().before(b_member.getStartDate())){ <START> cohortMemberships.add(b_member); <END> } } } } ret.getMemberships().addAll(cohortMemberships); return ret; }</code><technical_language>Is check this loops? If x memberships, loop want for x*x times find it</technical_language>

Target:
public static Cohort intersect(Cohort a, Cohort b) { Cohort ret = new Cohort(); ret.setName("(" + (a == null ? "NULL" : a.getName()) + " * " + (b == null ? "NULL" : b.getName()) + ")"); List<CohortMembership> cohortMemberships = new ArrayList<CohortMembership>(); for(CohortMembership a_member: a.getMemberships()){ for(CohortMembership b_member: b.getMemberships()){ if(a_member.getPatientId() == b_member.getPatientId()){ if(a_member.getStartDate() != null && b_member.getStartDate() != null ) { cohortMemberships.add(a_member.getStartDate().before(b_member.getStartDate()) || a_member.getStartDate().equals(b_member.getStartDate()) ? b_member : a_member); } else { cohortMemberships.add(a_member.getStartDate() == null ? a_member : b_member); } } } } ret.getMemberships().addAll(cohortMemberships); return ret; }
Source:
<code>private LineData generateWeightData() { List<String> xVals = new ArrayList<>(); List<Entry> yVals = new ArrayList<>(); int k = 0; for (int i = presenter.getWeightReadings().size() - 1; i >= 0; i--) { float val = Float.parseFloat(presenter.getWeightReadings().get(i).toString()); yVals.add(new Entry(k, val)); k++; } for (int i = presenter.getWeightReadingsDateTime().size() - 1; i >= 0; i--) { String date = presenter.convertDate(presenter.getWeightReadingsDateTime().get(i)); <START> xVals.add(date + ""); <END> } xValues = xVals; return new LineData(generateLineDataSet(yVals, getResources().getColor(R.color.glucosio_fab_weight))); }</code><technical_language>add empty string</technical_language>

Target:
private LineData generateWeightData() { List<String> xVals = new ArrayList<>(); List<Entry> yVals = new ArrayList<>(); int k = 0; for (int i = presenter.getWeightReadings().size() - 1; i >= 0; i--) { float val = Float.parseFloat(presenter.getWeightReadings().get(i).toString()); yVals.add(new Entry(k, val)); k++; } for (int i = presenter.getWeightReadingsDateTime().size() - 1; i >= 0; i--) { String date = presenter.convertDate(presenter.getWeightReadingsDateTime().get(i)); xVals.add(date); } xValues = xVals; return new LineData(generateLineDataSet(yVals, getResources().getColor(R.color.glucosio_fab_weight))); }
Source:
<code>public void downloadFile(String urlPath, Path toFile) throws IOException { if (!urlPath.startsWith("/")) { throw new IllegalArgumentException(format("URL path must start with slash: %s", urlPath)); } String url = baseUrlWithoutTrailingSlash + urlPath; logger.debug(format("Download %s to %s", url, toFile.toAbsolutePath().toString())); ResponseBody responseBody = callUrl(url); try (InputStream in = responseBody.byteStream()) { Files.copy(in, toFile, StandardCopyOption.REPLACE_EXISTING); } catch (IOException | RuntimeException e) { Utils.deleteQuietly(toFile); throw e; <START> }finally { <END> responseBody.close(); } }</code><technical_language>A space is missing</technical_language>

Target:
public void downloadFile(String urlPath, Path toFile) throws IOException { if (!urlPath.startsWith("/")) { throw new IllegalArgumentException(format("URL path must start with slash: %s", urlPath)); } String url = baseUrlWithoutTrailingSlash + urlPath; logger.debug(format("Download %s to %s", url, toFile.toAbsolutePath().toString())); try (ResponseBody responseBody = callUrl(url); InputStream in = responseBody.byteStream()) { Files.copy(in, toFile, StandardCopyOption.REPLACE_EXISTING); } catch (IOException | RuntimeException e) { Utils.deleteQuietly(toFile); throw e; } }
Source:
<code>public RouterServerSSLTest(boolean testEncryption) { if (testEncryption) { <START> testFramework.setTestEncryption(); <END> } }</code><technical_language>This method in a boolean. This allow tests executed in order, instead of encryption staying enabled</technical_language>

Target:
public RouterServerSSLTest(boolean testEncryption) { testFramework.setTestEncryption(testEncryption); }
Source:
<code>private Organization loadOrganization(ScannerReport.Metadata reportMetadata) { try (DbSession dbSession = dbClient.openSession(false)) { <START> analysisMetadata.setOrganizationsEnabled(organizationFlags.isEnabled(dbSession)); <END> Organization organization = toOrganization(dbSession, ceTask.getOrganizationUuid()); checkOrganizationKeyConsistency(reportMetadata, organization); analysisMetadata.setOrganization(organization); return organization; } }</code><technical_language>minor: I call organizationFlags.isEnabled checkOrganizationKeyConsistency, if check fails, uselessly a call DB</technical_language>

Target:
private Organization loadOrganization(ScannerReport.Metadata reportMetadata) { try (DbSession dbSession = dbClient.openSession(false)) { Organization organization = toOrganization(dbSession, ceTask.getOrganizationUuid()); checkOrganizationKeyConsistency(reportMetadata, organization); analysisMetadata.setOrganization(organization); analysisMetadata.setOrganizationsEnabled(organizationFlags.isEnabled(dbSession)); return organization; } }
Source:
<code>public static void SYSCS_PERFORM_MAJOR_COMPACTION_ON_TABLE(String schemaName,String tableName) throws SQLException { LanguageConnectionContext lcc = (LanguageConnectionContext) ContextService.getContext(LanguageConnectionContext.CONTEXT_ID); assert lcc != null; DataDictionary dd = lcc.getDataDictionary(); PartitionFactory tableFactory = SIDriver.driver().getTableFactory(); schemaName = EngineUtils.validateSchema(schemaName); <START> tableName = EngineUtils.validateTable(tableName); <END> for (long conglomID : getConglomNumbers(getDefaultConn(), schemaName, tableName)) { try { ConglomerateDescriptor cd = dd.getConglomerateDescriptor(conglomID); if (cd != null) { TableDescriptor td = dd.getTableDescriptor(cd.getTableID()); if (td != null && td.isExternal()) continue; } } catch (StandardException e) { throw PublicAPI.wrapStandardException(Exceptions.parseException(e)); } try (Partition partition = tableFactory.getTable(Long.toString(conglomID))) { partition.compact(true); } catch (IOException e) { throw PublicAPI.wrapStandardException(Exceptions.parseException(e)); } } }</code><technical_language>failed due this, SYSCS_PERFORM_MAJOR_COMPACTION_ON_SCHEMA calls this function tableName set null. perform validate move logic a separate function called SYSCS_PERFORM_MAJOR_COMPACTION_ON_TABLE SYSCS_PERFORM_MAJOR_COMPACTION_ON_SCHEMA</technical_language>

Target:
public static void SYSCS_PERFORM_MAJOR_COMPACTION_ON_TABLE(String schemaName,String tableName) throws SQLException { LanguageConnectionContext lcc = (LanguageConnectionContext) ContextService.getContext(LanguageConnectionContext.CONTEXT_ID); assert lcc != null; DataDictionary dd = lcc.getDataDictionary(); PartitionFactory tableFactory = SIDriver.driver().getTableFactory(); schemaName = EngineUtils.validateSchema(schemaName); tableName = tableName == null ? null : EngineUtils.validateTable(tableName); for (long conglomID : getConglomNumbers(getDefaultConn(), schemaName, tableName)) { try { ConglomerateDescriptor cd = dd.getConglomerateDescriptor(conglomID); if (cd != null) { TableDescriptor td = dd.getTableDescriptor(cd.getTableID()); if (td != null && td.isExternal()) continue; } } catch (StandardException e) { throw PublicAPI.wrapStandardException(Exceptions.parseException(e)); } try (Partition partition = tableFactory.getTable(Long.toString(conglomID))) { partition.compact(true); } catch (IOException e) { throw PublicAPI.wrapStandardException(Exceptions.parseException(e)); } } }
Source:
<code>private void backoff(int numberOfAttempts) { try { long sleepMillis = (long) Math.pow(2, numberOfAttempts) * 50; <START> LOGGER.debug("Throttled by DynamoDB, sleeping for ms.", sleepMillis); <END> Thread.sleep(sleepMillis); } catch (InterruptedException e) { LOGGER.error("Interrupted while attempting exponential backoff."); } }</code><technical_language>this a WARN instead of a debug</technical_language>

Target:
private void backoff(int numberOfAttempts) { try { long sleepMillis = (long) Math.pow(2, numberOfAttempts) * 50; LOGGER.warn("Throttled by DynamoDB, sleeping for ms.", sleepMillis); Thread.sleep(sleepMillis); } catch (InterruptedException e) { LOGGER.error("Interrupted while attempting exponential backoff."); } }
Source:
<code>public static Query of(Query source) { Assert.notNull(source, "Source must not be null!"); Document sourceFields = source.getFieldsObject(); Document sourceSort = source.getSortObject(); Document sourceQuery = source.getQueryObject(); Query target = new Query() { @Override public Document getFieldsObject() { return BsonUtils.merge(sourceFields, super.getFieldsObject()); } @Override public Document getSortObject() { return BsonUtils.merge(sourceSort, super.getSortObject()); } @Override public Document getQueryObject() { return BsonUtils.merge(sourceQuery, super.getQueryObject()); } @Override public boolean isSorted() { return source.isSorted() || super.isSorted(); } }; Query theQuery = ProxyUtils.unwrapTargetSource(source); <START> target.skip = theQuery.skip; <END> target.limit = theQuery.limit; target.hint = theQuery.hint; target.collation = theQuery.collation; target.restrictedTypes.addAll(theQuery.restrictedTypes); if (source.getMeta().hasValues()) { target.setMeta(new Meta(source.getMeta())); } return target; }</code><technical_language>accessor methods instead of field access? way, omit kind of proxy handling</technical_language>

Target:
public static Query of(Query source) { Assert.notNull(source, "Source must not be null!"); Document sourceFields = source.getFieldsObject(); Document sourceSort = source.getSortObject(); Document sourceQuery = source.getQueryObject(); Query target = new Query() { @Override public Document getFieldsObject() { return BsonUtils.merge(sourceFields, super.getFieldsObject()); } @Override public Document getSortObject() { return BsonUtils.merge(sourceSort, super.getSortObject()); } @Override public Document getQueryObject() { return BsonUtils.merge(sourceQuery, super.getQueryObject()); } @Override public boolean isSorted() { return source.isSorted() || super.isSorted(); } }; target.skip = source.getSkip(); target.limit = source.getLimit(); target.hint = source.getHint(); target.collation = source.getCollation(); target.restrictedTypes.addAll(source.getRestrictedTypes()); if (source.getMeta().hasValues()) { target.setMeta(new Meta(source.getMeta())); } return target; }
Source:
<code>public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { HttpServletRequest req = (HttpServletRequest) request; HttpServletResponse resp = (HttpServletResponse) response; boolean persistentAuth = "persistent-auth".equals(req.getHeader("Prefer")); if (persistentAuth && (req.getHeader("Authorization") != null || !containsJessionId(req))) { if (req.getSession(false) != null) { req.getSession().removeAttribute(FiltersHelper.Constants.AUTHENTICATED_KEY); } } chain.doFilter(request, response); HttpSession session = req.getSession(false); if (session != null && Boolean.TRUE.equals(session.getAttribute(FiltersHelper.Constants.AUTHENTICATED_KEY))) { String engineSessionId = (String) session.getAttribute(FiltersHelper.Constants.ENGINE_SESSION_ID_KEY); if (!persistentAuth) { try { InitialContext ctx = new InitialContext(); VdcActionParametersBase params = new VdcActionParametersBase(); params.setSessionId(engineSessionId); FiltersHelper.getBackend(ctx).runAction(VdcActionType.LogoutBySession, params); session.invalidate(); <START> FiltersHelper.closeContext(ctx); <END> } catch (Exception ex) { log.error(String.format("Error in logout. Message is: %1$s", ex.getMessage())); if (log.isDebugEnabled()) { log.debug("", ex); } } } else { Cookie cookie = new Cookie("JESSIONID", engineSessionId); cookie.setPath("/api"); resp.addCookie(cookie); } } }</code><technical_language>->finally</technical_language>

Target:
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { try { HttpServletRequest req = (HttpServletRequest) request; HttpServletResponse resp = (HttpServletResponse) response; boolean persistentAuth = "persistent-auth".equals(req.getHeader("Prefer")); if (persistentAuth && (req.getHeader("Authorization") != null || !containsJessionId(req))) { if (req.getSession(false) != null) { req.getSession().removeAttribute(FiltersHelper.Constants.AUTHENTICATED_KEY); } } chain.doFilter(request, response); HttpSession session = req.getSession(false); if (session != null && Boolean.TRUE.equals(session.getAttribute(FiltersHelper.Constants.AUTHENTICATED_KEY))) { String engineSessionId = (String) session.getAttribute(FiltersHelper.Constants.ENGINE_SESSION_ID_KEY); if (!persistentAuth) { InitialContext ctx = new InitialContext(); try { VdcActionParametersBase params = new VdcActionParametersBase(); params.setSessionId(engineSessionId); FiltersHelper.getBackend(ctx).runAction(VdcActionType.LogoutBySession, params); session.invalidate(); } finally { FiltersHelper.closeContext(ctx); } } else { Cookie cookie = new Cookie("JESSIONID", engineSessionId); cookie.setPath("/api"); resp.addCookie(cookie); } } } catch (Exception ex) { log.error(String.format("Error in REST-API session management. Message is: %1$s", ex.getMessage())); if (log.isDebugEnabled()) { log.debug("", ex); } } }
Source:
<code>public Function<Solution_, Score<?>> createExtractor() { SolutionDescriptor<Solution_> solutionDescriptor = constraintConfigurationDescriptor.getSolutionDescriptor(); MemberAccessor constraintConfigurationMemberAccessor = solutionDescriptor.getConstraintConfigurationMemberAccessor(); return (Solution_ solution) -> { Object constraintConfiguration = Objects.requireNonNull(constraintConfigurationMemberAccessor.executeGetter(solution), "Constraint configuration provider (" + constraintConfigurationMemberAccessor + <START> ") is null."); <END> return (Score<?>) memberAccessor.executeGetter(constraintConfiguration); }; }</code><technical_language>suggestion ") returns null."); memberAccessor null, returns null</technical_language>

Target:
public Function<Solution_, Score<?>> createExtractor() { SolutionDescriptor<Solution_> solutionDescriptor = constraintConfigurationDescriptor.getSolutionDescriptor(); MemberAccessor constraintConfigurationMemberAccessor = solutionDescriptor.getConstraintConfigurationMemberAccessor(); return (Solution_ solution) -> { Object constraintConfiguration = Objects.requireNonNull(constraintConfigurationMemberAccessor.executeGetter(solution), "Constraint configuration provider (" + constraintConfigurationMemberAccessor + ") returns null."); return (Score<?>) memberAccessor.executeGetter(constraintConfiguration); }; }
Source:
<code>private AbstractTopology getTopology(StartAction startAction, Map<Integer, String> hostGroups, JoinCoordinator joinCoordinator) { AbstractTopology topology = null; Map<Integer, Integer> sitesPerHostMap = m_messenger.getSitesPerHostMapFromZK(); if (startAction == StartAction.JOIN) { assert(joinCoordinator != null); JSONObject topoJson = joinCoordinator.getTopology(); try { return AbstractTopology.topologyFromJSON(topoJson); } catch (JSONException e) { VoltDB.crashLocalVoltDB("Unable to get topology from Json object", true, e); } <START> } else if (!startAction.doesRejoin()) { <END> final Set<Integer> liveHostIds = m_messenger.getLiveHostIds(); Preconditions.checkArgument(hostGroups.keySet().equals(liveHostIds)); int hostcount = liveHostIds.size(); int kfactor = m_catalogContext.getDeployment().getCluster().getKfactor(); String errMsg = AbstractTopology.validateLegacyClusterConfig(hostcount, sitesPerHostMap, kfactor); if (errMsg != null) { VoltDB.crashLocalVoltDB(errMsg, false, null); } topology = AbstractTopology.getTopology(sitesPerHostMap, hostGroups, kfactor); TopologyZKUtils.registerTopologyToZK(m_messenger.getZK(), topology); } else { topology = TopologyZKUtils.readTopologyFromZK(m_messenger.getZK()); } return topology; }</code><technical_language>@zeemanhe This IF/ELSE IF/ELSE is hard read. do like: if (startAction == StartAction.JOIN) { } else if (startAction.doesRejoin()) { } else { ... }</technical_language>

Target:
private AbstractTopology getTopology(StartAction startAction, Map<Integer, String> hostGroups, JoinCoordinator joinCoordinator) { AbstractTopology topology = null; Map<Integer, Integer> sitesPerHostMap = m_messenger.getSitesPerHostMapFromZK(); if (startAction == StartAction.JOIN) { assert(joinCoordinator != null); JSONObject topoJson = joinCoordinator.getTopology(); try { topology = AbstractTopology.topologyFromJSON(topoJson); } catch (JSONException e) { VoltDB.crashLocalVoltDB("Unable to get topology from Json object", true, e); } } else if (startAction.doesRejoin()) { topology = TopologyZKUtils.readTopologyFromZK(m_messenger.getZK()); } else { final Set<Integer> liveHostIds = m_messenger.getLiveHostIds(); Preconditions.checkArgument(hostGroups.keySet().equals(liveHostIds)); int hostcount = liveHostIds.size(); int kfactor = m_catalogContext.getDeployment().getCluster().getKfactor(); String errMsg = AbstractTopology.validateLegacyClusterConfig(hostcount, sitesPerHostMap, kfactor); if (errMsg != null) { VoltDB.crashLocalVoltDB(errMsg, false, null); } topology = AbstractTopology.getTopology(sitesPerHostMap, hostGroups, kfactor); TopologyZKUtils.registerTopologyToZK(m_messenger.getZK(), topology); } return topology; }
Source:
<code>public DeleteBulkFactory(Settings settings, MetadataExtractor metaExtractor, EsMajorVersion version) { <START> super(settings.copy().setSerializerValueWriterClassName(NoDataWriter.class.getName()), metaExtractor, version); <END> }</code><technical_language>required if a new implementation of BulkCommand</technical_language>

Target:
public DeleteBulkFactory(Settings settings, MetadataExtractor metaExtractor, EsMajorVersion version) { super(settings, metaExtractor, version); }
Source:
<code>public OpenPacket(final Header header, final ByteBuf buffer, final PeerFlags flags) { this.header = Objects.requireNonNull(header); this.version = uint8(buffer); this.as = uint16(buffer); this.holdTime = uint16(buffer); this.id = InetAddressUtils.getInetAddress(bytes(buffer, 4)); final int parametersLength = uint8(buffer); final List<Parameter> list = repeatRemaining(slice(buffer, parametersLength), Parameter::new); <START> parameters = list.stream().filter(p -> p.type != 2).collect(Collectors.toList()); <END> capabilities = list.stream().filter(p -> p.type == 2).flatMap(p -> repeatRemaining(slice(p.value, p.length), Capability::new).stream()).collect(Collectors.toList()); }</code><technical_language>I filter parameters, capabilities parameters, too. link rfc for reference parameter types, if any</technical_language>

Target:
public OpenPacket(final Header header, final ByteBuf buffer, final PeerFlags flags) { this.header = Objects.requireNonNull(header); this.version = uint8(buffer); this.as = uint16(buffer); this.holdTime = uint16(buffer); this.id = InetAddressUtils.getInetAddress(bytes(buffer, 4)); final int parametersLength = uint8(buffer); this.parameters = repeatRemaining(slice(buffer, parametersLength), Parameter::new); this.capabilities = this.parameters.stream().filter(p -> p.type == 2).flatMap(p -> repeatRemaining(slice(p.value, p.length), Capability::new).stream()).collect(Collectors.toList()); }
Source:
<code>private void setSecureStorageMasterPasswords(boolean checked) { WorkbenchPreferenceDialog preferenceDialog = new WorkbenchPreferenceDialog(); StoragePreferencePage storagePage = new StoragePreferencePage(preferenceDialog); preferenceDialog.open(); preferenceDialog.select(storagePage); try { new WaitUntil(new WidgetIsFound( org.eclipse.swt.custom.CLabel.class, <START> new WithMnemonicTextMatcher("Secure Storage")), END> TimePeriod.DEFAULT); log.info("Getting master password providers"); List<PasswordProvider> items = storagePage.getMasterPasswordProviders(); for (PasswordProvider item : items) { log.info("Uncheking table item: " + item.getDescription()); item.setEnabled(checked); } new WaitUntil(new JobIsRunning(), TimePeriod.DEFAULT, false); storagePage.apply(); } catch (WaitTimeoutExpiredException exc) { log.error("Secure Storage preferences page has timed out"); log.error(exc.getMessage()); } finally { preferenceDialog.ok(); } }</code><technical_language>@odockal this moved in labels class</technical_language>

Target:
private void setSecureStorageMasterPasswords(boolean checked) { WorkbenchPreferenceDialog preferenceDialog = new WorkbenchPreferenceDialog(); StoragePreferencePage storagePage = new StoragePreferencePage(preferenceDialog); preferenceDialog.open(); preferenceDialog.select(storagePage); try { new WaitUntil(new WidgetIsFound( org.eclipse.swt.custom.CLabel.class, new WithMnemonicTextMatcher(CDKLabel.Labels.SECURE_STORAGE)), TimePeriod.DEFAULT); log.info("Getting master password providers"); List<PasswordProvider> items = storagePage.getMasterPasswordProviders(); for (PasswordProvider item : items) { log.info("Uncheking table item: " + item.getDescription()); item.setEnabled(checked); } new WaitUntil(new JobIsRunning(), TimePeriod.DEFAULT, false); storagePage.apply(); } catch (WaitTimeoutExpiredException exc) { log.error("Secure Storage preferences page has timed out"); log.error(exc.getMessage()); } finally { preferenceDialog.ok(); } }
Source:
<code>public void testNominal() { int count = new java.util.Random().nextInt(10) + 3; Variables.register("count", count); for(int i = 0; i < count; i++) { Object key = Random.getObject(); Long value = Random.getLong(); <START> Variables.register("key", key); <END> Variables.register("value", value); map.insert(key, value); } Assert.assertEquals(VariableType.NOMINAL, map.variableType()); }</code><technical_language>get overwritten iteration of loop, need keys "key_"+i "value_"+i. Also, create object Object key = Variables.register("key_"+i, Random.getObject());</technical_language>

Target:
public void testNominal() { int count = new java.util.Random().nextInt(10) + 3; Variables.register("count", count); for(int i = 0; i < count; i++) { Object key = Variables.register("key_"+i, Random.getObject()); Long value = Variables.register("value_"+i, Random.getLong()); map.insert(key, value); } Assert.assertEquals(VariableType.NOMINAL, map.variableType()); }
Source:
<code>private static int scoreFilter(Map<Subfield, TupleDomainFilter> filters){ <START> final int lowestScore = 10; <END> final int lowScore = 50; final int mediumScore = 100; final int maxScore = 1000; checkArgument(!filters.isEmpty()); if (filters.size() > 1){ return maxScore; } checkArgument(filters.size() == 1); Map.Entry<Subfield, TupleDomainFilter> filter = Iterables.getOnlyElement(filters.entrySet()); if(! filter.getKey().getPath().isEmpty()){ return maxScore; } TupleDomainFilter tdf = filter.getValue(); if(tdf instanceof BigintRange) { if(((BigintRange) tdf).isSingleValue()){ return lowestScore; } return lowScore; } if(tdf instanceof BigintValues || tdf instanceof BigintMultiRange) { return lowScore; } return mediumScore; }</code><technical_language>final for local variables - constants need defined private static final member variables names caps underscore separators, e.g. private static final int LOWEST_SCORE = 10; - in this case though, I is inline values. private static int scoreFilter(Map<Subfield, TupleDomainFilter> filters) { checkArgument(!filters.isEmpty()); if (filters.size() > 1){ // Complex type column. Complex types expensive! return 1000; } Map.Entry<Subfield, TupleDomainFilter> filterEntry = Iterables.getOnlyElement(filters.entrySet()); if (!filterEntry.getKey().getPath().isEmpty()){ // Complex type column. Complex types expensive! return 1000; } TupleDomainFilter filter = filterEntry.getValue(); if(filter instanceof BigintRange) { if(((BigintRange) filter).isSingleValue()){ // Integer equality. Generally cheap. return 10; } return 50; } if(filter instanceof BigintValues || filter instanceof BigintMultiRange) { return 50; } return 100; }</technical_language>

Target:
private static int scoreFilter(Map<Subfield, TupleDomainFilter> filters) { checkArgument(!filters.isEmpty()); if (filters.size() > 1) { return 1000; } Map.Entry<Subfield, TupleDomainFilter> filterEntry = Iterables.getOnlyElement(filters.entrySet()); if (!filterEntry.getKey().getPath().isEmpty()) { return 1000; } TupleDomainFilter filter = filterEntry.getValue(); if (filter instanceof BigintRange) { if (((BigintRange) filter).isSingleValue()) { return 10; } return 50; } if (filter instanceof BigintValues || filter instanceof BigintMultiRange) { return 50; } return 100; }
Source:
<code>public void testInsertIntoPartitionedWithSerdePropety() { String tableName = "target_partitioned_with_serde_property"; <START> query(format("DROP TABLE IF EXISTS %s", tableName)); <END> String query = format( "CREATE TABLE %s(" + "id int," + "name string" + ")" + "PARTITIONED BY (dt string)" + "ROW FORMAT SERDE 'org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe'" + "WITH SERDEPROPERTIES (" + "'field.delim'='\\t'," + "'line.delim'='\\n'," + "'serialization.format'='\\t'" + ")", tableName); onHive().executeQuery(query); assertThat(query("SELECT * FROM " + tableName)).hasNoRows(); assertThat(query("INSERT INTO " + tableName + " SELECT 1, 'presto', '2018-01-01'")).containsExactly(row(1)); assertThat(query("SELECT * FROM " + tableName)).containsOnly( row( 1, "presto", "2018-01-01")); query(format("DROP TABLE %s", tableName)); }</code><technical_language>needed</technical_language>

Target:
public void testInsertIntoPartitionedWithSerdePropety() { String tableNameInDatabase = mutableTablesState().get(PARTITIONED_TABLE_WITH_SERDE).getNameInDatabase(); assertThat(query("INSERT INTO " + tableNameInDatabase + " SELECT 1, 'presto', '2018-01-01'")).containsExactly(row(1)); assertThat(query("SELECT * FROM " + tableNameInDatabase)).containsExactly(row(1, "presto", "2018-01-01")); }
Source:
<code><START> public Report getReport() { return this.report; } <END></code><technical_language>for you. change class AssetReport</technical_language>

Target:
public AssetReport getReport() { return this.report; }
Source:
<code>public void logResourceModification(Object resource, Map<String, Object> data, AuditEventType eventType, String description, Long accountId, String clientIp) { if (data != null) { putInAsString(data, "resource", "Failed to convert resource to json.", resource); } publishEvent(auditLogDao.create(objectManager.getType(resource), parseId(String.valueOf(ObjectUtils.getId(resource))), <START> data, null, accountId, null, eventType.toString(), null, null, description, clientIp)); <END> }</code><technical_language>EventType put publishEvent method, constructed similar API counterpart: resourceType.actionType. Example: service.update. instead of eventType.toString(), objectManager.getType(resource) + "." + eventType.toString()</technical_language>

Target:
public void logResourceModification(Object resource, Map<String, Object> data, AuditEventType eventType, String description, Long accountId, String clientIp) { if (data != null) { putInAsString(data, "resource", "Failed to convert resource to json.", resource); } String event = objectManager.getType(resource) + "." + eventType.toString(); publishEvent(auditLogDao.create(objectManager.getType(resource), parseId(String.valueOf(ObjectUtils.getId(resource))), data, null, accountId, null, event, null, null, description, clientIp)); }
Source:
<code>private static Map<EClass, Integer> inferRootElementsCandidates(EPackage ePackage, Collection<EClass> concreteClasses) { Map<EClass, Integer> eClassToRootScore = new HashMap<>(); <START> eClassToRootScore.clear(); <END> List<EClass> allClasses = ePackage.getEClassifiers().stream().filter(c -> c instanceof EClass).map(c -> (EClass) c).collect(Collectors.toList()); for (EClass eClass : concreteClasses) { if (eClass.getEAllReferences().stream().anyMatch(EReference::isContainment)) { int importance = getReferenceScore(eClass, allClasses); if (importance != -1) { eClassToRootScore.put(eClass, importance); } } } return eClassToRootScore; }</code><technical_language>created this, need clear (probably a leftover a previous version)</technical_language>

Target:
private static Map<EClass, Integer> inferRootElementsCandidates(EPackage ePackage, Collection<EClass> concreteClasses) { Map<EClass, Integer> eClassToRootScore = new HashMap<>(); List<EClass> allClasses = ePackage.getEClassifiers().stream().filter(c -> c instanceof EClass).map(c -> (EClass) c).collect(Collectors.toList()); for (EClass eClass : concreteClasses) { if (eClass.getEAllReferences().stream().anyMatch(EReference::isContainment)) { int importance = getReferenceScore(eClass, allClasses); if (importance != -1) { eClassToRootScore.put(eClass, importance); } } } return eClassToRootScore; }
Source:
<code>public Color getBackground(Object aElement, int aColumnIndex) { if (aElement instanceof GerritTask) { GerritTask item = (GerritTask) aElement; String state = item.getAttribute(GerritTask.IS_STARRED); if (state != null) { <START> if (state.equals("true")) { END> return INCOMING_COLOR; } else if (state.equals("false")) { return CLOSED_COLOR; } } } return DEFAULT_COLOR; }</code><technical_language>Boolean.toString(true)</technical_language>

Target:
public Color getBackground(Object aElement, int aColumnIndex) { if (aElement instanceof GerritTask) { GerritTask item = (GerritTask) aElement; String state = item.getAttribute(GerritTask.IS_STARRED); if (state != null) { if (state.equals(Boolean.toString(true))) { return INCOMING_COLOR; } else if (state.equals(Boolean.toString(false))) { return CLOSED_COLOR; } } } return DEFAULT_COLOR; }
Source:
<code>public void declarative() throws Exception { <START> WorkflowJob p = r.jenkins.createProject(WorkflowJob.class, "job with dir"); <END> p.setDefinition(new CpsFlowDefinition(loadPipelineScript("declarativePod.groovy"), true)); WorkflowRun b = p.scheduleBuild2(0).waitForStart(); assertNotNull(b); r.assertBuildStatusSuccess(r.waitForCompletion(b)); r.assertLogContains("Apache Maven 3.3.9", b); r.assertLogContains("INSIDE_CONTAINER_ENV_VAR = " + CONTAINER_ENV_VAR_VALUE + "\n", b); }</code><technical_language>"declarative pipeline podTemplate"</technical_language>

Target:
public void declarative() throws Exception { WorkflowJob p = r.jenkins.createProject(WorkflowJob.class, "declarative pipeline with podTemplate"); p.setDefinition(new CpsFlowDefinition(loadPipelineScript("declarativePod.groovy"), true)); WorkflowRun b = p.scheduleBuild2(0).waitForStart(); assertNotNull(b); r.assertBuildStatusSuccess(r.waitForCompletion(b)); r.assertLogContains("Apache Maven 3.3.9", b); r.assertLogContains("INSIDE_CONTAINER_ENV_VAR = " + CONTAINER_ENV_VAR_VALUE + "\n", b); }
Source:
<code>public <T> T execute(ChannelCallback<T> action) { <START> return doExecute(action, false); <END> }</code><technical_language>false again</technical_language>

Target:
public <T> T execute(ChannelCallback<T> action) { return execute(action, getConnectionFactory()); }
Source:
<code>static Key sanityCheck(Key prev, Key current, Key shortened) { if (prev.compareTo(shortened) >= 0) { <START> LoggerFactory.getLogger(KeyShortener.class).warn("Bug in key shortening code, please open an issue " + prev + " >= " + shortened); <END> return null; } if (current.compareTo(shortened) <= 0) { LoggerFactory.getLogger(KeyShortener.class).warn("Bug in key shortening code, please open an issue " + current + " <= " + shortened); return null; } return shortened; }</code><technical_language>Logger instance</technical_language>

Target:
static Key sanityCheck(Key prev, Key current, Key shortened) { if (prev.compareTo(shortened) >= 0) { log.warn("Bug in key shortening code, please open an issue " + prev + " >= " + shortened); return prev; } if (current.compareTo(shortened) <= 0) { log.warn("Bug in key shortening code, please open an issue " + current + " <= " + shortened); return prev; } return shortened; }
Source:
<code>public void clearChatBox(){ <START> if(TextUtils.isEmpty(messageEt.getText())){ <END> topicActv.setText(""); streamActv.setText(""); } }</code><technical_language>verifying messageEt is null attempting clear prevent NPE</technical_language>

Target:
public void clearChatBox() { if (messageEt != null) { if (TextUtils.isEmpty(messageEt.getText())) { topicActv.setText(""); streamActv.setText(""); } } }
Source:
<code><START> public static void applyClusteredReadPositionFilter(final M2ArgumentCollection MTAC, final VariantContext vc, final Collection<String> filters) { <END> if (MTAC.ENABLE_CLUSTERED_READ_POSITION_FILTER) { final Double tumorFwdPosMedian = (Double) vc.getAttribute(GATKVCFConstants.MEDIAN_LEFT_OFFSET_KEY); final Double tumorRevPosMedian = (Double) vc.getAttribute(GATKVCFConstants.MEDIAN_RIGHT_OFFSET_KEY); final Double tumorFwdPosMAD = (Double) vc.getAttribute(GATKVCFConstants.MAD_MEDIAN_LEFT_OFFSET_KEY); final Double tumorRevPosMAD = (Double) vc.getAttribute(GATKVCFConstants.MAD_MEDIAN_RIGHT_OFFSET_KEY); if ((tumorFwdPosMedian != null && tumorFwdPosMedian <= MTAC.PIR_MEDIAN_THRESHOLD && tumorFwdPosMAD != null && tumorFwdPosMAD <= MTAC.PIR_MAD_THRESHOLD) || (tumorRevPosMedian != null && tumorRevPosMedian <= MTAC.PIR_MEDIAN_THRESHOLD && tumorRevPosMAD != null && tumorRevPosMAD <= MTAC.PIR_MAD_THRESHOLD)) filters.add(GATKVCFConstants.CLUSTERED_READ_POSITION_FILTER_NAME); } }</code><technical_language>apply*Filter() methods private</technical_language>

Target:
private static void applyClusteredReadPositionFilter(final M2ArgumentCollection MTAC, final VariantContext vc, final Collection<String> filters) { if (MTAC.ENABLE_CLUSTERED_READ_POSITION_FILTER) { final Double tumorFwdPosMedian = (Double) vc.getAttribute(GATKVCFConstants.MEDIAN_LEFT_OFFSET_KEY); final Double tumorRevPosMedian = (Double) vc.getAttribute(GATKVCFConstants.MEDIAN_RIGHT_OFFSET_KEY); final Double tumorFwdPosMAD = (Double) vc.getAttribute(GATKVCFConstants.MAD_MEDIAN_LEFT_OFFSET_KEY); final Double tumorRevPosMAD = (Double) vc.getAttribute(GATKVCFConstants.MAD_MEDIAN_RIGHT_OFFSET_KEY); if ((tumorFwdPosMedian != null && tumorFwdPosMedian <= MTAC.PIR_MEDIAN_THRESHOLD && tumorFwdPosMAD != null && tumorFwdPosMAD <= MTAC.PIR_MAD_THRESHOLD) || (tumorRevPosMedian != null && tumorRevPosMedian <= MTAC.PIR_MEDIAN_THRESHOLD && tumorRevPosMAD != null && tumorRevPosMAD <= MTAC.PIR_MAD_THRESHOLD)) filters.add(GATKVCFConstants.CLUSTERED_READ_POSITION_FILTER_NAME); } }
Source:
<code>protected PlanNodeStatsEstimate visitBetweenPredicate(BetweenPredicate node, Void context) { if (!(node.getValue() instanceof SymbolReference) || !(node.getMin() instanceof Literal) || !(node.getMax() instanceof Literal)) { return visitExpression(node, context); } SymbolStatsEstimate valueStats = input.getSymbolStatistics(Symbol.from(node.getValue())); Expression leftComparison; Expression rightComparison; if (isInfinite(valueStats.getLowValue())) { leftComparison = new ComparisonExpression(GREATER_THAN_OR_EQUAL, node.getValue(), node.getMin()); rightComparison = new ComparisonExpression(LESS_THAN_OR_EQUAL, node.getValue(), node.getMax()); } else { rightComparison = new ComparisonExpression(GREATER_THAN_OR_EQUAL, node.getValue(), node.getMin()); leftComparison = new ComparisonExpression(LESS_THAN_OR_EQUAL, node.getValue(), node.getMax()); } <START> <END> return process(and(leftComparison, rightComparison)); }</code><technical_language>this subtract of inList predicates OR? (relevant e.g. if duplicate values)</technical_language>

Target:
protected PlanNodeStatsEstimate visitBetweenPredicate(BetweenPredicate node, Void context) { if (!(node.getValue() instanceof SymbolReference) || !(node.getMin() instanceof Literal) || !(node.getMax() instanceof Literal)) { return visitExpression(node, context); } SymbolStatsEstimate valueStats = input.getSymbolStatistics(Symbol.from(node.getValue())); Expression lowerBound = new ComparisonExpression(GREATER_THAN_OR_EQUAL, node.getValue(), node.getMin()); Expression upperBound = new ComparisonExpression(LESS_THAN_OR_EQUAL, node.getValue(), node.getMax()); Expression transformed; if (isInfinite(valueStats.getLowValue())) { transformed = and(lowerBound, upperBound); } else { transformed = and(upperBound, lowerBound); } return process(transformed); }
Source:
<code><START> private ServiceTicket createServiceTicket() { <END> val mock = mock(ServiceTicket.class); when(mock.getService()).thenReturn(createService()); return mock; }</code><technical_language>remove, similar functionality in MockServiceTicket</technical_language>

Target:
private ServiceTicket createServiceTicket() { val mock = mock(ServiceTicket.class); val service = createService(); when(mock.getService()).thenReturn(service); return mock; }