Skip to content

Commit 9abe3d6

Browse files
Fixed for #58 #57 #52
Fixed for #58 #57 #52
1 parent 4153e7c commit 9abe3d6

File tree

3 files changed

+7
-18
lines changed

3 files changed

+7
-18
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<modelVersion>4.0.0</modelVersion>
66
<groupId>com.contentstack.sdk</groupId>
77
<artifactId>java</artifactId>
8-
<version>${sdk.version.release}</version>
8+
<version>1.10.1-SNAPSHOT</version>
99
<packaging>jar</packaging>
1010
<name>contentstack-java</name>
1111
<description>Java SDK for Contentstack Content Delivery API</description>

src/main/java/com/contentstack/sdk/ContentType.java

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@
99
import 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
}

src/test/java/com/contentstack/sdk/TestContentType.java

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ void testQueryInstance() {
8383
}
8484

8585
@Test
86-
void testContentTypeFetch() {
86+
void testContentTypeFetch() throws IllegalAccessException {
8787
ContentType contentType = stack.contentType("product");
8888
JSONObject paramObj = new JSONObject();
8989
paramObj.put("ctKeyOne", "ctKeyValue1");
@@ -98,7 +98,7 @@ public void onCompletion(ContentTypesModel model, Error error) {
9898
}
9999

100100
@Test
101-
void testContentTypesFetch() {
101+
void testContentTypesFetch() throws IllegalAccessException {
102102
ContentType contentType = stack.contentType("product");
103103
JSONObject paramObj = new JSONObject();
104104
paramObj.put("ctKeyOne", "ctKeyValue1");
@@ -112,11 +112,5 @@ public void onCompletion(ContentTypesModel model, Error error) {
112112
});
113113
}
114114

115-
@Test
116-
void toCoverageCheckHeader() {
117-
Map<String, Object> mapHeader = new HashMap<>();
118-
CSBackgroundTask backgroundTask = new CSBackgroundTask();
119-
backgroundTask.checkHeader(mapHeader);
120-
}
121115

122116
}

0 commit comments

Comments
 (0)