Uploaded image for project: 'Wink'
  1. Wink
  2. WINK-210

Output of ProvidersRegistry$MediaTypeMap.toString() should be more readable

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.0
    • Common
    • None
    • Patch Available

    Description

      This is a debug statement in ProvidersRegistry$MediaTypeMap.put(),

      if (logger.isDebugEnabled()) {
      logger.debug("Added ObjectFactory {} with MediaType {} to MediaTypeMap {}",
      new Object[]

      {objectFactory, key, this}

      );
      ...

      ProvidersRegistry$MediaTypeMap.toString() is this:

      public String toString()

      { return String.format("RawType: %s, Data: %s", String.valueOf(rawType), data.toString()); }

      The data object is a HashMap with a MediaType for a key and a Set of ObjectFactory objects as its value:

      private volatile Map<MediaType, Set<ObjectFactory<T>>> data = new HashMap<MediaType, Set<ObjectFactory<T>>>();

      If there are several entries in the data map, the message that results can appear like this:

      [9/28/09 16:36:03:187 CDT] 00000013 ProvidersRegi 1 org.apache.wink.common.internal.registry.ProvidersRegistry$MediaTypeMap put Added ObjectFactory Priority: 0.100000, ObjectFactory: ClassMetadataPrototypeOF Class: class org.apache.wink.common.internal.providers.entity.AssetProvider with MediaType / to MediaTypeMap RawType: interface javax.ws.rs.ext.MessageBodyWriter, Data: {/=[Priority: 0.100000, ObjectFactory: SingletonOF: class org.apache.wink.common.internal.providers.entity.xml.JAXBElementXmlProvider, Priority: 0.100000, ObjectFactory: SingletonOF: class org.apache.wink.common.internal.providers.entity.StringProvider, Priority: 0.100000, ObjectFactory: SingletonOF: class org.apache.wink.common.internal.providers.entity.FileProvider, Priority: 0.100000, ObjectFactory: SingletonOF: class org.apache.wink.common.internal.providers.entity.StreamingOutputProvider, Priority: 0.100000, ObjectFactory: SingletonOF: class org.apache.wink.common.internal.providers.entity.ReaderProvider, Priority: 0.100000, ObjectFactory: SingletonOF: class org.apache.wink.common.internal.providers.entity.ByteArrayProvider, Priority: 0.100000, ObjectFactory: SingletonOF: class org.apache.wink.common.internal.providers.entity.DataSourceProvider, Priority: 0.100000, ObjectFactory: SingletonOF: class org.apache.wink.common.internal.providers.entity.InputStreamProvider, Priority: 0.100000, ObjectFactory: SingletonOF: class org.apache.wink.common.internal.providers.entity.SourceProvider$StreamSourceProvider, Priority: 0.100000, ObjectFactory: SingletonOF: class org.apache.wink.common.internal.providers.entity.SourceProvider$DOMSourceProvider, Priority: 0.100000, ObjectFactory: SingletonOF: class org.apache.wink.common.internal.providers.entity.xml.JAXBXmlProvider, Priority: 0.100000, ObjectFactory: SingletonOF: class org.apache.wink.common.internal.providers.entity.FormatedExceptionProvider, Priority: 0.100000, ObjectFactory: SingletonOF: class org.apache.wink.common.internal.providers.entity.SourceProvider$SAXSourceProvider], application/atomcat+xml=[Priority: 0.100000, ObjectFactory: ClassMetadataPrototypeOF Class: class org.apache.wink.common.internal.providers.entity.app.CategoriesProvider], application/xml=[Priority: 0.100000, ObjectFactory: SingletonOF: class org.apache.wink.common.internal.providers.entity.SourceProvider$StreamSourceProvider, Priority: 0.100000, ObjectFactory: SingletonOF: class org.apache.wink.common.internal.providers.entity.xml.JAXBElementXmlProvider, Priority: 0.100000, ObjectFactory: SingletonOF: class org.apache.wink.common.internal.providers.entity.SourceProvider$DOMSourceProvider, Priority: 0.100000, ObjectFactory: SingletonOF: class org.apache.wink.common.internal.providers.entity.xml.JAXBXmlProvider, Priority: 0.100000, ObjectFactory: SingletonOF: class org.apache.wink.common.internal.providers.entity.SourceProvider$SAXSourceProvider], text/xml=[Priority: 0.100000, ObjectFactory: SingletonOF: class org.apache.wink.common.internal.providers.entity.SourceProvider$StreamSourceProvider, Priority: 0.100000, ObjectFactory: SingletonOF: class org.apache.wink.common.internal.providers.entity.xml.JAXBElementXmlProvider, Priority: 0.100000, ObjectFactory: SingletonOF: class org.apache.wink.common.internal.providers.entity.SourceProvider$DOMSourceProvider, Priority: 0.100000, ObjectFactory: SingletonOF: class org.apache.wink.common.internal.providers.entity.xml.JAXBXmlProvider, Priority: 0.100000, ObjectFactory: SingletonOF: class org.apache.wink.common.internal.providers.entity.SourceProvider$SAXSourceProvider], application/x-www-form-urlencoded=[Priority: 0.100000, ObjectFactory: SingletonOF: class org.apache.wink.common.internal.providers.entity.FormMultivaluedMapProvider], application/atom+xml=[Priority: 0.100000, ObjectFactory: SingletonOF: class org.apache.wink.common.internal.providers.entity.atom.AtomFeedSyndFeedProvider, Priority: 0.100000, ObjectFactory: SingletonOF: class org.apache.wink.common.internal.providers.entity.atom.AtomEntrySyndEntryProvider], application/octet-stream=[Priority: 0.100000, ObjectFactory: SingletonOF: class org.apache.wink.common.internal.providers.entity.InputStreamProvider], text/html=[Priority: 0.100000, ObjectFactory: SingletonOF: class org.apache.wink.server.internal.providers.entity.html.HtmlProvider], application/json=[Priority: 0.100000, ObjectFactory: SingletonOF: class org.apache.wink.common.internal.providers.entity.atom.AtomFeedSyndFeedProvider, Priority: 0.100000, ObjectFactory: SingletonOF: class org.apache.wink.common.internal.providers.entity.atom.AtomEntrySyndEntryProvider], text/csv=[Priority: 0.100000, ObjectFactory: SingletonOF: class org.apache.wink.common.internal.providers.entity.csv.CsvSyndFeedSerializerProvider, Priority: 0.100000, ObjectFactory: SingletonOF: class org.apache.wink.common.internal.providers.entity.csv.CsvSerializerProvider], application/javascript=[Priority: 0.100000, ObjectFactory: SingletonOF: class org.apache.wink.common.internal.providers.entity.atom.AtomFeedSyndFeedProvider, Priority: 0.100000, ObjectFactory: SingletonOF: class org.apache.wink.common.internal.providers.entity.atom.AtomEntrySyndEntryProvider], multipart/*=[Priority: 0.100000, ObjectFactory: SingletonOF: class org.apache.wink.common.internal.providers.multipart.OutMultiPartProvider]}

      While it may make perfect sense to Wink development, for support personnel, this message is not very understandable.

      I propose either changing $MediaTypeMap.toString() or adding another toString() method that the existing toString() would call, so that the message can appear something like this:

      [10/2/09 11:45:59:078 CDT] 00000013 ProvidersRegi 1 org.apache.wink.common.internal.registry.ProvidersRegistry$MediaTypeMap put Added ObjectFactory Priority: 0.100000, ObjectFactory: SingletonOF: class org.apache.wink.common.internal.providers.entity.FormatedExceptionProvider with MediaType / to MediaTypeMap
      RawType: interface javax.ws.rs.ext.MessageBodyWriter
      Data Map:
      MediaType key = /
      ObjectFactory Set value = {
      Priority: 0.100000, ObjectFactory: SingletonOF: class org.apache.wink.common.internal.providers.entity.SourceProvider$SAXSourceProvider
      Priority: 0.100000, ObjectFactory: SingletonOF: class org.apache.wink.common.internal.providers.entity.StringProvider
      Priority: 0.100000, ObjectFactory: SingletonOF: class org.apache.wink.common.internal.providers.entity.xml.JAXBXmlProvider
      Priority: 0.100000, ObjectFactory: SingletonOF: class org.apache.wink.common.internal.providers.entity.DataSourceProvider
      Priority: 0.100000, ObjectFactory: SingletonOF: class org.apache.wink.common.internal.providers.entity.SourceProvider$StreamSourceProvider
      Priority: 0.100000, ObjectFactory: SingletonOF: class org.apache.wink.common.internal.providers.entity.StreamingOutputProvider
      Priority: 0.100000, ObjectFactory: SingletonOF: class org.apache.wink.common.internal.providers.entity.FileProvider
      Priority: 0.100000, ObjectFactory: SingletonOF: class org.apache.wink.common.internal.providers.entity.InputStreamProvider
      Priority: 0.100000, ObjectFactory: SingletonOF: class org.apache.wink.common.internal.providers.entity.SourceProvider$DOMSourceProvider
      Priority: 0.100000, ObjectFactory: SingletonOF: class org.apache.wink.common.internal.providers.entity.ByteArrayProvider
      Priority: 0.100000, ObjectFactory: SingletonOF: class org.apache.wink.common.internal.providers.entity.ReaderProvider
      Priority: 0.100000, ObjectFactory: SingletonOF: class org.apache.wink.common.internal.providers.entity.xml.JAXBElementXmlProvider
      }
      MediaType key = application/atomcat+xml
      ObjectFactory Set value = {
      Priority: 0.100000, ObjectFactory: ClassMetadataPrototypeOF Class: class org.apache.wink.common.internal.providers.entity.app.CategoriesProvider
      }
      MediaType key = application/xml
      ObjectFactory Set value = {
      Priority: 0.100000, ObjectFactory: SingletonOF: class org.apache.wink.common.internal.providers.entity.xml.JAXBXmlProvider
      Priority: 0.100000, ObjectFactory: SingletonOF: class org.apache.wink.common.internal.providers.entity.SourceProvider$SAXSourceProvider
      Priority: 0.100000, ObjectFactory: SingletonOF: class org.apache.wink.common.internal.providers.entity.SourceProvider$StreamSourceProvider
      Priority: 0.100000, ObjectFactory: SingletonOF: class org.apache.wink.common.internal.providers.entity.SourceProvider$DOMSourceProvider
      Priority: 0.100000, ObjectFactory: SingletonOF: class org.apache.wink.common.internal.providers.entity.xml.JAXBElementXmlProvider
      }
      MediaType key = text/xml
      ObjectFactory Set value = {
      Priority: 0.100000, ObjectFactory: SingletonOF: class org.apache.wink.common.internal.providers.entity.xml.JAXBXmlProvider
      Priority: 0.100000, ObjectFactory: SingletonOF: class org.apache.wink.common.internal.providers.entity.SourceProvider$SAXSourceProvider
      Priority: 0.100000, ObjectFactory: SingletonOF: class org.apache.wink.common.internal.providers.entity.SourceProvider$StreamSourceProvider
      Priority: 0.100000, ObjectFactory: SingletonOF: class org.apache.wink.common.internal.providers.entity.SourceProvider$DOMSourceProvider
      Priority: 0.100000, ObjectFactory: SingletonOF: class org.apache.wink.common.internal.providers.entity.xml.JAXBElementXmlProvider
      }
      // ....etc....

      All the breaking up of lines can make a long message even longer, but at least it would be much more understandable.

      I have a code solution for this, so there's no need for anyone to work on it right now.

      Attachments

        1. WINK-210.patch
          2 kB
          Wendy Raschke

        Activity

          People

            bluk Bryant Luk
            wraschke Wendy Raschke
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: