-
Notifications
You must be signed in to change notification settings - Fork 217
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#54 - Handle file size not enough in case of embed watermark operatio…
…n. Also handle case where some files fails processing during wildcard operations.
- Loading branch information
Samir Vaidya
committed
Sep 25, 2022
1 parent
b0377ff
commit 9c86c50
Showing
11 changed files
with
174 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
src/main/java/com/openstego/desktop/OpenStegoBulkException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/* | ||
* Steganography utility to hide messages into cover files | ||
* Author: Samir Vaidya (mailto:[email protected]) | ||
* Copyright (c) Samir Vaidya | ||
*/ | ||
|
||
package com.openstego.desktop; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
/** | ||
* Custom exception class to store multiple errors | ||
*/ | ||
public class OpenStegoBulkException extends Exception { | ||
|
||
/** | ||
* List of keys for the exception | ||
*/ | ||
private final List<String> keys = new ArrayList<>(); | ||
/** | ||
* List of exceptions | ||
*/ | ||
private final List<OpenStegoException> exceptions = new ArrayList<>(); | ||
|
||
/** | ||
* Add an exception to this bulk list | ||
* | ||
* @param key Key for the exception (e.g. filename) | ||
* @param e Exception to be added | ||
*/ | ||
public void add(String key, OpenStegoException e) { | ||
keys.add(key); | ||
exceptions.add(e); | ||
} | ||
|
||
/** | ||
* Return the current list of keys | ||
*/ | ||
public List<String> getKeys() { | ||
return keys; | ||
} | ||
|
||
/** | ||
* Return the current list of exceptions | ||
*/ | ||
public List<OpenStegoException> getExceptions() { | ||
return exceptions; | ||
} | ||
|
||
/** | ||
* Throw this exception if list is not empty | ||
*/ | ||
public void throwIfRequired() throws OpenStegoBulkException { | ||
if (!exceptions.isEmpty()) { | ||
throw this; | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters