Lines 26-32
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
Link Here
|
26 |
public class ResourceLeakTests extends AbstractRegressionTest { |
26 |
public class ResourceLeakTests extends AbstractRegressionTest { |
27 |
|
27 |
|
28 |
static { |
28 |
static { |
29 |
// TESTS_NAMES = new String[] { "test061l"}; |
29 |
TESTS_NAMES = new String[] { "testBug368709b"}; |
30 |
// TESTS_NUMBERS = new int[] { 50 }; |
30 |
// TESTS_NUMBERS = new int[] { 50 }; |
31 |
// TESTS_RANGE = new int[] { 11, -1 }; |
31 |
// TESTS_RANGE = new int[] { 11, -1 }; |
32 |
} |
32 |
} |
Lines 3085-3089
public void test063e() {
Link Here
|
3085 |
options, |
3085 |
options, |
3086 |
null); |
3086 |
null); |
3087 |
} |
3087 |
} |
3088 |
|
3088 |
// Bug 368709 - Endless loop in FakedTrackingVariable.markPassedToOutside |
|
|
3089 |
// original test case from jgit |
3090 |
public void testBug368709a() { |
3091 |
if (this.complianceLevel < ClassFileConstants.JDK1_5) return; |
3092 |
Map options = getCompilerOptions(); |
3093 |
options.put(CompilerOptions.OPTION_ReportUnclosedCloseable, CompilerOptions.ERROR); |
3094 |
options.put(CompilerOptions.OPTION_ReportPotentiallyUnclosedCloseable, CompilerOptions.ERROR); |
3095 |
this.runConformTest( |
3096 |
new String[] { |
3097 |
"X.java", |
3098 |
"import java.io.*;\n" + |
3099 |
"import java.util.zip.*;\n" + |
3100 |
"public class X {\n" + |
3101 |
" Object db, pack;\n" + // mock |
3102 |
" int objectOffset, headerLength, type, size;\n" + |
3103 |
" public ObjectStream openStream() throws MissingObjectException, IOException {\n" + |
3104 |
" WindowCursor wc = new WindowCursor(db);\n" + |
3105 |
" InputStream in;\n" + |
3106 |
" try\n" + |
3107 |
" {\n" + |
3108 |
" in = new PackInputStream(pack, (objectOffset + headerLength), wc);\n" + |
3109 |
" }\n" + |
3110 |
" catch (IOException packGone)\n" + |
3111 |
" {\n" + |
3112 |
" return wc.open(getObjectId(), type).openStream();\n" + |
3113 |
" }\n" + |
3114 |
" in = new BufferedInputStream(new InflaterInputStream(in, wc.inflater(), 8192), 8192);\n" + |
3115 |
" return new ObjectStream.Filter(type, size, in);\n" + |
3116 |
" }\n" + |
3117 |
" String getObjectId() { return \"\"; }\n" + // mock |
3118 |
"}\n" + |
3119 |
// mock: |
3120 |
"class WindowCursor {\n" + |
3121 |
" WindowCursor(Object db) {}\n" + |
3122 |
" ObjectStream open(String id, int type) { return null; }\n" + |
3123 |
" Inflater inflater() { return null; }\n" + |
3124 |
"}\n" + |
3125 |
"class MissingObjectException extends Exception { MissingObjectException() { super();} }\n" + |
3126 |
"class PackInputStream extends InputStream {\n" + |
3127 |
" PackInputStream(Object pack, int offset, WindowCursor wc) {}\n" + |
3128 |
"}\n" + |
3129 |
"class ObjectStream extends InputStream {\n" + |
3130 |
" static class Filter extends ObjectStream {\n" + |
3131 |
" Filter(int type, int size, InputStream in) { }\n" + |
3132 |
" }\n" + |
3133 |
" ObjectStream openStream() { return this; }\n" + |
3134 |
"}\n" |
3135 |
}, |
3136 |
"", |
3137 |
null, |
3138 |
true, |
3139 |
null, |
3140 |
options, |
3141 |
null); |
3142 |
} |
3143 |
//Bug 368709 - Endless loop in FakedTrackingVariable.markPassedToOutside |
3144 |
//original test case from jgit |
3145 |
public void testBug368709b() { |
3146 |
if (this.complianceLevel < ClassFileConstants.JDK1_5) return; |
3147 |
Map options = getCompilerOptions(); |
3148 |
options.put(CompilerOptions.OPTION_ReportUnclosedCloseable, CompilerOptions.ERROR); |
3149 |
options.put(CompilerOptions.OPTION_ReportPotentiallyUnclosedCloseable, CompilerOptions.ERROR); |
3150 |
this.runConformTest( |
3151 |
new String[] { |
3152 |
"X.java", |
3153 |
"import java.io.*;\n" + |
3154 |
"import java.util.zip.*;\n" + |
3155 |
"public class X {\n" + |
3156 |
" void doit() throws IOException {\n" + |
3157 |
" InputStream in = new FileInputStream(\"somefile\");\n" + |
3158 |
" in = new BufferedInputStream(new InflaterInputStream(in, inflater(), 8192), 8192);\n" + |
3159 |
" process(in);\n" + |
3160 |
" }\n" + |
3161 |
" Inflater inflater() { return null; }\n" + |
3162 |
" void process(InputStream is) { }\n" + |
3163 |
"}\n" |
3164 |
}, |
3165 |
"", |
3166 |
null, |
3167 |
true, |
3168 |
null, |
3169 |
options, |
3170 |
null); |
3171 |
} |
3089 |
} |
3172 |
} |