private int counter;
/**
- * OutputStream that simply counts lineends
+ * return an OutputStream that simply counts lineends
*/
- private OutputStream stream = new OutputStream() {
- private static final int searchedByte = '\n';
-
- @Override
- public void write(int b) throws IOException {
- if (b == searchedByte) {
- counter++;
- }
- }
- };
-
public OutputStream receiveUpload(String filename, String MIMEType) {
counter = 0;
fileName = filename;
mtype = MIMEType;
- return stream;
+ return new OutputStream() {
+ private static final int searchedByte = '\n';
+
+ @Override
+ public void write(int b) throws IOException {
+ if (b == searchedByte) {
+ counter++;
+ }
+ }
+ };
}
public String getFileName() {
private boolean sleep;
/**
- * OutputStream that simply counts lineends
+ * return an OutputStream that simply counts lineends
*/
- private OutputStream stream = new OutputStream() {
- private static final int searchedByte = '\n';
-
- @Override
- public void write(int b) throws IOException {
- total++;
- if (b == searchedByte) {
- counter++;
- }
- if (sleep && total % 1000 == 0) {
- try {
- Thread.sleep(100);
- } catch (InterruptedException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
- }
- };
-
public OutputStream receiveUpload(String filename, String MIMEType) {
counter = 0;
total = 0;
fileName = filename;
mtype = MIMEType;
- return stream;
+ return new OutputStream() {
+ private static final int searchedByte = '\n';
+
+ @Override
+ public void write(int b) throws IOException {
+ total++;
+ if (b == searchedByte) {
+ counter++;
+ }
+ if (sleep && total % 1000 == 0) {
+ try {
+ Thread.sleep(100);
+ } catch (InterruptedException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+ }
+ };
}
public String getFileName() {
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
+import java.io.NotSerializableException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.Date;
"Deadline Exceeded",
"I'm sorry, but the operation took too long to complete. We'll try reloading to see where we're at, please take note of any unsaved data...",
"", null);
+ } catch (NotSerializableException e) {
+ // TODO i18n?
+ // TODO this notification is not shown - solve this in some other
+ // way...
+ criticalNotification(
+ request,
+ response,
+ "NotSerializableException",
+ "I'm sorry, but there seems to be a serious problem, please contact the administrator. And please take note of any unsaved data...",
+ "", getApplicationUrl(request).toString()
+ + "?restartApplication");
+ e.printStackTrace(System.err);
} finally {
// "Next, please!"
if (locked) {