diff --git a/db/upgrade/8.56/2021-06-21.sql b/db/upgrade/8.56/2021-06-21.sql index 728437a6..63164ded 100644 --- a/db/upgrade/8.56/2021-06-21.sql +++ b/db/upgrade/8.56/2021-06-21.sql @@ -1,5 +1,71 @@ -# ERROR 1170 (42000): BLOB/TEXT column 'localityname' used in key specification without a key length -# Delaying this change to see if other changes help. +# Problem found: + + 2021-07-03 13:00:10,642 ERROR ajp-nio-0.0.0.0-8009-exec-38 org.calacademy.antweb.LoginAction - Connection.process + java.sql.SQLException: Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation '=' + at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:129) + at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122) + at com.mysql.cj.jdbc.StatementImpl.executeQuery(StatementImpl.java:1198) + at com.mchange.v2.c3p0.impl.NewProxyStatement.executeQuery(NewProxyStatement.java:35) + at org.calacademy.antweb.home.LoginDb.getLoginByName(LoginDb.java:88) + at org.calacademy.antweb.LoginAction.login(LoginAction.java:238) + at org.calacademy.antweb.LoginAction.execute(LoginAction.java:90) + + + +# These have not been executed. Proposed changes below. Wating till not on vacation/with more focused time. + +ALTER TABLE worldants_upload CONVERT TO CHARACTER SET utf8 COLLATE 'utf8_general_ci'; +ALTER TABLE admin_alerts CONVERT TO CHARACTER SET utf8 COLLATE 'utf8_general_ci'; +ALTER TABLE ancillary CONVERT TO CHARACTER SET utf8 COLLATE 'utf8_general_ci'; +ALTER TABLE antwiki_fossil_taxa CONVERT TO CHARACTER SET utf8 COLLATE 'utf8_general_ci'; +ALTER TABLE antwiki_valid_taxa CONVERT TO CHARACTER SET utf8 COLLATE 'utf8_general_ci'; +ALTER TABLE bioregion CONVERT TO CHARACTER SET utf8 COLLATE 'utf8_general_ci'; +ALTER TABLE bioregion_taxon CONVERT TO CHARACTER SET utf8 COLLATE 'utf8_general_ci'; +ALTER TABLE country CONVERT TO CHARACTER SET utf8 COLLATE 'utf8_general_ci'; +ALTER TABLE country_bioregion CONVERT TO CHARACTER SET utf8 COLLATE 'utf8_general_ci'; +ALTER TABLE description_edit CONVERT TO CHARACTER SET utf8 COLLATE 'utf8_general_ci'; +ALTER TABLE description_hist CONVERT TO CHARACTER SET utf8 COLLATE 'utf8_general_ci'; +ALTER TABLE description_homonym CONVERT TO CHARACTER SET utf8 COLLATE 'utf8_general_ci'; +ALTER TABLE event CONVERT TO CHARACTER SET utf8 COLLATE 'utf8_general_ci'; +ALTER TABLE geolocale_taxon CONVERT TO CHARACTER SET utf8 COLLATE 'utf8_general_ci'; +ALTER TABLE geolocale_taxon_dispute CONVERT TO CHARACTER SET utf8 COLLATE 'utf8_general_ci'; +ALTER TABLE image_upload CONVERT TO CHARACTER SET utf8 COLLATE 'utf8_general_ci'; +ALTER TABLE image_uploaded CONVERT TO CHARACTER SET utf8 COLLATE 'utf8_general_ci'; +ALTER TABLE login CONVERT TO CHARACTER SET utf8 COLLATE 'utf8_general_ci'; +ALTER TABLE long_request CONVERT TO CHARACTER SET utf8 COLLATE 'utf8_general_ci'; +ALTER TABLE lookup CONVERT TO CHARACTER SET utf8 COLLATE 'utf8_general_ci'; +ALTER TABLE museum CONVERT TO CHARACTER SET utf8 COLLATE 'utf8_general_ci'; +ALTER TABLE museum_taxon CONVERT TO CHARACTER SET utf8 COLLATE 'utf8_general_ci'; +ALTER TABLE object_hist CONVERT TO CHARACTER SET utf8 COLLATE 'utf8_general_ci'; +ALTER TABLE object_map CONVERT TO CHARACTER SET utf8 COLLATE 'utf8_general_ci'; +ALTER TABLE operation_lock CONVERT TO CHARACTER SET utf8 COLLATE 'utf8_general_ci'; +ALTER TABLE proj_taxon_dispute CONVERT TO CHARACTER SET utf8 COLLATE 'utf8_general_ci'; +ALTER TABLE proj_taxon_log CONVERT TO CHARACTER SET utf8 COLLATE 'utf8_general_ci'; +ALTER TABLE statistics CONVERT TO CHARACTER SET utf8 COLLATE 'utf8_general_ci'; +ALTER TABLE taxon_country CONVERT TO CHARACTER SET utf8 COLLATE 'utf8_general_ci'; +ALTER TABLE taxon_prop CONVERT TO CHARACTER SET utf8 COLLATE 'utf8_general_ci'; +ALTER TABLE team_member CONVERT TO CHARACTER SET utf8 COLLATE 'utf8_general_ci'; +ALTER TABLE un_country CONVERT TO CHARACTER SET utf8 COLLATE 'utf8_general_ci'; +ALTER TABLE upload CONVERT TO CHARACTER SET utf8 COLLATE 'utf8_general_ci'; +ALTER TABLE upload_line CONVERT TO CHARACTER SET utf8 COLLATE 'utf8_general_ci'; +ALTER TABLE user_agent CONVERT TO CHARACTER SET utf8 COLLATE 'utf8_general_ci'; + +#These could be pruned: +drop table museumBak; +drop table taxon_prop20170617; + + +# Not base tables, so can't convert. Look at view scrits?': +ALTER TABLE api3_1_specimen CONVERT TO CHARACTER SET utf8 COLLATE 'utf8_general_ci'; +ALTER TABLE api3_specimen CONVERT TO CHARACTER SET utf8 COLLATE 'utf8_general_ci'; +ALTER TABLE darwin_core_2_test CONVERT TO CHARACTER SET utf8 COLLATE 'utf8_general_ci'; +ALTER TABLE darwin_core_3 CONVERT TO CHARACTER SET utf8 COLLATE 'utf8_general_ci'; + +# Maybe change the views? Here are the create statements: +CREATE ALGORITHM=UNDEFINED DEFINER=`antweb`@`localhost` SQL SECURITY DEFINER VIEW `api3_1_specimen` AS select concat(_utf8'CAS:ANTWEB:',`s`.`code`) AS `occurrenceId`,`s`.`code` AS `specimen_code`,`s`.`taxon_name` AS `taxon_name`,`t`.`fossil` AS `fossil`,`t`.`status` AS `taxon_status`,`s`.`ownedby` AS `ownerInstitutionCode`,'CAS' AS `institutionCode`,'AntWeb' AS `dataSource`,`s`.`last_modified` AS `last_modified`,`s`.`kingdom_name` AS `kingdom_name`,`s`.`phylum_name` AS `phylum_name`,`s`.`class_name` AS `class_name`,`s`.`order_name` AS `order_name`,`s`.`family` AS `family`,`s`.`subfamily` AS `subfamily`,(case when (left(`s`.`genus`,1) = '(') then concat(left(`s`.`genus`,1),upper(substr(`s`.`genus`,2,1)),substr(`s`.`genus`,3)) else concat(upper(left(`s`.`genus`,1)),substr(`s`.`genus`,2)) end) AS `genus`,`s`.`subgenus` AS `subgenus`,`s`.`species` AS `species`,`s`.`subspecies` AS `subspecies`,concat(`s`.`genus`,_utf8' ',`s`.`species`) AS `scientific_name`,concat(`s`.`kingdom_name`,_utf8';',`s`.`phylum_name`,_utf8';',`s`.`class_name`,_utf8';',`s`.`order_name`,_utf8';',`s`.`order_name`,_utf8';',`s`.`family`,_utf8';',`s`.`subfamily`) AS `higherClassification`,`s`.`type_status` AS `typeStatus`,`s`.`adm1` AS `adm1`,`s`.`country` AS `country`,`s`.`bioregion` AS `bioregion`,`s`.`museum` AS `museum`,`s`.`decimal_latitude` AS `decimalLatitude`,`s`.`decimal_longitude` AS `decimalLongitude`,`s`.`latlonmaxerror` AS `latlonmaxerror`,`s`.`datedetermined` AS `dateDetermined`,concat(`s`.`habitat`,if(strcmp(`s`.`microhabitat`,''),concat(if(strcmp(`s`.`habitat`,''),_utf8'; ',''),`s`.`microhabitat`),'')) AS `habitats`,`s`.`habitat` AS `habitat`,`s`.`microhabitat` AS `microhabitat`,`s`.`method` AS `samplingMethod`,`s`.`life_stage` AS `lifeStageSex`,`s`.`caste` AS `caste`,`s`.`subcaste` AS `subcaste`,`s`.`medium` AS `medium`,`s`.`datecollectedstart` AS `datecollectedstart`,`s`.`datecollectedend` AS `datecollectedend`,`s`.`collectioncode` AS `collectioncode`,`s`.`determinedby` AS `determinedby`,`s`.`localityname` AS `localityname`,`s`.`localitynotes` AS `localitynotes`,`s`.`specimennotes` AS `specimennotes`,`s`.`collectionnotes` AS `collectionnotes`,`s`.`elevation` AS `minimumElevationInMeters`,`s`.`image_count` AS `image_count`,`s`.`ownedby` AS `ownedby`,`s`.`locatedat` AS `locatedat`,`s`.`collectedby` AS `collectedby`,`s`.`region` AS `region`,`s`.`subregion` AS `subregion` from (`specimen` `s` join `taxon` `t` on((`t`.`taxon_name` = `s`.`taxon_name`))) +CREATE ALGORITHM=UNDEFINED DEFINER=`antweb`@`localhost` SQL SECURITY DEFINER VIEW `api3_specimen` AS select concat(_utf8'CAS:ANTWEB:',`s`.`code`) AS `occurrenceId`,`s`.`code` AS `specimen_code`,`s`.`taxon_name` AS `taxon_name`,`t`.`fossil` AS `fossil`,`t`.`status` AS `taxon_status`,`s`.`ownedby` AS `ownerInstitutionCode`,'preserved specimen' AS `basisOfRecord`,'CAS' AS `institutionCode`,'ANTWEB' AS `collectionCode`,`s`.`code` AS `catalogNumber`,`s`.`last_modified` AS `dcterms:modified`,'ICZN' AS `nomenclaturalCode`,`s`.`kingdom_name` AS `kingdom`,`s`.`phylum_name` AS `phylum`,`s`.`class_name` AS `class`,`s`.`order_name` AS `order`,`s`.`family` AS `family`,`s`.`subfamily` AS `subfamily`,(case when (left(`s`.`genus`,1) = '(') then concat(left(`s`.`genus`,1),upper(substr(`s`.`genus`,2,1)),substr(`s`.`genus`,3)) else concat(upper(left(`s`.`genus`,1)),substr(`s`.`genus`,2)) end) AS `genus`,`s`.`subgenus` AS `subgenus`,`s`.`species` AS `specificEpithet`,`s`.`subspecies` AS `intraspecificEpithet`,concat(`s`.`genus`,_utf8' ',`s`.`species`) AS `scientific_name`,concat(`s`.`kingdom_name`,_utf8';',`s`.`phylum_name`,_utf8';',`s`.`class_name`,_utf8';',`s`.`order_name`,_utf8';',`s`.`order_name`,_utf8';',`s`.`family`,_utf8';',`s`.`subfamily`) AS `higherClassification`,`s`.`type_status` AS `typeStatus`,`s`.`adm1` AS `stateProvince`,`s`.`country` AS `country`,`s`.`bioregion` AS `bioregion`,`s`.`status` AS `status`,`s`.`decimal_latitude` AS `decimalLatitude`,`s`.`decimal_longitude` AS `decimalLongitude`,`s`.`latlonmaxerror` AS `georeferenceRemarks`,`s`.`datedetermined` AS `dateIdentified`,concat(`s`.`habitat`,if(strcmp(`s`.`microhabitat`,''),concat(if(strcmp(`s`.`habitat`,''),_utf8'; ',''),`s`.`microhabitat`),'')) AS `habitats`,`s`.`habitat` AS `habitat`,`s`.`microhabitat` AS `microhabitat`,`s`.`collectedby` AS `recordedBy`,`s`.`method` AS `samplingProtocol`,`s`.`caste` AS `sex`,`s`.`medium` AS `preparations`,`s`.`datecollectedstart` AS `dateCollected`,`s`.`collectioncode` AS `fieldNumber`,`s`.`determinedby` AS `identifiedBy`,`s`.`localityname` AS `locality`,`s`.`localitynotes` AS `locationRemarks`,`s`.`specimennotes` AS `occurrenceRemarks`,`s`.`collectionnotes` AS `fieldNotes`,concat(`s`.`datecollectedstart`,if(strcmp(`s`.`datecollectedend`,''),concat(_utf8'/',`s`.`datecollectedend`),'')) AS `eventDate`,concat(`s`.`datecollectedstartstr`,if(strcmp(`s`.`datecollectedendstr`,''),concat(_utf8'/',`s`.`datecollectedendstr`),'')) AS `verbatimEventDate`,`s`.`elevation` AS `minimumElevationInMeters`,`s`.`bioregion` AS `biogeographicregion`,`s`.`image_count` AS `image_count`,`s`.`museum` AS `museum`,`s`.`ownedby` AS `ownedby`,`s`.`locatedat` AS `locatedat`,`s`.`collectedby` AS `collectedby` from (`specimen` `s` join `taxon` `t` on((`t`.`taxon_name` = `s`.`taxon_name`))) +CREATE ALGORITHM=UNDEFINED DEFINER=`antweb`@`localhost` SQL SECURITY DEFINER VIEW `darwin_core_2_test` AS select concat(_utf8'CAS:ANTWEB:',`specimen`.`code`) AS `occurrenceId`,`specimen`.`ownedby` AS `ownerInstitutionCode`,'preserved specimen' AS `basisOfRecord`,'CAS' AS `institutionCode`,'ANTWEB' AS `collectionCode`,`specimen`.`code` AS `catalogNumber`,`specimen`.`last_modified` AS `dcterms:modified`,'ICZN' AS `nomenclaturalCode`,`specimen`.`kingdom_name` AS `kingdom`,`specimen`.`phylum_name` AS `phylum`,`specimen`.`class_name` AS `class`,`specimen`.`order_name` AS `order`,`specimen`.`family` AS `family`,`specimen`.`subfamily` AS `subfamily`,(case when (left(`specimen`.`genus`,1) = '') then concat(left(`specimen`.`genus`,1),upper(substr(`specimen`.`genus`,2,1)),substr(`specimen`.`genus`,3)) else concat(upper(left(`specimen`.`genus`,1)),substr(`specimen`.`genus`,2)) end) AS `genus`,`specimen`.`subgenus` AS `subgenus`,`specimen`.`species` AS `specificEpithet`,`specimen`.`subspecies` AS `intraspecificEpithet`,concat(`specimen`.`genus`,_utf8' ',`specimen`.`species`) AS `scientific_name`,concat(`specimen`.`kingdom_name`,_utf8';',`specimen`.`phylum_name`,_utf8';',`specimen`.`class_name`,_utf8';',`specimen`.`order_name`,_utf8';',`specimen`.`order_name`,_utf8';',`specimen`.`family`,_utf8';',`specimen`.`subfamily`) AS `higherClassification`,`specimen`.`type_status` AS `typeStatus`,`specimen`.`adm1` AS `stateProvince`,`specimen`.`country` AS `country`,`specimen`.`decimal_latitude` AS `decimalLatitude`,`specimen`.`decimal_longitude` AS `decimalLongitude`,`specimen`.`latlonmaxerror` AS `georeferenceRemarks`,`specimen`.`datedetermined` AS `dateIdentified`,`specimen`.`datecollectedstart` AS `dateCollected`,concat(`specimen`.`habitat`,if(strcmp(`specimen`.`microhabitat`,''),concat(if(strcmp(`specimen`.`habitat`,''),_utf8'; ',''),`specimen`.`microhabitat`),'')) AS `habitat`,`specimen`.`collectedby` AS `recordedBy`,`specimen`.`method` AS `samplingProtocol`,`specimen`.`caste` AS `sex`,`specimen`.`medium` AS `preparations`,`specimen`.`collectioncode` AS `fieldNumber`,`specimen`.`determinedby` AS `identifiedBy`,`specimen`.`localityname` AS `locality`,`specimen`.`localitynotes` AS `locationRemarks`,`specimen`.`specimennotes` AS `occurrenceRemarks`,`specimen`.`collectionnotes` AS `fieldNotes`,concat(`specimen`.`datecollectedstart`,if(strcmp(`specimen`.`datecollectedend`,''),concat(_utf8'/',`specimen`.`datecollectedend`),'')) AS `eventDate`,concat(`specimen`.`datecollectedstartstr`,if(strcmp(`specimen`.`datecollectedendstr`,''),concat(_utf8'/',`specimen`.`datecollectedendstr`),'')) AS `verbatimEventDate`,`specimen`.`elevation` AS `minimumElevationInMeters`,`specimen`.`bioregion` AS `biogeographicregion`,`specimen`.`taxon_name` AS `antweb_taxon_name` from `specimen` +CREATE ALGORITHM=UNDEFINED DEFINER=`antweb`@`localhost` SQL SECURITY DEFINER VIEW `darwin_core_3` AS select concat(_utf8'CAS:ANTWEB:',`s`.`code`) AS `occurrenceId`,`s`.`code` AS `specimen_code`,`s`.`taxon_name` AS `taxon_name`,`t`.`fossil` AS `fossil`,`t`.`status` AS `taxon_status`,`s`.`ownedby` AS `ownerInstitutionCode`,'preserved specimen' AS `basisOfRecord`,'CAS' AS `institutionCode`,'ANTWEB' AS `collectionCode`,`s`.`code` AS `catalogNumber`,`s`.`last_modified` AS `dcterms:modified`,'ICZN' AS `nomenclaturalCode`,`s`.`kingdom_name` AS `kingdom`,`s`.`phylum_name` AS `phylum`,`s`.`class_name` AS `class`,`s`.`order_name` AS `order`,`s`.`family` AS `family`,`s`.`subfamily` AS `subfamily`,(case when (left(`s`.`genus`,1) = '(') then concat(left(`s`.`genus`,1),upper(substr(`s`.`genus`,2,1)),substr(`s`.`genus`,3)) else concat(upper(left(`s`.`genus`,1)),substr(`s`.`genus`,2)) end) AS `genus`,`s`.`subgenus` AS `subgenus`,`s`.`species` AS `specificEpithet`,`s`.`subspecies` AS `intraspecificEpithet`,concat(`s`.`genus`,_utf8' ',`s`.`species`) AS `scientific_name`,concat(`s`.`kingdom_name`,_utf8';',`s`.`phylum_name`,_utf8';',`s`.`class_name`,_utf8';',`s`.`order_name`,_utf8';',`s`.`order_name`,_utf8';',`s`.`family`,_utf8';',`s`.`subfamily`) AS `higherClassification`,`s`.`type_status` AS `typeStatus`,`s`.`adm1` AS `stateProvince`,`s`.`country` AS `country`,`s`.`decimal_latitude` AS `decimalLatitude`,`s`.`decimal_longitude` AS `decimalLongitude`,`s`.`latlonmaxerror` AS `georeferenceRemarks`,`s`.`datedetermined` AS `dateIdentified`,concat(`s`.`habitat`,if(strcmp(`s`.`microhabitat`,''),concat(if(strcmp(`s`.`habitat`,''),_utf8'; ',''),`s`.`microhabitat`),'')) AS `habitat`,`s`.`collectedby` AS `recordedBy`,`s`.`method` AS `samplingProtocol`,`s`.`caste` AS `sex`,`s`.`medium` AS `preparations`,`s`.`datecollectedstart` AS `dateCollected`,`s`.`collectioncode` AS `fieldNumber`,`s`.`determinedby` AS `identifiedBy`,`s`.`localityname` AS `locality`,`s`.`localitynotes` AS `locationRemarks`,`s`.`specimennotes` AS `occurrenceRemarks`,`s`.`collectionnotes` AS `fieldNotes`,concat(`s`.`datecollectedstart`,if(strcmp(`s`.`datecollectedend`,''),concat(_utf8'/',`s`.`datecollectedend`),'')) AS `eventDate`,concat(`s`.`datecollectedstartstr`,if(strcmp(`s`.`datecollectedendstr`,''),concat(_utf8'/',`s`.`datecollectedendstr`),'')) AS `verbatimEventDate`,`s`.`elevation` AS `minimumElevationInMeters`,`s`.`bioregion` AS `biogeographicregion`,`s`.`image_count` AS `image_count`,`s`.`museum` AS `museum`,`s`.`ownedby` AS `ownedby`,`s`.`locatedat` AS `locatedat`,`s`.`collectedby` AS `collectedby` from (`specimen` `s` join `taxon` `t` on((`t`.`taxon_name` = `s`.`taxon_name`))) + -# create index col_localityname_idx on specimen (localityname); \ No newline at end of file diff --git a/doc/release.txt b/doc/release.txt index 67247416..045ed9ca 100755 --- a/doc/release.txt +++ b/doc/release.txt @@ -1,8 +1,8 @@ -Release 8.62.1 +Release 8.63 serverStatus display geolocaleTaxaPresent flagging. Specimen XML logging change. - + Image upload error handling refinements. Release 8.62 Fix css column display for Show Specimen Taxa feature. diff --git a/src/org/calacademy/antweb/imageUploader/ImageUploaded.java b/src/org/calacademy/antweb/imageUploader/ImageUploaded.java index bcf4cbef..da7301df 100644 --- a/src/org/calacademy/antweb/imageUploader/ImageUploaded.java +++ b/src/org/calacademy/antweb/imageUploader/ImageUploaded.java @@ -97,20 +97,23 @@ public static String getTestString(String fileName) { } // From the original file uploaded we derive the code, the shot and number. - public void init(String fileName) { + public String init(String fileName) { + String message = "success"; int u1 = 0; int u2 = 0; int period = 0; try { if (fileName == null) { - setErrorMessage("Null filename"); - return; + message = "Null filename"; + setErrorMessage(message); + return message; } setFileName(fileName); u1 = fileName.indexOf("_"); if (u1 <= 0) { - setErrorMessage("_ and shot type required."); - return; + message = "_ and shot type required."; + setErrorMessage(message); + return message; } // handle underscore that could be early in the name. @@ -128,43 +131,25 @@ public void init(String fileName) { String beforePeriod = fileName.substring(0, fileName.indexOf(".")); if (!beforePeriod.equals(beforePeriod.toUpperCase())) { - setErrorMessage("Filename must be uppercase"); - return; + message = "Filename must be uppercase"; + setErrorMessage(message); + return message; } - -/* - u2 = fileName.indexOf("_", u1 + 1); - period = fileName.indexOf("."); - if (u2 <= 0) { - setNumber(1); - String shot = fileName.substring(u1 + 1, period).toLowerCase(); - if (!Arrays.asList(new String[]{"d", "p", "h", "l", "v"}).contains(shot)){ - setErrorMessage("Unsupported shot type"); - return; - } - setShot(shot); - } else { - setShot(fileName.substring(u1 + 1, u2).toLowerCase()); - String num = fileName.substring(u2 + 1, period); - if (num != null) setNumber(new Integer(num).intValue()); - } -*/ - -// setShot(shot.toLowerCase()); - u2 = fileName.indexOf("_", u1 + 1); period = fileName.indexOf("."); if (u2 <= 0) { setNumber(1); String shot = fileName.substring(u1 + 1, period); if (shot.contains(" ")){ - setErrorMessage("Shot contains space"); - return; + message = "Shot contains space"; + setErrorMessage(message); + return message; } if (!Arrays.asList(new String[]{"D", "P", "H", "L", "V"}).contains(shot)){ - setErrorMessage("Unsupported shot type"); - return; + message = "Unsupported shot type"; + setErrorMessage(message); + return message; } setShot(shot.toLowerCase()); } else { @@ -179,15 +164,15 @@ public void init(String fileName) { setExt(ext); //A.log("populate() fileName:" + fileName + " u1:" + u1 + " u2:" + u2 + " period:" + period + " code:" + getCode() + " shot:" + getShot() + " number:" + getNumber() + " ext:" + ext); - //A.log("init() this:" + this.toString()); - - return; + return message; } catch (NumberFormatException e) { s_log.warn("populate() e:" + e); } catch (StringIndexOutOfBoundsException e) { - s_log.warn("populate() e:" + e); - } - setErrorMessage("Invalid filename"); + s_log.warn("populate() fileName:" + fileName + " e:" + e); + } + message = "Invalid filename:" + fileName; + setErrorMessage(message); + return message; } public String genImages() { diff --git a/src/org/calacademy/antweb/imageUploader/ImageUploaderAction.java b/src/org/calacademy/antweb/imageUploader/ImageUploaderAction.java index 4c151ee9..cca2f96c 100755 --- a/src/org/calacademy/antweb/imageUploader/ImageUploaderAction.java +++ b/src/org/calacademy/antweb/imageUploader/ImageUploaderAction.java @@ -83,7 +83,7 @@ public ActionForward execute(ActionMapping mapping, ActionForm form, ImageUpload imageUpload = null; UploadAction.setIsInUploadProcess(accessLogin.getName() + ":" + accessGroup.getName()); -A.log(accessLogin.getName() + ":" + accessGroup.getName()); + //A.log(accessLogin.getName() + ":" + accessGroup.getName()); ImageUploaded.tempDir.toFile().mkdirs(); // /usr/local/antweb/temp/images/ @@ -111,7 +111,23 @@ public ActionForward execute(ActionMapping mapping, ActionForm form, for (FileItem fileItem : fileItems) { if (!fileItem.isFormField()) { ImageUploaded imageUploaded = new ImageUploaded(); - imageUploaded.init(fileItem.getName()); // parse + message = imageUploaded.init(fileItem.getName()); // parse + + if (!"success".equals(message)) { + request.setAttribute("message", message); + s_log.warn(message); + return (mapping.findForward("message")); + } + + String code = imageUploaded.getCode(); + boolean exists = (new SpecimenDb(connection)).exists(code); + if (!exists) { + message = "Specimen:" + code + " not found in the Antweb database."; + request.setAttribute("message", message); + s_log.warn(message); + return (mapping.findForward("message")); + } + boolean specimenDataExists = specimenDb.exists(imageUploaded.getCode()); imageUploaded.setIsSpecimenDataExists(specimenDataExists); // verify specimen existence. imageUploaded.setFileItem(fileItem); // write to disk. @@ -158,12 +174,13 @@ public ActionForward execute(ActionMapping mapping, ActionForm form, return (mapping.findForward("imageUploader")); } } catch (Exception ex) { - AntwebUtil.logStackTrace(ex); + //AntwebUtil.logStackTrace(ex); AntwebUtil.log("ImageUploaderAction.execute() e:" + ex); message = "Error uploading images. ex:" + ex.toString(); AdminAlertMgr.add(message, connection); request.setAttribute("message", message); - return (mapping.findForward("message")); + s_log.warn(message + " temppDir:" + ImageUploaded.tempDir); + return (mapping.findForward("message")); } finally { DBUtil.close(connection, this, "ImageUploaderAction.execute()"); UploadAction.setIsInUploadProcess(null); diff --git a/web/util/pageTracker-body.jsp b/web/util/pageTracker-body.jsp index 19c06273..625320ed 100755 --- a/web/util/pageTracker-body.jsp +++ b/web/util/pageTracker-body.jsp @@ -38,12 +38,12 @@ if (thisTracker != null) { %>
  Target list: <% - String star = ""; + String isThisPage = ""; for (Tracker tracker : PageTracker.getTrackers()) { - if (tracker.getKey().equals(request.getAttribute("trackerKey"))) star = "*"; + if (tracker.getKey().equals(request.getAttribute("trackerKey"))) isThisPage = "isThisPage: *"; %> -
    <%= tracker.getTarget() %> code:<%= tracker.getCode() %> time:<%= tracker.getSinceStartTime() %> isThisPage:<%= star %> +
    <%= tracker.getTarget() %> code:<%= tracker.getCode() %> time:<%= tracker.getSinceStartTime() %> <%= isThisPage %> <% - star = ""; + isThisPage = ""; } %> diff --git a/web/util/serverStatus-body.jsp b/web/util/serverStatus-body.jsp index f8f4fdbf..14a95b40 100755 --- a/web/util/serverStatus-body.jsp +++ b/web/util/serverStatus-body.jsp @@ -135,6 +135,7 @@ String serverDetails = (String) request.getAttribute("serverDetails"); out.println("
name:" + name + " value:" + session.getAttribute(name)); } else { out.println("
name:dummyForm"); + Antweb.org("serverStatus-body.jsp dummyForm:" + } } %>