// Protocol Buffers for Go with Gadgets
//
// Copyright (c) 2013, The GoGo Authors. All rights reserved.
// http://github.com/gogo/protobuf
//
// Go support for Protocol Buffers - Google's data interchange format
//
// Copyright 2014 The Go Authors.  All rights reserved.
// https://github.com/golang/protobuf
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
//     * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//     * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
//     * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

syntax = "proto2";

package proto2.maps;

import "github.com/gogo/protobuf/gogoproto/gogo.proto";

option (gogoproto.goproto_stringer_all) = false;
option (gogoproto.goproto_enum_prefix_all) = false;
option (gogoproto.goproto_getters_all) = false;

option (gogoproto.equal_all) = true;
option (gogoproto.verbose_equal_all) = true;
option (gogoproto.stringer_all) = true;
option (gogoproto.gostring_all) = true;
option (gogoproto.face_all) = true;
option (gogoproto.description_all) = true;

option (gogoproto.testgen_all) = true;
option (gogoproto.populate_all) = true;
option (gogoproto.benchgen_all) = true;
option (gogoproto.unmarshaler_all) = false;
option (gogoproto.marshaler_all) = false;
option (gogoproto.sizer_all) = true;

option (gogoproto.goproto_enum_stringer_all) = false;
option (gogoproto.enum_stringer_all) = true;

option (gogoproto.unsafe_marshaler_all) = true;
option (gogoproto.unsafe_unmarshaler_all) = true;

message FloatingPoint {
  optional double f = 1;
}

message CustomMap {
  map<string, bytes> Nullable128s = 1 [(gogoproto.customtype)="github.com/gogo/protobuf/test/custom.Uint128"];
  map<string, bytes> Uint128s = 2 [(gogoproto.customtype)="github.com/gogo/protobuf/test/custom.Uint128", (gogoproto.nullable)=false];
  map<string, bytes> NullableIds = 3 [(gogoproto.customtype)="github.com/gogo/protobuf/test.Uuid"];
  map<string, bytes> Ids = 4 [(gogoproto.customtype)="github.com/gogo/protobuf/test.Uuid", (gogoproto.nullable)=false];
}

enum MapEnum {
  MA = 0;
  MB = 1;
  MC = 2;
}

message AllMaps {
  map<string, double> StringToDoubleMap = 1;
  map<string, float> StringToFloatMap = 2;
  map<int32, int32> Int32Map = 3;
  map<int64, int64> Int64Map = 4;
  map<uint32, uint32> Uint32Map = 5;
  map<uint64, uint64> Uint64Map = 6;
  map<sint32, sint32> Sint32Map = 7;
  map<sint64, sint64> Sint64Map = 8;
  map<fixed32, fixed32> Fixed32Map = 9;
  map<sfixed32, sfixed32> Sfixed32Map = 10;
  map<fixed64, fixed64> Fixed64Map = 11;
  map<sfixed64, sfixed64> Sfixed64Map = 12;
  map<bool, bool> BoolMap = 13;
  map<string, string> StringMap = 14;
  map<string, bytes> StringToBytesMap = 15;
  map<string, MapEnum> StringToEnumMap = 16;
  map<string, FloatingPoint> StringToMsgMap = 17;
}

message AllMapsOrdered {
  option (gogoproto.stable_marshaler) = true;

  map<string, double> StringToDoubleMap = 1;
  map<string, float> StringToFloatMap = 2;
  map<int32, int32> Int32Map = 3;
  map<int64, int64> Int64Map = 4;
  map<uint32, uint32> Uint32Map = 5;
  map<uint64, uint64> Uint64Map = 6;
  map<sint32, sint32> Sint32Map = 7;
  map<sint64, sint64> Sint64Map = 8;
  map<fixed32, fixed32> Fixed32Map = 9;
  map<sfixed32, sfixed32> Sfixed32Map = 10;
  map<fixed64, fixed64> Fixed64Map = 11;
  map<sfixed64, sfixed64> Sfixed64Map = 12;
  map<bool, bool> BoolMap = 13;
  map<string, string> StringMap = 14;
  map<string, bytes> StringToBytesMap = 15;
  map<string, MapEnum> StringToEnumMap = 16;
  map<string, FloatingPoint> StringToMsgMap = 17;
}

{'repo_name': 'oracle/mysql-operator', 'stars': '728', 'repo_language': 'Go', 'file_name': 'mysql_operator.go', 'mime_type': 'text/plain', 'hash': 8676921491888710215, 'source_dataset': 'data'}


<!DOCTYPE html>

{'repo_name': 'Feodor2/Mypal', 'stars': '149', 'repo_language': 'None', 'file_name': 'moz.build', 'mime_type': 'text/plain', 'hash': -4496804897698032483, 'source_dataset': 'data'}


     2              NAVIGATION DATA                         RINEX VERSION / TYPE
CCRINEXN V1.6.0 UX  CDDIS               08-JAN-16 15:33     PGM / RUN BY / DATE
IGS BROADCAST EPHEMERIS FILE                                COMMENT
    0.1118D-07 -0.7451D-08 -0.5960D-07  0.1192D-06          ION ALPHA
    0.1167D+06 -0.2294D+06 -0.1311D+06  0.1049D+07          ION BETA
   -0.279396772385D-08-0.106581410364D-13   589824     1878 DELTA-UTC: A0,A1,T,W
    17                                                      LEAP SECONDS
                                                            END OF HEADER
 3 16  1  7  0  0  0.0-0.811228528619D-05-0.511590769747D-11 0.000000000000D+00
    0.177000000000D+03-0.132187500000D+02 0.487591738725D-08-0.224677018403D+00
   -0.689178705215D-06 0.326581299305D-03 0.568479299545D-05 0.515378328133D+04
    0.345600000000D+06 0.745058059692D-08 0.138699446106D+01 0.242143869400D-07
    0.958754492682D+00 0.265812500000D+03 0.287616437412D+01-0.814926802115D-08
   -0.117147736816D-09 0.100000000000D+01 0.187800000000D+04 0.000000000000D+00
    0.280000000000D+01 0.000000000000D+00 0.186264514923D-08 0.177000000000D+03
    0.338418000000D+06 0.400000000000D+01 0.000000000000D+00 0.000000000000D+00
12 16  1  7  0  0  0.0 0.359061174095D-03 0.284217094304D-11 0.000000000000D+00
    0.440000000000D+02-0.376250000000D+02 0.406838375023D-08 0.213996524292D+01
   -0.211223959923D-05 0.568402733188D-02 0.184774398804D-05 0.515355006981D+04
    0.345600000000D+06-0.912696123123D-07-0.170469618431D+01-0.223517417908D-07
    0.990018573470D+00 0.359406250000D+03 0.641435100152D+00-0.808533678673D-08
   -0.205722854897D-09 0.100000000000D+01 0.187800000000D+04 0.000000000000D+00
    0.200000000000D+01 0.000000000000D+00-0.125728547573D-07 0.440000000000D+02
    0.340050000000D+06 0.400000000000D+01 0.000000000000D+00 0.000000000000D+00
27 16  1  7  0  0  0.0 0.510988757014D-04 0.341060513165D-11 0.000000000000D+00
    0.230000000000D+02-0.942812500000D+02 0.404552565524D-08-0.914523378141D+00
   -0.495836138725D-05 0.295445194934D-02 0.957772135735D-05 0.515371680069D+04
    0.345600000000D+06 0.931322574615D-07-0.711208343037D+00-0.670552253723D-07
    0.969983000440D+00 0.201750000000D+03 0.228417919369D+00-0.779961059937D-08
   -0.139291516337D-09 0.100000000000D+01 0.187800000000D+04 0.000000000000D+00
    0.200000000000D+01 0.000000000000D+00 0.186264514923D-08 0.230000000000D+02
    0.338418000000D+06 0.400000000000D+01 0.000000000000D+00 0.000000000000D+00
 3 16  1  7  1 59 44.0-0.814907252788D-05-0.511590769747D-11 0.000000000000D+00
    0.400000000000D+01-0.132500000000D+02 0.483555856328D-08 0.822582126522D+00
   -0.657513737678D-06 0.327211222611D-03 0.558234751225D-05 0.515378452683D+04
    0.352784000000D+06-0.149011611938D-07 0.138693585510D+01 0.186264514923D-07
    0.958753550562D+00 0.270500000000D+03 0.287668745657D+01-0.817141180067D-08
   -0.115004790411D-09 0.100000000000D+01 0.187800000000D+04 0.000000000000D+00
    0.200000000000D+01 0.000000000000D+00 0.186264514923D-08 0.400000000000D+01
    0.345618000000D+06 0.400000000000D+01 0.000000000000D+00 0.000000000000D+00
12 16  1  7  2  0  0.0 0.359081197530D-03 0.284217094304D-11 0.000000000000D+00
    0.450000000000D+02-0.429687500000D+02 0.412302888356D-08-0.309297875205D+01
   -0.230409204960D-05 0.568455713801D-02 0.178255140781D-05 0.515354924774D+04
    0.352800000000D+06-0.633299350738D-07-0.170475441576D+01-0.819563865662D-07
    0.990017128107D+00 0.357906250000D+03 0.641447066822D+00-0.808890836407D-08
   -0.189650756858D-09 0.000000000000D+00 0.187800000000D+04 0.000000000000D+00
    0.200000000000D+01 0.000000000000D+00-0.125728547573D-07 0.450000000000D+02
    0.345600000000D+06 0.400000000000D+01 0.000000000000D+00 0.000000000000D+00
27 16  1  7  2  0  0.0 0.511235557496D-04 0.341060513165D-11 0.000000000000D+00
    0.260000000000D+02-0.101593750000D+03 0.408517016374D-08 0.135978822098D+00
   -0.538863241673D-05 0.295664754231D-02 0.853836536408D-05 0.515372139549D+04
    0.352800000000D+06 0.353902578354D-07-0.711264731214D+00 0.372529029846D-07
    0.969981473153D+00 0.217531250000D+03 0.228065366352D+00-0.789247161027D-08
   -0.167506977338D-09 0.100000000000D+01 0.187800000000D+04 0.000000000000D+00
    0.200000000000D+01 0.000000000000D+00 0.186264514923D-08 0.260000000000D+02
    0.349266000000D+06 0.400000000000D+01 0.000000000000D+00 0.000000000000D+00
 3 16  1  7  4  0  0.0-0.818585976958D-05-0.511590769747D-11 0.000000000000D+00
    0.500000000000D+01-0.154062500000D+02 0.486805991709D-08 0.187644223285D+01
   -0.698491930962D-06 0.327173853293D-03 0.550784170628D-05 0.515378366089D+04
    0.360000000000D+06-0.372529029846D-07 0.138687700776D+01-0.558793544769D-08
    0.958752691829D+00 0.273156250000D+03 0.287527661253D+01-0.816462580372D-08
   -0.136077096729D-09 0.100000000000D+01 0.187800000000D+04 0.000000000000D+00
    0.200000000000D+01 0.000000000000D+00 0.186264514923D-08 0.500000000000D+01
    0.352818000000D+06 0.400000000000D+01 0.000000000000D+00 0.000000000000D+00
12 16  1  7  4  0  0.0 0.359101220965D-03 0.284217094304D-11 0.000000000000D+00
    0.460000000000D+02-0.470000000000D+02 0.421731852539D-08-0.204272256051D+01
   -0.235065817833D-05 0.568495248444D-02 0.195577740669D-05 0.515354862976D+04
    0.360000000000D+06 0.763684511185D-07-0.170481350302D+01-0.260770320892D-07
    0.990016025067D+00 0.357468750000D+03 0.641446191997D+00-0.814355349741D-08
   -0.778603860548D-10 0.000000000000D+00 0.187800000000D+04 0.000000000000D+00
    0.200000000000D+01 0.000000000000D+00-0.125728547573D-07 0.460000000000D+02
    0.352800000000D+06 0.400000000000D+01 0.000000000000D+00 0.000000000000D+00
27 16  1  7  4  0  0.0 0.511482357979D-04 0.341060513165D-11 0.000000000000D+00
    0.270000000000D+02-0.112343750000D+03 0.419874632321D-08 0.118645849340D+01
   -0.567734241486D-05 0.295544881374D-02 0.843778252602D-05 0.515371847916D+04
    0.360000000000D+06 0.447034835815D-07-0.711321599228D+00 0.298023223877D-07
    0.969980273560D+00 0.220312500000D+03 0.227735605599D+00-0.789711466081D-08
   -0.163935399996D-09 0.100000000000D+01 0.187800000000D+04 0.000000000000D+00
    0.200000000000D+01 0.000000000000D+00 0.186264514923D-08 0.270000000000D+02
    0.352818000000D+06 0.400000000000D+01 0.000000000000D+00 0.000000000000D+00
 3 16  1  7  6  0  0.0-0.822218134999D-05-0.511590769747D-11 0.000000000000D+00
    0.370000000000D+02-0.115625000000D+02 0.494270588354D-08 0.292784554674D+01
   -0.661239027977D-06 0.327620073222D-03 0.545755028725D-05 0.515378249931D+04
    0.367200000000D+06 0.167638063431D-07 0.138681834913D+01-0.111758708954D-07
    0.958751477607D+00 0.275156250000D+03 0.287398999509D+01-0.819069831832D-08
   -0.174650132022D-09 0.100000000000D+01 0.187800000000D+04 0.000000000000D+00
    0.200000000000D+01 0.000000000000D+00 0.186264514923D-08 0.370000000000D+02
    0.360018000000D+06 0.400000000000D+01 0.000000000000D+00 0.000000000000D+00
12 16  1  7  6  0  0.0 0.359121710062D-03 0.284217094304D-11 0.000000000000D+00
    0.780000000000D+02-0.395625000000D+02 0.426267755763D-08-0.992640639078D+00
   -0.196509063244D-05 0.568475667387D-02 0.202842056751D-05 0.515354674721D+04
    0.367200000000D+06 0.800937414169D-07-0.170487207973D+01 0.353902578354D-07
    0.990015381383D+00 0.356687500000D+03 0.641619947166D+00-0.817176895841D-08
   -0.878608026122D-10 0.000000000000D+00 0.187800000000D+04 0.000000000000D+00
    0.200000000000D+01 0.000000000000D+00-0.125728547573D-07 0.780000000000D+02
    0.360000000000D+06 0.400000000000D+01 0.000000000000D+00 0.000000000000D+00
27 16  1  7  6  0  0.0 0.511729158461D-04 0.341060513165D-11 0.000000000000D+00
    0.530000000000D+02-0.122656250000D+03 0.413410077332D-08 0.223596227692D+01
   -0.624172389507D-05 0.295509747229D-02 0.899843871594D-05 0.515372212982D+04
    0.367200000000D+06-0.763684511185D-07-0.711378808103D+00 0.540167093277D-07
    0.969979505528D+00 0.210812500000D+03 0.228382110060D+00-0.784711257802D-08
   -0.775032283206D-10 0.000000000000D+00 0.187800000000D+04 0.000000000000D+00
    0.200000000000D+01 0.000000000000D+00 0.186264514923D-08 0.530000000000D+02
    0.365130000000D+06 0.400000000000D+01 0.000000000000D+00 0.000000000000D+00
 3 16  1  7  8  0  0.0-0.825896859169D-05-0.511590769747D-11 0.000000000000D+00
    0.440000000000D+02-0.110000000000D+02 0.498877923125D-08-0.230534409413D+01
   -0.640749931335D-06 0.327905756421D-03 0.538490712643D-05 0.515378196335D+04
    0.374400000000D+06 0.279396772385D-07 0.138675942133D+01 0.745058059692D-08
    0.958750258997D+00 0.273062500000D+03 0.287411218679D+01-0.817891211309D-08
   -0.178936024832D-09 0.100000000000D+01 0.187800000000D+04 0.000000000000D+00
    0.200000000000D+01 0.000000000000D+00 0.186264514923D-08 0.440000000000D+02
    0.370590000000D+06 0.400000000000D+01 0.000000000000D+00 0.000000000000D+00
12 16  1  7  8  0  0.0 0.359141733497D-03 0.284217094304D-11 0.000000000000D+00
    0.790000000000D+02-0.320937500000D+02 0.421160400164D-08 0.576652872935D-01
   -0.166334211826D-05 0.568602362182D-02 0.181980431080D-05 0.515354914475D+04
    0.374400000000D+06 0.223517417908D-07-0.170493113919D+01 0.502914190292D-07
    0.990014522650D+00 0.363468750000D+03 0.641570238673D+00-0.821855662159D-08
   -0.907180644858D-10 0.100000000000D+01 0.187800000000D+04 0.000000000000D+00
    0.200000000000D+01 0.000000000000D+00-0.125728547573D-07 0.790000000000D+02
    0.371748000000D+06 0.400000000000D+01 0.000000000000D+00 0.000000000000D+00
27 16  1  7  8  0  0.0 0.511975958943D-04 0.341060513165D-11 0.000000000000D+00
    0.540000000000D+02-0.119437500000D+03 0.416981654674D-08-0.299683488204D+01
   -0.610575079918D-05 0.295712880325D-02 0.978633761406D-05 0.515371810532D+04
    0.374400000000D+06-0.558793544769D-07-0.711435187503D+00-0.316649675369D-07
    0.969979243666D+00 0.195562500000D+03 0.228143774372D+00-0.780032491484D-08
   -0.557166065346D-10 0.000000000000D+00 0.187800000000D+04 0.000000000000D+00
    0.200000000000D+01 0.000000000000D+00 0.186264514923D-08 0.540000000000D+02
    0.367200000000D+06 0.400000000000D+01 0.000000000000D+00 0.000000000000D+00
12 16  1  7  9 59 44.0 0.359163153917D-03 0.284217094304D-11 0.000000000000D+00
    0.100000000000D+02-0.264062500000D+02 0.412910056504D-08 0.110562524020D+01
   -0.157393515110D-05 0.568641943391D-02 0.146403908730D-05 0.515354953384D+04
    0.381584000000D+06 0.745058059692D-08-0.170499012112D+01 0.633299350738D-07
    0.990013854097D+00 0.366218750000D+03 0.641530306861D+00-0.821212778237D-08
   -0.932181686252D-10 0.100000000000D+01 0.187800000000D+04 0.000000000000D+00
    0.200000000000D+01 0.000000000000D+00-0.125728547573D-07 0.100000000000D+02
    0.380706000000D+06 0.400000000000D+01 0.000000000000D+00 0.000000000000D+00
 3 16  1  7 10  0  0.0-0.829575583339D-05-0.511590769747D-11 0.000000000000D+00
    0.450000000000D+02-0.940625000000D+01 0.497377860642D-08-0.125441366412D+01
   -0.549480319023D-06 0.327847315930D-03 0.542588531971D-05 0.515378247833D+04
    0.381600000000D+06 0.931322574616D-08 0.138670065445D+01 0.186264514923D-07
    0.958748948222D+00 0.271968750000D+03 0.287329961626D+01-0.816819738106D-08
   -0.189293599124D-09 0.100000000000D+01 0.187800000000D+04 0.000000000000D+00
    0.200000000000D+01 0.000000000000D+00 0.186264514923D-08 0.450000000000D+02
    0.374400000000D+06 0.400000000000D+01 0.000000000000D+00 0.000000000000D+00
12 16  1  7 10  0  0.0 0.359161756933D-03 0.284217094304D-11 0.000000000000D+00
    0.830000000000D+02-0.264062500000D+02 0.412910056504D-08 0.110795934209D+01
   -0.157393515110D-05 0.568642595317D-02 0.146403908730D-05 0.515354954719D+04
    0.381600000000D+06 0.745058059692D-08-0.170499025717D+01 0.633299350738D-07
    0.990013849708D+00 0.366218750000D+03 0.641530034758D+00-0.821212778237D-08
   -0.932181686252D-10 0.100000000000D+01 0.187800000000D+04 0.000000000000D+00
    0.200000000000D+01 0.000000000000D+00-0.125728547573D-07 0.830000000000D+02
    0.374418000000D+06 0.400000000000D+01 0.000000000000D+00 0.000000000000D+00
27 16  1  7 10  0  0.0 0.512222759426D-04 0.341060513165D-11 0.000000000000D+00
    0.600000000000D+02-0.112437500000D+03 0.411195699380D-08-0.194651915266D+01
   -0.595115125179D-05 0.295634754002D-02 0.975839793682D-05 0.515371980476D+04
    0.381600000000D+06-0.111758708954D-07-0.711491691251D+00-0.484287738800D-07
    0.969978845752D+00 0.195531250000D+03 0.227978550942D+00-0.783246911092D-08
   -0.207151485834D-10 0.000000000000D+00 0.187800000000D+04 0.000000000000D+00
    0.200000000000D+01 0.000000000000D+00 0.186264514923D-08 0.600000000000D+02
    0.374400000000D+06 0.400000000000D+01 0.000000000000D+00 0.000000000000D+00
12 16  1  7 11 59 44.0 0.359183643013D-03 0.284217094304D-11 0.000000000000D+00
    0.110000000000D+02-0.229062500000D+02 0.406874090796D-08 0.215598976522D+01
   -0.124052166939D-05 0.568612536881D-02 0.115856528282D-05 0.515354839134D+04
    0.388784000000D+06-0.726431608200D-07-0.170504944099D+01-0.111758708954D-07
    0.990013660991D+00 0.371875000000D+03 0.641420598245D+00-0.813926760460D-08
   -0.285726187357D-10 0.100000000000D+01 0.187800000000D+04 0.000000000000D+00
    0.200000000000D+01 0.000000000000D+00-0.125728547573D-07 0.110000000000D+02
    0.381618000000D+06 0.400000000000D+01 0.000000000000D+00 0.000000000000D+00
 3 16  1  7 12  0  0.0-0.833207741380D-05-0.511590769747D-11 0.000000000000D+00
    0.460000000000D+02-0.881250000000D+01 0.496913555587D-08-0.204467536596D+00
   -0.523403286934D-06 0.327784102410D-03 0.540353357792D-05 0.515378232002D+04
    0.388800000000D+06-0.167638063431D-07 0.138664179101D+01 0.186264514923D-07
    0.958747685724D+00 0.272218750000D+03 0.287347125458D+01-0.815641117584D-08
   -0.172507185617D-09 0.100000000000D+01 0.187800000000D+04 0.000000000000D+00
    0.200000000000D+01 0.000000000000D+00 0.186264514923D-08 0.460000000000D+02
    0.381600000000D+06 0.400000000000D+01 0.000000000000D+00 0.000000000000D+00
27 16  1  7 12  0  0.0 0.512469559908D-04 0.341060513165D-11 0.000000000000D+00
    0.760000000000D+02-0.106218750000D+03 0.418267422517D-08-0.897014958056D+00
   -0.560469925404D-05 0.295634439681D-02 0.910088419914D-05 0.515371623993D+04
    0.388800000000D+06 0.726431608200D-07-0.711547887786D+00-0.447034835815D-07
    0.969978475634D+00 0.208343750000D+03 0.228625675680D+00-0.786818488434D-08
   -0.703600736366D-10 0.000000000000D+00 0.187800000000D+04 0.000000000000D+00
    0.200000000000D+01 0.000000000000D+00 0.186264514923D-08 0.760000000000D+02
    0.381600000000D+06 0.400000000000D+01 0.000000000000D+00 0.000000000000D+00
 3 16  1  7 14  0  0.0-0.836886465549D-05-0.511590769747D-11 0.000000000000D+00
    0.470000000000D+02-0.784375000000D+01 0.499842249007D-08 0.845030020744D+00
   -0.463798642158D-06 0.328271416947D-03 0.519305467606D-05 0.515378331566D+04
    0.396000000000D+06-0.763684511185D-07 0.138658279592D+01-0.298023223877D-07
    0.958746171603D+00 0.275875000000D+03 0.287409130510D+01-0.822427114533D-08
   -0.160720980388D-09 0.000000000000D+00 0.187800000000D+04 0.000000000000D+00
    0.200000000000D+01 0.000000000000D+00 0.186264514923D-08 0.470000000000D+02
    0.392160000000D+06 0.400000000000D+01 0.000000000000D+00 0.000000000000D+00
12 16  1  7 14  0  0.0 0.359203666449D-03 0.284217094304D-11 0.000000000000D+00
    0.120000000000D+02-0.280625000000D+02 0.404588281297D-08-0.307464801401D+01
   -0.145100057125D-05 0.568642863073D-02 0.116229057312D-05 0.515354806519D+04
    0.396000000000D+06-0.204890966415D-07-0.170510796795D+01-0.167638063431D-07
    0.990013653677D+00 0.372625000000D+03 0.641460739255D+00-0.809712299196D-08
   -0.275011455331D-10 0.100000000000D+01 0.187800000000D+04 0.000000000000D+00
    0.200000000000D+01 0.000000000000D+00-0.125728547573D-07 0.120000000000D+02
    0.388818000000D+06 0.400000000000D+01 0.000000000000D+00 0.000000000000D+00
27 16  1  7 14  0  0.0 0.512716360390D-04 0.341060513165D-11 0.000000000000D+00
    0.780000000000D+02-0.113000000000D+03 0.410445668138D-08 0.153506658031D+00
   -0.590831041336D-05 0.295895012096D-02 0.819936394691D-05 0.515372159576D+04
    0.396000000000D+06 0.465661287308D-07-0.711604654859D+00 0.260770320892D-07
    0.969977700287D+00 0.227312500000D+03 0.228254482161D+00-0.791318675885D-08
   -0.882179603464D-10 0.000000000000D+00 0.187800000000D+04 0.000000000000D+00
    0.200000000000D+01 0.000000000000D+00 0.186264514923D-08 0.780000000000D+02
    0.388800000000D+06 0.400000000000D+01 0.000000000000D+00 0.000000000000D+00
27 16  1  7 15 59 28.0 0.512972474098D-04 0.341060513165D-11 0.000000000000D+00
    0.106000000000D+03-0.122156250000D+03 0.412624330317D-08 0.119930892380D+01
   -0.640377402306D-05 0.295796152204D-02 0.797398388386D-05 0.515371900940D+04
    0.403168000000D+06 0.130385160446D-07-0.711661164458D+00 0.242143869400D-07
    0.969977058066D+00 0.231437500000D+03 0.227934164544D+00-0.789354308347D-08
   -0.113933317209D-09 0.100000000000D+01 0.187800000000D+04 0.000000000000D+00
    0.200000000000D+01 0.630000000000D+02 0.186264514923D-08 0.106000000000D+03
    0.403140000000D+06 0.400000000000D+01 0.000000000000D+00 0.000000000000D+00
27 16  1  7 15 59 44.0 0.512972474098D-04 0.341060513165D-11 0.000000000000D+00
    0.120000000000D+02-0.122156250000D+03 0.412624330317D-08 0.120164299497D+01
   -0.640377402306D-05 0.295796140563D-02 0.797398388386D-05 0.515371901512D+04
    0.403184000000D+06 0.130385160446D-07-0.711661288806D+00 0.242143869400D-07
    0.969977062455D+00 0.231437500000D+03 0.227933744687D+00-0.789354308347D-08
   -0.113933317209D-09 0.100000000000D+01 0.187800000000D+04 0.000000000000D+00
    0.200000000000D+01 0.000000000000D+00 0.186264514923D-08 0.120000000000D+02
    0.399846000000D+06 0.400000000000D+01 0.000000000000D+00 0.000000000000D+00
 3 16  1  7 16  0  0.0-0.840565189719D-05-0.511590769747D-11 0.000000000000D+00
    0.480000000000D+02-0.946875000000D+01 0.510878422994D-08 0.189675327774D+01
   -0.385567545891D-06 0.328313675709D-03 0.515952706337D-05 0.515378235436D+04
    0.403200000000D+06 0.689178705216D-07 0.138652267876D+01-0.745058059692D-08
    0.958745203152D+00 0.279781250000D+03 0.287248624843D+01-0.829213111483D-08
   -0.521450291926D-10 0.000000000000D+00 0.187800000000D+04 0.000000000000D+00
    0.200000000000D+01 0.000000000000D+00 0.186264514923D-08 0.480000000000D+02
    0.396000000000D+06 0.400000000000D+01 0.000000000000D+00 0.000000000000D+00
12 16  1  7 16  0  0.0 0.359223689884D-03 0.284217094304D-11 0.000000000000D+00
    0.130000000000D+02-0.326562500000D+02 0.406195491101D-08-0.202436172439D+01
   -0.162422657013D-05 0.568675529212D-02 0.127777457237D-05 0.515354774094D+04
    0.403200000000D+06-0.223517417908D-07-0.170516617746D+01-0.540167093277D-07
    0.990013428387D+00 0.370406250000D+03 0.641429318700D+00-0.809712299196D-08
   -0.485734518507D-10 0.000000000000D+00 0.187800000000D+04 0.000000000000D+00
    0.200000000000D+01 0.000000000000D+00-0.125728547573D-07 0.130000000000D+02
    0.396030000000D+06 0.400000000000D+01 0.000000000000D+00 0.000000000000D+00
27 16  1  7 16  0  0.0 0.512963160873D-04 0.341060513165D-11 0.000000000000D+00
    0.900000000000D+02-0.122156250000D+03 0.412624334700D-08 0.120397806238D+01
   -0.640377402306D-05 0.295795907732D-02 0.797398388386D-05 0.515371901131D+04
    0.403200000000D+06 0.130385160446D-07-0.711661411691D+00 0.242143869400D-07
    0.969977058066D+00 0.231437500000D+03 0.227932360766D+00-0.789390064426D-08
   -0.114290472919D-09 0.100000000000D+01 0.187800000000D+04 0.000000000000D+00
    0.200000000000D+01 0.000000000000D+00 0.186264514923D-08 0.900000000000D+02
    0.396000000000D+06 0.000000000000D+00 0.000000000000D+00 0.000000000000D+00
27 16  1  7 17 59 28.0 0.513219274581D-04 0.341060513165D-11 0.000000000000D+00
    0.107000000000D+03-0.133281250000D+03 0.402195324478D-08 0.224885025019D+01
   -0.684149563313D-05 0.295750191435D-02 0.826641917229D-05 0.515372248459D+04
    0.410368000000D+06-0.242143869400D-07-0.711718073434D+00 0.167638063431D-07
    0.969976317830D+00 0.223718750000D+03 0.228542094781D+00-0.787747098543D-08
   -0.946467995620D-10 0.100000000000D+01 0.187800000000D+04 0.000000000000D+00
    0.200000000000D+01 0.630000000000D+02 0.186264514923D-08 0.107000000000D+03
    0.403218000000D+06 0.400000000000D+01 0.000000000000D+00 0.000000000000D+00
 3 16  1  7 18  0  0.0-0.844197347760D-05-0.511590769747D-11 0.000000000000D+00
    0.490000000000D+02-0.503125000000D+01 0.513592821774D-08 0.294857405578D+01
   -0.247731804848D-06 0.328828115016D-03 0.509060919285D-05 0.515378092384D+04
    0.410400000000D+06-0.186264514923D-07 0.138646276934D+01-0.186264514923D-08
    0.958745222170D+00 0.283031250000D+03 0.287078509707D+01-0.824855787126D-08
    0.110718897601D-10 0.000000000000D+00 0.187800000000D+04 0.000000000000D+00
    0.280000000000D+01 0.000000000000D+00 0.186264514923D-08 0.490000000000D+02
    0.403200000000D+06 0.400000000000D+01 0.000000000000D+00 0.000000000000D+00
12 16  1  7 18  0  0.0 0.359244178981D-03 0.284217094304D-11 0.000000000000D+00
    0.140000000000D+02-0.280625000000D+02 0.414767276722D-08-0.974200691278D+00
   -0.145845115185D-05 0.568644516170D-02 0.141747295856D-05 0.515354669762D+04
    0.410400000000D+06 0.987201929092D-07-0.170522421142D+01 0.353902578354D-07
    0.990012418974D+00 0.367062500000D+03 0.641522799165D+00-0.819605568433D-08
   -0.140005831805D-09 0.100000000000D+01 0.187800000000D+04 0.000000000000D+00
    0.200000000000D+01 0.000000000000D+00-0.125728547573D-07 0.140000000000D+02
    0.410010000000D+06 0.400000000000D+01 0.000000000000D+00 0.000000000000D+00
 3 16  1  7 19 59 44.0-0.847782939673D-05-0.511590769747D-11 0.000000000000D+00
    0.220000000000D+02-0.540625000000D+01 0.510985570314D-08-0.228723653009D+01
   -0.286847352982D-06 0.329199945554D-03 0.527873635292D-05 0.515378017998D+04
    0.417584000000D+06 0.260770320892D-07 0.138640370256D+01-0.186264514923D-08
    0.958745516216D+00 0.280250000000D+03 0.287119667444D+01-0.820284168128D-08
    0.107147320259D-10 0.100000000000D+01 0.187800000000D+04 0.000000000000D+00
    0.200000000000D+01 0.000000000000D+00 0.186264514923D-08 0.220000000000D+02
    0.415992000000D+06 0.400000000000D+01 0.000000000000D+00 0.000000000000D+00
 3 16  1  7 20  0  0.0-0.847876071930D-05-0.511590769747D-11 0.000000000000D+00
    0.500000000000D+02-0.540625000000D+01 0.510985564972D-08-0.228488858607D+01
   -0.286847352982D-06 0.329201924615D-03 0.527873635292D-05 0.515378017616D+04
    0.417600000000D+06 0.260770320892D-07 0.138640356358D+01-0.186264514923D-08
    0.958745510364D+00 0.280250000000D+03 0.287118236710D+01-0.820284196124D-08
    0.107147320530D-10 0.100000000000D+01 0.187800000000D+04 0.000000000000D+00
    0.280000000000D+01 0.000000000000D+00 0.186264514923D-08 0.500000000000D+02
    0.410400000000D+06 0.000000000000D+00 0.000000000000D+00 0.000000000000D+00
12 16  1  7 20  0  0.0 0.359264202416D-03 0.284217094304D-11 0.000000000000D+00
    0.300000000000D+02-0.194687500000D+02 0.414731560949D-08 0.760832167142D-01
   -0.104308128357D-05 0.568768393714D-02 0.108219683170D-05 0.515354895592D+04
    0.417600000000D+06 0.298023223877D-07-0.170528345229D+01 0.651925802231D-07
    0.990011168179D+00 0.372656250000D+03 0.641494645307D+00-0.824320050525D-08
   -0.147506144223D-09 0.100000000000D+01 0.187800000000D+04 0.000000000000D+00
    0.200000000000D+01 0.000000000000D+00-0.125728547573D-07 0.300000000000D+02
    0.410400000000D+06 0.400000000000D+01 0.000000000000D+00 0.000000000000D+00
27 16  1  7 20  0  0.0 0.513466075063D-04 0.341060513165D-11 0.000000000000D+00
    0.108000000000D+03-0.132656250000D+03 0.402838208400D-08-0.297935336648D+01
   -0.674836337566D-05 0.295940262731D-02 0.911019742489D-05 0.515371882629D+04
    0.417600000000D+06 0.745058059692D-08-0.711774945838D+00-0.149011611938D-07
    0.969975829215D+00 0.209281250000D+03 0.228376093078D+00-0.784104089654D-08
   -0.864321716755D-10 0.100000000000D+01 0.187800000000D+04 0.000000000000D+00
    0.200000000000D+01 0.630000000000D+02 0.186264514923D-08 0.108000000000D+03
    0.410418000000D+06 0.400000000000D+01 0.000000000000D+00 0.000000000000D+00
 3 16  1  7 21 59 44.0-0.851461663842D-05-0.511590769747D-11 0.000000000000D+00
    0.230000000000D+02-0.443750000000D+01 0.502449500467D-08-0.123643960745D+01
   -0.461935997009D-06 0.329194124788D-03 0.513345003128D-05 0.515378059196D+04
    0.424784000000D+06 0.242143869400D-07 0.138634466504D+01 0.111758708954D-07
    0.958745590825D+00 0.278843750000D+03 0.287051946041D+01-0.819962726167D-08
    0.121433629627D-10 0.100000000000D+01 0.187800000000D+04 0.000000000000D+00
    0.200000000000D+01 0.000000000000D+00 0.186264514923D-08 0.230000000000D+02
    0.417618000000D+06 0.400000000000D+01 0.000000000000D+00 0.000000000000D+00
12 16  1  7 22  0  0.0 0.359284225851D-03 0.284217094304D-11 0.000000000000D+00
    0.360000000000D+02-0.117500000000D+02 0.412160025262D-08 0.112634313285D+01
   -0.670552253723D-06 0.568841176573D-02 0.107102096081D-05 0.515355006027D+04
    0.424800000000D+06-0.186264514923D-07-0.170534256442D+01 0.689178705216D-07
    0.990010021251D+00 0.373406250000D+03 0.641488095823D+00-0.822427114533D-08
   -0.173221501085D-09 0.100000000000D+01 0.187800000000D+04 0.000000000000D+00
    0.200000000000D+01 0.000000000000D+00-0.125728547573D-07 0.360000000000D+02
    0.417600000000D+06 0.400000000000D+01 0.000000000000D+00 0.000000000000D+00
27 16  1  7 22  0  0.0 0.513712875545D-04 0.341060513165D-11 0.000000000000D+00
    0.186000000000D+03-0.126093750000D+03 0.395623622169D-08-0.192899641499D+01
   -0.649876892567D-05 0.295870250557D-02 0.920146703720D-05 0.515372055817D+04
    0.424800000000D+06-0.689178705216D-07-0.711830955119D+00 0.558793544769D-08
    0.969975176754D+00 0.207062500000D+03 0.228168016388D+00-0.779853912617D-08
   -0.135362781260D-09 0.100000000000D+01 0.187800000000D+04 0.000000000000D+00
    0.200000000000D+01 0.630000000000D+02 0.186264514923D-08 0.186000000000D+03
    0.417672000000D+06 0.400000000000D+01 0.000000000000D+00 0.000000000000D+00
27 16  1  7 23 57 52.0 0.513945706189D-04 0.341060513165D-11 0.000000000000D+00
    0.290000000000D+02-0.117156250000D+03 0.408767026787D-08-0.890460791015D+00
   -0.615790486336D-05 0.298193783965D-02 0.868178904057D-05 0.515363319778D+04
    0.431872000000D+06 0.931322574615D-07-0.711885570240D+00-0.465661287308D-07
    0.969973535360D+00 0.218687500000D+03 0.221259207283D+00-0.786818488434D-08
   -0.262153776900D-09 0.100000000000D+01 0.187800000000D+04 0.000000000000D+00
    0.200000000000D+01 0.000000000000D+00 0.186264514923D-08 0.290000000000D+02
    0.430188000000D+06 0.400000000000D+01 0.000000000000D+00 0.000000000000D+00

{'repo_name': 'SGL-UT/GPSTk', 'stars': '219', 'repo_language': 'C++', 'file_name': 'RINEX3_OBS_1.txt', 'mime_type': 'text/plain', 'hash': -2673567826182439784, 'source_dataset': 'data'}


/*
 *  Licensed to the Apache Software Foundation (ASF) under one or more
 *  contributor license agreements.  See the NOTICE file distributed with
 *  this work for additional information regarding copyright ownership.
 *  The ASF licenses this file to You under the Apache License, Version 2.0
 *  (the "License"); you may not use this file except in compliance with
 *  the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */

package java.net;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FilePermission;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.nio.charset.StandardCharsets;
import java.security.CodeSource;
import java.security.PermissionCollection;
import java.security.SecureClassLoader;
import java.security.cert.Certificate;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.StringTokenizer;
import java.util.jar.Attributes;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
import java.util.jar.Manifest;
import libcore.io.IoUtils;
import libcore.io.Streams;

/**
 * This class loader is responsible for loading classes and resources from a
 * list of URLs which can refer to either directories or JAR files. Classes
 * loaded by this {@code URLClassLoader} are granted permission to access the
 * URLs contained in the URL search list.
 */
@FindBugsSuppressWarnings({ "DMI_COLLECTION_OF_URLS", "DP_CREATE_CLASSLOADER_INSIDE_DO_PRIVILEGED" })
public class URLClassLoader extends SecureClassLoader {

    ArrayList<URL> originalUrls;

    List<URL> searchList;
    ArrayList<URLHandler> handlerList;
    Map<URL, URLHandler> handlerMap = new HashMap<URL, URLHandler>();

    private URLStreamHandlerFactory factory;

    static class IndexFile {

        private HashMap<String, ArrayList<URL>> map;
        //private URLClassLoader host;

        static IndexFile readIndexFile(JarFile jf, JarEntry indexEntry, URL url) {
            BufferedReader in = null;
            InputStream is = null;
            try {
                // Add mappings from resource to jar file
                String parentURLString = getParentURL(url).toExternalForm();
                String prefix = "jar:" + parentURLString + "/";
                is = jf.getInputStream(indexEntry);
                in = new BufferedReader(new InputStreamReader(is, StandardCharsets.UTF_8));
                HashMap<String, ArrayList<URL>> pre_map = new HashMap<String, ArrayList<URL>>();
                // Ignore the 2 first lines (index version)
                if (in.readLine() == null) return null;
                if (in.readLine() == null) return null;
                TOP_CYCLE:
                while (true) {
                    String line = in.readLine();
                    if (line == null) {
                        break;
                    }
                    URL jar = new URL(prefix + line + "!/");
                    while (true) {
                        line = in.readLine();
                        if (line == null) {
                            break TOP_CYCLE;
                        }
                        if (line.isEmpty()) {
                            break;
                        }
                        ArrayList<URL> list;
                        if (pre_map.containsKey(line)) {
                            list = pre_map.get(line);
                        } else {
                            list = new ArrayList<URL>();
                            pre_map.put(line, list);
                        }
                        list.add(jar);
                    }
                }
                if (!pre_map.isEmpty()) {
                    return new IndexFile(pre_map);
                }
            } catch (MalformedURLException e) {
                // Ignore this jar's index
            } catch (IOException e) {
                // Ignore this jar's index
            } finally {
                IoUtils.closeQuietly(in);
                IoUtils.closeQuietly(is);
            }
            return null;
        }

        private static URL getParentURL(URL url) throws IOException {
            URL fileURL = ((JarURLConnection) url.openConnection()).getJarFileURL();
            String file = fileURL.getFile();
            String parentFile = new File(file).getParent();
            parentFile = parentFile.replace(File.separatorChar, '/');
            if (parentFile.charAt(0) != '/') {
                parentFile = "/" + parentFile;
            }
            URL parentURL = new URL(fileURL.getProtocol(), fileURL
                    .getHost(), fileURL.getPort(), parentFile);
            return parentURL;
        }

        public IndexFile(HashMap<String, ArrayList<URL>> map) {
            this.map = map;
        }

        ArrayList<URL> get(String name) {
            return map.get(name);
        }
    }

    class URLHandler {
        URL url;
        URL codeSourceUrl;

        public URLHandler(URL url) {
            this.url = url;
            this.codeSourceUrl = url;
        }

        void findResources(String name, ArrayList<URL> resources) {
            URL res = findResource(name);
            if (res != null && !resources.contains(res)) {
                resources.add(res);
            }
        }

        Class<?> findClass(String packageName, String name, String origName) {
            URL resURL = targetURL(url, name);
            if (resURL != null) {
                try {
                    InputStream is = resURL.openStream();
                    return createClass(is, packageName, origName);
                } catch (IOException e) {
                }
            }
            return null;
        }

        Class<?> createClass(InputStream is, String packageName, String origName) {
            if (is == null) {
                return null;
            }
            byte[] clBuf;
            try {
                clBuf = Streams.readFully(is);
            } catch (IOException e) {
                return null;
            }
            if (packageName != null) {
                String packageDotName = packageName.replace('/', '.');
                Package packageObj = getPackage(packageDotName);
                if (packageObj == null) {
                    definePackage(packageDotName, null, null,
                            null, null, null, null, null);
                } else {
                    if (packageObj.isSealed()) {
                        throw new SecurityException("Package is sealed");
                    }
                }
            }
            return defineClass(origName, clBuf, 0, clBuf.length, new CodeSource(codeSourceUrl, (Certificate[]) null));
        }

        URL findResource(String name) {
            URL resURL = targetURL(url, name);
            if (resURL != null) {
                try {
                    URLConnection uc = resURL.openConnection();
                    uc.getInputStream().close();
                    // HTTP can return a stream on a non-existent file
                    // So check for the return code;
                    if (!resURL.getProtocol().equals("http")) {
                        return resURL;
                    }
                    int code;
                    if ((code = ((HttpURLConnection) uc).getResponseCode()) >= 200
                            && code < 300) {
                        return resURL;
                    }
                } catch (SecurityException e) {
                    return null;
                } catch (IOException e) {
                    return null;
                }
            }
            return null;
        }

        URL targetURL(URL base, String name) {
            try {
                StringBuilder fileBuilder = new StringBuilder();
                fileBuilder.append(base.getFile());
                URI.PATH_ENCODER.appendEncoded(fileBuilder, name);
                String file = fileBuilder.toString();

                return new URL(base.getProtocol(), base.getHost(), base.getPort(), file, null);
            } catch (MalformedURLException e) {
                return null;
            }
        }

    }

    class URLJarHandler extends URLHandler {
        final JarFile jf;
        final String prefixName;
        final IndexFile index;
        final Map<URL, URLHandler> subHandlers = new HashMap<URL, URLHandler>();

        public URLJarHandler(URL url, URL jarURL, JarFile jf, String prefixName) {
            super(url);
            this.jf = jf;
            this.prefixName = prefixName;
            this.codeSourceUrl = jarURL;
            final JarEntry je = jf.getJarEntry("META-INF/INDEX.LIST");
            this.index = (je == null ? null : IndexFile.readIndexFile(jf, je, url));
        }

        public URLJarHandler(URL url, URL jarURL, JarFile jf, String prefixName, IndexFile index) {
            super(url);
            this.jf = jf;
            this.prefixName = prefixName;
            this.index = index;
            this.codeSourceUrl = jarURL;
        }

        IndexFile getIndex() {
            return index;
        }

        @Override
        void findResources(String name, ArrayList<URL> resources) {
            URL res = findResourceInOwn(name);
            if (res != null && !resources.contains(res)) {
                resources.add(res);
            }
            if (index != null) {
                int pos = name.lastIndexOf("/");
                // only keep the directory part of the resource
                // as index.list only keeps track of directories and root files
                String indexedName = (pos > 0) ? name.substring(0, pos) : name;
                ArrayList<URL> urls = index.get(indexedName);
                if (urls != null) {
                    urls.remove(url);
                    for (URL url : urls) {
                        URLHandler h = getSubHandler(url);
                        if (h != null) {
                            h.findResources(name, resources);
                        }
                    }
                }
            }

        }

        @Override
        Class<?> findClass(String packageName, String name, String origName) {
            String entryName = prefixName + name;
            JarEntry entry = jf.getJarEntry(entryName);
            if (entry != null) {
                /**
                 * Avoid recursive load class, especially the class
                 * is an implementation class of security provider
                 * and the jar is signed.
                 */
                try {
                    Manifest manifest = jf.getManifest();
                    return createClass(entry, manifest, packageName, origName);
                } catch (IOException e) {
                }
            }
            if (index != null) {
                ArrayList<URL> urls;
                if (packageName == null) {
                    urls = index.get(name);
                } else {
                    urls = index.get(packageName);
                }
                if (urls != null) {
                    urls.remove(url);
                    for (URL url : urls) {
                        URLHandler h = getSubHandler(url);
                        if (h != null) {
                            Class<?> res = h.findClass(packageName, name, origName);
                            if (res != null) {
                                return res;
                            }
                        }
                    }
                }
            }
            return null;
        }

        private Class<?> createClass(JarEntry entry, Manifest manifest, String packageName, String origName) {
            byte[] clBuf;
            try {
                InputStream is = jf.getInputStream(entry);
                clBuf = Streams.readFully(is);
            } catch (IOException e) {
                return null;
            }
            if (packageName != null) {
                String packageDotName = packageName.replace('/', '.');
                Package packageObj = getPackage(packageDotName);
                if (packageObj == null) {
                    if (manifest != null) {
                        definePackage(packageDotName, manifest,
                                codeSourceUrl);
                    } else {
                        definePackage(packageDotName, null, null,
                                null, null, null, null, null);
                    }
                } else {
                    boolean exception = packageObj.isSealed();
                    if (manifest != null) {
                        if (isSealed(manifest, packageName + "/")) {
                            exception = !packageObj
                                    .isSealed(codeSourceUrl);
                        }
                    }
                    if (exception) {
                        throw new SecurityException(String.format("Package %s is sealed",
                                packageName));
                    }
                }
            }
            CodeSource codeS = new CodeSource(codeSourceUrl, entry.getCertificates());
            return defineClass(origName, clBuf, 0, clBuf.length, codeS);
        }

        URL findResourceInOwn(String name) {
            String entryName = prefixName + name;
            if (jf.getEntry(entryName) != null) {
                return targetURL(url, name);
            }
            return null;
        }

        @Override
        URL findResource(String name) {
            URL res = findResourceInOwn(name);
            if (res != null) {
                return res;
            }
            if (index != null) {
                int pos = name.lastIndexOf("/");
                // only keep the directory part of the resource
                // as index.list only keeps track of directories and root files
                String indexedName = (pos > 0) ? name.substring(0, pos) : name;
                ArrayList<URL> urls = index.get(indexedName);
                if (urls != null) {
                    urls.remove(url);
                    for (URL url : urls) {
                        URLHandler h = getSubHandler(url);
                        if (h != null) {
                            res = h.findResource(name);
                            if (res != null) {
                                return res;
                            }
                        }
                    }
                }
            }
            return null;
        }

        private synchronized URLHandler getSubHandler(URL url) {
            URLHandler sub = subHandlers.get(url);
            if (sub != null) {
                return sub;
            }
            String protocol = url.getProtocol();
            if (protocol.equals("jar")) {
                sub = createURLJarHandler(url);
            } else if (protocol.equals("file")) {
                sub = createURLSubJarHandler(url);
            } else {
                sub = createURLHandler(url);
            }
            if (sub != null) {
                subHandlers.put(url, sub);
            }
            return sub;
        }

        private URLHandler createURLSubJarHandler(URL url) {
            String prefixName;
            String file = url.getFile();
            if (url.getFile().endsWith("!/")) {
                prefixName = "";
            } else {
                int sepIdx = file.lastIndexOf("!/");
                if (sepIdx == -1) {
                    // Invalid URL, don't look here again
                    return null;
                }
                sepIdx += 2;
                prefixName = file.substring(sepIdx);
            }
            try {
                URL jarURL = ((JarURLConnection) url
                        .openConnection()).getJarFileURL();
                JarURLConnection juc = (JarURLConnection) new URL(
                        "jar", "",
                        jarURL.toExternalForm() + "!/").openConnection();
                JarFile jf = juc.getJarFile();
                URLJarHandler jarH = new URLJarHandler(url, jarURL, jf, prefixName, null);
                // TODO : to think what we should do with indexes & manifest.class file here
                return jarH;
            } catch (IOException e) {
            }
            return null;
        }

    }

    class URLFileHandler extends URLHandler {
        private String prefix;

        public URLFileHandler(URL url) {
            super(url);
            String baseFile = url.getFile();
            String host = url.getHost();
            int hostLength = 0;
            if (host != null) {
                hostLength = host.length();
            }
            StringBuilder buf = new StringBuilder(2 + hostLength
                    + baseFile.length());
            if (hostLength > 0) {
                buf.append("//").append(host);
            }
            // baseFile always ends with '/'
            buf.append(baseFile);
            prefix = buf.toString();
        }

        @Override
        Class<?> findClass(String packageName, String name, String origName) {
            String filename = prefix + name;
            try {
                filename = URLDecoder.decode(filename, "UTF-8");
            } catch (IllegalArgumentException e) {
                return null;
            } catch (UnsupportedEncodingException e) {
                return null;
            }

            File file = new File(filename);
            if (file.exists()) {
                try {
                    InputStream is = new FileInputStream(file);
                    return createClass(is, packageName, origName);
                } catch (FileNotFoundException e) {
                }
            }
            return null;
        }

        @Override
        URL findResource(String name) {
            int idx = 0;
            String filename;

            // Do not create a UNC path, i.e. \\host
            while (idx < name.length() &&
                   ((name.charAt(idx) == '/') || (name.charAt(idx) == '\\'))) {
                idx++;
            }

            if (idx > 0) {
                name = name.substring(idx);
            }

            try {
                filename = URLDecoder.decode(prefix, "UTF-8") + name;

                if (new File(filename).exists()) {
                    return targetURL(url, name);
                }
                return null;
            } catch (IllegalArgumentException e) {
                return null;
            } catch (UnsupportedEncodingException e) {
                // must not happen
                throw new AssertionError(e);
            }
        }

    }

    /**
     * Constructs a new {@code URLClassLoader} instance. The newly created
     * instance will have the system ClassLoader as its parent. URLs that end
     * with "/" are assumed to be directories, otherwise they are assumed to be
     * JAR files.
     *
     * @param urls
     *            the list of URLs where a specific class or file could be
     *            found.
     */
    public URLClassLoader(URL[] urls) {
        this(urls, ClassLoader.getSystemClassLoader(), null);
    }

    /**
     * Constructs a new URLClassLoader instance. The newly created instance will
     * have the system ClassLoader as its parent. URLs that end with "/" are
     * assumed to be directories, otherwise they are assumed to be JAR files.
     *
     * @param urls
     *            the list of URLs where a specific class or file could be
     *            found.
     * @param parent
     *            the class loader to assign as this loader's parent.
     */
    public URLClassLoader(URL[] urls, ClassLoader parent) {
        this(urls, parent, null);
    }

    /**
     * Adds the specified URL to the search list.
     *
     * @param url
     *            the URL which is to add.
     */
    protected void addURL(URL url) {
        try {
            originalUrls.add(url);
            searchList.add(createSearchURL(url));
        } catch (MalformedURLException e) {
        }
    }

    /**
     * Returns all known URLs which point to the specified resource.
     *
     * @param name
     *            the name of the requested resource.
     * @return the enumeration of URLs which point to the specified resource.
     * @throws IOException
     *             if an I/O error occurs while attempting to connect.
     */
    @Override
    public Enumeration<URL> findResources(final String name) throws IOException {
        if (name == null) {
            return null;
        }
        ArrayList<URL> result = new ArrayList<URL>();
        int n = 0;
        while (true) {
            URLHandler handler = getHandler(n++);
            if (handler == null) {
                break;
            }
            handler.findResources(name, result);
        }
        return Collections.enumeration(result);
    }

    /**
     * Gets all permissions for the specified {@code codesource}. First, this
     * method retrieves the permissions from the system policy. If the protocol
     * is "file:/" then a new permission, {@code FilePermission}, granting the
     * read permission to the file is added to the permission collection.
     * Otherwise, connecting to and accepting connections from the URL is
     * granted.
     *
     * @param codesource
     *            the code source object whose permissions have to be known.
     * @return the list of permissions according to the code source object.
     */
    @Override
    protected PermissionCollection getPermissions(final CodeSource codesource) {
        PermissionCollection pc = super.getPermissions(codesource);
        URL u = codesource.getLocation();
        if (u.getProtocol().equals("jar")) {
            try {
                // Create a URL for the resource the jar refers to
                u = ((JarURLConnection) u.openConnection()).getJarFileURL();
            } catch (IOException e) {
                // This should never occur. If it does continue using the jar
                // URL
            }
        }
        if (u.getProtocol().equals("file")) {
            String path = u.getFile();
            String host = u.getHost();
            if (host != null && host.length() > 0) {
                path = "//" + host + path;
            }

            if (File.separatorChar != '/') {
                path = path.replace('/', File.separatorChar);
            }
            if (isDirectory(u)) {
                pc.add(new FilePermission(path + "-", "read"));
            } else {
                pc.add(new FilePermission(path, "read"));
            }
        } else {
            String host = u.getHost();
            if (host.length() == 0) {
                host = "localhost";
            }
            pc.add(new SocketPermission(host, "connect, accept"));
        }
        return pc;
    }

    /**
     * Returns the search list of this {@code URLClassLoader}.
     *
     * @return the list of all known URLs of this instance.
     */
    public URL[] getURLs() {
        return originalUrls.toArray(new URL[originalUrls.size()]);
    }

    /**
     * Determines if the URL is pointing to a directory.
     */
    private static boolean isDirectory(URL url) {
        String file = url.getFile();
        return (file.length() > 0 && file.charAt(file.length() - 1) == '/');
    }

    /**
     * Returns a new {@code URLClassLoader} instance for the given URLs and the
     * system {@code ClassLoader} as its parent.
     *
     * @param urls
     *            the list of URLs that is passed to the new {@code
     *            URLClassLoader}.
     * @return the created {@code URLClassLoader} instance.
     */
    public static URLClassLoader newInstance(final URL[] urls) {
        return new URLClassLoader(urls, ClassLoader.getSystemClassLoader());
    }

    /**
     * Returns a new {@code URLClassLoader} instance for the given URLs and the
     * specified {@code ClassLoader} as its parent.
     *
     * @param urls
     *            the list of URLs that is passed to the new URLClassLoader.
     * @param parentCl
     *            the parent class loader that is passed to the new
     *            URLClassLoader.
     * @return the created {@code URLClassLoader} instance.
     */
    public static URLClassLoader newInstance(final URL[] urls, final ClassLoader parentCl) {
        return new URLClassLoader(urls, parentCl);
    }

    /**
     * Constructs a new {@code URLClassLoader} instance. The newly created
     * instance will have the specified {@code ClassLoader} as its parent and
     * use the specified factory to create stream handlers. URLs that end with
     * "/" are assumed to be directories, otherwise they are assumed to be JAR
     * files.
     *
     * @param searchUrls
     *            the list of URLs where a specific class or file could be
     *            found.
     * @param parent
     *            the {@code ClassLoader} to assign as this loader's parent.
     * @param factory
     *            the factory that will be used to create protocol-specific
     *            stream handlers.
     */
    public URLClassLoader(URL[] searchUrls, ClassLoader parent, URLStreamHandlerFactory factory) {
        super(parent);
        this.factory = factory;
        int nbUrls = searchUrls.length;
        originalUrls = new ArrayList<URL>(nbUrls);
        handlerList = new ArrayList<URLHandler>(nbUrls);
        searchList = Collections.synchronizedList(new ArrayList<URL>(nbUrls));
        for (int i = 0; i < nbUrls; i++) {
            originalUrls.add(searchUrls[i]);
            try {
                searchList.add(createSearchURL(searchUrls[i]));
            } catch (MalformedURLException e) {
            }
        }
    }

    /**
     * Tries to locate and load the specified class using the known URLs. If the
     * class could be found, a class object representing the loaded class will
     * be returned.
     *
     * @throws ClassNotFoundException
     *             if the specified class cannot be loaded.
     */
    @Override
    protected Class<?> findClass(final String className) throws ClassNotFoundException {
        String partialName = className.replace('.', '/');
        final String classFileName = new StringBuilder(partialName).append(".class").toString();
        String packageName = null;
        int position = partialName.lastIndexOf('/');
        if ((position = partialName.lastIndexOf('/')) != -1) {
            packageName = partialName.substring(0, position);
        }
        int n = 0;
        while (true) {
            URLHandler handler = getHandler(n++);
            if (handler == null) {
                break;
            }
            Class<?> res = handler.findClass(packageName, classFileName, className);
            if (res != null) {
                return res;
            }
        }
        throw new ClassNotFoundException(className);
    }

    /**
     * Returns an URL that will be checked if it contains the class or resource.
     * If the file component of the URL is not a directory, a Jar URL will be
     * created.
     *
     * @return java.net.URL a test URL
     */
    private URL createSearchURL(URL url) throws MalformedURLException {
        if (url == null) {
            return url;
        }

        String protocol = url.getProtocol();

        if (isDirectory(url) || protocol.equals("jar")) {
            return url;
        }
        if (factory == null) {
            return new URL("jar", "",
                    -1, url.toString() + "!/");
        }
        // use jar protocol as the stream handler protocol
        return new URL("jar", "",
                -1, url.toString() + "!/",
                factory.createURLStreamHandler("jar"));
    }

    /**
     * Returns an URL referencing the specified resource or {@code null} if the
     * resource could not be found.
     *
     * @param name
     *            the name of the requested resource.
     * @return the URL which points to the given resource.
     */
    @Override
    public URL findResource(final String name) {
        if (name == null) {
            return null;
        }
        int n = 0;
        while (true) {
            URLHandler handler = getHandler(n++);
            if (handler == null) {
                break;
            }
            URL res = handler.findResource(name);
            if (res != null) {
                return res;
            }
        }
        return null;
    }

    private URLHandler getHandler(int num) {
        if (num < handlerList.size()) {
            return handlerList.get(num);
        }
        makeNewHandler();
        if (num < handlerList.size()) {
            return handlerList.get(num);
        }
        return null;
    }

    private synchronized void makeNewHandler() {
        while (!searchList.isEmpty()) {
            URL nextCandidate = searchList.remove(0);
            if (nextCandidate == null) {
                throw new NullPointerException("nextCandidate == null");
            }
            if (!handlerMap.containsKey(nextCandidate)) {
                URLHandler result;
                String protocol = nextCandidate.getProtocol();
                if (protocol.equals("jar")) {
                    result = createURLJarHandler(nextCandidate);
                } else if (protocol.equals("file")) {
                    result = createURLFileHandler(nextCandidate);
                } else {
                    result = createURLHandler(nextCandidate);
                }
                if (result != null) {
                    handlerMap.put(nextCandidate, result);
                    handlerList.add(result);
                    return;
                }
            }
        }
    }

    private URLHandler createURLHandler(URL url) {
        return new URLHandler(url);
    }

    private URLHandler createURLFileHandler(URL url) {
        return new URLFileHandler(url);
    }

    private URLHandler createURLJarHandler(URL url) {
        String prefixName;
        String file = url.getFile();
        if (url.getFile().endsWith("!/")) {
            prefixName = "";
        } else {
            int sepIdx = file.lastIndexOf("!/");
            if (sepIdx == -1) {
                // Invalid URL, don't look here again
                return null;
            }
            sepIdx += 2;
            prefixName = file.substring(sepIdx);
        }
        try {
            URL jarURL = ((JarURLConnection) url
                    .openConnection()).getJarFileURL();
            JarURLConnection juc = (JarURLConnection) new URL(
                    "jar", "",
                    jarURL.toExternalForm() + "!/").openConnection();
            JarFile jf = juc.getJarFile();
            URLJarHandler jarH = new URLJarHandler(url, jarURL, jf, prefixName);

            if (jarH.getIndex() == null) {
                try {
                    Manifest manifest = jf.getManifest();
                    if (manifest != null) {
                        String classpath = manifest.getMainAttributes().getValue(
                                Attributes.Name.CLASS_PATH);
                        if (classpath != null) {
                            searchList.addAll(0, getInternalURLs(url, classpath));
                        }
                    }
                } catch (IOException e) {
                }
            }
            return jarH;
        } catch (IOException e) {
        }
        return null;
    }

    /**
     * Defines a new package using the information extracted from the specified
     * manifest.
     *
     * @param packageName
     *            the name of the new package.
     * @param manifest
     *            the manifest containing additional information for the new
     *            package.
     * @param url
     *            the URL to the code source for the new package.
     * @return the created package.
     * @throws IllegalArgumentException
     *             if a package with the given name already exists.
     */
    protected Package definePackage(String packageName, Manifest manifest,
                                    URL url) throws IllegalArgumentException {
        Attributes mainAttributes = manifest.getMainAttributes();
        String dirName = packageName.replace('.', '/') + "/";
        Attributes packageAttributes = manifest.getAttributes(dirName);
        boolean noEntry = false;
        if (packageAttributes == null) {
            noEntry = true;
            packageAttributes = mainAttributes;
        }
        String specificationTitle = packageAttributes
                .getValue(Attributes.Name.SPECIFICATION_TITLE);
        if (specificationTitle == null && !noEntry) {
            specificationTitle = mainAttributes
                    .getValue(Attributes.Name.SPECIFICATION_TITLE);
        }
        String specificationVersion = packageAttributes
                .getValue(Attributes.Name.SPECIFICATION_VERSION);
        if (specificationVersion == null && !noEntry) {
            specificationVersion = mainAttributes
                    .getValue(Attributes.Name.SPECIFICATION_VERSION);
        }
        String specificationVendor = packageAttributes
                .getValue(Attributes.Name.SPECIFICATION_VENDOR);
        if (specificationVendor == null && !noEntry) {
            specificationVendor = mainAttributes
                    .getValue(Attributes.Name.SPECIFICATION_VENDOR);
        }
        String implementationTitle = packageAttributes
                .getValue(Attributes.Name.IMPLEMENTATION_TITLE);
        if (implementationTitle == null && !noEntry) {
            implementationTitle = mainAttributes
                    .getValue(Attributes.Name.IMPLEMENTATION_TITLE);
        }
        String implementationVersion = packageAttributes
                .getValue(Attributes.Name.IMPLEMENTATION_VERSION);
        if (implementationVersion == null && !noEntry) {
            implementationVersion = mainAttributes
                    .getValue(Attributes.Name.IMPLEMENTATION_VERSION);
        }
        String implementationVendor = packageAttributes
                .getValue(Attributes.Name.IMPLEMENTATION_VENDOR);
        if (implementationVendor == null && !noEntry) {
            implementationVendor = mainAttributes
                    .getValue(Attributes.Name.IMPLEMENTATION_VENDOR);
        }

        return definePackage(packageName, specificationTitle,
                specificationVersion, specificationVendor, implementationTitle,
                implementationVersion, implementationVendor, isSealed(manifest,
                dirName) ? url : null);
    }

    private boolean isSealed(Manifest manifest, String dirName) {
        Attributes attributes = manifest.getAttributes(dirName);
        if (attributes != null) {
            String value = attributes.getValue(Attributes.Name.SEALED);
            if (value != null) {
                return value.equalsIgnoreCase("true");
            }
        }
        Attributes mainAttributes = manifest.getMainAttributes();
        String value = mainAttributes.getValue(Attributes.Name.SEALED);
        return (value != null && value.equalsIgnoreCase("true"));
    }

    /**
     * returns URLs referenced in the string classpath.
     *
     * @param root
     *            the jar URL that classpath is related to
     * @param classpath
     *            the relative URLs separated by spaces
     * @return URL[] the URLs contained in the string classpath.
     */
    private ArrayList<URL> getInternalURLs(URL root, String classpath) {
        // Class-path attribute is composed of space-separated values.
        StringTokenizer tokenizer = new StringTokenizer(classpath);
        ArrayList<URL> addedURLs = new ArrayList<URL>();
        String file = root.getFile();
        int jarIndex = file.lastIndexOf("!/") - 1;
        int index = file.lastIndexOf("/", jarIndex) + 1;
        if (index == 0) {
            index = file.lastIndexOf(
                    System.getProperty("file.separator"), jarIndex) + 1;
        }
        file = file.substring(0, index);
        while (tokenizer.hasMoreElements()) {
            String element = tokenizer.nextToken();
            if (!element.isEmpty()) {
                try {
                    // Take absolute path case into consideration
                    URL url = new URL(new URL(file), element);
                    addedURLs.add(createSearchURL(url));
                } catch (MalformedURLException e) {
                    // Nothing is added
                }
            }
        }
        return addedURLs;
    }
}

{'repo_name': 'robovm/robovm', 'stars': '1614', 'repo_language': 'Java', 'file_name': 'CMakeLists.txt', 'mime_type': 'text/plain', 'hash': -3220904842450013046, 'source_dataset': 'data'}


kubectl delete -f examples/dependency/demo.yaml
kubectl apply -f examples/dependency/definition.yaml
kubectl create -f examples/dependency/demo.yaml
go run cmd/oam-runtime/main.go

{'repo_name': 'crossplane/oam-kubernetes-runtime', 'stars': '112', 'repo_language': 'Go', 'file_name': 'trait-separated-from-underlying-workload-should-patch-back.md', 'mime_type': 'text/plain', 'hash': -7065174245959756656, 'source_dataset': 'data'}