src/share/jaf_classes/javax/activation/MailcapCommandMap.java

changeset 494
2fcd3ddb57a6
parent 286
f50545b5e2f1
child 637
9c07ef4934dd
equal deleted inserted replaced
493:b549c5ea34ab 494:2fcd3ddb57a6
1 /* 1 /*
2 * Copyright (c) 1997, 2005, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this 7 * published by the Free Software Foundation. Oracle designates this
118 */ 118 */
119 119
120 public class MailcapCommandMap extends CommandMap { 120 public class MailcapCommandMap extends CommandMap {
121 /* 121 /*
122 * We manage a collection of databases, searched in order. 122 * We manage a collection of databases, searched in order.
123 * The default database is shared between all instances 123 */
124 * of this class.
125 * XXX - Can we safely share more databases between instances?
126 */
127 private static MailcapFile defDB = null;
128 private MailcapFile[] DB; 124 private MailcapFile[] DB;
129 private static final int PROG = 0; // programmatically added entries 125 private static final int PROG = 0; // programmatically added entries
130 126
131 /** 127 /**
132 * The default Constructor. 128 * The default Constructor.
162 LogSupport.log("MailcapCommandMap: load JAR"); 158 LogSupport.log("MailcapCommandMap: load JAR");
163 // load from the app's jar file 159 // load from the app's jar file
164 loadAllResources(dbv, "META-INF/mailcap"); 160 loadAllResources(dbv, "META-INF/mailcap");
165 161
166 LogSupport.log("MailcapCommandMap: load DEF"); 162 LogSupport.log("MailcapCommandMap: load DEF");
167 synchronized (MailcapCommandMap.class) { 163 mf = loadResource("/META-INF/mailcap.default");
168 // see if another instance has created this yet. 164
169 if (defDB == null) 165 if (mf != null)
170 defDB = loadResource("/META-INF/mailcap.default"); 166 dbv.add(mf);
171 }
172
173 if (defDB != null)
174 dbv.add(defDB);
175 167
176 DB = new MailcapFile[dbv.size()]; 168 DB = new MailcapFile[dbv.size()];
177 DB = (MailcapFile[])dbv.toArray(DB); 169 DB = (MailcapFile[])dbv.toArray(DB);
178 } 170 }
179 171

mercurial