blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 332 | content_id stringlengths 40 40 | detected_licenses listlengths 0 50 | license_type stringclasses 2 values | repo_name stringlengths 7 115 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringclasses 557 values | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | star_events_count int64 0 77.7k | fork_events_count int64 0 48k | gha_license_id stringclasses 17 values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 82 values | src_encoding stringclasses 28 values | language stringclasses 1 value | is_vendor bool 1 class | is_generated bool 2 classes | length_bytes int64 7 5.41M | extension stringclasses 11 values | content stringlengths 7 5.41M | authors listlengths 1 1 | author stringlengths 0 161 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
cdb4cc4203326980c51bd290febed4094f12fdb7 | 082e26b011e30dc62a62fae95f375e4f87d9e99c | /docs/weixin_7.0.4_source/反编译源码/反混淆后/src/main/java/com/tencent/p177mm/p230g/p231a/C32565gq.java | c4907394d4dad519618fe65b72f8e05863d5cf11 | [] | no_license | xsren/AndroidReverseNotes | 9631a5aabc031006e795a112b7ac756a8edd4385 | 9202c276fe9f04a978e4e08b08e42645d97ca94b | refs/heads/master | 2021-04-07T22:50:51.072197 | 2019-07-16T02:24:43 | 2019-07-16T02:24:43 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 659 | java | package com.tencent.p177mm.p230g.p231a;
import com.tencent.matrix.trace.core.AppMethodBeat;
import com.tencent.p177mm.sdk.p600b.C4883b;
/* renamed from: com.tencent.mm.g.a.gq */
public final class C32565gq extends C4883b {
public C18277a cBo;
/* renamed from: com.tencent.mm.g.a.gq$a */
public static final class C18277a {
public String cBp;
public int type = 0;
}
public C32565gq() {
this((byte) 0);
}
private C32565gq(byte b) {
AppMethodBeat.m2504i(56560);
this.cBo = new C18277a();
this.xxG = false;
this.callback = null;
AppMethodBeat.m2505o(56560);
}
}
| [
"alwangsisi@163.com"
] | alwangsisi@163.com |
00478413f4ff0aa1ba1dbcaeeb33bbb5c9b9f588 | 928e36d300ebada4bad65d676a0f33da8d8ba5b2 | /app/src/main/java/com/tn3/mobile/hermes/dto/EmissorDestinatarioDTO.java | 0d9c31e377f1b8e5653c4a7a8d2b1194362444d8 | [] | no_license | cevargas/h-mobile | d2c5293cf5bef6a683259255b8ac811c147d5e6f | 849ee7f700e4f44de0d40d9f32e2d7ac12ba6bde | refs/heads/master | 2021-01-11T01:10:07.489941 | 2016-10-29T21:37:15 | 2016-10-29T21:37:15 | 71,052,993 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 692 | java | package com.tn3.mobile.hermes.dto;
public class EmissorDestinatarioDTO {
public int id;
public String nome;
public String cnpjCpf;
public CidadeDTO cidade;
public String logradouro;
public String logrCom;
public String logrNum;
public String bairro;
public EmissorDestinatarioDTO(int id, String nome, String cnpjCpf, CidadeDTO cidade, String logradouro, String logrCom, String logrNum, String bairro) {
this.id = id;
this.nome = nome;
this.cnpjCpf = cnpjCpf;
this.cidade = cidade;
this.logradouro = logradouro;
this.logrCom = logrCom;
this.logrNum = logrNum;
this.bairro = bairro;
}
}
| [
"cev@outlook.com"
] | cev@outlook.com |
b49007d6bce5ebd65707a5b594223dd6bee0b404 | bfdd1c6cc0279a0b3815d730f934a732d492cdbf | /src/main/java/payroll/payroll/EmployeeController.java | 2e596b4998ca4f868acfd8055468b37f2f6dcf77 | [] | no_license | praveenvem001/payroll | 620ba0437cef7e2eb8443d6d7e56dd0acbdbd18f | 75c4f7666bedc94c4b43af548add6b057d1dd142 | refs/heads/main | 2023-05-05T23:56:38.671159 | 2021-05-20T01:17:13 | 2021-05-20T01:17:13 | 368,367,798 | 0 | 1 | null | 2021-05-19T00:28:20 | 2021-05-18T01:35:38 | Java | UTF-8 | Java | false | false | 3,012 | java | package payroll.payroll;
import java.util.List;
import java.util.stream.Collectors;
import org.springframework.hateoas.CollectionModel;
import org.springframework.hateoas.EntityModel;
import org.springframework.hateoas.IanaLinkRelations;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.*;
@RestController
class EmployeeController {
private final EmployeeRepository repository;
private final EmployeeModelAssembler assembler;
EmployeeController(EmployeeRepository repository, EmployeeModelAssembler assembler) {
this.repository = repository;
this.assembler = assembler;
}
// Aggregate root
// tag::get-aggregate-root[]
@GetMapping("/employees")
CollectionModel<EntityModel<Employee>> all() {
List<EntityModel<Employee>> employees = repository.findAll().stream() //
.map(assembler::toModel) //
.collect(Collectors.toList());
return CollectionModel.of(employees, linkTo(methodOn(EmployeeController.class).all()).withSelfRel());
}
// end::get-aggregate-root[]
@PostMapping("/employees")
ResponseEntity<?> newEmployee(@RequestBody Employee newEmployee) {
EntityModel<Employee> entityModel = assembler.toModel(repository.save(newEmployee));
return ResponseEntity //
.created(entityModel.getRequiredLink(IanaLinkRelations.SELF).toUri()) //
.body(entityModel);
}
// Single item
@GetMapping("/employees/{id}")
EntityModel<Employee> one(@PathVariable Long id) {
Employee employee = repository.findById(id) //
.orElseThrow(() -> new EmployeeNotFoundException(id));
return assembler.toModel(employee);
}
@PutMapping("/employees/{id}")
ResponseEntity<?> replaceEmployee(@RequestBody Employee newEmployee, @PathVariable Long id) {
Employee updatedEmployee = repository.findById(id) //
.map(employee -> {
employee.setName(newEmployee.getName());
employee.setRole(newEmployee.getRole());
return repository.save(employee);
}) //
.orElseGet(() -> {
newEmployee.setId(id);
return repository.save(newEmployee);
});
EntityModel<Employee> entityModel = assembler.toModel(updatedEmployee);
return ResponseEntity //
.created(entityModel.getRequiredLink(IanaLinkRelations.SELF).toUri()) //
.body(entityModel);
}
@DeleteMapping("/employees/{id}")
ResponseEntity<?> deleteEmployee(@PathVariable Long id) {
repository.deleteById(id);
return ResponseEntity.noContent().build();
}
} | [
"praveen.vem001@gmail.com"
] | praveen.vem001@gmail.com |
4a60554be1e7239abcfcd605134b22dcb6b8f698 | 81614cf0e20c8d8c0df80fe3cfa9aebc83c8587b | /src/main/java/com/whx/RBTREEMap.java | 24d6ea48a3f96d28e6faf68c7ca83e04ecaf0413 | [] | no_license | pantherlion/datastruct | fb7e76a7fdbc86256a20e0ffe5802ae1b65472f3 | 1a455f9c1f97c870b2592ef6b2f616d7f4d8744f | refs/heads/master | 2020-03-18T02:57:40.169540 | 2018-06-01T08:25:16 | 2018-06-01T08:25:16 | 134,205,080 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,168 | java | package com.whx;
import ch.qos.logback.classic.Level;
import ch.qos.logback.classic.Logger;
import ch.qos.logback.classic.LoggerContext;
import org.junit.Assert;
import org.slf4j.LoggerFactory;
import java.util.Stack;
public class RBTREEMap <K extends Comparable<K>,V> {
static int RED=1;
static int BLACK=0;
private Node root;
private static LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory();
private static Logger logger = context.getLogger(RBTree.class);
static {
for(Logger logger:context.getLoggerList()){
logger.setLevel(Level.toLevel("debug"));
}
}
private class Node{
int color;
Node left;
Node right;
Node parent;
K key;
V value;
Node(K key,V value){
this.key=key;
this.value=value;
}
}
public boolean exits(K key){
Node p = indexOf(key);
if(p==null){
return false;
}
return true;
}
public RBTREEMap<K, V> insert(K key,V value){
Node p = indexOfInsert(key);
if(p==null){
Node newNode = new Node(key,value);
this.root=newNode;
return this;
}
if(p.key.compareTo(key)==0){
//直接修改value
p.value=value;
return this;
}
Node newNode = new Node(key,value);
newNode.color=RED;
newNode.parent=p;
if(p.key.compareTo(key)>0){
p.left=newNode;
}
else{
p.right=newNode;
}
insertFix(newNode);
return this;
}
public V get(K key){
Node p = indexOf(key);
if(p==null){
return null;
}
return p.value;
}
private Node successor(Node p){
Assert.assertNotNull(p);
Assert.assertNotNull(p.right);
p=p.right;
while(p.left!=null){
p=p.left;
}
return p;
}
public RBTREEMap<K, V> delete(K key){
Node node=indexOf(key);
if(node==null){
return this;
}
if(node.left!=null&&node.right!=null){
Node temp = successor(node);
node.value=temp.value;
node.key=temp.key;
node=temp;
}
delete(node);
return this;
}
private void delete(Node p){
//只有删除黑色叶子节点才需要deleteFix
if(p.left==null&&p.right==null&&colorOfNode(p)==BLACK){
deleteFix(p);
}
Node temp = (p.left==null?p.right:p.left);
Node father = p.parent;
if(temp!=null){
temp.color=BLACK;
temp.parent=father;
}
if(father==null){
this.root=temp;
}
else{
if(p==father.left){
father.left=temp;
}
else{
father.right=temp;
}
}
}
private void deleteFix(Node p){
Assert.assertNotNull(p);
Assert.assertEquals(p.color,BLACK);
while (p.parent!=null){
Node father = p.parent;
Node brother= (p==father.left?father.right:father.left);
Assert.assertNotNull(brother);
if(colorOfNode(brother)==RED){
if(p==father.left){
rotateLeft(father);
}
else{
rotateRight(father);
}
father.color=RED;
brother.color=BLACK;
}
else if(colorOfNode(brother.left)==BLACK&&colorOfNode(brother.right)==BLACK){
if(colorOfNode(father)==RED){
father.color=BLACK;
brother.color=RED;
p=father;
break;
}
else{
brother.color=RED;
p=father;
}
}
else if(p==father.left&&colorOfNode(brother.left)==RED&&colorOfNode(brother.right)==BLACK){
rotateRight(brother);
brother.color=RED;
brother.parent.color=BLACK;
}
else if(p==father.right&&colorOfNode(brother.right)==RED&&colorOfNode(brother.left)==BLACK){
rotateLeft(brother);
brother.color=RED;
brother.parent.color=BLACK;
}
else if(p==father.left&&colorOfNode(brother.right)==RED){
rotateLeft(father);
brother.color=father.color;
father.color=BLACK;
brother.right.color=BLACK;
p=brother;
break;
}
else if(p==father.right&&colorOfNode(brother.left)==RED){
rotateRight(father);
brother.color=father.color;
father.color=BLACK;
brother.left.color=BLACK;
p=brother;
break;
}
}
if(p.parent==null){
this.root=p;
}
}
private Node indexOfInsert(K key){
Node p = this.root;
Node prev=null;
while(p!=null){
prev=p;
if(p.key.compareTo(key)==0){
return p;
}
else if(p.key.compareTo(key)<0){
p=p.right;
}
else{
p=p.left;
}
}
return prev;
}
private Node indexOf(K key){
Node p = this.root;
while(p!=null){
if(p.key.compareTo(key)==0){
break;
}
if(p.key.compareTo(key)<0){
p=p.right;
}
else{
p=p.left;
}
}
return p;
}
private void rotateLeft(Node p){
Node father = p.parent;
Node rightChild=p.right;
rightChild.parent=father;
if(father!=null){
if(p==father.left){
father.left=rightChild;
}
else{
father.right=rightChild;
}
}
p.parent=rightChild;
p.right=rightChild.left;
if(rightChild.left!=null){
rightChild.left.parent=p;
}
rightChild.left=p;
}
private void rotateRight(Node p){
Node father=p.parent;
Node leftChild=p.left;
leftChild.parent=father;
if(father!=null){
if(p==father.left){
father.left=leftChild;
}
else {
father.right=leftChild;
}
}
p.parent=leftChild;
p.left=leftChild.right;
if(leftChild.right!=null){
leftChild.right.parent=p;
}
leftChild.right=p;
}
private void insertFix(Node p){
Assert.assertNotNull(p);
Assert.assertEquals(RED,p.color);
while(colorOfNode(p.parent)==RED){
Node father=p.parent;
Node grandFather=father.parent;
Assert.assertNotNull(grandFather);
Node uncle = (father==grandFather.left?grandFather.right:grandFather.left);
//CASE 1. uncle is red
if(colorOfNode(uncle)==RED){
uncle.color=BLACK;
father.color=BLACK;
grandFather.color=RED;
p=grandFather;
}
//CASE 2. self is left right child of father and father is left child of grandFather
// or self is left child of father and father is right child of grandFather
else if((grandFather.left==father&&father.right==p)||(grandFather.right==father&&father.left==p)){
if(grandFather.left==father){
rotateLeft(father);
}
else{
rotateRight(father);
}
p=father;
}
//CASE 3. self is left child of father and father is left child of grandFather
// or self is right child of father and father is right child of grandFather
else{
if(grandFather.left==father&&father.left==p){
rotateRight(grandFather);
}
else{
rotateLeft(grandFather);
}
grandFather.color=RED;
father.color=BLACK;
p=father;
break;
}
}
if(p.parent==null){
this.root=p;
this.root.color=BLACK;
}
}
private int colorOfNode(Node p){
if(p==null){
return BLACK;
}
return p.color;
}
public void showAllMembers(){
Node p = this.root;
Stack<Node> stack = new Stack<>();
while(!stack.isEmpty()||p!=null){
while(p!=null){
stack.push(p);
p=p.left;
}
p=stack.pop();
logger.debug(""+p.value);
p=p.right;
}
}
}
| [
"1196385362@qq.com"
] | 1196385362@qq.com |
1a9b7b6fd0377f4e53fff9711f08778080a4d449 | 40d14fdb813e9852356a3ab3d35d8c78f25335ae | /src/main/java/com/netquest/bugtracker/repository/AuthorityRepository.java | 16e5c8f7dc09ee1f38b62a42f752f4ed4a297542 | [] | no_license | carlesarnal/jhipster-sample | 2134d022c994db2504ac56b60edd23401fdca7e0 | ace91ad4abcc7e51178a1da747818e8baa114121 | refs/heads/master | 2021-05-10T13:04:14.457087 | 2018-01-22T13:35:28 | 2018-01-22T13:35:28 | 118,461,468 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 304 | java | package com.netquest.bugtracker.repository;
import com.netquest.bugtracker.domain.Authority;
import org.springframework.data.jpa.repository.JpaRepository;
/**
* Spring Data JPA repository for the Authority entity.
*/
public interface AuthorityRepository extends JpaRepository<Authority, String> {
}
| [
"carnal@netquest.com"
] | carnal@netquest.com |
e98afbc86eea92cda813dda6792e3fad64fec4fd | 7019dbe45cce0d0c59129c81bcd014fbe9e5eda6 | /java/simple/item/tool/ItemPickaxeWrapper.java | a7c1b84badd0a5f928adb0f7abf1c3c87739d985 | [] | no_license | JRobertson90/Simple-Mod | 08c86d80b164fdaa9ab70e53f945ad9caa460038 | 94c0d97b67bc14fb82677bf2c415a1b9c8634037 | refs/heads/master | 2021-01-01T18:55:15.562302 | 2015-11-07T02:23:52 | 2015-11-07T02:23:52 | 37,832,748 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 275 | java | package simple.item.tool;
import net.minecraft.item.ItemPickaxe;
//This class created to circumvent protection on ItemPickaxe constructor
public class ItemPickaxeWrapper extends ItemPickaxe{
public ItemPickaxeWrapper(ToolMaterial p_i45347_1_) {
super(p_i45347_1_);
}
}
| [
"jrobertson2990@gmail.com"
] | jrobertson2990@gmail.com |
d59ddfe8feecfad86ef7343749336af512cfdb27 | 7b733d7be68f0fa4df79359b57e814f5253fc72d | /modules/extensions-main/src/main/java/com/percussion/extensions/security/IPSAllowOnlyItemInputValidator.java | 91530f23b03aba7b2dddacad3b2ae851a5c6949a | [
"LicenseRef-scancode-dco-1.1",
"Apache-2.0",
"OFL-1.1",
"LGPL-2.0-or-later"
] | permissive | percussion/percussioncms | 318ac0ef62dce12eb96acf65fc658775d15d95ad | c8527de53c626097d589dc28dba4a4b5d6e4dd2b | refs/heads/development | 2023-08-31T14:34:09.593627 | 2023-08-31T14:04:23 | 2023-08-31T14:04:23 | 331,373,975 | 18 | 6 | Apache-2.0 | 2023-09-14T21:29:25 | 2021-01-20T17:03:38 | Java | UTF-8 | Java | false | false | 774 | java | /*
* Copyright 1999-2023 Percussion Software, Inc.
*
* 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.
*/
package com.percussion.extensions.security;
public interface IPSAllowOnlyItemInputValidator {
public String validate(String value, String options);
}
| [
"nate.chadwick@gmail.com"
] | nate.chadwick@gmail.com |
7d904108e464410ade38b9e47437a3f352ecc9f4 | f0bd401a14c09d31159909b5451c5d06c4de7b34 | /merge-two-sorted-lists/merge-two-sorted-lists.java | 5670e09e49cb716674bba63f808368bb901eeeb9 | [] | no_license | Cvam06/LeetCode-Solutions | 73625b87d97f574ee528ce55eeced437372ba3b1 | d2da7199adf6fe89bea246aa0ac5d6b49cc8d066 | refs/heads/main | 2023-08-27T19:40:19.198081 | 2021-10-28T19:17:47 | 2021-10-28T19:17:47 | 370,894,040 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 965 | java | /**
* Definition for singly-linked list.
* public class ListNode {
* int val;
* ListNode next;
* ListNode() {}
* ListNode(int val) { this.val = val; }
* ListNode(int val, ListNode next) { this.val = val; this.next = next; }
* }
*/
class Solution {
public ListNode mergeTwoLists(ListNode l1, ListNode l2) {
ListNode temp = new ListNode(0);
ListNode current = temp;
while(l1 != null && l2 != null){
if(l1.val < l2.val){
current.next = l1;
l1 = l1.next;
}
else{
current.next = l2;
l2 = l2.next;
}
current = current.next;
}
if(l1!=null){
current.next = l1;
l1 = l1.next;
}
if(l2!=null){
current.next = l2;
l2 = l2.next;
}
return temp.next;
}
} | [
"cvam612@gmail.com"
] | cvam612@gmail.com |
5d280fbdd776a2020540fcdb66a790119ae06fa0 | 68f3f6453652202c724dba5a1dbed6e46ddf2a1d | /softProcess/src/ERP/Process/Commerciale/Stock/DocumentLot/service/DocumentLotService.java | 7eaa48bbe41cb4fced3715891ac2720dac97ccf0 | [] | no_license | ErpProcess/25121981 | c5ecddfbdfbb97516bc3f57d8a6333a65b84a9f0 | d417b3e2287b6cc240dde747db7fd88824819f99 | refs/heads/master | 2023-08-05T10:03:50.378009 | 2023-07-29T19:39:09 | 2023-07-29T19:39:09 | 149,328,434 | 0 | 0 | null | 2023-03-08T06:58:27 | 2018-09-18T17:39:30 | JavaScript | UTF-8 | Java | false | false | 3,315 | java | package ERP.Process.Commerciale.Stock.DocumentLot.service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import org.springframework.transaction.annotation.Transactional;
import ERP.Process.Commerciale.Stock.DocumentLot.dao.DocumentLotDAO;
import ERP.Process.Commerciale.Stock.DocumentLot.model.SerieArticletBean;
import ERP.Process.Commerciale.Stock.DocumentLot.template.DocumentLotTemplate;
import ERP.Process.Commerciale.Stock.MouvementStock.model.MouvementSerieBean;
import ERP.eXpertSoft.wfsi.Administration.Outils_Parametrage.Generic.GenericWeb;
@Service
public class DocumentLotService extends GenericWeb {
private DocumentLotDAO daoDocumentLot;
@Autowired
public void setDaoDocumentLot(DocumentLotDAO daoDocumentLot) {
this.daoDocumentLot = daoDocumentLot;
}
@Transactional(readOnly=true)
public List<SerieArticletBean> doFetchDatafromServer(SerieArticletBean beanSearch) throws Exception {
return daoDocumentLot.doFindListDocumentLot(beanSearch);
}
@Transactional(readOnly=true)
public List<MouvementSerieBean> doFetch_detailleLotfromServer(SerieArticletBean beanSearch) throws Exception {
return daoDocumentLot.doFindList_detailleDocumentLot(beanSearch);
}
@Transactional
public Boolean doCreateRowData(SerieArticletBean insertBean) throws Exception {
boolean result = false;
try {
if(daoDocumentLot.doSaveDocumentLot(insertBean)){
result = true;
}else{
result = false;
}
} catch (Exception e) {
result = false;
throw e;
}
return result;
}
@Transactional
public Boolean doAddChoixRowData(SerieArticletBean insertBean,List list_des_lots_for_select) throws Exception {
boolean result = false;
try {
if(daoDocumentLot.doSaveDocumentLot_choix(insertBean,list_des_lots_for_select)){
result = true;
}else{
result = false;
}
} catch (Exception e) {
result = false;
throw e;
}
return result;
}
@Transactional
public Boolean doSuppChoixRowData(SerieArticletBean insertBean,List list_des_lots_for_select) throws Exception {
boolean result = false;
try {
if(daoDocumentLot.doSupp_choixLot(insertBean,list_des_lots_for_select)){
result = true;
}else{
result = false;
}
} catch (Exception e) {
result = false;
throw e;
}
return result;
}
@Transactional
public Boolean doUpdateRowData(SerieArticletBean updateBean) throws Exception {
boolean result = false;
try {
if(daoDocumentLot.doUpdateDocumentLot(updateBean)){
result = true;
}else{
result = false;
}
} catch (Exception e) {
result = false;
throw e;
}
return result;
}
@Transactional
public Boolean doDeleteRowData(SerieArticletBean deleteBean) throws Exception {
boolean result = false;
try {
if(daoDocumentLot.doDeleteDocumentLot(deleteBean)){
result = true;
}else{
result = false;
}
} catch (Exception e) {
result = false;
throw e;
}
return result;
}
}
| [
"amira@amira-PC"
] | amira@amira-PC |
43dc396bb6459d1d15e728d6021b3de178fb36cb | f4d4b86cd9a4d0f96d2ee4290029c4b3c7e8dc6b | /lab7/Player.java | 49865205926f8b0e19b655b056c56e0f3a93ce13 | [] | no_license | GabrielDiac/ProgramareAvansata | 01b4603636f9cecb2a1f4594b4f78ab7d2fc6c9a | e99830d319c744f7cee726a0ea75816a4bdd7682 | refs/heads/master | 2021-03-27T08:20:12.968393 | 2020-05-09T10:15:55 | 2020-05-09T10:15:55 | 247,805,247 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,630 | java | import java.util.ArrayList;
import java.util.List;
import java.util.Random;
public class Player implements Runnable{
String name;
Board board;
List<Token> listTokenPlayer = new ArrayList<Token>();
int activation;
Player opponent;
public Player(String name, Board board,int act) {
this.name = name;
this.board = board;
this.activation=act;
}
public Player getOpponent() {
return opponent;
}
public void setOpponent(Player opponent) {
this.opponent = opponent;
}
public void extractToken()
{
Random rand = new Random();
//int i = board.getSizeBoard()-1;
Token temp;
temp=board.getListToken().get(rand.nextInt(board.getListToken().size()));
listTokenPlayer.add(temp);
//System.out.println("Nrdeextars:");
//System.out.println(temp.getValoareToken());
// int pos =board.getListToken().indexOf(temp);
/* for (Token token : board.getListToken() ) {
if(token.getValoareToken()==temp.getValoareToken())
board.getListToken().remove(temp);
}*/
List<Token> listTokenTemp = new ArrayList<Token>();
for (Token token : board.getListToken() ) {
if(token.getValoareToken()!=temp.getValoareToken())
listTokenTemp.add(token);}
board.setListToken(listTokenTemp);
// board.printBoard();
board.setSizeBoard(board.getSizeBoard()-1);
setActivation(0);
opponent.setActivation(1);
}
public List<Token> getListTokenPlayer() {
return listTokenPlayer;
}
public int getActivation() {
return activation;
}
public void setActivation(int activation) {
this.activation = activation;
}
public void printerList() {
/*for(int i = 0; i < listTokenPlayer.size(); i++) {
System.out.println(listTokenPlayer.get(i));*/
System.out.println(this.name + " : ");
for (Token token : listTokenPlayer ) {
System.out.println(token.getValoareToken());
}
}
@Override
public void run()
{synchronized (this) {
try {
while (board.getSizeBoard() !=0) {
//System.out.println(activation);
if(getActivation()==1)
extractToken();
else
Thread.sleep(10);
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
| [
"noreply@github.com"
] | noreply@github.com |
30677cefbc1b81fb76480c35c621532632994b75 | 3c4763922cda3f3a990b74cdba6f8a30b07467de | /src/main/java/students/andrew_galashin/lesson_9/level_5/task_22/Trader.java | d0c56124a85cea65208c742c8005c1223e2f2f95 | [] | no_license | VitalyPorsev/JavaGuru1 | 07db5a0cc122b097a20e56c9da431cd49d3c01ea | f3c25b6357309d4e9e8ac0047e51bb8031d14da8 | refs/heads/main | 2023-05-10T15:35:55.419713 | 2021-05-15T18:48:12 | 2021-05-15T18:48:12 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 631 | java | package students.andrew_galashin.lesson_9.level_5.task_22;
class Trader {
private String fullName;
private String city;
private String country;
public Trader(String fullName, String city) {
this.fullName = fullName;
this.city = city;
}
public Trader(String fullName, String city, String country) {
this.fullName = fullName;
this.city = city;
this.country = country;
}
public String getFullName() {
return fullName;
}
public String getCity() {
return city;
}
public String getCountry() {
return country;
}
}
| [
"c0mplyster1@gmail.com"
] | c0mplyster1@gmail.com |
e5753732906751a22f42b83939980b803c75f723 | 24c6b17855a0ac6afc5bc996f78b77fb7796e24f | /mvplibrary/src/main/java/comapp/example/gyq/mvplibrary/utils/ScreenUtils.java | a7a73112e0a84919665770cfc53afc97429b57f3 | [] | no_license | 965310001/MVP-Template | 61f893ad7d9cb7a1f85eb86dcf0955520ee1b7e0 | 00400ee1fe6426e348252377ee32575ecb403c08 | refs/heads/master | 2021-01-19T09:46:11.255083 | 2017-04-10T07:42:28 | 2017-04-10T07:42:28 | 87,780,993 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,923 | java | package comapp.example.gyq.mvplibrary.utils;
import android.app.Activity;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Rect;
import android.util.DisplayMetrics;
import android.view.View;
import android.view.WindowManager;
/**
* 获得屏幕相关的辅助类
*
*
*
*/
public class ScreenUtils {
private ScreenUtils() {
/* cannot be instantiated */
throw new UnsupportedOperationException("cannot be instantiated");
}
/**
* 获得屏幕高度
*
* @param context
* @return
*/
public static int getScreenWidth(Context context) {
WindowManager wm = (WindowManager) context
.getSystemService(Context.WINDOW_SERVICE);
DisplayMetrics outMetrics = new DisplayMetrics();
wm.getDefaultDisplay().getMetrics(outMetrics);
return outMetrics.widthPixels;
}
/**
* 获得屏幕宽度
*
* @param context
* @return
*/
public static int getScreenHeight(Context context) {
WindowManager wm = (WindowManager) context
.getSystemService(Context.WINDOW_SERVICE);
DisplayMetrics outMetrics = new DisplayMetrics();
wm.getDefaultDisplay().getMetrics(outMetrics);
return outMetrics.heightPixels;
}
/**
* 获得状态栏的高度
*
* @param context
* @return
*/
public static int getStatusHeight(Context context) {
int statusHeight = -1;
try {
Class<?> clazz = Class.forName("com.android.internal.R$dimen");
Object object = clazz.newInstance();
int height = Integer.parseInt(clazz.getField("status_bar_height")
.get(object).toString());
statusHeight = context.getResources().getDimensionPixelSize(height);
} catch (Exception e) {
e.printStackTrace();
}
return statusHeight;
}
/**
* 获取当前屏幕截图,包含状态栏
*
* @param activity
* @return
*/
public static Bitmap snapShotWithStatusBar(Activity activity) {
View view = activity.getWindow().getDecorView();
view.setDrawingCacheEnabled(true);
view.buildDrawingCache();
Bitmap bmp = view.getDrawingCache();
int width = getScreenWidth(activity);
int height = getScreenHeight(activity);
Bitmap bp = null;
bp = Bitmap.createBitmap(bmp, 0, 0, width, height);
view.destroyDrawingCache();
return bp;
}
/**
* 获取当前屏幕截图,不包含状态栏
*
* @param activity
* @return
*/
public static Bitmap snapShotWithoutStatusBar(Activity activity) {
View view = activity.getWindow().getDecorView();
view.setDrawingCacheEnabled(true);
view.buildDrawingCache();
Bitmap bmp = view.getDrawingCache();
Rect frame = new Rect();
activity.getWindow().getDecorView().getWindowVisibleDisplayFrame(frame);
int statusBarHeight = frame.top;
int width = getScreenWidth(activity);
int height = getScreenHeight(activity);
Bitmap bp = null;
bp = Bitmap.createBitmap(bmp, 0, statusBarHeight, width, height
- statusBarHeight);
view.destroyDrawingCache();
return bp;
}
} | [
"13657626@qq.com"
] | 13657626@qq.com |
2c9915b9b570a26ac46cd8aeff754e094fbcf50f | 44b3214579574d4a46f2b98c763cb6c237bd1d6c | /src/main/java/com/example/solargen/entity/Role.java | bde16c2f3462f70c59cc1b6eacd4cf04f3989137 | [] | no_license | solargen/springboot-shiro | a70a18a59feb2497800c7d79dbff9783f4c6a27d | 2fe9dcd7dd907e450b00867d32e67d148e3c2383 | refs/heads/master | 2022-06-29T13:05:41.033205 | 2019-05-23T10:36:30 | 2019-05-23T10:36:30 | 186,207,944 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,252 | java | package com.example.solargen.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import java.io.Serializable;
/**
* <p>
*
* </p>
*
* @author solargen
* @since 2019-04-26
*/
@TableName("t_role")
public class Role implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Long id;
private String sn;
private String name;
private String intro;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getSn() {
return sn;
}
public void setSn(String sn) {
this.sn = sn;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getIntro() {
return intro;
}
public void setIntro(String intro) {
this.intro = intro;
}
@Override
public String toString() {
return "Role{" +
"id=" + id +
", sn=" + sn +
", name=" + name +
", intro=" + intro +
"}";
}
}
| [
"zhangsan@itsource.cn"
] | zhangsan@itsource.cn |
49a8cc5d2a1145657cc4f74972f42ea7f8ee5a10 | dbae6cf298be83a50fc7406f2e161306f9f6cbf5 | /RunPlanner/src/br/com/runplanner/view/EquipmentMBean.java | 14f0f569f6fb3dfe904c8c87464cd170eb8c40ee | [] | no_license | pedgoncalves/runplanner | 7e3635adaa24d783cef645946e33fc56cbe3ed13 | 999341b4852891c969ff5444a57b98c2c1de55df | refs/heads/master | 2021-05-01T02:25:07.914576 | 2016-02-17T12:32:28 | 2016-02-17T12:32:28 | 39,012,108 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,646 | java | package br.com.runplanner.view;
import java.util.List;
import javax.faces.application.FacesMessage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
import br.com.runplanner.domain.Equipment;
import br.com.runplanner.domain.Pessoa;
import br.com.runplanner.exception.EntityNotFoundException;
import br.com.runplanner.service.EquipmentService;
import br.com.runplanner.view.util.Constants;
@Component("equipmentMBean")
@Scope("session")
public class EquipmentMBean extends BasicMBean {
private static final String EQUIPMENT_FORM_PAGE = "/pages/equipment/equipment";
private static final String EQUIPMENT_LIST_PAGE = "/pages/equipment/equipmentList";
private List<Equipment> equipmentList;
private Equipment equipment;
private boolean findActive = Boolean.TRUE;
@Autowired
private EquipmentService equipmentService;
@Override
public String goToList() {
Pessoa user = getSessionUser();
findActive = Boolean.TRUE;
equipmentList = equipmentService.findByStudent(user.getId(), findActive);
for( Equipment e:equipmentList ) {
double distance = e.getKilometers();
distance += equipmentService.findDistance(e.getId());
e.setKilometers( distance );
}
equipment = new Equipment();
setSelectedMenu(Constants.MENU_EQUIPMENT);
return EQUIPMENT_LIST_PAGE;
}
public String find() {
Pessoa user = getSessionUser();
equipmentList = equipmentService.findByStudent(user.getId(), findActive);
return EQUIPMENT_LIST_PAGE;
}
@Override
public String goToCreate() {
this.equipment = new Equipment();
equipment.setKilometers(0d);
return EQUIPMENT_FORM_PAGE;
}
@Override
public String goToModify() {
this.equipment = equipmentService.loadById(equipment.getId());
if ( equipment==null ) {
addMessage(FacesMessage.SEVERITY_ERROR,"template.msg.entitynotfound.edit");
return goToList();
}
return EQUIPMENT_FORM_PAGE;
}
@Override
public String delete() {
if ( equipment!=null && equipment.getId()!=null ) {
try{
equipmentService.deleteById(equipment.getId());
addMessage(FacesMessage.SEVERITY_INFO, "equipment.delete.sucess");
}
catch (EntityNotFoundException e) {
addMessage(FacesMessage.SEVERITY_ERROR, "template.msg.entitynotfound.delete");
}
}
return goToList();
}
@Override
public String save() {
if( equipment.getId()==null ) {
Pessoa user = getSessionUser();
equipment.setStudent(user);
equipment.setActive(Boolean.TRUE);
equipment = equipmentService.persist(equipment);
addMessage(FacesMessage.SEVERITY_INFO, "equipment.save.sucess");
}
else {
try {
equipmentService.update(equipment);
addMessage(FacesMessage.SEVERITY_INFO, "equipment.edit.sucess");
} catch (EntityNotFoundException e) {
addMessage(FacesMessage.SEVERITY_ERROR, "template.msg.entitynotfound.edit");
}
}
return goToList();
}
public String deactivate() {
if ( equipment!=null && equipment.getId()!=null ) {
equipment = equipmentService.loadById(equipment.getId());
try {
equipment.setActive(Boolean.FALSE);
equipmentService.update(equipment);
addMessage(FacesMessage.SEVERITY_INFO, "equipment.deactivate.sucess");
} catch (EntityNotFoundException e) {
addMessage(FacesMessage.SEVERITY_ERROR, "template.msg.entitynotfound.edit");
}
}
return find();
}
public String activate() {
if ( equipment!=null && equipment.getId()!=null ) {
equipment = equipmentService.loadById(equipment.getId());
try {
equipment.setActive(Boolean.TRUE);
equipmentService.update(equipment);
addMessage(FacesMessage.SEVERITY_INFO, "equipment.activate.sucess");
} catch (EntityNotFoundException e) {
addMessage(FacesMessage.SEVERITY_ERROR, "template.msg.entitynotfound.edit");
}
}
return find();
}
//Gets e Sets
public List<Equipment> getEquipmentList() {
return equipmentList;
}
public void setEquipmentList(List<Equipment> equipmentList) {
this.equipmentList = equipmentList;
}
public Equipment getEquipment() {
return equipment;
}
public void setEquipment(Equipment equipment) {
this.equipment = equipment;
}
public boolean isFindActive() {
return findActive;
}
public void setFindActive(boolean findActive) {
this.findActive = findActive;
}
}
| [
"pedgoncalves@gmail.com"
] | pedgoncalves@gmail.com |
b6be8cc75e28e479556ee5489e043afa1991d57f | d778d1c21fb4433e6f231ffd05b49a650b1ab6bd | /online/Tudo.java | 02c4a79972fc022be39f761460f7a5a1f7e80969 | [] | no_license | gustavokira/ifpr-parimpar | 5032817a990c7d0e37e3f9bdc9f3e2c1fc112bda | cd0bbd5467402bd6a1a7169505a838e02180109f | refs/heads/master | 2021-01-23T02:35:25.251619 | 2018-03-08T13:26:33 | 2018-03-08T13:26:33 | 86,009,961 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,720 | java | import java.util.Scanner;
class Main{
public static void main(String args[]){
ParImpar jogo = new ParImpar();
jogo.escolherParParaOJogador1();
jogo.escolherValorParaOJogador1(1);
jogo.escolherValorParaOJogador2(2);
jogo.calcularResultado();
Jogador ganhador = jogo.quemGanhou();
System.out.println(ganhador.nome);
}
}
class ParImpar{
Jogador j1;
Jogador j2;
int resultado;
public ParImpar(){
this.j1 = new Jogador();
this.j1.nome = "J1";
this.j2 = new Jogador();
this.j2.nome = "J2";
this.resultado = 0;
}
public void escolherParParaOJogador1(){
this.j1.escolheuPar = true;
this.j2.escolheuPar = false;
}
public void escolherParParaOJogador2(){
this.j1.escolheuPar = false;
this.j2.escolheuPar = true;
}
public void escolherValorParaOJogador1(int i){
this.j1.valorEscolhido = i;
}
public void escolherValorParaOJogador2(int i){
this.j2.valorEscolhido = i;
}
public void calcularResultado(){
this.resultado = this.j1.valorEscolhido + this.j2.valorEscolhido;
}
public Jogador quemGanhou(){
Jogador ganhador = null;
if(this.j1.escolheuPar && this.resultado%2 == 0){
ganhador = this.j1;
}
else if(this.j2.escolheuPar && this.resultado%2 == 0){
ganhador = this.j2;
}
if(!this.j1.escolheuPar && this.resultado%2 == 1){
ganhador = this.j1;
}
else if(!this.j2.escolheuPar && this.resultado%2 == 1){
ganhador = this.j2;
}
return ganhador;
}
}
class Jogador{
String nome;
int valorEscolhido;
boolean escolheuPar;
public Jogador(){
this.valorEscolhido = 0;
this.escolheuPar = false;
this.nome = "";
}
}
| [
"gustavokira@gmail.com"
] | gustavokira@gmail.com |
b9f5014fda964d96899b713419a06a787ffe59f3 | b91b7c1acc1f0f7b384150890b1e326ad17e8cbd | /app/src/main/java/fi/mobiles13/movietonight/MovieUtils.java | 9b7acfa50c9a1b26b6f2e361a9a2e0b3acd7b889 | [] | no_license | dieu-vu/movie2night | b2fe12ab4f0782bf24c58e345b754ba74bc5fa85 | 1848257818e13c7b56381071abdd944491080f57 | refs/heads/master | 2023-01-29T15:03:16.546602 | 2020-12-08T11:53:33 | 2020-12-08T11:53:33 | 315,268,424 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,384 | java | package fi.mobiles13.movietonight;
import android.app.Application;
import android.content.Context;
import android.content.SharedPreferences;
import android.util.Log;
import com.google.gson.Gson;
import com.google.gson.JsonArray;
import com.google.gson.JsonParser;
import com.google.gson.reflect.TypeToken;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.lang.reflect.Array;
import java.lang.reflect.Type;
import java.util.ArrayList;
import static fi.mobiles13.movietonight.LoginActivity.USER_DATA_KEY;
//Singleton to handle all Movie object and Movie data
public class MovieUtils extends Application {
private static final String ALL_MOVIES_KEY = "all_movies";
private static final String TAG = "MOVIE_DATA";
private static MovieUtils instance = null;
private SharedPreferences sharedPreferences;
private Context context;
public static ArrayList<Movie> allMovies;
private User user;
//Initiate object - constructor
private MovieUtils(Context context, SharedPreferences sharedPreferences){
//user shared preferences to call data from movie_data in the context
sharedPreferences = context.getSharedPreferences("movie_data", Context.MODE_PRIVATE);
Log.d(TAG, "sharedprefs "+ sharedPreferences.toString());
if (sharedPreferences == null){
initData(context);
}
Log.d(TAG, "MovieUtils initialized");
//Check if shared preferences have any data, otherwise init data
if (getAllMovies(context).size() == 0){
allMovies = new ArrayList<>();
initData(context); //if the device doesn't have the shared prefs movie_data.xml yet, then init the data
}
}
public static MovieUtils getInstance(Context context){
SharedPreferences sharedPreferences = context.getSharedPreferences("movie_data", Context.MODE_PRIVATE);
if (null != instance){
return instance;
} else {
instance = new MovieUtils(context, sharedPreferences);
return instance;
}
}
public void initData(Context context){
//Add initial data from asset file
ArrayList<Movie> movies = new ArrayList<>();
Log.d(TAG, "initData called");
//Read data from JSON in assets from here and append to list(100 lines)
String jSonFileString;
Log.d(TAG, String.valueOf(context));
jSonFileString = JSONParser.getJsonFromAssets(context);
Log.d(TAG, "movie data read in: " + jSonFileString);
// Convert the original json data to create new movie objects:
try {
Log.d(TAG, "Checking json object");
Gson g = new Gson();
JSONArray moviesJsonArray = new JSONArray(jSonFileString);
Log.d(TAG, String.valueOf(moviesJsonArray));
for (int i = 0; i < moviesJsonArray.length(); i++) {
JSONObject entry = moviesJsonArray.getJSONObject(i);
String id = entry.getString("tconst");
String name = entry.getString("primaryTitle");
Boolean isAdult = entry.getBoolean("isAdult");
String year = entry.getString("startYear");
String genre = entry.getString("genres");
String rating = entry.getString("rating");
String url = entry.getString("url");
Log.d(TAG, id+name+isAdult+year+genre+rating+url);
Movie movie = new Movie(id, name, genre, isAdult, Integer.valueOf(year), Double.valueOf(rating), url);
Log.d(TAG, String.valueOf(movie));
movies.add(movie);
}
} catch (JSONException e){
e.printStackTrace();
}
Log.d(TAG, movies.toString());
//Convert the array of all Movie objects to Json and save into sharedPreferences movie_data.xml
SharedPreferences.Editor editor = sharedPreferences.edit();
Gson gson = new Gson();
editor.putString(ALL_MOVIES_KEY, gson.toJson(movies));
editor.apply();
Log.d(TAG, "movie data written");
}
//METHOD TO GET ALL MOVIE DATA AS AN ARRAY OF MOVIE OBJECTS
public ArrayList<Movie> getAllMovies(Context context){
sharedPreferences = context.getSharedPreferences("movie_data", Context.MODE_PRIVATE);
Log.d(TAG, "sharedPreferences" + sharedPreferences);
if (sharedPreferences.contains(ALL_MOVIES_KEY)){
//transfer array to Movie objects
Gson gson = new Gson();
Type type = new TypeToken<ArrayList<Movie>>(){}.getType();
ArrayList<Movie> movies = gson.fromJson(sharedPreferences.getString(ALL_MOVIES_KEY, null), type);
Log.d(TAG, "Movies: " + movies);
Log.d(TAG, "list of Movie objects created in MovieUtils class");
return movies;
} else {
Log.d(TAG, "cannot find Movie data");
}
return new ArrayList<Movie>();
}
// METHOD TO GET TOP RATED MOVIES
public ArrayList<String> getTopRated(Context context){
ArrayList<String> topRated = new ArrayList<>();
for (int i=0; i<5;i++){
topRated.add(getAllMovies(context).get(i).getName());
}
Log.d(TAG, topRated.toString());
return topRated;
}
public Movie getMovieByID(String id, Context context){
ArrayList<Movie> movies = getAllMovies(context);
if (movies !=null){
for (Movie m: movies){
if (m.getId()== id){
return m;
}
}
}
return null;
}
//METHOD TO SEARCH MOVIE BASED ON INPUT SEARCH STRINGS:
public ArrayList<Movie> searchMovie (String searchStr, int age, Context context){
ArrayList<Movie> movies = getAllMovies(context);
ArrayList<Movie> resultMovies = new ArrayList<>();
if (null != movies){
for (Movie m: movies){
Log.d("USER_SEARCH", "Search Age: " + age);
if (age > 17){
Log.d("USER_SEARCH", "is adult is running");
if (checkContain(m.getName(), searchStr) || checkContain(m.getGenre(),searchStr)) {
resultMovies.add(m);
}
} else {
if ((checkContain(m.getName(), searchStr) || checkContain(m.getGenre(),searchStr))) {
Boolean isAdult = m.isAdult();
if(isAdult == true){
Log.d("USER_SEARCH","this should run instead");
resultMovies = new ArrayList<Movie>();
} else {
Log.d("USER_SEARCH","search is adult" + isAdult);
Log.d("USER_SEARCH","this should not run");
resultMovies.add(m);
}
Log.d("USER_SEARCH","search is adult" + m.isAdult());
Log.d("USER_SEARCH","search is not adult" + !(m.isAdult()));
}
}
}
return resultMovies;
}
return null;
}
private boolean checkContain(String str, String subStr){
return str.toLowerCase().contains(subStr.toLowerCase());
}
}
| [
"dieu.vu@metropolia.fi"
] | dieu.vu@metropolia.fi |
85cd9f976d69c5fb79f1b258b00405e85809cd09 | 83caf1ed6c12590e43a027452cdc4d97cd792ecc | /app/src/main/java/com/example/powertrafficeapp/fragment/Fragment_4.java | 15848247d2763a68f365376c5d7fff62355d88cd | [] | no_license | sanyaoyao/PowerTrafficeApp | 44213f6329d314ba5d407e700b6b3dd1f28649bd | a7cae1d413eedcdeffc6ae8abd8a5b768f9aa8b1 | refs/heads/Text | 2021-07-13T05:51:49.977648 | 2017-10-19T00:49:15 | 2017-10-19T00:49:15 | 106,986,173 | 0 | 0 | null | 2017-10-15T05:25:26 | 2017-10-15T05:25:26 | null | UTF-8 | Java | false | false | 1,464 | java | /**
*
*/
package com.example.powertrafficeapp.fragment;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import com.example.powertrafficeapp.R;
public class Fragment_4 extends Fragment {
android.support.v4.app.FragmentManager fm;
private TextView textView2;
private TextView textView4;
private EditText editText;
private Button button;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_layout04, container, false);
return view;
}
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
textView2 = (TextView) getActivity().findViewById(R.id.textView2);
textView4 = (TextView) getActivity().findViewById(R.id.textView4);
editText = (EditText) getActivity().findViewById(R.id.editText);
button = (Button) getActivity().findViewById(R.id.button);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
}
});
}
}
| [
"3185717649@qq.com"
] | 3185717649@qq.com |
5aad7653bcb602ddd1f4490b1f6b4510414c3731 | 96d8b502e834f883aab11ba908e4a31df6e71303 | /src/com/ctgu/util/Json.java | d64d0a25bdd7806b93cd026127af6bab416dd3d5 | [] | no_license | sndhyqs/ctguhelp | 634c1274a356c0e95a5742829331fd1873045202 | 7279a2e1370a99d49339ebad12a5a1afbd0ada6c | refs/heads/master | 2021-01-15T23:36:37.219887 | 2014-12-16T12:19:08 | 2014-12-16T12:19:08 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 607 | java | package com.ctgu.util;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.json.JSONException;
import org.json.JSONObject;
/**
* 自己Json处理用的一个类
*
* @author 晏青山
*
*/
public class Json {
/**
* map转换一个一维的json数据
*
* @param map
* @return String
*/
public static String mapTojson(Map<String, String> map) {
JSONObject json = new JSONObject();
for (String key : map.keySet()) {
try {
json.put(key, map.get(key));
} catch (JSONException e) {
e.printStackTrace();
}
}
return json.toString();
}
}
| [
"529357231@qq.com"
] | 529357231@qq.com |
48133f40f2f1af824b25d519f0da4fd417fb3be8 | 93eac77827dde53e81b845f7cbea973bbad1fd70 | /src/main/java/com/facultate/disertatie/entity/RefPriority.java | a689df7015a0bd52f3b1a345fe00b048938678ec | [] | no_license | barbupetcu/HrEvaluationApp | 0423cac5b99eeecc38169043775c6021d1318309 | e99bb7f041b2c1bb51ea5e923476b4f43de78ed8 | refs/heads/master | 2022-07-17T12:44:09.043089 | 2019-06-11T00:26:25 | 2019-06-11T00:26:25 | 184,937,458 | 1 | 0 | null | 2022-06-29T17:25:50 | 2019-05-04T19:42:01 | JavaScript | UTF-8 | Java | false | false | 551 | java | package com.facultate.disertatie.entity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
@Entity
@Table(name="ref_priority")
public class RefPriority{
@Id
@Column(name="id", nullable = false, updatable=false)
private int id;
@Column(name="name")
private String name;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
} | [
"barbu.petcu@gmail.com"
] | barbu.petcu@gmail.com |
74774f33cca5697ca8baf5bb0006b9296e7b671d | 77ce891a691b4792eaae55d4c95db82d3bd60bf4 | /core/src/com/xpto/infectors/engine/Cell.java | 147cc6c966cac0b1f0ae3b3720b1478ad6aef9ab | [] | no_license | Nuclear2Games/Infectors | f63b744d0ba5337453bdbaaf2e994b0f1e242d11 | f71328533dc5825d32365ddc181865246c64b7a1 | refs/heads/master | 2023-07-10T10:05:32.852436 | 2014-05-09T21:32:16 | 2014-05-09T21:32:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,582 | java | package com.xpto.infectors.engine;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
public class Cell extends Circle {
public static final float MIN_RADIUS = 20;
public static final float MAX_RADIUS = 100;
private static Texture img;
private float energy;
private float energyRadius;
public float getEnergy() {
return energy;
}
public void setEnergy(float _energy) {
if (_energy < 0) {
energy = 0;
energyRadius = 0;
} else {
energy = _energy;
energyRadius = (float) Math.sqrt(energy / Math.PI);
}
}
public Cell(Team _team) {
super();
if (img == null)
img = new Texture("circle.png");
setTeam(_team);
}
public void render(Board board, SpriteBatch batch) {
Team t = getTeam();
float r2 = getRadius() * 2;
float er2 = energyRadius * 2;
batch.setColor(t.getR(), t.getG(), t.getB(), t.getA());
batch.draw(img, getX() - getRadius() - board.cameraPosition().x, getY() - getRadius()
- board.cameraPosition().y, r2, r2);
batch.draw(img, getX() - energyRadius - board.cameraPosition().x,
getY() - energyRadius - board.cameraPosition().y, er2, er2);
}
@Override
public void update(float seconds) {
super.update(seconds);
energy += (getRadius() / MAX_RADIUS) * getTeam().getRegenerate() * seconds;
energyRadius = (float) Math.sqrt(energy / Math.PI);
}
}
| [
"anderson.binario@gmail.com"
] | anderson.binario@gmail.com |
1bc5ea0c03cef449684d41786b6567e9745e3e5c | 8594efe548e1031362ca17971bdb81f62779e823 | /module-simple/src/main/java/domainapp/modules/simple/fixture/SimpleObjectBuilder.java | e9df3e06d96246085dd6ff606b8f3a68e7af9c62 | [] | no_license | erikhermilo/CRUD | 1a962e18bb5504c9d286b0bf8227939dc4a7de28 | a6ad6a0f06d6bf979ed1bae4eade6d313cfc7abe | refs/heads/master | 2020-03-21T10:32:58.239733 | 2018-07-13T09:11:09 | 2018-07-13T09:11:09 | 138,457,233 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,814 | java | /*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.
*/
package domainapp.modules.simple.fixture;
import domainapp.modules.simple.dom.impl.Sexos;
import org.apache.isis.applib.fixturescripts.BuilderScriptAbstract;
import domainapp.modules.simple.dom.impl.SimpleObject;
import domainapp.modules.simple.dom.impl.SimpleObjects;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;
import org.joda.time.LocalDate;
@Accessors(chain = true)
public class SimpleObjectBuilder extends BuilderScriptAbstract<SimpleObject, SimpleObjectBuilder> {
@Getter @Setter
private String name;
private String apaterno;
private String amaterno;
private Sexos sexo;
private LocalDate fechan;
@Getter
private SimpleObject object;
@Override
protected void execute(final ExecutionContext ec) {
checkParam("name", ec, String.class);
object = wrap(simpleObjects).create(name, apaterno,amaterno , fechan, sexo);
}
@javax.inject.Inject
SimpleObjects simpleObjects;
}
| [
"hermiloerik@gmail.com"
] | hermiloerik@gmail.com |
170ac5ba211738523eb82279b0adaf063eeea8da | aea1b3965860909d13e9d017260b86e05c2c2eb5 | /FacultyPreferences-portlet/WEB-INF/service/com/asu/poly/iproject/faculty/preferences/service/ProjectdetailServiceClp.java | 5af5b0db58726ab98041d2eda46a7244bf1a4482 | [] | no_license | AnshuSingh/IProjectTeamSelection | e485513940e8335850b0e31ea804e7118f64c621 | 82eaa56ac64efe75b59ea6a5a8ca287f1cc0c6ce | refs/heads/master | 2016-09-06T13:29:46.884012 | 2013-05-13T01:41:32 | 2013-05-13T01:41:32 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,507 | java | /**
* Copyright (c) 2000-2012 Liferay, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* 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 Lesser General Public License for more
* details.
*/
package com.asu.poly.iproject.faculty.preferences.service;
import com.liferay.portal.service.InvokableService;
/**
* @author emente
*/
public class ProjectdetailServiceClp implements ProjectdetailService {
public ProjectdetailServiceClp(InvokableService invokableService) {
_invokableService = invokableService;
_methodName0 = "getBeanIdentifier";
_methodParameterTypes0 = new String[] { };
_methodName1 = "setBeanIdentifier";
_methodParameterTypes1 = new String[] { "java.lang.String" };
}
public java.lang.String getBeanIdentifier() {
Object returnObj = null;
try {
returnObj = _invokableService.invokeMethod(_methodName0,
_methodParameterTypes0, new Object[] { });
}
catch (Throwable t) {
t = ClpSerializer.translateThrowable(t);
if (t instanceof RuntimeException) {
throw (RuntimeException)t;
}
else {
throw new RuntimeException(t.getClass().getName() +
" is not a valid exception");
}
}
return (java.lang.String)ClpSerializer.translateOutput(returnObj);
}
public void setBeanIdentifier(java.lang.String beanIdentifier) {
try {
_invokableService.invokeMethod(_methodName1,
_methodParameterTypes1,
new Object[] { ClpSerializer.translateInput(beanIdentifier) });
}
catch (Throwable t) {
t = ClpSerializer.translateThrowable(t);
if (t instanceof RuntimeException) {
throw (RuntimeException)t;
}
else {
throw new RuntimeException(t.getClass().getName() +
" is not a valid exception");
}
}
}
public java.lang.Object invokeMethod(java.lang.String name,
java.lang.String[] parameterTypes, java.lang.Object[] arguments)
throws java.lang.Throwable {
throw new UnsupportedOperationException();
}
private InvokableService _invokableService;
private String _methodName0;
private String[] _methodParameterTypes0;
private String _methodName1;
private String[] _methodParameterTypes1;
} | [
"anshu1012@gmail.com"
] | anshu1012@gmail.com |
3f390a1748b969d21b49764046283d1e73675429 | 352cb15cce9be9e4402131bb398a3c894b9c72bc | /src/main/java/chapter4/topic4/LeetCode_791.java | 2f1b6b5f8dd8be4417d6ef31a7cdbca1310e30bc | [
"MIT"
] | permissive | DonaldY/LeetCode-Practice | 9f67220bc6087c2c34606f81154a3e91c5ee6673 | 2b7e6525840de7ea0aed68a60cdfb1757b183fec | refs/heads/master | 2023-04-27T09:58:36.792602 | 2023-04-23T15:49:22 | 2023-04-23T15:49:22 | 179,708,097 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 558 | java | package chapter4.topic4;
/**
* @author donald
* @date 2022/11/13
*/
public class LeetCode_791 {
public String customSortString(String order, String s) {
int[] cnts = new int[26];
for (char c : s.toCharArray()) cnts[c - 'a']++;
StringBuilder sb = new StringBuilder();
for (char c : order.toCharArray()) {
while (cnts[c - 'a']-- > 0) sb.append(c);
}
for (int i = 0; i < 26; i++) {
while (cnts[i]-- > 0) sb.append((char)(i + 'a'));
}
return sb.toString();
}
}
| [
"448641125@qq.com"
] | 448641125@qq.com |
0776eb55fc1ff9c320a9c545b358bb502c79706e | 521789c822469f7676969fc7089b375fbab6d33d | /src/pattern_05_factory_method/BlackHuman.java | 500b02715fdef22db2649482d85e7a67f0223fb6 | [] | no_license | syf1234567/pattern | 6a4a56d1883aa74813ea8604089de1d7c8d83459 | e060a1ee6b1f5dd0e499ba66889786f00182befb | refs/heads/master | 2023-01-24T18:56:59.921926 | 2020-11-26T13:33:37 | 2020-11-26T13:33:37 | 315,897,287 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 704 | java | package pattern_05_factory_method;
/**
* @author cbf4Life cbf4life@126.com
* I'm glad to share my knowledge with you all.
* 黑色人类,记得中学学英语,老师说black man是侮辱人的意思,不懂,没跟老外说话
* 1.策略模式
* 2.代理模式
* 3.单例模式
* 4.多例模式
* 5.工厂方法模式
* 6.抽象工厂模式
*/
public class BlackHuman implements Human {
@Override
public void laugh() {
System.out.println("黑人会笑");
}
@Override
public void cry() {
System.out.println("黑人会哭");
}
@Override
public void talk() {
System.out.println("黑人可以说话,一般人听不懂");
}
}
| [
"shengyifan@tongqutech.cn"
] | shengyifan@tongqutech.cn |
71de015c6be540f83fabd919ab7787cdc7218fbe | 43f7579059f5f3884a48c108d705d05371ede96d | /src/Utils.java | bdf25b7e78908bee86754aa87b5130ae6410c5a8 | [] | no_license | bernardCS4244/CDCLSolver | 644f005bbb4d497da9b8255b16c60ec618af84ea | c5825a249742a43af65395f679a92d44802c7d1d | refs/heads/master | 2020-03-12T05:22:19.374783 | 2018-05-01T19:52:13 | 2018-05-01T19:52:13 | 130,462,178 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,241 | java | import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class Utils {
public static boolean formulaSatisfied(int numClauses, List<Clause> clauses, Map<Integer, Literal> solution) {
List<Literal> literals;
int satisfiedCounter = 0;
for (int i = 0; i < numClauses; i++) {
literals = clauses.get(i).getDisjunctiveClause();
for (Literal literal : literals) {
Literal literalAssigned = solution.get(literal.get());
if (literalAssigned != null && (literalAssigned.getValue() == literal.getValue())) {
satisfiedCounter++;
break;
}
}
}
if (satisfiedCounter == numClauses) {
return true;
}
return false;
}
public static void printSolution(Action type, int numLiterals, HashMap<Integer, Literal> solution, int counter) {
Literal literal = null;
for (int i = 1; i <= numLiterals; i++) {
literal = solution.get(i);
if (literal == null && type == Action.SAT) {
System.out.print(i + " ");
} else if (literal == null && type == Action.UNSAT) {
System.out.print("* ");
} else {
if (literal.getValue()) {
System.out.print(literal.get() + " ");
} else {
System.out.print(literal.get() * -1 + " ");
}
}
}
System.out.println("");
System.out.print("PickBranching Variable counter " + counter);
}
public static Clause performResolution(Clause currClause, Clause incomingClause) {
if (currClause == null) {
return incomingClause;
}
List<Literal> current = currClause.getDisjunctiveClause();
List<Literal> incoming = incomingClause.getDisjunctiveClause();
ArrayList<Integer> removeFromIncoming = new ArrayList<>(incoming.size());
Clause resolutionClause = new Clause();
boolean literalPresentInBoth;
for (int i = 0; i < current.size(); i++) {
literalPresentInBoth = false;
for (int j = 0; j < incoming.size(); j++) {
if (current.get(i).get() == incoming.get(j).get()) {
removeFromIncoming.add(incoming.get(j).get());
if (current.get(i).getValue() == !incoming.get(j).getValue()) {
literalPresentInBoth = true;
}
}
}
if (!literalPresentInBoth) {
resolutionClause.add(current.get(i));
}
}
for (Literal remainingLiteral : incoming) {
if (!removeFromIncoming.contains(remainingLiteral.get())) {
resolutionClause.add(remainingLiteral);
}
}
return resolutionClause;
}
public static boolean hasUip(Clause clause, int literalTracker[], int currentLevel) {
List<Literal> literals = clause.getDisjunctiveClause();
int count;
for (int i = 0; i < literals.size(); i++) {
count = 0;
if (literalTracker[i] == currentLevel) {
for (int j = i + 1; j < literals.size(); j++) {
count = literalTracker[literals.get(j).get()] < literalTracker[literals.get(i).get()] ? ++count : count;
}
for (int k = i - 1; k > -1; k--) {
count = literalTracker[literals.get(k).get()] < literalTracker[literals.get(i).get()] ? ++count : count;
}
if (count == literals.size() - 1) {
return true;
}
}
}
return false;
}
public static Literal findUnitLiteral(List<Literal> clause, int[] literalTracker,
HashMap<Integer, Literal> solution) {
// return null if not unit clause else, returns the only unassigned
// literal
int numAssigned = 0;
Literal unassigned = null;
if (clause.size() == 1) {
return clause.get(0);
} else {
for (Literal literal : clause) {
// if already assigned
if (literalTracker[literal.get()] != -1) {
numAssigned++;
// else not assigned, check if there is only one literal
// unassigned left the whole value of clause if false
} else {
unassigned = literal;
}
if ((clause.size() - numAssigned == 1) && !isClauseTrue(clause, literalTracker, solution)
&& unassigned != null) {
return unassigned;
}
}
}
return null;
}
public static boolean isClauseTrue(List<Literal> clause, int[] literalTracker, HashMap<Integer, Literal> solution) {
boolean clauseValue = false;
for (Literal literal : clause) {
if (literalTracker[literal.get()] != -1) {
clauseValue = (solution.get(literal.get()).getValue() == literal.getValue()) || clauseValue;
}
}
return clauseValue;
}
} | [
"bernardified@gmail.com"
] | bernardified@gmail.com |
8c11e35533c42618b1b627864331777ad8de16ab | 168101ccd80d2dcfd8d890336156a0bc9a0544d0 | /hql-benchmark-orm6/src/main/java/org/hibernate/benchmarks/hql/orm6/VersionSupportImpl.java | 6812743eba765a76a38cdf8147b5933fb25a892b | [] | no_license | Sanne/hql-benchmark | ce29c9475b0cf2903551bd00e041d58d1eead547 | b5fed1bdbe5c76ab8613260c99523ebd4603c365 | refs/heads/master | 2020-05-24T02:09:45.279218 | 2019-05-09T19:43:31 | 2019-05-09T19:43:31 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,862 | java | /*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later
* See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html
*/
package org.hibernate.benchmarks.hql.orm6;
import org.hibernate.benchmarks.hql.HibernateVersionSupport;
import org.hibernate.benchmarks.hql.HqlParseTreeBuilder;
import org.hibernate.benchmarks.hql.HqlSemanticTreeBuilder;
import org.hibernate.boot.MetadataSources;
import org.hibernate.boot.registry.StandardServiceRegistry;
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
import org.hibernate.engine.spi.SessionFactoryImplementor;
/**
* @author John O`Hara
* @author Luis Barreiro
* @author Andrea Boriero
* @author Steve Ebersole
*/
public class VersionSupportImpl implements HibernateVersionSupport {
private StandardServiceRegistry serviceRegistry;
private SessionFactoryImplementor sessionFactory;
@Override
public void setUp(Class[] annotatedClasses, String[] hbmfiles, boolean createSchema) {
serviceRegistry = new StandardServiceRegistryBuilder().build();
sessionFactory = (SessionFactoryImplementor) new MetadataSources( serviceRegistry )
.addResource( "benchmark.hbm.xml" )
.buildMetadata()
.buildSessionFactory();
}
@Override
public HqlParseTreeBuilder getHqlParseTreeBuilder() {
return new HqlParseTreeBuilderImpl();
}
@Override
public HqlSemanticTreeBuilder getHqlSemanticInterpreter() {
return new HqlSemanticTreeBuilderImpl( sessionFactory);
}
@Override
public void shutDown() {
if ( sessionFactory != null ) {
try {
sessionFactory.close();
}
catch (Exception ignore) {
}
}
if ( serviceRegistry != null ) {
try {
StandardServiceRegistryBuilder.destroy( serviceRegistry );
}
catch (Exception ignore) {
}
}
}
}
| [
"steve@hibernate.org"
] | steve@hibernate.org |
2744fe53f507dfbc33c21dfbb2fb09a39b3c4027 | 9bad7447163a9738db10b94b9d020393a9391d11 | /ContentRec/src/main/java/com/bridgelabz/contentRec/controller/PublisherImplementaion.java | f5f1ef81d73f4155c23169d802e0fe51106e2273 | [] | no_license | Dhareppahm/GamesContetnReccomendationRedisPubSubImpl | d69b404ee23c64841e2b72cf6314cc045a8c35f2 | 7ed47902e57b5efed5f742705a33a7a7caa68cf0 | refs/heads/master | 2020-04-05T23:24:07.060131 | 2017-02-23T13:36:56 | 2017-02-23T13:36:56 | 82,930,106 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,336 | java | /*
* @Author:Dhareppa Metri
* File:GamesCategoryScoreController.java
* Purpose:Publisher implementation class.
**/
package com.bridgelabz.contentRec.controller;
import java.util.concurrent.CountDownLatch;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.data.redis.listener.PatternTopic;
import org.springframework.data.redis.listener.RedisMessageListenerContainer;
import org.springframework.data.redis.listener.adapter.MessageListenerAdapter;
public class PublisherImplementaion {
Logger LOGGER = Logger.getLogger("PublisherImplementaion");
@Autowired
StringRedisTemplate template;
@Autowired
RedisConnectionFactory connectionFactory;
@Autowired
MessageListenerAdapter listenerAdapter;
@Autowired
CountDownLatch latch;
@Autowired
VisitorInformation mVisitorInfoPubSub;
@Bean
RedisMessageListenerContainer container(RedisConnectionFactory connectionFactory,
MessageListenerAdapter listenerAdapter) {
RedisMessageListenerContainer container = new RedisMessageListenerContainer();
container.setConnectionFactory(connectionFactory);
container.addMessageListener(listenerAdapter, new PatternTopic("chat"));
return container;
}
@Bean
MessageListenerAdapter listenerAdapter(SubcriberImplementation receiver) {
return new MessageListenerAdapter(receiver, "receiveMessage");
}
@Bean
SubcriberImplementation receiver(CountDownLatch latch) {
return new SubcriberImplementation(latch);
}
@Bean
CountDownLatch latch() {
return new CountDownLatch(1);
}
@Bean
StringRedisTemplate template(RedisConnectionFactory connectionFactory) {
return new StringRedisTemplate(connectionFactory);
}
public void sendMessage() throws InterruptedException {
System.out.println("Publisher Method Running....");
System.out.println("Storing CSV info to Db......");
LOGGER.info("Sending message...");
mVisitorInfoPubSub.getDataFromCSV();
System.out.println("CSV file updated to Db");
template.convertAndSend("chat", "CSV file updated to Db");
latch.await();
// System.exit(0);
}//End of sendMessage Method
}//End of PubImpl class
| [
"dhareppahm@gmail.com"
] | dhareppahm@gmail.com |
d053a907bebbc84de29abd4b108b2524c62f8430 | a3cfda71887c99a1efac74a07fdfeb42e4ccb216 | /app/src/main/java/com/xiangxue/webviewapp/WebActivity.java | cdd755289a12618df1dc3a71e551f2fb248945b1 | [] | no_license | bobSir/webProcess | 2955e8f5af4e1f5868c4fc576ea384dac377abc5 | ae60ce794bdd7dc5b20e570bc8be647f66995434 | refs/heads/master | 2022-11-16T06:00:10.306088 | 2020-07-10T07:31:01 | 2020-07-10T07:31:01 | 278,568,683 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,800 | java | package com.xiangxue.webviewapp;
import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.MenuItem;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;
import com.xiangxue.webviewapp.R;
import com.xiangxue.webview.AccountWebFragment;
import com.xiangxue.webview.basefragment.BaseWebviewFragment;
import com.xiangxue.webview.CommonWebFragment;
import com.xiangxue.webview.command.Command;
import com.xiangxue.webview.command.CommandsManager;
import com.xiangxue.webview.command.ResultBack;
import com.xiangxue.webview.utils.WebConstants;
import java.util.HashMap;
import java.util.Map;
public class WebActivity extends AppCompatActivity {
private String title;
private String url;
BaseWebviewFragment webviewFragment;
public static void startCommonWeb(Context context, String title, String url, int testLevel) {
Intent intent = new Intent(context, WebActivity.class);
intent.putExtra(WebConstants.INTENT_TAG_TITLE, title);
intent.putExtra(WebConstants.INTENT_TAG_URL, url);
intent.putExtra("level", testLevel);
if (context instanceof Service) {
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
}
context.startActivity(intent);
}
public static void startAccountWeb(Context context, String title, String url, int testLevel, @NonNull HashMap<String, String> headers) {
Intent intent = new Intent(context, WebActivity.class);
Bundle bundle = new Bundle();
bundle.putString(WebConstants.INTENT_TAG_TITLE, title);
bundle.putString(WebConstants.INTENT_TAG_URL, url);
bundle.putSerializable(WebConstants.INTENT_TAG_HEADERS, headers);
bundle.putInt("level", testLevel);
if (context instanceof Service) {
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
}
intent.putExtras(bundle);
context.startActivity(intent);
}
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_common_web);
title = getIntent().getStringExtra(WebConstants.INTENT_TAG_TITLE);
url = getIntent().getStringExtra(WebConstants.INTENT_TAG_URL);
setTitle(title);
FragmentManager fm = getSupportFragmentManager();
FragmentTransaction transaction = fm.beginTransaction();
CommandsManager.getInstance().registerCommand(WebConstants.LEVEL_LOCAL, titleUpdateCommand);
int level = getIntent().getIntExtra("level", WebConstants.LEVEL_BASE);
webviewFragment = null;
if (level == WebConstants.LEVEL_BASE) {
webviewFragment = CommonWebFragment.newInstance(url);
} else {
webviewFragment = AccountWebFragment.newInstance(url, (HashMap<String, String>) getIntent().getExtras().getSerializable(WebConstants.INTENT_TAG_HEADERS), true);
}
transaction.replace(R.id.web_view_fragment, webviewFragment).commit();
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setHomeButtonEnabled(true);
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (webviewFragment != null && webviewFragment instanceof BaseWebviewFragment) {
boolean flag = webviewFragment.onKeyDown(keyCode, event);
if (flag) {
return flag;
}
}
return super.onKeyDown(keyCode, event);
}
/**
* 页面路由
*/
private final Command titleUpdateCommand = new Command() {
@Override
public String name() {
return Command.COMMAND_UPDATE_TITLE;
}
@Override
public void exec(Context context, Map params, ResultBack resultBack) {
if (params.containsKey(Command.COMMAND_UPDATE_TITLE_PARAMS_TITLE)) {
setTitle((String) params.get(Command.COMMAND_UPDATE_TITLE_PARAMS_TITLE));
}
}
};
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.action_sign_out: {
// do your sign-out stuff
break;
}
// case blocks for other MenuItems (if any)
}
return true;
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.toolbar_menu, menu);
return true;
}
}
| [
"3063093332@qq.com"
] | 3063093332@qq.com |
d552223b02e21905b04f5e686e969601b9084395 | f145521a5fdd0673839b2a71e2294aea4d045059 | /manage/com/cc/manage/controller/BindController.java | 7e3d361136a5be0f80738df147cfd4d7a9683574 | [] | no_license | DimonHo/ccplat | 0b68c0b9cc145966b73c51f2e49016be88d7e854 | f717b70014c0c29506c3f4959cbd484b1279d250 | refs/heads/master | 2021-01-14T09:36:34.617896 | 2015-05-25T16:42:51 | 2015-05-25T16:42:51 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,605 | java | package com.cc.manage.controller;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import com.cc.core.common.Result;
import com.cc.core.utils.RequestUtils;
import com.cc.manage.logic.BindLogic;
/**
* 绑定类,用于绑定设备,解绑机器
* @author Einstein
*
*/
@Controller
@RequestMapping("bind")
public class BindController {
@Autowired
private BindLogic bindLogic;
public static Log log = LogFactory.getLog(BindController.class);
/**
* 绑定设置
* @param request uuid,imei(当前设备的唯一编码)
* @param response -1:验证码无效;0:验证码过期;1:绑定成功;2:绑定不成功
*/
@RequestMapping("bindDevice")
public void bindDevice(HttpServletRequest request, HttpServletResponse response) {
String uuid = RequestUtils.getString(request, "uuid");
String imei = RequestUtils.getString(request, "imei");//imei
String model = RequestUtils.getString(request, "model");//model
if (bindLogic.getBindInfo(uuid, imei) != null) {
//已有申请记录
Result.send("0", response);
} else {
boolean flag = bindLogic.bindDevice(uuid, imei, model);
if (flag) {
Result.send("1", response);
}
}
}
}
| [
"vampirehgg@qq.com"
] | vampirehgg@qq.com |
8a6d506126f5b586da564fe6e229053b2677e947 | fa194a7b40466b3791ad44e0cd52cb573090ae85 | /Demo/src/abc/Hello.java | c4b25357eb9ddaa1a71de488bab3caa63fea7f62 | [] | no_license | ashish1204/JenkinsDemo | e119cacd2ec2d52927d02dfc86da634ad93bbd77 | 16920c5095f79b3525c69643fe384b6fec70683b | refs/heads/master | 2022-12-28T08:11:56.248473 | 2020-10-09T12:24:50 | 2020-10-09T12:24:50 | 302,621,186 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 151 | java | package abc;
public class Hello {
public static void main(String[] a) {
for(int i=0;i<=9;i++) {
System.out.println("hello world");
}
}
}
| [
"ashishgandhi220@gmail.com"
] | ashishgandhi220@gmail.com |
37ed05a590d5531211cf8aa0b3c2ba4eee851e77 | a6b7b16ef80be43d9bd0a49072b6338e74178003 | /gaia-test-case-top/gaia-test-case-database-derby/src/main/java/net/sf/gaia/testcase/database/DerbyServer.java | b765b1b17c98c18fe668fd51ffcacd411c68f801 | [
"MIT"
] | permissive | danieljoppi/gaia-framework | 263fe881f877e5d29b1a1ac34eb0852c4843a207 | 806280f258276e09cc4bda6f93a09138a5aef587 | refs/heads/master | 2022-01-14T16:09:02.334535 | 2022-01-10T21:18:28 | 2022-01-10T21:18:28 | 23,439,161 | 0 | 1 | MIT | 2022-01-10T21:18:29 | 2014-08-28T18:47:37 | Java | UTF-8 | Java | false | false | 866 | java | package net.sf.gaia.testcase.database;
import java.io.PrintWriter;
import java.net.InetAddress;
import java.net.URL;
import java.util.Properties;
import org.apache.derby.drda.NetworkServerControl;
public final class DerbyServer {
private NetworkServerControl container;
private String dir;
public DerbyServer(String dir) {
this.dir = dir;
}
public void start() throws Exception {
container = new NetworkServerControl();
container.setTraceDirectory(dir);
Properties props = container.getCurrentProperties();
URL url = ClassLoader.getSystemResource("net/sf/gaia/testcase/database/derby.properties");
props.load(url.openStream());
props.setProperty("derby.drda.traceDirectory", dir);
PrintWriter out = new PrintWriter(System.out, true);
container.start(out);
}
public void stop() throws Exception {
container.shutdown();
}
}
| [
"daniel.joppi@gmail.com"
] | daniel.joppi@gmail.com |
c73258ad8a25de07f6f861885a054acd9834d146 | 8ced32b21f1be9511c256cb8b589d7976b4b98d6 | /temp/user-service/user-api/src/main/java/com/itcrazy/alanmall/user/carddto/HandleDto.java | 1ac55cc7eb947162d8f197bdfb68433fc32e9de3 | [] | no_license | Yangliang266/Alanmall | e5d1e57441790a481ae5aa75aa9d091909440281 | 38c2bde86dab6fd0277c87f99bc860bfc0fbdc0a | refs/heads/master | 2023-06-13T05:01:25.747444 | 2021-07-10T12:18:58 | 2021-07-10T12:18:58 | 293,702,057 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 646 | java | package com.itcrazy.alanmall.user.carddto;
public class HandleDto
{
private Long moduleId;
private Integer system;
public Long getModuleId() {
/* 9 */ return this.moduleId;
}
public void setModuleId(Long moduleId) {
/* 12 */ this.moduleId = moduleId;
}
public Integer getSystem() {
/* 15 */ return this.system;
}
public void setSystem(Integer system) {
/* 18 */ this.system = system;
}
}
/* Location: C:\Users\xiaomi\Desktop\tem\\user-ap\\user-api-1.180516.0-RELEASE.jar!\com\meish\\user\dto\HandleDto.class
* Java compiler version: 8 (52.0)
* JD-Core Version: 1.1.3
*/ | [
"546493589@qq.com"
] | 546493589@qq.com |
99b2058a2bd0181fc8a645fb8933b9897f8635e2 | 2702c1806c6503e701ae74ece7d7d0faa06e3b90 | /j2me/media/graphics/animation/vector/VectorAnimationJ2MEJavaLibrary/src/allbinary/animation/VectorAnimation.java | 320f195df790f0c09cb53828021559ca3af495d7 | [
"LicenseRef-scancode-warranty-disclaimer"
] | no_license | thaingo/AllBinary-Platform | eba8c727480d178ea72771ed3f9548ebed806292 | b94abf99c09f4c4efae6cb200b5eccc55f6c05ed | refs/heads/master | 2020-12-24T09:56:04.600572 | 2011-08-08T11:27:41 | 2011-08-08T11:27:41 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,709 | java | /*
* AllBinary Open License Version 1
* Copyright (c) 2011 AllBinary
*
* By agreeing to this license you and any business entity you represent are
* legally bound to the AllBinary Open License Version 1 legal agreement.
*
* You may obtain the AllBinary Open License Version 1 legal agreement from
* AllBinary or the root directory of AllBinary's AllBinary Platform repository.
*
* Created By: Travis Berthelot
*
*/
package allbinary.animation;
import javax.microedition.lcdui.Graphics;
import org.allbinary.util.CircularIndexUtil;
import abcs.logic.basic.string.CommonStrings;
import abcs.logic.communication.log.LogFactory;
import abcs.logic.communication.log.LogUtil;
import allbinary.graphics.color.BasicColor;
import allbinary.graphics.color.BasicColorSetUtil;
import allbinary.logic.math.PrimitiveIntUtil;
public class VectorAnimation extends IndexedAnimation
implements VectorAnimationInterface
{
private int currentPoints[][][];
private BasicColor basicColor;
//private int color;
private CircularIndexUtil circularIndexUtil;
protected final BasicColorSetUtil basicColorUtil =
BasicColorSetUtil.getInstance();
public VectorAnimation(int currentPoints[][][], BasicColor basicColor)
{
this.setPoints(currentPoints);
this.setBasicColor(basicColor);
}
public VectorAnimation(int currentPoints[][], BasicColor basicColor)
{
this.setPoints(new int[1][currentPoints.length][2]);
int size = currentPoints.length;
for (int index = 0; index < size; index++)
{
this.currentPoints[0][index][0] = currentPoints[index][0];
this.currentPoints[0][index][1] = currentPoints[index][1];
}
this.setBasicColor(basicColor);
}
public BasicColor getBasicColor()
{
return this.basicColor;
}
public void setBasicColor(BasicColor basicColor)
{
this.basicColor = basicColor;
//this.color = this.basicColor.intValue();
}
public int getSize()
{
return this.currentPoints.length;
}
public void setSequence(int[] sequence)
{
}
public int[] getSequence()
{
return PrimitiveIntUtil.getArrayInstance();
}
public void nextFrame()
{
this.circularIndexUtil.next();
}
public void previousFrame()
{
this.circularIndexUtil.previous();
}
protected void paintVectors(Graphics graphics, int x, int y)
{
try
{
/*
* if (this.currentFrame >= this.currentPoints.length) {
* this.currentFrame = 0; }
*/
int nextPointX = 0;
int nextPointY = 0;
int[] nextPoint;
int[] point;
int[][] currentPointsFrame = this.currentPoints[this.circularIndexUtil.getIndex()];
int size = currentPointsFrame.length;
for (int index = size - 3; index >= 0; index--)
{
nextPoint = currentPointsFrame[index];
point = currentPointsFrame[index + 1];
nextPointX = nextPoint[0];
nextPointY = nextPoint[1];
if (nextPointX != 1000)
{
// LogUtil.put(LogFactory.getInstance("Next Line: x1: " +
// this.currentPoints[this.currentFrame][index][0] + x +
// " y1: "
// + this.currentPoints[this.currentFrame][index][1] + y,
// this,
// "paint"));
graphics.drawLine(point[0] + x, point[1] + y,
nextPointX + x, nextPointY + y);
}
else
{
index--;
}
}
}
catch (Exception e)
{
LogUtil.put(LogFactory.getInstance(CommonStrings.getInstance().EXCEPTION, this, "paintVectors", e));
}
}
public void paint(Graphics graphics, int x, int y)
{
this.basicColorUtil.setBasicColor(graphics, basicColor);
this.paintVectors(graphics, x, y);
}
public int getFrame()
{
return this.circularIndexUtil.getIndex();
}
public void setFrame(int index)
{
this.circularIndexUtil.setIndex(index);
}
public int[][] getPoints(int frame)
{
return currentPoints[frame];
}
public void setPoints(int[][][] currentPoints)
{
this.currentPoints = currentPoints;
this.circularIndexUtil = CircularIndexUtil.getInstance(this.currentPoints.length);
}
}
| [
"travisberthelot@hotmail.com"
] | travisberthelot@hotmail.com |
42d92705cdffe7bc2eb8d54ad7c92d10a397e169 | 9fd915ed9996649f22af92dd741a84ba235e2619 | /src/main/java/com/hibernateCaching/HibernateCachingDemo/Alien.java | d254f2fd371f0586bfb8056d1a0f582412dd96cf | [] | no_license | SupriyaRadhakrishnan/HibernateCachingDemo | 0ad5f6e3ccc3725b488baf30837236b3f11b3dd4 | b1765cb2387fa2196c1d01beac262e78312db1d1 | refs/heads/main | 2023-08-18T22:42:16.686749 | 2021-10-22T00:15:54 | 2021-10-22T00:15:54 | 419,914,812 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 987 | java | package com.hibernateCaching.HibernateCachingDemo;
import javax.persistence.Cacheable;
import javax.persistence.Entity;
import javax.persistence.Id;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
@Entity
@Cacheable
@Cache(usage=CacheConcurrencyStrategy.READ_ONLY)
public class Alien {
@Id
private int aid;
private String aname;
//@Column(name="alien_color") can be a different column name in the table.
//@Transient- This will not create a column in the Table
private String color;
public int getAid() {
return aid;
}
public void setAid(int aid) {
this.aid = aid;
}
public String getAname() {
return aname;
}
public void setAname(String aname) {
this.aname = aname;
}
public String getColor() {
return color;
}
public void setColor(String color) {
this.color = color;
}
@Override
public String toString() {
return "Alien [aid=" + aid + ", aname=" + aname + ", color=" + color + "]";
}
}
| [
"supriya7458@gmail.com"
] | supriya7458@gmail.com |
8bc72f1edb143f47f5a189bc1c5af0d635496ae3 | 1f0819aaab3be404d692533831f65bf5d1152979 | /ZoneSignupWeb/src/com/tsp/zone/DoAddBillingResponse.java | 5b018fd48cac08fe8b30bfc3c95c3377ae4d3650 | [] | no_license | prabhusengal/ZONE1511-Yong | a76fef556ccf6d376f44c3a9352b583e0c727f19 | aaf0a17699b0b9ac39259d36dd0f2e6c34e1e202 | refs/heads/master | 2020-12-25T05:06:56.683828 | 2012-07-27T09:14:44 | 2012-07-27T09:14:44 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 744 | java |
package com.tsp.zone;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for doAddBillingResponse complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="doAddBillingResponse">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "doAddBillingResponse")
public class DoAddBillingResponse {
}
| [
"hongdung@thesoftwarepractice.com"
] | hongdung@thesoftwarepractice.com |
b0a917661845952019bb34e15e3d48fd09cad9a8 | 01d2bc428237010874e4a92ca76f6f3a8fced141 | /src/com/arch/webcontroller/ControllerExtendClass.java | 4953b81547feba2156e4ceebc1db940a622e2654 | [] | no_license | Encore0314/qqqq | 97f997652eeccb530c962c11d204a6ef4ba468ab | 482680352d316f37b0209a1409f2031c40f10ca7 | refs/heads/master | 2020-06-01T00:10:57.859284 | 2019-06-05T06:52:12 | 2019-06-05T06:52:12 | 190,550,489 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,227 | java | package com.arch.webcontroller;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.*;
import javax.servlet.http.*;
import com.arch.util.*;
import java.sql.*;
/**
* <p>Title: </p>
*
* <p>Description: </p>
*
* <p>Copyright: Copyright (c) 2006</p>
*
* <p>Company: </p>
*
* @author not attributable
* @version 1.0
*/
public class ControllerExtendClass {
public ControllerExtendClass() {
}
//处理fid的类型,如果是形如Fxx.xx.xx.xx的则给赋old标记,否则赋new标记
public static void divisionFid(HttpServletRequest request) {
String fid = Tools.nvl(request.getParameter(SysConst.PAR_FUNCTIONID));
if (fid.indexOf(".xml") != -1) {
request.setAttribute(SysConst.GLOBE_FLAG, "new");
} else {
request.setAttribute(SysConst.GLOBE_FLAG, "old");
}
}
//在init actionmapping前,对全局存放function的文件function.xml进行内容验证
public static boolean checkFunctionXmlFile(String path) {
return true;
}
//如果在actionMapping里找不到这个actionName,则在function.xml找,如果找到将它append到actionMapping里
public static String extendReadFunctionFile(String path) {
return "";
}
//在系统启动时,检查数据库联接是否正确。
public static boolean initDataBaseConnection() {
DBTransUtil db = new DBTransUtil();
SysConst.trace("2:System begin check the database connection……");
SysConst.trace("JNDI=" + SysConst.JNDI);
Connection con = null;
try {
con = db.getConnection();
if (con != null) {
SysConst.trace("Complete check the connection successful.");
con.close();
return true;
} else {
SysConst.trace(
"Errors occur in checking the database connection.");
return false;
}
} catch (Exception e) {
SysConst.trace(
"Can not open or close the database connection,cause:"
);
SysConst.trace(e.getMessage());
return false;
}
}
}
| [
"tangsongyyh@163.com"
] | tangsongyyh@163.com |
0ce5156af3ddb96e4103667ea6d785fae127a914 | 16ca74ac57310298f6497a7dd6a8c70be9a4b231 | /src/test/java/com/mycompany/myapp/security/DomainUserDetailsServiceIT.java | 66efd76d163b9f2420f4890878fdb06b52faf6b3 | [] | no_license | satishtamilan/jhipster-sample | 76013c25ff58d3a50378b7388dcba7fed015b1d7 | 57b63d521d3875965036512852695160551b4319 | refs/heads/main | 2023-02-17T23:37:55.316191 | 2021-01-20T09:52:49 | 2021-01-20T09:52:49 | 331,262,112 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,689 | java | package com.mycompany.myapp.security;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
import com.mycompany.myapp.JhipsterSampleApplicationApp;
import com.mycompany.myapp.RedisTestContainerExtension;
import com.mycompany.myapp.domain.User;
import com.mycompany.myapp.repository.UserRepository;
import java.util.Locale;
import org.apache.commons.lang3.RandomStringUtils;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.test.context.support.WithMockUser;
/**
* Integrations tests for {@link DomainUserDetailsService}.
*/
@SpringBootTest(classes = JhipsterSampleApplicationApp.class)
@ExtendWith(RedisTestContainerExtension.class)
@WithMockUser("test-user-one")
public class DomainUserDetailsServiceIT {
private static final String USER_ONE_LOGIN = "test-user-one";
private static final String USER_ONE_EMAIL = "test-user-one@localhost";
private static final String USER_TWO_LOGIN = "test-user-two";
private static final String USER_TWO_EMAIL = "test-user-two@localhost";
private static final String USER_THREE_LOGIN = "test-user-three";
private static final String USER_THREE_EMAIL = "test-user-three@localhost";
@Autowired
private UserRepository userRepository;
@Autowired
private UserDetailsService domainUserDetailsService;
@BeforeEach
public void init() {
userRepository.deleteAll();
User userOne = new User();
userOne.setLogin(USER_ONE_LOGIN);
userOne.setPassword(RandomStringUtils.random(60));
userOne.setActivated(true);
userOne.setEmail(USER_ONE_EMAIL);
userOne.setFirstName("userOne");
userOne.setLastName("doe");
userOne.setLangKey("en");
userRepository.save(userOne);
User userTwo = new User();
userTwo.setLogin(USER_TWO_LOGIN);
userTwo.setPassword(RandomStringUtils.random(60));
userTwo.setActivated(true);
userTwo.setEmail(USER_TWO_EMAIL);
userTwo.setFirstName("userTwo");
userTwo.setLastName("doe");
userTwo.setLangKey("en");
userRepository.save(userTwo);
User userThree = new User();
userThree.setLogin(USER_THREE_LOGIN);
userThree.setPassword(RandomStringUtils.random(60));
userThree.setActivated(false);
userThree.setEmail(USER_THREE_EMAIL);
userThree.setFirstName("userThree");
userThree.setLastName("doe");
userThree.setLangKey("en");
userRepository.save(userThree);
}
@Test
public void assertThatUserCanBeFoundByLogin() {
UserDetails userDetails = domainUserDetailsService.loadUserByUsername(USER_ONE_LOGIN);
assertThat(userDetails).isNotNull();
assertThat(userDetails.getUsername()).isEqualTo(USER_ONE_LOGIN);
}
@Test
public void assertThatUserCanBeFoundByLoginIgnoreCase() {
UserDetails userDetails = domainUserDetailsService.loadUserByUsername(USER_ONE_LOGIN.toUpperCase(Locale.ENGLISH));
assertThat(userDetails).isNotNull();
assertThat(userDetails.getUsername()).isEqualTo(USER_ONE_LOGIN);
}
@Test
public void assertThatUserCanBeFoundByEmail() {
UserDetails userDetails = domainUserDetailsService.loadUserByUsername(USER_TWO_EMAIL);
assertThat(userDetails).isNotNull();
assertThat(userDetails.getUsername()).isEqualTo(USER_TWO_LOGIN);
}
@Test
public void assertThatUserCanBeFoundByEmailIgnoreCase() {
UserDetails userDetails = domainUserDetailsService.loadUserByUsername(USER_TWO_EMAIL.toUpperCase(Locale.ENGLISH));
assertThat(userDetails).isNotNull();
assertThat(userDetails.getUsername()).isEqualTo(USER_TWO_LOGIN);
}
@Test
public void assertThatEmailIsPrioritizedOverLogin() {
UserDetails userDetails = domainUserDetailsService.loadUserByUsername(USER_ONE_EMAIL);
assertThat(userDetails).isNotNull();
assertThat(userDetails.getUsername()).isEqualTo(USER_ONE_LOGIN);
}
@Test
public void assertThatUserNotActivatedExceptionIsThrownForNotActivatedUsers() {
assertThatExceptionOfType(UserNotActivatedException.class)
.isThrownBy(() -> domainUserDetailsService.loadUserByUsername(USER_THREE_LOGIN));
}
}
| [
"jhipster-bot@jhipster.tech"
] | jhipster-bot@jhipster.tech |
4d1ab4f77945118fac63d562eb53d1aaeb1563c0 | c5765db45df294be9791e2fbcca65ffe2844bf22 | /src/main/java/com/qd/modules/cms/web/StatsController.java | 58fc1e6eec65d51d83aa1cc9278c41e8c7cfd949 | [
"Apache-2.0"
] | permissive | guohaolei/harry | f7993f09a4c65982e69125769e46a85bc7473f45 | 54fca65e0c500d7705bcffcbb21f5830b9d23eda | refs/heads/master | 2020-12-02T19:44:01.861952 | 2017-06-15T09:41:06 | 2017-06-15T09:41:06 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,316 | java | /**
* Copyright © 2012-2017 <a href="https://www.tech-qd.com">Jeeqd</a> All rights reserved.
*/
package com.qd.modules.cms.web;
import java.util.List;
import java.util.Map;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import com.qd.common.web.BaseController;
import com.qd.modules.cms.entity.Category;
import com.qd.modules.cms.service.StatsService;
/**
* 统计Controller
*
* @author Harry
* @version 2013-5-21
*/
@Controller
@RequestMapping(value = "${adminPath}/cms/stats")
public class StatsController extends BaseController {
@Autowired
private StatsService statsService;
/**
* 文章信息量
*
* @param paramMap
* @param model
* @return
*/
@RequiresPermissions("cms:stats:article")
@RequestMapping(value = "article")
public String article(@RequestParam Map<String, Object> paramMap,
Model model) {
List<Category> list = statsService.article(paramMap);
model.addAttribute("list", list);
model.addAttribute("paramMap", paramMap);
return "modules/cms/statsArticle";
}
}
| [
"183865800@qq.com"
] | 183865800@qq.com |
49797c518e84161995e4ea69f08e7dd7cc362b52 | a81d7846c99675a5297151784d660617f59125db | /appOpenCV/src/main/java/com/example/fofe/opencv/VideoReceiver.java | 75371681bebf3dd216b6df502b17344b40d8bc8f | [] | no_license | jojupiter/VideoChat | bf158b3b3428891dd510ed1742b5dbc052a9694d | da4a476629688874c0980221300e849bdcf8b20f | refs/heads/master | 2020-05-17T16:25:40.988847 | 2019-04-28T08:33:42 | 2019-04-28T08:33:42 | 183,817,949 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 683 | java | package com.example.fofe.opencv;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.widget.ImageView;
import com.example.fofe.opencv.tutorial3.SocketReceiver;
public class VideoReceiver extends AppCompatActivity {
private ImageView imageView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_video_receiver);
imageView= (findViewById(R.id.imageSocketReceiver));
Log.e("Test","On create OK");
SocketReceiver testUDP = new SocketReceiver(imageView);
testUDP.send();
}
}
| [
"sedoufofe@gmail.com"
] | sedoufofe@gmail.com |
1b654af89ade64df61a5a0536c20e4b4c68498d7 | 013389ae8002e0ac4a9ef38012ef1ae05dffe35d | /src/main/java/com/marcura/cargotracker/security/jwt/TokenProvider.java | d977b227ed6a82d2793d1238fc78b00f43981dd0 | [] | no_license | BulkSecurityGeneratorProject/CargoTracker | 5e4cacbea5ad8a86f59f4e15f1ce28e872cf34b2 | 66d1db8695bc7e82bd9cae76ce19800ae15dd798 | refs/heads/master | 2022-12-12T16:20:40.291992 | 2018-01-26T00:53:32 | 2018-01-26T00:53:32 | 296,637,796 | 0 | 0 | null | 2020-09-18T14:03:35 | 2020-09-18T14:03:35 | null | UTF-8 | Java | false | false | 4,049 | java | package com.marcura.cargotracker.security.jwt;
import io.github.jhipster.config.JHipsterProperties;
import java.util.*;
import java.util.stream.Collectors;
import javax.annotation.PostConstruct;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.userdetails.User;
import org.springframework.stereotype.Component;
import io.jsonwebtoken.*;
@Component
public class TokenProvider {
private final Logger log = LoggerFactory.getLogger(TokenProvider.class);
private static final String AUTHORITIES_KEY = "auth";
private String secretKey;
private long tokenValidityInMilliseconds;
private long tokenValidityInMillisecondsForRememberMe;
private final JHipsterProperties jHipsterProperties;
public TokenProvider(JHipsterProperties jHipsterProperties) {
this.jHipsterProperties = jHipsterProperties;
}
@PostConstruct
public void init() {
this.secretKey =
jHipsterProperties.getSecurity().getAuthentication().getJwt().getSecret();
this.tokenValidityInMilliseconds =
1000 * jHipsterProperties.getSecurity().getAuthentication().getJwt().getTokenValidityInSeconds();
this.tokenValidityInMillisecondsForRememberMe =
1000 * jHipsterProperties.getSecurity().getAuthentication().getJwt().getTokenValidityInSecondsForRememberMe();
}
public String createToken(Authentication authentication, Boolean rememberMe) {
String authorities = authentication.getAuthorities().stream()
.map(GrantedAuthority::getAuthority)
.collect(Collectors.joining(","));
long now = (new Date()).getTime();
Date validity;
if (rememberMe) {
validity = new Date(now + this.tokenValidityInMillisecondsForRememberMe);
} else {
validity = new Date(now + this.tokenValidityInMilliseconds);
}
return Jwts.builder()
.setSubject(authentication.getName())
.claim(AUTHORITIES_KEY, authorities)
.signWith(SignatureAlgorithm.HS512, secretKey)
.setExpiration(validity)
.compact();
}
public Authentication getAuthentication(String token) {
Claims claims = Jwts.parser()
.setSigningKey(secretKey)
.parseClaimsJws(token)
.getBody();
Collection<? extends GrantedAuthority> authorities =
Arrays.stream(claims.get(AUTHORITIES_KEY).toString().split(","))
.map(SimpleGrantedAuthority::new)
.collect(Collectors.toList());
User principal = new User(claims.getSubject(), "", authorities);
return new UsernamePasswordAuthenticationToken(principal, token, authorities);
}
public boolean validateToken(String authToken) {
try {
Jwts.parser().setSigningKey(secretKey).parseClaimsJws(authToken);
return true;
} catch (SignatureException e) {
log.info("Invalid JWT signature.");
log.trace("Invalid JWT signature trace: {}", e);
} catch (MalformedJwtException e) {
log.info("Invalid JWT token.");
log.trace("Invalid JWT token trace: {}", e);
} catch (ExpiredJwtException e) {
log.info("Expired JWT token.");
log.trace("Expired JWT token trace: {}", e);
} catch (UnsupportedJwtException e) {
log.info("Unsupported JWT token.");
log.trace("Unsupported JWT token trace: {}", e);
} catch (IllegalArgumentException e) {
log.info("JWT token compact of handler are invalid.");
log.trace("JWT token compact of handler are invalid trace: {}", e);
}
return false;
}
}
| [
"vishalhingorani18@gmail.com"
] | vishalhingorani18@gmail.com |
be04113af16c1175915e4184a756bf2909ed904a | 66138bf3577688398489e4a65f23b139424e9adf | /Minggu 2/inputoutput.java | e0ef2b166cff2b44fc4d69c905fedaa558c75e05 | [] | no_license | Lathifahdhiya/Prolan-12 | f6e8f77a6611907262914d9e44a8af56f4e8dc8d | c9b13cbd084c425ba3bf138758cecb9e81f96fe7 | refs/heads/master | 2021-01-20T15:31:36.055611 | 2017-07-17T00:54:23 | 2017-07-17T00:54:23 | 82,764,744 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 731 | java | import java.util.Scanner;
public class inputoutput
{
public static void main(String [] args)
{
Scanner s = new Scanner (System.in);
String nama;
char jenisKelamin;
int umur;
boolean status;
System.out.println("Masukkan nama anda : ");
nama = s.nextLine();
System.out.println("Masukkan umur anda : ");
umur = s.nextInt();
System.out.println("Masukkan jenis kelamin anda : ");
jenisKelamin = s.next().charAt(0);
System.out.println("Masukkan status anda : (True atau False)");
status = s.nextBoolean();
System.out.println("----------------------------------------");
System.out.println("Nama : "+nama+"\nUmur : "+umur+"\nJenis Kelamin : "+jenisKelamin+"\nStatus : "+status);
}
} | [
"noreply@github.com"
] | noreply@github.com |
bb78203fd64da4486c8b89882b4797a74f371834 | 6f1f83e72c14da838378b2bc349351ad6dd52147 | /src/test/java/org/practice/actionmonitor/web/controller/MessageControllerTest.java | cdcdc64131a7e0a8599973e52a251bc093a977f7 | [] | no_license | GergelyJonas/BV_exercise | 008f6612fbd4e8ee4a1dbdbeb0f94f7f8d3074c9 | 8656065dd7662f2ed8290572c265f2fd62d672f6 | refs/heads/master | 2021-09-09T04:13:41.780303 | 2018-03-13T18:36:48 | 2018-03-13T19:16:13 | 125,096,712 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,437 | java | package org.practice.actionmonitor.web.controller;
import com.fasterxml.jackson.core.JsonProcessingException;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
import org.practice.actionmonitor.business.service.MessageService;
import org.practice.actionmonitor.dal.dto.Message;
import org.practice.actionmonitor.web.model.MessageRequest;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
@RunWith(MockitoJUnitRunner.class)
public class MessageControllerTest {
@Mock
private MessageRequest messageRequest;
@Mock
private MessageService messageService;
private MessageController underTest;
@Before
public void setUp() {
underTest = new MessageController(messageService);
}
@Test
public void shouldSendMessage() throws JsonProcessingException {
//Given
ArgumentCaptor<Message> argumentCaptor = ArgumentCaptor.forClass(Message.class);
String text = "text";
when(messageRequest.getText()).thenReturn(text);
//When
underTest.sendMessage(messageRequest);
//Then
verify(messageService).send(argumentCaptor.capture());
assertThat(argumentCaptor.getValue().getText()).isEqualTo(text);
}
}
| [
"jonasgerg@gmail.com"
] | jonasgerg@gmail.com |
6380adf291ebf20253b636cdee0ca1a2d072232d | de04fc3ebc49a23379f1b51d1a4aead69d539f16 | /aopdemo/src/main/spittr/web/HomeController.java | 8babcdb0083eefee9b9e072523c661300de5368e | [] | no_license | liangyuhang-lyh/repo1 | 0791fce1746eff0e77be67a2680600e8684f2266 | e58c1c6d42b8f50d458aa4a781dad15a6c4b2f8f | refs/heads/master | 2022-12-23T13:56:38.550261 | 2019-10-29T14:12:31 | 2019-10-29T14:12:31 | 217,831,499 | 0 | 0 | null | 2022-12-16T07:17:28 | 2019-10-27T09:22:52 | JavaScript | UTF-8 | Java | false | false | 347 | java | package spittr.web;
import static org.springframework.web.bind.annotation.RequestMethod.*;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
public class HomeController {
@RequestMapping(value="/",method=GET)
public String home(){
return "home";
}
}
| [
"123@duliugang.com"
] | 123@duliugang.com |
29c5fb3ccf29f7d520280dc42bad5798d9df3898 | a5dfb6f0a0152d6142e6ddd0bc7c842fdea3daf9 | /first_semester/first_semester/Exercise16_07/src/Person.java | ceab6b164797fe118fe6f85c51dcad03c9a24bfa | [] | no_license | jimmi280586/Java_school_projects | e7c97dfe380cd3f872487232f1cc060e1fabdc1c | 86b0cb5d38c65e4f7696bc841e3c5eed74e4d552 | refs/heads/master | 2021-01-11T11:58:06.578737 | 2016-12-16T20:55:48 | 2016-12-16T20:55:48 | 76,685,030 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,649 | java | import java.util.Calendar;
public class Person
{
// Declare the fields
private String name;
private MyDate birthday;
// Two-argument Constructor
public Person(String name, MyDate birthday)
{
this.name = name;
// Make sure the birthday object is a composite
this.birthday = birthday.copy();
}
// One-argument Constructor
public Person(MyDate birthday)
{
this.name = null;
this.birthday = birthday.copy();
}
// Set the name variable
public void setName(String name)
{
this.name = name;
}
// Return the name variable
public String getName()
{
return this.name;
}
// Returns a birthday object
public MyDate getBirthday()
{
// Return a copy instead of the internal object
return this.birthday.copy();
}
// Returns the age of the person
public int getAge()
{
// WARNING: complicated!
// Without any arguments to use, the only way to check age is to get the current date/year
// This can be done with the built-in Calendar class
// TO-DO: check if birthday has already happened in the current year
return Calendar.getInstance().get(Calendar.YEAR) - this.birthday.getYear();
}
// Return a String representation
public String toString()
{
// Use the toString method in the MyDate class
return "Name: " + this.name + ", Date of Birth: " + this.birthday.toString();
}
// Compare against another Person object
// WARNING: complicated!
// Need to check if obj is a Person
// then cast obj to Person to do comparisons
public boolean equals(Object obj)
{
if (obj instanceof Person)
{
return this.name.equals(((Person) obj).name) && this.birthday.equals(((Person)obj).birthday);
}
return false;
}
}
| [
"joa@jimmiandersen.dk"
] | joa@jimmiandersen.dk |
f853a878e973ada625c56766ffb60f94a8f09194 | c7b70bfc62c76c6ee4c2c3dab1414c47f6af1754 | /server/src/com/rs/game/player/SpinsManager.java | 89b56fb793eb0e4aed8e7eebc00ce322135554bc | [] | no_license | EnlistedGhost/MorrowRealm-v718 | 4459bb58f5ceb4dca8e4ef5ee7dcd55e57951a6b | 8608210d1a3a3bd4374200ffe938fc56d071b554 | refs/heads/master | 2020-06-01T21:26:28.610346 | 2019-06-24T18:48:29 | 2019-06-24T18:48:29 | 190,932,255 | 2 | 1 | null | null | null | null | UTF-8 | Java | false | false | 493 | java | package com.rs.game.player;
import com.rs.utils.Utils;
public class SpinsManager {
private transient Player player;
public SpinsManager(Player player) {
this.player = player;
}
public void addSpins() {
if (player.getLastSpinsReceived() < Utils.currentTimeMillis()) {
player.setLastSpinsReceived(Utils.currentTimeMillis() + 86400000);// 1 Day
player.setSpins(player.getSpins() + 2);
player.sendMessage("You have received 2 free spins for the Squeal of Fortune.");
}
}
} | [
"enlisted.ghost@gmail.com"
] | enlisted.ghost@gmail.com |
e76270b6679531c802e4995de0908f4ac12175db | 7d169e796639b01c6b652f12effa1d59951b8345 | /src/java/org/apache/bcel/generic/LoadInstruction.java | f277917a0d009aba786d475177af4d98e9ba79e6 | [
"Apache-2.0"
] | permissive | dubenju/javay | 65555744a895ecbd345df07e5537072985095e3b | 29284c847c2ab62048538c3973a9fb10090155aa | refs/heads/master | 2021-07-09T23:44:55.086890 | 2020-07-08T13:03:50 | 2020-07-08T13:03:50 | 47,082,846 | 7 | 1 | null | null | null | null | UTF-8 | Java | false | false | 4,248 | java | package org.apache.bcel.generic;
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache BCEL" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* "Apache BCEL", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
/**
* Denotes an unparameterized instruction to load a value from a local
* variable, e.g. ILOAD.
*
* @version $Id: LoadInstruction.java,v 1.1 2005/12/16 14:11:25 andos Exp $
* @author <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A>
*/
public abstract class LoadInstruction extends LocalVariableInstruction
implements PushInstruction
{
/**
* Empty constructor needed for the Class.newInstance() statement in
* Instruction.readInstruction(). Not to be used otherwise.
* tag and length are defined in readInstruction and initFromFile, respectively.
*/
LoadInstruction(short canon_tag, short c_tag) {
super(canon_tag, c_tag);
}
/**
* @param opcode Instruction opcode
* @param c_tag Instruction number for compact version, ALOAD_0, e.g.
* @param n local variable index (unsigned short)
*/
protected LoadInstruction(short opcode, short c_tag, int n) {
super(opcode, c_tag, n);
}
/**
* Call corresponding visitor method(s). The order is:
* Call visitor methods of implemented interfaces first, then
* call methods according to the class hierarchy in descending order,
* i.e., the most specific visitXXX() call comes last.
*
* @param v Visitor object
*/
public void accept(Visitor v) {
v.visitStackProducer(this);
v.visitPushInstruction(this);
v.visitTypedInstruction(this);
v.visitLocalVariableInstruction(this);
v.visitLoadInstruction(this);
}
}
| [
"dubenju@163.com"
] | dubenju@163.com |
fbed0466feac59008d999cc8bd3b910dafc177a1 | 96f8d42c474f8dd42ecc6811b6e555363f168d3e | /budejie/sources/com/tencent/weibo/sdk/android/api/util/HypyUtil.java | c201a05d17258caa537bd5772a37f7d574d831a6 | [] | no_license | aheadlcx/analyzeApk | 050b261595cecc85790558a02d79739a789ae3a3 | 25cecc394dde4ed7d4971baf0e9504dcb7fabaca | refs/heads/master | 2020-03-10T10:24:49.773318 | 2018-04-13T09:44:45 | 2018-04-13T09:44:45 | 129,332,351 | 6 | 2 | null | null | null | null | UTF-8 | Java | false | false | 2,234 | java | package com.tencent.weibo.sdk.android.api.util;
import android.support.v4.view.MotionEventCompat;
public class HypyUtil {
private static int BEGIN = 45217;
private static int END = 63486;
private static char[] chartable = new char[]{'啊', '芭', '擦', '搭', '蛾', '发', '噶', '哈', '哈', '击', '喀', '垃', '妈', '拿', '哦', '啪', '期', '然', '撒', '塌', '塌', '塌', '挖', '昔', '压', '匝'};
private static char[] initialtable = new char[]{'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'h', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 't', 't', 'w', 'x', 'y', 'z'};
private static int[] table = new int[27];
static {
for (int i = 0; i < 26; i++) {
table[i] = gbValue(chartable[i]);
}
table[26] = END;
}
public static String cn2py(String str) {
int length = str.length();
String str2 = "";
int i = 0;
while (i < length) {
try {
String stringBuilder = new StringBuilder(String.valueOf(str2)).append(Char2Initial(str.charAt(i))).toString();
i++;
str2 = stringBuilder;
} catch (Exception e) {
return "";
}
}
return str2;
}
private static char Char2Initial(char c) {
if (c >= 'a' && c <= 'z') {
return (char) ((c - 97) + 65);
}
if (c >= 'A' && c <= 'Z') {
return c;
}
int gbValue = gbValue(c);
if (gbValue < BEGIN || gbValue > END) {
return c;
}
int i = 0;
while (i < 26 && (gbValue < table[i] || gbValue >= table[i + 1])) {
i++;
}
if (gbValue == END) {
i = 25;
}
return initialtable[i];
}
private static int gbValue(char c) {
try {
byte[] bytes = new StringBuilder(String.valueOf(new String())).append(c).toString().getBytes("GB2312");
if (bytes.length < 2) {
return 0;
}
return (bytes[1] & 255) + ((bytes[0] << 8) & MotionEventCompat.ACTION_POINTER_INDEX_MASK);
} catch (Exception e) {
return 0;
}
}
}
| [
"aheadlcxzhang@gmail.com"
] | aheadlcxzhang@gmail.com |
32fbc9ff7a045a816701bf288c2388b0e77d47f5 | 854d06932d1ad8b6f58f03a1a3fae2b6e30594a0 | /Lab01/src/duvida_botao/MinhaJanelaColorida.java | e0ebafb3b9d10419b16448014b3bc41ce8d20992 | [] | no_license | viniciusdenovaes/Unip202ALPOOdiurno | baf5a82f2fbcf01a1853882aed77f43ad55f2ec6 | 723378d60193f1c4755f308acf6c554d4d3e54d7 | refs/heads/master | 2023-01-09T14:01:33.244900 | 2020-11-06T12:49:48 | 2020-11-06T12:49:48 | 288,170,869 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 1,336 | java | package duvida_botao;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
public class MinhaJanelaColorida extends JFrame {
private JPanel panel;
public MinhaJanelaColorida() {
super("Janela Colorida");
setSize(300, 300);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setLayout(new BorderLayout());
panel = new JPanel();
panel.setLayout(new FlowLayout());
add(panel);
panel.setBackground(Color.BLUE);
JButton botaoVermelho = new JButton("Vermelho");
panel.add(botaoVermelho);
botaoVermelho.addActionListener(new ComportamentoMudaCor(Color.RED));
JButton botaoAzul = new JButton("Azul");
panel.add(botaoAzul);
botaoAzul.addActionListener(new ComportamentoMudaCor(Color.BLUE));
JButton botaoVerde = new JButton("Verde");
panel.add(botaoVerde);
botaoVerde.addActionListener(new ComportamentoMudaCor(Color.GREEN));
setVisible(true);
}
class ComportamentoMudaCor implements ActionListener{
Color cor;
public ComportamentoMudaCor(Color aCor) {
this.cor = aCor;
}
@Override
public void actionPerformed(ActionEvent e) {
panel.setBackground(cor);
}
}
}
| [
"viniciusdenovaes@gmail.com"
] | viniciusdenovaes@gmail.com |
591e3fa10ec67c1b8b1a463d3dc7944090f7df2d | c7118bc1d0187583b880257879e35b7a2964147f | /packages/services/Car/obd2-lib/src/com/android/car/obd2/Obd2Command.java | e3366cfd08c79beb5648f84504c0ca5432d12e6e | [] | no_license | paultcn/android_aosp_8.0 | 9bf6fff95eac0754255b7a3e9f6b63f8bdbb8296 | d4a08b5696e4f404c242ee87eb84eefd5defe419 | refs/heads/master | 2022-04-20T08:26:21.239571 | 2020-04-10T06:00:53 | 2020-04-10T06:00:53 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,625 | java | /*
* Copyright (C) 2017 The Android Open Source Project
*
* 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.
*/
package com.android.car.obd2;
import com.android.car.obd2.commands.AmbientAirTemperature;
import com.android.car.obd2.commands.CalculatedEngineLoad;
import com.android.car.obd2.commands.EngineCoolantTemperature;
import com.android.car.obd2.commands.EngineOilTemperature;
import com.android.car.obd2.commands.EngineRuntime;
import com.android.car.obd2.commands.FuelGaugePressure;
import com.android.car.obd2.commands.FuelSystemStatus;
import com.android.car.obd2.commands.FuelTankLevel;
import com.android.car.obd2.commands.FuelTrimCommand.Bank1LongTermFuelTrimCommand;
import com.android.car.obd2.commands.FuelTrimCommand.Bank1ShortTermFuelTrimCommand;
import com.android.car.obd2.commands.FuelTrimCommand.Bank2LongTermFuelTrimCommand;
import com.android.car.obd2.commands.FuelTrimCommand.Bank2ShortTermFuelTrimCommand;
import com.android.car.obd2.commands.RPM;
import com.android.car.obd2.commands.Speed;
import com.android.car.obd2.commands.ThrottlePosition;
import java.io.IOException;
import java.util.HashMap;
import java.util.Objects;
import java.util.Optional;
import java.util.Set;
/**
* Base class of OBD2 command objects that query a "vehicle" and return an individual data point
* represented as a Java type.
*
* @param <ValueType> The Java type that represents the value of this command's output.
*/
public abstract class Obd2Command<ValueType> {
/**
* Abstract representation of an object whose job it is to receive the bytes read from the OBD2
* connection and return a Java representation of a command's value.
*
* @param <ValueType>
*/
public interface OutputSemanticHandler<ValueType> {
int getPid();
Optional<ValueType> consume(IntegerArrayStream data);
}
public static final int LIVE_FRAME = 1;
public static final int FREEZE_FRAME = 2;
private static final HashMap<Integer, OutputSemanticHandler<Integer>>
SUPPORTED_INTEGER_COMMANDS = new HashMap<>();
private static final HashMap<Integer, OutputSemanticHandler<Float>> SUPPORTED_FLOAT_COMMANDS =
new HashMap<>();
private static void addSupportedIntegerCommands(
OutputSemanticHandler<Integer>... integerOutputSemanticHandlers) {
for (OutputSemanticHandler<Integer> integerOutputSemanticHandler :
integerOutputSemanticHandlers) {
SUPPORTED_INTEGER_COMMANDS.put(
integerOutputSemanticHandler.getPid(), integerOutputSemanticHandler);
}
}
private static void addSupportedFloatCommands(
OutputSemanticHandler<Float>... floatOutputSemanticHandlers) {
for (OutputSemanticHandler<Float> floatOutputSemanticHandler :
floatOutputSemanticHandlers) {
SUPPORTED_FLOAT_COMMANDS.put(
floatOutputSemanticHandler.getPid(), floatOutputSemanticHandler);
}
}
public static Set<Integer> getSupportedIntegerCommands() {
return SUPPORTED_INTEGER_COMMANDS.keySet();
}
public static Set<Integer> getSupportedFloatCommands() {
return SUPPORTED_FLOAT_COMMANDS.keySet();
}
public static OutputSemanticHandler<Integer> getIntegerCommand(int pid) {
return SUPPORTED_INTEGER_COMMANDS.get(pid);
}
public static OutputSemanticHandler<Float> getFloatCommand(int pid) {
return SUPPORTED_FLOAT_COMMANDS.get(pid);
}
static {
addSupportedFloatCommands(
new AmbientAirTemperature(),
new CalculatedEngineLoad(),
new FuelTankLevel(),
new Bank2ShortTermFuelTrimCommand(),
new Bank2LongTermFuelTrimCommand(),
new Bank1LongTermFuelTrimCommand(),
new Bank1ShortTermFuelTrimCommand(),
new ThrottlePosition());
addSupportedIntegerCommands(
new EngineOilTemperature(),
new EngineCoolantTemperature(),
new FuelGaugePressure(),
new FuelSystemStatus(),
new RPM(),
new EngineRuntime(),
new Speed());
}
protected final int mMode;
protected final OutputSemanticHandler<ValueType> mSemanticHandler;
Obd2Command(int mode, OutputSemanticHandler<ValueType> semanticHandler) {
mMode = mode;
mSemanticHandler = Objects.requireNonNull(semanticHandler);
}
public abstract Optional<ValueType> run(Obd2Connection connection) throws Exception;
public int getPid() {
return mSemanticHandler.getPid();
}
public static final <T> LiveFrameCommand<T> getLiveFrameCommand(OutputSemanticHandler handler) {
return new LiveFrameCommand<>(handler);
}
public static final <T> FreezeFrameCommand<T> getFreezeFrameCommand(
OutputSemanticHandler handler, int frameId) {
return new FreezeFrameCommand<>(handler, frameId);
}
/**
* An OBD2 command that returns live frame data.
*
* @param <ValueType> The Java type that represents the command's result type.
*/
public static class LiveFrameCommand<ValueType> extends Obd2Command<ValueType> {
private static final int RESPONSE_MARKER = 0x41;
LiveFrameCommand(OutputSemanticHandler<ValueType> semanticHandler) {
super(LIVE_FRAME, semanticHandler);
}
public Optional<ValueType> run(Obd2Connection connection)
throws IOException, InterruptedException {
String command = String.format("%02X%02X", mMode, mSemanticHandler.getPid());
int[] data = connection.run(command);
IntegerArrayStream stream = new IntegerArrayStream(data);
if (stream.expect(RESPONSE_MARKER, mSemanticHandler.getPid())) {
return mSemanticHandler.consume(stream);
}
return Optional.empty();
}
}
/**
* An OBD2 command that returns freeze frame data.
*
* @param <ValueType> The Java type that represents the command's result type.
*/
public static class FreezeFrameCommand<ValueType> extends Obd2Command<ValueType> {
private static final int RESPONSE_MARKER = 0x2;
private int mFrameId;
FreezeFrameCommand(OutputSemanticHandler<ValueType> semanticHandler, int frameId) {
super(FREEZE_FRAME, semanticHandler);
mFrameId = frameId;
}
public Optional<ValueType> run(Obd2Connection connection)
throws IOException, InterruptedException {
String command =
String.format("%02X%02X %02X", mMode, mSemanticHandler.getPid(), mFrameId);
int[] data = connection.run(command);
IntegerArrayStream stream = new IntegerArrayStream(data);
if (stream.expect(RESPONSE_MARKER, mSemanticHandler.getPid(), mFrameId)) {
return mSemanticHandler.consume(stream);
}
return Optional.empty();
}
}
}
| [
"574926365@qq.com"
] | 574926365@qq.com |
80b4150a431563d41d0cab08831febb513298c40 | a6e595224d55f797e92ac63d5fcffd40851e9ff9 | /RestTest/src/org/resttest/fhn/FHNTest.java | 37ac244d3a53cd27fe02f4032cf496dde25d9982 | [] | no_license | porco1x/jenatests | 6887755061b57ef5ea6cc9dc24507d3f093930c8 | e869442a7ae183e2ccedeacd38ad4a5c241381b8 | refs/heads/master | 2020-03-26T23:12:13.718581 | 2015-09-25T03:31:43 | 2015-09-25T03:31:43 | 31,934,331 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 15,571 | java | package org.resttest.fhn;
import java.io.IOException;
import java.net.URL;
import java.util.ArrayList;
import javax.ws.rs.Consumes;
import javax.ws.rs.FormParam;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import org.openrdf.model.Resource;
import org.openrdf.model.Statement;
import org.openrdf.model.URI;
import org.openrdf.model.Value;
import org.openrdf.query.BindingSet;
import org.openrdf.query.GraphQueryResult;
import org.openrdf.query.MalformedQueryException;
import org.openrdf.query.QueryEvaluationException;
import org.openrdf.query.QueryLanguage;
import org.openrdf.query.TupleQuery;
import org.openrdf.query.TupleQueryResult;
import org.openrdf.query.UnsupportedQueryLanguageException;
import org.openrdf.query.Update;
import org.openrdf.query.UpdateExecutionException;
import org.openrdf.repository.Repository;
import org.openrdf.repository.RepositoryConnection;
import org.openrdf.repository.RepositoryException;
import org.openrdf.repository.http.HTTPRepository;
import org.openrdf.repository.manager.RemoteRepositoryManager;
import org.openrdf.repository.manager.RepositoryInfo;
import org.openrdf.repository.sail.SailRepository;
import org.openrdf.repository.sparql.SPARQLRepository;
import org.openrdf.rio.RDFFormat;
import org.openrdf.rio.RDFParseException;
import org.openrdf.sail.SailException;
import org.openrdf.sail.inferencer.fc.CustomGraphQueryInferencer;
import org.openrdf.sail.memory.MemoryStore;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Response;
import org.json.JSONException;
import org.json.JSONObject;
@Path("/fhn")
public class FHNTest {
private static String FHNRDF = "PREFIX FHNRDF: <http://www.semanticweb.org/porco/ontologies/2015/2/FHNRDF#> ";
private static String FHN = " PREFIX FHN: <htttp://www.shawndexter.com/semantics/FHNOntology#>";
private static String owl = " PREFIX owl: <http://www.w3.org/2002/07/owl#>";
private static String or = "PREFIX or: <http://www.ontologydesignpatterns.org/cp/owl/objectrole.owl#>";
private String queryConstruct = "PREFIX FHNRDF: <http://www.semanticweb.org/porco/ontologies/2015/2/FHNRDF#>\r\n" +
"PREFIX FHN: <htttp://www.shawndexter.com/semantics/FHNOntology#>\r\n" +
"PREFIX owl: <http://www.w3.org/2002/07/owl#>\r\n" +
"PREFIX or: <http://www.ontologydesignpatterns.org/cp/owl/objectrole.owl#>\r\n" +
"PREFIX ar: <http://www.ontologydesignpatterns.org/cp/owl/agentrole.owl#>\r\n" +
"\r\n" +
"CONSTRUCT { ?x FHN:agentIsSatisfiedBy ?y }\r\n" +
"WHERE {\r\n" +
" ?x or:hasRole ?b.\r\n" +
" ?d FHN:isANeedFor ?b.\r\n" +
" ?a FHN:isASatisfierFor ?y. \r\n" +
"}";
private String queryConstruct2 = "PREFIX FHNRDF: <http://www.semanticweb.org/porco/ontologies/2015/2/FHNRDF#>\r\n" +
"PREFIX FHN: <htttp://www.shawndexter.com/semantics/FHNOntology#>\r\n" +
"PREFIX owl: <http://www.w3.org/2002/07/owl#>\r\n" +
"PREFIX or: <http://www.ontologydesignpatterns.org/cp/owl/objectrole.owl#>\r\n" +
"PREFIX ar: <http://www.ontologydesignpatterns.org/cp/owl/agentrole.owl#>\r\n" +
"\r\n" +
"CONSTRUCT { ?x FHN:agentIsSatisfiedBy ?y }\r\n" +
"WHERE {\r\n" +
" ?x or:hasRole ?b.\r\n" +
" ?b FHN:roleHasNeed ?a.\r\n" +
" ?a FHN:isSatisfiedBy ?y. \r\n" +
"}";
private String dbPediaQuery2 = "PREFIX dbo: <http://dbpedia.org/ontology/>\r\n" +
"PREFIX android: <http://dbpedia.org/resources/Category:Android_(operating_system)_software> \r\n" +
"SELECT ?f \r\n" +
"WHERE { \r\n" +
"?f dbpedia2:operatingSystem <http://dbpedia.org/resource/Android_(operating_system)> . \r\n" +
"?f dbpedia-owl:genre <http://dbpedia.org/resource/Physical_fitness>\r\n" +
"}";
private String dbPediaQueryPrefix = "PREFIX owl: <http://www.w3.org/2002/07/owl#>\r\n" +
"PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>\r\n" +
"PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>\r\n" +
"PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\r\n" +
"PREFIX foaf: <http://xmlns.com/foaf/0.1/>\r\n" +
"PREFIX dc: <http://purl.org/dc/elements/1.1/>\r\n" +
"PREFIX : <http://dbpedia.org/resource/>\r\n" +
"PREFIX dbpedia2: <http://dbpedia.org/property/>\r\n" +
"PREFIX dbpedia: <http://dbpedia.org/>\r\n" +
"PREFIX skos: <http://www.w3.org/2004/02/skos/core#> ";
private String dbPediaConferenceQuery = "PREFIX dbo: <http://dbpedia.org/ontology/>\r\n" +
"SELECT ?f \r\n" +
"WHERE {\r\n" +
"?f rdf:type yago:TheoreticalComputerScienceConferences\r\n" +
"}";
private ArrayList<String> dbPdiaList = new ArrayList<String>();
// This method is called if TEXT_PLAIN is request
/*
*/
/*
// This method is called if XML is request
@GET
@Produces(MediaType.TEXT_XML)
public String sayXMLHello() throws MalformedQueryException, UnsupportedQueryLanguageException, SailException, RepositoryException, RDFParseException, QueryEvaluationException, IOException {
String output = queryOntology(output);
return output;
//return "<?xml version=\"1.0\"?>" + "<hello> Hello Jersey" + "</hello>";
}
// This method is called if HTML is request
@GET
@Produces(MediaType.TEXT_HTML)
public String sayHtmlHello() throws MalformedQueryException, UnsupportedQueryLanguageException, SailException, RepositoryException, RDFParseException, QueryEvaluationException, IOException {
String output = queryOntology(output);
return output;
//return "<html> " + "<title>" + "Hello Jersey" + "</title>"
// + "<body><h1>" + "Hello Jersey" + "</body></h1>" + "</html> ";
}
*/
public String queryOntology(String nameOfIndividual) throws MalformedQueryException, UnsupportedQueryLanguageException, SailException, RepositoryException, RDFParseException, IOException, QueryEvaluationException
{
Repository repo = null;
repo = new SailRepository(new CustomGraphQueryInferencer(new MemoryStore(), QueryLanguage.SPARQL, queryConstruct, ""));
repo.initialize();
RepositoryConnection con = repo.getConnection();
URL url = new URL("http://www.shawndexter.com/TheFHNOntology.owl");
con.add(url, url.toString(), RDFFormat.RDFXML);
URL url2 = new URL("http://www.shawndexter.com/FHNRDF.owl");
con.add(url2, url2.toString(), RDFFormat.RDFXML);
con.close();
String output = queryRepo(repo, nameOfIndividual);
return output;
}
private String queryRepo(Repository repo, String nameOfIndividual) throws QueryEvaluationException, RepositoryException, MalformedQueryException {
String queryResult = null;
String need = "";
String satisfier = "";
RepositoryConnection con = repo.getConnection();
queryResult = evaluateGraphQuery(repo, con, nameOfIndividual);
//queryResult = evaluateTupleQuery(repo, con);
if (queryResult!= null) {
return queryResult;
}
return "Failed Query or Connection";
}
private String updateRepo(Repository repo, String insertQuery) throws QueryEvaluationException, RepositoryException, MalformedQueryException {
RepositoryConnection con = repo.getConnection();
Update insert = con.prepareUpdate(QueryLanguage.SPARQL, insertQuery);
try {
insert.execute();
return "/n Insert successful";
} catch (UpdateExecutionException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return "Failed Query or Connection";
}
private String evaluateTupleQuery(Repository repo, RepositoryConnection con, String queryString) throws QueryEvaluationException, RepositoryException, MalformedQueryException {
String queryResult = null;
String need = "";
String satisfier = "";
TupleQuery tupleQuery = con.prepareTupleQuery(QueryLanguage.SPARQL, queryString);
TupleQueryResult result = tupleQuery.evaluate();
String testString = result.toString();
System.out.println(result.toString());
try {
while (result.hasNext()) { // iterate over the result
BindingSet bindingSet = result.next();
Value valueOfF = bindingSet.getValue("f");
this.dbPdiaList.add(valueOfF.toString());
queryResult = queryResult + valueOfF;
}
}
finally {
result.close();
}
if(queryResult != null)
{
return queryResult;
}
else
{
return "Error evaluating graph query";
}
}
private String evaluateGraphQuery(Repository repo, RepositoryConnection con, String nameOfIndividual) throws QueryEvaluationException, RepositoryException, MalformedQueryException {
String queryResult = "";
FHNQuery query = new FHNQuery(nameOfIndividual);
String graphQuery = query.createQuery();
GraphQueryResult graphResult = con.prepareGraphQuery(QueryLanguage.SPARQL, graphQuery).evaluate();
while (graphResult.hasNext()) { // iterate over the result
Statement st = graphResult.next();
queryResult = queryResult + st.getSubject().toString().split("#")[1] + " is satisfied by:"
+ st.getObject().toString().split("#")[1] + "<br>";
}
if(queryResult != null)
{
return queryResult;
}
else
{
return "Error evaluating graph query";
}
}
//Method to query Sesame Repo with only Name
public String querySesameRepository(String nameOfIndividual) throws RepositoryException, QueryEvaluationException, MalformedQueryException{
String serverUrl = "http://localhost:8080/openrdf-sesame";
RemoteRepositoryManager manager = new RemoteRepositoryManager(serverUrl);
manager.initialize();
RepositoryInfo repInfo = manager.getRepositoryInfo("testRepID");
Repository repo = new HTTPRepository(serverUrl, "testRepID");
repo.initialize();
String output = queryRepo(repo, nameOfIndividual);
return output;
}
//Method to update Sesame repo with User Sign Info
public String querySesameRepository(String nameOfIndividual, String insertQuery) throws RepositoryException, QueryEvaluationException, MalformedQueryException{
String serverUrl = "http://localhost:8080/openrdf-sesame";
RemoteRepositoryManager manager = new RemoteRepositoryManager(serverUrl);
manager.initialize();
RepositoryInfo repInfo = manager.getRepositoryInfo("testRepID");
Repository repo = new HTTPRepository(serverUrl, "testRepID");
repo.initialize();
String output = updateRepo(repo, insertQuery);
return output;
}
@GET
@Produces(MediaType.TEXT_PLAIN)
public String sayPlainTextHello() {
return "Hello Jersey";
}
@Path("/convert/{f}")
@GET
@Produces("application/json")
public Response convertFtoCfromInput(@PathParam("f") float f) throws JSONException {
JSONObject jsonObject = new JSONObject();
float celsius;
celsius = (f - 32)*5/9;
jsonObject.put("id", f);
jsonObject.put("content", celsius);
// String result = "@Produces(\"application/json\") Output: \n\nF to C Converter Output: \n\n" + jsonObject;
String result = jsonObject.toString();
return Response.status(200).entity(result).build();
}
@Path("{nameOfIndividual}")
@GET
@Produces(MediaType.TEXT_PLAIN)
public String sayPlainTextHello( @PathParam("nameOfIndividual") String nameOfIndividual) throws MalformedQueryException, UnsupportedQueryLanguageException, SailException, RepositoryException, RDFParseException, QueryEvaluationException, IOException {
// return nameOfIndividual;
//String output = queryOntology(nameOfIndividual);
String output = querySesameRepository(nameOfIndividual);
return output + "asdasdasdtest";
}
@Path("/create/{nameOfIndividual}/{role}/{birthday}/{relationship}/{gender}/{email}")
@GET
@Produces(MediaType.TEXT_PLAIN)
public String createFHNQuery( @PathParam("nameOfIndividual") String nameOfIndividual, @PathParam("role") String role, @PathParam("birthday") String birthday, @PathParam("relationship") String relationship, @PathParam("gender") String gender, @PathParam("email") String email) throws MalformedQueryException, UnsupportedQueryLanguageException, SailException, RepositoryException, RDFParseException, QueryEvaluationException, IOException {
String test = "shawn";
// return nameOfIndividual;
//String output = queryOntology(nameOfIndividual);
//String output = querySesameRepository(nameOfIndividual);
String userProfile = nameOfIndividual + " " + role + " " + birthday + " " + gender + " " + relationship;
FHNQuery createQuery = new FHNQuery(nameOfIndividual, role, gender, relationship, email, birthday) ;
String insertQuery = createQuery.insertNewIndividual();
String getSesame = querySesameRepository(nameOfIndividual, insertQuery);
return insertQuery + "/n" + getSesame;
}
/*
@POST
@Consumes(MediaType.APPLICATION_JSON)
public Response createUser(User user) throws RepositoryException, QueryEvaluationException, MalformedQueryException {
System.out.println("HELLO WORLD");
FHNQuery createQuery = new FHNQuery(user);
String insertQuery = createQuery.insertNewIndividual();
String getSesame = querySesameRepository(user.getName(), insertQuery);
return Response.status(666).entity("Hello world").build();
}
*/
@POST
@Path("/createUser/{nameOfIndividual}/{role}/{birthday}/{relationship}/{gender}/{email}")
@Consumes(MediaType.APPLICATION_JSON)
public Response createUser(@PathParam("nameOfIndividual") String nameOfIndividual, @PathParam("role") String role, @PathParam("birthday") String birthday, @PathParam("relationship") String relationship, @PathParam("gender") String gender, @PathParam("email") String email) throws RepositoryException, QueryEvaluationException, MalformedQueryException{
String userProfile = nameOfIndividual + " " + role + " " + birthday + " " + gender + " " + relationship;
FHNQuery createQuery = new FHNQuery(nameOfIndividual, role, gender, relationship, email, birthday) ;
String insertQuery = createQuery.insertNewIndividual();
String getSesame = querySesameRepository(nameOfIndividual, insertQuery);
this.queryDbPedia();
return Response.status(666).entity(getSesame).build();
}
public void queryDbPedia() throws RepositoryException, QueryEvaluationException, MalformedQueryException{
SPARQLRepository repo = new SPARQLRepository("http://dbpedia.org/sparql");
repo.initialize();
final RepositoryConnection conn = repo.getConnection();
String query= this.dbPediaQueryPrefix+dbPediaConferenceQuery;
String testOutput = evaluateTupleQuery(repo, conn, query);
System.out.println(testOutput);
System.out.println(dbPdiaList.toString());
}
@GET
@Path("/getList")
@Produces(MediaType.APPLICATION_JSON)
public SatisfierList getSatListInJSON() throws RepositoryException, QueryEvaluationException, MalformedQueryException {
queryDbPedia();
SatisfierList satList = new SatisfierList();
satList.setSatList(this.dbPdiaList);
satList.setAgentName("ShawnDexter");
return satList;
}
}
| [
"dexter.shawn@hotmail.com"
] | dexter.shawn@hotmail.com |
17fb13422ef1cc59b3d07a1ea78d840ce3e41c32 | 2fc68ccbd1a3f8b69cf01f6c98c24b7447c3100c | /miaosha_nodes/src/advance/src/main/java/person/sa/dataobject/StockLogDO.java | c74bb04fc26aa2a4374e6a446e8b8556624e6501 | [] | no_license | boyscoding/miaosha | 437acbfc5d8ba0bf54025d7381286d36883e0472 | 0d41de4e4e80f4e9abb32f2a085dcf6c7a23f9f9 | refs/heads/master | 2022-06-24T02:10:13.923277 | 2020-04-12T14:06:52 | 2020-04-12T14:06:52 | 207,053,972 | 1 | 0 | null | 2022-06-21T01:51:15 | 2019-09-08T03:01:34 | Java | UTF-8 | Java | false | false | 3,664 | java | package person.sa.dataobject;
public class StockLogDO {
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column stock_log.stock_log_id
*
* @mbg.generated Tue Jul 02 16:07:40 CST 2019
*/
private String stockLogId;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column stock_log.item_id
*
* @mbg.generated Tue Jul 02 16:07:40 CST 2019
*/
private Integer itemId;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column stock_log.amount
*
* @mbg.generated Tue Jul 02 16:07:40 CST 2019
*/
private Integer amount;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column stock_log.status
*
* @mbg.generated Tue Jul 02 16:07:40 CST 2019
*/
private Integer status;
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column stock_log.stock_log_id
*
* @return the value of stock_log.stock_log_id
* @mbg.generated Tue Jul 02 16:07:40 CST 2019
*/
public String getStockLogId() {
return stockLogId;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column stock_log.stock_log_id
*
* @param stockLogId the value for stock_log.stock_log_id
* @mbg.generated Tue Jul 02 16:07:40 CST 2019
*/
public void setStockLogId(String stockLogId) {
this.stockLogId = stockLogId == null ? null : stockLogId.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column stock_log.item_id
*
* @return the value of stock_log.item_id
* @mbg.generated Tue Jul 02 16:07:40 CST 2019
*/
public Integer getItemId() {
return itemId;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column stock_log.item_id
*
* @param itemId the value for stock_log.item_id
* @mbg.generated Tue Jul 02 16:07:40 CST 2019
*/
public void setItemId(Integer itemId) {
this.itemId = itemId;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column stock_log.amount
*
* @return the value of stock_log.amount
* @mbg.generated Tue Jul 02 16:07:40 CST 2019
*/
public Integer getAmount() {
return amount;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column stock_log.amount
*
* @param amount the value for stock_log.amount
* @mbg.generated Tue Jul 02 16:07:40 CST 2019
*/
public void setAmount(Integer amount) {
this.amount = amount;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column stock_log.status
*
* @return the value of stock_log.status
* @mbg.generated Tue Jul 02 16:07:40 CST 2019
*/
public Integer getStatus() {
return status;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column stock_log.status
*
* @param status the value for stock_log.status
* @mbg.generated Tue Jul 02 16:07:40 CST 2019
*/
public void setStatus(Integer status) {
this.status = status;
}
} | [
"boyscoding@163.com"
] | boyscoding@163.com |
44f330d0774e773b750b66d271fbbfee781748cd | ab47329cc231b2ad82a045edeb7b134d021bcd79 | /app/src/main/java/com/nullgarden/postatask/PlashScreen.java | 892e9393ad894a99cd28908a4a6db47fd459e9ae | [] | no_license | sorawu84/PostATask | b84b24d6d72cd398d9fcab4b62f735a7417b64f3 | f681825cdff738c987230aaf81535cc2de405186 | refs/heads/master | 2021-01-02T22:40:34.189069 | 2017-08-04T16:59:59 | 2017-08-04T16:59:59 | 99,363,523 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 854 | java | package com.nullgarden.postatask;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
public class PlashScreen extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_plash_screen);
Thread mThread = new Thread(){
@Override
public void run() {
try {
sleep(3000);
Intent intent = new Intent(getApplicationContext(),MainActivity.class);
startActivity(intent);
finish();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
};
mThread.start();
}
}
| [
"sorawu84@gmail.com"
] | sorawu84@gmail.com |
b4be8a8f34bbea64d0d347abe9472b697fe578d8 | 93a348c525b7c979bc69749daad1281ac19ad439 | /mcenter/java/so/wwb/gamebox/mcenter/share/form/SysListOperatorSearchForm.java | 9203a79ff8a8f17c2d3c7b3b8d891ad52ed9c38c | [] | no_license | a12791602/gb-app_mcenter | d45f41fc58663226d4769056daf4e46ac80fcb93 | a95cb978b06cdce4420e275a63aea0161059cd00 | refs/heads/master | 2021-09-24T03:22:01.013932 | 2018-09-21T07:51:38 | 2018-09-21T07:51:38 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 272 | java | package so.wwb.gamebox.mcenter.share.form;
import org.soul.web.support.IForm;
/**
* 用户自定义查询条件,列表显示保存表查询表单验证对象
*
* @author tom
* @date 2015-6-1 9:15:39
*/
public class SysListOperatorSearchForm implements IForm {
} | [
"tony@wwb.so"
] | tony@wwb.so |
a256c68d89c0e7ea2d2c4fa572269f3436ae6ba9 | 391b66188c94b9ebb868940f7d367ceae3688046 | /src/main/java/com/example/petproject/controllers/GlobalExceptionHandler.java | ed199de0184e5a360f8de9c84403087ec9840ebd | [] | no_license | Andriireva/petproj | 31ad42e439ad9cd26f9c4d6ec55a8930375775e4 | ef133c33dc17cb0eb99172e98c8e0f77bfc4bccc | refs/heads/master | 2023-02-10T10:28:34.910158 | 2021-01-10T12:17:27 | 2021-01-10T12:17:27 | 315,026,915 | 0 | 0 | null | 2020-11-29T14:18:33 | 2020-11-22T12:00:08 | Java | UTF-8 | Java | false | false | 748 | java | package com.example.petproject.controllers;
import com.example.petproject.exeptions.ResourceNotFoundException;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseStatus;
@ControllerAdvice
public class GlobalExceptionHandler {
@ExceptionHandler({ResourceNotFoundException.class})
// @ResponseStatus(HttpStatus.NOT_FOUND)
public ResponseEntity<HttpErrorBody> handlerResoruceNotFound(ResourceNotFoundException exception) {
return ResponseEntity.status(404).body(new HttpErrorBody(exception.getMessage()));
}
}
| [
"noreply@github.com"
] | noreply@github.com |
e979eeca967bb0e2dd4bc46ade344ecb8cfde821 | e847d9e7ea13dafca663e34acd2988582cf3db09 | /TowerDefence/src/main/java/com/example/towerdefence/DevelopersActivity.java | ccd9f1716a3ef05b90b659c432ccd27f221137b9 | [] | no_license | paknikolay/TowerDefense | 031f33819f64a38f697f9f9fb4b12381073b16da | 9771ae4479d51f3d39b0bded51ca66d56a9eec2a | refs/heads/master | 2020-03-22T04:04:52.151055 | 2018-07-03T07:58:01 | 2018-07-03T07:58:01 | 139,470,935 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,650 | java | package com.example.towerdefence;
import android.app.Activity;
import android.content.Intent;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.util.DisplayMetrics;
import android.view.Menu;
import android.view.MenuItem;
public class DevelopersActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
DisplayMetrics metrics = new DisplayMetrics();
this.getWindowManager().getDefaultDisplay().getMetrics(metrics);
setContentView(new Developer(getApplicationContext(), metrics.widthPixels, metrics.heightPixels, DevelopersActivity.this));
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_developers, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
public void exit()
{
Intent intent=new Intent(this,MainMenuActivity.class);
this.startActivity(intent);
this.finish();
}
}
| [
"noreply@github.com"
] | noreply@github.com |
27a5dd3ee81e6136dc8972d7928088a5ada6b2b1 | edc9fe1e56276df6b39ea3c67d560c9713dc19cc | /src/main/java/net/geforcemods/securitycraft/blocks/BlockFrame.java | ed4d40805c0630d69613fc2d1ae50412cc7ef4da | [] | no_license | Dalluk/SecurityCraftPacketExploit-1.7.10 | 49f33a70ca13e41937f77f5984e5213269f04193 | 591c0e93c989d2455aac99256a66775731da44bd | refs/heads/master | 2022-11-30T03:11:05.137203 | 2020-08-04T17:53:20 | 2020-08-04T17:53:20 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,941 | java | package net.geforcemods.securitycraft.blocks;
import net.geforcemods.securitycraft.main.mod_SecurityCraft;
import net.geforcemods.securitycraft.tileentity.TileEntityFrame;
import net.geforcemods.securitycraft.util.PlayerUtils;
import net.minecraft.block.material.Material;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.MathHelper;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
public class BlockFrame extends BlockOwnable {
public BlockFrame(Material par1) {
super(par1);
}
public boolean renderAsNormalBlock(){
return false;
}
public boolean isNormalCube(){
return false;
}
public boolean isOpaqueCube(){
return false;
}
public int getRenderType(){
return -1;
}
/**
* Called when the block is placed in the world.
*/
public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLivingBase par5EntityLivingBase, ItemStack par6ItemStack){
int l = MathHelper.floor_double(par5EntityLivingBase.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
if(l == 0){
par1World.setBlockMetadataWithNotify(par2, par3, par4, 2, 2);
}
if(l == 1){
par1World.setBlockMetadataWithNotify(par2, par3, par4, 5, 2);
}
if(l == 2){
par1World.setBlockMetadataWithNotify(par2, par3, par4, 3, 2);
}
if(l == 3){
par1World.setBlockMetadataWithNotify(par2, par3, par4, 4, 2);
}
}
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9){
if(par1World.isRemote){
if(mod_SecurityCraft.configHandler.fiveMinAutoShutoff && ((TileEntityFrame) par1World.getTileEntity(par2, par3, par4)).hasCameraLocation()){
((TileEntityFrame) par1World.getTileEntity(par2, par3, par4)).enableView();
return true;
}
}else{
if(!(par1World.getTileEntity(par2, par3, par4) instanceof TileEntityFrame))
return false;
if(!((TileEntityFrame) par1World.getTileEntity(par2, par3, par4)).hasCameraLocation() && (par5EntityPlayer.getCurrentEquippedItem() == null || par5EntityPlayer.getCurrentEquippedItem().getItem() != mod_SecurityCraft.cameraMonitor)){
PlayerUtils.sendMessageToPlayer(par5EntityPlayer, StatCollector.translateToLocal("tile.keypadFrame.name"), StatCollector.translateToLocal("messages.frame.rightclick"), EnumChatFormatting.RED);
return false;
}
if(PlayerUtils.isHoldingItem(par5EntityPlayer, mod_SecurityCraft.keyPanel))
return false;
}
return false;
}
public TileEntity createNewTileEntity(World var1, int var2) {
return new TileEntityFrame();
}
}
| [
"spam.clash.iyad@gmail.com"
] | spam.clash.iyad@gmail.com |
adaaba5a3678d56a74376f775755db34f87e9cdb | 341c9c7a38acbe5bd3bc3a6eab13f893e2a1907f | /app/src/main/java/com/chengyi/app/model/model/GameMode.java | 83caddae8012a98af6527a7911c82768dc2af6b6 | [] | no_license | Async-Wu/jicaired | 7c30492da040c5b31e427b02f35601fd1ce21b12 | 9ecec93d8358ea1de01eb51f9e1835ba3f424918 | refs/heads/master | 2021-01-25T11:28:10.127368 | 2018-03-01T07:33:38 | 2018-03-01T07:33:38 | 123,399,131 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,072 | java | package com.chengyi.app.model.model;
import java.io.Serializable;
import java.util.ArrayList;
/**
* Created by lishangfan on 2016/11/17.
*/
public class GameMode implements Serializable{
protected String gameName;// 联赛名
protected String time;// 比赛时间
protected String team1;// 队伍1
protected String team2;// 队伍2
protected int rangNumber = 0;// 让球数
public String getGameName() {
return gameName;
}
public void setGameName(String gameName) {
this.gameName = gameName;
}
public String getTeam1() {
return team1;
}
public void setTeam1(String team1) {
this.team1 = team1;
}
public String getTeam2() {
return team2;
}
public void setTeam2(String team2) {
this.team2 = team2;
}
// 比分投注按钮
protected String[] biFenStr = "1:0,2:0,2:1,3:0,3:1,3:2,4:0,4:1,4:2,5:0,5:1,5:2,胜其他,0:0,1:1,2:2,3:3,平其他,0:1,0:2,1:2,0:3,1:3,2:3,0:4,1:4,2:4,0:5,1:5,2:5,负其他"
.split(",");
public String[] getBiFenStr() {
return biFenStr;
}
public void setBiFenStr(String[] biFenStr) {
this.biFenStr = biFenStr;
}
protected ArrayList<String> bqcList = new ArrayList<String>();// 半全场,比分投注的内容
public ArrayList<String> getBqcList() {
return bqcList;
}
public void setBqcList(ArrayList<String> bqcList) {
this.bqcList = bqcList;
}
protected String selectedStr; //半全场,比分投注选择的拼接成的串
public String getSelectedStr() {
return selectedStr;
}
public void setSelectedStr(String selectedStr) {
this.selectedStr = selectedStr;
spfFlag = selectedStr.split(",").length - 1;
}
protected int spfFlag = -1; // /投注列表中被选中的按钮的个数,主要用来计算注数所用
public int getSpfFlag() {
return spfFlag;
}
public void setSpfFlag(int spfFlag) {
this.spfFlag = spfFlag;
}
}
| [
"810284176@qq.com"
] | 810284176@qq.com |
58306e1afee8aea31f1b871d04d2934bb796c736 | 647ec12ce50f06e7380fdbfb5b71e9e2d1ac03b4 | /com.tencent.mm/classes.jar/com/tencent/mm/plugin/finder/live/olympic/widget/d$b.java | a3ec1f6e844cd380f0f5381e2c1622cd433fc923 | [] | no_license | tsuzcx/qq_apk | 0d5e792c3c7351ab781957bac465c55c505caf61 | afe46ef5640d0ba6850cdefd3c11badbd725a3f6 | refs/heads/main | 2022-07-02T10:32:11.651957 | 2022-02-01T12:41:38 | 2022-02-01T12:41:38 | 453,860,108 | 36 | 9 | null | 2022-01-31T09:46:26 | 2022-01-31T02:43:22 | Java | UTF-8 | Java | false | false | 354 | java | package com.tencent.mm.plugin.finder.live.olympic.widget;
import kotlin.Metadata;
@Metadata(k=3, mv={1, 5, 1}, xi=48)
public final class d$b {}
/* Location: L:\local\mybackup\temp\qq_apk\com.tencent.mm\classes2.jar
* Qualified Name: com.tencent.mm.plugin.finder.live.olympic.widget.d.b
* JD-Core Version: 0.7.0.1
*/ | [
"98632993+tsuzcx@users.noreply.github.com"
] | 98632993+tsuzcx@users.noreply.github.com |
eaebb6387f4b0c52e06329abf4ed35e419393969 | 0af7c2914cddadacfff6e41650d6c993338239d8 | /src/java/servlet/LoginServlet.java | 59e9b032b0a91720b2fb015a13b091d3ae05aad0 | [] | no_license | LIcopyleft/Java-jsp-servlets-jdbc | 5dcb9689efca0f2c207c6a2e9fa5c350ed32dc0b | 855ec50188a794b7539a47b9af5b57dc2bd4cbfc | refs/heads/master | 2022-12-13T06:14:36.948143 | 2020-09-14T06:27:30 | 2020-09-14T06:27:30 | 295,286,863 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,248 | java |
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import com.web.app.eng.SoftwareEngineer;
import com.web.app.login.eng.LoginEngineer;
import com.web.app.login.mgr.LoginManager;
import com.web.app.login.user.LoginUser;
import com.web.app.login.userdao.UserDAO;
import com.web.app.mgr.Manager;
import com.web.app.user.User;
/**
*
* @author Tiego Makaleng
*/
public class LoginServlet extends HttpServlet {
@Override
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
//Interpret the request
PrintWriter out = response.getWriter();
HttpSession session = request.getSession(true);
String decision = request.getParameter("login");
String driver, url, user, pass;
url = getServletContext().getInitParameter("url");
driver = getServletContext().getInitParameter("driver");
user = getServletContext().getInitParameter("username");
pass = getServletContext().getInitParameter("password");
try
{
UserDAO dao = new UserDAO(driver, url, user, pass);
LoginUser objUser = new LoginUser(0, request.getParameter("usern"), request.getParameter("passw"));
boolean validUser = dao.loginUser(objUser.getUsername(), objUser.getPassword());
LoginEngineer objEng = new LoginEngineer(0, request.getParameter("usern"), request.getParameter("passw"));
boolean validEngineer = dao.loginEngineer(objEng.getUsername(), objEng.getPassword());
LoginManager objMgr = new LoginManager(0, request.getParameter("usern"), request.getParameter("passw"));
boolean validManager = dao.loginManager(objMgr.getUsername(), objMgr.getPassword());
if (request.getParameter("usern") != "" && request.getParameter("passw") != "") {
if (validUser)
{
response.sendRedirect("User.jsp");
List<User> list = (ArrayList<User>)dao.getUserLoggedIn(request.getParameter("usern"), request.getParameter("passw"));
session.setAttribute("listUser", list);
}
else
if (validEngineer)
{
List<SoftwareEngineer> list = (ArrayList<SoftwareEngineer>)dao.getEngineerLoggedIn(request.getParameter("usern"), request.getParameter("passw"));
response.sendRedirect("Engineer.jsp");
session.setAttribute("listEngineer", list);
}
else
if (validManager)
{
List<Manager> list = (ArrayList<Manager>)dao.getManagerLoggedIn(request.getParameter("usern"), request.getParameter("passw"));
session.setAttribute("listManager", list);
response.sendRedirect("Manager.jsp");
}
else {
// String invalidLogin = "Incorrect username/password.";
// request.setAttribute("login", invalidLogin);
// RequestDispatcher dispatch = request.getRequestDispatcher("index.jsp");
// dispatch.forward(request, response);
response.sendRedirect("invalidLogin.html");
}
}
else {
// String invalidLogin = "All fields must be entered.";
// request.setAttribute("loginFields", invalidLogin);
// RequestDispatcher dispatch = request.getRequestDispatcher("index.jsp");
// dispatch.forward(request, response);
response.sendRedirect("fields.html");
}
} catch (Exception e) {
out.println(e.getMessage());
}
}
}
| [
"“976225259@qq.com"
] | “976225259@qq.com |
af7215515918dcd7a3cd797fd72ad783e2be0318 | 8aac068aaeb2f3edd5a8e4516711ac503500f926 | /MCI Latest 1/app/src/androidTest/java/com/greenusys/personal/registrationapp/ExampleInstrumentedTest.java | c0b9f705f95dcbae410ad01e844899b245e2297e | [] | no_license | greenusys/androidBackUp | f436c0f2d7c91ad99b2223556acc8a0b1c730bf1 | 2cb69c8087f7758f7711ab79ea4b1b05ec47dc34 | refs/heads/master | 2020-12-14T11:14:33.403690 | 2020-01-18T11:29:22 | 2020-01-18T11:29:22 | 234,721,480 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 799 | java | package com.example.personal.registrationapp;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.example.personal.registrationapp", appContext.getPackageName());
}
}
| [
"sayed@Sayed.Md.Kaif"
] | sayed@Sayed.Md.Kaif |
f5a0f013f2e12c13b76623b9ce5604cfd733cc90 | 6781d1f53810e7ff9bb8aedd309ef80c36935301 | /LC127.java | 502ed95eb68a9e5b034be8ecba78fd0bad177fbf | [] | no_license | taslim45/LeetCode | 382000827237772976374466c166d84598e6f168 | 5179b9915e70617ce3c40ece7b878ac1e5292fc1 | refs/heads/main | 2023-08-13T14:08:45.009975 | 2021-10-14T19:49:39 | 2021-10-14T19:49:39 | 415,764,771 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,635 | java | class Solution {
private class Ladder {
String word;
int dist;
Ladder(String w, int d) {
word = w;
dist = d;
}
}
public int ladderLength(String beginWord, String endWord, List<String> wordList) {
Map<String, Integer> dict = new HashMap<>();
int wlLen = wordList.size();
int[] visit = new int[wlLen];
for(int i=0; i<wlLen; i++) {
dict.put(wordList.get(i), i);
}
if(!dict.containsKey(endWord)) return 0;
Queue<Ladder> queue = new LinkedList<>();
queue.add(new Ladder(beginWord, 1));
if(dict.containsKey(beginWord)) {
visit[dict.get(beginWord)] = 1;
}
while(!queue.isEmpty()) {
Ladder aStep = queue.poll();
String str = aStep.word;
int distSoFar = aStep.dist;
if(str.compareTo(endWord) == 0) return distSoFar;
for(int i=0; i<wlLen; i++) {
if(visit[i] == 0 && isDistanceOne(str, wordList.get(i))) {
visit[i] = 1;
queue.add(new Ladder(wordList.get(i), distSoFar + 1));
}
}
}
return 0;
}
private boolean isDistanceOne(String s1, String s2) {
if(s1.length() != s2.length()) return false;
int diff = 0;
for(int i=0; i<s1.length(); i++) {
if(s1.charAt(i) != s2.charAt(i)) diff++;
if(diff > 1) return false;
}
return true;
}
}
| [
"noreply@github.com"
] | noreply@github.com |
481f3563a1d06eaf82034e159b269dd63d377e5a | 98e5e0ea09359208628055d67521bfecc9f1dd64 | /wp-starter-core/src/test/java/RepositoryExecutor.java | b529a329edd67ac3a7593ed5b9fbb3a0b91f299e | [] | no_license | kirkovg/wp-labs-2016 | 76fe0a8a123c62c045fe85566337e0d50556ed87 | 7ac89fe5ddd9340dfdb263d938e7f573ebff6967 | refs/heads/master | 2021-01-21T10:04:21.523011 | 2017-02-27T21:23:50 | 2017-02-27T21:23:50 | 83,357,970 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,123 | java | import mk.ukim.finki.wp.model.Group;
import mk.ukim.finki.wp.persistence.GroupRepository;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.List;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("classpath:spring/persistence-config.xml")
public class RepositoryExecutor {
@Autowired
GroupRepository repository;
@Test
public void showAllGroups() {
List<Group> results = repository.findAll();
System.out.println(results);
}
@Test
public void getGroupById() {
System.out.println(repository.findById(3L));
}
@Test
public void saveGroup(){
repository.save(new Group("newGroup",40,33));
}
@Test
public void updateGroup() {
repository.update(2L, new Group("group2Updated",40,33));
}
@Test
public void deleteGroup() {
repository.delete(2L);
}
} | [
"gjorgjikirkov@gmail.com"
] | gjorgjikirkov@gmail.com |
cd1b14dd25b6db652561d7dfbcb68811edee92ee | fcce5ddf28ca64ad0716fd8a18695d5602a63f54 | /Parse-Starter-Project-1.12.0 (3)/ParseStarterProject/build/generated/source/r/debug/com/google/android/gms/appinvite/R.java | d24dab468823e357a1f432fbda92d65336c2edaa | [] | no_license | carlsonkellie/Marauders-Mapp | ceccc6ccf5e1012aea444616609e2632052cfa06 | c4bea57138368e3b6ea4b43738f89b357f3c0775 | refs/heads/master | 2021-01-10T13:27:40.331082 | 2017-08-28T13:26:08 | 2017-08-28T13:26:08 | 49,902,452 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 21,946 | java | /* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* aapt tool from the resource data it found. It
* should not be modified by hand.
*/
package com.google.android.gms.appinvite;
public final class R {
public static final class attr {
public static final int adSize = 0x7f010027;
public static final int adSizes = 0x7f010028;
public static final int adUnitId = 0x7f010029;
public static final int ambientEnabled = 0x7f010051;
public static final int appTheme = 0x7f0100ef;
public static final int buttonSize = 0x7f010067;
public static final int buyButtonAppearance = 0x7f0100f6;
public static final int buyButtonHeight = 0x7f0100f3;
public static final int buyButtonText = 0x7f0100f5;
public static final int buyButtonWidth = 0x7f0100f4;
public static final int cameraBearing = 0x7f010042;
public static final int cameraTargetLat = 0x7f010043;
public static final int cameraTargetLng = 0x7f010044;
public static final int cameraTilt = 0x7f010045;
public static final int cameraZoom = 0x7f010046;
public static final int circleCrop = 0x7f010040;
public static final int colorScheme = 0x7f010068;
public static final int environment = 0x7f0100f0;
public static final int fragmentMode = 0x7f0100f2;
public static final int fragmentStyle = 0x7f0100f1;
public static final int imageAspectRatio = 0x7f01003f;
public static final int imageAspectRatioAdjust = 0x7f01003e;
public static final int liteMode = 0x7f010047;
public static final int mapType = 0x7f010041;
public static final int maskedWalletDetailsBackground = 0x7f0100f9;
public static final int maskedWalletDetailsButtonBackground = 0x7f0100fb;
public static final int maskedWalletDetailsButtonTextAppearance = 0x7f0100fa;
public static final int maskedWalletDetailsHeaderTextAppearance = 0x7f0100f8;
public static final int maskedWalletDetailsLogoImageType = 0x7f0100fd;
public static final int maskedWalletDetailsLogoTextColor = 0x7f0100fc;
public static final int maskedWalletDetailsTextAppearance = 0x7f0100f7;
public static final int scopeUris = 0x7f010069;
public static final int uiCompass = 0x7f010048;
public static final int uiMapToolbar = 0x7f010050;
public static final int uiRotateGestures = 0x7f010049;
public static final int uiScrollGestures = 0x7f01004a;
public static final int uiTiltGestures = 0x7f01004b;
public static final int uiZoomControls = 0x7f01004c;
public static final int uiZoomGestures = 0x7f01004d;
public static final int useViewLifecycle = 0x7f01004e;
public static final int windowTransitionStyle = 0x7f010032;
public static final int zOrderOnTop = 0x7f01004f;
}
public static final class color {
public static final int common_action_bar_splitter = 0x7f0c0012;
public static final int common_google_signin_btn_text_dark = 0x7f0c0068;
public static final int common_google_signin_btn_text_dark_default = 0x7f0c0013;
public static final int common_google_signin_btn_text_dark_disabled = 0x7f0c0014;
public static final int common_google_signin_btn_text_dark_focused = 0x7f0c0015;
public static final int common_google_signin_btn_text_dark_pressed = 0x7f0c0016;
public static final int common_google_signin_btn_text_light = 0x7f0c0069;
public static final int common_google_signin_btn_text_light_default = 0x7f0c0017;
public static final int common_google_signin_btn_text_light_disabled = 0x7f0c0018;
public static final int common_google_signin_btn_text_light_focused = 0x7f0c0019;
public static final int common_google_signin_btn_text_light_pressed = 0x7f0c001a;
public static final int common_plus_signin_btn_text_dark = 0x7f0c006a;
public static final int common_plus_signin_btn_text_dark_default = 0x7f0c001b;
public static final int common_plus_signin_btn_text_dark_disabled = 0x7f0c001c;
public static final int common_plus_signin_btn_text_dark_focused = 0x7f0c001d;
public static final int common_plus_signin_btn_text_dark_pressed = 0x7f0c001e;
public static final int common_plus_signin_btn_text_light = 0x7f0c006b;
public static final int common_plus_signin_btn_text_light_default = 0x7f0c001f;
public static final int common_plus_signin_btn_text_light_disabled = 0x7f0c0020;
public static final int common_plus_signin_btn_text_light_focused = 0x7f0c0021;
public static final int common_plus_signin_btn_text_light_pressed = 0x7f0c0022;
public static final int place_autocomplete_prediction_primary_text = 0x7f0c0039;
public static final int place_autocomplete_prediction_primary_text_highlight = 0x7f0c003a;
public static final int place_autocomplete_prediction_secondary_text = 0x7f0c003b;
public static final int place_autocomplete_search_hint = 0x7f0c003c;
public static final int place_autocomplete_search_text = 0x7f0c003d;
public static final int place_autocomplete_separator = 0x7f0c003e;
public static final int wallet_bright_foreground_disabled_holo_light = 0x7f0c0051;
public static final int wallet_bright_foreground_holo_dark = 0x7f0c0052;
public static final int wallet_bright_foreground_holo_light = 0x7f0c0053;
public static final int wallet_dim_foreground_disabled_holo_dark = 0x7f0c0054;
public static final int wallet_dim_foreground_holo_dark = 0x7f0c0055;
public static final int wallet_dim_foreground_inverse_disabled_holo_dark = 0x7f0c0056;
public static final int wallet_dim_foreground_inverse_holo_dark = 0x7f0c0057;
public static final int wallet_highlighted_text_holo_dark = 0x7f0c0058;
public static final int wallet_highlighted_text_holo_light = 0x7f0c0059;
public static final int wallet_hint_foreground_holo_dark = 0x7f0c005a;
public static final int wallet_hint_foreground_holo_light = 0x7f0c005b;
public static final int wallet_holo_blue_light = 0x7f0c005c;
public static final int wallet_link_text_light = 0x7f0c005d;
public static final int wallet_primary_text_holo_light = 0x7f0c006e;
public static final int wallet_secondary_text_holo_dark = 0x7f0c006f;
}
public static final class dimen {
public static final int place_autocomplete_button_padding = 0x7f08004b;
public static final int place_autocomplete_powered_by_google_height = 0x7f08004c;
public static final int place_autocomplete_powered_by_google_start = 0x7f08004d;
public static final int place_autocomplete_prediction_height = 0x7f08004e;
public static final int place_autocomplete_prediction_horizontal_margin = 0x7f08004f;
public static final int place_autocomplete_prediction_primary_text = 0x7f080050;
public static final int place_autocomplete_prediction_secondary_text = 0x7f080051;
public static final int place_autocomplete_progress_horizontal_margin = 0x7f080052;
public static final int place_autocomplete_progress_size = 0x7f080053;
public static final int place_autocomplete_separator_start = 0x7f080054;
}
public static final class drawable {
public static final int cast_ic_notification_0 = 0x7f02003e;
public static final int cast_ic_notification_1 = 0x7f02003f;
public static final int cast_ic_notification_2 = 0x7f020040;
public static final int cast_ic_notification_connecting = 0x7f020041;
public static final int cast_ic_notification_on = 0x7f020042;
public static final int common_full_open_on_phone = 0x7f020043;
public static final int common_google_signin_btn_icon_dark = 0x7f020044;
public static final int common_google_signin_btn_icon_dark_disabled = 0x7f020045;
public static final int common_google_signin_btn_icon_dark_focused = 0x7f020046;
public static final int common_google_signin_btn_icon_dark_normal = 0x7f020047;
public static final int common_google_signin_btn_icon_dark_pressed = 0x7f020048;
public static final int common_google_signin_btn_icon_light = 0x7f020049;
public static final int common_google_signin_btn_icon_light_disabled = 0x7f02004a;
public static final int common_google_signin_btn_icon_light_focused = 0x7f02004b;
public static final int common_google_signin_btn_icon_light_normal = 0x7f02004c;
public static final int common_google_signin_btn_icon_light_pressed = 0x7f02004d;
public static final int common_google_signin_btn_text_dark = 0x7f02004e;
public static final int common_google_signin_btn_text_dark_disabled = 0x7f02004f;
public static final int common_google_signin_btn_text_dark_focused = 0x7f020050;
public static final int common_google_signin_btn_text_dark_normal = 0x7f020051;
public static final int common_google_signin_btn_text_dark_pressed = 0x7f020052;
public static final int common_google_signin_btn_text_light = 0x7f020053;
public static final int common_google_signin_btn_text_light_disabled = 0x7f020054;
public static final int common_google_signin_btn_text_light_focused = 0x7f020055;
public static final int common_google_signin_btn_text_light_normal = 0x7f020056;
public static final int common_google_signin_btn_text_light_pressed = 0x7f020057;
public static final int common_ic_googleplayservices = 0x7f020058;
public static final int common_plus_signin_btn_icon_dark = 0x7f020059;
public static final int common_plus_signin_btn_icon_dark_disabled = 0x7f02005a;
public static final int common_plus_signin_btn_icon_dark_focused = 0x7f02005b;
public static final int common_plus_signin_btn_icon_dark_normal = 0x7f02005c;
public static final int common_plus_signin_btn_icon_dark_pressed = 0x7f02005d;
public static final int common_plus_signin_btn_icon_light = 0x7f02005e;
public static final int common_plus_signin_btn_icon_light_disabled = 0x7f02005f;
public static final int common_plus_signin_btn_icon_light_focused = 0x7f020060;
public static final int common_plus_signin_btn_icon_light_normal = 0x7f020061;
public static final int common_plus_signin_btn_icon_light_pressed = 0x7f020062;
public static final int common_plus_signin_btn_text_dark = 0x7f020063;
public static final int common_plus_signin_btn_text_dark_disabled = 0x7f020064;
public static final int common_plus_signin_btn_text_dark_focused = 0x7f020065;
public static final int common_plus_signin_btn_text_dark_normal = 0x7f020066;
public static final int common_plus_signin_btn_text_dark_pressed = 0x7f020067;
public static final int common_plus_signin_btn_text_light = 0x7f020068;
public static final int common_plus_signin_btn_text_light_disabled = 0x7f020069;
public static final int common_plus_signin_btn_text_light_focused = 0x7f02006a;
public static final int common_plus_signin_btn_text_light_normal = 0x7f02006b;
public static final int common_plus_signin_btn_text_light_pressed = 0x7f02006c;
public static final int ic_plusone_medium_off_client = 0x7f020082;
public static final int ic_plusone_small_off_client = 0x7f020083;
public static final int ic_plusone_standard_off_client = 0x7f020084;
public static final int ic_plusone_tall_off_client = 0x7f020085;
public static final int places_ic_clear = 0x7f020096;
public static final int places_ic_search = 0x7f020097;
public static final int powered_by_google_dark = 0x7f020098;
public static final int powered_by_google_light = 0x7f020099;
}
public static final class id {
public static final int adjust_height = 0x7f0d001d;
public static final int adjust_width = 0x7f0d001e;
public static final int android_pay = 0x7f0d0047;
public static final int android_pay_dark = 0x7f0d003e;
public static final int android_pay_light = 0x7f0d003f;
public static final int android_pay_light_with_border = 0x7f0d0040;
public static final int auto = 0x7f0d002a;
public static final int book_now = 0x7f0d0037;
public static final int buyButton = 0x7f0d0034;
public static final int buy_now = 0x7f0d0038;
public static final int buy_with = 0x7f0d0039;
public static final int buy_with_google = 0x7f0d003a;
public static final int cast_notification_id = 0x7f0d0004;
public static final int classic = 0x7f0d0041;
public static final int dark = 0x7f0d002b;
public static final int donate_with = 0x7f0d003b;
public static final int donate_with_google = 0x7f0d003c;
public static final int google_wallet_classic = 0x7f0d0042;
public static final int google_wallet_grayscale = 0x7f0d0043;
public static final int google_wallet_monochrome = 0x7f0d0044;
public static final int grayscale = 0x7f0d0045;
public static final int holo_dark = 0x7f0d002e;
public static final int holo_light = 0x7f0d002f;
public static final int hybrid = 0x7f0d001f;
public static final int icon_only = 0x7f0d0027;
public static final int light = 0x7f0d002c;
public static final int logo_only = 0x7f0d003d;
public static final int match_parent = 0x7f0d0036;
public static final int monochrome = 0x7f0d0046;
public static final int none = 0x7f0d000f;
public static final int normal = 0x7f0d000b;
public static final int place_autocomplete_clear_button = 0x7f0d00ac;
public static final int place_autocomplete_powered_by_google = 0x7f0d00ae;
public static final int place_autocomplete_prediction_primary_text = 0x7f0d00b0;
public static final int place_autocomplete_prediction_secondary_text = 0x7f0d00b1;
public static final int place_autocomplete_progress = 0x7f0d00af;
public static final int place_autocomplete_search_button = 0x7f0d00aa;
public static final int place_autocomplete_search_input = 0x7f0d00ab;
public static final int place_autocomplete_separator = 0x7f0d00ad;
public static final int production = 0x7f0d0030;
public static final int sandbox = 0x7f0d0031;
public static final int satellite = 0x7f0d0020;
public static final int selectionDetails = 0x7f0d0035;
public static final int slide = 0x7f0d0019;
public static final int standard = 0x7f0d0028;
public static final int strict_sandbox = 0x7f0d0032;
public static final int terrain = 0x7f0d0021;
public static final int test = 0x7f0d0033;
public static final int wide = 0x7f0d0029;
public static final int wrap_content = 0x7f0d002d;
}
public static final class integer {
public static final int google_play_services_version = 0x7f0b0004;
}
public static final class layout {
public static final int place_autocomplete_fragment = 0x7f040030;
public static final int place_autocomplete_item_powered_by_google = 0x7f040031;
public static final int place_autocomplete_item_prediction = 0x7f040032;
public static final int place_autocomplete_progress = 0x7f040033;
}
public static final class raw {
public static final int gtm_analytics = 0x7f060000;
}
public static final class string {
public static final int accept = 0x7f07003d;
public static final int auth_google_play_services_client_facebook_display_name = 0x7f070040;
public static final int auth_google_play_services_client_google_display_name = 0x7f070041;
public static final int cast_notification_connected_message = 0x7f070042;
public static final int cast_notification_connecting_message = 0x7f070043;
public static final int cast_notification_disconnect = 0x7f070044;
public static final int common_google_play_services_api_unavailable_text = 0x7f070011;
public static final int common_google_play_services_enable_button = 0x7f070012;
public static final int common_google_play_services_enable_text = 0x7f070013;
public static final int common_google_play_services_enable_title = 0x7f070014;
public static final int common_google_play_services_install_button = 0x7f070015;
public static final int common_google_play_services_install_text_phone = 0x7f070016;
public static final int common_google_play_services_install_text_tablet = 0x7f070017;
public static final int common_google_play_services_install_title = 0x7f070018;
public static final int common_google_play_services_invalid_account_text = 0x7f070019;
public static final int common_google_play_services_invalid_account_title = 0x7f07001a;
public static final int common_google_play_services_network_error_text = 0x7f07001b;
public static final int common_google_play_services_network_error_title = 0x7f07001c;
public static final int common_google_play_services_notification_ticker = 0x7f07001d;
public static final int common_google_play_services_restricted_profile_text = 0x7f07001e;
public static final int common_google_play_services_restricted_profile_title = 0x7f07001f;
public static final int common_google_play_services_sign_in_failed_text = 0x7f070020;
public static final int common_google_play_services_sign_in_failed_title = 0x7f070021;
public static final int common_google_play_services_unknown_issue = 0x7f070022;
public static final int common_google_play_services_unsupported_text = 0x7f070023;
public static final int common_google_play_services_unsupported_title = 0x7f070024;
public static final int common_google_play_services_update_button = 0x7f070025;
public static final int common_google_play_services_update_text = 0x7f070026;
public static final int common_google_play_services_update_title = 0x7f070027;
public static final int common_google_play_services_updating_text = 0x7f070028;
public static final int common_google_play_services_updating_title = 0x7f070029;
public static final int common_google_play_services_wear_update_text = 0x7f07002a;
public static final int common_open_on_phone = 0x7f07002b;
public static final int common_signin_button_text = 0x7f07002c;
public static final int common_signin_button_text_long = 0x7f07002d;
public static final int create_calendar_message = 0x7f070045;
public static final int create_calendar_title = 0x7f070046;
public static final int decline = 0x7f070047;
public static final int place_autocomplete_clear_button = 0x7f070039;
public static final int place_autocomplete_search_hint = 0x7f07003a;
public static final int store_picture_message = 0x7f07004b;
public static final int store_picture_title = 0x7f07004c;
public static final int wallet_buy_button_place_holder = 0x7f07003c;
}
public static final class style {
public static final int Theme_AppInvite_Preview = 0x7f0900e9;
public static final int Theme_AppInvite_Preview_Base = 0x7f090014;
public static final int Theme_IAPTheme = 0x7f0900ea;
public static final int WalletFragmentDefaultButtonTextAppearance = 0x7f0900f2;
public static final int WalletFragmentDefaultDetailsHeaderTextAppearance = 0x7f0900f3;
public static final int WalletFragmentDefaultDetailsTextAppearance = 0x7f0900f4;
public static final int WalletFragmentDefaultStyle = 0x7f0900f5;
}
public static final class styleable {
public static final int[] AdsAttrs = { 0x7f010027, 0x7f010028, 0x7f010029 };
public static final int AdsAttrs_adSize = 0;
public static final int AdsAttrs_adSizes = 1;
public static final int AdsAttrs_adUnitId = 2;
public static final int[] CustomWalletTheme = { 0x7f010032 };
public static final int CustomWalletTheme_windowTransitionStyle = 0;
public static final int[] LoadingImageView = { 0x7f01003e, 0x7f01003f, 0x7f010040 };
public static final int LoadingImageView_circleCrop = 2;
public static final int LoadingImageView_imageAspectRatio = 1;
public static final int LoadingImageView_imageAspectRatioAdjust = 0;
public static final int[] MapAttrs = { 0x7f010041, 0x7f010042, 0x7f010043, 0x7f010044, 0x7f010045, 0x7f010046, 0x7f010047, 0x7f010048, 0x7f010049, 0x7f01004a, 0x7f01004b, 0x7f01004c, 0x7f01004d, 0x7f01004e, 0x7f01004f, 0x7f010050, 0x7f010051 };
public static final int MapAttrs_ambientEnabled = 16;
public static final int MapAttrs_cameraBearing = 1;
public static final int MapAttrs_cameraTargetLat = 2;
public static final int MapAttrs_cameraTargetLng = 3;
public static final int MapAttrs_cameraTilt = 4;
public static final int MapAttrs_cameraZoom = 5;
public static final int MapAttrs_liteMode = 6;
public static final int MapAttrs_mapType = 0;
public static final int MapAttrs_uiCompass = 7;
public static final int MapAttrs_uiMapToolbar = 15;
public static final int MapAttrs_uiRotateGestures = 8;
public static final int MapAttrs_uiScrollGestures = 9;
public static final int MapAttrs_uiTiltGestures = 10;
public static final int MapAttrs_uiZoomControls = 11;
public static final int MapAttrs_uiZoomGestures = 12;
public static final int MapAttrs_useViewLifecycle = 13;
public static final int MapAttrs_zOrderOnTop = 14;
public static final int[] SignInButton = { 0x7f010067, 0x7f010068, 0x7f010069 };
public static final int SignInButton_buttonSize = 0;
public static final int SignInButton_colorScheme = 1;
public static final int SignInButton_scopeUris = 2;
public static final int[] WalletFragmentOptions = { 0x7f0100ef, 0x7f0100f0, 0x7f0100f1, 0x7f0100f2 };
public static final int WalletFragmentOptions_appTheme = 0;
public static final int WalletFragmentOptions_environment = 1;
public static final int WalletFragmentOptions_fragmentMode = 3;
public static final int WalletFragmentOptions_fragmentStyle = 2;
public static final int[] WalletFragmentStyle = { 0x7f0100f3, 0x7f0100f4, 0x7f0100f5, 0x7f0100f6, 0x7f0100f7, 0x7f0100f8, 0x7f0100f9, 0x7f0100fa, 0x7f0100fb, 0x7f0100fc, 0x7f0100fd };
public static final int WalletFragmentStyle_buyButtonAppearance = 3;
public static final int WalletFragmentStyle_buyButtonHeight = 0;
public static final int WalletFragmentStyle_buyButtonText = 2;
public static final int WalletFragmentStyle_buyButtonWidth = 1;
public static final int WalletFragmentStyle_maskedWalletDetailsBackground = 6;
public static final int WalletFragmentStyle_maskedWalletDetailsButtonBackground = 8;
public static final int WalletFragmentStyle_maskedWalletDetailsButtonTextAppearance = 7;
public static final int WalletFragmentStyle_maskedWalletDetailsHeaderTextAppearance = 5;
public static final int WalletFragmentStyle_maskedWalletDetailsLogoImageType = 10;
public static final int WalletFragmentStyle_maskedWalletDetailsLogoTextColor = 9;
public static final int WalletFragmentStyle_maskedWalletDetailsTextAppearance = 4;
}
}
| [
"jaimiec@seas.upenn.edu"
] | jaimiec@seas.upenn.edu |
55555670a410c9b40df3e64816c5b505a49346ce | 1ef8eb3a650c0e090ec9ceeafd6f843e601c6da5 | /app/src/main/java/com/tikalk/antsmasher/board/ProgressDialogFragment.java | 920619faa3aa88bca9c56d9325ebf8a7bfdadfe2 | [] | no_license | pnemonic78/TikalAntSmasher | 03b422de402cce6bf62b6b102a388ef30d818516 | 5d06a54f5d8f7a0fe72ce8ec9795d2b775586d9c | refs/heads/master | 2021-09-07T06:58:51.875638 | 2018-02-19T06:21:29 | 2018-02-19T06:21:29 | 110,829,318 | 0 | 0 | null | 2017-11-15T12:14:14 | 2017-11-15T12:14:14 | null | UTF-8 | Java | false | false | 1,929 | java | package com.tikalk.antsmasher.board;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.res.Resources;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.ActivityCompat;
import android.support.v4.app.DialogFragment;
import android.support.v7.app.AlertDialog;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import com.tikalk.antsmasher.R;
import static com.bumptech.glide.gifdecoder.GifHeaderParser.TAG;
/**
* Created by motibartov on 15/11/2017.
*/
public class ProgressDialogFragment extends DialogFragment {
private static final String TAG = "ProgressDialogFragment";
public static final String EXTRA_TITLE = "title";
public static final String EXTRA_LABEL = "label";
private ProgressDialogEventListener dialogClosedListener;
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
dialogClosedListener = (ProgressDialogEventListener) getActivity();
Dialog d = buildDialog(getActivity());
d.setCanceledOnTouchOutside(false);
return d;
}
private Dialog buildDialog(Context context) {
final Resources res = getResources();
View view = LayoutInflater.from(context).inflate(R.layout.progress_dialog, null);
AlertDialog.Builder builder = new AlertDialog.Builder(context)
.setCancelable(true)
.setView(view);
final AlertDialog dialog = builder.create();
return dialog;
}
@Override
public void onCancel(DialogInterface dialog) {
super.onCancel(dialog);
Log.i(TAG, "onCancel: ");
dialogClosedListener.onProgressBarCanceled();
}
interface ProgressDialogEventListener {
void onProgressDialogClosed();
void onProgressBarCanceled();
}
}
| [
"motib@tikalk.com"
] | motib@tikalk.com |
f1542b871b7e929cb620f49a6c79f49fc8ea9985 | b6faffd6b7d6f1ac01a343e6b078bc3e015eed4e | /src/main/java/com/example/demo/LombokBank.java | e113f98276520e47e9c924a69767303268b1edc9 | [] | no_license | bfazeli/LombokDemo | c945aa075098bb246d33e99c9b7b2c1be6dbba0d | c0e7960ababe1b8ae04216a0011c37685794c227 | refs/heads/master | 2020-08-14T11:46:51.322520 | 2019-10-16T18:42:15 | 2019-10-16T18:42:15 | 215,162,709 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 412 | java | package com.example.demo;
import lombok.*;
import lombok.experimental.NonFinal;
@Value public class LombokBank {
@Getter(lazy=true) private final double CEOSalary = salaryCalculator();
String name;
String address;
@With String phoneNumber;
@NonFinal double assetts;
private double salaryCalculator() {
double result;
result = this.assetts * 100;
return result;
}
}
| [
"noreply@github.com"
] | noreply@github.com |
5d2520d92dbca5c46414a30aa8d38000c63a1daf | 33168a08f39b2053f371ab1374ec1a96fb154c9e | /ticker_server_impl/src/main/java/com/tl/server/ticker/service/SysUserServiceImpl.java | cce9e70eea667383d7f94b4699ee430dcffb6bdc | [] | no_license | pangjian527/ticker_server | 0f2338d130aab3af2ddc1606c55881b2d139caf3 | 6c96cd1aa53f12c7d5688c7721bc333f4b4b7fd7 | refs/heads/master | 2020-06-17T23:18:09.536325 | 2017-01-18T01:36:21 | 2017-01-18T01:36:21 | 74,964,134 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,386 | java | package com.tl.server.ticker.service;
import com.facebook.swift.codec.ThriftField;
import com.tl.rpc.common.RpcException;
import com.tl.rpc.common.ServiceToken;
import com.tl.rpc.sys.SysUser;
import com.tl.rpc.sys.SysUserService;
import com.tl.server.ticker.entity.SysUserEntity;
import org.apache.thrift.TException;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/**
* Created by pangjian on 16-11-26.
*/
public class SysUserServiceImpl extends BaseDaoImpl<SysUserEntity> implements SysUserService{
public SysUserServiceImpl(){
super(SysUserEntity.class);
}
public SysUser getByAccount(@ThriftField(value = 1, name = "serviceToken", requiredness = ThriftField.Requiredness.NONE) ServiceToken serviceToken, @ThriftField(value = 2, name = "account", requiredness = ThriftField.Requiredness.NONE) String account) throws RpcException, TException {
StringBuilder sql = new StringBuilder("select * from sys_user u where u.account = :account");
List<SysUserEntity> list = this.setSql(sql.toString()).setParameter("account", account).execute();
if(list.size() > 0 ){
return list.get(0).toSysUser();
}
return null;
}
}
| [
"pangjian@91htw.com"
] | pangjian@91htw.com |
fe6f5c1a21c86ff4c64cc92a0077552a588b8081 | e7dff6b655819d7e1e18b6ef52389b50e7646a29 | /study-javafx-LegacyLMS/src/dialogs/EditCustomerDialog.java | b56d5713aa1196329029330db22c8ca578d686b2 | [] | no_license | leegeobuk/study-javafx-LegacyLMS | cc500a731516c61009068abbda89869fe54443c3 | 737180b8e372cdc039749c4f82b79fc6a0d3f2db | refs/heads/master | 2023-02-15T01:01:12.226192 | 2021-01-05T07:25:52 | 2021-01-05T07:25:52 | 260,165,857 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,406 | java | package dialogs;
import buttons.Cancel;
import db.Customer;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.HBox;
import javafx.scene.paint.Color;
import javafx.scene.text.Font;
import javafx.scene.text.FontWeight;
import javafx.stage.Stage;
import ok_buttons.EditCustomerOK;
import ui.CustomerWorkSpace;
public class EditCustomerDialog extends Stage implements GeneralDialog {
private BorderPane bp = new BorderPane();
private Label headerLabel;
private Label idLabel;
private Label nameLabel;
private Label contactLabel;
private Label warningLabel;
private TextField idField = new TextField();
private TextField nameField = new TextField();
private TextField contactField = new TextField();
private Button edit = new Button("Edit");
private Button cancel = new Button("Cancel");
private EditCustomerOK editCustomerOK;
private Cancel editCustomerCancel;
private CustomerWorkSpace customerWorkSpace;
private Customer selected;
private boolean isIdFilled = true;
private boolean isNameFilled = true;
private boolean isContactFilled = true;
{
this.headerLabel = new Label("Edit Customer");
this.idLabel = new Label("Customer ID:");
this.nameLabel = new Label("Name:");
this.contactLabel = new Label("Contact:");
warningLabel = new Label("");
}
public EditCustomerDialog(CustomerWorkSpace customerWorkSpace) {
this.customerWorkSpace = customerWorkSpace;
editCustomerOK = new EditCustomerOK(customerWorkSpace, edit, idField, nameField, contactField);
editCustomerCancel = new Cancel(cancel);
}
@Override
public void initDialog() {
headerLabel.setFont(Font.font("Arial", FontWeight.BOLD, 20));
headerLabel.setTextFill(Color.DARKBLUE);
bp.setTop(headerLabel);
BorderPane.setAlignment(headerLabel, Pos.TOP_CENTER);
idLabel.setFont(Font.font("Arial", FontWeight.BOLD, 11));
nameLabel.setFont(Font.font("Arial", FontWeight.BOLD, 11));
contactLabel.setFont(Font.font("Arial", FontWeight.BOLD, 11));
warningLabel.setFont(Font.font("Arial", FontWeight.BOLD, 10));
warningLabel.setTextFill(Color.RED);
selected = customerWorkSpace.getTable().getSelectionModel().getSelectedItem();
idField.setText(""+selected.getCid());
nameField.setText(selected.getCname());
contactField.setText(selected.getContact());
GridPane gp = new GridPane();
gp.addRow(0, idLabel, idField);
gp.addRow(1, nameLabel, nameField);
gp.addRow(2, contactLabel,contactField);
gp.add(warningLabel, 1, 3);
gp.setHgap(5);
gp.setVgap(5);
gp.setPadding(new Insets(6));
bp.setCenter(gp);
HBox hb = new HBox(10);
hb.setAlignment(Pos.BASELINE_CENTER);
hb.getChildren().addAll(edit, cancel);
hb.setPadding(new Insets(0, 0, 3, 0));
bp.setBottom(hb);
}
@Override
public void initButtons() {
editCustomerOK.buttonPressed();
editCustomerCancel.buttonPressed();
}
@Override
public void foolProof() {
idField.setOnKeyReleased(e -> {
if (idField.getText().length() > 0)
isIdFilled = true;
else
isIdFilled = false;
if (!(isIdFilled && isNameFilled && isContactFilled)) {
edit.setDisable(true);
warningLabel.setText("All fields must be filled!");
}
else {
warningLabel.setText("");
edit.setDisable(false);
}
});
nameField.setOnKeyReleased(e -> {
if (nameField.getText().length() > 0)
isNameFilled = true;
else
isNameFilled = false;
if (!(isIdFilled && isNameFilled && isContactFilled)) {
edit.setDisable(true);
warningLabel.setText("All fields must be filled!");
}
else {
warningLabel.setText("");
edit.setDisable(false);
}
});
contactField.setOnKeyReleased(e -> {
if (contactField.getText().length() > 0)
isContactFilled = true;
else
isContactFilled = false;
if (!(isIdFilled && isNameFilled && isContactFilled)) {
edit.setDisable(true);
warningLabel.setText("All fields must be filled!");
}
else {
warningLabel.setText("");
edit.setDisable(false);
}
});
}
@Override
public void showDialog() {
initDialog();
initButtons();
foolProof();
Scene scene = new Scene(bp);
setTitle("Edit Customer");
setScene(scene);
showAndWait();
}
}
| [
"leegeobuk@gmail.com"
] | leegeobuk@gmail.com |
ae84703bab0b9ce2787b6175ae474c65026e1776 | e108d65747c07078ae7be6dcd6369ac359d098d7 | /com/itextpdf/text/pdf/IntHashtable.java | e72b61bfc7305412e25aa57dae3fb974140da8b3 | [
"MIT"
] | permissive | kelu124/pyS3 | 50f30b51483bf8f9581427d2a424e239cfce5604 | 86eb139d971921418d6a62af79f2868f9c7704d5 | refs/heads/master | 2020-03-13T01:51:42.054846 | 2018-04-24T21:03:03 | 2018-04-24T21:03:03 | 130,913,008 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,473 | java | package com.itextpdf.text.pdf;
import com.itextpdf.text.error_messages.MessageLocalization;
import java.util.Arrays;
import java.util.Iterator;
import java.util.NoSuchElementException;
public class IntHashtable implements Cloneable {
private transient int count;
private float loadFactor;
private transient Entry[] table;
private int threshold;
static class Entry {
int hash;
int key;
Entry next;
int value;
protected Entry(int hash, int key, int value, Entry next) {
this.hash = hash;
this.key = key;
this.value = value;
this.next = next;
}
public int getKey() {
return this.key;
}
public int getValue() {
return this.value;
}
protected Object clone() {
return new Entry(this.hash, this.key, this.value, this.next != null ? (Entry) this.next.clone() : null);
}
}
static class IntHashtableIterator implements Iterator<Entry> {
Entry entry;
int index;
Entry[] table;
IntHashtableIterator(Entry[] table) {
this.table = table;
this.index = table.length;
}
public boolean hasNext() {
if (this.entry != null) {
return true;
}
Entry entry;
do {
int i = this.index;
this.index = i - 1;
if (i <= 0) {
return false;
}
entry = this.table[this.index];
this.entry = entry;
} while (entry == null);
return true;
}
public Entry next() {
if (this.entry == null) {
Entry entry;
do {
int i = this.index;
this.index = i - 1;
if (i <= 0) {
break;
}
entry = this.table[this.index];
this.entry = entry;
} while (entry == null);
}
if (this.entry != null) {
Entry e = this.entry;
this.entry = e.next;
return e;
}
throw new NoSuchElementException(MessageLocalization.getComposedMessage("inthashtableiterator", new Object[0]));
}
public void remove() {
throw new UnsupportedOperationException(MessageLocalization.getComposedMessage("remove.not.supported", new Object[0]));
}
}
public IntHashtable() {
this(150, 0.75f);
}
public IntHashtable(int initialCapacity) {
this(initialCapacity, 0.75f);
}
public IntHashtable(int initialCapacity, float loadFactor) {
if (initialCapacity < 0) {
throw new IllegalArgumentException(MessageLocalization.getComposedMessage("illegal.capacity.1", initialCapacity));
} else if (loadFactor <= 0.0f) {
throw new IllegalArgumentException(MessageLocalization.getComposedMessage("illegal.load.1", String.valueOf(loadFactor)));
} else {
if (initialCapacity == 0) {
initialCapacity = 1;
}
this.loadFactor = loadFactor;
this.table = new Entry[initialCapacity];
this.threshold = (int) (((float) initialCapacity) * loadFactor);
}
}
public int size() {
return this.count;
}
public boolean isEmpty() {
return this.count == 0;
}
public boolean contains(int value) {
Entry[] tab = this.table;
int i = tab.length;
while (true) {
int i2 = i - 1;
if (i <= 0) {
return false;
}
for (Entry e = tab[i2]; e != null; e = e.next) {
if (e.value == value) {
return true;
}
}
i = i2;
}
}
public boolean containsValue(int value) {
return contains(value);
}
public boolean containsKey(int key) {
Entry[] tab = this.table;
int hash = key;
Entry e = tab[(Integer.MAX_VALUE & hash) % tab.length];
while (e != null) {
if (e.hash == hash && e.key == key) {
return true;
}
e = e.next;
}
return false;
}
public int get(int key) {
Entry[] tab = this.table;
int hash = key;
Entry e = tab[(Integer.MAX_VALUE & hash) % tab.length];
while (e != null) {
if (e.hash == hash && e.key == key) {
return e.value;
}
e = e.next;
}
return 0;
}
protected void rehash() {
int oldCapacity = this.table.length;
Entry[] oldMap = this.table;
int newCapacity = (oldCapacity * 2) + 1;
Entry[] newMap = new Entry[newCapacity];
this.threshold = (int) (((float) newCapacity) * this.loadFactor);
this.table = newMap;
int i = oldCapacity;
while (true) {
int i2 = i - 1;
if (i > 0) {
Entry old = oldMap[i2];
while (old != null) {
Entry e = old;
old = old.next;
int index = (e.hash & Integer.MAX_VALUE) % newCapacity;
e.next = newMap[index];
newMap[index] = e;
}
i = i2;
} else {
return;
}
}
}
public int put(int key, int value) {
Entry[] tab = this.table;
int hash = key;
int index = (hash & Integer.MAX_VALUE) % tab.length;
Entry e = tab[index];
while (e != null) {
if (e.hash == hash && e.key == key) {
int old = e.value;
e.value = value;
return old;
}
e = e.next;
}
if (this.count >= this.threshold) {
rehash();
tab = this.table;
index = (hash & Integer.MAX_VALUE) % tab.length;
}
tab[index] = new Entry(hash, key, value, tab[index]);
this.count++;
return 0;
}
public int remove(int key) {
Entry[] tab = this.table;
int hash = key;
int index = (Integer.MAX_VALUE & hash) % tab.length;
Entry e = tab[index];
Entry prev = null;
while (e != null) {
if (e.hash == hash && e.key == key) {
if (prev != null) {
prev.next = e.next;
} else {
tab[index] = e.next;
}
this.count--;
int oldValue = e.value;
e.value = 0;
return oldValue;
}
prev = e;
e = e.next;
}
return 0;
}
public void clear() {
Entry[] tab = this.table;
int index = tab.length;
while (true) {
index--;
if (index >= 0) {
tab[index] = null;
} else {
this.count = 0;
return;
}
}
}
public Iterator<Entry> getEntryIterator() {
return new IntHashtableIterator(this.table);
}
public int[] toOrderedKeys() {
int[] res = getKeys();
Arrays.sort(res);
return res;
}
public int[] getKeys() {
int[] res = new int[this.count];
int index = this.table.length;
Entry entry = null;
int ptr = 0;
while (true) {
if (entry == null) {
int index2 = index;
while (true) {
index = index2 - 1;
if (index2 <= 0) {
break;
}
entry = this.table[index];
if (entry != null) {
break;
}
index2 = index;
}
}
if (entry == null) {
return res;
}
Entry e = entry;
entry = e.next;
int ptr2 = ptr + 1;
res[ptr] = e.key;
ptr = ptr2;
}
}
public int getOneKey() {
if (this.count == 0) {
return 0;
}
Entry entry = null;
int index = this.table.length;
while (true) {
int index2 = index - 1;
if (index <= 0) {
break;
}
entry = this.table[index2];
if (entry != null) {
break;
}
index = index2;
}
if (entry != null) {
return entry.key;
}
return 0;
}
public Object clone() {
try {
IntHashtable t = (IntHashtable) super.clone();
t.table = new Entry[this.table.length];
int i = this.table.length;
while (true) {
int i2 = i - 1;
if (i <= 0) {
return t;
}
t.table[i2] = this.table[i2] != null ? (Entry) this.table[i2].clone() : null;
i = i2;
}
} catch (CloneNotSupportedException e) {
throw new InternalError();
}
}
}
| [
"kelu124@gmail.com"
] | kelu124@gmail.com |
4560a017ef83c44f0c8ec2938583bc9737d02f0a | 983537c2a03fd172f5b32e2addb33ac567b0c2ef | /src/main/java/uk/gov/companieshouse/document/generator/consumer/DocumentGeneratorConsumerProperties.java | 48161f537acdc8217612224c4e41bf38fb3d7760 | [
"MIT"
] | permissive | companieshouse/document-generator-consumer | 641e2d10feeda2c07173a73b28205ec9decb3bdd | 8c9f85ee22d8d1f2202a43545687d7aa2cf870e7 | refs/heads/master | 2022-06-03T13:18:23.378671 | 2021-12-15T14:58:09 | 2021-12-15T14:58:09 | 146,713,368 | 0 | 1 | MIT | 2022-05-20T20:51:37 | 2018-08-30T07:35:36 | Java | UTF-8 | Java | false | false | 657 | java | package uk.gov.companieshouse.document.generator.consumer;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
@Component
@ConfigurationProperties(prefix="documentgeneration")
public class DocumentGeneratorConsumerProperties {
private String rootUri;
private String baseUrl;
public String getRootUri() {
return rootUri;
}
public void setRootUri(String rootUri) {
this.rootUri = rootUri;
}
public String getBaseUrl() {
return baseUrl;
}
public void setBaseUrl(String baseUrl) {
this.baseUrl = baseUrl;
}
}
| [
"csmith2@companieshouse.gov.uk"
] | csmith2@companieshouse.gov.uk |
35f1dfb58306fe45bc92852d478af29a405426f1 | a9142702f075f675d5d3ba1a1588adbe312a7361 | /fragment/CustomerAccountFragment.java | b6800edd5b8b7ea86870ea4de070707c9076533e | [] | no_license | Anber2/Eat-Run-Android-App-code-samples | a65178ab72820ab0fed25deaff4237f358a17edb | f0641b55bd9437d715c3fef91ec7a824e2337b2d | refs/heads/master | 2021-05-10T16:49:47.375062 | 2018-01-23T09:30:57 | 2018-01-23T09:30:57 | 118,588,366 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,127 | java | package com.mawaqaa.eatandrun.fragment;
import android.app.ProgressDialog;
import android.graphics.Paint;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
import com.android.volley.DefaultRetryPolicy;
import com.android.volley.NetworkResponse;
import com.android.volley.ParseError;
import com.android.volley.Request;
import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.HttpHeaderParser;
import com.android.volley.toolbox.StringRequest;
import com.android.volley.toolbox.Volley;
import com.mawaqaa.eatandrun.Constants.AppConstants;
import com.mawaqaa.eatandrun.R;
import com.mawaqaa.eatandrun.Utilities.PreferenceUtil;
import com.mawaqaa.eatandrun.activity.EatndRunBaseActivity;
import org.json.JSONObject;
import java.io.UnsupportedEncodingException;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
/**
* Created by HP on 11/27/2017.
*/
public class CustomerAccountFragment extends EatndRunBaseFragment implements View.OnClickListener {
String TAG = "ResListFrg";
RelativeLayout Rel_lay_usersettings, Rel_lay_payhist, Rel_lay_paymeth;
ImageView imageView_userImage;
TextView myAccount, textView_username_profile;
private ProgressDialog progressBar;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Log.d(TAG, "onCreate");
Activity = (EatndRunBaseActivity) this.getActivity();
}
public void onResume() {
Log.d(TAG, "onResume" + this.getClass().getName());
super.onResume();
((EatndRunBaseActivity) getActivity()).BaseFragment = this;
//((AjaratyMainActivity) getActivity()).hideLogo();
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
//View v = inflater.inflate(R.layout.fragment_registerorlogin, container, false);
View v = inflater.inflate(R.layout.customeraccount, container, false);
initview(v);
progressBar = ProgressDialog.show(getActivity(), "", getString(R.string.progressbar_please_wait), true, false);
new Thread(new Runnable() {
@Override
public void run() {
try {
JSONObject jsonObject = new JSONObject();
jsonObject.putOpt(AppConstants.CUST_ID, PreferenceUtil.getUserId(Activity));
jsonObject.putOpt(AppConstants.SecurityKey, AppConstants.SecurityKeyValue);
makeJsonCustomerAccountStringReq(AppConstants.EatndRun_VIEWCUSTOMER, jsonObject);
} catch (Exception xx) {
xx.toString();
}
}
}).start();
return v;
}
private void initview(View v) {
Rel_lay_payhist = (RelativeLayout) v.findViewById(R.id.Rel_lay_payhist);
Rel_lay_usersettings = (RelativeLayout) v.findViewById(R.id.Rel_lay_usersettings);
Rel_lay_paymeth = (RelativeLayout) v.findViewById(R.id.Rel_lay_paymeth);
myAccount = (TextView) v.findViewById(R.id.textView_myaccount_profile);
textView_username_profile = (TextView) v.findViewById(R.id.textView_username_profile);
imageView_userImage = (ImageView) v.findViewById(R.id.imageView_userImage);
myAccount.setPaintFlags(myAccount.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
Rel_lay_usersettings.setOnClickListener(this);
Rel_lay_payhist.setOnClickListener(this);
myAccount.setOnClickListener(this);
Rel_lay_paymeth.setOnClickListener(this);
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.Rel_lay_usersettings:
Activity.pushFragments(new SettingsFragment(), false, true);
break;
case R.id.Rel_lay_payhist:
Activity.pushFragments(new PaymentHistoryFragment(), false, true);
break;
case R.id.Rel_lay_paymeth:
Activity.pushFragments(new CybersourceCustomer(), false, true);
break;
case R.id.textView_myaccount_profile:
Activity.pushFragments(new SettingsFragment(), false, true);
break;
}
}
private String makeJsonCustomerAccountStringReq(String urlPost, final JSONObject jsonObject) {
StringRequest stringRequest = null;
final String[] resultConn = {""};
String string_json = "";
try {
RequestQueue queue = Volley.newRequestQueue(this.getActivity());
final String finalString_json = string_json;
stringRequest = new StringRequest(Request.Method.POST, urlPost,
new Response.Listener<String>() {
@Override
public void onResponse(String response) {
try {
JSONObject jsonObj = new JSONObject(response);
if (jsonObj != null) {
String userName = jsonObj.getString("Cus_Username");
textView_username_profile.setText(userName);
}
} catch (Exception xx) {
Log.e(TAG, " " + xx.toString());
xx.toString();
}
progressBar.dismiss();
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(final VolleyError error) {
String xx = error.toString();
progressBar.dismiss();
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
Toast.makeText(getActivity(), error.toString(), Toast.LENGTH_LONG).show();
}
});
}
}) {
@Override
protected Map<String, String> getParams() {
Map<String, String> params = new HashMap<String, String>();
try {
Iterator<?> keys = jsonObject.keys();
while (keys.hasNext()) {
String key = (String) keys.next();
String value = jsonObject.getString(key);
params.put(key, value);
}
} catch (Exception xx) {
xx.toString();
}
return params;
}
@Override
protected Response<String> parseNetworkResponse(NetworkResponse response) {
try {
String jsonString = new String(response.data,
HttpHeaderParser.parseCharset(response.headers));
return Response.success(jsonString, HttpHeaderParser.parseCacheHeaders(response));
} catch (UnsupportedEncodingException e) {
return Response.error(new ParseError(e));
}
}
};
stringRequest.setRetryPolicy(new DefaultRetryPolicy(
5000,
DefaultRetryPolicy.DEFAULT_MAX_RETRIES,
DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));
queue.add(stringRequest);
} catch (Exception e) {
progressBar.dismiss();
e.toString();
return e.toString();
}
return resultConn[0];
}
}
| [
"anber.sub@gmail.com"
] | anber.sub@gmail.com |
0aa52c86421961c47647aec3c1d012d1ff8fbf09 | 8e409a525e523b44fbae0a258bdb9b41a7a59da3 | /blip-cards-android/src/main/java/ai/blip/cards/widget/ZoomView.java | 04aa60af9f6f3ddd9f926afcb56cef69c2140cff | [] | no_license | takenet/blip-cards-android | 4c841568d60870bad97189e747902c0198f2e6e8 | 3461a12a1cdf0fcc2a61fa58efe6b8208413c510 | refs/heads/master | 2021-05-08T03:17:59.565779 | 2018-01-31T15:28:50 | 2018-01-31T15:28:50 | 108,184,668 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 13,429 | java | package ai.blip.cards.widget;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
import android.widget.RelativeLayout;
/**
* Zooming view.
*/
public class ZoomView extends RelativeLayout {
public ZoomView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
// TODO Auto-generated constructor stub
}
public ZoomView(Context context, AttributeSet attrs) {
super(context, attrs);
// TODO Auto-generated constructor stub
}
public ZoomView(final Context context) {
super(context);
}
/**
* Zooming view listener interface.
*
* @author karooolek
*/
public interface ZoomViewListener {
void onZoomStarted(float zoom, float zoomx, float zoomy);
void onZooming(float zoom, float zoomx, float zoomy);
void onZoomEnded(float zoom, float zoomx, float zoomy);
}
// zooming
float zoom = 1.0f;
float maxZoom = 5.0f;
float smoothZoom = 1.0f;
float zoomX, zoomY;
float smoothZoomX, smoothZoomY;
private boolean scrolling; // NOPMD by karooolek on 29.06.11 11:45
// minimap variables
private boolean showMinimap = false;
private int miniMapColor = Color.WHITE;
private int miniMapHeight = -1;
private String miniMapCaption;
private float miniMapCaptionSize = 10.0f;
private int miniMapCaptionColor = Color.WHITE;
// touching variables
private long lastTapTime;
private float touchStartX, touchStartY;
private float touchLastX, touchLastY;
private float startd;
private boolean pinching;
private float lastd;
private float lastdx1, lastdy1;
private float lastdx2, lastdy2;
// drawing
private final Matrix m = new Matrix();
private final Paint p = new Paint();
// listener
ZoomViewListener listener;
private Bitmap ch;
public float getZoom() {
return zoom;
}
public float getMaxZoom() {
return maxZoom;
}
public void setMaxZoom(final float maxZoom) {
if (maxZoom < 1.0f) {
return;
}
this.maxZoom = maxZoom;
}
public void setMiniMapEnabled(final boolean showMiniMap) {
this.showMinimap = showMiniMap;
}
public boolean isMiniMapEnabled() {
return showMinimap;
}
public void setMiniMapHeight(final int miniMapHeight) {
if (miniMapHeight < 0) {
return;
}
this.miniMapHeight = miniMapHeight;
}
public int getMiniMapHeight() {
return miniMapHeight;
}
public void setMiniMapColor(final int color) {
miniMapColor = color;
}
public int getMiniMapColor() {
return miniMapColor;
}
public String getMiniMapCaption() {
return miniMapCaption;
}
public void setMiniMapCaption(final String miniMapCaption) {
this.miniMapCaption = miniMapCaption;
}
public float getMiniMapCaptionSize() {
return miniMapCaptionSize;
}
public void setMiniMapCaptionSize(final float size) {
miniMapCaptionSize = size;
}
public int getMiniMapCaptionColor() {
return miniMapCaptionColor;
}
public void setMiniMapCaptionColor(final int color) {
miniMapCaptionColor = color;
}
public void zoomTo(final float zoom, final float x, final float y) {
this.zoom = Math.min(zoom, maxZoom);
zoomX = x;
zoomY = y;
smoothZoomTo(this.zoom, x, y);
}
public void smoothZoomTo(final float zoom, final float x, final float y) {
smoothZoom = clamp(1.0f, zoom, maxZoom);
smoothZoomX = x;
smoothZoomY = y;
if (listener != null) {
listener.onZoomStarted(smoothZoom, x, y);
}
}
public ZoomViewListener getListener() {
return listener;
}
public void setListner(final ZoomViewListener listener) {
this.listener = listener;
}
public float getZoomFocusX() {
return zoomX * zoom;
}
public float getZoomFocusY() {
return zoomY * zoom;
}
@Override
public boolean dispatchTouchEvent(final MotionEvent ev) {
// single touch
if (ev.getPointerCount() == 1) {
processSingleTouchEvent(ev);
}
// // double touch
if (ev.getPointerCount() == 2) {
processDoubleTouchEvent(ev);
}
// redraw
getRootView().invalidate();
invalidate();
return true;
}
private void processSingleTouchEvent(final MotionEvent ev) {
final float x = ev.getX();
final float y = ev.getY();
final float w = miniMapHeight * (float) getWidth() / getHeight();
final float h = miniMapHeight;
final boolean touchingMiniMap = x >= 10.0f && x <= 10.0f + w
&& y >= 10.0f && y <= 10.0f + h;
if (showMinimap && smoothZoom > 1.0f && touchingMiniMap) {
processSingleTouchOnMinimap(ev);
} else {
processSingleTouchOutsideMinimap(ev);
}
}
private void processSingleTouchOnMinimap(final MotionEvent ev) {
final float x = ev.getX();
final float y = ev.getY();
final float w = miniMapHeight * (float) getWidth() / getHeight();
final float h = miniMapHeight;
final float zx = (x - 10.0f) / w * getWidth();
final float zy = (y - 10.0f) / h * getHeight();
smoothZoomTo(smoothZoom, zx, zy);
}
private void processSingleTouchOutsideMinimap(final MotionEvent ev) {
final float x = ev.getX();
final float y = ev.getY();
float lx = x - touchStartX;
float ly = y - touchStartY;
final float l = (float) Math.hypot(lx, ly);
float dx = x - touchLastX;
float dy = y - touchLastY;
touchLastX = x;
touchLastY = y;
switch (ev.getAction()) {
case MotionEvent.ACTION_DOWN:
touchStartX = x;
touchStartY = y;
touchLastX = x;
touchLastY = y;
dx = 0;
dy = 0;
lx = 0;
ly = 0;
scrolling = false;
break;
case MotionEvent.ACTION_MOVE:
if (scrolling || (smoothZoom > 1.0f && l > 30.0f)) {
if (!scrolling) {
scrolling = true;
ev.setAction(MotionEvent.ACTION_CANCEL);
super.dispatchTouchEvent(ev);
}
smoothZoomX -= dx / zoom;
smoothZoomY -= dy / zoom;
return;
}
break;
case MotionEvent.ACTION_OUTSIDE:
case MotionEvent.ACTION_UP:
// tap
if (l < 30.0f) {
// check double tap
if (System.currentTimeMillis() - lastTapTime < 500) {
if (smoothZoom == 1.0f) {
smoothZoomTo(maxZoom, x, y);
} else {
smoothZoomTo(1.0f, getWidth() / 2.0f,
getHeight() / 2.0f);
}
lastTapTime = 0;
ev.setAction(MotionEvent.ACTION_CANCEL);
super.dispatchTouchEvent(ev);
return;
}
lastTapTime = System.currentTimeMillis();
performClick();
}
break;
default:
break;
}
ev.setLocation(zoomX + (x - 0.5f * getWidth()) / zoom, zoomY
+ (y - 0.5f * getHeight()) / zoom);
ev.getX();
ev.getY();
super.dispatchTouchEvent(ev);
}
private void processDoubleTouchEvent(final MotionEvent ev) {
final float x1 = ev.getX(0);
final float dx1 = x1 - lastdx1;
lastdx1 = x1;
final float y1 = ev.getY(0);
final float dy1 = y1 - lastdy1;
lastdy1 = y1;
final float x2 = ev.getX(1);
final float dx2 = x2 - lastdx2;
lastdx2 = x2;
final float y2 = ev.getY(1);
final float dy2 = y2 - lastdy2;
lastdy2 = y2;
// pointers distance
final float d = (float) Math.hypot(x2 - x1, y2 - y1);
final float dd = d - lastd;
lastd = d;
final float ld = Math.abs(d - startd);
Math.atan2(y2 - y1, x2 - x1);
switch (ev.getAction()) {
case MotionEvent.ACTION_DOWN:
startd = d;
pinching = false;
break;
case MotionEvent.ACTION_MOVE:
if (pinching || ld > 30.0f) {
pinching = true;
final float dxk = 0.5f * (dx1 + dx2);
final float dyk = 0.5f * (dy1 + dy2);
smoothZoomTo(Math.max(1.0f, zoom * d / (d - dd)), zoomX - dxk
/ zoom, zoomY - dyk / zoom);
}
break;
case MotionEvent.ACTION_UP:
default:
pinching = false;
break;
}
ev.setAction(MotionEvent.ACTION_CANCEL);
super.dispatchTouchEvent(ev);
}
private float clamp(final float min, final float value, final float max) {
return Math.max(min, Math.min(value, max));
}
private float lerp(final float a, final float b, final float k) {
return a + (b - a) * k;
}
private float bias(final float a, final float b, final float k) {
return Math.abs(b - a) >= k ? a + k * Math.signum(b - a) : b;
}
@Override
protected void dispatchDraw(final Canvas canvas) {
// do zoom
zoom = lerp(bias(zoom, smoothZoom, 0.05f), smoothZoom, 0.2f);
smoothZoomX = clamp(0.5f * getWidth() / smoothZoom, smoothZoomX,
getWidth() - 0.5f * getWidth() / smoothZoom);
smoothZoomY = clamp(0.5f * getHeight() / smoothZoom, smoothZoomY,
getHeight() - 0.5f * getHeight() / smoothZoom);
zoomX = lerp(bias(zoomX, smoothZoomX, 0.1f), smoothZoomX, 0.35f);
zoomY = lerp(bias(zoomY, smoothZoomY, 0.1f), smoothZoomY, 0.35f);
if (zoom != smoothZoom && listener != null) {
listener.onZooming(zoom, zoomX, zoomY);
}
final boolean animating = Math.abs(zoom - smoothZoom) > 0.0000001f
|| Math.abs(zoomX - smoothZoomX) > 0.0000001f
|| Math.abs(zoomY - smoothZoomY) > 0.0000001f;
// nothing to draw
if (getChildCount() == 0) {
return;
}
// prepare matrix
m.setTranslate(0.5f * getWidth(), 0.5f * getHeight());
m.preScale(zoom, zoom);
m.preTranslate(
-clamp(0.5f * getWidth() / zoom, zoomX, getWidth() - 0.5f
* getWidth() / zoom),
-clamp(0.5f * getHeight() / zoom, zoomY, getHeight() - 0.5f
* getHeight() / zoom));
// get view
final View v = getChildAt(0);
m.preTranslate(v.getLeft(), v.getTop());
// get drawing cache if available
if (animating && ch == null && isAnimationCacheEnabled()) {
v.setDrawingCacheEnabled(true);
ch = v.getDrawingCache();
}
// draw using cache while animating
if (animating && isAnimationCacheEnabled() && ch != null) {
p.setColor(0xffffffff);
canvas.drawBitmap(ch, m, p);
} else { // zoomed or cache unavailable
ch = null;
canvas.save();
canvas.concat(m);
v.draw(canvas);
canvas.restore();
}
// draw minimap
if (showMinimap) {
if (miniMapHeight < 0) {
miniMapHeight = getHeight() / 4;
}
canvas.translate(10.0f, 10.0f);
p.setColor(0x80000000 | 0x00ffffff & miniMapColor);
final float w = miniMapHeight * (float) getWidth() / getHeight();
final float h = miniMapHeight;
canvas.drawRect(0.0f, 0.0f, w, h, p);
if (miniMapCaption != null && miniMapCaption.length() > 0) {
p.setTextSize(miniMapCaptionSize);
p.setColor(miniMapCaptionColor);
p.setAntiAlias(true);
canvas.drawText(miniMapCaption, 10.0f,
10.0f + miniMapCaptionSize, p);
p.setAntiAlias(false);
}
p.setColor(0x80000000 | 0x00ffffff & miniMapColor);
final float dx = w * zoomX / getWidth();
final float dy = h * zoomY / getHeight();
canvas.drawRect(dx - 0.5f * w / zoom, dy - 0.5f * h / zoom, dx
+ 0.5f * w / zoom, dy + 0.5f * h / zoom, p);
canvas.translate(-10.0f, -10.0f);
}
// redraw
// if (animating) {
getRootView().invalidate();
invalidate();
// }
}
} | [
"rafaelpa@takenet.com.br"
] | rafaelpa@takenet.com.br |
eb9dbd0fcacd236bfd059b25612990a6e618b245 | d153af8f4766ae8f5d0b012f8ab1f7dc5c86fb39 | /src/main/java/com/surfilter/act/thumbnailator/makers/ScaledThumbnailMaker.java | 92ba066a3fe3461826fafbee2f100e417d615da4 | [
"MIT"
] | permissive | Eliaine/thumbnailator | 5f23cf15a3120d80abeabef443ecbd23b8959661 | 768a42f6f36ae86cfcf2b99e8459656030440443 | refs/heads/master | 2020-03-22T02:31:33.307966 | 2018-07-02T01:49:51 | 2018-07-02T01:49:51 | 139,375,412 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,834 | java | package com.surfilter.act.thumbnailator.makers;
import java.awt.image.BufferedImage;
/**
* A {@link ThumbnailMaker} which scales an image by a specified scaling factor
* when producing a thumbnail.
* <p>
* Upon calculating the size of the thumbnail, if any of the dimensions are
* {@code 0}, then that dimension will be promoted to {@code 1}. This will
* cause some resizing operations to not preserve the aspect ratio of the
* original image.
* <p>
* <DL>
* <DT><B>Usage:</B></DT>
* <DD>
* The following example demonstrates how to create a thumbnail which is 25%
* the size of the source image:
* <pre>
BufferedImage img = ImageIO.read(new File("sourceImage.jpg"));
BufferedImage thumbnail = new ScaledThumbnailMaker()
.scale(0.25)
.make(img);
* </pre>
* </DD>
* </DL>
* It is also possible to independently specify the scaling factor for the
* width and height. (If the two scaling factors are not equal then the aspect
* ratio of the original image will not be preserved.)
* <p>
* <DL>
* <DT><B>Usage:</B></DT>
* <DD>
* The following example demonstrates how to create a thumbnail which is scaled
* 50% in the width and 75% in the height:
* <pre>
BufferedImage img = ImageIO.read(new File("sourceImage.jpg"));
BufferedImage thumbnail = new ScaledThumbnailMaker()
.scale(0.50, 0.75)
.make(img);
* </pre>
* </DD>
* </DL>
* <DL>
*
* @author coobird
*
*/
public final class ScaledThumbnailMaker extends ThumbnailMaker
{
private static final String PARAM_SCALE = "scale";
/**
* The scaling factor to apply to the width when resizing an image to
* create a thumbnail.
*/
private double widthFactor;
/**
* The scaling factor to apply to the height when resizing an image to
* create a thumbnail.
*/
private double heightFactor;
/**
* <p>
* Creates an instance of {@code ScaledThumbnailMaker} without the
* scaling factor specified.
* </p>
* <p>
* To use this {@code ScaledThumbnailMaker}, one must specify the
* scaling factor to use by calling the {@link #scale(double)} method
* before generating a thumbnail.
* </p>
*/
public ScaledThumbnailMaker()
{
super();
ready.unset(PARAM_SCALE);
}
/**
* Creates an instance of {@code ScaledThumbnailMaker} with the specified
* scaling factor.
*
* @param factor The scaling factor to apply when resizing an
* image to create a thumbnail.
*/
public ScaledThumbnailMaker(double factor)
{
this();
scale(factor);
}
/**
* Creates an instance of {@code ScaledThumbnailMaker} with the specified
* scaling factors for the width and height.
*
* @param widthFactor The scaling factor to apply to the width when
* resizing an image to create a thumbnail.
* @param heightFactor The scaling factor to apply to the height when
* resizing an image to create a thumbnail.
* @since 0.3.10
*/
public ScaledThumbnailMaker(double widthFactor, double heightFactor)
{
this();
scale(widthFactor, heightFactor);
}
/**
* <p>
* Sets the scaling factor for the thumbnail.
* </p>
* <p>
* The aspect ratio of the resulting image is unaltered from the original.
* </p>
*
* @param factor The scaling factor to apply when resizing an
* image to create a thumbnail.
* @return A reference to this object.
* @throws IllegalStateException If the scaling factor has already
* been previously set.
*/
public ScaledThumbnailMaker scale(double factor)
{
return scale(factor, factor);
}
/**
* <p>
* Sets the scaling factors for the thumbnail.
* </p>
*
* @param widthFactor The scaling factor to apply to the width when
* resizing an image to create a thumbnail.
* @param heightFactor The scaling factor to apply to the height when
* resizing an image to create a thumbnail.
* @return A reference to this object.
* @throws IllegalStateException If the scaling factor has already
* been previously set.
* @since 0.3.10
*/
public ScaledThumbnailMaker scale(double widthFactor, double heightFactor)
{
if (ready.isSet(PARAM_SCALE))
{
throw new IllegalStateException(
"The scaling factor has already been set."
);
}
if (widthFactor <= 0 || heightFactor <= 0)
{
throw new IllegalArgumentException(
"The scaling factor must be greater than zero."
);
}
this.widthFactor = widthFactor;
this.heightFactor = heightFactor;
ready.set(PARAM_SCALE);
return this;
}
@Override
public BufferedImage make(BufferedImage img)
{
int width = (int)Math.round(img.getWidth() * widthFactor);
int height = (int)Math.round(img.getHeight() * heightFactor);
width = (width == 0) ? 1 : width;
height = (height == 0) ? 1 : height;
return super.makeThumbnail(img, width, height);
}
}
| [
"283068943@qq.com"
] | 283068943@qq.com |
013e2dfb333983309d752f6b8c9671f20aa80d4e | 8af33da41b4ff7248ee2939ac92a06cf8ddb573f | /app/src/main/java/com/example/shrirang/techfarm1/MainActivity.java | ea3cf07dacd5e24694a1f5a8964faf047ec53408 | [] | no_license | ShrirangPatil/MyTechFarmApp | 6c378b319a30f1cb114d1bdbcc6dfc3d6fc22ea3 | 2bb435b52b83ff254ba59a9e4a06bf2bacc5fe3b | refs/heads/master | 2020-03-21T17:14:21.631546 | 2018-06-27T08:55:25 | 2018-06-27T08:55:25 | 138,821,709 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,220 | java | package com.example.shrirang.techfarm1;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.ImageButton;
import android.widget.LinearLayout;
import android.widget.Toast;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//final TextView t = (TextView) findViewById(R.id.textView);
SharedPreferences prefs = getSharedPreferences("Registration", MODE_PRIVATE);
final String name = prefs.getString("name", null);//"No name defined" is the default value.
if (name != null) {
//name = prefs.getString("name", "No name defined");//"No name defined" is the default value.
String phn = prefs.getString("idName", "No phone number"); //0 is the default value.
ImageButton imb = (ImageButton) findViewById(R.id.person);
imb.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(v.getContext(),
"Hello\n"+name,Toast.LENGTH_SHORT).show();
}
});
final String w = "Weather";
LinearLayout weather = (LinearLayout) findViewById(R.id.weather);
weather.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
//t.setText(w);
Toast.makeText(v.getContext(),
w,Toast.LENGTH_SHORT).show();
Intent weatherintent = new Intent(MainActivity.this,WeathersActivity.class);
startActivity(weatherintent);
}
});
final String sr = "Soil Report";
LinearLayout soil = (LinearLayout) findViewById(R.id.soil);
soil.setOnClickListener(new View.OnClickListener(){
public void onClick(View v) {
//t.setText(sr);
Toast.makeText(v.getContext(),
sr,Toast.LENGTH_SHORT).show();
Intent soilactivity = new Intent(MainActivity.this,SoilActivity.class);
startActivity(soilactivity);
}
});
final String of = "Organic Farming";
LinearLayout organic = (LinearLayout) findViewById(R.id.organic);
organic.setOnClickListener(new View.OnClickListener(){
public void onClick(View v) {
//t.setText(of);
Toast.makeText(v.getContext(),
of,Toast.LENGTH_SHORT).show();
Intent organicactivity = new Intent(MainActivity.this,OrganicActivity.class);
startActivity(organicactivity);
}
});
}
else {
Intent intent = new Intent(this, RegistrationActivity.class);
startActivity(intent);
}
}
}
| [
"shrirangpatil1996@outlook.com"
] | shrirangpatil1996@outlook.com |
b3c51ed9b9285306293ce540f1900918528aa7ee | 1a2612f3be9db993aa7463d8362c1d8ed82b3950 | /work03/src/com/main/creat.java | e4dad8dae72ac6d345ee11e83d1456e09b7f6ff7 | [] | no_license | hush15/design-pattern | 9373c633c6c1f8ff42b607e2622f7afd03923b85 | c336b8b5045e2bf14d686260c06f5bb4250af0a6 | refs/heads/main | 2023-06-04T12:23:32.318480 | 2021-06-20T06:07:01 | 2021-06-20T06:07:01 | 351,633,822 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 358 | java | package com.main;
import com.Source.AbstractSource;
import com.Source.AbstractSourceFactory;
import com.Source.XMLSource;
public class creat {
public static void main(String[] args) {
AbstractSourceFactory factory =(AbstractSourceFactory)XMLSource.getBean();
AbstractSource source = factory.getSourceFactory();
source.Source();
}
}
| [
"noreply@github.com"
] | noreply@github.com |
2b80c518cb53aeb0b96b4ab748d7038bb7e862b9 | cbc3bed18f2d17c887fcc0a2fe1b1161b0db89ae | /hw14-integration-app/src/main/java/ru/spb/avetall/hw14integrationapp/modules/question/dao/TokenDao.java | 0970da071e3bf58676b23ce111ceda511b6ffafb | [] | no_license | avetall87/otus_spring_2019_11 | e6068a2e97ecd035423ae83e7196c69af486da0a | a6e55c0866c6ac6e8ced5459fa411f722477f297 | refs/heads/master | 2020-09-21T07:09:14.294721 | 2020-07-26T10:41:50 | 2020-07-26T10:41:50 | 224,718,824 | 0 | 0 | null | 2020-07-26T10:41:52 | 2019-11-28T19:44:04 | Java | UTF-8 | Java | false | false | 310 | java | package ru.spb.avetall.hw14integrationapp.modules.question.dao;
import org.springframework.data.jpa.repository.JpaRepository;
import ru.spb.avetall.hw14integrationapp.modules.question.domain.Token;
public interface TokenDao extends JpaRepository<Token, Long> {
Token findByTokenName(String tokenName);
}
| [
"aleksandrov.vetall@yandex.ru"
] | aleksandrov.vetall@yandex.ru |
0eae5cff87cbc64cda68dd6fc32acf86ad72f64a | e91e5481a0cbbe6cc05cf1c7fe7ae33a241cb66a | /PROJECT_DEJ-ejb/src/java/cl/services/ClienteFacade.java | 4df7d9fb563f41f77450a1fbc8424da1d2cfd320 | [] | no_license | djok7777/PROJECT_DEJ | 17258c38d731a84d72176081bd2198efdc9459f9 | ee4759286790d85c6f9ee2a2c0ecd556ddd8b0f2 | refs/heads/master | 2020-04-01T16:25:05.599428 | 2018-10-17T03:28:30 | 2018-10-17T03:28:30 | 153,380,450 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 731 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package cl.services;
import cl.pojos.Cliente;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
/**
*
* @author MiguelAngel
*/
@Stateless
public class ClienteFacade extends AbstractFacade<Cliente> implements ClienteFacadeLocal {
@PersistenceContext(unitName = "PROJECT_DEJ-ejbPU")
private EntityManager em;
@Override
protected EntityManager getEntityManager() {
return em;
}
public ClienteFacade() {
super(Cliente.class);
}
}
| [
"djok777@hotmail.com"
] | djok777@hotmail.com |
f41bfd5cd1762d1f1b7308462ce14a0b4c558efa | 671691d45941c926aac7f1612595b9611b27a8b0 | /Basketball_Play/src/com/basketball/play/CustomApplcation.java | 7cec345ab4ffb7b9f591a5b5bae5f5d0bf25366c | [] | no_license | maxulin/Basketball_Play | 6ce6651ce0f5630df5e5ff236915f94051d621b7 | e25d39b505a6372ec709aefd50229775da1e578b | refs/heads/master | 2021-01-10T21:27:43.683835 | 2015-08-24T09:57:54 | 2015-08-24T09:57:54 | 40,470,683 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,260 | java | package com.basketball.play;
import java.io.File;
import java.util.HashMap;
import java.util.Map;
import android.app.Application;
import android.app.NotificationManager;
import android.content.Context;
import android.content.SharedPreferences;
import android.media.MediaPlayer;
import android.preference.PreferenceManager;
import cn.bmob.im.BmobChat;
import cn.bmob.im.BmobUserManager;
import cn.bmob.im.bean.BmobChatUser;
import cn.bmob.v3.datatype.BmobGeoPoint;
import com.baidu.location.BDLocation;
import com.baidu.location.BDLocationListener;
import com.baidu.location.LocationClient;
import com.baidu.location.LocationClientOption;
import com.baidu.mapapi.SDKInitializer;
import com.basketball.play.R;
import com.basketball.play.bean.GeoPointAndAdress;
import com.basketball.play.util.SharePreferenceUtil;
import com.nostra13.universalimageloader.cache.disc.impl.UnlimitedDiscCache;
import com.nostra13.universalimageloader.cache.disc.naming.Md5FileNameGenerator;
import com.nostra13.universalimageloader.cache.memory.impl.WeakMemoryCache;
import com.nostra13.universalimageloader.core.ImageLoader;
import com.nostra13.universalimageloader.core.ImageLoaderConfiguration;
import com.nostra13.universalimageloader.core.assist.QueueProcessingType;
import com.nostra13.universalimageloader.utils.StorageUtils;
/**
* 自定义全局Applcation类
* @ClassName: CustomApplcation
* @Description: TODO
* @author smilefds
* @date 2014-5-19 下午3:25:00
*/
public class CustomApplcation extends Application {
public static CustomApplcation mInstance;
public LocationClient mLocationClient;
public MyLocationListener mMyLocationListener;
public LocationClientOption option;
public static BmobGeoPoint lastPoint = null;// 上一次定位到的经纬度
public static GeoPointAndAdress address = new GeoPointAndAdress();
@Override
public void onCreate() {
// TODO Auto-generated method stub
super.onCreate();
// 是否开启debug模式--默认开启状态
BmobChat.DEBUG_MODE = true;
mInstance = this;
init();
}
private void init() {
mMediaPlayer = MediaPlayer.create(this, R.raw.notify);
mNotificationManager = (NotificationManager) getSystemService(android.content.Context.NOTIFICATION_SERVICE);
initImageLoader(getApplicationContext());
// 若用户登陆过,则先从好友数据库中取出好友list存入内存中
if (BmobUserManager.getInstance(getApplicationContext())
.getCurrentUser() != null) {
// // 获取本地好友user list到内存,方便以后获取好友list
// contactList = CollectionUtils.list2map(BmobDB.create(getApplicationContext()).getContactList());
}
initBaidu();
}
/**
* 初始化百度相关sdk initBaidumap
* @Title: initBaidumap
* @Description: TODO
* @param
* @return void
* @throws
*/
private void initBaidu() {
// 初始化地图Sdk
SDKInitializer.initialize(this);
// 初始化定位sdk
initBaiduLocClient();
}
/**
* 初始化百度定位sdk
* @Title: initBaiduLocClient
* @Description: TODO
* @param
* @return void
* @throws
*/
private void initBaiduLocClient() {
mLocationClient = new LocationClient(this.getApplicationContext());
mMyLocationListener = new MyLocationListener();
mLocationClient.registerLocationListener(mMyLocationListener);
option = new LocationClientOption();
option.setCoorType("bd09ll"); // 设置坐标类型:百度经纬度
option.setIsNeedAddress(true);//反编译获得具体位置,只有网络定位才可以
//option.setIsNeedLocationDescribe(true);//可选,默认false,设置是否需要位置语义化结果,可以在BDLocation.getLocationDescribe里得到,结果类似于“在北京天安门附近”
//option.setIsNeedLocationPoiList(true);//可选,默认false,设置是否需要POI结果,可以在BDLocation.getPoiList里得到
mLocationClient.setLocOption(option);
}
/**
* 实现实位回调监听
*/
public class MyLocationListener implements BDLocationListener {
@Override
public void onReceiveLocation(BDLocation location) {
// Receive Location
double latitude = location.getLatitude();
double longtitude = location.getLongitude();
if (lastPoint != null) {
if (lastPoint.getLatitude() == location.getLatitude()
&& lastPoint.getLongitude() == location.getLongitude()) {
// BmobLog.i("两次获取坐标相同");// 若两次请求获取到的地理位置坐标是相同的,则不再定位
mLocationClient.stop();
return;
}
}
lastPoint = new BmobGeoPoint(longtitude, latitude);
//String loc_address = location.getAddrStr();
String loc_address = location.getCity()+location.getDistrict()+location.getStreet();
address.setAddress(loc_address);
//Toast.makeText(getApplicationContext(), "坐标:"+longtitude+","+latitude+" 位置:"+loc_address, 3000).show();
}
}
/** 初始化ImageLoader */
public static void initImageLoader(Context context) {
File cacheDir = StorageUtils.getOwnCacheDirectory(context,
"bmobim/Cache");// 获取到缓存的目录地址
// 创建配置ImageLoader(所有的选项都是可选的,只使用那些你真的想定制),这个可以设定在APPLACATION里面,设置为全局的配置参数
ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(
context)
// 线程池内加载的数量
.threadPoolSize(3).threadPriority(Thread.NORM_PRIORITY - 2)
.memoryCache(new WeakMemoryCache())
.denyCacheImageMultipleSizesInMemory()
.discCacheFileNameGenerator(new Md5FileNameGenerator())
// 将保存的时候的URI名称用MD5 加密
.tasksProcessingOrder(QueueProcessingType.LIFO)
.discCache(new UnlimitedDiscCache(cacheDir))// 自定义缓存路径
// .defaultDisplayImageOptions(DisplayImageOptions.createSimple())
.writeDebugLogs() // Remove for release app
.build();
// Initialize ImageLoader with configuration.
ImageLoader.getInstance().init(config);// 全局初始化此配置
}
public static CustomApplcation getInstance() {
return mInstance;
}
// 单例模式,才能及时返回数据
SharePreferenceUtil mSpUtil;
public static final String PREFERENCE_NAME = "_sharedinfo";
public synchronized SharePreferenceUtil getSpUtil() {
if (mSpUtil == null) {
String currentId = BmobUserManager.getInstance(
getApplicationContext()).getCurrentUserObjectId();
String sharedName = currentId + PREFERENCE_NAME;
mSpUtil = new SharePreferenceUtil(this, sharedName);
}
return mSpUtil;
}
NotificationManager mNotificationManager;
public NotificationManager getNotificationManager() {
if (mNotificationManager == null)
mNotificationManager = (NotificationManager) getSystemService(android.content.Context.NOTIFICATION_SERVICE);
return mNotificationManager;
}
MediaPlayer mMediaPlayer;
public synchronized MediaPlayer getMediaPlayer() {
if (mMediaPlayer == null)
mMediaPlayer = MediaPlayer.create(this, R.raw.notify);
return mMediaPlayer;
}
public final String PREF_LONGTITUDE = "longtitude";// 经度
private String longtitude = "";
/**
* 获取经度
*
* @return
*/
public String getLongtitude() {
SharedPreferences preferences = PreferenceManager
.getDefaultSharedPreferences(this);
longtitude = preferences.getString(PREF_LONGTITUDE, "");
return longtitude;
}
/**
* 设置经度
*
* @param pwd
*/
public void setLongtitude(String lon) {
SharedPreferences preferences = PreferenceManager
.getDefaultSharedPreferences(this);
SharedPreferences.Editor editor = preferences.edit();
if (editor.putString(PREF_LONGTITUDE, lon).commit()) {
longtitude = lon;
}
}
public final String PREF_LATITUDE = "latitude";// 经度
private String latitude = "";
/**
* 获取纬度
*
* @return
*/
public String getLatitude() {
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
latitude = preferences.getString(PREF_LATITUDE, "");
return latitude;
}
/**
* 设置维度
*
* @param pwd
*/
public void setLatitude(String lat) {
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
SharedPreferences.Editor editor = preferences.edit();
if (editor.putString(PREF_LATITUDE, lat).commit()) {
latitude = lat;
}
}
private Map<String, BmobChatUser> contactList = new HashMap<String, BmobChatUser>();
/**
* 获取内存中好友user list
*
* @return
*/
public Map<String, BmobChatUser> getContactList() {
return contactList;
}
/**
* 设置好友user list到内存中
* @param contactList
*/
public void setContactList(Map<String, BmobChatUser> contactList) {
if (this.contactList != null) {
this.contactList.clear();
}
this.contactList = contactList;
}
/**
* 退出登录,清空缓存数据
*/
public void logout() {
BmobUserManager.getInstance(getApplicationContext()).logout();
setContactList(null);
setLatitude(null);
setLongtitude(null);
}
}
| [
"513246732@qq.com"
] | 513246732@qq.com |
7e6e08e6624845f318621c9fcfc25a05afc50f76 | 65df20d14d5c6565ec135c9351d753436d3de0f5 | /jo_sm/src/jo/sm/ui/StatusPanel.java | 538c1d6546d2c6a9bc3ed4b0ffcdbcafc47ff22d | [
"Apache-2.0"
] | permissive | cadox8/SMEdit | caf70575e27ea450e7998bf6e92f73b825cf42a1 | f9bd01fc794886be71580488b656ec1c5c94afe3 | refs/heads/master | 2021-05-30T17:35:31.035736 | 2016-01-03T21:39:58 | 2016-01-03T21:39:58 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,336 | java | /**
* Copyright 2014
* SMEdit https://github.com/StarMade/SMEdit
* SMTools https://github.com/StarMade/SMTools
*
* 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.
**/
package jo.sm.ui;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.Font;
import java.util.logging.Logger;
import javax.swing.JLabel;
import javax.swing.JPanel;
import jo.log.LabelLogHandler;
public class StatusPanel extends JPanel {
private final static Logger log = Logger.getLogger(StatusPanel.class.getName());
private final JPanel contentPanel;
private final JPanel southPanel;
private final JPanel midPanel;
private final ToolPanel toolBar;
private final LabelLogHandler handler;
private final Font font;
/** Creates a new instance of StatusBar */
public StatusPanel() {
contentPanel = new JPanel(new BorderLayout());
southPanel = new JPanel(new BorderLayout());
midPanel = new JPanel(new BorderLayout());
toolBar = new ToolPanel(this);
midPanel.add(toolBar);
handler = new LabelLogHandler();
font = handler.label.getFont();
setLayout(new BorderLayout());
Logger.getLogger("").addHandler(handler);
southPanel.add(new JLabel(new TriangleSquareWindowsCornerIcon()), BorderLayout.EAST);
handler.label.setBorder(javax.swing.BorderFactory.createTitledBorder(" App Events "));
handler.label.setFont(new Font(font.getFamily(), Font.BOLD, font.getSize()));
handler.label.setPreferredSize(new Dimension(1000, 30 + 12));
contentPanel.add(handler.label, BorderLayout.NORTH);
contentPanel.add(midPanel, BorderLayout.CENTER);
contentPanel.add(southPanel, BorderLayout.SOUTH);
add(contentPanel, BorderLayout.CENTER);
}
}
| [
"bobbybighoof@gmail.com"
] | bobbybighoof@gmail.com |
8689522c0b5fce91012acb16f3d9d9ab86e8aff0 | 13a19c34921d2253f175ed97339c0b6a31dd92d0 | /src/main.java | 1c19aaa2a6122795b5f4959e33e9bd61d26bfb94 | [] | no_license | KevinIDU/Proj631 | bee8f363fccc54d099b69c620334dcf72a7fe567 | 15a968cc8616093dec32a476bbd910a9e0956cdd | refs/heads/master | 2021-05-16T23:17:55.327835 | 2020-03-28T16:39:26 | 2020-03-28T16:39:26 | 250,512,101 | 0 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 1,218 | java | import java.util.Scanner;
import java.util.*;
public class main {
public static void main(String[] args){
//Je demande a l'utlisateur quel texte il veux comprésser.
Scanner sc = new Scanner(System.in);
System.out.println("quel texte voulez vous compressez ? Indiquez juste le nom sans l'extension "); //Pour alice.txt -> alice
String adresse = sc.nextLine()+".txt";
//Ouverture du fichier texte et on récupere le nom du fichier
OpenFile texte = new OpenFile(adresse);
String nom = texte.nomFichier(adresse);
/* On détermine :
* -> l'alphabet et la fréquence des caractères.
* -> Le TreeSet pour lier et ordonner les données.
* -> Les noeuds a partir du TreeSet.
* -> L'arbre avec le parcours en profondeur
* -> L'écriture des fichiers .bin et .txt
*/
texte.defAlphFreq();
texte.defTreeSet();
texte.defNoeud();
texte.parcourir(texte.defArbre(), "");
texte.writeFileTxt(adresse);
texte.writeFileFreq(adresse);
System.out.println("le taux de compréssion de votre "+ nom+".txt est de :"+ texte.compression(nom+"_comp.bin", nom+".txt"));
System.out.println("un caractère est codé en moyenne sur "+ texte.moyBitCarac() +"bits");
}
}
| [
"kevin.fanton@etu.univ-lyon1.fr"
] | kevin.fanton@etu.univ-lyon1.fr |
642b8c8588b6f57faac9cfb819dd3f6f295b7a6a | 8d4e48455899e3931abf034f2942fd1578bf1dec | /bitvunit-core/src/test/java/de/codescape/bitvunit/rule/ViolationTest.java | 65fd93529371af1bc84b6f8c50326cfdb3fe9313 | [
"Apache-2.0",
"LicenseRef-scancode-free-unknown"
] | permissive | codescape/bitvunit | 57ddeb3daa0e644d1decf61a9aa9d28935f98b84 | 45fa124d1908f0081bb3f00f25f59d710d9dcbf8 | refs/heads/master | 2023-04-25T17:30:16.894518 | 2020-10-14T13:14:00 | 2020-10-14T13:14:00 | 1,784,308 | 3 | 2 | Apache-2.0 | 2021-06-04T01:34:22 | 2011-05-22T16:18:27 | Java | UTF-8 | Java | false | false | 2,136 | java | package de.codescape.bitvunit.rule;
import com.gargoylesoftware.htmlunit.html.HtmlElement;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
public class ViolationTest {
@Test
public void violationKnowsTheRule() throws Exception {
Rule expectedRule = someRule();
assertEquals(expectedRule, new Violation(expectedRule, someElement(), "").getRule());
}
@Test
public void violationKnowsThePosition() throws Exception {
Integer lineNumber = 4711;
Integer columnNumber = 815;
String expectedPosition = lineNumber + ":" + columnNumber;
assertEquals(expectedPosition, new Violation(someRule(), someElement(lineNumber, columnNumber), "").getPosition());
}
@Test
public void violationKnowsTheMessage() throws Exception {
String expectedMessage = someMessage();
assertEquals(expectedMessage, new Violation(someRule(), someElement(), expectedMessage).getMessage());
}
@Test(expected = IllegalArgumentException.class)
public void creatingViolationShouldFailWithoutRuleReference() {
new Violation(null, someElement(), someMessage());
}
@Test(expected = IllegalArgumentException.class)
public void creatingViolationShouldFailWithoutElementReference() {
new Violation(someRule(), null, someMessage());
}
@Test(expected = IllegalArgumentException.class)
public void creatingViolationShouldFailWithoutMessage() {
new Violation(someRule(), someElement(), null);
}
private Rule someRule() {
return mock(Rule.class);
}
private HtmlElement someElement(int lineNumber, int columnNumber) {
HtmlElement element = someElement();
when(element.getStartLineNumber()).thenReturn(lineNumber);
when(element.getStartColumnNumber()).thenReturn(columnNumber);
return element;
}
private HtmlElement someElement() {
return mock(HtmlElement.class);
}
private String someMessage() {
return "Some wise words.";
}
}
| [
"stefan.glase@googlemail.com"
] | stefan.glase@googlemail.com |
8b7aa6e2b5cf4c9619a2b72aee3d32bb48771df7 | c885ef92397be9d54b87741f01557f61d3f794f3 | /results/JacksonXml-6/com.fasterxml.jackson.dataformat.xml.ser.ToXmlGenerator/BBC-F0-opt-70/tests/8/com/fasterxml/jackson/dataformat/xml/ser/ToXmlGenerator_ESTest.java | 2d2c49dc5ce3fbc7f30398b86d39c5b87ba2d4dc | [
"CC-BY-4.0",
"MIT"
] | permissive | pderakhshanfar/EMSE-BBC-experiment | f60ac5f7664dd9a85f755a00a57ec12c7551e8c6 | fea1a92c2e7ba7080b8529e2052259c9b697bbda | refs/heads/main | 2022-11-25T00:39:58.983828 | 2022-04-12T16:04:26 | 2022-04-12T16:04:26 | 309,335,889 | 0 | 1 | null | 2021-11-05T11:18:43 | 2020-11-02T10:30:38 | null | UTF-8 | Java | false | false | 232,289 | java | /*
* This file was automatically generated by EvoSuite
* Wed Oct 13 17:33:57 GMT 2021
*/
package com.fasterxml.jackson.dataformat.xml.ser;
import org.junit.Test;
import static org.junit.Assert.*;
import static org.evosuite.shaded.org.mockito.Mockito.*;
import static org.evosuite.runtime.EvoAssertions.*;
import com.ctc.wstx.api.WriterConfig;
import com.ctc.wstx.sw.AsciiXmlWriter;
import com.ctc.wstx.sw.BufferingXmlWriter;
import com.ctc.wstx.sw.ISOLatin1XmlWriter;
import com.ctc.wstx.sw.NonNsStreamWriter;
import com.ctc.wstx.sw.RepairingNsStreamWriter;
import com.ctc.wstx.sw.SimpleNsStreamWriter;
import com.ctc.wstx.sw.XmlWriter;
import com.fasterxml.jackson.core.Base64Variant;
import com.fasterxml.jackson.core.JsonFactory;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.ObjectCodec;
import com.fasterxml.jackson.core.PrettyPrinter;
import com.fasterxml.jackson.core.SerializableString;
import com.fasterxml.jackson.core.io.IOContext;
import com.fasterxml.jackson.core.io.SerializedString;
import com.fasterxml.jackson.core.util.BufferRecycler;
import com.fasterxml.jackson.core.util.ByteArrayBuilder;
import com.fasterxml.jackson.core.util.DefaultPrettyPrinter;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.InjectableValues;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectReader;
import com.fasterxml.jackson.databind.deser.DefaultDeserializationContext;
import com.fasterxml.jackson.databind.node.MissingNode;
import com.fasterxml.jackson.databind.ser.DefaultSerializerProvider;
import com.fasterxml.jackson.dataformat.xml.ser.ToXmlGenerator;
import com.fasterxml.jackson.dataformat.xml.util.DefaultXmlPrettyPrinter;
import java.io.BufferedOutputStream;
import java.io.ByteArrayOutputStream;
import java.io.CharArrayWriter;
import java.io.FileDescriptor;
import java.io.IOException;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PipedOutputStream;
import java.io.StringWriter;
import java.math.BigDecimal;
import java.math.BigInteger;
import javax.xml.namespace.QName;
import javax.xml.stream.XMLStreamWriter;
import org.codehaus.stax2.XMLStreamWriter2;
import org.codehaus.stax2.ri.Stax2WriterAdapter;
import org.codehaus.stax2.util.StreamWriter2Delegate;
import org.codehaus.stax2.util.StreamWriterDelegate;
import org.evosuite.runtime.EvoRunner;
import org.evosuite.runtime.EvoRunnerParameters;
import org.evosuite.runtime.ViolatedAssumptionAnswer;
import org.evosuite.runtime.mock.java.io.MockFile;
import org.evosuite.runtime.mock.java.io.MockFileOutputStream;
import org.evosuite.runtime.mock.java.io.MockFileWriter;
import org.evosuite.runtime.mock.java.io.MockPrintStream;
import org.evosuite.runtime.mock.java.io.MockPrintWriter;
import org.evosuite.runtime.mock.java.util.MockRandom;
import org.junit.runner.RunWith;
@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, separateClassLoader = true)
public class ToXmlGenerator_ESTest extends ToXmlGenerator_ESTest_scaffolding {
@Test(timeout = 4000)
public void test000() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createFullDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, true);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, "srt h)ec", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, 4, 4, (ObjectCodec) null, repairingNsStreamWriter0);
QName qName0 = new QName("srt h)ec");
toXmlGenerator0._nextIsAttribute = true;
toXmlGenerator0.startWrappedValue(qName0, qName0);
byte[] byteArray0 = new byte[8];
// Undeclared exception!
try {
toXmlGenerator0.writeBinary(byteArray0, (int) (byte)0, 11);
fail("Expecting exception: ArrayIndexOutOfBoundsException");
} catch(ArrayIndexOutOfBoundsException e) {
}
}
@Test(timeout = 4000)
public void test001() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createFullDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, true);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, "srt h)ec", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, 4, 4, (ObjectCodec) null, repairingNsStreamWriter0);
QName qName0 = new QName("srt h)ec", "srt h)ec");
toXmlGenerator0._nextIsAttribute = true;
toXmlGenerator0.startWrappedValue(qName0, qName0);
byte[] byteArray0 = new byte[4];
// Undeclared exception!
try {
toXmlGenerator0.writeBinary(byteArray0, (int) (byte)52, 2);
fail("Expecting exception: ArrayIndexOutOfBoundsException");
} catch(ArrayIndexOutOfBoundsException e) {
}
}
@Test(timeout = 4000)
public void test002() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, bufferRecycler0, true);
ObjectMapper objectMapper0 = new ObjectMapper();
ByteArrayBuilder byteArrayBuilder0 = new ByteArrayBuilder(2328);
WriterConfig writerConfig0 = WriterConfig.createFullDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter(byteArrayBuilder0, writerConfig0, true);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, "n^jlz7", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator(iOContext0, 2328, 2325, objectMapper0, repairingNsStreamWriter0);
toXmlGenerator0.writeRaw((char[]) null, 56320, (-2653));
assertEquals(2325, toXmlGenerator0.getFormatFeatures());
}
@Test(timeout = 4000)
public void test003() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, false);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, ", expecting field name", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, 0, 0, (ObjectCodec) null, repairingNsStreamWriter0);
QName qName0 = new QName("");
toXmlGenerator0.startWrappedValue(qName0, qName0);
toXmlGenerator0.writeNull();
assertEquals(0, toXmlGenerator0.getFormatFeatures());
}
@Test(timeout = 4000)
public void test004() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, true);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, ", exetiyg field nme", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, 1762, 1762, (ObjectCodec) null, repairingNsStreamWriter0);
QName qName0 = new QName(", exetiyg field nme");
toXmlGenerator0.startWrappedValue(qName0, qName0);
toXmlGenerator0.writeStartObject((Object) iSOLatin1XmlWriter0);
toXmlGenerator0.writeFieldName("BINARY");
assertEquals(1762, toXmlGenerator0.getFormatFeatures());
}
@Test(timeout = 4000)
public void test005() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createFullDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, false);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, "<PW:\"Q]J`~IeuMY2gM", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, 0, 0, (ObjectCodec) null, repairingNsStreamWriter0);
toXmlGenerator0.writeStartArray();
toXmlGenerator0.writeEndArray();
assertEquals(0, toXmlGenerator0.getFormatFeatures());
}
@Test(timeout = 4000)
public void test006() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, false);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, "pKtEmLZY?", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, (-46), (-46), (ObjectCodec) null, repairingNsStreamWriter0);
QName qName0 = new QName("pKtEmLZY?", "pKtEmLZY?", "pKtEmLZY?");
toXmlGenerator0.startWrappedValue(qName0, qName0);
byte[] byteArray0 = new byte[4];
toXmlGenerator0.writeBinary((Base64Variant) null, byteArray0, (int) (byte) (-48), (-1));
assertEquals((-46), toXmlGenerator0.getFormatFeatures());
}
@Test(timeout = 4000)
public void test007() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createFullDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, true);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, "#['\"PAk}", writerConfig0);
StreamWriterDelegate streamWriterDelegate0 = new StreamWriterDelegate(repairingNsStreamWriter0);
XMLStreamWriter2 xMLStreamWriter2_0 = Stax2WriterAdapter.wrapIfNecessary(streamWriterDelegate0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, (-1471), 91, (ObjectCodec) null, xMLStreamWriter2_0);
toXmlGenerator0._verifyValueWrite("Wggs >P");
assertEquals(91, toXmlGenerator0.getFormatFeatures());
}
@Test(timeout = 4000)
public void test008() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, false);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, "start an object", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, (-339), (-339), (ObjectCodec) null, repairingNsStreamWriter0);
QName qName0 = new QName("start an object", "start an object");
toXmlGenerator0.startWrappedValue(qName0, qName0);
toXmlGenerator0.finishWrappedValue(qName0, qName0);
char[] charArray0 = new char[2];
try {
toXmlGenerator0.writeString(charArray0, (-339), 32);
fail("Expecting exception: IOException");
} catch(IOException e) {
//
// Trying to output second root, <start an object>
//
verifyException("com.fasterxml.jackson.dataformat.xml.util.StaxUtil", e);
}
}
@Test(timeout = 4000)
public void test009() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, false);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, ", expecting field name", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, 0, 0, (ObjectCodec) null, repairingNsStreamWriter0);
QName qName0 = new QName("", ", expecting field name");
toXmlGenerator0.startWrappedValue(qName0, qName0);
SerializedString serializedString0 = new SerializedString(", expecting field name");
toXmlGenerator0.writeString((SerializableString) serializedString0);
assertEquals(0, toXmlGenerator0.getFormatFeatures());
}
@Test(timeout = 4000)
public void test010() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createFullDefaults();
MockPrintStream mockPrintStream0 = new MockPrintStream("UTF-8");
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter(mockPrintStream0, writerConfig0, false);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, "4", writerConfig0);
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, writerConfig0, false);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator(iOContext0, 3, 1, (ObjectCodec) null, repairingNsStreamWriter0);
QName qName0 = new QName("Underlying Stax XMLStreamWriter (of type ");
toXmlGenerator0.startWrappedValue(qName0, qName0);
toXmlGenerator0.close();
try {
toXmlGenerator0.writeRawValue((char[]) null, (-3918), 2);
fail("Expecting exception: IOException");
} catch(IOException e) {
//
// Trying to output second root, <Underlying Stax XMLStreamWriter (of type >
//
verifyException("com.fasterxml.jackson.dataformat.xml.util.StaxUtil", e);
}
}
@Test(timeout = 4000)
public void test011() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, true);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, "1.0", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, 287, 287, (ObjectCodec) null, repairingNsStreamWriter0);
QName qName0 = new QName("A");
toXmlGenerator0.startWrappedValue(qName0, qName0);
char[] charArray0 = new char[1];
toXmlGenerator0.writeRawValue(charArray0, 45, (-82));
assertEquals(287, toXmlGenerator0.getFormatFeatures());
}
@Test(timeout = 4000)
public void test012() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, false);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, "", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, (-339), (-339), (ObjectCodec) null, repairingNsStreamWriter0);
QName qName0 = new QName("start n object", "}?.U|NF:b$,yl;nIm");
toXmlGenerator0.startWrappedValue(qName0, qName0);
toXmlGenerator0.finishWrappedValue(qName0, qName0);
try {
toXmlGenerator0.writeRawValue("", (-339), (-2566));
fail("Expecting exception: IOException");
} catch(IOException e) {
//
// Trying to output second root, <}?.U|NF:b$,yl;nIm>
//
verifyException("com.fasterxml.jackson.dataformat.xml.util.StaxUtil", e);
}
}
@Test(timeout = 4000)
public void test013() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, false);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, "", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, 0, 0, (ObjectCodec) null, repairingNsStreamWriter0);
QName qName0 = new QName("");
toXmlGenerator0.startWrappedValue(qName0, qName0);
toXmlGenerator0.writeRawValue("ALLOW_NON_NUMERIC_NUMBERS", 57343, (-1580));
assertEquals(0, toXmlGenerator0.getFormatFeatures());
}
@Test(timeout = 4000)
public void test014() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createFullDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, true);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, "#ME8,cmZW2y1S", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, (-304), (-304), (ObjectCodec) null, repairingNsStreamWriter0);
QName qName0 = new QName("#ME8,cmZW2y1S", "#ME8,cmZW2y1S");
toXmlGenerator0.startWrappedValue(qName0, qName0);
toXmlGenerator0.finishWrappedValue(qName0, qName0);
try {
toXmlGenerator0.writeRawValue("com.fasterxml.jackson.databind.ser.PropertyBuilder$1");
fail("Expecting exception: IOException");
} catch(IOException e) {
//
// Trying to output second root, <#ME8,cmZW2y1S>
//
verifyException("com.fasterxml.jackson.dataformat.xml.util.StaxUtil", e);
}
}
@Test(timeout = 4000)
public void test015() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
DefaultXmlPrettyPrinter defaultXmlPrettyPrinter0 = new DefaultXmlPrettyPrinter();
IOContext iOContext0 = new IOContext(bufferRecycler0, defaultXmlPrettyPrinter0, false);
JsonFactory jsonFactory0 = new JsonFactory();
DefaultSerializerProvider.Impl defaultSerializerProvider_Impl0 = new DefaultSerializerProvider.Impl();
ObjectMapper objectMapper0 = new ObjectMapper(jsonFactory0, defaultSerializerProvider_Impl0, (DefaultDeserializationContext) null);
ByteArrayBuilder byteArrayBuilder0 = new ByteArrayBuilder();
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter(byteArrayBuilder0, writerConfig0, false);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, "JSON", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator(iOContext0, 0, 31, objectMapper0, repairingNsStreamWriter0);
toXmlGenerator0.writeRaw("bx?n-Wy|,Q", (-2714), (-63));
assertEquals(31, toXmlGenerator0.getFormatFeatures());
}
@Test(timeout = 4000)
public void test016() throws Throwable {
FileDescriptor fileDescriptor0 = new FileDescriptor();
MockFileOutputStream mockFileOutputStream0 = new MockFileOutputStream(fileDescriptor0);
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
AsciiXmlWriter asciiXmlWriter0 = new AsciiXmlWriter(mockFileOutputStream0, writerConfig0, true);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(asciiXmlWriter0, "|}Cc", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, 31, 31, (ObjectCodec) null, repairingNsStreamWriter0);
toXmlGenerator0.writeRaw('*');
assertEquals(31, toXmlGenerator0.getFormatFeatures());
}
@Test(timeout = 4000)
public void test017() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, false);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, ", expecting field name", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, (-27), (-27), (ObjectCodec) null, repairingNsStreamWriter0);
QName qName0 = new QName("");
toXmlGenerator0.startWrappedValue(qName0, qName0);
BigInteger bigInteger0 = BigInteger.ONE;
toXmlGenerator0.writeNumber(bigInteger0);
assertEquals((-27), toXmlGenerator0.getFormatFeatures());
}
@Test(timeout = 4000)
public void test018() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, false);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, ") does not implement Stax2 API natively and is missing method '", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, 248, 248, (ObjectCodec) null, repairingNsStreamWriter0);
QName qName0 = new QName("");
toXmlGenerator0.startWrappedValue(qName0, qName0);
toXmlGenerator0.writeNumber((BigInteger) null);
assertEquals(248, toXmlGenerator0.getFormatFeatures());
}
@Test(timeout = 4000)
public void test019() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, false);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, ", expecting field name", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, 0, 0, (ObjectCodec) null, repairingNsStreamWriter0);
QName qName0 = new QName("");
toXmlGenerator0.startWrappedValue(qName0, qName0);
toXmlGenerator0.writeNumber((BigDecimal) null);
assertEquals(0, toXmlGenerator0.getFormatFeatures());
}
@Test(timeout = 4000)
public void test020() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, false);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, "pKtEmLZY?", writerConfig0);
repairingNsStreamWriter0.writeEmptyElement("P{A\"");
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, (-46), 1812, (ObjectCodec) null, repairingNsStreamWriter0);
QName qName0 = new QName("pKtEmLZY?");
toXmlGenerator0.startWrappedValue(qName0, qName0);
try {
toXmlGenerator0.writeNumber((float) 56320);
fail("Expecting exception: IOException");
} catch(IOException e) {
//
// Trying to output non-whitespace characters outside main element tree (in prolog or epilog)
//
verifyException("com.fasterxml.jackson.dataformat.xml.util.StaxUtil", e);
}
}
@Test(timeout = 4000)
public void test021() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, false);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, ", expecting field name", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, 1762, 1762, (ObjectCodec) null, repairingNsStreamWriter0);
QName qName0 = new QName(", expecting field name");
toXmlGenerator0.startWrappedValue(qName0, qName0);
toXmlGenerator0.writeStartObject((Object) iSOLatin1XmlWriter0);
SerializedString serializedString0 = new SerializedString("");
toXmlGenerator0.writeFieldName((SerializableString) serializedString0);
assertEquals(1762, toXmlGenerator0.getFormatFeatures());
}
@Test(timeout = 4000)
public void test022() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, true);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, "", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, 287, 287, (ObjectCodec) null, repairingNsStreamWriter0);
QName qName0 = QName.valueOf("");
toXmlGenerator0.startWrappedValue(qName0, qName0);
byte[] byteArray0 = new byte[2];
repairingNsStreamWriter0.writeFullEndElement();
try {
toXmlGenerator0.writeBinary(byteArray0, 287, 56319);
fail("Expecting exception: IOException");
} catch(IOException e) {
//
// Trying to output second root, <>
//
verifyException("com.fasterxml.jackson.dataformat.xml.util.StaxUtil", e);
}
}
@Test(timeout = 4000)
public void test023() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createFullDefaults();
MockPrintStream mockPrintStream0 = new MockPrintStream("@JsonUnwrapped");
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter(mockPrintStream0, writerConfig0, false);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, "4", writerConfig0);
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, writerConfig0, false);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator(iOContext0, 3, 1, (ObjectCodec) null, repairingNsStreamWriter0);
QName qName0 = new QName("Underlying Stax XMLStreamWriter (of type ");
toXmlGenerator0.startWrappedValue(qName0, qName0);
toXmlGenerator0.writeBinary((byte[]) null, 1, 97);
assertEquals(1, toXmlGenerator0.getFormatFeatures());
}
@Test(timeout = 4000)
public void test024() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, bufferRecycler0, true);
ObjectMapper objectMapper0 = new ObjectMapper();
ByteArrayBuilder byteArrayBuilder0 = new ByteArrayBuilder(2328);
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter(byteArrayBuilder0, writerConfig0, true);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, "writeRawValue", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator(iOContext0, (-1580), 2284, objectMapper0, repairingNsStreamWriter0);
toXmlGenerator0.flush();
assertEquals(2284, toXmlGenerator0.getFormatFeatures());
}
@Test(timeout = 4000)
public void test025() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createFullDefaults();
StringWriter stringWriter0 = new StringWriter();
MockPrintWriter mockPrintWriter0 = new MockPrintWriter(stringWriter0);
MockPrintStream mockPrintStream0 = new MockPrintStream("y=|!obwF~|A$");
BufferingXmlWriter bufferingXmlWriter0 = new BufferingXmlWriter(mockPrintWriter0, writerConfig0, "", false, mockPrintStream0, 1189);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(bufferingXmlWriter0, "Unexpected tokens after complete type", writerConfig0);
JsonFactory jsonFactory0 = new JsonFactory((ObjectCodec) null);
BufferRecycler bufferRecycler0 = jsonFactory0._getBufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, repairingNsStreamWriter0, false);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator(iOContext0, (-1170), (-1), (ObjectCodec) null, repairingNsStreamWriter0);
DefaultXmlPrettyPrinter defaultXmlPrettyPrinter0 = new DefaultXmlPrettyPrinter();
QName qName0 = new QName("YCJth3W4%8c");
toXmlGenerator0.startWrappedValue(qName0, qName0);
toXmlGenerator0.writeStartObject((Object) bufferingXmlWriter0);
toXmlGenerator0.setPrettyPrinter(defaultXmlPrettyPrinter0);
try {
toXmlGenerator0.close();
fail("Expecting exception: IOException");
} catch(IOException e) {
//
// N/A
//
verifyException("com.fasterxml.jackson.dataformat.xml.ser.ToXmlGenerator", e);
}
}
@Test(timeout = 4000)
public void test026() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, false);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, (String) null, writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, 1762, 1762, (ObjectCodec) null, repairingNsStreamWriter0);
QName qName0 = new QName(", expecting field name");
toXmlGenerator0.startWrappedValue(qName0, qName0);
toXmlGenerator0.finishWrappedValue(qName0, qName0);
try {
toXmlGenerator0.writeStartObject((Object) iSOLatin1XmlWriter0);
fail("Expecting exception: IOException");
} catch(IOException e) {
//
// Trying to output second root, <, expecting field name>
//
verifyException("com.fasterxml.jackson.dataformat.xml.util.StaxUtil", e);
}
}
@Test(timeout = 4000)
public void test027() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, false);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, ", expcting fid nam", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, 0, 0, (ObjectCodec) null, repairingNsStreamWriter0);
repairingNsStreamWriter0.writeEmptyElement("", "");
QName qName0 = new QName("");
toXmlGenerator0.startWrappedValue(qName0, qName0);
toXmlGenerator0._handleStartObject();
try {
toXmlGenerator0._handleEndObject();
fail("Expecting exception: IOException");
} catch(IOException e) {
//
// No open start element, when trying to write end element
//
verifyException("com.fasterxml.jackson.dataformat.xml.util.StaxUtil", e);
}
}
@Test(timeout = 4000)
public void test028() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, bufferRecycler0, true);
ByteArrayBuilder byteArrayBuilder0 = new ByteArrayBuilder(bufferRecycler0, 365);
WriterConfig writerConfig0 = WriterConfig.createFullDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter(byteArrayBuilder0, writerConfig0, false);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, "_WGb;SCmp+oQ3hZ|M", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator(iOContext0, 2, 0, (ObjectCodec) null, repairingNsStreamWriter0);
JsonGenerator jsonGenerator0 = toXmlGenerator0.setPrettyPrinter((PrettyPrinter) null);
assertEquals(0, jsonGenerator0.getFormatFeatures());
}
@Test(timeout = 4000)
public void test029() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, bufferRecycler0, true);
ObjectMapper objectMapper0 = new ObjectMapper();
ByteArrayBuilder byteArrayBuilder0 = new ByteArrayBuilder(2328);
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter(byteArrayBuilder0, writerConfig0, true);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, "writeRawValue", writerConfig0);
StreamWriter2Delegate streamWriter2Delegate0 = new StreamWriter2Delegate(repairingNsStreamWriter0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator(iOContext0, 3, 0, objectMapper0, streamWriter2Delegate0);
toXmlGenerator0.overrideFormatFeatures(4, 1401);
assertEquals(0, toXmlGenerator0.getFormatFeatures());
}
@Test(timeout = 4000)
public void test030() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, bufferRecycler0, true);
ObjectMapper objectMapper0 = new ObjectMapper();
InjectableValues.Std injectableValues_Std0 = new InjectableValues.Std();
ObjectReader objectReader0 = objectMapper0.reader((InjectableValues) injectableValues_Std0);
ByteArrayBuilder byteArrayBuilder0 = new ByteArrayBuilder(1);
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter(byteArrayBuilder0, writerConfig0, true);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, "writeRawValue", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator(iOContext0, 3, (-1580), objectReader0, repairingNsStreamWriter0);
assertEquals((-1580), toXmlGenerator0.getFormatFeatures());
toXmlGenerator0.overrideFormatFeatures(1977, 3);
assertEquals((-1579), toXmlGenerator0.getFormatFeatures());
}
@Test(timeout = 4000)
public void test031() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createFullDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, true);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, "", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, (-2276), (-3868), (ObjectCodec) null, repairingNsStreamWriter0);
QName qName0 = QName.valueOf("");
toXmlGenerator0.startWrappedValue(qName0, qName0);
MissingNode missingNode0 = MissingNode.getInstance();
toXmlGenerator0.writeStartObject((Object) missingNode0);
toXmlGenerator0.inRoot();
assertEquals((-3868), toXmlGenerator0.getFormatFeatures());
}
@Test(timeout = 4000)
public void test032() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
MissingNode missingNode0 = MissingNode.getInstance();
IOContext iOContext0 = new IOContext(bufferRecycler0, missingNode0, true);
ObjectMapper objectMapper0 = new ObjectMapper();
MockFile mockFile0 = new MockFile("X-");
MockFileWriter mockFileWriter0 = new MockFileWriter(mockFile0, true);
WriterConfig writerConfig0 = WriterConfig.createFullDefaults();
MockPrintStream mockPrintStream0 = new MockPrintStream(mockFile0);
BufferingXmlWriter bufferingXmlWriter0 = new BufferingXmlWriter(mockFileWriter0, writerConfig0, "X-", true, mockPrintStream0, 1);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(bufferingXmlWriter0, "X-", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator(iOContext0, 0, 0, objectMapper0, repairingNsStreamWriter0);
int int0 = toXmlGenerator0.getFormatFeatures();
assertEquals(0, int0);
}
@Test(timeout = 4000)
public void test033() throws Throwable {
ToXmlGenerator.Feature toXmlGenerator_Feature0 = ToXmlGenerator.Feature.WRITE_XML_DECLARATION;
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, toXmlGenerator_Feature0, false);
ObjectMapper objectMapper0 = new ObjectMapper();
ByteArrayBuilder byteArrayBuilder0 = new ByteArrayBuilder();
WriterConfig writerConfig0 = WriterConfig.createFullDefaults();
AsciiXmlWriter asciiXmlWriter0 = new AsciiXmlWriter(byteArrayBuilder0, writerConfig0, false);
NonNsStreamWriter nonNsStreamWriter0 = new NonNsStreamWriter(asciiXmlWriter0, "={H #", writerConfig0);
StreamWriter2Delegate streamWriter2Delegate0 = new StreamWriter2Delegate(nonNsStreamWriter0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator(iOContext0, 0, 2, objectMapper0, streamWriter2Delegate0);
int int0 = toXmlGenerator0.getFormatFeatures();
assertEquals(2, int0);
}
@Test(timeout = 4000)
public void test034() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createFullDefaults();
MockPrintStream mockPrintStream0 = new MockPrintStream("@JsonUnwrapped");
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter(mockPrintStream0, writerConfig0, false);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, "4", writerConfig0);
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, writerConfig0, false);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator(iOContext0, 3, 1, (ObjectCodec) null, repairingNsStreamWriter0);
ToXmlGenerator.Feature toXmlGenerator_Feature0 = ToXmlGenerator.Feature.WRITE_XML_1_1;
QName qName0 = new QName("Underlying Stax XMLStreamWriter (of type ");
toXmlGenerator0.startWrappedValue(qName0, qName0);
toXmlGenerator0.close();
assertEquals(1, toXmlGenerator0.getFormatFeatures());
toXmlGenerator0.enable(toXmlGenerator_Feature0);
assertEquals(3, toXmlGenerator0.getFormatFeatures());
}
@Test(timeout = 4000)
public void test035() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, false);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, ", expecting field name", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, 1762, 1762, (ObjectCodec) null, repairingNsStreamWriter0);
QName qName0 = new QName(", expecting field name");
toXmlGenerator0.startWrappedValue(qName0, qName0);
toXmlGenerator0.writeStartObject((Object) iSOLatin1XmlWriter0);
ToXmlGenerator.Feature toXmlGenerator_Feature0 = ToXmlGenerator.Feature.WRITE_XML_1_1;
ToXmlGenerator toXmlGenerator1 = toXmlGenerator0.enable(toXmlGenerator_Feature0);
assertEquals(1762, toXmlGenerator1.getFormatFeatures());
}
@Test(timeout = 4000)
public void test036() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
JsonGenerator.Feature jsonGenerator_Feature0 = JsonGenerator.Feature.QUOTE_FIELD_NAMES;
IOContext iOContext0 = new IOContext(bufferRecycler0, jsonGenerator_Feature0, true);
ObjectMapper objectMapper0 = new ObjectMapper();
ByteArrayBuilder byteArrayBuilder0 = new ByteArrayBuilder(bufferRecycler0, 2094);
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
AsciiXmlWriter asciiXmlWriter0 = new AsciiXmlWriter(byteArrayBuilder0, writerConfig0, true);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(asciiXmlWriter0, (String) null, writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator(iOContext0, 1778, (-1435), objectMapper0, repairingNsStreamWriter0);
ToXmlGenerator.Feature toXmlGenerator_Feature0 = ToXmlGenerator.Feature.WRITE_XML_DECLARATION;
toXmlGenerator0.enable(toXmlGenerator_Feature0);
assertEquals((-1435), toXmlGenerator0.getFormatFeatures());
}
@Test(timeout = 4000)
public void test037() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, false);
SimpleNsStreamWriter simpleNsStreamWriter0 = new SimpleNsStreamWriter(iSOLatin1XmlWriter0, "Value returned by 'any-getter' (%s()) not java.util.Map but %s", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, 0, 8000, (ObjectCodec) null, simpleNsStreamWriter0);
ToXmlGenerator.Feature toXmlGenerator_Feature0 = ToXmlGenerator.Feature.WRITE_XML_1_1;
toXmlGenerator0.enable(toXmlGenerator_Feature0);
assertEquals(8002, toXmlGenerator0.getFormatFeatures());
}
@Test(timeout = 4000)
public void test038() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createFullDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, true);
ToXmlGenerator.Feature toXmlGenerator_Feature0 = ToXmlGenerator.Feature.WRITE_XML_1_1;
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, "#['\"PAk}", writerConfig0);
StreamWriterDelegate streamWriterDelegate0 = new StreamWriterDelegate(repairingNsStreamWriter0);
XMLStreamWriter2 xMLStreamWriter2_0 = Stax2WriterAdapter.wrapIfNecessary(streamWriterDelegate0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, (-1471), 91, (ObjectCodec) null, xMLStreamWriter2_0);
ToXmlGenerator toXmlGenerator1 = toXmlGenerator0.enable(toXmlGenerator_Feature0);
assertEquals(91, toXmlGenerator1.getFormatFeatures());
}
@Test(timeout = 4000)
public void test039() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, bufferRecycler0, true);
ObjectMapper objectMapper0 = new ObjectMapper();
StringWriter stringWriter0 = new StringWriter(2283);
WriterConfig writerConfig0 = WriterConfig.createFullDefaults();
BufferedOutputStream bufferedOutputStream0 = new BufferedOutputStream((OutputStream) null);
BufferingXmlWriter bufferingXmlWriter0 = new BufferingXmlWriter(stringWriter0, writerConfig0, (String) null, true, bufferedOutputStream0, 2);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(bufferingXmlWriter0, (String) null, writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator(iOContext0, (-855), 127, objectMapper0, repairingNsStreamWriter0);
QName qName0 = new QName("");
toXmlGenerator0.startWrappedValue(qName0, qName0);
toXmlGenerator0.close();
assertEquals(127, toXmlGenerator0.getFormatFeatures());
ToXmlGenerator.Feature toXmlGenerator_Feature0 = ToXmlGenerator.Feature.WRITE_XML_DECLARATION;
toXmlGenerator0.disable(toXmlGenerator_Feature0);
assertEquals(126, toXmlGenerator0.getFormatFeatures());
}
@Test(timeout = 4000)
public void test040() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, bufferRecycler0, true);
ObjectMapper objectMapper0 = new ObjectMapper();
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, false);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, (String) null, writerConfig0);
StreamWriter2Delegate streamWriter2Delegate0 = new StreamWriter2Delegate(repairingNsStreamWriter0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator(iOContext0, 4, 0, objectMapper0, streamWriter2Delegate0);
ToXmlGenerator.Feature toXmlGenerator_Feature0 = ToXmlGenerator.Feature.WRITE_XML_1_1;
toXmlGenerator0.writeStartArray();
ToXmlGenerator toXmlGenerator1 = toXmlGenerator0.disable(toXmlGenerator_Feature0);
assertEquals(0, toXmlGenerator1.getFormatFeatures());
}
@Test(timeout = 4000)
public void test041() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, false);
ToXmlGenerator.Feature toXmlGenerator_Feature0 = ToXmlGenerator.Feature.WRITE_XML_1_1;
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, "", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, 0, 0, (ObjectCodec) null, repairingNsStreamWriter0);
ToXmlGenerator toXmlGenerator1 = toXmlGenerator0.disable(toXmlGenerator_Feature0);
assertEquals(0, toXmlGenerator1.getFormatFeatures());
}
@Test(timeout = 4000)
public void test042() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, bufferRecycler0, false);
ObjectMapper objectMapper0 = new ObjectMapper();
WriterConfig writerConfig0 = WriterConfig.createFullDefaults();
SimpleNsStreamWriter simpleNsStreamWriter0 = new SimpleNsStreamWriter((XmlWriter) null, "", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator(iOContext0, (-3360), (-3697), objectMapper0, simpleNsStreamWriter0);
ToXmlGenerator.Feature toXmlGenerator_Feature0 = ToXmlGenerator.Feature.WRITE_XML_1_1;
toXmlGenerator0.disable(toXmlGenerator_Feature0);
assertEquals((-3699), toXmlGenerator0.getFormatFeatures());
}
@Test(timeout = 4000)
public void test043() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, bufferRecycler0, true);
ObjectMapper objectMapper0 = new ObjectMapper();
StringWriter stringWriter0 = new StringWriter(2283);
WriterConfig writerConfig0 = WriterConfig.createFullDefaults();
BufferedOutputStream bufferedOutputStream0 = new BufferedOutputStream((OutputStream) null);
BufferingXmlWriter bufferingXmlWriter0 = new BufferingXmlWriter(stringWriter0, writerConfig0, (String) null, true, bufferedOutputStream0, 2);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(bufferingXmlWriter0, (String) null, writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator(iOContext0, (-855), 127, objectMapper0, repairingNsStreamWriter0);
QName qName0 = new QName("");
toXmlGenerator0.startWrappedValue(qName0, qName0);
toXmlGenerator0.close();
assertEquals(127, toXmlGenerator0.getFormatFeatures());
ToXmlGenerator.Feature toXmlGenerator_Feature0 = ToXmlGenerator.Feature.WRITE_XML_DECLARATION;
toXmlGenerator0.configure(toXmlGenerator_Feature0, false);
assertEquals(126, toXmlGenerator0.getFormatFeatures());
}
@Test(timeout = 4000)
public void test044() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, true);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, "n dj&El4_]+", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, (-73), (-73), (ObjectCodec) null, repairingNsStreamWriter0);
QName qName0 = QName.valueOf("n dj&El4_]+");
toXmlGenerator0.startWrappedValue(qName0, qName0);
toXmlGenerator0.writeStartObject((Object) qName0);
ToXmlGenerator.Feature toXmlGenerator_Feature0 = ToXmlGenerator.Feature.WRITE_XML_DECLARATION;
toXmlGenerator0.configure(toXmlGenerator_Feature0, true);
assertEquals((-73), toXmlGenerator0.getFormatFeatures());
}
@Test(timeout = 4000)
public void test045() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, bufferRecycler0.CHAR_CONCAT_BUFFER, false);
ObjectMapper objectMapper0 = new ObjectMapper((JsonFactory) null);
WriterConfig writerConfig0 = WriterConfig.createFullDefaults();
SimpleNsStreamWriter simpleNsStreamWriter0 = new SimpleNsStreamWriter((XmlWriter) null, "org.codehaus.stax2.ri.typed.StringBase64Decoder", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator(iOContext0, 2, 2, objectMapper0, simpleNsStreamWriter0);
assertEquals(2, toXmlGenerator0.getFormatFeatures());
ToXmlGenerator.Feature toXmlGenerator_Feature0 = ToXmlGenerator.Feature.WRITE_XML_1_1;
toXmlGenerator0.configure(toXmlGenerator_Feature0, false);
assertEquals(0, toXmlGenerator0.getFormatFeatures());
}
@Test(timeout = 4000)
public void test046() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, bufferRecycler0, false);
ObjectMapper objectMapper0 = new ObjectMapper();
WriterConfig writerConfig0 = WriterConfig.createFullDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, false);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, "x", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator(iOContext0, 0, 3, objectMapper0, repairingNsStreamWriter0);
ToXmlGenerator.Feature toXmlGenerator_Feature0 = ToXmlGenerator.Feature.WRITE_XML_DECLARATION;
toXmlGenerator0.configure(toXmlGenerator_Feature0, true);
assertEquals(3, toXmlGenerator0.getFormatFeatures());
}
@Test(timeout = 4000)
public void test047() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, true);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, "H2", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, (-2235), (-2235), (ObjectCodec) null, repairingNsStreamWriter0);
toXmlGenerator0._nextIsUnwrapped = true;
boolean boolean0 = toXmlGenerator0.checkNextIsUnwrapped();
assertEquals((-2235), toXmlGenerator0.getFormatFeatures());
assertTrue(boolean0);
}
@Test(timeout = 4000)
public void test048() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, true);
SimpleNsStreamWriter simpleNsStreamWriter0 = new SimpleNsStreamWriter(iSOLatin1XmlWriter0, "v=K5O_>x)V}6~].2", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, 0, 0, (ObjectCodec) null, simpleNsStreamWriter0);
boolean boolean0 = toXmlGenerator0.checkNextIsUnwrapped();
assertEquals(0, toXmlGenerator0.getFormatFeatures());
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test049() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, false);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, ", expecting field name", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, 1762, 1762, (ObjectCodec) null, repairingNsStreamWriter0);
toXmlGenerator0._constructDefaultPrettyPrinter();
assertEquals(1762, toXmlGenerator0.getFormatFeatures());
}
@Test(timeout = 4000)
public void test050() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createFullDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, true);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, (String) null, writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, 1762, 1762, (ObjectCodec) null, repairingNsStreamWriter0);
QName qName0 = new QName(", expecting field name");
toXmlGenerator0.startWrappedValue(qName0, qName0);
toXmlGenerator0.writeStartObject((Object) iSOLatin1XmlWriter0);
// Undeclared exception!
try {
toXmlGenerator0.writeStringField("? Vn(93dt", (String) null);
fail("Expecting exception: NullPointerException");
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("com.ctc.wstx.sw.BaseStreamWriter", e);
}
}
@Test(timeout = 4000)
public void test051() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createFullDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, false);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, ", expecting field name", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, (-24), (-24), (ObjectCodec) null, repairingNsStreamWriter0);
QName qName0 = new QName(", expecting field name");
toXmlGenerator0.startWrappedValue(qName0, qName0);
toXmlGenerator0.writeStartObject((Object) ", expecting field name");
// Undeclared exception!
try {
toXmlGenerator0.writeStringField((String) null, (String) null);
fail("Expecting exception: IllegalArgumentException");
} catch(IllegalArgumentException e) {
//
// local part cannot be \"null\" when creating a QName
//
verifyException("javax.xml.namespace.QName", e);
}
}
@Test(timeout = 4000)
public void test052() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createFullDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, true);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, "rth)ec", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, 4, 4, (ObjectCodec) null, repairingNsStreamWriter0);
QName qName0 = new QName("rth)ec", "rth)ec");
toXmlGenerator0._nextIsAttribute = true;
toXmlGenerator0.startWrappedValue(qName0, qName0);
char[] charArray0 = new char[5];
// Undeclared exception!
try {
toXmlGenerator0.writeString(charArray0, 4, 4);
fail("Expecting exception: StringIndexOutOfBoundsException");
} catch(StringIndexOutOfBoundsException e) {
}
}
@Test(timeout = 4000)
public void test053() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, true);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, "", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, 257, 257, (ObjectCodec) null, repairingNsStreamWriter0);
QName qName0 = QName.valueOf("");
toXmlGenerator0.startWrappedValue(qName0, qName0);
char[] charArray0 = new char[3];
// Undeclared exception!
try {
toXmlGenerator0.writeString(charArray0, (-391), 15);
fail("Expecting exception: ArrayIndexOutOfBoundsException");
} catch(ArrayIndexOutOfBoundsException e) {
//
// -391
//
verifyException("com.ctc.wstx.sw.ISOLatin1XmlWriter", e);
}
}
@Test(timeout = 4000)
public void test054() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, false);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, ", expecting field name", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, 1762, 1762, (ObjectCodec) null, repairingNsStreamWriter0);
QName qName0 = new QName(", expecting field name");
toXmlGenerator0.startWrappedValue(qName0, qName0);
toXmlGenerator0.writeStartObject((Object) iSOLatin1XmlWriter0);
try {
toXmlGenerator0.writeString((char[]) null, 1762, 2512);
fail("Expecting exception: IOException");
} catch(IOException e) {
//
// Can not write String value, expecting field name
//
verifyException("com.fasterxml.jackson.core.JsonGenerator", e);
}
}
@Test(timeout = 4000)
public void test055() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, true);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, "1.0", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, 287, 287, (ObjectCodec) null, repairingNsStreamWriter0);
QName qName0 = new QName("A");
toXmlGenerator0.startWrappedValue(qName0, qName0);
// Undeclared exception!
try {
toXmlGenerator0.writeString((String) null);
fail("Expecting exception: NullPointerException");
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("com.ctc.wstx.sw.BaseStreamWriter", e);
}
}
@Test(timeout = 4000)
public void test056() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, false);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, " not Java Enum type", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, (-215), 465, (ObjectCodec) null, repairingNsStreamWriter0);
QName qName0 = new QName(" not Java Enum type");
toXmlGenerator0.startWrappedValue(qName0, qName0);
toXmlGenerator0.writeStartObject();
try {
toXmlGenerator0.writeString("\"A\u0003");
fail("Expecting exception: IOException");
} catch(IOException e) {
//
// Can not write String value, expecting field name
//
verifyException("com.fasterxml.jackson.core.JsonGenerator", e);
}
}
@Test(timeout = 4000)
public void test057() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createFullDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, false);
SimpleNsStreamWriter simpleNsStreamWriter0 = new SimpleNsStreamWriter(iSOLatin1XmlWriter0, "v={O_>x)V}6~]2", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, 2621473, 578, (ObjectCodec) null, simpleNsStreamWriter0);
// Undeclared exception!
try {
toXmlGenerator0.writeString((SerializableString) null);
fail("Expecting exception: NullPointerException");
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("com.fasterxml.jackson.dataformat.xml.ser.ToXmlGenerator", e);
}
}
@Test(timeout = 4000)
public void test058() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, true);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, ", exetiyg fiel%d nme", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, 1762, 1762, (ObjectCodec) null, repairingNsStreamWriter0);
QName qName0 = new QName(", exetiyg fiel%d nme");
toXmlGenerator0.startWrappedValue(qName0, qName0);
toXmlGenerator0.writeStartObject((Object) iSOLatin1XmlWriter0);
SerializedString serializedString0 = new SerializedString(", exetiyg fiel%d nme");
try {
toXmlGenerator0.writeString((SerializableString) serializedString0);
fail("Expecting exception: IOException");
} catch(IOException e) {
//
// Can not write String value, expecting field name
//
verifyException("com.fasterxml.jackson.core.JsonGenerator", e);
}
}
@Test(timeout = 4000)
public void test059() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, false);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, (String) null, writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, 1762, 1762, (ObjectCodec) null, repairingNsStreamWriter0);
QName qName0 = new QName(", expecting field name");
toXmlGenerator0.startWrappedValue(qName0, qName0);
toXmlGenerator0.writeStartObject((Object) iSOLatin1XmlWriter0);
try {
toXmlGenerator0.writeStartObject();
fail("Expecting exception: IOException");
} catch(IOException e) {
//
// Can not start an object, expecting field name
//
verifyException("com.fasterxml.jackson.core.JsonGenerator", e);
}
}
@Test(timeout = 4000)
public void test060() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, bufferRecycler0.BYTE_WRITE_CONCAT_BUFFER, false);
ObjectMapper objectMapper0 = new ObjectMapper();
ByteArrayBuilder byteArrayBuilder0 = new ByteArrayBuilder(2);
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
AsciiXmlWriter asciiXmlWriter0 = new AsciiXmlWriter(byteArrayBuilder0, writerConfig0, true);
SimpleNsStreamWriter simpleNsStreamWriter0 = new SimpleNsStreamWriter(asciiXmlWriter0, "s6>E?", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator(iOContext0, 2, 3, objectMapper0, simpleNsStreamWriter0);
// Undeclared exception!
try {
toXmlGenerator0.writeRepeatedFieldName();
fail("Expecting exception: NullPointerException");
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("com.fasterxml.jackson.dataformat.xml.ser.ToXmlGenerator", e);
}
}
@Test(timeout = 4000)
public void test061() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
AsciiXmlWriter asciiXmlWriter0 = new AsciiXmlWriter((OutputStream) null, writerConfig0, true);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(asciiXmlWriter0, "N8K", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, 0, 1704, (ObjectCodec) null, repairingNsStreamWriter0);
QName qName0 = new QName("");
toXmlGenerator0.startWrappedValue(qName0, qName0);
char[] charArray0 = new char[2];
// Undeclared exception!
try {
toXmlGenerator0.writeRawValue(charArray0, 56320, 55296);
fail("Expecting exception: ArrayIndexOutOfBoundsException");
} catch(ArrayIndexOutOfBoundsException e) {
//
// 56320
//
verifyException("com.ctc.wstx.sw.AsciiXmlWriter", e);
}
}
@Test(timeout = 4000)
public void test062() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, false);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, ", expecting field name", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, 55296, 55296, (ObjectCodec) null, repairingNsStreamWriter0);
QName qName0 = new QName("");
toXmlGenerator0.startWrappedValue(qName0, qName0);
// Undeclared exception!
try {
toXmlGenerator0.writeRawValue((String) null, 57343, 2);
fail("Expecting exception: NullPointerException");
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
}
}
@Test(timeout = 4000)
public void test063() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, false);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, ", expecting field name", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, 0, 0, (ObjectCodec) null, repairingNsStreamWriter0);
QName qName0 = new QName("");
toXmlGenerator0.startWrappedValue(qName0, qName0);
// Undeclared exception!
try {
toXmlGenerator0.writeRawValue((String) null);
fail("Expecting exception: NullPointerException");
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("com.ctc.wstx.sw.BaseStreamWriter", e);
}
}
@Test(timeout = 4000)
public void test064() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter((XmlWriter) null, "\" (character at #", writerConfig0);
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = mock(IOContext.class, new ViolatedAssumptionAnswer());
StreamWriterDelegate streamWriterDelegate0 = new StreamWriterDelegate(repairingNsStreamWriter0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator(iOContext0, (-473), 0, (ObjectCodec) null, streamWriterDelegate0);
IOContext iOContext1 = new IOContext(bufferRecycler0, streamWriterDelegate0, true);
Stax2WriterAdapter stax2WriterAdapter0 = (Stax2WriterAdapter)toXmlGenerator0._xmlWriter;
ToXmlGenerator toXmlGenerator1 = new ToXmlGenerator(iOContext1, 1338, 335, (ObjectCodec) null, stax2WriterAdapter0);
// Undeclared exception!
try {
toXmlGenerator1.writeRaw((char[]) null, 0, (-912));
fail("Expecting exception: StringIndexOutOfBoundsException");
} catch(StringIndexOutOfBoundsException e) {
}
}
@Test(timeout = 4000)
public void test065() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, bufferRecycler0, true);
ObjectMapper objectMapper0 = new ObjectMapper();
InjectableValues.Std injectableValues_Std0 = new InjectableValues.Std();
ObjectReader objectReader0 = objectMapper0.reader((InjectableValues) injectableValues_Std0);
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
SimpleNsStreamWriter simpleNsStreamWriter0 = new SimpleNsStreamWriter((XmlWriter) null, "", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator(iOContext0, 2, 24, objectReader0, simpleNsStreamWriter0);
char[] charArray0 = new char[1];
// Undeclared exception!
try {
toXmlGenerator0.writeRaw(charArray0, 17, 17);
fail("Expecting exception: NullPointerException");
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("com.ctc.wstx.sw.BaseStreamWriter", e);
}
}
@Test(timeout = 4000)
public void test066() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
DefaultXmlPrettyPrinter defaultXmlPrettyPrinter0 = new DefaultXmlPrettyPrinter();
IOContext iOContext0 = new IOContext(bufferRecycler0, defaultXmlPrettyPrinter0, false);
JsonFactory jsonFactory0 = new JsonFactory();
DefaultSerializerProvider.Impl defaultSerializerProvider_Impl0 = new DefaultSerializerProvider.Impl();
ObjectMapper objectMapper0 = new ObjectMapper(jsonFactory0, defaultSerializerProvider_Impl0, (DefaultDeserializationContext) null);
ByteArrayBuilder byteArrayBuilder0 = new ByteArrayBuilder(bufferRecycler0);
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter(byteArrayBuilder0, writerConfig0, false);
SimpleNsStreamWriter simpleNsStreamWriter0 = new SimpleNsStreamWriter(iSOLatin1XmlWriter0, "JSON", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator(iOContext0, 2, 2, objectMapper0, simpleNsStreamWriter0);
char[] charArray0 = new char[1];
// Undeclared exception!
try {
toXmlGenerator0.writeRaw(charArray0, 57343, 25);
fail("Expecting exception: ArrayIndexOutOfBoundsException");
} catch(ArrayIndexOutOfBoundsException e) {
//
// 57343
//
verifyException("com.ctc.wstx.sw.ISOLatin1XmlWriter", e);
}
}
@Test(timeout = 4000)
public void test067() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createFullDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, true);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, "#['\"PAk}", writerConfig0);
StreamWriterDelegate streamWriterDelegate0 = new StreamWriterDelegate(repairingNsStreamWriter0);
XMLStreamWriter2 xMLStreamWriter2_0 = Stax2WriterAdapter.wrapIfNecessary(streamWriterDelegate0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, (-1471), 91, (ObjectCodec) null, xMLStreamWriter2_0);
// Undeclared exception!
try {
toXmlGenerator0.writeRaw("rs4dLDlw=SYUX'[.", (-4525), (-1014));
fail("Expecting exception: UnsupportedOperationException");
} catch(UnsupportedOperationException e) {
//
// Not implemented
//
verifyException("org.codehaus.stax2.ri.Stax2WriterAdapter", e);
}
}
@Test(timeout = 4000)
public void test068() throws Throwable {
ObjectMapper objectMapper0 = new ObjectMapper();
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
SimpleNsStreamWriter simpleNsStreamWriter0 = new SimpleNsStreamWriter((XmlWriter) null, "{QQu`+~#G^2!C", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, 55296, 2, objectMapper0, simpleNsStreamWriter0);
// Undeclared exception!
try {
toXmlGenerator0.writeRaw(",\"#Gp1bN", 1436, 55296);
fail("Expecting exception: NullPointerException");
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("com.ctc.wstx.sw.BaseStreamWriter", e);
}
}
@Test(timeout = 4000)
public void test069() throws Throwable {
JsonFactory jsonFactory0 = new JsonFactory();
BufferRecycler bufferRecycler0 = jsonFactory0._getBufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, "%4h=jXJt0MN/", true);
ByteArrayBuilder byteArrayBuilder0 = new ByteArrayBuilder(bufferRecycler0, 365);
WriterConfig writerConfig0 = WriterConfig.createFullDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter(byteArrayBuilder0, writerConfig0, false);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, "%4h=jXJt0MN/", writerConfig0);
StreamWriter2Delegate streamWriter2Delegate0 = new StreamWriter2Delegate(repairingNsStreamWriter0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator(iOContext0, 2, 3, (ObjectCodec) null, streamWriter2Delegate0);
// Undeclared exception!
try {
toXmlGenerator0.writeRaw("JSON");
fail("Expecting exception: NullPointerException");
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("org.codehaus.stax2.util.StreamWriter2Delegate", e);
}
}
@Test(timeout = 4000)
public void test070() throws Throwable {
ObjectMapper objectMapper0 = new ObjectMapper();
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
BufferRecycler bufferRecycler0 = new BufferRecycler();
MissingNode missingNode0 = MissingNode.getInstance();
IOContext iOContext0 = new IOContext(bufferRecycler0, missingNode0, false);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter((XmlWriter) null, "3/A,bOEN", writerConfig0);
StreamWriterDelegate streamWriterDelegate0 = new StreamWriterDelegate(repairingNsStreamWriter0);
XMLStreamWriter2 xMLStreamWriter2_0 = Stax2WriterAdapter.wrapIfNecessary(streamWriterDelegate0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator(iOContext0, (-219), 2, objectMapper0, xMLStreamWriter2_0);
// Undeclared exception!
try {
toXmlGenerator0.writeRaw('\'');
fail("Expecting exception: UnsupportedOperationException");
} catch(UnsupportedOperationException e) {
//
// Not implemented
//
verifyException("org.codehaus.stax2.ri.Stax2WriterAdapter", e);
}
}
@Test(timeout = 4000)
public void test071() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, bufferRecycler0, false);
ObjectMapper objectMapper0 = new ObjectMapper();
WriterConfig writerConfig0 = WriterConfig.createFullDefaults();
SimpleNsStreamWriter simpleNsStreamWriter0 = new SimpleNsStreamWriter((XmlWriter) null, "", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator(iOContext0, (-3360), (-3697), objectMapper0, simpleNsStreamWriter0);
// Undeclared exception!
try {
toXmlGenerator0.writeRaw('*');
fail("Expecting exception: NullPointerException");
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("com.ctc.wstx.sw.BaseStreamWriter", e);
}
}
@Test(timeout = 4000)
public void test072() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, false);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, ", expecting field name", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, 0, 0, (ObjectCodec) null, repairingNsStreamWriter0);
QName qName0 = new QName("");
toXmlGenerator0.startWrappedValue(qName0, qName0);
MockRandom mockRandom0 = new MockRandom();
BigInteger bigInteger0 = new BigInteger(56319, mockRandom0);
// Undeclared exception!
try {
toXmlGenerator0.writeNumber(bigInteger0);
fail("Expecting exception: ArrayIndexOutOfBoundsException");
} catch(ArrayIndexOutOfBoundsException e) {
//
// no message in exception (getMessage() returned null)
//
}
}
@Test(timeout = 4000)
public void test073() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, false);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, ", expecting field name", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, (-24), (-24), (ObjectCodec) null, repairingNsStreamWriter0);
QName qName0 = new QName(", expecting field name");
toXmlGenerator0.startWrappedValue((QName) null, qName0);
toXmlGenerator0.writeNumber((-1972));
BigInteger bigInteger0 = BigInteger.TEN;
try {
toXmlGenerator0.writeNumber(bigInteger0);
fail("Expecting exception: IOException");
} catch(IOException e) {
//
// Trying to output second root, <, expecting field name>
//
verifyException("com.fasterxml.jackson.dataformat.xml.util.StaxUtil", e);
}
}
@Test(timeout = 4000)
public void test074() throws Throwable {
StreamWriter2Delegate streamWriter2Delegate0 = new StreamWriter2Delegate((XMLStreamWriter2) null);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, 4178, (-48), (ObjectCodec) null, streamWriter2Delegate0);
QName qName0 = new QName("Cannot deserialize a Map.Entry out of empty JSON Object", "unknown");
toXmlGenerator0.startWrappedValue((QName) null, qName0);
BigDecimal bigDecimal0 = BigDecimal.TEN;
// Undeclared exception!
try {
toXmlGenerator0.writeNumber(bigDecimal0);
fail("Expecting exception: NullPointerException");
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("org.codehaus.stax2.util.StreamWriterDelegate", e);
}
}
@Test(timeout = 4000)
public void test075() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, false);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, ", expecting field name", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, 0, 0, (ObjectCodec) null, repairingNsStreamWriter0);
QName qName0 = new QName("");
toXmlGenerator0.startWrappedValue(qName0, qName0);
toXmlGenerator0.finishWrappedValue(qName0, qName0);
BigDecimal bigDecimal0 = new BigDecimal((-1));
try {
toXmlGenerator0.writeNumber(bigDecimal0);
fail("Expecting exception: IOException");
} catch(IOException e) {
//
// Trying to output second root, <>
//
verifyException("com.fasterxml.jackson.dataformat.xml.util.StaxUtil", e);
}
}
@Test(timeout = 4000)
public void test076() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, false);
SimpleNsStreamWriter simpleNsStreamWriter0 = new SimpleNsStreamWriter(iSOLatin1XmlWriter0, "", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, (-2667), (-2112), (ObjectCodec) null, simpleNsStreamWriter0);
QName qName0 = new QName("ALLOW_NON_NUMERIC_NUMBERS");
toXmlGenerator0.startWrappedValue(qName0, qName0);
// Undeclared exception!
try {
toXmlGenerator0.writeNumber((String) null);
fail("Expecting exception: NullPointerException");
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("com.ctc.wstx.sw.BaseStreamWriter", e);
}
}
@Test(timeout = 4000)
public void test077() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, false);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, ") does not implement Stax2 4PI natively and is missing method '", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, 248, 248, (ObjectCodec) null, repairingNsStreamWriter0);
QName qName0 = new QName("");
toXmlGenerator0.startWrappedValue(qName0, qName0);
repairingNsStreamWriter0.writeEndElement(qName0);
try {
toXmlGenerator0.writeNumber("");
fail("Expecting exception: IOException");
} catch(IOException e) {
//
// Trying to output second root, <>
//
verifyException("com.fasterxml.jackson.dataformat.xml.util.StaxUtil", e);
}
}
@Test(timeout = 4000)
public void test078() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, false);
QName qName0 = new QName("start an object");
NonNsStreamWriter nonNsStreamWriter0 = new NonNsStreamWriter(iSOLatin1XmlWriter0, "start an object", writerConfig0);
StreamWriter2Delegate streamWriter2Delegate0 = new StreamWriter2Delegate(nonNsStreamWriter0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, 1762, 1762, (ObjectCodec) null, streamWriter2Delegate0);
toXmlGenerator0.startWrappedValue(qName0, qName0);
// Undeclared exception!
try {
toXmlGenerator0.writeNumber((long) 55296);
fail("Expecting exception: NullPointerException");
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("org.codehaus.stax2.util.StreamWriter2Delegate", e);
}
}
@Test(timeout = 4000)
public void test079() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, false);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, ", expecting field name", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, 0, 0, (ObjectCodec) null, repairingNsStreamWriter0);
QName qName0 = new QName("");
toXmlGenerator0.startWrappedValue(qName0, qName0);
toXmlGenerator0.finishWrappedValue(qName0, qName0);
try {
toXmlGenerator0.writeNumber(2575L);
fail("Expecting exception: IOException");
} catch(IOException e) {
//
// Trying to output second root, <>
//
verifyException("com.fasterxml.jackson.dataformat.xml.util.StaxUtil", e);
}
}
@Test(timeout = 4000)
public void test080() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, false);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, "strt a objec", writerConfig0);
StreamWriter2Delegate streamWriter2Delegate0 = new StreamWriter2Delegate(repairingNsStreamWriter0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, (-339), 5, (ObjectCodec) null, streamWriter2Delegate0);
QName qName0 = new QName("strt a objec", "strt a objec");
toXmlGenerator0.startWrappedValue(qName0, qName0);
// Undeclared exception!
try {
toXmlGenerator0.writeNumber(0.0F);
fail("Expecting exception: NullPointerException");
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("org.codehaus.stax2.util.StreamWriter2Delegate", e);
}
}
@Test(timeout = 4000)
public void test081() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createFullDefaults();
ByteArrayOutputStream byteArrayOutputStream0 = new ByteArrayOutputStream();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter(byteArrayOutputStream0, writerConfig0, false);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, ", expecting field name", writerConfig0);
StreamWriter2Delegate streamWriter2Delegate0 = new StreamWriter2Delegate(repairingNsStreamWriter0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, 2217, 2217, (ObjectCodec) null, streamWriter2Delegate0);
QName qName0 = new QName("");
toXmlGenerator0.startWrappedValue(qName0, qName0);
// Undeclared exception!
try {
toXmlGenerator0.writeNumber((double) 2217);
fail("Expecting exception: NullPointerException");
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("org.codehaus.stax2.util.StreamWriter2Delegate", e);
}
}
@Test(timeout = 4000)
public void test082() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, bufferRecycler0, false);
ObjectMapper objectMapper0 = new ObjectMapper();
WriterConfig writerConfig0 = WriterConfig.createFullDefaults();
AsciiXmlWriter asciiXmlWriter0 = new AsciiXmlWriter((OutputStream) null, writerConfig0, false);
NonNsStreamWriter nonNsStreamWriter0 = new NonNsStreamWriter(asciiXmlWriter0, (String) null, writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator(iOContext0, 0, 0, objectMapper0, nonNsStreamWriter0);
QName qName0 = new QName("");
toXmlGenerator0.startWrappedValue((QName) null, qName0);
toXmlGenerator0.writeNumber("");
try {
toXmlGenerator0.writeNumber((double) 2);
fail("Expecting exception: IOException");
} catch(IOException e) {
//
// Trying to output second root, <>
//
verifyException("com.fasterxml.jackson.dataformat.xml.util.StaxUtil", e);
}
}
@Test(timeout = 4000)
public void test083() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, false);
BufferRecycler bufferRecycler0 = new BufferRecycler();
NonNsStreamWriter nonNsStreamWriter0 = new NonNsStreamWriter(iSOLatin1XmlWriter0, "", writerConfig0);
IOContext iOContext0 = new IOContext(bufferRecycler0, (Object) null, false);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator(iOContext0, 3, 1, (ObjectCodec) null, nonNsStreamWriter0);
QName qName0 = new QName("", "", "");
toXmlGenerator0.startWrappedValue((QName) null, qName0);
toXmlGenerator0.writeNumber(0.0F);
try {
toXmlGenerator0.writeNull();
fail("Expecting exception: IOException");
} catch(IOException e) {
//
// Trying to output second root, <>
//
verifyException("com.fasterxml.jackson.dataformat.xml.util.StaxUtil", e);
}
}
@Test(timeout = 4000)
public void test084() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createFullDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, false);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, "trying to use CONTENn_ALLOW_UNDEFINED via define()", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, 2689, 2689, (ObjectCodec) null, repairingNsStreamWriter0);
QName qName0 = new QName("trying to use CONTENn_ALLOW_UNDEFINED via define()", "trying to use CONTENn_ALLOW_UNDEFINED via define()", "trying to use CONTENn_ALLOW_UNDEFINED via define()");
toXmlGenerator0.startWrappedValue(qName0, qName0);
toXmlGenerator0.writeStartObject((Object) iSOLatin1XmlWriter0);
// Undeclared exception!
try {
toXmlGenerator0.writeFieldName((String) null);
fail("Expecting exception: IllegalArgumentException");
} catch(IllegalArgumentException e) {
//
// local part cannot be \"null\" when creating a QName
//
verifyException("javax.xml.namespace.QName", e);
}
}
@Test(timeout = 4000)
public void test085() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, bufferRecycler0, false);
ObjectMapper objectMapper0 = new ObjectMapper();
WriterConfig writerConfig0 = WriterConfig.createFullDefaults();
SimpleNsStreamWriter simpleNsStreamWriter0 = new SimpleNsStreamWriter((XmlWriter) null, "", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator(iOContext0, (-3360), (-3697), objectMapper0, simpleNsStreamWriter0);
SerializedString serializedString0 = DefaultPrettyPrinter.DEFAULT_ROOT_VALUE_SEPARATOR;
try {
toXmlGenerator0.writeFieldName((SerializableString) serializedString0);
fail("Expecting exception: IOException");
} catch(IOException e) {
//
// Can not write a field name, expecting a value
//
verifyException("com.fasterxml.jackson.core.JsonGenerator", e);
}
}
@Test(timeout = 4000)
public void test086() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, false);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, ", expecting field name", writerConfig0);
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, repairingNsStreamWriter0, false);
StreamWriter2Delegate streamWriter2Delegate0 = new StreamWriter2Delegate(repairingNsStreamWriter0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator(iOContext0, 53, 1806, (ObjectCodec) null, streamWriter2Delegate0);
QName qName0 = new QName(", expecting field name");
toXmlGenerator0.startWrappedValue(qName0, qName0);
// Undeclared exception!
try {
toXmlGenerator0.writeBoolean(true);
fail("Expecting exception: NullPointerException");
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("org.codehaus.stax2.util.StreamWriter2Delegate", e);
}
}
@Test(timeout = 4000)
public void test087() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, false);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, "", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, 0, 0, (ObjectCodec) null, repairingNsStreamWriter0);
QName qName0 = new QName("");
toXmlGenerator0.startWrappedValue(qName0, qName0);
repairingNsStreamWriter0.writeEndElement(qName0);
try {
toXmlGenerator0.writeBoolean(false);
fail("Expecting exception: IOException");
} catch(IOException e) {
//
// Trying to output second root, <>
//
verifyException("com.fasterxml.jackson.dataformat.xml.util.StaxUtil", e);
}
}
@Test(timeout = 4000)
public void test088() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createFullDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, false);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, "", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, (-31), (-31), (ObjectCodec) null, repairingNsStreamWriter0);
QName qName0 = new QName("", "");
toXmlGenerator0._nextIsAttribute = true;
toXmlGenerator0.startWrappedValue(qName0, qName0);
byte[] byteArray0 = new byte[15];
// Undeclared exception!
try {
toXmlGenerator0.writeBinary((Base64Variant) null, byteArray0, 0, (-31));
fail("Expecting exception: NegativeArraySizeException");
} catch(NegativeArraySizeException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("com.fasterxml.jackson.dataformat.xml.ser.ToXmlGenerator", e);
}
}
@Test(timeout = 4000)
public void test089() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, false);
SimpleNsStreamWriter simpleNsStreamWriter0 = new SimpleNsStreamWriter(iSOLatin1XmlWriter0, "v=K5O_>x)V}6~].2", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, 0, 0, (ObjectCodec) null, simpleNsStreamWriter0);
byte[] byteArray0 = new byte[7];
// Undeclared exception!
try {
toXmlGenerator0.writeBinary((Base64Variant) null, byteArray0, (-90), 5);
fail("Expecting exception: IllegalStateException");
} catch(IllegalStateException e) {
//
// No element/attribute name specified when trying to output element
//
verifyException("com.fasterxml.jackson.dataformat.xml.ser.ToXmlGenerator", e);
}
}
@Test(timeout = 4000)
public void test090() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, false);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, "pKtEmLZY?", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, (-46), (-46), (ObjectCodec) null, repairingNsStreamWriter0);
QName qName0 = new QName("pKtEmLZY?", "pKtEmLZY?", "pKtEmLZY?");
toXmlGenerator0.startWrappedValue(qName0, qName0);
byte[] byteArray0 = new byte[4];
// Undeclared exception!
try {
toXmlGenerator0.writeBinary((Base64Variant) null, byteArray0, 0, (int) (byte)43);
fail("Expecting exception: ArrayIndexOutOfBoundsException");
} catch(ArrayIndexOutOfBoundsException e) {
//
// 4
//
verifyException("org.codehaus.stax2.ri.typed.ValueEncoderFactory$Base64Encoder", e);
}
}
@Test(timeout = 4000)
public void test091() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, true);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, "EZ%(W}Nq>", writerConfig0);
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, (Object) null, true);
StreamWriterDelegate streamWriterDelegate0 = new StreamWriterDelegate(repairingNsStreamWriter0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator(iOContext0, 3, 3, (ObjectCodec) null, streamWriterDelegate0);
QName qName0 = new QName("");
DefaultXmlPrettyPrinter defaultXmlPrettyPrinter0 = new DefaultXmlPrettyPrinter();
toXmlGenerator0.setPrettyPrinter(defaultXmlPrettyPrinter0);
// Undeclared exception!
try {
toXmlGenerator0.startWrappedValue(qName0, qName0);
fail("Expecting exception: UnsupportedOperationException");
} catch(UnsupportedOperationException e) {
//
// Not implemented
//
verifyException("org.codehaus.stax2.ri.Stax2WriterAdapter", e);
}
}
@Test(timeout = 4000)
public void test092() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createFullDefaults();
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter((XmlWriter) null, "", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, 0, (-2351), (ObjectCodec) null, repairingNsStreamWriter0);
QName qName0 = new QName("`YfMl");
// Undeclared exception!
try {
toXmlGenerator0.startWrappedValue(qName0, qName0);
fail("Expecting exception: NullPointerException");
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("com.ctc.wstx.sw.BaseNsStreamWriter", e);
}
}
@Test(timeout = 4000)
public void test093() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, false);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, ", expecting field name", writerConfig0);
char[] charArray0 = new char[2];
iSOLatin1XmlWriter0.writeRawAscii(charArray0, (-754), (-24));
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, (-24), (-24), (ObjectCodec) null, repairingNsStreamWriter0);
QName qName0 = new QName(", expecting field name");
// Undeclared exception!
try {
toXmlGenerator0.startWrappedValue(qName0, qName0);
fail("Expecting exception: ArrayIndexOutOfBoundsException");
} catch(ArrayIndexOutOfBoundsException e) {
//
// no message in exception (getMessage() returned null)
//
}
}
@Test(timeout = 4000)
public void test094() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, true);
SimpleNsStreamWriter simpleNsStreamWriter0 = new SimpleNsStreamWriter(iSOLatin1XmlWriter0, "Cannot call getValue() on constructor of ", writerConfig0);
QName qName0 = new QName("D3z,VvBkZ/z", "", "D3z,VvBkZ/z");
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, (-388), (-388), (ObjectCodec) null, simpleNsStreamWriter0);
try {
toXmlGenerator0.startWrappedValue(qName0, qName0);
fail("Expecting exception: IOException");
} catch(IOException e) {
//
// Unbound namespace URI 'D3z,VvBkZ/z'
//
verifyException("com.fasterxml.jackson.dataformat.xml.util.StaxUtil", e);
}
}
@Test(timeout = 4000)
public void test095() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, true);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, "mh0Ir;GCV1%", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, 32767, 32767, (ObjectCodec) null, repairingNsStreamWriter0);
// Undeclared exception!
try {
toXmlGenerator0.isEnabled((ToXmlGenerator.Feature) null);
fail("Expecting exception: NullPointerException");
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("com.fasterxml.jackson.dataformat.xml.ser.ToXmlGenerator", e);
}
}
@Test(timeout = 4000)
public void test096() throws Throwable {
StreamWriter2Delegate streamWriter2Delegate0 = new StreamWriter2Delegate((XMLStreamWriter2) null);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, (-2657), 95, (ObjectCodec) null, streamWriter2Delegate0);
// Undeclared exception!
try {
toXmlGenerator0.initGenerator();
fail("Expecting exception: NullPointerException");
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("org.codehaus.stax2.util.StreamWriterDelegate", e);
}
}
@Test(timeout = 4000)
public void test097() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createFullDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, true);
SimpleNsStreamWriter simpleNsStreamWriter0 = new SimpleNsStreamWriter(iSOLatin1XmlWriter0, "v=K5O_>x)V}6~].2", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, 32, 0, (ObjectCodec) null, simpleNsStreamWriter0);
StreamWriter2Delegate streamWriter2Delegate0 = new StreamWriter2Delegate(simpleNsStreamWriter0);
ToXmlGenerator.Feature toXmlGenerator_Feature0 = ToXmlGenerator.Feature.WRITE_XML_1_1;
streamWriter2Delegate0.writeStartElement("v=K5O_>x)V}6~].2", "v=K5O_>x)V}6~].2", "v=K5O_>x)V}6~].2");
ToXmlGenerator toXmlGenerator1 = toXmlGenerator0.configure(toXmlGenerator_Feature0, true);
try {
toXmlGenerator1.initGenerator();
fail("Expecting exception: IOException");
} catch(IOException e) {
//
// Can not output XML declaration, after other output has already been done.
//
verifyException("com.fasterxml.jackson.dataformat.xml.util.StaxUtil", e);
}
}
@Test(timeout = 4000)
public void test098() throws Throwable {
JsonFactory jsonFactory0 = new JsonFactory();
BufferRecycler bufferRecycler0 = jsonFactory0._getBufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, "%4h=jXJt0MN/", true);
ByteArrayBuilder byteArrayBuilder0 = new ByteArrayBuilder(bufferRecycler0, 365);
WriterConfig writerConfig0 = WriterConfig.createFullDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter(byteArrayBuilder0, writerConfig0, false);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, "%4h=jXJt0MN/", writerConfig0);
StreamWriter2Delegate streamWriter2Delegate0 = new StreamWriter2Delegate(repairingNsStreamWriter0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator(iOContext0, 2, 3, (ObjectCodec) null, streamWriter2Delegate0);
// Undeclared exception!
try {
toXmlGenerator0.handleMissingName();
fail("Expecting exception: IllegalStateException");
} catch(IllegalStateException e) {
//
// No element/attribute name specified when trying to output element
//
verifyException("com.fasterxml.jackson.dataformat.xml.ser.ToXmlGenerator", e);
}
}
@Test(timeout = 4000)
public void test099() throws Throwable {
FileDescriptor fileDescriptor0 = new FileDescriptor();
MockFileOutputStream mockFileOutputStream0 = new MockFileOutputStream(fileDescriptor0);
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
AsciiXmlWriter asciiXmlWriter0 = new AsciiXmlWriter(mockFileOutputStream0, writerConfig0, true);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(asciiXmlWriter0, "|}Cc", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, 31, 31, (ObjectCodec) null, repairingNsStreamWriter0);
asciiXmlWriter0.writeCDataEnd();
try {
toXmlGenerator0.flush();
fail("Expecting exception: IOException");
} catch(IOException e) {
//
// N/A
//
verifyException("com.fasterxml.jackson.dataformat.xml.util.StaxUtil", e);
}
}
@Test(timeout = 4000)
public void test100() throws Throwable {
QName qName0 = new QName("`qZ@");
StreamWriter2Delegate streamWriter2Delegate0 = new StreamWriter2Delegate((XMLStreamWriter2) null);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, (-2828), (-2828), (ObjectCodec) null, streamWriter2Delegate0);
// Undeclared exception!
try {
toXmlGenerator0.finishWrappedValue(qName0, qName0);
fail("Expecting exception: NullPointerException");
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("org.codehaus.stax2.util.StreamWriterDelegate", e);
}
}
@Test(timeout = 4000)
public void test101() throws Throwable {
ToXmlGenerator.Feature toXmlGenerator_Feature0 = ToXmlGenerator.Feature.WRITE_XML_DECLARATION;
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, toXmlGenerator_Feature0, false);
ObjectMapper objectMapper0 = new ObjectMapper();
ByteArrayOutputStream byteArrayOutputStream0 = new ByteArrayOutputStream(0);
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter(byteArrayOutputStream0, writerConfig0, false);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, "no int/Int-argument constructor/factory method to deserialize from Number value (%s)", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator(iOContext0, 2, 1, objectMapper0, repairingNsStreamWriter0);
// Undeclared exception!
try {
toXmlGenerator0.enable((ToXmlGenerator.Feature) null);
fail("Expecting exception: NullPointerException");
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("com.fasterxml.jackson.dataformat.xml.ser.ToXmlGenerator", e);
}
}
@Test(timeout = 4000)
public void test102() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, true);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, ", expecting field name", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, 0, 0, (ObjectCodec) null, repairingNsStreamWriter0);
// Undeclared exception!
try {
toXmlGenerator0.disable((ToXmlGenerator.Feature) null);
fail("Expecting exception: NullPointerException");
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("com.fasterxml.jackson.dataformat.xml.ser.ToXmlGenerator", e);
}
}
@Test(timeout = 4000)
public void test103() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, true);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, ", exetiyg field nme", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, 1762, 1762, (ObjectCodec) null, repairingNsStreamWriter0);
QName qName0 = new QName(", exetiyg field nme");
toXmlGenerator0.startWrappedValue(qName0, qName0);
toXmlGenerator0.writeStartObject((Object) iSOLatin1XmlWriter0);
try {
toXmlGenerator0._verifyValueWrite(", exetiyg field nme");
fail("Expecting exception: IOException");
} catch(IOException e) {
//
// Can not , exetiyg field nme, expecting field name
//
verifyException("com.fasterxml.jackson.core.JsonGenerator", e);
}
}
@Test(timeout = 4000)
public void test104() throws Throwable {
Object object0 = new Object();
IOContext iOContext0 = new IOContext((BufferRecycler) null, object0, true);
JsonFactory jsonFactory0 = new JsonFactory();
ObjectMapper objectMapper0 = new ObjectMapper(jsonFactory0);
DeserializationFeature deserializationFeature0 = DeserializationFeature.UNWRAP_SINGLE_VALUE_ARRAYS;
DeserializationFeature[] deserializationFeatureArray0 = new DeserializationFeature[1];
deserializationFeatureArray0[0] = deserializationFeature0;
ObjectReader objectReader0 = objectMapper0.reader(deserializationFeature0, deserializationFeatureArray0);
ByteArrayBuilder byteArrayBuilder0 = new ByteArrayBuilder();
WriterConfig writerConfig0 = WriterConfig.createFullDefaults();
AsciiXmlWriter asciiXmlWriter0 = new AsciiXmlWriter(byteArrayBuilder0, writerConfig0, true);
NonNsStreamWriter nonNsStreamWriter0 = new NonNsStreamWriter(asciiXmlWriter0, "", writerConfig0);
StreamWriterDelegate streamWriterDelegate0 = new StreamWriterDelegate(nonNsStreamWriter0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator(iOContext0, (-107), 4, objectReader0, streamWriterDelegate0);
try {
toXmlGenerator0._reportUnimplementedStax2("8VmJYxC'tucJ=R");
fail("Expecting exception: IOException");
} catch(IOException e) {
//
// Underlying Stax XMLStreamWriter (of type org.codehaus.stax2.util.StreamWriterDelegate) does not implement Stax2 API natively and is missing method '8VmJYxC'tucJ=R': this breaks functionality such as indentation that relies on it. You need to upgrade to using compliant Stax implementation like Woodstox or Aalto
//
verifyException("com.fasterxml.jackson.dataformat.xml.ser.ToXmlGenerator", e);
}
}
@Test(timeout = 4000)
public void test105() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter((XmlWriter) null, "]JTz?oop1[hw&Z", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, (-6978), (-6978), (ObjectCodec) null, repairingNsStreamWriter0);
QName qName0 = new QName("=:", "=:");
toXmlGenerator0.startWrappedValue((QName) null, qName0);
// Undeclared exception!
try {
toXmlGenerator0._handleStartObject();
fail("Expecting exception: NullPointerException");
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("com.ctc.wstx.sw.BaseNsStreamWriter", e);
}
}
@Test(timeout = 4000)
public void test106() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, bufferRecycler0, false);
ObjectMapper objectMapper0 = new ObjectMapper();
ToXmlGenerator toXmlGenerator0 = null;
try {
toXmlGenerator0 = new ToXmlGenerator(iOContext0, 1, (-2571), objectMapper0, (XMLStreamWriter) null);
fail("Expecting exception: NullPointerException");
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("org.codehaus.stax2.ri.Stax2WriterAdapter", e);
}
}
@Test(timeout = 4000)
public void test107() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, bufferRecycler0, true);
ObjectMapper objectMapper0 = new ObjectMapper();
Class<Integer> class0 = Integer.class;
ObjectReader objectReader0 = objectMapper0.readerWithView(class0);
WriterConfig writerConfig0 = WriterConfig.createFullDefaults();
NonNsStreamWriter nonNsStreamWriter0 = new NonNsStreamWriter((XmlWriter) null, "", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator(iOContext0, 0, 2, objectReader0, nonNsStreamWriter0);
// Undeclared exception!
try {
toXmlGenerator0.writeNull();
fail("Expecting exception: IllegalStateException");
} catch(IllegalStateException e) {
//
// No element/attribute name specified when trying to output element
//
verifyException("com.fasterxml.jackson.dataformat.xml.ser.ToXmlGenerator", e);
}
}
@Test(timeout = 4000)
public void test108() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
MockFile mockFile0 = new MockFile("WRAP_ROOT_VALUE", "*Rju");
MockFileOutputStream mockFileOutputStream0 = new MockFileOutputStream(mockFile0);
OutputStreamWriter outputStreamWriter0 = new OutputStreamWriter(mockFileOutputStream0);
BufferingXmlWriter bufferingXmlWriter0 = new BufferingXmlWriter(outputStreamWriter0, writerConfig0, "<!DOCTYPE ", true, mockFileOutputStream0, (-830));
SimpleNsStreamWriter simpleNsStreamWriter0 = new SimpleNsStreamWriter(bufferingXmlWriter0, "<!DOCTYPE ", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, 1266, (-1066), (ObjectCodec) null, simpleNsStreamWriter0);
// Undeclared exception!
try {
toXmlGenerator0.writeRaw((char[]) null, (-256), 55296);
fail("Expecting exception: IndexOutOfBoundsException");
} catch(IndexOutOfBoundsException e) {
}
}
@Test(timeout = 4000)
public void test109() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, bufferRecycler0, true);
ObjectMapper objectMapper0 = new ObjectMapper();
ByteArrayBuilder byteArrayBuilder0 = new ByteArrayBuilder(2328);
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter(byteArrayBuilder0, writerConfig0, true);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, "writeRawValue", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator(iOContext0, (-1580), 2284, objectMapper0, repairingNsStreamWriter0);
toXmlGenerator0.writeRaw("writeRawValue");
assertEquals(2284, toXmlGenerator0.getFormatFeatures());
}
@Test(timeout = 4000)
public void test110() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, false);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, "", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, 248, 248, (ObjectCodec) null, repairingNsStreamWriter0);
QName qName0 = new QName("");
DefaultXmlPrettyPrinter defaultXmlPrettyPrinter0 = new DefaultXmlPrettyPrinter();
JsonGenerator jsonGenerator0 = toXmlGenerator0.setPrettyPrinter(defaultXmlPrettyPrinter0);
toXmlGenerator0.startWrappedValue(qName0, qName0);
jsonGenerator0.writeString("write null value");
assertEquals(248, jsonGenerator0.getFormatFeatures());
}
@Test(timeout = 4000)
public void test111() throws Throwable {
JsonFactory jsonFactory0 = new JsonFactory();
BufferRecycler bufferRecycler0 = jsonFactory0._getBufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, bufferRecycler0.CHAR_NAME_COPY_BUFFER, false);
ObjectMapper objectMapper0 = new ObjectMapper();
ByteArrayBuilder byteArrayBuilder0 = new ByteArrayBuilder(5);
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter(byteArrayBuilder0, writerConfig0, false);
SimpleNsStreamWriter simpleNsStreamWriter0 = new SimpleNsStreamWriter(iSOLatin1XmlWriter0, "68bHB?ii@>wp8!/A", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator(iOContext0, 1401, 2, objectMapper0, simpleNsStreamWriter0);
// Undeclared exception!
try {
toXmlGenerator0.writeString("com.fasterxml.jackson.annotation.JsonProperty$Access");
fail("Expecting exception: IllegalStateException");
} catch(IllegalStateException e) {
//
// No element/attribute name specified when trying to output element
//
verifyException("com.fasterxml.jackson.dataformat.xml.ser.ToXmlGenerator", e);
}
}
@Test(timeout = 4000)
public void test112() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createFullDefaults();
ByteArrayOutputStream byteArrayOutputStream0 = new ByteArrayOutputStream();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter(byteArrayOutputStream0, writerConfig0, false);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, ", expecting field name", writerConfig0);
StreamWriter2Delegate streamWriter2Delegate0 = new StreamWriter2Delegate(repairingNsStreamWriter0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, 2217, 2217, (ObjectCodec) null, streamWriter2Delegate0);
QName qName0 = new QName("");
toXmlGenerator0.startWrappedValue(qName0, qName0);
toXmlGenerator0._handleStartObject();
toXmlGenerator0._handleEndObject();
assertEquals(2217, toXmlGenerator0.getFormatFeatures());
}
@Test(timeout = 4000)
public void test113() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, false);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, "", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, 248, 248, (ObjectCodec) null, repairingNsStreamWriter0);
QName qName0 = QName.valueOf("");
DefaultXmlPrettyPrinter defaultXmlPrettyPrinter0 = new DefaultXmlPrettyPrinter();
ToXmlGenerator toXmlGenerator1 = (ToXmlGenerator)toXmlGenerator0.setPrettyPrinter(defaultXmlPrettyPrinter0);
toXmlGenerator0.startWrappedValue(qName0, qName0);
toXmlGenerator0._handleStartObject();
toXmlGenerator1._handleEndObject();
assertEquals(248, toXmlGenerator1.getFormatFeatures());
}
@Test(timeout = 4000)
public void test114() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, false);
SimpleNsStreamWriter simpleNsStreamWriter0 = new SimpleNsStreamWriter(iSOLatin1XmlWriter0, "v=K5O_>x)V}6~].2", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, 0, 0, (ObjectCodec) null, simpleNsStreamWriter0);
// Undeclared exception!
try {
toXmlGenerator0._handleStartObject();
fail("Expecting exception: IllegalStateException");
} catch(IllegalStateException e) {
//
// No element/attribute name specified when trying to output element
//
verifyException("com.fasterxml.jackson.dataformat.xml.ser.ToXmlGenerator", e);
}
}
@Test(timeout = 4000)
public void test115() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, bufferRecycler0, false);
ObjectMapper objectMapper0 = new ObjectMapper();
CharArrayWriter charArrayWriter0 = new CharArrayWriter();
WriterConfig writerConfig0 = WriterConfig.createFullDefaults();
PipedOutputStream pipedOutputStream0 = new PipedOutputStream();
BufferingXmlWriter bufferingXmlWriter0 = new BufferingXmlWriter(charArrayWriter0, writerConfig0, "write number", true, pipedOutputStream0, (-2500));
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(bufferingXmlWriter0, "com.fasterxml.jackson.databind.ser.std.NullSerializer", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator(iOContext0, 1, 2165, objectMapper0, repairingNsStreamWriter0);
try {
toXmlGenerator0.writeFieldName("");
fail("Expecting exception: IOException");
} catch(IOException e) {
//
// Can not write a field name, expecting a value
//
verifyException("com.fasterxml.jackson.core.JsonGenerator", e);
}
}
@Test(timeout = 4000)
public void test116() throws Throwable {
ToXmlGenerator.Feature toXmlGenerator_Feature0 = ToXmlGenerator.Feature.WRITE_XML_1_1;
boolean boolean0 = toXmlGenerator_Feature0.enabledIn(0);
assertEquals(2, toXmlGenerator_Feature0.getMask());
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test117() throws Throwable {
ToXmlGenerator.Feature toXmlGenerator_Feature0 = ToXmlGenerator.Feature.WRITE_XML_1_1;
boolean boolean0 = toXmlGenerator_Feature0.enabledIn((-1801));
assertTrue(boolean0);
}
@Test(timeout = 4000)
public void test118() throws Throwable {
ToXmlGenerator.Feature toXmlGenerator_Feature0 = ToXmlGenerator.Feature.WRITE_XML_DECLARATION;
int int0 = toXmlGenerator_Feature0.getMask();
assertEquals(1, int0);
}
@Test(timeout = 4000)
public void test119() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
DefaultXmlPrettyPrinter defaultXmlPrettyPrinter0 = new DefaultXmlPrettyPrinter();
IOContext iOContext0 = new IOContext(bufferRecycler0, defaultXmlPrettyPrinter0, false);
JsonFactory jsonFactory0 = new JsonFactory();
DefaultSerializerProvider.Impl defaultSerializerProvider_Impl0 = new DefaultSerializerProvider.Impl();
ObjectMapper objectMapper0 = new ObjectMapper(jsonFactory0, defaultSerializerProvider_Impl0, (DefaultDeserializationContext) null);
ByteArrayBuilder byteArrayBuilder0 = new ByteArrayBuilder(bufferRecycler0);
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter(byteArrayBuilder0, writerConfig0, false);
SimpleNsStreamWriter simpleNsStreamWriter0 = new SimpleNsStreamWriter(iSOLatin1XmlWriter0, "JSON", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator(iOContext0, 2, 2, objectMapper0, simpleNsStreamWriter0);
toXmlGenerator0.setNextName((QName) null);
assertEquals(2, toXmlGenerator0.getFormatFeatures());
}
@Test(timeout = 4000)
public void test120() throws Throwable {
ToXmlGenerator.Feature toXmlGenerator_Feature0 = ToXmlGenerator.Feature.WRITE_XML_DECLARATION;
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, toXmlGenerator_Feature0, false);
ObjectMapper objectMapper0 = new ObjectMapper();
ByteArrayBuilder byteArrayBuilder0 = new ByteArrayBuilder(bufferRecycler0, 3);
WriterConfig writerConfig0 = WriterConfig.createFullDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter(byteArrayBuilder0, writerConfig0, false);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, (String) null, writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator(iOContext0, 57343, 0, objectMapper0, repairingNsStreamWriter0);
try {
toXmlGenerator0.close();
fail("Expecting exception: IOException");
} catch(IOException e) {
//
// Trying to write END_DOCUMENT when document has no root (ie. trying to output empty document).
//
verifyException("com.fasterxml.jackson.dataformat.xml.util.StaxUtil", e);
}
}
@Test(timeout = 4000)
public void test121() throws Throwable {
ToXmlGenerator.Feature toXmlGenerator_Feature0 = ToXmlGenerator.Feature.WRITE_XML_DECLARATION;
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, toXmlGenerator_Feature0, false);
ObjectMapper objectMapper0 = new ObjectMapper();
ByteArrayBuilder byteArrayBuilder0 = new ByteArrayBuilder(bufferRecycler0, 3);
WriterConfig writerConfig0 = WriterConfig.createFullDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter(byteArrayBuilder0, writerConfig0, false);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, (String) null, writerConfig0);
StreamWriter2Delegate streamWriter2Delegate0 = new StreamWriter2Delegate(repairingNsStreamWriter0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator(iOContext0, 2, 2, objectMapper0, streamWriter2Delegate0);
try {
toXmlGenerator0.close();
fail("Expecting exception: IOException");
} catch(IOException e) {
//
// Trying to write END_DOCUMENT when document has no root (ie. trying to output empty document).
//
verifyException("com.fasterxml.jackson.dataformat.xml.util.StaxUtil", e);
}
}
@Test(timeout = 4000)
public void test122() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, bufferRecycler0, true);
ObjectMapper objectMapper0 = new ObjectMapper();
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, false);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, (String) null, writerConfig0);
StreamWriter2Delegate streamWriter2Delegate0 = new StreamWriter2Delegate(repairingNsStreamWriter0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator(iOContext0, 4, 0, objectMapper0, streamWriter2Delegate0);
// Undeclared exception!
try {
toXmlGenerator0.close();
fail("Expecting exception: NullPointerException");
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("org.codehaus.stax2.util.StreamWriter2Delegate", e);
}
}
@Test(timeout = 4000)
public void test123() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createFullDefaults();
SimpleNsStreamWriter simpleNsStreamWriter0 = new SimpleNsStreamWriter((XmlWriter) null, "60Aw6gJ%kg:m^+LR9", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, 2, 2, (ObjectCodec) null, simpleNsStreamWriter0);
toXmlGenerator0.writeStartArray();
// Undeclared exception!
try {
toXmlGenerator0.close();
fail("Expecting exception: NullPointerException");
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("com.fasterxml.jackson.dataformat.xml.ser.ToXmlGenerator", e);
}
}
@Test(timeout = 4000)
public void test124() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, false);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, "v=K5O_>x)V}6~].2", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, 1212, (-856), (ObjectCodec) null, repairingNsStreamWriter0);
// Undeclared exception!
try {
toXmlGenerator0.flush();
fail("Expecting exception: NullPointerException");
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("com.ctc.wstx.sw.EncodingXmlWriter", e);
}
}
@Test(timeout = 4000)
public void test125() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, bufferRecycler0, true);
ObjectMapper objectMapper0 = new ObjectMapper();
ByteArrayBuilder byteArrayBuilder0 = new ByteArrayBuilder(2328);
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter(byteArrayBuilder0, writerConfig0, true);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, "writeRawValue", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator(iOContext0, 3, 1436, objectMapper0, repairingNsStreamWriter0);
toXmlGenerator0.flush();
assertEquals(1436, toXmlGenerator0.getFormatFeatures());
}
@Test(timeout = 4000)
public void test126() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, false);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, (String) null, writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, 1762, 1762, (ObjectCodec) null, repairingNsStreamWriter0);
QName qName0 = new QName(", expecting field name");
toXmlGenerator0.startWrappedValue(qName0, qName0);
toXmlGenerator0.writeStartObject((Object) iSOLatin1XmlWriter0);
try {
toXmlGenerator0.writeStartArray();
fail("Expecting exception: IOException");
} catch(IOException e) {
//
// Can not start an array, expecting field name
//
verifyException("com.fasterxml.jackson.core.JsonGenerator", e);
}
}
@Test(timeout = 4000)
public void test127() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, false);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, ") does not implement Stax2 API natively and is missing method '", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, 248, 248, (ObjectCodec) null, repairingNsStreamWriter0);
QName qName0 = new QName("");
DefaultXmlPrettyPrinter defaultXmlPrettyPrinter0 = new DefaultXmlPrettyPrinter();
toXmlGenerator0.setPrettyPrinter(defaultXmlPrettyPrinter0);
toXmlGenerator0.startWrappedValue(qName0, qName0);
BigInteger bigInteger0 = BigInteger.ONE;
toXmlGenerator0.writeNumber(bigInteger0);
assertEquals(248, toXmlGenerator0.getFormatFeatures());
}
@Test(timeout = 4000)
public void test128() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createFullDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, true);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, "", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, (-2276), (-3859), (ObjectCodec) null, repairingNsStreamWriter0);
QName qName0 = QName.valueOf("");
toXmlGenerator0._nextIsUnwrapped = true;
toXmlGenerator0.startWrappedValue(qName0, qName0);
BigInteger bigInteger0 = BigInteger.ONE;
toXmlGenerator0.writeNumber(bigInteger0);
assertEquals((-3859), toXmlGenerator0.getFormatFeatures());
}
@Test(timeout = 4000)
public void test129() throws Throwable {
StreamWriter2Delegate streamWriter2Delegate0 = new StreamWriter2Delegate((XMLStreamWriter2) null);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, (-2889), (-2889), (ObjectCodec) null, streamWriter2Delegate0);
QName qName0 = new QName("yQyCi y[Zo*/");
toXmlGenerator0._nextIsAttribute = true;
toXmlGenerator0.startWrappedValue((QName) null, qName0);
BigInteger bigInteger0 = BigInteger.ZERO;
// Undeclared exception!
try {
toXmlGenerator0.writeNumber(bigInteger0);
fail("Expecting exception: NullPointerException");
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("org.codehaus.stax2.util.StreamWriter2Delegate", e);
}
}
@Test(timeout = 4000)
public void test130() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, false);
SimpleNsStreamWriter simpleNsStreamWriter0 = new SimpleNsStreamWriter(iSOLatin1XmlWriter0, "v=K5O_>x)V}6~].2", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, 0, 0, (ObjectCodec) null, simpleNsStreamWriter0);
// Undeclared exception!
try {
toXmlGenerator0.writeNumber((BigInteger) null);
fail("Expecting exception: IllegalStateException");
} catch(IllegalStateException e) {
//
// No element/attribute name specified when trying to output element
//
verifyException("com.fasterxml.jackson.dataformat.xml.ser.ToXmlGenerator", e);
}
}
@Test(timeout = 4000)
public void test131() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createFullDefaults();
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter((XmlWriter) null, "com.ctc.ex.api.WstxVnputPro#erties", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, 1741, 1741, (ObjectCodec) null, repairingNsStreamWriter0);
BigInteger bigInteger0 = BigInteger.ZERO;
// Undeclared exception!
try {
toXmlGenerator0.writeNumber(bigInteger0);
fail("Expecting exception: IllegalStateException");
} catch(IllegalStateException e) {
//
// No element/attribute name specified when trying to output element
//
verifyException("com.fasterxml.jackson.dataformat.xml.ser.ToXmlGenerator", e);
}
}
@Test(timeout = 4000)
public void test132() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, false);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, ", expecting field name", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, 0, 0, (ObjectCodec) null, repairingNsStreamWriter0);
QName qName0 = new QName("");
toXmlGenerator0.startWrappedValue(qName0, qName0);
BigDecimal bigDecimal0 = new BigDecimal((-1));
toXmlGenerator0.writeNumber(bigDecimal0);
assertEquals(0, toXmlGenerator0.getFormatFeatures());
}
@Test(timeout = 4000)
public void test133() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, false);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, "", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, 248, 248, (ObjectCodec) null, repairingNsStreamWriter0);
QName qName0 = new QName("");
DefaultXmlPrettyPrinter defaultXmlPrettyPrinter0 = new DefaultXmlPrettyPrinter();
toXmlGenerator0.setPrettyPrinter(defaultXmlPrettyPrinter0);
toXmlGenerator0.startWrappedValue(qName0, qName0);
BigDecimal bigDecimal0 = BigDecimal.ZERO;
toXmlGenerator0.writeNumber(bigDecimal0);
assertEquals(248, toXmlGenerator0.getFormatFeatures());
}
@Test(timeout = 4000)
public void test134() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, true);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, "Expected $END (already had one <", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, 1762, 1762, (ObjectCodec) null, repairingNsStreamWriter0);
QName qName0 = new QName("$lnG{l^J6u's>EUO", "$lnG{l^J6u's>EUO");
toXmlGenerator0.setNextIsUnwrapped(true);
toXmlGenerator0.startWrappedValue(qName0, qName0);
BigDecimal bigDecimal0 = BigDecimal.TEN;
toXmlGenerator0.writeNumber(bigDecimal0);
assertEquals(1762, toXmlGenerator0.getFormatFeatures());
}
@Test(timeout = 4000)
public void test135() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createFullDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, true);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, "srt h)ec", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, 4, 4, (ObjectCodec) null, repairingNsStreamWriter0);
QName qName0 = new QName("srt h)ec", "srt h)ec");
toXmlGenerator0.setNextIsUnwrapped(true);
toXmlGenerator0.startWrappedValue(qName0, qName0);
BigDecimal bigDecimal0 = BigDecimal.TEN;
toXmlGenerator0.writeNumber(bigDecimal0);
assertEquals(4, toXmlGenerator0.getFormatFeatures());
}
@Test(timeout = 4000)
public void test136() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createFullDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, true);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, "srt h)ec", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, 4, 4, (ObjectCodec) null, repairingNsStreamWriter0);
QName qName0 = new QName("srt h)ec", "srt h)ec");
toXmlGenerator0._nextIsAttribute = true;
toXmlGenerator0.startWrappedValue(qName0, qName0);
BigDecimal bigDecimal0 = BigDecimal.TEN;
toXmlGenerator0.writeNumber(bigDecimal0);
assertEquals(4, toXmlGenerator0.getFormatFeatures());
}
@Test(timeout = 4000)
public void test137() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, false);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, "rth)c", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, (-1171), (-1171), (ObjectCodec) null, repairingNsStreamWriter0);
QName qName0 = new QName("rth)c", "rth)c", "rth)c");
toXmlGenerator0._nextIsAttribute = true;
toXmlGenerator0.startWrappedValue(qName0, qName0);
BigDecimal bigDecimal0 = BigDecimal.ZERO;
toXmlGenerator0.writeNumber(bigDecimal0);
assertEquals((-1171), toXmlGenerator0.getFormatFeatures());
}
@Test(timeout = 4000)
public void test138() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, false);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, "rth)c", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, (-1171), (-1171), (ObjectCodec) null, repairingNsStreamWriter0);
QName qName0 = new QName("rth)c", "rth)c", "rth)c");
toXmlGenerator0.startWrappedValue(qName0, qName0);
BigDecimal bigDecimal0 = BigDecimal.ZERO;
toXmlGenerator0.writeNumber(bigDecimal0);
assertEquals((-1171), toXmlGenerator0.getFormatFeatures());
}
@Test(timeout = 4000)
public void test139() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, false);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, ") does not implement Stax2 4PI natively and is missing method '", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, 248, 248, (ObjectCodec) null, repairingNsStreamWriter0);
// Undeclared exception!
try {
toXmlGenerator0.writeNumber((BigDecimal) null);
fail("Expecting exception: IllegalStateException");
} catch(IllegalStateException e) {
//
// No element/attribute name specified when trying to output element
//
verifyException("com.fasterxml.jackson.dataformat.xml.ser.ToXmlGenerator", e);
}
}
@Test(timeout = 4000)
public void test140() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, false);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, "rth)c", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, (-1171), (-1171), (ObjectCodec) null, repairingNsStreamWriter0);
BigDecimal bigDecimal0 = BigDecimal.ZERO;
// Undeclared exception!
try {
toXmlGenerator0.writeNumber(bigDecimal0);
fail("Expecting exception: IllegalStateException");
} catch(IllegalStateException e) {
//
// No element/attribute name specified when trying to output element
//
verifyException("com.fasterxml.jackson.dataformat.xml.ser.ToXmlGenerator", e);
}
}
@Test(timeout = 4000)
public void test141() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, false);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, "", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, 248, 248, (ObjectCodec) null, repairingNsStreamWriter0);
QName qName0 = new QName("");
DefaultXmlPrettyPrinter defaultXmlPrettyPrinter0 = new DefaultXmlPrettyPrinter();
toXmlGenerator0.setPrettyPrinter(defaultXmlPrettyPrinter0);
toXmlGenerator0.startWrappedValue(qName0, qName0);
toXmlGenerator0.writeNumber((float) 56320);
assertEquals(248, toXmlGenerator0.getFormatFeatures());
}
@Test(timeout = 4000)
public void test142() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, false);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, "pKtEmLZY?", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, (-46), 1812, (ObjectCodec) null, repairingNsStreamWriter0);
QName qName0 = new QName("pKtEmLZY?");
toXmlGenerator0.startWrappedValue(qName0, qName0);
toXmlGenerator0.setNextIsUnwrapped(true);
toXmlGenerator0.writeNumber((float) 56320);
assertEquals(1812, toXmlGenerator0.getFormatFeatures());
}
@Test(timeout = 4000)
public void test143() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createFullDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, true);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, "srt h)ec", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, 4, 4, (ObjectCodec) null, repairingNsStreamWriter0);
QName qName0 = new QName("srt h)ec", "srt h)ec");
toXmlGenerator0._nextIsAttribute = true;
toXmlGenerator0.startWrappedValue(qName0, qName0);
toXmlGenerator0.writeNumber(1503.9447F);
assertEquals(4, toXmlGenerator0.getFormatFeatures());
}
@Test(timeout = 4000)
public void test144() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, bufferRecycler0, true);
ObjectMapper objectMapper0 = new ObjectMapper();
WriterConfig writerConfig0 = WriterConfig.createFullDefaults();
SimpleNsStreamWriter simpleNsStreamWriter0 = new SimpleNsStreamWriter((XmlWriter) null, "K-U)D803x-1-", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator(iOContext0, (-1), 56320, objectMapper0, simpleNsStreamWriter0);
// Undeclared exception!
try {
toXmlGenerator0.writeNumber(0.0F);
fail("Expecting exception: IllegalStateException");
} catch(IllegalStateException e) {
//
// No element/attribute name specified when trying to output element
//
verifyException("com.fasterxml.jackson.dataformat.xml.ser.ToXmlGenerator", e);
}
}
@Test(timeout = 4000)
public void test145() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, false);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, "", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, 248, 248, (ObjectCodec) null, repairingNsStreamWriter0);
QName qName0 = new QName("");
DefaultXmlPrettyPrinter defaultXmlPrettyPrinter0 = new DefaultXmlPrettyPrinter();
toXmlGenerator0.setPrettyPrinter(defaultXmlPrettyPrinter0);
toXmlGenerator0.startWrappedValue(qName0, qName0);
toXmlGenerator0.writeNumber(1625.9030953692);
assertEquals(248, toXmlGenerator0.getFormatFeatures());
}
@Test(timeout = 4000)
public void test146() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, bufferRecycler0, true);
ObjectMapper objectMapper0 = new ObjectMapper();
WriterConfig writerConfig0 = WriterConfig.createFullDefaults();
AsciiXmlWriter asciiXmlWriter0 = new AsciiXmlWriter((OutputStream) null, writerConfig0, true);
SimpleNsStreamWriter simpleNsStreamWriter0 = new SimpleNsStreamWriter(asciiXmlWriter0, "Can not ", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator(iOContext0, 1, 32767, objectMapper0, simpleNsStreamWriter0);
ToXmlGenerator.Feature toXmlGenerator_Feature0 = ToXmlGenerator.Feature.WRITE_XML_1_1;
ToXmlGenerator toXmlGenerator1 = toXmlGenerator0.disable(toXmlGenerator_Feature0);
QName qName0 = new QName("JZ3P");
toXmlGenerator0.startWrappedValue(qName0, qName0);
toXmlGenerator1._nextIsUnwrapped = true;
toXmlGenerator0.writeNumber((double) 56320);
assertEquals(32765, toXmlGenerator0.getFormatFeatures());
}
@Test(timeout = 4000)
public void test147() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, false);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, ", expecting field name", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, (-24), (-24), (ObjectCodec) null, repairingNsStreamWriter0);
QName qName0 = new QName(", expecting field name");
toXmlGenerator0.startWrappedValue(qName0, qName0);
toXmlGenerator0._nextIsAttribute = true;
toXmlGenerator0.writeNumber(0.0);
assertEquals((-24), toXmlGenerator0.getFormatFeatures());
}
@Test(timeout = 4000)
public void test148() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, true);
SimpleNsStreamWriter simpleNsStreamWriter0 = new SimpleNsStreamWriter(iSOLatin1XmlWriter0, "Cannot call getValue() on constructor of ", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, 2513, 2513, (ObjectCodec) null, simpleNsStreamWriter0);
// Undeclared exception!
try {
toXmlGenerator0.writeNumber(2569.9739404);
fail("Expecting exception: IllegalStateException");
} catch(IllegalStateException e) {
//
// No element/attribute name specified when trying to output element
//
verifyException("com.fasterxml.jackson.dataformat.xml.ser.ToXmlGenerator", e);
}
}
@Test(timeout = 4000)
public void test149() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, false);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, "", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, (-339), (-339), (ObjectCodec) null, repairingNsStreamWriter0);
QName qName0 = new QName("start n object", "}?.U|NF:b$,yl;nIm");
toXmlGenerator0.startWrappedValue(qName0, qName0);
toXmlGenerator0.writeNumber(1.0);
assertEquals((-339), toXmlGenerator0.getFormatFeatures());
}
@Test(timeout = 4000)
public void test150() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, false);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, ") does not implement Stax2 4PI natively and is missing method '", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, 248, 248, (ObjectCodec) null, repairingNsStreamWriter0);
QName qName0 = new QName("");
DefaultXmlPrettyPrinter defaultXmlPrettyPrinter0 = new DefaultXmlPrettyPrinter();
toXmlGenerator0.setPrettyPrinter(defaultXmlPrettyPrinter0);
toXmlGenerator0.startWrappedValue(qName0, qName0);
toXmlGenerator0.writeNumber((-3781L));
assertEquals(248, toXmlGenerator0.getFormatFeatures());
}
@Test(timeout = 4000)
public void test151() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createFullDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, true);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, "", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, (-2276), (-3868), (ObjectCodec) null, repairingNsStreamWriter0);
QName qName0 = QName.valueOf("");
toXmlGenerator0._nextIsUnwrapped = true;
toXmlGenerator0.startWrappedValue(qName0, qName0);
toXmlGenerator0.writeNumber((long) (-2276));
assertEquals((-3868), toXmlGenerator0.getFormatFeatures());
}
@Test(timeout = 4000)
public void test152() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, false);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, "art an object", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, (-3695), (-3695), (ObjectCodec) null, repairingNsStreamWriter0);
QName qName0 = new QName("art an object");
toXmlGenerator0._nextIsAttribute = true;
toXmlGenerator0.startWrappedValue(qName0, qName0);
toXmlGenerator0.writeNumber((long) (-3695));
assertEquals((-3695), toXmlGenerator0.getFormatFeatures());
}
@Test(timeout = 4000)
public void test153() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, false);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, ", expecting field name", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, 0, 0, (ObjectCodec) null, repairingNsStreamWriter0);
// Undeclared exception!
try {
toXmlGenerator0.writeNumber(42L);
fail("Expecting exception: IllegalStateException");
} catch(IllegalStateException e) {
//
// No element/attribute name specified when trying to output element
//
verifyException("com.fasterxml.jackson.dataformat.xml.ser.ToXmlGenerator", e);
}
}
@Test(timeout = 4000)
public void test154() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createFullDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, true);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, "", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, (-2276), (-3868), (ObjectCodec) null, repairingNsStreamWriter0);
QName qName0 = QName.valueOf("");
toXmlGenerator0.startWrappedValue(qName0, qName0);
toXmlGenerator0.writeNumber((long) (-2276));
assertEquals((-3868), toXmlGenerator0.getFormatFeatures());
}
@Test(timeout = 4000)
public void test155() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, false);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, ") does not implement Stax2 API natively and is missing method '", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, 248, 248, (ObjectCodec) null, repairingNsStreamWriter0);
QName qName0 = new QName("");
DefaultXmlPrettyPrinter defaultXmlPrettyPrinter0 = new DefaultXmlPrettyPrinter();
toXmlGenerator0.setPrettyPrinter(defaultXmlPrettyPrinter0);
toXmlGenerator0.startWrappedValue(qName0, qName0);
toXmlGenerator0.writeNumber((-304));
assertEquals(248, toXmlGenerator0.getFormatFeatures());
}
@Test(timeout = 4000)
public void test156() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, false);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, ") does not implement Stax2 4PI natively and is missing method '", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, 248, 248, (ObjectCodec) null, repairingNsStreamWriter0);
QName qName0 = new QName("");
toXmlGenerator0.startWrappedValue(qName0, qName0);
toXmlGenerator0.setNextIsUnwrapped(true);
toXmlGenerator0.writeNumber((-268));
assertEquals(248, toXmlGenerator0.getFormatFeatures());
}
@Test(timeout = 4000)
public void test157() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, true);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, ") does not implement Stax2 4PI natively and is missing method '", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, 248, 248, (ObjectCodec) null, repairingNsStreamWriter0);
QName qName0 = new QName("");
toXmlGenerator0.startWrappedValue(qName0, qName0);
toXmlGenerator0._nextIsAttribute = true;
toXmlGenerator0.writeNumber((-268));
assertEquals(248, toXmlGenerator0.getFormatFeatures());
}
@Test(timeout = 4000)
public void test158() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, bufferRecycler0.CHAR_TOKEN_BUFFER, false);
ObjectMapper objectMapper0 = new ObjectMapper();
ByteArrayBuilder byteArrayBuilder0 = new ByteArrayBuilder(2);
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter(byteArrayBuilder0, writerConfig0, false);
SimpleNsStreamWriter simpleNsStreamWriter0 = new SimpleNsStreamWriter(iSOLatin1XmlWriter0, "Multiple type ids specified with ", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator(iOContext0, 2, 1, objectMapper0, simpleNsStreamWriter0);
// Undeclared exception!
try {
toXmlGenerator0.writeNumber((-215));
fail("Expecting exception: IllegalStateException");
} catch(IllegalStateException e) {
//
// No element/attribute name specified when trying to output element
//
verifyException("com.fasterxml.jackson.dataformat.xml.ser.ToXmlGenerator", e);
}
}
@Test(timeout = 4000)
public void test159() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, false);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, ", expectiyg field name", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, 1762, 1762, (ObjectCodec) null, repairingNsStreamWriter0);
DefaultXmlPrettyPrinter defaultXmlPrettyPrinter0 = new DefaultXmlPrettyPrinter();
QName qName0 = new QName(", expectiyg field name");
toXmlGenerator0.startWrappedValue(qName0, qName0);
toXmlGenerator0.writeStartObject((Object) iSOLatin1XmlWriter0);
toXmlGenerator0.setPrettyPrinter(defaultXmlPrettyPrinter0);
toXmlGenerator0.writeNullField(", expectiyg field name");
assertEquals(1762, toXmlGenerator0.getFormatFeatures());
}
@Test(timeout = 4000)
public void test160() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, false);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, ", expectiyg field name", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, 1762, 1762, (ObjectCodec) null, repairingNsStreamWriter0);
toXmlGenerator0.setNextIsUnwrapped(true);
QName qName0 = new QName(", expectiyg field name");
toXmlGenerator0.startWrappedValue(qName0, qName0);
toXmlGenerator0.writeStartObject((Object) iSOLatin1XmlWriter0);
toXmlGenerator0.writeNullField(", expectiyg field name");
assertEquals(1762, toXmlGenerator0.getFormatFeatures());
}
@Test(timeout = 4000)
public void test161() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, false);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, (String) null, writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, 1762, 1762, (ObjectCodec) null, repairingNsStreamWriter0);
ToXmlGenerator.Feature toXmlGenerator_Feature0 = ToXmlGenerator.Feature.WRITE_XML_DECLARATION;
QName qName0 = new QName(", expecting field name");
toXmlGenerator0.startWrappedValue(qName0, qName0);
assertEquals(1762, toXmlGenerator0.getFormatFeatures());
ToXmlGenerator toXmlGenerator1 = toXmlGenerator0.enable(toXmlGenerator_Feature0);
toXmlGenerator0.writeStartObject((Object) iSOLatin1XmlWriter0);
toXmlGenerator1._nextIsAttribute = true;
toXmlGenerator1.writeNullField(", expecting field name");
assertEquals(1763, toXmlGenerator0.getFormatFeatures());
}
@Test(timeout = 4000)
public void test162() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, false);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, "", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, 248, 248, (ObjectCodec) null, repairingNsStreamWriter0);
QName qName0 = new QName("");
DefaultXmlPrettyPrinter defaultXmlPrettyPrinter0 = new DefaultXmlPrettyPrinter();
toXmlGenerator0.setPrettyPrinter(defaultXmlPrettyPrinter0);
toXmlGenerator0.startWrappedValue(qName0, qName0);
toXmlGenerator0.writeBoolean(false);
assertEquals(248, toXmlGenerator0.getFormatFeatures());
}
@Test(timeout = 4000)
public void test163() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createFullDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, true);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, "", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, (-2276), (-3868), (ObjectCodec) null, repairingNsStreamWriter0);
QName qName0 = QName.valueOf("");
toXmlGenerator0._nextIsUnwrapped = true;
toXmlGenerator0.startWrappedValue(qName0, qName0);
toXmlGenerator0.writeBoolean(true);
assertEquals((-3868), toXmlGenerator0.getFormatFeatures());
}
@Test(timeout = 4000)
public void test164() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createFullDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, true);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, "srt h)ec", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, 4, 4, (ObjectCodec) null, repairingNsStreamWriter0);
QName qName0 = new QName("srt h)ec", "srt h)ec");
toXmlGenerator0._nextIsAttribute = true;
toXmlGenerator0.startWrappedValue(qName0, qName0);
toXmlGenerator0.writeBoolean(true);
assertEquals(4, toXmlGenerator0.getFormatFeatures());
}
@Test(timeout = 4000)
public void test165() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
DefaultXmlPrettyPrinter defaultXmlPrettyPrinter0 = new DefaultXmlPrettyPrinter();
IOContext iOContext0 = new IOContext(bufferRecycler0, defaultXmlPrettyPrinter0, false);
JsonFactory jsonFactory0 = new JsonFactory();
DefaultSerializerProvider.Impl defaultSerializerProvider_Impl0 = new DefaultSerializerProvider.Impl();
ObjectMapper objectMapper0 = new ObjectMapper(jsonFactory0, defaultSerializerProvider_Impl0, (DefaultDeserializationContext) null);
ByteArrayBuilder byteArrayBuilder0 = new ByteArrayBuilder(bufferRecycler0);
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter(byteArrayBuilder0, writerConfig0, false);
SimpleNsStreamWriter simpleNsStreamWriter0 = new SimpleNsStreamWriter(iSOLatin1XmlWriter0, "JSON", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator(iOContext0, 2, 2, objectMapper0, simpleNsStreamWriter0);
// Undeclared exception!
try {
toXmlGenerator0.writeBoolean(true);
fail("Expecting exception: IllegalStateException");
} catch(IllegalStateException e) {
//
// No element/attribute name specified when trying to output element
//
verifyException("com.fasterxml.jackson.dataformat.xml.ser.ToXmlGenerator", e);
}
}
@Test(timeout = 4000)
public void test166() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, true);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, "tart an object", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, (-339), (-339), (ObjectCodec) null, repairingNsStreamWriter0);
QName qName0 = new QName("tart an object", "tart an object", "tart an object");
toXmlGenerator0.startWrappedValue((QName) null, qName0);
toXmlGenerator0.writeBoolean(true);
try {
toXmlGenerator0.writeNumber((-339));
fail("Expecting exception: IOException");
} catch(IOException e) {
//
// Trying to output second root, <tart an object>
//
verifyException("com.fasterxml.jackson.dataformat.xml.util.StaxUtil", e);
}
}
@Test(timeout = 4000)
public void test167() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createFullDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, true);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, "srt h)ec", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, 4, 4, (ObjectCodec) null, repairingNsStreamWriter0);
QName qName0 = new QName("srt h)ec", "srt h)ec");
toXmlGenerator0._nextIsAttribute = true;
toXmlGenerator0.startWrappedValue(qName0, qName0);
byte[] byteArray0 = new byte[8];
toXmlGenerator0.writeBinary(byteArray0, (int) (byte)0, 0);
assertEquals(4, toXmlGenerator0.getFormatFeatures());
}
@Test(timeout = 4000)
public void test168() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createFullDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, false);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, "", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, (-31), (-31), (ObjectCodec) null, repairingNsStreamWriter0);
QName qName0 = new QName("", "");
toXmlGenerator0._nextIsAttribute = true;
toXmlGenerator0.startWrappedValue(qName0, qName0);
byte[] byteArray0 = new byte[15];
toXmlGenerator0.writeBinary(byteArray0);
assertEquals((-31), toXmlGenerator0.getFormatFeatures());
}
@Test(timeout = 4000)
public void test169() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createFullDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, false);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, "rth)c", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, 5, 5, (ObjectCodec) null, repairingNsStreamWriter0);
QName qName0 = new QName("rth)c");
toXmlGenerator0._nextIsAttribute = true;
toXmlGenerator0.startWrappedValue(qName0, qName0);
byte[] byteArray0 = new byte[9];
// Undeclared exception!
try {
toXmlGenerator0.writeBinary(byteArray0, (-3783), (-5877));
fail("Expecting exception: NegativeArraySizeException");
} catch(NegativeArraySizeException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("com.fasterxml.jackson.dataformat.xml.ser.ToXmlGenerator", e);
}
}
@Test(timeout = 4000)
public void test170() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, false);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, ") does not implement Stax2 4PI natively and is missing method '", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, 248, 248, (ObjectCodec) null, repairingNsStreamWriter0);
QName qName0 = new QName("");
DefaultXmlPrettyPrinter defaultXmlPrettyPrinter0 = new DefaultXmlPrettyPrinter();
JsonGenerator jsonGenerator0 = toXmlGenerator0.setPrettyPrinter(defaultXmlPrettyPrinter0);
toXmlGenerator0.startWrappedValue(qName0, qName0);
byte[] byteArray0 = new byte[2];
// Undeclared exception!
try {
jsonGenerator0.writeBinary(byteArray0, (-304), 56320);
fail("Expecting exception: ArrayIndexOutOfBoundsException");
} catch(ArrayIndexOutOfBoundsException e) {
//
// -304
//
verifyException("org.codehaus.stax2.ri.typed.ValueEncoderFactory$Base64Encoder", e);
}
}
@Test(timeout = 4000)
public void test171() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createFullDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, true);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, "", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, (-2276), (-3868), (ObjectCodec) null, repairingNsStreamWriter0);
QName qName0 = QName.valueOf("");
toXmlGenerator0._nextIsUnwrapped = true;
toXmlGenerator0.startWrappedValue(qName0, qName0);
byte[] byteArray0 = new byte[0];
// Undeclared exception!
try {
toXmlGenerator0.writeBinary(byteArray0, (-1007), 2);
fail("Expecting exception: ArrayIndexOutOfBoundsException");
} catch(ArrayIndexOutOfBoundsException e) {
//
// -1007
//
verifyException("org.codehaus.stax2.ri.typed.ValueEncoderFactory$Base64Encoder", e);
}
}
@Test(timeout = 4000)
public void test172() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, bufferRecycler0, true);
ObjectMapper objectMapper0 = new ObjectMapper();
ByteArrayBuilder byteArrayBuilder0 = new ByteArrayBuilder(2328);
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter(byteArrayBuilder0, writerConfig0, true);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, "writeRawValue", writerConfig0);
StreamWriter2Delegate streamWriter2Delegate0 = new StreamWriter2Delegate(repairingNsStreamWriter0);
StreamWriterDelegate streamWriterDelegate0 = new StreamWriterDelegate(streamWriter2Delegate0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator(iOContext0, 0, 3639, objectMapper0, streamWriterDelegate0);
char[] charArray0 = new char[0];
try {
toXmlGenerator0.writeRaw(charArray0, (-272), (-131072));
fail("Expecting exception: IOException");
} catch(IOException e) {
//
// Underlying Stax XMLStreamWriter (of type org.codehaus.stax2.util.StreamWriterDelegate) does not implement Stax2 API natively and is missing method 'writeRaw': this breaks functionality such as indentation that relies on it. You need to upgrade to using compliant Stax implementation like Woodstox or Aalto
//
verifyException("com.fasterxml.jackson.dataformat.xml.ser.ToXmlGenerator", e);
}
}
@Test(timeout = 4000)
public void test173() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, bufferRecycler0, true);
ObjectMapper objectMapper0 = new ObjectMapper();
WriterConfig writerConfig0 = WriterConfig.createFullDefaults();
NonNsStreamWriter nonNsStreamWriter0 = new NonNsStreamWriter((XmlWriter) null, "Kq(>nXH$f=d!iYdo.", writerConfig0);
StreamWriterDelegate streamWriterDelegate0 = new StreamWriterDelegate(nonNsStreamWriter0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator(iOContext0, 2, (-1), objectMapper0, streamWriterDelegate0);
try {
toXmlGenerator0.writeRaw("Kq(>nXH$f=d!iYdo.", (-2714), 1);
fail("Expecting exception: IOException");
} catch(IOException e) {
//
// Underlying Stax XMLStreamWriter (of type org.codehaus.stax2.util.StreamWriterDelegate) does not implement Stax2 API natively and is missing method 'writeRaw': this breaks functionality such as indentation that relies on it. You need to upgrade to using compliant Stax implementation like Woodstox or Aalto
//
verifyException("com.fasterxml.jackson.dataformat.xml.ser.ToXmlGenerator", e);
}
}
@Test(timeout = 4000)
public void test174() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, true);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, ", exetiyg field nme", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, 1762, 1762, (ObjectCodec) null, repairingNsStreamWriter0);
// Undeclared exception!
try {
toXmlGenerator0.writeRaw(", exetiyg field nme", 55296, 57343);
fail("Expecting exception: StringIndexOutOfBoundsException");
} catch(StringIndexOutOfBoundsException e) {
}
}
@Test(timeout = 4000)
public void test175() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
SimpleNsStreamWriter simpleNsStreamWriter0 = new SimpleNsStreamWriter((XmlWriter) null, "JEL00{efiZxh", writerConfig0);
StreamWriterDelegate streamWriterDelegate0 = new StreamWriterDelegate(simpleNsStreamWriter0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, 12, 12, (ObjectCodec) null, streamWriterDelegate0);
try {
toXmlGenerator0.writeRaw("JEL00{efiZxh");
fail("Expecting exception: IOException");
} catch(IOException e) {
//
// Underlying Stax XMLStreamWriter (of type org.codehaus.stax2.util.StreamWriterDelegate) does not implement Stax2 API natively and is missing method 'writeRaw': this breaks functionality such as indentation that relies on it. You need to upgrade to using compliant Stax implementation like Woodstox or Aalto
//
verifyException("com.fasterxml.jackson.dataformat.xml.ser.ToXmlGenerator", e);
}
}
@Test(timeout = 4000)
public void test176() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, true);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, ") does not implement Stax2 4PI natively and is missing method '", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, 248, 248, (ObjectCodec) null, repairingNsStreamWriter0);
QName qName0 = new QName("");
toXmlGenerator0.startWrappedValue(qName0, qName0);
toXmlGenerator0._nextIsAttribute = true;
char[] charArray0 = new char[8];
// Undeclared exception!
try {
toXmlGenerator0.writeRawValue(charArray0, 356, 356);
fail("Expecting exception: StringIndexOutOfBoundsException");
} catch(StringIndexOutOfBoundsException e) {
}
}
@Test(timeout = 4000)
public void test177() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, false);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, ", expecting field name", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, 0, 0, (ObjectCodec) null, repairingNsStreamWriter0);
QName qName0 = new QName("");
toXmlGenerator0.startWrappedValue(qName0, qName0);
// Undeclared exception!
try {
toXmlGenerator0.writeRawValue((char[]) null, 56320, 56319);
fail("Expecting exception: NullPointerException");
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("com.ctc.wstx.sw.ISOLatin1XmlWriter", e);
}
}
@Test(timeout = 4000)
public void test178() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, false);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, ", expecting field name", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, 55296, 55296, (ObjectCodec) null, repairingNsStreamWriter0);
// Undeclared exception!
try {
toXmlGenerator0.writeRawValue((char[]) null, 56320, (-2019));
fail("Expecting exception: IllegalStateException");
} catch(IllegalStateException e) {
//
// No element/attribute name specified when trying to output element
//
verifyException("com.fasterxml.jackson.dataformat.xml.ser.ToXmlGenerator", e);
}
}
@Test(timeout = 4000)
public void test179() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createFullDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, true);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, "srt h)ec", writerConfig0);
JsonFactory jsonFactory0 = new JsonFactory();
BufferRecycler bufferRecycler0 = jsonFactory0._getBufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, (Object) null, true);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator(iOContext0, 9, 5784, (ObjectCodec) null, repairingNsStreamWriter0);
QName qName0 = QName.valueOf("http://java.sun.com/xml/stream/properties/report-cdata-event");
toXmlGenerator0.setNextIsAttribute(true);
toXmlGenerator0.startWrappedValue((QName) null, qName0);
// Undeclared exception!
try {
toXmlGenerator0.writeRawValue("http://java.sun.com/xml/stream/properties/report-cdata-event", (-58), 1);
fail("Expecting exception: StringIndexOutOfBoundsException");
} catch(StringIndexOutOfBoundsException e) {
}
}
@Test(timeout = 4000)
public void test180() throws Throwable {
ObjectMapper objectMapper0 = new ObjectMapper();
ByteArrayBuilder byteArrayBuilder0 = new ByteArrayBuilder();
WriterConfig writerConfig0 = WriterConfig.createFullDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter(byteArrayBuilder0, writerConfig0, false);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, (String) null, writerConfig0);
StreamWriterDelegate streamWriterDelegate0 = new StreamWriterDelegate(repairingNsStreamWriter0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, 41, 1, objectMapper0, streamWriterDelegate0);
try {
toXmlGenerator0.writeRawValue((String) null, (-2282), (-366));
fail("Expecting exception: IOException");
} catch(IOException e) {
//
// Underlying Stax XMLStreamWriter (of type org.codehaus.stax2.util.StreamWriterDelegate) does not implement Stax2 API natively and is missing method 'writeRawValue': this breaks functionality such as indentation that relies on it. You need to upgrade to using compliant Stax implementation like Woodstox or Aalto
//
verifyException("com.fasterxml.jackson.dataformat.xml.ser.ToXmlGenerator", e);
}
}
@Test(timeout = 4000)
public void test181() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createFullDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, true);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, "srt h)ec", writerConfig0);
JsonFactory jsonFactory0 = new JsonFactory();
BufferRecycler bufferRecycler0 = jsonFactory0._getBufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, (Object) null, true);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator(iOContext0, 9, 5784, (ObjectCodec) null, repairingNsStreamWriter0);
// Undeclared exception!
try {
toXmlGenerator0.writeRawValue("http://java.sun.com/xml/stream/properties/report-cdata-event", (-58), 1);
fail("Expecting exception: IllegalStateException");
} catch(IllegalStateException e) {
//
// No element/attribute name specified when trying to output element
//
verifyException("com.fasterxml.jackson.dataformat.xml.ser.ToXmlGenerator", e);
}
}
@Test(timeout = 4000)
public void test182() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, false);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, ", expecting field name", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, (-24), (-24), (ObjectCodec) null, repairingNsStreamWriter0);
QName qName0 = new QName(", expecting field name");
toXmlGenerator0.startWrappedValue(qName0, qName0);
toXmlGenerator0._nextIsAttribute = true;
toXmlGenerator0.writeRawValue("No element/attribute name specified when trying to output element");
assertEquals((-24), toXmlGenerator0.getFormatFeatures());
}
@Test(timeout = 4000)
public void test183() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createFullDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, true);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, "#ME8,cmZW2y1S", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, (-304), (-304), (ObjectCodec) null, repairingNsStreamWriter0);
QName qName0 = new QName("#ME8,cmZW2y1S", "#ME8,cmZW2y1S");
toXmlGenerator0.startWrappedValue(qName0, qName0);
toXmlGenerator0.writeRawValue("com.fasterxml.jackson.databind.ser.PropertyBuilder$1");
assertEquals((-304), toXmlGenerator0.getFormatFeatures());
}
@Test(timeout = 4000)
public void test184() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, bufferRecycler0, true);
ObjectMapper objectMapper0 = new ObjectMapper();
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, true);
NonNsStreamWriter nonNsStreamWriter0 = new NonNsStreamWriter(iSOLatin1XmlWriter0, (String) null, writerConfig0);
StreamWriterDelegate streamWriterDelegate0 = new StreamWriterDelegate(nonNsStreamWriter0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator(iOContext0, 0, 3, objectMapper0, streamWriterDelegate0);
try {
toXmlGenerator0.writeRawValue("");
fail("Expecting exception: IOException");
} catch(IOException e) {
//
// Underlying Stax XMLStreamWriter (of type org.codehaus.stax2.util.StreamWriterDelegate) does not implement Stax2 API natively and is missing method 'writeRawValue': this breaks functionality such as indentation that relies on it. You need to upgrade to using compliant Stax implementation like Woodstox or Aalto
//
verifyException("com.fasterxml.jackson.dataformat.xml.ser.ToXmlGenerator", e);
}
}
@Test(timeout = 4000)
public void test185() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createFullDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, true);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, "#ME8,cmZW2y1S", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, (-304), (-304), (ObjectCodec) null, repairingNsStreamWriter0);
// Undeclared exception!
try {
toXmlGenerator0.writeRawValue("com.fasterxml.jackson.databind.ser.PropertyBuilder$1");
fail("Expecting exception: IllegalStateException");
} catch(IllegalStateException e) {
//
// No element/attribute name specified when trying to output element
//
verifyException("com.fasterxml.jackson.dataformat.xml.ser.ToXmlGenerator", e);
}
}
@Test(timeout = 4000)
public void test186() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createFullDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, true);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, ", expecting fild name", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, (-459), (-459), (ObjectCodec) null, repairingNsStreamWriter0);
toXmlGenerator0._nextIsCData = true;
QName qName0 = new QName(", expecting fild name");
toXmlGenerator0.startWrappedValue(qName0, qName0);
// Undeclared exception!
try {
toXmlGenerator0.writeString((char[]) null, 9, 57343);
fail("Expecting exception: NullPointerException");
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("com.ctc.wstx.sw.ISOLatin1XmlWriter", e);
}
}
@Test(timeout = 4000)
public void test187() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createFullDefaults();
ByteArrayOutputStream byteArrayOutputStream0 = new ByteArrayOutputStream(1);
AsciiXmlWriter asciiXmlWriter0 = new AsciiXmlWriter(byteArrayOutputStream0, writerConfig0, true);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(asciiXmlWriter0, ", expecting fild name", writerConfig0);
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, "3EAA", true);
StreamWriterDelegate streamWriterDelegate0 = new StreamWriterDelegate(repairingNsStreamWriter0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator(iOContext0, 3, 2, (ObjectCodec) null, streamWriterDelegate0);
QName qName0 = new QName(", expecting fild name");
toXmlGenerator0.startWrappedValue(qName0, qName0);
toXmlGenerator0.useDefaultPrettyPrinter();
// Undeclared exception!
try {
toXmlGenerator0.writeString((char[]) null, 2, 1984);
fail("Expecting exception: UnsupportedOperationException");
} catch(UnsupportedOperationException e) {
//
// Not implemented
//
verifyException("org.codehaus.stax2.ri.Stax2WriterAdapter", e);
}
}
@Test(timeout = 4000)
public void test188() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createFullDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, true);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, "", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, (-2276), (-3868), (ObjectCodec) null, repairingNsStreamWriter0);
QName qName0 = QName.valueOf("");
toXmlGenerator0._nextIsUnwrapped = true;
toXmlGenerator0.startWrappedValue(qName0, qName0);
toXmlGenerator0.writeString((char[]) null, (-1020), (-1020));
assertEquals((-3868), toXmlGenerator0.getFormatFeatures());
}
@Test(timeout = 4000)
public void test189() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
MissingNode missingNode0 = MissingNode.getInstance();
IOContext iOContext0 = new IOContext(bufferRecycler0, missingNode0, true);
ObjectMapper objectMapper0 = new ObjectMapper();
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
NonNsStreamWriter nonNsStreamWriter0 = new NonNsStreamWriter((XmlWriter) null, ", expecting field name", writerConfig0);
StreamWriter2Delegate streamWriter2Delegate0 = new StreamWriter2Delegate(nonNsStreamWriter0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator(iOContext0, 0, 1, objectMapper0, streamWriter2Delegate0);
char[] charArray0 = new char[6];
// Undeclared exception!
try {
toXmlGenerator0.writeString(charArray0, 65, 53);
fail("Expecting exception: IllegalStateException");
} catch(IllegalStateException e) {
//
// No element/attribute name specified when trying to output element
//
verifyException("com.fasterxml.jackson.dataformat.xml.ser.ToXmlGenerator", e);
}
}
@Test(timeout = 4000)
public void test190() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createFullDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, true);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, "", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, (-2276), (-3868), (ObjectCodec) null, repairingNsStreamWriter0);
QName qName0 = QName.valueOf("");
toXmlGenerator0.startWrappedValue(qName0, qName0);
toXmlGenerator0.writeString((char[]) null, (-1020), (-1020));
assertEquals((-3868), toXmlGenerator0.getFormatFeatures());
}
@Test(timeout = 4000)
public void test191() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createFullDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, true);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, "@gW|#o<l", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, 2631, 2631, (ObjectCodec) null, repairingNsStreamWriter0);
QName qName0 = new QName("@gW|#o<l", "@gW|#o<l", "@gW|#o<l");
toXmlGenerator0.startWrappedValue(qName0, qName0);
toXmlGenerator0.writeStartObject((Object) qName0);
toXmlGenerator0._nextIsCData = true;
toXmlGenerator0.writeStringField("@gW|#o<l", "@gW|#o<l");
assertEquals(2631, toXmlGenerator0.getFormatFeatures());
}
@Test(timeout = 4000)
public void test192() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createFullDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, true);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, "}ahdW4LFM9eJzJspRjm", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, 4109, 4109, (ObjectCodec) null, repairingNsStreamWriter0);
QName qName0 = new QName("}ahdW4LFM9eJzJspRjm", "}ahdW4LFM9eJzJspRjm", "}ahdW4LFM9eJzJspRjm");
toXmlGenerator0._nextIsUnwrapped = true;
toXmlGenerator0.setNextIsCData(true);
toXmlGenerator0.startWrappedValue(qName0, qName0);
toXmlGenerator0.writeString("}ahdW4LFM9eJzJspRjm");
assertEquals(4109, toXmlGenerator0.getFormatFeatures());
}
@Test(timeout = 4000)
public void test193() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createFullDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, true);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, "}ahdW4LFM9eJzJspRjm", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, 4109, 4109, (ObjectCodec) null, repairingNsStreamWriter0);
QName qName0 = new QName("}ahdW4LFM9eJzJspRjm", "}ahdW4LFM9eJzJspRjm", "}ahdW4LFM9eJzJspRjm");
toXmlGenerator0._nextIsUnwrapped = true;
toXmlGenerator0.startWrappedValue(qName0, qName0);
toXmlGenerator0.writeString("}ahdW4LFM9eJzJspRjm");
assertEquals(4109, toXmlGenerator0.getFormatFeatures());
}
@Test(timeout = 4000)
public void test194() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createFullDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, true);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, "srt h)ec", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, 4, 4, (ObjectCodec) null, repairingNsStreamWriter0);
QName qName0 = new QName("srt h)ec", "srt h)ec");
toXmlGenerator0._nextIsAttribute = true;
toXmlGenerator0.startWrappedValue(qName0, qName0);
toXmlGenerator0.writeString("srt h)ec");
assertEquals(4, toXmlGenerator0.getFormatFeatures());
}
@Test(timeout = 4000)
public void test195() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, false);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, ", expecting fied name", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, 55296, 55296, (ObjectCodec) null, repairingNsStreamWriter0);
QName qName0 = new QName("");
toXmlGenerator0.startWrappedValue(qName0, qName0);
MissingNode missingNode0 = MissingNode.getInstance();
toXmlGenerator0.writeStartObject((Object) missingNode0);
toXmlGenerator0._handleStartObject();
toXmlGenerator0._handleEndObject();
assertEquals(55296, toXmlGenerator0.getFormatFeatures());
}
@Test(timeout = 4000)
public void test196() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, false);
SimpleNsStreamWriter simpleNsStreamWriter0 = new SimpleNsStreamWriter(iSOLatin1XmlWriter0, "v=K5O_>x)V}6~].2", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, 0, 0, (ObjectCodec) null, simpleNsStreamWriter0);
try {
toXmlGenerator0._handleEndObject();
fail("Expecting exception: IOException");
} catch(IOException e) {
//
// Can not write END_ELEMENT without open START_ELEMENT
//
verifyException("com.fasterxml.jackson.dataformat.xml.ser.ToXmlGenerator", e);
}
}
@Test(timeout = 4000)
public void test197() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, true);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, "n dj&El4_]+", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, (-73), (-73), (ObjectCodec) null, repairingNsStreamWriter0);
QName qName0 = QName.valueOf("n dj&El4_]+");
toXmlGenerator0.startWrappedValue(qName0, qName0);
toXmlGenerator0.writeStartObject((Object) qName0);
DefaultXmlPrettyPrinter defaultXmlPrettyPrinter0 = new DefaultXmlPrettyPrinter();
ToXmlGenerator toXmlGenerator1 = (ToXmlGenerator)toXmlGenerator0.setPrettyPrinter(defaultXmlPrettyPrinter0);
toXmlGenerator1.setNextIsAttribute(true);
// Undeclared exception!
try {
toXmlGenerator0.close();
fail("Expecting exception: NullPointerException");
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("com.fasterxml.jackson.dataformat.xml.ser.ToXmlGenerator", e);
}
}
@Test(timeout = 4000)
public void test198() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, false);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, ", expectiyg field name", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, 1762, 1762, (ObjectCodec) null, repairingNsStreamWriter0);
DefaultXmlPrettyPrinter defaultXmlPrettyPrinter0 = new DefaultXmlPrettyPrinter();
QName qName0 = new QName(", expectiyg field name");
toXmlGenerator0.startWrappedValue(qName0, qName0);
toXmlGenerator0.writeStartObject((Object) iSOLatin1XmlWriter0);
toXmlGenerator0.setPrettyPrinter(defaultXmlPrettyPrinter0);
toXmlGenerator0.writeEndObject();
assertEquals(1762, toXmlGenerator0.getFormatFeatures());
}
@Test(timeout = 4000)
public void test199() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, false);
SimpleNsStreamWriter simpleNsStreamWriter0 = new SimpleNsStreamWriter(iSOLatin1XmlWriter0, "v=K5O_>x)V}6~].2", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, 0, 0, (ObjectCodec) null, simpleNsStreamWriter0);
try {
toXmlGenerator0.writeEndObject();
fail("Expecting exception: IOException");
} catch(IOException e) {
//
// Current context not Object but root
//
verifyException("com.fasterxml.jackson.core.JsonGenerator", e);
}
}
@Test(timeout = 4000)
public void test200() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, false);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, ", expectiyg field name", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, 1762, 1762, (ObjectCodec) null, repairingNsStreamWriter0);
QName qName0 = new QName(", expectiyg field name");
toXmlGenerator0.startWrappedValue(qName0, qName0);
toXmlGenerator0.writeStartObject((Object) iSOLatin1XmlWriter0);
toXmlGenerator0.writeEndObject();
assertEquals(1762, toXmlGenerator0.getFormatFeatures());
}
@Test(timeout = 4000)
public void test201() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, false);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, "", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, 248, 248, (ObjectCodec) null, repairingNsStreamWriter0);
DefaultXmlPrettyPrinter defaultXmlPrettyPrinter0 = new DefaultXmlPrettyPrinter();
toXmlGenerator0.setPrettyPrinter(defaultXmlPrettyPrinter0);
// Undeclared exception!
try {
toXmlGenerator0.writeStartObject();
fail("Expecting exception: IllegalStateException");
} catch(IllegalStateException e) {
//
// No element/attribute name specified when trying to output element
//
verifyException("com.fasterxml.jackson.dataformat.xml.ser.ToXmlGenerator", e);
}
}
@Test(timeout = 4000)
public void test202() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createFullDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, true);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, "", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, (-2276), (-3868), (ObjectCodec) null, repairingNsStreamWriter0);
try {
toXmlGenerator0.writeEndArray();
fail("Expecting exception: IOException");
} catch(IOException e) {
//
// Current context not Array but root
//
verifyException("com.fasterxml.jackson.core.JsonGenerator", e);
}
}
@Test(timeout = 4000)
public void test203() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, false);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, ", (xpecting field n+me", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, (-3232), (-92), (ObjectCodec) null, repairingNsStreamWriter0);
DefaultXmlPrettyPrinter defaultXmlPrettyPrinter0 = new DefaultXmlPrettyPrinter();
toXmlGenerator0.setPrettyPrinter(defaultXmlPrettyPrinter0);
double[] doubleArray0 = new double[0];
toXmlGenerator0.writeArray(doubleArray0, 168, (-3232));
assertEquals((-92), toXmlGenerator0.getFormatFeatures());
}
@Test(timeout = 4000)
public void test204() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createFullDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, true);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, "", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, (-2276), (-3868), (ObjectCodec) null, repairingNsStreamWriter0);
QName qName0 = QName.valueOf("");
toXmlGenerator0.startWrappedValue(qName0, qName0);
try {
toXmlGenerator0.writeRepeatedFieldName();
fail("Expecting exception: IOException");
} catch(IOException e) {
//
// Can not write a field name, expecting a value
//
verifyException("com.fasterxml.jackson.core.JsonGenerator", e);
}
}
@Test(timeout = 4000)
public void test205() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createFullDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, true);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, "", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, (-15), (-15), (ObjectCodec) null, repairingNsStreamWriter0);
QName qName0 = new QName("");
toXmlGenerator0.startWrappedValue(qName0, qName0);
toXmlGenerator0.writeStartObject((Object) repairingNsStreamWriter0);
toXmlGenerator0.writeRepeatedFieldName();
assertEquals((-15), toXmlGenerator0.getFormatFeatures());
}
@Test(timeout = 4000)
public void test206() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, true);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, ", exetiyg field nme", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, 1762, 1762, (ObjectCodec) null, repairingNsStreamWriter0);
DefaultXmlPrettyPrinter defaultXmlPrettyPrinter0 = new DefaultXmlPrettyPrinter();
QName qName0 = new QName(", exetiyg field nme");
ToXmlGenerator toXmlGenerator1 = (ToXmlGenerator)toXmlGenerator0.setPrettyPrinter(defaultXmlPrettyPrinter0);
try {
toXmlGenerator1.finishWrappedValue(qName0, qName0);
fail("Expecting exception: IOException");
} catch(IOException e) {
//
// No open start element, when trying to write end element
//
verifyException("com.fasterxml.jackson.dataformat.xml.util.StaxUtil", e);
}
}
@Test(timeout = 4000)
public void test207() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, false);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, ", expecting field name", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, 0, 0, (ObjectCodec) null, repairingNsStreamWriter0);
toXmlGenerator0.finishWrappedValue((QName) null, (QName) null);
assertEquals(0, toXmlGenerator0.getFormatFeatures());
}
@Test(timeout = 4000)
public void test208() throws Throwable {
StreamWriter2Delegate streamWriter2Delegate0 = new StreamWriter2Delegate((XMLStreamWriter2) null);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, 1323, 1323, (ObjectCodec) null, streamWriter2Delegate0);
QName qName0 = new QName("", "");
toXmlGenerator0.startWrappedValue((QName) null, qName0);
// Undeclared exception!
try {
toXmlGenerator0.writeNull();
fail("Expecting exception: NullPointerException");
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("org.codehaus.stax2.util.StreamWriterDelegate", e);
}
}
@Test(timeout = 4000)
public void test209() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createFullDefaults();
SimpleNsStreamWriter simpleNsStreamWriter0 = new SimpleNsStreamWriter((XmlWriter) null, "v=KvO_>x)V}6~].2", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, (-1398), (-1398), (ObjectCodec) null, simpleNsStreamWriter0);
boolean boolean0 = toXmlGenerator0.setNextNameIfMissing((QName) null);
assertTrue(boolean0);
assertEquals((-1398), toXmlGenerator0.getFormatFeatures());
}
@Test(timeout = 4000)
public void test210() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, false);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, ", expecting field name", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, 0, 0, (ObjectCodec) null, repairingNsStreamWriter0);
QName qName0 = new QName("");
toXmlGenerator0.startWrappedValue(qName0, qName0);
boolean boolean0 = toXmlGenerator0.setNextNameIfMissing(qName0);
assertFalse(boolean0);
assertEquals(0, toXmlGenerator0.getFormatFeatures());
}
@Test(timeout = 4000)
public void test211() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, true);
ToXmlGenerator.Feature toXmlGenerator_Feature0 = ToXmlGenerator.Feature.WRITE_XML_1_1;
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, ") does not implement Stax2 4PI natively and is missing method '", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, 248, 248, (ObjectCodec) null, repairingNsStreamWriter0);
toXmlGenerator0.configure(toXmlGenerator_Feature0, true);
boolean boolean0 = toXmlGenerator0.isEnabled(toXmlGenerator_Feature0);
assertEquals(250, toXmlGenerator0.getFormatFeatures());
assertTrue(boolean0);
}
@Test(timeout = 4000)
public void test212() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, false);
ToXmlGenerator.Feature toXmlGenerator_Feature0 = ToXmlGenerator.Feature.WRITE_XML_1_1;
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, ") does not implement Stax2 4PI natively and is missing method '", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, 248, 248, (ObjectCodec) null, repairingNsStreamWriter0);
boolean boolean0 = toXmlGenerator0.isEnabled(toXmlGenerator_Feature0);
assertEquals(248, toXmlGenerator0.getFormatFeatures());
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test213() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, bufferRecycler0, true);
ObjectMapper objectMapper0 = new ObjectMapper();
ByteArrayBuilder byteArrayBuilder0 = new ByteArrayBuilder(2328);
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter(byteArrayBuilder0, writerConfig0, true);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, "writeRawValue", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator(iOContext0, 3, 1436, objectMapper0, repairingNsStreamWriter0);
assertEquals(1436, toXmlGenerator0.getFormatFeatures());
toXmlGenerator0.overrideFormatFeatures(3, 57343);
assertEquals(3, toXmlGenerator0.getFormatFeatures());
}
@Test(timeout = 4000)
public void test214() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, bufferRecycler0, false);
ObjectMapper objectMapper0 = new ObjectMapper();
WriterConfig writerConfig0 = WriterConfig.createFullDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, false);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, "x", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator(iOContext0, 0, 3, objectMapper0, repairingNsStreamWriter0);
toXmlGenerator0.useDefaultPrettyPrinter();
toXmlGenerator0.initGenerator();
assertEquals("1.1", repairingNsStreamWriter0.getXmlVersion());
assertEquals(3, toXmlGenerator0.getFormatFeatures());
}
@Test(timeout = 4000)
public void test215() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, true);
SimpleNsStreamWriter simpleNsStreamWriter0 = new SimpleNsStreamWriter(iSOLatin1XmlWriter0, "Cannot call getValue() on constructor of ", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, 2513, 2513, (ObjectCodec) null, simpleNsStreamWriter0);
toXmlGenerator0.initGenerator();
assertEquals("1.0", simpleNsStreamWriter0.getXmlVersion());
assertEquals(2513, toXmlGenerator0.getFormatFeatures());
}
@Test(timeout = 4000)
public void test216() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, true);
SimpleNsStreamWriter simpleNsStreamWriter0 = new SimpleNsStreamWriter(iSOLatin1XmlWriter0, "Cannot call getValue() on constructor of ", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, 2513, 2513, (ObjectCodec) null, simpleNsStreamWriter0);
toXmlGenerator0._initialized = true;
toXmlGenerator0.initGenerator();
assertEquals(2513, toXmlGenerator0.getFormatFeatures());
}
@Test(timeout = 4000)
public void test217() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, false);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, ", (xpecting field n+me", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, (-3232), (-92), (ObjectCodec) null, repairingNsStreamWriter0);
toXmlGenerator0.initGenerator();
assertEquals((-92), toXmlGenerator0.getFormatFeatures());
assertEquals("1.0", repairingNsStreamWriter0.getXmlVersion());
}
@Test(timeout = 4000)
public void test218() throws Throwable {
int int0 = ToXmlGenerator.Feature.collectDefaults();
assertEquals(0, int0);
}
@Test(timeout = 4000)
public void test219() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, false);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, "", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, 248, 248, (ObjectCodec) null, repairingNsStreamWriter0);
// Undeclared exception!
try {
toXmlGenerator0.writeNumber("");
fail("Expecting exception: IllegalStateException");
} catch(IllegalStateException e) {
//
// No element/attribute name specified when trying to output element
//
verifyException("com.fasterxml.jackson.dataformat.xml.ser.ToXmlGenerator", e);
}
}
@Test(timeout = 4000)
public void test220() throws Throwable {
ToXmlGenerator.Feature toXmlGenerator_Feature0 = ToXmlGenerator.Feature.WRITE_XML_DECLARATION;
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, toXmlGenerator_Feature0, false);
ObjectMapper objectMapper0 = new ObjectMapper();
ByteArrayBuilder byteArrayBuilder0 = new ByteArrayBuilder(bufferRecycler0, 3);
WriterConfig writerConfig0 = WriterConfig.createFullDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter(byteArrayBuilder0, writerConfig0, false);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, (String) null, writerConfig0);
StreamWriter2Delegate streamWriter2Delegate0 = new StreamWriter2Delegate(repairingNsStreamWriter0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator(iOContext0, 2, 2, objectMapper0, streamWriter2Delegate0);
// Undeclared exception!
try {
toXmlGenerator0.writeRawUTF8String(byteArrayBuilder0.NO_BYTES, 0, (-58));
fail("Expecting exception: UnsupportedOperationException");
} catch(UnsupportedOperationException e) {
//
// Operation not supported by generator of type com.fasterxml.jackson.dataformat.xml.ser.ToXmlGenerator
//
verifyException("com.fasterxml.jackson.core.JsonGenerator", e);
}
}
@Test(timeout = 4000)
public void test221() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
AsciiXmlWriter asciiXmlWriter0 = new AsciiXmlWriter((OutputStream) null, writerConfig0, false);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(asciiXmlWriter0, "PROPERTY", writerConfig0);
StreamWriter2Delegate streamWriter2Delegate0 = new StreamWriter2Delegate(repairingNsStreamWriter0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, 449, 4, (ObjectCodec) null, streamWriter2Delegate0);
boolean boolean0 = toXmlGenerator0.canWriteFormattedNumbers();
assertTrue(boolean0);
assertEquals(4, toXmlGenerator0.getFormatFeatures());
}
@Test(timeout = 4000)
public void test222() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter((XmlWriter) null, "\" (character at #", writerConfig0);
IOContext iOContext0 = mock(IOContext.class, new ViolatedAssumptionAnswer());
StreamWriterDelegate streamWriterDelegate0 = new StreamWriterDelegate(repairingNsStreamWriter0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator(iOContext0, (-473), 0, (ObjectCodec) null, streamWriterDelegate0);
Object object0 = toXmlGenerator0.getOutputTarget();
assertEquals(0, toXmlGenerator0.getFormatFeatures());
assertNotNull(object0);
}
@Test(timeout = 4000)
public void test223() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
DefaultXmlPrettyPrinter defaultXmlPrettyPrinter0 = new DefaultXmlPrettyPrinter();
IOContext iOContext0 = new IOContext(bufferRecycler0, defaultXmlPrettyPrinter0, false);
JsonFactory jsonFactory0 = new JsonFactory();
DefaultSerializerProvider.Impl defaultSerializerProvider_Impl0 = new DefaultSerializerProvider.Impl();
ObjectMapper objectMapper0 = new ObjectMapper(jsonFactory0, defaultSerializerProvider_Impl0, (DefaultDeserializationContext) null);
ByteArrayBuilder byteArrayBuilder0 = new ByteArrayBuilder(bufferRecycler0);
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter(byteArrayBuilder0, writerConfig0, false);
SimpleNsStreamWriter simpleNsStreamWriter0 = new SimpleNsStreamWriter(iSOLatin1XmlWriter0, "JSON", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator(iOContext0, 2, 2, objectMapper0, simpleNsStreamWriter0);
toXmlGenerator0.getStaxWriter();
assertEquals(2, toXmlGenerator0.getFormatFeatures());
}
@Test(timeout = 4000)
public void test224() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createFullDefaults();
SimpleNsStreamWriter simpleNsStreamWriter0 = new SimpleNsStreamWriter((XmlWriter) null, "v=KvO_>x)V}6~].2", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, (-1398), (-1398), (ObjectCodec) null, simpleNsStreamWriter0);
int int0 = toXmlGenerator0.getFormatFeatures();
assertEquals((-1398), int0);
}
@Test(timeout = 4000)
public void test225() throws Throwable {
IOContext iOContext0 = new IOContext((BufferRecycler) null, "could not determine property type", false);
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, false);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, "could not determine property type", writerConfig0);
StreamWriterDelegate streamWriterDelegate0 = new StreamWriterDelegate(repairingNsStreamWriter0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator(iOContext0, 57343, 57343, (ObjectCodec) null, streamWriterDelegate0);
toXmlGenerator0.useDefaultPrettyPrinter();
toXmlGenerator0.initGenerator();
assertEquals("1.1", repairingNsStreamWriter0.getXmlVersion());
assertEquals(57343, toXmlGenerator0.getFormatFeatures());
}
@Test(timeout = 4000)
public void test226() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
DefaultXmlPrettyPrinter defaultXmlPrettyPrinter0 = new DefaultXmlPrettyPrinter();
IOContext iOContext0 = new IOContext(bufferRecycler0, defaultXmlPrettyPrinter0, false);
JsonFactory jsonFactory0 = new JsonFactory();
DefaultSerializerProvider.Impl defaultSerializerProvider_Impl0 = new DefaultSerializerProvider.Impl();
ObjectMapper objectMapper0 = new ObjectMapper(jsonFactory0, defaultSerializerProvider_Impl0, (DefaultDeserializationContext) null);
ByteArrayBuilder byteArrayBuilder0 = new ByteArrayBuilder();
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter(byteArrayBuilder0, writerConfig0, false);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, "JSON", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator(iOContext0, 5660, 3, objectMapper0, repairingNsStreamWriter0);
int int0 = toXmlGenerator0.getOutputBuffered();
assertEquals((-1), int0);
assertEquals(3, toXmlGenerator0.getFormatFeatures());
}
@Test(timeout = 4000)
public void test227() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, bufferRecycler0, true);
ObjectMapper objectMapper0 = new ObjectMapper();
ByteArrayBuilder byteArrayBuilder0 = new ByteArrayBuilder(2328);
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter(byteArrayBuilder0, writerConfig0, true);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, "writeRawValue", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator(iOContext0, (-1580), 2284, objectMapper0, repairingNsStreamWriter0);
// Undeclared exception!
try {
toXmlGenerator0.writeUTF8String(byteArrayBuilder0.NO_BYTES, 3, 56320);
fail("Expecting exception: UnsupportedOperationException");
} catch(UnsupportedOperationException e) {
//
// Operation not supported by generator of type com.fasterxml.jackson.dataformat.xml.ser.ToXmlGenerator
//
verifyException("com.fasterxml.jackson.core.JsonGenerator", e);
}
}
@Test(timeout = 4000)
public void test228() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createFullDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, true);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, "sZ_S/YsOJktaGtUU>Qe", writerConfig0);
StreamWriterDelegate streamWriterDelegate0 = new StreamWriterDelegate(repairingNsStreamWriter0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, 111, 111, (ObjectCodec) null, streamWriterDelegate0);
try {
toXmlGenerator0.writeRawValue((char[]) null, 111, 111);
fail("Expecting exception: IOException");
} catch(IOException e) {
//
// Underlying Stax XMLStreamWriter (of type org.codehaus.stax2.util.StreamWriterDelegate) does not implement Stax2 API natively and is missing method 'writeRawValue': this breaks functionality such as indentation that relies on it. You need to upgrade to using compliant Stax implementation like Woodstox or Aalto
//
verifyException("com.fasterxml.jackson.dataformat.xml.ser.ToXmlGenerator", e);
}
}
@Test(timeout = 4000)
public void test229() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createFullDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, false);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, "trying to use CONTENn_ALLOW_UNDEFINED via define()", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, 2689, 2689, (ObjectCodec) null, repairingNsStreamWriter0);
try {
toXmlGenerator0.writeStringField("trying to use CONTENn_ALLOW_UNDEFINED via define()", "trying to use CONTENn_ALLOW_UNDEFINED via define()");
fail("Expecting exception: IOException");
} catch(IOException e) {
//
// Can not write a field name, expecting a value
//
verifyException("com.fasterxml.jackson.core.JsonGenerator", e);
}
}
@Test(timeout = 4000)
public void test230() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
ByteArrayBuilder byteArrayBuilder0 = new ByteArrayBuilder(bufferRecycler0);
WriterConfig writerConfig0 = WriterConfig.createFullDefaults();
AsciiXmlWriter asciiXmlWriter0 = new AsciiXmlWriter(byteArrayBuilder0, writerConfig0, true);
SimpleNsStreamWriter simpleNsStreamWriter0 = new SimpleNsStreamWriter(asciiXmlWriter0, "write number", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, (-2896), 2468, (ObjectCodec) null, simpleNsStreamWriter0);
try {
toXmlGenerator0.writeRaw('\u0019');
fail("Expecting exception: IOException");
} catch(IOException e) {
//
// Invalid white space character (0x19) in text to output (in xml 1.1, could output as a character entity)
//
verifyException("com.fasterxml.jackson.dataformat.xml.util.StaxUtil", e);
}
}
@Test(timeout = 4000)
public void test231() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter((OutputStream) null, writerConfig0, false);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, (String) null, writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, 1762, 1762, (ObjectCodec) null, repairingNsStreamWriter0);
// Undeclared exception!
try {
toXmlGenerator0.writeFieldName((SerializableString) null);
fail("Expecting exception: NullPointerException");
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("com.fasterxml.jackson.dataformat.xml.ser.ToXmlGenerator", e);
}
}
@Test(timeout = 4000)
public void test232() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, bufferRecycler0, true);
PipedOutputStream pipedOutputStream0 = new PipedOutputStream();
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter(pipedOutputStream0, writerConfig0, true);
NonNsStreamWriter nonNsStreamWriter0 = new NonNsStreamWriter(iSOLatin1XmlWriter0, "ps", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator(iOContext0, 3, 61, (ObjectCodec) null, nonNsStreamWriter0);
toXmlGenerator0.inRoot();
assertEquals(61, toXmlGenerator0.getFormatFeatures());
}
@Test(timeout = 4000)
public void test233() throws Throwable {
WriterConfig writerConfig0 = WriterConfig.createFullDefaults();
SimpleNsStreamWriter simpleNsStreamWriter0 = new SimpleNsStreamWriter((XmlWriter) null, "v=KvO_>x)V}6~].2", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator((IOContext) null, (-1398), (-1398), (ObjectCodec) null, simpleNsStreamWriter0);
SerializedString serializedString0 = DefaultPrettyPrinter.DEFAULT_ROOT_VALUE_SEPARATOR;
// Undeclared exception!
try {
toXmlGenerator0.writeString((SerializableString) serializedString0);
fail("Expecting exception: IllegalStateException");
} catch(IllegalStateException e) {
//
// No element/attribute name specified when trying to output element
//
verifyException("com.fasterxml.jackson.dataformat.xml.ser.ToXmlGenerator", e);
}
}
@Test(timeout = 4000)
public void test234() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, bufferRecycler0, true);
ObjectMapper objectMapper0 = new ObjectMapper();
ByteArrayBuilder byteArrayBuilder0 = new ByteArrayBuilder(2328);
WriterConfig writerConfig0 = WriterConfig.createFullDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter(byteArrayBuilder0, writerConfig0, true);
RepairingNsStreamWriter repairingNsStreamWriter0 = new RepairingNsStreamWriter(iSOLatin1XmlWriter0, "n^jlz7", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator(iOContext0, 2328, 2325, objectMapper0, repairingNsStreamWriter0);
toXmlGenerator0._releaseBuffers();
assertEquals(2325, toXmlGenerator0.getFormatFeatures());
}
}
| [
"pderakhshanfar@serg2.ewi.tudelft.nl"
] | pderakhshanfar@serg2.ewi.tudelft.nl |
770d23030c169b45aa590aa0c80804d6d940bb41 | a13f533b4ecf49beab5f4f7166a69eaf415921dd | /spring-mvc-javaconfig/src/main/java/org/bana/test/springmvcjavaconfig/mvc/DemoInteceptor.java | aefaf0e1774db53235456563fb058f68d0e6761b | [] | no_license | ganlanshugod/springmvc-based | 05fb5c4346519331cc894fef60f74bdd65659c4e | ec9b9d35fc700551abea64a0cc96764344fce311 | refs/heads/master | 2021-01-19T21:58:16.631835 | 2017-04-19T11:17:40 | 2017-04-19T11:17:40 | 88,729,087 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 786 | java | package org.bana.test.springmvcjavaconfig.mvc;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
public class DemoInteceptor extends HandlerInterceptorAdapter {
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
throws Exception {
System.out.println("DemoInteceptor ... perHandle");
return true;
}
@Override
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler,
ModelAndView modelAndView) throws Exception {
System.out.println("DemoInteceptor ... postHandle");
}
}
| [
"liuwenjiegod@126.com"
] | liuwenjiegod@126.com |
17dbcd50d47f5bb54883540b7713f27775188ba4 | 044fa73ee3106fe81f6414fa33dd2f8d44c8457e | /rta-api/rta-core/src/main/java/org/rta/core/enums/CompanyType.java | c1197e12844a2c68b9e9b99db0c8b5db7b8607e7 | [] | no_license | VinayAddank/webservices | 6ec87de5b90d28c6511294de644b7579219473ca | 882ba250a7bbe9c7112aa6e2dc1a34640731bfb8 | refs/heads/master | 2021-01-25T11:34:25.534538 | 2018-03-01T09:18:26 | 2018-03-01T09:18:26 | 123,411,464 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,644 | java | package org.rta.core.enums;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.Map;
import org.rta.core.utils.ObjectsUtil;
/**
* @Author sohan.maurya created on Jan 2, 2017.
*/
public enum CompanyType {
INDIVIDUAL_OWNED(1,"Individual Owned"), PARTNERSHIP(2,"Partnership"), PVT_LTD(3,"Pvt. LTD"), PUBLIC_LTD(4,"Public LTD");
private Integer value;
private String label;
private CompanyType(Integer value, String label) {
this.value = value;
this.label = label;
}
public Integer getValue() {
return value;
}
public void setValue(Integer value) {
this.value = value;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
private static final Map<String, CompanyType> labelToCompany = new HashMap<String, CompanyType>();
private static final Map<Integer, CompanyType> valueToCompany = new HashMap<Integer, CompanyType>();
static {
for (CompanyType companyType : CompanyType.values()) {
labelToCompany.put(companyType.getLabel(), companyType);
}
for (CompanyType companyType : EnumSet.allOf(CompanyType.class)) {
valueToCompany.put(companyType.getValue(), companyType);
}
}
public static CompanyType getCompanyType(String label) {
return ObjectsUtil.isNull(label) ? null : labelToCompany.get(label.toUpperCase());
}
public static CompanyType getCompanyType(Integer value) {
return ObjectsUtil.isNull(value) ? null : valueToCompany.get(value);
}
}
| [
"vinay.addanki540@gmail.com"
] | vinay.addanki540@gmail.com |
14ed78f7ceb0051c94857cc51070107aad81b094 | 57897f6e7c20a505258eb88d404c85c3d3911438 | /Oops/employee-polymorphism/src/com/techlabs/employee/Developer.java | 428136e4addc04624e99279656adb0f2ad405f91 | [] | no_license | gaubunty1996/swabhav-gaurang | 42fe42a8faba80947f9f4a0138a335d65f608610 | d8139cea34892bee047d388174d6ff38882470ba | refs/heads/master | 2020-04-16T06:41:06.336236 | 2019-03-15T16:37:01 | 2019-03-15T16:37:01 | 165,356,913 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 576 | java | package com.techlabs.employee;
public class Developer extends Employee {
//private double performanceAllowance;
//private String role;
//private double salaryOfDeveloper;
public Developer(String employeeName, int employeeNumber, String role) {
super(employeeName, employeeNumber);
this.role = role;
this.performanceAllowance = 0.4 * basic;
}
public double getPerformanceAllowance() {
return performanceAllowance;
}
public String getRole() {
return role;
}
@Override
public void salary() {
this.salary = (basic + (this.performanceAllowance));
}
}
| [
"gaurangk27@gmail.com"
] | gaurangk27@gmail.com |
c52bfad270f745cf8db0556e4a68a5de53a49c15 | 9ec10d6fa9b6e5132598796237d9ccc9b61d2a77 | /Spring-00-TightlyCoupled/src/Mentor.java | 760523380184873b9e190256fd5845dcd63f70e3 | [] | no_license | adel-sul/Spring | 5023152d4be27e655368f47170cd81389e54cf2d | 4452eecccc1646cd2b849a35d4c3ef5ffbff614d | refs/heads/main | 2023-07-02T13:57:14.829932 | 2021-07-29T02:31:21 | 2021-07-29T02:31:21 | 305,230,542 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 398 | java | public class Mentor {
FullTimeMentor fullTimeMentor;
PartTimeMentor partTimeMentor;
public Mentor(FullTimeMentor fullTimeMentor, PartTimeMentor partTimeMentor) {
this.fullTimeMentor = fullTimeMentor;
this.partTimeMentor = partTimeMentor;
}
public void manageAccount() {
fullTimeMentor.createAccount();
partTimeMentor.createAccount();
}
}
| [
"adelsuleymanov1986@gmail.com"
] | adelsuleymanov1986@gmail.com |
24aca4efb90c541576679558d5dc450bd975b553 | 284ee14b9d72ad23f80a5e9c18b9258763bbfe95 | /code/src/com/smona/app/preinstallclient/image/BitmapProcess.java | b19a6474f528d2fc949ae32247a513cf962572ba | [] | no_license | motianhu/PreinstallClient | 1f0d030507465a0c896e801e3888860cc28f4ac9 | 3947bb215a9381e027633e8f3ba888d8b130245c | refs/heads/master | 2016-09-06T16:43:42.735193 | 2015-06-23T12:35:26 | 2015-06-23T12:35:26 | 37,527,616 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,174 | java | package com.smona.app.preinstallclient.image;
import com.smona.app.preinstallclient.R;
import com.smona.app.preinstallclient.control.ImageCacheStrategy;
import com.smona.app.preinstallclient.util.LogUtil;
import android.annotation.SuppressLint;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.Canvas;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.drawable.Drawable;
public class BitmapProcess {
private static final String TAG = "BitmapProcess";
public static void processBitmap(Context context, int resid, String fileName) {
int sourceSize = context.getResources().getDimensionPixelSize(
R.dimen.source_bitmap_size);
Bitmap source = ImageCacheStrategy.getInstance().getBitmap(fileName);
Bitmap standerd = resizeBitmap(source, sourceSize, sourceSize);
Drawable template = context.getResources().getDrawable(resid);
Bitmap collet = ((BitmapDrawable) template).getBitmap();
int targetSize = collet.getHeight();
int top = (targetSize - sourceSize) / 2;
int left = (targetSize - sourceSize) / 2;
LogUtil.d(TAG, "bitmapPath: " + fileName + ", targetH: " + targetSize
+ ", sourceH: " + sourceSize);
Bitmap result = Bitmap.createBitmap(targetSize, targetSize,
Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(result);
Paint paint = new Paint();
canvas.save();
canvas.drawBitmap(collet, 0, 0, paint);
canvas.drawBitmap(standerd, left, top, paint);
canvas.restore();
ImageCacheStrategy.getInstance().saveBitmap(result, fileName);
recycleBitmap(source);
recycleBitmap(standerd);
recycleBitmap(result);
}
private static Bitmap resizeBitmap(Bitmap srcBitmap, int newHeight,
int newWidth) {
int srcWidth = srcBitmap.getWidth();
int srcHeight = srcBitmap.getHeight();
float scaleWidth = ((float) newWidth) / srcWidth;
float scaleHeight = ((float) newHeight) / srcHeight;
if (isNotNeedScale(scaleWidth, scaleHeight)) {
return srcBitmap;
}
Matrix matrix = new Matrix();
matrix.postScale(scaleWidth, scaleHeight);
Bitmap result = Bitmap.createBitmap(srcBitmap, 0, 0, srcWidth,
srcHeight, matrix, true);
if (result != null) {
return result;
} else {
LogUtil.e(TAG, "theme scale bitmap fail.");
return srcBitmap;
}
}
private static boolean isNotNeedScale(float scaleWidth, float scaleHeight) {
return scaleWidth == 1.0f && scaleHeight == 1.0f;
}
private static void recycleBitmap(Bitmap recycle) {
recycleBitmap(recycle, null);
}
@SuppressLint("NewApi")
private static void recycleBitmap(Bitmap recycle, Bitmap source) {
if (recycle != null) {
if (recycle.sameAs(source) || recycle.isRecycled()) {
return;
}
recycle.recycle();
}
}
}
| [
"tianhu.mo@gmail.com"
] | tianhu.mo@gmail.com |
f351409adb8cb65ae833fb3402f9905d9e7550b2 | 51c6717770ea031aa120446f67b0aa1f94e92dac | /src/main/java/com/nxtlife/vmdt/entity/user/User.java | 12b246e8c6d9defe72125cf2594b01dde4c84c0e | [] | no_license | Koushal1996/Vmdt | 8b526ea30e6717d39d046493ae99f5d4e8e9945e | 000c0be938248eec4a528ae2899bd43ffcda32dd | refs/heads/master | 2022-12-14T23:14:36.438447 | 2020-09-16T07:51:02 | 2020-09-16T07:51:02 | 295,959,715 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,452 | java | package com.nxtlife.vmdt.entity.user;
import com.nxtlife.vmdt.entity.common.BaseEntity;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.springframework.security.core.userdetails.UserDetails;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
import java.io.Serializable;
import java.util.Collection;
import java.util.List;
@SuppressWarnings("serial")
@Entity
@Table(name = "user", uniqueConstraints = { @UniqueConstraint(columnNames = { "username" }) })
@DynamicInsert(value = true)
@DynamicUpdate(value = true)
public class User extends BaseEntity implements UserDetails, Serializable {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
@NotNull(message = "name can't be null")
private String name;
@NotNull(message = "username can't be null")
@Pattern(regexp = "^[@A-Za-z0-9_]{3,20}$", message = "username should contains only alphabets/digit/@ and length should be in between 4 to 20")
private String username;
@NotNull(message = "password can't be null")
private String password;
private Boolean active;
private String generatedPassword;
private String email;
@Size(min = 10, max = 10)
@Pattern(regexp = "^[0-9]*$", message = "Mobile no should contain only digit")
private String mobileNo;
private String contactNo;
private String notificationToken;
private String picUrl;
@Column(columnDefinition = "boolean default false")
private boolean accountExpired = false;
@Column(columnDefinition = "boolean default false")
private boolean accountLocked = false;
@Column(columnDefinition = "boolean default false")
private boolean credentialsExpired = false;
@Column(columnDefinition = "boolean default false")
private boolean enabled = true;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "user")
private List<UserRole> userRoles;
@Transient
private Collection<Authority> authorities;
@Transient
private Collection<Role> roles;
@Transient
private Long userId;
public User() {
}
public User(
@NotNull @Pattern(regexp = "^[@A-Za-z0-9_]{3,20}$", message = "username should contains only alphabets/digit/@ and length should be in between 4 to 20") String username,
@NotNull String password, Collection<Authority> authorities) {
super();
this.username = username;
this.password = password;
this.authorities = authorities;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
@Override
public String getUsername() {
return username;
}
@Override
public String getPassword() {
return password;
}
@Override
public boolean isEnabled() {
return enabled;
}
@Override
public Collection<Authority> getAuthorities() {
return authorities;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getMobileNo() {
return mobileNo;
}
public void setMobileNo(String mobileNo) {
this.mobileNo = mobileNo;
}
public String getContactNo() {
return contactNo;
}
public void setContactNo(String contactNo) {
this.contactNo = contactNo;
}
public String getNotificationToken() {
return notificationToken;
}
public void setNotificationToken(String notificationToken) {
this.notificationToken = notificationToken;
}
public String getPicUrl() {
return picUrl;
}
public void setPicUrl(String picUrl) {
this.picUrl = picUrl;
}
public boolean isAccountExpired() {
return accountExpired;
}
public void setAccountExpired(boolean accountExpired) {
this.accountExpired = accountExpired;
}
public boolean isAccountLocked() {
return accountLocked;
}
public void setAccountLocked(boolean accountLocked) {
this.accountLocked = accountLocked;
}
public boolean isCredentialsExpired() {
return credentialsExpired;
}
public void setCredentialsExpired(boolean credentialsExpired) {
this.credentialsExpired = credentialsExpired;
}
public void setUsername(String username) {
this.username = username;
}
public void setPassword(String password) {
this.password = password;
}
public void setEnabled(boolean enabled) {
this.enabled = enabled;
}
public void setAuthorities(Collection<Authority> authorities) {
this.authorities = authorities;
}
@Override
public boolean isAccountNonExpired() {
return !isAccountExpired();
}
@Override
public boolean isAccountNonLocked() {
return !isAccountLocked();
}
@Override
public boolean isCredentialsNonExpired() {
return !isCredentialsExpired();
}
public String getGeneratedPassword() {
return generatedPassword;
}
public void setGeneratedPassword(String generatedPassword) {
this.generatedPassword = generatedPassword;
}
public List<UserRole> getUserRoles() {
return userRoles;
}
public void setUserRoles(List<UserRole> userRoles) {
this.userRoles = userRoles;
}
public Boolean getActive() {
return active;
}
public void setActive(Boolean active) {
this.active = active;
}
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public Collection<Role> getRoles() {
return roles;
}
public void setRoles(Collection<Role> roles) {
this.roles = roles;
}
}
| [
"koushalpintu195@gmail.com"
] | koushalpintu195@gmail.com |
b50a464bcebc6bf7eef701b6809f34c704da160f | 89cb83aa6fc4fe05331394529937e4c80a631abe | /InClass_03_0826_KershawKylerBuild_2/src/HW_01_KershawKyler/HW_01_KershawKyler.java | e0feae0383155f1bfdf674a8e3207538f7b906ee | [] | no_license | KershawK5646/CSC-251 | 9ed74acd012c947feb3ca60ab46563fb87671a35 | ad410340a418c65f82ef28b140bb1fcce6aee3eb | refs/heads/master | 2020-07-13T02:52:18.721362 | 2019-11-11T14:02:55 | 2019-11-11T14:02:55 | 204,972,458 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,161 | java | /*
* Ask for name
*Ask for classes (CSC-251) (Class name)
*Output:
*Users name
*Users class
*How many days you can miss
*
* 20% of hours in class
*
* Start with basic I/O then port to JOption.
*/
package HW_01_KershawKyler;
import java.util.Scanner;
public class HW_01_KershawKyler {
public static void main(String[] args) {
// Veriables
String userName;
String className;
String classNumber;
String repeatAnswer = "Filler";
Integer totalTimeInClass;
Integer hoursInClass;
Integer daysMeet;
Integer numOfWeeks;
Double roundedDaysCanMiss;
Double hoursMiss;
Double missablePercent;
Double daysCanMiss;
boolean repeatMenu = true;
// Create scanner object
Scanner keyboard = new Scanner(System.in);
// While loop to ask user if they want to go again
while(repeatMenu)
{
// Prompt user for their name
System.out.print("Enter your name: \n");
userName = keyboard.nextLine();
// Prompt the user for their course number
System.out.print("Enter your course number: \n");
classNumber = keyboard.nextLine();
// Prompt user for their class name
System.out.print("Enter your class name: \n");
className = keyboard.nextLine();
// Ask the user how many hours they're in class
System.out.print("How many hours at a time does your class meet: ");
hoursInClass = Integer.parseInt(keyboard.nextLine());
// Ask the user how many days they're in class
System.out.print("How many days a week does your class meet: ");
daysMeet = Integer.parseInt(keyboard.nextLine());
// Ask the user how many weeks they're in class
System.out.print("How many weeks does your class meet: ");
numOfWeeks = Integer.parseInt(keyboard.nextLine());
// Calculate the toal hours the user is in class.
totalTimeInClass = hoursInClass*daysMeet*numOfWeeks;
// Ask the user what the syllabus says in a % they can miss
System.out.print("Looking at your syllabus, what percentage of "
+ "class are you allowed to miss? \n");
System.out.print("Enter 5 for 5%, 10 for 10% and so on: \n");
// Parse input for math use.
missablePercent = Double.parseDouble(keyboard.nextLine());
// Calculate the number of hours a user can miss
//// Uses the calulateDaysCanMiss function below.
hoursMiss = calculateDaysCanMiss(missablePercent,
totalTimeInClass);
// TODO
// FIX ISSUE CAUSING CRASH
// Conversion issue
// hoursMiss is a double
// hoursInClass is an int
// daysCanMiss needs to be rounded up to nearest whole#
roundedDaysCanMiss = Math.ceil(hoursMiss/hoursInClass);
System.out.print(roundedDaysCanMiss);
// Output name. class info, # of days you can miss to user.
output(userName, classNumber, className, totalTimeInClass,
hoursMiss, roundedDaysCanMiss);
// TODO Ask user if they want to go again for another class
repeatMenu = false;
}
//Out of the while loop.
//System.out.print("Out the loop");
}
// This function displays the user input and calulated data to the user.
public static void output(String userName, String classNumber,
String className, Integer timeInClass, Double hoursMiss,
Double daysCanMiss){
System.out.print("Name: " + userName + "\n");
System.out.print("Course Num: " + classNumber + "\n");
System.out.print("Class Name: " + className + "\n");
System.out.print("Hours in class: " + timeInClass + "\n");
System.out.print("Hours you can miss: " + hoursMiss + "\n");
System.out.print("Days you can miss: " + daysCanMiss + "\n");
}
// This function uses the user entered variables to find the number of hours
// they are permitted to miss.
public static Double calculateDaysCanMiss(Double missablePercent,
Integer totalTimeInClass){
Double hoursMiss;
//Process the missable percent from int to percentage
missablePercent = (missablePercent/100);
//TODO finish calculation of days they can miss
hoursMiss = totalTimeInClass * missablePercent;
return hoursMiss;
}
}
| [
"KershawK5646@student.faytechcc.edu"
] | KershawK5646@student.faytechcc.edu |
3c104184d61acf64a3ed52a22235eb37f69bb292 | b8d6958fe1a9c01876d9b5226262b70bb58c5c15 | /src/main/java/org/erp/tarak/salesPayment/SalesPaymentIdGenerator.java | 702d48642c191e157211fc16dd65b750f36abf2c | [] | no_license | ramarao271/PMSoft | aa6f890965bf17f90e8c46b6825ed46f6789b4bd | 6bf6009cc711d9937c8c5b5ab47c797ba8db63cf | refs/heads/master | 2020-07-03T00:28:59.123059 | 2016-11-20T11:56:36 | 2016-11-20T11:56:36 | 74,204,821 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,496 | java | package org.erp.tarak.salesPayment;
import java.io.Serializable;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import org.hibernate.HibernateException;
import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.id.IdentifierGenerator;
public class SalesPaymentIdGenerator implements IdentifierGenerator {
@Override
public Serializable generate(SharedSessionContractImplementor HiSession, Object object)
throws HibernateException {
Connection connection = HiSession.connection();
try {
String finyear="";
String query="";
if(object instanceof SalesPayment)
{
SalesPayment salesPayment = (SalesPayment) object;
finyear = salesPayment.getFinYear();
query="SELECT MAX(salesPaymentId) as vlaue from SalesPayment where finYear='"
+ finyear + "'";
}
else if(object instanceof SalesPaymentItem)
{
SalesPaymentItem salesPaymentItem=(SalesPaymentItem)object;
finyear=salesPaymentItem.getFinYear();
query="SELECT MAX(salesPaymentId) as vlaue from SalesPaymentItem where FINANCIAL_YEAR='"
+ finyear + "'";
}
PreparedStatement ps = connection
.prepareStatement(query);
ResultSet rs = ps.executeQuery();
if (rs.next()) {
long id = rs.getLong("vlaue");
id = id + 1;
return id;
}
} catch (SQLException e) {
e.printStackTrace();
}
return null;
}
}
| [
"Tarak@DESKTOP-SSLKAI7"
] | Tarak@DESKTOP-SSLKAI7 |
b6b2d1618c457546948125cebfd27f110e7e9b1d | bc704eda802e83e524e43b33d00dde87fdcc3eaa | /ExpenseTracker/app/src/main/java/com/example/expensetracker/BudgetActivity.java | 81ad412674af68f6cf0140d72d867e7756de5719 | [] | no_license | Saad-Ishtiaq/MC-Work | 63fb1bd25212bd91fb85b6b02f1fedbaeebf81e6 | 2c8ab003af84e6b22dfe321571dab7f697cef9e4 | refs/heads/master | 2023-06-06T10:54:41.655803 | 2021-06-27T17:23:17 | 2021-06-27T17:23:17 | 354,335,387 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 30,665 | java | package com.example.expensetracker;
import android.app.ProgressDialog;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.Spinner;
import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.firebase.ui.database.FirebaseRecyclerAdapter;
import com.firebase.ui.database.FirebaseRecyclerOptions;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.Query;
import com.google.firebase.database.ValueEventListener;
import org.joda.time.DateTime;
import org.joda.time.Months;
import org.joda.time.MutableDateTime;
import org.joda.time.Weeks;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Map;
public class BudgetActivity extends AppCompatActivity {
private TextView totalBudgetAmountTextView;
private RecyclerView recyclerView;
private FloatingActionButton fab;
private DatabaseReference budgetRef, personalRef;
private FirebaseAuth mAuth;
private ProgressDialog loader;
private String post_key = "";
private String item = "";
private int amount = 0;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_budget);
mAuth = FirebaseAuth.getInstance();
budgetRef = FirebaseDatabase.getInstance().getReference().child("budget").child(mAuth.getCurrentUser().getUid());
personalRef = FirebaseDatabase.getInstance().getReference("personal").child(mAuth.getCurrentUser().getUid());
loader = new ProgressDialog(this);
totalBudgetAmountTextView = findViewById(R.id.totalBudgetAmountTextView);
recyclerView = findViewById(R.id.recyclerView);
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this);
linearLayoutManager.setStackFromEnd(true);
linearLayoutManager.setReverseLayout(true);
recyclerView.setHasFixedSize(true);
recyclerView.setLayoutManager(linearLayoutManager);
budgetRef.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot snapshot) {
int totalAmount = 0;
for (DataSnapshot snap: snapshot.getChildren()){
Data data = snap.getValue(Data.class);
totalAmount += data.getAmount();
String sTotal = String.valueOf("Month budget: Rs."+ totalAmount);
totalBudgetAmountTextView.setText(sTotal);
}
}
@Override
public void onCancelled(@NonNull DatabaseError error) {
}
});
fab = findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
additem();
}
});
budgetRef.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot snapshot) {
if (snapshot.exists() && snapshot.getChildrenCount()>0){
int totalammount = 0;
for (DataSnapshot snap:snapshot.getChildren()){
Data data =snap.getValue(Data.class);
totalammount+=data.getAmount();
String sttotal=String.valueOf("Month Budget: "+totalammount);
totalBudgetAmountTextView.setText(sttotal);
}
int weeklyBudget = totalammount/4;
int dailyBudget = totalammount/30;
personalRef.child("budget").setValue(totalammount);
personalRef.child("weeklyBudget").setValue(weeklyBudget);
personalRef.child("dailyBudget").setValue(dailyBudget);
}else {
personalRef.child("budget").setValue(0);
personalRef.child("weeklyBudget").setValue(0);
personalRef.child("dailyBudget").setValue(0);
}
}
@Override
public void onCancelled(@NonNull DatabaseError error) {
}
});
getMonthTransportBudgetRatios();
getMonthFoodBudgetRatios();
getMonthHouseBudgetRatios();
getMonthEntBudgetRatios();
getMonthEduBudgetRatios();
getMonthCharityBudgetRatios();
getMonthAppBudgetRatios();
getMonthHealthBudgetRatios();
getMonthPerBudgetRatios();
getMonthOtherBudgetRatios();
}
private void additem() {
AlertDialog.Builder myDialog = new AlertDialog.Builder(this);
LayoutInflater inflater = LayoutInflater.from(this);
View myView = inflater.inflate(R.layout.input_layout, null);
myDialog.setView(myView);
final AlertDialog dialog = myDialog.create();
dialog.setCancelable(false);
final Spinner itemSpinner = myView.findViewById(R.id.itemsspinner);
final EditText amount = myView.findViewById(R.id.amount);
final Button cancel = myView.findViewById(R.id.cancel);
final Button save = myView.findViewById(R.id.save);
save.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
String budgetAmount = amount.getText().toString();
String budgtItem = itemSpinner.getSelectedItem().toString();
if (TextUtils.isEmpty(budgetAmount)){
amount.setError("Amount is required!");
return;
}
if (budgtItem.equals("Select item")){
Toast.makeText(BudgetActivity.this, "Select a valid item", Toast.LENGTH_SHORT).show();
}
else {
loader.setMessage("adding a budget item");
loader.setCanceledOnTouchOutside(false);
loader.show();
String id = budgetRef.push().getKey();
DateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy");
Calendar cal = Calendar.getInstance();
String date = dateFormat.format(cal.getTime());
MutableDateTime epoch = new MutableDateTime();
epoch.setDate(0);
DateTime now = new DateTime();
Weeks weeks = Weeks.weeksBetween(epoch, now);
Months months = Months.monthsBetween(epoch, now);
String itemNday = budgtItem+date;
String itemNweek = budgtItem+weeks.getWeeks();
String itemNmonth = budgtItem+months.getMonths();
Data data = new Data(budgtItem, date, id, itemNday, itemNweek, itemNmonth, Integer.parseInt(budgetAmount), weeks.getWeeks(), months.getMonths(), null);
budgetRef.child(id).setValue(data).addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
if (task.isSuccessful()){
Toast.makeText(BudgetActivity.this, "Budget item added successfuly", Toast.LENGTH_SHORT).show();
}else {
Toast.makeText(BudgetActivity.this, task.getException().toString(), Toast.LENGTH_SHORT).show();
}
loader.dismiss();
}
});
}
dialog.dismiss();
}
});
cancel.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
dialog.dismiss();
}
});
dialog.show();
}
@Override
protected void onStart() {
super.onStart();
FirebaseRecyclerOptions<Data> options = new FirebaseRecyclerOptions.Builder<Data>()
.setQuery(budgetRef, Data.class)
.build();
FirebaseRecyclerAdapter<Data, MyViewHolder> adapter = new FirebaseRecyclerAdapter<Data, MyViewHolder>(options) {
@Override
protected void onBindViewHolder(@NonNull MyViewHolder holder, final int position, @NonNull final Data model) {
holder.setItemAmount("Allocated amount: Rs."+ model.getAmount());
holder.setDate("On: "+model.getDate());
holder.setItemName("BudgetItem: "+model.getItem());
holder.notes.setVisibility(View.GONE);
switch (model.getItem()){
case "Transport":
holder.imageView.setImageResource(R.drawable.transport);
break;
case "Food":
holder.imageView.setImageResource(R.drawable.food);
break;
case "House":
holder.imageView.setImageResource(R.drawable.house);
break;
case "Entertainment":
holder.imageView.setImageResource(R.drawable.entertainment);
break;
case "Education":
holder.imageView.setImageResource(R.drawable.education);
break;
case "Charity":
holder.imageView.setImageResource(R.drawable.consultancy);
break;
case "Apparel":
holder.imageView.setImageResource(R.drawable.shirt);
break;
case "Health":
holder.imageView.setImageResource(R.drawable.health);
break;
case "Personal":
holder.imageView.setImageResource(R.drawable.personalcare);
break;
case "Other":
holder.imageView.setImageResource(R.drawable.other);
break;
}
holder.mView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
post_key = getRef(position).getKey();
item = model.getItem();
amount = model.getAmount();
updateData();
}
});
}
@NonNull
@Override
public MyViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.retrieve_layout, parent, false);
return new MyViewHolder(view);
}
};
recyclerView.setAdapter(adapter);
adapter.startListening();
adapter.notifyDataSetChanged();
}
public class MyViewHolder extends RecyclerView.ViewHolder{
View mView;
public ImageView imageView;
public TextView notes, date;
public MyViewHolder(@NonNull View itemView) {
super(itemView);
mView = itemView;
imageView = itemView.findViewById(R.id.imageView);
notes = itemView.findViewById(R.id.note);
date = itemView.findViewById(R.id.date);
}
public void setItemName (String itemName){
TextView item = mView.findViewById(R.id.item);
item.setText(itemName);
}
public void setItemAmount(String itemAmount){
TextView amount = mView.findViewById(R.id. amount);
amount.setText(itemAmount);
}
public void setDate(String itemDate){
TextView date = mView.findViewById(R.id.date);
date.setText(itemDate);
}
}
private void updateData(){
AlertDialog.Builder myDialog= new AlertDialog.Builder(this);
LayoutInflater inflater = LayoutInflater.from(this);
View mView = inflater.inflate(R.layout.update_layout, null);
myDialog.setView(mView);
final AlertDialog dialog = myDialog.create();
final TextView mItem = mView.findViewById(R.id.itemName);
final EditText mAmount = mView.findViewById(R.id.amount);
final EditText mNotes = mView.findViewById(R.id.note);
mNotes.setVisibility(View.GONE);
mItem.setText(item);
mAmount.setText(String.valueOf(amount));
mAmount.setSelection(String.valueOf(amount).length());
Button delBut = mView.findViewById(R.id.btnDelete);
Button btnUpdate = mView.findViewById(R.id.btnUpdate);
btnUpdate.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
amount = Integer.parseInt(mAmount.getText().toString());
DateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy");
Calendar cal = Calendar.getInstance();
String date = dateFormat.format(cal.getTime());
MutableDateTime epoch = new MutableDateTime();
epoch.setDate(0);
DateTime now = new DateTime();
Weeks weeks = Weeks.weeksBetween(epoch, now);
Months months = Months.monthsBetween(epoch, now);
String itemNday = item+date;
String itemNweek = item+weeks.getWeeks();
String itemNmonth = item+months.getMonths();
Data data = new Data(item, date, post_key, itemNday, itemNweek, itemNmonth, amount, weeks.getWeeks(), months.getMonths(), null);
budgetRef.child(post_key).setValue(data).addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
if (task.isSuccessful()){
Toast.makeText(BudgetActivity.this, "Updated successfully", Toast.LENGTH_SHORT).show();
}else {
Toast.makeText(BudgetActivity.this, task.getException().toString(), Toast.LENGTH_SHORT).show();
}
}
});
dialog.dismiss();
}
});
delBut.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
budgetRef.child(post_key).removeValue().addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
if (task.isSuccessful()){
Toast.makeText(BudgetActivity.this, "Deleted successfully", Toast.LENGTH_SHORT).show();
}else {
Toast.makeText(BudgetActivity.this, task.getException().toString(), Toast.LENGTH_SHORT).show();
}
}
});
dialog.dismiss();
}
});
dialog.show();
}
private void getMonthTransportBudgetRatios(){
Query query = budgetRef.orderByChild("item").equalTo("Transport");
query.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot snapshot) {
if (snapshot.exists()){
int pTotal = 0;
for (DataSnapshot ds : snapshot.getChildren()) {
Map<String, Object> map = (Map<String, Object>) ds.getValue();
Object total = map.get("amount");
pTotal = Integer.parseInt(String.valueOf(total));
}
int dayTransRatio = pTotal/30;
int weekTransRatio = pTotal/4;
int monthTransRatio = pTotal;
personalRef.child("dayTransRatio").setValue(dayTransRatio);
personalRef.child("weekTransRatio").setValue(weekTransRatio);
personalRef.child("monthTransRatio").setValue(monthTransRatio);
}else {
personalRef.child("dayTransRatio").setValue(0);
personalRef.child("weekTransRatio").setValue(0);
personalRef.child("monthTransRatio").setValue(0);
}
}
@Override
public void onCancelled(@NonNull DatabaseError error) {
}
});
}
private void getMonthFoodBudgetRatios(){
Query query = budgetRef.orderByChild("item").equalTo("Food");
query.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot snapshot) {
if (snapshot.exists()){
int pTotal = 0;
for (DataSnapshot ds : snapshot.getChildren()) {
Map<String, Object> map = (Map<String, Object>) ds.getValue();
Object total = map.get("amount");
pTotal = Integer.parseInt(String.valueOf(total));
}
int dayFoodRatio = pTotal/30;
int weekFoodRatio = pTotal/4;
int monthFoodRatio = pTotal;
personalRef.child("dayFoodRatio").setValue(dayFoodRatio);
personalRef.child("weekFoodRatio").setValue(weekFoodRatio);
personalRef.child("monthFoodRatio").setValue(monthFoodRatio);
}else {
personalRef.child("dayFoodRatio").setValue(0);
personalRef.child("weekFoodRatio").setValue(0);
personalRef.child("monthFoodRatio").setValue(0);
}
}
@Override
public void onCancelled(@NonNull DatabaseError error) {
}
});
}
private void getMonthHouseBudgetRatios(){
Query query = budgetRef.orderByChild("item").equalTo("House Expenses");
query.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot snapshot) {
if (snapshot.exists()){
int pTotal = 0;
for (DataSnapshot ds : snapshot.getChildren()) {
Map<String, Object> map = (Map<String, Object>) ds.getValue();
Object total = map.get("amount");
pTotal = Integer.parseInt(String.valueOf(total));
}
int dayHouseRatio = pTotal/30;
int weekHouseRatio = pTotal/4;
int monthHouseRatio = pTotal;
personalRef.child("dayHouseRatio").setValue(dayHouseRatio);
personalRef.child("weekHouseRatio").setValue(weekHouseRatio);
personalRef.child("monthHouseRatio").setValue(monthHouseRatio);
}else {
personalRef.child("dayHouseRatio").setValue(0);
personalRef.child("weekHouseRatio").setValue(0);
personalRef.child("monthHouseRatio").setValue(0);
}
}
@Override
public void onCancelled(@NonNull DatabaseError error) {
}
});
}
private void getMonthEntBudgetRatios(){
Query query = budgetRef.orderByChild("item").equalTo("Entertainment");
query.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot snapshot) {
if (snapshot.exists()){
int pTotal = 0;
for (DataSnapshot ds : snapshot.getChildren()) {
Map<String, Object> map = (Map<String, Object>) ds.getValue();
Object total = map.get("amount");
pTotal = Integer.parseInt(String.valueOf(total));
}
int dayEntRatio = pTotal/30;
int weekEntRatio = pTotal/4;
int monthEntRatio = pTotal;
personalRef.child("dayEntRatio").setValue(dayEntRatio);
personalRef.child("weekEntRatio").setValue(weekEntRatio);
personalRef.child("monthEntRatio").setValue(monthEntRatio);
}else {
personalRef.child("dayEntRatio").setValue(0);
personalRef.child("weekEntRatio").setValue(0);
personalRef.child("monthEntRatio").setValue(0);
}
}
@Override
public void onCancelled(@NonNull DatabaseError error) {
}
});
}
private void getMonthEduBudgetRatios(){
Query query = budgetRef.orderByChild("item").equalTo("Education");
query.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot snapshot) {
if (snapshot.exists()){
int pTotal = 0;
for (DataSnapshot ds : snapshot.getChildren()) {
Map<String, Object> map = (Map<String, Object>) ds.getValue();
Object total = map.get("amount");
pTotal = Integer.parseInt(String.valueOf(total));
}
int dayEduRatio = pTotal/30;
int weekEduRatio = pTotal/4;
int monthEduRatio = pTotal;
personalRef.child("dayEduRatio").setValue(dayEduRatio);
personalRef.child("weekEduRatio").setValue(weekEduRatio);
personalRef.child("monthEduRatio").setValue(monthEduRatio);
}else {
personalRef.child("dayEduRatio").setValue(0);
personalRef.child("weekEduRatio").setValue(0);
personalRef.child("monthEduRatio").setValue(0);
}
}
@Override
public void onCancelled(@NonNull DatabaseError error) {
}
});
}
private void getMonthCharityBudgetRatios(){
Query query = budgetRef.orderByChild("item").equalTo("Charity");
query.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot snapshot) {
if (snapshot.exists()){
int pTotal = 0;
for (DataSnapshot ds : snapshot.getChildren()) {
Map<String, Object> map = (Map<String, Object>) ds.getValue();
Object total = map.get("amount");
pTotal = Integer.parseInt(String.valueOf(total));
}
int dayCharRatio = pTotal/30;
int weekCharRatio = pTotal/4;
int monthCharRatio = pTotal;
personalRef.child("dayCharRatio").setValue(dayCharRatio);
personalRef.child("weekCharRatio").setValue(weekCharRatio);
personalRef.child("monthCharRatio").setValue(monthCharRatio);
}else {
personalRef.child("dayCharRatio").setValue(0);
personalRef.child("weekCharRatio").setValue(0);
personalRef.child("monthCharRatio").setValue(0);
}
}
@Override
public void onCancelled(@NonNull DatabaseError error) {
}
});
}
private void getMonthAppBudgetRatios(){
Query query = budgetRef.orderByChild("item").equalTo("Apparel and Services");
query.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot snapshot) {
if (snapshot.exists()){
int pTotal = 0;
for (DataSnapshot ds : snapshot.getChildren()) {
Map<String, Object> map = (Map<String, Object>) ds.getValue();
Object total = map.get("amount");
pTotal = Integer.parseInt(String.valueOf(total));
}
int dayAppRatio = pTotal/30;
int weekAppRatio = pTotal/4;
int monthAppRatio = pTotal;
personalRef.child("dayAppRatio").setValue(dayAppRatio);
personalRef.child("weekAppRatio").setValue(weekAppRatio);
personalRef.child("monthAppRatio").setValue(monthAppRatio);
}else {
personalRef.child("dayAppRatio").setValue(0);
personalRef.child("weekAppRatio").setValue(0);
personalRef.child("monthAppRatio").setValue(0);
}
}
@Override
public void onCancelled(@NonNull DatabaseError error) {
}
});
}
private void getMonthHealthBudgetRatios(){
Query query = budgetRef.orderByChild("item").equalTo("Health");
query.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot snapshot) {
if (snapshot.exists()){
int pTotal = 0;
for (DataSnapshot ds : snapshot.getChildren()) {
Map<String, Object> map = (Map<String, Object>) ds.getValue();
Object total = map.get("amount");
pTotal = Integer.parseInt(String.valueOf(total));
}
int dayHealthRatio = pTotal/30;
int weekHealthRatio = pTotal/4;
int monthHealthRatio = pTotal;
personalRef.child("dayHealthRatio").setValue(dayHealthRatio);
personalRef.child("weekHealthRatio").setValue(weekHealthRatio);
personalRef.child("monthHealthRatio").setValue(monthHealthRatio);
}else {
personalRef.child("dayHealthRatio").setValue(0);
personalRef.child("weekHealthRatio").setValue(0);
personalRef.child("monthHealthRatio").setValue(0);
}
}
@Override
public void onCancelled(@NonNull DatabaseError error) {
}
});
}
private void getMonthPerBudgetRatios(){
Query query = budgetRef.orderByChild("item").equalTo("Personal Expenses");
query.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot snapshot) {
if (snapshot.exists()){
int pTotal = 0;
for (DataSnapshot ds : snapshot.getChildren()) {
Map<String, Object> map = (Map<String, Object>) ds.getValue();
Object total = map.get("amount");
pTotal = Integer.parseInt(String.valueOf(total));
}
int dayPerRatio = pTotal/30;
int weekPerRatio = pTotal/4;
int monthPerRatio = pTotal;
personalRef.child("dayPerRatio").setValue(dayPerRatio);
personalRef.child("weekPerRatio").setValue(weekPerRatio);
personalRef.child("monthPerRatio").setValue(monthPerRatio);
}else {
personalRef.child("dayPerRatio").setValue(0);
personalRef.child("weekPerRatio").setValue(0);
personalRef.child("monthPerRatio").setValue(0);
}
}
@Override
public void onCancelled(@NonNull DatabaseError error) {
}
});
}
private void getMonthOtherBudgetRatios(){
Query query = budgetRef.orderByChild("item").equalTo("Other");
query.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot snapshot) {
if (snapshot.exists()){
int pTotal = 0;
for (DataSnapshot ds : snapshot.getChildren()) {
Map<String, Object> map = (Map<String, Object>) ds.getValue();
Object total = map.get("amount");
pTotal = Integer.parseInt(String.valueOf(total));
}
int dayOtherRatio = pTotal/30;
int weekOtherRatio = pTotal/4;
int monthOtherRatio = pTotal;
personalRef.child("dayOtherRatio").setValue(dayOtherRatio);
personalRef.child("weekOtherRatio").setValue(weekOtherRatio);
personalRef.child("monthOtherRatio").setValue(monthOtherRatio);
}else {
personalRef.child("dayOtherRatio").setValue(0);
personalRef.child("weekOtherRatio").setValue(0);
personalRef.child("monthOtherRatio").setValue(0);
}
}
@Override
public void onCancelled(@NonNull DatabaseError error) {
}
});
}
} | [
"bsef18a025@pucit.edu.pk"
] | bsef18a025@pucit.edu.pk |
b822f217a47cefedb9750a854f634b83c1400094 | c629f2968b64721a7671bc17035d1d82b3769403 | /src/main/java/act/app/ActionContext.java | a8542d4f77293b729eef9f34346d13defbc3dcbb | [
"Apache-2.0"
] | permissive | zhoujian1210/actframework | 65038ef7c18df5e1e420656c2c52884c86bff4c3 | cace5472e6716bdbb827e6b18b54d67423faf54f | refs/heads/master | 2021-05-03T04:28:51.365370 | 2018-01-30T10:15:48 | 2018-01-30T10:15:48 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 37,924 | java | package act.app;
/*-
* #%L
* ACT Framework
* %%
* Copyright (C) 2014 - 2017 ActFramework
* %%
* 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%
*/
import act.ActResponse;
import act.Destroyable;
import act.conf.AppConfig;
import act.controller.ResponseCache;
import act.data.MapUtil;
import act.data.RequestBodyParser;
import act.event.ActEvent;
import act.event.SystemEvent;
import act.handler.RequestHandler;
import act.i18n.LocaleResolver;
import act.route.Router;
import act.route.UrlPath;
import act.security.CORS;
import act.session.SessionManager;
import act.util.ActContext;
import act.util.MissingAuthenticationHandler;
import act.util.PropertySpec;
import act.util.RedirectToLoginUrl;
import act.view.RenderAny;
import org.osgl.$;
import org.osgl.concurrent.ContextLocal;
import org.osgl.http.H;
import org.osgl.logging.LogManager;
import org.osgl.logging.Logger;
import org.osgl.mvc.result.Result;
import org.osgl.storage.ISObject;
import org.osgl.util.C;
import org.osgl.util.E;
import org.osgl.util.S;
import org.osgl.web.util.UserAgent;
import javax.enterprise.context.RequestScoped;
import javax.inject.Inject;
import javax.validation.ConstraintViolation;
import java.lang.annotation.Annotation;
import java.util.*;
import static act.controller.Controller.Util.*;
import static org.osgl.http.H.Header.Names.*;
/**
* {@code AppContext} encapsulate contextual properties needed by
* an application session
*/
@RequestScoped
public class ActionContext extends ActContext.Base<ActionContext> implements Destroyable {
private static final Logger LOGGER = LogManager.get(ActionContext.class);
public static final String ATTR_EXCEPTION = "__exception__";
public static final String ATTR_CURRENT_FILE_INDEX = "__file_id__";
public static final String REQ_BODY = "_body";
private H.Request request;
private ActResponse<?> response;
private H.Session session;
private H.Flash flash;
private Set<Map.Entry<String, String[]>> requestParamCache;
private Map<String, String> extraParams;
private volatile Map<String, String[]> bodyParams;
private Map<String, String[]> allParams;
private String actionPath; // e.g. com.mycorp.myapp.controller.AbcController.foo
private State state;
private Map<String, Object> controllerInstances;
private Map<String, ISObject[]> uploads;
private Router router;
private RequestHandler handler;
private UserAgent ua;
private String sessionKeyUsername;
private LocaleResolver localeResolver;
private boolean disableCors;
private boolean disableCsrf;
private Boolean hasTemplate;
private $.Visitor<H.Format> templateChangeListener;
private H.Status forceResponseStatus;
private boolean cacheEnabled;
private MissingAuthenticationHandler forceMissingAuthenticationHandler;
private MissingAuthenticationHandler forceCsrfCheckingFailureHandler;
private String urlContext;
private boolean byPassImplicitTemplateVariable;
private int pathVarCount;
private UrlPath urlPath;
private Set<String> pathVarNames = new HashSet<>();
private SessionManager sessionManager;
// -- replace attributres with fields -- perf tune
// -- ATTR_CSRF_PREFETCHED
private String csrfPrefetched;
public void setCsrfPrefetched(String csrf) {
csrfPrefetched = csrf;
}
public String csrfPrefetched() {
return csrfPrefetched;
}
public void clearCsrfPrefetched() {
csrfPrefetched = null;
}
// -- ATTR_WAS_UNAUTHENTICATED
private boolean wasUnauthenticated;
public boolean wasUnauthenticated() {
return wasUnauthenticated;
}
public void setWasUnauthenticated() {
wasUnauthenticated = true;
}
public void clearWasUnauthenticated() {
wasUnauthenticated = false;
}
// -- ATTR_HANDLER
// replaced with field handler
// -- ATTR_RESULT
private Result result;
public Result result() {
return result;
}
public void setResult(Result result) {
this.result = result;
}
@Inject
private ActionContext(App app, H.Request request, ActResponse<?> response) {
super(app, true);
E.NPE(app, request, response);
request.context(this);
response.context(this);
this.request = request;
this.response = response;
this._init();
this.state = State.CREATED;
AppConfig config = app.config();
this.disableCors = !config.corsEnabled();
this.disableCsrf = req().method().safe();
this.sessionKeyUsername = config.sessionKeyUsername();
this.localeResolver = new LocaleResolver(this);
this.sessionManager = app.sessionManager();
}
public State state() {
return state;
}
public boolean isSessionDissolved() {
return state == State.SESSION_DISSOLVED;
}
public boolean isSessionResolved() {
return state == State.SESSION_RESOLVED;
}
public H.Request req() {
return request;
}
public ActResponse<?> resp() {
return response;
}
public ActResponse<?> prepareRespForWrite() {
response.markReady();
return response;
}
public H.Cookie cookie(String name) {
return req().cookie(name);
}
public H.Session session() {
return session;
}
public String session(String key) {
return session.get(key);
}
public H.Session session(String key, String value) {
return session.put(key, value);
}
/**
* Returns HTTP session's id
* @return HTTP session id
*/
public String sessionId() {
return session().id();
}
public H.Flash flash() {
return flash;
}
public String flash(String key) {
return flash.get(key);
}
public H.Flash flash(String key, String value) {
return flash.put(key, value);
}
public Router router() {
return router;
}
public ActionContext router(Router router) {
this.router = $.notNull(router);
return this;
}
public MissingAuthenticationHandler missingAuthenticationHandler() {
if (null != forceMissingAuthenticationHandler) {
return forceMissingAuthenticationHandler;
}
return isAjax() ? config().ajaxMissingAuthenticationHandler() : config().missingAuthenticationHandler();
}
public MissingAuthenticationHandler csrfFailureHandler() {
if (null != forceCsrfCheckingFailureHandler) {
return forceCsrfCheckingFailureHandler;
}
return isAjax() ? config().ajaxCsrfCheckFailureHandler() : config().csrfCheckFailureHandler();
}
public ActionContext forceMissingAuthenticationHandler(MissingAuthenticationHandler handler) {
this.forceMissingAuthenticationHandler = handler;
return this;
}
public ActionContext forceCsrfCheckingFailureHandler(MissingAuthenticationHandler handler) {
this.forceCsrfCheckingFailureHandler = handler;
return this;
}
public ActionContext byPassImplicitVariable() {
this.byPassImplicitTemplateVariable = true;
return this;
}
public boolean isByPassImplicitTemplateVariable() {
return this.byPassImplicitTemplateVariable;
}
public ActionContext urlContext(String context) {
this.urlContext = context;
return this;
}
public String urlContext() {
return urlContext;
}
/**
* Return a {@link UrlPath} of this context.
*
* Note this method is used only by {@link Router} for dynamic path
* matching.
*
* @return a {@link UrlPath} of this context
*/
public UrlPath urlPath() {
if (null == urlPath) {
urlPath = UrlPath.of(req().path());
}
return urlPath;
}
// !!!IMPORTANT! the following methods needs to be kept to allow enhancer work correctly
@Override
public <T> T renderArg(String name) {
return super.renderArg(name);
}
@Override
public ActionContext renderArg(String name, Object val) {
return super.renderArg(name, val);
}
@Override
public Map<String, Object> renderArgs() {
return super.renderArgs();
}
@Override
public ActionContext templatePath(String templatePath) {
hasTemplate = null;
if (null != templateChangeListener) {
templateChangeListener.visit(accept());
}
return super.templatePath(templatePath);
}
@Override
public ActionContext templateLiteral(String literal) {
// Need to declare this method for bytecode enhancement
return super.templateLiteral(literal);
}
public ActionContext templateChangeListener($.Visitor<H.Format> listener) {
this.templateChangeListener = $.notNull(listener);
return this;
}
public RequestHandler handler() {
return handler;
}
public ActionContext handler(RequestHandler handler) {
E.NPE(handler);
this.handler = handler;
return this;
}
public H.Format accept() {
return req().accept();
}
public ActionContext accept(H.Format fmt) {
req().accept(fmt);
return this;
}
public Boolean hasTemplate() {
return hasTemplate;
}
public ActionContext setHasTemplate(boolean b) {
hasTemplate = b;
return this;
}
public ActionContext enableCache() {
E.illegalArgumentIf(this.cacheEnabled, "cache already enabled in the action context");
this.cacheEnabled = true;
this.response = new ResponseCache(response);
return this;
}
public int pathVarCount() {
return pathVarCount;
}
public boolean isPathVar(String name) {
return pathVarNames.contains(name);
}
public String portId() {
return router().portId();
}
public int port() {return router().port(); }
public UserAgent userAgent() {
if (null == ua) {
ua = UserAgent.parse(req().header(H.Header.Names.USER_AGENT));
}
return ua;
}
public boolean jsonEncoded() {
return req().contentType() == H.Format.JSON;
}
public boolean acceptJson() {
return accept() == H.Format.JSON;
}
public boolean acceptXML() {
return accept() == H.Format.XML;
}
public boolean isAjax() {
return req().isAjax();
}
public boolean isOptionsMethod() {
return req().method() == H.Method.OPTIONS;
}
public String username() {
return session().get(sessionKeyUsername);
}
public boolean isLoggedIn() {
return S.notBlank(username());
}
public String body() {
return paramVal(REQ_BODY);
}
public ActionContext param(String name, String value) {
extraParams.put(name, value);
return this;
}
public ActionContext urlPathParam(String name, String value) {
pathVarCount++;
pathVarNames.add(name);
return param(name, value);
}
@Override
public Set<String> paramKeys() {
Set<String> set = new HashSet<String>();
set.addAll(C.<String>list(request.paramNames()));
set.addAll(extraParams.keySet());
set.addAll(bodyParams().keySet());
return set;
}
@Override
public String paramVal(String name) {
String val = extraParams.get(name);
if (null != val) {
return val;
}
val = request.paramVal(name);
if (null == val) {
String[] sa = getBody(name);
if (null != sa && sa.length > 0) {
val = sa[0];
}
}
return val;
}
public String[] paramVals(String name) {
String val = extraParams.get(name);
if (null != val) {
return new String[]{val};
}
String[] sa = request.paramVals(name);
return null == sa ? getBody(name) : sa;
}
private String[] getBody(String name) {
Map<String, String[]> body = bodyParams();
String[] sa = body.get(name);
return null == sa ? new String[0] : sa;
}
private Map<String, String[]> bodyParams() {
if (null == bodyParams) {
Map<String, String[]> map = new HashMap<>();
H.Method method = request.method();
if (H.Method.POST == method || H.Method.PUT == method || H.Method.PATCH == method) {
RequestBodyParser parser = RequestBodyParser.get(request);
map = parser.parse(this);
}
bodyParams = map;
}
return bodyParams;
}
public Map<String, String[]> allParams() {
return allParams;
}
public ISObject upload(String name) {
Integer index = attribute(ATTR_CURRENT_FILE_INDEX);
if (null == index) {
index = 0;
}
return upload(name, index);
}
public ISObject upload(String name, int index) {
body();
ISObject[] a = uploads.get(name);
return null != a && a.length > index ? a[index] : null;
}
public ActionContext addUpload(String name, ISObject sobj) {
ISObject[] a = uploads.get(name);
if (null == a) {
a = new ISObject[1];
a[0] = sobj;
} else {
ISObject[] newA = new ISObject[a.length + 1];
System.arraycopy(a, 0, newA, 0, a.length);
newA[a.length] = sobj;
a = newA;
}
uploads.put(name, a);
return this;
}
public H.Status successStatus() {
if (null != forceResponseStatus) {
return forceResponseStatus;
}
return H.Method.POST == req().method() ? H.Status.CREATED : H.Status.OK;
}
public ActionContext forceResponseStatus(H.Status status) {
this.forceResponseStatus = $.notNull(status);
return this;
}
public Result nullValueResult() {
if (hasRenderArgs()) {
RenderAny result = new RenderAny();
if (renderArgs().size() == fieldOutputVarCount() && req().isAjax()) {
result.ignoreMissingTemplate();
}
return result;
}
return nullValueResultIgnoreRenderArgs();
}
public Result nullValueResultIgnoreRenderArgs() {
if (null != forceResponseStatus) {
return new Result(forceResponseStatus){};
} else {
if (req().method() == H.Method.POST) {
H.Format accept = accept();
if (H.Format.JSON == accept) {
return CREATED_JSON;
} else if (H.Format.XML == accept) {
return CREATED_XML;
} else {
return CREATED;
}
} else {
return NO_CONTENT;
}
}
}
public void preCheckCsrf() {
if (!disableCsrf) {
handler().csrfSpec().preCheck(this);
}
}
public void checkCsrf(H.Session session) {
if (!disableCsrf) {
handler().csrfSpec().check(this, session);
}
}
public void setCsrfCookieAndRenderArgs() {
handler().csrfSpec().setCookieAndRenderArgs(this);
}
public void disableCORS() {
this.disableCors = true;
}
/**
* Apply content type to response with result provided.
*
* If `result` is an error then it might not apply content type as requested:
* * If request is not ajax request, then use `text/html`
* * If request is ajax request then apply requested content type only when `json` or `xml` is requested
* * otherwise use `text/html`
*
* @param result
* the result used to check if it is error result
* @return
* this `ActionContext`.
*/
public ActionContext applyContentType(Result result) {
if (!result.status().isError()) {
return applyContentType();
}
if (req().isAjax()) {
H.Request req = req();
H.Format fmt = req.accept();
if (H.Format.UNKNOWN == fmt) {
fmt = req.contentType();
}
if (H.Format.JSON == fmt || H.Format.XML == fmt) {
applyContentType(fmt);
} else {
applyContentType(H.Format.HTML);
}
} else {
applyContentType(H.Format.HTML);
}
return this;
}
public ActionContext applyContentType() {
ActResponse resp = resp();
H.Format lastContentType = resp.lastContentType();
if (null != lastContentType && $.ne(H.Format.UNKNOWN, lastContentType)) {
resp.commitContentType();
return this;
}
H.Request req = req();
H.Format fmt = req.accept();
if (H.Format.UNKNOWN == fmt) {
fmt = req.contentType();
}
applyContentType(fmt);
return this;
}
public ActionContext applyCorsSpec() {
RequestHandler handler = handler();
if (null != handler) {
CORS.Spec spec = handler.corsSpec();
spec.applyTo(this);
}
applyGlobalCorsSetting();
return this;
}
public ActionContext applyContentSecurityPolicy() {
RequestHandler handler = handler();
if (null != handler) {
boolean disableCSP = handler.disableContentSecurityPolicy();
if (disableCSP) {
return this;
}
String csp = handler.contentSecurityPolicy();
if (S.notBlank(csp)) {
H.Response resp = resp();
resp.addHeaderIfNotAdded(CONTENT_SECURITY_POLICY, csp);
}
}
applyGlobalCspSetting();
return this;
}
private void applyContentType(H.Format fmt) {
if (null != fmt) {
ActResponse resp = resp();
resp.initContentType(fmt.contentType());
resp.commitContentType();
}
}
private void applyGlobalCspSetting() {
String csp = config().contentSecurityPolicy();
if (S.blank(csp)) {
return;
}
H.Response r = resp();
r.addHeaderIfNotAdded(CONTENT_SECURITY_POLICY, csp);
}
private void applyGlobalCorsSetting() {
if (this.disableCors) {
return;
}
AppConfig conf = config();
if (!conf.corsEnabled()) {
return;
}
H.Response r = resp();
r.addHeaderIfNotAdded(ACCESS_CONTROL_ALLOW_ORIGIN, conf.corsAllowOrigin());
if (request.method() == H.Method.OPTIONS || !conf.corsOptionCheck()) {
r.addHeaderIfNotAdded(ACCESS_CONTROL_ALLOW_HEADERS, conf.corsAllowHeaders());
r.addHeaderIfNotAdded(ACCESS_CONTROL_ALLOW_CREDENTIALS, S.string(conf.corsAllowCredentials()));
r.addHeaderIfNotAdded(ACCESS_CONTROL_EXPOSE_HEADERS, conf.corsExposeHeaders());
r.addHeaderIfNotAdded(ACCESS_CONTROL_MAX_AGE, S.string(conf.corsMaxAge()));
}
}
/**
* Called by bytecode enhancer to set the name list of the render arguments that is update
* by the enhancer
*
* @param names the render argument names separated by ","
* @return this AppContext
*/
public ActionContext __appRenderArgNames(String names) {
return renderArg("__arg_names__", C.listOf(names.split(",")));
}
public List<String> __appRenderArgNames() {
return renderArg("__arg_names__");
}
public ActionContext __controllerInstance(String className, Object instance) {
if (null == controllerInstances) {
controllerInstances = new HashMap<>();
}
controllerInstances.put(className, instance);
return this;
}
public Object __controllerInstance(String className) {
return null == controllerInstances ? null : controllerInstances.get(className);
}
/**
* Return cached object by key. The key will be concatenated with
* current session id when fetching the cached object
*
* @param key
* @param <T> the object type
* @return the cached object
*/
public <T> T cached(String key) {
H.Session sess = session();
if (null != sess) {
return sess.cached(key);
} else {
return app().cache().get(key);
}
}
/**
* Add an object into cache by key. The key will be used in conjunction with session id if
* there is a session instance
*
* @param key the key to index the object within the cache
* @param obj the object to be cached
*/
public void cache(String key, Object obj) {
H.Session sess = session();
if (null != sess) {
sess.cache(key, obj);
} else {
app().cache().put(key, obj);
}
}
/**
* Add an object into cache by key with expiration time specified
*
* @param key the key to index the object within the cache
* @param obj the object to be cached
* @param expiration the seconds after which the object will be evicted from the cache
*/
public void cache(String key, Object obj, int expiration) {
H.Session session = this.session;
if (null != session) {
session.cache(key, obj, expiration);
} else {
app().cache().put(key, obj, expiration);
}
}
/**
* Add an object into cache by key and expired after one hour
*
* @param key the key to index the object within the cache
* @param obj the object to be cached
*/
public void cacheForOneHour(String key, Object obj) {
cache(key, obj, 60 * 60);
}
/**
* Add an object into cache by key and expired after half hour
*
* @param key the key to index the object within the cache
* @param obj the object to be cached
*/
public void cacheForHalfHour(String key, Object obj) {
cache(key, obj, 30 * 60);
}
/**
* Add an object into cache by key and expired after 10 minutes
*
* @param key the key to index the object within the cache
* @param obj the object to be cached
*/
public void cacheForTenMinutes(String key, Object obj) {
cache(key, obj, 10 * 60);
}
/**
* Add an object into cache by key and expired after one minute
*
* @param key the key to index the object within the cache+
* @param obj the object to be cached
*/
public void cacheForOneMinute(String key, Object obj) {
cache(key, obj, 60);
}
/**
* Evict cached object
*
* @param key the key indexed the cached object to be evicted
*/
public void evictCache(String key) {
H.Session sess = session();
if (null != sess) {
sess.evict(key);
} else {
app().cache().evict(key);
}
}
public S.Buffer buildViolationMessage(S.Buffer builder) {
return buildViolationMessage(builder, "\n");
}
public S.Buffer buildViolationMessage(S.Buffer builder, String separator) {
Map<String, ConstraintViolation> violations = violations();
if (violations.isEmpty()) return builder;
for (Map.Entry<String, ConstraintViolation> entry : violations.entrySet()) {
builder.append(entry.getKey()).append(": ").append(entry.getValue().getMessage()).append(separator);
}
int n = builder.length();
builder.delete(n - separator.length(), n);
return builder;
}
public String violationMessage(String separator) {
return buildViolationMessage(S.newBuffer(), separator).toString();
}
public String violationMessage() {
return violationMessage("\n");
}
public ActionContext flashViolationMessage() {
return flashViolationMessage("\n");
}
public ActionContext flashViolationMessage(String separator) {
if (violations().isEmpty()) return this;
flash().error(violationMessage(separator));
return this;
}
public String actionPath() {
return actionPath;
}
public ActionContext actionPath(String path) {
actionPath = path;
return this;
}
@Override
public String methodPath() {
return actionPath;
}
public void startIntercepting() {
state = State.INTERCEPTING;
}
public void startHandling() {
state = State.HANDLING;
}
/**
* Update the context session to mark a user logged in
* @param username the username
*/
public void login(String username) {
session().put(config().sessionKeyUsername(), username);
}
/**
* Login the user and redirect back to original URL
* @param username
* the username
*/
public void loginAndRedirectBack(String username) {
login(username);
RedirectToLoginUrl.redirectToOriginalUrl(this);
}
/**
* Login the user and redirect back to original URL. If no
* original URL found then redirect to `defaultLandingUrl`.
*
* @param username
* The username
* @param defaultLandingUrl
* the URL to be redirected if original URL not found
*/
public void loginAndRedirectBack(String username, String defaultLandingUrl) {
login(username);
RedirectToLoginUrl.redirectToOriginalUrl(this, defaultLandingUrl);
}
/**
* Login the user and redirect to specified URL
* @param username
* the username
* @param url
* the URL to be redirected to
*/
public void loginAndRedirect(String username, String url) {
login(username);
redirect(url);
}
/**
* Logout the current session. After calling this method,
* the session will be cleared
*/
public void logout() {
session().clear();
}
/**
* Initialize params/renderArgs/attributes and then
* resolve session and flash from cookies
*/
public void resolve() {
E.illegalStateIf(state != State.CREATED);
boolean sessionFree = handler.sessionFree();
setWasUnauthenticated();
H.Request req = req();
if (!sessionFree) {
resolveSession(req);
app().eventBus().emit(new PreFireSessionResolvedEvent(session, this));
resolveFlash(req);
}
localeResolver.resolve();
state = State.SESSION_RESOLVED;
if (!sessionFree) {
handler.prepareAuthentication(this);
app().eventBus().emit(new SessionResolvedEvent(session, this));
if (isLoggedIn()) {
clearWasUnauthenticated();
}
}
}
@Override
public Locale locale(boolean required) {
if (required) {
if (null == locale()) {
localeResolver.resolve();
}
}
return super.locale(required);
}
/**
* Dissolve session and flash into cookies.
* <p><b>Note</b> this method must be called
* before any content has been committed to
* response output stream/writer</p>
*/
public void dissolve() {
if (state == State.SESSION_DISSOLVED) {
return;
}
if (handler.sessionFree()) {
return;
}
if (null == session) {
// only case is when CSRF token check failed
// while resolving session
// we need to generate new session anyway
// because it is required to cache the
// original URL
// see RedirectToLoginUrl
session = new H.Session();
}
localeResolver.dissolve();
app().eventBus().emit(new SessionWillDissolveEvent(this));
try {
setCsrfCookieAndRenderArgs();
sessionManager.dissolveState(session(), flash(), resp());
// dissolveFlash();
// dissolveSession();
state = State.SESSION_DISSOLVED;
} finally {
app().eventBus().emit(new SessionDissolvedEvent(this));
}
}
/**
* Clear all internal data store/cache and then
* remove this context from thread local
*/
@Override
protected void releaseResources() {
super.releaseResources();
PropertySpec.current.remove();
if (this.state != State.DESTROYED) {
this.allParams = null;
this.extraParams = null;
this.requestParamCache = null;
this.router = null;
this.handler = null;
// xio impl might need this this.request = null;
// xio impl might need this this.response = null;
this.flash = null;
this.session = null;
this.controllerInstances = null;
this.result = null;
this.uploads.clear();
ActionContext.clearLocal();
}
this.state = State.DESTROYED;
}
@Override
public Class<? extends Annotation> scope() {
return RequestScoped.class;
}
public void saveLocal() {
_local.set(this);
}
public static void clearLocal() {
clearCurrent();
}
private Set<Map.Entry<String, String[]>> requestParamCache() {
if (null != requestParamCache) {
return requestParamCache;
}
requestParamCache = new HashSet<>();
Map<String, String[]> map = new HashMap<>();
// url queries
Iterator<String> paramNames = request.paramNames().iterator();
while (paramNames.hasNext()) {
final String key = paramNames.next();
final String[] val = request.paramVals(key);
MapUtil.mergeValueInMap(map, key, val);
}
// post bodies
Map<String, String[]> map2 = bodyParams();
for (String key : map2.keySet()) {
String[] val = map2.get(key);
if (null != val) {
MapUtil.mergeValueInMap(map, key, val);
}
}
requestParamCache.addAll(map.entrySet());
return requestParamCache;
}
private void _init() {
uploads = new HashMap<>();
extraParams = new HashMap<>();
final Set<Map.Entry<String, String[]>> paramEntrySet = new AbstractSet<Map.Entry<String, String[]>>() {
@Override
public Iterator<Map.Entry<String, String[]>> iterator() {
final Iterator<Map.Entry<String, String[]>> extraItr = new Iterator<Map.Entry<String, String[]>>() {
Iterator<Map.Entry<String, String>> parent = extraParams.entrySet().iterator();
@Override
public boolean hasNext() {
return parent.hasNext();
}
@Override
public Map.Entry<String, String[]> next() {
final Map.Entry<String, String> parentEntry = parent.next();
return new Map.Entry<String, String[]>() {
@Override
public String getKey() {
return parentEntry.getKey();
}
@Override
public String[] getValue() {
return new String[]{parentEntry.getValue()};
}
@Override
public String[] setValue(String[] value) {
throw E.unsupport();
}
};
}
@Override
public void remove() {
throw E.unsupport();
}
};
final Iterator<Map.Entry<String, String[]>> reqParamItr = requestParamCache().iterator();
return new Iterator<Map.Entry<String, String[]>>() {
@Override
public boolean hasNext() {
return extraItr.hasNext() || reqParamItr.hasNext();
}
@Override
public Map.Entry<String, String[]> next() {
if (extraItr.hasNext()) return extraItr.next();
return reqParamItr.next();
}
@Override
public void remove() {
throw E.unsupport();
}
};
}
@Override
public int size() {
int size = extraParams.size();
if (null != request) {
size += requestParamCache().size();
}
return size;
}
};
allParams = new AbstractMap<String, String[]>() {
@Override
public Set<Entry<String, String[]>> entrySet() {
return paramEntrySet;
}
};
}
private void resolveSession(H.Request req) {
preCheckCsrf();
//this.session = Act.sessionManager().resolveSession(this);
session = sessionManager.resolveSession(req);
checkCsrf(session);
}
private void resolveFlash(H.Request req) {
//this.flash = Act.sessionManager().resolveFlash(this);
flash = sessionManager.resolveFlash(req);
}
// private void dissolveSession() {
// Cookie c = Act.sessionManager().dissolveSession(this);
// if (null != c) {
// config().sessionMapper().serializeSession(c, this);
// }
// }
//
// private void dissolveFlash() {
// Cookie c = Act.sessionManager().dissolveFlash(this);
// if (null != c) {
// config().sessionMapper().serializeFlash(c, this);
// }
// }
//
private static ContextLocal<ActionContext> _local = $.contextLocal();
public static final String METHOD_GET_CURRENT = "current";
public static ActionContext current() {
return _local.get();
}
public static void clearCurrent() {
_local.remove();
}
/**
* Create an new {@code AppContext} and return the new instance
*/
public static ActionContext create(App app, H.Request request, ActResponse<?> resp) {
return new ActionContext(app, request, resp);
}
public enum State {
CREATED,
SESSION_RESOLVED,
SESSION_DISSOLVED,
INTERCEPTING,
HANDLING,
DESTROYED;
public boolean isHandling() {
return this == HANDLING;
}
public boolean isIntercepting() {
return this == INTERCEPTING;
}
}
public static class ActionContextEvent extends ActEvent<ActionContext> implements SystemEvent {
public ActionContextEvent(ActionContext source) {
super(source);
}
public ActionContext context() {
return source();
}
}
private static class SessionEvent extends ActionContextEvent {
private H.Session session;
public SessionEvent(H.Session session, ActionContext source) {
super(source);
this.session = session;
}
public H.Session session() {
return session;
}
}
/**
* This event is fired after session resolved and before
* context state changed to {@link State#SESSION_RESOLVED}
* and in turn before {@link SessionResolvedEvent} is fired.
*/
public static class PreFireSessionResolvedEvent extends SessionEvent {
public PreFireSessionResolvedEvent(H.Session session, ActionContext context) {
super(session, context);
}
@Override
public Class<? extends ActEvent<ActionContext>> eventType() {
return PreFireSessionResolvedEvent.class;
}
}
/**
* This event is fired after session resolved after
* all event listeners that listen to the
* {@link PreFireSessionResolvedEvent} get notified.
*/
public static class SessionResolvedEvent extends SessionEvent {
public SessionResolvedEvent(H.Session session, ActionContext context) {
super(session, context);
}
@Override
public Class<? extends ActEvent<ActionContext>> eventType() {
return SessionResolvedEvent.class;
}
}
public static class SessionWillDissolveEvent extends ActionContextEvent {
public SessionWillDissolveEvent(ActionContext source) {
super(source);
}
@Override
public Class<? extends ActEvent<ActionContext>> eventType() {
return SessionWillDissolveEvent.class;
}
}
public static class SessionDissolvedEvent extends ActionContextEvent {
public SessionDissolvedEvent(ActionContext source) {
super(source);
}
@Override
public Class<? extends ActEvent<ActionContext>> eventType() {
return SessionDissolvedEvent.class;
}
}
}
| [
"greenlaw110@gmail.com"
] | greenlaw110@gmail.com |
fee257d1c0fb6ff8506a7c4a9f544d83f91c1e22 | 58b456dc4f9165c0b3aa71e0a0e6b3e77cd3bf2c | /Prac/src/prinHundred.java | b4aca9217878cff7d0d0630b1c7fbe8ed21f18b2 | [] | no_license | sm2701/AllPractise | 5b1e96d25c0299ac2c0e4a13e64f479731177f38 | 1c7178138acd90c79051aa1e3035d7a60cc38a8a | refs/heads/master | 2020-04-18T07:58:36.835223 | 2019-05-24T11:43:53 | 2019-05-24T11:43:53 | 167,379,396 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 440 | java | import java.util.Scanner;
public class prinHundred {
public void showHundred(int nums){
if(nums > 00) {
showHundred(nums-1);
System.out.println(nums);
}
return ;
}
public static void main(String [] args) {
System.out.println("please enter a number");
@SuppressWarnings("resource")
Scanner sc=new Scanner(System.in);
int nums=sc.nextInt();
prinHundred p=new prinHundred();
p.showHundred(nums);
}
}
| [
"s2701m@gmail.com"
] | s2701m@gmail.com |
1cb60716e98d830bd3f536d082d8d866b60df96d | 674eb423ef145a9f1b9ed8c23569cc39fcef3868 | /Print1.java | 78459f7850b71a0ab20d19084153c9dc41a3f0c7 | [] | no_license | Poorva17/FirstJava | 5dd0353aeb64d418e7cc093d8b3630c5da21f442 | 4ff013df2d1950409ad02c8a021e9ddcfbc808f7 | refs/heads/master | 2021-05-04T18:01:22.095822 | 2018-03-15T11:06:47 | 2018-03-15T11:06:47 | 38,606,952 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 138 | java | import java.io.*;
public class Print1
{
public static void main(String[] args)
{
FirstJava J=new FirstJava();
J.print();
}
}
| [
"gokhale@ubuntu.ubuntu-domain"
] | gokhale@ubuntu.ubuntu-domain |
693aa2fb96df9113f5a58ea279427fe242b19770 | 837015d72664f2063603c0ced91e0724dbf61c05 | /src/schoolmanagementservices/ProgramManagement.java | e25e7698d54494e24b029fe484a528f45a9d527b | [] | no_license | sleam91/SchoolManagementVersion2 | a70b56dd29049fec45defc0de96861417ffe4a10 | b87f34233b731a0aa451c6ff674371eb63e66b83 | refs/heads/master | 2020-12-26T23:24:00.649871 | 2020-04-22T13:33:42 | 2020-04-22T13:33:42 | 237,684,670 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,693 | java | package schoolmanagementservices;
import entities.Course;
import entities.Program;
import entities.Student;
import integration.ProgramDAO;
import view.UI;
public class ProgramManagement {
ProgramDAO daoProgram;
UI ui;
StudentManagement student;
CourseManagement course;
public ProgramManagement(ProgramDAO programDAOImpl, UI ui) {
daoProgram = programDAOImpl;
this.ui = ui;
}
public void setStudent(StudentManagement student) {
this.student = student;
}
public void setCourse(CourseManagement course) {
this.course = course;
}
public Program findByNameOrID() {
String input = ui.inputString();
if (input.isEmpty()) {
ui.outputString("Cancelled, no input detected");
return null;
}
if (daoProgram.findByNameOrID(input).count() > 1) {
daoProgram.findByNameOrID(input).forEach(ui::printResult);
ui.outputString("\nMore than one result.\nEnter ID of Program instead or search for another Program:");
return findByNameOrID();
}
Program p = daoProgram.findByNameOrID(input).findFirst().orElse(null);
if (p != null) {
showDetailedInfo(p);
} else {
ui.outputString("No result found");
}
return p;
}
public void showDetailedInfo(Program p) {
ui.printResult(p);
ui.outputString("\nCurrent Courses:");
p.getCourseList().forEach(ui::printResult);
ui.outputString("\nCurrent Students:");
p.getStudentList().forEach(ui::printResult);
}
public void showAll() {
daoProgram.findAll().sorted((e1, e2) -> e1.getId() - e2.getId()).forEach(ui::printResult);
}
public Program add() {
ui.outputString("Enter Program name:");
String name = ui.inputString();
if (name.isEmpty()) {
ui.outputString("Cancelled, no input detected");
return null;
} else if (daoProgram.findByName(name).anyMatch(pr -> pr.getName().equalsIgnoreCase(name))) {
ui.outputString("A Program with that name already exists, choose another name");
return add();
} else if (name.matches("^[0-9]\\d*$")) {
ui.outputString("Program name cannot be only numbers, try again");
return add();
}
ui.outputString("Enter Program Start Date (yyyy-mm-dd):");
String startDate = ui.inputDate();
ui.outputString("Enter Program End Date (yyyy-mm-dd):");
String endDate = ui.inputDate();
Program p = new Program(name, startDate, endDate);
daoProgram.create(p);
ui.outputString("Program created");
return p;
}
public void update(String choice) {
ui.outputString("Enter Name or ID of Program to Update:");
Program p = findByNameOrID();
if (p == null) {
if (choice.equals("addStudents") || choice.equals("addCourses")) {
ui.pressEnterToContinue();
}
return;
}
switch (choice) {
case "updateName":
updateName(p);
break;
case "addStudents":
addStudents(p);
break;
case "removeStudent":
removeStudent(p);
break;
case "addCourses":
addCourses(p);
break;
case "removeCourse":
removeCourse(p);
break;
case "updateStartDate":
ui.outputString("Enter new Start Date (yyyy-mm-dd):");
p.setStartDate(ui.inputDate());
ui.outputString("Program Start Date updated");
break;
case "updateEndDate":
ui.outputString("Enter new End Date (yyyy-mm-dd):");
p.setEndDate(ui.inputDate());
ui.outputString("Program End Date updated");
break;
}
daoProgram.update(p);
}
public void updateName(Program p) {
ui.outputString("Enter new Program name:");
String name = ui.inputString();
if (name.isEmpty()) {
ui.outputString("Cancelled, no input detected");
} else if (daoProgram.findByName(name).anyMatch(pr -> pr.getName().equalsIgnoreCase(name))) {
ui.outputString("A Program with that name already exists, choose another name");
} else if (name.matches("^[0-9]\\d*$")) {
ui.outputString("Program name cannot be only numbers, try again");
} else {
p.setName(name);
ui.outputString("Program Name updated");
}
}
public void delete() {
ui.outputString("Enter Name or ID of Program to Delete:");
Program p = findByNameOrID();
if (p != null) {
daoProgram.delete(p);
ui.outputString(p.getName() + " removed successfully from Programs");
}
}
private void addStudents(Program p) {
String input = "Y";
while (input.equalsIgnoreCase("Y")) {
ui.outputString("\nList of available Students:");
student.showAll();
ui.outputString("\nEnter Name or ID of Student to add to Program:");
Student s = student.findByNameOrID();
if (s == null) {
ui.outputString("Create new Student? (Y/N)");
input = ui.inputString();
ui.clear();
if (input.equalsIgnoreCase("Y")) {
s = student.add();
} else {
return;
}
}
if (s != null) {
if (p.getStudentList().contains(s)) {
ui.outputString("\nStudent " + s.getName() + " already added");
} else {
p.getStudentList().add(s);
s.setProgram(p);
student.daoStudent.update(s);
ui.outputString("\nStudent " + s.getName() + " added to Program " + p.getName());
}
}
ui.outputString("Add another student? (Y/N)");
input = ui.inputString();
ui.clear();
}
}
private void removeStudent(Program p) {
ui.outputString("Enter Name or ID of Student to Remove from Program:");
Student s = student.findByNameOrID();
if (s != null) {
p.getStudentList().remove(s);
s.setProgram(null);
student.daoStudent.update(s);
ui.outputString("Student removed from Program " + p.getName());
}
}
private void addCourses(Program p) {
String input = "Y";
while (input.equalsIgnoreCase("Y")) {
ui.outputString("\nList of available Courses:");
course.showAll();
ui.outputString("\nEnter Name or ID of Course to add to Program:");
Course c = course.findByNameOrID();
if (c == null) {
ui.outputString("Create new Course? (Y/N)");
input = ui.inputString();
ui.clear();
if (input.equalsIgnoreCase("Y")) {
c = course.add();
} else {
return;
}
}
if (c != null && c.getProgram() == null) {
String name = c.getName();
if (p.getCourseList().stream().anyMatch(e -> e.getName().equalsIgnoreCase(name))) {
ui.outputString("\nA Course with that name already exists in Program " + p.getName());
} else {
p.getCourseList().add(c);
c.setProgram(p);
course.daoCourse.update(c);
ui.outputString("\nCourse " + c.getName() + " added to Program " + p.getName());
}
} else if (c != null) {
ui.outputString("Course " + c.getName() + " already added to another Program, cannot add to this Program");
}
ui.outputString("Add another course? (Y/N)");
input = ui.inputString();
ui.clear();
}
}
private void removeCourse(Program p) {
ui.outputString("Enter Name or ID of Course to Remove from Program:");
Course c = course.findByNameOrID();
if (c != null) {
p.getCourseList().remove(c);
c.setProgram(null);
course.daoCourse.update(c);
ui.outputString("Course removed from Program " + p.getName());
}
}
}
| [
"sleam@192.168.0.28"
] | sleam@192.168.0.28 |
57e4ae7cb9f6d5f457d7ecccbd4103d2a6bd2971 | acd42fb76daf9ffb6d5b810672b4f4062e74ad7f | /src/SeleniumTasksPDF6/VerifyElementIsClickable.java | c0cc87d2079e62c70ac481617e743ebe269d10d9 | [] | no_license | HaticeBatur/Selenium-Tasks | ee442cdb1b60ac986f2798a5411389391dea3aee | d1cad7c6c9013a0bd1cc0831fe8a3d0354702732 | refs/heads/master | 2020-12-04T18:24:18.237030 | 2020-02-04T03:42:24 | 2020-02-04T03:42:24 | 231,865,667 | 0 | 0 | null | null | null | null | WINDOWS-1252 | Java | false | false | 1,606 | java | package SeleniumTasksPDF6;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import com.utils.CommonMethods;
import com.utils.Constants;
public class VerifyElementIsClickable extends CommonMethods{
/*
* TC 2: Verify element is clickable
Open chrome browser
Go to “https://the-internet.herokuapp.com/”
Click on “Click on the “Dynamic Controls” link
Select checkbox and click Remove
Click on Add button and verify “It’s back!” text is displayed
Close the browser
*/
public static void main(String[] args) {
setUp("chrome", Constants.welcomeToTheInternet_URL);
driver.findElement(By.linkText("Dynamic Controls")).click();
driver.findElement(By.xpath("//input[@type='checkbox']")).click();
driver.findElement(By.xpath("//button[@type='button' and text()='Remove']")).click();
WebDriverWait wait=new WebDriverWait(driver, 30);
wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//button[@type='button' and text()='Add']")));
driver.findElement(By.xpath("//button[@type='button' and text()='Add']")).click();
wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//button[@type='button' and text()='Remove']")));
WebElement text=driver.findElement(By.id("message"));
String expectedText="It's back!";
String actualText=text.getText();
System.out.println(actualText);
if(actualText.equals(expectedText)) {
System.out.println("Passed");
}else {
System.out.println("Failed");
}
driver.quit();
}
}
| [
"hb.baturhatice@gmail.com"
] | hb.baturhatice@gmail.com |
a0b71fad3782e387b20377e24137e5669ab6f533 | 7fba90634128bb137c74b5d313bbcf086fadf983 | /singletonPattern/src/main/java/mx/iteso/singleton/ThreadSafeSingleton.java | b29d84f6d77b539ad8729c1641a0f8aa149bb1be | [] | no_license | alexvigro92/-SingletonPattern | 666102c1f9b6af06ff20644c2e2736a5b0f18e36 | b27ec6c79124c07d476e9e3a2c729f3194602333 | refs/heads/master | 2021-01-10T14:26:45.414993 | 2015-10-28T22:25:17 | 2015-10-28T22:25:17 | 45,144,060 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,176 | java | package mx.iteso.singleton;
/**
* Created by mavg_ on 10/28/2015.
*/
/*The easier way to create a thread-safe singleton
class is to make the global access method synchronized,
so that only one thread can execute this method
at a time.
Above implementation works fine and provides thread-safety
but it reduces the performance because of cost associated
with the synchronized method, although we need it only for
the first few threads who might create the separate instances
the second one is the reduce performance*/
public class ThreadSafeSingleton {
private static ThreadSafeSingleton instance;
private ThreadSafeSingleton(){}
public static synchronized ThreadSafeSingleton getInstance(){
if(instance == null){
instance = new ThreadSafeSingleton();
}
return instance;
}
}
/*
public static ThreadSafeSingleton getInstanceUsingDoubleLocking(){
if(instance == null){
synchronized (ThreadSafeSingleton.class) {
if(instance == null){
instance = new ThreadSafeSingleton();
}
}
}
return instance;
}
*/ | [
"alexvigro92@gmail.com"
] | alexvigro92@gmail.com |
d1eca8299844ac04739aa06fd81eadb4c5dbf92e | 80b286d5d3a2a1d20107227ef596bc175bdfcf19 | /Implementation/7568 덩치.java | 3f0bfdac664f1f3082b014c84d3f412385fd79db | [] | no_license | madirony/BOJ | f798ab83a9a1aee28eb778003828b4ca398e4b71 | 9bb3d27b02e63f3cf82c54b52b9b1a2d160881d4 | refs/heads/master | 2023-03-05T01:44:47.914729 | 2021-02-08T08:47:18 | 2021-02-08T08:47:18 | 330,094,836 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,142 | java | package com.company;
import java.io.*;
import java.util.Arrays;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
int people = Integer.parseInt(br.readLine());
int[][] big = new int[people][2];
for(int i = 0; i < people; i++){
String[] split = br.readLine().split(" ");
big[i][0] = Integer.parseInt(split[0]);
big[i][1] = Integer.parseInt(split[1]);
}
int[] big_rank = new int[people];
Arrays.fill(big_rank,1);
for(int i = 0; i < people; i++){
for(int j = 0; j < people; j++) {
if(j!=i) {
if (big[i][0] < big[j][0] && big[i][1] < big[j][1]) {
big_rank[i]++;
}
}
}
}
for(int i = 0; i < people; i++){
bw.write(String.valueOf(big_rank[i]+" "));
}
bw.flush();
bw.close();
}
}
| [
"madirony52@naver.com"
] | madirony52@naver.com |
7fb6355d517ce114bc85e471f06a67c33d5e9d37 | 8cfe4c973a65636dae0379990bbb0de2d028009c | /app/src/main/java/com/example/retrocycler/SourceModel.java | d64b3ad64f9e87c0b7b70d1d9a091a4196f642f0 | [] | no_license | Kiran2233/Retrocycler | 97a4d47801a72326f7bc4e6e61660343d961a9b1 | 1d7df556ad26b0faa1f9a346337b814b25934633 | refs/heads/master | 2020-04-29T21:46:34.449381 | 2019-03-19T04:49:37 | 2019-03-19T04:49:37 | 176,423,340 | 0 | 0 | null | 2019-03-19T04:49:38 | 2019-03-19T04:25:43 | Java | UTF-8 | Java | false | false | 458 | java | package com.example.retrocycler;
import com.google.gson.annotations.SerializedName;
class SourceModel {
@SerializedName("id")
private String id;
@SerializedName("name")
private String name;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
| [
"kiran.virob@gmail.com"
] | kiran.virob@gmail.com |
8442c5f423d32e65d00e19d58b5f0f78363c8463 | abcd01c4c38be6047838b8df71741b1d3467105a | /spring/spring-data-example/src/test/java/com/examples/demo/IntegrationTestBase.java | 5fe01ac401541b1a9c6e71b53c191a379d27cc2b | [] | no_license | sdarioo/toys | 288c15f33f39715e27cce76468cc90c908ab3995 | 537abbe25e7eea62d1c1b6647461e9bef21ea818 | refs/heads/master | 2023-04-14T08:45:31.233963 | 2023-03-28T08:28:01 | 2023-03-28T08:28:01 | 47,557,133 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,829 | java | package com.examples.demo;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestPropertySource;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.TransactionStatus;
import org.springframework.transaction.support.DefaultTransactionDefinition;
import org.springframework.transaction.support.TransactionCallback;
import org.springframework.transaction.support.TransactionTemplate;
import com.examples.demo.config.AppConfig;
@ContextConfiguration(classes = {AppConfig.class, TestConfig.class})
@RunWith(SpringJUnit4ClassRunner.class)
@ActiveProfiles(Profiles.TEST_PROFILE)
@TestPropertySource(properties={"active.database=hsql"})
public abstract class IntegrationTestBase {
@Autowired
protected PlatformTransactionManager txManager;
@PersistenceContext
protected EntityManager em;
protected IntegrationTestBase() {}
protected void doInJPA(Runnable runnable) {
doInJPA(runnable, false);
}
protected void doInJPA(Runnable runnable, boolean readOnly) {
DefaultTransactionDefinition definition = new DefaultTransactionDefinition();
definition.setReadOnly(readOnly);
TransactionTemplate template = new TransactionTemplate(txManager, definition);
template.execute(new TransactionCallback<Void>() {
@Override
public Void doInTransaction(TransactionStatus status) {
runnable.run();
return null;
}
});
}
}
| [
"sdarioo@github.com"
] | sdarioo@github.com |
aeb08429d4fe751c8e6baa2d7db1666c6836433d | d290d743800f05617467a38379c4cc2755a948ef | /app/src/main/java/com/castoriqbal/masakgitu/JumlahBahanActivity.java | 98bbe217dd28452585e8ea6910ef9000524ddace | [] | no_license | muhakmal/MasakGitu | 4f7fec3703a1a956e533899d41752bf3a3c83ee4 | 6daf9c019c2a54a66d12cb4da9b90839d42168e0 | refs/heads/master | 2021-05-12T01:06:37.003826 | 2018-04-07T15:51:34 | 2018-04-07T15:51:34 | 117,551,433 | 0 | 0 | null | 2018-01-15T13:50:55 | 2018-01-15T13:50:54 | null | UTF-8 | Java | false | false | 3,104 | java | package com.castoriqbal.masakgitu;
import android.content.Intent;
import android.support.constraint.ConstraintLayout;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.LinearLayout;
import com.hariofspades.incdeclibrary.IncDecCircular;
import com.john.waveview.WaveView;
import com.simmorsal.recolor_project.ReColor;
import java.util.ArrayList;
public class JumlahBahanActivity extends AppCompatActivity {
ConstraintLayout constraintLayoutJumlahBahan;
WaveView waveView;
ReColor reColor;
IncDecCircular incDecCircular;
ArrayList<String> values = new ArrayList<>();
Button button;
Intent intent;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
getSupportActionBar().hide();
setContentView(R.layout.activity_jumlah_bahan);
intent = new Intent(this, FormBahanActivity.class);
constraintLayoutJumlahBahan = findViewById(R.id.constraint_layout_jumlah_bahan);
waveView = findViewById(R.id.wave_view_jumlah_bahan);
reColor = new ReColor(this);
reColor.setViewBackgroundColor(constraintLayoutJumlahBahan, "#"+Integer.toHexString(ContextCompat.getColor(this, R.color.millenialPink) & 0xffffff),
"#"+Integer.toHexString(ContextCompat.getColor(this, R.color.millenialPink02) & 0xffffff), 2000);
for(int i = 1; i <= 10; i++){
values.add(Integer.toString(i));
}
incDecCircular = findViewById(R.id.increment_decrement_buttons);
incDecCircular.setConfiguration(LinearLayout.HORIZONTAL,IncDecCircular.TYPE_ARRAY,
IncDecCircular.DECREMENT,IncDecCircular.INCREMENT);
incDecCircular.setArrayList(values);
incDecCircular.setArrayIndexes(0,values.size()-1,1);
incDecCircular.enableLongPress(true, true, 500);
incDecCircular.setOnValueChangeListener(new IncDecCircular.OnValueChangeListener() {
@Override
public void onValueChange(IncDecCircular view, float oldValue, float newValue) {
int actualOldValue = ((int)oldValue)+1;
int actualNewValue = ((int)newValue)+1;
int oldWaveProgress = actualOldValue*10;
int newWaveProgress = actualNewValue*10;
waveView.setProgress(newWaveProgress);
}
});
button = findViewById(R.id.button_search_bahan);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
intent.putExtra("jumlahBahan",incDecCircular.getValue());
startActivity(intent);
}
});
}
}
| [
"silentcantabile@gmail.com"
] | silentcantabile@gmail.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.