Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
jgit
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Faculty of Technology
Software Engineering
tools
cms
jgit
Commits
fbadb195
Commit
fbadb195
authored
15 years ago
by
Robin Rosenberg
Committed by
Code Review
15 years ago
Browse files
Options
Downloads
Plain Diff
Merge "Ensure RawText closes the FileInputStream when read is complete"
parents
ad94dca1
c5816725
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
org.eclipse.jgit/src/org/eclipse/jgit/diff/RawText.java
+2
-14
2 additions, 14 deletions
org.eclipse.jgit/src/org/eclipse/jgit/diff/RawText.java
with
2 additions
and
14 deletions
org.eclipse.jgit/src/org/eclipse/jgit/diff/RawText.java
+
2
−
14
View file @
fbadb195
...
...
@@ -45,10 +45,10 @@
package
org.eclipse.jgit.diff
;
import
java.io.File
;
import
java.io.FileInputStream
;
import
java.io.IOException
;
import
java.io.OutputStream
;
import
org.eclipse.jgit.util.IO
;
import
org.eclipse.jgit.util.IntList
;
import
org.eclipse.jgit.util.RawParseUtils
;
...
...
@@ -99,7 +99,7 @@ public RawText(final byte[] input) {
* @throws IOException if Exceptions occur while reading the file
*/
public
RawText
(
File
file
)
throws
IOException
{
this
(
readF
ile
(
file
));
this
(
IO
.
readF
ully
(
file
));
}
public
int
size
()
{
...
...
@@ -202,16 +202,4 @@ protected int hashLine(final byte[] raw, int ptr, final int end) {
hash
=
(
hash
<<
5
)
^
(
raw
[
ptr
]
&
0xff
);
return
hash
;
}
private
static
byte
[]
readFile
(
File
file
)
throws
IOException
{
byte
[]
result
=
new
byte
[(
int
)
file
.
length
()];
FileInputStream
in
=
new
FileInputStream
(
file
);
for
(
int
off
=
0
;
off
<
result
.
length
;
)
{
int
read
=
in
.
read
(
result
,
off
,
result
.
length
-
off
);
if
(
read
<
0
)
throw
new
IOException
(
"Early EOF"
);
off
+=
read
;
}
return
result
;
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment