fix: change `No @startuml/@enduml found` message to `No valid @start/@end found, please check the version` for more readability

- [x] Rename `noStartumlFound` function to `noValidStartFound`
- [x] Rename `No @startuml/@enduml found` message to `No valid @start/@end found, please check the version`

Notes:
- Impact also the PicoWebserver;
- _For future enhancement perhaps use `resource` or list of message instead of repeating a message in many different places..._
This commit is contained in:
The-Lum 2023-08-28 15:30:27 +00:00
parent 90198c40d8
commit 5149c49858
3 changed files with 7 additions and 7 deletions

View File

@ -154,7 +154,7 @@ public class SourceStringReader {
public DiagramDescription outputImage(OutputStream os, int numImage, FileFormatOption fileFormatOption)
throws IOException {
if (blocks.size() == 0) {
noStartumlFound(os, fileFormatOption);
noValidStartFound(os, fileFormatOption);
return null;
}
for (BlockUml b : blocks) {
@ -230,8 +230,8 @@ public class SourceStringReader {
}
public ImageData noStartumlFound(OutputStream os, FileFormatOption fileFormatOption) throws IOException {
final TextBlock error = GraphicStrings.createForError(Arrays.asList("No @startuml/@enduml found"),
public ImageData noValidStartFound(OutputStream os, FileFormatOption fileFormatOption) throws IOException {
final TextBlock error = GraphicStrings.createForError(Arrays.asList("No valid @start/@end found, please check the version"),
fileFormatOption.isUseRedForError());
return plainImageBuilder(error, fileFormatOption).write(os);

View File

@ -269,9 +269,9 @@ public class PicoWebServer implements Runnable {
if (ssr.getBlocks().size() == 0) {
system = PSystemErrorUtils.buildV2(null,
new ErrorUml(SYNTAX_ERROR, "No @startuml/@enduml found", 0, new LineLocationImpl("", null)), null,
new ErrorUml(SYNTAX_ERROR, "No valid @start/@end found, please check the version", 0, new LineLocationImpl("", null)), null,
Collections.<StringLocated>emptyList());
imageData = ssr.noStartumlFound(os, option.getFileFormatOption());
imageData = ssr.noValidStartFound(os, option.getFileFormatOption());
} else {
system = ssr.getBlocks().get(0).getDiagram();
imageData = system.exportDiagram(os, 0, option.getFileFormatOption());

View File

@ -197,13 +197,13 @@ public class PicoWebServerTest {
response = httpPostJson("/render", renderRequestJson("@startuml", "-ttxt"));
assert response.getResponseCode() == 200;
assert response.getHeaderField("X-PlantUML-Diagram-Error").equals("No @startuml/@enduml found");
assert response.getHeaderField("X-PlantUML-Diagram-Error").equals("No valid @start/@end found, please check the version");
assert response.getHeaderField("X-PlantUML-Diagram-Error-Line").equals("0");
assert response.getContentType().equals("text/plain");
assert readStreamAsString(response.getInputStream()).equals("" +
" \n" +
" \n" +
" No @startuml/@enduml found\n"
" No valid @start/@end found, please check the version\n"
);
response = httpPostJson("/render", "");