File tree 2 files changed +8
-0
lines changed
2 files changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -102,6 +102,7 @@ def major_or_minor_and_tail(s)
102
102
if s . nil? || s . empty?
103
103
major_or_minor , tail = nil , nil
104
104
else
105
+ raise "Invalid version '#{ s } ': must not end in '.'" if s [ -1 ] == '.'
105
106
tokens = s . match ( /^([^\. ]+)(?:\. (.*))?/ )
106
107
107
108
major_or_minor , tail = tokens [ 1 ..-1 ]
@@ -116,6 +117,7 @@ def micro_and_qualifier(s)
116
117
if s . nil? || s . empty?
117
118
micro , qualifier = nil , nil
118
119
else
120
+ raise "Invalid version '#{ s } ': must not end in '_'" if s [ -1 ] == '_'
119
121
tokens = s . match ( /^([^\_ ]+)(?:_(.*))?/ )
120
122
121
123
micro , qualifier = tokens [ 1 ..-1 ]
Original file line number Diff line number Diff line change 129
129
expect { JavaBuildpack ::VersionResolver . resolve ( '1.6.0_25' , [ '+' ] ) } . to raise_error
130
130
end
131
131
132
+ it 'should raise an exception when a version ends with a component separator' do
133
+ expect { JavaBuildpack ::VersionResolver . resolve ( '1.' , [ '1.' ] ) } . to raise_error
134
+ expect { JavaBuildpack ::VersionResolver . resolve ( '1.7.' , [ '1.7.' ] ) } . to raise_error
135
+ expect { JavaBuildpack ::VersionResolver . resolve ( '1.7.0_' , [ '1.7.0_' ] ) } . to raise_error
136
+ end
137
+
132
138
end
You can’t perform that action at this time.
0 commit comments