You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jspwiki.apache.org by ju...@apache.org on 2024/12/19 22:37:00 UTC

(jspwiki) branch master updated (7bf665751 -> 76669e391)

This is an automated email from the ASF dual-hosted git repository.

juanpablo pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/jspwiki.git


    from 7bf665751 2.12.3-git-02
     new bd412b29b JSPWIKI-1197 fix for if and when someone, other software (antivirus, etc) or a human deletes an attachment from disk and leaves behind a properties file in the attachment director for a given wiki page. Before this change jspwiki would not boot up in this condition. After it will and simply logs this error condition.
     new 76669e391 formatting

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../org/apache/wiki/providers/BasicAttachmentProvider.java  | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)


(jspwiki) 01/02: JSPWIKI-1197 fix for if and when someone, other software (antivirus, etc) or a human deletes an attachment from disk and leaves behind a properties file in the attachment director for a given wiki page. Before this change jspwiki would not boot up in this condition. After it will and simply logs this error condition.

Posted by ju...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

juanpablo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jspwiki.git

commit bd412b29bcaa994ef870afa003c0c0470973409a
Author: Alex <sp...@gmail.com>
AuthorDate: Sat Aug 17 11:09:31 2024 -0400

    JSPWIKI-1197 fix for if and when someone, other software (antivirus, etc) or a human deletes an attachment from disk and leaves behind a properties file in the attachment director for a given wiki page. Before this change jspwiki would not boot up in this condition. After it will and simply logs this error condition.
---
 .../org/apache/wiki/providers/BasicAttachmentProvider.java | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/jspwiki-main/src/main/java/org/apache/wiki/providers/BasicAttachmentProvider.java b/jspwiki-main/src/main/java/org/apache/wiki/providers/BasicAttachmentProvider.java
index 86c3cf320..ee4b0b054 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/providers/BasicAttachmentProvider.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/providers/BasicAttachmentProvider.java
@@ -379,12 +379,12 @@ public class BasicAttachmentProvider implements AttachmentProvider {
                     final Attachment att = getAttachmentInfo( page, attachmentName, WikiProvider.LATEST_VERSION );
                     //  Sanity check - shouldn't really be happening, unless you mess with the repository directly.
                     if( att == null ) {
-                        throw new ProviderException( "Attachment disappeared while reading information:"
-                                + " if you did not touch the repository, there is a serious bug somewhere. " + "Attachment = " + attachment
+                        LOG.error( "Attachment disappeared while reading information:"
+                                + " if you did not touch the repository, there is a serious bug somewhere or perhaps it"
+                                + " was deleted by antivirus software, etc. " + "Attachment = " + attachment
                                 + ", decoded = " + attachmentName );
-                    }
-
-                    result.add( att );
+                    } else 
+                        result.add( att );
                 }
             }
         }
@@ -408,7 +408,9 @@ public class BasicAttachmentProvider implements AttachmentProvider {
     public List< Attachment > listAllChanged( final Date timestamp ) throws ProviderException {
         final File attDir = new File( m_storageDir );
         if( !attDir.exists() ) {
-            throw new ProviderException( "Specified attachment directory " + m_storageDir + " does not exist!" );
+            if (!attDir.mkdirs()) {
+                throw new ProviderException( "Specified attachment directory " + m_storageDir + " does not exist!" );
+            }
         }
 
         final ArrayList< Attachment > list = new ArrayList<>();


(jspwiki) 02/02: formatting

Posted by ju...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

juanpablo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jspwiki.git

commit 76669e391c6105c426c23a01ad9c589be2517d39
Author: Alex <sp...@gmail.com>
AuthorDate: Sat Aug 17 11:09:41 2024 -0400

    formatting
---
 .../main/java/org/apache/wiki/providers/BasicAttachmentProvider.java   | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/jspwiki-main/src/main/java/org/apache/wiki/providers/BasicAttachmentProvider.java b/jspwiki-main/src/main/java/org/apache/wiki/providers/BasicAttachmentProvider.java
index ee4b0b054..1b5ce9835 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/providers/BasicAttachmentProvider.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/providers/BasicAttachmentProvider.java
@@ -383,8 +383,9 @@ public class BasicAttachmentProvider implements AttachmentProvider {
                                 + " if you did not touch the repository, there is a serious bug somewhere or perhaps it"
                                 + " was deleted by antivirus software, etc. " + "Attachment = " + attachment
                                 + ", decoded = " + attachmentName );
-                    } else 
+                    } else {
                         result.add( att );
+                    }
                 }
             }
         }