auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
@Override public Set<Entry<Integer, GridDhtPartitionState>> entrySet() { return new AbstractSet<Entry<Integer, GridDhtPartitionState>>() { @Override public Iterator<Entry<Integer, GridDhtPartitionState>> iterator() { return new Iterator<Entry<Integer, GridDhtPartitionState>>() { private int idx; private int cur; @Override public boolean hasNext() { idx = states.nextSetBit(idx); return idx != -1; } @Override public Entry<Integer, GridDhtPartitionState> next() { if (!hasNext()) throw new NoSuchElementException(); cur = idx / BITS; int bitN = idx % BITS; int st = 1 << bitN; for (int i = 1; i < BITS - bitN; i++) st |= (states.get(idx + i) ? 1 : 0) << i + bitN; final int ordinal = st - 1; idx += (BITS - bitN); return new Entry<Integer, GridDhtPartitionState>() { int p = cur; int state = ordinal; @Override public Integer getKey() { return p; } @Override public GridDhtPartitionState getValue() { return GridDhtPartitionState.fromOrdinal(state); } @Override public GridDhtPartitionState setValue(GridDhtPartitionState val) { return setState(p, val); } }; } @Override public void remove() { setState(cur, null); } }; } @Override public int size() { return GridPartitionStateMap.this.size(); } }; }

Target:
@Override public Set<Entry<Integer, GridDhtPartitionState>> entrySet() { return new AbstractSet<Entry<Integer, GridDhtPartitionState>>() { @Override public Iterator<Entry<Integer, GridDhtPartitionState>> iterator() { return new Iterator<Entry<Integer, GridDhtPartitionState>>() { private int idx; private int cur; @Override public boolean hasNext() { idx = states.nextSetBit(idx); return idx != -1; } @Override public Entry<Integer, GridDhtPartitionState> next() { if (!hasNext()) throw new NoSuchElementException(); cur = idx / BITS; int bitN = idx % BITS; int st = 1 << bitN; for (int i = 1; i < BITS - bitN; i++) st |= (states.get(idx + i) ? 1 : 0) << i + bitN; final int ordinal = st - 1; idx += (BITS - bitN); return new Entry<Integer, GridDhtPartitionState>() { int p = cur; @Override public Integer getKey() { return p; } @Override public GridDhtPartitionState getValue() { return GridDhtPartitionState.fromOrdinal(ordinal); } @Override public GridDhtPartitionState setValue(GridDhtPartitionState val) { return setState(p, val); } }; } @Override public void remove() { setState(cur, null); } }; } @Override public int size() { return GridPartitionStateMap.this.size(); } }; }
Source:
public Set<Locator> getExcessEnumMetrics() throws IOException { Timer.Context ctx = Instrumentation.getBatchReadTimerContext(CassandraModel.CF_METRICS_EXCESS_ENUMS_NAME); Session session = DatastaxIO.getSession(); final Set<Locator> excessEnumMetrics = new HashSet<Locator>(); try { BoundStatement bs = getValue.bind(); List<Row> results = session.execute(bs).all(); for ( Row row : results ) { if ( LOG.isTraceEnabled() ) { LOG.trace( "Read metrics_excess_enums: " + row.getString( KEY )); } excessEnumMetrics.add(Locator.createLocatorFromDbKey(row.getString(KEY))); } return excessEnumMetrics; } finally { ctx.stop(); } }

Target:
public Set<Locator> getExcessEnumMetrics() throws IOException { Timer.Context ctx = Instrumentation.getReadTimerContext(CassandraModel.CF_METRICS_EXCESS_ENUMS_NAME); Session session = DatastaxIO.getSession(); final Set<Locator> excessEnumMetrics = new HashSet<Locator>(); try { BoundStatement bs = getValue.bind(); List<Row> results = session.execute(bs).all(); for ( Row row : results ) { if ( LOG.isTraceEnabled() ) { LOG.trace( "Read metrics_excess_enums: " + row.getString( KEY )); } excessEnumMetrics.add(Locator.createLocatorFromDbKey(row.getString(KEY))); } return excessEnumMetrics; } finally { ctx.stop(); } }
Source:
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 (member.getName() != 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; }

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:
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(), cacheEvent, EventStrings.TOKEN_CACHE_LOOKUP); return frtResult; }

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:
public void inflateClientInformation() { ConnectivityManager connectivityManager = (ConnectivityManager) getContext().getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo networkInfo = connectivityManager.getActiveNetworkInfo(); if(networkInfo != null && networkInfo.isConnected()){ mClientDetailsPresenter.loadClientDetailsAndClientAccounts(clientId); return; } showFetchingError("Device not connected to internet"); }

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:
public long getGreatestLogEntry() { return execute(x -> x.getGreatestLogEntry(namespace)).orElse(PaxosAcceptor.NO_LOG_ENTRY); }

Target:
public long getGreatestLogEntry() { return execute(dao -> dao.getGreatestLogEntry(namespace)).orElse(PaxosAcceptor.NO_LOG_ENTRY); }
Source:
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 = customClassToNativeSuper.get(cls); Super sup = new Super(self, nativeSuper); return ObjCRuntime.ptr_objc_msgSendSuper(sup.getHandle(), sel); }

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:
private String describeSize(long nrOfBytes) { if (nrOfBytes<1000L) return nrOfBytes+" Bytes"; if (nrOfBytes<1000000L) return (nrOfBytes/1000L)+" kB"; if (nrOfBytes<1000000000L) return (nrOfBytes/1000000L)+" MB"; return (nrOfBytes/1000000000L)+" GB"; }

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:
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))); if (usermetadataLogSet.size() != 0) { 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; }

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:
public void testSkipScanFilterQuery() throws Exception { String createTableDDL = "CREATE TABLE test1" + "(col1 VARCHAR," + "col2 VARCHAR," + "col3 VARCHAR," + "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(); } }

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:
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); r = (Role) hu.load(); 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; }

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:
public final boolean hasRole(final String roleName) { if ("<LINK_1>".equals(roleName)) { 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; }

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:
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); int size = 8192; 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); }

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:
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 { throw new UnauthorizedAccessException("Admin or Instructor privilege is required to access this resource."); } }

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:
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 mapping \"" + regionMapping.getRegionName() + "\""); } try (Connection connection = dataSource.getConnection()) { TableMetaDataView tableMetaData = getTableMetaDataView(regionMapping, dataSource); return createDefaultFieldMapping(regionMapping, pdxType, tableMetaData); } catch (SQLException e) { throw JdbcConnectorException.createException(e); } }

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:
public void start() { DateTime now = DateTime.now(); executionStartTime.compareAndSet(null, now); startNanos.compareAndSet(0, System.nanoTime()); startFullGcCount.compareAndSet(0, gcMonitor.getMajorGcCount()); startFullGcTimeNanos.compareAndSet(0, gcMonitor.getMajorGcTime().roundTo(NANOSECONDS)); lastExecutionStartTime.set(now); }

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:
public void onNext(final Message<AvroPSMsg> msg) { LOG.entering(ServerSideMsgHandler.class.getSimpleName(), "onNext"); Trace.setProcessId("parameter_server"); 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"); }

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:
public static TimelineResult create(final List<Timeline> timelines, final List<TimelineLog> logs) { final Optional<TimelineLog> logOptional; if(logs.size()>0){ 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); }

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:
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; assert root.getChild("question1", 1) != null; }

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:
public Identifiable<String> createDispoSet(ArtifactReadable author, DispoProgram program, DispoSet descriptor) { IOseeBranch branch = TokenFactory.createBranch(program.getUuid(), ""); 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; }

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:
public void backup(@NotNull final String keyspace) throws IOException { backup(keyspace, "s-" + System.currentTimeMillis()); }

Target:
public void backup(@NotNull final String keyspace) throws IOException { backup(keyspace, "snapshot-" + System.currentTimeMillis()); }
Source:
protected Integer addToFacts( AggregatorFactory[] metrics, boolean deserializeComplexMetrics, InputRow row, AtomicInteger numEntries, TimeAndDims key, ThreadLocal<InputRow> in ) throws IndexSizeExceededException { final Aggregator[] aggs; final Integer retval; final Integer rowOffset = numEntries.get(); 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; }

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:
public void onUserClicked(String id) { if(BuildConfig.DEBUG) { startActivity(PublicProfileActivity.getLaunchIntent(this ,id)); } }

Target:
public void onUserClicked(String id) { startActivity(PublicProfileActivity.getLaunchIntent(this, id)); }
Source:
public void checkRunEvent() throws Exception { GHEventPayload.CheckRun event = GitHub.offline() .parseEventPayload(payload.asReader(), GHEventPayload.CheckRun.class); assertThat(event.getRepository().getName(), is("Hello-World")); assertThat(event.getAction(), is("created")); GHCheckRun checkRun = event.getCheckRun(); assertThat(checkRun.getName(), is("Octocoders-linter")); assertThat(checkRun.getHeadSha(), is("ec26c3e57ca3a959ca5aad62de7213c562f8c821")); assertThat(checkRun.getStatus(), is("completed")); assertThat(checkRun.getNodeId(), is("MDg6Q2hlY2tSdW4xMjg2MjAyMjg=")); assertThat(checkRun.getExternalId(), is("")); SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'"); formatter.setTimeZone(TimeZone.getTimeZone("UTC")); assertThat(formatter.format(checkRun.getStartedAt()), is("2019-05-15T15:21:12Z")); assertThat(formatter.format(checkRun.getCompletedAt()), is("2019-05-15T20:22:22Z")); assertThat(checkRun.getConclusion(), is("success")); assertThat(checkRun.getUrl().toString(), is("<LINK_3>")); assertThat(checkRun.getUrl().toString(), is("<LINK_3>")); assertThat(checkRun.getHtmlUrl().toString(), is("<LINK_2>")); assertThat(checkRun.getDetailsUrl().toString(), is("<LINK_1>")); assertThat(checkRun.getApp().getId(), is(29310L)); assertThat(checkRun.getOutput().getTitle(), is("check-run output")); assertThat(event.getSender().getId(), is(21031067L)); }

Target:
public void checkRunEvent() throws Exception { GHEventPayload.CheckRun event = GitHub.offline() .parseEventPayload(payload.asReader(), GHEventPayload.CheckRun.class); assertThat(event.getRepository().getName(), is("Hello-World")); assertThat(event.getRepository().getOwner().getLogin(), is("Codertocat")); assertThat(event.getAction(), is("created")); GHCheckRun checkRun = event.getCheckRun(); assertThat(checkRun.getName(), is("Octocoders-linter")); assertThat(checkRun.getHeadSha(), is("ec26c3e57ca3a959ca5aad62de7213c562f8c821")); assertThat(checkRun.getStatus(), is("completed")); assertThat(checkRun.getNodeId(), is("MDg6Q2hlY2tSdW4xMjg2MjAyMjg=")); assertThat(checkRun.getExternalId(), is("")); SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'"); formatter.setTimeZone(TimeZone.getTimeZone("UTC")); assertThat(formatter.format(checkRun.getStartedAt()), is("2019-05-15T15:21:12Z")); assertThat(formatter.format(checkRun.getCompletedAt()), is("2019-05-15T20:22:22Z")); assertThat(checkRun.getConclusion(), is("success")); assertThat(checkRun.getUrl().toString(), is("<LINK_3>")); assertThat(checkRun.getHtmlUrl().toString(), is("<LINK_2>")); assertThat(checkRun.getDetailsUrl().toString(), is("<LINK_1>")); assertThat(checkRun.getApp().getId(), is(29310L)); assertThat(checkRun.getCheckSuite().getId(), is(118578147L)); assertThat(checkRun.getOutput().getTitle(), is("check-run output")); assertThat(checkRun.getOutput().getSummary(), nullValue()); assertThat(checkRun.getOutput().getText(), nullValue()); assertThat(checkRun.getOutput().getAnnotationsCount(), is(0)); assertThat(checkRun.getOutput().getAnnotationsUrl().toString(), is("<LINK_0>")); assertThat(event.getSender().getId(), is(21031067L)); }
Source:
public ListImageOptions changesSince(Date ifModifiedSince) { queryParameters.put("changes-since", checkNotNull(ifModifiedSince, "ifModifiedSince").getTime() / 1000 + ""); return this; }

Target:
public ListImageOptions changesSince(Date ifModifiedSince) { queryParameters.put("changes-since", checkNotNull(ifModifiedSince, "modification date should not be null").getTime() / 1000 + ""); return this; }
Source:
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.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; } }

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:
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) { p.getExtensionsToWrite().put("heading", decimalFormat.format(p.heading)); } writeExtensions(serializer, p); }

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:
protected void executeVmCommand() { List<VmDevice> watchdogs = getVmDeviceDao().getVmDeviceByVmIdAndType(getVmId(), VmDeviceType.WATCHDOG.getName()); if(watchdogs.isEmpty()) { 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); }

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:
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; } splitSize = FileSystem.get(conf).getDefaultBlockSize(new Path(".")); return splitSize; }

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:
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.getSyncSchedule(); } }; getTable().addColumn(scheduleColumn, constants.scheduleLabel(), "300px"); getTable().addActionButton(new WebAdminButtonDefinition<StorageDomainDR>(constants.newDRSetup()) { @Override protected UICommand resolveCommand() { return getDetailModel().getNewCommand(); } }); }

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:
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 || 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; }

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:
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()); resultObject.put(EXTENSION_DESC, bean.getDescription()); } catch (JSONException e) { throw new FalconException(e); } results.put(resultObject); } return results; }

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:
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) { System.out.println(type.equals("Trade")); 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); } } } }

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:
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 UnsupportedOperationException(); } return new Bin( currentIndex * (max - min) / bucketCount, (currentIndex + 1) * (max - min) / bucketCount, weights[currentIndex++]); } @Override public void remove() { throw new UnsupportedOperationException(); } }; }

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(); } }; }