Merge lp://staging/~walles/bzr-java-lib/commons-logging into lp://staging/~verterok/bzr-java-lib/bzr-java-lib
- commons-logging
- Merge into bzr-java-lib
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Guillermo Gonzalez | ||||
Approved revision: | 180 | ||||
Merged at revision: | not available | ||||
Proposed branch: | lp://staging/~walles/bzr-java-lib/commons-logging | ||||
Merge into: | lp://staging/~verterok/bzr-java-lib/bzr-java-lib | ||||
Diff against target: | None lines | ||||
To merge this branch: | bzr merge lp://staging/~walles/bzr-java-lib/commons-logging | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Guillermo Gonzalez | Approve | ||
Review via email:
|
Commit message
Description of the change
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Johan Walles (walles) wrote : | # |
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Guillermo Gonzalez (verterok) wrote : | # |
Great!
Thanks for making the proposal!
Also, thanks a lot for working on this, and for fixing all the javadocs!
I'll take a closer look later, but let me know if this are the same changes as the patch attached to the bug, as it's a direct approve then ;)
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Johan Walles (walles) wrote : | # |
It's the exact same patch. I just wanted it to be in some better
location than on my hard drive :-).
Cheers //Johan
2009/5/11 Guillermo Gonzalez <email address hidden>:
> Great!
> Thanks for making the proposal!
> Also, thanks a lot for working on this, and for fixing all the javadocs!
>
> I'll take a closer look later, but let me know if this are the same changes as the patch attached to the bug, as it's a direct approve then ;)
> --
> https:/
> You are the owner of lp:~walles/bzr-java-lib/commons-logging.
>
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Guillermo Gonzalez (verterok) : | # |
Preview Diff
1 | === modified file '.bzrignore' |
2 | --- .bzrignore 2008-10-24 04:45:06 +0000 |
3 | +++ .bzrignore 2009-04-05 07:52:42 +0000 |
4 | @@ -26,3 +26,5 @@ |
5 | file_to_ignore |
6 | file_to_ignore |
7 | target-eclipse |
8 | +.classpath |
9 | +.project |
10 | |
11 | === removed file '.classpath' |
12 | --- .classpath 2008-09-17 20:02:22 +0000 |
13 | +++ .classpath 1970-01-01 00:00:00 +0000 |
14 | @@ -1,13 +0,0 @@ |
15 | -<?xml version="1.0" encoding="UTF-8"?> |
16 | -<classpath> |
17 | - <classpathentry kind="src" path="src/main/java"/> |
18 | - <classpathentry kind="src" output="target/test-classes" path="src/test/java"/> |
19 | - <classpathentry excluding="**/*.java" kind="src" output="target/test-classes" path="src/test/resources"/> |
20 | - <classpathentry kind="src" path="src/main/resources"/> |
21 | - <classpathentry exported="true" kind="lib" path="lib/kxml2-min-2.3.0.jar"/> |
22 | - <classpathentry exported="true" kind="lib" path="lib/xmlrpc-1.1.jar"/> |
23 | - <classpathentry exported="true" kind="lib" path="lib/xmlrpc-client-1.1.jar"/> |
24 | - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> |
25 | - <classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/> |
26 | - <classpathentry kind="output" path="target/classes"/> |
27 | -</classpath> |
28 | |
29 | === removed file '.project' |
30 | --- .project 2008-11-20 04:41:37 +0000 |
31 | +++ .project 1970-01-01 00:00:00 +0000 |
32 | @@ -1,13 +0,0 @@ |
33 | -<projectDescription> |
34 | - <name>bzr-java-lib</name> |
35 | - <comment/> |
36 | - <projects/> |
37 | - <buildSpec> |
38 | - <buildCommand> |
39 | - <name>org.eclipse.jdt.core.javabuilder</name> |
40 | - </buildCommand> |
41 | - </buildSpec> |
42 | - <natures> |
43 | - <nature>org.eclipse.jdt.core.javanature</nature> |
44 | - </natures> |
45 | -</projectDescription> |
46 | |
47 | === modified file 'pom.xml' |
48 | --- pom.xml 2008-11-03 23:09:22 +0000 |
49 | +++ pom.xml 2009-04-17 05:59:56 +0000 |
50 | @@ -1,6 +1,6 @@ |
51 | -<project xmlns="http://maven.apache.org/POM/4.0.0" |
52 | - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
53 | - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> |
54 | +<project xmlns="http://maven.apache.org/POM/4.0.0" |
55 | + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
56 | + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> |
57 | <modelVersion>4.0.0</modelVersion> |
58 | <groupId>org.vcs.bazaar.client</groupId> |
59 | <artifactId>bzr-java-lib</artifactId> |
60 | @@ -44,6 +44,11 @@ |
61 | <version>4.4</version> |
62 | <scope>test</scope> |
63 | </dependency> |
64 | + <dependency> |
65 | + <groupId>commons-logging</groupId> |
66 | + <artifactId>commons-logging</artifactId> |
67 | + <version>1.1.1</version> |
68 | + </dependency> |
69 | </dependencies> |
70 | <build> |
71 | <pluginManagement> |
72 | @@ -99,20 +104,20 @@ |
73 | </executions> |
74 | </plugin> |
75 | <plugin> |
76 | - <groupId>org.apache.maven.plugins</groupId> |
77 | - <artifactId>maven-source-plugin</artifactId> |
78 | - <executions> |
79 | - <execution> |
80 | - <id>attach-sources</id> |
81 | - <phase>verify</phase> |
82 | - <goals> |
83 | - <goal>jar</goal> |
84 | - <goal>test-jar</goal> |
85 | - </goals> |
86 | - </execution> |
87 | - </executions> |
88 | - </plugin> |
89 | - <plugin> |
90 | + <groupId>org.apache.maven.plugins</groupId> |
91 | + <artifactId>maven-source-plugin</artifactId> |
92 | + <executions> |
93 | + <execution> |
94 | + <id>attach-sources</id> |
95 | + <phase>verify</phase> |
96 | + <goals> |
97 | + <goal>jar</goal> |
98 | + <goal>test-jar</goal> |
99 | + </goals> |
100 | + </execution> |
101 | + </executions> |
102 | + </plugin> |
103 | + <plugin> |
104 | <groupId>org.apache.maven.plugins</groupId> |
105 | <artifactId>maven-jar-plugin</artifactId> |
106 | <version>2.2</version> |
107 | @@ -124,50 +129,62 @@ |
108 | </execution> |
109 | </executions> |
110 | </plugin> |
111 | - <plugin> |
112 | - <groupId>org.apache.maven.plugins</groupId> |
113 | - <artifactId>maven-resources-plugin</artifactId> |
114 | - <configuration> |
115 | - <encoding>UTF-8</encoding> |
116 | - </configuration> |
117 | - </plugin> |
118 | + <plugin> |
119 | + <groupId>org.apache.maven.plugins</groupId> |
120 | + <artifactId>maven-resources-plugin</artifactId> |
121 | + <configuration> |
122 | + <encoding>UTF-8</encoding> |
123 | + </configuration> |
124 | + </plugin> |
125 | + <plugin> |
126 | + <!-- |
127 | + Attempt to fetch sources and javadoc by default when |
128 | + generating Eclipse project files. |
129 | + --> |
130 | + <groupId>org.apache.maven.plugins</groupId> |
131 | + <artifactId>maven-eclipse-plugin</artifactId> |
132 | + <configuration> |
133 | + <downloadSources>true</downloadSources> |
134 | + <downloadJavadocs>true</downloadJavadocs> |
135 | + </configuration> |
136 | + </plugin> |
137 | </plugins> |
138 | </build> |
139 | - <reporting> |
140 | - <plugins> |
141 | - <plugin> |
142 | - <groupId>org.apache.maven.plugins</groupId> |
143 | - <artifactId>maven-pmd-plugin</artifactId> |
144 | - <configuration> |
145 | - <linkXref>true</linkXref> |
146 | - <sourceEncoding>utf-8</sourceEncoding> |
147 | - <minimumTokens>100</minimumTokens> |
148 | - <targetJdk>1.5</targetJdk> |
149 | - <excludes> |
150 | - <exclude>**/client/commandline/syntax/*.java</exclude> |
151 | - </excludes> |
152 | - <rulesets> |
153 | - <ruleset>/rulesets/basic.xml</ruleset> |
154 | - <ruleset>/rulesets/imports.xml</ruleset> |
155 | - <ruleset>/rulesets/unusedcode.xml</ruleset> |
156 | - <ruleset>/rulesets/strings.xml</ruleset> |
157 | - <ruleset>/rulesets/naming.xml</ruleset> |
158 | - <ruleset>/rulesets/optimizations.xml</ruleset> |
159 | - <ruleset>/rulesets/design.xml</ruleset> |
160 | - <ruleset>/rulesets/coupling.xml</ruleset> |
161 | - </rulesets> |
162 | - </configuration> |
163 | - </plugin> |
164 | - <plugin> |
165 | - <groupId>org.codehaus.mojo</groupId> |
166 | - <artifactId>findbugs-maven-plugin</artifactId> |
167 | - <configuration> |
168 | - <xmlOutput>true</xmlOutput> |
169 | - <xmlOutputDirectory>target</xmlOutputDirectory> |
170 | - <threshold>Normal</threshold> |
171 | - <effort>Max</effort> |
172 | - </configuration> |
173 | - </plugin> |
174 | - </plugins> |
175 | - </reporting> |
176 | + <reporting> |
177 | + <plugins> |
178 | + <plugin> |
179 | + <groupId>org.apache.maven.plugins</groupId> |
180 | + <artifactId>maven-pmd-plugin</artifactId> |
181 | + <configuration> |
182 | + <linkXref>true</linkXref> |
183 | + <sourceEncoding>utf-8</sourceEncoding> |
184 | + <minimumTokens>100</minimumTokens> |
185 | + <targetJdk>1.5</targetJdk> |
186 | + <excludes> |
187 | + <exclude>**/client/commandline/syntax/*.java</exclude> |
188 | + </excludes> |
189 | + <rulesets> |
190 | + <ruleset>/rulesets/basic.xml</ruleset> |
191 | + <ruleset>/rulesets/imports.xml</ruleset> |
192 | + <ruleset>/rulesets/unusedcode.xml</ruleset> |
193 | + <ruleset>/rulesets/strings.xml</ruleset> |
194 | + <ruleset>/rulesets/naming.xml</ruleset> |
195 | + <ruleset>/rulesets/optimizations.xml</ruleset> |
196 | + <ruleset>/rulesets/design.xml</ruleset> |
197 | + <ruleset>/rulesets/coupling.xml</ruleset> |
198 | + </rulesets> |
199 | + </configuration> |
200 | + </plugin> |
201 | + <plugin> |
202 | + <groupId>org.codehaus.mojo</groupId> |
203 | + <artifactId>findbugs-maven-plugin</artifactId> |
204 | + <configuration> |
205 | + <xmlOutput>true</xmlOutput> |
206 | + <xmlOutputDirectory>target</xmlOutputDirectory> |
207 | + <threshold>Normal</threshold> |
208 | + <effort>Max</effort> |
209 | + </configuration> |
210 | + </plugin> |
211 | + </plugins> |
212 | + </reporting> |
213 | </project> |
214 | |
215 | === modified file 'src/main/java/org/vcs/bazaar/client/BazaarClientPreferences.java' |
216 | --- src/main/java/org/vcs/bazaar/client/BazaarClientPreferences.java 2008-10-22 07:05:29 +0000 |
217 | +++ src/main/java/org/vcs/bazaar/client/BazaarClientPreferences.java 2009-04-17 05:59:56 +0000 |
218 | @@ -12,8 +12,9 @@ |
219 | import java.util.List; |
220 | import java.util.Map; |
221 | import java.util.Properties; |
222 | -import java.util.logging.Logger; |
223 | |
224 | +import org.apache.commons.logging.Log; |
225 | +import org.apache.commons.logging.LogFactory; |
226 | import org.vcs.bazaar.client.commandline.CommandLineClientFactory; |
227 | import org.vcs.bazaar.client.core.BazaarClientException; |
228 | import org.vcs.bazaar.client.utils.BazaarUtilities; |
229 | @@ -28,7 +29,7 @@ |
230 | */ |
231 | public final class BazaarClientPreferences { |
232 | |
233 | - private static final Logger logger = Logger.getLogger(BazaarClientPreferences.class.getName()); |
234 | + private static final Log LOG = LogFactory.getLog(BazaarClientPreferences.class); |
235 | |
236 | private static final BazaarClientPreferences instance = new BazaarClientPreferences(); |
237 | |
238 | @@ -82,7 +83,7 @@ |
239 | * @return |
240 | */ |
241 | public String getString(BazaarPreference value) { |
242 | - return (String) preferenceMap.get(value); |
243 | + return preferenceMap.get(value); |
244 | } |
245 | |
246 | /** |
247 | @@ -115,13 +116,13 @@ |
248 | try { |
249 | isCLI = forceCLI || BazaarClientFactory.getPreferredClientType().equals(CommandLineClientFactory.CLIENT_TYPE); |
250 | } catch (BazaarClientException e) { |
251 | - logger.info(e.getMessage()); |
252 | + LOG.info(e.getMessage()); |
253 | } |
254 | if(exe.toLowerCase().endsWith(".bat") && isCLI) { |
255 | try { |
256 | return BazaarUtilities.getWindowsExecutable(exe); |
257 | - } catch(IOException ioex) { |
258 | - logger.severe(ioex.getMessage()); |
259 | + } catch(IOException e) { |
260 | + LOG.error("IO trouble while parsing bzr.bat", e); |
261 | } |
262 | } |
263 | |
264 | @@ -139,8 +140,9 @@ |
265 | public final Map<String, String> getPreferences() { |
266 | final HashMap<String, String> newMap = new HashMap<String, String>(preferenceMap.size() - 1); |
267 | for (BazaarPreference key : preferenceMap.keySet()) { |
268 | - if(!EXECUTABLE.equals(key) && !BZR_PROGRESS_BAR.equals(key) && preferenceMap.get(key) != null) |
269 | - newMap.put(key.name(), preferenceMap.get(key)); |
270 | + if(!EXECUTABLE.equals(key) && !BZR_PROGRESS_BAR.equals(key) && preferenceMap.get(key) != null) { |
271 | + newMap.put(key.name(), preferenceMap.get(key)); |
272 | + } |
273 | } |
274 | return newMap; |
275 | } |
276 | |
277 | === modified file 'src/main/java/org/vcs/bazaar/client/IBazaarClient.java' |
278 | --- src/main/java/org/vcs/bazaar/client/IBazaarClient.java 2008-11-03 23:09:22 +0000 |
279 | +++ src/main/java/org/vcs/bazaar/client/IBazaarClient.java 2009-04-18 18:46:23 +0000 |
280 | @@ -17,8 +17,8 @@ |
281 | import org.vcs.bazaar.client.core.BranchLocation; |
282 | |
283 | /** |
284 | + * Bzr operations can be performed by calling methods in this interface. |
285 | * @author Guillermo Gonzalez |
286 | - * |
287 | */ |
288 | public interface IBazaarClient { |
289 | |
290 | @@ -32,7 +32,7 @@ |
291 | public void add(File[] files, Option... options) throws BazaarClientException; |
292 | |
293 | /** |
294 | - * Get a IBazaarAnnoation which conatins the origin of each line in a file |
295 | + * Get a IBazaarAnnoation which contains the origin of each line in a file |
296 | * |
297 | * @param file |
298 | * @param options |
299 | @@ -65,9 +65,11 @@ |
300 | * Get a Reader of the file content from the specified revision.<br> |
301 | * If revision is null the last revision is used |
302 | * |
303 | - * @param file |
304 | - * @param revision |
305 | - * @return a Reader |
306 | + * @param file A file to read. |
307 | + * @param revision The revision of the file to read, or null to read from |
308 | + * the file's latest revision. |
309 | + * @return a Reader from which the contents of the requested file at the |
310 | + * given revision can be read. |
311 | * @throws BazaarClientException |
312 | */ |
313 | public InputStream cat(File file, IBazaarRevisionSpec revision, Option... options) throws BazaarClientException; |
314 | @@ -107,8 +109,6 @@ |
315 | * Show differences in the working tree or between revisions. |
316 | * |
317 | * @param file |
318 | - * @param startRev - if is null, the last commited revision is used |
319 | - * @param endRev - if is null, the parameter to 'bzr diff' is omitted |
320 | * @throws BazaarClientException |
321 | */ |
322 | public String diff(File file, IBazaarRevisionSpec range, Option... options) throws BazaarClientException; |
323 | |
324 | === modified file 'src/main/java/org/vcs/bazaar/client/commandline/parser/XMLAnnotateParser.java' |
325 | --- src/main/java/org/vcs/bazaar/client/commandline/parser/XMLAnnotateParser.java 2008-10-22 07:05:29 +0000 |
326 | +++ src/main/java/org/vcs/bazaar/client/commandline/parser/XMLAnnotateParser.java 2009-04-17 05:59:56 +0000 |
327 | @@ -8,9 +8,9 @@ |
328 | import java.io.StringReader; |
329 | import java.util.ArrayList; |
330 | import java.util.List; |
331 | -import java.util.logging.Level; |
332 | -import java.util.logging.Logger; |
333 | |
334 | +import org.apache.commons.logging.Log; |
335 | +import org.apache.commons.logging.LogFactory; |
336 | import org.kxml2.io.KXmlParser; |
337 | import org.xmlpull.v1.XmlPullParser; |
338 | import org.xmlpull.v1.XmlPullParserException; |
339 | @@ -24,7 +24,7 @@ |
340 | */ |
341 | public class XMLAnnotateParser extends XMLParser { |
342 | |
343 | - private final static Logger LOGGER = Logger.getLogger(XMLAnnotateParser.class.getName()); |
344 | + private final static Log LOG = LogFactory.getLog(XMLAnnotateParser.class); |
345 | |
346 | // List<IBazaarAnnotation> lines; |
347 | private final List<String> revisionByLine = new ArrayList<String>(); |
348 | @@ -58,10 +58,10 @@ |
349 | eventType = parser.next(); |
350 | } |
351 | } catch (XmlPullParserException e) { |
352 | - LOGGER.log(Level.SEVERE, e.getMessage(), e); |
353 | + LOG.error("XML parsing failed", e); |
354 | throw e; |
355 | } catch (IOException e) { |
356 | - LOGGER.log(Level.SEVERE, e.getMessage(), e); |
357 | + LOG.error("IO trouble while parsing XML", e); |
358 | throw e; |
359 | } |
360 | } |
361 | |
362 | === modified file 'src/main/java/org/vcs/bazaar/client/commandline/parser/XMLLsParser.java' |
363 | --- src/main/java/org/vcs/bazaar/client/commandline/parser/XMLLsParser.java 2008-10-22 07:05:29 +0000 |
364 | +++ src/main/java/org/vcs/bazaar/client/commandline/parser/XMLLsParser.java 2009-04-17 05:59:56 +0000 |
365 | @@ -4,9 +4,9 @@ |
366 | import java.io.StringReader; |
367 | import java.util.ArrayList; |
368 | import java.util.List; |
369 | -import java.util.logging.Level; |
370 | -import java.util.logging.Logger; |
371 | |
372 | +import org.apache.commons.logging.Log; |
373 | +import org.apache.commons.logging.LogFactory; |
374 | import org.kxml2.io.KXmlParser; |
375 | import org.vcs.bazaar.client.BazaarItemInfo; |
376 | import org.vcs.bazaar.client.BazaarItemKind; |
377 | @@ -17,7 +17,7 @@ |
378 | |
379 | public class XMLLsParser extends XMLParser { |
380 | |
381 | - private final static Logger LOGGER = Logger.getLogger(XMLLsParser.class.getName()); |
382 | + private final static Log LOG = LogFactory.getLog(XMLLsParser.class); |
383 | |
384 | private final static String LIST = "list"; |
385 | private final static String KIND = "kind"; |
386 | @@ -27,13 +27,19 @@ |
387 | private final static String STATUS_KIND = "status_kind"; |
388 | |
389 | |
390 | + /** |
391 | + * Parse an XML string into a list of {@link IBazaarItemInfo}s. Parse errors |
392 | + * will be logged, and an empty list will be returned. |
393 | + * @param xml The XML string to parse. |
394 | + * @return The parse result, or an empty list on parse errors. |
395 | + */ |
396 | public static List<IBazaarItemInfo> parse(String xml) { |
397 | KXmlParser parser = new KXmlParser(); |
398 | try { |
399 | parser.setInput(new StringReader(xml)); |
400 | return new XMLLsParser().parse(parser); |
401 | } catch (XmlPullParserException e) { |
402 | - LOGGER.log(Level.SEVERE, e.getMessage(), e); |
403 | + LOG.error("XML parsing failed", e); |
404 | } |
405 | return new ArrayList<IBazaarItemInfo>(0); |
406 | } |
407 | @@ -58,9 +64,9 @@ |
408 | eventType = parser.next(); |
409 | } |
410 | } catch (XmlPullParserException e) { |
411 | - LOGGER.log(Level.SEVERE, e.getMessage(), e); |
412 | + LOG.error("XML parsing failed", e); |
413 | } catch (IOException e) { |
414 | - LOGGER.log(Level.SEVERE, e.getMessage(), e); |
415 | + LOG.error("IO trouble while parsing XML", e); |
416 | } |
417 | return result; |
418 | } |
419 | |
420 | === modified file 'src/main/java/org/vcs/bazaar/client/commandline/parser/XMLStatusParser.java' |
421 | --- src/main/java/org/vcs/bazaar/client/commandline/parser/XMLStatusParser.java 2008-10-27 03:19:09 +0000 |
422 | +++ src/main/java/org/vcs/bazaar/client/commandline/parser/XMLStatusParser.java 2009-04-17 05:59:56 +0000 |
423 | @@ -14,8 +14,9 @@ |
424 | import java.util.List; |
425 | import java.util.Map; |
426 | import java.util.Set; |
427 | -import java.util.logging.Logger; |
428 | |
429 | +import org.apache.commons.logging.Log; |
430 | +import org.apache.commons.logging.LogFactory; |
431 | import org.kxml2.io.KXmlParser; |
432 | import org.vcs.bazaar.client.BazaarStatusKind; |
433 | import org.vcs.bazaar.client.IBazaarLogMessage; |
434 | @@ -35,7 +36,7 @@ |
435 | */ |
436 | public class XMLStatusParser extends XMLParser { |
437 | |
438 | - private final static Logger logger = Logger.getLogger(XMLStatusParser.class.getName()); |
439 | + private final static Log LOG = LogFactory.getLog(XMLStatusParser.class); |
440 | |
441 | private final List<IBazaarStatus> statuses = new ArrayList<IBazaarStatus>(0); |
442 | private List<IBazaarLogMessage> pendingMerges = null; |
443 | @@ -96,11 +97,11 @@ |
444 | } |
445 | |
446 | private void parsePendingMerges() throws BazaarClientException { |
447 | - logger.fine("Parsing pending merges"); |
448 | + LOG.debug("Parsing pending merges"); |
449 | try { |
450 | pendingMerges = new XMLLogParser().parse(parser); |
451 | } catch (Exception e) { |
452 | - logger.severe("unexpected error while parsing pending merges: " + e.getMessage()); |
453 | + LOG.error("unexpected error while parsing pending merges", e); |
454 | pendingMerges = null; |
455 | } |
456 | if(pendingMerges == null) { |
457 | @@ -108,10 +109,6 @@ |
458 | } |
459 | } |
460 | |
461 | - /** |
462 | - * @param name |
463 | - * @return |
464 | - */ |
465 | private boolean isGroup(String name) { |
466 | return (name.equals(ADDED) || name.equals(REMOVED) || name.equals(RENAMED) |
467 | || name.equals(MODIFIED) || name.equals(KIND_CHANGED) |
468 | @@ -120,7 +117,7 @@ |
469 | |
470 | private void parseGroup() throws XmlPullParserException, IOException { |
471 | String group = parser.getName(); |
472 | - logger.fine("Parsing status group: " + group); |
473 | + LOG.debug("Parsing status group: " + group); |
474 | int eventType = parser.next(); |
475 | while (eventType != XmlPullParser.END_DOCUMENT) { |
476 | if(eventType == XmlPullParser.START_TAG && CONFLICT.equals(parser.getName())) { |
477 | |
478 | === modified file 'src/main/java/org/vcs/bazaar/client/utils/BazaarUtilities.java' |
479 | --- src/main/java/org/vcs/bazaar/client/utils/BazaarUtilities.java 2008-11-07 23:32:20 +0000 |
480 | +++ src/main/java/org/vcs/bazaar/client/utils/BazaarUtilities.java 2009-04-17 05:59:56 +0000 |
481 | @@ -13,9 +13,9 @@ |
482 | import java.util.List; |
483 | import java.util.Properties; |
484 | import java.util.StringTokenizer; |
485 | -import java.util.logging.Level; |
486 | -import java.util.logging.Logger; |
487 | |
488 | +import org.apache.commons.logging.Log; |
489 | +import org.apache.commons.logging.LogFactory; |
490 | import org.vcs.bazaar.client.BazaarClientFactory; |
491 | import org.vcs.bazaar.client.BazaarClientPreferences; |
492 | import org.vcs.bazaar.client.BazaarPreference; |
493 | @@ -27,7 +27,7 @@ |
494 | */ |
495 | public final class BazaarUtilities { |
496 | |
497 | - private static final Logger LOGGER = Logger.getLogger(BazaarUtilities.class.getName()); |
498 | + private static final Log LOG = LogFactory.getLog(BazaarUtilities.class); |
499 | |
500 | /** |
501 | * The Unix separator character. |
502 | @@ -119,11 +119,11 @@ |
503 | String drive = exe.substring(0, 2)+"\\\\"; |
504 | String[] allparts = exe.split("(?=" + drive + ")"); |
505 | List<String> output = new ArrayList<String>(); |
506 | - for(int ii = 0 ; ii < allparts.length ; ii++) { |
507 | - if(allparts[ii].trim().length() == 0) { |
508 | + for (String allpart : allparts) { |
509 | + if(allpart.trim().length() == 0) { |
510 | continue; |
511 | } else { |
512 | - output.add(allparts[ii].trim()); |
513 | + output.add(allpart.trim()); |
514 | } |
515 | } |
516 | return output; |
517 | @@ -204,7 +204,7 @@ |
518 | * @param propertiesFile path/URI of a properties file to load the preferences from. |
519 | */ |
520 | public static void configureBazaarClient(Class clazz, String propertiesFile) { |
521 | - LOGGER.fine("Getting environment settings"); |
522 | + LOG.debug("Getting environment settings"); |
523 | final BazaarClientPreferences prefs = BazaarClientPreferences.getInstance(); |
524 | try { |
525 | InputStream is = clazz.getResourceAsStream(propertiesFile); |
526 | @@ -214,17 +214,17 @@ |
527 | prefs.setFrom(fileProps); |
528 | } |
529 | } catch (Exception e) { |
530 | - LOGGER.log(Level.SEVERE, e.getMessage(), e); |
531 | - BazaarClientException.makeUnChecked(e); |
532 | + LOG.error("Error loading properties", e); |
533 | + throw BazaarClientException.makeUnChecked(e); |
534 | } |
535 | if(prefs.getString(BazaarPreference.EXECUTABLE) == null) { |
536 | prefs.set(BazaarPreference.EXECUTABLE, "bzr"); |
537 | } |
538 | - LOGGER.info("Initializing client factories"); |
539 | + LOG.debug("Initializing client factories"); |
540 | try { |
541 | BazaarClientFactory.setupBestAvailableBackend(true); |
542 | } catch (BazaarClientException e) { |
543 | - LOGGER.warning(e.getMessage()); |
544 | + LOG.error("Error initializing client factories", e); |
545 | throw BazaarClientException.makeUnChecked(e); |
546 | } |
547 | } |
548 | |
549 | === modified file 'src/main/java/org/vcs/bazaar/client/xmlrpc/parser/XMLErrorParser.java' |
550 | --- src/main/java/org/vcs/bazaar/client/xmlrpc/parser/XMLErrorParser.java 2008-10-24 04:45:06 +0000 |
551 | +++ src/main/java/org/vcs/bazaar/client/xmlrpc/parser/XMLErrorParser.java 2009-04-17 05:59:56 +0000 |
552 | @@ -8,9 +8,9 @@ |
553 | import java.util.Collections; |
554 | import java.util.HashMap; |
555 | import java.util.Map; |
556 | -import java.util.logging.Level; |
557 | -import java.util.logging.Logger; |
558 | |
559 | +import org.apache.commons.logging.Log; |
560 | +import org.apache.commons.logging.LogFactory; |
561 | import org.kxml2.io.KXmlParser; |
562 | import org.vcs.bazaar.client.IBzrError; |
563 | import org.vcs.bazaar.client.commandline.parser.XMLParser; |
564 | @@ -24,7 +24,7 @@ |
565 | */ |
566 | public class XMLErrorParser extends XMLParser { |
567 | |
568 | - private static final Logger LOGGER = Logger.getLogger(XMLErrorParser.class.getName()); |
569 | + private static final Log LOG = LogFactory.getLog(XMLErrorParser.class); |
570 | |
571 | private static final String ERROR = "error"; |
572 | private static final String CLASS = "class"; |
573 | @@ -49,9 +49,9 @@ |
574 | eventType = parser.next(); |
575 | } |
576 | } catch (XmlPullParserException e) { |
577 | - LOGGER.log(Level.WARNING, e.getMessage() + " while parsing error"); |
578 | + LOG.error("Trouble while parsing error", e); |
579 | } catch (IOException e) { |
580 | - LOGGER.log(Level.WARNING, e.getMessage() + " while parsing error"); |
581 | + LOG.error("IO trouble while parsing error", e); |
582 | } |
583 | return new BzrXmlRpcError(Collections.EMPTY_MAP, xml, "unknown"); |
584 | } |
585 | |
586 | === modified file 'src/test/java/org/vcs/bazaar/client/examples/SimpleUsageExample.java' |
587 | --- src/test/java/org/vcs/bazaar/client/examples/SimpleUsageExample.java 2008-10-22 07:05:29 +0000 |
588 | +++ src/test/java/org/vcs/bazaar/client/examples/SimpleUsageExample.java 2009-04-17 05:59:56 +0000 |
589 | @@ -5,9 +5,9 @@ |
590 | |
591 | import java.io.File; |
592 | import java.net.URI; |
593 | -import java.util.logging.Level; |
594 | -import java.util.logging.Logger; |
595 | |
596 | +import org.apache.commons.logging.Log; |
597 | +import org.apache.commons.logging.LogFactory; |
598 | import org.vcs.bazaar.client.BazaarClientFactory; |
599 | import org.vcs.bazaar.client.BazaarClientPreferences; |
600 | import org.vcs.bazaar.client.BazaarPreference; |
601 | @@ -23,12 +23,13 @@ |
602 | */ |
603 | public class SimpleUsageExample { |
604 | |
605 | - private final static Logger LOGGER = Logger.getLogger(SimpleUsageExample.class.getName()); |
606 | + /** |
607 | + * Write log messages here. |
608 | + */ |
609 | + private final static Log LOG = LogFactory.getLog(SimpleUsageExample.class); |
610 | |
611 | /** |
612 | - * @param args |
613 | - * void |
614 | - * @throws BazaarClientException |
615 | + * @param args Intentionally ignored |
616 | */ |
617 | public static void main(String[] args) { |
618 | BazaarClientPreferences.getInstance().set(BazaarPreference.EXECUTABLE, "/usr/bin/bzr"); |
619 | @@ -39,7 +40,7 @@ |
620 | client.addNotifyListener(new StandardOutputListener()); |
621 | client.branch(new BranchLocation(URI.create("http://freeshells.ch/~guillo/code/bzr-xmloutput/0.17")), new File("/tmp/client_test_remote"), null); |
622 | } catch (BazaarClientException e) { |
623 | - LOGGER.log(Level.SEVERE, e.getMessage(), e); |
624 | + LOG.fatal(e.getMessage(), e); |
625 | } |
626 | } |
627 | |
628 | |
629 | === modified file 'src/test/java/org/vcs/bazaar/client/testUtils/Environment.java' |
630 | --- src/test/java/org/vcs/bazaar/client/testUtils/Environment.java 2008-09-17 20:13:54 +0000 |
631 | +++ src/test/java/org/vcs/bazaar/client/testUtils/Environment.java 2009-04-17 05:59:56 +0000 |
632 | @@ -4,8 +4,9 @@ |
633 | package org.vcs.bazaar.client.testUtils; |
634 | |
635 | import java.io.File; |
636 | -import java.util.logging.Logger; |
637 | |
638 | +import org.apache.commons.logging.Log; |
639 | +import org.apache.commons.logging.LogFactory; |
640 | import org.vcs.bazaar.client.BazaarTreeStatus; |
641 | import org.vcs.bazaar.client.core.BranchLocation; |
642 | |
643 | @@ -14,7 +15,7 @@ |
644 | * |
645 | */ |
646 | public class Environment { |
647 | - private static final Logger log = Logger.getLogger(Environment.class.getName()); |
648 | + private static final Log LOG = LogFactory.getLog(Environment.class); |
649 | protected String testName; |
650 | |
651 | protected TestsConfig testsConfig = TestsConfig.getTestsConfig(); |
652 | @@ -50,7 +51,6 @@ |
653 | } |
654 | |
655 | /** |
656 | - * <p> |
657 | * Create a branch (with workingTree) with the name of the test who is going |
658 | * to use it. |
659 | * </p> |
660 | @@ -62,10 +62,11 @@ |
661 | */ |
662 | protected File createStartWorkingCopy(File branch, String testName) throws Exception { |
663 | workingTreeLocation = new File(testsConfig.workingCopies, testName); |
664 | - log.fine("Creating working copy at " + workingTreeLocation.toString()); |
665 | + LOG.debug("Creating working copy at " + workingTreeLocation.toString()); |
666 | workingTreeLocation.getParentFile().mkdirs(); |
667 | - if (workingTreeLocation.exists()) |
668 | - FileUtils.removeDirectoryWithContent(workingTreeLocation); |
669 | + if (workingTreeLocation.exists()) { |
670 | + FileUtils.removeDirectoryWithContent(workingTreeLocation); |
671 | + } |
672 | config.getClient().setWorkDir(branch.getParentFile()); |
673 | config.getClient().branch(new BranchLocation(branch), workingTreeLocation, null); |
674 | // check if the working tree have the expected status |
675 | @@ -73,10 +74,6 @@ |
676 | return workingTreeLocation; |
677 | } |
678 | |
679 | - /** |
680 | - * |
681 | - * @throws Exception |
682 | - */ |
683 | public void checkStatusesExpectedWorkingTree(File wtLocation) throws Exception { |
684 | BazaarTreeStatus treeStatus = config.getClient().status(new File[] { wtLocation }); |
685 | expectedWorkingTree.check(treeStatus.getStatusAsArray(), workingTreeLocation.getAbsolutePath()); |
686 | |
687 | === modified file 'src/test/java/org/vcs/bazaar/client/testUtils/TestsConfig.java' |
688 | --- src/test/java/org/vcs/bazaar/client/testUtils/TestsConfig.java 2009-01-02 13:47:43 +0000 |
689 | +++ src/test/java/org/vcs/bazaar/client/testUtils/TestsConfig.java 2009-04-17 05:59:56 +0000 |
690 | @@ -3,9 +3,9 @@ |
691 | import java.io.File; |
692 | import java.io.InputStream; |
693 | import java.util.Properties; |
694 | -import java.util.logging.Level; |
695 | -import java.util.logging.Logger; |
696 | |
697 | +import org.apache.commons.logging.Log; |
698 | +import org.apache.commons.logging.LogFactory; |
699 | import org.junit.Ignore; |
700 | import org.vcs.bazaar.client.BazaarClientFactory; |
701 | import org.vcs.bazaar.client.BazaarClientPreferences; |
702 | @@ -18,7 +18,7 @@ |
703 | */ |
704 | @Ignore |
705 | public final class TestsConfig { |
706 | - private static final Logger log = Logger.getLogger(TestsConfig.class.getName()); |
707 | + private static final Log LOG = LogFactory.getLog(TestsConfig.class); |
708 | |
709 | private static TestsConfig testsConfig; |
710 | public String clientType; |
711 | @@ -35,7 +35,7 @@ |
712 | private static String usermail = "bzr-eclipse-user@bzr.org"; |
713 | |
714 | static { |
715 | - log.fine("Getting environment settings"); |
716 | + LOG.debug("Getting environment settings"); |
717 | final BazaarClientPreferences prefs = BazaarClientPreferences.getInstance(); |
718 | try { |
719 | InputStream is = TestsConfig.class.getResourceAsStream("/tests.properties"); |
720 | @@ -46,7 +46,7 @@ |
721 | } |
722 | |
723 | } catch (Exception e) { |
724 | - log.log(Level.SEVERE, e.getMessage(), e); |
725 | + LOG.error("Trouble getting environment settings", e); |
726 | } |
727 | |
728 | if(prefs.getString(BazaarPreference.TEST_USER_NAME) != null) { |
729 | @@ -63,11 +63,11 @@ |
730 | } |
731 | |
732 | private TestsConfig() throws Exception { |
733 | - log.info("Initializing client factories"); |
734 | + LOG.debug("Initializing client factories"); |
735 | try { |
736 | BazaarClientFactory.setupBestAvailableBackend(true); |
737 | } catch (BazaarClientException e) { |
738 | - log.warning(e.getMessage()); |
739 | + LOG.error("Error initializing bzr backend", e); |
740 | throw e; |
741 | } |
742 | clientType = BazaarClientPreferences.getInstance().getString(BazaarPreference.TEST_CLIENT_TYPE); |
743 | @@ -80,7 +80,7 @@ |
744 | |
745 | workingCopies = new File(rootDir, "working_copies"); |
746 | if (workingCopies.exists()) { |
747 | - log.info("working_copies dir already exists, deleting it..."); |
748 | + LOG.debug("working_copies dir already exists, deleting it..."); |
749 | FileUtils.removeDirectoryWithContent(workingCopies); |
750 | } |
751 | workingCopies.mkdirs(); |
752 | @@ -99,7 +99,7 @@ |
753 | defaultWorkingTreeLocation.mkdir(); |
754 | defaultWorkingTree.materialize(defaultWorkingTreeLocation); |
755 | |
756 | - log.fine("Creating branch:" + defaultWorkingTreeLocation.toString()); |
757 | + LOG.debug("Creating branch:" + defaultWorkingTreeLocation.toString()); |
758 | File[] filesToAdd = defaultWorkingTreeLocation.listFiles(); |
759 | client.setWorkDir(defaultWorkingTreeLocation); |
760 | client.init(defaultWorkingTreeLocation); |
761 | @@ -116,7 +116,7 @@ |
762 | } |
763 | |
764 | private void configureClient() { |
765 | - log.info("Using client: " + clientType); |
766 | + LOG.info("Using client: " + clientType); |
767 | client = BazaarClientFactory.createClient(clientType); |
768 | } |
769 |
This branch replaces java.util.logging with Apache commons logging.
A library that uses the commons-logging API can be used with any logging implementation at runtime. Currently, bzr-java-lib can only be used with applications using java.util.logging, or log messages will look like crap.
More info at http:// commons. apache. org/logging/.