juliocamarero/liferay-portal — pull request #1933 by matethurzo (2013-06-12 15:23:05+00:00)
Title: LPS-34802 Fixing import errors

Hey Julio,

I fixed the problem for when importing a LAR file. The issue was that the LAR file was put on the disk with a path like this: //. So it was something d:\liferay\data\document_library\10123\5\1.0 where the "5" was the file name and the 1.0 is the version. For some reason I don't know this is how the API works it's giving the file a new name.

This is all fine, but since we are renaming the file to the original name (Public_Pages_2013000.lar) the API was looking for the mentioned path, however it should have looked on this path: d:\liferay\data\document_library\10123\5\Public_Pages_2013000.lar.

So after all the root cause of the problem was that we were querying up the physical file in a wrong way. I've introduced a method which can get a file based on a FileEntry. And I've also applied some refactoring to the code.

Dániel and I were thinking about what could cause the problem on Windows and not on Mac, and we think (but that's just a theory) that probably the file handling is different on the two systems (probably the JVM implementation as well regarding this) and we are creating temp files, moving, renaming that could have caused the problem here.

Also I've noticed that there are actually two places where we are renaming the file itself. I think it's unnecessary or at least feels strange, but I also think that's been introduced because you had problems with the renamed file due to the reasons described above. So I've removed that code piece, it should work now, but it would be great if you could validate it. On windows it's working now.

Thanks,

Máté

cc: @KocsisDániel