August 22 2012

Yesterday, while working on a sample project with a co-working I came across what looks to be a new bug in JDeveloper when trying to create a Taskflow based on a Human task.  The issue turned out to be that the wizard for generating the task flow based on a human task was replacing the default package that was configured for the view project and setting it to the project name instead.  In most cases, this wouldn't have caused any problem except that the DataBindings.cpx would be placed in a package named after the project instead of the default package that was provided when creating the view project.  In our case though, the project name had hyphens in the name which is not a valid character for a java package name.  

First, I created an empty ADF View Controller project called adf-view-tests and set the default package to be com.avioconsulting.mbo as can be seen below.

Next, I created a new ADF Task Flow Based on Human Task.

I accepted the fault naming and location for the bounded task flow (CreateMBO_TaskFlow.xml)

Once the code generation was complete, you can see that a package exists called adf_view_tests_CreateMBO.  This contains all of the data definitions for the task payload.  This package name is correct.  Below this package you can see a folder called adf-view-tests that contains the DataControls.dcx file.  This is shown as a folder instead of a package because the hyphens in the folder name are not valid for a package name.  This will cause problems if we try and deploy and execute the task flow.  Also, this is not the package name I had configured in the project, so it seems it was overridden.

As you can see below when I open the project perferences again and simply try to press OK at the bottom I am notified that the package name is not valid.  So not only did it generate the DataControls.dcx file into the wrong package it actually changed the default package for my project to this invalid package name.

This issue leaves us with two options.

1.  Only use a valid package name as the project name, which means removing the hyphens.  We can then use the new package name that is generated, although this is not ideal.  In this case you can also right click on the generated package and use the refactor option to rename or move the package.  This will update the dcx and adfm.xml files as needed.  You can then change the default package to whatever you would like.

2.  We name the project however we want and once the DataControls.dcx file has been generated we move it into the package we want.  We then, at a minimum, need to modify the dcx file which contains a Package attribute and the META-INF/adfm.xml file that has a reference to the dcx file.  

In either case, if you generate additional task flows based on human tasks then the existing dcx file will be updated and you won't need to move or modify it again.  Hower, the default package will be reset each time, so after each time you generate a task flow based on a human task you will want to go and reset your default package name.

Unfortunately, other than the two solutions described above, I could not find a solution for this issue.  I performed the same test in JDeveloper and did not see this behavior.  Instead, used the default package that was configured in the project and did not override anything.

Hopefully, this will be resolved again in the upcoming release or in a patch to

About the Author

Adam Desjardin


Join the Conversation
