<commit_before>/*
 * $Id$
 *
 * Copyright (c) 2008 by <NAME>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License (LGPL) as published by the Free Software Foundation.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this library; if not, copies are available
 * at http://www.opensource.org.
 */
package VASSAL.tools;

import java.awt.Component;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Frame;
import java.awt.event.ActionEvent;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.GregorianCalendar;

import javax.swing.AbstractAction;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;

import org.jdesktop.layout.GroupLayout;
import org.jdesktop.layout.LayoutStyle;

import VASSAL.Info;
import VASSAL.tools.swing.FlowLabel;

/**
 * 
 * @author <NAME>
 * @since 3.1.0
 */
public class BugDialog {
  private static final long serialVersionUID = 1L;

  public static void reportABug() {
/*
    reportABug(GameModule.getGameModule() == null
      ? null : GameModule.getGameModule().getFrame());
*/
// FIXME: do something to find our top-level frame

    final GregorianCalendar expiry = new GregorianCalendar(2008, 8, 5);
    final GregorianCalendar now = new GregorianCalendar();

    if (now.after(expiry)) oldReportABug(null);
    else reportABug(null);
  }

  public static void oldReportABug(Frame parent) {
    final JDialog dialog;

    final JLabel header = new JLabel("Congratulations! You've found a bug.");
    final Font f = header.getFont();
    header.setFont(f.deriveFont(Font.BOLD, f.getSize()*1.2f));

    final FlowLabel notice = new FlowLabel("VASSAL had an internal error. Becasue this beta version of VASSAL is more than 30 days old, bug reporting is disabled. If you can reproduce this bug with a current verision of VASSAL, please do so and alert the VASSAL developers to the problem.");

    // prevents FlowLabel from being a single line
    // FIXME: why is this necessary?
    final Dimension d = notice.getPreferredSize();
    d.width = 0;
    notice.setPreferredSize(d);

    String tmp = null;
    FileReader r = null;
    try {
      r = new FileReader(new File(Info.getConfDir(), "errorLog"));
      tmp = IOUtils.toString(r);
    }
    catch (IOException e) {
      // Don't bother logging this---if we can't read the errorLog,
      // then we probably can't write to it either.<commit_msg>Fixed typo.<commit_after>/*
 * $Id$
 *
 * Copyright (c) 2008 by <NAME>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License (LGPL) as published by the Free Software Foundation.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this library; if not, copies are available
 * at http://www.opensource.org.
 */
package VASSAL.tools;

import java.awt.Component;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Frame;
import java.awt.event.ActionEvent;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.GregorianCalendar;

import javax.swing.AbstractAction;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;

import org.jdesktop.layout.GroupLayout;
import org.jdesktop.layout.LayoutStyle;

import VASSAL.Info;
import VASSAL.tools.swing.FlowLabel;

/**
 * 
 * @author <NAME>
 * @since 3.1.0
 */
public class BugDialog {
  private static final long serialVersionUID = 1L;

  public static void reportABug() {
/*
    reportABug(GameModule.getGameModule() == null
      ? null : GameModule.getGameModule().getFrame());
*/
// FIXME: do something to find our top-level frame

    final GregorianCalendar expiry = new GregorianCalendar(2008, 8, 5);
    final GregorianCalendar now = new GregorianCalendar();

    if (now.after(expiry)) oldReportABug(null);
    else reportABug(null);
  }

  public static void oldReportABug(Frame parent) {
    final JDialog dialog;

    final JLabel header = new JLabel("Congratulations! You've found a bug.");
    final Font f = header.getFont();
    header.setFont(f.deriveFont(Font.BOLD, f.getSize()*1.2f));

    final FlowLabel notice = new FlowLabel("VASSAL had an internal error. Because this beta version of VASSAL is more than 30 days old, bug reporting is disabled. If you can reproduce this bug with a current verision of VASSAL, please do so and alert the VASSAL developers to the problem.");

    // prevents FlowLabel from being a single line
    // FIXME: why is this necessary?
    final Dimension d = notice.getPreferredSize();
    d.width = 0;
    notice.setPreferredSize(d);

    String tmp = null;
    FileReader r = null;
    try {
      r = new FileReader(new File(Info.getConfDir(), "errorLog"));
      tmp = IOUtils.toString(r);
    }
    catch (IOException e) {
      // Don't bother logging this---if we can't read the errorLog,
      // then we probably can't write to it either.
{'fraction_non_alphanumeric': 0.09556697719241888, 'fraction_numerical': 0.006103437198843559, 'mean_word_length': 3.861046057767369, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2467436', 'n_tokens_mistral': 1865, 'n_tokens_neox': 1799, 'n_words': 652}