Skip to content

Commit 0299754

Browse files
authored
Merge pull request #186 from contentstack/development
Development
2 parents cc69601 + 7eb50ed commit 0299754

25 files changed

+465
-223
lines changed

.github/workflows/issues-jira.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Create Jira Ticket for Github Issue
2+
3+
on:
4+
issues:
5+
types: [opened]
6+
7+
jobs:
8+
issue-jira:
9+
runs-on: ubuntu-latest
10+
steps:
11+
12+
- name: Login to Jira
13+
uses: atlassian/gajira-login@master
14+
env:
15+
JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }}
16+
JIRA_USER_EMAIL: ${{ secrets.JIRA_USER_EMAIL }}
17+
JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }}
18+
19+
- name: Create Jira Issue
20+
id: create_jira
21+
uses: atlassian/gajira-create@master
22+
with:
23+
project: ${{ secrets.JIRA_PROJECT }}
24+
issuetype: ${{ secrets.JIRA_ISSUE_TYPE }}
25+
summary: Github | Issue | ${{ github.event.repository.name }} | ${{ github.event.issue.title }}
26+
description: |
27+
*GitHub Issue:* ${{ github.event.issue.html_url }}
28+
29+
*Description:*
30+
${{ github.event.issue.body }}
31+
fields: "${{ secrets.ISSUES_JIRA_FIELDS }}"

.github/workflows/jira.yml

Lines changed: 0 additions & 33 deletions
This file was deleted.

.github/workflows/policy-scan.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Checks the security policy and configurations
2+
on:
3+
pull_request:
4+
types: [opened, synchronize, reopened]
5+
jobs:
6+
security-policy:
7+
if: github.event.repository.visibility == 'public'
8+
runs-on: ubuntu-latest
9+
defaults:
10+
run:
11+
shell: bash
12+
steps:
13+
- uses: actions/checkout@master
14+
- name: Checks for SECURITY.md policy file
15+
run: |
16+
if ! [[ -f "SECURITY.md" || -f ".github/SECURITY.md" ]]; then exit 1; fi
17+
security-license:
18+
if: github.event.repository.visibility == 'public'
19+
runs-on: ubuntu-latest
20+
defaults:
21+
run:
22+
shell: bash
23+
steps:
24+
- uses: actions/checkout@master
25+
- name: Checks for License file
26+
run: |
27+
expected_license_files=("LICENSE" "LICENSE.txt" "LICENSE.md" "License.txt")
28+
license_file_found=false
29+
current_year=$(date +"%Y")
30+
31+
for license_file in "${expected_license_files[@]}"; do
32+
if [ -f "$license_file" ]; then
33+
license_file_found=true
34+
# check the license file for the current year, if not exists, exit with error
35+
if ! grep -q "$current_year" "$license_file"; then
36+
echo "License file $license_file does not contain the current year."
37+
exit 2
38+
fi
39+
break
40+
fi
41+
done
42+
43+
if [ "$license_file_found" = false ]; then
44+
echo "No license file found. Please add a license file to the repository."
45+
exit 1
46+
fi

.github/workflows/sast-scan.yml

Lines changed: 0 additions & 11 deletions
This file was deleted.

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ local.properties
2525
.settings/
2626
.loadpath
2727
.recommenders
28+
# Ignore test configuration
29+
test-config.properties
2830

2931
# External tool builders
3032
.externalToolBuilders/

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# CHANGELOG
22

3+
## v2.1.1
4+
5+
### Date: 1-Apr-2025
6+
7+
- Github Issue fix
8+
- Sanity test Integration
9+
310
## v2.1.0
411

512
### Date: 1-Apr-2025

pom.xml

Lines changed: 26 additions & 14 deletions
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>2.1.0</version>
8+
<version>2.1.1</version>
99
<packaging>jar</packaging>
1010
<name>contentstack-java</name>
1111
<description>Java SDK for Contentstack Content Delivery API</description>
@@ -22,7 +22,7 @@
2222
<dotenv-source.version>3.0.0</dotenv-source.version>
2323
<rxjava-source.version>3.1.10</rxjava-source.version>
2424
<retrofit-source.version>2.11.0</retrofit-source.version>
25-
<loggin.version>5.0.0-alpha.11</loggin.version>
25+
<loggin.version>4.12.0</loggin.version>
2626
<jococo-plugin.version>0.8.5</jococo-plugin.version>
2727
<lombok-source.version>1.18.36</lombok-source.version>
2828
<junit-jupiter.version>5.11.4</junit-jupiter.version>
@@ -34,7 +34,7 @@
3434
<maven-compiler-plugin.version>3.8.1</maven-compiler-plugin.version>
3535
<nexus-staging-maven-plugin.version>1.6.13</nexus-staging-maven-plugin.version>
3636
<json-version>20250107</json-version>
37-
<jacoco-maven-plugin-version>0.8.7</jacoco-maven-plugin-version>
37+
<jacoco-maven-plugin-version>0.8.11</jacoco-maven-plugin-version>
3838
<maven-release-plugin-version>2.5.3</maven-release-plugin-version>
3939
<contentstack-utils-version>1.2.15</contentstack-utils-version>
4040
</properties>
@@ -122,14 +122,6 @@
122122
<scope>compile</scope>
123123
</dependency>
124124

125-
<!-- https://mvnrepository.com/artifact/io.github.cdimascio/java-dotenv -->
126-
<dependency>
127-
<groupId>io.github.cdimascio</groupId>
128-
<artifactId>java-dotenv</artifactId>
129-
<version>5.2.2</version>
130-
</dependency>
131-
132-
133125
<dependency>
134126
<groupId>io.reactivex.rxjava3</groupId>
135127
<artifactId>rxjava</artifactId>
@@ -189,6 +181,27 @@
189181
<artifactId>jackson-databind</artifactId>
190182
<version>2.18.2</version>
191183
</dependency>
184+
<dependency>
185+
<groupId>com.slack.api</groupId>
186+
<artifactId>bolt</artifactId>
187+
<version>1.44.0</version>
188+
</dependency>
189+
<dependency>
190+
<groupId>org.jetbrains</groupId>
191+
<artifactId>annotations</artifactId>
192+
<version>24.0.1</version>
193+
</dependency>
194+
<dependency>
195+
<groupId>com.squareup.okhttp3</groupId>
196+
<artifactId>okhttp</artifactId>
197+
<version>4.12.0</version>
198+
</dependency>
199+
<dependency>
200+
<groupId>org.slf4j</groupId>
201+
<artifactId>slf4j-simple</artifactId>
202+
<version>1.7.36</version>
203+
</dependency>
204+
192205
</dependencies>
193206

194207
<build>
@@ -237,8 +250,7 @@
237250
<use>false</use>
238251
<source>1.8</source>
239252
<links>
240-
<link>https://docs.oracle.com/javase/7/docs/api/</link>
241-
<link>https://docs.oracle.com/javase/7/docs/api/</link>
253+
<link>https://docs.oracle.com/en/java/javase/23/docs/api/index.html</link>
242254
</links>
243255
<doclint>none</doclint>
244256
</configuration>
@@ -251,7 +263,7 @@
251263
<artifactId>maven-surefire-plugin</artifactId>
252264
<version>2.22.2</version>
253265
<configuration>
254-
<skipTests>true</skipTests>
266+
<!-- <skipTests>true</skipTests> -->
255267
</configuration>
256268
</plugin>
257269

send-report.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/bash
2+
3+
set -e # Exit immediately if any command fails
4+
5+
echo "🧪 Running tests..."
6+
mvn clean test
7+
8+
echo "📄 Generating Surefire HTML report..."
9+
mvn surefire-report:report-only
10+
11+
echo "📤 Sending test report to Slack..."
12+
mvn compile exec:java -Dexec.mainClass="com.contentstack.sdk.SanityReport"
13+
14+
echo "✅ Done."

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ private String getParams(HashMap<String, Object> params) {
158158
urlParams += urlParams.equals("?") ? key + "=" + value : "&" + key + "=" + value;
159159
}
160160
} catch (Exception e1) {
161-
e1.printStackTrace();
161+
logger.log(Level.SEVERE, e1.getLocalizedMessage(), e1);
162162
}
163163
}
164164
return urlParams;

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

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -995,7 +995,7 @@ private void setIncludeJSON(JSONObject mainJson, ResultCallBack callBack) {
995995

996996
private void throwException(@Nullable String errorMsg, Exception e, EntryResultCallBack callBack) {
997997
Error error = new Error();
998-
if (errorMsg != null) {
998+
if (!errorMsg.isEmpty()) {
999999
error.setErrorMessage(errorMsg);
10001000
} else {
10011001
error.setErrorMessage(e.toString());
@@ -1124,11 +1124,9 @@ public Entry includeMetadata() {
11241124
}
11251125

11261126
/**
1127-
* @method variants
1128-
* @memberof Entry
1129-
* @description The variant header will be added to client
1130-
* @returns {Entry}
1131-
* @example
1127+
* The variant header will be added to client
1128+
* @return {Entry}
1129+
*
11321130
* import contentstack from '@contentstack/delivery-sdk'
11331131
*
11341132
* Stack stack = contentstack.Stack("apiKey", "deliveryToken",

0 commit comments

Comments
 (0)