
The 9 lines of code that Google allegedly stole from Oracle - nkurz
https://majadhondt.wordpress.com/2012/05/16/googles-9-lines/
======
jbob2000
Looks like something I've written a hundred times. It's a common pattern, you
could "steal" this just through organically writing a program.

The more I hear about this case, the more I realize it's just a bunch of
lawyers trying to pad their bank accounts. No sane engineer would claim this
is infringement.

~~~
rayiner
The article misses the forest for the trees. This lawsuit isn't about
rangeCheck, it's about the structure/sequence/organization of the Java APIs.
Whether you think SSO should be copyrightable or not, you can't argue it's
trivial. Copying the SSO allowed Google to greatly reduce the barrier to entry
for Android by leveraging the enormous Java ecosystem.[1]

The relevance of rangeCheck isn't that it's some crucial functionality that
Google couldn't have written themselves. The relevance of rangeCheck--and
Google's admission that it literally copied the code instead of developing it
"organically"\--is proving that Google was looking at JDK code while
developing the Android JVM.

Oracle would never sue on rangeCheck by itself because the damages would be
trivial. They're hammering on the literal copying of rangeCheck because of
what it says about Google's state of mind.

[1] The fundamental legal question is actually pretty interesting and has
implications beyond this case. Remember Microsoft's policy of "embrace,
extend, extinguish" in the 1990s? If SSO is protectable, then "embrace,
extend, extinguish" tactics may cross the line from simply distasteful to
actionable unfair competition.

~~~
Oletros
> Copying the SSO allowed Google to greatly reduce the barrier to entry for
> Android by leveraging the enormous Java ecosystem.[1]

Google used Apache Harmony implementation of Java.

Why Oracle never sued Apache Foundation?

~~~
nitrogen
Sun did refuse to give the Apache Foundation access to the necessary test
suites to certify the Harmony implementation.

------
sgc
Given the guy who wrote this wrote both the first and supposedly infringing
code, I have a bit of an analogy here from personal experience from another
field.

For a while I worked in translating, and I translated a couple of books for
the same author. One of the later books quoted about a page from the first one
I had translated a couple of years earlier. I just translated it again because
it was faster than finding the passage in my other translation (first point).
Afterwards, I went back out of curiosity and checked the two translations
against each other. I was quite surprised to see that in one full page of
translation, after years of further experience, there was only one or two
prepositions that were meaninglessly changed (point two).

Some things are just so obvious that the same guy doing the same thing years
apart will produce the same results, especially if he is an expert in his
craft. Unless there is some way to prove otherwise, this point of the case
should be definitively dropped.

------
nedsma
Dear goodness. And there are tens if not hundreds of people involved in trying
to prove/disprove this case and they're all getting some hefty money. What a
waste of human intellect and time.

~~~
tetrep
I wonder if it's possible to measure energy spent in court cases? One of the
things that amazed me about spam was how many resources we spend just
transmitting it across the internet, it's kind of tragic when you think about
the waste, but also kinda awesome that everything still works, despite
relatively poor resource allocation.

The Economics of Spam:
[http://pubs.aeaweb.org/doi/pdfplus/10.1257/jep.26.3.87](http://pubs.aeaweb.org/doi/pdfplus/10.1257/jep.26.3.87)

~~~
jerf
You'd have to define what you mean a lot more carefully. Certainly any sort of
network transmission costs would be dominated by, say, climate control in the
court room.

~~~
tlrobinson
I think the parent commenter was just using spam as an example of an activity
that uses a disproportionate amount of energy compared to it's value.

The court room climate control costs would likely be dominated by energy
expended for every involved individuals' commutes, which would likely be
dominated by the opportunity cost of all of those individuals doing something
more productive (if you want to go that far)

------
guelo
This article is from 2012 and is very outdated. The "famous 9 lines" are not
being contested anymore. Google lost that case. The current trial is about
whether Google's copyright infringement constituted "fair use".

~~~
polpo
I was also surprised to see this here. It needs a (2012) tag in the title at
the very least, as this is not what is being litigated right now.

~~~
justinclift
"tag" is apparently not the correct word. I was downvoted for using the same
term to point out the same thing for another article recently. No idea what
the "correct" word should be though.

~~~
logn
Maybe you weren't downvoted over the terminology. Putting the year in titles
isn't required if it's an evergreen article (i.e., not news, not timely).

~~~
justinclift
Interesting, thanks that's something I hadn't considered.

------
AdmiralAsshat
One thing I've been thinking about as I've read through the trial:

It's my understanding (I am a wee lad compared to the grizzled vets here, so
bear with me) that most of our common *nix tools were written during the UNIX
days and were technically proprietary (awk, grep, cut, etc). When Linux came
around, these tools were "ported" to become GNU tools and completely rewritten
on the backend, while still keeping the same name so that existing UNIX
developers would feel at-home using the same tools on Linux,BSD, etc.

The key point here is that they intentionally kept the same command names, for
familiarity's sake.

Given that, could one make the analogy that a command name would be similar to
an "API" and should also have been illegal by Oracle's logic?

~~~
toyg
IANAL but I believe imitation to ensure interoperability is covered by fair
use clauses.

~~~
geofft
_The difference here is that Google was not trying to ensure interoperability
with anything, they just wanted to mimic Java to attract developers._

Is that true? Can't you use several Java packages (at least in source form),
IDEs, etc. with Android?

~~~
toyg
Sorry, i removed that bit from my comment because I thought it was a bit too
biased, and tbh I wasn't paying too much attention to Android when it started,
so I might be wrong and everything.

This said, IIUC, the point is that they did not build Android specifically to
achieve interoperability with, say, Eclipse; they built Android in Java for
whatever reason (including attracting developers), and when they realised they
couldn't use the JVM because of commercial issues, they swapped it with Dalvik
(which may or may not be a complete clean-room JVM reimplementation).

So it's not exactly in the same bucket as "we built this because existing
tooling expected it this way"; it's more like "we built something, then had to
rewrite the bits underneath because we realised we couldn't use them", a
different scenario.

~~~
c22
My understanding is Android already used Java when Google acquired it.

~~~
toyg
Yeah, but the switch to Dalvik (which is where the trouble starts) was done
under Google.

If they had just thrashed out an agreement with Sun (which would have been
much _much_ cheaper than dealing with Oracle will ever be...), they could have
continued using the official mobile-oriented JVM, likely influencing its
development as well; but first they dragged their feet and then they thought
they'd just rewrite the whole thing so they could claim originality and
independence, and here we are.

------
worldsayshi
Wow, this is legal bullshiting beyond comprehension. It is the equivalent of
one engineer copycating the way another engineer moves his arm when fastening
a screw. To give anything beyond 5 minutes attention to this in a court is an
insult to society.

~~~
geofft
Yes, there's a concept in law called " _de minimis_ ", short for " _de minimis
non curat lex_ ": "The law does not care about trivial things". Google argued
that rangeCheck was " _de minimis_ ".

[http://www.groklaw.net/articlebasic.php?story=20120802030811...](http://www.groklaw.net/articlebasic.php?story=20120802030811156)

This article is from 2012. The trial currently happening was remanded from an
appeals court, which overruled Judge Alsup in determining that the "structure,
sequence, and organization" of the Java _APIs_ (not the code itself) was
copyrightable, which is much less _de minimis_ I don't believe rangeCheck
itself is still at issue.

~~~
franciscop
"Has Oracle proven that Google's conceded use of the following was infringing,
the only issue being whether such use was de mimis"

------
gvb
More relevant information: "What are the 37 Java API packages possibly
encumbered by the May 2014 Oracle v Google decision?"

[http://stackoverflow.com/questions/23583968/what-are-
the-37-...](http://stackoverflow.com/questions/23583968/what-are-the-37-java-
api-packages-possibly-encumbered-by-the-may-2014-oracle-v-g)

From the #1 answer (it is worth clicking the link and reading the full
answer):

    
    
        java.awt.font
        java.beans
        java.io
        java.lang
        java.lang.annotation
        java.lang.ref
        java.lang.reflect
        java.net
        java.nio
        java.nio.channels
        java.nio.channels.spi
        java.nio.charset
        java.nio.charset.spi
        java.security
        java.security.acl
        java.security.cert
        java.security.interfaces
        java.security.spec
        java.sql
        java.text
        java.util
        java.util.jar
        java.util.logging
        java.util.prefs
        java.util.regex
        java.util.zip
        javax.crypto
        javax.crypto.interfaces
        javax.crypto.spec
        javax.net
        javax.net.ssl
        javax.security.auth
        javax.security.auth.callback
        javax.security.auth.login
        javax.security.auth.x500
        javax.security.cert
        javax.sql

------
foobarrio
I thought it "not obvious to a practitioner of the craft" was a requirement
for a patent no? Give 10 programmers the task to write "rangeCheck()" and
you'll end up with very similar looking code.

~~~
dboreham
Although this case relates to copyright, I feel it worthwhile to note that in
patent-lawyer-land, what you say does not work so much.

I had the pleasure to spend some time working with some very (very!) smart
patent lawyers on a couple of cases.

Apart from feeling like I was in an episode of Boston Legal merged with The
Good Wife, I was able to gain some understanding of the rules of the game. In
that game things like "but it's patently obvious" gets you zero points. Any
argument you advance that's based on obviousness will lead to eye rolling and
deep sighs. Such arguments are extremely hard to win, it turns out. In our
legal system, proving invalidity is difficult.

By contrast, things like : a comma in the wrong place in claim drafting; case
moved to a different jurisdiction; tricks with filing dates; prior art (the
thing I was helping with) and other noninfringement theories are greeted with
enthusiasm.

~~~
lordnacho
So basically an alternative universe is where these claims are decided?

I did a patent a few years ago, and that's how it felt. The patent lawyer
would call me to get my version and when the application was done, it would
look like it came from another plane of existence.

Phrasing like "cause a calculating machine to..." were repeated a lot. Totally
unreadable, probably only makes sense if you're a lawyer.

And symptomatic of a broken system, in my view.

~~~
dboreham
Yes, totally. Patent drafting and patent litigation in this field has almost
nothing to do with reality.

------
holtalanm
am I the only one that when looking at the implementation sees that there is a
major flaw in the code?

if(toIndex > arrayLen) does not handle the case in which toIndex == arrayLen,
which should still throw an ArrayIndexOutOfBoundsException if we are dealing
with 0-based indexes.

Please correct me if I am wrong.

~~~
worldsayshi
Also the code isn't syntactically correct:

    
    
        (int arrayLen, int fromIndex, int toIndex {
    

Missing parenthesis after toIndex. Something is fishy here.

~~~
moron4hire
Maybe it's transcription error. Probably a paralegal somewhere copied it from
the original source to a different document and doesn't have the programmer's
eye for noticing minor differences in what would basically be line-noise to
them.

------
Aelinsaar
Incredible. The amount of money being set to the fire for the sake of
something that even a student knows is utter crap.

~~~
toyg
Considering this case is probably not influencing the US dollar inflation
rate, nothing is being set on fire -- it's just being moved from Google's +
Oracle's pockets to Google's + Oracle's _lawyers'_ pockets :)

~~~
worldsayshi
Well, people-time is certainly being wasted.

------
devy
Sort of off topic, anyone know who's this Tim Peters who created the TimSort?
Python docs and Wikipedia[1] has virtually no bio for him even though he's
very well known Python contributor and his code becomes a legacy in this
billion dollar lawsuit, among other things(like Zen of Python[2]).

[1]:
[https://en.wikipedia.org/wiki/Timsort](https://en.wikipedia.org/wiki/Timsort)

[2]:
[https://www.python.org/dev/peps/pep-0020/](https://www.python.org/dev/peps/pep-0020/)

------
ZeroGravitas
The worst part is that the programmer only "stole" these lines as he was
contributing an improvement back to the OpenJDK and wanted his stuff to be
compatible. Which adds one more level of absurdity.

------
hermannj314
Yeah, a bunch of jurors will be ruined financially while being forced to watch
billionaires fight over how to best split up their empire. Sortition is how
you spell slavery in the 21st century.

------
enibundo
As a software engineer, I get sad when I read news like this.

~~~
singham
It's not news because the article is old. 2012

------
CiPHPerCoder
This code is ugly anyway:

    
    
        private static void rangeCheck(int arrayLen, int fromIndex, int toIndex {
             if (fromIndex > toIndex)
                  throw new IllegalArgumentException("fromIndex(" + fromIndex +
                       ") > toIndex(" + toIndex+")");
             if (fromIndex < 0) 
                  throw new ArrayIndexOutOfBoundsException(fromIndex);
             if (toIndex > arrayLen) 
                  throw new ArrayIndexOutOfBoundsException(toIndex);
        }
    

Missing a closing paren in the function prototype, among other things.

    
    
        private static void rangeCheck(int arrayLen, int fromIndex, int toIndex)
        {
             if (fromIndex > toIndex) {
                  throw new IllegalArgumentException(
                      String.format("fromIndex(%d) > toIndex(%d)", fromIndex, toIndex)
                  );
             }
             if (fromIndex < 0) {
                  throw new ArrayIndexOutOfBoundsException(fromIndex);
             }
             if (toIndex > arrayLen) {
                  throw new ArrayIndexOutOfBoundsException(toIndex);
             }
        }
    

There you go Google, Oracle, et al. I release this snippet under MIT / WTFPL /
CC0. You're welcome.

~~~
creshal
I'd use whatever Java's printf equivalent is for the IllegalArgumentException
too. Sting concatenation like that is an eyesore.

~~~
CiPHPerCoder
Good point. Updated.

------
erikb
When the content of a trial are 9 lines of code then of course the topic are
not really the 9 lines of code. It's just a way to gain something else.
Everybody involved probably knows that.

I personally am very happy if powerhouses fight each other with lawsuits
instead of giving me a sword and asking me to die for them. In that regard I
feel humanity has come quite far over the last centuries.

------
tantalor
(2012)

~~~
nedsma
You're right. Please, someone update the headline.

------
cognivore
That has to be a joke. By pursuing this Oracle just makes themselves look like
idiots to anyone who actually has an technical knowledge.

So, they're idiots.

~~~
JPKab
Oracle has long looked like idiots to people with technical knowledge.

Their entire business has been selling software to C level executives who will
never come into contact with the product, let alone use it.

This isn't about merit, or technology. This is about a company's legal team
doing whatever they can to utilize acquired patents to create a revenue
stream.

Companies the size of Oracle simply aren't structured for innovation, and have
a culture which actively undermines it. They're getting their ass handed to
them by Azure, AWS, and Google Cloud for this very reason. When a company
starts making money off of professional services to help customers implement
and utilize their software, they simply aren't going to be incentivized to
make that software good. Shitty software and vendor lock-in combine to produce
guaranteed revenue streams, which sustain the company just enough for them to
be comfortable while they cruise towards irrelevance.

~~~
ZenoArrow
> "They're getting their ass handed to them by Azure, AWS, and Google Cloud
> for this very reason."

I'd add PostgreSQL to that list, they're clearly concerned about the risk it
poses to their core business:

[http://www.postgresql.org/message-id/CANNMO++6tPiwBv2OKcy-
Hh...](http://www.postgresql.org/message-id/CANNMO++6tPiwBv2OKcy-
HhiYmByhL+XSSUH3NDvOs3G1VVg++g@mail.gmail.com)

------
gsylvie
"I May Not Be Totally Perfect But Parts of Me Are Excellent" \- I think this
is a useful article to read when considering the 9 lines of code, because
copyright law tends to treat novels, pop songs, and software code as the same:
[http://fairuse.stanford.edu/2003/09/09/copyright_protection_...](http://fairuse.stanford.edu/2003/09/09/copyright_protection_for_short/)

------
Twisell
This is total FUD. (EDIT ND: because thoses lines of code are already out of
every discussions to be held in the current retrial, they are already ruled
out the only remaining question is fair use)

This trial should now be entirely focused about wether Google "stole" the API
SSO under a fair use exception and shall be relieved.

The preceding phases of this case already determined that: -thoses a nines
lines are not significant -Google used API SSO without consent of Sun/Oracle
and without any license -API SSO of Java are indeed copyrightable (this was
ruled in appeal and confirmed by the Supreme Court)

This retrial is only happening because judge Aslup did a half baked first
trial and the appeal court returned him the case after invalidating his bad
ruling about non-copyrightability of API.

For thoses who seek deep insights about this case, take a look at Florian
Mueller's blog: [http://www.fosspatents.com](http://www.fosspatents.com)

He pretty accurately predict the reversal of the first ruling against the
opinion of many mainstream analysts. And he frequently publish link to public
court documents so you can make up you mind by yourself.

EDIT: If you downvote please argument, otherwise it's very suspicious. I'm
totally open to discussion but I can't fight against a hidden lobbyst activity
that systmatically downvote diverging views.

EDIT2: I edited the first sentence to be more explicative. I've seen I got
some upvote, but silent bashing seems to continue. Again, please argument!

I don't get why the name of this blogger unleash so much passions while he
actually always publish documents and link to actual rulings. Yes he clearly
don't write as elegantly as some, and yes he's by now pretty opinionated but
why such much hate?

------
robin_reala
Site’s falling over. Cache:
[https://webcache.googleusercontent.com/search?q=cache:https%...](https://webcache.googleusercontent.com/search?q=cache:https%3A%2F%2Fmajadhondt.wordpress.com%2F2012%2F05%2F16%2Fgoogles%2D9%2Dlines%2F)

------
laverick
Uhm. That code wouldn't even compile...

~~~
mariodiana
First though I had. I wonder who's responsible for the typo -- the journalist,
Google, or Oracle?

------
draw_down
> Every company tries to control its developers’ actions, but does management
> really know what goes into the software?

This is backwards, developers do what management allows. If management cares
to know what goes in the software, they will know. There are ways to know.
Whether business people want to pay for that is a different matter. Of course
they don't, for this precise reason- so they can throw up their hands and say,
"those darn developers!"

------
chiefalchemist
Actual code aside, I would think this should strike fear in the hearts and
minds of any dev who wishes to change jobs and doesn't change industries /
product type. I would think that push come to shove employers will opt for
less direct experience, else they'll fear "a temporary measure" they didn't
ask for. That is, suddenly, experience might not be as valuable as it used to
be.

------
sleepychu
I'm pretty sure I've seen

    
    
      }
    

before...

------
0xmohit
Thankfully the patent system didn't exist when the number system was
developed. Otherwise one would need to pay a royalty for counting.

------
meganvito
In the university I graduated, the professor definitely will mark plagiarism
and give an F, unless a strict rule of sourcing followed. Most openjdk source
has the first line a usual header. Maybe I am a late student of JDK. or may be
there the court may prevail an exception. Finally you have to consider
yourself what do we mean to contribute to open source?

------
curiousgal
> _if i is between 0 and 11 before retrieving the ith element of a 10-element
> list._

Shouldn't i be between 0 and 9?

------
foldablechair
Reminds me of all those court cases of 'stolen' logos, using a small and fixed
set of geometric primitives, the probability of coincidences is just high that
way. Of course, some people believe all art is immitation and nothing ever
gets created from first principles.

------
known
Sounds like
[https://en.wikipedia.org/wiki/SCO_Group,_Inc._v._Internation...](https://en.wikipedia.org/wiki/SCO_Group,_Inc._v._International_Business_Machines_Corp).

------
chiefalchemist
Code aside. This should strike fear in the hearts and minds of any dev who
wishes to change jobs and doesn't change industries / product type. I would
think that push come to shove employers will opt for less direct experience.

------
Matt3o12_
Does anyone have an idea what is really going on?

I've heard people say that Google actually copied the API structure (which is
copyright-able) but I've also heard that this lawsuit was actually about
Google using a wrong (or missing license). And I've heard that Google also
manipulated the developer community by only propagating "we only copied 7
lines of code" and big evil oracle sues us.

From what I know Google used Java's API structure but did not include a
license. They could have paid oracle for a license to use it conmercially or
they could have used the GPL from OpenSDK and be bound to its restrictions.
What they did instead was not to include a license at all, because try did not
want to pay oracle but also did not want to be bound by the GPL (which might
complicate things with phone manufacturers that change the code).

Could anyone tell me what the fuck this lawsuit is actually about?

------
eps
Am I reading this correctly that it's actually buggy?

It doesn't properly work if an array is zero-based nor it works if it's
1-based. It neither properly work if toIndex is meant to be included in the
range or excluded from it.

------
nutate
The resonance with left-pad and the questions of "how exactly to we share
super simple code" evolves through so many different prisms. From legal to
organizational to not invented here to...

------
Tloewald
Is it just me or does this code seem to have an off-by-one error (i.e.
throwing on toIndex > arrayLen and not toIndex >= arrayLen, given that the
lower bound check implies zero-based arrays)?

------
knodi123
Interesting that these 9 lines were apparently re-typed by hand, or possibly
even from memory.... or so I suppose based on the missing close-paren on the
first line...

------
cm2187
There is a lot of vested interest in this case and I do not know the author of
this article. Are we sure the claim is down to the implementation of this
function?

------
mark242
A void function that does nothing but throw exceptions. Scala engineers
everywhere cringe at the thought of converting this kind of code to native
Scala.

~~~
_ZeD_
Who cares? We are talking about Java, were is perfectly fine to do "*check()"
methods that signals errors through exceptions.

------
chenster
Thanks for wasting course time on non-sense like this. Things like this
squatting our legal system and yields absolutely nothing.

------
rootlocus

      > Google owes Oracle between $1.4 billion and $6 billion in damages if liable
    

In what damages, exactly?

------
shubhamjain
Perhaps, someone should make a software that checks code to see if it is
infringing any copyright. :)

------
meganvito
I would leave my last comment, doing 'cheap things' is/are habitual.

------
eb0la
I bet you can get a similar code from BSD, EMACS, Ingres, or any venerable
open source codebase and use it as prior art against that patent claim.

Ok, maybe that venerable codebases doesn't have exception handling like Java
but you can prove to have the same logic maybe 10 or 20 years before that code
was written.

------
masters3d
One billion dollars per line.

------
Oletros
This case is not about RangeCheck, is about the 37 Java classed declaration

------
BurningFrog
Is this what the whole case rests on, or is it just one of many details?

------
udkl
Naively, that's $200 million to $800 million per line of code.

------
hathym
wow, each line costs nearly one billion dollars

------
smaili
tldr -

    
    
      private static void rangeCheck(int arrayLen, int fromIndex, int toIndex {
         if (fromIndex > toIndex)
              throw new IllegalArgumentException("fromIndex(" + fromIndex +
                   ") > toIndex(" + toIndex+")");
         if (fromIndex < 0) 
              throw new ArrayIndexOutOfBoundsException(fromIndex);
         if (toIndex > arrayLen) 
              throw new ArrayIndexOutOfBoundsException(toIndex);
      }

~~~
aexaey
You may want to start lines with (at least) 4 spaces for HN to preserve
original formatting.

~~~
Jtsummers
2 spaces are all that's needed.

OT: Really convenient use of emacs for formatting quotes. Copy the text into a
text-mode buffer, put two spaces at the start, M-q and the whole thing is
wrapped and each line prefixed with two spaces.

------
vladaionescu
Pretty sure that the only reason they copied that code was that they didn't
know how to do it themselves.

