You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by im...@apache.org on 2004/12/29 09:24:55 UTC
cvs commit: jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/provider DefaultFileContent.java
imario 2004/12/29 00:24:55
Modified: vfs/src/java/org/apache/commons/vfs/provider
DefaultFileContent.java
Log:
create thread-data on demand to have it correctly initialized within the thread's scope
Revision Changes Path
1.24 +10 -5 jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/provider/DefaultFileContent.java
Index: DefaultFileContent.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/provider/DefaultFileContent.java,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- DefaultFileContent.java 21 Dec 2004 21:54:32 -0000 1.23
+++ DefaultFileContent.java 29 Dec 2004 08:24:55 -0000 1.24
@@ -1,12 +1,12 @@
/*
* Copyright 2002, 2003,2004 The Apache Software Foundation.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -61,14 +61,19 @@
public DefaultFileContent(final AbstractFileObject file, final FileContentInfoFactory fileContentInfoFactory)
{
- this.threadData.set(new FileContentThreadData(this));
this.file = file;
this.fileContentInfoFactory = fileContentInfoFactory;
}
private FileContentThreadData getThreadData()
{
- return (FileContentThreadData) this.threadData.get();
+ FileContentThreadData data = (FileContentThreadData) this.threadData.get();
+ if (data == null)
+ {
+ data = new FileContentThreadData(this);
+ this.threadData.set(data);
+ }
+ return data;
}
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org