< prev index next >

src/share/classes/sun/net/www/MessageHeader.java

Print this page
rev 1564 : 7090158: Networking Libraries don't build with javac -Werror
7125055: ContentHandler.getContent API changed in error
Summary: Minor changes to networking java files to remove warnings
Reviewed-by: chegar, weijun, hawtin, alanb
Contributed-by: kurchi.subhra.hazra@oracle.com, sasha_bu@hotmail.com

*** 1,7 **** /* ! * Copyright (c) 1995, 2010, Oracle and/or its affiliates. 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 * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this --- 1,7 ---- /* ! * Copyright (c) 1995, 2011, Oracle and/or its affiliates. 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 * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this
*** 33,43 **** import java.util.Collections; import java.util.Map; import java.util.HashMap; import java.util.List; import java.util.ArrayList; - import java.util.Set; import java.util.Iterator; import java.util.NoSuchElementException; /** An RFC 844 or MIME message header. Includes methods for parsing headers from incoming streams, fetching --- 33,42 ----
*** 197,207 **** public synchronized Map<String, List<String>> getHeaders(String[] excludeList) { return filterAndAddHeaders(excludeList, null); } ! public synchronized Map<String, List<String>> filterAndAddHeaders(String[] excludeList, Map<String, List<String>> include) { boolean skipIt = false; Map<String, List<String>> m = new HashMap<String, List<String>>(); for (int i = nkeys; --i >= 0;) { if (excludeList != null) { // check if the key is in the excludeList. --- 196,207 ---- public synchronized Map<String, List<String>> getHeaders(String[] excludeList) { return filterAndAddHeaders(excludeList, null); } ! public synchronized Map<String, List<String>> filterAndAddHeaders( ! String[] excludeList, Map<String, List<String>> include) { boolean skipIt = false; Map<String, List<String>> m = new HashMap<String, List<String>>(); for (int i = nkeys; --i >= 0;) { if (excludeList != null) { // check if the key is in the excludeList.
*** 226,244 **** skipIt = false; } } if (include != null) { ! Iterator entries = include.entrySet().iterator(); ! while (entries.hasNext()) { ! Map.Entry entry = (Map.Entry)entries.next(); ! List l = (List)m.get(entry.getKey()); if (l == null) { ! l = new ArrayList(); ! m.put((String)entry.getKey(), l); } ! l.add(entry.getValue()); } } for (String key : m.keySet()) { m.put(key, Collections.unmodifiableList(m.get(key))); --- 226,242 ---- skipIt = false; } } if (include != null) { ! for (Map.Entry<String,List<String>> entry: include.entrySet()) { ! List<String> l = m.get(entry.getKey()); if (l == null) { ! l = new ArrayList<String>(); ! m.put(entry.getKey(), l); } ! l.addAll(entry.getValue()); } } for (String key : m.keySet()) { m.put(key, Collections.unmodifiableList(m.get(key)));
*** 398,407 **** --- 396,406 ---- } mergeHeader(is); } /** Parse and merge a MIME header from an input stream. */ + @SuppressWarnings("fallthrough") public void mergeHeader(InputStream is) throws java.io.IOException { if (is == null) return; char s[] = new char[10]; int firstc = is.read();
*** 419,428 **** --- 418,428 ---- keyend = len; inKey = false; break; case '\t': c = ' '; + /*fall through*/ case ' ': inKey = false; break; case '\r': case '\n':
< prev index next >