public static void outNoStack( String str ) { outNoStack( str, false ); }
static TrayDelegate getTray(Display display) { if (Constants.isUnix) { try { TrayDelegate delegate = (TrayDelegate) Class.forName( "com.biglybt.ui.swt.systray.TrayDork").newInstance(); if (delegate != null) { Method mGetSystemTray = delegate.getClass().getDeclaredMethod("getSystemTray"); Object o = mGetSystemTray.invoke(delegate); Method mGetMenu = o.getClass().getMethod("getMenu"); Object menu = mGetMenu.invoke(o); if (menu != null) { return delegate; } } } catch (Throwable ignore) { Debug.outNoStack(ignore.getMessage()); } } return new TraySWT(display); }
Debug.outNoStack( "RSSUtils: failed to parse Atom date: " + date_str );
protected LinkedList<UploadSession> pickBestDownloadSessions( int max_sessions ) { //TODO factor download priority into best calculation? ArrayList<PEPeer> all_peers = globalGetAllDownloadPeers(); if( all_peers.isEmpty() ) return new LinkedList(); ArrayList<PEPeer> best = down_ranker.rankPeers( max_sessions, all_peers ); if( best.size() != max_sessions ) { Debug.outNoStack( "best.size()[" +best.size()+ "] != max_sessions[" +max_sessions+ "]" ); } if( best.isEmpty() ) { return new LinkedList<>(); } LinkedList<UploadSession> best_sessions = new LinkedList<>(); for( Iterator<PEPeer> it = best.iterator(); it.hasNext(); ) { PEPeer peer = it.next(); UploadSession session = new UploadSession( peer, UploadSession.TYPE_DOWNLOAD ); best_sessions.add( session ); } return best_sessions; }
private static void checkErrorType(Throwable e) { if (e instanceof RPException) { Debug.outNoStack("RPExceptions chained together - stack trace, followed by other RPException stack trace."); Debug.outStackTrace(); Debug.printStackTrace(e); throw new RuntimeException("cannot chain RPException instances together"); } }
@Override public void runSupport() { try { int pool = NSAutoreleasePool_push(); long start = System.currentTimeMillis(); String src; if (params == null || params.length == 0) { src = scriptFormat; } else { src = MessageFormat.format(scriptFormat, params); } Debug.outNoStack("Executing: \n" + src); Object /*NSMutableDictionary*/ errorInfo = new_NSMutableDictionary(); if (NSAppleScript_execute(new_NSAppleScript(src), errorInfo) == null) { Debug.out(String.valueOf(NSMutableDictionary_objectForKey(errorInfo, NSAppleScript_AppleScriptErrorMessage))); //logWarning(String.valueOf(errorInfo.objectForKey(NSAppleScript.AppleScriptErrorBriefMessage))); } Debug.outNoStack(MessageFormat.format("Elapsed time: {0}ms\n", new Object[] { new Long(System.currentTimeMillis() - start) })); NSAutoreleasePool_pop(pool); } catch (Throwable t) { Debug.out(t); } } };
@Override public void runSupport() { try { int pool = NSAutoreleasePool_push(); long start = System.currentTimeMillis(); String src; if (params == null || params.length == 0) { src = scriptFormat; } else { src = MessageFormat.format(scriptFormat, params); } Debug.outNoStack("Executing: \n" + src); Object /*NSMutableDictionary*/ errorInfo = new_NSMutableDictionary(); if (NSAppleScript_execute(new_NSAppleScript(src), errorInfo) == null) { Debug.out(String.valueOf(NSMutableDictionary_objectForKey(errorInfo, NSAppleScript_AppleScriptErrorMessage))); //logWarning(String.valueOf(errorInfo.objectForKey(NSAppleScript.AppleScriptErrorBriefMessage))); } Debug.outNoStack(MessageFormat.format("Elapsed time: {0}ms\n", new Object[] { new Long(System.currentTimeMillis() - start) })); NSAutoreleasePool_pop(pool); } catch (Throwable e) { Debug.out(e); } } };
protected static void initialise() { try{ Security.addProvider(new org.gudy.bouncycastle.jce.provider.BouncyCastleProvider()); KeyFactory kf = KeyFactory.getInstance( "ECDSA", BouncyCastleProvider.PROVIDER_NAME ); if ( Constants.IS_CVS_VERSION ){ String where = ""; try{ where = BouncyCastleProvider.class.getClassLoader().getResource( "org/gudy/bouncycastle/jce/provider/BouncyCastleProvider.class" ).toExternalForm(); }catch( Throwable e ){ ClassLoader cl = BouncyCastleProvider.class.getClassLoader(); if ( cl == null ){ where = "<bootstrap>"; }else{ where = cl.toString(); } } if ( !where.contains( Constants.DEFAULT_JAR_NAME )){ Debug.outNoStack( "BC Provider '" + BouncyCastleProvider.PROVIDER_NAME + "' initialised successfully (loaded from " + where + ")" ); } } }catch( Throwable e ){ Debug.out( "BC Provider initialisation failed", e ); } }
protected void installSecurityManager() { if ( Constants.isAndroid ){ // can't do this }else{ String prop = System.getProperty(SystemProperties.SYSPROP_SECURITY_MANAGER_INSTALL, "1" ); if ( prop.equals( "0" )){ Debug.outNoStack( "Not installing security manager - disabled by system property" ); return; } try{ final SecurityManager old_sec_man = System.getSecurityManager(); my_sec_man = new ClientSecurityManager( old_sec_man ); System.setSecurityManager( my_sec_man ); }catch( Throwable e ){ Debug.printStackTrace(e); } } }
@Override public void badPieceReported( PEPeerTransport originator, int piece_number ) { Debug.outNoStack( getDisplayName() + ": bad piece #" + piece_number + " reported by " + originator.getIp()); if ( piece_number < 0 || piece_number >= _nbPieces ){ return; } bad_piece_reported = piece_number; }
/** * {@inheritDoc} */ @Override protected void dispose() { try { classMon.enter(); if(!isDisposed) { Debug.outNoStack("Disposing Native PlatformManager..."); try { NSAutoreleasePool_pop(mainPool); } catch (Throwable e) { } isDisposed = true; Debug.outNoStack("Done"); } } finally { classMon.exit(); } }
@Override public UISWTStatusEntry createStatusEntry() { final UISWTStatusEntryImpl entry = new UISWTStatusEntryImpl(); UIFunctionsSWT functionsSWT = UIFunctionsManagerSWT.getUIFunctionsSWT(); if (functionsSWT == null) { Debug.outNoStack("No UIFunctionsSWT on createStatusEntry"); return null; } IMainStatusBar mainStatusBar = functionsSWT.getMainStatusBar(); if (mainStatusBar == null) { Debug.outNoStack("No MainStatusBar on createStatusEntry"); return null; } mainStatusBar.createStatusEntry(entry); return entry; }
Debug.outNoStack( "Gave up waiting for delete to complete for " + path );
protected void reopen( FMFileManagerException cause ) throws Throwable { if ( !cause.isRecoverable()){ throw( cause ); } if ( raf != null ){ try{ raf.close(); }catch( Throwable e ){ // ignore any close failure as can't do much } // don't clear down raf here as we want to leave things looking as they were // if the subsequent open fails } file_access.aboutToOpen(); raf = new RandomAccessFile( linked_file, access_mode==FM_READ?READ_ACCESS_MODE:WRITE_ACCESS_MODE); last_modified = linked_file.lastModified(); Debug.outNoStack( "Recovered connection to " + getName() + " after access failure" ); }
@Override public void runWithDisplay(Display display) { if (swtItem != null && !swtItem.isDisposed()) { try { swtItem.setFont(null); swtItem.dispose(); } catch (Exception e) { // on OSX, SWT does some misguided exceptions on disposal of TreeItem // We occasionally get SWTException of "Widget is Disposed" or // "Argument not valid", as well as NPEs Debug.outNoStack( "Warning on SidebarEntry dispose: " + e.toString(), false); } finally { swtItem = null; } } } });
public static void logClientDiscrepancy(String peer_id_name, String handshake_name, String discrepancy, String protocol, byte[] peer_id) { if (!client_logging_allowed) {return;} // Generate the string used that we will log. String line_to_log = discrepancy + " [" + protocol + "]: "; line_to_log += "\"" + peer_id_name + "\" / \"" + handshake_name + "\" "; // We'll encode the name in byte form to help us decode it. line_to_log += "[" + asUTF8ByteString(handshake_name) + "]"; // Avoid logging the same combination of things again. boolean log_to_debug_out = Constants.isCVSVersion(); if (log_to_debug_out || LOG_UNKNOWN) { // If this text has been recorded before, then avoid doing it again. if (!logged_discrepancies.add(line_to_log)) {return;} } // Add peer ID bytes. if (peer_id != null) { line_to_log += ", Peer ID: " + ByteFormatter.encodeString(peer_id); } // Enable this block for now - just until we get more feedback about // problematic clients. if (log_to_debug_out) { Debug.outNoStack("Conflicting peer identification: " + line_to_log); } if (!LOG_UNKNOWN) {return;} logClientDiscrepancyToFile(line_to_log); }
Debug.outNoStack("Old aereg.dll"); } catch (Throwable e) { Debug.out(e);
static void logUnknownClient(byte[] peer_id_bytes, boolean to_debug_out) { if (!client_logging_allowed) {return;} // Avoid logging the same client ID multiple times. boolean log_to_debug_out = to_debug_out && Constants.isCVSVersion(); if (log_to_debug_out || LOG_UNKNOWN) { // If the ID has been recorded before, then avoid doing it again. if (!logged_ids.add(makePeerIDReadableAndUsable(peer_id_bytes))) {return;} } // Enable this block for now - just until we get more feedback about // unknown clients. if (log_to_debug_out) { Debug.outNoStack("Unable to decode peer correctly - peer ID bytes: " + makePeerIDReadableAndUsable(peer_id_bytes)); } if (!LOG_UNKNOWN) {return;} try {logClientDiscrepancyToFile(logUnknownClient0(peer_id_bytes));} catch (Throwable t) {Debug.printStackTrace(t);} }
protected CryptoHandlerECC( CryptoManagerImpl _manager, int _instance_id ) { manager = _manager; CONFIG_PREFIX += _instance_id + "."; // migration away from system managed keys if ( getDefaultPasswordHandlerType() != CryptoManagerPasswordHandler.HANDLER_TYPE_USER ){ COConfigurationManager.setParameter( CONFIG_PREFIX + "default_pwtype", CryptoManagerPasswordHandler.HANDLER_TYPE_USER ); } if ( getCurrentPasswordType() == CryptoManagerPasswordHandler.HANDLER_TYPE_SYSTEM || COConfigurationManager.getByteParameter( CONFIG_PREFIX + "publickey", null ) == null ){ try{ createAndStoreKeys( manager.setPassword( CryptoManager.HANDLER_ECC, CryptoManagerPasswordHandler.HANDLER_TYPE_USER, DEFAULT_PASSWORD.toCharArray(), DEFAULT_TIMEOUT )); Debug.outNoStack( "Successfully migrated key management" ); }catch( Throwable e ){ Debug.out( "Failed to migrate key management", e ); } } }
protected Rectangle swt_getBounds() { if (swtItem == null || swtItem.isDisposed()) { return null; } try { Tree tree = swtItem.getParent(); Rectangle bounds = swtItem.getBounds(); Rectangle treeBounds = tree.getClientArea(); return new Rectangle(0, bounds.y, treeBounds.width, bounds.height); } catch (NullPointerException e) { // On OSX, we get erroneous NPE here: //at org.eclipse.swt.widgets.Tree.sendMeasureItem(Tree.java:2443) //at org.eclipse.swt.widgets.Tree.cellSize(Tree.java:274) //at org.eclipse.swt.widgets.Display.windowProc(Display.java:4750) //at org.eclipse.swt.internal.cocoa.OS.objc_msgSend_stret(Native Method) //at org.eclipse.swt.internal.cocoa.NSCell.cellSize(NSCell.java:34) //at org.eclipse.swt.widgets.TreeItem.getBounds(TreeItem.java:467) Debug.outNoStack("NPE @ " + Debug.getCompressedStackTrace(), true); } catch (Exception e) { Debug.out(e); } return null; }