Whenever you face issues like you are trying to delete some files or folders either manually with windows explorer or via code, then the files may not get deleted.
Situations should be like:
Situations should be like:
- Files already in use (opened in the system) not allowing you to delete it. Resolution - Close the file and try to delete or execute the delete code
- Your code or maven build trying to delete the target folder but not able to. Resolution - Close the target folder or the sub directories of it. Also it can be opened in the command prompt or through some other editor in Git Bash or Git hub OR may be some files inside the target folder might be opened in notepad or Notepad++. Close all and then try to delete. If nothing works, close all applications and try deleting. Last option would be restarting the system.
- Sometimes, java code like Files.deleteQuietly or Files.delete or Files.forceDelete may not work OR may delete some files but a few files may remain undeleted. Resolution - The code through which you are reading the file, the inputstream of it might be remaining open. Close the inputstream after you finish reading or working with the file. This occurs when you are opening so many files in bulk using your code and inputstream might be remaining opened. Close the inputstream. That is, if you are inside a loop and opening/reading new file everytime, just close the inputstream object once you finish working with it in each iteration if you don't need it. This should resolve the problem of few files not getting deleted
- In Alfresco, in document details page, the preview of the document might not be loaded inspite of the document getting previewed correctly after downloading or viewing in browser. Resolution - You might be writing this file in alfresco through ContentWriter and the code to write the file might be improper or incomplete. You can try the following in such situations:
- Put the code sequence like :
- Creating node
- Setting aspects/properties on it (if any)
- writer.guessMimeType()
- writer.guessEncoding()
- writer.putContent(...)
- Instead of writing writer.setMimetype and writer.setEncoding try using above options like writer.guessMimetype() and writer.guessEncoding(). This should fix your problem of content not getting previewed
- If the content in alfresco is not previewed and also even after downloading or viewing it in browser doesnot show the document, then the document itself might be corrupted. Resolution:
- Check the document on your local system itself (from windows explorer) that are you able to open it correctly. The document itself might be corrupted and not able to open.
- If you are able to open doc in windows, but not able to preview after downloading from alfresco then the document should be corrupted after arriving in alfresco itself. Check the code for upload or code of creating content in alfresco. If its your custom code, follow above steps of writing or refer docs.alfresco.com for using ContentWriter and ContentReader object in alfresco for reading/writing content.