Ignore:
Timestamp:
2017-02-02T00:08:08+01:00 (7 years ago)
Author:
Don-vip
Message:

see #14319 - update to latest version of svgSalamander (2017-01-07, patched)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/com/kitfox/svg/xml/XMLParseUtil.java

    r10866 r11525  
    44 * All rights reserved.
    55 *
    6  * Redistribution and use in source and binary forms, with or 
     6 * Redistribution and use in source and binary forms, with or
    77 * without modification, are permitted provided that the following
    88 * conditions are met:
    99 *
    10  *   - Redistributions of source code must retain the above 
     10 *   - Redistributions of source code must retain the above
    1111 *     copyright notice, this list of conditions and the following
    1212 *     disclaimer.
    1313 *   - Redistributions in binary form must reproduce the above
    1414 *     copyright notice, this list of conditions and the following
    15  *     disclaimer in the documentation and/or other materials 
     15 *     disclaimer in the documentation and/or other materials
    1616 *     provided with the distribution.
    1717 *
     
    2727 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
    2828 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
    29  * OF THE POSSIBILITY OF SUCH DAMAGE. 
    30  * 
     29 * OF THE POSSIBILITY OF SUCH DAMAGE.
     30 *
    3131 * Mark McKay can be contacted at mark@kitfox.com.  Salamander and other
    3232 * projects can be found at http://www.kitfox.com
     
    3737package com.kitfox.svg.xml;
    3838
    39 import com.kitfox.svg.SVGConst;
    40 import java.awt.*;
    41 import java.util.*;
    42 import java.util.regex.*;
     39import java.awt.Toolkit;
     40import java.util.HashMap;
     41import java.util.Iterator;
     42import java.util.LinkedList;
    4343import java.util.logging.Level;
    4444import java.util.logging.Logger;
     45import java.util.regex.Matcher;
     46import java.util.regex.Pattern;
     47
     48import com.kitfox.svg.SVGConst;
    4549
    4650/**
     
    6367        matchWs.reset(list);
    6468
    65         LinkedList matchList = new LinkedList();
     69        LinkedList<String> matchList = new LinkedList<>();
    6670        while (matchWs.find())
    6771        {
     
    7074
    7175        String[] retArr = new String[matchList.size()];
    72         return (String[])matchList.toArray(retArr);
     76        return matchList.toArray(retArr);
    7377    }
    7478
    7579    public static double parseDouble(String val)
    7680    {
    77         /*
    78         if (val == null) return 0.0;
    79 
    80         double retVal = 0.0;
    81         try
    82         { retVal = Double.parseDouble(val); }
    83         catch (Exception e)
    84         {}
    85         return retVal;
    86          */
    8781        return findDouble(val);
    8882    }
     
    10397        catch (StringIndexOutOfBoundsException e)
    10498        {
    105             Logger.getLogger(SVGConst.SVG_LOGGER).log(Level.WARNING, 
     99            Logger.getLogger(SVGConst.SVG_LOGGER).log(Level.WARNING,
    106100                "XMLParseUtil: regex parse problem: '" + val + "'", e);
    107101        }
     
    112106        double retVal = 0;
    113107        try
    114         { 
    115             retVal = Double.parseDouble(val); 
    116            
     108        {
     109            retVal = Double.parseDouble(val);
     110
    117111            float pixPerInch;
    118112            try {
    119                 pixPerInch = (float)Toolkit.getDefaultToolkit().getScreenResolution();
     113                pixPerInch = Toolkit.getDefaultToolkit().getScreenResolution();
    120114            }
    121115            catch (NoClassDefFoundError err)
     
    126120            final float inchesPerCm = .3936f;
    127121            final String units = fpMatch.group(6);
    128            
     122
    129123            if ("%".equals(units)) retVal /= 100;
    130124            else if ("in".equals(units))
     
    166160        fpMatch.reset(list);
    167161
    168         LinkedList doubList = new LinkedList();
     162        LinkedList<Double> doubList = new LinkedList<>();
    169163        while (fpMatch.find())
    170164        {
     
    174168
    175169        double[] retArr = new double[doubList.size()];
    176         Iterator it = doubList.iterator();
     170        Iterator<Double> it = doubList.iterator();
    177171        int idx = 0;
    178172        while (it.hasNext())
    179173        {
    180             retArr[idx++] = ((Double)it.next()).doubleValue();
     174            retArr[idx++] = it.next().doubleValue();
    181175        }
    182176
     
    216210        fpMatch.reset(list);
    217211
    218         LinkedList floatList = new LinkedList();
     212        LinkedList<Float> floatList = new LinkedList<>();
    219213        while (fpMatch.find())
    220214        {
     
    224218
    225219        float[] retArr = new float[floatList.size()];
    226         Iterator it = floatList.iterator();
     220        Iterator<Float> it = floatList.iterator();
    227221        int idx = 0;
    228222        while (it.hasNext())
    229223        {
    230             retArr[idx++] = ((Float)it.next()).floatValue();
     224            retArr[idx++] = it.next().floatValue();
    231225        }
    232226
     
    261255        intMatch.reset(list);
    262256
    263         LinkedList intList = new LinkedList();
     257        LinkedList<Integer> intList = new LinkedList<>();
    264258        while (intMatch.find())
    265259        {
     
    269263
    270264        int[] retArr = new int[intList.size()];
    271         Iterator it = intList.iterator();
     265        Iterator<Integer> it = intList.iterator();
    272266        int idx = 0;
    273267        while (it.hasNext())
    274268        {
    275             retArr[idx++] = ((Integer)it.next()).intValue();
     269            retArr[idx++] = it.next().intValue();
    276270        }
    277271
     
    307301     * @param map - A map to which these styles will be added
    308302     */
    309     public static HashMap parseStyle(String styleString, HashMap map) {
     303    public static HashMap<String, StyleAttribute> parseStyle(String styleString, HashMap<String, StyleAttribute> map) {
    310304        final Pattern patSemi = Pattern.compile(";");
    311305
Note: See TracChangeset for help on using the changeset viewer.