@Override public void setEncoding(String encoding) throws SecurityException, UnsupportedEncodingException { super.setEncoding(encoding); Handler t = resolve(); if(t!=null) t.setEncoding(encoding); }
/** * Sets the character encoding used by this handler. A {@code null} value * indicates that the default encoding should be used. * * @throws UnsupportedEncodingException if {@code charsetName} is not supported. */ @Override public void setEncoding(String charsetName) throws UnsupportedEncodingException { // Flush any existing data first. this.flush(); super.setEncoding(charsetName); // renew writer only if the writer exists if (this.writer != null) { if (getEncoding() == null) { this.writer = new OutputStreamWriter(this.os); } else { try { this.writer = new OutputStreamWriter(this.os, getEncoding()); } catch (UnsupportedEncodingException e) { /* * Should not happen because it's checked in * super.initProperties(). */ throw new AssertionError(e); } } } }
protected static Handler makeLogger(String logName, Logger heliumRecordLog) { CspFormatter formatter = new CspFormatter(); String fileName = LogBase.getLogBaseDir() + logName; if (isLogNameUsePid()) { fileName += ".pid" + PidUtil.getPid(); } Handler handler = null; try { handler = new DateFileLogHandler(fileName + ".%d", 1024 * 1024 * 200, 4, true); handler.setFormatter(formatter); handler.setEncoding(LOG_CHARSET); } catch (IOException e) { e.printStackTrace(); } if (handler != null) { LoggerUtils.disableOtherHandlers(heliumRecordLog, handler); } heliumRecordLog.setLevel(Level.ALL); return handler; } }
/** * Set the character encoding used by this Handler. */ public void setEncoding(String encoding) throws SecurityException, UnsupportedEncodingException { handler.setEncoding(encoding); }
/** * {@inheritDoc} */ public void setEncoding(String encoding) throws java.io.UnsupportedEncodingException { handler.setEncoding(encoding); }
@Override public void setEncoding(String encoding) throws SecurityException, UnsupportedEncodingException { if (this.delegate != null) this.delegate.setEncoding(encoding); }
/** * {@inheritDoc} */ public void setEncoding(String encoding) throws java.io.UnsupportedEncodingException { handler.setEncoding(encoding); }
public void setEncoding(T handler, String encoding) throws SecurityException, UnsupportedEncodingException { handler.setEncoding(encoding); }
/** * {@inheritDoc} */ public void setEncoding(String encoding) throws java.io.UnsupportedEncodingException { handler.setEncoding(encoding); }
@Override public void setEncoding(String encoding) throws SecurityException, UnsupportedEncodingException { super.setEncoding(encoding); Handler t = resolve(); if(t!=null) t.setEncoding(encoding); }
@Override public void setEncoding(String encoding) throws SecurityException, UnsupportedEncodingException { super.setEncoding(encoding); Handler t = resolve(); if (t != null) { t.setEncoding(encoding); } }
@Override public void setEncoding(String encoding) throws SecurityException, UnsupportedEncodingException { super.setEncoding(encoding); Handler t = resolve(); if(t!=null) t.setEncoding(encoding); }
@Override public void setEncoding(String encoding) throws SecurityException, UnsupportedEncodingException { super.setEncoding(encoding); Handler t = resolve(); if(t!=null) t.setEncoding(encoding); }
@Override public void setEncoding(String encoding) throws SecurityException, UnsupportedEncodingException { super.setEncoding(encoding); Handler t = resolve(); if(t!=null) t.setEncoding(encoding); }
@Override public void setEncoding(final String encoding) throws SecurityException, UnsupportedEncodingException { checkAccess(this); super.setEncoding(encoding); }
@Override public void setEncoding(@Nullable String encoding) throws SecurityException, UnsupportedEncodingException { if (this.delegate != null) this.delegate.setEncoding(encoding); }
public void applyPostCreate(final Void param) { try { configuration.getHandlerRefs().get(getName()).setEncoding(encoding); } catch (UnsupportedEncodingException e) { throw new IllegalArgumentException(String.format("The encoding value '%s' is invalid.", encoding), e); } }
public void init () { try { if (!Boolean.getBoolean("com.samskivert.util.JDK14Logger.noFormatter")) { OneLineLogFormatter.configureDefaultHandler(); } boolean reportedUTF8Missing = false; for (Handler handler : java.util.logging.Logger.getLogger("").getHandlers()) { try { handler.setEncoding("UTF-8"); } catch (UnsupportedEncodingException e) { // JVMs are required to support UTF-8 so this shouldn't happen, but if it does, // tell somebody that things are really fucked if (!reportedUTF8Missing) { reportedUTF8Missing = true; System.err.println("Unable to find UTF-8 encoding. " + "This JVM ain't right: " + e.getMessage()); } } } } catch (SecurityException se) { // running in sandbox; no custom logging; no problem! } }
private void initEncoding(LogManager manager, String p) { assert Thread.holdsLock(this); try { super.setEncoding(manager.getProperty(p.concat(".encoding"))); } catch (final SecurityException SE) { throw SE; //Avoid catch all. } catch (final UnsupportedEncodingException UEE) { reportError(UEE.getMessage(), UEE, ErrorManager.OPEN_FAILURE); } catch (final RuntimeException RE) { reportError(RE.getMessage(), RE, ErrorManager.OPEN_FAILURE); } }
@Override public void setEncoding(String charsetName) throws UnsupportedEncodingException { // Flush any existing data first. this.flush(); super.setEncoding(charsetName); // renew writer only if the writer exists if (this.writer != null) { if (getEncoding() == null) { this.writer = new OutputStreamWriter(this.os); } else { try { this.writer = new OutputStreamWriter(this.os, getEncoding()); } catch (UnsupportedEncodingException e) { throw new AssertionError(e); } } } }