Skip to content

Answer a missing Property in the examples with the contact link in plain text - #193

Merged
ben51degrees merged 2 commits into
rcfrom
examples/missing-property-plain-text
Nov 19, 2026
Merged

ben51degrees merged 2 commits into
rcfrom
examples/missing-property-plain-text

Conversation

@jwrosewell

@jwrosewell jwrosewell commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Problem

The example helpers that read a Property through PropertyHelper.tryGet answered a Property the data file or resource key in use cannot give with an HTML anchor to the pricing page, See data file options <a href="https://51degrees.com/pricing?...">here</a>. The examples print that answer to a console, where the HTML is shown as written. The Device Detection helper's anchor wrote its separators as &amp;, so the address was wrong even when copied. The IP Intelligence helper also logged a once-only advisory, PRICING_MESSAGE, pointing at the pricing page.

The specification, device-detection-specification/required-examples.md lines 105 to 113 at d79bbe3b, says "Where the data file in use has no value for one of them, the example says that the Property needs the Enterprise Data File, rather than leaving it out or showing a default value, and once in its output gives a link to the 51Degrees contact page to ask for a copy. The link the example writes carries utm_source=code, utm_medium=example, the language repository's name as utm_campaign and the example's file as utm_content, so that an enquiry can be traced to the example that prompted it." This draft fixes the HTML and the pricing page. Giving the link once, tagged with the example's file, is #210.

What changed

Links are to the head, 3afe55c8.

  1. Both PropertyHelper.tryGet methods answer in plain text with the contact link. Device Detection and IP Intelligence now give "The property 'X' is not available with the data file or resource key in use. Contact us about one that has it at" followed by the contact link, tagged utm_source=code, utm_medium=example, utm_campaign=51degrees-java, the helper's file as utm_content and the existing utm_term.
  2. The IP Intelligence advisory gives the contact link too. PRICING_MESSAGE now says that some properties are not available with a free resource key or the free data file and gives the contact link with utm_term=paid-properties, where it gave the pricing page with utm_term=pricing_message. The constant keeps its name.

Examples only. No published package changes, and no public name is removed or renamed.

Before you upgrade

The Device Detection web examples, through HtmlContentHelper, and the IP Intelligence cloud and cloud mixed web examples put the answer into their page as it is, so on those pages a missing Property now shows the contact link as text where it showed a "here" link to the pricing page. The console examples, which are most of the callers, print it as a link a terminal can open.

Tests

PropertyHelperMissingPropertyTests, new in both example shared modules, has the helper read a Property that throws PropertyMissingException and checks the answer holds no HTML (< or &amp;), names the Property and holds the tagged contact link. The IP Intelligence class also checks PRICING_MESSAGE holds the contact link and no HTML.

Red and green, run 43903389104 on tmp/red-dx31, which runs the new class against the published packages from each example tree, at the test commit effb54f and at the fix 3afe55c.

Job Result
red, Device Detection 2 of 2 fail, "The message holds HTML" and "The message has no tagged contact link", each quoting the old anchor with its &amp; separators
red, IP Intelligence 3 of 3 fail, the two above and "The advisory has no tagged contact link" quoting the pricing page advisory
green, Device Detection 2 of 2 pass
green, IP Intelligence 3 of 3 pass

Build

The draft changes only the two example trees, so it runs the tests of what it touches, being the new classes' red and green above, and the full build runs once on rc before a release. All seven checks on the head passed, being the four fresh clone checks, which build both example trees against the published packages on Ubuntu and Windows, the environment variable name check, the UTM link lint and the rc into main check.

Base branch

Branched from rc 81e3d4a.

What remains

  1. #148 changes unwrapValue in the same IP Intelligence PropertyHelper. The two touch different methods and a trial merge is clean.
  2. Making the contact link an anchor on those web pages, which put the answer into HTML as it is, is #197.
  3. The examples that call tryGet were not run here to read the line they print, because each needs a key or the Enterprise data file to reach a missing Property. The test reads the helper's answer directly.
  4. The link is still in every missing Property's answer and tagged with the shared helper's file, where the specification asks for it once in an example's output, tagged with the example's file. Both were the same before this draft. #210 covers both, with the specification quoted and the examples that need to change.

Changes at this head

The draft is two commits on rc 81e3d4a.

  1. effb54fb, the test. PropertyHelperMissingPropertyTests in both example shared modules holds that a missing Property is answered in plain text with the tagged contact link, as Tests says. Red in run 43903389104.
  2. 3afe55c8, the fix. Both PropertyHelper.tryGet methods and the IP Intelligence PRICING_MESSAGE give the contact link in plain text, as What changed says. Green in the same run.

The link is still given in every missing Property's answer and tagged with the shared helper's file, as it was on rc. The specification asks for it once in an example's output, tagged with the example's file, which changes the output of every example that reads through the helpers, so it is left to #210 (What remains item 4).

@ben51degrees
ben51degrees marked this pull request as ready for review November 19, 2026 17:18
@ben51degrees
ben51degrees merged commit 6503c27 into rc Nov 19, 2026
7 checks passed
@ben51degrees
ben51degrees deleted the examples/missing-property-plain-text branch November 19, 2026 17:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants