auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>static Set<String> getYarnApiAddresses(Configuration conf) { String emptyString = ""; String rmIdsConf = conf.get("yarn.resourcemanager.ha.rm-ids", emptyString); if (rmIdsConf.isEmpty()) { String yarnApiAddress = conf.get("yarn.resourcemanager.webapp.address", emptyString); return yarnApiAddress.isEmpty() ? Sets.newHashSet() : Sets.newHashSet(yarnApiAddress); } String[] allRmIds = rmIdsConf.split(","); return Arrays.stream(allRmIds) .map(rmId -> conf.get("yarn.resourcemanager.webapp.address." + rmId, emptyString)) .filter(address -> !address.isEmpty()) .collect(Collectors.toSet()); <START> } <END></code><technical_language>Wondering emptyString here. Efficiency: String constants interned immutable references "" anyway. Readability: "" potentially more readable emptyString, interface for Configuration is get(key) returns a null is sort of want in this case. Substituting "" gaining right? filter Objects::notNull superior supplying a default asking if default. I suppose depends null-averse are, if conf legitimately empty values. Hmm. sounds of Raymond Chen blog posts is producing weird stuff consuming side workarounds optimal switch producing side</technical_language>

Target:
static Set<String> getYarnApiAddresses(Configuration conf) { String[] rmIds = conf.getStrings("yarn.resourcemanager.ha.rm-ids"); if (rmIds == null) { String yarnApiAddress = conf.get("yarn.resourcemanager.webapp.address"); return yarnApiAddress == null ? Sets.newHashSet() : Sets.newHashSet(yarnApiAddress); } return Arrays.stream(rmIds) .map(rmId -> conf.get("yarn.resourcemanager.webapp.address." + rmId)) .filter(Objects::nonNull) .collect(Collectors.toSet()); }
Source:
<code>public LockResource(Lock lock, long tryMs, long sleepMs, long timeoutMs) throws InterruptedException, TimeoutException { mLock = lock; long deadlineMs = System.currentTimeMillis() + timeoutMs; boolean lockAcquired = false; while (System.currentTimeMillis() < deadlineMs) { if (mLock.tryLock(tryMs, TimeUnit.MILLISECONDS)) { lockAcquired = true; break; } else { <START> long remainingWaitMs = deadlineMs = System.currentTimeMillis(); <END> if (remainingWaitMs > 0) { Thread.sleep(Math.min(sleepMs, remainingWaitMs)); } } } if (!lockAcquired) { throw new TimeoutException( String.format("Failed to acquire the lock:%s, after %dms", mLock, timeoutMs)); } }</code><technical_language>is this supposed deadlineMs - System.currentTimeMillis()</technical_language>

Target:
public LockResource(Lock lock, long tryMs, long sleepMs, long timeoutMs) throws InterruptedException, TimeoutException { mLock = lock; long deadlineMs = System.currentTimeMillis() + timeoutMs; boolean lockAcquired = false; while (System.currentTimeMillis() < deadlineMs) { if (mLock.tryLock(tryMs, TimeUnit.MILLISECONDS)) { lockAcquired = true; break; } else { long remainingWaitMs = deadlineMs - System.currentTimeMillis(); if (remainingWaitMs > 0) { Thread.sleep(Math.min(sleepMs, remainingWaitMs)); } } } if (!lockAcquired) { throw new TimeoutException(ExceptionMessage.STATE_LOCK_TIMED_OUT.getMessage(timeoutMs)); } }
Source:
<code>private void testDownloadAction() { homePage.verifyDownloadResultButtonExists(feedbackSessionClosed.getCourseId(), feedbackSessionClosed.getSessionName()); ______TS("Typical case: download report"); AppUrl reportUrl = createUrl(Const.ActionURIs.INSTRUCTOR_FEEDBACK_RESULTS_DOWNLOAD) .withUserId("CHomeUiT.instructor.tmms") .withCourseId(feedbackSessionClosed.getCourseId()) .withSessionName(feedbackSessionClosed.getSessionName()); homePage.verifyDownloadLink(reportUrl); ______TS("Typical case: download report unsuccessfully"); reportUrl = createUrl(Const.ActionURIs.INSTRUCTOR_FEEDBACK_RESULTS_DOWNLOAD) .withUserId("CHomeUiT.instructor.tmms"); browser.driver.get(reportUrl.toAbsoluteString()); String afterReportDownloadUrl = browser.driver.getCurrentUrl(); assertFalse(reportUrl.toString().equals(afterReportDownloadUrl)); assertTrue("Expected url is InstructorHomePage or Unauthorised page, but is " + afterReportDownloadUrl, afterReportDownloadUrl.contains(Const.ActionURIs.INSTRUCTOR_HOME_PAGE) <START> || afterReportDownloadUrl.contains(Const.ViewURIs.UNAUTHORIZED)); <END> loginAsCommonInstructor(); }</code><technical_language>Is completely of pages shown</technical_language>

Target:
private void testDownloadAction() throws Exception { homePage.verifyDownloadResultButtonExists(feedbackSessionClosed.getCourseId(), feedbackSessionClosed.getSessionName()); ______TS("Typical case: download report"); AppUrl reportUrl = createUrl(Const.ActionURIs.INSTRUCTOR_FEEDBACK_RESULTS_DOWNLOAD) .withUserId("CHomeUiT.instructor.tmms") .withCourseId(feedbackSessionClosed.getCourseId()) .withSessionName(feedbackSessionClosed.getSessionName()); homePage.verifyDownloadLink(reportUrl); ______TS("Typical case: download report unsuccessfully due to missing parameters"); reportUrl = createUrl(Const.ActionURIs.INSTRUCTOR_FEEDBACK_RESULTS_DOWNLOAD) .withUserId("CHomeUiT.instructor.tmms"); browser.driver.get(reportUrl.toAbsoluteString()); String afterReportDownloadUrl = browser.driver.getCurrentUrl(); assertFalse(reportUrl.toString().equals(afterReportDownloadUrl)); assertTrue("Expected url is Unauthorised page, but is " + afterReportDownloadUrl, afterReportDownloadUrl.contains(Const.ViewURIs.UNAUTHORIZED)); loginAsCommonInstructor(); }
Source:
<code>private void assertScoreAndConstraintMatches(SolverFactory<Solution_> solverFactory, Solution_ bestSolution, String bestScoreLimitString) { assertThat(bestSolution).isNotNull(); InnerScoreDirectorFactory<Solution_> scoreDirectorFactory = (InnerScoreDirectorFactory<Solution_>) solverFactory .getScoreDirectorFactory(); Score bestScore = scoreDirectorFactory.getSolutionDescriptor().getScore(bestSolution); ScoreDefinition scoreDefinition = scoreDirectorFactory.getScoreDefinition(); Score bestScoreLimit = scoreDefinition.parseScore(bestScoreLimitString); assertThat(bestScore) .isGreaterThanOrEqualTo(bestScoreLimit) <START> .as("The bestScore (" + bestScore + ") must be at least the bestScoreLimit (" + bestScoreLimit + ")."); <END> try (ScoreDirector<Solution_> scoreDirector = scoreDirectorFactory.buildScoreDirector()) { scoreDirector.setWorkingSolution(bestSolution); Score score = scoreDirector.calculateScore(); assertThat(bestScore).isEqualTo(score); if (scoreDirector.isConstraintMatchEnabled()) { Collection<ConstraintMatchTotal> constraintMatchTotals = scoreDirector.getConstraintMatchTotals(); assertThat(constraintMatchTotals).isNotNull(); assertThat(constraintMatchTotals.stream() .map(ConstraintMatchTotal::getScore) .reduce(Score::add) .orElse(scoreDefinition.getZeroScore())).isEqualTo(score); assertThat(scoreDirector.getIndictmentMap()).isNotNull(); } } }</code><technical_language>as() needs assertions, unreachable</technical_language>

Target:
private void assertScoreAndConstraintMatches(SolverFactory<Solution_> solverFactory, Solution_ bestSolution, String bestScoreLimitString) { assertThat(bestSolution).isNotNull(); InnerScoreDirectorFactory<Solution_> scoreDirectorFactory = (InnerScoreDirectorFactory<Solution_>) solverFactory .getScoreDirectorFactory(); Score bestScore = scoreDirectorFactory.getSolutionDescriptor().getScore(bestSolution); ScoreDefinition scoreDefinition = scoreDirectorFactory.getScoreDefinition(); Score bestScoreLimit = scoreDefinition.parseScore(bestScoreLimitString); assertThat(bestScore.compareTo(bestScoreLimit)) .as("The bestScore (" + bestScore + ") must be at least the bestScoreLimit (" + bestScoreLimit + ").") .isGreaterThanOrEqualTo(0); try (ScoreDirector<Solution_> scoreDirector = scoreDirectorFactory.buildScoreDirector()) { scoreDirector.setWorkingSolution(bestSolution); Score score = scoreDirector.calculateScore(); assertThat(bestScore).isEqualTo(score); if (scoreDirector.isConstraintMatchEnabled()) { Collection<ConstraintMatchTotal> constraintMatchTotals = scoreDirector.getConstraintMatchTotals(); assertThat(constraintMatchTotals).isNotNull(); assertThat(constraintMatchTotals.stream() .map(ConstraintMatchTotal::getScore) .reduce(Score::add) .orElse(scoreDefinition.getZeroScore())).isEqualTo(score); assertThat(scoreDirector.getIndictmentMap()).isNotNull(); } } }
Source:
<code>public static Double lineLocatePoint(@SqlType(GEOMETRY_TYPE_NAME) Slice lineSlice, @SqlType(GEOMETRY_TYPE_NAME) Slice pointSlice) { Geometry line = JtsGeometrySerde.deserialize(lineSlice); Geometry point = JtsGeometrySerde.deserialize(pointSlice); if (line.isEmpty() || point.isEmpty()) { return null; } GeometryType lineType = GeometryType.getForJtsGeometryType(line.getGeometryType()); if (lineType != GeometryType.LINE_STRING && lineType != GeometryType.MULTI_LINE_STRING) { throw new PrestoException(INVALID_FUNCTION_ARGUMENT, format("First argument to line_locate_point must be a LineString or a MultiLineString. Got: %s", line.getGeometryType())); } GeometryType pointType = GeometryType.getForJtsGeometryType(point.getGeometryType()); <START> if (pointType != POINT) { <END> throw new PrestoException(INVALID_FUNCTION_ARGUMENT, format("Second argument to line_locate_point must be a Point. Got: %s", point.getGeometryType())); } return new LengthIndexedLine(line).indexOf(point.getCoordinate()); }</code><technical_language>This is unrelated change. move a separate commit</technical_language>

Target:
public static Double lineLocatePoint(@SqlType(GEOMETRY_TYPE_NAME) Slice lineSlice, @SqlType(GEOMETRY_TYPE_NAME) Slice pointSlice) { Geometry line = JtsGeometrySerde.deserialize(lineSlice); Geometry point = JtsGeometrySerde.deserialize(pointSlice); if (line.isEmpty() || point.isEmpty()) { return null; } GeometryType lineType = GeometryType.getForJtsGeometryType(line.getGeometryType()); if (lineType != GeometryType.LINE_STRING && lineType != GeometryType.MULTI_LINE_STRING) { throw new PrestoException(INVALID_FUNCTION_ARGUMENT, format("First argument to line_locate_point must be a LineString or a MultiLineString. Got: %s", line.getGeometryType())); } GeometryType pointType = GeometryType.getForJtsGeometryType(point.getGeometryType()); if (pointType != GeometryType.POINT) { throw new PrestoException(INVALID_FUNCTION_ARGUMENT, format("Second argument to line_locate_point must be a Point. Got: %s", point.getGeometryType())); } return new LengthIndexedLine(line).indexOf(point.getCoordinate()); }
Source:
<code>public Object[] getElements(Object inputElement) { <START> List<IBrowserDescriptor> list = new ArrayList<IBrowserDescriptor>(); <END> Iterator<IBrowserDescriptor> iterator = BrowserManager.getInstance().getWebBrowsers() .iterator(); while (iterator.hasNext()) { IBrowserDescriptor browser = iterator .next(); list.add(browser); } return list.toArray(); }</code><technical_language>Please remove redundant type information in another follow commit</technical_language>

Target:
public Object[] getElements(Object inputElement) { List<IBrowserDescriptor> list = new ArrayList<>(); Iterator<IBrowserDescriptor> iterator = BrowserManager.getInstance().getWebBrowsers() .iterator(); while (iterator.hasNext()) { IBrowserDescriptor browser = iterator .next(); list.add(browser); } return list.toArray(); }
Source:
<code>public void connect(String url) throws Exception { <START> System.out.println("[SchedulerNodeClient] Connecting to scheduler at url " + url); <END> CredData userCreds = decrypter.decrypt(); client.init(new ConnectionInfo(url, userCreds.getLogin(), userCreds.getPassword(), null, true)); System.out.println("[SchedulerNodeClient] Connected"); }</code><technical_language>Remove sysout business code</technical_language>

Target:
public void connect(String url) throws Exception { CredData userCreds = decrypter.decrypt(); client.init(new ConnectionInfo(url, userCreds.getLogin(), userCreds.getPassword(), null, true)); }
Source:
<code>private static String getGerritPluginName(File srcFile) throws IOException { String fileName = srcFile.getName(); if (isJarPlugin(fileName)) { JarFile jarFile = new JarFile(srcFile); try { return jarFile.getManifest().getMainAttributes() .getValue("Gerrit-PluginName"); } finally { jarFile.close(); } } if (isJsPlugin(fileName)) { return fileName.substring(0, fileName.length() - 3); } throw new <START> RuntimeException(String.format("Unknown <END> plugin file: %s", fileName)); }</code><technical_language>IOException</technical_language>

Target:
private static String getGerritPluginName(File srcFile) throws IOException { String fileName = srcFile.getName(); if (isJarPlugin(fileName)) { JarFile jarFile = new JarFile(srcFile); try { return jarFile.getManifest().getMainAttributes() .getValue("Gerrit-PluginName"); } finally { jarFile.close(); } } if (isJsPlugin(fileName)) { return fileName.substring(0, fileName.length() - 3); } return null; }
Source:
<code>private void sizeCheck() { long minRecordToWait = Long.MAX_VALUE; int pageRowCountLimit = props.getPageRowCountLimit(); long rowCountForNextRowCountCheck = rowCount + pageRowCountLimit; for (ColumnWriterBase writer : columns.values()) { long usedMem = writer.getCurrentPageBufferedSize(); long rows = rowCount - writer.getRowsWrittenSoFar(); long remainingMem = props.getPageSizeThreshold() - usedMem; if (remainingMem <= thresholdTolerance || rows >= pageRowCountLimit) { writer.writePage(); remainingMem = props.getPageSizeThreshold(); } else { rowCountForNextRowCountCheck = min(rowCountForNextRowCountCheck, writer.getRowsWrittenSoFar() + pageRowCountLimit); } long rowsToFillPage = usedMem == 0 ? props.getMaxRowCountForPageSizeCheck() <START> : (long) (rows) / usedMem * remainingMem; <END> if (rowsToFillPage < minRecordToWait) { minRecordToWait = rowsToFillPage; } } if (minRecordToWait == Long.MAX_VALUE) { minRecordToWait = props.getMinRowCountForPageSizeCheck(); } if (props.estimateNextSizeCheck()) { rowCountForNextSizeCheck = rowCount + min( max(minRecordToWait / 2, props.getMinRowCountForPageSizeCheck()), props.getMaxRowCountForPageSizeCheck()); } else { rowCountForNextSizeCheck = rowCount + props.getMinRowCountForPageSizeCheck(); } if (rowCountForNextRowCountCheck < rowCountForNextSizeCheck) { rowCountForNextSizeCheck = rowCountForNextRowCountCheck; } }</code><technical_language>I braces redundant now</technical_language>

Target:
private void sizeCheck() { long minRecordToWait = Long.MAX_VALUE; int pageRowCountLimit = props.getPageRowCountLimit(); long rowCountForNextRowCountCheck = rowCount + pageRowCountLimit; for (ColumnWriterBase writer : columns.values()) { long usedMem = writer.getCurrentPageBufferedSize(); long rows = rowCount - writer.getRowsWrittenSoFar(); long remainingMem = props.getPageSizeThreshold() - usedMem; if (remainingMem <= thresholdTolerance || rows >= pageRowCountLimit) { writer.writePage(); remainingMem = props.getPageSizeThreshold(); } else { rowCountForNextRowCountCheck = min(rowCountForNextRowCountCheck, writer.getRowsWrittenSoFar() + pageRowCountLimit); } long rowsToFillPage = usedMem == 0 ? props.getMaxRowCountForPageSizeCheck() : (long) rows / usedMem * remainingMem; if (rowsToFillPage < minRecordToWait) { minRecordToWait = rowsToFillPage; } } if (minRecordToWait == Long.MAX_VALUE) { minRecordToWait = props.getMinRowCountForPageSizeCheck(); } if (props.estimateNextSizeCheck()) { rowCountForNextSizeCheck = rowCount + min( max(minRecordToWait / 2, props.getMinRowCountForPageSizeCheck()), props.getMaxRowCountForPageSizeCheck()); } else { rowCountForNextSizeCheck = rowCount + props.getMinRowCountForPageSizeCheck(); } if (rowCountForNextRowCountCheck < rowCountForNextSizeCheck) { rowCountForNextSizeCheck = rowCountForNextRowCountCheck; } }
Source:
<code>public boolean shouldSchedule(Queue.Task p, List<Action> actions) { for (Action action : actions) { if (action instanceof CauseAction) { for (Cause c : ((CauseAction) action).getCauses()) { if (c instanceof BranchIndexingCause) { if (p instanceof Job) { Job j = (Job) p; OverrideIndexTriggersJobProperty overrideProp = <START> (OverrideIndexTriggersJobProperty) j.getProperty(OverrideIndexTriggersJobProperty.class); <END> if (overrideProp != null && !overrideProp.getEnableTriggers()) { return false; } } } } } } return true; }</code><technical_language>ant: ditto</technical_language>

Target:
public boolean shouldSchedule(Queue.Task p, List<Action> actions) { for (Action action : actions) { if (action instanceof CauseAction) { for (Cause c : ((CauseAction) action).getCauses()) { if (c instanceof BranchIndexingCause) { if (p instanceof Job) { Job<?,?> j = (Job) p; OverrideIndexTriggersJobProperty overrideProp = j.getProperty(OverrideIndexTriggersJobProperty.class); if (overrideProp != null) { return overrideProp.getEnableTriggers(); } else { return true; } } } } } } return true; }
Source:
<code>public LocalDateDoubleTimeSeries withValues(double[] values) { <START> validate(_times, values); <END> return new ImmutableLocalDateDoubleTimeSeries(_times, values.clone()); }</code><technical_language>validate checks nullness, checks lengths checks times ordered. need check drop validate do null length check</technical_language>

Target:
public LocalDateDoubleTimeSeries withValues(double[] values) { validateLength(_times, values); return new ImmutableLocalDateDoubleTimeSeries(_times, values.clone()); }
Source:
<code>public BoundedIterable<Long> newAllEntriesReader() { @SuppressWarnings( "unchecked" ) BoundedIterable<Long>[] entries = Arrays.stream( instancesAs( BoundedIterable.class, IndexAccessor::newAllEntriesReader ) ) <START> .filter( notNull() ) <END> .toArray( BoundedIterable[]::new ); return new BoundedIterable<Long>() { @Override public long maxCount() { long[] maxCounts = new long[entries.length]; long sum = 0; for ( int i = 0; i < entries.length; i++ ) { maxCounts[i] = entries[i].maxCount(); sum += maxCounts[i]; } return existsUnknownMaxCount( maxCounts ) ? UNKNOWN_MAX_COUNT : sum; } private boolean existsUnknownMaxCount( long... maxCounts ) { for ( long maxCount : maxCounts ) { if ( maxCount == UNKNOWN_MAX_COUNT ) { return true; } } return false; } @SuppressWarnings( "unchecked" ) @Override public void close() throws Exception { forAll( BoundedIterable::close, entries ); } @Override public Iterator<Long> iterator() { return Iterables.concat( entries ).iterator(); } }; }</code><technical_language>i filtering out guarding nulls is a source of errors, if instead instance empty instance of some sort</technical_language>

Target:
public BoundedIterable<Long> newAllEntriesReader() { BoundedIterable<Long>[] entries = instancesAs( BoundedIterable.class, IndexAccessor::newAllEntriesReader ); return new BoundedIterable<Long>() { @Override public long maxCount() { long[] maxCounts = new long[entries.length]; long sum = 0; for ( int i = 0; i < entries.length; i++ ) { maxCounts[i] = entries[i].maxCount(); sum += maxCounts[i]; } return existsUnknownMaxCount( maxCounts ) ? UNKNOWN_MAX_COUNT : sum; } private boolean existsUnknownMaxCount( long... maxCounts ) { for ( long maxCount : maxCounts ) { if ( maxCount == UNKNOWN_MAX_COUNT ) { return true; } } return false; } @SuppressWarnings( "unchecked" ) @Override public void close() throws Exception { forAll( BoundedIterable::close, entries ); } @Override public Iterator<Long> iterator() { return Iterables.concat( entries ).iterator(); } }; }
Source:
<code>public boolean canContribute(IStatus status) { <START> return !StringUtils.isEmpty(doAnalyze()); <END> }</code><technical_language>doAnalyze() is overkill. need check is a section (lines 40 - 42)</technical_language>

Target:
public boolean canContribute(IStatus status) { return getPlatformDetailsConfiguration().contains(sectionTitle); }
Source:
<code>public static void main(String[] args) { <START> try { <END> try(KubernetesClient client = new DefaultKubernetesClient()){ if (!client.supportsApiPath("/apis/apiextensions.k8s.io/v1beta1") && !client.supportsApiPath("/apis/apiextensions.k8s.io/v1")) { System.out.println("WARNING this cluster does not support the API Group apiextensions.k8s.io"); return; } CustomResourceDefinitionList list = client.customResourceDefinitions().list(); if (list == null) { System.out.println("ERROR no list returned!"); return; } List<CustomResourceDefinition> items = list.getItems(); for (CustomResourceDefinition item : items) { System.out.println("CustomResourceDefinition " + item.getMetadata().getName() + " has version: " + item.getApiVersion()); } } } catch (KubernetesClientException e) { System.out.println("Failed: " + e); e.printStackTrace(); } }}</code><technical_language>Please reuse this try-catch block init resources</technical_language>

Target:
public static void main(String[] args) { try(KubernetesClient client = new DefaultKubernetesClient()){ if (!client.supportsApiPath("/apis/apiextensions.k8s.io/v1beta1") && !client.supportsApiPath("/apis/apiextensions.k8s.io/v1")) { System.out.println("WARNING this cluster does not support the API Group apiextensions.k8s.io"); return; } CustomResourceDefinitionList list = client.customResourceDefinitions().list(); if (list == null) { System.out.println("ERROR no list returned!"); return; } List<CustomResourceDefinition> items = list.getItems(); for (CustomResourceDefinition item : items) { System.out.println("CustomResourceDefinition " + item.getMetadata().getName() + " has version: " + item.getApiVersion()); } } catch (KubernetesClientException e) { System.out.println("Failed: " + e); e.printStackTrace(); } }}
Source:
<code>public TumorType(TumorType otherTumorType) { code = otherTumorType.code; color = otherTumorType.color; name = otherTumorType.name; mainType = otherTumorType.mainType; NCI = new ArrayList<String>(otherTumorType.NCI); UMLS = new ArrayList<String>(otherTumorType.UMLS); tissue = otherTumorType.tissue; <START> children = new HashMap<String, TumorType>(otherTumorType.children); <END> parent = otherTumorType.parent; deprecated = otherTumorType.deprecated; history = new ArrayList<String>(otherTumorType.history); level = otherTumorType.level; }</code><technical_language>This is ok, TumorType instances modified created. potentially, this sharing of children (the copy refer objects children of otherTumorType) means a remote edit child TumorType alter "my" children (the copy's children)</technical_language>

Target:
public TumorType(TumorType otherTumorType) { this.code = otherTumorType.code; this.color = otherTumorType.color; this.name = otherTumorType.name; this.mainType = otherTumorType.mainType; this.externalReferences = new HashMap<String, List<String>>(otherTumorType.externalReferences); this.tissue = otherTumorType.tissue; this.children = new HashMap<String, TumorType>(otherTumorType.children); this.parent = otherTumorType.parent; this.history = new ArrayList<String>(otherTumorType.history); this.level = otherTumorType.level; }
Source:
<code>public void testPutWithTimestamp() throws Exception { final EntityId entityId = mTable.getEntityId("foo"); final KijiDataRequest request = KijiDataRequest.create("info", "name"); <START> KijiTableWriter writer = mTable.openTableWriter(); <END> writer.put(entityId, "info", "name", 123L, "old"); writer.close(); mBufferedWriter.put(entityId, KijiColumnName.create("info", "name"), 123L, "baz"); final String actual = mReader.get(entityId, request).getValue("info", "name", 123L).toString(); assertEquals("old", actual); mBufferedWriter.flush().get(); final String actual2 = mReader.get(entityId, request).getValue("info", "name", 123L).toString(); assertEquals("baz", actual2); }</code><technical_language>writer.put() fail, enclose in a try/finally like: try { writer.put() } finally { writer.close() }</technical_language>

Target:
public void testPutWithTimestamp() throws Exception { final EntityId entityId = mTable.getEntityId("foo"); final KijiDataRequest request = KijiDataRequest.create("info", "name"); KijiTableWriter writer = mTable.openTableWriter(); try { writer.put(entityId, "info", "name", 123L, "old"); } finally { writer.close(); } mBufferedWriter.put(entityId, KijiColumnName.create("info", "name"), 123L, "baz"); final String actual = mReader.get(entityId, request).getValue("info", "name", 123L).toString(); assertEquals("old", actual); mBufferedWriter.flush().get(); final String actual2 = mReader.get(entityId, request).getValue("info", "name", 123L).toString(); assertEquals("baz", actual2); }
Source:
<code>public static List<ProtoGrade> gradingRequestHandler(final Institution institution, final ItemRequest request, final String authId, final String userId) throws DatabaseAccessException, InvalidProtocolBufferException, AuthenticationException { final GradingQuery query = GradingQuery.parseFrom(request.getAdvanceQuery()); final boolean instructor = query.getPermissionLevel() == GradingQuery.PermissionLevel.INSTRUCTOR; final boolean student = query.getPermissionLevel() == GradingQuery.PermissionLevel.STUDENT; final boolean allGrades = query.getSearchType() == GradingQuery.SearchType.ALL_GRADES; final boolean singleGrade = query.getSearchType() == GradingQuery.SearchType.SINGLE_GRADE; LOG.debug("Query State instructor: {}, student: {}, allGrades: {}, singleGrade: {}", instructor, student, allGrades, singleGrade); List<ProtoGrade> returnList = new ArrayList<>(); if (instructor && allGrades) { returnList = institution.getAllAssignmentGradesInstructor(request.getItemId(COURSE_INDEX), authId); } else if (student && allGrades) { <START> returnList = institution.getAllAssignmentGradesStudent(request.getItemId(COURSE_INDEX), authId, userId); <END> } else { final ProtoGrade gradeData = ProtoGrade.newBuilder() .setUserId(request.getItemId(USER_INDEX)) .setCourseId(request.getItemId(COURSE_INDEX)) .setAssignmentId(request.getItemId(ASSIGNMENT_INDEX)) .setProblemId(request.getItemId(PROBLEM_INDEX)) .build(); returnList.add(institution.getGrade(userId, authId, gradeData)); } return returnList; }</code><technical_language>change method userId authId</technical_language>

Target:
public static List<ProtoGrade> gradingRequestHandler(final Institution institution, final ItemRequest request, final String authId, final String userId) throws DatabaseAccessException, InvalidProtocolBufferException, AuthenticationException { final GradingQuery query = GradingQuery.parseFrom(request.getAdvanceQuery()); final boolean instructor = query.getPermissionLevel() == GradingQuery.PermissionLevel.INSTRUCTOR; final boolean student = query.getPermissionLevel() == GradingQuery.PermissionLevel.STUDENT; final boolean allGrades = query.getSearchType() == GradingQuery.SearchType.ALL_GRADES; final boolean singleGrade = query.getSearchType() == GradingQuery.SearchType.SINGLE_GRADE; LOG.debug("Query State instructor: {}, student: {}, allGrades: {}, singleGrade: {}", instructor, student, allGrades, singleGrade); List<ProtoGrade> returnList = new ArrayList<>(); if (instructor && allGrades) { returnList = institution.getAllAssignmentGradesInstructor(authId, request.getItemId(COURSE_INDEX)); } else if (student && allGrades) { returnList = institution.getAllAssignmentGradesStudent(userId, authId, request.getItemId(COURSE_INDEX)); } else { final ProtoGrade gradeData = ProtoGrade.newBuilder() .setUserId(request.getItemId(USER_INDEX)) .setCourseId(request.getItemId(COURSE_INDEX)) .setAssignmentId(request.getItemId(ASSIGNMENT_INDEX)) .setProblemId(request.getItemId(PROBLEM_INDEX)) .build(); returnList.add(institution.getGrade(userId, authId, gradeData)); } return returnList; }
Source:
<code>public DataTransactionResult set(DataHolder dataHolder, DyeableData manipulator, MergeFunction function) { if (!supports(dataHolder)) { return DataTransactionResult.failResult(manipulator.type().asImmutable()); } DyeableData original = from(dataHolder).get(); DyeableData merged = function.merge(original, manipulator); ((IMixinTileEntityShulkerBox) dataHolder).setColor((EnumDyeColor) (Object) merged.type().get()); <START> return DataTransactionResult.successReplaceResult(original.type().asImmutable(), merged.type().asImmutable()); <END> }</code><technical_language>While this method read ok, is wasting a lot of resources generating unnecessary objects line</technical_language>

Target:
public DataTransactionResult set(DataHolder dataHolder, DyeableData manipulator, MergeFunction function) { DyeableData original = dataHolder.require(DyeableData.class); DyeableData merged = function.merge(original, manipulator); Value<DyeColor> mergedValue = merged.type(); ((IMixinTileEntityShulkerBox) dataHolder).setColor((EnumDyeColor) (Object) mergedValue.get()); return DataTransactionResult.successReplaceResult(original.type().asImmutable(), mergedValue.asImmutable()); }
Source:
<code>public void testTransformInternet() throws Exception { if (!TestHelper.isInternetConnected()) { <START> return; <END> } assertEquals("94.142.215.39", t.transform(new MockInputRow().put(col, "eobjects.org"))[0]); }</code><technical_language>This is wrong-ish. org.junit.Assume.assumeTrue(TestHelper.isInternetConnected()); instead. test properly skipped instead of claiming test passed, about</technical_language>

Target:
public void testTransformInternet() throws Exception { Assume.assumeTrue(TestHelper.isInternetConnected()); assertEquals("94.142.215.39", t.transform(new MockInputRow().put(col, "eobjects.org"))[0]); }
Source:
<code>private void reset() { logger.info("Resetting the routing table."); for (String key: _routingTableRefMap.keySet()) { PropertyType propertyType = _routingTableRefMap.get(key).get().getPropertyType(); if (propertyType == PropertyType.CUSTOMIZEDVIEW) { String stateType = _routingTableRefMap.get(key).get().getStateType(); RoutingTable newRoutingTable = new CustomizedViewRoutingTable(propertyType, stateType); <START> _routingTableRefMap.get(key).set(newRoutingTable); <END> } else { RoutingTable newRoutingTable = new RoutingTable(propertyType); _routingTableRefMap.get(key).set(newRoutingTable); } } }</code><technical_language>nit, move this condition block for reducing verbose code</technical_language>

Target:
private void reset() { logger.info("Resetting the routing table."); RoutingTable newRoutingTable; for (String key: _routingTableRefMap.keySet()) { PropertyType propertyType = _routingTableRefMap.get(key).get().getPropertyType(); if (propertyType == PropertyType.CUSTOMIZEDVIEW) { String stateType = _routingTableRefMap.get(key).get().getStateType(); newRoutingTable = new CustomizedViewRoutingTable(propertyType, stateType); } else { newRoutingTable = new RoutingTable(propertyType); } _routingTableRefMap.get(key).set(newRoutingTable); } }
Source:
<code>protected VDSGroup lookupClusterByName(String name) { <START> return getEntity(VDSGroup.class, VdcQueryType.GetVdsGroupByName, new NameQueryParameters(name), "GetVdsGroupByName"); <END> }</code><technical_language>parameter of "getEntity" method presented user in case of error. Putting name of query type help, is internal detail. Please following: "Cluster: name=" + name</technical_language>

Target:
protected VDSGroup lookupClusterByName(String name) { return getEntity(VDSGroup.class, VdcQueryType.GetVdsGroupByName, new NameQueryParameters(name), "Cluster: name=" + name); }
Source:
<code>public @ResponseBody Map<String, Object> cswRequest(@RequestParam String xml){ try { String decodedXML = java.net.URLDecoder.decode(xml, "UTF-8"); String response = this.metadataService.cswRequest(decodedXML); return ResultSet.success(response); } catch (URISyntaxException | HttpException | IOException e) { <START> return ResultSet.error("Error while updating Sld: " + e.getMessage()); <END> } }</code><technical_language>wrong msg</technical_language>

Target:
public @ResponseBody Map<String, Object> cswRequest(@RequestParam String xml){ try { String decodedXML = java.net.URLDecoder.decode(xml, "UTF-8"); String response = this.metadataService.cswRequest(decodedXML); return ResultSet.success(response); } catch (URISyntaxException | HttpException | IOException e) { return ResultSet.error("Error during csw-transaction: " + e.getMessage()); } }
Source:
<code>public void selectNthItem(int n) { requestFocus(); <START> assert(getItems().size() < n); <END> getSelectionModel().clearAndSelect(n - 1); scrollAndShow(n - 1); selectedIndex = Optional.of(n - 1); onItemSelected.accept(selectedIndex.get()); }</code><technical_language>Needs assertion for bound</technical_language>

Target:
public void selectNthItem(int n) { requestFocus(); assert n <= getItems().size() && n > 0; getSelectionModel().clearAndSelect(n - 1); scrollAndShow(n - 1); selectedIndex = Optional.of(n - 1); onItemSelected.accept(selectedIndex.get()); }
Source:
<code>private static TypeReference[] computeExceptions(IClassHierarchy cha, IR ir, SSAInstruction s) throws InvalidClassFileException { Collection<TypeReference> c = null; Language l = ir.getMethod().getDeclaringClass().getClassLoader().getLanguage(); if (s instanceof SSAInvokeInstruction) { SSAInvokeInstruction call = (SSAInvokeInstruction) s; c = l.inferInvokeExceptions(call.getDeclaredTarget(), cha); } else { c = s.getExceptionTypes(); } if (c == null) { return null; } else { TypeReference[] exceptions = new TypeReference[c.size()]; Iterator<TypeReference> it = c.iterator(); <START> Arrays.setAll(exceptions, i -> it.next()); <END> return exceptions; } }</code><technical_language>toArray</technical_language>

Target:
private static TypeReference[] computeExceptions(IClassHierarchy cha, IR ir, SSAInstruction s) throws InvalidClassFileException { final Collection<TypeReference> c; Language l = ir.getMethod().getDeclaringClass().getClassLoader().getLanguage(); if (s instanceof SSAInvokeInstruction) { SSAInvokeInstruction call = (SSAInvokeInstruction) s; c = l.inferInvokeExceptions(call.getDeclaredTarget(), cha); } else { c = s.getExceptionTypes(); } return c == null ? null : c.toArray(new TypeReference[0]); }
Source:
<code>public void findAllSortedAsync_onSubObjectField() { Realm realm = looperThread.realm; populateTestRealm(realm, TEST_DATA_SIZE); RealmResults<AllTypes> results = realm.where(AllTypes.class) .findAllSorted(AllTypes.FIELD_REALMOBJECT + "." + Dog.FIELD_AGE); looperThread.keepStrongReference.add(results); results.addChangeListener(new RealmChangeListener<RealmResults<AllTypes>>() { @Override public void onChange(RealmResults<AllTypes> results) { <START> assertEquals(0, results.get(0).getColumnRealmObject().getAge()); <END> assertEquals(TEST_DATA_SIZE - 1, results.get(TEST_DATA_SIZE - 1).getColumnRealmObject().getAge()); looperThread.testComplete(); } }); }</code><technical_language>this listener is triggered? local commit trigger listeners previously registered posting looper</technical_language>

Target:
public void findAllSortedAsync_onSubObjectField() { Realm realm = looperThread.realm; populateTestRealm(realm, TEST_DATA_SIZE); RealmResults<AllTypes> results = realm.where(AllTypes.class) .findAllSortedAsync(AllTypes.FIELD_REALMOBJECT + "." + Dog.FIELD_AGE); looperThread.keepStrongReference.add(results); results.addChangeListener(new RealmChangeListener<RealmResults<AllTypes>>() { @Override public void onChange(RealmResults<AllTypes> results) { assertEquals(0, results.get(0).getColumnRealmObject().getAge()); assertEquals(TEST_DATA_SIZE - 1, results.get(TEST_DATA_SIZE - 1).getColumnRealmObject().getAge()); looperThread.testComplete(); } }); }
Source:
<code>private static int getMajorJavaVersion() { int major = 0; String version = WildFlySecurityManager.getPropertyPrivileged("java.specification.version", null); if (version != null) { if (version.contains(".")) { major = Integer.parseInt(version.split("\\.")[1]); } else { major = Integer.parseInt(version); } } return major; <START> } <END></code><technical_language>big of a deal, a group matching safer. If for reason this property changes 11.0.0_02 this return 0. is essentially is for determining version for domains. private static int getMajorJavaVersion() { int major = 8; String version = WildFlySecurityManager.getPropertyPrivileged("java.specification.version", null); if (version != null) { Matcher matcher = Pattern.compile("^(?:1\\.)?(\\d+)$").matcher(version); if (matcher.find()) { major = Integer.valueOf(matcher.group(1)); } } return major; }</technical_language>

Target:
private static int getMajorJavaVersion() { int major = 8; String version = WildFlySecurityManager.getPropertyPrivileged("java.specification.version", null); if (version != null) { Matcher matcher = Pattern.compile("^(?:1\\.)?(\\d+)$").matcher(version); if (matcher.find()) { major = Integer.valueOf(matcher.group(1)); } } return major; }}
Source:
<code>public ImageDescriptor createImageDescriptor() { Program program = <START> ProgramFinder.findProgram(extension.toLowerCase()); <END> if (program == null || program.getImageData() == null) { return null; } return ImageDescriptor.createFromImageData(program.getImageData()); }</code><technical_language>Perform this operation in custom ProgramFinder.findProgram() method instead</technical_language>

Target:
public ImageDescriptor createImageDescriptor() { Program program = ProgramFinder.findProgram(extension); if (program == null || program.getImageData() == null) { return null; } return ImageDescriptor.createFromImageData(program.getImageData()); }
Source:
<code>@Override public Observable<Boolean> observeInternetConnectivity(final int initialIntervalInMs, final int intervalInMs, final String host, final int port, final int timeoutInMs, final ErrorHandler errorHandler) { Preconditions.checkGreaterOrEqualToZero(initialIntervalInMs, "initialIntervalInMs is not a positive number"); Preconditions.checkGreaterThanZero(intervalInMs, "intervalInMs is not a positive number"); Preconditions.checkNotNullOrEmpty(host, "host is null or empty"); Preconditions.checkGreaterThanZero(port, "port is not a positive number"); Preconditions.checkGreaterThanZero(timeoutInMs, "timeoutInMs is not a positive number"); Preconditions.checkNotNull(errorHandler, "errorHandler is null"); return Observable.interval(initialIntervalInMs, intervalInMs, TimeUnit.MILLISECONDS, Schedulers.io()).map(new Function<Long, Boolean>() { <START> @Override public Boolean apply(@NonNull Long aLong) throws Exception { <END> return isConnected(host, port, timeoutInMs, errorHandler); } }).distinctUntilChanged(); }</code><technical_language>Please change variable name tick previously</technical_language>

Target:
@Override public Observable<Boolean> observeInternetConnectivity(final int initialIntervalInMs, final int intervalInMs, final String host, final int port, final int timeoutInMs, final ErrorHandler errorHandler) { Preconditions.checkGreaterOrEqualToZero(initialIntervalInMs, "initialIntervalInMs is not a positive number"); Preconditions.checkGreaterThanZero(intervalInMs, "intervalInMs is not a positive number"); Preconditions.checkNotNullOrEmpty(host, "host is null or empty"); Preconditions.checkGreaterThanZero(port, "port is not a positive number"); Preconditions.checkGreaterThanZero(timeoutInMs, "timeoutInMs is not a positive number"); Preconditions.checkNotNull(errorHandler, "errorHandler is null"); return Observable.interval(initialIntervalInMs, intervalInMs, TimeUnit.MILLISECONDS, Schedulers.io()).map(new Function<Long, Boolean>() { @Override public Boolean apply(@NonNull Long tick) throws Exception { return isConnected(host, port, timeoutInMs, errorHandler); } }).distinctUntilChanged(); }
Source:
<code>private void terminateWindowsApplication() { List<String> cmd = new ArrayList<>(); cmd.add("WMIC"); cmd.add("PROCESS"); cmd.add("WHERE"); cmd.add("CommandLine like '%vertx.id=" + id + "%'"); cmd.add("CALL"); cmd.add("TERMINATE"); try { final Process process = new ProcessBuilder(cmd).start(); out.println("Application '" + id + "' stopped"); process.waitFor(); } catch (Exception e) { <START> out.println("Failed to stop application '" + id + "'"); <END> e.printStackTrace(out); } }</code><technical_language>reset Interrupted status, I waitFor() throws InterruptedException</technical_language>

Target:
private void terminateWindowsApplication() { List<String> cmd = Arrays.asList( "WMIC", "PROCESS", "WHERE", "CommandLine like '%vertx.id=" + id + "%'", "CALL", "TERMINATE" ); try { final Process process = new ProcessBuilder(cmd).start(); out.println("Application '" + id + "' stopped"); process.waitFor(); } catch (Exception e) { out.println("Failed to stop application '" + id + "'"); e.printStackTrace(out); } }
Source:
<code>protected static boolean shouldUpdate(OskariLayer layer) { Date lastUpdated = layer.getCapabilitiesLastUpdated(); if (lastUpdated == null) { <START> LOG.debug("Should update layer:", layer.getId(), "last updated unknown and update rate is positive"); <END> return true; } int rate = layer.getCapabilitiesUpdateRateSec(); long nextUpdate = lastUpdated.getTime() + TimeUnit.SECONDS.toMillis(rate); long now = System.currentTimeMillis(); LOG.debug("Layer:", layer.getId(), "next scheduled update is:", nextUpdate, "now is", now); if (nextUpdate <= now) { return true; } LOG.debug("Skipping layerId:", layer.getId(), "as recently updated"); return false; }</code><technical_language>Update rate checked here, I guess if update is null update. change message a bit</technical_language>

Target:
protected static boolean shouldUpdate(OskariLayer layer) { Date lastUpdated = layer.getCapabilitiesLastUpdated(); if (lastUpdated == null) { LOG.debug("Should update layer:", layer.getId(), "last updated unknown"); return true; } int rate = layer.getCapabilitiesUpdateRateSec(); long nextUpdate = lastUpdated.getTime() + TimeUnit.SECONDS.toMillis(rate); long now = System.currentTimeMillis(); LOG.debug("Layer:", layer.getId(), "next scheduled update is:", nextUpdate, "now is", now); if (nextUpdate <= now) { return true; } LOG.debug("Skipping layerId:", layer.getId(), "as recently updated"); return false; }
Source:
<code>public DataUriSchemeParser(String url) { <START> this.url = url; <END> }</code><technical_language>this.url = checkNotNull(url, "url");</technical_language>

Target:
public DataUriSchemeParser(String url) { this.url = Preconditions.checkNotNull(url, "url"); }
Source:
<code>public Class<? extends StreamOperator> getStreamOperatorClass(ClassLoader classLoader) { <START> return AbstractStreamingCommitterOperator.class; <END> }</code><technical_language>StreamingCommitterOperator, right</technical_language>

Target:
public Class<? extends StreamOperator> getStreamOperatorClass(ClassLoader classLoader) { return StreamingCommitterOperator.class; }
Source:
<code>public void deleteAlias(String alias) { mapLock.lock(); try { List<String> jobs = alias2jobs.get(alias); alias2jobs.remove(alias); if ((jobs != null) && !jobs.isEmpty()) { for (String job : jobs) { String aliasVal = job2alias.get(job); if (Objects.equals(aliasVal, alias)) { job2alias.remove(job); } } } } finally { mapLock.unlock(); <START> } <END> spawnDataStore.deleteChild(ALIAS_PATH, alias); ac.deleteAlias(alias); }</code><technical_language>copy maps first? if deleteChild call fails? a bad state</technical_language>

Target:
public void deleteAlias(String alias) throws Exception { spawnDataStore.deleteChild(ALIAS_PATH, alias); if( !Strings.isNullOrEmpty(spawnDataStore.getChild(ALIAS_PATH, alias))) { log.error("Fail to delete alias from spawn datastore", alias); return; } mapLock.lock(); try { List<String> jobs = alias2jobs.get(alias); alias2jobs.remove(alias); if ((jobs != null) && !jobs.isEmpty()) { for (String job : jobs) { String aliasVal = job2alias.get(job); if (Objects.equals(aliasVal, alias)) { job2alias.remove(job); } } } } finally { mapLock.unlock(); } ac.deleteAlias(alias); }
Source:
<code>protected void doExecute() throws Exception { if (defaultOutputDirSet) { outputDirectory = new File(project.getBuild().getDirectory(), "liberty-alt-output-dir"); } if (skip || skipLibertyPackage) { return; } if (isInstall) { installServerAssembly(); } else { log.info(MessageFormat.format(messages.getString("info.install.type.preexisting"), "")); checkServerHomeExists(); checkServerDirectoryExists(); } log.info(MessageFormat.format(messages.getString("info.server.package"), serverName)); ServerTask serverTask = initializeJava(); copyConfigFiles(); serverTask.setOperation("package"); <START> validateIncludeAndPackageType(); <END> setPackageFilePath(); serverTask.setArchive(packageFile); serverTask.setInclude(include); serverTask.setOs(os); serverTask.setServerRoot(serverRoot); log.info(MessageFormat.format(messages.getString("info.server.package.file.location"), packageFile.getCanonicalPath())); serverTask.execute(); if ("liberty-assembly".equals(project.getPackaging())) { project.getArtifact().setFile(packageFile); } else if (attach) { if (packageFileType.getValue() != project.getPackaging()) { throw new MojoFailureException("packageType must match project packaging type."); } project.getArtifact().setFile(packageFile); } }</code><technical_language>This is called setPackageFilePath() in next line</technical_language>

Target:
protected void doExecute() throws Exception { if (defaultOutputDirSet) { outputDirectory = new File(project.getBuild().getDirectory(), "liberty-alt-output-dir"); } if (skip || skipLibertyPackage) { return; } if (isInstall) { installServerAssembly(); } else { log.info(MessageFormat.format(messages.getString("info.install.type.preexisting"), "")); checkServerHomeExists(); checkServerDirectoryExists(); } log.info(MessageFormat.format(messages.getString("info.server.package"), serverName)); ServerTask serverTask = initializeJava(); copyConfigFiles(); serverTask.setOperation("package"); setPackageFilePath(); serverTask.setArchive(packageFile); serverTask.setInclude(include); serverTask.setOs(os); serverTask.setServerRoot(serverRoot); log.info(MessageFormat.format(messages.getString("info.server.package.file.location"), packageFile.getCanonicalPath())); serverTask.execute(); if ("liberty-assembly".equals(project.getPackaging())) { project.getArtifact().setFile(packageFile); } else if (attach) { if (packageFileType.getValue() != project.getPackaging()) { throw new MojoFailureException("packageType must match project packaging type."); } project.getArtifact().setFile(packageFile); } }
Source:
<code>private void createCacheWithXMLConfiguration() { String cacheName = "CacheWithXMLConfiguration"; String xml = String.format("<infinispan>" + <START> "<cache-container>" + <END> "<distributed-cache name=\"%s\" mode=\"SYNC\">" + "<locking isolation=\"READ_COMMITTED\"/>" + "<transaction mode=\"NON_XA\"/>" + "<expiration lifespan=\"60000\" interval=\"20000\"/>" + "</distributed-cache>" + "</cache-container>" + "</infinispan>" , cacheName); manager.administration().getOrCreateCache(cacheName, new XMLStringConfiguration(xml)); System.out.println("Cache with configuration exists or is created"); }</code><technical_language>createCache simply</technical_language>

Target:
private void createCacheWithXMLConfiguration() { String cacheName = "CacheWithXMLConfiguration"; String xml = String.format("<infinispan>" + "<cache-container>" + "<distributed-cache name=\"%s\" mode=\"SYNC\">" + "<locking isolation=\"READ_COMMITTED\"/>" + "<transaction mode=\"NON_XA\"/>" + "<expiration lifespan=\"60000\" interval=\"20000\"/>" + "</distributed-cache>" + "</cache-container>" + "</infinispan>" , cacheName); manager.administration().getOrCreateCache(cacheName, new XMLStringConfiguration(xml)); System.out.println("Cache with configuration exists or is created."); }
Source:
<code>protected void startUpdateCheck() { try { updateTask = UpdateTask.getNewInstance(); updateTask.startPinnedNotification(this); updateTask.registerTaskListener(this); } catch (IllegalStateException e) { <START> enterErrorState("There is already an existing update task instance."); <END> return; } catch (TaskListenerRegistrationException e) { enterErrorState("Attempting to register a TaskListener to an " + "already registered task."); return; } String ref = ResourceInstallUtils.getDefaultProfileRef(); updateTask.execute(ref); uiState.downloadingUiState(); }</code><technical_language>this connect running instance this activity</technical_language>

Target:
protected void startUpdateCheck() { try { updateTask = UpdateTask.getNewInstance(); updateTask.startPinnedNotification(this); updateTask.registerTaskListener(this); } catch (IllegalStateException e) { connectToRunningTask(); return; } catch (TaskListenerRegistrationException e) { enterErrorState("Attempting to register a TaskListener to an " + "already registered task."); return; } String ref = ResourceInstallUtils.getDefaultProfileRef(); updateTask.execute(ref); uiState.downloadingUiState(); }