Custom UIShell: making closeable the initial tabs.

With this pattern, among many other features, we have an option that allows us to open initial tabs. (when the application is started).–>closeable true in adfc-config

The problem is that if we make closeable this initial tab, when we close the initial tab and we try to open the initial tab again. We get a NullPointerException in addTab method of DynTabManager class

The problem is that the TaskflowId property in getInstance method  of  DynTab class is null.

I added these lines and now the initial Tab can be closeable.

public static DynTab getInstance(String tabName) {
 String beanName = tabName + "DynTab";
 String expr = "#{" + beanName + "}";
 DynTab tab = (DynTab)JsfUtils.getExpressionValue(expr);
 if (tab == null) {
  // try viewScope, must be used when tab is initially displayed
  expr = "#{viewScope." + beanName + "}";
  tab = (DynTab)JsfUtils.getExpressionValue(expr);
 if (tab == null) {
  sLog.severe("Could not find DynTab bean " + beanName + "!");

 //workaround to re-open the initial Tabs
 if ((tab.getTitle() == null) || (tab.getTitle().length() == 0)) {

 return tab;

and add a if in addTab method of DynTabManager class

public void addTab(DynTab tabToAdd) {
      if (tabTracker.getNumActive() >= tabTracker.getMaxNumberOfTabs()) {
      } else {
          // The list of tabs doesn't get fragmented, so the first inactive tab always
          // shows as the right most tab.
          DynTab tab = getFirstInactiveTabOrThrow();
          // add the DynTabManager instance as taskflow parameter so the
          // taskflow itself can open new tabs, and close tabs.
          if (tab.getParameters() != null) {
               tab.getParameters().put("dynTabManager", this);
               // add tab id so the taskflow iktself can change its label
               tab.getParameters().put("dynTabId", tab.getId());
           tabTracker.setNumActive(tabTracker.getNumActive() + 1);

Note:This post does not talk about Oracle UI Shell, we are talking about the UI Shell that can be downloaded from here.