コード例 #1
0
  @RequestMapping(value = "/new", method = RequestMethod.GET)
  public String showNewForm(
      @RequestParam(value = "start", required = false) @DateTimeFormat(pattern = dataFormat)
          Date start,
      @RequestParam(value = "end", required = false) @DateTimeFormat(pattern = dataFormat) Date end,
      Model model) {

    setColorList(model);

    Calendar calendar = new Calendar();
    calendar.setLength(1);
    if (start != null) {
      calendar.setStartDate(start);
      calendar.setLength((int) Math.ceil(1.0 * (end.getTime() - start.getTime()) / oneDayMillis));
      if (DateUtils.isSameDay(start, end)) {
        calendar.setLength(1);
      }
      if (!"00:00:00".equals(DateFormatUtils.format(start, "HH:mm:ss"))) {
        calendar.setStartTime(start);
      }
      if (!"00:00:00".equals(DateFormatUtils.format(end, "HH:mm:ss"))) {
        calendar.setEndTime(end);
      }
    }
    model.addAttribute("model", calendar);
    return viewName("newForm");
  }
コード例 #2
0
  @RequestMapping(value = "/move", method = RequestMethod.POST)
  @ResponseBody
  public String moveCalendar(
      @RequestParam("id") Long id,
      @RequestParam(value = "start", required = false) @DateTimeFormat(pattern = dataFormat)
          Date start,
      @RequestParam(value = "end", required = false) @DateTimeFormat(pattern = dataFormat)
          Date end) {
    Calendar calendar = calendarService.findOne(id);

    if (end == null) {
      end = start;
    }

    calendar.setStartDate(start);
    calendar.setLength((int) Math.ceil(1.0 * (end.getTime() - start.getTime()) / oneDayMillis));
    if (DateUtils.isSameDay(start, end)) {
      calendar.setLength(1);
    }
    if (!"00:00:00".equals(DateFormatUtils.format(start, "HH:mm:ss"))) {
      calendar.setStartTime(start);
    }
    if (!"00:00:00".equals(DateFormatUtils.format(end, "HH:mm:ss"))) {
      calendar.setEndTime(end);
    }
    calendarService.copyAndRemove(calendar);

    return "ok";
  }
コード例 #3
0
  @RequestMapping("{cacheName}/{key}/details")
  @ResponseBody
  public Object keyDetail(
      @PathVariable("cacheName") String cacheName, @PathVariable("key") String key, Model model) {

    Element element = cacheManager.getCache(cacheName).get(key);

    String dataPattern = "yyyy-MM-dd hh:mm:ss";
    Map<String, Object> data = Maps.newHashMap();
    data.put("objectValue", element.getObjectValue().toString());
    data.put("size", PrettyMemoryUtils.prettyByteSize(element.getSerializedSize()));
    data.put("hitCount", element.getHitCount());

    Date latestOfCreationAndUpdateTime = new Date(element.getLatestOfCreationAndUpdateTime());
    data.put(
        "latestOfCreationAndUpdateTime",
        DateFormatUtils.format(latestOfCreationAndUpdateTime, dataPattern));
    Date lastAccessTime = new Date(element.getLastAccessTime());
    data.put("lastAccessTime", DateFormatUtils.format(lastAccessTime, dataPattern));
    if (element.getExpirationTime() == Long.MAX_VALUE) {
      data.put("expirationTime", "不过期");
    } else {
      Date expirationTime = new Date(element.getExpirationTime());
      data.put("expirationTime", DateFormatUtils.format(expirationTime, dataPattern));
    }

    data.put("timeToIdle", element.getTimeToIdle());
    data.put("timeToLive", element.getTimeToLive());
    data.put("version", element.getVersion());

    return data;
  }
コード例 #4
0
  /*
   * This method gets ReportHeaderType for cumulative Report from budget.It
   * set all the data for RportHeader from budget and DevelopmentProposal
   */
  protected ReportHeaderType getReportHeaderTypeForCumulativeReport(BudgetParent budgetParent) {
    ReportHeaderType reportHeaderType = ReportHeaderType.Factory.newInstance();
    if (budgetParent != null) {
      reportHeaderType.setParentTypeName(budgetParent.getParentTypeName());
      reportHeaderType.setProposalNumber(budgetParent.getParentNumber());
    }
    if (budgetParent != null && budgetParent.getParentTitle() != null) {
      reportHeaderType.setProposalTitle(budgetParent.getParentTitle());
    }
    String principleInvestigatorName = budgetParent.getParentPIName();

    if (principleInvestigatorName != null) {
      reportHeaderType.setPIName(principleInvestigatorName);
    }
    if (budget.getVersionNumber() != null) {
      reportHeaderType.setBudgetVersion(budget.getBudgetVersionNumber().intValue());
    }
    if (budget.getStartDate() != null) {
      reportHeaderType.setPeriodStartDate(
          DateFormatUtils.format(budget.getStartDate(), DATE_FORMAT));
    }
    if (budget.getEndDate() != null) {
      reportHeaderType.setPeriodEndDate(DateFormatUtils.format(budget.getEndDate(), DATE_FORMAT));
    }
    reportHeaderType.setCreateDate(dateTimeService.getCurrentDate().toString());
    if (budget.getComments() != null) {
      if (budget.getPrintBudgetCommentFlag() != null
          && budget.getPrintBudgetCommentFlag().equals("true"))
        reportHeaderType.setComments(budget.getComments());
    }

    budget.setPrintBudgetCommentFlag(null);

    return reportHeaderType;
  }
コード例 #5
0
ファイル: DateUtils.java プロジェクト: Allan1310/maf
 /** 得到日期字符串 默认格式(yyyy-MM-dd) pattern可以为:"yyyy-MM-dd" "HH:mm:ss" "E" */
 public static String formatDate(Date date, Object... pattern) {
   String formatDate = null;
   if (pattern != null && pattern.length > 0) {
     formatDate = DateFormatUtils.format(date, pattern[0].toString());
   } else {
     formatDate = DateFormatUtils.format(date, "yyyy-MM-dd");
   }
   return formatDate;
 }
コード例 #6
0
 public static String getLogin_date(Date date) {
   if (date == null) {
     return "从未登录";
   } else {
     return DateFormatUtils.format(date, "yyyy-MM-dd HH:mm");
   }
 }
コード例 #7
0
  /**
   * 返回服务系统信息
   *
   * @throws Exception
   */
  public static ServerStatus getServerStatus() throws Exception {
    ServerStatus status = new ServerStatus();
    status.setServerTime(DateFormatUtils.format(Calendar.getInstance(), "yyyy-MM-dd HH:mm:ss"));
    status.setServerName(System.getenv().get("COMPUTERNAME"));

    Runtime rt = Runtime.getRuntime();
    // status.setIp(InetAddress.getLocalHost().getHostAddress());
    status.setJvmTotalMem(rt.totalMemory() / (1024 * 1024));
    status.setJvmFreeMem(rt.freeMemory() / (1024 * 1024));
    status.setJvmMaxMem(rt.maxMemory() / (1024 * 1024));
    Properties props = System.getProperties();
    status.setServerOs(
        props.getProperty("os.name")
            + " "
            + props.getProperty("os.arch")
            + " "
            + props.getProperty("os.version"));
    status.setJavaHome(props.getProperty("java.home"));
    status.setJavaVersion(props.getProperty("java.version"));
    status.setJavaTmpPath(props.getProperty("java.io.tmpdir"));

    Sigar sigar = new Sigar();
    getServerCpuInfo(sigar, status);
    getServerDiskInfo(sigar, status);
    getServerMemoryInfo(sigar, status);

    return status;
  }
コード例 #8
0
  public List<DeviceList> getDeviceList(String location) {
    SessionFactory sessionFactory = HibernateSessionFactory.getSessionFactory();
    List<DeviceList> results = new ArrayList<DeviceList>();
    Session session = sessionFactory.openSession();
    if (session != null) {
      SQLQuery query =
          session.createSQLQuery(
              "select d.*,da.*,du.* "
                  + "from device_app.device d, device_app.device_availability da, device_app.device_user du "
                  + "where d.id=da.device_id and "
                  + "da.checked_out_user = du.email_id and "
                  + "d.device_status='active' and "
                  + "du.user_location=:location");
      query.addEntity(Device.class);
      query.addEntity(DeviceAvailability.class);
      query.addEntity(DeviceUser.class);
      query.setString("location", location);

      List<Object[]> resultList = query.list();
      if (resultList != null && resultList.size() > 0) {
        System.out.println("results size is " + resultList.size());
        for (Object[] array : resultList) {
          DeviceList row = new DeviceList();
          for (Object resultObject : array) {
            System.out.println(resultObject.getClass());
            if (resultObject instanceof Device) {
              Device device = (Device) resultObject;

              row.setBarCodeIdentifier(device.getBarCodeId());
              row.setDeviceCapacity(device.getDeviceCapacity());
              row.setDeviceName(device.getDeviceName());
              row.setDeviceNickname(device.getDeviceNickName());
              row.setDeviceOs(device.getDeviceOs());
              row.setDeviceOsVersion(device.getDeviceOsVersion());
              row.setDeviceSerialNumber(device.getDeviceSerialNumber());
              row.setDeviceStatus(device.getDeviceStatus());
              row.setDeviceType(device.getDeviceType());
              row.setId(device.getId());
              row.setOwnedBy(device.getDeviceOwner());

            } else if (resultObject instanceof DeviceAvailability) {
              DeviceAvailability availability = (DeviceAvailability) resultObject;
              //
              //	row.setCheckedOutAt(DateUtils.truncate(availability.getModifiedDate(),Calendar.MINUTE).toString());
              row.setCheckedOutAt(
                  DateFormatUtils.format(availability.getModifiedDate(), "yyyy-MM-dd HH:mm:ss"));
              row.setCurrentlyCheckedOutById(availability.getDeviceUser().getEmailId());
              row.setIsCheckedOut(availability.isIsCheckedOut());
              row.setLocation(location);
            } else {
              DeviceUser user = (DeviceUser) resultObject;
            }
          }
          results.add(row);
        }
      }
    }

    return results;
  }
コード例 #9
0
 protected static String getStringRepOfFieldValueForInsert(Field field) {
   switch (field.getType()) {
     case BYTE_ARRAY:
       // Do a hex encode.
       return Hex.encodeHexString(field.getValueAsByteArray());
     case BYTE:
       return String.valueOf(field.getValueAsInteger());
     case TIME:
       return DateFormatUtils.format(field.getValueAsDate(), "HH:mm:ss.SSS");
     case DATE:
       return DateFormatUtils.format(field.getValueAsDate(), "yyyy-MM-dd");
     case DATETIME:
       return DateFormatUtils.format(field.getValueAsDate(), "yyyy-MM-dd HH:mm:ss.SSS");
     default:
       return String.valueOf(field.getValue());
   }
 }
コード例 #10
0
ファイル: YhdPriceMonitor.java プロジェクト: lcstore/iblade
 public static void main(String[] args) throws Exception {
   int index = 0;
   long timeout = 5000;
   String pattern = "MMdd_HH_mm_ss";
   String dataDir = "./data/" + YhdPriceMonitor.class.getSimpleName().toLowerCase();
   disableSSLCertCheck();
   String dateChars = DateFormatUtils.format(new Date(), pattern);
   int lastErrorCount = 0;
   while (true) {
     index++;
     String url =
         "http://gps.yhd.com/restful/detail?mcsite=1&provinceId=1&pmId=41909728&callback=jQuery111304328004347221549_1447325832073&_="
             + System.currentTimeMillis();
     long start = System.currentTimeMillis();
     Response resp = doRequest(url, 3);
     long cost = System.currentTimeMillis() - start;
     if (resp == null) {
       log.warn("error,index:" + index + ",status:null,cost:" + cost + ",url:" + url);
     } else {
       log.info(
           "done,index:"
               + index
               + ",status:"
               + resp.statusCode()
               + ",cost:"
               + cost
               + ",url:"
               + url);
     }
     boolean success = doValidateResponse(resp);
     if (success) {
       lastErrorCount = 0;
       log.info("validate=true.index:" + index + ",cookies:" + JSON.toJSONString(resp.cookies()));
       log.info("validate=true.index:" + index + ",headers:" + JSON.toJSONString(resp.headers()));
     } else {
       lastErrorCount++;
       if (resp != null) {
         log.warn(
             "validate=false.index:" + index + ",cookies:" + JSON.toJSONString(resp.cookies()));
         log.warn(
             "validate=false.index:" + index + ",cookies:" + JSON.toJSONString(resp.headers()));
       }
     }
     FileUtils.writeStringToFile(
         new File(dataDir, dateChars + File.separator + index + ".html"),
         resp == null ? "no response" : resp.body());
     if (lastErrorCount >= 10) {
       break;
     }
     TimeUnit.MILLISECONDS.sleep(timeout);
   }
 }
コード例 #11
0
ファイル: WeiboService.java プロジェクト: yangwangsmile/test2
  public Weibo findWeiboById(Long id) {

    Weibo w = elasticSearch.getWeibo(id.toString());
    if (changsha) {
      hbaseWeiboMsg.getHeadPic_changsha(w);
    } else {
      w =
          hbaseWeiboMsg.getWeibo(
              DateFormatUtils.format(w.getReleaseDate(), "yyyyMMddHHmmss") + "-" + id.toString());
    }
    // mongoDBClient.findWeiboById(w);
    return w;
  }
コード例 #12
0
  // 压缩
  @RequestMapping("compress")
  public String compress(
      @RequestParam(value = "parentPath") String parentPath,
      @RequestParam(value = "paths") String[] paths,
      RedirectAttributes redirectAttributes)
      throws IOException {

    String rootPath = sc.getRealPath(ROOT_DIR);
    parentPath = URLDecoder.decode(parentPath, Constants.ENCODING);

    Date now = new Date();
    String pattern = "yyyyMMddHHmmss";

    String compressPath =
        parentPath
            + File.separator
            + "[系统压缩]"
            + DateFormatUtils.format(now, pattern)
            + "-"
            + System.nanoTime()
            + ".zip";

    for (int i = 0, l = paths.length; i < l; i++) {
      String path = paths[i];
      path = URLDecoder.decode(path, Constants.ENCODING);
      paths[i] = rootPath + File.separator + path;
    }

    try {
      CompressUtils.zip(rootPath + File.separator + compressPath, paths);
      String msg =
          "压缩成功,<a href='%s/%s?path=%s' target='_blank' class='btn btn-primary'>点击下载</a>,下载完成后,请手工删除生成的压缩包";
      redirectAttributes.addFlashAttribute(
          Constants.MESSAGE,
          String.format(
              msg,
              sc.getContextPath(),
              viewName("download"),
              URLEncoder.encode(compressPath, Constants.ENCODING)));

    } catch (Exception e) {
      redirectAttributes.addFlashAttribute(Constants.ERROR, e.getMessage());
    }

    redirectAttributes.addAttribute("path", URLEncoder.encode(parentPath, Constants.ENCODING));
    return redirectToUrl(viewName("list"));
  }
コード例 #13
0
  /** 查询学生信息分页 */
  @Override
  public PageResponse<StudentManagerDTO> queryStudentPage(StudentPageRequest studentPageRequest) {
    String schoolId = studentPageRequest.getSchoolId();
    if (schoolId == null) {
      schoolId = userService.getSchoolId(studentPageRequest.getUserId());
      studentPageRequest.setSchoolId(schoolId);
    }
    // 获取学生信息的总条数
    MStudentManager studentManager = new MStudentManager();
    BeanUtils.copyProperties(studentPageRequest, studentManager);
    long count = studentMapper.selectCount(studentManager);
    // 获取当前页的信息
    Page page = PageUtils.buildPage(studentPageRequest);
    List<MStudentManager> mStudentList =
        studentMapper.selectMStudentManagerPage(page, studentManager);
    /*
    给返回接口赋值
     */
    List<StudentManagerDTO> studentManagerDTOs = new ArrayList<>();
    for (MStudentManager mstudents : mStudentList) {
      StudentManagerDTO studentManagerDTO = new StudentManagerDTO();
      BeanUtils.copyProperties(mstudents, studentManagerDTO);
      studentManagerDTO.setLastLoginDate(
          mstudents.getLastLoginDate() == null
              ? "从未登录"
              : DateFormatUtils.format(mstudents.getLastLoginDate(), "yyyy-MM-dd HH:mm"));
      if (mstudents.getYears() != null) {
        studentManagerDTO.setClassAliasName(
            getGrade(mstudents.getYears()) + studentManagerDTO.getClassAliasName());
      } else {
        studentManagerDTO.setClassAliasName("无班级");
      }
      studentManagerDTOs.add(studentManagerDTO);
    }

    // 返回对象
    PageResponse<StudentManagerDTO> pageResponse = new PageResponse<>();
    PageUtils.buldPageResponse(studentPageRequest, pageResponse);
    pageResponse.setRows(studentManagerDTOs);
    pageResponse.setRecords(count);
    return pageResponse;
  }
コード例 #14
0
ファイル: FManager.java プロジェクト: iadgov/GRASSMARLIN
  public void saveSettings(Map<String, String> keyValMap, boolean autoLoad) throws IOException {
    Properties p;
    File f;
    if ((f = Environment.getPropertiesFile(FManager.class)).exists()) {
      this.activeFingerprintFileMap.clear();
      try (InputStream is = new FileInputStream(f)) {
        p = new Properties();
        // p.load(is);
        keyValMap
            .entrySet()
            .stream()
            .forEach(
                pair -> {
                  p.setProperty(pair.getKey(), pair.getValue());
                  this.activeFingerprintFileMap.put(
                      new File(pair.getKey()), Boolean.valueOf(pair.getValue()));
                });

        p.setProperty(AUTOLOAD, autoLoad + "");

        // is.close();
        FileOutputStream fos = new FileOutputStream(f);
        p.store(
            fos,
            "Updated "
                + DateFormatUtils.format(
                    System.currentTimeMillis(), ISO_EXTENDED_FORMAT_PATTERN, Locale.ENGLISH));
        try {
          fos.close();
        } catch (Exception ex) {
        }
      }
    } else {
      throw new IOException("Cannot store properties.");
    }
  }
コード例 #15
0
ファイル: FManager.java プロジェクト: iadgov/GRASSMARLIN
 public static void saveSetting(String key, String val) throws IOException {
   Properties p;
   File f;
   if ((f = Environment.getPropertiesFile(FManager.class)).exists()) {
     try (InputStream is = new FileInputStream(f)) {
       p = new Properties();
       p.load(is);
       p.setProperty(key, val);
       is.close();
       FileOutputStream fos = new FileOutputStream(f);
       p.store(
           fos,
           "Updated "
               + DateFormatUtils.format(
                   System.currentTimeMillis(), ISO_EXTENDED_FORMAT_PATTERN, Locale.ENGLISH));
       try {
         fos.close();
       } catch (Exception ex) {
       }
     }
   } else {
     throw new IOException("Cannot store properties.");
   }
 }
コード例 #16
0
  private String getFormatDate(String infmt, String date, String outfmt) throws ParseException {
    if (date == null || date.length() <= 0) {
      return "";
    }
    if (date.length() == 1) {
      Date today = Calendar.getInstance().getTime();
      return DateFormatUtils.format(today, outfmt);
    } else {
      int plus = date.indexOf('+');
      int minus = date.indexOf('-');
      if (plus > 0 || minus > 0) {
        Date today = Calendar.getInstance().getTime();
        String type = date.substring(0, 1);
        String sign = date.substring(1, 2);
        int amount = 0;
        try {
          amount = Integer.parseInt(date.substring(2));
        } catch (NumberFormatException e) {
          LOG.error("Exception", e);
          return null;
        }
        if (("+").equals(sign)) {
          if (("D").equals(type)) {
            return DateFormatUtils.format(DateUtils.addDays(today, amount), outfmt);
          } else if (("M").equals(type)) {
            return DateFormatUtils.format(DateUtils.addMonths(today, amount), outfmt);
          } else if (("Y").equals(type)) {
            return DateFormatUtils.format(DateUtils.addYears(today, amount), outfmt);
          }
        } else if (("-").equals(sign)) {
          if (("D").equals(type)) {
            return DateFormatUtils.format(DateUtils.addDays(today, -amount), outfmt);
          } else if (("M").equals(type)) {
            return DateFormatUtils.format(DateUtils.addMonths(today, -amount), outfmt);
          } else if (("Y").equals(type)) {
            return DateFormatUtils.format(DateUtils.addYears(today, -amount), outfmt);
          }
        } else {
          return null;
        }
      }
    }

    // date 형식이  infmt 에 맞지 않다면 date 를 infmt 에 맞추어줌.
    StringBuilder sDate = new StringBuilder(date);
    int len = date.length();

    if (("yyyyMMddHHmm").equals(infmt) && len < 12) {
      for (int i = len; i < 12; i++) {
        sDate.append("0");
      }
    } else if (("yyyyMMddHHmmss").equals(infmt) && len < 14) {
      for (int i = len; i < 14; i++) {
        sDate.append("0");
      }
    }

    SimpleDateFormat sdf = new SimpleDateFormat(infmt);
    Date d = sdf.parse(sDate.toString());
    sdf.applyPattern(outfmt);

    return sdf.format(d);
  }
コード例 #17
0
 /** 这个时刻是不是录入学生后,现在以8月1日为准,超过此日期返回true */
 private boolean isPastHalf(Date now) {
   String monthDay = DateFormatUtils.format(now, "MMdd");
   return monthDay.compareTo(ClassConstants.YEAR_SEPARATOR) >= 0;
 }
コード例 #18
0
ファイル: DateUtils.java プロジェクト: c3h8moon/agent
 /** 得到日期时间字符串,转换格式(yyyyMM) */
 public static String formatDateYearAndMonth(Date date) {
   return DateFormatUtils.format(date, "yyyyMM");
 }
コード例 #19
0
ファイル: DateUtils.java プロジェクト: Allan1310/maf
 /** 得到当前日期字符串 格式(yyyy-MM-dd) pattern可以为:"yyyy-MM-dd" "HH:mm:ss" "E" */
 public static String getDate(String pattern) {
   return DateFormatUtils.format(new Date(), pattern);
 }
コード例 #20
0
ファイル: TimeUtils.java プロジェクト: frankzhf/dream
 /**
  * 使用日期对象构造时间
  *
  * @param date
  */
 public TimeUtils(Date date) {
   this(DateFormatUtils.formatUTC(date, "HH:mm:ss"));
 }
コード例 #21
0
 public static String dateformat(long ctime) {
   return DateFormatUtils.format(ctime, "MM/dd/yyyy HH:mm:ss");
 }
コード例 #22
0
  @RequestMapping(value = "hunter/addressbooks/attachment/{id}", method = RequestMethod.GET)
  public Object getAttachments(@PathVariable Long id, @RequestParam String filename) {
    Addressbook book = addressbookService.getAttachment(id);
    int times = book.getDownloadtimes();
    String today = DateFormatUtils.format(new Date(), "yyyy-MM-dd");
    boolean isToday = today.equals(book.getDownloaddate());

    if (isToday && times == 10) {
      try {
        String msg = new String("此目标公司通讯录今天下载次数已达10次,不能继续下载".getBytes("UTF-8"), "iso-8859-1");
        return new ResponseEntity<>(msg, HttpStatus.OK);
      } catch (UnsupportedEncodingException e) {
        throw new RuntimeException(e);
      }
    }
    boolean downloadStatus = false;
    Map<String, Object> map = new HashMap<String, Object>();
    map.put("id", id);

    while (!isToday || (isToday && times <= 10)) {
      map.put("downloaddate", book.getDownloaddate());
      map.put("downloadtimes", times);
      if (!isToday) {
        map.put("newdate", today);
        map.put("newtimes", 1);
      } else {
        map.put("newtimes", times + 1);
      }
      if (addressbookService.updateDownloadtimes(map) > 0) {
        downloadStatus = true;
        break;
      }
      book = addressbookService.getAttachment(id);
      times = book.getDownloadtimes();
      isToday = today.equals(book.getDownloaddate());
    }
    if (!downloadStatus) {
      try {
        String msg = new String("此目标公司通讯录今天下载次数已达10次,不能继续下载".getBytes("UTF-8"), "iso-8859-1");
        return new ResponseEntity<>(msg, HttpStatus.OK);
      } catch (UnsupportedEncodingException e) {
        throw new RuntimeException(e);
      }
    }

    addressbookService.insertDownloadLog(id, filename, book.getCompanyName());

    String pathname = book.getAttachmentPath() + filename;
    File file = new File(pathname);
    HttpHeaders headers = new HttpHeaders();

    try {
      String fileName = new String(filename.getBytes("UTF-8"), "iso-8859-1"); // 为了解决中文名称乱码问题
      headers.setContentDispositionFormData("attachment", fileName);
      headers.setContentType(MediaType.APPLICATION_OCTET_STREAM);
      return new ResponseEntity<byte[]>(
          FileUtils.readFileToByteArray(file), headers, HttpStatus.OK);
    } catch (IOException e) {
      throw new RuntimeException(e);
    }
  }