コード例 #1
0
 private EntitySpec<? extends Application> createEntitySpecForApplication(String potentialYaml) {
   try {
     return EntityManagementUtils.createEntitySpecForApplication(mgmt(), potentialYaml);
   } catch (Exception e) {
     // An IllegalArgumentException for creating the entity spec gets wrapped in a ISE, and
     // possibly a Compound.
     // But we want to return a 400 rather than 500, so ensure we throw IAE.
     IllegalArgumentException iae =
         (IllegalArgumentException)
             Exceptions.getFirstThrowableOfType(e, IllegalArgumentException.class);
     if (iae != null) {
       throw new IllegalArgumentException("Cannot create spec for app: " + iae.getMessage(), e);
     } else {
       throw Exceptions.propagate(e);
     }
   }
 }
コード例 #2
0
 private EntitySpec<? extends Application> createAppSpec(String... lines) {
   return EntityManagementUtils.createEntitySpecForApplication(mgmt(), joinLines(lines));
 }