classpath-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [cp-patches] Patch: javax.sound.midi


From: Anthony Green
Subject: Re: [cp-patches] Patch: javax.sound.midi
Date: Mon, 26 Sep 2005 10:23:10 -0700

On Mon, 2005-09-26 at 09:48 -0600, Tom Tromey wrote:
> There are one or two places where the code goes past column 79.
> (I'm not super concerned about this.  I think we need a reformatting
> flag day anyway.)

I've cleaned most of these up in the attached patch.  This patch also
removes the declaration of some unchecked IllegalArgumentException
throws, as per the hacking guide.  I'm checking it in.

AG

2005-09-26  Anthony Green  <address@hidden>

        * javax/sound/midi/Synthesizer.java (loadInstrument,
        unloadInstrument, remapInstrument, loadAllInstruments,
        unloadAllInstruments, unloadInstrument, loadInstrument): Don't
        declare the unchecked IllegalArgumentException.
        * javax/sound/midi/MidiSystem.java (getMidiDevice, write): Ditto.
        
        * javax/sound/midi/ShortMessage.java: Fix 80-column formatting
        problem.
        * javax/sound/midi/Sequence.java: Ditto.
        * javax/sound/midi/MidiMessage.java: Ditto.
        * javax/sound/midi/MidiSystem.java: Ditto.
        * javax/sound/midi/MidiFileFormat.java: Ditto.

Index: javax/sound//midi/MidiFileFormat.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/sound/midi/MidiFileFormat.java,v
retrieving revision 1.1
diff -u -r1.1 MidiFileFormat.java
--- javax/sound//midi/MidiFileFormat.java       26 Sep 2005 16:35:00 -0000      
1.1
+++ javax/sound//midi/MidiFileFormat.java       26 Sep 2005 17:20:29 -0000
@@ -95,7 +95,8 @@
    * @param bytes the MIDI file size in bytes
    * @param microseconds the MIDI file length in microseconds
    */
-  public MidiFileFormat(int type, float divisionType, int resolution, int 
bytes, long microseconds)
+  public MidiFileFormat(int type, float divisionType, 
+                       int resolution, int bytes, long microseconds)
   {
     this.type = type;
     this.divisionType = divisionType;
Index: javax/sound//midi/MidiMessage.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/sound/midi/MidiMessage.java,v
retrieving revision 1.1
diff -u -r1.1 MidiMessage.java
--- javax/sound//midi/MidiMessage.java  26 Sep 2005 16:35:00 -0000      1.1
+++ javax/sound//midi/MidiMessage.java  26 Sep 2005 17:20:29 -0000
@@ -75,7 +75,8 @@
    * @param length The length of the MIDI message.
    * @throws InvalidMidiDataException Thrown when the MIDI message is invalid.
    */
-  protected void setMessage(byte[] data, int length) throws 
InvalidMidiDataException
+  protected void setMessage(byte[] data, int length) 
+    throws InvalidMidiDataException
   {
     this.data = new byte[length];
     System.arraycopy(data, 0, this.data, 0, length);
Index: javax/sound//midi/MidiSystem.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/sound/midi/MidiSystem.java,v
retrieving revision 1.1
diff -u -r1.1 MidiSystem.java
--- javax/sound//midi/MidiSystem.java   26 Sep 2005 16:35:00 -0000      1.1
+++ javax/sound//midi/MidiSystem.java   26 Sep 2005 17:20:29 -0000
@@ -71,7 +71,8 @@
    */
   public static MidiDevice.Info[] getMidiDeviceInfo()
   {
-    Iterator deviceProviders = 
ServiceFactory.lookupProviders(MidiDeviceProvider.class);
+    Iterator deviceProviders = 
+       ServiceFactory.lookupProviders(MidiDeviceProvider.class);
     List infoList = new ArrayList();
     
     while (deviceProviders.hasNext())
@@ -82,7 +83,8 @@
         infoList.add(infos[--i]);
     }
     
-    return (MidiDevice.Info[]) infoList.toArray(new 
MidiDevice.Info[infoList.size()]);
+    return (MidiDevice.Info[]) 
+       infoList.toArray(new MidiDevice.Info[infoList.size()]);
   }
   
   /**
@@ -94,9 +96,10 @@
    * @throws IllegalArgumentException if the device described by info is not 
found
    */
   public static MidiDevice getMidiDevice(MidiDevice.Info info) 
-    throws MidiUnavailableException, IllegalArgumentException
+    throws MidiUnavailableException
   {
-    Iterator deviceProviders = 
ServiceFactory.lookupProviders(MidiDeviceProvider.class);
+    Iterator deviceProviders = 
+       ServiceFactory.lookupProviders(MidiDeviceProvider.class);
     
     if (! deviceProviders.hasNext())
       throw new MidiUnavailableException("No MIDI device providers 
available.");
@@ -109,7 +112,8 @@
         return provider.getDevice(info);
     } while (deviceProviders.hasNext());
     
-    throw new IllegalArgumentException("MIDI device " + info + " not 
available.");
+    throw new IllegalArgumentException("MIDI device " 
+                                      + info + " not available.");
   }
   
   /**
@@ -259,7 +263,8 @@
       if (sb != null)
         return sb;
     }
-    throw new InvalidMidiDataException("Cannot read soundbank from file " + 
file);
+    throw new InvalidMidiDataException("Cannot read soundbank from file " 
+                                      + file);
   } 
 
   /**
@@ -281,7 +286,7 @@
       if (sb != null)
         return sb;
     }
-    throw new InvalidMidiDataException("Cannot read MidiFileFormat from 
stream");
+    throw new InvalidMidiDataException("Can't read MidiFileFormat from 
stream");
   }
 
   /**
@@ -325,7 +330,8 @@
       if (sb != null)
         return sb;
     }
-    throw new InvalidMidiDataException("Cannot read MidiFileFormat from file " 
+ file);
+    throw new InvalidMidiDataException("Can't read MidiFileFormat from file " 
+                                      + file);
   } 
   
   
@@ -452,7 +458,7 @@
    * @throws IllegalArgumentException if fileType is not supported for in
    */
   public static int write(Sequence in, int fileType, OutputStream out)
-    throws IOException, IllegalArgumentException
+    throws IOException
   {
     Iterator writers = ServiceFactory.lookupProviders(MidiFileWriter.class);
     while (writers.hasNext())
@@ -462,7 +468,8 @@
       if (fw.isFileTypeSupported(fileType, in))
         return fw.write(in, fileType, out);
     }
-    throw new IllegalArgumentException("File type " + fileType + " is not 
supported");
+    throw new IllegalArgumentException("File type " 
+                                      + fileType + " is not supported");
   }
 
   /**
@@ -476,7 +483,7 @@
    * @throws IllegalArgumentException if fileType is not supported for in
    */
   public static int write(Sequence in, int fileType, File out)
-    throws IOException, IllegalArgumentException
+    throws IOException
   {
     Iterator writers = ServiceFactory.lookupProviders(MidiFileWriter.class);
     while (writers.hasNext())
@@ -486,7 +493,8 @@
       if (fw.isFileTypeSupported(fileType, in))
         return fw.write(in, fileType, out);
     }
-    throw new IllegalArgumentException("File type " + fileType + " is not 
supported");
+    throw new IllegalArgumentException("File type " 
+                                      + fileType + " is not supported");
   }
 }
 
Index: javax/sound//midi/Sequence.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/sound/midi/Sequence.java,v
retrieving revision 1.1
diff -u -r1.1 Sequence.java
--- javax/sound//midi/Sequence.java     26 Sep 2005 16:35:00 -0000      1.1
+++ javax/sound//midi/Sequence.java     26 Sep 2005 17:20:29 -0000
@@ -206,7 +206,8 @@
       // FIXME
       // How can this possible be computed?  PPQ is pulses per quarter-note,
       // which is dependent on the tempo of the Sequencer.
-      throw new UnsupportedOperationException("Can't compute PPQ based lengths 
yet");
+      throw new 
+         UnsupportedOperationException("Can't compute PPQ based lengths yet");
     }
     else
     {
Index: javax/sound//midi/Sequencer.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/sound/midi/Sequencer.java,v
retrieving revision 1.1
diff -u -r1.1 Sequencer.java
--- javax/sound//midi/Sequencer.java    26 Sep 2005 16:35:00 -0000      1.1
+++ javax/sound//midi/Sequencer.java    26 Sep 2005 17:20:30 -0000
@@ -67,7 +67,8 @@
    * @throws IOException if an I/O exception happens
    * @throws InvalidMidiDataException if the MIDI file contains bad data
    */
-  public void setSequence(InputStream istream) throws IOException, 
InvalidMidiDataException;
+  public void setSequence(InputStream istream) 
+      throws IOException, InvalidMidiDataException;
   
   /**
    * Get the current sequence object for this sequencer.
Index: javax/sound//midi/ShortMessage.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/sound/midi/ShortMessage.java,v
retrieving revision 1.1
diff -u -r1.1 ShortMessage.java
--- javax/sound//midi/ShortMessage.java 26 Sep 2005 16:35:00 -0000      1.1
+++ javax/sound//midi/ShortMessage.java 26 Sep 2005 17:20:30 -0000
@@ -249,8 +249,8 @@
       return 0;
       
     default:
-      throw new InvalidMidiDataException ("Invalid status: 0x" 
-                                          + 
Integer.toHexString(originalStatus));
+      throw new InvalidMidiDataException("Invalid status: 0x" 
+                                         + 
Integer.toHexString(originalStatus));
     }
   }
   
Index: javax/sound//midi/Synthesizer.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/sound/midi/Synthesizer.java,v
retrieving revision 1.1
diff -u -r1.1 Synthesizer.java
--- javax/sound//midi/Synthesizer.java  26 Sep 2005 16:35:00 -0000      1.1
+++ javax/sound//midi/Synthesizer.java  26 Sep 2005 17:20:30 -0000
@@ -91,8 +91,7 @@
    * @return true if the instrument was loaded and false otherwise
    * @throws IllegalArgumentException if this synth doesn't support instrument
    */
-  public boolean loadInstrument(Instrument instrument)
-    throws IllegalArgumentException;
+  public boolean loadInstrument(Instrument instrument);
   
   /**
    * Unload an instrument from this synth.
@@ -100,8 +99,7 @@
    * @param instrument the Instrument to unload
    * @throws IllegalArgumentException if this synth doesn't support instrument
    */
-  public void unloadInstrument(Instrument instrument)
-    throws IllegalArgumentException;
+  public void unloadInstrument(Instrument instrument);
   
   /**
    * Move an intrument from one place to another.  The instrument at the
@@ -112,8 +110,7 @@
    * @return if from was remapped
    * @throws IllegalArgumentException
    */
-  public boolean remapInstrument(Instrument from, Instrument to)
-    throws IllegalArgumentException;
+  public boolean remapInstrument(Instrument from, Instrument to);
   
   /**
    * Get the default Soundbank for this synth.  Return null if there is no
@@ -144,8 +141,7 @@
    * @return true if all instruments were loaded, false othewise
    * @throws IllegalArgumentException if the soundbank isn't supported by this
    */
-  public boolean loadAllInstruments(Soundbank soundbank)
-    throws IllegalArgumentException;
+  public boolean loadAllInstruments(Soundbank soundbank);
   
   /**
    * Unload all soundbank instruments from this synthesizer.
@@ -153,8 +149,7 @@
    * @param soundbank the Soundbank containing the instruments to unload
    * @throws IllegalArgumentException if the soundbank isn't supported by this
    */
-  public void unloadAllInstruments(Soundbank soundbank)
-    throws IllegalArgumentException;
+  public void unloadAllInstruments(Soundbank soundbank);
   
   /**
    * Load a subset of soundbank instruments into this synthesizer.  The 
@@ -165,8 +160,7 @@
    * @return true if instruments were loaded, false otherwise
    * @throws IllegalArgumentException if the soundbank isn't supported by this
    */
-  public boolean loadInstruments(Soundbank soundbank, Patch[] patchList)
-    throws IllegalArgumentException;
+  public boolean loadInstruments(Soundbank soundbank, Patch[] patchList);
   
   /**
    * Unload a subset of soundbank instruments from this synthesizer.
@@ -175,6 +169,5 @@
    * @param patchList the array of patches identifying instruments to unload
    * @throws IllegalArgumentException if the soundbank isn't supported by this
    */
-  public void unloadInstruments(Soundbank soundbank, Patch[] patchList)
-    throws IllegalArgumentException;
+  public void unloadInstruments(Soundbank soundbank, Patch[] patchList);
 }






reply via email to

[Prev in Thread] Current Thread [Next in Thread]