Appian Community
Site
Search
Sign In/Register
Site
Search
User
DISCUSS
LEARN
SUCCESS
SUPPORT
Documentation
AppMarket
More
Cancel
I'm looking for ...
State
Not Answered
Replies
13 replies
Subscribers
6 subscribers
Views
4460 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
Plug-Ins
I am trying to create a plug-in for converting a file that is stored in a consta
amitas
over 8 years ago
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
Top Replies
Vinod Bongoni
over 8 years ago
+1
Certified Lead Developer
If we choose function output type is an integer and multiple then the Long[] type will be the return object from the java method. Please find the attached code, which is updated and it is working fine…
Parents
0
Vinod Bongoni
Certified Lead Developer
over 8 years ago
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.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
Reply
0
Vinod Bongoni
Certified Lead Developer
over 8 years ago
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.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
Children
No Data