Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,465,146
Community Members
 
Community Events
176
Community Groups

How to fetch the Text file Using java code stored in resource folder of Jira Custom plugin .

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;

}

 

 

image.png

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events