if (Array.getLength(parameter) > MAX_ARRAY_LENGTH) throw new DBusException("Array exceeds maximum length of "+MAX_ARRAY_LENGTH);
if (Array.getLength(parameter) > DBusConnection.MAX_ARRAY_LENGTH) throw new DBusException("Array exceeds maximum length of "+DBusConnection.MAX_ARRAY_LENGTH);
   static Object convertParameter(Object parameter, Type type) throws DBusException   {      // its an unwrapped variant, wrap it      if (type instanceof TypeVariable &&            !(parameter instanceof Variant)) {         parameter = new Variant<Object>(parameter);      }      // recurse on Variants      else if (parameter instanceof Variant)      {         parameter = new Variant(convertParameter(((Variant) parameter).getValue(),                                                   ((Variant) parameter).getType()),                                 ((Variant) parameter).getType());      }      // wrap TypeSignatures      else if (parameter instanceof Type[])         parameter = new TypeSignature((Type[]) parameter);      // its something parameterised      else if (type instanceof ParameterizedType) {         ParameterizedType p = (ParameterizedType) type;         Class r = (Class) p.getRawType();         // its a list, wrap it in our typed container class         if (List.class.isAssignableFrom(r) && !(parameter instanceof ListContainer)) {            parameter = new ListContainer((List<Object>) parameter, p);         }         // its a map, wrap it in our typed container class         else if (Map.class.isAssignableFrom(r) && !(parameter instanceof MapContainer)) {            parameter = new MapContainer((Map<Object,Object>) parameter, p);         }         // its a struct or tuple, recurse over it         else if (Container.class.isAssignableFrom(r)) {            Constructor con = r.getDeclaredConstructors()[0];            Object[] newparams;            if (Tuple.class.isAssignableFrom(r)) {               Type[] ts = p.getActualTypeArguments();               newparams = ((Container) parameter).getParameters(ts);            } else               newparams = ((Container) parameter).getParameters();            try {               parameter = con.newInstance(newparams);            } catch (Exception e) {               if (DBusConnection.EXCEPTION_DEBUG) e.printStackTrace();               throw new DBusException("Failure in serializing parameters: "+e.getMessage());            }         }      }      else if (type instanceof GenericArrayType) {         if (Array.getLength(parameter) > MAX_ARRAY_LENGTH) throw new DBusException("Array exceeds maximum length of "+MAX_ARRAY_LENGTH);         Type t = ((GenericArrayType) type).getGenericComponentType();         if (!(t instanceof Class) || !((Class) t).isPrimitive())            parameter = new ListContainer((Object[]) parameter, t);      } else if (type instanceof Class && ((Class) type).isArray()) {         if (Array.getLength(parameter) > MAX_ARRAY_LENGTH) throw new DBusException("Array exceeds maximum length of "+MAX_ARRAY_LENGTH);         if (!((Class) type).getComponentType().isPrimitive())            parameter = new ListContainer((Object[]) parameter, ((Class) type).getComponentType());      }      return parameter;   }