InputMismatchException by Checkstyle since Sonar-Update

Hi,

yesterday we updated our SonarQube (Enterprise, on-Premise) from 10.4 to 10.7 and at the same time updated the Checkstyle plugin from 10.12.5 to 10.17.0.

Since this update we face an exception which didn’t occur before. This is a problem, as the analysis of the whole project is now aborted and not available on Sonar.

[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.9.1.2184:sonar (default-cli) on project cpq-veterans-aggregator: Can not execute Checkstyle: Exception was thrown while processing C:\censoredPath\AbstractPipelineComparator.java: IllegalStateException occurred while parsing file C:\censoredPath\AbstractPipelineComparator.java. 28:39: mismatched input ‘(’ expecting ‘;’: InputMismatchException

The whole content of the file is:

/*
 * AbstractPipelineComparator.java
 *
 * Created on 16. Juni 2004, 14:15
 */

package com.censored.util.sort.comparator;

/**
 *
 * @author  anonymus
 */
public abstract class AbstractPipelineComparator implements java.util.Comparator {
    
    public abstract int compare(Object o1, Object o2);
    
    /*
     * Ersetzt in einem String (falls vorhanden) 
     * alle Umlaute (ä,ö,ü) durch (a,o,u),
     * 'ß' durch s und alle Zeichen in Kleinbuchstaben.
     * Dies ermöglicht eine genaue Sortierung eines
     * Strings.
     * 
     * @param Object o
     * @return ersetzter String 
     */
    protected String prepairForCompare(Object o) {
        String prepair = String.valueOf(o);
        prepair = prepair.toLowerCase();        
        prepair = prepair.replace('ä','a');
        prepair = prepair.replace('ö','o');
        prepair = prepair.replace('ü','u');
        prepair = prepair.replace('ß','s');
        return prepair;
    }    
}


It contains several German umlauts, but is encoded in UTF-8 and hasn’t caused any problems until now.

Is this a bug in Checkstyle or SonarQube?
Is there a workaround to mitigate this problem?

Thanks!

Regards,
Carsten

Same issue for us as well, getting it on this line

gs.forEach(g -> mg
            .computeIfAbsent(Tuple.of(g.getService(), g.getResource()), k -> new HashSet<>())
            .addAll(Arrays.asList(g.getAction())));

Hi all,

Thanks for this notification, and welcome to the community @Asrar_Husain!

This is on the Checkstyle side, and I’ve updated the Marketplace to end compatibility of the latest plugin version at 10.6. You might want to raise this with them (after you uninstall & restart :slight_smile:)

 
Ann

Hi,

I reported a bug at the checkstyle plugin: Analysis fails with InputMismatchException after Sonar and Checkstyle Update · Issue #533 · checkstyle/sonar-checkstyle (github.com)

As a workaround we excluded the affected file from the analysis.

Regards,
Carsten

1 Like