Skip to content

Instantly share code, notes, and snippets.

@remysucre
Last active April 10, 2018 17:18
Show Gist options
  • Save remysucre/3ad2d7701685b12fd9af7f3cb80b5aa1 to your computer and use it in GitHub Desktop.
Save remysucre/3ad2d7701685b12fd9af7f3cb80b5aa1 to your computer and use it in GitHub Desktop.
false negatives
/Users/rem/metalift/txl/qbs/allbench//WorkProductSExpTableBean.java
{
int numberOfFinishedActivity = 0;
wilos.model.misc.project.Project project = this.projectService.getProject(((java.lang.String) wilos.presentation.web.utils.WebSessionService.getAttribute(wilos.presentation.web.utils.WebSessionService.PROJECT_ID)));
if (this.concreteActivityService.getConcreteActivitiesFromProject(project).size() != 0)
{
labeled_1: {
java.util.Iterator extfor$iter = this.concreteActivityService.getConcreteActivitiesFromProject(project).iterator();
while (extfor$iter.hasNext())
{
wilos.model.misc.concreteactivity.ConcreteActivity cact = (wilos.model.misc.concreteactivity.ConcreteActivity) extfor$iter.next();
if (cact.getState().equals(wilos.utils.Constantes.State.FINISHED))
{
numberOfFinishedActivity++;
}
}
}
labeled_2: {
if (numberOfFinishedActivity == this.concreteActivityService.getConcreteActivitiesFromProject(project).size())
{
this.allConcreteActivitiesAreFinishedWorkProduct = true;
}
else
{
this.allConcreteActivitiesAreFinishedWorkProduct = false;
}
}
}
return this.allConcreteActivitiesAreFinishedWorkProduct;
}haha
matches1
/Users/rem/metalift/txl/qbs/allbench//ProcessManagerBean.java
{
labeled_1: {
if (this.getProcessManagerList().size() == 0)
{
this.processManagerView = "processManagerView_null";
}
else
{
this.processManagerView = "processManagerView_not_null";
}
}
return this.processManagerView;
}haha
matches1
/Users/rem/metalift/txl/qbs/allbench//NotificationServiceImpl.java
{
try
{
if (logger.isDebugEnabled())
{
logger.debug(("handleIssueNotificationhandleIssueNotification: called with " + "issue: " + issue + ", type: " + type + "url: " + url + ", receipients: " + (null == receipients ? "<null>" : java.lang.String.valueOf(java.util.Arrays.asList(receipients))) + ", lastModifiedDays: " + lastModifiedDays));
}
java.util.List<org.itracker.model.Notification> notifications;
if (issue == null)
{
logger.warn(("handleIssueNotification: issue was null. Notification will n" + "ot be handled"));
return;
}
if (lastModifiedDays == null || lastModifiedDays.intValue() < 0)
{
lastModifiedDays = java.lang.Integer.valueOf(org.itracker.web.scheduler.tasks.ReminderNotification.DEFAULT_ISSUE_AGE);
}
if (receipients == null)
{
java.util.ArrayList<javax.mail.internet.InternetAddress> recList = new java.util.ArrayList<javax.mail.internet.InternetAddress>();
notifications = this.getIssueNotifications(issue);
java.util.Iterator<org.itracker.model.Notification> it = notifications.iterator();
org.itracker.model.User currentUser;
while (it.hasNext())
{
currentUser = it.next().getUser();
if (null != currentUser && null != currentUser.getEmailAddress() && null != currentUser.getEmail() && !recList.contains(currentUser.getEmailAddress()) && currentUser.getEmail().indexOf('@') >= 0)
{
recList.add(currentUser.getEmailAddress());
}
}
receipients = recList.toArray(new javax.mail.internet.InternetAddress[] {
});
}
labeled_1: {
java.util.List<org.itracker.model.IssueActivity> activity = getIssueService().getIssueActivity(issue.getId(), false);
issue.getActivities();
java.util.List<org.itracker.model.IssueHistory> histories = issue.getHistory();
java.util.Iterator<org.itracker.model.IssueHistory> it = histories.iterator();
org.itracker.model.IssueHistory history = null;
org.itracker.model.IssueHistory currentHistory;
history = getIssueService().getLastIssueHistory(issue.getId());
java.lang.Integer historyId = 0;
while (it.hasNext())
{
currentHistory = (org.itracker.model.IssueHistory) it.next();
if (logger.isDebugEnabled())
{
logger.debug(("handleIssueNotification: found history: " + currentHistory.getDescription() + " (time: " + currentHistory.getCreateDate()));
}
if (currentHistory.getId() > historyId)
{
historyId = currentHistory.getId();
history = currentHistory;
}
}
}
if (logger.isDebugEnabled() && null != history)
{
logger.debug(("handleIssueNotification: got most recent history: " + history + " (" + history.getDescription() + ")"));
}
java.util.List<org.itracker.model.Component> components = issue.getComponents();
java.util.List<org.itracker.model.Version> versions = issue.getVersions();
if (receipients.length > 0)
{
java.lang.String subject = "";
if (type == org.itracker.model.Notification.Type.CREATED)
{
subject = org.itracker.core.resources.ITrackerResources.getString("itracker.email.issue.subject.created", new java.lang.Object[] {
issue.getId(),
issue.getProject().getName(),
lastModifiedDays,
});
}
else
if (type == org.itracker.model.Notification.Type.ASSIGNED)
{
subject = org.itracker.core.resources.ITrackerResources.getString("itracker.email.issue.subject.assigned", new java.lang.Object[] {
issue.getId(),
issue.getProject().getName(),
lastModifiedDays,
});
}
else
if (type == org.itracker.model.Notification.Type.CLOSED)
{
subject = org.itracker.core.resources.ITrackerResources.getString("itracker.email.issue.subject.closed", new java.lang.Object[] {
issue.getId(),
issue.getProject().getName(),
lastModifiedDays,
});
}
else
if (type == org.itracker.model.Notification.Type.ISSUE_REMINDER)
{
subject = org.itracker.core.resources.ITrackerResources.getString("itracker.email.issue.subject.reminder", new java.lang.Object[] {
issue.getId(),
issue.getProject().getName(),
lastModifiedDays,
});
}
else
{
subject = org.itracker.core.resources.ITrackerResources.getString("itracker.email.issue.subject.updated", new java.lang.Object[] {
issue.getId(),
issue.getProject().getName(),
lastModifiedDays,
});
}
java.lang.String activityString;
java.lang.String componentString = "";
java.lang.String versionString = "";
java.lang.StringBuffer sb = new java.lang.StringBuffer();
int i = 0;
while (i < activity.size())
{
sb.append(org.itracker.services.util.IssueUtilities.getActivityName(activity.get(i).getActivityType())).append(": ").append(activity.get(i).getDescription()).append("\n");
i++;
}
activityString = sb.toString();
i = 0;
while (i < components.size())
{
componentString += (i != 0 ? ", " : "") + components.get(i).getName();
i++;
}
i = 0;
while (i < versions.size())
{
versionString += (i != 0 ? ", " : "") + versions.get(i).getNumber();
i++;
}
java.lang.String msgText = "";
if (type == org.itracker.model.Notification.Type.ISSUE_REMINDER)
{
msgText = org.itracker.core.resources.ITrackerResources.getString("itracker.email.issue.body.reminder", new java.lang.Object[] {
(url + "/module-projects/view_issue.do?id=" + issue.getId()),
issue.getProject().getName(),
issue.getDescription(),
org.itracker.services.util.IssueUtilities.getStatusName(issue.getStatus()),
org.itracker.services.util.IssueUtilities.getSeverityName(issue.getSeverity()),
((issue.getOwner().getFirstName() != null ? issue.getOwner().getFirstName() : "") + " " + (issue.getOwner().getLastName() != null ? issue.getOwner().getLastName() : "")),
componentString,
(history == null ? "" : history.getUser().getFirstName() + " " + history.getUser().getLastName()),
(history == null ? "" : org.itracker.services.util.HTMLUtilities.removeMarkup(history.getDescription())),
lastModifiedDays,
activityString,
});
}
else
{
java.lang.String resolution = issue.getResolution() == null ? "" : issue.getResolution();
if (!resolution.equals("") && org.itracker.services.util.ProjectUtilities.hasOption(org.itracker.services.util.ProjectUtilities.OPTION_PREDEFINED_RESOLUTIONS, issue.getProject().getOptions()))
{
resolution = org.itracker.services.util.IssueUtilities.getResolutionName(resolution, org.itracker.core.resources.ITrackerResources.getLocale());
}
msgText = org.itracker.core.resources.ITrackerResources.getString("itracker.email.issue.body.standard", new java.lang.Object[] {
new java.lang.StringBuffer(url).append("/module-projects/view_issue.do?id=").append(issue.getId()).toString(),
issue.getProject().getName(),
issue.getDescription(),
org.itracker.services.util.IssueUtilities.getStatusName(issue.getStatus()),
resolution,
org.itracker.services.util.IssueUtilities.getSeverityName(issue.getSeverity()),
((null != issue.getOwner() && null != issue.getOwner().getFirstName() ? issue.getOwner().getFirstName() : "") + " " + (null != issue.getOwner() && null != issue.getOwner().getLastName() ? issue.getOwner().getLastName() : "")),
componentString,
(history == null ? "" : history.getUser().getFirstName() + " " + history.getUser().getLastName()),
(history == null ? "" : org.itracker.services.util.HTMLUtilities.removeMarkup(history.getDescription())),
activityString,
});
}
emailService.sendEmail(receipients, subject, msgText);
updateIssueActivityNotification(issue, true);
}
}
catch (java.lang.Exception e)
{
logger.error(("handleIssueNotification: unexpected exception caught, throwi" + "ng runtime exception"), e);
throw new java.lang.RuntimeException(e);
}
}haha
{
java.util.Set<javax.mail.internet.InternetAddress> recipients = recipientsLocales.keySet();
java.util.Map<java.util.Locale, java.util.Set<javax.mail.internet.InternetAddress>> localeRecipients = new java.util.Hashtable<java.util.Locale, java.util.Set<javax.mail.internet.InternetAddress>>();
java.util.List<org.itracker.model.Component> components = issue.getComponents();
java.util.List<org.itracker.model.Version> versions = issue.getVersions();
java.util.List<org.itracker.model.IssueActivity> activity = getIssueService().getIssueActivity(issue.getId(), false);
issue.getActivities();
java.util.List<org.itracker.model.IssueHistory> histories = issue.getHistory();
java.util.Iterator<org.itracker.model.IssueHistory> it = histories.iterator();
labeled_2: {
org.itracker.model.IssueHistory history = null;
org.itracker.model.IssueHistory currentHistory;
history = getIssueService().getLastIssueHistory(issue.getId());
java.lang.Integer historyId = 0;
while (it.hasNext())
{
currentHistory = (org.itracker.model.IssueHistory) it.next();
if (logger.isDebugEnabled())
{
logger.debug(("handleIssueNotification: found history: " + currentHistory.getDescription() + " (time: " + currentHistory.getCreateDate()));
}
if (currentHistory.getId() > historyId)
{
historyId = currentHistory.getId();
history = currentHistory;
}
}
}
if (logger.isDebugEnabled() && null != history)
{
logger.debug(("handleIssueNotification: got most recent history: " + history + " (" + history.getDescription() + ")"));
}
java.util.Iterator<javax.mail.internet.InternetAddress> iaIt = recipientsLocales.keySet().iterator();
while (iaIt.hasNext())
{
javax.mail.internet.InternetAddress internetAddress = (javax.mail.internet.InternetAddress) iaIt.next();
if (localeRecipients.keySet().contains(recipientsLocales.get(internetAddress)))
{
localeRecipients.get(recipientsLocales.get(internetAddress)).add(internetAddress);
}
else
{
java.util.Set<javax.mail.internet.InternetAddress> addresses = new java.util.HashSet<javax.mail.internet.InternetAddress>();
localeRecipients.put(recipientsLocales.get(internetAddress), addresses);
}
}
java.util.Iterator<java.util.Locale> localesIt = localeRecipients.keySet().iterator();
try
{
while (localesIt.hasNext())
{
java.util.Locale currentLocale = (java.util.Locale) localesIt.next();
recipients = localeRecipients.get(currentLocale);
if (recipients.size() > 0)
{
java.lang.String subject = "";
if (type == org.itracker.model.Notification.Type.CREATED)
{
subject = org.itracker.core.resources.ITrackerResources.getString("itracker.email.issue.subject.created", currentLocale, new java.lang.Object[] {
issue.getId(),
issue.getProject().getName(),
notModifiedSince,
});
}
else
if (type == org.itracker.model.Notification.Type.ASSIGNED)
{
subject = org.itracker.core.resources.ITrackerResources.getString("itracker.email.issue.subject.assigned", currentLocale, new java.lang.Object[] {
issue.getId(),
issue.getProject().getName(),
notModifiedSince,
});
}
else
if (type == org.itracker.model.Notification.Type.CLOSED)
{
subject = org.itracker.core.resources.ITrackerResources.getString("itracker.email.issue.subject.closed", currentLocale, new java.lang.Object[] {
issue.getId(),
issue.getProject().getName(),
notModifiedSince,
});
}
else
if (type == org.itracker.model.Notification.Type.ISSUE_REMINDER)
{
subject = org.itracker.core.resources.ITrackerResources.getString("itracker.email.issue.subject.reminder", currentLocale, new java.lang.Object[] {
issue.getId(),
issue.getProject().getName(),
notModifiedSince,
});
}
else
{
subject = org.itracker.core.resources.ITrackerResources.getString("itracker.email.issue.subject.updated", currentLocale, new java.lang.Object[] {
issue.getId(),
issue.getProject().getName(),
notModifiedSince,
});
}
java.lang.String activityString;
java.lang.String componentString = "";
java.lang.String versionString = "";
java.lang.StringBuffer sb = new java.lang.StringBuffer();
int i = 0;
while (i < activity.size())
{
sb.append(org.itracker.services.util.IssueUtilities.getActivityName(activity.get(i).getActivityType(), currentLocale)).append(": ").append(activity.get(i).getDescription()).append("\n");
i++;
}
activityString = sb.toString();
i = 0;
while (i < components.size())
{
componentString += (i != 0 ? ", " : "") + components.get(i).getName();
i++;
}
i = 0;
while (i < versions.size())
{
versionString += (i != 0 ? ", " : "") + versions.get(i).getNumber();
i++;
}
java.lang.String msgText = "";
if (type == org.itracker.model.Notification.Type.ISSUE_REMINDER)
{
msgText = org.itracker.core.resources.ITrackerResources.getString("itracker.email.issue.body.reminder", currentLocale, new java.lang.Object[] {
(url + "/module-projects/view_issue.do?id=" + issue.getId()),
issue.getProject().getName(),
issue.getDescription(),
org.itracker.services.util.IssueUtilities.getStatusName(issue.getStatus()),
org.itracker.services.util.IssueUtilities.getSeverityName(issue.getSeverity()),
((issue.getOwner().getFirstName() != null ? issue.getOwner().getFirstName() : "") + " " + (issue.getOwner().getLastName() != null ? issue.getOwner().getLastName() : "")),
componentString,
(history == null ? "" : history.getUser().getFirstName() + " " + history.getUser().getLastName()),
(history == null ? "" : org.itracker.services.util.HTMLUtilities.removeMarkup(history.getDescription())),
notModifiedSince,
activityString,
});
}
else
{
java.lang.String resolution = issue.getResolution() == null ? "" : issue.getResolution();
if (!resolution.equals("") && org.itracker.services.util.ProjectUtilities.hasOption(org.itracker.services.util.ProjectUtilities.OPTION_PREDEFINED_RESOLUTIONS, issue.getProject().getOptions()))
{
resolution = org.itracker.services.util.IssueUtilities.getResolutionName(resolution, org.itracker.core.resources.ITrackerResources.getLocale());
}
msgText = org.itracker.core.resources.ITrackerResources.getString("itracker.email.issue.body.standard", currentLocale, new java.lang.Object[] {
new java.lang.StringBuffer(url).append("/module-projects/view_issue.do?id=").append(issue.getId()).toString(),
issue.getProject().getName(),
issue.getDescription(),
org.itracker.services.util.IssueUtilities.getStatusName(issue.getStatus()),
resolution,
org.itracker.services.util.IssueUtilities.getSeverityName(issue.getSeverity()),
((null != issue.getOwner() && null != issue.getOwner().getFirstName() ? issue.getOwner().getFirstName() : "") + " " + (null != issue.getOwner() && null != issue.getOwner().getLastName() ? issue.getOwner().getLastName() : "")),
componentString,
(history == null ? "" : history.getUser().getFirstName() + " " + history.getUser().getLastName()),
(history == null ? "" : org.itracker.services.util.HTMLUtilities.removeMarkup(history.getDescription())),
activityString,
});
}
if (logger.isInfoEnabled())
{
logger.info(new java.lang.StringBuilder("handleNotification: sending notification for ").append(issue).append(" (").append(type).append(") to ").append(currentLocale).append("-users (").append((recipients + ")")).toString());
}
emailService.sendEmail(recipients, subject, msgText);
if (logger.isDebugEnabled())
{
logger.debug(("handleNotification: sent notification for " + issue));
}
}
updateIssueActivityNotification(issue, true);
if (logger.isDebugEnabled())
{
logger.debug(("handleNotification: sent notification for locales " + localeRecipients.keySet() + " recipients: " + localeRecipients.values()));
}
}
}
catch (java.lang.RuntimeException e)
{
logger.error(("handleNotification: failed to notify: " + issue + " (locales: " + localeRecipients.keySet() + ")"), e);
}
}haha
matches2
/Users/rem/metalift/txl/qbs/allbench//ProcessBean.java
{
labeled_1: {
boolean r;
r = false;
java.util.Iterator extfor$iter = this.processService.getAllProcesses().iterator();
while (extfor$iter.hasNext())
{
wilos.model.spem2.process.Process process = (wilos.model.spem2.process.Process) extfor$iter.next();
if (process.getPresentationName().equals(_presentationName) && !_processId.equals(process.getId()))
r = true;
}
r = false;
}
return r;
}haha
matches1
/Users/rem/metalift/txl/qbs/allbench//UserServiceImpl.java
{
labeled_2: {
java.util.List<org.itracker.model.User> users = new java.util.ArrayList<org.itracker.model.User>();
if (projectId != null)
{
java.util.List<org.itracker.model.Permission> permissions = permissionDAO.findByProjectIdAndPermission(projectId, permissionType);
for (org.itracker.model.Permission permission : permissions) {
users.add(permission.getUser());
}
}
}
return users;
}haha
matches1
/Users/rem/metalift/txl/qbs/allbench//ParticipantBean.java
{
labeled_2: {
if (this.getParticipantsList().size() == 0)
{
this.participantView = "participantView_null";
}
else
{
this.participantView = "participantView_not_null";
}
}
return this.participantView;
}haha
matches1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment