I am trying to create a plug-in for converting a file that is stored in a consta

I am trying to create a plug-in for converting a file that is stored in a constant of type document to hashcode using eclipse. But whenever I am calling the custom function in expression rule by passing the same constant as parameter I am getting an error: "Expression evaluation error at function 'hashcode': Error evaluating function 'hashcode' : (Result too large)". When do we get such an error?

OriginalPostID-223509

OriginalPostID-223509

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer
    1. You are passing Appian document directly to the FileReader, which accepts only type of java.io.File.
    2. Please use ContentService class to play with the any document in Appian.
    3. Make use of exception handling with try,catch blocks in your code. so that your exceptions will be handled correctly.
    4. Use the Logger class object to log the exception messages in log file.
    5. The BufferedReader object should be closed after completion of reading the file. Use r.close() at the end or finally block.
    otherwiise it will cause the (Result too large) issue

    Try with the below code

    ContentService cs = ServiceLocator.getContentService(sc);
                        try{
                                  
                                  String fileName = cs.getInternalFilename(cs.getVersionId(param0, ContentConstants.VERSION_CURRENT));
                                  BufferedReader r = new BufferedReader(new FileReader(new File(fileName)));
                                  //your logic
                                  }catch(Exception e){
                                  LOG.error(e);
                         }

                                  Please take the reference from other plugins, which are related to the documents. It will be helpful to you to get out of the initial Appian document usage issues.
Reply
  • 0
    Certified Lead Developer
    1. You are passing Appian document directly to the FileReader, which accepts only type of java.io.File.
    2. Please use ContentService class to play with the any document in Appian.
    3. Make use of exception handling with try,catch blocks in your code. so that your exceptions will be handled correctly.
    4. Use the Logger class object to log the exception messages in log file.
    5. The BufferedReader object should be closed after completion of reading the file. Use r.close() at the end or finally block.
    otherwiise it will cause the (Result too large) issue

    Try with the below code

    ContentService cs = ServiceLocator.getContentService(sc);
                        try{
                                  
                                  String fileName = cs.getInternalFilename(cs.getVersionId(param0, ContentConstants.VERSION_CURRENT));
                                  BufferedReader r = new BufferedReader(new FileReader(new File(fileName)));
                                  //your logic
                                  }catch(Exception e){
                                  LOG.error(e);
                         }

                                  Please take the reference from other plugins, which are related to the documents. It will be helpful to you to get out of the initial Appian document usage issues.
Children
No Data