Problem with decorator in xWork, the page is displayed without tabs and lot of exceptions in the log

Hi Alexey,

Thank you for acknowledging the bug and suggesting the workaround. I will try to implement the workaround on my dev env now. Will let you know if it solves the problem.

Regards,
Kshi

Hi Alexey,

The workaround did not work.
Using super.execute with / without the workaround gave further JAVA exceptions.

The problem still persist.

Not sure if I am doing the right thing as a part of work around.
Here is the relevant code…

@Scanned
public class RobotReport extends ViewBuildResults {

    @ComponentImport private final StorageLocationService storageLocationService;
    @ComponentImport private final BambooPermissionManager bambooPermissionManager;
    @ComponentImport private final BambooAuthenticationContext bambooAuthenticationContext;
    @ComponentImport private final JiraApplinksService jiraApplinksService;
    @ComponentImport private final WebInterfaceManager webInterfaceManager;
    @ComponentImport private final VcsRepositoryConfigurationService vcsRepositoryConfigurationService;
    @ComponentImport private final PlanExecutionManager planExecutionManager;
    @ComponentImport private final TriggerManager triggerManager;
    @ComponentImport private final PlanManager planManager;

    public RobotReport(final StorageLocationService storageLocationService, final BambooPermissionManager bambooPermissionManager,
                           final BambooAuthenticationContext bambooAuthenticationContext, final JiraApplinksService jiraApplinksService,
                           final WebInterfaceManager webInterfaceManager, final VcsRepositoryConfigurationService vcsRepositoryConfigurationService,
                           final PlanExecutionManager planExecutionManager, final TriggerManager triggerManager, final PlanManager planManager){

        this.storageLocationService = storageLocationService;
        this.bambooPermissionManager = bambooPermissionManager;
        this.bambooAuthenticationContext = bambooAuthenticationContext;
        this.jiraApplinksService = jiraApplinksService;
        this.webInterfaceManager = webInterfaceManager;
        this.vcsRepositoryConfigurationService = vcsRepositoryConfigurationService;
        this.planExecutionManager = planExecutionManager;
        this.triggerManager = triggerManager;
        this.planManager = planManager;
    }   

    public String execute() throws Exception {
        String strBuildList = super.doExecute();
        return strBuildList;
    }

Do I need do make any change to the pom.xml ?
How do I verify that the dependencies are injected ?
Do I need to update the atlassian-spring-scanner version ? (<atlassian.spring.scanner.version>1.2.13</atlassian.spring.scanner.version>)

@markusschulte Did the work-around provided worked for you ?

@achystoprudov @kshi.korde

The workaround does not work in my case, too. I think it cannot work, because (at least) field BambooActionSupport.authenticationContext is private.

I did some research myself, and updated my bug-demo at BitBucket with a working workaround, you can see the changes/fix/workaround at https://bitbucket.org/MarkusSchulte/devhelp1230/branches/compare/fix…#diff. In my usecase, using this addon is now without any exception being thrown.
Note this project “devhelp1230” was created using latest atlas-create-bamboo-plugin, and is because of this an Atlassian Spring scanner v1.2 addon. I think the workaround will be less freaky, when using Atlassian Spring scanner v2.

You don’t need to set these fields via constructor. You need to let spring-scanner find these dependencies and make them visible for plugin class loader when instantiate action. As I said you can have separate class with only code I’ve submitted

@achystoprudov @markusschulte looks like it is working. I will just play around with it by creating a few more jobs and plans and confirm that nothing breaks now. :slight_smile:

@markusschulte I did not add “setAuthenticationContext” (the one in your source) and it still worked for me (with the workaround suggested by Alexey).
I just additionally added com.atlassian.bamboo.vcs.configuration.service.*:="optional" in my pom.xml which was missing in your pom.xml.

@acalantog and @achystoprudov @markusschulte thanks a ton !!!

Created an issue to track progress: [BAM-19884] Bamboo doesn't wire required dependencies for Struts actions - Create and track feature requests for Atlassian products.

2 Likes

@achystoprudov , @markusschulte

I have another question, it is regarding the same context so asking it here.

In my atlassian-plugin.xml (above) my web-item has a link which is associated with the action viewRobotReport

"/build/result/viewRobotReport.action?planKey=${planKey}&buildNumber=${buildNumber}"

When I switch to a job for which the RobotReportViewCondition evaluates to false, I can still set the html report rendered by my freemarker template /templates/viewRobotReport.ftl

From the logs I could see that the link action called is instantiated first (which returns success) and then the condition class (RobotReportViewCondition) is instantiated which returns false. So I end up in a job which does not show the web-item in the tab but shows the report rendered by the freemarker template.

From what I understand, this is because the web-item link action gets executed first and then the web-item display condition gets evaluated later.

This behavior I find strange.

How can I correct this ?

Got around this. Implemented the same condition that I implemented in RobotReportViewCondition