@@ -0,0 +1,2931 @@
+/*%0A%0ACopyright (c) 2000-2021, Board of Trustees of Leland Stanford Jr. University%0AAll rights reserved.%0A%0ARedistribution and use in source and binary forms, with or without%0Amodification, are permitted provided that the following conditions are met:%0A%0A1. Redistributions of source code must retain the above copyright notice,%0Athis list of conditions and the following disclaimer.%0A%0A2. Redistributions in binary form must reproduce the above copyright notice,%0Athis list of conditions and the following disclaimer in the documentation%0Aand/or other materials provided with the distribution.%0A%0A3. Neither the name of the copyright holder nor the names of its contributors%0Amay be used to endorse or promote products derived from this software without%0Aspecific prior written permission.%0A%0ATHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS %22AS IS%22%0AAND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE%0AIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE%0AARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE%0ALIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR%0ACONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF%0ASUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS%0AINTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN%0ACONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)%0AARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE%0APOSSIBILITY OF SUCH DAMAGE.%0A%0A*/%0A%0Apackage org.lockss.plugin.highwire.nas;%0A%0Aimport org.lockss.plugin.ArchivalUnit;%0Aimport org.lockss.plugin.highwire.HighWirePressH20HttpResponseHandler;%0Aimport org.lockss.util.Logger;%0Aimport org.lockss.util.urlconn.CacheException;%0Aimport org.lockss.util.urlconn.CacheResultMap;%0A%0Apublic class NasDrupalHttpResponseHandler extends HighWirePressH20HttpResponseHandler %7B%0A%0A  // https://www.pnas.org/highwire/filestream/870826/field_highwire_adjunct_files/3/pnas.1902688116.sm03.avi%0A  //%0A%0A  private static final Logger logger = Logger.getLogger(NasDrupalHttpResponseHandler.class);%0A%0A  @Override%0A  public void init(CacheResultMap crmap) %7B%0A    logger.warning(%22Unexpected call to init()%22);%0A    throw new UnsupportedOperationException(%22Unexpected call to NasHttpResponseHandler.init()%22);%0A  %7D%0A%0A  @Override%0A  public CacheException handleResult(ArchivalUnit au,%0A                                     String url,%0A                                     int responseCode) %7B%0A    logger.debug2(url);%0A    switch (responseCode) %7B%0A      case 520:%0A        logger.debug2(%22520%22);%0A        if (url.endsWith(%22.avi%22)%0A            && url.contains(%22field_highwire_adjunct_files%22)) %7B%0A          return new CacheException.NoRetryDeadLinkException(%22520 Origin Error (non-fatal)%22);%0A        %7D%0A        return new CacheException.RetrySameUrlException(%22520 Origin Error%22);%0A    %7D%0A    return super.handleResult(au, url, responseCode);%0A  %7D%0A%0A%7D%0A

add a HttpResponseHandler for National Academy of Sciences 520 errors