Changeset d7a84c88 for apps/jrobin


Ignore:
Timestamp:
Nov 12, 2016 12:29:30 PM (5 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
6acc23af
Parents:
aeeee0e
Message:

JRobin: Move DeallocationHelper? logging from wrapper log to router log
Fix redundant cast

Location:
apps/jrobin/java
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • apps/jrobin/java/build.xml

    raeeee0e rd7a84c88  
    1414            srcdir="./src"
    1515            destdir="./build/obj" >
     16            <classpath>
     17                <pathelement location="../../../core/java/build/i2p.jar" />
     18            </classpath>
    1619        </depend>
    1720    </target>
     
    3336            includes="**/*.java" >
    3437            <compilerarg line="${javac.compilerargs}" />
     38            <classpath>
     39                <pathelement location="../../../core/java/build/i2p.jar" />
     40            </classpath>
    3541        </javac>
    3642    </target>
     
    5561        <jar destfile="./build/jrobin.jar" basedir="./build/obj" includes="**/*.class">
    5662            <manifest>
     63                <attribute name="Class-Path" value="i2p.jar" />
    5764                <attribute name="Implementation-Version" value="1.6.0-1" />
    5865                <attribute name="Built-By" value="${build.built-by}" />
  • apps/jrobin/java/src/engine/misc/DeallocationHelper.java

    raeeee0e rd7a84c88  
    3232import java.util.Map.Entry;
    3333import java.util.Set;
    34 import java.util.logging.Level;
    35 import java.util.logging.Logger;
     34
     35import net.i2p.I2PAppContext;
     36import net.i2p.util.Log;
     37
    3638
    3739/**
     
    5759public class DeallocationHelper {
    5860
     61    private final Log logger = I2PAppContext.getGlobalContext().logManager().getLog(DeallocationHelper.class);
     62
    5963    /**
    6064     * tool responsible for releasing the native memory of a deallocatable byte
     
    6266     */
    6367    public static abstract class Deallocator {
     68
     69        protected final Log logger = I2PAppContext.getGlobalContext().logManager().getLog(DeallocationHelper.class);
    6470
    6571        public Deallocator() {
     
    102108                }
    103109            } catch (ClassNotFoundException | NoSuchMethodException e) {
    104                 logger.log(Level.WARNING,
     110                logger.warn(
    105111                        "The initialization of the deallocator for Oracle Java, Sun Java and OpenJDK has failed", e);
    106112            }
     
    123129                    }
    124130                } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
    125                     logger.log(Level.WARNING, "The deallocation of a direct NIO buffer has failed", e);
     131                    logger.warn("The deallocation of a direct NIO buffer has failed", e);
    126132                } finally {
    127133                    directByteBufferCleanerMethod.setAccessible(directByteBufferCleanerMethodWasAccessible);
     
    143149                directByteBufferFreeMethod = directByteBufferClass.getDeclaredMethod("free");
    144150            } catch (ClassNotFoundException | NoSuchMethodException e) {
    145                 logger.log(Level.WARNING, "The initialization of the deallocator for Android has failed", e);
     151                logger.warn("The initialization of the deallocator for Android has failed", e);
    146152            }
    147153        }
     
    157163                    success = true;
    158164                } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
    159                     logger.log(Level.WARNING, "The deallocation of a direct NIO buffer has failed", e);
     165                    logger.warn("The deallocation of a direct NIO buffer has failed", e);
    160166                } finally {
    161167                    directByteBufferFreeMethod.setAccessible(directByteBufferFreeMethodWasAccessible);
     
    181187                bufferAddressField = Buffer.class.getDeclaredField("address");
    182188            } catch (ClassNotFoundException | NoSuchMethodException | NoSuchFieldException e) {
    183                 logger.log(Level.WARNING, "The initialization of the deallocator for GNU Classpath has failed", e);
     189                logger.warn("The initialization of the deallocator for GNU Classpath has failed", e);
    184190            }
    185191        }
     
    200206                    }
    201207                } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
    202                     logger.log(Level.WARNING, "The deallocation of a direct NIO buffer has failed", e);
     208                    logger.warn("The deallocation of a direct NIO buffer has failed", e);
    203209                } finally {
    204210                    bufferAddressField.setAccessible(bufferAddressFieldWasAccessible);
     
    220226                directByteBufferFreeMethod = directByteBufferClass.getDeclaredMethod("free");
    221227            } catch (ClassNotFoundException | NoSuchMethodException e) {
    222                 logger.log(Level.WARNING, "The initialization of the deallocator for Apache Harmony has failed", e);
     228                logger.warn("The initialization of the deallocator for Apache Harmony has failed", e);
    223229            }
    224230        }
     
    234240                    success = true;
    235241                } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
    236                     logger.log(Level.WARNING, "The deallocation of a direct NIO buffer has failed", e);
     242                    logger.warn("The deallocation of a direct NIO buffer has failed", e);
    237243                } finally {
    238244                    directByteBufferFreeMethod.setAccessible(directByteBufferFreeMethodWasAccessible);
     
    242248        }
    243249    }
    244 
    245     private static final Logger logger = Logger.getLogger(DeallocationHelper.class.getName());
    246250
    247251    private Map<Class<?>, Field> attachmentOrByteBufferFieldMap;
     
    432436                            superClassesMsg = builder.toString();
    433437                        }
    434                         logger.warning("The field " + fieldname + " hasn't been found in the class " + classname
     438                        logger.warn("The field " + fieldname + " hasn't been found in the class " + classname
    435439                                + superClassesMsg);
    436440                    } else {// the field has been found, stores it into the map
     
    450454                            + " hasn't been found while initializing the deallocator. Java vendor: " + javaVendor
    451455                            + " Java version: " + javaVersion;
    452                     logger.log(Level.WARNING, msg, cnfe);
     456                    logger.warn(msg, cnfe);
    453457                }
    454458            }
     
    568572                                }
    569573                            } catch (IllegalAccessException iae) {
    570                                 logger.log(Level.WARNING, "Cannot access the field " + field.getName()
     574                                logger.warn("Cannot access the field " + field.getName()
    571575                                        + " of the class " + bufferIntermediaryClass.getName(), iae);
    572576                            } finally {
     
    595599                        + " hasn't been found while initializing the deallocator. Java vendor: " + javaVendor
    596600                        + " Java version: " + javaVersion;
    597                 logger.log(Level.WARNING, msg, cnfe);
     601                logger.warn(msg, cnfe);
    598602            }
    599603            if (directByteBufferClass != null)
     
    608612                        + " hasn't been found while initializing the deallocator. Java vendor: " + javaVendor
    609613                        + " Java version: " + javaVersion;
    610                 logger.log(Level.WARNING, msg, cnfe);
     614                logger.warn(msg, cnfe);
    611615            }
    612616            if (readOnlyDirectByteBufferClass != null)
     
    620624                        + " hasn't been found while initializing the deallocator. Java vendor: " + javaVendor
    621625                        + " Java version: " + javaVersion;
    622                 logger.log(Level.WARNING, msg, cnfe);
     626                logger.warn(msg, cnfe);
    623627            }
    624628            if (readWriteDirectByteBufferClass != null)
     
    633637                        + " hasn't been found while initializing the deallocator. Java vendor: " + javaVendor
    634638                        + " Java version: " + javaVersion;
    635                 logger.log(Level.WARNING, msg, cnfe);
     639                logger.warn(msg, cnfe);
    636640            }
    637641            if (readOnlyDirectByteBufferClass != null)
     
    645649                        + " hasn't been found while initializing the deallocator. Java vendor: " + javaVendor
    646650                        + " Java version: " + javaVersion;
    647                 logger.log(Level.WARNING, msg, cnfe);
     651                logger.warn(msg, cnfe);
    648652            }
    649653            if (readWriteDirectByteBufferClass != null)
     
    731735                    deallocatableDirectByteBuffer = null;
    732736                    final String bufferClassName = bufferClass.getName();
    733                     logger.warning("No deallocatable buffer has been found for an instance of the class "
     737                    logger.warn("No deallocatable buffer has been found for an instance of the class "
    734738                            + bufferClassName + " whereas it is a direct NIO buffer");
    735739                }
  • apps/jrobin/java/src/org/jrobin/core/jrrd/RRDFile.java

    raeeee0e rd7a84c88  
    189189                        System.out.println(value);
    190190                }
    191                 return (int)value;
     191                return value;
    192192        }
    193193
Note: See TracChangeset for help on using the changeset viewer.