Buggy code:
public class PivotModelImpl implements PivotModel { private Logger logger = LoggerFactory . getLogger ( getClass ( ) ) ; private OlapDataSource dataSource ; private OlapConnection connection ; private String roleName ; private Locale locale ; private boolean initialized = false ; private Boolean scenarioSupported ; private Collection < ModelChangeListener > modelListeners = new LinkedList < ModelChangeListener > ( ) ; private Collection < QueryListener > queryListeners = new LinkedList < QueryListener > ( ) ; private QueryAdapter queryAdapter ; private TransformFactory transformFactory = new TransformFactoryImpl ( ) ; private ExpressionEvaluatorFactory expressionEvaluatorFactory = new FreeMarkerExpressionEvaluatorFactory ( ) ; private int topBottomCount = 10 ; private SortCriteria sortCriteria = SortCriteria . ASC ; private boolean sorting = false ; private boolean defaultNonEmpty = false ; private List < Member > sortPosMembers ; private String mdxQuery ; private CellSet cellSet ; private ExpressionContext expressionContext ; private MemberHierarchyCache memberHierarchyCache ; private QueryChangeListener queryChangeListener = new QueryChangeListener ( ) { public void queryChanged ( QueryChangeEvent e ) { } } ; public PivotModelImpl ( OlapDataSource dataSource ) { } protected Logger getLogger ( ) { } public Locale getLocale ( ) { } public void setLocale ( Locale locale ) { } public String getRoleName ( ) { } public void setRoleName ( String roleName ) { } public synchronized void initialize ( ) { } public boolean isInitialized ( ) { } private void checkInitialization ( ) { } private void initializeCache ( ) { } protected OlapConnection createConnection ( OlapDataSource dataSource ) throws SQLException { } public synchronized void destroy ( ) { } protected void closeConnection ( OlapConnection connection ) throws SQLException { } protected ExpressionContext createExpressionContext ( ) { } protected OlapConnection getConnection ( ) { } @ Override public boolean isScenarioSupported ( ) { } @ Override public Scenario createScenario ( ) { } @ Override public Scenario getScenario ( ) { } @ Override public void setScenario ( Scenario scenario ) { } public OlapDataSource getDataSource ( ) { } public Catalog getCatalog ( ) { } @ Override public OlapDatabaseMetaData getMetadata ( ) { } public Cube getCube ( ) { } public synchronized CellSet getCellSet ( ) { } @ Override public void refresh ( ) { } @ Override public ExpressionContext getExpressionContext ( ) { } public MemberHierarchyCache getMemberHierarchyCache ( ) { } protected CellSet executeMdx ( OlapConnection connection , String mdx ) throws OlapException { } protected String normalizeMdx ( String mdx ) { } public String getCurrentMdx ( ) { } public String getEvaluatedMdx ( ) { } protected String getCurrentMdx ( boolean evaluated ) { } public String getMdx ( ) { } public void setMdx ( String mdxQuery ) { } protected void onMdxChanged ( String mdx ) { } protected QueryAdapter createQueryAdapter ( ) { } protected QueryAdapter getQueryAdapter ( ) { } public TransformFactory getTransformFactory ( ) { } public void setTransformFactory ( TransformFactory factory ) { } public ExpressionEvaluatorFactory getExpressionEvaluatorFactory ( ) { } public void setExpressionEvaluatorFactory ( ExpressionEvaluatorFactory factory ) { } public void addModelChangeListener ( ModelChangeListener listener ) { } public void removeModelChangeListener ( ModelChangeListener listener ) { } protected void fireModelInitialized ( ) { } protected void fireModelChanged ( ) { } protected void fireStructureChanged ( ) { } protected void fireModelDestroyed ( ) { } public void addQueryListener ( QueryListener listener ) { } public void removeQueryListener ( QueryListener listener ) { } protected void fireQueryExecuted ( Date start , long duration , String mdx ) { } public < T extends Transform > T getTransform ( Class < T > type ) { } public boolean isSorting ( ) { } public boolean isSorting ( Position position ) { } public void setSorting ( boolean sorting ) { } public SortCriteria getSortCriteria ( ) { } public void setSortCriteria ( SortCriteria sortCriteria ) { } public boolean isSortable ( Position position ) { } protected boolean isSortOnQuery ( ) { } public List < Member > getSortPosMembers ( ) { } public int getTopBottomCount ( ) { } public void setTopBottomCount ( int topBottomCount ) { } public void sort ( CellSetAxis axisToSort , Position position ) { } @ Override public boolean getDefaultNonEmpty ( ) { } @ Override public void setDefaultNonEmpty ( boolean defaultNonEmpty ) { } @ Override public synchronized Serializable saveState ( ) { } public synchronized void restoreState ( Serializable state ) { } @ Override public synchronized void saveSettings ( HierarchicalConfiguration configuration ) { if ( configuration == null ) { throw new NullArgumentException ( "configuration" ) ; } if ( ( configuration . getLogger ( ) ) == null ) { configuration . setLogger ( LogFactory . getLog ( getClass ( ) ) ) ; } if ( isInitialized ( ) ) { configuration . addProperty ( "mdx" , getCurrentMdx ( ) ) ; } else { configuration . addProperty ( "mdx" , mdxQuery ) ; } if ( sorting ) { configuration . addProperty ( "sort[@enabled]" , sorting ) ; if ( ( queryAdapter . getQuaxToSort ( ) ) != null ) { configuration . addProperty ( "sort[@ordinal]" , queryAdapter . getQuaxToSort ( ) . getOrdinal ( ) ) ; } if ( ( sortCriteria ) != null ) { configuration . addProperty ( "sort[@criteria]" , sortCriteria . name ( ) ) ; configuration . addProperty ( "sort[@topBottomCount]" , topBottomCount ) ; if ( ( isSorting ( ) ) && ( ( sortPosMembers ) != null ) ) { int index = 0 ; for ( Member member : sortPosMembers ) { configuration . addProperty ( String . format ( "sort.member(%s)" , ( index ++ ) ) , member . getUniqueName ( ) ) ; } } } } <START_BUG> if ( queryAdapter . isAxesSwapped ( ) ) { <END_BUG> configuration . addProperty ( "axesSwapped" , true ) ; } } @ Override public synchronized void restoreSettings ( HierarchicalConfiguration configuration ) { } }

Fix:
if ( ( ( queryAdapter ) != null ) && ( queryAdapter . isAxesSwapped ( ) ) ) {