auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>protected boolean isProblem(IReference reference) { IApiMember member = reference.getResolvedReference(); try { IApiAnnotations annotations = member.getApiComponent().getApiDescription().resolveAnnotations(member.getHandle()); if (annotations != null) { return VisibilityModifiers.isPrivate(annotations.getVisibility()); } else { if (isEnclosingTypeVisible(member)) { if <START> (member.getName() != <END> null) { if (!member.getName().startsWith("javax.")) { ApiPlugin.log(new Status(IStatus.INFO, ApiPlugin.PLUGIN_ID, MessageFormat.format(BuilderMessages.AbstractTypeLeakDetector_vis_type_has_no_api_description, member.getName()))); } } } else { return true; } } } catch (CoreException e) { ApiPlugin.log(e); } return false; }</code><technical_language>extracted a local variable</technical_language>

Target:
protected boolean isProblem(IReference reference) { IApiMember member = reference.getResolvedReference(); try { IApiAnnotations annotations = member.getApiComponent().getApiDescription().resolveAnnotations(member.getHandle()); if (annotations != null) { return VisibilityModifiers.isPrivate(annotations.getVisibility()); } else { if (isEnclosingTypeVisible(member)) { String memberName = member.getName(); if (memberName != null) { if (!memberName.startsWith("javax.")) { ApiPlugin.log(new Status(IStatus.INFO, ApiPlugin.PLUGIN_ID, MessageFormat.format(BuilderMessages.AbstractTypeLeakDetector_vis_type_has_no_api_description, memberName))); } } } else { return true; } } } catch (CoreException e) { ApiPlugin.log(e); } return false; }
Source:
<code>private AuthenticationResult tryFRT(final String familyClientId, final AuthenticationResult mrrtResult) throws AuthenticationException { CacheEvent cacheEvent = new CacheEvent(EventStrings.TOKEN_CACHE_LOOKUP); cacheEvent.setTokenType(EventStrings.TOKEN_TYPE_FRT); cacheEvent.setRequestId(mAuthRequest.getTelemetryRequestId()); Telemetry.getInstance().startEvent(mAuthRequest.getTelemetryRequestId(), EventStrings.TOKEN_CACHE_LOOKUP); final TokenCacheItem frtTokenCacheItem = mTokenCacheAccessor.getFRTItem(familyClientId, mAuthRequest.getUserFromRequest()); if (frtTokenCacheItem == null) { Telemetry.getInstance().stopEvent(mAuthRequest.getTelemetryRequestId(), cacheEvent, EventStrings.TOKEN_CACHE_LOOKUP); if (!mAttemptedWithMRRT) { Logger.v(TAG, "FRT cache item does not exist, fall back to try MRRT."); return useMRRT(); } else { return mrrtResult; } } cacheEvent.setTokenTypeFRT(true); Logger.v(TAG, "Send request to use FRT for new AT."); AuthenticationResult frtResult = acquireTokenWithCachedItem(frtTokenCacheItem); if (isTokenRequestFailed(frtResult) && !mAttemptedWithMRRT) { final AuthenticationResult retryMrrtResult = useMRRT(); frtResult = retryMrrtResult == null ? frtResult : retryMrrtResult; } Telemetry.getInstance().stopEvent(mAuthRequest.getTelemetryRequestId(), <START> cacheEvent, EventStrings.TOKEN_CACHE_LOOKUP); <END> return frtResult; }</code><technical_language>missing event for fall MRRT? #Closed</technical_language>

Target:
private AuthenticationResult tryFRT(final String familyClientId, final AuthenticationResult mrrtResult) throws AuthenticationException { final TokenCacheItem frtTokenCacheItem = mTokenCacheAccessor.getFRTItem(familyClientId, mAuthRequest.getUserFromRequest()); if (frtTokenCacheItem == null) { if (!mAttemptedWithMRRT) { Logger.v(TAG, "FRT cache item does not exist, fall back to try MRRT."); return useMRRT(); } else { return mrrtResult; } } Logger.v(TAG, "Send request to use FRT for new AT."); AuthenticationResult frtResult = acquireTokenWithCachedItem(frtTokenCacheItem); if (isTokenRequestFailed(frtResult) && !mAttemptedWithMRRT) { final AuthenticationResult retryMrrtResult = useMRRT(); frtResult = retryMrrtResult == null ? frtResult : retryMrrtResult; } return frtResult; }
Source:
<code>public void inflateClientInformation() { <START> ConnectivityManager connectivityManager = (ConnectivityManager) getContext().getSystemService(Context.CONNECTIVITY_SERVICE); <END> NetworkInfo networkInfo = connectivityManager.getActiveNetworkInfo(); if(networkInfo != null && networkInfo.isConnected()){ mClientDetailsPresenter.loadClientDetailsAndClientAccounts(clientId); return; } showFetchingError("Device not connected to internet"); }</code><technical_language>separate lines of condition in check style plugin i.e. put more 100 characters in line, build is failing</technical_language>

Target:
public void inflateClientInformation() { Context context = getContext(); Object systemService = context.getSystemService(Context.CONNECTIVITY_SERVICE); ConnectivityManager connectivityManager = (ConnectivityManager) systemService; NetworkInfo networkInfo = connectivityManager.getActiveNetworkInfo(); if (networkInfo != null && networkInfo.isConnected()) { mClientDetailsPresenter.loadClientDetailsAndClientAccounts(clientId); return; } showFetchingError(getString(R.string.device_not_connected_to_internet)); }
Source:
<code>public long getGreatestLogEntry() { <START> return execute(x -> x.getGreatestLogEntry(namespace)).orElse(PaxosAcceptor.NO_LOG_ENTRY); <END> }</code><technical_language>nit: standardise x dao</technical_language>

Target:
public long getGreatestLogEntry() { return execute(dao -> dao.getGreatestLogEntry(namespace)).orElse(PaxosAcceptor.NO_LOG_ENTRY); }
Source:
<code>private static @Pointer long retain(@Pointer long self, @Pointer long sel) { if (ObjCRuntime.int_objc_msgSend(self, retainCount) <= 1) { synchronized (CUSTOM_OBJECTS) { ObjCClass cls = ObjCClass.toObjCClass(ObjCRuntime.object_getClass(self)); ObjCObject obj = ObjCObject.toObjCObject(cls.getType(), self, 0); CUSTOM_OBJECTS.put(self, obj); } } long cls = ObjCRuntime.object_getClass(self); <START> long nativeSuper = customClassToNativeSuper.get(cls); <END> Super sup = new Super(self, nativeSuper); return ObjCRuntime.ptr_objc_msgSendSuper(sup.getHandle(), sel); }</code><technical_language>customClassToNativeSuper.get() call in a synchronized block</technical_language>

Target:
private static @Pointer long retain(@Pointer long self, @Pointer long sel) { if (ObjCRuntime.int_objc_msgSend(self, retainCount) <= 1) { synchronized (CUSTOM_OBJECTS) { ObjCClass cls = ObjCClass.toObjCClass(ObjCRuntime.object_getClass(self)); ObjCObject obj = ObjCObject.toObjCObject(cls.getType(), self, 0); CUSTOM_OBJECTS.put(self, obj); } } long cls = ObjCRuntime.object_getClass(self); long nativeSuper = 0; synchronized(customClassToNativeSuper) { nativeSuper = customClassToNativeSuper.get(cls); } Super sup = new Super(self, nativeSuper); return ObjCRuntime.ptr_objc_msgSendSuper(sup.getHandle(), sel); }
Source:
<code><START> private String describeSize(long nrOfBytes) { <END> if (nrOfBytes<1000L) return nrOfBytes+" Bytes"; if (nrOfBytes<1000000L) return (nrOfBytes/1000L)+" kB"; if (nrOfBytes<1000000000L) return (nrOfBytes/1000000L)+" MB"; return (nrOfBytes/1000000000L)+" GB"; }</code><technical_language>rounding a consistent number of significant digits. E.g. 345,3 MB is displayed 345 MB (that's fine) 3,456MB is displayed 3MB is unnecessarily reducing accuracy, instead this displayed 3,45MB. sense show precise numbers in brackets file system explorers typically display</technical_language>

Target:
private String describeSize(long nrOfBytes) { if (nrOfBytes < 1000L) return bigIntFmt.format(nrOfBytes) + " Bytes"; if (nrOfBytes < 1000000L) return bigFpFmt.format(nrOfBytes / 1000.0) + " kB (" + bigIntFmt.format(nrOfBytes) + ")"; if (nrOfBytes < 1000000000L) return bigFpFmt.format(nrOfBytes / 1000000.0) + " MB (" + bigIntFmt.format(nrOfBytes) + ")"; return bigFpFmt.format(nrOfBytes / 1000000000.0) + " GB (" + bigIntFmt.format(nrOfBytes) + ")"; }
Source:
<code>private Set<GroupUsermetadata> findByLogAndGroup(Integer logId, String groupRowGuid) { Group group = groupRepo.findByRowGuid(groupRowGuid); Set<GroupUsermetadata> result = new HashSet<>(); Set<UsermetadataLog> usermetadataLogSet = new HashSet<>(usermetadataLogRepo.findByLog(logRepo.findUniqueByID(logId))); <START> if (usermetadataLogSet.size() != 0) { <END> for (UsermetadataLog usermetadataLog : usermetadataLogSet) { Usermetadata u = usermetadataLog.getUsermetadata(); List<GroupUsermetadata> groupUsermetadataList = groupUsermetadataRepo.findByUsermetadataId(u.getId()); for (GroupUsermetadata g : groupUsermetadataList) { if (g.getGroup().equals(group)) { result.add(g); } } } } return result; }</code><technical_language>if loop required</technical_language>

Target:
private Set<GroupUsermetadata> findByLogAndGroup(Integer logId, String groupRowGuid) { Group group = groupRepo.findByRowGuid(groupRowGuid); Set<GroupUsermetadata> result = new HashSet<>(); Set<UsermetadataLog> usermetadataLogSet = new HashSet<>(usermetadataLogRepo.findByLog(logRepo.findUniqueByID(logId))); for (UsermetadataLog usermetadataLog : usermetadataLogSet) { Usermetadata u = usermetadataLog.getUsermetadata(); List<GroupUsermetadata> groupUsermetadataList = groupUsermetadataRepo.findByUsermetadataId(u.getId()); for (GroupUsermetadata g : groupUsermetadataList) { if (g.getGroup().equals(group)) { result.add(g); } } } return result; }
Source:
<code>public void testSkipScanFilterQuery() throws Exception { <START> String createTableDDL = "CREATE TABLE test1" + "(col1 VARCHAR," + "col2 VARCHAR," + "col3 VARCHAR," <END> + "col4 VARCHAR," + "CONSTRAINT pk " + "PRIMARY KEY (col1,col2,col3,col4))"; String upsertQuery = "upsert into test1 values(?,?,?,?)"; String query = "SELECT col1, col2, col3, col4 FROM test1 WHERE col1 IN ('a','e','f') AND col2 = 'b' AND col4 = '1' "; String[] col1Values = { "a", "e.f", "f" }; Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); createTestTable(getUrl(), createTableDDL); Connection conn = DriverManager.getConnection(getUrl(), props); conn.setAutoCommit(true); try { PreparedStatement statement = conn.prepareStatement(upsertQuery); for (String col1Value : col1Values) { statement.setString(1, col1Value); statement.setString(2, "b"); statement.setString(3, ""); statement.setString(4, "1"); statement.execute(); } ResultSet rs = conn.createStatement().executeQuery(query); assertTrue(rs.next()); assertEquals(rs.getString(1), "a"); assertTrue(rs.next()); assertEquals(rs.getString(1), "f"); assertFalse(rs.next()); } finally { conn.close(); } }</code><technical_language>Is a reason table name generated randomly</technical_language>

Target:
public void testSkipScanFilterQuery() throws Exception { String tableName = generateRandomString(); String createTableDDL = "CREATE TABLE " + tableName + "(col1 VARCHAR," + "col2 VARCHAR," + "col3 VARCHAR," + "col4 VARCHAR," + "CONSTRAINT pk " + "PRIMARY KEY (col1,col2,col3,col4))"; String upsertQuery = "upsert into " + tableName + " values(?,?,?,?)"; String query = "SELECT col1, col2, col3, col4 FROM " + tableName + " WHERE col1 IN ('a','e','f') AND col2 = 'b' AND col4 = '1' "; String[] col1Values = { "a", "e.f", "f" }; Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); createTestTable(getUrl(), createTableDDL); Connection conn = DriverManager.getConnection(getUrl(), props); conn.setAutoCommit(true); try { PreparedStatement statement = conn.prepareStatement(upsertQuery); for (String col1Value : col1Values) { statement.setString(1, col1Value); statement.setString(2, "b"); statement.setString(3, ""); statement.setString(4, "1"); statement.execute(); } ResultSet rs = conn.createStatement().executeQuery(query); assertTrue(rs.next()); assertEquals(rs.getString(1), "a"); assertTrue(rs.next()); assertEquals(rs.getString(1), "f"); assertFalse(rs.next()); } finally { conn.close(); } }
Source:
<code>protected Role findRoleByFQN(String FQN) throws DotDataException { if(FQN == null){ throw new DotDataException("FQN is null"); } Role r = null; if(!FQN.contains("-->")){ r = findRoleByName(FQN, null); }else{ Role parent = null; String rFQN = ""; try { final String[] rids = FQN.split(" --> "); String parentId = null; for (final String rid : rids) { if (parentId == null) { parent = findRoleByName(rid, null); parentId = parent.getId(); rFQN = parent.getId(); } else { parent = findRoleByName(rid, parent); parentId = parent.getId(); rFQN = rFQN + " --> " + parentId; } } final HibernateUtil hu = new HibernateUtil(Role.class); hu.setQuery("from " + Role.class.getName() + " where db_fqn like ?"); hu.setParam(rFQN); <START> r = (Role) hu.load(); <END> translateFQNFromDB(r); rc.add(r); HibernateUtil.evict(r); } catch (Exception e) { final String errorMessage = String .format("Error finding Role for FQN '%s' and Resolved FQN '%s'.", FQN, rFQN); Logger.error(this, errorMessage, e); throw new DotDataException(errorMessage, e); } } return r; }</code><technical_language>rename role</technical_language>

Target:
protected Role findRoleByFQN(String FQN) throws DotDataException { if(FQN == null){ throw new DotDataException("FQN is null"); } Role role = null; if(!FQN.contains("-->")){ role = findRoleByName(FQN, null); }else{ Role parent = null; String rFQN = ""; try { final String[] rids = FQN.split(" --> "); String parentId = null; for (final String rid : rids) { if (parentId == null) { parent = findRoleByName(rid, null); parentId = parent.getId(); rFQN = parent.getId(); } else { parent = findRoleByName(rid, parent); parentId = parent.getId(); rFQN = rFQN + " --> " + parentId; } } final HibernateUtil hu = new HibernateUtil(Role.class); hu.setQuery("from " + Role.class.getName() + " where db_fqn like ?"); hu.setParam(rFQN); role = (Role) hu.load(); translateFQNFromDB(role); rc.add(role); HibernateUtil.evict(role); } catch (Exception e) { final String errorMessage = String .format("Unable to resolve Role for the FQN '%s' which Resolves to the FQN '%s'.", FQN, rFQN); Logger.error(this, errorMessage, e); return null; } } return role; }
Source:
<code>public final boolean hasRole(final String roleName) { <START> if ("<LINK_1>".equals(roleName)) { <END> return true; } else if ("<LINK_3>".equals(roleName)) { return true; } else if ("<LINK_2>".equals(roleName)) { return true; } else if ("<LINK_0>".equals(roleName)) { return true; } return false; }</code><technical_language>Please constants defined here: <LINK_4></technical_language>

Target:
public final boolean hasRole(final String roleName) { if (WEBAC_MODE_READ_VALUE.equals(roleName)) { return true; } else if (WEBAC_MODE_WRITE_VALUE.equals(roleName)) { return true; } else if (WEBAC_MODE_APPEND_VALUE.equals(roleName)) { return true; } else if (WEBAC_MODE_CONTROL_VALUE.equals(roleName)) { return true; } return false; }
Source:
<code>public Base(final Request req) throws IOException { super(req); final String header = new RqHeaders.Smart( new RqHeaders.Base(req) ).single("Content-Type"); if (!header.toLowerCase(Locale.ENGLISH) .startsWith("multipart/form-data")) { throw new HttpException( HttpURLConnection.HTTP_BAD_REQUEST, String.format( "RqMultipart.Base can only parse multipart/form-data, while Content-Type specifies a different type: \"%s\"", header ) ); } final Matcher matcher = RqMultipart.Base.BOUNDARY.matcher(header); if (!matcher.matches()) { throw new HttpException( HttpURLConnection.HTTP_BAD_REQUEST, String.format( "boundary is not specified in Content-Type header: \"%s\"", header ) ); } final InputStream stream = new RqLengthAware(req).body(); final ReadableByteChannel body = Channels.newChannel(stream); <START> int size = 8192; <END> if (stream.available() < size) { size = stream.available(); } final ByteBuffer buffer = ByteBuffer.allocate(size); if (body.read(buffer) < 0) { throw new HttpException( HttpURLConnection.HTTP_BAD_REQUEST, "failed to read the request body" ); } buffer.flip(); final byte[] boundary = String.format( "\r\n--%s", matcher.group(1) ).getBytes(); buffer.position(boundary.length - 2); final Collection<Request> requests = new LinkedList<Request>(); while (buffer.hasRemaining()) { final byte data = buffer.get(); if (data == '-') { break; } buffer.position(buffer.position() + 1); requests.add(this.make(buffer, body, boundary)); } this.map = RqMultipart.Base.asMap(requests); }</code><technical_language>@dmzaytsev java final int size = Math.min(8192, stream.available())</technical_language>

Target:
public Base(final Request req) throws IOException { super(req); final InputStream stream = new RqLengthAware(req).body(); this.body = Channels.newChannel(stream); this.buffer = ByteBuffer.allocate( Math.min(8192, stream.available()) ); this.map = this.buildRequests(req); }
Source:
<code>public void checkSpecificAccessControl() { if (userInfo.isAdmin) { return; } else if (userInfo.isInstructor) { String courseId = getNonNullRequestParamValue(Const.ParamsNames.COURSE_ID); InstructorAttributes instructor = logic.getInstructorForGoogleId(courseId, userInfo.id); gateKeeper.verifyAccessible( instructor, logic.getCourse(courseId), Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_INSTRUCTOR); } else { <START> throw new UnauthorizedAccessException("Admin or Instructor privilege is required to access this resource."); <END> } }</code><technical_language>of early returns reduce nesting, e.g. java if (userInfo.isAdmin) { return; } if (!userInfo.isInstructor) { throw new UnauthorizedAccessException(...); } // else</technical_language>

Target:
public void checkSpecificAccessControl() { if (userInfo.isAdmin) { return; } if (!userInfo.isInstructor) { throw new UnauthorizedAccessException("Admin or Instructor privilege is required to access this resource."); } String courseId = getNonNullRequestParamValue(Const.ParamsNames.COURSE_ID); InstructorAttributes instructor = logic.getInstructorForGoogleId(courseId, userInfo.id); gateKeeper.verifyAccessible( instructor, logic.getCourse(courseId), Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_INSTRUCTOR); }
Source:
<code>public List<FieldMapping> createDefaultFieldMapping(RegionMapping regionMapping, PdxType pdxType) { DataSource dataSource = getDataSource(regionMapping.getDataSourceName()); if (dataSource == null) { throw new JdbcConnectorException("No datasource \"" + regionMapping.getDataSourceName() <START> + "\" found when creating mapping \"" + regionMapping.getRegionName() + "\""); <END> } try (Connection connection = dataSource.getConnection()) { TableMetaDataView tableMetaData = getTableMetaDataView(regionMapping, dataSource); return createDefaultFieldMapping(regionMapping, pdxType, tableMetaData); } catch (SQLException e) { throw JdbcConnectorException.createException(e); } }</code><technical_language>data source do table metadata region name. I recommend removing this line of error message</technical_language>

Target:
public List<FieldMapping> createDefaultFieldMapping(RegionMapping regionMapping, PdxType pdxType) { DataSource dataSource = getDataSource(regionMapping.getDataSourceName()); if (dataSource == null) { throw new JdbcConnectorException("No datasource \"" + regionMapping.getDataSourceName() + "\" found when creating default field mapping"); } try (Connection connection = dataSource.getConnection()) { TableMetaDataView tableMetaData = getTableMetaDataView(regionMapping, dataSource); return createDefaultFieldMapping(regionMapping, pdxType, tableMetaData); } catch (SQLException e) { throw JdbcConnectorException.createException(e); } }
Source:
<code>public void start() { DateTime now = DateTime.now(); executionStartTime.compareAndSet(null, now); startNanos.compareAndSet(0, System.nanoTime()); startFullGcCount.compareAndSet(0, gcMonitor.getMajorGcCount()); <START> startFullGcTimeNanos.compareAndSet(0, gcMonitor.getMajorGcTime().roundTo(NANOSECONDS)); <END> lastExecutionStartTime.set(now); }</code><technical_language>0 is a reasonable initial for fields. -1 instead. I imagine values stay 0 for a long time VM start</technical_language>

Target:
public void start() { DateTime now = DateTime.now(); executionStartTime.compareAndSet(null, now); startNanos.compareAndSet(0, System.nanoTime()); startFullGcCount.compareAndSet(-1, gcMonitor.getMajorGcCount()); startFullGcTimeNanos.compareAndSet(-1, gcMonitor.getMajorGcTime().roundTo(NANOSECONDS)); lastExecutionStartTime.set(now); }
Source:
<code>public void onNext(final Message<AvroPSMsg> msg) { LOG.entering(ServerSideMsgHandler.class.getSimpleName(), "onNext"); <START> Trace.setProcessId("parameter_server"); <END> final AvroPSMsg innerMsg = SingleMessageExtractor.extract(msg); final TraceInfo traceInfo = HTraceUtils.fromAvro(innerMsg.getTraceInfo()); switch (innerMsg.getType()) { case PushMsg: onPushMsg(msg.getSrcId().toString(), innerMsg.getPushMsg()); break; case PullMsg: onPullMsg(msg.getSrcId().toString(), innerMsg.getPullMsg(), traceInfo); break; default: throw new RuntimeException("Unexpected message type: " + innerMsg.getType().toString()); } LOG.exiting(ServerSideMsgHandler.class.getSimpleName(), "onNext"); }</code><technical_language>do this in constructor</technical_language>

Target:
public void onNext(final Message<AvroPSMsg> msg) { LOG.entering(ServerSideMsgHandler.class.getSimpleName(), "onNext"); final AvroPSMsg innerMsg = SingleMessageExtractor.extract(msg); final TraceInfo traceInfo = HTraceUtils.fromAvro(innerMsg.getTraceInfo()); switch (innerMsg.getType()) { case PushMsg: onPushMsg(msg.getSrcId().toString(), innerMsg.getPushMsg()); break; case PullMsg: onPullMsg(msg.getSrcId().toString(), innerMsg.getPullMsg(), traceInfo); break; default: throw new RuntimeException("Unexpected message type: " + innerMsg.getType().toString()); } LOG.exiting(ServerSideMsgHandler.class.getSimpleName(), "onNext"); }
Source:
<code>public static TimelineResult create(final List<Timeline> timelines, final List<TimelineLog> logs) { final Optional<TimelineLog> logOptional; <START> if(logs.size()>0){ <END> logOptional = Optional.of(logs.get(logs.size()-1)); } else{ logOptional = Optional.absent(); } return new TimelineResult(ImmutableList.copyOf(timelines), logOptional, ImmutableList.copyOf(logs), DataCompleteness.ENOUGH_DATA); }</code><technical_language>isEmpty() check if empty</technical_language>

Target:
public static TimelineResult create(final List<Timeline> timelines, final List<TimelineLog> logs) { final Optional<TimelineLog> logOptional; if(!logs.isEmpty()){ logOptional = Optional.of(logs.get(logs.size()-1)); } else{ logOptional = Optional.absent(); } return new TimelineResult(ImmutableList.copyOf(timelines), logOptional, ImmutableList.copyOf(logs), DataCompleteness.ENOUGH_DATA); }
Source:
<code>public void testDeleteRepeatMultiplicities() throws IOException { FormParseInit fpi = new FormParseInit("/multiple_repeats.xml"); FormEntryController fec = initFormEntry(fpi, "en"); fec.stepToNextEvent(); fec.newRepeat(); fec.stepToNextEvent(); fec.answerQuestion(new StringData("Repeat 1/1")); fec.stepToNextEvent(); fec.answerQuestion(new StringData("Repeat 1/2")); fec.stepToNextEvent(); fec.newRepeat(); fec.stepToNextEvent(); fec.answerQuestion(new StringData("Repeat 2/1")); fec.stepToNextEvent(); fec.answerQuestion(new StringData("Repeat 2/2")); fec.stepToNextEvent(); fec.stepToNextEvent(); fec.newRepeat(); fec.stepToNextEvent(); fec.answerQuestion(new StringData("Repeat 3/1")); fec.stepToNextEvent(); fec.answerQuestion(new StringData("Repeat 3/2")); fec.stepToNextEvent(); fec.newRepeat(); fec.stepToNextEvent(); fec.answerQuestion(new StringData("Repeat 4/1")); fec.stepToNextEvent(); fec.answerQuestion(new StringData("Repeat 4/2")); fec.stepToPreviousEvent(); fec.stepToPreviousEvent(); fec.deleteRepeat(0); TreeElement root = fpi.getFormDef().getInstance().getRoot(); assert root.getChildMultiplicity("question4") == 1; assert root.getChild("question1", 4) == null; assert root.getChildMultiplicity("question1") == 2; <START> assert root.getChild("question1", 1) != null; <END> }</code><technical_language>add similar checks deleteRepeat more easily changed</technical_language>

Target:
public void testDeleteRepeatMultiplicities() throws IOException { FormParseInit fpi = new FormParseInit("/multiple_repeats.xml"); FormEntryController fec = initFormEntry(fpi, "en"); fec.stepToNextEvent(); fec.newRepeat(); fec.stepToNextEvent(); fec.answerQuestion(new StringData("First repeat, first iteration: question2")); fec.stepToNextEvent(); fec.answerQuestion(new StringData("First repeat, first iteration: question3")); fec.stepToNextEvent(); fec.newRepeat(); fec.stepToNextEvent(); fec.answerQuestion(new StringData("First repeat, second iteration: question2")); fec.stepToNextEvent(); fec.answerQuestion(new StringData("First repeat, second iteration: question3")); fec.stepToNextEvent(); fec.stepToNextEvent(); fec.newRepeat(); fec.stepToNextEvent(); fec.answerQuestion(new StringData("Second repeat, first iteration: question5")); fec.stepToNextEvent(); fec.answerQuestion(new StringData("Second repeat, first iteration: question6")); fec.stepToNextEvent(); fec.newRepeat(); fec.stepToNextEvent(); fec.answerQuestion(new StringData("Second repeat, second iteration: question5")); fec.stepToNextEvent(); fec.answerQuestion(new StringData("Second repeat, second iteration: question6")); fec.stepToPreviousEvent(); fec.stepToPreviousEvent(); TreeElement root = fpi.getFormDef().getInstance().getRoot(); assertEquals(root.getChildMultiplicity("question4"), 2); assertNotEquals(root.getChild("question4", 1), null); assertEquals(root.getChildMultiplicity("question1"), 2); assertNotEquals(root.getChild("question1", 1), null); fec.deleteRepeat(0); assertEquals(root.getChildMultiplicity("question4"), 1); assertEquals(root.getChild("question4", 1), null); assertEquals(root.getChildMultiplicity("question1"), 2); assertNotEquals(root.getChild("question1", 1), null); }
Source:
<code>public Identifiable<String> createDispoSet(ArtifactReadable author, DispoProgram program, DispoSet descriptor) { <START> IOseeBranch branch = TokenFactory.createBranch(program.getUuid(), ""); <END> TransactionBuilder tx = getTxFactory().createTransaction(branch, author, "Create Dispo Set"); ArtifactId creatdArtId = tx.createArtifact(DispoConstants.DispoSet, descriptor.getName()); tx.setSoleAttributeFromString(creatdArtId, DispoConstants.ImportPath, descriptor.getImportPath()); tx.setSoleAttributeFromString(creatdArtId, DispoConstants.ImportState, descriptor.getImportState()); tx.setSoleAttributeFromString(creatdArtId, DispoConstants.DispoNotesJson, descriptor.getNotesList().toString()); tx.commit(); return creatdArtId; }</code><technical_language>Add method TokenFactory createBranch takes uuid replace calls. Applications create bogus tokens calls</technical_language>

Target:
public Identifiable<String> createDispoSet(ArtifactReadable author, DispoProgram program, DispoSet descriptor) { TransactionBuilder tx = getTxFactory().createTransaction(program.getUuid(), author, "Create Dispo Set"); ArtifactId creatdArtId = tx.createArtifact(DispoConstants.DispoSet, descriptor.getName()); tx.setSoleAttributeFromString(creatdArtId, DispoConstants.ImportPath, descriptor.getImportPath()); tx.setSoleAttributeFromString(creatdArtId, DispoConstants.ImportState, descriptor.getImportState()); tx.setSoleAttributeFromString(creatdArtId, DispoConstants.DispoNotesJson, descriptor.getNotesList().toString()); tx.commit(); return creatdArtId; }
Source:
<code><START> public void backup(@NotNull final String keyspace) throws IOException { <END> backup(keyspace, "s-" + System.currentTimeMillis()); }</code><technical_language>a more descriptive name for keyspace here, i.e. "cassandra-keyspace-" + System.currentTimeMillis()</technical_language>

Target:
public void backup(@NotNull final String keyspace) throws IOException { backup(keyspace, "snapshot-" + System.currentTimeMillis()); }
Source:
<code>protected Integer addToFacts( AggregatorFactory[] metrics, boolean deserializeComplexMetrics, InputRow row, AtomicInteger numEntries, TimeAndDims key, ThreadLocal<InputRow> in ) throws IndexSizeExceededException { final Aggregator[] aggs; final Integer retval; <START> final Integer rowOffset = numEntries.get(); <END> if (rowOffset >= maxRowCount && !facts.containsKey(key)) { throw new IndexSizeExceededException("Maximum number of rows reached"); } final Integer prev = facts.putIfAbsent(key, rowOffset); if (prev != null) { aggs = aggList.get(prev); retval = rowOffset; } else { aggs = new Aggregator[metrics.length]; for (int i = 0; i < metrics.length; i++) { final AggregatorFactory agg = metrics[i]; aggs[i] = agg.factorize( makeColumnSelectorFactory(agg, in, deserializeComplexMetrics) ); } aggList.set(rowOffset, aggs); retval = numEntries.incrementAndGet(); } in.set(row); for (int i = 0; i < aggs.length; i++) { synchronized (aggs[i]) { aggs[i].aggregate(); } } in.set(null); return retval; }</code><technical_language>happened synchronized block</technical_language>

Target:
protected Integer addToFacts( AggregatorFactory[] metrics, boolean deserializeComplexMetrics, InputRow row, AtomicInteger numEntries, TimeAndDims key, ThreadLocal<InputRow> in ) throws IndexSizeExceededException { final Integer priorIndex = facts.get(key); Aggregator[] aggs; if (null != priorIndex) { aggs = concurrentGet(priorIndex); } else { aggs = new Aggregator[metrics.length]; for (int i = 0; i < metrics.length; i++) { final AggregatorFactory agg = metrics[i]; aggs[i] = agg.factorize( makeColumnSelectorFactory(agg, in, deserializeComplexMetrics) ); } final Integer rowIndex = indexIncrement.getAndIncrement(); concurrentSet(rowIndex, aggs); if (numEntries.get() >= maxRowCount && !facts.containsKey(key)) { throw new IndexSizeExceededException("Maximum number of rows reached"); } final Integer prev = facts.putIfAbsent(key, rowIndex); if (null == prev) { numEntries.incrementAndGet(); } else { aggs = concurrentGet(prev); concurrentRemove(rowIndex); } } in.set(row); for (Aggregator agg : aggs) { synchronized (agg) { agg.aggregate(); } } in.set(null); return numEntries.get(); }
Source:
<code>public void onUserClicked(String id) { if(BuildConfig.DEBUG) { <START> startActivity(PublicProfileActivity.getLaunchIntent(this ,id)); <END> } }</code><technical_language>FIXME: This crashes. Also, need wrapped in a debug check</technical_language>

Target:
public void onUserClicked(String id) { startActivity(PublicProfileActivity.getLaunchIntent(this, id)); }
Source:
<code>public ListImageOptions changesSince(Date ifModifiedSince) { <START> queryParameters.put("changes-since", checkNotNull(ifModifiedSince, "ifModifiedSince").getTime() / 1000 + ""); <END> return this; }</code><technical_language>checkNotNull message more descriptive</technical_language>

Target:
public ListImageOptions changesSince(Date ifModifiedSince) { queryParameters.put("changes-since", checkNotNull(ifModifiedSince, "modification date should not be null").getTime() / 1000 + ""); return this; }
Source:
<code>public Date deserialize(String val) { Date date; try { <START> date = df.parse(val); <END> } catch (java.text.ParseException e) { throw new IllegalArgumentException("Date strings must be formated as " + df.toPattern()); } if (ClassUtils.isAssignable(targetType, java.sql.Date.class)) { return new java.sql.Date(date.getTime()); } else if (ClassUtils.isAssignable(targetType, java.sql.Timestamp.class)) { return new java.sql.Timestamp(date.getTime()); } else if (ClassUtils.isAssignable(targetType, java.sql.Time.class)) { return new java.sql.Time(date.getTime()); } else { return date; } }</code><technical_language>need serialize if want reuse SimpleDateFormat</technical_language>

Target:
public Date deserialize(String val) { Date date; try { date = df.parse(val); } catch (java.text.ParseException e) { throw new IllegalArgumentException("Date strings must be formated as " + df.getPattern()); } if (ClassUtils.isAssignable(targetType, java.sql.Date.class)) { return new java.sql.Date(date.getTime()); } else if (ClassUtils.isAssignable(targetType, java.sql.Timestamp.class)) { return new java.sql.Timestamp(date.getTime()); } else if (ClassUtils.isAssignable(targetType, java.sql.Time.class)) { return new java.sql.Time(date.getTime()); } else { return date; } }
Source:
<code>private static void writeWpt(SimpleDateFormat format, XmlSerializer serializer, WptPt p) throws IOException { serializer.attribute(null, "lat", latLonFormat.format(p.lat)); serializer.attribute(null, "lon", latLonFormat.format(p.lon)); if (!Double.isNaN(p.ele)) { writeNotNullText(serializer, "ele", decimalFormat.format(p.ele)); } if (p.time != 0) { writeNotNullText(serializer, "time", format.format(new Date(p.time))); } writeNotNullText(serializer, "name", p.name); writeNotNullText(serializer, "desc", p.desc); writeNotNullTextWithAttribute(serializer, "link", "href", p.link); writeNotNullText(serializer, "type", p.category); if (p.comment != null) { writeNotNullText(serializer, "cmt", p.comment); } if (!Double.isNaN(p.hdop)) { writeNotNullText(serializer, "hdop", decimalFormat.format(p.hdop)); } if (p.speed > 0) { p.getExtensionsToWrite().put("speed", decimalFormat.format(p.speed)); } if (p.heading >= 0) { <START> p.getExtensionsToWrite().put("heading", decimalFormat.format(p.heading)); <END> } writeExtensions(serializer, p); }</code><technical_language>do need heading decimal. integer</technical_language>

Target:
private static void writeWpt(SimpleDateFormat format, XmlSerializer serializer, WptPt p) throws IOException { serializer.attribute(null, "lat", latLonFormat.format(p.lat)); serializer.attribute(null, "lon", latLonFormat.format(p.lon)); if (!Double.isNaN(p.ele)) { writeNotNullText(serializer, "ele", decimalFormat.format(p.ele)); } if (p.time != 0) { writeNotNullText(serializer, "time", format.format(new Date(p.time))); } writeNotNullText(serializer, "name", p.name); writeNotNullText(serializer, "desc", p.desc); writeNotNullTextWithAttribute(serializer, "link", "href", p.link); writeNotNullText(serializer, "type", p.category); if (p.comment != null) { writeNotNullText(serializer, "cmt", p.comment); } if (!Double.isNaN(p.hdop)) { writeNotNullText(serializer, "hdop", decimalFormat.format(p.hdop)); } if (p.speed > 0) { p.getExtensionsToWrite().put("speed", decimalFormat.format(p.speed)); } if (!Float.isNaN(p.heading)) { p.getExtensionsToWrite().put("heading", String.valueOf(Math.round(p.heading))); } writeExtensions(serializer, p); }
Source:
<code>protected void executeVmCommand() { List<VmDevice> watchdogs = getVmDeviceDao().getVmDeviceByVmIdAndType(getVmId(), VmDeviceType.WATCHDOG.getName()); <START> if(watchdogs.isEmpty()) { <END> VmDevice watchdogDevice = new VmDevice(); watchdogDevice.setType(VmDeviceType.WATCHDOG.getName()); watchdogDevice.setId(new VmDeviceId(Guid.NewGuid(), getVmId())); watchdogDevice.setDevice(VmDeviceType.WATCHDOG.getName()); watchdogDevice.setSpecParams(getSpecParams()); watchdogDevice.setAddress(StringUtils.EMPTY); getVmDeviceDao().save(watchdogDevice); } else { VmDevice watchdogDevice = watchdogs.get(0); watchdogDevice.setSpecParams(getSpecParams()); getVmDeviceDao().update(watchdogDevice); } setSucceeded(true); }</code><technical_language>null check</technical_language>

Target:
protected void executeVmCommand() { List<VmDevice> watchdogs = getVmDeviceDao().getVmDeviceByVmIdAndType(getParameters().getVmId(), VmDeviceType.WATCHDOG.getName()); if(getParameters().getModel() == null) { for(VmDevice device : watchdogs) { getVmDeviceDao().remove(device.getId()); } } else { if(watchdogs.isEmpty()) { VmDevice watchdogDevice = new VmDevice(); watchdogDevice.setType(VmDeviceType.WATCHDOG.getName()); watchdogDevice.setId(new VmDeviceId(Guid.NewGuid(), getParameters().getVmId())); watchdogDevice.setDevice(VmDeviceType.WATCHDOG.getName()); watchdogDevice.setSpecParams(getSpecParams()); watchdogDevice.setAddress(StringUtils.EMPTY); getVmDeviceDao().save(watchdogDevice); } else { VmDevice watchdogDevice = watchdogs.get(0); watchdogDevice.setSpecParams(getSpecParams()); getVmDeviceDao().update(watchdogDevice); } } setSucceeded(true); }
Source:
<code>private static long getCombinedSplitSize(Configuration conf) throws IOException { long splitSize = conf.getLong(COMBINE_SPLIT_SIZE, -1); if (splitSize != -1) { return splitSize; } splitSize = conf.getLong(CFIF_MAX_SPLIT_SIZE_KEY, -1); if (splitSize != -1) { return splitSize; } <START> splitSize = FileSystem.get(conf).getDefaultBlockSize(new Path(".")); <END> return splitSize; }</code><technical_language>do return this point</technical_language>

Target:
private static long getCombinedSplitSize(Configuration conf) throws IOException { long splitSize = conf.getLong(COMBINE_SPLIT_SIZE, -1); if (splitSize != -1) { return splitSize; } splitSize = conf.getLong( DelegateCombineFileInputFormat.CFIF_MAX_SPLIT_SIZE_KEY, DelegateCombineFileInputFormat.CFIF_MAX_SPLIT_SIZE_DEFAULT); if (splitSize != DelegateCombineFileInputFormat.CFIF_MAX_SPLIT_SIZE_DEFAULT) { return splitSize; } return FileSystem.get(conf).getDefaultBlockSize(new Path(".")); }
Source:
<code>void initTable() { getTable().enableColumnResizing(); <START> <END> AbstractTextColumn<StorageDomainDR> sessionColumn = new AbstractTextColumn<StorageDomainDR>() { @Override public String getValue(StorageDomainDR storageDomainDR) { return storageDomainDR.getGeoRepSessionId().toString(); } }; getTable().addColumn(sessionColumn, constants.geoRepSlaveVolume(), "300px"); AbstractTextColumn<StorageDomainDR> scheduleColumn = new AbstractTextColumn<StorageDomainDR>() { @Override public String getValue(StorageDomainDR storageDomainDR) { return storageDomainDR.getSyncSchedule(); } }; getTable().addColumn(scheduleColumn, constants.scheduleLabel(), "300px"); getTable().addActionButton(new WebAdminButtonDefinition<StorageDomainDR>(constants.newDRSetup()) { @Override protected UICommand resolveCommand() { return getDetailModel().getNewCommand(); } }); }</code><technical_language>Do need show gluster volume mapped storage domain</technical_language>

Target:
void initTable() { getTable().enableColumnResizing(); AbstractTextColumn<StorageDomainDR> sessionColumn = new AbstractTextColumn<StorageDomainDR>() { @Override public String getValue(StorageDomainDR storageDomainDR) { return storageDomainDR.getGeoRepSessionId().toString(); } }; getTable().addColumn(sessionColumn, constants.geoRepSlaveVolume(), "300px"); AbstractTextColumn<StorageDomainDR> scheduleColumn = new AbstractTextColumn<StorageDomainDR>() { @Override public String getValue(StorageDomainDR storageDomainDR) { return storageDomainDR.getScheduleCronExpression(); } }; getTable().addColumn(scheduleColumn, constants.scheduleLabel(), "300px"); getTable().addActionButton(new WebAdminButtonDefinition<StorageDomainDR>(constants.newDRSetup()) { @Override protected UICommand resolveCommand() { return getDetailModel().getNewCommand(); } }); }
Source:
<code>public boolean equals(Object a, Object b) { final boolean ret; if (a != b && a instanceof IMergeViewerItem && b instanceof IMergeViewerItem) { IMergeViewerItem itemA = (IMergeViewerItem)a; IMergeViewerItem itemB = (IMergeViewerItem)b; <START> <END> Diff diffA = itemA.getDiff(); Diff diffB = itemB.getDiff(); if (diffA != null && diffA.getConflict() != null && diffA.getConflict().getKind() == ConflictKind.PSEUDO && diffB != null && diffB.getConflict() != null && diffB.getConflict().getKind() == ConflictKind.PSEUDO) { ret = Objects.equal(itemA.getAncestor(), itemB.getAncestor()) && Objects.equal(diffA.getConflict(), diffB.getConflict()); } else if (diffA != null && diffB != null && itemA.getLeft() == null && itemA.getRight() == null && itemB.getLeft() == null && itemB.getRight() == null) { ret = Objects.equal(diffA, diffB); } else if (diffA != null && diffB == null || diffA == null && diffB != null) { ret = Objects.equal(itemA.getLeft(), itemB.getLeft()) && Objects.equal(itemA.getRight(), itemB.getRight()) && Objects.equal(itemA.getAncestor(), itemB.getAncestor()); } else { ret = Objects.equal(itemA.getLeft(), itemB.getLeft()) && Objects.equal(itemA.getRight(), itemB.getRight()) && Objects.equal(itemA.getAncestor(), itemB.getAncestor()) && Objects.equal(diffA, diffB); } } else { ret = Objects.equal(a, b); } return ret; }</code><technical_language>Please add this blank line</technical_language>

Target:
public boolean equals(Object a, Object b) { final boolean ret; if (a != b && a instanceof IMergeViewerItem && b instanceof IMergeViewerItem) { IMergeViewerItem itemA = (IMergeViewerItem)a; IMergeViewerItem itemB = (IMergeViewerItem)b; Diff diffA = itemA.getDiff(); Diff diffB = itemB.getDiff(); if (diffA != null && diffA.getConflict() != null && diffA.getConflict().getKind() == ConflictKind.PSEUDO && diffB != null && diffB.getConflict() != null && diffB.getConflict().getKind() == ConflictKind.PSEUDO) { ret = Objects.equal(itemA.getAncestor(), itemB.getAncestor()) && Objects.equal(diffA.getConflict(), diffB.getConflict()); } else if (diffA != null && diffB != null && itemA.getLeft() == null && itemA.getRight() == null && itemB.getLeft() == null && itemB.getRight() == null) { ret = Objects.equal(diffA, diffB); } else if ((diffA == null) != (diffB == null)) { ret = Objects.equal(itemA.getLeft(), itemB.getLeft()) && Objects.equal(itemA.getRight(), itemB.getRight()) && Objects.equal(itemA.getAncestor(), itemB.getAncestor()); } else { ret = Objects.equal(itemA.getLeft(), itemB.getLeft()) && Objects.equal(itemA.getRight(), itemB.getRight()) && Objects.equal(itemA.getAncestor(), itemB.getAncestor()) && Objects.equal(diffA, diffB); } } else { ret = Objects.equal(a, b); } return ret; }
Source:
<code>private static JSONArray buildEnumerateResult(final List<String> extensions) throws FalconException { JSONArray results = new JSONArray(); ExtensionMetaStore metricStore = ExtensionStore.get().getMetricStore(); List<ExtensionMetadataBean> beanList = metricStore.getAllExtensions(); for (ExtensionMetadataBean bean : beanList) { JSONObject resultObject = new JSONObject(); try { resultObject.put(EXTENSION_NAME, bean.getExtensionName().toLowerCase()); resultObject.put(EXTENSION_TYPE, bean.getExtensionType()); <START> resultObject.put(EXTENSION_DESC, bean.getDescription()); <END> } catch (JSONException e) { throw new FalconException(e); } results.put(resultObject); } return results; }</code><technical_language>@sandeepSamudrala mentioned in another pull request. add location resultObject</technical_language>

Target:
private static JSONArray buildEnumerateResult(final List<String> extensions) throws FalconException { JSONArray results = new JSONArray(); ExtensionMetaStore metricStore = ExtensionStore.get().getMetaStore(); List<ExtensionMetadataBean> beanList = metricStore.getAllExtensions(); for (ExtensionMetadataBean bean : beanList) { JSONObject resultObject = new JSONObject(); try { resultObject.put(EXTENSION_NAME, bean.getExtensionName().toLowerCase()); resultObject.put(EXTENSION_TYPE, bean.getExtensionType()); resultObject.put(EXTENSION_DESC, bean.getDescription()); resultObject.put(EXTENSION_LOCATION, bean.getLocation()); } catch (JSONException e) { throw new FalconException(e); } results.put(resultObject); } return results; }
Source:
<code>private void importModelObjects(Document doc, String type, List<Exception> errors) { NodeList nList = doc.getElementsByTagName(type); for (int temp = 0; temp < nList.getLength(); temp++) { Node nNode = nList.item(temp); if (nNode.getNodeType() == Node.ELEMENT_NODE) { <START> System.out.println(type.equals("Trade")); <END> try { if (type.equals("Trade")) { this.buildPortfolioTransaction(client, (Element) nNode); } else if (type.equals("CorporateAction")) { this.buildCorporateTransaction(client, (Element) nNode); } else if (type.equals("CashTransaction")) { this.buildAccountTransaction(client, (Element) nNode); } } catch (ParseException e) { errors.add(e); } } } }</code><technical_language>sysout</technical_language>

Target:
private void importModelObjects(Document doc, String type, List<Exception> errors) { NodeList nList = doc.getElementsByTagName(type); for (int temp = 0; temp < nList.getLength(); temp++) { Node nNode = nList.item(temp); if (nNode.getNodeType() == Node.ELEMENT_NODE) { try { if (type.equals("Trade")) { this.buildPortfolioTransaction(client, (Element) nNode); } else if (type.equals("CorporateAction")) { this.buildCorporateTransaction(client, (Element) nNode); } else if (type.equals("CashTransaction")) { this.buildAccountTransaction(client, (Element) nNode); } } catch (ParseException e) { errors.add(e); } } } }
Source:
<code>public Iterator<Bin> iterator() { return new Iterator<Bin>() { private int currentIndex; @Override public boolean hasNext() { return currentIndex < bucketCount; } @Override public Bin next() { if (currentIndex == bucketCount) { <START> throw new UnsupportedOperationException(); <END> } return new Bin( currentIndex * (max - min) / bucketCount, (currentIndex + 1) * (max - min) / bucketCount, weights[currentIndex++]); } @Override public void remove() { throw new UnsupportedOperationException(); } }; }</code><technical_language>suggestion throw new NoSuchElementException();</technical_language>

Target:
public Iterator<Bin> iterator() { return new Iterator<Bin>() { private int currentIndex; @Override public boolean hasNext() { return currentIndex < bucketCount; } @Override public Bin next() { if (currentIndex == bucketCount) { throw new NoSuchElementException(); } return new Bin( currentIndex * (max - min) / bucketCount, (currentIndex + 1) * (max - min) / bucketCount, weights[currentIndex++]); } @Override public void remove() { throw new UnsupportedOperationException(); } }; }
Source:
<code>TreeMap<Key,Value> consume(SortedKeyValueIterator<Key,Value> skvi, IteratorTestInput testInput) throws IOException { final TreeMap<Key,Value> data = new TreeMap<>(); final Range origRange = testInput.getRange(); int reseekCount = random.nextInt(RESEEK_INTERVAL); int i = 0; while (skvi.hasTop()) { data.put(skvi.getTopKey(), skvi.getTopValue()); if (i % RESEEK_INTERVAL == reseekCount) { Key reSeekStartKey = skvi.getTopKey(); <START> skvi = skvi.deepCopy(new SimpleIteratorEnvironment()); <END> final Range newRange = new Range(reSeekStartKey, false, origRange.getEndKey(), origRange.isEndKeyInclusive()); log.debug("Re-seeking to {}", newRange); skvi.seek(newRange, Collections.<ByteSequence> emptySet(), false); } else { skvi.next(); } i++; } return data; }</code><technical_language>creating a completely new iterator instance initializing more realistic</technical_language>

Target:
TreeMap<Key,Value> consume(SortedKeyValueIterator<Key,Value> skvi, IteratorTestInput testInput) throws IOException { final TreeMap<Key,Value> data = new TreeMap<>(); final Range origRange = testInput.getRange(); int reseekCount = random.nextInt(RESEEK_INTERVAL); int i = 0; while (skvi.hasTop()) { data.put(skvi.getTopKey(), skvi.getTopValue()); if (i % RESEEK_INTERVAL == reseekCount) { Key reSeekStartKey = skvi.getTopKey(); skvi = IteratorTestUtil.instantiateIterator(testInput); final SortedKeyValueIterator<Key,Value> sourceCopy = IteratorTestUtil.createSource(testInput); skvi.init(sourceCopy, testInput.getIteratorOptions(), new SimpleIteratorEnvironment()); final Range newRange = new Range(reSeekStartKey, false, origRange.getEndKey(), origRange.isEndKeyInclusive()); log.debug("Re-seeking to {}", newRange); skvi.seek(newRange, Collections.<ByteSequence> emptySet(), false); } else { skvi.next(); } i++; } return data; }
Source:
<code>private void initializeInternationalModules(BranchContext context) { if (internationalModuleIds.isEmpty()) { SnomedRequests.prepareSearchConcept() .filterByActive(true) <START> .filterByEcl(String.format("<<%s", SnomedConstants.Concepts.IHTSDO_MAINTAINED_MODULE)) <END> .build() .execute(context) .forEach(concept -> internationalModuleIds.add(concept.getId())); } }</code><technical_language>Missing setLimit() all() method call</technical_language>

Target:
private void initializeInternationalModules(BranchContext context) { if (internationalModuleIds.isEmpty()) { SnomedRequests.prepareSearchConcept() .all() .filterByActive(true) .filterByEcl(String.format("<<%s", SnomedConstants.Concepts.IHTSDO_MAINTAINED_MODULE)) .build() .execute(context) .forEach(concept -> internationalModuleIds.add(concept.getId())); } }