Examples of ObservationValidationError


Examples of org.aavso.tools.vstar.exception.ObservationValidationError

    } else if (">".equals(modStr)) {
      mod = MagnitudeModifier.BRIGHTER_THAN;
    } else {
      // This should never happen if we are calling this appropriately
      // above.
      throw new ObservationValidationError("Expected " + kind
          + " modifier: < or >");
    }

    return mod;
  }
View Full Code Here

Examples of org.aavso.tools.vstar.exception.ObservationValidationError

          isTransformed = true;
        } else if ("no".equalsIgnoreCase(transformed)
            || "0".equals(transformed)) {
          isTransformed = false;
        } else {
          throw new ObservationValidationError(
              "Transformed field must contain 'yes' or 'no', or be empty.");
        }
      }
    }
View Full Code Here

Examples of org.aavso.tools.vstar.exception.ObservationValidationError

        if (kind != null) {
          String msg = LocaleProps.get("THE") + " " + kind
              + " "
              + LocaleProps.get("FIELD_CANNOT_BE_EMPTY")
              + ".";
          throw new ObservationValidationError(msg);
        } else {
          throw new ObservationValidationError();
        }
      }
    } else {
      return false;
    }
View Full Code Here

Examples of org.aavso.tools.vstar.exception.ObservationValidationError

      msgBuf.append("'");
      if (this.errorNotes != null) {
        msgBuf.append(". ");
        msgBuf.append(this.errorNotes);
      }
      throw new ObservationValidationError(msgBuf.toString());
    } else {
      for (int i=1;i<=matcher.groupCount();i++) {
        groups.add(matcher.group(i));
      }
    }
View Full Code Here

Examples of org.aavso.tools.vstar.exception.ObservationValidationError

    double value = 0;

    try {
      value = Double.parseDouble(str);
    } catch (NumberFormatException e) {
      throw new ObservationValidationError(String.format(LocaleProps
          .get("REAL_NUMBER_VALIDATOR_KIND_ERR_MSG"), kind, str));
    }

    return value;
  }
View Full Code Here

Examples of org.aavso.tools.vstar.exception.ObservationValidationError

      if (uncertaintyMag != null) {
        magnitude.setUncertainty(uncertaintyMag);
      }

      if (magnitude.isBrighterThan()) {
        throw new ObservationValidationError(
            "Was '>' intended (brighter than) or '<'?");
      }

      observation.setMagnitude(magnitude);
View Full Code Here

Examples of org.aavso.tools.vstar.exception.ObservationValidationError

      return "";

    if (str.length() <= MAX) {
      return str;
    } else {
      throw new ObservationValidationError("The " + kind + " '" + str
          + "' is more than " + MAX + " characters in length.");
    }
  }
View Full Code Here

Examples of org.aavso.tools.vstar.exception.ObservationValidationError

      return "";

    if (str.length() <= MAX) {
      return str;
    } else {
      throw new ObservationValidationError("The " + kind + " '" + str
          + "' is more than " + MAX + " characters in length.");
    }
  }
View Full Code Here

Examples of org.aavso.tools.vstar.exception.ObservationValidationError

      }

      String cname = fields[7].trim();
      if (isNA(cname)) {
        if (mtype == MTypeType.DIFF) {
          throw new ObservationValidationError(
              "Magnitude type is differential but there is no CNAME.");
        } else {
          cname = "";
        }
      } else {
        cname += ": ";
      }

      String cmagStr = fields[8].trim();
      if (!isNA(cmagStr)) {
        // Note: Could CKMagValidator here, but its max field width
        // seems not to represent the reality of some instrumental
        // magnitudes, for example.
        double cmag = magnitudeValueValidator.validate(cmagStr);
        observation.setCMag(cname + cmag);
      }

      String kname = fields[9].trim();
      if (isNA(kname)) {
        kname = "";
      } else {
        kname += ": ";
      }

      String kmagStr = fields[10].trim();
      if (!isNA(kmagStr)) {
        // Note: Could CKMagValidator here, but its max field width
        // seems not to represent the reality of some instrumental
        // magnitudes, for example.
        double kmag = magnitudeValueValidator.validate(kmagStr);
        observation.setKMag(kname + kmag);
      }

      String airmass = fields[11].trim();
      if (!isNA(airmass)) {
        observation.setAirmass(airmass);
      }

      String group = fields[12].trim();
      if (group.length() > 5) {
        throw new ObservationValidationError(
            "GROUP has more than 5 characters.");
      }

      String chart = fields[13].trim();
      if (!isNA(chart)) {
View Full Code Here

Examples of org.aavso.tools.vstar.exception.ObservationValidationError

      observation.setName(name);
      observation.setObsCode(obscode);

      // TODO: handle "calendar" date format.
      if (!"JD".equals(dateType) && !"HJD".equals(dateType)) {
        throw new ObservationValidationError("Unsupported date type: "
            + dateType);
      } else {
        DateInfo dateInfo = julianDayValidator.validate(fields[1]
            .trim());
        observation.setDateInfo(dateInfo);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.