[ 
https://issues.apache.org/jira/browse/JSPWIKI-575?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14073285#comment-14073285
 ] 

Leonardo Costantini commented on JSPWIKI-575:
---------------------------------------------

Hi all,
I have similar issue in JSPWIKI 2.10.1
I look at the code where it start:
int LATEST_VERSION = -1;

.    public void doGet( HttpServletRequest  req, HttpServletResponse res )
        throws IOException, ServletException
    {
        WikiContext context = m_engine.createContext( req, WikiContext.ATTACH );

        String version  = req.getParameter( HDR_VERSION );
        String nextPage = req.getParameter( "nextpage" );

        String msg      = "An error occurred. Ouch.";
        int    ver      = WikiProvider.LATEST_VERSION;

        AttachmentManager mgr = m_engine.getAttachmentManager();
        AuthorizationManager authmgr = m_engine.getAuthorizationManager();


        String page = context.getPage().getName();

        if( page == null )
        {
            log.info("Invalid attachment name.");
            res.sendError( HttpServletResponse.SC_BAD_REQUEST );
            return;
        }

        OutputStream out = null;
        InputStream  in  = null;

        try
        {
            log.debug("Attempting to download att "+page+", version "+version);
            if( version != null )
            {
                ver = Integer.parseInt( version );
            }

IMHO  ver is not properly initilaised in case this is the first version of the 
page, and thus the version is -1
Where is version initialised (in the code), when performing the first upload of 
an attachment?

Best Regards,
Leonardo

> Attachment objects with wrong version numbers (-1)
> --------------------------------------------------
>
>                 Key: JSPWIKI-575
>                 URL: https://issues.apache.org/jira/browse/JSPWIKI-575
>             Project: JSPWiki
>          Issue Type: Bug
>          Components: Core & storage
>    Affects Versions: 2.8.2
>         Environment: Win, Tomcat, IE + FF
>            Reporter: Jochen Reutelshoefer
>
> If a new version of an attachment is uploaded jspwiki looks for the old 
> version. This old version can not be found because its looked up with a wrong 
> page  name (AttachmentServlet.executeUpload()). We believe the reason is that 
> the current page name is not contained in this request. 
> (DefaultURLConstructor.parsePage()) 
> We are implmenting a plugin that listens attachment file versions and we 
> cannot manage to do so because the version number fo the Attachment is always 
> -1.
> When the server is restartet all version numbers are initialized correctly 
> but will be corrupted by new uploads of the particular file.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to