[prev in list] [next in list] [prev in thread] [next in thread]
List: jakarta-commons-dev
Subject: [jira] Updated: (VFS-220) Wrong test in
From: "Gilles Gaillard (JIRA)" <jira () apache ! org>
Date: 2008-09-30 20:13:44
Message-ID: 1056849899.1222805624227.JavaMail.jira () brutus
[Download RAW message or body]
[ https://issues.apache.org/jira/browse/VFS-220?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel \
]
Gilles Gaillard updated VFS-220:
--------------------------------
Description:
Method endOutput() is called when a file is created or an outputstream closed.
The current code says:
{noformat}
if (getType() == FileType.IMAGINARY) {
// File was created
handleCreate(FileType.FILE);
} else {
// File has changed
onChange();
}
{noformat}
Calling getType() on a file that wasn't previously attached will cause the file to be \
attached and therefore not return FileType.IMAGINARY since it's just been created. \
Hence the list of children in the parent will become wrong.
To correct, replace the test by 'if (type == FileType.IMAGINARY)', and the method \
becomes: {noformat}
protected void endOutput() throws Exception
{
// NOTE: don't use getType() here
if (type == FileType.IMAGINARY)
{
// File was created
handleCreate(FileType.FILE);
}
else
{
// File has changed
onChange();
}
}
{noformat}
was:
Method endOutput() is called when a file is created or an outputstream closed.
The current code says:
if (getType() == FileType.IMAGINARY) {
// File was created
handleCreate(FileType.FILE);
} else {
// File has changed
onChange();
}
Calling getType() on a file that wasn't previously attached will cause the file to be \
attached and therefore not return FileType.IMAGINARY since it's just been created. \
Hence the list of children in the parent will become wrong.
To correct, replace the test by 'if (type == FileType.IMAGINARY)', and the method \
becomes:
protected void endOutput() throws Exception
{
// NOTE: don't use getType() here
if (type == FileType.IMAGINARY)
{
// File was created
handleCreate(FileType.FILE);
}
else
{
// File has changed
onChange();
}
}
suppress format for code excerpt
> Wrong test in AbstractFileObject.endOutput may cause invalid list of children
> -----------------------------------------------------------------------------
>
> Key: VFS-220
> URL: https://issues.apache.org/jira/browse/VFS-220
> Project: Commons VFS
> Issue Type: Bug
> Environment: all
> Reporter: Gilles Gaillard
> Original Estimate: 1h
> Remaining Estimate: 1h
>
> Method endOutput() is called when a file is created or an outputstream closed.
> The current code says:
> {noformat}
> if (getType() == FileType.IMAGINARY) {
> // File was created
> handleCreate(FileType.FILE);
> } else {
> // File has changed
> onChange();
> }
> {noformat}
> Calling getType() on a file that wasn't previously attached will cause the file to \
> be attached and therefore not return FileType.IMAGINARY since it's just been \
> created. Hence the list of children in the parent will become wrong.
> To correct, replace the test by 'if (type == FileType.IMAGINARY)', and the method \
> becomes: {noformat}
> protected void endOutput() throws Exception
> {
> // NOTE: don't use getType() here
> if (type == FileType.IMAGINARY)
> {
> // File was created
> handleCreate(FileType.FILE);
> }
> else
> {
> // File has changed
> onChange();
> }
> }
> {noformat}
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic