code: public static String cleanupVersion(String version) {
          StringBuilder result = new StringBuilder();
          Matcher m = FUZZY_VERSION.matcher(version);
          if (m.matches()) {
              String major = m.group(1);
              String minor = m.group(3);
              String micro = m.group(5);
              String qualifier = m.group(7);
  
              if (major != null) {
                  result.append(major);
                  if (minor != null) {
                      result.append(".");
                      result.append(minor);
                      if (micro != null) {
                          result.append(".");
                          result.append(micro);
                          if (qualifier != null) {
                              result.append(".");
                              cleanupModifier(result, qualifier);
                          }
                      } else if (qualifier != null) {
                          result.append(".0.");
                          cleanupModifier(result, qualifier);
                      } else {
                          result.append(".0");
                      }
                  } else if (qualifier != null) {
                      result.append(".0.0.");
                      cleanupModifier(result, qualifier);
                  } else {
                      result.append(".0.0");
                  }
              }
          } else {
              result.append("0.0.0.");
              cleanupModifier(result, version);
          }
          return result.toString();
      }
docs: Cleans up the version to be OSGi compliant.
  
  @param version a Maven version
  @return the OSGi version computed from the given Maven version.