auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code><START> public static void init(String sqlDialect) { <END> emf = Persistence.createEntityManagerFactory("aggregationStore"); EntityManager em = emf.createEntityManager(); em.getTransaction().begin(); em.createNativeQuery("DROP ALL OBJECTS;").executeUpdate(); em.createNativeQuery("RUNSCRIPT FROM 'classpath:create_tables.sql'").executeUpdate(); em.getTransaction().commit(); HikariConfig config = new HikariConfig(); config.setDriverClassName(emf.getProperties().get("javax.persistence.jdbc.driver").toString()); config.setJdbcUrl(emf.getProperties().get("javax.persistence.jdbc.url").toString()); DataSource dataSource = new HikariDataSource(config); metaDataStore = new MetaDataStore(ClassScanner.getAllClasses("com.yahoo.elide.datastores.aggregation.example")); dictionary = new EntityDictionary(new HashMap<>()); dictionary.bindEntity(PlayerStatsWithView.class); dictionary.bindEntity(PlayerStatsView.class); dictionary.bindEntity(PlayerStats.class); dictionary.bindEntity(Country.class); dictionary.bindEntity(SubCountry.class); dictionary.bindEntity(Player.class); dictionary.bindEntity(CountryView.class); dictionary.bindEntity(CountryViewNested.class); dictionary.bindEntity(Continent.class); filterParser = new RSQLFilterDialect(dictionary); metaDataStore.populateEntityDictionary(dictionary); engine = new SQLQueryEngine(metaDataStore, dataSource, sqlDialect); TableId tableId = new TableId("playerStats", "", ""); playerStatsTable = engine.getTable(tableId); ASIA.setName("Asia"); ASIA.setId("1"); NA.setName("North America"); NA.setId("2"); HONG_KONG.setIsoCode("HKG"); HONG_KONG.setName("Hong Kong"); HONG_KONG.setId("344"); HONG_KONG.setContinent(ASIA); USA.setIsoCode("USA"); USA.setName("United States"); USA.setId("840"); USA.setContinent(NA); }</code><technical_language>This Argument of Type SQLDialect</technical_language>

Target:
public static void init(String sqlDialect) { HikariConfig config = new HikariConfig(File.separator + "jpah2db.properties"); DataSource dataSource = new HikariDataSource(config); try (Connection h2Conn = dataSource.getConnection()) { h2Conn.createStatement().execute("RUNSCRIPT FROM 'classpath:prepare_tables.sql'"); } catch (SQLException e) { ((HikariDataSource) dataSource).close(); throw new IllegalStateException(e); } metaDataStore = new MetaDataStore(ClassScanner.getAllClasses("com.yahoo.elide.datastores.aggregation.example")); dictionary = new EntityDictionary(new HashMap<>()); dictionary.bindEntity(PlayerStatsWithView.class); dictionary.bindEntity(PlayerStatsView.class); dictionary.bindEntity(PlayerStats.class); dictionary.bindEntity(Country.class); dictionary.bindEntity(SubCountry.class); dictionary.bindEntity(Player.class); dictionary.bindEntity(CountryView.class); dictionary.bindEntity(CountryViewNested.class); dictionary.bindEntity(Continent.class); filterParser = new RSQLFilterDialect(dictionary); metaDataStore.populateEntityDictionary(dictionary); engine = new SQLQueryEngine(metaDataStore, new ConnectionDetails(dataSource, sqlDialect)); TableId tableId = new TableId("playerStats", "", ""); playerStatsTable = engine.getTable(tableId); }
Source:
<code>public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ((WordPress) getActivity().getApplication()).component().inject(this); if (savedInstanceState == null) { mSite = (SiteModel) getActivity().getIntent().getSerializableExtra(WordPress.SITE); mBrowserType = (MediaBrowserType) getActivity().getIntent().getSerializableExtra(MediaBrowserActivity.ARG_BROWSER_TYPE); <START> mImagesOnly = getActivity().getIntent().getBooleanExtra(MediaBrowserActivity.ARG_IMAGES_ONLY, false); <END> } else { mSite = (SiteModel) savedInstanceState.getSerializable(WordPress.SITE); mBrowserType = (MediaBrowserType) savedInstanceState.getSerializable(MediaBrowserActivity.ARG_BROWSER_TYPE); mImagesOnly = savedInstanceState.getBoolean(MediaBrowserActivity.ARG_IMAGES_ONLY); } if (mSite == null) { ToastUtils.showToast(getActivity(), R.string.blog_not_found, ToastUtils.Duration.SHORT); getActivity().finish(); } }</code><technical_language>a question, instead of introducing a new variable mImagesOnly here, set mFilter = Filter.IMAGES; getActivity().getIntent().getBooleanExtra(MediaBrowserActivity.ARG_IMAGES_ONLY, false); is true? saveState restoreState change</technical_language>

Target:
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ((WordPress) getActivity().getApplication()).component().inject(this); if (savedInstanceState == null) { mSite = (SiteModel) getActivity().getIntent().getSerializableExtra(WordPress.SITE); mBrowserType = (MediaBrowserType) getActivity().getIntent().getSerializableExtra(MediaBrowserActivity.ARG_BROWSER_TYPE); boolean imagesOnly = getActivity().getIntent().getBooleanExtra(MediaBrowserActivity.ARG_IMAGES_ONLY, false); if (imagesOnly) { mFilter = Filter.IMAGES; } } else { mSite = (SiteModel) savedInstanceState.getSerializable(WordPress.SITE); mBrowserType = (MediaBrowserType) savedInstanceState.getSerializable(MediaBrowserActivity.ARG_BROWSER_TYPE); } if (mSite == null) { ToastUtils.showToast(getActivity(), R.string.blog_not_found, ToastUtils.Duration.SHORT); getActivity().finish(); } }
Source:
<code><START> Priority getPriority() { <END> Priority priority = Priority.LOW; boolean hasMultiple = actions != null && !actions.isEmpty(); if (actions != null && !hasMultiple) { return priority; } if (action != null) { priority = action.getPriority(); } if (hasMultiple) { for (int i = 0, n = actions.size(); i < n; i++) { Priority actionPriority = actions.get(i).getPriority(); if (actionPriority.ordinal() > priority.ordinal()) { priority = actionPriority; } } } return priority; }</code><technical_language>This is expensive computationally. I track this in a field update requests attached/detached Action. This computation incremental access cheap (the of is essential priority queue is calling compateTo multiple times)</technical_language>

Target:
Priority getPriority() { return priority; }
Source:
<code>void applied(long msgId) { inProgressMessages.computeIfPresent(msgId, ((id, state) -> state = true)); if (lwmLock.tryLock()) { try { for (long i = lowerWaterMark + 1; i<= higerWaterMark.get(); i++) { final AtomicBoolean removed = new AtomicBoolean(false); inProgressMessages.computeIfPresent(i, (id, state) -> { <START> if (state == true) { <END> removed.set(true); return null; } return state; }); if (removed.get()) { lowerWaterMark ++; } else { break; } } } finally { lwmLock.unlock(); } } }</code><technical_language>state is a boolean - need _compare_</technical_language>

Target:
void applied(long msgId) { inProgressMessages.computeIfPresent(msgId, ((id, state) -> state = true)); updateLowerWaterMark(); }
Source:
<code>public String getReplicaPath() { <START> return getMountPath() + File.separator + GetRequest.Cloud_Replica_Keyword + File.separator <END> + partitionId.toPathString(); }</code><technical_language>minor: prefer Cloud_Replica_Keyword mount path order path granular</technical_language>

Target:
public String getReplicaPath() { return GetRequest.Cloud_Replica_Keyword + File.separator + getMountPath() + File.separator + partitionId.toPathString(); }
Source:
<code><START> public SimpleDateFormat getSimpleDateFormat() { <END> if (simpleDateFormat == null) { simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'", Locale.ROOT); simpleDateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); } return simpleDateFormat; }</code><technical_language>more state => more branches => more bugs, is a strong reason default lazy initialization? This a stateless final nonnull if initialize declaration. said, want skip member variable altogether[0] switch Joda time[1]. [0] <LINK_1> [1] <LINK_0></technical_language>

Target:
public SimpleDateFormat getSimpleDateFormat() { SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'", Locale.ROOT); simpleDateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); return simpleDateFormat; }
Source:
<code>protected QueryExecutionEngine createEngine( Dependencies deps, GraphDatabaseAPI graphAPI ) { GraphDatabaseCypherService queryService = new GraphDatabaseCypherService( graphAPI ); deps.satisfyDependency( queryService ); DependencyResolver resolver = graphAPI.getDependencyResolver(); LogService logService = resolver.resolveDependency( LogService.class ); KernelAPI kernelAPI = resolver.resolveDependency( KernelAPI.class ); Monitors monitors = resolver.resolveDependency( Monitors.class ); LogProvider logProvider = logService.getInternalLogProvider(); CommunityCompatibilityFactory inner = new CommunityCompatibilityFactory( queryService, kernelAPI, monitors, logProvider ); EnterpriseCompatibilityFactory compatibilityFactory = new EnterpriseCompatibilityFactory( inner, queryService, kernelAPI, monitors, logProvider ); deps.satisfyDependency( compatibilityFactory ); try { <START> deps.resolveDependency( Procedures.class ).registerProcedure( QueryEngineProcedures.class ); <END> } catch ( KernelException e ) { throw new IllegalStateException( "Failed to register QueryEngineProcedures", e ); } return new ExecutionEngine( queryService, logProvider, compatibilityFactory ); }</code><technical_language>this done <LINK_0></technical_language>

Target:
protected QueryExecutionEngine createEngine( Dependencies deps, GraphDatabaseAPI graphAPI ) { GraphDatabaseCypherService queryService = new GraphDatabaseCypherService( graphAPI ); deps.satisfyDependency( queryService ); DependencyResolver resolver = graphAPI.getDependencyResolver(); LogService logService = resolver.resolveDependency( LogService.class ); KernelAPI kernelAPI = resolver.resolveDependency( KernelAPI.class ); Monitors monitors = resolver.resolveDependency( Monitors.class ); LogProvider logProvider = logService.getInternalLogProvider(); CommunityCompatibilityFactory inner = new CommunityCompatibilityFactory( queryService, kernelAPI, monitors, logProvider ); EnterpriseCompatibilityFactory compatibilityFactory = new EnterpriseCompatibilityFactory( inner, queryService, kernelAPI, monitors, logProvider ); deps.satisfyDependency( compatibilityFactory ); return new ExecutionEngine( queryService, logProvider, compatibilityFactory ); }
Source:
<code>public Set<TopicRef> mapGenresToTopicRefs(Set<String> genres) { <START> Set<String> tags = new HashSet<>(genres.size() + 1); END> for (String genre : genres) { if (genre.contains("<LINK_0>")) { String tag = paTagMap.get(genre); if (tag != null) { tags.add(tag); } } } if (tags.size() == 1 && tags.contains("film")) { tags.add("action"); } return getTopicRefFromTags(tags); }</code><technical_language>Sets Maps contains useful static constructors fyi</technical_language>

Target:
public Set<TopicRef> mapGenresToTopicRefs(Set<String> genres) { Set<String> tags = Sets.newHashSet(); for (String genre : genres) { if (genre.contains("<LINK_0>")) { String tag = paTagMap.get(genre); if (tag != null) { tags.add(tag); } } } if (tags.size() == 1 && tags.contains("film")) { tags.add("action"); } return getTopicRefFromTags(tags); }
Source:
<code>private boolean validateHostPort(String string) { try { URI uri = new URI("my://" + string); if (uri.getHost() == null || uri.getPort() == -1) { <START> throw new URISyntaxException(uri.toString(), "URI must have host and port parts"); <END> } } catch (URISyntaxException ex) { return false; } return true; }</code><technical_language>return false better</technical_language>

Target:
private boolean validateHostPort(String string) { try { URI uri = new URI("my://" + string); if (uri.getHost() == null || uri.getPort() == -1) { return false; } } catch (URISyntaxException ex) { return false; } return true; }
Source:
<code><START> public SpatialIndexBuilderOperator( <END> OperatorContext operatorContext, PagesSpatialIndexFactory pagesSpatialIndexFactory, List<Integer> outputChannels, int indexChannel, BiPredicate<OGCGeometry, OGCGeometry> spatialRelationshipTest, Optional<JoinFilterFunctionFactory> filterFunctionFactory, int expectedPositions, PagesIndex.Factory pagesIndexFactory) { this.operatorContext = operatorContext; this.localUserMemoryContext = operatorContext.localUserMemoryContext(); this.spatialRelationshipTest = spatialRelationshipTest; this.filterFunctionFactory = filterFunctionFactory; this.index = pagesIndexFactory.newPagesIndex(pagesSpatialIndexFactory.getTypes(), expectedPositions); this.pagesSpatialIndexFactory = pagesSpatialIndexFactory; this.outputChannels = outputChannels; this.indexChannel = indexChannel; }</code><technical_language>this class private</technical_language>

Target:
private SpatialIndexBuilderOperator( OperatorContext operatorContext, PagesSpatialIndexFactory pagesSpatialIndexFactory, List<Integer> outputChannels, int indexChannel, BiPredicate<OGCGeometry, OGCGeometry> spatialRelationshipTest, Optional<JoinFilterFunctionFactory> filterFunctionFactory, int expectedPositions, PagesIndex.Factory pagesIndexFactory) { this.operatorContext = requireNonNull(operatorContext, "operatorContext is null"); this.localUserMemoryContext = operatorContext.localUserMemoryContext(); this.spatialRelationshipTest = requireNonNull(spatialRelationshipTest, "spatialRelationshipTest is null"); this.filterFunctionFactory = filterFunctionFactory; this.pagesSpatialIndexFactory = requireNonNull(pagesSpatialIndexFactory, "pagesSpatialIndexFactory is null"); this.index = pagesIndexFactory.newPagesIndex(pagesSpatialIndexFactory.getTypes(), expectedPositions); this.outputChannels = requireNonNull(outputChannels, "outputChannels is null"); this.indexChannel = indexChannel; }
Source:
<code>private Set<SignatureAlgorithm> fetchSignatureAlgorithms() { if (StringUtils.isEmpty(jwkSetUri)) { return Collections.emptySet(); } try { <START> return parseAlgorithms(JWKSet.load(toURL(jwkSetUri), 5000, 5000, 0)); <END> } catch (Exception ex) { log.error("Failed to load Signature Algorithms from remote JWK source."); return Collections.emptySet(); } }</code><technical_language>please JWKSource retrieve JWKs. allow a JWKMatcher removes some of validation in parseAlgorithms</technical_language>

Target:
private Set<SignatureAlgorithm> fetchSignatureAlgorithms() { try { return parseAlgorithms(JWKSet.load(toURL(jwkSetUri), 5000, 5000, 0)); } catch (Exception ex) { throw new IllegalArgumentException("Failed to load Signature Algorithms from remote JWK source.", ex); } }
Source:
<code>public void testExecuteAndPostProcess() { InstructorAttributes instructor1ofCourse1 = dataBundle.instructors.get("instructor1OfCourse1"); FeedbackSessionAttributes fs = dataBundle.feedbackSessions.get("session1InCourse1"); InstructorFeedbackRemindAction action; RedirectResult rr; ______TS("Unsuccessful case: Not owned Course/Modify Permission, authentication failure"); String[] paramsNotOwnedCourse = new String[] { Const.ParamsNames.COURSE_ID, fs.getCourseId(), Const.ParamsNames.FEEDBACK_SESSION_NAME, fs.getSessionName(), }; verifyUnaccessibleForInstructorsOfOtherCourses(paramsNotOwnedCourse); <START> verifyUnaccessibleWithoutModifySessionPrivilege(paramsNotOwnedCourse); <END> gaeSimulation.loginAsInstructor(instructor1ofCourse1.googleId); ______TS("Unsuccessful case: Not enough Parameter"); verifyAssumptionFailure(); String[] paramsNoCourseId = new String[] { Const.ParamsNames.FEEDBACK_SESSION_NAME, fs.getSessionName(), }; verifyAssumptionFailure(paramsNoCourseId); String[] paramsNoFeedback = new String[] { Const.ParamsNames.COURSE_ID, fs.getCourseId() }; verifyAssumptionFailure(paramsNoFeedback); ______TS("Successful case: Typical case"); String[] paramsTypical = new String[]{ Const.ParamsNames.COURSE_ID, fs.getCourseId(), Const.ParamsNames.FEEDBACK_SESSION_NAME, fs.getSessionName(), }; action = getAction(paramsTypical); rr = (RedirectResult) action.executeAndPostProcess(); assertTrue(rr.getStatusMessage().contains(Const.StatusMessages.FEEDBACK_SESSION_REMINDERSSENT)); verifySpecifiedTasksAdded(action, TaskQueue.FEEDBACK_SESSION_REMIND_EMAIL_QUEUE_NAME, 1); }</code><technical_language>This tested in AllActionsAccessControlTest, needs repeated anymore</technical_language>

Target:
public void testExecuteAndPostProcess() { InstructorAttributes instructor1ofCourse1 = dataBundle.instructors.get("instructor1OfCourse1"); FeedbackSessionAttributes fs = dataBundle.feedbackSessions.get("session1InCourse1"); gaeSimulation.loginAsInstructor(instructor1ofCourse1.googleId); ______TS("Unsuccessful case: Not enough parameters"); verifyAssumptionFailure(); String[] paramsNoCourseId = new String[] { Const.ParamsNames.FEEDBACK_SESSION_NAME, fs.getSessionName(), }; verifyAssumptionFailure(paramsNoCourseId); String[] paramsNoFeedback = new String[] { Const.ParamsNames.COURSE_ID, fs.getCourseId() }; verifyAssumptionFailure(paramsNoFeedback); ______TS("Successful case: Typical case"); String[] paramsTypical = new String[]{ Const.ParamsNames.COURSE_ID, fs.getCourseId(), Const.ParamsNames.FEEDBACK_SESSION_NAME, fs.getSessionName(), }; InstructorFeedbackRemindAction action = getAction(paramsTypical); RedirectResult rr = (RedirectResult) action.executeAndPostProcess(); assertTrue(rr.getStatusMessage().contains(Const.StatusMessages.FEEDBACK_SESSION_REMINDERSSENT)); verifySpecifiedTasksAdded(action, TaskQueue.FEEDBACK_SESSION_REMIND_EMAIL_QUEUE_NAME, 1); }
Source:
<code>public void activate() { logger.info("Activate " + Thread.currentThread()); <START> controllerThread.start(); <END> }</code><technical_language>please do start threads implementation items for Tellstick binding (see providesBindingFor() a hook). Please stop this Thread deactivate() called</technical_language>

Target:
public void activate() { logger.info("Activate " + Thread.currentThread()); }
Source:
<code>public Future<PoolEntry<T, C>> lease( final T route, final Object state, final Timeout requestTimeout, final FutureCallback<PoolEntry<T, C>> callback) { Args.notNull(route, "Route"); Args.notNull(requestTimeout, "Request timeout"); Asserts.check(!this.isShutDown.get(), "Connection pool shut down"); final Deadline deadline = Deadline.calculate(requestTimeout); final BasicFuture<PoolEntry<T, C>> future = new BasicFuture<>(callback); boolean acquiredLock = false; try { acquiredLock = this.lock.tryLock(requestTimeout.getDuration(), requestTimeout.getTimeUnit()); <START> } catch (final InterruptedException ignored) { <END> } if (acquiredLock) { try { final LeaseRequest<T, C> request = new LeaseRequest<>(route, state, requestTimeout, future); final boolean completed = processPendingRequest(request); if (!request.isDone() && !completed) { this.leasingRequests.add(request); } if (request.isDone()) { this.completedRequests.add(request); } } finally { this.lock.unlock(); } fireCallbacks(); } else { future.failed(DeadlineTimeoutException.from(deadline)); } return future; }</code><technical_language>@cwildman InterruptedException handling logic right me. call Thread.currentThread().interrupt() catching re-throwing InterruptedException. I cancel request point propagate exception caller</technical_language>

Target:
public Future<PoolEntry<T, C>> lease( final T route, final Object state, final Timeout requestTimeout, final FutureCallback<PoolEntry<T, C>> callback) { Args.notNull(route, "Route"); Args.notNull(requestTimeout, "Request timeout"); Asserts.check(!this.isShutDown.get(), "Connection pool shut down"); final Deadline deadline = Deadline.calculate(requestTimeout); final BasicFuture<PoolEntry<T, C>> future = new BasicFuture<>(callback); final boolean acquiredLock; try { acquiredLock = this.lock.tryLock(requestTimeout.getDuration(), requestTimeout.getTimeUnit()); } catch (final InterruptedException interruptedException) { Thread.currentThread().interrupt(); future.cancel(); return future; } if (acquiredLock) { try { final LeaseRequest<T, C> request = new LeaseRequest<>(route, state, requestTimeout, future); final boolean completed = processPendingRequest(request); if (!request.isDone() && !completed) { this.leasingRequests.add(request); } if (request.isDone()) { this.completedRequests.add(request); } } finally { this.lock.unlock(); } fireCallbacks(); } else { future.failed(DeadlineTimeoutException.from(deadline)); } return future; }
Source:
<code>public void dump() { m_replaySequencer.dump(m_mailbox.getHSId()); tmLog.info(String.format("%s: %s", CoreUtils.hsIdToString(m_mailbox.getHSId()), m_pendingTasks)); if (m_defaultConsistencyReadLevel == ReadLevel.SAFE) { <START> hostLog.info("[dump] current truncation handle: " + TxnEgo.debugTxnId(m_repairLogTruncationHandle) + " " <END> + (m_defaultConsistencyReadLevel == Consistency.ReadLevel.SAFE ? m_bufferedReadLog.toString() : "")); } }</code><technical_language>dump() tmLog, please consistent</technical_language>

Target:
public void dump() { m_replaySequencer.dump(m_mailbox.getHSId()); tmLog.info(String.format("%s: %s", CoreUtils.hsIdToString(m_mailbox.getHSId()), m_pendingTasks)); if (m_defaultConsistencyReadLevel == ReadLevel.SAFE) { tmLog.info("[dump] current truncation handle: " + TxnEgo.txnIdToString(m_repairLogTruncationHandle) + " " + (m_defaultConsistencyReadLevel == Consistency.ReadLevel.SAFE ? m_bufferedReadLog.toString() : "")); } }
Source:
<code>public void flush() throws IOException { LOG.trace("Flushing"); try { sizeManager.flush(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); <START> throw new IOException("flush() was interrupted before it could complete", e); <END> } LOG.trace("Done flushing"); }</code><technical_language>nit: This belong in this PR</technical_language>

Target:
public void flush() throws IOException { LOG.trace("Flushing"); try { sizeManager.flush(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } LOG.trace("Done flushing"); }
Source:
<code>public ConsoleAnnotator annotate(Object context, MarkupText text, int charPos) { String line = text.getText(); int end = line.indexOf(':',charPos); if (end<0) { if (CLASSNAME.matcher(line.substring(charPos)).matches()) end = line.length(); else return null; } <START> text.addHyperlinkLowKey(charPos,end,annotateClassName(line.substring(charPos,end))); <END> return new ConsoleAnnotator() { @Override public ConsoleAnnotator annotate(Object context, MarkupText text) { return null; } }; }</code><technical_language>leaving this there? link dead service</technical_language>

Target:
public ConsoleAnnotator annotate(Object context, MarkupText text, int charPos) { return null; }
Source:
<code>public static boolean isOfType(DetailAST ast, int... types) { return ast != null <START> && Arrays.stream(types).anyMatch(tokenType -> tokenType == ast.getType()); <END> }</code><technical_language>please reuse function wrote</technical_language>

Target:
public static boolean isOfType(DetailAST ast, int... types) { return ast != null && isOfType(ast.getType(), types); }
Source:
<code>protected void stubGet(UrlMatchingStrategy url, String responseFile) throws Exception { stubFor(get(url) .withHeader("Authorization", equalTo("Basic dXNlcjpwYXNz")) .willReturn(aResponse() <START> .withStatus(200) <END> .withHeader("Content-Type", "application/json") .withBody(IOUtils.toString(getClass().getResourceAsStream(responseFile))))); }</code><technical_language>[Checkstyle] INFO: '200' is a magic number</technical_language>

Target:
protected void stubGet(UrlMatchingStrategy url, String responseFile) throws Exception { stubFor(get(url) .withHeader("Authorization", equalTo("Basic dXNlcjpwYXNz")) .willReturn(aResponse() .withStatus(HttpStatus.SC_OK) .withHeader("Content-Type", "application/json") .withBody(IOUtils.toString(getClass().getResourceAsStream(responseFile))))); }
Source:
<code>public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; MeasuredUnit measuredUnit = (MeasuredUnit) o; <START> if (name != null ? !name.equals(measuredUnit.name) : measuredUnit.name != null) return false; <END> if (displayName != null ? !displayName.equals(measuredUnit.displayName) : measuredUnit.displayName != null) return false; if (description != null ? !description.equals(measuredUnit.description) : measuredUnit.description != null) return false; return true; }</code><technical_language>Missing id comparison</technical_language>

Target:
public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; MeasuredUnit measuredUnit = (MeasuredUnit) o; if (id != null ? !id.equals(measuredUnit.id) : measuredUnit.id != null) return false; if (name != null ? !name.equals(measuredUnit.name) : measuredUnit.name != null) return false; if (displayName != null ? !displayName.equals(measuredUnit.displayName) : measuredUnit.displayName != null) return false; if (description != null ? !description.equals(measuredUnit.description) : measuredUnit.description != null) return false; return true; }
Source:
<code>@Override public boolean equals(Object obj) { <START> if (this == obj) { <END> return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } MyObject other = (MyObject) obj; if (count != other.count) { return false; } if (message == null) { if (other.message != null) { return false; } } else if (!message.equals(other.message)) { return false; } return true; }</code><technical_language>writes code this</technical_language>

Target:
@Override public boolean equals(Object obj) { if (obj == this) return true; if (!(obj instanceof MyObject)) return false; MyObject other = (MyObject) obj; return count == other.count && (message == null ? other.message == null : message.equals(other.message)); }
Source:
<code>protected void run() throws Exception { if (localName != null && gitdir != null) throw die(CLIText.get().conflictingUsageOf_git_dir_andArguments); final URIish uri = new URIish(sourceUri); if (localName == null) { try { localName = uri.getHumanishName(); } catch (IllegalArgumentException e) { throw die(MessageFormat.format(CLIText.get().cannotGuessLocalNameFrom, sourceUri)); } } if (branch == null) branch = Constants.HEAD; CloneCommand command = Git.cloneRepository(); command.setURI(sourceUri).setRemote(remoteName) .setNoCheckout(noCheckout).setBranch(branch); String dirPath = ""; if (localName != null && localName.length() > 0) dirPath = localName; if (gitdir != null && gitdir.length() > 0) dirPath = gitdir; <START> command.setDirectory(new File(dirPath)); <END> try { outw.println(MessageFormat.format(CLIText.get().cloningInto, dirPath)); Repository db = command.call().getRepository(); if (db.resolve(Constants.HEAD) == null) outw.println(CLIText.get().clonedEmptyRepository); } catch (InvalidRemoteException e) { throw die(MessageFormat.format(CLIText.get().doesNotExist, sourceUri)); } outw.println(); outw.flush(); }</code><technical_language>if gitDir localName set (to clone a repo repo a non-standard layout)? I simply command.setDirectory(localname); command.setGitDir(gitDir); validation of localname (null not) gitdir done in CloneCommand</technical_language>

Target:
protected void run() throws Exception { if (localName != null && gitdir != null) throw die(CLIText.get().conflictingUsageOf_git_dir_andArguments); final URIish uri = new URIish(sourceUri); if (localName == null) { try { localName = uri.getHumanishName(); } catch (IllegalArgumentException e) { throw die(MessageFormat.format(CLIText.get().cannotGuessLocalNameFrom, sourceUri)); } } if (branch == null) branch = Constants.HEAD; CloneCommand command = Git.cloneRepository(); command.setURI(sourceUri).setRemote(remoteName) .setNoCheckout(noCheckout).setBranch(branch); command.setGitDir(gitdir == null ? null : new File(gitdir)); command.setDirectory(localName == null ? null : new File(localName)); try { outw.println(MessageFormat.format(CLIText.get().cloningInto, command.getDirectory().getPath())); db = command.call().getRepository(); if (db.resolve(Constants.HEAD) == null) outw.println(CLIText.get().clonedEmptyRepository); } catch (InvalidRemoteException e) { throw die(MessageFormat.format(CLIText.get().doesNotExist, sourceUri)); } finally { if (db != null) db.close(); } outw.println(); outw.flush(); }
Source:
<code>private boolean isUpsertEnabled() { <START> return _upsertMode != null && _upsertMode == UpsertConfig.Mode.FULL || _upsertMode == UpsertConfig.Mode.PARTIAL; <END> }</code><technical_language>NIT: please parentheses in boolean condition avoid confusion</technical_language>

Target:
public boolean isUpsertEnabled() { return _upsertMode != UpsertConfig.Mode.NONE; }
Source:
<code>private void handleFormats(List<StringField> sourceFormats, DataSetReference.Builder metaBuilder) { if (CollectionUtils.isNotEmpty(sourceFormats)) { <START> List<CharSequence> resultFormats = new ArrayList<CharSequence>(); for (StringField sourceFormat : sourceFormats) { if (fieldApprover.approve(sourceFormat.getDataInfo()) && StringUtils.isNotBlank(sourceFormat.getValue())) { resultFormats.add(sourceFormat.getValue()); } } <END> metaBuilder.setFormats(resultFormats); } }</code><technical_language>replaced streams java sourceFormats.stream() .filter(x -> fieldApprover.approve(x.getDataInfo())) .filter(x -> StringUtils.isNotBlank(x.getValue())) .map(StringField::getValue) .collect(Collectors.toList());</technical_language>

Target:
private void handleFormats(List<StringField> sourceFormats, DataSetReference.Builder metaBuilder) { if (CollectionUtils.isNotEmpty(sourceFormats)) { metaBuilder.setFormats(sourceFormats.stream().filter(x -> fieldApprover.approve(x.getDataInfo())) .filter(x -> StringUtils.isNotBlank(x.getValue())).map(StringField::getValue) .collect(Collectors.toList())); } }
Source:
<code>public static String preprocessQuery(Optional<String> catalog, Optional<String> schema, String query) throws QueryPreprocessorException { Duration timeout = DEFAULT_PREPROCESSOR_TIMEOUT; String timeoutEnvironment = System.getenv(ENV_PREPROCESSOR_TIMEOUT); if (emptyToNull(timeoutEnvironment) != null) { timeout = Duration.valueOf(timeoutEnvironment.trim()); } String preprocessorCommand = System.getenv(ENV_PREPROCESSOR); if (emptyToNull(preprocessorCommand) == null) { return query; } <START> return preprocessQuery(catalog, schema, query, ImmutableList.of("/bin/sh", "-c", preprocessorCommand.trim()), timeout); <END> }</code><technical_language>need trim cmt msg mention sh</technical_language>

Target:
public static String preprocessQuery(Optional<String> catalog, Optional<String> schema, String query) throws QueryPreprocessorException { Duration timeout = DEFAULT_PREPROCESSOR_TIMEOUT; String timeoutEnvironment = nullToEmpty(System.getenv(ENV_PREPROCESSOR_TIMEOUT)).trim(); if (!timeoutEnvironment.isEmpty()) { timeout = Duration.valueOf(timeoutEnvironment); } String preprocessorCommand = System.getenv(ENV_PREPROCESSOR); if (emptyToNull(preprocessorCommand) == null) { return query; } return preprocessQuery(catalog, schema, query, ImmutableList.of("/bin/sh", "-c", preprocessorCommand), timeout); }
Source:
<code>public boolean isAnyNotificationUnread() { List<WebElement> notifications = notificationCards .stream() .filter(card -> card .getAttribute("class") .contains(UNREAD_CLASS)) .collect(Collectors.toList()); <START> return !notifications.isEmpty(); <END> }</code><technical_language>new ArrayList<>().stream().anyMatch()</technical_language>

Target:
public boolean isAnyNotificationUnread() { return notificationCards .stream() .anyMatch(card -> card .getAttribute("class") .contains(UNREAD_CLASS)); }
Source:
<code>public static void setupFlavoredUI(PlaybackPreferencesFragment ui) { ui.findPreference(UserPreferences.PREF_CAST_ENABLED).setOnPreferenceChangeListener((preference, o) -> { if (o instanceof Boolean && ((Boolean) o)) { final int googlePlayServicesCheck = GoogleApiAvailability.getInstance() .isGooglePlayServicesAvailable(ui.getActivity()); if (googlePlayServicesCheck == ConnectionResult.SUCCESS) { displayRestartRequiredDialog(ui.requireContext()); return true; } else { GoogleApiAvailability.getInstance() .getErrorDialog(ui.getActivity(), googlePlayServicesCheck, 0) .show(); return false; } } <START> displayRestartRequiredDialog(ui.requireContext()); <END> return true; }); }</code><technical_language>Is this line needed? dialog is displayed disabling cast support, is handled fine a restart</technical_language>

Target:
public static void setupFlavoredUI(PlaybackPreferencesFragment ui) { ui.findPreference(UserPreferences.PREF_CAST_ENABLED).setOnPreferenceChangeListener((preference, o) -> { if (o instanceof Boolean && ((Boolean) o)) { final int googlePlayServicesCheck = GoogleApiAvailability.getInstance() .isGooglePlayServicesAvailable(ui.getActivity()); if (googlePlayServicesCheck == ConnectionResult.SUCCESS) { displayRestartRequiredDialog(ui.requireContext()); return true; } else { GoogleApiAvailability.getInstance() .getErrorDialog(ui.getActivity(), googlePlayServicesCheck, 0) .show(); return false; } } return true; }); }
Source:
<code>public void mouseClicked(MouseEvent e) { JTable table = this.weakRef.get(); if (table != null) { int uiIndex = table.getColumnModel().getColumnIndexAtX(e.getX()); <START> this.columnIndex = table.getColumnModel().getColumn(uiIndex).getModelIndex(); <END> for (RowSorter.SortKey key : table.getRowSorter().getSortKeys()) { if (key.getColumn() == this.columnIndex) { this.sortOrder = key.getSortOrder(); break; } } } }</code><technical_language>while I is unlikely, handle uiIndex -1</technical_language>

Target:
public void mouseClicked(MouseEvent e) { JTable table = this.weakRef.get(); if (table != null) { int uiIndex = table.getColumnModel().getColumnIndexAtX(e.getX()); if (uiIndex == -1) { return; } this.columnIndex = table.getColumnModel().getColumn(uiIndex).getModelIndex(); for (RowSorter.SortKey key : table.getRowSorter().getSortKeys()) { if (key.getColumn() == this.columnIndex) { this.sortOrder = key.getSortOrder(); break; } } } }
Source:
<code>public void handleActualMeterReadsResponse(final DeviceMessageMetadata deviceMessageMetadata, final ResponseMessageResultType deviceResult, final OsgpException exception, final MeterReadsResponseDto actualMeterReadsDto) { LOGGER.info("handleActualMeterReadsResponse for MessageType: {}", deviceMessageMetadata.getMessageType()); ResponseMessageResultType result = deviceResult; if (exception != null) { LOGGER.error(DEVICE_RESPONSE_NOT_OK_LOG_MSG, exception); result = ResponseMessageResultType.NOT_OK; } <START> this.webServiceResponseMessageSender.send( <END> ResponseMessage.newResponseMessageBuilder() .withCorrelationUid(deviceMessageMetadata.getCorrelationUid()) .withOrganisationIdentification(deviceMessageMetadata.getOrganisationIdentification()) .withDeviceIdentification(deviceMessageMetadata.getDeviceIdentification()).withResult(result) .withOsgpException(exception) .withDataObject(this.monitoringMapper.map(actualMeterReadsDto, MeterReads.class)) .withMessagePriority(deviceMessageMetadata.getMessagePriority()).build(), deviceMessageMetadata.getMessageType()); }</code><technical_language>Extract building of ResponseMessage variable (in eclipse, select text, right-click > refactor > extract local variable / select code + shift+alt+L). This code a bit more readable, especially passing in other besides ResponseMessage</technical_language>

Target:
public void handleActualMeterReadsResponse(final DeviceMessageMetadata deviceMessageMetadata, final ResponseMessageResultType deviceResult, final OsgpException exception, final MeterReadsResponseDto actualMeterReadsDto) { LOGGER.info("handleActualMeterReadsResponse for MessageType: {}", deviceMessageMetadata.getMessageType()); ResponseMessageResultType result = deviceResult; if (exception != null) { LOGGER.error(DEVICE_RESPONSE_NOT_OK_LOG_MSG, exception); result = ResponseMessageResultType.NOT_OK; } final ResponseMessage responseMessage = ResponseMessage.newResponseMessageBuilder() .withCorrelationUid(deviceMessageMetadata.getCorrelationUid()) .withOrganisationIdentification(deviceMessageMetadata.getOrganisationIdentification()) .withDeviceIdentification(deviceMessageMetadata.getDeviceIdentification()).withResult(result) .withOsgpException(exception) .withDataObject(this.monitoringMapper.map(actualMeterReadsDto, MeterReads.class)) .withMessagePriority(deviceMessageMetadata.getMessagePriority()).build(); this.webServiceResponseMessageSender.send(responseMessage, deviceMessageMetadata.getMessageType()); }
Source:
<code>public void run(BatchActionContext batchContext) throws Exception { <START> config.validate(batchContext.getFailureCollector()); <END> if (!config.shouldRun(batchContext)) { return; } Class<? extends Driver> driverClass = batchContext.loadPluginClass(JDBC_PLUGIN_ID); DBRun executeQuery = new DBRun(config, driverClass); executeQuery.run(); }</code><technical_language>in run method call collector.getOrThrowException. In configurePipeline method, data pipeline app throw in exception if validation failure carries failures. however, this apply other methods</technical_language>

Target:
public void run(BatchActionContext batchContext) throws Exception { FailureCollector collector = batchContext.getFailureCollector(); config.validate(collector); collector.getOrThrowException(); if (!config.shouldRun(batchContext)) { return; } Class<? extends Driver> driverClass = batchContext.loadPluginClass(JDBC_PLUGIN_ID); DBRun executeQuery = new DBRun(config, driverClass); executeQuery.run(); }
Source:
<code>private void deleteKeyPair(KeyPair keyPair) { System.out.format(" Delete Key Pair%n"); KeyPairApi keyPairApi = nova.getApi().getKeyPairExtensionForZone(ZONE).get(); keyPairApi.delete(keyPair.getName()); if (keyPairFile.delete()) { System.out.format(" Deleted %s%n", keyPairFile.getAbsolutePath()); } else { <START> System.out.format(" Could not delete %s%n", keyPairFile.getAbsolutePath()); <END> } }</code><technical_language>Is this a "WARN" so..</technical_language>

Target:
private void deleteKeyPair(KeyPair keyPair) { System.out.format(" Delete Key Pair%n"); KeyPairApi keyPairApi = novaContext.getApi().getKeyPairExtensionForZone(ZONE).get(); keyPairApi.delete(keyPair.getName()); if (keyPairFile.delete()) { System.out.format(" Deleted %s%n", keyPairFile.getAbsolutePath()); } else { System.err.format(" Could not delete %s%n", keyPairFile.getAbsolutePath()); } }
Source:
<code>protected String copyRecurse(String sourceId, String parentId, LinkedList<String> ancestorIds, String name, boolean excludeSpecialChildren, boolean excludeRegularChildren) { String copyId = copy(sourceId, parentId, ancestorIds, name); ancestorIds.addLast(copyId); for (String childId : getChildrenIds(sourceId, excludeSpecialChildren, excludeRegularChildren)) { <START> copyRecurse(childId, copyId, ancestorIds, null, true, false); <END> } ancestorIds.removeLast(); return copyId; }</code><technical_language>passing excludeSpecialChildren instead of true consistent VCS</technical_language>

Target:
protected String copyRecurse(String sourceId, String parentId, LinkedList<String> ancestorIds, String name, boolean excludeSpecialChildren, boolean excludeRegularChildren) { String copyId = copy(sourceId, parentId, ancestorIds, name); ancestorIds.addLast(copyId); for (String childId : getChildrenIds(sourceId, excludeSpecialChildren, excludeRegularChildren)) { copyRecurse(childId, copyId, ancestorIds, null, excludeSpecialChildren, false); } ancestorIds.removeLast(); return copyId; }
Source:
<code>public SubscribeConnection openSubscribe() throws NotSupportedException, TransportException { final String service = SVC_PUBLISH_SUBSCRIBE; try { final HttpURLConnection c = connect(service); final InputStream in = openInputStream(c); try { <START> if (isSmartHttp(c, service)) { <END> readSmartHeaders(in, service); return new SmartHttpSubscribeConnection(in); } else { String msg = JGitText .get().remoteDoesNotSupportSmartHTTPSubscribe; throw new NotSupportedException(MessageFormat.format( msg, baseUrl.toString())); } } finally { in.close(); } } catch (IOException err) { throw new TransportException(uri, JGitText .get().errorReadingInfoRefs, err); } }</code><technical_language>HTTP GET pubsub URL is fine me</technical_language>

Target:
public SubscribeConnection openSubscribe() throws NotSupportedException, TransportException { return new SmartHttpSubscribeConnection(); }
Source:
<code>public void validate() { StorageType type = attributes.attribute(STORAGE_TYPE).get(); if (type != StorageType.OBJECT && getBuilder().compatibility().isEnabled()) { throw new CacheConfigurationException("Compatibility mode requires OBJECT storage type but was: " + type); } long size = attributes.attribute(SIZE).get(); if (size > 0) { EvictionType evictionType = attributes.attribute(EVICTION_TYPE).get(); if (evictionType == EvictionType.MEMORY) { switch (type) { case OBJECT: throw new CacheConfigurationException("MEMORY based eviction is not supported with OBJECT storage"); case OFF_HEAP: int addressCount = attributes.attribute(ADDRESS_COUNT).get(); <START> long actualAddressCount = OffHeapDataContainer.findRequiredMemoryAddress(addressCount); <END> actualAddressCount *= 8; if (size < actualAddressCount) { throw new CacheConfigurationException("MEMORY based OFF_HEAP eviction configured size " + size + " must be larger than " + actualAddressCount + " to store configured address count of " + addressCount); } } } } }</code><technical_language>i18n</technical_language>

Target:
public void validate() { StorageType type = attributes.attribute(STORAGE_TYPE).get(); if (type != StorageType.OBJECT && getBuilder().compatibility().isEnabled()) { throw log.compatibilityModeOnlyCompatibleWithObjectStorage(type); } long size = attributes.attribute(SIZE).get(); if (size > 0) { EvictionType evictionType = attributes.attribute(EVICTION_TYPE).get(); if (evictionType == EvictionType.MEMORY) { switch (type) { case OBJECT: throw log.offHeapMemoryEvictionNotSupportedWithObject(); case OFF_HEAP: int addressCount = attributes.attribute(ADDRESS_COUNT).get(); long actualAddressCount = OffHeapDataContainer.getActualAddressCount(addressCount << 3); actualAddressCount = UnpooledOffHeapMemoryAllocator.estimateSizeOverhead(actualAddressCount); if (size < actualAddressCount) { throw log.offHeapMemoryEvictionSizeNotLargeEnoughForAddresses(size, actualAddressCount, addressCount); } } } } }
Source:
<code>private void sleepUntilLoginDisplays(final AuthenticationActivity startedActivity) throws InterruptedException, IllegalArgumentException, NoSuchFieldException, IllegalAccessException { Log.v(TAG, "sleepUntilLoginDisplays start"); <START> waitUntil(PAGE_LOAD_TIMEOUT * 5, new ResponseVerifier() { <END> @Override public boolean hasCondition() throws IllegalArgumentException, NoSuchFieldException, IllegalAccessException { return hasLoginPage(getLoginPage(startedActivity)); } }); Log.v(TAG, "sleepUntilLoginDisplays end"); }</code><technical_language>Separate timeout constant</technical_language>

Target:
private void sleepUntilLoginDisplays(final AuthenticationActivity startedActivity) throws InterruptedException, IllegalArgumentException, NoSuchFieldException, IllegalAccessException { Log.v(TAG, "sleepUntilLoginDisplays start"); waitUntil(LOGIN_DISPLAY_TIME_OUT, new ResponseVerifier() { @Override public boolean hasCondition() throws IllegalArgumentException, NoSuchFieldException, IllegalAccessException { return hasLoginPage(getLoginPage(startedActivity)); } }); Log.v(TAG, "sleepUntilLoginDisplays end"); }
Source:
<code>void cleanUp() { Log.d(TAG, "Vungle banner adapter try to cleanUp:" + this); if (mVungleBannerAd != null) { Log.d(TAG, "Vungle banner adapter cleanUp: destroyAd # " + mVungleBannerAd.hashCode()); mVungleBannerAd.destroyAd(); if (mVungleBannerAd != null && mVungleBannerAd.getParent() != null) { <START> ((RelativeLayout) mVungleBannerAd.getParent()).removeView(mVungleBannerAd); <END> } mVungleBannerAd = null; } if (mVungleNativeAd != null) { Log.d(TAG, "Vungle banner adapter cleanUp: finishDisplayingAd # " + mVungleNativeAd.hashCode()); mVungleNativeAd.finishDisplayingAd(); if (mVungleNativeAd != null) { View adView = mVungleNativeAd.renderNativeView(); if (adView != null && adView.getParent() != null) { ((RelativeLayout) adView.getParent()).removeView(adView); } } mVungleNativeAd = null; } }</code><technical_language>Safer cast ViewGroup here</technical_language>

Target:
void cleanUp() { Log.d(TAG, "Vungle banner adapter try to cleanUp:" + this); if (mVungleBannerAd != null) { Log.d(TAG, "Vungle banner adapter cleanUp: destroyAd # " + mVungleBannerAd.hashCode()); mVungleBannerAd.destroyAd(); if (mVungleBannerAd != null && mVungleBannerAd.getParent() != null) { ((ViewGroup) mVungleBannerAd.getParent()).removeView(mVungleBannerAd); } mVungleBannerAd = null; } if (mVungleNativeAd != null) { Log.d(TAG, "Vungle banner adapter cleanUp: finishDisplayingAd # " + mVungleNativeAd.hashCode()); mVungleNativeAd.finishDisplayingAd(); if (mVungleNativeAd != null) { View adView = mVungleNativeAd.renderNativeView(); if (adView != null && adView.getParent() != null) { ((ViewGroup) adView.getParent()).removeView(adView); } } mVungleNativeAd = null; } }
Source:
<code>public void getConsensusFromCurrentMembers1Node() throws Exception { addServer(SERVERS.PORT_0); addServer(SERVERS.PORT_1); Layout l = new TestLayoutBuilder() .setEpoch(1L) .addLayoutServer(SERVERS.PORT_1) .addSequencer(SERVERS.PORT_1) .buildSegment() .buildStripe() .addLogUnit(SERVERS.PORT_1) .addToSegment() .addToLayout() .build(); bootstrapAllServers(l); CorfuRuntime corfuRuntime = getRuntime(l).connect(); getManagementServer(SERVERS.PORT_0).shutdown(); getManagementServer(SERVERS.PORT_1).shutdown(); Layout newLayout = new TestLayoutBuilder() .setEpoch(2L) .addLayoutServer(SERVERS.PORT_0) .addLayoutServer(SERVERS.PORT_1) .addSequencer(SERVERS.PORT_1) .buildSegment() .buildStripe() .addLogUnit(SERVERS.PORT_1) .addToSegment() .addToLayout() .build(); l.setEpoch(l.getEpoch() + 1); corfuRuntime.getLayoutView().getRuntimeLayout(l).sealMinServerSet(); corfuRuntime.getLayoutView().updateLayout(newLayout, 1L); <START> System.out.println("check12"); <END> assertThat(getLayoutServer(SERVERS.PORT_0).getCurrentLayout()).isEqualTo(newLayout); assertThat(getLayoutServer(SERVERS.PORT_1).getCurrentLayout()).isEqualTo(newLayout); }</code><technical_language>is this intentional</technical_language>

Target:
public void getConsensusFromCurrentMembers1Node() throws Exception { addServer(SERVERS.PORT_0); addServer(SERVERS.PORT_1); Layout l = new TestLayoutBuilder() .setEpoch(1L) .addLayoutServer(SERVERS.PORT_1) .addSequencer(SERVERS.PORT_1) .buildSegment() .buildStripe() .addLogUnit(SERVERS.PORT_1) .addToSegment() .addToLayout() .build(); bootstrapAllServers(l); CorfuRuntime corfuRuntime = getRuntime(l).connect(); getManagementServer(SERVERS.PORT_0).shutdown(); getManagementServer(SERVERS.PORT_1).shutdown(); Layout newLayout = new TestLayoutBuilder() .setEpoch(2L) .addLayoutServer(SERVERS.PORT_0) .addLayoutServer(SERVERS.PORT_1) .addSequencer(SERVERS.PORT_1) .buildSegment() .buildStripe() .addLogUnit(SERVERS.PORT_1) .addToSegment() .addToLayout() .build(); l.setEpoch(l.getEpoch() + 1); corfuRuntime.getLayoutView().getRuntimeLayout(l).sealMinServerSet(); corfuRuntime.getLayoutView().updateLayout(newLayout, 1L); assertThat(getLayoutServer(SERVERS.PORT_0).getCurrentLayout()).isEqualTo(newLayout); assertThat(getLayoutServer(SERVERS.PORT_1).getCurrentLayout()).isEqualTo(newLayout); }
Source:
<code>private void pullMetadata(final Callback callback) { mPullMetadataController.pullMetadata(new PullMetadataController.Callback() { @Override public void onComplete() { if(mMetadataValidator.isValid()){ pullData(callback); } else { <START> onError(new ConversionException()); <END> } } @Override public void onStep(PullStep step) { callback.onStep(step); } @Override public void onError(Throwable throwable) { manageError(throwable, callback); } @Override public void onCancel() { callback.onCancel(); } }); }</code><technical_language>@idelcano Remember domain conversions sense case creates ConversionException. I create o refactor MetadataException message "All necessary mandatory metadata tables populated" for example. review it? thanks</technical_language>

Target:
private void pullMetadata(final Callback callback) { mPullMetadataController.pullMetadata(new PullMetadataController.Callback() { @Override public void onComplete() { if(pullCanceled){ callback.onCancel(); }else { if(mMetadataValidator.isValid()){ pullData(callback); } else { onError(new MetadataException()); } } } @Override public void onStep(PullStep step) { callback.onStep(step); } @Override public void onError(Throwable throwable) { manageError(throwable, callback); } }); }