Ignore:
Timestamp:
2015-06-03T14:05:30+02:00 (9 years ago)
Author:
Don-vip
Message:

global use of String.isEmpty()

Location:
trunk/src/org/openstreetmap/josm/data
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/CustomConfigurator.java

    r8449 r8461  
    178178    public static int askForOption(String text, String opts) {
    179179        Integer answer;
    180         if (opts.length()>0) {
     180        if (!opts.isEmpty()) {
    181181            String[] options = opts.split(";");
    182182            answer = JOptionPane.showOptionDialog(Main.parent, text, "Question", JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, 0);
     
    189189    public static String askForText(String text) {
    190190        String s = JOptionPane.showInputDialog(Main.parent, text, tr("Enter text"), JOptionPane.QUESTION_MESSAGE);
    191         if (s!=null && (s=s.trim()).length()>0) {
     191        if (s!=null && !(s=s.trim()).isEmpty()) {
    192192            return s;
    193193        } else {
     
    558558            PreferencesUtils.showPrefs(tmpPref);
    559559
    560             if (id.length()>0) {
     560            if (!id.isEmpty()) {
    561561                try {
    562562                    String fragmentVar = "API.fragments['"+id+"']";
     
    621621            String text = evalVars(elem.getAttribute("text"));
    622622            String locText = evalVars(elem.getAttribute(LanguageInfo.getJOSMLocaleCode()+".text"));
    623             if (locText!=null && locText.length()>0) text=locText;
     623            if (locText!=null && !locText.isEmpty()) text=locText;
    624624
    625625            String type = evalVars(elem.getAttribute("type"));
     
    630630            String text = evalVars(elem.getAttribute("text"));
    631631            String locText = evalVars(elem.getAttribute(LanguageInfo.getJOSMLocaleCode()+".text"));
    632             if (locText.length()>0) text=locText;
     632            if (!locText.isEmpty()) text=locText;
    633633            String var = elem.getAttribute("var");
    634634            if (var.isEmpty()) var="result";
     
    640640                String opts = evalVars(elem.getAttribute("options"));
    641641                String locOpts = evalVars(elem.getAttribute(LanguageInfo.getJOSMLocaleCode()+".options"));
    642                 if (locOpts.length()>0) opts=locOpts;
     642                if (!locOpts.isEmpty()) opts=locOpts;
    643643                setVar(var, String.valueOf(askForOption(text, opts)));
    644644            }
  • trunk/src/org/openstreetmap/josm/data/validation/routines/InetAddressValidator.java

    r7937 r8461  
    7474        for (int i = 0; i <= 3; i++) {
    7575            String ipSegment = groups[i];
    76             if (ipSegment == null || ipSegment.length() <= 0) {
     76            if (ipSegment == null || ipSegment.isEmpty()) {
    7777                return false;
    7878            }
  • trunk/src/org/openstreetmap/josm/data/validation/routines/UrlValidator.java

    r7937 r8461  
    405405
    406406        String extra = authorityMatcher.group(PARSE_AUTHORITY_EXTRA);
    407         if (extra != null && extra.trim().length() > 0){
     407        if (extra != null && !extra.trim().isEmpty()){
    408408            return false;
    409409        }
  • trunk/src/org/openstreetmap/josm/data/validation/tests/RelationChecker.java

    r8401 r8461  
    301301                }));
    302302
    303                 if (key.length() > 0) {
     303                if (!key.isEmpty()) {
    304304                    String s = marktr("Role {0} unknown in templates {1}");
    305305
  • trunk/src/org/openstreetmap/josm/data/validation/tests/TagChecker.java

    r8444 r8461  
    177177                boolean isFirstLine = true;
    178178                String line;
    179                 while ((line = reader.readLine()) != null && (tagcheckerfile || line.length() != 0)) {
     179                while ((line = reader.readLine()) != null && (tagcheckerfile || !line.isEmpty())) {
    180180                    if (line.startsWith("#")) {
    181181                        if (line.startsWith("# JOSM TagChecker")) {
     
    218218                        }
    219219                    } else if (tagcheckerfile) {
    220                         if (line.length() > 0) {
     220                        if (!line.isEmpty()) {
    221221                            CheckerData d = new CheckerData();
    222222                            String err = d.getData(line);
     
    247247        }
    248248
    249         if (errorSources.length() > 0)
     249        if (!errorSources.isEmpty())
    250250            throw new IOException(tr("Could not access data file(s):\n{0}", errorSources));
    251251    }
     
    382382                withErrors.put(p, "HTML");
    383383            }
    384             if (checkValues && key != null && value != null && value.length() > 0 && presetsValueData != null) {
     384            if (checkValues && key != null && value != null && !value.isEmpty() && presetsValueData != null) {
    385385                final Set<String> values = presetsValueData.get(key);
    386386                final boolean keyInPresets = values != null;
     
    440440                }
    441441            }
    442             if (checkFixmes && key != null && value != null && value.length() > 0) {
     442            if (checkFixmes && key != null && value != null && !value.isEmpty()) {
    443443                if ((value.toLowerCase(Locale.ENGLISH).contains("fixme")
    444444                        || value.contains("check and delete")
Note: See TracChangeset for help on using the changeset viewer.