Merge pull request #142 from apache/remove-dead-code

Remove dead code
diff --git a/scim-core/src/main/java/org/apache/directory/scim/core/repository/ReflectionUtils.java b/scim-core/src/main/java/org/apache/directory/scim/core/repository/ReflectionUtils.java
deleted file mode 100644
index e7c6ce9..0000000
--- a/scim-core/src/main/java/org/apache/directory/scim/core/repository/ReflectionUtils.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
-* Licensed to the Apache Software Foundation (ASF) under one
-* or more contributor license agreements.  See the NOTICE file
-* distributed with this work for additional information
-* regarding copyright ownership.  The ASF licenses this file
-* to you under the Apache License, Version 2.0 (the
-* "License"); you may not use this file except in compliance
-* with the License.  You may obtain a copy of the License at
- 
-* http://www.apache.org/licenses/LICENSE-2.0
-
-* Unless required by applicable law or agreed to in writing,
-* software distributed under the License is distributed on an
-* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-* KIND, either express or implied.  See the License for the
-* specific language governing permissions and limitations
-* under the License.
-*/
-
-package org.apache.directory.scim.core.repository;
-
-import java.lang.reflect.Field;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-final class ReflectionUtils {
-  private ReflectionUtils() {
-  }
-
-  static List<Field> getFieldsUpTo(Class<?> startClass, Class<?> exclusiveParent) {
-    List<Field> currentClassFields = new ArrayList<>();
-    Collections.addAll(currentClassFields, startClass.getDeclaredFields());
-    Class<?> parentClass = startClass.getSuperclass();
-    if (parentClass != null && (!(parentClass.equals(exclusiveParent)))) {
-      List<Field> parentClassFields = getFieldsUpTo(parentClass, exclusiveParent);
-      currentClassFields.addAll(parentClassFields);
-    }
-    return currentClassFields;
-  }
-}
diff --git a/scim-spec/scim-spec-protocol/src/main/java/org/apache/directory/scim/protocol/data/ErrorResponse.java b/scim-spec/scim-spec-protocol/src/main/java/org/apache/directory/scim/protocol/data/ErrorResponse.java
index 4c27bc5..1f06a1e 100644
--- a/scim-spec/scim-spec-protocol/src/main/java/org/apache/directory/scim/protocol/data/ErrorResponse.java
+++ b/scim-spec/scim-spec-protocol/src/main/java/org/apache/directory/scim/protocol/data/ErrorResponse.java
@@ -19,9 +19,6 @@
 
 package org.apache.directory.scim.protocol.data;
 
-import java.util.ArrayList;
-import java.util.List;
-
 import jakarta.ws.rs.core.Response;
 import jakarta.ws.rs.core.Response.Status;
 import jakarta.xml.bind.annotation.XmlAccessType;
@@ -55,8 +52,6 @@
   @XmlElement
   private ErrorMessageType scimType;
 
-  private List<String> errorMessageList;
-  
   protected ErrorResponse() {
     super(SCHEMA_URI);
   }
@@ -66,29 +61,16 @@
   }
 
   public ErrorResponse(Status status, String detail) {
-    super(SCHEMA_URI);
+    this();
     this.status = status;
     this.detail = detail;
   }
-  
-  public void addErrorMessage(String message) {
-    if (errorMessageList == null) {
-      errorMessageList = new ArrayList<>();
-    }
-    
-    errorMessageList.add(message);
-  }
-  
+
   public Response toResponse() {
-    if (errorMessageList != null) {
-      StringBuilder sb = new StringBuilder();
-      for (String s : errorMessageList) {
-        sb.append("\n").append(s);
-      }
-      detail += sb.toString();
-    }
-    
-    return Response.status(status).entity(this).build();
+    return toResponse(this);
   }
 
+  public static Response toResponse(ErrorResponse error) {
+    return Response.status(error.status).entity(error).build();
+  }
 }
diff --git a/scim-spec/scim-spec-schema/src/main/java/org/apache/directory/scim/spec/filter/TreePrintingListener.java b/scim-spec/scim-spec-schema/src/main/java/org/apache/directory/scim/spec/filter/TreePrintingListener.java
deleted file mode 100644
index 6d1aa81..0000000
--- a/scim-spec/scim-spec-schema/src/main/java/org/apache/directory/scim/spec/filter/TreePrintingListener.java
+++ /dev/null
@@ -1,237 +0,0 @@
-/*
-* Licensed to the Apache Software Foundation (ASF) under one
-* or more contributor license agreements.  See the NOTICE file
-* distributed with this work for additional information
-* regarding copyright ownership.  The ASF licenses this file
-* to you under the Apache License, Version 2.0 (the
-* "License"); you may not use this file except in compliance
-* with the License.  You may obtain a copy of the License at
- 
-* http://www.apache.org/licenses/LICENSE-2.0
-
-* Unless required by applicable law or agreed to in writing,
-* software distributed under the License is distributed on an
-* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-* KIND, either express or implied.  See the License for the
-* specific language governing permissions and limitations
-* under the License.
-*/
-
-package org.apache.directory.scim.spec.filter;
-
-import org.antlr.v4.runtime.ParserRuleContext;
-import org.antlr.v4.runtime.tree.ErrorNode;
-import org.antlr.v4.runtime.tree.TerminalNode;
-import org.apache.commons.lang3.StringUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.apache.directory.scim.spec.filter.FilterParser.AttributeCompareExpressionContext;
-import org.apache.directory.scim.spec.filter.FilterParser.AttributeGroupExpressionContext;
-import org.apache.directory.scim.spec.filter.FilterParser.AttributeLogicExpressionContext;
-import org.apache.directory.scim.spec.filter.FilterParser.AttributePresentExpressionContext;
-import org.apache.directory.scim.spec.filter.FilterParser.FilterAttributeCompareExpressionContext;
-import org.apache.directory.scim.spec.filter.FilterParser.FilterAttributeExpressionContext;
-import org.apache.directory.scim.spec.filter.FilterParser.FilterAttributePresentExpressionContext;
-import org.apache.directory.scim.spec.filter.FilterParser.FilterContext;
-import org.apache.directory.scim.spec.filter.FilterParser.FilterGroupExpressionContext;
-import org.apache.directory.scim.spec.filter.FilterParser.FilterLogicExpressionContext;
-import org.apache.directory.scim.spec.filter.FilterParser.FilterValuePathExpressionContext;
-import org.apache.directory.scim.spec.filter.FilterParser.FullAttributePathContext;
-import org.apache.directory.scim.spec.filter.FilterParser.PartialAttributePathContext;
-
-public class TreePrintingListener extends ExpressionBuildingListener {
-
-  private static final Logger LOG = LoggerFactory.getLogger(TreePrintingListener.class);
-
-  private int indent = -1;
-
-  @Override
-  public void enterFilter(FilterContext ctx) {
-    LOG.info(indent("--- Filter -->"));
-    super.enterFilter(ctx);
-  }
-
-  @Override
-  public void exitFilter(FilterContext ctx) {
-    LOG.info(indent("<-- Filter ---"));
-    super.exitFilter(ctx);
-  }
-
-  @Override
-  public void enterFilterLogicExpression(FilterLogicExpressionContext ctx) {
-    LOG.info(indent("--- FilterLogicExpression -->"));
-    super.enterFilterLogicExpression(ctx);
-  }
-
-  @Override
-  public void exitFilterLogicExpression(FilterLogicExpressionContext ctx) {
-    LOG.info(indent("<-- FilterLogicExpression ---"));
-    super.exitFilterLogicExpression(ctx);
-  }
-
-  @Override
-  public void enterFilterGroupExpression(FilterGroupExpressionContext ctx) {
-    LOG.info(indent("--- FilterGroupExpression -->"));
-    super.enterFilterGroupExpression(ctx);
-  }
-
-  @Override
-  public void exitFilterGroupExpression(FilterGroupExpressionContext ctx) {
-    LOG.info(indent("<-- FilterGroupExpression ---"));
-    super.exitFilterGroupExpression(ctx);
-  }
-
-  @Override
-  public void enterFilterValuePathExpression(FilterValuePathExpressionContext ctx) {
-    LOG.info(indent("--- FilterValuePathContext -->"));
-    super.enterFilterValuePathExpression(ctx);
-  }
-
-  @Override
-  public void exitFilterValuePathExpression(FilterValuePathExpressionContext ctx) {
-    LOG.info(indent("<-- FilterValuePath ---"));
-    super.exitFilterValuePathExpression(ctx);
-  }
-
-  @Override
-  public void enterFilterAttributePresentExpression(FilterAttributePresentExpressionContext ctx) {
-    LOG.info(indent("--- FilterAttributePresentExpression -->"));
-    super.enterFilterAttributePresentExpression(ctx);
-  }
-
-  @Override
-  public void exitFilterAttributePresentExpression(FilterAttributePresentExpressionContext ctx) {
-    LOG.info(indent("<-- FilterAttributePresentExpression ---"));
-    super.exitFilterAttributePresentExpression(ctx);
-  }
-
-  @Override
-  public void enterFilterAttributeCompareExpression(FilterAttributeCompareExpressionContext ctx) {
-    LOG.info(indent("--- FilterAttributeCompareExpression -->"));
-    super.enterFilterAttributeCompareExpression(ctx);
-  }
-
-  @Override
-  public void exitFilterAttributeCompareExpression(FilterAttributeCompareExpressionContext ctx) {
-    LOG.info(indent("<-- FilterAttributeCompareExpression ---"));
-    super.exitFilterAttributeCompareExpression(ctx);
-  }
-
-  @Override
-  public void enterFilterAttributeExpression(FilterAttributeExpressionContext ctx) {
-    LOG.info(indent("--- FilterAttributeExpression -->"));
-    super.enterFilterAttributeExpression(ctx);
-  }
-
-  @Override
-  public void exitFilterAttributeExpression(FilterAttributeExpressionContext ctx) {
-    LOG.info(indent("<-- FilterAttributeExpression ---"));
-    super.exitFilterAttributeExpression(ctx);
-  }
-
-  @Override
-  public void enterAttributeLogicExpression(AttributeLogicExpressionContext ctx) {
-    LOG.info(indent("--- AttributeLogicExpression -->"));
-    super.enterAttributeLogicExpression(ctx);
-  }
-
-  @Override
-  public void exitAttributeLogicExpression(AttributeLogicExpressionContext ctx) {
-    LOG.info(indent("<-- AttributeLogicExpression ---"));
-    super.exitAttributeLogicExpression(ctx);
-  }
-
-  @Override
-  public void enterAttributeGroupExpression(AttributeGroupExpressionContext ctx) {
-    LOG.info(indent("--- AttributeGroupExpression -->"));
-    super.enterAttributeGroupExpression(ctx);
-  }
-
-  @Override
-  public void exitAttributeGroupExpression(AttributeGroupExpressionContext ctx) {
-    LOG.info(indent("<-- AttributeGroupExpression ---"));
-    super.exitAttributeGroupExpression(ctx);
-  }
-
-  @Override
-  public void enterAttributeCompareExpression(AttributeCompareExpressionContext ctx) {
-    LOG.info(indent("--- AttributeCompareExpression -->"));
-    super.enterAttributeCompareExpression(ctx);
-  }
-
-  @Override
-  public void exitAttributeCompareExpression(AttributeCompareExpressionContext ctx) {
-    LOG.info(indent("<-- AttributeCompareExpression ---"));
-    super.exitAttributeCompareExpression(ctx);
-  }
-
-  @Override
-  public void enterAttributePresentExpression(AttributePresentExpressionContext ctx) {
-    LOG.info(indent("--- AttributePresentExpression -->"));
-    super.enterAttributePresentExpression(ctx);
-  }
-
-  @Override
-  public void exitAttributePresentExpression(AttributePresentExpressionContext ctx) {
-    LOG.info(indent("<-- AttributePresentExpression ---"));
-    super.exitAttributePresentExpression(ctx);
-  }
-
-  @Override
-  public void enterFullAttributePath(FullAttributePathContext ctx) {
-    LOG.info(indent("--- FullAttributePath -->"));
-    super.enterFullAttributePath(ctx);
-  }
-
-  @Override
-  public void exitFullAttributePath(FullAttributePathContext ctx) {
-    LOG.info(indent("<-- FullAttributePath ---"));
-    super.exitFullAttributePath(ctx);
-  }
-
-  @Override
-  public void enterPartialAttributePath(PartialAttributePathContext ctx) {
-    LOG.info(indent("--- PartialAttributePath -->"));
-    super.enterPartialAttributePath(ctx);
-  }
-
-  @Override
-  public void exitPartialAttributePath(PartialAttributePathContext ctx) {
-    LOG.info(indent("<-- PartialAttributePath ---"));
-    super.exitPartialAttributePath(ctx);
-  }
-
-  @Override
-  public void enterEveryRule(ParserRuleContext ctx) {
-    indent++;
-  }
-
-  @Override
-  public void exitEveryRule(ParserRuleContext ctx) {
-    indent--;
-  }
-
-  @Override
-  public void visitTerminal(TerminalNode node) {
-    String text = node.getText();
-    if (StringUtils.isNotEmpty(text.trim())) {
-      LOG.info(indent(text));
-    }
-  }
-
-  @Override
-  public void visitErrorNode(ErrorNode node) {
-    LOG.error(indent(node.getText()));
-  }
-  
-  private String indent(String s) {
-    StringBuilder sb = new StringBuilder();
-    for (int i = 0; i < indent; i++) {
-      sb.append("    ");
-    }
-    sb.append(s);
-    return sb.toString();
-  }
-
-}
diff --git a/scim-spec/scim-spec-schema/src/main/java/org/apache/directory/scim/spec/phonenumber/TreePrintingListener.java b/scim-spec/scim-spec-schema/src/main/java/org/apache/directory/scim/spec/phonenumber/TreePrintingListener.java
deleted file mode 100644
index 0722187..0000000
--- a/scim-spec/scim-spec-schema/src/main/java/org/apache/directory/scim/spec/phonenumber/TreePrintingListener.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
-* Licensed to the Apache Software Foundation (ASF) under one
-* or more contributor license agreements.  See the NOTICE file
-* distributed with this work for additional information
-* regarding copyright ownership.  The ASF licenses this file
-* to you under the Apache License, Version 2.0 (the
-* "License"); you may not use this file except in compliance
-* with the License.  You may obtain a copy of the License at
- 
-* http://www.apache.org/licenses/LICENSE-2.0
-
-* Unless required by applicable law or agreed to in writing,
-* software distributed under the License is distributed on an
-* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-* KIND, either express or implied.  See the License for the
-* specific language governing permissions and limitations
-* under the License.
-*/
-
-package org.apache.directory.scim.spec.phonenumber;
-
-import org.antlr.v4.runtime.ParserRuleContext;
-import org.antlr.v4.runtime.tree.ErrorNode;
-import org.antlr.v4.runtime.tree.TerminalNode;
-import org.apache.commons.lang3.StringUtils;
-
-import org.apache.directory.scim.spec.phonenumber.PhoneNumberParser.GlobalNumberContext;
-import org.apache.directory.scim.spec.phonenumber.PhoneNumberParser.LocalNumberContext;
-import org.apache.directory.scim.spec.phonenumber.PhoneNumberParser.LocalNumberDigitsContext;
-import org.apache.directory.scim.spec.phonenumber.PhoneNumberParser.ParameterContext;
-import org.apache.directory.scim.spec.phonenumber.PhoneNumberParser.PhoneContextContext;
-import org.apache.directory.scim.spec.phonenumber.PhoneNumberParser.PhoneNumberContext;
-import lombok.extern.slf4j.Slf4j;
-
-@Slf4j
-public class TreePrintingListener extends PhoneNumberParserBaseListener {
-
-  private int indent = -1;
-  
-  @Override
-  public void enterPhoneNumber(PhoneNumberContext ctx) {
-    log.info(indent("--- Enter PhoneNumber -->"));
-  }
-
-  @Override
-  public void exitPhoneNumber(PhoneNumberContext ctx) {
-    log.info(indent("<-- Exit PhoneNumber ---"));
-  }
-
-  @Override
-  public void enterGlobalNumber(GlobalNumberContext ctx) {
-    log.info(indent("<-- Enter GlobalNumber ---"));
-  }
-
-  @Override
-  public void exitGlobalNumber(GlobalNumberContext ctx) {
-    log.info(indent("<-- Exit GlobalNumber ---"));
-  }
-
-  @Override
-  public void enterLocalNumber(LocalNumberContext ctx) {
-    log.info(indent("<-- Enter LocalNumber ---"));
-  }
-
-  @Override
-  public void exitLocalNumber(LocalNumberContext ctx) {
-    log.info(indent("<-- Exit LocalNumber ---"));
-  }
-  
-  @Override
-  public void enterPhoneContext(PhoneContextContext ctx) {
-	log.info(indent("<-- Enter PhoneContext "));
-  }
-
-  @Override
-  public void exitPhoneContext(PhoneContextContext ctx) {
-	log.info(indent("<-- Exit PhoneContext"));
-  }
-
-  @Override
-  public void enterParameter(ParameterContext ctx) {
-	log.info(indent("<-- Enter Parameter"));
-  }
-
-  @Override
-  public void exitParameter(ParameterContext ctx) {
-	log.info(indent("<-- Exit Parameter"));
-  }
-
-  @Override
-  public void enterLocalNumberDigits(LocalNumberDigitsContext ctx) {
-    log.info(indent("<-- Enter LocalNumberDigits"));
-  }
-
-  @Override
-  public void exitLocalNumberDigits(LocalNumberDigitsContext ctx) {
-    log.info(indent("<-- Exit LocalNumberDigits"));
-  }
-
-  @Override
-  public void enterEveryRule(ParserRuleContext ctx) {
-    indent++;
-  }
-
-  @Override
-  public void exitEveryRule(ParserRuleContext ctx) {
-    indent--;
-  }
-
-  @Override
-  public void visitTerminal(TerminalNode node) {
-    String text = node.getText();
-    if (StringUtils.isNotEmpty(text.trim())) {
-      log.info(indent(text));
-    }
-  }
-
-  @Override
-  public void visitErrorNode(ErrorNode node) {
-    log.error(indent(node.getText()));
-  }
-  
-  private String indent(String s) {
-    StringBuilder sb = new StringBuilder();
-    for (int i = 0; i < indent; i++) {
-      sb.append("    ");
-    }
-    sb.append(s);
-    return sb.toString();
-  }
-
-}