File tree Expand file tree Collapse file tree 4 files changed +6
-12
lines changed
itext.tests/itext.commons.tests/itext/commons/actions
itext/itext.commons/itext/commons Expand file tree Collapse file tree 4 files changed +6
-12
lines changed Original file line number Diff line number Diff line change @@ -20,11 +20,9 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20
20
You should have received a copy of the GNU Affero General Public License
21
21
along with this program. If not, see <https://www.gnu.org/licenses/>.
22
22
*/
23
- using System ;
24
23
using iText . Commons . Actions . Contexts ;
25
24
using iText . Commons . Actions . Data ;
26
25
using iText . Commons . Ecosystem ;
27
- using iText . Commons . Exceptions ;
28
26
using iText . Test ;
29
27
30
28
namespace iText . Commons . Actions {
@@ -45,10 +43,7 @@ public virtual void ResetMetaInfoForbiddenTest() {
45
43
AbstractContextBasedITextEventTest . BasicAbstractContextBasedITextEvent e = new AbstractContextBasedITextEventTest . BasicAbstractContextBasedITextEvent
46
44
( CommonsProductData . GetInstance ( ) , metaInfoBefore ) ;
47
45
NUnit . Framework . Assert . AreSame ( metaInfoBefore , e . GetMetaInfo ( ) ) ;
48
- Exception exception = NUnit . Framework . Assert . Catch ( typeof ( InvalidOperationException ) , ( ) => e . SetMetaInfo (
49
- metaInfoAfter ) ) ;
50
- NUnit . Framework . Assert . AreEqual ( CommonsExceptionMessageConstant . META_INFO_SHOULDNT_BE_NULL , exception . Message
51
- ) ;
46
+ NUnit . Framework . Assert . IsFalse ( e . SetMetaInfo ( metaInfoAfter ) ) ;
52
47
}
53
48
54
49
private class BasicAbstractContextBasedITextEvent : AbstractContextBasedITextEvent {
Original file line number Diff line number Diff line change @@ -23,7 +23,6 @@ You should have received a copy of the GNU Affero General Public License
23
23
using System ;
24
24
using iText . Commons . Actions . Contexts ;
25
25
using iText . Commons . Actions . Data ;
26
- using iText . Commons . Exceptions ;
27
26
28
27
namespace iText . Commons . Actions {
29
28
/// <summary>Represents a context-based event.</summary>
@@ -51,11 +50,13 @@ public virtual Type GetClassFromContext() {
51
50
52
51
/// <summary>Sets meta info.</summary>
53
52
/// <param name="metaInfo">meta info</param>
54
- public virtual void SetMetaInfo ( IMetaInfo metaInfo ) {
53
+ /// <returns>true if meta info has been set, false otherwise</returns>
54
+ public virtual bool SetMetaInfo ( IMetaInfo metaInfo ) {
55
55
if ( this . metaInfo != null ) {
56
- throw new InvalidOperationException ( CommonsExceptionMessageConstant . META_INFO_SHOULDNT_BE_NULL ) ;
56
+ return false ;
57
57
}
58
58
this . metaInfo = metaInfo ;
59
+ return true ;
59
60
}
60
61
61
62
/// <summary>Obtains stored meta info associated with the event.</summary>
Original file line number Diff line number Diff line change @@ -43,8 +43,6 @@ public sealed class CommonsExceptionMessageConstant {
43
43
44
44
public const String INVALID_USAGE_FORMAT_REQUIRED = "Invalid usage of placeholder \" {0}\" : format is required" ;
45
45
46
- public const String META_INFO_SHOULDNT_BE_NULL = "Meta info shouldn't be null" ;
47
-
48
46
public const String NO_EVENTS_WERE_REGISTERED_FOR_THE_DOCUMENT = "No events were registered for the document!" ;
49
47
50
48
public const String PATTERN_CONTAINS_OPEN_QUOTATION = "Pattern contains open quotation!" ;
Original file line number Diff line number Diff line change 1
- 7309ce8ca4c7782f482d4c4cf2b68a82fc305745
1
+ 6c1b6135d55c607dd1098c733cc1a3b300d5cc96
You can’t perform that action at this time.
0 commit comments