Project

General

Profile

« Previous | Next » 

Revision 5752

use detected XML encoding when reading/writing files
use UTF-8 as default when performing queries in the DB (assume DB is using UTF-8)
remove as many PrintWriters (uses system default character encoding only) as possible and construct OutputStreamWriters where explicit encoding can be given.
http://bugzilla.ecoinformatics.org/show_bug.cgi?id=2495

View differences:

McdbException.java
27 27

  
28 28
package edu.ucsb.nceas.metacat;
29 29

  
30
import java.io.IOException;
30 31
import java.io.PrintWriter;
32
import java.io.Writer;
31 33

  
32 34
/**
33 35
 * Exception thrown when an error occurs because a problem occurred in
......
113 115
   * is null, and if the tunnelled exception is not null, then
114 116
   * it returns the message from the tunnelled exception.
115 117
   */
116
  public void toXml(PrintWriter pw) {
118
  public void toXml(Writer pw) {
117 119
    String msg = super.getMessage();
118 120

  
119 121
    if (msg == null && exception != null) {
120 122
      msg = exception.getMessage();
121 123
    }
122 124

  
123
    pw.println("<?xml version=\"1.0\"?>");
124
    pw.println("<error>" + msg + "</error>");
125
    pw.flush();
125
    try {
126
		pw.write("<?xml version=\"1.0\"?>");
127
		pw.write("<error>" + msg + "</error>");
128
	    pw.flush();
129
	} catch (IOException e) {
130
		e.printStackTrace();
131
	}
132
    
126 133
  }
127 134
}

Also available in: Unified diff