diff -ru --ignore-tab-expansion CVS/classpath/javax/sound/midi/MidiMessage.java updated/classpath/javax/sound/midi/MidiMessage.java
--- CVS/classpath/javax/sound/midi/MidiMessage.java	2005-09-26 20:24:00.000000000 +0300
+++ updated/classpath/javax/sound/midi/MidiMessage.java	2010-03-24 11:38:22.000000000 +0300
@@ -1,5 +1,5 @@
 /* MidiMessage.java -- base class for MIDI messages.
-   Copyright (C) 2005 Free Software Foundation, Inc.
+   Copyright (C) 2005, 2010  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -65,7 +65,8 @@
   protected MidiMessage(byte[] data)
   {
     this.data = data;
-    this.length = data.length;
+    if (data != null)
+      this.length = data.length;
   }
   
   /**
@@ -78,7 +79,10 @@
   protected void setMessage(byte[] data, int length) 
     throws InvalidMidiDataException
   {
-    this.data = new byte[length];
+    if (length < 0 || length > data.length)
+      throw new IndexOutOfBoundsException("length out of bounds: " + length);
+    if (this.data == null || this.data.length < length)
+      this.data = new byte[length];
     System.arraycopy(data, 0, this.data, 0, length);
     this.length = length;
   }
diff -ru --ignore-tab-expansion CVS/classpath/javax/sound/midi/MidiSystem.java updated/classpath/javax/sound/midi/MidiSystem.java
--- CVS/classpath/javax/sound/midi/MidiSystem.java	2006-03-16 04:46:58.000000000 +0300
+++ updated/classpath/javax/sound/midi/MidiSystem.java	2010-03-24 11:36:44.000000000 +0300
@@ -1,5 +1,5 @@
 /* MidiSystem.java -- Access system MIDI resources
-   Copyright (C) 2005 Free Software Foundation, Inc.
+   Copyright (C) 2005, 2010  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -425,7 +425,7 @@
       for (int i = types.length; i > 0;)
       {
         int type = types[--i];
-        if (supported[type] == false)
+        if (supported.length > type && !supported[type])
         {
           count++;
           supported[type] = true;
@@ -481,7 +481,7 @@
       for (int i = types.length; i > 0;)
       {
         int type = types[--i];
-        if (supported[type] == false)
+        if (supported.length > type && !supported[type])
         {
           count++;
           supported[type] = true;
@@ -568,4 +568,3 @@
 				       + fileType + " is not supported");
   }
 }
-
diff -ru --ignore-tab-expansion CVS/classpath/javax/sound/midi/SysexMessage.java updated/classpath/javax/sound/midi/SysexMessage.java
--- CVS/classpath/javax/sound/midi/SysexMessage.java	2006-07-02 05:13:16.000000000 +0300
+++ updated/classpath/javax/sound/midi/SysexMessage.java	2010-03-24 11:36:44.000000000 +0300
@@ -1,5 +1,5 @@
 /* SysexMessage.java -- System Exclusive MIDI message.
-   Copyright (C) 2005 Free Software Foundation, Inc.
+   Copyright (C) 2005, 2010  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -85,10 +85,10 @@
   public void setMessage(byte[] data, int length)
     throws InvalidMidiDataException
   {
-    if (data[0] != SYSTEM_EXCLUSIVE
-        && data[0] != SPECIAL_SYSTEM_EXCLUSIVE)
+    int status = data[0] & 0xff;
+    if (status != SYSTEM_EXCLUSIVE && status != SPECIAL_SYSTEM_EXCLUSIVE)
       throw new InvalidMidiDataException("Sysex message starts with 0x"
-                                         + Integer.toHexString(data[0])
+                                         + Integer.toHexString(status)
                                          + " instead of 0xF0 or 0xF7");
     super.setMessage(data, length);
   }
@@ -109,7 +109,10 @@
       throw new InvalidMidiDataException("Sysex message starts with 0x"
                                          + Integer.toHexString(status)
                                          + " instead of 0xF0 or 0xF7");
-    this.data = new byte[length+1];
+    if (length < 0 || length > data.length)
+      throw new IndexOutOfBoundsException("length out of bounds: " + length);
+    if (this.data == null || this.data.length - 1 < length)
+      this.data = new byte[length + 1];
     this.data[0] = (byte) status;
     System.arraycopy(data, 0, this.data, 1, length);
     this.length = length+1;
@@ -132,8 +135,8 @@
   public Object clone()
   {
     byte message[] = new byte[length];
-    System.arraycopy(data, 0, message, 0, length);
+    if (data != null)
+      System.arraycopy(data, 0, message, 0, message.length);
     return new SysexMessage(message); 
   }
 }
-
diff -ru --ignore-tab-expansion CVS/classpath/javax/sound/sampled/CompoundControl.java updated/classpath/javax/sound/sampled/CompoundControl.java
--- CVS/classpath/javax/sound/sampled/CompoundControl.java	2008-05-07 03:18:24.000000000 +0300
+++ updated/classpath/javax/sound/sampled/CompoundControl.java	2010-03-24 11:36:44.000000000 +0300
@@ -1,5 +1,5 @@
 /* Control consisting of several other controls
-   Copyright (C) 2005 Free Software Foundation, Inc.
+   Copyright (C) 2005, 2010  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -72,8 +72,7 @@
   protected CompoundControl(Type type, Control[] members)
   {
     super(type);
-    // FIXME: clone?
-    this.memberControls = members;
+    this.memberControls = members; // no cloning
   }
 
   /**
@@ -81,8 +80,9 @@
    */
   public Control[] getMemberControls()
   {
-    // FIXME: clone?
-    return memberControls;
+    Control[] members = new Control[memberControls.length];
+    System.arraycopy(memberControls, 0, members, 0, members.length);
+    return members;
   }
 
   /**
diff -ru --ignore-tab-expansion CVS/classpath/javax/sound/sampled/EnumControl.java updated/classpath/javax/sound/sampled/EnumControl.java
--- CVS/classpath/javax/sound/sampled/EnumControl.java	2006-03-16 19:01:22.000000000 +0300
+++ updated/classpath/javax/sound/sampled/EnumControl.java	2010-03-24 11:36:44.000000000 +0300
@@ -1,5 +1,5 @@
-/* 
-   Copyright (C) 2005 Free Software Foundation, Inc.
+/* EnumControl.java --
+   Copyright (C) 2005, 2010  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -77,9 +77,7 @@
   protected EnumControl(Type type, Object[] values, Object val)
   {
     super(type);
-    // FIXME: error checking: values.length>0, val in values... ?
-    // FIXME: clone here?
-    this.values = values;
+    this.values = values; // no cloning and error checking
     this.value = val;
   }
 
@@ -96,8 +94,9 @@
    */
   public Object[] getValues()
   {
-    // FIXME: clone here?
-    return values;
+    Object[] valuesCopy = new Object[values.length];
+    System.arraycopy(values, 0, valuesCopy, 0, valuesCopy.length);
+    return valuesCopy;
   }
 
   /**
@@ -110,8 +109,8 @@
   {
     for (int i = 0; i < values.length; ++i)
       {
-	if (! values[i].equals(value))
-	  throw new IllegalArgumentException("value not supported");
+        if (!value.equals(values[i]))
+          throw new IllegalArgumentException("value not supported: " + value);
       }
     this.value = value;
   }
@@ -121,6 +120,6 @@
    */
   public String toString()
   {
-    return super.toString() + ": " + value;
+    return super.toString() + ": " + getValue();
   }
 }
diff -ru --ignore-tab-expansion CVS/classpath/javax/sound/sampled/Line.java updated/classpath/javax/sound/sampled/Line.java
--- CVS/classpath/javax/sound/sampled/Line.java	2006-12-10 23:25:48.000000000 +0300
+++ updated/classpath/javax/sound/sampled/Line.java	2010-03-24 11:36:44.000000000 +0300
@@ -1,5 +1,5 @@
 /* An input or output line
-   Copyright (C) 2005 Free Software Foundation, Inc.
+   Copyright (C) 2005, 2010  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -50,7 +50,7 @@
    */
   class Info
   {
-    private Class klass;
+    private final Class<?> klass;
 
     /**
      * Create a new Info object.  The argument is the class of the line,
@@ -59,6 +59,8 @@
      */
     public Info(Class<?> klass)
     {
+      if (klass == null)
+        klass = Line.class;
       this.klass = klass;
     }
 
@@ -77,7 +79,8 @@
      */
     public boolean matches(Info other)
     {
-      return klass.equals(other.klass);
+      return getClass().isInstance(other) &&
+               getLineClass().isAssignableFrom(other.getLineClass());
     }
 
     /**
diff -ru --ignore-tab-expansion CVS/classpath/javax/sound/sampled/spi/FormatConversionProvider.java updated/classpath/javax/sound/sampled/spi/FormatConversionProvider.java
--- CVS/classpath/javax/sound/sampled/spi/FormatConversionProvider.java	2005-11-13 20:33:44.000000000 +0300
+++ updated/classpath/javax/sound/sampled/spi/FormatConversionProvider.java	2010-03-24 11:36:44.000000000 +0300
@@ -1,5 +1,5 @@
 /* Format conversion API
-   Copyright (C) 2005 Free Software Foundation, Inc.
+   Copyright (C) 2005, 2010  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -140,7 +140,12 @@
   public boolean isConversionSupported(AudioFormat targ, AudioFormat src)
   {
     AudioFormat[] encodings = getTargetFormats(targ.getEncoding(), src);
-    return encodings.length > 0;
+    for (int i = 0; i < encodings.length; ++i)
+      {
+        if (targ.matches(encodings[i]))
+          return true;
+      }
+    return false;
   }
 
   /**
