auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public boolean connect(SocketAddress socketAddress) throws IOException { checkUnconnected(); InetSocketAddress inetSocketAddress = validateAddress(socketAddress); InetAddress normalAddr = inetSocketAddress.getAddress(); int port = inetSocketAddress.getPort(); if (normalAddr.isAnyLocalAddress()) { normalAddr = InetAddress.getLocalHost(); } boolean isBlocking = isBlocking(); boolean finished = false; int newStatus; try { if (isBlocking) { begin(); } finished = IoBridge.connect(fd, normalAddr, port); if (isBlocking) { newStatus = finished ? SOCKET_STATUS_CONNECTED : SOCKET_STATUS_UNCONNECTED; } else { newStatus = SOCKET_STATUS_PENDING; } } catch (IOException e) { if (isEINPROGRESS(e)) { newStatus = SOCKET_STATUS_PENDING; } else { if (isOpen()) { close(); finished = true; newStatus = SOCKET_STATUS_UNCONNECTED; } throw e; } } finally { if (isBlocking) { end(finished); } } if (!isBound) { onBind(true ); } onConnect(inetSocketAddress, newStatus, true ); return finished; }

Target:
public boolean connect(SocketAddress socketAddress) throws IOException { checkUnconnected(); InetSocketAddress inetSocketAddress = validateAddress(socketAddress); InetAddress normalAddr = inetSocketAddress.getAddress(); int port = inetSocketAddress.getPort(); if (normalAddr.isAnyLocalAddress()) { normalAddr = InetAddress.getLocalHost(); } boolean isBlocking = isBlocking(); boolean finished = false; int newStatus; try { if (isBlocking) { begin(); } IoBridge.connect(fd, normalAddr, port); newStatus = isBlocking ? SOCKET_STATUS_CONNECTED : SOCKET_STATUS_PENDING; finished = true; } catch (IOException e) { if (isEINPROGRESS(e)) { newStatus = SOCKET_STATUS_PENDING; } else { if (isOpen()) { close(); finished = true; } throw e; } } finally { if (isBlocking) { end(finished); } } if (!isBound) { onBind(true ); } onConnectStatusChanged(inetSocketAddress, newStatus, true ); return status == SOCKET_STATUS_CONNECTED; }
Source:
private void createAdvancedLiveGroup() { if (fliveGroup == null && fIsAdvancedEnabled) { GridLayout layout = new GridLayout(2, false); fliveGroup = new Group(fAdvancedGroup, SWT.NONE); fliveGroup.setLayout(layout); fliveGroup.setLayoutData(new GridData(GridData.FILL_BOTH)); Label liveDelayLabel = new Label(fliveGroup, SWT.NONE); liveDelayLabel.setText(Messages.TraceControl_CreateSessionLiveDelayLabel); fLiveDelayText = new Text(fliveGroup, SWT.NONE); fLiveDelayText.setText(Integer.toString(SessionInfo.DEFAULT_LIVE_DELAY)); fLiveDelayText.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent event) { updateEnablement(); } }); getShell().pack(); } }

Target:
private void createAdvancedLiveGroup() { if (fLiveGroup == null && fIsAdvancedEnabled) { GridLayout layout = new GridLayout(7, true); fLiveGroup = new Group(fAdvancedGroup, SWT.NONE); fLiveGroup.setLayout(layout); GridData layoutData = new GridData(GridData.FILL_BOTH); fLiveGroup.setLayoutData(layoutData); Label liveDelayLabel = new Label(fLiveGroup, SWT.RIGHT); layoutData = new GridData(GridData.FILL_HORIZONTAL); liveDelayLabel.setText(Messages.TraceControl_CreateSessionLiveDelayLabel); liveDelayLabel.setLayoutData(layoutData); fLiveDelayText = new Text(fLiveGroup, SWT.NONE); fLiveDelayText.setText(DEFAULT_TEXT); fLiveDelayText.setForeground(getShell().getDisplay().getSystemColor(SWT.COLOR_GRAY)); fLiveDelayText.setToolTipText(Messages.TraceControl_CreateSessionLiveDelayTooltip); fLiveDelayText.addVerifyListener(new VerifyListener() { @Override public void verifyText(VerifyEvent e) { e.doit = e.text.matches("[0-9]*") || e.text.matches(DEFAULT_TEXT); updateEnablement(); } }); fLiveDelayText.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent event) { updateEnablement(); } }); fLiveDelayText.addFocusListener(new FocusListener() { @Override public void focusLost(FocusEvent e) { Text focusLostWidget = (Text) e.widget; if (focusLostWidget.getText().isEmpty()) { focusLostWidget.setText(DEFAULT_TEXT); focusLostWidget.setForeground(getShell().getDisplay().getSystemColor(SWT.COLOR_GRAY)); } } @Override public void focusGained(FocusEvent e) { Text focusGainedWidget = (Text) e.widget; if (focusGainedWidget.getText().equals(DEFAULT_TEXT)) { focusGainedWidget.setText(""); focusGainedWidget.setForeground(getShell().getDisplay().getSystemColor(SWT.COLOR_BLACK)); } } }); layoutData = new GridData(GridData.FILL_HORIZONTAL); layoutData.grabExcessHorizontalSpace = true; layoutData.horizontalSpan = 6; fLiveDelayText.setLayoutData(layoutData); getShell().pack(); } }
Source:
private String getDomainFromDB(String userId) throws UserStoreException { Connection dbConnection = null; PreparedStatement preparedStatement = null; ResultSet resultSet = null; String domainName = null; try { dbConnection = getDBConnection(); preparedStatement = dbConnection.prepareStatement(GET_DOMAIN); preparedStatement.setString(1, userId); resultSet = preparedStatement.executeQuery(); while (resultSet.next()) { domainName = resultSet.getString(DOMAIN_COLUMN_NAME); } } catch (SQLException ex) { throw new UserStoreException("Error occurred while reading the domain name for user id from database.", ex); } finally { DatabaseUtil.closeAllConnections(dbConnection, resultSet, preparedStatement); } return domainName; }

Target:
private String getDomainFromDB(String userId) throws UserStoreException { String domainName = null; try (Connection dbConnection = getDBConnection(); PreparedStatement preparedStatement = dbConnection.prepareStatement(GET_DOMAIN)) { preparedStatement.setString(1, userId); preparedStatement.setInt(2, tenantId); try (ResultSet resultSet = preparedStatement.executeQuery()) { while (resultSet.next()) { domainName = resultSet.getString(DOMAIN_COLUMN_NAME); } } } catch (SQLException ex) { throw new UserStoreException("Error occurred while reading the domain name for user id from database.", ex); } return domainName; }
Source:
public PasswordManagementWebflowConfigurer(final FlowBuilderServices flowBuilderServices, final FlowDefinitionRegistry loginFlowDefinitionRegistry, final ConfigurableApplicationContext applicationContext, final CasConfigurationProperties casProperties, final Action initPasswordChangeAction) { super(flowBuilderServices, loginFlowDefinitionRegistry, applicationContext, casProperties); this.initPasswordChangeAction = initPasswordChangeAction; setOrder(WebflowConfigurersOrder.PM); }

Target:
public PasswordManagementWebflowConfigurer(final FlowBuilderServices flowBuilderServices, final FlowDefinitionRegistry loginFlowDefinitionRegistry, final ConfigurableApplicationContext applicationContext, final CasConfigurationProperties casProperties, final Action initPasswordChangeAction) { super(flowBuilderServices, loginFlowDefinitionRegistry, applicationContext, casProperties); this.initPasswordChangeAction = initPasswordChangeAction; setOrder(casProperties.getAuthn().getPm().getWebflow().getOrder()); }
Source:
public List<MetricQuery> getMatchingQueries(MetricQuery query) { requireNotDisposed(); SystemAssert.requireArgument(query != null, "MetricQuery cannot be null."); long start = System.nanoTime(); List<MetricQuery> queries = new ArrayList<>(); if(isWildcardQuery(query)) { String value = _cacheService.get(_getKey(query)); if(value == null) { _logger.info(MessageFormat.format("CACHE MISS for Wildcard Query: '{'{0}'}'. Will read from persistent storage.", query)); queries = _discoveryService.getMatchingQueries(query); _executorService.submit(new CacheInsertWorker(query, queries)); } else { _logger.info(MessageFormat.format("CACHE HIT for Wildcard Query: '{'{0}'}'", query)); try { JavaType type = MAPPER.getTypeFactory().constructCollectionType(List.class, MetricQuery.class); List<MetricQuery> matchedQueries = MAPPER.readValue(value, type); for(int i=0; i<matchedQueries.size(); i++) { MetricQuery q = new MetricQuery(query); _replaceWildcardFieldsFromCachedQuery(matchedQueries.get(i), q); queries.add(q); } } catch (IOException e) { _logger.warn("IOException while parsing string value from cache to list of metric queries. Will read from persistent storage.", e); queries = _discoveryService.getMatchingQueries(query); _executorService.submit(new CacheInsertWorker(query, queries)); } } } else { _logger.info(MessageFormat.format("MetricQuery'{'{0}'}' does not have any wildcards", query)); queries.add(query); } _logger.debug("Time to get matching queries in ms: " + (System.nanoTime() - start) / 1000000); return queries; }

Target:
public List<MetricQuery> getMatchingQueries(MetricQuery query) { requireNotDisposed(); SystemAssert.requireArgument(query != null, "MetricQuery cannot be null."); long start = System.nanoTime(); List<MetricQuery> queries = new ArrayList<>(); if(isWildcardQuery(query)) { String value = _cacheService.get(_getKey(query)); if(value == null) { _logger.info(MessageFormat.format("CACHE MISS for Wildcard Query: '{'{0}'}'. Will read from persistent storage.", query)); queries = _discoveryService.getMatchingQueries(query); _executorService.submit(new CacheInsertWorker(query, queries)); } else { _logger.info(MessageFormat.format("CACHE HIT for Wildcard Query: '{'{0}'}'", query)); try { JavaType type = MAPPER.getTypeFactory().constructCollectionType(List.class, MetricQuery.class); List<MetricQuery> matchedQueries = MAPPER.readValue(value, type); for(int i=0; i<matchedQueries.size(); i++) { MetricQuery q = new MetricQuery(query); _replaceWildcardFieldsFromCachedQuery(matchedQueries.get(i), q); queries.add(q); } } catch (Exception e) { _logger.warn("Failed to deserialize cached data into metric queries. Will read from persistent storage.", e); queries = _discoveryService.getMatchingQueries(query); _executorService.submit(new CacheInsertWorker(query, queries)); } } } else { _logger.info(MessageFormat.format("MetricQuery'{'{0}'}' does not have any wildcards", query)); queries.add(query); } _logger.debug("Time to get matching queries in ms: " + (System.nanoTime() - start) / 1000000); return queries; }
Source:
public SourceControl convertToEntityAttribute(String dbData) { if (dbData == null || dbData.isEmpty()) { LOG.info("Cannot convert null or empty source control"); return null; } Optional<SourceControl> first = Lists.newArrayList(SourceControl.values()).stream().filter(val -> val.toString().equals(dbData)) .findFirst(); if (first.isPresent()) { return first.get(); } else { LOG.error("could not convert token type: " + dbData); return null; } }

Target:
public SourceControl convertToEntityAttribute(String dbData) { if (dbData == null || dbData.isEmpty()) { LOG.info("Cannot convert null or empty source control"); return null; } Optional<SourceControl> first = Lists.newArrayList(SourceControl.values()).stream().filter(val -> val.toString().equals(dbData)) .findFirst(); if (first.isPresent()) { return first.get(); } else { LOG.error("could not convert source control: " + dbData); return null; } }
Source:
private Run partialCopy(Run run) { Run clone = new Run(); clone.setId(run.getId()); clone.setAlias(run.getAlias()); for (RunQC qc : run.getRunQCs()) { try { clone.addQc(partialCopy(qc)); } catch (MalformedRunQcException e) { log.error("Can't track Malformed RunQC", e); } } for (User u : run.getWatchers()) { clone.addWatcher(u); } return clone; }

Target:
private Run partialCopy(Run run) { Run clone = new Run(); clone.setId(run.getId()); clone.setAlias(run.getAlias()); clone.setHealth(run.getHealth()); for (RunQC qc : run.getRunQCs()) { try { clone.addQc(partialCopy(qc)); } catch (MalformedRunQcException e) { log.error("Can't track Malformed RunQC", e); } } for (User u : run.getWatchers()) { clone.addWatcher(u); } return clone; }
Source:
public Canvas addShapeIntoView(final Shape shape) { if (shape.getUUID() == null) { shape.setUUID(UUID.uuid()); } shape.getShapeView().setUUID(shape.getUUID()); getView().add(shape.getShapeView()); return this; }

Target:
public Canvas addShapeIntoView(final Shape shape) { if (shape.getUUID() == null) { shape.setUUID(UUID.uuid()); } getView().add(shape.getShapeView()); return this; }
Source:
protected void onLoad() { super.onLoad(); com.google.gwtjsonrpc.common.AsyncCallback<PatchSetPublishDetail> load = new ScreenLoadCallback<PatchSetPublishDetail>(this) { @Override protected void preDisplay(final PatchSetPublishDetail result) { send.setEnabled(true); display(result); } @Override protected void postDisplay() { message.setFocus(true); } }; CallbackGroup cbs = new CallbackGroup(); Util.DETAIL_SVC.patchSetPublishDetail(patchSetId, cbs.add(load)); }

Target:
protected void onLoad() { super.onLoad(); CallbackGroup cbs = new CallbackGroup(); Util.DETAIL_SVC.patchSetPublishDetail(patchSetId, cbs.add( (com.google.gwtjsonrpc.common.AsyncCallback<PatchSetPublishDetail>) new ScreenLoadCallback<PatchSetPublishDetail>(this) { @Override protected void preDisplay(final PatchSetPublishDetail result) { send.setEnabled(true); display(result); } @Override protected void postDisplay() { message.setFocus(true); } })); }
Source:
public static String visibilityName(int visibility) { switch (visibility) { case ICPPClassType.v_private: return "private"; case ICPPClassType.v_protected: return "protected"; case ICPPClassType.v_public: return "public"; default: return "illegal access specifier"; } }

Target:
public static String visibilityName(int visibility) { switch (visibility) { case ICPPClassType.v_private: return "private"; case ICPPClassType.v_protected: return "protected"; case ICPPClassType.v_public: return "public"; default: throw new IllegalArgumentException("illegal visibility: " + visibility); } }
Source:
public void run() { packagesIndex = new HashMap<String, PackageHierarchyElement>(); System.out.println("Creating package index."); startIndexing(); System.out.println("Finished package index."); }

Target:
public void run() { packagesIndex = new HashMap<String, PackageHierarchyElement>(); logger.info("Creating package index."); ApplicationManager.getApplication().runReadAction(new Runnable() { @Override public void run() { startIndexing(); } }); logger.info("Finished package index."); }
Source:
public void tearDown() throws Exception { if (feedRegistration!=null) BrooklynFeatureEnablement.setEnablement(BrooklynFeatureEnablement.FEATURE_FEED_REGISTRATION_PROPERTY, feedRegistration); for (WebAppMonitor monitor : webAppMonitors) { monitor.terminate(); } if (executor != null) executor.shutdownNow(); super.tearDown(); RecordingSshjTool.reset(); }

Target:
public void tearDown() throws Exception { try { if (feedRegistration!=null) BrooklynFeatureEnablement.setEnablement(BrooklynFeatureEnablement.FEATURE_FEED_REGISTRATION_PROPERTY, feedRegistration); for (WebAppMonitor monitor : webAppMonitors) { monitor.terminate(); } webAppMonitors.clear(); if (executor != null) executor.shutdownNow(); super.tearDown(); } finally { RecordingSshjTool.reset(); } }
Source:
public void nodeUnpublishVolume(NodeUnpublishVolumeRequest request, StreamObserver<NodeUnpublishVolumeResponse> responseObserver) { String umountCommand = String.format("fusermount -u %s", request.getTargetPath()); LOG.info("Executing " + umountCommand); try { executeCommand(umountCommand); responseObserver.onNext(NodeUnpublishVolumeResponse.newBuilder() .build()); responseObserver.onCompleted(); } catch (Exception e) { responseObserver.onError(e); } }

Target:
public void nodeUnpublishVolume(NodeUnpublishVolumeRequest request, StreamObserver<NodeUnpublishVolumeResponse> responseObserver) { String umountCommand = String.format("fusermount -u %s", request.getTargetPath()); LOG.info("Executing {}", umountCommand); try { executeCommand(umountCommand); responseObserver.onNext(NodeUnpublishVolumeResponse.newBuilder() .build()); responseObserver.onCompleted(); } catch (Exception e) { responseObserver.onError(e); } }
Source:
protected Boolean doInBackground(Void... params) { if (mStatusFilter == null){ tmpComments = CommentTable.getCommentsForBlogWithFilter(mLocalBlogId, CommentStatus.UNKNOWN); } else { tmpComments = CommentTable.getCommentsForBlogWithFilter(mLocalBlogId, mStatusFilter); } if (mComments.isSameList(tmpComments)) { return false; } final int maxImageWidth = (int) mContext.getResources().getDimension(R.dimen.reader_comment_embedded_image_max_size); WPHtml.ImageGetter imgGetter = new WPHtml.ImageGetter() { @Override public Drawable getDrawable(String source) { try { Bitmap bmp = ImageUtils.getScaledBitmapAtLongestSide(BitmapFactory.decodeStream(new URL(source).openStream()), maxImageWidth); BitmapDrawable drawable = new BitmapDrawable(mContext.getResources(), bmp); drawable.setBounds(0, 0, drawable.getIntrinsicWidth(),drawable.getIntrinsicHeight()); return drawable; } catch(IOException exception) { return null; } } }; for (Comment comment: tmpComments) { comment.getDatePublished(); comment.getUnescapedPostTitle(); comment.getAvatarForDisplay(mAvatarSz); comment.getFormattedTitle(); String content = StringUtils.notNullStr(comment.getCommentText()); Spanned spanned = WPHtml.fromHtml(content, imgGetter, null, mContext, null, maxImageWidth); comment.setUnescapedCommentWithDrawables(spanned); } return true; }

Target:
protected Boolean doInBackground(Void... params) { if (mStatusFilter == null){ tmpComments = CommentTable.getCommentsForBlogWithFilter(mLocalBlogId, CommentStatus.UNKNOWN); } else { tmpComments = CommentTable.getCommentsForBlogWithFilter(mLocalBlogId, mStatusFilter); } if (mComments.isSameList(tmpComments)) { return false; } for (Comment comment: tmpComments) { comment.getDatePublished(); comment.getUnescapedPostTitle(); comment.getAvatarForDisplay(mAvatarSz); comment.getFormattedTitle(); String content = StringUtils.notNullStr(comment.getCommentText()); Spanned spanned = WPHtml.fromHtml(content, null, null, mContext, null, 0); comment.setUnescapedCommentWithDrawables(spanned); } return true; }
Source:
public String getETag(RevisionResource rsrc) { if (submitWholeTopicEnabled(config) && rsrc.getChange().getTopic() != null && !rsrc.getChange().getTopic().equals("")) { String topic = rsrc.getChange().getTopic(); Hasher h = Hashing.md5().newHasher(); try { for (ChangeData c : queryProvider.get().byTopicOpen(topic)) { new ChangeResource(c.changeControl()).prepareEtag(h, rsrc.getUser()); } } catch (OrmException e){ throw new OrmRuntimeException(e); } return h.hash().toString(); } else { return rsrc.getETag(); } }

Target:
public String getETag(RevisionResource rsrc) { String topic = rsrc.getChange().getTopic(); if (!Submit.wholeTopicEnabled(config) || Strings.isNullOrEmpty(topic)) { return rsrc.getETag(); } Hasher h = Hashing.md5().newHasher(); try { for (ChangeData c : queryProvider.get().byTopicOpen(topic)) { new ChangeResource(c.changeControl()).prepareETag(h, rsrc.getUser()); } } catch (OrmException e){ throw new OrmRuntimeException(e); } return h.hash().toString(); }
Source:
private String getSenderEmailId(MimeMessage message) throws MessagingException { InternetAddress sender = (InternetAddress) message.getSender(); if (sender == null) { InternetAddress[] fromAddresses = (InternetAddress[]) message.getFrom(); sender = fromAddresses[0]; } return (sender.getAddress()); }

Target:
private String getSenderEmailId(MimeMessage message) throws MessagingException { InternetAddress sender = null; sender = (InternetAddress) message.getSender(); if (sender == null) { InternetAddress[] fromAddresses = (InternetAddress[]) message.getFrom(); if (fromAddresses.length > 0) { sender = fromAddresses[0]; } } return ((sender == null) ? null : sender.getAddress()); }
Source:
private static String getFailureLog(TaskCompletionEvent event) { LOG.info("Getting errors for attempt " + event.getTaskAttemptId()); String exception = ""; try { String fullLog = retrieveTaskLogs(event.getTaskAttemptId(), event.getTaskTrackerHttp()); Pattern pattern = Pattern.compile("Caused by.*?more", Pattern.DOTALL); Matcher matcher = pattern.matcher(fullLog); matcher.find(); exception = matcher.group(); } catch (Exception e) { LOG.info("Regex Error!", e); } return "\nFailure log:\n" + exception; }

Target:
private static String getFailureLog(TaskCompletionEvent event) { LOG.info("Getting errors for attempt " + event.getTaskAttemptId()); String exception = ""; try { String fullLog = retrieveTaskLogs(event.getTaskAttemptId(), event.getTaskTrackerHttp()); Matcher matcher = LOG_ERROR_PATTERN.matcher(fullLog); matcher.find(); exception = matcher.group(); } catch (IOException e) { LOG.info("Regex Error!", e); } return "\nCluster Log Exception:\n" + exception; }
Source:
public void theStoredEventsAreRetrieved(final String deviceIdentification, final Map<String, String> expectedResponse) throws Throwable { final List<Event> events = this.retrieveStoredEvents(deviceIdentification); for (final Event e : events) { Assert.assertEquals(getString(expectedResponse, Keys.EVENT_TYPE), e.getEventType().toString()); Assert.assertEquals(getString(expectedResponse, Keys.KEY_DESCRIPTION), e.getDescription().toString()); Assert.assertEquals((int) getInteger(expectedResponse, Keys.KEY_INDEX), (int) e.getIndex()); } }

Target:
public void theStoredEventsAreRetrieved(final String deviceIdentification, final Map<String, String> expectedResponse) throws Throwable { final List<Event> events = this.retrieveStoredEvents(deviceIdentification); for (final Event e : events) { Assert.assertEquals(getEnum(expectedResponse, Keys.EVENT_TYPE, EventType.class), e.getEventType()); Assert.assertEquals(getString(expectedResponse, Keys.KEY_DESCRIPTION), e.getDescription().toString()); Assert.assertEquals((int) getInteger(expectedResponse, Keys.KEY_INDEX, Defaults.DEFAULT_INDEX), (int) e.getIndex()); } }
Source:
protected CollectionRest put(Context context, HttpServletRequest request, String apiCategory, String model, UUID id, JsonNode jsonNode) throws RepositoryMethodNotImplementedException, SQLException, AuthorizeException { CollectionRest collectionRest = null; try { collectionRest = new ObjectMapper().readValue(jsonNode.toString(), CollectionRest.class); } catch (IOException e) { log.error(e.getMessage(), e); } Collection collection = cs.find(context, id); if (collection == null) { throw new ResourceNotFoundException(apiCategory + "." + model + " with id: " + id + " not found"); } if (StringUtils.equals(id.toString(), collectionRest.getId())) { List<MetadataEntryRest> metadataEntryRestList = collectionRest.getMetadata(); collection = (Collection) dspaceObjectUtils.replaceMetadataValues(context, collection, metadataEntryRestList); } else { throw new IllegalArgumentException("The UUID in the Json and the UUID in the url do not match: " + id + ", " + collectionRest.getId()); } return converter.fromModel(collection); }

Target:
protected CollectionRest put(Context context, HttpServletRequest request, String apiCategory, String model, UUID id, JsonNode jsonNode) throws RepositoryMethodNotImplementedException, SQLException, AuthorizeException { CollectionRest collectionRest = null; try { collectionRest = new ObjectMapper().readValue(jsonNode.toString(), CollectionRest.class); } catch (IOException e) { throw new UnprocessableEntityException("error parsing the body ..." + e.getMessage()); } Collection collection = cs.find(context, id); if (collection == null) { throw new ResourceNotFoundException(apiCategory + "." + model + " with id: " + id + " not found"); } CollectionRest originalCollectionRest = converter.fromModel(collection); if (collectionRestEqualityUtils.isCollectionRestEqualWithoutMetadata(originalCollectionRest, collectionRest)) { List<MetadataEntryRest> metadataEntryRestList = collectionRest.getMetadata(); collection = (Collection) dspaceObjectUtils.replaceMetadataValues(context, collection, metadataEntryRestList); } else { throw new IllegalArgumentException("The UUID in the Json and the UUID in the url do not match: " + id + ", " + collectionRest.getId()); } return converter.fromModel(collection); }
Source:
private void unloadRegions(ServerName server, List<ServerName> regionServers, List<RegionInfo> movedRegions) throws Exception { while (true) { List<RegionInfo> regionsToMove = admin.getRegions(server); regionsToMove.removeAll(movedRegions); if (regionsToMove.isEmpty()) { LOG.info("No Regions to move....Quitting now"); break; } int counter = 0; LOG.info("Moving " + regionsToMove.size() + " regions from " + this.hostname + " to " + regionServers.size() + " servers using " + this.maxthreads + " threads .Ack Mode:" + ack); ExecutorService moveRegionsPool = Executors.newFixedThreadPool(this.maxthreads); List<Future<Boolean>> taskList = new ArrayList<>(); int serverIndex = 0; while (counter < regionsToMove.size()) { if (ack) { Future<Boolean> task = moveRegionsPool.submit( new MoveWithAck(conn, regionsToMove.get(counter), server, regionServers.get(serverIndex), movedRegions)); taskList.add(task); } else { Future<Boolean> task = moveRegionsPool.submit( new MoveWithoutAck(admin, regionsToMove.get(counter), server, regionServers.get(serverIndex), movedRegions)); taskList.add(task); } counter++; serverIndex = (serverIndex + 1) % regionServers.size(); } moveRegionsPool.shutdown(); long timeoutInSeconds = regionsToMove.size() * admin.getConfiguration() .getLong(MOVE_WAIT_MAX_KEY, DEFAULT_MOVE_WAIT_MAX); waitMoveTasksToFinish(moveRegionsPool, taskList, timeoutInSeconds); } }

Target:
private void unloadRegions(ServerName server, List<ServerName> regionServers, List<RegionInfo> movedRegions) throws Exception { while (true) { List<RegionInfo> regionsToMove = admin.getRegions(server); regionsToMove.removeAll(movedRegions); if (regionsToMove.isEmpty()) { LOG.info("No Regions to move....Quitting now"); break; } LOG.info("Moving regions from to servers using threads .Ack Mode: {}", regionsToMove.size(), this.hostname, regionServers.size(), this.maxthreads, ack); final ExecutorService moveRegionsPool = Executors.newFixedThreadPool(this.maxthreads); List<Future<Boolean>> taskList = new ArrayList<>(); int serverIndex = 0; for (RegionInfo regionToMove : regionsToMove) { if (ack) { Future<Boolean> task = moveRegionsPool.submit( new MoveWithAck(conn, regionToMove, server, regionServers.get(serverIndex), movedRegions)); taskList.add(task); } else { Future<Boolean> task = moveRegionsPool.submit( new MoveWithoutAck(admin, regionToMove, server, regionServers.get(serverIndex), movedRegions)); taskList.add(task); } serverIndex = (serverIndex + 1) % regionServers.size(); } moveRegionsPool.shutdown(); long timeoutInSeconds = regionsToMove.size() * admin.getConfiguration() .getLong(MOVE_WAIT_MAX_KEY, DEFAULT_MOVE_WAIT_MAX); waitMoveTasksToFinish(moveRegionsPool, taskList, timeoutInSeconds); } }
Source:
public RadiatingLightning(UUID ownerId, CardSetInfo setInfo) { super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{3}{R}"); this.getSpellAbility().addEffect(new DamageTargetEffect(3)); this.getSpellAbility().addEffect(new DamageAllControlledTargetEffect(1, new FilterCreaturePermanent())); this.getSpellAbility().addTarget(new TargetPlayer()); }

Target:
public RadiatingLightning(UUID ownerId, CardSetInfo setInfo) { super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{3}{R}"); this.getSpellAbility().addEffect(new DamageTargetEffect(3)); this.getSpellAbility().addEffect(new DamageAllControlledTargetEffect(1, new FilterCreaturePermanent()).setText("and 1 damage to each creature that player controls")); this.getSpellAbility().addTarget(new TargetPlayer()); }
Source:
public void aggregate(int length, AggregationResultHolder aggregationResultHolder, Map<TransformExpressionTree, BlockValSet> blockValSetMap) { int numBlockValSets = blockValSetMap.size(); int numExpressions = _inputExpressions.size(); Preconditions .checkState(numBlockValSets == numExpressions, "Size mismatch: numBlockValSets = %s, numExpressions = %s", numBlockValSets, numExpressions); BlockValSet[] blockValSets = new BlockValSet[numExpressions]; for (int i = 0; i < numExpressions; i++) { blockValSets[i] = blockValSetMap.get(_inputExpressions.get(i)); } DistinctTable distinctTable = aggregationResultHolder.getResult(); if (distinctTable == null) { ColumnDataType[] columnDataTypes = new ColumnDataType[numExpressions]; for (int i = 0; i < numExpressions; i++) { columnDataTypes[i] = ColumnDataType.fromDataTypeSV(blockValSetMap.get(_inputExpressions.get(i)).getValueType()); } DataSchema dataSchema = new DataSchema(_columns, columnDataTypes); distinctTable = new DistinctTable(dataSchema, _orderBy, _limit); aggregationResultHolder.setValue(distinctTable); } else if (distinctTable.shouldNotAddMore()) { return; } RowBasedBlockValueFetcher blockValueFetcher = new RowBasedBlockValueFetcher(blockValSets); for (int i = 0; i < length; i++) { if (!distinctTable.add(new Record(blockValueFetcher.getRow(i)))) { return; } } }

Target:
public void aggregate(int length, AggregationResultHolder aggregationResultHolder, Map<TransformExpressionTree, BlockValSet> blockValSetMap) { int numBlockValSets = blockValSetMap.size(); int numExpressions = _inputExpressions.size(); Preconditions .checkState(numBlockValSets == numExpressions, "Size mismatch: numBlockValSets = %s, numExpressions = %s", numBlockValSets, numExpressions); BlockValSet[] blockValSets = new BlockValSet[numExpressions]; for (int i = 0; i < numExpressions; i++) { blockValSets[i] = blockValSetMap.get(_inputExpressions.get(i)); } DistinctTable distinctTable = aggregationResultHolder.getResult(); if (distinctTable == null) { ColumnDataType[] columnDataTypes = new ColumnDataType[numExpressions]; for (int i = 0; i < numExpressions; i++) { columnDataTypes[i] = ColumnDataType.fromDataTypeSV(blockValSetMap.get(_inputExpressions.get(i)).getValueType()); } DataSchema dataSchema = new DataSchema(_columns, columnDataTypes); distinctTable = new DistinctTable(dataSchema, _orderBy, _limit); aggregationResultHolder.setValue(distinctTable); } if (distinctTable.hasOrderBy()) { RowBasedBlockValueFetcher blockValueFetcher = new RowBasedBlockValueFetcher(blockValSets); for (int i = 0; i < length; i++) { distinctTable.addWithOrderBy(new Record(blockValueFetcher.getRow(i))); } } else { if (distinctTable.isSatisfied()) { return; } RowBasedBlockValueFetcher blockValueFetcher = new RowBasedBlockValueFetcher(blockValSets); for (int i = 0; i < length; i++) { if (distinctTable.addWithoutOrderBy(new Record(blockValueFetcher.getRow(i)))) { return; } } } }
Source:
public static void validateLicenseIdMatch(License license) throws SW360Exception { if (license.isSetId() && license.isSetShortname()) { String message = "license short name must be equal with license id"; assertEquals(license.getId(), license.getShortname(), message); } }

Target:
private static void validateLicenseIdMatch(License license) throws SW360Exception { String message = "license short name must be equal to license id"; assertEquals(license.getId(), license.getShortname(), message); }
Source:
private void initializeErrorReport() { reportWriterService.setFileNamePrefix(configurationService.getPropertyValueAsString(CUPdpKeyConstants.PDP_SEND_ACH_NOTIFICATION_ERROR_REPORT_PREFIX)); reportWriterService.setTitle(configurationService.getPropertyValueAsString(CUPdpKeyConstants.PDP_SEND_ACH_NOTIFICATION_ERROR_REPORT_TITLE)); reportWriterService.initialize(); reportWriterService.writeNewLines(2); String rowFormat = configurationService.getPropertyValueAsString(CUPdpKeyConstants.PDP_SEND_ACH_NOTIFICATION_ERROR_REPORT_FORMAT); reportWriterService.writeFormattedMessageLine(rowFormat, "PAYEE ID", "PAYMENT GROUP", "DISBURSEMENT NUMBER", "EMAIL ADDRESS"); String hyphens25 = buildHyphenString(20); String hyphens200 = buildHyphenString(50); reportWriterService.writeFormattedMessageLine(rowFormat, hyphens25, hyphens25, hyphens25, hyphens200); }

Target:
private void initializeErrorReport() { reportWriterService.setFileNamePrefix(configurationService.getPropertyValueAsString(CUPdpKeyConstants.PDP_SEND_ACH_NOTIFICATION_ERROR_REPORT_PREFIX)); reportWriterService.setTitle(configurationService.getPropertyValueAsString(CUPdpKeyConstants.PDP_SEND_ACH_NOTIFICATION_ERROR_REPORT_TITLE)); reportWriterService.initialize(); reportWriterService.writeNewLines(2); String rowFormat = configurationService.getPropertyValueAsString(CUPdpKeyConstants.PDP_SEND_ACH_NOTIFICATION_ERROR_REPORT_FORMAT); reportWriterService.writeFormattedMessageLine(rowFormat, "PAYEE ID", "PAYMENT GROUP", "DISBURSEMENT NUMBER", "EMAIL ADDRESS"); String hyphens25 = buildHyphenString(20); String hyphens50 = buildHyphenString(50); reportWriterService.writeFormattedMessageLine(rowFormat, hyphens25, hyphens25, hyphens25, hyphens50); }
Source:
public static MigrationOptions map(HasMigrationOptions entity, MigrationOptions template) { if (template == null) { template = new MigrationOptions(); } template.setAutoConverge(mapToInheritableBoolean(entity.getAutoConverge())); template.setCompressed(mapToInheritableBoolean(entity.getMigrateCompressed())); if (entity.getMigrationPolicyId() != null) { MigrationPolicy policy = template.getPolicy(); if (policy == null) { policy = new MigrationPolicy(); template.setPolicy(policy); } policy.setId(entity.getMigrationPolicyId().toString()); template.setPolicy(policy); } return template; }

Target:
public static MigrationOptions map(HasMigrationOptions entity, MigrationOptions template) { if (template == null) { template = new MigrationOptions(); } template.setAutoConverge(mapToInheritableBoolean(entity.getAutoConverge())); template.setCompressed(mapToInheritableBoolean(entity.getMigrateCompressed())); if (entity.getMigrationPolicyId() != null) { MigrationPolicy policy = template.getPolicy(); if (policy == null) { policy = new MigrationPolicy(); template.setPolicy(policy); } policy.setId(entity.getMigrationPolicyId().toString()); } return template; }
Source:
private void mergeManifests() throws MojoExecutionException { getLog().debug( "mergeManifests: " + mergeManifests ); if ( !mergeManifests ) { getLog().info( "Manifest merging disabled. Using project manifest only" ); return; } getLog().info( "Getting manifests of dependent apklibs" ); List<File> libManifests = new ArrayList<File>(); for ( Artifact artifact : getAllRelevantDependencyArtifacts() ) { if ( artifact.getType().equals( APKLIB ) ) { File apklibManifeset = new File( getLibraryUnpackDirectory( artifact ), "AndroidManifest.xml" ); if ( !apklibManifeset.exists() ) { throw new MojoExecutionException( artifact.getArtifactId() + " is missing AndroidManifest.xml" ); } libManifests.add( apklibManifeset ); } } if ( libManifests.size() > 0 ) { File mergedManifest = new File( androidManifestFile.getParent(), "AndroidManifest-merged.xml" ); File sdkLibs = getAndroidSdk().getSDKLibJar(); File mergerLib = getAndroidSdk().getManifmergerJar(); ManifestMerger.initialize( getLog(), sdkLibs, mergerLib ); ManifestMerger mm = new ManifestMerger(); getLog().info( "Merging manifests of dependent apklibs" ); if ( mm.process( mergedManifest, androidManifestFile, libManifests.toArray( new File[libManifests.size()] ) ) ) { androidManifestFile.delete(); mergedManifest.renameTo( androidManifestFile ); getLog().info( "Done Merging Manifests of APKLIBs" ); } else { getLog().error( "Manifests were not merged!" ); throw new MojoExecutionException( "Manifests were not merged!" ); } } else { getLog().info( "No APKLIB manifests found. Using project manifest only." ); } }

Target:
private void mergeManifests() throws MojoExecutionException { getLog().debug( "mergeManifests: " + mergeManifests ); if ( !mergeManifests ) { getLog().info( "Manifest merging disabled. Using project manifest only" ); return; } getLog().info( "Getting manifests of dependent apklibs" ); List<File> libManifests = new ArrayList<File>(); for ( Artifact artifact : getAllRelevantDependencyArtifacts() ) { if ( artifact.getType().equals( APKLIB ) ) { File apklibManifeset = new File( getLibraryUnpackDirectory( artifact ), "AndroidManifest.xml" ); if ( !apklibManifeset.exists() ) { throw new MojoExecutionException( artifact.getArtifactId() + " is missing AndroidManifest.xml" ); } libManifests.add( apklibManifeset ); } } if ( !libManifests.isEmpty() ) { File mergedManifest = new File( androidManifestFile.getParent(), "AndroidManifest-merged.xml" ); File sdkLibs = getAndroidSdk().getSDKLibJar(); File mergerLib = getAndroidSdk().getManifmergerJar(); ManifestMerger mm = new ManifestMerger( getLog(), sdkLibs, mergerLib ); getLog().info( "Merging manifests of dependent apklibs" ); if ( mm.process( mergedManifest, androidManifestFile, libManifests.toArray( new File[libManifests.size()] ) ) ) { androidManifestFile.delete(); mergedManifest.renameTo( androidManifestFile ); getLog().info( "Done Merging Manifests of APKLIBs" ); } else { getLog().error( "Manifests were not merged!" ); throw new MojoExecutionException( "Manifests were not merged!" ); } } else { getLog().info( "No APKLIB manifests found. Using project manifest only." ); } }
Source:
public void propagate(int evtmask) throws ContradictionException { if (iv.isInstantiated()) { set.addToKernel(iv.getValue(), aCause); setPassive(); return; } int ub = iv.getUB(); for (int i = iv.getLB(); i <= ub; i++) { if (!set.envelopeContains(i)) { iv.removeValue(i, this); } } if (iv.isInstantiated()) { set.addToKernel(iv.getValue(), aCause); setPassive(); } }

Target:
public void propagate(int evtmask) throws ContradictionException { if (iv.isInstantiated()) { set.addToKernel(iv.getValue(), aCause); setPassive(); return; } int ub = iv.getUB(); for (int i = iv.getLB(); i <= ub; iv.nextValue(i)) { if (!set.envelopeContains(i)) { iv.removeValue(i, aCause); } } if (iv.isInstantiated()) { set.addToKernel(iv.getValue(), aCause); setPassive(); } sdm.unfreeze(); }
Source:
public Storage getStorage(final String id) { final Optional<Storage> storage; try { storage = storageDbRepository.getStorage(id); } catch (RepositoryProblemException e) { LOG.error("DB error occurred when fetching storage", e); throw new InternalNakadiException(e.getMessage()); } if (storage.isPresent()) { return storage.get(); } else { throw new NoSuchStorageException("No storage with id " + id); } }

Target:
public Storage getStorage(final String id) throws NoSuchStorageException, InternalNakadiException { final Optional<Storage> storage; try { storage = storageDbRepository.getStorage(id); } catch (RepositoryProblemException e) { LOG.error("DB error occurred when fetching storage", e); throw new InternalNakadiException(e.getMessage()); } if (storage.isPresent()) { return storage.get(); } else { throw new NoSuchStorageException("No storage with id " + id); } }
Source:
public boolean onCreateOptionsMenu(Menu menu) { getSupportMenuInflater().inflate(R.menu.guide_view_menu, menu); MenuItem item = menu.findItem(R.id.comments); item.getActionView().setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (mGuide != null) { ArrayList<Comment> comments; int stepIndex = getStepIndex(), contextid; String title, context; if (stepIndex < 0) { comments = mGuide.getComments(); title = getString(R.string.guide_comments); context = "guide"; contextid = mGuide.getGuideid(); } else { comments = mGuide.getStep(stepIndex).getComments(); contextid = mGuide.getStep(stepIndex).getStepid(); context = "step"; title = getString(R.string.step_number_comments, stepIndex + 1); } startActivityForResult(CommentsActivity.viewComments(getApplicationContext(), comments, title, context, contextid), COMMENT_REQUEST); } } }); return super.onCreateOptionsMenu(menu); }

Target:
public boolean onCreateOptionsMenu(Menu menu) { getSupportMenuInflater().inflate(R.menu.guide_view_menu, menu); MenuItem item = menu.findItem(R.id.comments); item.getActionView().setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (mGuide != null) { ArrayList<Comment> comments; int stepIndex = getStepIndex(), contextid; String title, context; if (stepIndex < 0) { comments = mGuide.getComments(); title = getString(R.string.guide_comments); context = "guide"; contextid = mGuide.getGuideid(); } else { comments = mGuide.getStep(stepIndex).getComments(); contextid = mGuide.getStep(stepIndex).getStepid(); context = "step"; title = getString(R.string.step_number_comments, stepIndex + 1); } startActivityForResult(CommentsActivity.viewGuideComments(getApplicationContext(), comments, title, context, contextid, mGuide.getGuideid()), COMMENT_REQUEST); } } }); CheatSheet.setup(item.getActionView(), R.string.view_comments); return super.onCreateOptionsMenu(menu); }
Source:
void refreshTree() { try { tree.refresh(); } catch (Exception e) }

Target:
void refreshTree() { if(tree.getControl() != null && !tree.getControl().isDisposed()) { tree.refresh(); } }
Source:
public String getCatalogUrl() { String catalogUrl = properties.get(CATALOG_URL); if (catalogUrl == null) { catalogUrl = ""; } return catalogUrl; }

Target:
public String getCatalogUrl() { return properties.get(CATALOG_URL); }
Source:
public void resetKernelCmdlineCheckboxes() { final CpuVendor cpuVendor = getCurrentCpuVendor(); if (cpuVendor == null) { return; } switch (cpuVendor) { case INTEL: case AMD: case IBMS390: setKernelCmdlineCheckboxesValue(false); break; case IBM: setKernelCmdlineCheckboxesValue(true); if (getKernelCmdlineFips().getIsChangable()) { getKernelCmdlineFips().setEntity(false); } if (getKernelCmdlineSmtDisabled().getIsChangable()) { getKernelCmdlineSmtDisabled().setEntity(false); } break; default: throw new RuntimeException("Unknown CpuVendor type: " + cpuVendor); } updateKernelCmdlineCheckboxesChangeability(); }

Target:
public void resetKernelCmdlineCheckboxes() { final CpuVendor cpuVendor = getCurrentCpuVendor(); if (cpuVendor == null) { return; } switch (cpuVendor) { case INTEL: case AMD: case IBMS390: setKernelCmdlineCheckboxesValue(false); break; case IBM: setKernelCmdlineCheckboxesValuePpc(false); break; default: throw new RuntimeException("Unknown CpuVendor type: " + cpuVendor); } updateKernelCmdlineCheckboxesChangeability(); }
Source:
public void userTypeChanged(UserOrGroup newType, boolean setRadioValue) { switch (newType) { case User: searchItems.ensureColumnVisible(firstNameColumn, constants.firstNamePermissionsPopup(), true, MAX_COL_WIDTH); searchItems.ensureColumnVisible(groupNameColumn, constants.groupNamePermissionsPopup(), false, MAX_COL_WIDTH); searchItems.ensureColumnVisible(lastNameColumn, constants.lastNamePermissionsPopup(), true, MAX_COL_WIDTH); searchItems.ensureColumnVisible(userNameColumn, constants.userNamePermissionsPopup(), true, MAX_COL_WIDTH); searchItems.ensureColumnVisible(displayNameColumn, constants.displayNamePermissionsPopup(), false, MAX_COL_WIDTH); if (setRadioValue) { specificUserRadio.setValue(true, false); } break; case Group: searchItems.ensureColumnVisible(firstNameColumn, constants.firstNamePermissionsPopup(), false, MAX_COL_WIDTH); searchItems.ensureColumnVisible(groupNameColumn, constants.groupNamePermissionsPopup(), true, MAX_COL_WIDTH); searchItems.ensureColumnVisible(lastNameColumn, constants.lastNamePermissionsPopup(), false, MAX_COL_WIDTH); searchItems.ensureColumnVisible(userNameColumn, constants.userNamePermissionsPopup(), false, MAX_COL_WIDTH); searchItems.ensureColumnVisible(displayNameColumn, constants.displayNamePermissionsPopup(), true, MAX_COL_WIDTH); if (setRadioValue) { specificGroupRadio.setValue(true, false); } break; } }

Target:
public void userTypeChanged(UserOrGroup newType, boolean setRadioValue) { boolean isUser = newType == UserOrGroup.User; searchItems.ensureColumnVisible(firstNameColumn, constants.firstNamePermissionsPopup(), isUser, MAX_COL_WIDTH); searchItems.ensureColumnVisible(groupNameColumn, constants.groupNamePermissionsPopup(), !isUser, MAX_COL_WIDTH); searchItems.ensureColumnVisible(lastNameColumn, constants.lastNamePermissionsPopup(), isUser, MAX_COL_WIDTH); searchItems.ensureColumnVisible(userNameColumn, constants.userNamePermissionsPopup(), isUser, MAX_COL_WIDTH); searchItems.ensureColumnVisible(displayNameColumn, constants.displayNamePermissionsPopup(), !isUser, MAX_COL_WIDTH); if (setRadioValue) { if (isUser) { specificUserRadio.setValue(true, false); } else { specificGroupRadio.setValue(true, false); } } }
Source:
private static Details getDetails(DetailAST ast) { final Details details; switch (ast.getType()) { case TokenTypes.LITERAL_TRY: case TokenTypes.LITERAL_CATCH: case TokenTypes.LITERAL_FINALLY: details = getDetailsForTryCatchFinally(ast); break; case TokenTypes.LITERAL_IF: case TokenTypes.LITERAL_ELSE: details = getDetailsForIfElse(ast); break; case TokenTypes.LITERAL_DO: case TokenTypes.LITERAL_WHILE: case TokenTypes.LITERAL_FOR: details = getDetailsForLoops(ast); break; default: details = getDetailsForDefs(ast); break; } return details; }

Target:
private static Details getDetails(DetailAST ast) { final Details details; switch (ast.getType()) { case TokenTypes.LITERAL_TRY: case TokenTypes.LITERAL_CATCH: case TokenTypes.LITERAL_FINALLY: details = getDetailsForTryCatchFinally(ast); break; case TokenTypes.LITERAL_IF: case TokenTypes.LITERAL_ELSE: details = getDetailsForIfElse(ast); break; case TokenTypes.LITERAL_DO: case TokenTypes.LITERAL_WHILE: case TokenTypes.LITERAL_FOR: details = getDetailsForLoops(ast); break; case TokenTypes.LAMBDA: details = getDetailsForLambda(ast); break; case TokenTypes.LITERAL_NEW: details = getDetailsForAnonClassOrArrInitOrObjInit(ast); break; default: details = getDetailsForOthers(ast); break; } return details; }
Source:
private static double analyseBFB(BasicFBType fbType) { ECC ecc = fbType.getECC(); int nrstates = ecc.getECState().size(); int nrtransitions = ecc.getECTransition().size(); double ccfb = (nrtransitions - nrstates + 2); int saveIndex = 0; for (ECState state : ecc.getECState()) { for (ECAction action : state.getECAction()) { if (null != action.getAlgorithm()) { for (String cond : CONDITIONS) { int lastIndex = 0; while (lastIndex != -1) { if (cond.equals("REPEAT")) { saveIndex = action.getAlgorithm().toString().indexOf(cond + "\r\n", lastIndex); } else { saveIndex = action.getAlgorithm().toString().indexOf(cond + " ", lastIndex); } if (saveIndex != 0) { lastIndex = saveIndex; if (lastIndex != -1) { ccfb++; lastIndex += cond.length(); } } } } } } } return ccfb; }

Target:
private static double analyseBFB(BasicFBType fbType) { ECC ecc = fbType.getECC(); int nrstates = ecc.getECState().size(); int nrtransitions = ecc.getECTransition().size(); double ccfb = (nrtransitions - nrstates + 2); int saveIndex = 0; for (ECState state : ecc.getECState()) { for (ECAction action : state.getECAction()) { if (null != action.getAlgorithm()) { for (String cond : CONDITIONS) { int lastIndex = 0; while (-1 != lastIndex) { if (cond.equals("REPEAT")) { saveIndex = action.getAlgorithm().toString().indexOf(cond + "\r\n", lastIndex); } else { saveIndex = action.getAlgorithm().toString().indexOf(cond + " ", lastIndex); } if (0 != saveIndex) { lastIndex = saveIndex; if (-1 != lastIndex) { ccfb++; lastIndex += cond.length(); } } } } } } } return ccfb; }
Source:
protected void scrollAndClick(WebElement element) { scrollToElement(element); waitForElementClickableByElement(element); element.click(); }

Target:
protected void scrollAndClick(WebElement element) { scrollToElement(element); waitForElementClickableByElement(element, 5); element.click(); }
Source:
public void testGetCompletionTimesSingleFragment() { Trace trace1 = new Trace(); trace1.setId("1"); trace1.setStartTime(System.currentTimeMillis() - 4000); Consumer c1 = new Consumer(); c1.setUri("testuri"); c1.setDuration(TimeUnit.NANOSECONDS.convert(1234, TimeUnit.MILLISECONDS)); trace1.getNodes().add(c1); List<Trace> traces = new ArrayList<Trace>(); traces.add(trace1); try { publisher.publish(null, traces); } catch (Exception e1) { fail("Failed to store: " + e1); } Wait.until(() -> service.searchFragments(null, new Criteria()).size() == 1); Wait.until(() -> analytics.getTraceCompletionTimes(null, new Criteria()).size() == 1); List<CompletionTime> times = analytics.getTraceCompletionTimes(null, new Criteria()); assertNotNull(times); assertEquals(1, times.size()); assertEquals(1234, times.get(0).getDuration()); }

Target:
public void testGetCompletionTimesSingleFragment() throws Exception { Trace trace1 = new Trace(); trace1.setId("1"); trace1.setStartTime(System.currentTimeMillis() - 4000); Consumer c1 = new Consumer(); c1.setUri("testuri"); c1.setDuration(TimeUnit.NANOSECONDS.convert(1234, TimeUnit.MILLISECONDS)); trace1.getNodes().add(c1); publisher.publish(null, Collections.singletonList(trace1)); Wait.until(() -> service.searchFragments(null, new Criteria()).size() == 1); Wait.until(() -> analytics.getTraceCompletionTimes(null, new Criteria()).size() == 1); List<CompletionTime> times = analytics.getTraceCompletionTimes(null, new Criteria()); assertNotNull(times); assertEquals(1, times.size()); assertEquals(1234, times.get(0).getDuration()); }