QuickHammurapiTask.java


Package: org.hammurapi

Results
Date2007/07/27
Codebase5530
Reviews10293
DPMO927
Sigma4.612

Metrics
NameNumberMinAvgMaxTotal
Class complexity148.0048.0048.0048.00
Code length101.0035.50273.00355.00
File length1474.00474.00474.00474.00
Operation complexity101.005.8036.0058.00
Work order13.283.283.283.28

Violations
#LineColumnNameSeverityDescription
1231ER-0233Packages should begin with []
210184ER-0363Line is too long
311294ER-0363Line is too long
4122131ER-0363Line is too long
512388ER-0363Line is too long
612483ER-0363Line is too long
712691ER-0363Line is too long
812780ER-0363Line is too long
912890ER-0363Line is too long
1013488ER-0363Line is too long
1114391ER-0363Line is too long
1214591ER-0363Line is too long
1314683ER-0363Line is too long
1414880ER-0363Line is too long
15149117ER-0363Line is too long
16150127ER-0363Line is too long
1715592ER-0363Line is too long
1816286ER-0363Line is too long
1916586ER-0363Line is too long
2017191ER-0363Line is too long
2117891ER-0363Line is too long
2218384ER-0363Line is too long
23184150ER-0363Line is too long
2419190ER-0363Line is too long
2519599ER-0363Line is too long
26203116ER-0363Line is too long
27210114ER-0363Line is too long
28221116ER-0363Line is too long
2922281ER-0363Line is too long
3022380ER-0363Line is too long
3122797ER-0363Line is too long
32229105ER-0363Line is too long
3323098ER-0363Line is too long
3423192ER-0363Line is too long
35232142ER-0363Line is too long
36238102ER-0363Line is too long
3724382ER-0363Line is too long
38244104ER-0363Line is too long
39246157ER-0363Line is too long
4024883ER-0363Line is too long
41250106ER-0363Line is too long
4225382ER-0363Line is too long
43258132ER-0363Line is too long
4425982ER-0363Line is too long
4526680ER-0363Line is too long
46272106ER-0363Line is too long
4727591ER-0363Line is too long
48277134ER-0363Line is too long
49289109ER-0363Line is too long
5029086ER-0363Line is too long
5129199ER-0363Line is too long
52292138ER-0363Line is too long
53293127ER-0363Line is too long
5429691ER-0363Line is too long
5529896ER-0363Line is too long
56300128ER-0363Line is too long
57301105ER-0363Line is too long
58302113ER-0363Line is too long
59303143ER-0363Line is too long
6030984ER-0363Line is too long
6131194ER-0363Line is too long
62313128ER-0363Line is too long
63315121ER-0363Line is too long
64316147ER-0363Line is too long
6531899ER-0363Line is too long
66319123ER-0363Line is too long
6732583ER-0363Line is too long
6832787ER-0363Line is too long
69329128ER-0363Line is too long
70331118ER-0363Line is too long
71332146ER-0363Line is too long
7233499ER-0363Line is too long
73335122ER-0363Line is too long
74341101ER-0363Line is too long
75342136ER-0363Line is too long
76357123ER-0363Line is too long
77385177ER-0363Line is too long
78405178ER-0363Line is too long
79407122ER-0363Line is too long
80409146ER-0363Line is too long
8142181ER-0363Line is too long
82461123ER-0363Line is too long
8346490ER-0363Line is too long
8446587ER-0363Line is too long
8546790ER-0363Line is too long
8647099ER-0363Line is too long
87981ER-0492Unify logging strategy - define individual logger for class
88999ER-0111Cyclomatic complexity (36) exceeds 12
89999ER-0412Method is too long
909938ER-0472Operation (method or constructor) declares subclasses of RuntimeException in throws clause
91999ER-1053Document all Interfaces and public methods. Use a Class header. Provide Javadoc
9210129ER-0303Avoid hardwired string literals
9311125ER-1042Use a Collection instead of arrays Object[]
9411333ER-1053Document all Interfaces and public methods. Use a Class header. Provide Javadoc
95122116ER-0823Avoid using method parameter names that conflict with class member names
9612249ER-1053Document all Interfaces and public methods. Use a Class header. Provide Javadoc
9713437ER-0303Avoid hardwired string literals
9813829ER-0303Avoid hardwired string literals
9914973ER-0303Avoid hardwired string literals
10015073ER-0303Avoid hardwired string literals
10115173ER-0303Avoid hardwired string literals
10215529ER-0303Avoid hardwired string literals
10315729ER-0303Avoid hardwired string literals
10416529ER-0303Avoid hardwired string literals
10516729ER-0303Avoid hardwired string literals
10617541ER-2141java.util.List is different from java.lang.Object
10717638ER-2141org.hammurapi.ReviewToLogListener is different from java.lang.Object
10818129ER-0303Avoid hardwired string literals
10918497ER-1163Use StringBuffer for excessive String concatenation
11018490ER-1163Use StringBuffer for excessive String concatenation
11118437ER-0303Avoid hardwired string literals
11218491ER-0303Avoid hardwired string literals
11323055ER-1022String Arrays are deprecated and are ONLY allowed for final variables
11423055ER-1042Use a Collection instead of arrays Object[]
11525645ER-0303Avoid hardwired string literals
11628274ER-0293Avoid hardwired numeric literals
11728361ER-0293Avoid hardwired numeric literals
11828463ER-0293Avoid hardwired numeric literals
11928670ER-1163Use StringBuffer for excessive String concatenation
12028666ER-1163Use StringBuffer for excessive String concatenation
12128657ER-1163Use StringBuffer for excessive String concatenation
12228645ER-0303Avoid hardwired string literals
12328658ER-0303Avoid hardwired string literals
12428671ER-0303Avoid hardwired string literals
12528973ER-0303Avoid hardwired string literals
126292106ER-0481Use BigDecimal instead of Float or Double for monetary values
127292138ER-0293Avoid hardwired numeric literals
12830076ER-0823Avoid using method parameter names that conflict with class member names
12930057ER-1053Document all Interfaces and public methods. Use a Class header. Provide Javadoc
130303128ER-1163Use StringBuffer for excessive String concatenation
131303102ER-0303Avoid hardwired string literals
132303129ER-0303Avoid hardwired string literals
13331155ER-0481Use BigDecimal instead of Float or Double for monetary values
13431376ER-0823Avoid using method parameter names that conflict with class member names
13531357ER-1053Document all Interfaces and public methods. Use a Class header. Provide Javadoc
136316142ER-1163Use StringBuffer for excessive String concatenation
137316110ER-0303Avoid hardwired string literals
138316143ER-0303Avoid hardwired string literals
13931867ER-1032Catch-blocks should log the exeption with Log4J.error("Context String" , exception )
140319102ER-0303Avoid hardwired string literals
14132976ER-0823Avoid using method parameter names that conflict with class member names
14232957ER-1053Document all Interfaces and public methods. Use a Class header. Provide Javadoc
143332141ER-1163Use StringBuffer for excessive String concatenation
144332110ER-0303Avoid hardwired string literals
145332142ER-0303Avoid hardwired string literals
14633467ER-1032Catch-blocks should log the exeption with Log4J.error("Context String" , exception )
147335102ER-0303Avoid hardwired string literals
14834291ER-0303Avoid hardwired string literals
14935758ER-0303Avoid hardwired string literals
15035919ER-1032Catch-blocks should log the exeption with Log4J.error("Context String" , exception )
15136119ER-1032Catch-blocks should log the exeption with Log4J.error("Context String" , exception )
15236319ER-1032Catch-blocks should log the exeption with Log4J.error("Context String" , exception )
15336519ER-1032Catch-blocks should log the exeption with Log4J.error("Context String" , exception )
15436719ER-1032Catch-blocks should log the exeption with Log4J.error("Context String" , exception )
15536919ER-1032Catch-blocks should log the exeption with Log4J.error("Context String" , exception )
15637119ER-1032Catch-blocks should log the exeption with Log4J.error("Context String" , exception )
1573859ER-0952Too many exceptions listed in throws clause
15838929ER-1042Use a Collection instead of arrays Object[]
1594059ER-0053Classes, interfaces, methods, and variables should be named according to Sun's naming conventions.
1604059ER-0952Too many exceptions listed in throws clause
16142131ER-1111LOG4J is mandatory for all logging in ERC. System.out.println will be lost in a system console of our web/app server.
16242132ER-0303Avoid hardwired string literals
16343115ER-1032Catch-blocks should log the exeption with Log4J.error("Context String" , exception )
16443732ER-0303Avoid hardwired string literals
16545034ER-0303Avoid hardwired string literals
16645519ER-1032Catch-blocks should log the exeption with Log4J.error("Context String" , exception )
16745737ER-0293Avoid hardwired numeric literals
16846188ER-0472Operation (method or constructor) declares subclasses of RuntimeException in throws clause
1694619ER-1053Document all Interfaces and public methods. Use a Class header. Provide Javadoc
17046581ER-0303Avoid hardwired string literals
17146750ER-0303Avoid hardwired string literals
17247083ER-0303Avoid hardwired string literals

JavaDoc
QuickHammurapiTask

1/*
2 * Hammurapi
3 * Automated Java code review system.
4 * Copyright (C) 2004 Hammurapi Group
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 *
20 * URL: http://www.hammurapi.org
21 * e-Mail: support@hammurapi.biz
22 */

23package org.hammurapi;
24
25import java.io.File;
26import java.io.FileInputStream;
27import java.io.FileNotFoundException;
28import java.io.FileReader;
29import java.io.IOException;
30import java.io.InputStream;
31import java.io.InputStreamReader;
32import java.io.Reader;
33import java.sql.SQLException;
34import java.text.MessageFormat;
35import java.util.ArrayList;
36import java.util.Collection;
37import java.util.Date;
38import java.util.Iterator;
39import java.util.LinkedList;
40import java.util.List;
41
42import org.apache.commons.cli.CommandLine;
43import org.apache.commons.cli.CommandLineParser;
44import org.apache.commons.cli.Options;
45import org.apache.commons.cli.PosixParser;
46import org.apache.tools.ant.AntClassLoader;
47import org.apache.tools.ant.BuildException;
48import org.apache.tools.ant.DirectoryScanner;
49import org.apache.tools.ant.Project;
50import org.hammurapi.results.CompositeResults;
51import org.hammurapi.results.ResultsFactory;
52import org.hammurapi.results.quick.PackageTotal;
53import org.hammurapi.results.simple.QuickResultsFactory;
54
55import com.pavelvlasov.config.Component;
56import com.pavelvlasov.config.ConfigurationException;
57import com.pavelvlasov.jsel.JselException;
58import com.pavelvlasov.jsel.impl.CompilationUnitImpl;
59import com.pavelvlasov.logging.AntLogger;
60import com.pavelvlasov.logging.Logger;
61import com.pavelvlasov.sql.DataAccessObject;
62import com.pavelvlasov.util.ClassResourceLoader;
63import com.pavelvlasov.util.VisitorStack;
64import com.pavelvlasov.util.VisitorStackSource;
65
66/**
67 * Performs automatic code reviews. Quick mode - doesn't store anything to the database,
68 * package and repository level inspectors are not invoked.
69 * <section name="Example" suppress-description="yes">
70If you copy content of Hammurapi lib directory to ant lib directory then you can
71invoke Hammurapi in the following way:
72 <pre>
73&lt;taskdef name="quickurappi" classname="org.hammurapi.QuickHammurapiTask" /&gt;<br/>
74<br/>
75&lt;quickurappi&gt;<br/>
76 <tab/>&lt;src dir="src"/&gt;<br/>
77 <tab/>&lt;output dir="review"/&gt;<br/>
78&lt;/quickurappi&gt;</pre>
79or, if you didn't copy jar files to Ant lib directory, use this syntax:
80<pre>
81&lt;taskdef name="quickurappi" classname="org.hammurapi.QuickHammurapiTask"&gt;<br/>
82 <tab/>&lt;classpath&gt;<br/>
83 <tab/><tab/>&lt;fileset dir="${hammurapi.home}/lib" includes="*.jar"/&gt;<br/>
84 <tab/>&lt;/classpath&gt;<br/>
85&lt;/taskdef&gt;<br/>
86<br/>
87&lt;quickurappi&gt;<br/>
88 <tab/>&lt;src dir="src"/&gt;<br/>
89 <tab/>&lt;output dir="review"/&gt;<br/>
90&lt;/quickurappi&gt;
91</pre>
92
93</section>
94 * @ant.element name="hammurapi" display-name="Automatic code review task"
95 * @author Pavel Vlasov
96 * @version $Revision: 1.10 $
97 */

98public class QuickHammurapiTask extends TaskBase {
99 public void execute() throws BuildException {
100 if (!suppressLogo) {
101 log("Quick Hammurapi 3 Copyright (C) 2004 Hammurapi Group");
102 }
103
104 File archiveTmpDir=processArchive();
105
106 try {
107 long start=System.currentTimeMillis();
108
109 Logger logger=new AntLogger(this);
110
111 final VisitorStack[] visitorStack={null};
112 final VisitorStackSource visitorStackSource=new VisitorStackSource() {
113 public VisitorStack getVisitorStack() {
114 return visitorStack[0];
115 }
116 };
117
118 final SessionImpl session=new SessionImpl();
119
120 InspectorSet inspectorSet=new InspectorSet(
121 new InspectorContextFactory() {
122 public InspectorContext newContext(InspectorDescriptor descriptor, Logger logger) {
123 return new InspectorContextImpl(
124 descriptor,
125 logger,
126 visitorStackSource,
127 session,
128 violationFilters);
129 }
130 },
131 logger);
132
133 if (embeddedInspectors) {
134 log("Loading embedded inspectors", Project.MSG_VERBOSE);
135 loadEmbeddedInspectors(inspectorSet);
136 }
137
138 log("Loading inspectors", Project.MSG_VERBOSE);
139 Iterator it=inspectors.iterator();
140 while (it.hasNext()) {
141 Object o=it.next();
142 if (o instanceof InspectorSource) {
143 ((InspectorSource) o).loadInspectors(inspectorSet);
144 } else {
145 InspectorEntry inspectorEntry = (InspectorEntry) o;
146 inspectorSet.addDescriptor(inspectorEntry);
147 inspectorSet.addInspectorSourceInfo(
148 new InspectorSourceInfo(
149 "Inline inspector "+inspectorEntry.getName(),
150 "Build file: "+inspectorEntry.getLocation().toString(),
151 ""));
152 }
153 }
154
155 log("Inspectors loaded: "+inspectorSet.size(), Project.MSG_VERBOSE);
156
157 log("Loading waivers", Project.MSG_VERBOSE);
158 Date now=new Date();
159 WaiverSet waiverSet=new WaiverSet();
160 it=waivers.iterator();
161 while (it.hasNext()) {
162 ((WaiverSource) it.next()).loadWaivers(waiverSet,now);
163 }
164
165 log("Waivers loaded: "+waiverSet.size(), Project.MSG_VERBOSE);
166
167 log("Loading listeners", Project.MSG_VERBOSE);
168 List listeners=new LinkedList();
169 it=listenerEntries.iterator();
170 while (it.hasNext()) {
171 listeners.add(((ListenerEntry) it.next()).getObject(null));
172 }
173
174 //Outputs
175
listeners.addAll(outputs);
176 listeners.add(new ReviewToLogListener(project));
177
178 Collection inspectors=new LinkedList(inspectorSet.getInspectors());
179 session.setInspectors(inspectorSet);
180 Iterator inspectorsIt=inspectors.iterator();
181 log("Inspectors mapping", Project.MSG_VERBOSE);
182 while (inspectorsIt.hasNext()) {
183 Inspector inspector=(Inspector) inspectorsIt.next();
184 log("\t"+inspector.getContext().getDescriptor().getName()+" -> "+inspector.getClass().getName(), Project.MSG_VERBOSE);
185 }
186
187 ClassLoader classLoader;
188 if (classPath==null) {
189 classLoader=this.getClass().getClassLoader();
190 } else {
191 classLoader=new AntClassLoader(project, classPath, false);
192 session.setClassPath(classPath.list());
193 }
194
195 new QuickResultsFactory(waiverSet, classLoader, tabSize, logger).install();
196
197 Iterator lit=listeners.iterator();
198 while (lit.hasNext()) {
199 ((Listener) lit.next()).onBegin(inspectorSet);
200 }
201
202 try {
203 QuickResultsCollector collector = new QuickResultsCollector(this, title, listeners);
204
205 // Initializing violation filters
206
Iterator vfit=violationFilters.iterator();
207 while (vfit.hasNext()) {
208 Object vf=vfit.next();
209 if (vf instanceof DataAccessObject) {
210 ((DataAccessObject) vf).setSQLProcessor(collector.getProcessor());
211 }
212
213 if (vf instanceof Component) {
214 ((Component) vf).start();
215 }
216 }
217
218 try {
219 inspectors.add(collector);
220
221 QuickReviewEngine engine=new QuickReviewEngine(inspectors, this, collector);
222 visitorStack[0]=engine.getVisitorStack();
223 session.setVisitor(engine.getVisitor());
224
225 it=srcFileSets.iterator();
226 while (it.hasNext()) {
227 HammurapiFileSet fs=(HammurapiFileSet) it.next();
228 fs.setDefaultIncludes();
229 DirectoryScanner scanner=fs.getDirectoryScanner(project);
230 String[] includedFiles=scanner.getIncludedFiles();
231 for (int i=0; i<includedFiles.length; i++) {
232 review(new File(scanner.getBasedir(), includedFiles[i]), engine, classLoader, logger);
233 }
234 }
235
236 it=srcFiles.iterator();
237 while (it.hasNext()) {
238 review((File) it.next(), engine, classLoader, logger);
239 }
240
241 collector.getEngine().deleteOld();
242
243 Collection packageResults=new ArrayList();
244 Iterator pit=collector.getEngine().getPackageTotal().iterator();
245 while (pit.hasNext()) {
246 CompositeResults packageResult = new QuickPackageResults((PackageTotal) pit.next(), collector, inspectorSet);
247 packageResult.commit();
248 Iterator llit=listeners.iterator();
249 while (llit.hasNext()) {
250 ((Listener) llit.next()).onPackage(packageResult);
251 }
252
253 packageResults.add(packageResult);
254 }
255
256 log("Building summary");
257
258 CompositeResults summary = new QuickSummary(title, collector, inspectorSet, packageResults);
259 ResultsFactory.pushThreadResults(summary);
260
261 // Stopping violation filters
262
vfit=violationFilters.iterator();
263 while (vfit.hasNext()) {
264 Object vf=vfit.next();
265 if (vf instanceof Component) {
266 ((Component) vf).stop();
267 }
268 }
269
270 Iterator slit=listeners.iterator();
271 while (slit.hasNext()) {
272 ((Listener) slit.next()).onSummary(summary, inspectorSet);
273 }
274
275 Iterator rit=getReviewAcceptorEntries().iterator();
276 while (rit.hasNext()) {
277 ((ReviewAcceptor) ((ReviewAcceptorEntry) rit.next()).getObject(null)).accept(summary);
278 }
279
280 long finish=System.currentTimeMillis();
281
282 long elapsedSec = (finish-start)/1000;
283 long min=elapsedSec/60;
284 long sec=elapsedSec % 60;
285
286 log("Time: "+min+" min. "+sec+" sec.");
287 log(
288 MessageFormat.format(
289 "Performance {0, number,###.000000}",
290 new Object[] {
291 new Double(
292 (double) summary.getCodeBase() * 1000
293 / (finish - start))}));
294
295
296 Integer severityThreshold = getSeverityThreshold();
297 if (severityThreshold!=null) {
298 final int sth=getSeverityThreshold().intValue();
299 new ReviewAcceptor() {
300 public void accept(CompositeResults summary) throws HammurapiException {
301 Number severity=summary.getMaxSeverity();
302 if (severity!=null && severity.intValue()<=sth) {
303 throw new HammurapiException("Severity threshold ("+sth+") infringed");
304 }
305 }
306 }.accept(summary);
307 }
308
309 Double sigmaThreshold = getSigmaThreshold();
310 if (sigmaThreshold!=null) {
311 final double cth=sigmaThreshold.doubleValue();
312 new ReviewAcceptor() {
313 public void accept(CompositeResults summary) throws HammurapiException {
314 try {
315 if (Double.parseDouble(summary.getSigma())<cth) {
316 throw new HammurapiException("Sigma is below threshold ("+cth+")");
317 }
318 } catch (NumberFormatException e) {
319 throw new HammurapiException("Sigma is not valid");
320 }
321 }
322 }.accept(summary);
323 }
324
325 Integer dpmoThreshold = getDpmoThreshold();
326 if (dpmoThreshold!=null) {
327 final int cth=dpmoThreshold.intValue();
328 new ReviewAcceptor() {
329 public void accept(CompositeResults summary) throws HammurapiException {
330 try {
331 if (Integer.parseInt(summary.getDPMO())>cth) {
332 throw new HammurapiException("DPMO is above threshold ("+cth+")");
333 }
334 } catch (NumberFormatException e) {
335 throw new HammurapiException("DPMO is not valid");
336 }
337 }
338 }.accept(summary);
339 }
340
341 if (isFailOnWarnings() && !summary.getWarnings().isEmpty()) {
342 throw new HammurapiNonConsumableException("There have been warnings during execution.");
343 }
344
345 summary.commit();
346 } finally {
347 session.shutdown();
348 collector.shutdown();
349 }
350 } finally {
351 if (archiveTmpDir!=null) {
352 deleteFile(archiveTmpDir);
353 }
354 }
355
356 if (hadExceptions) {
357 throw new BuildException("There have been exceptions during execution. Check log output.");
358 }
359 } catch (ClassNotFoundException e) {
360 throw new BuildException(e);
361 } catch (SQLException e) {
362 throw new BuildException(e);
363 } catch (JselException e) {
364 throw new BuildException(e);
365 } catch (HammurapiException e) {
366 throw new BuildException(e);
367 } catch (ConfigurationException e) {
368 throw new BuildException(e);
369 } catch (FileNotFoundException e) {
370 throw new BuildException(e);
371 } catch (IOException e) {
372 throw new BuildException(e);
373 }
374 }
375
376 /**
377 * @param file
378 * @param engine
379 * @param classLoader
380 * @param logger
381 * @throws JselException
382 * @throws FileNotFoundException
383 * @throws SQLException
384 */

385 private void review(File file, QuickReviewEngine engine, ClassLoader classLoader, Logger logger) throws JselException, FileNotFoundException, SQLException, IOException {
386 if (file.isFile()) {
387 _review(file, engine, classLoader, logger);
388 } else if (file.isDirectory()) {
389 File[] files=file.listFiles();
390 for (int i=0; i<files.length; i++) {
391 review(files[i], engine, classLoader, logger);
392 }
393 }
394 }
395
396 /**
397 * @param file
398 * @param engine
399 * @param classLoader
400 * @param logger
401 * @throws JselException
402 * @throws FileNotFoundException
403 * @throws SQLException
404 */

405 private void _review(File file, QuickReviewEngine engine, ClassLoader classLoader, Logger logger) throws JselException, FileNotFoundException, SQLException, IOException {
406 InputStream is=new FileInputStream(file);
407 Reader reader= getEncoding()==null ? new InputStreamReader(is) : new InputStreamReader(is, getEncoding());
408 try {
409 engine.review(new CompilationUnitImpl(reader, getEncoding(), null, file.getAbsolutePath(), tabSize, classLoader, logger));
410 } finally {
411 reader.close();
412 is.close();
413 }
414 }
415
416 /**
417 * Use it for inspector debugging
418 * @param args
419 */

420 public static void main(String[] args) {
421 System.out.println("Hammurapi 3 Copyright (C) 2004 Hammurapi Group");
422
423 Options options=new Options();
424
425 populateOptions(options);
426
427 CommandLineParser parser=new PosixParser();
428 CommandLine line=null;
429 try {
430 line=parser.parse(options, args);
431 } catch (org.apache.commons.cli.ParseException e) {
432 System.err.println(e.getMessage());
433 System.err.flush();
434 printHelpAndExit(options);
435 }
436
437 if (line.hasOption("h")) {
438 printHelpAndExit(options);
439 }
440
441 QuickHammurapiTask task=new QuickHammurapiTask();
442 Project project = new Project();
443 task.setProject(project);
444 project.setCoreLoader(task.getClass().getClassLoader());
445
446 task.configure(options, line);
447
448 task.suppressLogo=true;
449
450 task.setTaskName("quickurapi");
451
452 try {
453 task.execute();
454 System.exit(0);
455 } catch (Exception e) {
456 e.printStackTrace();
457 System.exit(2);
458 }
459 }
460
461 protected static void loadEmbeddedInspectors(InspectorSet inspectorSet) throws BuildException, HammurapiException {
462 TaskBase.loadEmbeddedInspectors(inspectorSet);
463
464 ClassResourceLoader crl=new ClassResourceLoader(QuickHammurapiTask.class);
465 InputStream inspectorStream=crl.getResourceAsStream(null, null, "xml");
466 if (inspectorStream==null) {
467 throw new BuildException("Cannot load quick embedded inspectors");
468 }
469
470 DomInspectorSource source=new DomInspectorSource(inspectorStream, "Hammurapi.jar");
471 source.loadInspectors(inspectorSet);
472 }
473}
474
475

Hammurapi 3 Copyright © 2004 Hammurapi Group. All Rights Reserved.