This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 42653
Collapse All | Expand All

(-)nbproject/project.xml (+8 lines)
Lines 28-33 Link Here
28
                    </run-dependency>
28
                    </run-dependency>
29
                </dependency>
29
                </dependency>
30
                <dependency>
30
                <dependency>
31
                    <code-name-base>org.netbeans.api.web.webmodule</code-name-base>
32
                    <build-prerequisite/>
33
                    <compile-dependency/>
34
                    <run-dependency>
35
                        <specification-version>1.0</specification-version>
36
                    </run-dependency>
37
                </dependency>
38
                <dependency>
31
                    <code-name-base>org.netbeans.libs.xerces</code-name-base>
39
                    <code-name-base>org.netbeans.libs.xerces</code-name-base>
32
                    <run-dependency>
40
                    <run-dependency>
33
                        <release-version>1</release-version>
41
                        <release-version>1</release-version>
(-)src/org/apache/tools/ant/module/run/AntOutputParser.java (+54 lines)
Lines 33-38 Link Here
33
import org.netbeans.api.java.classpath.ClassPath;
33
import org.netbeans.api.java.classpath.ClassPath;
34
import org.netbeans.api.java.classpath.GlobalPathRegistry;
34
import org.netbeans.api.java.classpath.GlobalPathRegistry;
35
import org.netbeans.api.java.queries.SourceForBinaryQuery;
35
import org.netbeans.api.java.queries.SourceForBinaryQuery;
36
import org.netbeans.modules.web.api.webmodule.WebModule;
36
import org.openide.filesystems.FileObject;
37
import org.openide.filesystems.FileObject;
37
import org.openide.filesystems.FileUtil;
38
import org.openide.filesystems.FileUtil;
38
39
Lines 43-48 Link Here
43
    
44
    
44
    private String classpath = null;
45
    private String classpath = null;
45
    private Collection/*<FileObject>*/ classpathSourceRoots = null;
46
    private Collection/*<FileObject>*/ classpathSourceRoots = null;
47
    private String wmRootPath = null;
48
    private FileObject wmRoot = null;
46
    
49
    
47
    private String possibleExceptionText = null;
50
    private String possibleExceptionText = null;
48
    private String lastExceptionMessage = null;
51
    private String lastExceptionMessage = null;
Lines 56-61 Link Here
56
        classpathSourceRoots = null;
59
        classpathSourceRoots = null;
57
    }
60
    }
58
    
61
    
62
    /** Hack to detect web module used when running JSP compilation. */
63
    public void setWebModuleRoot(String wm) {
64
        wmRootPath = wm;
65
        wmRoot = null;
66
    }
67
    
59
    // XXX handle Unicode elements as well
68
    // XXX handle Unicode elements as well
60
    // XXX handle unknown source too? or don't bother?
69
    // XXX handle unknown source too? or don't bother?
61
    
70
    
Lines 65-70 Link Here
65
    private static final Pattern EXCEPTION_MESSAGE = Pattern.compile(
74
    private static final Pattern EXCEPTION_MESSAGE = Pattern.compile(
66
        "(([a-zA-Z_$][a-zA-Z0-9_$]*\\.)+)([a-zA-Z_$][a-zA-Z0-9_$]*(: .+)?)"); // NOI18N
75
        "(([a-zA-Z_$][a-zA-Z0-9_$]*\\.)+)([a-zA-Z_$][a-zA-Z0-9_$]*(: .+)?)"); // NOI18N
67
    
76
    
77
    private static final Pattern JSP_COMPILER_ERROR = Pattern.compile(
78
        "(org.apache.jasper.JasperException:)([a-zA-Z0-9_$/\\. ]*)\\(([0-9]+),([0-9]+)\\)(.*)"); // NOI18N
79
68
    /** returns a hyperlink for the line, or null if not apropos */
80
    /** returns a hyperlink for the line, or null if not apropos */
69
    public AntOutputParser.Result parse(String line) {
81
    public AntOutputParser.Result parse(String line) {
70
82
Lines 105-110 Link Here
105
            lastExceptionMessage = null;
117
            lastExceptionMessage = null;
106
        }
118
        }
107
        
119
        
120
        // JSP compiler error messages
121
        m = JSP_COMPILER_ERROR.matcher(line);
122
        if (m.matches()) {
123
            // We have a stack trace.
124
            String jspResource  = m.group(2).trim();
125
            if (jspResource.startsWith("/")) // NOI18N;
126
                jspResource = jspResource.substring(1);
127
            int lineNumber      = Integer.parseInt(m.group(3)) - 1;
128
            int columnNumber    = Integer.parseInt(m.group(4));
129
            String jspErrorText = m.group(5).trim();
130
            // Check to see if this JSP is in the web module.
131
            FileObject wmRoot = getCurrentWebModuleRoot();
132
            if (wmRoot != null) {
133
                FileObject source = wmRoot.getFileObject(jspResource);
134
                if (source != null) {
135
                    // Got it!
136
                    //debug("Found " + source + " in derived source root " + root);
137
                    return new AntOutputParser.Result(source, lineNumber, -1 /*columnNumber*/, -1, -1, jspErrorText);
138
                }
139
            }
140
        } else {
141
            // Track the last line which was not a stack trace - probably the exception message.
142
            possibleExceptionText = line;
143
            lastExceptionMessage = null;
144
        }
145
        
146
        
108
        // Not a stack trace - check whether this line mentions an explicit file.
147
        // Not a stack trace - check whether this line mentions an explicit file.
109
        
148
        
110
        // do some heuristic whether the line contains a filename
149
        // do some heuristic whether the line contains a filename
Lines 248-253 Link Here
248
            return lastExceptionMessage;
287
            return lastExceptionMessage;
249
        }
288
        }
250
        return null;
289
        return null;
290
    }
291
    
292
    /** Returns the current web module root, or null if not known.
293
     */
294
    private FileObject getCurrentWebModuleRoot() {
295
        if (wmRootPath == null) {
296
            return null;
297
        }
298
        if (wmRoot == null) {
299
            wmRoot = findFO(wmRootPath);
300
            // not really the web module root, for now the project root
301
            WebModule wm = WebModule.getWebModule(wmRoot);
302
            return wm.getDocumentBase();
303
        }
304
        return wmRoot;
251
    }
305
    }
252
    
306
    
253
    private FileObject findFO(String name) {
307
    private FileObject findFO(String name) {
(-)src/org/apache/tools/ant/module/spi/AntOutputStream.java (+6 lines)
Lines 105-110 Link Here
105
    
105
    
106
    /** see NbBuildLogger */
106
    /** see NbBuildLogger */
107
    private static final String CP_PREFIX = "***CLASSPATH***="; // NOI18N
107
    private static final String CP_PREFIX = "***CLASSPATH***="; // NOI18N
108
    private static final String WM_PREFIX = "***WEBMODULE***="; // NOI18N
108
109
109
    private void flushLine (String l) throws IOException {
110
    private void flushLine (String l) throws IOException {
110
        //System.err.println("flushing: " + l);
111
        //System.err.println("flushing: " + l);
Lines 118-123 Link Here
118
        if (l.startsWith(CP_PREFIX)) {
119
        if (l.startsWith(CP_PREFIX)) {
119
            String cp = l.substring(CP_PREFIX.length());
120
            String cp = l.substring(CP_PREFIX.length());
120
            antOutputParser.setClasspath(cp);
121
            antOutputParser.setClasspath(cp);
122
            return; // do not actually print it!
123
        }
124
        if (l.startsWith(WM_PREFIX)) {
125
            String wm = l.substring(WM_PREFIX.length());
126
            antOutputParser.setWebModuleRoot(wm);
121
            return; // do not actually print it!
127
            return; // do not actually print it!
122
        }
128
        }
123
        AntOutputParser.Result r = antOutputParser.parse(l);
129
        AntOutputParser.Result r = antOutputParser.parse(l);
(-)src-bridge/org/apache/tools/ant/module/bridge/impl/NbBuildLogger.java (+10 lines)
Lines 59-64 Link Here
59
    }
59
    }
60
    
60
    
61
    private static final Pattern classpathPattern = Pattern.compile("\n'-classpath'\n'(.*)'\n"); // NOI18N
61
    private static final Pattern classpathPattern = Pattern.compile("\n'-classpath'\n'(.*)'\n"); // NOI18N
62
    private static final Pattern projectRootPattern = Pattern.compile(
63
        "Project base dir set to: (.*)"); // NOI18N
62
    
64
    
63
    public void messageLogged(BuildEvent ev) {
65
    public void messageLogged(BuildEvent ev) {
64
        if (ev.getPriority() <= level) {
66
        if (ev.getPriority() <= level) {
Lines 82-87 Link Here
82
            if (m.find()) {
84
            if (m.find()) {
83
                String cp = m.group(1);
85
                String cp = m.group(1);
84
                err.println("***CLASSPATH***=" + cp); // NOI18N
86
                err.println("***CLASSPATH***=" + cp); // NOI18N
87
            }
88
        }
89
        // Hack to find web module root when compiling JSPs
90
        if (ev.getPriority() == Project.MSG_VERBOSE) {
91
            Matcher m = projectRootPattern.matcher(ev.getMessage());
92
            if (m.find()) {
93
                String wm = m.group(1);
94
                err.println("***WEBMODULE***=" + wm); // NOI18N
85
            }
95
            }
86
        }
96
        }
87
        // XXX should also probably clear classpath when taskFinished called
97
        // XXX should also probably clear classpath when taskFinished called
(-)build.xml (-1 / +1 lines)
Lines 267-273 Link Here
267
    <echo message="Building module a11y..."/>
267
    <echo message="Building module a11y..."/>
268
    <ant dir="../a11y" target="netbeans"/>
268
    <ant dir="../a11y" target="netbeans"/>
269
  </target>
269
  </target>
270
  <target name="all-ant" depends="all-openide,all-core/javahelp,all-openide/execution,all-openide/io,all-java/api">
270
  <target name="all-ant" depends="all-openide,all-core/javahelp,all-openide/execution,all-openide/io,all-java/api,all-web/webapi">
271
    <echo message="Building module ant..."/>
271
    <echo message="Building module ant..."/>
272
    <ant dir="../ant" target="netbeans"/>
272
    <ant dir="../ant" target="netbeans"/>
273
  </target>
273
  </target>

Return to bug 42653