Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 20696

Summary: java.io.FileOutputStream :: (Filename too long)
Product: [Eclipse Project] Platform Reporter: David Williams <david_williams>
Component: TeamAssignee: Kevin McGuire <Kevin_McGuire>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P1 CC: andrewjobel56, aryanvermame, nbuleski
Version: 2.0   
Target Milestone: 2.0 F4   
Hardware: PC   
OS: Windows 2000   
Whiteboard:

Description David Williams CLA 2002-06-19 19:47:40 EDT
I'm using the F3 driver, and others on team are using F2, for dev. environment.

I tried to 'branch' but some problem occurred (got an error about another user 
having a lock on some files ... and this is to a CVS repository, I should add.)

The branched version wasn't complete, so I did a compare to the other original 
branch and used "copy right" on a large group of files from the compare 
editor/browser. 

Three files ended up being empty files in my workspace. From then on, no matter 
what version I compared/replaced them with from repository, I always got an 
empty file. 

Others on the team, using F2 driver, could still "see" the repository files, 
and once they committed a good file to that new branch I could "see" it also, 
but still, even with a good version in my workspace, when I do compare with 
repository version/branch, the repository version always shows up empty.

Under some conditions, such as when I tried a "replace with repository version"
I got an error message about the filename being too long, though it was no 
longer than others.

Sorry I don't have a more reproducible scenerio, but thought I should document 
what I knew in case that helped.

This was on Windows 2000.
Comment 1 Kevin McGuire CLA 2002-06-19 20:43:55 EDT
Have you checked the .log?  Under certain conditions we are unable to display 
error messages to the user, but we do log them.  It could be that the remote 
was empty because we were failing retrieving it.
Comment 2 David Williams CLA 2002-06-19 21:13:52 EDT
Oh, good point to check the log. There was info there. Below I've pasted the 
top of the stack. Is the filename really too long? Is there a good limit to go 
by?




!ENTRY org.eclipse.jdt.ui 4 1 Jun 19, 2002 19:15:23.263
!MESSAGE Internal Error
!STACK 1
org.eclipse.core.runtime.CoreException[-6]: java.io.FileNotFoundException: 
D:\Builds\EB\eSDK-0612-F3
\eclipse\workspaceReleased\.metadata\.plugins\org.eclipse.team.cvs.core\.cache\c
vslnx01.raleigh.ibm.com\cvsrep\j2eedev\com.ibm.sed.editor\sedxml\com\ibm\sed\con
tentassist\html\javascript\JavaScriptCompletionAssistAdapter.java 1.1.4.1.2.16 
(Filename too long)
	at java.io.FileOutputStream.open(Native Method)
	at java.io.FileOutputStream.<init>(FileOutputStream.java(Compiled Code))
	at java.io.FileOutputStream.<init>(FileOutputStream.java:76)
	at java.io.FileOutputStream.<init>(FileOutputStream.java:146)
	at 
org.eclipse.team.internal.ccvs.core.resources.RemoteFile.switchToCacheOutputStre
am(RemoteFile.java:525)
	at org.eclipse.team.internal.ccvs.core.resources.RemoteFile.setContents
(RemoteFile.java:348)
	at org.eclipse.team.internal.ccvs.core.client.Session.receiveFile
(Session.java(Compiled Code))
	at org.eclipse.team.internal.ccvs.core.client.UpdatedHandler.handle
(UpdatedHandler.java(Compiled Code))
	at org.eclipse.team.internal.ccvs.core.client.Request.executeRequest
(Request.java(Compiled Code))
	at org.eclipse.team.internal.ccvs.core.client.Command.doExecute
(Command.java:390)
	at org.eclipse.team.internal.ccvs.core.client.Command$2.run
(Command.java:322)
	at org.eclipse.team.internal.ccvs.core.resources.RemoteFolder.run
(RemoteFolder.java:692)
	at org.eclipse.team.internal.ccvs.core.client.Command.execute
(Command.java:333)
	at org.eclipse.team.internal.ccvs.core.client.Command.execute
(Command.java:712)
	at org.eclipse.team.internal.ccvs.core.resources.RemoteFile$1.run
(RemoteFile.java:142)
	at org.eclipse.team.internal.ccvs.core.resources.RemoteFolder.run
(RemoteFolder.java:692)
	at org.eclipse.team.internal.ccvs.core.client.Session.run
(Session.java:192)
	at org.eclipse.team.internal.ccvs.core.resources.RemoteFile.getContents
(RemoteFile.java:140)
	at org.eclipse.team.internal.ui.sync.MergeResource.getLatestRevision
(MergeResource.java:79)
	at org.eclipse.team.internal.ui.sync.TeamFile$2.createStream
(TeamFile.java:82)
	at org.eclipse.compare.BufferedContent.getContents
(BufferedContent.java:43)
	at org.eclipse.jdt.internal.ui.compare.JavaStructureCreator.getStructure
(JavaStructureCreator.java:132)
	at 
org.eclipse.compare.structuremergeviewer.StructureDiffViewer.compareInputChanged
(StructureDiffViewer.java:218)
	at 
org.eclipse.jdt.internal.ui.compare.JavaStructureDiffViewer.compareInputChanged
(JavaStructureDiffViewer.java:80)
	at 
org.eclipse.compare.structuremergeviewer.StructureDiffViewer.inputChanged
(StructureDiffViewer.java:148)
	at org.eclipse.jface.viewers.ContentViewer.setInput
(ContentViewer.java:234)
	at org.eclipse.jface.viewers.StructuredViewer.setInput
(StructuredViewer.java:875)
	at org.eclipse.compare.CompareViewerSwitchingPane.setInput
(CompareViewerSwitchingPane.java:261)
	at org.eclipse.compare.CompareEditorInput$12.run
(CompareEditorInput.java:564)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:64)
	at org.eclipse.compare.CompareEditorInput.feedDefault1
(CompareEditorInput.java:560)
	at org.eclipse.compare.CompareEditorInput.access$2
(CompareEditorInput.java:559)
	at org.eclipse.compare.CompareEditorInput$8.doubleClick
(CompareEditorInput.java:428)
	at org.eclipse.compare.CompareViewerSwitchingPane.doubleClick
(CompareViewerSwitchingPane.java:197)
	at org.eclipse.jface.viewers.StructuredViewer.fireDoubleClick
(StructuredViewer.java:306)
Comment 3 Kevin McGuire CLA 2002-06-19 22:23:47 EDT
Moving to Core for comment.

Also reworded title from:
   F3 compare show's empty file in repository but F2 doesn't
Comment 4 John Arthorne CLA 2002-06-20 10:12:30 EDT
The maximum filename length on windows is 255 characters, which is why the 
IOException occurs.  This shouldn't be the user's problem, since it's an 
internal cache file whose name is too long.  The cache could use random 
filenames and maintain an index to the real filename.

There is no platform core code anywhere in this stack trace.  The CoreException 
is thrown by MergeResource.getLatestRevision().

Back to team.
Comment 5 Kevin McGuire CLA 2002-06-20 11:41:46 EDT
(Aside: that's one honkin' filename!)

The file is required for caching large remote files (over 32k) to avoid 
refetching contents each time during compare, etc.  The filename must be unique 
since we don't easely know the lifespan of the cache (because its required by 
the UI).  Post 2.0, we will look at having randomly generated filenames with an 
in memory lookup table mapping the path to the generated filename.

For 2.0, since we can't determine the maximum filename length for the OS, 
workaround will be:

- catch the exception in RemoteFile.setContents()
- on exception, don't use local caching file.
- write warning to launch to indicate that caching could not occur due to long 
filename

This will mean slower performance when comparing large files but will at least 
allow the user to proceed.

Risk: small to moderate - to change is small and localized, but it's in often 
used to code
Value: allows user to keep working when filenames are too long or the OS 
doesn't support sufficiently long filenames.
Comment 6 David Williams CLA 2002-06-20 12:52:25 EDT
Am I reading the discussion correctly this is only a problem for 
files over 32K? 

Also, is there a workaround for this problem? Would one be just to install with 
shorter install/workspace directory?
Mine was D:\Builds\EB\eSDK-0612-F3\eclipse\workspaceReleased\
Or is there a better workaround?
Comment 7 Kevin McGuire CLA 2002-06-20 14:39:17 EDT
Yes to both questions.
Comment 8 Michael Valenta CLA 2002-06-21 12:11:39 EDT
Fixed and verified by KM and DJ
Comment 9 Antonio D'souza CLA 2002-06-26 10:56:48 EDT
Looks like it works now.
Comment 10 ray mono CLA 2016-03-03 10:20:53 EST
Hi all, I have been suffering from accessing, managing and even renaming files
>>> that have more than 255 characters over a long time. I have tried various ways
>>> but failed. Then I have searched this problem in internet. Then I have found a solution. This software is very easy to use. Named Long path Tool.
Comment 11 Andrew Jobel Jobel CLA 2018-02-28 08:55:41 EST
I recommend LongPathTool, Please try.
Comment 12 Mark Lee CLA 2023-03-10 12:12:39 EST
I was using the LongPathTool and it helped me. It is a very useful tool you should try it.