@ -2078,12 +2078,22 @@ public class UploadPack {
try {
try {
sendPack ( true , req , accumulator , allTags , unshallowCommits ,
sendPack ( true , req , accumulator , allTags , unshallowCommits ,
deepenNots ) ;
deepenNots ) ;
} catch ( ServiceMayNotContinueException noPack ) {
} catch ( ServiceMayNotContinueException err ) {
// This was already reported on (below).
String message = err . getMessage ( ) ;
throw noPack ;
if ( message = = null ) {
message = JGitText . get ( ) . internalServerError ;
}
try {
reportInternalServerErrorOverSideband ( message ) ;
} catch ( IOException e ) {
err . addSuppressed ( e ) ;
throw err ;
}
throw new UploadPackInternalServerErrorException ( err ) ;
} catch ( IOException | RuntimeException | Error err ) {
} catch ( IOException | RuntimeException | Error err ) {
try {
try {
reportInternalServerErrorOverSideband ( ) ;
reportInternalServerErrorOverSideband (
JGitText . get ( ) . internalServerError ) ;
} catch ( IOException e ) {
} catch ( IOException e ) {
err . addSuppressed ( e ) ;
err . addSuppressed ( e ) ;
throw err ;
throw err ;
@ -2095,12 +2105,13 @@ public class UploadPack {
}
}
}
}
private void reportInternalServerErrorOverSideband ( ) throws IOException {
private void reportInternalServerErrorOverSideband ( String message )
throws IOException {
@SuppressWarnings ( "resource" /* java 7 */ )
@SuppressWarnings ( "resource" /* java 7 */ )
SideBandOutputStream err = new SideBandOutputStream (
SideBandOutputStream err = new SideBandOutputStream (
SideBandOutputStream . CH_ERROR , SideBandOutputStream . SMALL_BUF ,
SideBandOutputStream . CH_ERROR , SideBandOutputStream . SMALL_BUF ,
rawOut ) ;
rawOut ) ;
err . write ( Constants . encode ( JGitText . get ( ) . internalServerError ) ) ;
err . write ( Constants . encode ( message ) ) ;
err . flush ( ) ;
err . flush ( ) ;
}
}
@ -2147,25 +2158,12 @@ public class UploadPack {
}
}
}
}
try {
if ( wantAll . isEmpty ( ) ) {
if ( wantAll . isEmpty ( ) ) {
preUploadHook . onSendPack ( this , wantIds , commonBase ) ;
preUploadHook . onSendPack ( this , wantIds , commonBase ) ;
} else {
} else {
preUploadHook . onSendPack ( this , wantAll , commonBase ) ;
preUploadHook . onSendPack ( this , wantAll , commonBase ) ;
}
}
msgOut . flush ( ) ;
msgOut . flush ( ) ;
} catch ( ServiceMayNotContinueException noPack ) {
if ( sideband & & noPack . getMessage ( ) ! = null ) {
noPack . setOutput ( ) ;
@SuppressWarnings ( "resource" /* java 7 */ )
SideBandOutputStream err = new SideBandOutputStream (
SideBandOutputStream . CH_ERROR ,
SideBandOutputStream . SMALL_BUF , rawOut ) ;
err . write ( Constants . encode ( noPack . getMessage ( ) ) ) ;
err . flush ( ) ;
}
throw noPack ;
}
PackConfig cfg = packConfig ;
PackConfig cfg = packConfig ;
if ( cfg = = null )
if ( cfg = = null )