1616package pl .wavesoftware .eid .exceptions ;
1717
1818import javax .annotation .Nullable ;
19+ import java .util .Locale ;
1920
2021/**
2122 * <strong>This class shouldn't be used in any public API or library.</strong> It is designed to be used for in-house development
@@ -62,7 +63,6 @@ public EidRuntimeException(String eid, String ref) {
6263 * @param cause the cause (which is saved for later retrieval by the {@link #getCause()} method). (A <tt>null</tt>
6364 * value is permitted, and indicates that the cause is nonexistent or unknown.)
6465 */
65- @ SuppressWarnings ("WeakerAccess" )
6666 public EidRuntimeException (String eid , Throwable cause ) {
6767 this (new Eid (eid ), cause );
6868 }
@@ -75,7 +75,6 @@ public EidRuntimeException(String eid, Throwable cause) {
7575 * @param cause the cause (which is saved for later retrieval by the {@link #getCause()} method). (A <tt>null</tt> value is
7676 * permitted, and indicates that the cause is nonexistent or unknown.)
7777 */
78- @ SuppressWarnings ("WeakerAccess" )
7978 public EidRuntimeException (String eid , String ref , Throwable cause ) {
8079 this (new Eid (eid , ref ), cause );
8180 }
@@ -85,7 +84,6 @@ public EidRuntimeException(String eid, String ref, Throwable cause) {
8584 *
8685 * @param id exception ID
8786 */
88- @ SuppressWarnings ("WeakerAccess" )
8987 public EidRuntimeException (Eid id ) {
9088 super (id .toString ());
9189 eid = id ;
@@ -94,14 +92,33 @@ public EidRuntimeException(Eid id) {
9492 /**
9593 * Constructs a new runtime exception with the specified Eid object and cause
9694 * <p>
97- * The detail message is computed as <tt>String.format(messageFormat , id.toString(), message(cause)</tt>
95+ * The detail message is computed as <tt>String.format(Eid.getMessageFormat() , id.toString(), message(cause) )</tt>
9896 *
9997 * @param id exception ID
10098 * @param cause the cause (which is saved for later retrieval by the {@link #getCause()} method). (A <tt>null</tt> value is
10199 * permitted, and indicates that the cause is nonexistent or unknown.)
102100 */
103101 public EidRuntimeException (Eid id , Throwable cause ) {
104- super (String .format (Eid .getMessageFormat (), id .toString (), message (cause )), cause );
102+ super (String .format (
103+ Locale .ENGLISH , Eid .getMessageFormat (), id .toString (), message (cause )
104+ ), cause );
105+ eid = id ;
106+ }
107+
108+ /**
109+ * Constructs a new runtime exception with specified Eid object and custom message
110+ * <p>
111+ * The detail message is computed as:
112+ * <pre>String.format(Eid.getMessageFormat(), id.toString(), String.format(messageFormat, parameters))</pre>
113+ * @param id exception ID
114+ * @param messageFormat message format in form of {@link String#format(String, Object...)}
115+ * @param parameters parameters in form of {@link String#format(String, Object...)}
116+ */
117+ public EidRuntimeException (Eid id , String messageFormat , Object ... parameters ) {
118+ super (String .format (
119+ Locale .ENGLISH , Eid .getMessageFormat (), id .toString (),
120+ String .format (Locale .ENGLISH , messageFormat , parameters )
121+ ));
105122 eid = id ;
106123 }
107124
0 commit comments