From c8a72df5913d2f6816b66837bee8030633fa9189 Mon Sep 17 00:00:00 2001 From: Stefan Bodewig Date: Tue, 20 Dec 2016 20:43:46 +0100 Subject: [PATCH] whitespace --- .../optional/depend/DirectoryIterator.java | 14 ++-- .../ant/taskdefs/optional/jlink/jlink.java | 80 +++++++++---------- .../optional/sound/AntSoundPlayer.java | 34 ++++---- .../ant/types/resources/ResourceList.java | 10 +-- 4 files changed, 69 insertions(+), 69 deletions(-) diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/depend/DirectoryIterator.java b/src/main/org/apache/tools/ant/taskdefs/optional/depend/DirectoryIterator.java index e12f684c5..af28c9642 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/depend/DirectoryIterator.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/depend/DirectoryIterator.java @@ -134,16 +134,16 @@ public class DirectoryIterator implements ClassFileIterator { = new FileInputStream(element); try { - if (element.getName().endsWith(".class")) { + if (element.getName().endsWith(".class")) { - // create a data input stream from the jar - // input stream - ClassFile javaClass = new ClassFile(); + // create a data input stream from the jar + // input stream + ClassFile javaClass = new ClassFile(); - javaClass.read(inFileStream); + javaClass.read(inFileStream); - nextElement = javaClass; - } + nextElement = javaClass; + } } finally { inFileStream.close(); } diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/jlink/jlink.java b/src/main/org/apache/tools/ant/taskdefs/optional/jlink/jlink.java index 391647782..b2c5d0f52 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/jlink/jlink.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/jlink/jlink.java @@ -224,52 +224,52 @@ public class jlink { } ZipFile zipf = new ZipFile(f); try { - Enumeration entries = zipf.entries(); - - while (entries.hasMoreElements()) { - ZipEntry inputEntry = (ZipEntry) entries.nextElement(); - //Ignore manifest entries. They're bound to cause conflicts between - //files that are being merged. User should supply their own - //manifest file when doing the merge. - String inputEntryName = inputEntry.getName(); - int index = inputEntryName.indexOf("META-INF"); - - if (index < 0) { - //META-INF not found in the name of the entry. Go ahead and process it. - try { - output.putNextEntry(processEntry(zipf, inputEntry)); - } catch (ZipException ex) { - //If we get here, it could be because we are trying to put a - //directory entry that already exists. - //For example, we're trying to write "com", but a previous - //entry from another mergefile was called "com". - //In that case, just ignore the error and go on to the - //next entry. - String mess = ex.getMessage(); - - if (mess.indexOf("duplicate") >= 0) { - //It was the duplicate entry. - continue; - } else { - // I hate to admit it, but we don't know what happened - // here. Throw the Exception. - throw ex; + Enumeration entries = zipf.entries(); + + while (entries.hasMoreElements()) { + ZipEntry inputEntry = (ZipEntry) entries.nextElement(); + //Ignore manifest entries. They're bound to cause conflicts between + //files that are being merged. User should supply their own + //manifest file when doing the merge. + String inputEntryName = inputEntry.getName(); + int index = inputEntryName.indexOf("META-INF"); + + if (index < 0) { + //META-INF not found in the name of the entry. Go ahead and process it. + try { + output.putNextEntry(processEntry(zipf, inputEntry)); + } catch (ZipException ex) { + //If we get here, it could be because we are trying to put a + //directory entry that already exists. + //For example, we're trying to write "com", but a previous + //entry from another mergefile was called "com". + //In that case, just ignore the error and go on to the + //next entry. + String mess = ex.getMessage(); + + if (mess.indexOf("duplicate") >= 0) { + //It was the duplicate entry. + continue; + } else { + // I hate to admit it, but we don't know what happened + // here. Throw the Exception. + throw ex; + } } - } - InputStream in = zipf.getInputStream(inputEntry); - int len = buffer.length; - int count = -1; + InputStream in = zipf.getInputStream(inputEntry); + int len = buffer.length; + int count = -1; - while ((count = in.read(buffer, 0, len)) > 0) { - output.write(buffer, 0, count); + while ((count = in.read(buffer, 0, len)) > 0) { + output.write(buffer, 0, count); + } + in.close(); + output.closeEntry(); } - in.close(); - output.closeEntry(); } - } } finally { - zipf.close(); + zipf.close(); } } diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/sound/AntSoundPlayer.java b/src/main/org/apache/tools/ant/taskdefs/optional/sound/AntSoundPlayer.java index 2a99124cb..5007c4594 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/sound/AntSoundPlayer.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/sound/AntSoundPlayer.java @@ -117,25 +117,25 @@ public class AntSoundPlayer implements LineListener, BuildListener { DataLine.Info info = new DataLine.Info(Clip.class, format, AudioSystem.NOT_SPECIFIED); try { - try { - audioClip = (Clip) AudioSystem.getLine(info); - audioClip.addLineListener(this); - audioClip.open(audioInputStream); - } catch (LineUnavailableException e) { - project.log("The sound device is currently unavailable"); - return; - } catch (IOException e) { - e.printStackTrace(); - } + try { + audioClip = (Clip) AudioSystem.getLine(info); + audioClip.addLineListener(this); + audioClip.open(audioInputStream); + } catch (LineUnavailableException e) { + project.log("The sound device is currently unavailable"); + return; + } catch (IOException e) { + e.printStackTrace(); + } - if (duration != null) { - playClip(audioClip, duration.longValue()); - } else { - playClip(audioClip, loops); - } - audioClip.drain(); + if (duration != null) { + playClip(audioClip, duration.longValue()); + } else { + playClip(audioClip, loops); + } + audioClip.drain(); } finally { - audioClip.close(); + audioClip.close(); } } else { project.log("Can't get data from file " + file.getName()); diff --git a/src/main/org/apache/tools/ant/types/resources/ResourceList.java b/src/main/org/apache/tools/ant/types/resources/ResourceList.java index 6c16b5e0d..da83ea9dd 100644 --- a/src/main/org/apache/tools/ant/types/resources/ResourceList.java +++ b/src/main/org/apache/tools/ant/types/resources/ResourceList.java @@ -198,12 +198,12 @@ public class ResourceList extends DataType implements ResourceCollection { Union streamResources = new Union(); BufferedReader reader = new BufferedReader(crh.getAssembledReader()); try { - streamResources.setCache(true); + streamResources.setCache(true); - String line = null; - while ((line = reader.readLine()) != null) { - streamResources.add(parse(line)); - } + String line = null; + while ((line = reader.readLine()) != null) { + streamResources.add(parse(line)); + } } finally { reader.close(); }