Skip to content

Commit

Permalink
Merge pull request microprofile#435 from MikeEdgar/sonar_cleanup
Browse files Browse the repository at this point in the history
Sonar cleanup
  • Loading branch information
phillip-kruger authored Aug 17, 2020
2 parents 89b7ec2 + 972ff8e commit c2b40d5
Show file tree
Hide file tree
Showing 63 changed files with 249 additions and 293 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
*/
public class PathItemImpl extends ExtensibleImpl<PathItem> implements PathItem, ModelImpl {

private String $ref;
private String ref;
private String summary;
private String description;
private Operation get;
Expand All @@ -36,15 +36,15 @@ public class PathItemImpl extends ExtensibleImpl<PathItem> implements PathItem,
*/
@Override
public String getRef() {
return $ref;
return ref;
}

/**
* @see org.eclipse.microprofile.openapi.models.Reference#setRef(java.lang.String)
*/
@Override
public void setRef(String ref) {
this.$ref = ref;
this.ref = ref;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*/
public class ExampleImpl extends ExtensibleImpl<Example> implements Example, ModelImpl {

private String $ref;
private String ref;
private String summary;
private String description;
private Object value;
Expand All @@ -22,7 +22,7 @@ public class ExampleImpl extends ExtensibleImpl<Example> implements Example, Mod
*/
@Override
public String getRef() {
return this.$ref;
return this.ref;
}

/**
Expand All @@ -33,7 +33,7 @@ public void setRef(String ref) {
if (ref != null && !ref.contains("/")) {
ref = OpenApiConstants.REF_PREFIX_EXAMPLE + ref;
}
this.$ref = ref;
this.ref = ref;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/
public class HeaderImpl extends ExtensibleImpl<Header> implements Header, ModelImpl {

private String $ref;
private String ref;
private String description;
private Boolean required;
private Boolean deprecated;
Expand All @@ -35,7 +35,7 @@ public class HeaderImpl extends ExtensibleImpl<Header> implements Header, ModelI
*/
@Override
public String getRef() {
return this.$ref;
return this.ref;
}

/**
Expand All @@ -46,7 +46,7 @@ public void setRef(String ref) {
if (ref != null && !ref.contains("/")) {
ref = OpenApiConstants.REF_PREFIX_HEADER + ref;
}
this.$ref = ref;
this.ref = ref;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/
public class LinkImpl extends ExtensibleImpl<Link> implements Link, ModelImpl {

private String $ref;
private String ref;
private String operationRef;
private String operationId;
private Map<String, Object> parameters;
Expand All @@ -29,7 +29,7 @@ public class LinkImpl extends ExtensibleImpl<Link> implements Link, ModelImpl {
*/
@Override
public String getRef() {
return this.$ref;
return this.ref;
}

/**
Expand All @@ -40,7 +40,7 @@ public void setRef(String ref) {
if (ref != null && !ref.contains("/")) {
ref = OpenApiConstants.REF_PREFIX_LINK + ref;
}
this.$ref = ref;
this.ref = ref;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
*/
public class SchemaImpl extends ExtensibleImpl<Schema> implements Schema, ModelImpl {

private String $ref;
private String ref;
private String format;
private final String name;
private String title;
Expand Down Expand Up @@ -81,7 +81,7 @@ public String getName() {
*/
@Override
public String getRef() {
return this.$ref;
return this.ref;
}

/**
Expand All @@ -92,7 +92,7 @@ public void setRef(String ref) {
if (ref != null && !ref.contains("/")) {
ref = OpenApiConstants.REF_PREFIX_SCHEMA + ref;
}
this.$ref = ref;
this.ref = ref;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/
public class ParameterImpl extends ExtensibleImpl<Parameter> implements Parameter, ModelImpl {

private String $ref;
private String ref;
private String name;
private In in;
private String description;
Expand All @@ -38,7 +38,7 @@ public class ParameterImpl extends ExtensibleImpl<Parameter> implements Paramete
*/
@Override
public String getRef() {
return this.$ref;
return this.ref;
}

/**
Expand All @@ -49,7 +49,7 @@ public void setRef(String ref) {
if (ref != null && !ref.contains("/")) {
ref = OpenApiConstants.REF_PREFIX_PARAMETER + ref;
}
this.$ref = ref;
this.ref = ref;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*/
public class RequestBodyImpl extends ExtensibleImpl<RequestBody> implements RequestBody, ModelImpl {

private String $ref;
private String ref;
private String description;
private Content content;
private Boolean required;
Expand All @@ -22,7 +22,7 @@ public class RequestBodyImpl extends ExtensibleImpl<RequestBody> implements Requ
*/
@Override
public String getRef() {
return this.$ref;
return this.ref;
}

/**
Expand All @@ -33,7 +33,7 @@ public void setRef(String ref) {
if (ref != null && !ref.contains("/")) {
ref = OpenApiConstants.REF_PREFIX_REQUEST_BODY + ref;
}
this.$ref = ref;
this.ref = ref;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/
public class APIResponseImpl extends ExtensibleImpl<APIResponse> implements APIResponse, ModelImpl {

private String $ref;
private String ref;
private String description;
private Map<String, Header> headers;
private Content content;
Expand All @@ -29,7 +29,7 @@ public class APIResponseImpl extends ExtensibleImpl<APIResponse> implements APIR
*/
@Override
public String getRef() {
return this.$ref;
return this.ref;
}

/**
Expand All @@ -40,7 +40,7 @@ public void setRef(String ref) {
if (ref != null && !ref.contains("/")) {
ref = OpenApiConstants.REF_PREFIX_API_RESPONSE + ref;
}
this.$ref = ref;
this.ref = ref;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*/
public class SecuritySchemeImpl extends ExtensibleImpl<SecurityScheme> implements SecurityScheme, ModelImpl {

private String $ref;
private String ref;
private Type type;
private String description;
private String name;
Expand All @@ -27,7 +27,7 @@ public class SecuritySchemeImpl extends ExtensibleImpl<SecurityScheme> implement
*/
@Override
public String getRef() {
return this.$ref;
return this.ref;
}

/**
Expand All @@ -38,7 +38,7 @@ public void setRef(String ref) {
if (ref != null && !ref.contains("/")) {
ref = OpenApiConstants.REF_PREFIX_SECURITY_SCHEME + ref;
}
this.$ref = ref;
this.ref = ref;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public static <T> T mergeObjects(T object1, T object2) {
try {
descriptors = Introspector.getBeanInfo(object1.getClass()).getPropertyDescriptors();
} catch (IntrospectionException e) {
UtilLogging.log.failedToIntrospectBeanInfo(object1.getClass(), e);
UtilLogging.logger.failedToIntrospectBeanInfo(object1.getClass(), e);
}

for (PropertyDescriptor descriptor : descriptors) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

@MessageLogger(projectCode = "SROAP", length = 5)
interface UtilLogging extends BasicLogger {
UtilLogging log = Logger.getMessageLogger(UtilLogging.class, UtilLogging.class.getPackage().getName());
UtilLogging logger = Logger.getMessageLogger(UtilLogging.class, UtilLogging.class.getPackage().getName());

@LogMessage(level = Logger.Level.ERROR)
@Message(id = 1000, value = "Failed to introspect BeanInfo for: %s")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

@MessageLogger(projectCode = "SROAP", length = 5)
public interface IoLogging extends BasicLogger {
IoLogging log = Logger.getMessageLogger(IoLogging.class, IoLogging.class.getPackage().getName());
IoLogging logger = Logger.getMessageLogger(IoLogging.class, IoLogging.class.getPackage().getName());

@LogMessage(level = Logger.Level.DEBUG)
@Message(id = 2000, value = "Processing a map of %s annotations.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public static Map<String, Callback> readCallbacks(final AnnotationScannerContext
if (annotationValue == null) {
return null;
}
IoLogging.log.annotationsMap("@Callback");
IoLogging.logger.annotationsMap("@Callback");
Map<String, Callback> callbacks = new LinkedHashMap<>();
AnnotationInstance[] nestedArray = annotationValue.asNestedArray();
for (AnnotationInstance nested : nestedArray) {
Expand All @@ -72,7 +72,7 @@ public static Map<String, Callback> readCallbacks(final JsonNode node) {
if (node == null || !node.isObject()) {
return null;
}
IoLogging.log.jsonNodeMap("Callback");
IoLogging.logger.jsonNodeMap("Callback");
Map<String, Callback> callbacks = new LinkedHashMap<>();
for (Iterator<String> fieldNames = node.fieldNames(); fieldNames.hasNext();) {
String fieldName = fieldNames.next();
Expand Down Expand Up @@ -102,9 +102,9 @@ public static Callback readCallback(final AnnotationScannerContext context,
if (annotation == null) {
return null;
}
IoLogging.log.singleAnnotation("@Callback");
IoLogging.logger.singleAnnotation("@Callback");
Callback callback = new CallbackImpl();
callback.setRef(JandexUtil.refValue(annotation, JandexUtil.RefType.Callback));
callback.setRef(JandexUtil.refValue(annotation, JandexUtil.RefType.CALLBACK));
String expression = JandexUtil.stringValue(annotation, CallbackConstant.PROP_CALLBACK_URL_EXPRESSION);
callback.addPathItem(expression,
PathsReader.readPathItem(context, annotation.value(CallbackConstant.PROP_OPERATIONS), null));
Expand All @@ -121,7 +121,7 @@ private static Callback readCallback(final JsonNode node) {
if (node == null || !node.isObject()) {
return null;
}
IoLogging.log.singleJsonNode("Callback");
IoLogging.logger.singleJsonNode("Callback");
Callback callback = new CallbackImpl();
callback.setRef(JsonUtil.stringProperty(node, Referenceable.PROP_$REF));
for (Iterator<String> fieldNames = node.fieldNames(); fieldNames.hasNext();) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public static Components readComponents(final AnnotationScannerContext context,
if (annotationValue == null) {
return null;
}
IoLogging.log.singleAnnotation("@Components");
IoLogging.logger.singleAnnotation("@Components");
AnnotationInstance nested = annotationValue.asNested();
Components components = new ComponentsImpl();
// TODO for EVERY item below, handle the case where the annotation is ref-only. then strip the ref path and use the final segment as the name
Expand Down Expand Up @@ -78,7 +78,7 @@ public static Components readComponents(final JsonNode node) {
if (node == null || !node.isObject()) {
return null;
}
IoLogging.log.singleJsonNode("Components");
IoLogging.logger.singleJsonNode("Components");
Components components = new ComponentsImpl();
components.setCallbacks(CallbackReader.readCallbacks(node.get(ComponentsConstant.PROP_CALLBACKS)));
components.setExamples(ExampleReader.readExamples(node.get(ComponentsConstant.PROP_EXAMPLES)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public static Contact readContact(final AnnotationValue annotationValue) {
if (annotationValue == null) {
return null;
}
IoLogging.log.singleAnnotation("@Contact");
IoLogging.logger.singleAnnotation("@Contact");
AnnotationInstance nested = annotationValue.asNested();
Contact contact = new ContactImpl();
contact.setName(JandexUtil.stringValue(nested, ContactConstant.PROP_NAME));
Expand All @@ -54,7 +54,7 @@ public static Contact readContact(final JsonNode node) {
if (node == null) {
return null;
}
IoLogging.log.singleJsonNode("Contact");
IoLogging.logger.singleJsonNode("Contact");
Contact contact = new ContactImpl();
contact.setName(JsonUtil.stringProperty(node, ContactConstant.PROP_NAME));
contact.setUrl(JsonUtil.stringProperty(node, ContactConstant.PROP_URL));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public static Content readContent(final AnnotationScannerContext context,
if (annotationValue == null) {
return null;
}
IoLogging.log.singleAnnotation("@Content");
IoLogging.logger.singleAnnotation("@Content");
Content content = new ContentImpl();
AnnotationInstance[] nestedArray = annotationValue.asNestedArray();
for (AnnotationInstance nested : nestedArray) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ private DefinitionReader() {
public static void processDefinition(final AnnotationScannerContext context,
final OpenAPI openApi,
final AnnotationInstance annotationInstance) {
IoLogging.log.annotation("@OpenAPIDefinition");
IoLogging.logger.annotation("@OpenAPIDefinition");

openApi.setInfo(InfoReader.readInfo(annotationInstance.value(DefinitionConstant.PROP_INFO)));
openApi.setTags(TagReader.readTags(annotationInstance.value(DefinitionConstant.PROP_TAGS)).orElse(null));
Expand All @@ -66,7 +66,7 @@ public static void processDefinition(final AnnotationScannerContext context,
*/
public static void processDefinition(final OpenAPI openApi,
final JsonNode node) {
IoLogging.log.jsonNode("OpenAPIDefinition");
IoLogging.logger.jsonNode("OpenAPIDefinition");

openApi.setOpenapi(JsonUtil.stringProperty(node, DefinitionConstant.PROP_OPENAPI));
openApi.setInfo(InfoReader.readInfo(node.get(DefinitionConstant.PROP_INFO)));
Expand Down
Loading

0 comments on commit c2b40d5

Please sign in to comment.