Open ingomohr opened 3 years ago
hi @ingomohr I am beginner to opensource but I would like to contribute to the issue if it is open. Can you help me?
Hi @Ejaz29! Thank you for getting in touch.
Are you familiar with Java projects? I could also provide you with a small how-to on how to on working on the project - if you think that could help you.
I just re-reviewed the code and I think there actually is less to do than I thought when I created this issue. Well, that could be good for you if you wanted to take the opportunity to have something small to contribute. ;)
Let's say you have the following code in some Java class:
This is the simplest way of using the SimpleDocxProcessor
. It will create a new *.docx file containing only
"Hello world!"
SimpleDocxProcessor processor = new SimpleDocxProcessor();
// processor.createDocument();
processor.addMarkdown("Hello **world**!");
try {
File tempFile = File.createTempFile("docwriter-eclipse-test", ".docx");
processor.saveDocumentToPath(tempFile);
} catch (IOException e) {
// log
}
Actually, it won't create that file - and that is because the createDocument()
method is not called. A document, however, is required to exist - either by creating one or by loading one.
Executing the snippet above in a (Java class with a main method) will produce a NullPointerException
with following message.
"No document found. See createDocument() and loadDocument() methods."
When I created this issue, I missed that I already had added some hint to the doc creation - the "See createDocument()...". But I would like to have both the exception type and the message changed - and here is why:
My suggestion is to
NullPointerException
with an IllegalStateException
org.ingomohr.docwriter.docx.TestSimpleDocxProcessor
.SimpleDocxProcessor
in its class javadoc.@Ejaz29 I you have some other suggestion or thoughts on the issue you want to share, I would appreciate that. :)
Thank you for the detailed explanation @ingomohr :) I will work on it. You can also provide me with how to work on a project that would be really helpful. Thank you.
@Ejaz29 Are you sure? I see a test class by that name. 😉
The goal for this issue is to update the test to the new expectation (as suggested above) and to update the code so that all tests pass again.
Generally, this is what you can do:
Sorry @ingomohr I didn't notice. I am good in java but do not have even basic understanding of maven and JUnit5. So if someone else want to contribute they can. I will still be lurking around waiting for the right issue for me to contribute in your repo. :) Thank you for the detailed explanation and I am sorry to waste your time.
Hey @Ejaz29, thanks for the update. And you didn't waste my time, don't worry. :) Should you change your mind: I won't have time to resolve this issue myself before tomorrow evening.
In
SimpleDocxProcessor
, when you work on a document and you didn't create one before, the error message just points out that there is no doc yet. It doesn't, however, point out how to create one - e.g. via methodcreateDocument()
.The task is to improve the error message to give a hint on how to create the document.