TextDescriptor#getText: @NotNull

GitOrigin-RevId: 52a7b9b227104d11370f40c387c59ee4a942fc3c
This commit is contained in:
Tagir Valeev
2019-10-10 08:32:56 +00:00
committed by intellij-monorepo-bot
parent a926913886
commit 34aa95a47e
3 changed files with 7 additions and 1 deletions
@@ -35,10 +35,14 @@ class ResourceTextDescriptor implements TextDescriptor {
return Objects.hash(myLoader, myResourcePath);
}
@NotNull
@Override
public String getText() throws IOException {
InputStream stream = myLoader.getResourceAsStream(myResourcePath);
return stream != null ? ResourceUtil.loadText(stream) : null;
if (stream == null) {
throw new IOException("Resource not found: " + myResourcePath);
}
return ResourceUtil.loadText(stream);
}
@NotNull
@@ -24,6 +24,7 @@ import java.io.IOException;
* @author yole
*/
public interface TextDescriptor {
@NotNull
String getText() throws IOException;
@NotNull
String getFileName();
@@ -67,6 +67,7 @@ public final class PostfixTemplateMetaData extends BeforeAfterActionMetaData {
List<TextDescriptor> list = new ArrayList<>(before.length);
for (final TextDescriptor descriptor : before) {
list.add(new TextDescriptor() {
@NotNull
@Override
public String getText() throws IOException {
return StringUtil.replace(descriptor.getText(), KEY, key);