Menu

"zero service" error

Developers
2005-09-29
2012-10-08
  • Andras Nagy

    Andras Nagy - 2005-09-29

    Hi,
    Maybe someone can help me. I get a:
    "Zero service while at recoder.java.declaration.TypeDeclaration.getMethods(TypeDeclaration.java)"
    error when calling getMethods() on a TypeDeclaration instance. The relevant code snippet is:

    ServiceConfiguration config=new DefaultServiceConfiguration();
    ProjectSettings settings=config.getProjectSettings();
    PathList pathList=settings.getSearchPathList();
    pathList.add("/usr/local/share/jdk1.3.1_02/src");
    SourceFileRepository rep=config.getSourceFileRepository();
    rep.getAllCompilationUnitsFromPath();
    SourceInfo si =config.getSourceInfo();

    CompilationUnit cu = rep.getCompilationUnit(CLASS_TO_TEST);

    TypeDeclaration typeDeclaration= cu.getPrimaryTypeDeclaration();
    MethodList methods=typeDeclaration.getMethods();

    Does anyone have any idea what I'm doing wrong? Thank you in advance.
    Andras

     
    • Barthelemy Dagenais

      I just began to play with recoder and I ran into this problem too.

      This is in fact not an error but a logging information located in TypeDeclaration:

      if (service == null) {
      Debug.log("Zero service while " + Debug.makeStackTrace());
      updateModel();
      }

      If you want to avoid this message, you may change the source code or you may call the updateModel() method of the ChangeHistory instance just before retrieving the methods :

      config.getChangeHistory().updateModel();

      I guess recoder should use a more standard logger such as log4j or commons logging to allow the user to choose the appropriate logging level.

       
    • Andras Nagy

      Andras Nagy - 2005-11-03

      Hi Barthelemy,
      Thanks a lot for your help, you were right.
      Andras

       
    • Andras Nagy

      Andras Nagy - 2005-09-29

      I've forgot to add that afterwards it seems to work though (the methods are returned), I just don't know why I'm getting the error message.

      thanks,
      Andras

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.