<commit_before>package com.inmobi.grill.cli.client;

import com.inmobi.grill.client.GrillClient;
import com.inmobi.grill.client.exceptions.GrillClientServerConnectionException;

import java.io.Console;
/*
 * #%L
 * Grill client
 * %%
 * Copyright (C) 2014 Inmobi
 * %%
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * #L%
 */
public enum GrillClientWrapper {
  INSTANCE;
  protected GrillClient client;
  protected String username;
  protected String password;
  GrillClientWrapper() {
    try {
      client = new GrillClient();
    } catch(GrillClientServerConnectionException e) {
      // Connecting without password prompt failed.
      for(int i = 0; i < 3; i++) {
        getCredentials();
        try{
          client = new GrillClient(username, password);
        } catch(GrillClientServerConnectionException grillClientServerConnectionException) {
          explainFailedAttempt(grillClientServerConnectionException);
        }
      }
    }
  }
  public void explainFailedAttempt(GrillClientServerConnectionException e) {
    switch(e.getErrorCode()) {
      case 401:
        System.console().printf("username/password combination incorrect.");
        break;
      case 500:
        System.console().printf("server unresponsive, Returned error code 500");
        break;
      default:
        System.console().printf("Unknown error in authenticating with the server. Error code = %d", e.getErrorCode());
    }
  }
  public void getCredentials(){
    Console console = System.console();
    if (console == null) {
      System.err.println("Couldn't get Console instance");
      System.exit(-1);
    }
    console.printf("username:");
    username = console.readLine();
    char passwordArray[] = console.readPassword("password:");
    password = new String(passwordArray);
  }

  public GrillClient getClient() {<commit_msg>small modification<commit_after>package com.inmobi.grill.cli.client;

import com.inmobi.grill.client.GrillClient;
import com.inmobi.grill.client.exceptions.GrillClientServerConnectionException;

import java.io.Console;
/*
 * #%L
 * Grill client
 * %%
 * Copyright (C) 2014 Inmobi
 * %%
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * #L%
 */
public enum GrillClientWrapper {
  INSTANCE;
  protected GrillClient client;
  protected String username;
  protected String password;
  GrillClientWrapper() {
    try {
      client = new GrillClient();
    } catch(GrillClientServerConnectionException e) {
      // Connecting without password prompt failed.
      for(int i = 0; i < 3; i++) {
        getCredentials();
        try{
          client = new GrillClient(username, password);
        } catch(GrillClientServerConnectionException grillClientServerConnectionException) {
          explainFailedAttempt(grillClientServerConnectionException);
        }
      }
    }
  }
  public void explainFailedAttempt(GrillClientServerConnectionException e) {
    switch(e.getErrorCode()) {
      case 401:
        System.console().printf("username/password combination incorrect.\n");
        break;
      case 500:
        System.console().printf("server unresponsive, Returned error code 500\n");
        break;
      default:
        System.console().printf("Unknown error in authenticating with the server. Error code = %d\n", e.getErrorCode());
    }
  }
  public void getCredentials(){
    Console console = System.console();
    if (console == null) {
      System.err.println("Couldn't get Console instance");
      System.exit(-1);
    }
    console.printf("username:");
    username = console.readLine();
    char passwordArray[] = console.readPassword("password:");
    password = new String(passwordArray);
  }

  public GrillClient getClient() {
{'fraction_non_alphanumeric': 0.1008706731790189, 'fraction_numerical': 0.00849437247823317, 'mean_word_length': 3.3732590529247912, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '5631055', 'n_tokens_mistral': 1292, 'n_tokens_neox': 1251, 'n_words': 385}