@@ -868,24 +868,21 @@ private String decryptSignature(String encryptedSig, String decryptionCode) thro
868868 }
869869
870870 private String getDecryptionFuncName (String playerCode ) throws DecryptException {
871- String decryptionFunctionName ;
872- // Cascading things in catch is ugly, but its faster than running a match before getting the actual name
873- // to se if the function can actually be found with the given regex.
874- // However if this cascading should probably be cleaned up somehow as it looks a bit weird.
875- try {
876- decryptionFunctionName = Parser . matchGroup1 ( DECRYPTION_SIGNATURE_FUNCTION_REGEX , playerCode ) ;
877- } catch ( Parser . RegexException re ) {
871+ String [] decryptionFuncNameRegexes = {
872+ DECRYPTION_SIGNATURE_FUNCTION_REGEX ,
873+ DECRYPTION_AKAMAIZED_SHORT_STRING_REGEX ,
874+ DECRYPTION_AKAMAIZED_STRING_REGEX
875+ };
876+ Parser . RegexException exception = null ;
877+ for ( String regex : decryptionFuncNameRegexes ) {
878878 try {
879- decryptionFunctionName = Parser .matchGroup1 (DECRYPTION_AKAMAIZED_SHORT_STRING_REGEX , playerCode );
880- } catch (Parser .RegexException re2 ) {
881- try {
882- decryptionFunctionName = Parser .matchGroup1 (DECRYPTION_AKAMAIZED_STRING_REGEX , playerCode );
883- } catch (Parser .RegexException re3 ) {
884- throw new DecryptException ("Could not find decrypt function with any of the given patterns." , re );
885- }
879+ return Parser .matchGroup1 (regex , playerCode );
880+ } catch (Parser .RegexException re ) {
881+ if (exception == null )
882+ exception = re ;
886883 }
887884 }
888- return decryptionFunctionName ;
885+ throw new DecryptException ( "Could not find decrypt function with any of the given patterns." , exception ) ;
889886 }
890887
891888 @ Nonnull
0 commit comments