Skip to content

Commit

Permalink
#:bug: 45 bug fix #43 & #45
Browse files Browse the repository at this point in the history
- Reverse logic for entry uid
- Static logger
- scope based dependencies
  • Loading branch information
ishaileshmishra committed Jan 22, 2022
1 parent 474f01c commit c49d927
Show file tree
Hide file tree
Showing 13 changed files with 60 additions and 30 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ factoryConfiguration.json
bin/
tmp/
*.tmp
.vscode
.vscode/
.dccache/
.dccache
*.bak
*.swp
*~.nib
Expand Down
4 changes: 4 additions & 0 deletions .talismanrc
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
threshold: medium

fileignoreconfig:
- filename: .dccache
checksum: 94743bc78dc44fedb1abcfb99f69c0ee190cf2ae1295e974970a8d91a0f06e42
15 changes: 14 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
# CHANGELOG

## Version 2.0.0

## Version 1.8.1

### Date: 21-Jan-2022

- Entry uid bug fixed #45
- Static logger implemented #43
- Scope based dependencies

------------------------------------------------

## Version 1.8.0

### Date: 01-Nov-2021

Expand All @@ -11,6 +22,8 @@
- Removed deprecated code/Non-working code marked deprecated
- Few breaking changes added.

------------------------------------------------

## Version 1.7.0

### Date: 12-JUL-2021
Expand Down
39 changes: 24 additions & 15 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

<modelVersion>4.0.0</modelVersion>
<groupId>com.contentstack.sdk</groupId>
<artifactId>java</artifactId>
<version>1.8.0-SNAPSHOT</version>
<version>${sdk.version.snapshot}</version>
<packaging>jar</packaging>
<name>contentstack-java</name>
<description>Java SDK for Contentstack Content Delivery API</description>
Expand All @@ -15,24 +14,24 @@

<properties>
<!--update sdk version before every release push for SNAPSHOT/RELEASE-->
<sdk.version.snapshot>v1.8.0</sdk.version.snapshot>
<sdk.version.release>v1.8.0</sdk.version.release>
<sdk.version.snapshot>1.8.1-SNAPSHOT</sdk.version.snapshot>
<sdk.version.release>1.8.1</sdk.version.release>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.source>1.8</maven.compiler.source>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<surefire-report-plugin.version>2.22.0</surefire-report-plugin.version>
<maven-source-plugin.version>2.2.1</maven-source-plugin.version>
<maven-javadoc-plugin.version>3.0.0</maven-javadoc-plugin.version>
<dotenv-source.version>5.2.2</dotenv-source.version>
<rxjava-source.version>3.1.2</rxjava-source.version>
<rxjava-source.version>3.1.3</rxjava-source.version>
<retrofit-source.version>2.9.0</retrofit-source.version>
<converter-gson-source.version>2.9.0</converter-gson-source.version>
<loggin.version>4.9.2</loggin.version>
<loggin.version>4.9.3</loggin.version>
<jococo-plugin.version>0.8.5</jococo-plugin.version>
<lombok-source.version>1.18.22</lombok-source.version>
<junit-jupiter.version>5.8.1</junit-jupiter.version>
<junit-jupiter.version>5.8.2</junit-jupiter.version>
<junit-jupiter-engine.version>5.8.0-M1</junit-jupiter-engine.version>
<junit-vintage-engine.version>5.8.1</junit-vintage-engine.version>
<junit-vintage-engine.version>5.8.2</junit-vintage-engine.version>
<gson.version>2.8.8</gson.version>
<json-simple-version>1.1.1</json-simple-version>
<maven-site-plugin.version>3.3</maven-site-plugin.version>
Expand All @@ -57,7 +56,7 @@
<url>https://github.com/contentstack/contentstack-java</url>
<connection>scm:git:git://github.com/contentstack/contentstack-java.git</connection>
<developerConnection>scm:git:ssh://github.com:contentstack/contentstack-java.git</developerConnection>
<tag>HEAD</tag>
<tag>java-1.8.0</tag>
</scm>

<issueManagement>
Expand Down Expand Up @@ -106,45 +105,53 @@


<dependencies>
<!-- <dependency>-->
<!-- <groupId>com.contentstack.sdk</groupId>-->
<!-- <artifactId>utils</artifactId>-->
<!-- <version>${contentstack-utils-version}</version>-->
<!-- </dependency>-->
<dependency>
<groupId>com.contentstack.sdk</groupId>
<artifactId>utils</artifactId>
<version>${contentstack-utils-version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>${json-version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>io.github.cdimascio</groupId>
<artifactId>java-dotenv</artifactId>
<version>${dotenv-source.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>io.reactivex.rxjava3</groupId>
<artifactId>rxjava</artifactId>
<version>${rxjava-source.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.squareup.retrofit2</groupId>
<artifactId>retrofit</artifactId>
<version>${retrofit-source.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.squareup.retrofit2</groupId>
<artifactId>converter-gson</artifactId>
<version>${converter-gson-source.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>logging-interceptor</artifactId>
<version>${loggin.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok-source.version}</version>
<scope>compile</scope>
</dependency>
<!--JUnit 5 requires Java 8, you should make sure you have it ready in your environment.-->
<dependency>
Expand All @@ -157,12 +164,14 @@
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<version>${junit-vintage-engine.version}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
<version>${json-simple-version}</version>
<scope>compile</scope>
</dependency>
</dependencies>

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/contentstack/sdk/Asset.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
*/
public class Asset {

protected final Logger logger = Logger.getLogger(Asset.class.getSimpleName());
protected static final Logger logger = Logger.getLogger(Asset.class.getSimpleName());
protected final JSONObject urlQueries = new JSONObject();
protected String assetUid = null;
protected String contentType = null;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/contentstack/sdk/AssetLibrary.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
*/
public class AssetLibrary implements INotifyClass {

protected final Logger logger = Logger.getLogger(AssetLibrary.class.getSimpleName());
protected static final Logger logger = Logger.getLogger(AssetLibrary.class.getSimpleName());
protected final JSONObject urlQueries;
protected Stack stackInstance;
protected LinkedHashMap<String, Object> headers;
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/contentstack/sdk/CSHttpConnection.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

public class CSHttpConnection implements IURLRequestHTTP {

private final Logger logger = Logger.getLogger(CSHttpConnection.class.getName());
protected static final Logger logger = Logger.getLogger(CSHttpConnection.class.getName());
private final String urlPath;
private final IRequestModelHTTP connectionRequest;
private String controller;
Expand Down Expand Up @@ -177,7 +177,7 @@ public void send() {
try {
getService(url);
} catch (IOException | JSONException e) {
e.printStackTrace();
logger.severe(e.getLocalizedMessage());
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/contentstack/sdk/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
public class Constants {

private static final Logger logger = Logger.getLogger(Constants.class.getSimpleName());
protected static final String SDK_VERSION = "1.8.0";
protected static final String SDK_VERSION = "1.8.1";
protected static final String ENVIRONMENT = "environment";
protected static final String CONTENT_TYPE_UID = "content_type_uid";
protected static final String SYNCHRONISATION = "stacks/sync";
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/contentstack/sdk/ContentType.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
*/
public class ContentType {

private final Logger logger = Logger.getLogger(ContentType.class.getSimpleName());
protected static final Logger logger = Logger.getLogger(ContentType.class.getSimpleName());
protected String contentTypeUid = null;
protected Stack stackInstance = null;
protected LinkedHashMap<String, Object> headers = null;
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/contentstack/sdk/Entry.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

public class Entry {

private final Logger logger = Logger.getLogger(Entry.class.getSimpleName());
protected static final Logger logger = Logger.getLogger(Entry.class.getSimpleName());
protected JSONObject params;
protected LinkedHashMap<String, Object> headers = null;
protected HashMap<String, Object> owner = null;
Expand Down Expand Up @@ -952,7 +952,7 @@ public Entry exceptWithReferenceUid(@NotNull ArrayList<String> fieldUid, @NotNul
*/

public void fetch(EntryResultCallBack callback) {
if (!uid.isEmpty()) {
if (uid.isEmpty()) { // throws IllegalAccessException if uid is Empty
try {
throw new IllegalAccessException("Entry Uid is required");
} catch (IllegalAccessException e) {
Expand Down
8 changes: 5 additions & 3 deletions src/main/java/com/contentstack/sdk/Group.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import java.util.logging.Logger;

public class Group {

protected static final Logger logger = Logger.getLogger(Group.class.getSimpleName());
private final JSONObject resultJson;
private final Stack stackInstance;

Expand Down Expand Up @@ -270,7 +272,7 @@ public Calendar getDate(String key) {
String value = getString(key);
return Constants.parseDate(value, null);
} catch (Exception e) {
e.printStackTrace();
logger.severe(e.getLocalizedMessage());
}
return null;
}
Expand Down Expand Up @@ -387,7 +389,7 @@ public ArrayList<Entry> getAllEntries(String refKey, String refContentType) {
entryInstance = stackInstance.contentType(refContentType).entry();
} catch (Exception e) {
entryInstance = new Entry(refContentType);
e.printStackTrace();
logger.severe(e.getLocalizedMessage());
}
entryInstance.setUid(model.uid);
entryInstance.resultJson = model.jsonObject;
Expand All @@ -398,7 +400,7 @@ public ArrayList<Entry> getAllEntries(String refKey, String refContentType) {
}
}
} catch (Exception e) {
e.printStackTrace();
logger.severe(e.getLocalizedMessage());
return entryContainer;
}
return entryContainer;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/contentstack/sdk/Query.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

public class Query implements INotifyClass {

private static final Logger logger = Logger.getLogger(Query.class.getSimpleName());
protected static final Logger logger = Logger.getLogger(Query.class.getSimpleName());
protected ContentType contentTypeInstance = null;
protected LinkedHashMap<String, Object> headers = null;
protected JSONObject urlQueries;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/contentstack/sdk/QueryResult.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

public class QueryResult {

private final Logger logger = Logger.getLogger(QueryResult.class.getSimpleName());
protected static final Logger logger = Logger.getLogger(QueryResult.class.getSimpleName());
protected JSONObject receiveJson;
protected JSONArray schemaArray;
protected JSONObject contentObject;
Expand Down

0 comments on commit c49d927

Please sign in to comment.