Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
f6d3feef
D
dragonwell8_jdk
项目概览
openanolis
/
dragonwell8_jdk
通知
3
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_jdk
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
f6d3feef
编写于
7月 23, 2009
作者:
R
rupashka
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
6460525: javax/swing/JFileChooser/6396844/TwentyThousandTest.java times out
Reviewed-by: malenkov, peterz
上级
4c55daa3
变更
7
展开全部
隐藏空白更改
内联
并排
Showing
7 changed file
with
281 addition
and
202 deletion
+281
-202
src/share/classes/javax/swing/JFileChooser.java
src/share/classes/javax/swing/JFileChooser.java
+6
-1
src/share/classes/javax/swing/plaf/basic/BasicDirectoryModel.java
...e/classes/javax/swing/plaf/basic/BasicDirectoryModel.java
+7
-3
src/share/classes/sun/awt/shell/ShellFolder.java
src/share/classes/sun/awt/shell/ShellFolder.java
+52
-8
src/share/classes/sun/awt/shell/ShellFolderManager.java
src/share/classes/sun/awt/shell/ShellFolderManager.java
+3
-7
src/share/classes/sun/swing/FilePane.java
src/share/classes/sun/swing/FilePane.java
+3
-4
src/windows/classes/sun/awt/shell/Win32ShellFolder2.java
src/windows/classes/sun/awt/shell/Win32ShellFolder2.java
+151
-145
src/windows/classes/sun/awt/shell/Win32ShellFolderManager2.java
...ndows/classes/sun/awt/shell/Win32ShellFolderManager2.java
+59
-34
未找到文件。
src/share/classes/javax/swing/JFileChooser.java
浏览文件 @
f6d3feef
/*
* Copyright 1997-200
8
Sun Microsystems, Inc. All Rights Reserved.
* Copyright 1997-200
9
Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -739,6 +739,11 @@ public class JFileChooser extends JComponent implements Accessible {
dialog
.
show
();
firePropertyChange
(
"JFileChooserDialogIsClosingProperty"
,
dialog
,
null
);
// Remove all components from dialog. The MetalFileChooserUI.installUI() method (and other LAFs)
// registers AWT listener for dialogs and produces memory leaks. It happens when
// installUI invoked after the showDialog method.
dialog
.
getContentPane
().
removeAll
();
dialog
.
dispose
();
dialog
=
null
;
return
returnValue
;
...
...
src/share/classes/javax/swing/plaf/basic/BasicDirectoryModel.java
浏览文件 @
f6d3feef
/*
* Copyright 1998-200
8
Sun Microsystems, Inc. All Rights Reserved.
* Copyright 1998-200
9
Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -232,6 +232,10 @@ public class BasicDirectoryModel extends AbstractListModel implements PropertyCh
public
void
run0
()
{
FileSystemView
fileSystem
=
filechooser
.
getFileSystemView
();
if
(
isInterrupted
())
{
return
;
}
File
[]
list
=
fileSystem
.
getFiles
(
currentDirectory
,
filechooser
.
isFileHidingEnabled
());
if
(
isInterrupted
())
{
...
...
@@ -268,8 +272,8 @@ public class BasicDirectoryModel extends AbstractListModel implements PropertyCh
// To avoid loads of synchronizations with Invoker and improve performance we
// execute the whole block on the COM thread
DoChangeContents
doChangeContents
=
ShellFolder
.
getInvoker
().
invoke
(
new
Callable
<
DoChangeContents
>()
{
public
DoChangeContents
call
()
throws
Exception
{
DoChangeContents
doChangeContents
=
ShellFolder
.
invoke
(
new
Callable
<
DoChangeContents
>()
{
public
DoChangeContents
call
()
{
int
newSize
=
newFileCache
.
size
();
int
oldSize
=
fileCache
.
size
();
...
...
src/share/classes/sun/awt/shell/ShellFolder.java
浏览文件 @
f6d3feef
/*
* Copyright 2000-200
8
Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2000-200
9
Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -289,8 +289,8 @@ public abstract class ShellFolder extends File {
// To avoid loads of synchronizations with Invoker and improve performance we
// synchronize the whole code of the sort method once
getInvoker
().
invoke
(
new
Callable
<
Void
>()
{
public
Void
call
()
throws
Exception
{
invoke
(
new
Callable
<
Void
>()
{
public
Void
call
()
{
// Check that we can use the ShellFolder.sortChildren() method:
// 1. All files have the same non-null parent
// 2. All files is ShellFolders
...
...
@@ -330,8 +330,8 @@ public abstract class ShellFolder extends File {
public
void
sortChildren
(
final
List
<?
extends
File
>
files
)
{
// To avoid loads of synchronizations with Invoker and improve performance we
// synchronize the whole code of the sort method once
getInvoker
().
invoke
(
new
Callable
<
Void
>()
{
public
Void
call
()
throws
Exception
{
invoke
(
new
Callable
<
Void
>()
{
public
Void
call
()
{
Collections
.
sort
(
files
,
FILE_COMPARATOR
);
return
null
;
...
...
@@ -501,18 +501,62 @@ public abstract class ShellFolder extends File {
return
invoker
;
}
/**
* Invokes the {@code task} which doesn't throw checked exceptions
* from its {@code call} method. If invokation is interrupted then Thread.currentThread().isInterrupted() will
* be set and result will be {@code null}
*/
public
static
<
T
>
T
invoke
(
Callable
<
T
>
task
)
{
try
{
return
invoke
(
task
,
RuntimeException
.
class
);
}
catch
(
InterruptedException
e
)
{
return
null
;
}
}
/**
* Invokes the {@code task} which throws checked exceptions from its {@code call} method.
* If invokation is interrupted then Thread.currentThread().isInterrupted() will
* be set and InterruptedException will be thrown as well.
*/
public
static
<
T
,
E
extends
Throwable
>
T
invoke
(
Callable
<
T
>
task
,
Class
<
E
>
exceptionClass
)
throws
InterruptedException
,
E
{
try
{
return
getInvoker
().
invoke
(
task
);
}
catch
(
Exception
e
)
{
if
(
e
instanceof
RuntimeException
)
{
// Rethrow unchecked exceptions
throw
(
RuntimeException
)
e
;
}
if
(
e
instanceof
InterruptedException
)
{
// Set isInterrupted flag for current thread
Thread
.
currentThread
().
interrupt
();
// Rethrow InterruptedException
throw
(
InterruptedException
)
e
;
}
if
(
exceptionClass
.
isInstance
(
e
))
{
throw
exceptionClass
.
cast
(
e
);
}
throw
new
RuntimeException
(
"Unexpected error"
,
e
);
}
}
/**
* Interface allowing to invoke tasks in different environments on different platforms.
*/
public
static
interface
Invoker
{
/**
* Invokes a callable task. If the {@code task} throws a checked exception,
* it will be wrapped into a {@link RuntimeException}
* Invokes a callable task.
*
* @param task a task to invoke
* @throws Exception {@code InterruptedException} or an exception that was thrown from the {@code task}
* @return the result of {@code task}'s invokation
*/
<
T
>
T
invoke
(
Callable
<
T
>
task
);
<
T
>
T
invoke
(
Callable
<
T
>
task
)
throws
Exception
;
}
/**
...
...
src/share/classes/sun/awt/shell/ShellFolderManager.java
浏览文件 @
f6d3feef
/*
* Copyright 2000-200
8
Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2000-200
9
Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -108,12 +108,8 @@ class ShellFolderManager {
}
private
static
class
DirectInvoker
implements
ShellFolder
.
Invoker
{
public
<
T
>
T
invoke
(
Callable
<
T
>
task
)
{
try
{
return
task
.
call
();
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
e
);
}
public
<
T
>
T
invoke
(
Callable
<
T
>
task
)
throws
Exception
{
return
task
.
call
();
}
}
}
src/share/classes/sun/swing/FilePane.java
浏览文件 @
f6d3feef
/*
* Copyright 2003-200
8
Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2003-200
9
Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -905,8 +904,8 @@ public class FilePane extends JPanel implements PropertyChangeListener {
@Override
public
void
sort
()
{
ShellFolder
.
getInvoker
().
invoke
(
new
Callable
<
Void
>()
{
public
Void
call
()
throws
Exception
{
ShellFolder
.
invoke
(
new
Callable
<
Void
>()
{
public
Void
call
()
{
DetailsTableRowSorter
.
super
.
sort
();
return
null
;
}
...
...
src/windows/classes/sun/awt/shell/Win32ShellFolder2.java
浏览文件 @
f6d3feef
此差异已折叠。
点击以展开。
src/windows/classes/sun/awt/shell/Win32ShellFolderManager2.java
浏览文件 @
f6d3feef
/*
* Copyright 2003-200
8
Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2003-200
9
Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -58,10 +58,15 @@ public class Win32ShellFolderManager2 extends ShellFolderManager {
}
public
ShellFolder
createShellFolder
(
File
file
)
throws
FileNotFoundException
{
return
createShellFolder
(
getDesktop
(),
file
);
try
{
return
createShellFolder
(
getDesktop
(),
file
);
}
catch
(
InterruptedException
e
)
{
throw
new
FileNotFoundException
(
"Execution was interrupted"
);
}
}
static
Win32ShellFolder2
createShellFolder
(
Win32ShellFolder2
parent
,
File
file
)
throws
FileNotFoundException
{
static
Win32ShellFolder2
createShellFolder
(
Win32ShellFolder2
parent
,
File
file
)
throws
FileNotFoundException
,
InterruptedException
{
long
pIDL
;
try
{
pIDL
=
parent
.
parseDisplayName
(
file
.
getCanonicalPath
());
...
...
@@ -77,7 +82,8 @@ public class Win32ShellFolderManager2 extends ShellFolderManager {
return
folder
;
}
static
Win32ShellFolder2
createShellFolderFromRelativePIDL
(
Win32ShellFolder2
parent
,
long
pIDL
)
{
static
Win32ShellFolder2
createShellFolderFromRelativePIDL
(
Win32ShellFolder2
parent
,
long
pIDL
)
throws
InterruptedException
{
// Walk down this relative pIDL, creating new nodes for each of the entries
while
(
pIDL
!=
0
)
{
long
curPIDL
=
Win32ShellFolder2
.
copyFirstPIDLEntry
(
pIDL
);
...
...
@@ -108,7 +114,9 @@ public class Win32ShellFolderManager2 extends ShellFolderManager {
try
{
desktop
=
new
Win32ShellFolder2
(
DESKTOP
);
}
catch
(
IOException
e
)
{
desktop
=
null
;
// Ignore error
}
catch
(
InterruptedException
e
)
{
// Ignore error
}
}
return
desktop
;
...
...
@@ -119,7 +127,9 @@ public class Win32ShellFolderManager2 extends ShellFolderManager {
try
{
drives
=
new
Win32ShellFolder2
(
DRIVES
);
}
catch
(
IOException
e
)
{
drives
=
null
;
// Ignore error
}
catch
(
InterruptedException
e
)
{
// Ignore error
}
}
return
drives
;
...
...
@@ -132,8 +142,10 @@ public class Win32ShellFolderManager2 extends ShellFolderManager {
if
(
path
!=
null
)
{
recent
=
createShellFolder
(
getDesktop
(),
new
File
(
path
));
}
}
catch
(
InterruptedException
e
)
{
// Ignore error
}
catch
(
IOException
e
)
{
recent
=
null
;
// Ignore error
}
}
return
recent
;
...
...
@@ -144,7 +156,9 @@ public class Win32ShellFolderManager2 extends ShellFolderManager {
try
{
network
=
new
Win32ShellFolder2
(
NETWORK
);
}
catch
(
IOException
e
)
{
network
=
null
;
// Ignore error
}
catch
(
InterruptedException
e
)
{
// Ignore error
}
}
return
network
;
...
...
@@ -164,8 +178,10 @@ public class Win32ShellFolderManager2 extends ShellFolderManager {
personal
.
setIsPersonal
();
}
}
}
catch
(
InterruptedException
e
)
{
// Ignore error
}
catch
(
IOException
e
)
{
personal
=
null
;
// Ignore error
}
}
return
personal
;
...
...
@@ -267,6 +283,9 @@ public class Win32ShellFolderManager2 extends ShellFolderManager {
}
}
catch
(
IOException
e
)
{
// Skip this value
}
catch
(
InterruptedException
e
)
{
// Return empty result
return
new
File
[
0
];
}
}
while
(
value
!=
null
);
...
...
@@ -476,33 +495,39 @@ public class Win32ShellFolderManager2 extends ShellFolderManager {
return
comThread
;
}
public
<
T
>
T
invoke
(
Callable
<
T
>
task
)
{
try
{
if
(
Thread
.
currentThread
()
==
comThread
)
{
// if it's already called from the COM
// thread, we don't need to delegate the task
return
task
.
call
();
}
else
{
while
(
true
)
{
Future
<
T
>
future
=
submit
(
task
);
try
{
return
future
.
get
();
}
catch
(
InterruptedException
e
)
{
// Repeat the attempt
future
.
cancel
(
true
);
}
}
}
}
catch
(
Exception
e
)
{
Throwable
cause
=
(
e
instanceof
ExecutionException
)
?
e
.
getCause
()
:
e
;
if
(
cause
instanceof
RuntimeException
)
{
throw
(
RuntimeException
)
cause
;
public
<
T
>
T
invoke
(
Callable
<
T
>
task
)
throws
Exception
{
if
(
Thread
.
currentThread
()
==
comThread
)
{
// if it's already called from the COM
// thread, we don't need to delegate the task
return
task
.
call
();
}
else
{
Future
<
T
>
future
;
try
{
future
=
submit
(
task
);
}
catch
(
RejectedExecutionException
e
)
{
throw
new
InterruptedException
(
e
.
getMessage
());
}
if
(
cause
instanceof
Error
)
{
throw
(
Error
)
cause
;
try
{
return
future
.
get
();
}
catch
(
InterruptedException
e
)
{
future
.
cancel
(
true
);
throw
e
;
}
catch
(
ExecutionException
e
)
{
Throwable
cause
=
e
.
getCause
();
if
(
cause
instanceof
Exception
)
{
throw
(
Exception
)
cause
;
}
if
(
cause
instanceof
Error
)
{
throw
(
Error
)
cause
;
}
throw
new
RuntimeException
(
"Unexpected error"
,
cause
);
}
throw
new
RuntimeException
(
cause
);
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录