public void received (final Connection connection, Object object) { if (!(object instanceof InvokeMethod)) return; if (connections != null) { int i = 0, n = connections.length; for (; i < n; i++) if (connection == connections[i]) break; if (i == n) return; // The InvokeMethod message is not for a connection in this ObjectSpace. } final InvokeMethod invokeMethod = (InvokeMethod)object; final Object target = idToObject.get(invokeMethod.objectID); if (target == null) { if (WARN) warn("kryonet", "Ignoring remote invocation request for unknown object ID: " + invokeMethod.objectID); return; } if (executor == null) invoke(connection, target, invokeMethod); else { executor.execute(new Runnable() { public void run () { invoke(connection, target, invokeMethod); } }); } }
public Object read (Kryo kryo, Input input, Class type) { int objectID = input.readInt(true); Connection connection = (Connection)kryo.getContext().get("connection"); Object object = getRegisteredObject(connection, objectID); if (WARN && object == null) warn("kryonet", "Unknown object ID " + objectID + " for connection: " + connection); return object; } });
fromAddress = udp.readFromAddress(); } catch (IOException ex) { if (WARN) warn("kryonet", "Error reading UDP data.", ex); continue; if (ERROR) error("kryonet", "Error reading UDP from connection: " + fromConnection, ex); } else warn("kryonet", "Error reading UDP from unregistered address: " + fromAddress, ex); if (DEBUG && responseSent) debug("kryonet", "Responded to host discovery from: " + fromAddress); } catch (IOException ex) { if (WARN) warn("kryonet", "Error replying to host discovery from: " + fromAddress, ex);
public static void closing( Path host ) { try { Files.deleteIfExists( host.resolve( STARTED )); } catch( IOException e ) { Log.warn( "stranded " + STARTED ); } }
public static long copy( InputStream input, OutputStream output, byte[] buffer ) { long count = 0; int n = 0; try { while( EOF < ( n = input.read( buffer ) ) ) { output.write( buffer, 0, n ); count += n; } } catch( IOException e ) { throw u( e ); } try { output.flush(); } catch( IOException e ) { Log.warn( "flush failed ", e ); } return count; }
public Optional<ElsewhereProvider> getElsewhereProvider( String typ ) { Optional<ElsewhereProvider> elsewhereProvider = Optional.empty(); try { Iterator<ElsewhereProvider> providers = loader.iterator(); while( !elsewhereProvider.isPresent() && providers.hasNext() ) { ElsewhereProvider d = providers.next(); if( d.getType().equals( typ ) ) { elsewhereProvider = Optional.of( d ); } } } catch( ServiceConfigurationError serviceError ) { Log.warn( serviceError.getMessage() ); return Optional.empty(); } return elsewhereProvider; }
private static URL getAccessibleResource(String url) { URL urlResource = CspHeadersPanel.class.getResource(url); if(urlResource == null) { Log.error("Resource not found "+url); return null; } if(!urlResource.getFile().contains(".jar!") && !urlResource.getFile().contains(".zap!")) { return urlResource; } try { File tempFile = File.createTempFile("temp-file-name", ".png"); System.out.println(tempFile.toPath()); try (InputStream in = urlResource.openStream(); FileOutputStream out = new FileOutputStream(tempFile)) { IOUtils.copy(in, out); } return tempFile.toURI().toURL(); } catch (IOException e) { Log.warn(e.getMessage()); return null; } } }
public static boolean validateOrThrow( Path root, char[] passwd ) { if ( !Files.exists( sanityFile( root ))) { Log.warn( "no password hash exists, let's hope its ok" ); return true; } return same( Filess.readAllBytes( root.resolve( SANITY ) ), passwd ); }
Log.warn("Unable to save the script file : "+e.getMessage()); cont.fileSaveError(file.getAbsolutePath());
public void received (final Connection connection, Object object) { if (!(object instanceof InvokeMethod)) return; if (connections != null) { int i = 0, n = connections.length; for (; i < n; i++) if (connection == connections[i]) break; if (i == n) return; // The InvokeMethod message is not for a connection in this ObjectSpace. } final InvokeMethod invokeMethod = (InvokeMethod)object; final Object target = idToObject.get(invokeMethod.objectID); if (target == null) { if (WARN) warn("kryonet", "Ignoring remote invocation request for unknown object ID: " + invokeMethod.objectID); return; } if (executor == null) invoke(connection, target, invokeMethod); else { executor.execute(new Runnable() { public void run () { invoke(connection, target, invokeMethod); } }); } }
void go() { if( started ) { Log.warn( "tried to start save worker again" ); return; } started = true; Log.info( "save worker started for elsewhere .." ); new Thread( () -> { while( open ) { while( open && !elsewhere.offline() && oneSave() ) { // all in condi } try { Thread.sleep( 5000 ); } catch( InterruptedException e ) { } } } ).start(); }
if (target == null) { if (WARN) { warn("kryonet", "Ignoring remote invocation request for unknown object ID: " + invokeMethod.objectID);
public static boolean same( byte[] combined, char[] passwd ) { byte[] salt = new byte[8]; System.arraycopy( combined, 0, salt, 0, 8 ); CipherProvider cp = new CipherProvider( new AES_CBC_PKCS5(), passwd, salt, false ); byte[] newCombined = cp.getSaltedHash(); if ( newCombined.length != combined.length ) { Log.warn( "different key sizes, get java unlimited strength" ); return false; } for ( int idx = 0; idx < combined.length; idx++ ) { if ( newCombined[idx] != newCombined[idx] ) { return false; } } return true; }
warn(unregisteredClassMessage(type));
warn(unregisteredClassMessage(type));
@Override public Object read(Kryo kryo, Input input, Class type) { int objectID = input.readInt(true); Connection connection = (Connection) kryo.getContext().get("connection"); Object object = getRegisteredObject(connection, objectID); if (WARN && (object == null)) { warn("kryonet", "Unknown object ID " + objectID + " for connection: " + connection); } return object; } }, nextRegistrationId++);
public Object read (Kryo kryo, Input input, Class type) { int objectID = input.readInt(true); Connection connection = (Connection)kryo.getContext().get("connection"); Object object = getRegisteredObject(connection, objectID); if (WARN && object == null) warn("kryonet", "Unknown object ID " + objectID + " for connection: " + connection); return object; } });
protected Registration readName (Input input) { int nameId = input.readVarInt(true); if (nameIdToClass == null) nameIdToClass = new IntMap(); Class type = nameIdToClass.get(nameId); if (type == null) { // Only read the class name the first time encountered in object graph. String className = input.readString(); type = getTypeByName(className); if (type == null) { try { type = Class.forName(className, false, kryo.getClassLoader()); } catch (ClassNotFoundException ex) { if (WARN) warn("kryo", "Unable to load class " + className + " with kryo's ClassLoader. Retrying with current.."); try { type = Class.forName(className); } catch (ClassNotFoundException e) { throw new KryoException("Unable to find class: " + className, ex); } } if (nameToClass == null) nameToClass = new ObjectMap(); nameToClass.put(className, type); } nameIdToClass.put(nameId, type); if (TRACE) trace("kryo", "Read class name: " + className); } else { if (TRACE) trace("kryo", "Read class name reference " + nameId + ": " + className(type)); } return kryo.getRegistration(type); }
protected Registration readName (Input input) { int nameId = input.readVarInt(true); if (nameIdToClass == null) nameIdToClass = new IntMap(); Class type = nameIdToClass.get(nameId); if (type == null) { // Only read the class name the first time encountered in object graph. String className = input.readString(); type = getTypeByName(className); if (type == null) { try { type = Class.forName(className, false, kryo.getClassLoader()); } catch (ClassNotFoundException ex) { if (WARN) warn("kryo", "Unable to load class " + className + " with kryo's ClassLoader. Retrying with current.."); try { type = Class.forName(className); } catch (ClassNotFoundException e) { throw new KryoException("Unable to find class: " + className, ex); } } if (nameToClass == null) nameToClass = new ObjectMap(); nameToClass.put(className, type); } nameIdToClass.put(nameId, type); if (TRACE) trace("kryo", "Read class name: " + className); } else { if (TRACE) trace("kryo", "Read class name reference " + nameId + ": " + className(type)); } return kryo.getRegistration(type); }
} catch (ClassNotFoundException ex) { if (WARN) warn("kryo", "Unable to load class " + className + " with kryo's ClassLoader. Retrying with current.."); try {