You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by ti...@apache.org on 2019/08/24 04:33:33 UTC
svn commit: r1865803 -
/pdfbox/branches/issue4569/debugger/src/main/java/org/apache/pdfbox/debugger/streampane/StreamPane.java
Author: tilman
Date: Sat Aug 24 04:33:33 2019
New Revision: 1865803
URL: http://svn.apache.org/viewvc?rev=1865803&view=rev
Log:
PDFBOX-4071: improve logging
Modified:
pdfbox/branches/issue4569/debugger/src/main/java/org/apache/pdfbox/debugger/streampane/StreamPane.java
Modified: pdfbox/branches/issue4569/debugger/src/main/java/org/apache/pdfbox/debugger/streampane/StreamPane.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/issue4569/debugger/src/main/java/org/apache/pdfbox/debugger/streampane/StreamPane.java?rev=1865803&r1=1865802&r2=1865803&view=diff
==============================================================================
--- pdfbox/branches/issue4569/debugger/src/main/java/org/apache/pdfbox/debugger/streampane/StreamPane.java (original)
+++ pdfbox/branches/issue4569/debugger/src/main/java/org/apache/pdfbox/debugger/streampane/StreamPane.java Sat Aug 24 04:33:33 2019
@@ -43,6 +43,8 @@ import javax.swing.text.Style;
import javax.swing.text.StyleConstants;
import javax.swing.text.StyleContext;
import javax.swing.text.StyledDocument;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.apache.pdfbox.contentstream.operator.Operator;
import org.apache.pdfbox.contentstream.operator.OperatorName;
import org.apache.pdfbox.cos.COSArray;
@@ -68,6 +70,8 @@ import org.apache.pdfbox.util.Charsets;
*/
public class StreamPane implements ActionListener
{
+ private static final Log LOG = LogFactory.getLog(StreamPane.class);
+
private static final StyleContext CONTEXT = StyleContext.getDefaultStyleContext();
private static final Style OPERATOR_STYLE = CONTEXT.addStyle("operator", null);
private static final Style NUMBER_STYLE = CONTEXT.addStyle("number", null);
@@ -189,7 +193,7 @@ public class StreamPane implements Actio
}
catch (IOException e)
{
- e.printStackTrace();
+ LOG.error(e.getMessage(), e);
}
}
}
@@ -248,7 +252,8 @@ public class StreamPane implements Actio
String encoding = "ISO-8859-1";
synchronized (stream)
{
- if (stream.isXmlMetadata()) {
+ if (stream.isXmlMetadata())
+ {
encoding = "UTF-8";
}
InputStream inputStream = stream.getStream(filterKey);
@@ -274,7 +279,7 @@ public class StreamPane implements Actio
}
catch (InterruptedException | ExecutionException e)
{
- e.printStackTrace();
+ LOG.error(e.getMessage(), e);
}
}
@@ -288,7 +293,7 @@ public class StreamPane implements Actio
}
catch (IOException e)
{
- e.printStackTrace();
+ LOG.error(e.getMessage(), e);
return null;
}
}
@@ -305,7 +310,7 @@ public class StreamPane implements Actio
}
catch (BadLocationException e)
{
- e.printStackTrace();
+ LOG.error(e.getMessage(), e);
}
}
return docu;
@@ -348,7 +353,7 @@ public class StreamPane implements Actio
}
catch (BadLocationException e)
{
- e.printStackTrace();
+ LOG.error(e.getMessage(), e);
}
}