Uploaded image for project: 'Legal Discuss'
  1. Legal Discuss
  2. LEGAL-467

Licensing for 'boilerplate' code snippets

    XMLWordPrintableJSON

Details

    • Question
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • None

    Description

      Related to LEGAL-459, but not necessarily limited to StackOverflow.

      There is a lot of code on the internet that is meant to illustrate how to do some boilerplate kind of thing. A lot of that code has either murky licensing (no copyright/license statement, because it's from someone's personal blog) or forbidden licensing (StackOverflow, which hosts a lot of these snippets, covers its pages with a category X license).

      One example that came up in Apache Druid recently was the desire to include some code to work around a problem with the Apache Kafka producer. Someone submitted a patch that was adapted from https://stackoverflow.com/a/54118010/2586315. It is boilerplate Java code for manipulating the thread context classloader - the core of it is just a couple of lines:

      Thread.currentThread().setContextClassLoader(null);
      Producer<String, String> producer = new KafkaProducer(props);
      

      In a situation like this, I'd like to be able to say that the code is short and boilerplate, so we are free to add similar code to our project without worrying about licensing. Is that reasonable?

      I'm concerned that the alternative – treating this snippet the same as we would treat a more substantial body of code – is infeasible:

      • Identifying the author is a challenge since the code snippet seems to have been independently generated and/or passed around multiple times. Three different answers in the SO thread contain the same snippet (or one that is pretty close). Who is the real author? If we contact the author of the answer – putting aside for a minute the burden that imposes – how do we arrive at the confidence that they are the legal copyright holder of this snippet?
      • Being boilerplate code, it isn't possible to rewrite using a different approach. So what happens if the Apache project is unable to find an author to relicense the snippet? Must we avoid using this particular snippet forever?

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              gian Gian Merlino
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: