History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: APF-1081
Type: Improvement Improvement
Status: Open Open
Priority: Minor Minor
Assignee: Matt Raible
Reporter: Carlus Henry
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
AppFuse

appfuse:gen goal does not work in core project

Created: 19/Jun/08 09:58 PM   Updated: 19/Jun/08 10:31 PM
Component/s: Tools - AMP
Affects Version/s: 2.0.2
Fix Version/s: 2.1

File Attachments: 1. File patch.diff (1 kb)



 Description  « Hide
When using the appfuse:gen goal on a project that was generated with appfuse-core archetype, it fails with a NullPointerException. The NullpointerException is due to looking for a property in the AppFuseGeneratorMojo called "webframework".

 All   Comments   Change History   FishEye      Sort Order:
Matt Raible - 19/Jun/08 10:06 PM
Please provide the steps to reproduce. I remember writing the code for this and believe I ignore this property when it's a core project (packaging=jar and parent.packing=pom).

Thanks,

Matt

Carlus Henry - 19/Jun/08 10:17 PM
Here are the recreate steps in order to recreate the issue

1.) Using the maven archetype appfuse-core create the core type project
2.) Afterwards, create the entity:
package com.mycompany.app.model;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;


@Entity
@Table (name="person")
public class Person {
private Long id;
private String lastName;
private String firstName;
@Column(name="last_name")
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
@Column(name="first_name")
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
@Id
@Column(name="id")
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
}

3.) From the command line, type the 'appfuse:gen'
4.) When prompted, enter the pojo 'Person'
5.) Then you will receive the following stacktrace.
[INFO] Trace
java.lang.NullPointerException
        at java.util.Hashtable.put(Hashtable.java:394)
        at java.util.Properties.setProperty(Properties.java:143)
        at org.appfuse.mojo.exporter.AppFuseGeneratorMojo.configureExporter(AppF
useGeneratorMojo.java:237)
        at org.appfuse.mojo.HibernateExporterMojo.doExecute(HibernateExporterMoj
o.java:228)
        at org.appfuse.mojo.exporter.AppFuseGeneratorMojo.doExecute(AppFuseGener
atorMojo.java:261)
        at org.appfuse.mojo.HibernateExporterMojo.execute(HibernateExporterMojo.
java:138)
        at org.appfuse.mojo.exporter.AppFuseGeneratorMojo.execute(AppFuseGenerat
orMojo.java:210)
        at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPlugi
nManager.java:447)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(Defa
ultLifecycleExecutor.java:539)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandalone
Goal(DefaultLifecycleExecutor.java:493)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(Defau
ltLifecycleExecutor.java:463)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHan
dleFailures(DefaultLifecycleExecutor.java:311)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegmen
ts(DefaultLifecycleExecutor.java:278)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLi
fecycleExecutor.java:143)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:333)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:126)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:282)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
        at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
        at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)

        at org.codehaus.classworlds.Launcher.main(Launcher.java:375)

Thanks
Carlus

Carlus Henry - 19/Jun/08 10:19 PM
After looking at the source code, I did find this entry...

        // AppFuse-specific values
        exporter.getProperties().setProperty("basepackage", getProject().getGroupId());
        exporter.getProperties().setProperty("daoframework", getProject().getProperties().getProperty("dao.framework"));
        exporter.getProperties().setProperty("webframework", getProject().getProperties().getProperty("web.framework"));

        exporter.getProperties().setProperty("packaging", getProject().getPackaging());


The NPE is being thrown when looking up the "web.framework" property from the project properties.

Matt Raible - 19/Jun/08 10:22 PM
Sounds like a real bug. If you get a chance to provide a patch, that'd be great.

Carlus Henry - 19/Jun/08 10:26 PM
Working on it as we speak...er...type

:)

Carlus

Carlus Henry - 19/Jun/08 10:31 PM
Here is the patch that resolves the issue.

Thanks
Carlus