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
2020You should have received a copy of the GNU Affero General Public License
2121along with this program. If not, see <https://www.gnu.org/licenses/>.
2222*/
23- using System ;
2423using iText . Commons . Actions . Contexts ;
2524using iText . Commons . Actions . Data ;
2625using iText . Commons . Ecosystem ;
27- using iText . Commons . Exceptions ;
2826using iText . Test ;
2927
3028namespace iText . Commons . Actions {
@@ -45,10 +43,7 @@ public virtual void ResetMetaInfoForbiddenTest() {
4543 AbstractContextBasedITextEventTest . BasicAbstractContextBasedITextEvent e = new AbstractContextBasedITextEventTest . BasicAbstractContextBasedITextEvent
4644 ( CommonsProductData . GetInstance ( ) , metaInfoBefore ) ;
4745 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 ) ) ;
5247 }
5348
5449 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
2323using System ;
2424using iText . Commons . Actions . Contexts ;
2525using iText . Commons . Actions . Data ;
26- using iText . Commons . Exceptions ;
2726
2827namespace iText . Commons . Actions {
2928 /// <summary>Represents a context-based event.</summary>
@@ -51,11 +50,13 @@ public virtual Type GetClassFromContext() {
5150
5251 /// <summary>Sets meta info.</summary>
5352 /// <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 ) {
5555 if ( this . metaInfo != null ) {
56- throw new InvalidOperationException ( CommonsExceptionMessageConstant . META_INFO_SHOULDNT_BE_NULL ) ;
56+ return false ;
5757 }
5858 this . metaInfo = metaInfo ;
59+ return true ;
5960 }
6061
6162 /// <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 {
4343
4444 public const String INVALID_USAGE_FORMAT_REQUIRED = "Invalid usage of placeholder \" {0}\" : format is required" ;
4545
46- public const String META_INFO_SHOULDNT_BE_NULL = "Meta info shouldn't be null" ;
47-
4846 public const String NO_EVENTS_WERE_REGISTERED_FOR_THE_DOCUMENT = "No events were registered for the document!" ;
4947
5048 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