Examples of GenericException


Examples of com.alibaba.dubbo.rpc.service.GenericException

                }
                args = PojoUtils.realize(args, params, method.getGenericParameterTypes());
                Result result = invoker.invoke(new RpcInvocation(method, args, inv.getAttachments()));
                if (result.hasException()
                        && ! (result.getException() instanceof GenericException)) {
                    return new RpcResult(new GenericException(result.getException()));
                }
                return new RpcResult(PojoUtils.generalize(result.getResult()));
            } catch (NoSuchMethodException e) {
                throw new RpcException(e.getMessage(), e);
            } catch (ClassNotFoundException e) {
View Full Code Here

Examples of com.alibaba.dubbo.rpc.service.GenericException

                    return new RpcResult(PojoUtils.realize(value, method.getReturnType(), method.getGenericReturnType()));
                } catch (NoSuchMethodException e) {
                    throw new RpcException(e.getMessage(), e);
                }
            } else if (result.getException() instanceof GenericException) {
                GenericException exception = (GenericException) result.getException();
                try {
                    String className = exception.getExceptionClass();
                    Class<?> clazz = ReflectUtils.forName(className);
                    Throwable targetException = null;
                    Throwable lastException = null;
                    try {
                        targetException = (Throwable) clazz.newInstance();
                    } catch (Throwable e) {
                        lastException = e;
                        for (Constructor<?> constructor : clazz.getConstructors()) {
                            try {
                                targetException = (Throwable) constructor.newInstance(new Object[constructor.getParameterTypes().length]);
                                break;
                            } catch (Throwable e1) {
                                lastException = e1;
                            }
                        }
                    }
                    if (targetException != null) {
                        try {
                            Field field = Throwable.class.getDeclaredField("detailMessage");
                            if (! field.isAccessible()) {
                                field.setAccessible(true);
                            }
                            field.set(targetException, exception.getExceptionMessage());
                        } catch (Throwable e) {
                            logger.warn(e.getMessage(), e);
                        }
                        result = new RpcResult(targetException);
                    } else if (lastException != null) {
                        throw lastException;
                    }
                } catch (Throwable e) {
                    throw new RpcException("Can not deserialize exception " + exception.getExceptionClass() + ", message: " + exception.getExceptionMessage(), e);
                }
            }
            return result;
        }
        return invoker.invoke(invocation);
View Full Code Here

Examples of com.alibaba.dubbo.rpc.service.GenericException

                }
                args = PojoUtils.realize(args, params);
                Result result = invoker.invoke(new RpcInvocation(method, args, inv.getAttachments()));
                if (result.hasException()
                        && ! (result.getException() instanceof GenericException)) {
                    return new RpcResult(new GenericException(result.getException()));
                }
                return new RpcResult(PojoUtils.generalize(result.getResult()));
            } catch (NoSuchMethodException e) {
                throw new RpcException(e.getMessage(), e);
            } catch (ClassNotFoundException e) {
View Full Code Here

Examples of com.alibaba.dubbo.rpc.service.GenericException

                    return new RpcResult(PojoUtils.realize(value, invoker.getInterface().getMethod(methodName, parameterTypes).getReturnType()));
                } catch (NoSuchMethodException e) {
                    throw new RpcException(e.getMessage(), e);
                }
            } else if (result.getException() instanceof GenericException) {
                GenericException exception = (GenericException) result.getException();
                try {
                    String className = exception.getExceptionClass();
                    Class<?> clazz = ReflectUtils.forName(className);
                    Throwable targetException = null;
                    Throwable lastException = null;
                    try {
                        targetException = (Throwable) clazz.newInstance();
                    } catch (Throwable e) {
                        lastException = e;
                        for (Constructor<?> constructor : clazz.getConstructors()) {
                            try {
                                targetException = (Throwable) constructor.newInstance(new Object[constructor.getParameterTypes().length]);
                                break;
                            } catch (Throwable e1) {
                                lastException = e1;
                            }
                        }
                    }
                    if (targetException != null) {
                        try {
                            Field field = Throwable.class.getDeclaredField("detailMessage");
                            if (! field.isAccessible()) {
                                field.setAccessible(true);
                            }
                            field.set(targetException, exception.getExceptionMessage());
                        } catch (Throwable e) {
                            logger.warn(e.getMessage(), e);
                        }
                        result = new RpcResult(targetException);
                    } else if (lastException != null) {
                        throw lastException;
                    }
                } catch (Throwable e) {
                    throw new RpcException("Can not deserialize exception " + exception.getExceptionClass() + ", message: " + exception.getExceptionMessage(), e);
                }
            }
            return result;
        }
        return invoker.invoke(invocation);
View Full Code Here

Examples of com.m4f.web.controller.exception.GenericException

      PageManager<Course> paginator = new PageManager<Course>();
      paginator.setOffset(this.getPageSize());
      paginator.setUrlBase("/" + locale.getLanguage()+ "/catalog/reglated/course/list");
      paginator.setSize(this.serviceLocator.getCourseService().countCourses(true, locale));
      if((page-1)*paginator.getOffset() > paginator.getSize()) {
        throw new GenericException("Paginator Out of Range!!! Size: " + paginator.getSize() + " start: " + (page-1)*paginator.getOffset());
      }
      paginator.setStart((page-1)*paginator.getOffset());
      paginator.setCollection(this.serviceLocator.getCourseService().getCourses(true,
          "-" + ORDERING_PROPERTY, locale, paginator.getStart(), paginator.getEnd()));
      model.addAttribute("paginator", paginator);
      model.addAttribute("type", "reglated");
    } catch(Exception e) {
      throw new GenericException(e);
    }
    return "catalog.course.list";
  }
View Full Code Here

Examples of com.m4f.web.controller.exception.GenericException

      PageManager<Course> paginator = new PageManager<Course>();
      paginator.setOffset(this.getPageSize());
      paginator.setUrlBase("/" + locale.getLanguage()+ "/catalog/non-reglated/course/list");
      paginator.setSize(this.serviceLocator.getCourseService().countCourses(false, locale));
      if((page-1)*paginator.getOffset() > paginator.getSize()) {
        throw new GenericException("Paginator Out of Range!!! Size: " + paginator.getSize() + " start: " + (page-1)*paginator.getOffset());
      }
      paginator.setStart((page-1)*paginator.getOffset());
      paginator.setCollection(this.serviceLocator.getCourseService().getCourses(false,
          "-" + ORDERING_PROPERTY, locale, paginator.getStart(), paginator.getEnd()));
      model.addAttribute("paginator", paginator);
      model.addAttribute("type", "non-reglated");
    } catch(Exception e) {
      throw new GenericException(e);
    }
    return "catalog.course.list";
  }
View Full Code Here

Examples of com.m4f.web.controller.exception.GenericException

      model.addAttribute("town", courseData.get("town"));
      model.addAttribute("tags", courseData.get("tags"));
     
      response.addDateHeader("Last-Modified", course.getStart() != null ? course.getStart().getTime() : course.getUpdated().getTime());
    } catch(Exception e) {
      throw new GenericException(e);
    }
    return "search.result.detail";
  }
View Full Code Here

Examples of com.m4f.web.controller.exception.GenericException

           
      LOGGER.severe("Date: " + calendar.getTime());
     
      paginator.setSize(this.serviceLocator.getCourseService().countUpdatedCourses(calendar.getTime(), true));
      if((page-1)*paginator.getOffset() > paginator.getSize()) {
        throw new GenericException("Paginator Out of Range!!! Size: " + paginator.getSize() + " start: " + (page-1)*paginator.getOffset());
      }
      paginator.setStart((page-1)*paginator.getOffset());
      paginator.setCollection(this.serviceLocator.getCourseService().getUpdatedCourses(calendar.getTime(), true,
          "-" + ORDERING_PROPERTY, locale, paginator.getStart(), paginator.getEnd()));
      /*paginator.setCollection(this.serviceLocator.getCourseService().getCourses(true,
          "-" + ORDERING_PROPERTY, locale, paginator.getStart(), paginator.getEnd())); */
      model.addAttribute("paginator", paginator);
      model.addAttribute("type", "reglated");
     
      response.addDateHeader("Last-Modified", calendar.getTimeInMillis());
    } catch(Exception e) {
      throw new GenericException(e);
    }
    return "catalog.course.list";
  }
View Full Code Here

Examples of com.m4f.web.controller.exception.GenericException

                 
      LOGGER.severe("Date: " + calendar.getTime());
     
      paginator.setSize(this.serviceLocator.getCourseService().countUpdatedCourses(calendar.getTime(), false));
      if((page-1)*paginator.getOffset() > paginator.getSize()) {
        throw new GenericException("Paginator Out of Range!!! Size: " + paginator.getSize() + " start: " + (page-1)*paginator.getOffset());
      }
      paginator.setStart((page-1)*paginator.getOffset());
      paginator.setCollection(this.serviceLocator.getCourseService().getUpdatedCourses(calendar.getTime(), false,
          "-" + ORDERING_PROPERTY, locale, paginator.getStart(), paginator.getEnd()));
     
      model.addAttribute("paginator", paginator);
      model.addAttribute("type", "non-reglated");
     
      response.addDateHeader("Last-Modified", calendar.getTimeInMillis());
    } catch(Exception e) {
      throw new GenericException(e);
    }
    return "catalog.course.list";
  }
View Full Code Here

Examples of com.scooterframework.common.exception.GenericException

     * Retrieves the underlying Servlet Request.
     *
     * @return HttpServletRequest
     */
    public HttpServletRequest getHttpServletRequest(){
        if (servletRequest == null) throw new GenericException("HttpServletRequest must be set by framework.");
        return servletRequest;
    }
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.