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

(-)src/org/eclipse/wst/common/snippets/internal/model/SnippetManager.java (-1 / +14 lines)
Lines 12-17 Link Here
12
12
13
import java.beans.PropertyChangeEvent;
13
import java.beans.PropertyChangeEvent;
14
import java.beans.PropertyChangeListener;
14
import java.beans.PropertyChangeListener;
15
import java.io.File;
15
import java.io.FileNotFoundException;
16
import java.io.FileNotFoundException;
16
import java.io.FileOutputStream;
17
import java.io.FileOutputStream;
17
import java.io.IOException;
18
import java.io.IOException;
Lines 58-71 Link Here
58
59
59
	private static SnippetManager instance = null;
60
	private static SnippetManager instance = null;
60
61
62
	/**
63
	 * PR5042/5292 Used to store URI safe version of hiddenStateFileName
64
	 */
65
	private static String hiddenStateFilenameURI;
66
61
	public synchronized static SnippetManager getInstance() {
67
	public synchronized static SnippetManager getInstance() {
62
		if (instance == null) {
68
		if (instance == null) {
63
			instance = new SnippetManager();
69
			instance = new SnippetManager();
64
			try {
70
			try {
65
				hiddenStateFilename = SnippetsPlugin.getDefault().getStateLocation().toString() + "/hidden.xml"; //$NON-NLS-1$
71
				hiddenStateFilename = SnippetsPlugin.getDefault().getStateLocation().toString() + "/hidden.xml"; //$NON-NLS-1$
72
				/* PR5042/5292
73
				 * We need to create a safe URI string that is properly encoded
74
				 * to ascii in case the filename contains non-ascii chars, e.g. ja_JP
75
				 */
76
				hiddenStateFilenameURI = new File(hiddenStateFilename).toURI().toASCIIString();
66
			}
77
			}
67
			catch (Exception e) {
78
			catch (Exception e) {
68
				hiddenStateFilename = "/hidden.xml"; //$NON-NLS-1$
79
				hiddenStateFilename = "/hidden.xml"; //$NON-NLS-1$
80
				hiddenStateFilenameURI = "/hidden.xml"; //$NON-NLS-1$
69
			}
81
			}
70
			// hook resource listener and load categories from workspace
82
			// hook resource listener and load categories from workspace
71
			// nsd_TODO: disable in-workspace support until fully stabilized
83
			// nsd_TODO: disable in-workspace support until fully stabilized
Lines 251-257 Link Here
251
		try {
263
		try {
252
			DocumentBuilder builder = CommonXML.getDocumentBuilder();
264
			DocumentBuilder builder = CommonXML.getDocumentBuilder();
253
			if (builder != null) {
265
			if (builder != null) {
254
				document = builder.parse(hiddenStateFilename);
266
				//pr5042/5292 need to use URI safe string for parsing
267
				document = builder.parse(hiddenStateFilenameURI);
255
			}
268
			}
256
			else {
269
			else {
257
				Logger.log(Logger.ERROR, "SnippetManager couldn't obtain a DocumentBuilder"); //$NON-NLS-1$
270
				Logger.log(Logger.ERROR, "SnippetManager couldn't obtain a DocumentBuilder"); //$NON-NLS-1$

Return to bug 203290