You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
How to fetch the Text file Using java code stored in resource folder of Jira Custom plugin .
Tried This Things till Now
Code : Just for Testing
String response = "" ;
FileInputStream fis = null;
try {
response = response + "Try block" ;
fis = new FileInputStream(comments);
} catch (FileNotFoundException e) {
response = response + "Catch block :" + " "+e.toString(); ;
e.printStackTrace();
}
try {
InputStreamReader inStream = new InputStreamReader(fis);
BufferedReader buffer = new BufferedReader(inStream);
// InputStream is = FileReading.class.getClassLoader().getResourceAsStream("comments");
// BufferedReader buffer = new BufferedReader(new InputStreamReader(is));
StringBuilder builder = new StringBuilder();
response = response + "-------- Start-----";
//response = response+ " TRY BLOCK START" ;
String str;
// Condition check via buffer.readLine() method
// holding true upto that the while loop runs
while ((str = buffer.readLine()) != null) {
builder.append(str).append("\n");
}
String s = builder.toString();
s = s.replaceFirst("option1", "NNN");
s = s.replaceFirst("option2", "KKK);
System.out.println(s);
response = response + s+"-------- END-----";
}
catch (Exception e)
{
response = response + "-Exception:"+e.toString();
}
// Returning a string
return " DATA FETCH FROM FILE :"+ "|"+ "|" +response;
}