-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FileSystemPipe more exits #6740
Conversation
…nues teardown all the way.
…ouched in this PR Begin updating tests for FileSystemPipe.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You've really vacuumed a lot of code, but I think those are good improvements. Thanks Tim!
filesystem/src/test/java/org/frankframework/filesystem/smb/Samba2FileSystemTestHelper.java
Show resolved
Hide resolved
@@ -63,13 +62,13 @@ public static <F> void checkSource(IBasicFileSystem<F> fileSystem, F source, Fil | |||
public static <F> void prepareDestination(IWritableFileSystem<F> fileSystem, F destination, boolean overwrite, int numOfBackups, FileSystemAction action) throws FileSystemException { | |||
if (fileSystem.exists(destination)) { | |||
if (overwrite) { | |||
log.debug("removing current destination file ["+fileSystem.getCanonicalName(destination)+"]"); | |||
log.debug("removing current destination file [{}]", fileSystem.getCanonicalName(destination)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Het ophalen van de canonical name kan voor extra compute zorgen bij sommige fs impl.
log.debug("removing current destination file [{}]", fileSystem.getCanonicalName(destination)); | |
log.debug("removing current destination file [{}]", () -> fileSystem.getCanonicalName(destination)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dat kan niet, want fileSystem.getCanonicalName(x)
kan een exception gooien.
Het zou dan dit moeten worden (Wat de log ook veiliger maakt, natuurlijk):
log.debug("removing current destination file [{}]", fileSystem.getCanonicalName(destination)); | |
log.debug("removing current destination file [{}]", ()-> { | |
try { | |
return fileSystem.getCanonicalName(destination); | |
} catch (FileSystemException e) { | |
return "<Cannot get canonical name for destination file>"; | |
} | |
}); |
Eigenlijk is dit wel een issue. Want ik zie dat er verschillende exceptions zijn, waar we deze method ook gebruiken. Dan gaan we straks fouten verbergen met een fout uit deze method... Dat is niet goed.
Ik ga hier wat meer structureels aan doen misschien, een method getNameSafe()
of zoiets.
filesystem/src/main/java/org/frankframework/filesystem/LocalFileSystem.java
Show resolved
Hide resolved
@@ -109,13 +109,18 @@ public OutputStream appendFile(Path f) throws IOException { | |||
|
|||
@Override | |||
public Message readFile(Path f, String charset) throws FileSystemException { | |||
if (!f.toFile().exists()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (!f.toFile().exists()) { | |
if (!Files.exists(p)) { |
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
f
, of p
?
filesystem/src/test/java/org/frankframework/filesystem/FileSystemActorTest.java
Show resolved
Hide resolved
filesystem/src/test/java/org/frankframework/filesystem/FileSystemSenderTest.java
Show resolved
Hide resolved
filesystem/src/test/java/org/frankframework/filesystem/FileSystemSenderTest.java
Show resolved
Hide resolved
@Override | ||
void close() throws SenderException; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ik heb ooit #5045 aangemaakt om open/close te vervangen door start en stop. Mocht een pipe/sender dan zelf toch nog AutoCloseable willen implementeren dan kan dat maar het moet niet een verplichting zijn.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
En wil je deze AutoClosable nog weghalen of...?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ik vind eigenlijk de AutoClosable of een sender nog steeds wel logisch, maar nu weggehaald, zie commit:
cbd3334
filesystem/src/main/java/org/frankframework/filesystem/FileSystemActor.java
Outdated
Show resolved
Hide resolved
filesystem/src/main/java/org/frankframework/filesystem/FileSystemActor.java
Show resolved
Hide resolved
filesystem/src/main/java/org/frankframework/filesystem/FileSystemException.java
Show resolved
Hide resolved
filesystem/src/main/java/org/frankframework/filesystem/IMailFileSystem.java
Outdated
Show resolved
Hide resolved
# Conflicts: # filesystem/src/main/java/org/frankframework/filesystem/FileSystemActor.java
…fix only in LocalFileSystem. Add test to validate behaviour in various scenarios, that were failing before.
…y their temp files, and also test the scenario of root folder that doesn't yet exist before opening the Local FS.
* @param f File for which to try to get canonical name | ||
* @return Either the canonical name of the file, or an error. | ||
*/ | ||
default String getCanonicalNameOrError(F f) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
default String getCanonicalNameOrError(F f) { | |
default String getCanonicalNameOrErrorMessage(F f) { |
Otherwise it might suggest that it gives a canonical name or throws an error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ben ik met je eens, die twijfel had ik ook. Maar dit is wel heel lang. Ik dacht aan getCanonicalNameForLog()
maar het is niet alleen voor logging, ook voor error messages, dus dat denkt het ook niet.
Eigenlijk vind ik alle namen voor deze method lelijk. Ik houd me open voor betere suggesties.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getCanonicalNameSafely
perhaps.
Or getCanonicalNameWithoutDisappointingUncleBob
😉
filesystem/src/test/java/org/frankframework/filesystem/LocalFileSystemActorTest.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ik vind nog steeds de closeable op ISender een beetje vreemd
throw new SenderException(e); | ||
String forwardName = e.getForward().getForwardName(); | ||
|
||
log.error("Error from FileSystemActor, will return forward name [{}]",forwardName, e); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
log.error("Error from FileSystemActor, will return forward name [{}]",forwardName, e); | |
log.info("error from FileSystemActor, will call forward name [{}]",forwardName, e); |
Error level is wel heel erg bot.. dat hoeft toch niet?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Je hebt helemaal gelijk. Ik weet niet waarom daar log.error()
stond.
@Override | ||
void close() throws SenderException; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
En wil je deze AutoClosable nog weghalen of...?
…4933_FileSystemPipeExits # Conflicts: # filesystem/src/main/java/org/frankframework/filesystem/FileSystemActor.java # filesystem/src/main/java/org/frankframework/filesystem/LocalFileSystem.java # filesystem/src/test/java/org/frankframework/filesystem/FileSystemActorTest.java # filesystem/src/test/java/org/frankframework/filesystem/LocalFileSystemActorTest.java
Quality Gate failedFailed conditions See analysis details on SonarCloud Catch issues before they fail your Quality Gate with our IDE extension SonarLint |
@@ -1,5 +1,5 @@ | |||
/* | |||
Copyright 2019 Integration Partners | |||
Copyright 2019, 2024 Integration Partners |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copyright 2019, 2024 Integration Partners | |
Copyright 2019, 2024 WeAreFrank! |
No description provided.