Skip to content

Commit

Permalink
Merge branch 'develop' into 8241-mime
Browse files Browse the repository at this point in the history
  • Loading branch information
djbrooke committed Dec 7, 2021
2 parents 985b552 + 5897231 commit 5e0b7d6
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 41 deletions.
1 change: 0 additions & 1 deletion conf/docker-aio/0prep_deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ wdir=`pwd`

if [ ! -e dv/deps/payara-5.2021.5.zip ]; then
echo "payara dependency prep"
# no more fiddly patching :)
wget https://s3-eu-west-1.amazonaws.com/payara.fish/Payara+Downloads/5.2021.5/payara-5.2021.5.zip -O dv/deps/payara-5.2021.5.zip
fi

Expand Down
6 changes: 3 additions & 3 deletions conf/docker-aio/1prep.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ cd ../../
cp -r scripts conf/docker-aio/testdata/
cp doc/sphinx-guides/source/_static/util/createsequence.sql conf/docker-aio/testdata/doc/sphinx-guides/source/_static/util/

wget -q https://downloads.apache.org/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz
tar xfz apache-maven-3.6.3-bin.tar.gz
wget -q https://downloads.apache.org/maven/maven-3/3.8.4/binaries/apache-maven-3.8.4-bin.tar.gz
tar xfz apache-maven-3.8.4-bin.tar.gz
mkdir maven
mv apache-maven-3.6.3/* maven/
mv apache-maven-3.8.4/* maven/
echo "export JAVA_HOME=/usr/lib/jvm/jre-openjdk" > maven/maven.sh
echo "export M2_HOME=../maven" >> maven/maven.sh
echo "export MAVEN_HOME=../maven" >> maven/maven.sh
Expand Down
2 changes: 1 addition & 1 deletion conf/docker-aio/c8.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ RUN cd /opt ; unzip /tmp/dv/deps/payara-5.2021.5.zip ; ln -s /opt/payara5 /opt/g
# this dies under Java 11, do we keep it?
#COPY domain-restmonitor.xml /opt/payara5/glassfish/domains/domain1/config/domain.xml

RUN sudo -u postgres /usr/pgsql-13/bin/initdb -D /var/lib/pgsql/13/data
RUN sudo -u postgres /usr/pgsql-13/bin/initdb -D /var/lib/pgsql/13/data -E 'UTF-8'

# copy configuration related files
RUN cp /tmp/dv/pg_hba.conf /var/lib/pgsql/13/data/
Expand Down
61 changes: 32 additions & 29 deletions src/main/java/edu/harvard/iq/dataverse/SettingsWrapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -448,36 +448,39 @@ public boolean isEmbargoAllowed() {

public void validateEmbargoDate(FacesContext context, UIComponent component, Object value)
throws ValidatorException {
UIComponent cb = component.findComponent("embargoCheckbox");
UIInput endComponent = (UIInput) cb;
boolean removedState = false;
if (endComponent != null) {
try {
removedState = (Boolean) endComponent.getSubmittedValue();
} catch (NullPointerException npe) {
// Do nothing - checkbox is not being shown (and is therefore not checked)
if (isEmbargoAllowed()) {
UIComponent cb = component.findComponent("embargoCheckbox");
UIInput endComponent = (UIInput) cb;
boolean removedState = false;
if (endComponent != null) {
try {
removedState = (Boolean) endComponent.getSubmittedValue();
} catch (NullPointerException npe) {
// Do nothing - checkbox is not being shown (and is therefore not checked)
}
}
if (!removedState && value == null) {
String msgString = BundleUtil.getStringFromBundle("embargo.date.required");
FacesMessage msg = new FacesMessage(msgString);
msg.setSeverity(FacesMessage.SEVERITY_ERROR);
throw new ValidatorException(msg);
}
Embargo newE = new Embargo(((LocalDate) value), null);
if (!isValidEmbargoDate(newE)) {
String minDate = getMinEmbargoDate().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
String maxDate = getMaxEmbargoDate().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
String msgString = BundleUtil.getStringFromBundle("embargo.date.invalid",
Arrays.asList(minDate, maxDate));
// If we don't throw an exception here, the datePicker will use it's own
// vaidator and display a default message. The value for that can be set by
// adding validatorMessage="#{bundle['embargo.date.invalid']}" (a version with
// no params) to the datepicker
// element in file-edit-popup-fragment.html, but it would be better to catch all
// problems here (so we can show a message with the min/max dates).
FacesMessage msg = new FacesMessage(msgString);
msg.setSeverity(FacesMessage.SEVERITY_ERROR);
throw new ValidatorException(msg);
}
}
if (!removedState && value == null) {
String msgString = BundleUtil.getStringFromBundle("embargo.date.required");
FacesMessage msg = new FacesMessage(msgString);
msg.setSeverity(FacesMessage.SEVERITY_ERROR);
throw new ValidatorException(msg);
}
Embargo newE = new Embargo(((LocalDate) value), null);
if (!isValidEmbargoDate(newE)) {
String minDate = getMinEmbargoDate().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
String maxDate = getMaxEmbargoDate().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
String msgString = BundleUtil.getStringFromBundle("embargo.date.invalid", Arrays.asList(minDate, maxDate));
// If we don't throw an exception here, the datePicker will use it's own
// vaidator and display a default message. The value for that can be set by
// adding validatorMessage="#{bundle['embargo.date.invalid']}" (a version with
// no params) to the datepicker
// element in file-edit-popup-fragment.html, but it would be better to catch all
// problems here (so we can show a message with the min/max dates).
FacesMessage msg = new FacesMessage(msgString);
msg.setSeverity(FacesMessage.SEVERITY_ERROR);
throw new ValidatorException(msg);
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
-- This list of characters also appears in DatasetFieldValidator.java
-- Remove character: form feed (\f)
UPDATE datasetfieldvalue SET value = regexp_replace(value, E'\f', '', 'g');
-- Remove character: start of text (\u0002)
UPDATE datasetfieldvalue SET value = regexp_replace(value, U&'\0002', '', 'g');
-- Remove character: not a character (\ufffe)
UPDATE datasetfieldvalue SET value = regexp_replace(value, U&'\FFFE', '', 'g');
DO $$
BEGIN
-- Run on UTF8 only. It's known to fail on SQL_ASCII encoding.
IF EXISTS (SELECT 1 FROM information_schema.character_sets WHERE character_set_name='UTF8') THEN
-- This list of characters also appears in DatasetFieldValidator.java
-- Remove character: form feed (\f)
UPDATE datasetfieldvalue SET value = regexp_replace(value, E'\f', '', 'g');
-- Remove character: start of text (\u0002)
UPDATE datasetfieldvalue SET value = regexp_replace(value, U&'\0002', '', 'g');
-- Remove character: not a character (\ufffe)
UPDATE datasetfieldvalue SET value = regexp_replace(value, U&'\FFFE', '', 'g');
END IF;
END
$$

0 comments on commit 5e0b7d6

Please sign in to comment.