99import java .util .logging .Logger ;
1010
1111/**
12- * <a
13- * href="https://www.contentstack.com/docs/developers/apis/content-delivery-api/#single-content-type">ContentType</a>
12+ * <a href="https://www.contentstack.com/docs/developers/apis/content-delivery-api/#single-content-type">ContentType</a>
1413 * This call returns information of a specific content type. It returns the content type schema, but does not include
1514 * its entries.
1615 *
@@ -125,7 +124,7 @@ public Query query() {
125124 * @param callback
126125 * the callback of type {@link ContentTypesCallback}
127126 */
128- public void fetch (@ NotNull JSONObject params , final ContentTypesCallback callback ) {
127+ public void fetch (@ NotNull JSONObject params , final ContentTypesCallback callback ) throws IllegalAccessException {
129128 String urlString = "content_types/" + contentTypeUid ;
130129 Iterator <String > keys = params .keys ();
131130 while (keys .hasNext ()) {
@@ -134,12 +133,8 @@ public void fetch(@NotNull JSONObject params, final ContentTypesCallback callbac
134133 params .put (key , value );
135134 }
136135 params .put ("environment" , headers .get ("environment" ));
137- if (contentTypeUid != null && !contentTypeUid .isEmpty ()) {
138- try {
139- throw new IllegalAccessException ("contentTypeUid is required" );
140- } catch (Exception e ) {
141- logger .warning ("contentTypeUid is required" );
142- }
136+ if (contentTypeUid == null || contentTypeUid .isEmpty ()) {
137+ throw new IllegalAccessException ("contentTypeUid is required" );
143138 }
144139 fetchContentTypes (urlString , params , headers , callback );
145140 }
0 commit comments