View | Details | Raw Unified | Return to bug 244268
Collapse All | Expand All

(-)src/org/eclipse/jpt/core/internal/platform/GenericJpaFactory.java (-1 / +13 lines)
Lines 10-15 Link Here
10
package org.eclipse.jpt.core.internal.platform;
10
package org.eclipse.jpt.core.internal.platform;
11
11
12
import java.io.IOException;
12
import java.io.IOException;
13
import java.io.InputStream;
13
import org.eclipse.core.resources.IFile;
14
import org.eclipse.core.resources.IFile;
14
import org.eclipse.core.runtime.CoreException;
15
import org.eclipse.core.runtime.CoreException;
15
import org.eclipse.core.runtime.Platform;
16
import org.eclipse.core.runtime.Platform;
Lines 295-302 Link Here
295
	// have to check the file contents instead of just the file name
296
	// have to check the file contents instead of just the file name
296
	// because for xml we base it on the rootElement name
297
	// because for xml we base it on the rootElement name
297
	private IContentType contentType(IFile file) {
298
	private IContentType contentType(IFile file) {
299
		InputStream inputStream = null;
298
		try {
300
		try {
299
			return Platform.getContentTypeManager().findContentTypeFor(file.getContents(), file.getName());
301
			inputStream = file.getContents();
302
			return Platform.getContentTypeManager().findContentTypeFor(inputStream, file.getName());
300
		}
303
		}
301
		catch (IOException ex) {
304
		catch (IOException ex) {
302
			JptCorePlugin.log(ex);
305
			JptCorePlugin.log(ex);
Lines 304-309 Link Here
304
		catch (CoreException ex) {
307
		catch (CoreException ex) {
305
			JptCorePlugin.log(ex);
308
			JptCorePlugin.log(ex);
306
		}
309
		}
310
		finally {
311
			try {
312
				if (inputStream != null) {
313
					inputStream.close();
314
				}
315
			} catch (IOException ex) {
316
				JptCorePlugin.log(ex);
317
			}
318
		}
307
		return null;
319
		return null;
308
	}
320
	}
309
	
321
	

Return to bug 244268