Skip to content

Commit 19feb33

Browse files
committed
fixes for PostgreSQL error and spring initialization in Staging
1 parent 804779e commit 19feb33

File tree

2 files changed

+15
-23
lines changed

2 files changed

+15
-23
lines changed

adapters/jdbc/src/main/java/org/atomhopper/jdbc/adapter/JdbcFeedSource.java

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
import org.springframework.jdbc.core.JdbcTemplate;
3030
import org.springframework.jdbc.core.ResultSetExtractor;
3131

32-
import java.sql.Array;
3332
import java.sql.SQLException;
3433
import org.springframework.jdbc.core.RowMapper;
3534

@@ -38,8 +37,15 @@
3837
import java.net.URL;
3938
import java.net.URLEncoder;
4039
import java.sql.ResultSet;
41-
import java.sql.SQLException;
42-
import java.util.*;
40+
import java.util.ArrayList;
41+
import java.util.Arrays;
42+
import java.util.List;
43+
import java.util.Map;
44+
import java.util.HashMap;
45+
import java.util.Date;
46+
import java.util.UUID;
47+
import java.util.LinkedList;
48+
import java.util.Collections;
4349
import java.util.concurrent.TimeUnit;
4450

4551
import static org.apache.abdera.i18n.text.UrlEncoding.decode;
@@ -799,16 +805,12 @@ public Object extractData( ResultSet rs ) throws SQLException, DataAccessExcepti
799805

800806
List<String> cats = new ArrayList<String>();
801807
try {
802-
Array categoriesArray = rs.getArray("categories");
803-
if (categoriesArray != null) {
804-
String[] categoryArray = (String[]) categoriesArray.getArray();
805-
if (categoryArray != null) {
806-
cats.addAll(Arrays.asList(categoryArray));
807-
}
808-
}
808+
cats.addAll(Arrays.asList((String[]) rs.getArray("categories").getArray()));
809809
} catch (SQLException e) {
810+
// Handle PostgreSQL-specific array processing errors
810811
LOG.warn("Failed to process categories array: {}", e.getMessage(), e);
811812
} catch (NullPointerException e) {
813+
// Handle cases where array or its elements are null
812814
LOG.warn("Null pointer encountered while processing categories: {}", e.getMessage(), e);
813815
}
814816

docker/Dockerfile

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -38,25 +38,15 @@ WORKDIR ${AH_HOME}
3838
COPY --from=tomcat /usr/local/tomcat ${CATALINA_HOME}
3939
COPY docker/start.sh .
4040

41-
RUN apk --no-cache add curl unzip file \
42-
&& echo "Downloading AtomHopper ${AH_VERSION} from GitHub Packages..." \
43-
&& echo "URL: https://maven.pkg.github.com/rackerlabs/atom-hopper/org/atomhopper/atomhopper/${AH_VERSION}/atomhopper-${AH_VERSION}.war" \
44-
&& curl -L -v -u ${GITHUB_ACTOR}:${GITHUB_TOKEN} -o atomhopper.war \
41+
RUN apk --no-cache add curl unzip \
42+
&& curl -L -u ${GITHUB_ACTOR}:${GITHUB_TOKEN} -o atomhopper.war \
4543
"https://maven.pkg.github.com/rackerlabs/atom-hopper/org/atomhopper/atomhopper/${AH_VERSION}/atomhopper-${AH_VERSION}.war" \
46-
&& echo "Download completed. Verifying WAR file..." \
47-
&& ls -la atomhopper.war \
48-
&& file atomhopper.war \
49-
&& unzip -t atomhopper.war > /dev/null \
50-
&& echo "Extracting configuration files..." \
5144
&& unzip atomhopper.war META-INF/application-context.xml META-INF/template-logback.xml WEB-INF/classes/META-INF/atom-server.cfg.xml -d . \
5245
&& mv META-INF/application-context.xml WEB-INF/classes/META-INF/atom-server.cfg.xml /etc/atomhopper/ \
5346
&& mv META-INF/template-logback.xml /etc/atomhopper/logback.xml \
5447
&& mv atomhopper.war ${CATALINA_HOME}/webapps/ROOT.war \
5548
&& rm -rf META-INF WEB-INF \
56-
&& chmod +x ${AH_HOME}/start.sh \
57-
&& echo "Verifying start.sh file..." \
58-
&& ls -la ${AH_HOME}/start.sh \
59-
&& echo "AtomHopper ${AH_VERSION} setup completed successfully"
49+
&& chmod +x ${AH_HOME}/start.sh
6050

6151
EXPOSE 8080
6252

0 commit comments

Comments
 (0)