APISonar


org.apache.poi.util.POILogger.log

> org > apache > poi > util > POILogger > log
org APIs apache APIs poi APIs util APIs POILogger APIs log APIs

Example 1
private static final POILogger LOG = POILogFactory.getLogger(SLGraphics.class);

    public boolean drawImage(Image img, AffineTransform xform, ImageObserver obs) {
        if (LOG.check(POILogger.WARN)) {
            LOG.log(POILogger.WARN, "Not implemented");
        }
        return false;
    }
Example 2
private static final POILogger LOG = POILogFactory.getLogger(SXSSFWorkbookWithCustomZipEntrySource.class);

    protected SheetDataWriter createSheetDataWriter() throws IOException {
        //log values to ensure these values are accessible to subclasses
        LOG.log(POILogger.INFO, "isCompressTempFiles: " + isCompressTempFiles());
        LOG.log(POILogger.INFO, "SharedStringSource: " + getSharedStringSource());
        return new SheetDataWriterWithDecorator();
    }
Example 3
private static POILogger   log = POILogFactory.getLogger(Workbook.class);

    public int getNumSheets() {
        if (log.check( POILogger.DEBUG ))
            log.log(DEBUG, "getNumSheets=", new Integer(boundsheets.size()));
        return boundsheets.size();
    }
Example 4
private static final POILogger LOG = POILogFactory.getLogger(OOXMLSignatureFacet.class);

    public void preSign(
        Document document
        , List<Reference> references
        , List<XMLObject> objects)
    throws XMLSignatureException {
        LOG.log(POILogger.DEBUG, "pre sign");
        addManifestObject(document, references, objects);
        addSignatureInfo(document, references, objects);
    }
Example 5
private static final POILogger LOG = POILogFactory.getLogger(XSSFExportToXml.class);

    private static void trySet(String name, SecurityFeature securityFeature) {
        try {
            securityFeature.accept(name);
        } catch (Exception e) {
            LOG.log(POILogger.WARN, "SchemaFactory feature unsupported", name, e);
        } catch (AbstractMethodError ame) {
            LOG.log(POILogger.WARN, "Cannot set SchemaFactory feature because outdated XML parser in classpath", name, ame);
        }
    }
Example 6
public static void main(String[] args)
    throws IOException, IllegalAccessException, InvocationTargetException, NoSuchMethodException {
        POILogger LOGGER = POILogFactory.getLogger(Outlines.class);
        for (int i=1; i<=13; i++) {
            Outlines o = new Outlines();
            try {
                String log = (String)Outlines.class.getDeclaredMethod("test"+i).invoke(o);
                String filename = "outline"+i+".xls";
                o.writeOut(filename);
                LOGGER.log(POILogger.INFO, filename+" written. "+log);
            } finally {
                o.close();
            }
        }
    }
Example 7
private static final POILogger LOG = POILogFactory.getLogger(RelationshipTransformService.class);

    public Data transform(Data data, XMLCryptoContext context, OutputStream os) throws TransformException {
        LOG.log(POILogger.DEBUG, "transform(data,context,os)");
        return null;
    }
Example 8
private static POILogger            log              = POILogFactory.getLogger(Sheet.class);

    public static Sheet createSheet(List records, int sheetnum)
    {
        if (log.check( POILogger.DEBUG ))
            log.log(POILogger.DEBUG,
                    "Sheet createSheet (exisiting file) assumed offset 0");
        return createSheet(records, sheetnum, 0);
    }
Example 9
private static final POILogger LOG = POILogFactory.getLogger(RelationshipTransformService.class);

    public void marshalParams(XMLStructure parent, XMLCryptoContext context) throws MarshalException {
        LOG.log(POILogger.DEBUG, "marshallParams(parent,context)");
        DOMStructure domParent = (DOMStructure) parent;
        Element parentNode = (Element)domParent.getNode();
        // parentNode.setAttributeNS(XML_NS, "xmlns:mdssi", XML_DIGSIG_NS);
        Document doc = parentNode.getOwnerDocument();
        
        for (String sourceId : this.sourceIds) {
            RelationshipReferenceDocument relRef = RelationshipReferenceDocument.Factory.newInstance();
            relRef.addNewRelationshipReference().setSourceId(sourceId);
            Node n = relRef.getRelationshipReference().getDomNode();
            n = doc.importNode(n, true);
            parentNode.appendChild(n);
        }
    }
Example 10
private static final POILogger LOG = POILogFactory.getLogger(SignatureConfig.class);

    public void setExecutionTime(String executionTime) {
        if (executionTime != null && !"".equals(executionTime)){
            final DateFormat fmt = new SimpleDateFormat(SIGNATURE_TIME_FORMAT, Locale.ROOT);
            fmt.setTimeZone(LocaleUtil.TIMEZONE_UTC);
            try {
                this.executionTime = fmt.parse(executionTime);
            } catch (ParseException e) {
                LOG.log(POILogger.WARN, "Illegal execution time: "+executionTime);
            }
        }
    }
Example 11
private static final POILogger LOG = POILogFactory.getLogger(NPOIFSFileSystem.class);

    private void closeInputStream(InputStream stream, boolean success) {
        try {
            stream.close();
        } catch (IOException e) {
            if(success) {
                throw new RuntimeException(e);
            }
            // else not success? Try block did not complete normally
            // just print stack trace and leave original ex to be thrown
            LOG.log(POILogger.ERROR, "can't close input stream", e);
        }
    }
Example 12
private static final POILogger log = POILogFactory.getLogger(EscherPictBlip.class);

    private static byte[] inflatePictureData(byte[] data) {
        try {
            InflaterInputStream in = new InflaterInputStream(new ByteArrayInputStream(data));
            ByteArrayOutputStream out = new ByteArrayOutputStream();
            byte[] buf = new byte[4096];
            int readBytes;
            while ((readBytes = in.read(buf)) > 0) {
                out.write(buf, 0, readBytes);
            }
            return out.toByteArray();
        } catch (IOException e) {
            log.log(POILogger.INFO, "Possibly corrupt compression or non-compressed data", e);
            return data;
        }
    }
Example 13
private static final POILogger LOG = POILogFactory.getLogger(AesZipFileZipEntrySource.class);

    public void close() throws IOException {
        if(!closed) {
            zipFile.close();
            if (!tmpFile.delete()) {
                LOG.log(POILogger.WARN, tmpFile.getAbsolutePath()+" can't be removed (or was already removed.");
            }
        }
        closed = true;
    }
Example 14
private static final POILogger LOG = POILogFactory.getLogger(SignatureInfo.class);

    private Element getDsigElement(final Document document, final String localName) {
        NodeList sigValNl = document.getElementsByTagNameNS(XML_DIGSIG_NS, localName);
        if (sigValNl.getLength() == 1) {
            return (Element)sigValNl.item(0);
        }

        LOG.log(POILogger.WARN, "Signature element '"+localName+"' was "+(sigValNl.getLength() == 0 ? "not found" : "multiple times"));
        
        return null;
    }
Example 15
private static final POILogger LOG = POILogFactory.getLogger(Property.class);

    private String decodeValueFromID() {
        try {
            switch((int)getID()) {
                case PropertyIDMap.PID_CODEPAGE:
                    return CodePageUtil.codepageToEncoding(((Number)value).intValue());
                case PropertyIDMap.PID_LOCALE:
                    return LocaleUtil.getLocaleFromLCID(((Number)value).intValue());
            }
        } catch (Exception e) {
            LOG.log(POILogger.WARN, "Can't decode id "+getID());
        }
        return null;
    }
Example 16
private final static POILogger LOG = POILogFactory.getLogger(PresetGeometries.class);

    public static CustomGeometry convertCustomGeometry(XMLStreamReader staxReader) {
        try {
            JAXBContext jaxbContext = JAXBContext.newInstance(BINDING_PACKAGE);
            Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
            JAXBElement<CTCustomGeometry2D> el = unmarshaller.unmarshal(staxReader, CTCustomGeometry2D.class);
            return new CustomGeometry(el.getValue());
        } catch (JAXBException e) {
            LOG.log(POILogger.ERROR, "Unable to parse single custom geometry", e);
            return null;
        }
    }
Example 17
private static POILogger            log              = POILogFactory.getLogger(Sheet.class);

    public void setLoc(int loc)
    {
        valueRecIterator = null;
        if (log.check( POILogger.DEBUG ))
            log.log(POILogger.DEBUG, "sheet.setLoc(): " + loc);
        this.loc = loc;
    }
Example 18
private static final POILogger LOG = POILogFactory.getLogger(OOXMLSignatureFacet.class);

    private static String normalizePartName(URI partName, String baseUri) throws XMLSignatureException {
        String pn = partName.toASCIIString();
        if (!pn.startsWith(baseUri)) {
            pn = baseUri + pn;
        }
        try {
            pn = new URI(pn).normalize().getPath().replace('\\', '/');
            LOG.log(POILogger.DEBUG, "part name: " + pn);
        } catch (URISyntaxException e) {
            throw new XMLSignatureException(e);
        }
        return pn;
    }
Example 19
private static POILogger   log = POILogFactory.getLogger(Workbook.class);

    public void setSheetBof(int sheetnum, int pos) {
        if (log.check( POILogger.DEBUG ))
            log.log(DEBUG, "setting bof for sheetnum =", new Integer(sheetnum),
                " at pos=", new Integer(pos));
        checkSheets(sheetnum);
        (( BoundSheetRecord ) boundsheets.get(sheetnum))
        .setPositionOfBof(pos);
    }
Example 20
private static final POILogger LOG = POILogFactory.getLogger(RelationshipTransformService.class);

    public void init(TransformParameterSpec params) throws InvalidAlgorithmParameterException {
        LOG.log(POILogger.DEBUG, "init(params)");
        if (!(params instanceof RelationshipTransformParameterSpec)) {
            throw new InvalidAlgorithmParameterException();
        }
        RelationshipTransformParameterSpec relParams = (RelationshipTransformParameterSpec) params;
        this.sourceIds.addAll(relParams.sourceIds);
    }
Example 21
private static final POILogger LOG = POILogFactory.getLogger(HSSFShape.class);

    public int getRotationDegree(){
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        EscherSimpleProperty property = getOptRecord().lookup(EscherProperties.TRANSFORM__ROTATION);
        if (null == property){
            return 0;
        }
        try {
            LittleEndian.putInt(property.getPropertyValue(), bos);
            return LittleEndian.getShort(bos.toByteArray(), 2);
        } catch (IOException e) {
            LOG.log(POILogger.ERROR, "can't determine rotation degree", e);
            return 0;
        }
    }
Example 22
private static POILogger            log              = POILogFactory.getLogger(Sheet.class);

    protected Record createProtect()
    {
        if (log.check( POILogger.DEBUG ))
            log.log(POILogger.DEBUG, "create protect record with protection disabled");
        ProtectRecord retval = new ProtectRecord();

        retval.setProtect(false);
        // by default even when we support encryption we won't
        return retval;
    }
Example 23
private static final POILogger LOG = POILogFactory.getLogger(ImageHeaderBitmap.class);

    public ImageHeaderBitmap(byte[] data, int offset) {
        BufferedImage img = null;
        try {
            img = ImageIO.read(new ByteArrayInputStream(data, offset, data.length-offset));
        } catch (IOException e) {
            LOG.log(POILogger.WARN, "Can't determine image dimensions", e);
        }
        // set dummy size, in case of dummy dimension can't be set
        size = (img == null)
            ? new Dimension(200,200)
            : new Dimension(
                (int)Units.pixelToPoints(img.getWidth()),
                (int)Units.pixelToPoints(img.getHeight())
            );
    }
Example 24
private static final POILogger LOG = POILogFactory.getLogger(TestEmptyDocument.class);

	public void testSingleEmptyDocumentEvent() throws IOException {
		POIFSFileSystem fs = new POIFSFileSystem();
		DirectoryEntry dir = fs.getRoot();
		dir.createDocument("Foo", 0, new POIFSWriterListener() {
			@Override
            public void processPOIFSWriterEvent(POIFSWriterEvent event) {
				LOG.log(POILogger.WARN, "written");
			}
		});

		ByteArrayOutputStream out = new ByteArrayOutputStream();
		fs.writeFilesystem(out);
		new POIFSFileSystem(new ByteArrayInputStream(out.toByteArray())).close();
		fs.close();
	}
Example 25
private static final POILogger LOG = POILogFactory.getLogger(TxMasterStyleAtom.class);

    protected TxMasterStyleAtom(byte[] source, int start, int len) {
        _header = new byte[8];
        System.arraycopy(source,start,_header,0,8);

        _data = new byte[len-8];
        System.arraycopy(source,start+8,_data,0,_data.length);

        //read available styles
        try {
            init();
        } catch (Exception e){
            LOG.log(POILogger.WARN, "Exception when reading available styles", e);
        }
    }