blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
410
content_id
stringlengths
40
40
detected_licenses
listlengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
689M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
131 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
32 values
content
stringlengths
3
9.45M
authors
listlengths
1
1
author_id
stringlengths
0
313
2d861726852d454e8c37608b7f4c62559eb46167
8d4b48ff1e9fe806dccef09d46f34c236912373f
/src/main/java/com/programmer/gate/restfulwebservices/CustomizedResponseEntityExceptionHandler.java
926acd17a10f19025720ecf28fb216c88612cd92
[]
no_license
Fiona0205/restful-web-services
78457954e2353661b1da220d35f2fd375061356c
1f1a6901a6959f5960dec5de19a3cd945e0b6f2d
refs/heads/master
2020-03-08T01:27:47.451318
2018-04-03T01:34:09
2018-04-03T01:34:09
127,830,922
0
0
null
null
null
null
UTF-8
Java
false
false
1,338
java
package com.programmer.gate.restfulwebservices; import java.util.Date; 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.RestController; import org.springframework.web.context.request.WebRequest; import org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler; @ControllerAdvice @RestController public class CustomizedResponseEntityExceptionHandler extends ResponseEntityExceptionHandler { @ExceptionHandler(Exception.class) public final ResponseEntity<Object> handleAllExceptions(Exception ex, WebRequest request) { ExceptionResponse exceptionResponse = new ExceptionResponse(new Date(), ex.getMessage(), request.getDescription(false)); return new ResponseEntity(exceptionResponse, HttpStatus.INTERNAL_SERVER_ERROR); } @ExceptionHandler(UserNotFoundException.class) public final ResponseEntity<Object> handleUserNotFoundException(UserNotFoundException ex, WebRequest request) { ExceptionResponse exceptionResponse = new ExceptionResponse(new Date(), ex.getMessage(), request.getDescription(false)); return new ResponseEntity(exceptionResponse, HttpStatus.NOT_FOUND); } }
[ "fiona.wang0205@gmail.com" ]
fiona.wang0205@gmail.com
62b21f89202c4ba0fb0f92c8cf14d88b8acd4893
7485ac03c392f04bb5dfefb8fb2b211ff5e22a59
/src/main/java/io/github/samurainate/chestdrop/Trade.java
da470302544fbbf291e1885a1a1e84694ed10b00
[ "BSD-2-Clause" ]
permissive
samurainate/chestdrop
d14b2e8e3d646e9659ee66f4198d9e215aaed4e2
f18c62b57bca18e371834d7e28273cceeb28b39e
refs/heads/master
2021-01-15T13:11:18.662983
2016-11-24T14:25:08
2016-11-24T14:25:08
40,081,369
1
0
null
null
null
null
UTF-8
Java
false
false
864
java
package io.github.samurainate.chestdrop; import org.bukkit.inventory.ItemStack; public class Trade { public Trade(ItemStack itemInHand, int cost) { this.items = itemInHand; this.cost = cost; } public Trade(String name, ItemStack itemInHand, int cost) { this.name = name; this.items = itemInHand; this.cost = cost; } String name; public String getName() { return name; } public void setName(String name) { this.name = name; } ItemStack items; int cost; public ItemStack getItems() { return items; } public int getCost() { return cost; } @Override public int hashCode() { return items.toString().hashCode(); } @Override public boolean equals(Object obj) { if (obj == null || !(obj instanceof Trade)) return false; Trade tobj = (Trade) obj; if (this.items.equals(tobj)) return true; return false; } }
[ "nathaniel.meyer@gatech.edu" ]
nathaniel.meyer@gatech.edu
2562e8e29db618929c76cbd451c28d4a00169a4d
1c0df66bdc53d84aea6f7aa1f0183cf6f8392ab1
/temp/src/minecraft/net/minecraft/entity/item/EntityFallingBlock.java
4a650a601b96c0c2095c5d05c97756bec389075b
[]
no_license
yuwenyong/Minecraft-1.9-MCP
9b7be179db0d7edeb74865b1a78d5203a5f75d08
bc89baf1fd0b5d422478619e7aba01c0b23bd405
refs/heads/master
2022-05-23T00:52:00.345068
2016-03-11T21:47:32
2016-03-11T21:47:32
null
0
0
null
null
null
null
UTF-8
Java
false
false
11,374
java
package net.minecraft.entity.item; import com.google.common.collect.Lists; import java.util.List; import net.minecraft.block.Block; import net.minecraft.block.BlockAnvil; import net.minecraft.block.BlockFalling; import net.minecraft.block.ITileEntityProvider; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.crash.CrashReportCategory; import net.minecraft.entity.Entity; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTBase; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.datasync.DataParameter; import net.minecraft.network.datasync.DataSerializers; import net.minecraft.network.datasync.EntityDataManager; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.DamageSource; import net.minecraft.util.EnumFacing; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; import net.minecraft.world.World; public class EntityFallingBlock extends Entity { private IBlockState field_175132_d; public int field_145812_b; public boolean field_145813_c = true; private boolean field_145808_f; private boolean field_145809_g; private int field_145815_h = 40; private float field_145816_i = 2.0F; public NBTTagCompound field_145810_d; protected static final DataParameter<BlockPos> field_184532_d = EntityDataManager.<BlockPos>func_187226_a(EntityFallingBlock.class, DataSerializers.field_187200_j); public EntityFallingBlock(World p_i1706_1_) { super(p_i1706_1_); } public EntityFallingBlock(World p_i45848_1_, double p_i45848_2_, double p_i45848_4_, double p_i45848_6_, IBlockState p_i45848_8_) { super(p_i45848_1_); this.field_175132_d = p_i45848_8_; this.field_70156_m = true; this.func_70105_a(0.98F, 0.98F); this.func_70107_b(p_i45848_2_, p_i45848_4_ + (double)((1.0F - this.field_70131_O) / 2.0F), p_i45848_6_); this.field_70159_w = 0.0D; this.field_70181_x = 0.0D; this.field_70179_y = 0.0D; this.field_70169_q = p_i45848_2_; this.field_70167_r = p_i45848_4_; this.field_70166_s = p_i45848_6_; this.func_184530_a(new BlockPos(this)); } public void func_184530_a(BlockPos p_184530_1_) { this.field_70180_af.func_187227_b(field_184532_d, p_184530_1_); } public BlockPos func_184531_j() { return (BlockPos)this.field_70180_af.func_187225_a(field_184532_d); } protected boolean func_70041_e_() { return false; } protected void func_70088_a() { this.field_70180_af.func_187214_a(field_184532_d, BlockPos.field_177992_a); } public boolean func_70067_L() { return !this.field_70128_L; } public void func_70071_h_() { Block block = this.field_175132_d.func_177230_c(); if(this.field_175132_d.func_185904_a() == Material.field_151579_a) { this.func_70106_y(); } else { this.field_70169_q = this.field_70165_t; this.field_70167_r = this.field_70163_u; this.field_70166_s = this.field_70161_v; if(this.field_145812_b++ == 0) { BlockPos blockpos = new BlockPos(this); if(this.field_70170_p.func_180495_p(blockpos).func_177230_c() == block) { this.field_70170_p.func_175698_g(blockpos); } else if(!this.field_70170_p.field_72995_K) { this.func_70106_y(); return; } } this.field_70181_x -= 0.03999999910593033D; this.func_70091_d(this.field_70159_w, this.field_70181_x, this.field_70179_y); this.field_70159_w *= 0.9800000190734863D; this.field_70181_x *= 0.9800000190734863D; this.field_70179_y *= 0.9800000190734863D; if(!this.field_70170_p.field_72995_K) { BlockPos blockpos1 = new BlockPos(this); if(this.field_70122_E) { IBlockState iblockstate = this.field_70170_p.func_180495_p(blockpos1); if(BlockFalling.func_185759_i(this.field_70170_p.func_180495_p(new BlockPos(this.field_70165_t, this.field_70163_u - 0.009999999776482582D, this.field_70161_v)))) { this.field_70122_E = false; return; } this.field_70159_w *= 0.699999988079071D; this.field_70179_y *= 0.699999988079071D; this.field_70181_x *= -0.5D; if(iblockstate.func_177230_c() != Blocks.field_180384_M) { this.func_70106_y(); if(!this.field_145808_f) { if(this.field_70170_p.func_175716_a(block, blockpos1, true, EnumFacing.UP, (Entity)null, (ItemStack)null) && !BlockFalling.func_185759_i(this.field_70170_p.func_180495_p(blockpos1.func_177977_b())) && this.field_70170_p.func_180501_a(blockpos1, this.field_175132_d, 3)) { if(block instanceof BlockFalling) { ((BlockFalling)block).func_176502_a_(this.field_70170_p, blockpos1); } if(this.field_145810_d != null && block instanceof ITileEntityProvider) { TileEntity tileentity = this.field_70170_p.func_175625_s(blockpos1); if(tileentity != null) { NBTTagCompound nbttagcompound = new NBTTagCompound(); tileentity.func_145841_b(nbttagcompound); for(String s : this.field_145810_d.func_150296_c()) { NBTBase nbtbase = this.field_145810_d.func_74781_a(s); if(!s.equals("x") && !s.equals("y") && !s.equals("z")) { nbttagcompound.func_74782_a(s, nbtbase.func_74737_b()); } } tileentity.func_145839_a(nbttagcompound); tileentity.func_70296_d(); } } } else if(this.field_145813_c && this.field_70170_p.func_82736_K().func_82766_b("doEntityDrops")) { this.func_70099_a(new ItemStack(block, 1, block.func_180651_a(this.field_175132_d)), 0.0F); } } } } else if(this.field_145812_b > 100 && !this.field_70170_p.field_72995_K && (blockpos1.func_177956_o() < 1 || blockpos1.func_177956_o() > 256) || this.field_145812_b > 600) { if(this.field_145813_c && this.field_70170_p.func_82736_K().func_82766_b("doEntityDrops")) { this.func_70099_a(new ItemStack(block, 1, block.func_180651_a(this.field_175132_d)), 0.0F); } this.func_70106_y(); } } } } public void func_180430_e(float p_180430_1_, float p_180430_2_) { Block block = this.field_175132_d.func_177230_c(); if(this.field_145809_g) { int i = MathHelper.func_76123_f(p_180430_1_ - 1.0F); if(i > 0) { List<Entity> list = Lists.newArrayList(this.field_70170_p.func_72839_b(this, this.func_174813_aQ())); boolean flag = block == Blocks.field_150467_bQ; DamageSource damagesource = flag?DamageSource.field_82728_o:DamageSource.field_82729_p; for(Entity entity : list) { entity.func_70097_a(damagesource, (float)Math.min(MathHelper.func_76141_d((float)i * this.field_145816_i), this.field_145815_h)); } if(flag && (double)this.field_70146_Z.nextFloat() < 0.05000000074505806D + (double)i * 0.05D) { int j = ((Integer)this.field_175132_d.func_177229_b(BlockAnvil.field_176505_b)).intValue(); ++j; if(j > 2) { this.field_145808_f = true; } else { this.field_175132_d = this.field_175132_d.func_177226_a(BlockAnvil.field_176505_b, Integer.valueOf(j)); } } } } } protected void func_70014_b(NBTTagCompound p_70014_1_) { Block block = this.field_175132_d != null?this.field_175132_d.func_177230_c():Blocks.field_150350_a; ResourceLocation resourcelocation = (ResourceLocation)Block.field_149771_c.func_177774_c(block); p_70014_1_.func_74778_a("Block", resourcelocation == null?"":resourcelocation.toString()); p_70014_1_.func_74774_a("Data", (byte)block.func_176201_c(this.field_175132_d)); p_70014_1_.func_74768_a("Time", this.field_145812_b); p_70014_1_.func_74757_a("DropItem", this.field_145813_c); p_70014_1_.func_74757_a("HurtEntities", this.field_145809_g); p_70014_1_.func_74776_a("FallHurtAmount", this.field_145816_i); p_70014_1_.func_74768_a("FallHurtMax", this.field_145815_h); if(this.field_145810_d != null) { p_70014_1_.func_74782_a("TileEntityData", this.field_145810_d); } } protected void func_70037_a(NBTTagCompound p_70037_1_) { int i = p_70037_1_.func_74771_c("Data") & 255; if(p_70037_1_.func_150297_b("Block", 8)) { this.field_175132_d = Block.func_149684_b(p_70037_1_.func_74779_i("Block")).func_176203_a(i); } else if(p_70037_1_.func_150297_b("TileID", 99)) { this.field_175132_d = Block.func_149729_e(p_70037_1_.func_74762_e("TileID")).func_176203_a(i); } else { this.field_175132_d = Block.func_149729_e(p_70037_1_.func_74771_c("Tile") & 255).func_176203_a(i); } this.field_145812_b = p_70037_1_.func_74762_e("Time"); Block block = this.field_175132_d.func_177230_c(); if(p_70037_1_.func_150297_b("HurtEntities", 99)) { this.field_145809_g = p_70037_1_.func_74767_n("HurtEntities"); this.field_145816_i = p_70037_1_.func_74760_g("FallHurtAmount"); this.field_145815_h = p_70037_1_.func_74762_e("FallHurtMax"); } else if(block == Blocks.field_150467_bQ) { this.field_145809_g = true; } if(p_70037_1_.func_150297_b("DropItem", 99)) { this.field_145813_c = p_70037_1_.func_74767_n("DropItem"); } if(p_70037_1_.func_150297_b("TileEntityData", 10)) { this.field_145810_d = p_70037_1_.func_74775_l("TileEntityData"); } if(block == null || block.func_176223_P().func_185904_a() == Material.field_151579_a) { this.field_175132_d = Blocks.field_150354_m.func_176223_P(); } } public World func_145807_e() { return this.field_70170_p; } public void func_145806_a(boolean p_145806_1_) { this.field_145809_g = p_145806_1_; } public boolean func_90999_ad() { return false; } public void func_85029_a(CrashReportCategory p_85029_1_) { super.func_85029_a(p_85029_1_); if(this.field_175132_d != null) { Block block = this.field_175132_d.func_177230_c(); p_85029_1_.func_71507_a("Immitating block ID", Integer.valueOf(Block.func_149682_b(block))); p_85029_1_.func_71507_a("Immitating block data", Integer.valueOf(block.func_176201_c(this.field_175132_d))); } } public IBlockState func_175131_l() { return this.field_175132_d; } public boolean func_184213_bq() { return true; } }
[ "jholley373@yahoo.com" ]
jholley373@yahoo.com
2d6e2c8afe567932bfcaa642b889bea10b9e88d8
7ab1d486c445d3f7592b96b56ce5a472618024b2
/src/main/java/com/ocho/stream/_6Collect.java
af7be2369743267f7d23d563d5c755e9570a12ef
[]
no_license
icast7/java20
2d8b260ea9d6dae0438fe82d73b6b8fe96010277
32fc283a9af24a3f9cf9c49be2861371a9f7f1ef
refs/heads/master
2023-05-10T13:38:20.086988
2019-12-03T07:40:36
2019-12-03T07:40:36
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,964
java
package com.ocho.stream; import java.util.*; import java.util.stream.Collector; import java.util.stream.Collectors; public class _6Collect { public static void main(String[] args) { List<Product> list = Arrays.asList(new Product(23, "potato"), new Product(14, "orange"), new Product(13, "lemon"), new Product(23, "bread"), new Product(13, "sugar") ); List<String> collector = list.stream().map(Product::getName).collect(Collectors.toList()); System.out.println("String collector:"); collector.forEach(System.out::println); String string = list.stream().map(Product::getName).collect(Collectors.joining(", ", "[", "]")); System.out.println("String: " + string); double avgPrice = list.stream().collect(Collectors.averagingInt(Product::getPrice)); System.out.println("Average price: " + avgPrice); int priceSum = list.stream().collect(Collectors.summingInt(Product::getPrice)); System.out.println("Sum price: " + priceSum); IntSummaryStatistics stats = list.stream().collect(Collectors.summarizingInt(Product::getPrice)); System.out.println("Stats: " + stats); Map<Integer, List<Product>> collectorMapOfLists = list.stream().collect(Collectors.groupingBy(Product::getPrice)); System.out.println("Map of products by price:"); collectorMapOfLists.forEach((k, v) -> System.out.println(k + ":" + v.toString())); Map<Boolean, List<Product>> mapPartioned = list.stream() .collect(Collectors.partitioningBy(e -> e.getPrice() > 15)); System.out.println("Map of products by price range:"); mapPartioned.forEach((k, v) -> System.out.println(k + ":" + v.toString())); Set<Product> unmodifiableSet = list.stream().collect(Collectors.collectingAndThen(Collectors.toSet(), Collections::unmodifiableSet)); System.out.println("Set:"); unmodifiableSet.forEach(e -> System.out.println(e)); Collector<Product, ?, LinkedList<Product>> toLinkedList = Collector.of(LinkedList::new, LinkedList::add, (first, second) -> { first.addAll(second); return first; }); LinkedList<Product> linkedListOfProducts = list.stream().collect(toLinkedList); System.out.println("Custom collector ::: Linked list:"); linkedListOfProducts.forEach(e -> System.out.println(e)); } static class Product { private int price; private String name; public Product(int price, String name) { this.price = price; this.name = name; } public String getName() { return name; } public int getPrice() { return price; } @Override public String toString() { return this.name + "($" + price + ")"; } } }
[ "icastillejos@gmail.com" ]
icastillejos@gmail.com
4d2cd485c8a87f26e2c448930a436899e35b9643
ac68b309495d823bf081d168c4a013095c76b1fd
/HubbleBackend/src/com/hubble/hubblebackend/postgressql/model/LReleaseGroupWorkHome.java
7663ff34df166547c67ba41335982f1ec97d86bc
[]
no_license
hmehrotra/hubble
f6d726b8a9d7deed94f67893c3c44c2763be88c3
3762613ed351d3fd4b31c369c3f10b33c06edf70
refs/heads/master
2016-08-04T14:16:38.080270
2015-09-21T00:22:10
2015-09-21T00:22:10
12,354,502
0
0
null
2015-08-30T00:45:27
2013-08-25T05:18:10
HTML
UTF-8
Java
false
false
3,750
java
package com.hubble.hubblebackend.postgressql.model; // Generated Sep 7, 2015 5:12:36 PM by Hibernate Tools 3.4.0.CR1 import java.util.List; import javax.naming.InitialContext; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.hibernate.LockMode; import org.hibernate.SessionFactory; import org.hibernate.criterion.Example; /** * Home object for domain model class LReleaseGroupWork. * @see com.hubble.hubblebackend.postgressql.model.LReleaseGroupWork * @author Hibernate Tools */ public class LReleaseGroupWorkHome { private static final Log log = LogFactory .getLog(LReleaseGroupWorkHome.class); private final SessionFactory sessionFactory = getSessionFactory(); protected SessionFactory getSessionFactory() { try { return (SessionFactory) new InitialContext() .lookup("SessionFactory"); } catch (Exception e) { log.error("Could not locate SessionFactory in JNDI", e); throw new IllegalStateException( "Could not locate SessionFactory in JNDI"); } } public void persist(LReleaseGroupWork transientInstance) { log.debug("persisting LReleaseGroupWork instance"); try { sessionFactory.getCurrentSession().persist(transientInstance); log.debug("persist successful"); } catch (RuntimeException re) { log.error("persist failed", re); throw re; } } public void attachDirty(LReleaseGroupWork instance) { log.debug("attaching dirty LReleaseGroupWork instance"); try { sessionFactory.getCurrentSession().saveOrUpdate(instance); log.debug("attach successful"); } catch (RuntimeException re) { log.error("attach failed", re); throw re; } } public void attachClean(LReleaseGroupWork instance) { log.debug("attaching clean LReleaseGroupWork instance"); try { sessionFactory.getCurrentSession().lock(instance, LockMode.NONE); log.debug("attach successful"); } catch (RuntimeException re) { log.error("attach failed", re); throw re; } } public void delete(LReleaseGroupWork persistentInstance) { log.debug("deleting LReleaseGroupWork instance"); try { sessionFactory.getCurrentSession().delete(persistentInstance); log.debug("delete successful"); } catch (RuntimeException re) { log.error("delete failed", re); throw re; } } public LReleaseGroupWork merge(LReleaseGroupWork detachedInstance) { log.debug("merging LReleaseGroupWork instance"); try { LReleaseGroupWork result = (LReleaseGroupWork) sessionFactory .getCurrentSession().merge(detachedInstance); log.debug("merge successful"); return result; } catch (RuntimeException re) { log.error("merge failed", re); throw re; } } public LReleaseGroupWork findById(int id) { log.debug("getting LReleaseGroupWork instance with id: " + id); try { LReleaseGroupWork instance = (LReleaseGroupWork) sessionFactory .getCurrentSession() .get("com.hubble.hubblebackend.postgressql.model.LReleaseGroupWork", id); if (instance == null) { log.debug("get successful, no instance found"); } else { log.debug("get successful, instance found"); } return instance; } catch (RuntimeException re) { log.error("get failed", re); throw re; } } public List findByExample(LReleaseGroupWork instance) { log.debug("finding LReleaseGroupWork instance by example"); try { List results = sessionFactory .getCurrentSession() .createCriteria( "com.hubble.hubblebackend.postgressql.model.LReleaseGroupWork") .add(Example.create(instance)).list(); log.debug("find by example successful, result size: " + results.size()); return results; } catch (RuntimeException re) { log.error("find by example failed", re); throw re; } } }
[ "hmehrotra@apple.com" ]
hmehrotra@apple.com
3e486fe77cc31e60f2a0d2fcef434faeeff136e2
4e81ceedae1eabc491a9ae876998776cbde49e63
/src/main/java/com/luizmario/brewer/service/ClienteService.java
778f96f091c472c63cc99ef1778dc512f5222e91
[]
no_license
luizmdeveloper/brewer
e93634ddc3f2e98314d69782d68f7557b4f37dfa
e0a32b1195055bceecf4ee08d2149589b723e202
refs/heads/master
2018-09-06T05:38:37.952929
2018-07-10T02:04:35
2018-07-10T02:04:35
103,947,333
0
0
null
null
null
null
UTF-8
Java
false
false
1,307
java
package com.luizmario.brewer.service; import java.util.Optional; import javax.persistence.PersistenceException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import com.luizmario.brewer.model.Cliente; import com.luizmario.brewer.respository.ClienteRepository; import com.luizmario.brewer.service.execption.ClienteComVendaCadastradaException; import com.luizmario.brewer.service.execption.CnpjCpfJaCadastradoException; @Service public class ClienteService { @Autowired private ClienteRepository clienteRepository; @Transactional public void salvar(Cliente cliente){ Optional<Cliente> clienteExistente = clienteRepository.findByCpfOuCnpj(cliente.getCpfOuCnpjSemFormatacao()); if (clienteExistente.isPresent() && !clienteExistente.get().equals(cliente)){ throw new CnpjCpfJaCadastradoException("CPF/CNPJ já cadastrado"); } clienteRepository.save(cliente); } @Transactional public void apagar(Cliente cliente) { try { clienteRepository.delete(cliente); clienteRepository.flush(); } catch (PersistenceException e) { throw new ClienteComVendaCadastradaException("Impossível excluir cliente, devido ter venda cadastrada!"); } } }
[ "luizmariodev@gmail.com" ]
luizmariodev@gmail.com
e5014e81418cfeedd7aa22d1343ae256c39084dd
34ab3ccc2754ea0563fa93b8b2d6e9bebaa126b1
/src/com/entitie/Plantillausuario.java
ef8576ecc14616cc4cb2f7e95f20e254d4dc1bce
[]
no_license
lizfernandez/conexioNegociosV2
e0e823a9eaa0355a6cdba9d3587cbc1097a3985f
d83fc628b356b2bf4cfa6633ce9dbbbf7ad6e4a2
refs/heads/master
2021-01-02T09:43:15.939681
2015-09-07T14:07:32
2015-09-07T14:07:32
39,475,117
0
0
null
null
null
null
UTF-8
Java
false
false
8,568
java
package com.entitie; import java.io.Serializable; import java.util.Date; import javax.persistence.CascadeType; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.Temporal; import javax.persistence.TemporalType; import com.entities.vo.PlantillausuarioVo; /** * The persistent class for the plantillausuario database table. * */ @Entity public class Plantillausuario implements Serializable { @Id @GeneratedValue(strategy=GenerationType.IDENTITY) private String iPlantillaUsuarioId; private static final long serialVersionUID = 1L; private String cEstadoCodigo; @Temporal(TemporalType.TIMESTAMP) private Date dFechaActualiza; @Temporal(TemporalType.TIMESTAMP) private Date dFechaInserta; @ManyToOne(fetch=FetchType.LAZY) @JoinColumn(name="iPlantillaId") private Plantilla plantilla; @ManyToOne(fetch=FetchType.LAZY) @JoinColumn(name="iUsuarioId") private Usuario usuario; @ManyToOne(fetch=FetchType.LAZY) @JoinColumn(name="iTipoSeccionId") private Tiposeccion tipoSeccion ; private int iUsuarioActualiza; private int iUsuarioInserta; private String vAlineado; private String vColorBorde; private String vColorCabeceraInf; private String vColorCabeceraSup; private String vColorFondo; private String vDescripcion; private String vFoto; private String vNombre; private String vPaginaDestino; private String vTipoAnimacion; private String vTitulo; public Plantillausuario() { // TODO Auto-generated constructor stub } public Plantillausuario(PlantillausuarioVo seccionPlantilla) { this.iPlantillaUsuarioId = seccionPlantilla.getiPlantillaUsuarioId(); this.cEstadoCodigo = seccionPlantilla.getcEstadoCodigo(); this.dFechaActualiza = seccionPlantilla.getdFechaActualiza(); this.dFechaInserta = seccionPlantilla.getdFechaInserta(); this.plantilla = seccionPlantilla.getPlantilla()!=null? new Plantilla(seccionPlantilla.getPlantilla()):null; this.usuario = seccionPlantilla.getUsuario()!=null? new Usuario(seccionPlantilla.getUsuario()):null; this.tipoSeccion = seccionPlantilla.getTipoSeccion()!= null? new Tiposeccion(seccionPlantilla.getTipoSeccion()) : null; this.iUsuarioActualiza = seccionPlantilla.getiUsuarioActualiza(); this.iUsuarioInserta = seccionPlantilla.getiUsuarioInserta(); this.vAlineado = seccionPlantilla.getvAlineado(); this.vColorBorde = seccionPlantilla.getvColorBorde(); this.vColorCabeceraInf = seccionPlantilla.getvColorCabeceraInf(); this.vColorCabeceraSup = seccionPlantilla.getvColorCabeceraSup(); this.vColorFondo = seccionPlantilla.getvColorFondo(); this.vDescripcion = seccionPlantilla.getvDescripcion(); this.vFoto = seccionPlantilla.getvFoto(); this.vNombre = seccionPlantilla.getvNombre(); this.vPaginaDestino = seccionPlantilla.getvPaginaDestino(); this.vTipoAnimacion = seccionPlantilla.getvTipoAnimacion(); this.vTitulo = seccionPlantilla.getvTitulo(); } /** * @return the iPlantillaUsuarioId */ public String getiPlantillaUsuarioId() { return iPlantillaUsuarioId; } /** * @param iPlantillaUsuarioId the iPlantillaUsuarioId to set */ public void setiPlantillaUsuarioId(String iPlantillaUsuarioId) { this.iPlantillaUsuarioId = iPlantillaUsuarioId; } /** * @return the cEstadoCodigo */ public String getcEstadoCodigo() { return cEstadoCodigo; } /** * @param cEstadoCodigo the cEstadoCodigo to set */ public void setcEstadoCodigo(String cEstadoCodigo) { this.cEstadoCodigo = cEstadoCodigo; } /** * @return the dFechaActualiza */ public Date getdFechaActualiza() { return dFechaActualiza; } /** * @param dFechaActualiza the dFechaActualiza to set */ public void setdFechaActualiza(Date dFechaActualiza) { this.dFechaActualiza = dFechaActualiza; } /** * @return the dFechaInserta */ public Date getdFechaInserta() { return dFechaInserta; } /** * @param dFechaInserta the dFechaInserta to set */ public void setdFechaInserta(Date dFechaInserta) { this.dFechaInserta = dFechaInserta; } /** * @return the usuario */ public Usuario getUsuario() { return usuario; } /** * @param usuario the usuario to set */ public void setUsuario(Usuario usuario) { this.usuario = usuario; } /** * @return the tipoSeccion */ public Tiposeccion getTipoSeccion() { return tipoSeccion; } /** * @param tipoSeccion the tipoSeccion to set */ public void setTipoSeccion(Tiposeccion tipoSeccion) { this.tipoSeccion = tipoSeccion; } /** * @return the iUsuarioActualiza */ public int getiUsuarioActualiza() { return iUsuarioActualiza; } /** * @param iUsuarioActualiza the iUsuarioActualiza to set */ public void setiUsuarioActualiza(int iUsuarioActualiza) { this.iUsuarioActualiza = iUsuarioActualiza; } /** * @return the iUsuarioInserta */ public int getiUsuarioInserta() { return iUsuarioInserta; } /** * @param iUsuarioInserta the iUsuarioInserta to set */ public void setiUsuarioInserta(int iUsuarioInserta) { this.iUsuarioInserta = iUsuarioInserta; } /** * @return the vAlineado */ public String getvAlineado() { return vAlineado; } /** * @param vAlineado the vAlineado to set */ public void setvAlineado(String vAlineado) { this.vAlineado = vAlineado; } /** * @return the vColorBorde */ public String getvColorBorde() { return vColorBorde; } /** * @param vColorBorde the vColorBorde to set */ public void setvColorBorde(String vColorBorde) { this.vColorBorde = vColorBorde; } /** * @return the vColorCabeceraInf */ public String getvColorCabeceraInf() { return vColorCabeceraInf; } /** * @param vColorCabeceraInf the vColorCabeceraInf to set */ public void setvColorCabeceraInf(String vColorCabeceraInf) { this.vColorCabeceraInf = vColorCabeceraInf; } /** * @return the vColorCabeceraSup */ public String getvColorCabeceraSup() { return vColorCabeceraSup; } /** * @param vColorCabeceraSup the vColorCabeceraSup to set */ public void setvColorCabeceraSup(String vColorCabeceraSup) { this.vColorCabeceraSup = vColorCabeceraSup; } /** * @return the vColorFondo */ public String getvColorFondo() { return vColorFondo; } /** * @param vColorFondo the vColorFondo to set */ public void setvColorFondo(String vColorFondo) { this.vColorFondo = vColorFondo; } /** * @return the vDescripcion */ public String getvDescripcion() { return vDescripcion; } /** * @param vDescripcion the vDescripcion to set */ public void setvDescripcion(String vDescripcion) { this.vDescripcion = vDescripcion; } /** * @return the vFoto */ public String getvFoto() { return vFoto; } /** * @param vFoto the vFoto to set */ public void setvFoto(String vFoto) { this.vFoto = vFoto; } /** * @return the vNombre */ public String getvNombre() { return vNombre; } /** * @param vNombre the vNombre to set */ public void setvNombre(String vNombre) { this.vNombre = vNombre; } /** * @return the vPaginaDestino */ public String getvPaginaDestino() { return vPaginaDestino; } /** * @param vPaginaDestino the vPaginaDestino to set */ public void setvPaginaDestino(String vPaginaDestino) { this.vPaginaDestino = vPaginaDestino; } /** * @return the vTipoAnimacion */ public String getvTipoAnimacion() { return vTipoAnimacion; } /** * @param vTipoAnimacion the vTipoAnimacion to set */ public void setvTipoAnimacion(String vTipoAnimacion) { this.vTipoAnimacion = vTipoAnimacion; } /** * @return the vTitulo */ public String getvTitulo() { return vTitulo; } /** * @param vTitulo the vTitulo to set */ public void setvTitulo(String vTitulo) { this.vTitulo = vTitulo; } /** * @return the plantilla */ public Plantilla getPlantilla() { return plantilla; } /** * @param plantilla the plantilla to set */ public void setPlantilla(Plantilla plantilla) { this.plantilla = plantilla; } }
[ "ws.lizfernandez@gmail.com" ]
ws.lizfernandez@gmail.com
affeb555f911a34a6bc0423d8a0da619533189c1
2854b43621ee89704a271f3f591dfdf0eb07efab
/code/java/ch02/src/main/java/net/sf/classifier4J/bayesian/ICategorisedWordsDataSource.java
35938dc812cad7630ed88a30557ff25a01c932bf
[]
no_license
souv/mlbook2ndedition
3c53303f897eeb13dfad721aee2190bd2cdb7eac
d048f19ba0bcbb04eb1cc263a08548f900d28c1c
refs/heads/master
2023-05-13T21:56:50.145983
2021-05-30T13:37:13
2021-05-30T13:37:13
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,030
java
/* * ==================================================================== * * The Apache Software License, Version 1.1 * * Copyright (c) 2003 Nick Lothian. 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 acknowlegement: * "This product includes software developed by the * developers of Classifier4J (http://classifier4j.sf.net/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The name "Classifier4J" must not be used to endorse or promote * products derived from this software without prior written * permission. For written permission, please contact * http://sourceforge.net/users/nicklothian/. * * 5. Products derived from this software may not be called * "Classifier4J", nor may "Classifier4J" appear in their names * without prior written permission. For written permission, please * contact http://sourceforge.net/users/nicklothian/. * * 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. * ==================================================================== */ package net.sf.classifier4J.bayesian; /** * Interface used by BayesianClassifier to determine the probability of each * word based on a particular category. * * @author Nick Lothian * @author Peter Leschev */ public interface ICategorisedWordsDataSource extends IWordsDataSource { /** * @param category the category to check against * @param word The word to calculate the probability of * @return The word probability if the word exists, null otherwise; * * @throws WordsDataSourceException If there is a fatal problem. For * example, the database is unavailable */ public WordProbability getWordProbability(String category, String word) throws WordsDataSourceException; /** * Add a matching word to the data source * * @param category the category add the match to * @param word the word that matches * * @throws WordsDataSourceException If there is a fatal problem. For * example, the database is unavailable */ public void addMatch(String category, String word) throws WordsDataSourceException; /** * Add a non-matching word to the data source * * @param category the category add the non-match to * @param word the word that does not match * * @throws WordsDataSourceException If there is a fatal problem. For * example, the database is unavailable */ public void addNonMatch(String category, String word) throws WordsDataSourceException; }
[ "jasebell@gmail.com" ]
jasebell@gmail.com
b255c05e38c0196022a573df2c91d999830fdcf5
8d46d6703d3d4044c1661592b76fbbe934bb5a36
/src/main/java/com/example/api/management/EmployeeManagementService.java
cd15c1c6bd43d14fb9c8db7f91326ac6045e3d13
[]
no_license
user-987/management-app
0453f3f5a8db316bd3336951984803bfebdfbd42
2215c7a29dd3f7d78785a08d51f4b7a3249cd2e4
refs/heads/master
2020-05-30T01:28:32.292491
2019-05-30T21:17:31
2019-05-30T21:17:31
189,477,604
0
0
null
null
null
null
UTF-8
Java
false
false
2,374
java
package com.example.api.management; import com.example.api.model.Employee; import com.example.api.model.EmployeeRepository; import lombok.extern.log4j.Log4j2; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.dao.DataIntegrityViolationException; import org.springframework.stereotype.Service; import java.util.List; import java.util.Optional; @Service @Log4j2 public class EmployeeManagementService { private final EmployeeRepository employeeRepository; @Autowired public EmployeeManagementService(EmployeeRepository employeeRepository) { this.employeeRepository = employeeRepository; } public List<Employee> getAll() { return employeeRepository.findAll(); } public Optional<Employee> getById(int id) { return employeeRepository.findById(id); } public Employee addEmployee(Employee employee) { try { employeeRepository.save(employee); } catch (DataIntegrityViolationException e) { log.error("Error when adding an employee", e); throw new IllegalArgumentException("Error occurred when adding an employee: data integrity violation"); } log.info("Employee added"); return employee; } public void deleteEmployee(int id) { Employee employee = employeeRepository .findById(id) .orElseThrow(() -> new IllegalArgumentException("Employee with id=" + id + " not found")); employeeRepository.delete(employee); log.info("Employee with id={} deleted", id); } public Employee updateEmployee(int id, Employee employee) { Optional<Employee> employeeOld = employeeRepository.findById(id); Employee employeeUpdated; if (employeeOld.isPresent()) { Employee employeeNew = employeeOld.get(); employeeNew.setName(employee.getName()); employeeNew.setSurname(employee.getSurname()); employeeNew.setGrade(employee.getGrade()); employeeNew.setSalary(employee.getSalary()); employeeUpdated = addEmployee(employeeNew); } else { employeeUpdated = addEmployee(employee); } log.info("Employee with id={} updated", id); return employeeUpdated; } }
[ "azagorska@protonmail.com" ]
azagorska@protonmail.com
096ef0da1333b35839fdc5abfa3e956184353af8
dad58132832f19e09667181236ee8b781c3a2f7f
/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/functions/ReturnRegion.java
37ec7d8ce0d41080fddebcf9fddfb41351d8f146
[ "Apache-2.0", "LicenseRef-scancode-generic-cla", "LicenseRef-scancode-unknown-license-reference" ]
permissive
danikov/jclouds
d08cb3169eb15a8e49a3e4ee4946549e7976b512
588a7c38ad2ffb7a10fb5c434d8f9fda8510dc0d
refs/heads/master
2021-01-18T20:57:11.057424
2012-04-27T02:21:19
2012-04-27T02:21:19
2,746,934
0
1
null
null
null
null
UTF-8
Java
false
false
1,221
java
/** * Licensed to jclouds, Inc. (jclouds) under one or more * contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. jclouds 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 org.jclouds.openstack.keystone.v2_0.functions; import static com.google.common.base.Preconditions.checkNotNull; import javax.inject.Singleton; import org.jclouds.openstack.keystone.v2_0.domain.Endpoint; @Singleton public class ReturnRegion implements EndpointToRegion { @Override public String apply(Endpoint input) { return checkNotNull(input.getRegion(), "no region for endpoint %s", input); } }
[ "adrian@jclouds.org" ]
adrian@jclouds.org
8f266b593907f6fe4e51cdf8e4b9a3326e4be66a
dc57c413a68cb3f948f4b72692cdb48b2b54e450
/Stacks/src/blackjack/BlackJack.java
663a233fcf8d18b86596a171cf9b7df6e01464f7
[]
no_license
rsha256/ATCS
1095edf5073e279d84a57325282056d71980db13
f7907d2dc401af0d41509dc0a37bf0c4b06c4819
refs/heads/master
2022-10-08T19:52:00.623574
2020-06-11T04:41:06
2020-06-11T04:41:06
207,554,119
0
0
null
2019-10-04T21:12:18
2019-09-10T12:31:40
Java
UTF-8
Java
false
false
3,743
java
package blackjack; import java.util.*; public class BlackJack { public static void main(String[] args) throws InterruptedException { Scanner input = new Scanner(System.in); Scanner input2 = new Scanner(System.in); System.out.println("Welcome to Le Casino d'Aravind"); String in = ""; double score = 500; double amnt = 0; System.out.println("How much money do you want to play with?"); score = input.nextDouble(); do { System.out.println("\nPrepare to face the dealer!"); Deck one = new Deck(); one.completeShuffle(); System.out.println("Shuffling deck ..."); DeckHand play = new DeckHand(one.deal()); System.out.println("\nDealing cards...\n\nHere is your hand:\n" + play); System.out.println("\nHow much money do you want to bet? You have $" + score); amnt = input.nextDouble(); score -= amnt; while (score < 0) { score += amnt; System.out.println("Enter Valid Bet! You only have $" + score); System.out.println("\nHow much money do you want to bet?"); amnt = input.nextDouble(); score -= amnt; } play.hit(one.deal()); System.out.println("\n\nDealing second card to player...Here is your hand:\n" + play); in = ""; while (!in.equalsIgnoreCase("n") && play.getHandValue() <= 30) { System.out.println("\nDo you want to hit? (Enter 'y' to hit or Enter 'N' to stay)"); in = input2.nextLine(); if (in.equalsIgnoreCase("y")) { play.hit(one.deal()); System.out.println("Your new hand: \n" + play); } } DeckHand deal = new DeckHand(one.deal()); System.out.println("\n>Dealer's turn\n\nThe dealer's hand is:\n" + deal); while (deal.getHandValue() < 17) { deal.hit(one.deal()); System.out.println("\nThe dealer hit.\nHis new hand is:\n" + deal); } if (deal.getHandValue() <= 21) { System.out.println("\nThe dealer decided to stay!"); } if (deal.bust()) { if (play.bust()) { score += amnt; System.out.println("\nBoth dealer and player busted. " + "You guys should improve your skills."); System.out.println("\nYou can have your bet back. " + "Currently you have $" + score); } else { score += (2 * amnt); System.out.println("\nLooks like you won. " + "Congratulations but here is your money" + "\n\nCurrent Balance: $" + score); } } else if (play.bust()) { if (deal.bust()) { score += amnt; System.out.println("\nBoth dealer and player busted. " + "You guys should improve your skills."); System.out.println("\nYou can have your bet back. " + "Currently you have $" + score); } else { System.out.println("\nLooks like the dealer won. " + "You should improve your skills!" + "\n\nCurrent Balance: $" + score); } } else { if (play.winner(deal) == 0) { System.out.println( "\nRIP, the dealer won. " + "Better Luck next time!" + "\n\nCurrent Balance: $" + score); } else if (play.winner(deal) == 1) { score += amnt; System.out.println("\nOof it's a tie." + "You should improve your skills!"); System.out.println("\nYou can have your bet back. " + "Currently you have $" + score); } else { score += (2 * amnt); System.out.println("\nLooks like you won. " + "Unfortunate but here is your money" + "\n\nCurrent Balance: $" + score); } } in = ""; System.out.println("Do you want to Play again? (Enter 'y' or 'N')"); in = input2.nextLine(); } while (!in.equalsIgnoreCase("n") && score > 0); if (score == 0) { System.out.println("\nThanks for playing at Le Casino d'Aravind. Come back when you have more money for us!"); } else { System.out.println("\nThanks for playing at Le Casino d'Aravind. Play again later!"); } } }
[ "rahuldshah3@gmail.com" ]
rahuldshah3@gmail.com
e321f82cd2d05fdc80519ad56ccdf7a844abdde2
9e1b3d87a41f662dda21d21fdaadc68651967e21
/crash_collect/src/main/java/com/emporia/common/util/ZipUtil.java
f4561f0606322d1f0beade6efdb2f50c9813702e
[]
no_license
nzsdyun/CrashCollect
27dc823f14af72ec1b9623448d44a2ce4df9d05c
c89b93927a3f383ea6ee7b90fe7bdbf38eb5a86b
refs/heads/master
2021-01-13T08:00:21.282395
2016-10-21T01:45:55
2016-10-21T01:45:55
71,519,450
1
0
null
null
null
null
UTF-8
Java
false
false
4,190
java
package com.emporia.common.util; import com.emporia.common.util.crash.CrashExceptionHandler; import net.lingala.zip4j.core.ZipFile; import net.lingala.zip4j.exception.ZipException; import net.lingala.zip4j.model.ZipParameters; import net.lingala.zip4j.util.Zip4jConstants; import java.io.File; /** * use zip4j compress file * @author sky */ public final class ZipUtil { private static final String TAG = ZipUtil.class.getSimpleName(); /** compress file password */ private static final String compressPwd = "emporia123456"; /** compress files, files will be stored in its original parent directory */ public static File compress(File fileDirPath) { if (fileDirPath == null || !fileDirPath.exists()) { return null; } String destFilePath = CrashExceptionHandler.getIntance().getCrashFileDir().getAbsolutePath() + File.separator + "crash.zip"; return compress(destFilePath, fileDirPath); } /** compress files by file path */ public static File compress(String destFilePath, String srcFolders) { File destFile = new File(destFilePath); File srcFile = new File(srcFolders); if (srcFile == null || !srcFile.exists() || destFile == null) { return null; } try { if (destFile.exists()) { destFile.delete(); } ZipFile zipFile = new ZipFile(destFile); // Initiate Zip Parameters which define various properties such // as compression method, etc. More parameters are explained in other // examples ZipParameters parameters = new ZipParameters(); parameters.setCompressionMethod(Zip4jConstants.COMP_DEFLATE); // set compression method to deflate compression // Set the compression level. This value has to be in between 0 to 9 // Several predefined compression levels are available // DEFLATE_LEVEL_FASTEST - Lowest compression level but higher speed of compression // DEFLATE_LEVEL_FAST - Low compression level but higher speed of compression // DEFLATE_LEVEL_NORMAL - Optimal balance between compression level/speed // DEFLATE_LEVEL_MAXIMUM - High compression level with a compromise of speed // DEFLATE_LEVEL_ULTRA - Highest compression level but low speed parameters.setCompressionLevel(Zip4jConstants.DEFLATE_LEVEL_NORMAL); // Set the encryption flag to true // If this is set to false, then the rest of encryption properties are ignored parameters.setEncryptFiles(true); // Set the encryption method to AES Zip Encryption parameters.setEncryptionMethod(Zip4jConstants.ENC_METHOD_AES); // Set AES Key strength. Key strengths available for AES encryption are: // AES_STRENGTH_128 - For both encryption and decryption // AES_STRENGTH_192 - For decryption only // AES_STRENGTH_256 - For both encryption and decryption // Key strength 192 cannot be used for encryption. But if a zip file already has a // file encrypted with key strength of 192, then Zip4j can decrypt this file parameters.setAesKeyStrength(Zip4jConstants.AES_STRENGTH_256); // Set password parameters.setPassword(compressPwd); // Now add files to the zip file // Note: To add a single file, the method addFile can be used // Note: If the zip file already exists and if this zip file is a split file // then this method throws an exception as Zip Format Specification does not // allow updating split zip files zipFile.addFolder(srcFile, parameters); } catch (ZipException e) { e.printStackTrace(); } return destFile; } /** compress files by file */ public static File compress(String destFilePath, File srcFolders) { if (srcFolders == null) { return null; } return compress(destFilePath, srcFolders.getAbsolutePath()); } }
[ "1799058367@qq.com" ]
1799058367@qq.com
b61b81d1cb2fbca6aa7c1fce75024027a7a79dd9
ef8c2d356beff411e1285f62d83c2f3a1eb92653
/cloud-kechuang-backend/src/test/java/net/dreamlu/EhCachePluginTest.java
262ce05803462e2276dd3cb56772286c87002b6a
[]
no_license
baijingchuan/cloud-kechuang
7ee757699238bfe49edbb8ce4048da13cfe3f41d
1098f0931408dbf00527de41d8683070c560c865
refs/heads/master
2020-03-27T07:21:30.497810
2018-08-26T15:23:56
2018-08-26T15:23:56
146,184,741
0
0
null
null
null
null
UTF-8
Java
false
false
836
java
package net.dreamlu; import org.junit.Before; import org.junit.Test; import com.jfinal.kit.JsonKit; import com.jfinal.plugin.activerecord.Record; import com.jfinal.plugin.ehcache.CacheKit; import com.jfinal.plugin.ehcache.EhCachePlugin; /** * EhCache插件测试 * @author L.cm * email: 596392912@qq.com * site:http://www.dreamlu.net * date: 2015年8月2日 下午3:00:56 */ public class EhCachePluginTest { @Before public void setUp() { EhCachePlugin ehCachePlugin = new EhCachePlugin(); ehCachePlugin.start(); } String cacheName = "session"; @Test public void testPut() { Record value = new Record(); value.set("id", "123123"); CacheKit.put(cacheName, "key", value); } @Test public void testGet() { Record value = CacheKit.get(cacheName, "key"); System.out.println(JsonKit.toJson(value)); } }
[ "285961845@qq.com" ]
285961845@qq.com
da36202f64e64fc05ffff015a7d96b947859d62f
1d3cd86f7c22b2aa939cbf2dbe72a7e1401b262e
/Hibernate/src/hibernate/Podaci.java
998d756d0ba9668c516ca3e463c77d7af34cc21d
[]
no_license
MateaMikulandra/Hibernate-task
1e7e7914dc5681d839dca9c0607c42cf1d2ce6cc
e24fe345e872a865645e7facd404c3b232e915ac
refs/heads/master
2020-04-16T19:26:55.500876
2019-01-15T13:52:50
2019-01-15T13:52:50
165,859,707
0
0
null
null
null
null
UTF-8
Java
false
false
5,012
java
package hibernate; import java.io.Serializable; import java.sql.SQLException; import java.util.List; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.criterion.Criterion; import org.hibernate.criterion.Restrictions; @Entity @Table(name = "podaci") public class Podaci implements Serializable{ @Id @Column(name = "podaci_id") @GeneratedValue(strategy = GenerationType.IDENTITY) private int id; private String ime; private int broj_godina; private String adresa; private int visina_dohotka; public static List<Podaci> List() throws SQLException { SessionFactory sessionFactory = datoteka.HibernateUtil.createSessionFactory(); Session s = sessionFactory.getCurrentSession(); s.beginTransaction(); List<Podaci> ls = s.createCriteria(Podaci.class).list(); s.getTransaction().commit(); return ls; } public static Podaci GetByID(int id) throws SQLException { SessionFactory sessionFactory = datoteka.HibernateUtil.createSessionFactory(); Session s = sessionFactory.getCurrentSession(); s.beginTransaction(); List<Podaci> podatci = s.createCriteria(Podaci.class).add(Restrictions.eq("id", id)).list(); Podaci podatak = podatci.get(0); s.getTransaction().commit(); return podatak; } public void Add() throws SQLException { SessionFactory sessionFactory = datoteka.HibernateUtil.createSessionFactory(); Session s = sessionFactory.getCurrentSession(); s.beginTransaction(); Podaci p = new Podaci(); p.ime = getIme(); p.broj_godina = getBrojGodina(); p.adresa = getAdresa(); p.visina_dohotka = getVisinaDohotka(); s.persist(p); s.getTransaction().commit(); } public static List<Podaci> Search(String query) throws SQLException { SessionFactory sessionFactory = datoteka.HibernateUtil.createSessionFactory(); Session s = sessionFactory.getCurrentSession(); s.beginTransaction(); List<Podaci> ls = s.createCriteria(Podaci.class) .add(Restrictions.like("ime", query)).list(); s.getTransaction().commit(); return ls; } public void UpdateAdresa() throws SQLException { SessionFactory sessionFactory = datoteka.HibernateUtil.createSessionFactory(); Session s = sessionFactory.getCurrentSession(); s.beginTransaction(); Podaci p = GetByID(getId()); p.adresa = getAdresa(); s.update(p); s.getTransaction().commit(); } public void UpdateVisinaDohotka() throws SQLException { SessionFactory sessionFactory = datoteka.HibernateUtil.createSessionFactory(); Session s = sessionFactory.getCurrentSession(); s.beginTransaction(); Podaci p = GetByID(getId()); p.visina_dohotka = getVisinaDohotka(); s.update(p); s.getTransaction().commit(); } public void Delete() throws SQLException { SessionFactory sessionFactory = datoteka.HibernateUtil.createSessionFactory(); Session s = sessionFactory.getCurrentSession(); s.beginTransaction(); Podaci p = new Podaci(); p.id = getId(); p.ime = getIme(); p.broj_godina = getBrojGodina(); p.adresa = getAdresa(); p.visina_dohotka = getVisinaDohotka(); s.delete(p); s.getTransaction().commit(); } public int getId() { return id; } public void setId(int id) { this.id = id; } public String getIme() { return ime; } public void setIme(String ime) { this.ime = ime; } public int getBrojGodina() { return broj_godina; } public void setBrojGodina(int broj_godina) { this.broj_godina = broj_godina; } public String getAdresa() { return adresa; } public void setAdresa(String adresa) { this.adresa = adresa; } public int getVisinaDohotka() { return visina_dohotka; } public void setVisinaDohotka(int visina_dohotka) { this.visina_dohotka = visina_dohotka; } public Podaci(String ime, int broj_godina, String adresa, int visina_dohotka) { this.ime = ime; this.broj_godina = broj_godina; this.adresa = adresa; this.visina_dohotka = visina_dohotka; } Podaci() { } @Override public String toString() { return "ID je: " + getId() + " " + "Ime: " + getIme() + " " + "Broj godina: " + getBrojGodina()+ " " + "Adresa: " + getAdresa()+ " " + " Visina dohotka: " + getVisinaDohotka(); } }
[ "mikulandra.matea@gmail.com" ]
mikulandra.matea@gmail.com
d7f41cdb2b1fa332a994b14b076743c69ac27bd3
4218254b294e9bc475919005e0284c5e24b2c011
/AmazingRace_1/src/foodbank/main.java
411df6ea804369554146568f32b833fdadcb69fc
[]
no_license
ScottHowland/CS372-Java-Apps
720f9b3f02582fd0eeb8db3ebe49ec701a2175a4
7d22e5d66433f1ad621688b5c66e1d728d64048b
refs/heads/master
2021-05-28T09:53:25.730289
2015-02-06T04:18:54
2015-02-06T04:18:54
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,089
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 foodbank; import java.util.Random; import foodbank.food.*; /** * * @author showland17 */ public class main { /** * @param args the command line arguments */ public static void main(String[] args) { Random rnd = new Random(); FoodContainer lootCrate = new FoodContainer(); int c = rnd.nextInt(50) + 20; for (int i=0; i<c; i++) { if (rnd.nextBoolean()) lootCrate.addGood(new Soup(rnd.nextInt(30) + 10, rnd.nextInt(50) + 10, 0)); else lootCrate.addGood(new Coffee(rnd.nextInt(50) + 10, rnd.nextInt(150) +10, 0)); } System.out.printf("Total number of items: %d.\n", lootCrate.getCount()); System.out.printf("Total weight: %d.\n", lootCrate.getWeight()); System.out.printf("Total volume: %d.\n", lootCrate.getVolume()); } }
[ "showland17@my.whitworth.edu" ]
showland17@my.whitworth.edu
22de3d588ede0b0a3005d268c937c45d4ed35a26
45736204805554b2d13f1805e47eb369a8e16ec3
/net/minecraft/client/gui/GuiRepair.java
62d4f85a77d4d00d7099ba5c7ddc8ec248813159
[]
no_license
KrOySi/ArchWare-Source
9afc6bfcb1d642d2da97604ddfed8048667e81fd
46cdf10af07341b26bfa704886299d80296320c2
refs/heads/main
2022-07-30T02:54:33.192997
2021-08-08T23:36:39
2021-08-08T23:36:39
394,089,144
2
0
null
null
null
null
UTF-8
Java
false
false
7,055
java
/* * Decompiled with CFR 0.150. * * Could not load the following classes: * io.netty.buffer.Unpooled * org.lwjgl.input.Keyboard */ package net.minecraft.client.gui; import io.netty.buffer.Unpooled; import java.io.IOException; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiTextField; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Container; import net.minecraft.inventory.ContainerRepair; import net.minecraft.inventory.IContainerListener; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; import net.minecraft.network.PacketBuffer; import net.minecraft.network.play.client.CPacketCustomPayload; import net.minecraft.util.NonNullList; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; import org.lwjgl.input.Keyboard; public class GuiRepair extends GuiContainer implements IContainerListener { private static final ResourceLocation ANVIL_RESOURCE = new ResourceLocation("textures/gui/container/anvil.png"); private final ContainerRepair anvil; private GuiTextField nameField; private final InventoryPlayer playerInventory; public GuiRepair(InventoryPlayer inventoryIn, World worldIn) { super(new ContainerRepair(inventoryIn, worldIn, Minecraft.getMinecraft().player)); this.playerInventory = inventoryIn; this.anvil = (ContainerRepair)this.inventorySlots; } @Override public void initGui() { super.initGui(); Keyboard.enableRepeatEvents((boolean)true); int i = (this.width - this.xSize) / 2; int j = (this.height - this.ySize) / 2; this.nameField = new GuiTextField(0, this.fontRendererObj, i + 62, j + 24, 103, 12); this.nameField.setTextColor(-1); this.nameField.setDisabledTextColour(-1); this.nameField.setEnableBackgroundDrawing(false); this.nameField.setMaxStringLength(35); this.inventorySlots.removeListener(this); this.inventorySlots.addListener(this); } @Override public void onGuiClosed() { super.onGuiClosed(); Keyboard.enableRepeatEvents((boolean)false); this.inventorySlots.removeListener(this); } @Override protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) { GlStateManager.disableLighting(); GlStateManager.disableBlend(); this.fontRendererObj.drawString(I18n.format("container.repair", new Object[0]), 60, 6, 0x404040); if (this.anvil.maximumCost > 0) { int i = 8453920; boolean flag = true; String s = I18n.format("container.repair.cost", this.anvil.maximumCost); if (this.anvil.maximumCost >= 40 && !this.mc.player.capabilities.isCreativeMode) { s = I18n.format("container.repair.expensive", new Object[0]); i = 0xFF6060; } else if (!this.anvil.getSlot(2).getHasStack()) { flag = false; } else if (!this.anvil.getSlot(2).canTakeStack(this.playerInventory.player)) { i = 0xFF6060; } if (flag) { int j = 0xFF000000 | (i & 0xFCFCFC) >> 2 | i & 0xFF000000; int k = this.xSize - 8 - this.fontRendererObj.getStringWidth(s); int l = 67; if (this.fontRendererObj.getUnicodeFlag()) { GuiRepair.drawRect(k - 3, 65.0, this.xSize - 7, 77.0, -16777216); GuiRepair.drawRect(k - 2, 66.0, this.xSize - 8, 76.0, -12895429); } else { this.fontRendererObj.drawString(s, k, 68, j); this.fontRendererObj.drawString(s, k + 1, 67, j); this.fontRendererObj.drawString(s, k + 1, 68, j); } this.fontRendererObj.drawString(s, k, 67, i); } } GlStateManager.enableLighting(); } @Override protected void keyTyped(char typedChar, int keyCode) throws IOException { if (this.nameField.textboxKeyTyped(typedChar, keyCode)) { this.renameItem(); } else { super.keyTyped(typedChar, keyCode); } } private void renameItem() { String s = this.nameField.getText(); Slot slot = this.anvil.getSlot(0); if (slot != null && slot.getHasStack() && !slot.getStack().hasDisplayName() && s.equals(slot.getStack().getDisplayName())) { s = ""; } this.anvil.updateItemName(s); this.mc.player.connection.sendPacket(new CPacketCustomPayload("MC|ItemName", new PacketBuffer(Unpooled.buffer()).writeString(s))); } @Override protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException { super.mouseClicked(mouseX, mouseY, mouseButton); this.nameField.mouseClicked(mouseX, mouseY, mouseButton); } @Override public void drawScreen(int mouseX, int mouseY, float partialTicks) { this.drawDefaultBackground(); super.drawScreen(mouseX, mouseY, partialTicks); this.func_191948_b(mouseX, mouseY); GlStateManager.disableLighting(); GlStateManager.disableBlend(); this.nameField.drawTextBox(); } @Override protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) { GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f); this.mc.getTextureManager().bindTexture(ANVIL_RESOURCE); int i = (this.width - this.xSize) / 2; int j = (this.height - this.ySize) / 2; this.drawTexturedModalRect(i, j, 0, 0, this.xSize, this.ySize); this.drawTexturedModalRect(i + 59, j + 20, 0, this.ySize + (this.anvil.getSlot(0).getHasStack() ? 0 : 16), 110, 16); if ((this.anvil.getSlot(0).getHasStack() || this.anvil.getSlot(1).getHasStack()) && !this.anvil.getSlot(2).getHasStack()) { this.drawTexturedModalRect(i + 99, j + 45, this.xSize, 0, 28, 21); } } @Override public void updateCraftingInventory(Container containerToSend, NonNullList<ItemStack> itemsList) { this.sendSlotContents(containerToSend, 0, containerToSend.getSlot(0).getStack()); } @Override public void sendSlotContents(Container containerToSend, int slotInd, ItemStack stack) { if (slotInd == 0) { this.nameField.setText(stack.func_190926_b() ? "" : stack.getDisplayName()); this.nameField.setEnabled(!stack.func_190926_b()); if (!stack.func_190926_b()) { this.renameItem(); } } } @Override public void sendProgressBarUpdate(Container containerIn, int varToUpdate, int newValue) { } @Override public void sendAllWindowProperties(Container containerIn, IInventory inventory) { } }
[ "67242784+KrOySi@users.noreply.github.com" ]
67242784+KrOySi@users.noreply.github.com
d4d89511c81a2649965681e6734d13dc4c4c9b9a
6b3eca4a86761e8d60b73f3a3033d141d641171c
/springboot/src/main/java/com/mkpassby/springbootvalidate/interceptor/ControllerInterceptor.java
cc7502989f1b755796e234e826c1139f9055b235
[]
no_license
mk-passby/mk_learn
501acd164c4f6d641406c7880315ec4065672876
9dd1e744b91874e9346e225045542183fe7484f8
refs/heads/master
2022-06-21T20:34:08.414188
2021-09-25T14:17:40
2021-09-25T14:17:40
251,604,655
1
2
null
2022-06-17T03:22:56
2020-03-31T13:03:50
Java
UTF-8
Java
false
false
675
java
package com.mkpassby.springbootvalidate.interceptor; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.springframework.web.servlet.HandlerInterceptor; import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; /** * @program: springboot * @description: * @author: mk_passby * @create: 2019-10-09 21:16 **/ public class ControllerInterceptor extends HandlerInterceptorAdapter { @Override public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { System.out.println("前置处理器"); return true; } }
[ "33092250@qq.com" ]
33092250@qq.com
61106da3d1d43f236cfa7ab127d91e4f71ad0b6e
1849982403e43938a0abfdff5b436e5ee906e087
/JAVA/OopMasterChallenge/HealthyBurger.java
8fd9ef536449be889c2d7898871f0c320772199b
[]
no_license
ujjwaljamuar/VSCode_
0c87cc90c653f7a16cb03bb166363a0cf2685b74
64ff6378c55f643747bec0e937d30c2f2c373253
refs/heads/master
2023-05-01T17:51:04.526629
2021-05-19T15:43:30
2021-05-19T15:43:30
363,122,232
0
0
null
null
null
null
UTF-8
Java
false
false
886
java
package OopMasterChallenge; public class HealthyBurger extends Burger { private Addition tofu; private Addition egg; public HealthyBurger(String name, String meat, double price) { super(name, "Brown bread roll", meat, true, price); this.tofu = new Addition("Tofu", 35); this.egg = new Addition("Egg", 40); } @Override public void selectIngredient(int selected) { super.selectIngredient(selected); switch (selected) { case 5: addIngredient(this.tofu); break; case 6: addIngredient(this.egg); break; } } @Override public void printExtraAdditions() { super.printExtraAdditions(); printAdditionPrice(5, this.tofu); printAdditionPrice(6, this.egg); } }
[ "noreply@github.com" ]
ujjwaljamuar.noreply@github.com
31782fddf2d8748e284681bb3482147d942285b1
cbea23d5e087a862edcf2383678d5df7b0caab67
/aws-java-sdk-networkfirewall/src/main/java/com/amazonaws/services/networkfirewall/model/Header.java
632ff71b0835aa67aa706bfb492cc0e77df8bb1b
[ "Apache-2.0" ]
permissive
phambryan/aws-sdk-for-java
66a614a8bfe4176bf57e2bd69f898eee5222bb59
0f75a8096efdb4831da8c6793390759d97a25019
refs/heads/master
2021-12-14T21:26:52.580137
2021-12-03T22:50:27
2021-12-03T22:50:27
4,263,342
0
0
null
null
null
null
UTF-8
Java
false
false
32,588
java
/* * Copyright 2016-2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file 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.amazonaws.services.networkfirewall.model; import java.io.Serializable; import javax.annotation.Generated; import com.amazonaws.protocol.StructuredPojo; import com.amazonaws.protocol.ProtocolMarshaller; /** * <p> * The basic rule criteria for AWS Network Firewall to use to inspect packet headers in stateful traffic flow * inspection. Traffic flows that match the criteria are a match for the corresponding <a>StatefulRule</a>. * </p> * * @see <a href="http://docs.aws.amazon.com/goto/WebAPI/network-firewall-2020-11-12/Header" target="_top">AWS API * Documentation</a> */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class Header implements Serializable, Cloneable, StructuredPojo { /** * <p> * The protocol to inspect for. To specify all, you can use <code>IP</code>, because all traffic on AWS and on the * internet is IP. * </p> */ private String protocol; /** * <p> * The source IP address or address range to inspect for, in CIDR notation. To match with any address, specify * <code>ANY</code>. * </p> * <p> * Specify an IP address or a block of IP addresses in Classless Inter-Domain Routing (CIDR) notation. Network * Firewall supports all address ranges for IPv4. * </p> * <p> * Examples: * </p> * <ul> * <li> * <p> * To configure Network Firewall to inspect for the IP address 192.0.2.44, specify <code>192.0.2.44/32</code>. * </p> * </li> * <li> * <p> * To configure Network Firewall to inspect for IP addresses from 192.0.2.0 to 192.0.2.255, specify * <code>192.0.2.0/24</code>. * </p> * </li> * </ul> * <p> * For more information about CIDR notation, see the Wikipedia entry <a * href="https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing">Classless Inter-Domain Routing</a>. * </p> */ private String source; /** * <p> * The source port to inspect for. You can specify an individual port, for example <code>1994</code> and you can * specify a port range, for example <code>1990:1994</code>. To match with any port, specify <code>ANY</code>. * </p> */ private String sourcePort; /** * <p> * The direction of traffic flow to inspect. If set to <code>ANY</code>, the inspection matches bidirectional * traffic, both from the source to the destination and from the destination to the source. If set to * <code>FORWARD</code>, the inspection only matches traffic going from the source to the destination. * </p> */ private String direction; /** * <p> * The destination IP address or address range to inspect for, in CIDR notation. To match with any address, specify * <code>ANY</code>. * </p> * <p> * Specify an IP address or a block of IP addresses in Classless Inter-Domain Routing (CIDR) notation. Network * Firewall supports all address ranges for IPv4. * </p> * <p> * Examples: * </p> * <ul> * <li> * <p> * To configure Network Firewall to inspect for the IP address 192.0.2.44, specify <code>192.0.2.44/32</code>. * </p> * </li> * <li> * <p> * To configure Network Firewall to inspect for IP addresses from 192.0.2.0 to 192.0.2.255, specify * <code>192.0.2.0/24</code>. * </p> * </li> * </ul> * <p> * For more information about CIDR notation, see the Wikipedia entry <a * href="https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing">Classless Inter-Domain Routing</a>. * </p> */ private String destination; /** * <p> * The destination port to inspect for. You can specify an individual port, for example <code>1994</code> and you * can specify a port range, for example <code>1990:1994</code>. To match with any port, specify <code>ANY</code>. * </p> */ private String destinationPort; /** * <p> * The protocol to inspect for. To specify all, you can use <code>IP</code>, because all traffic on AWS and on the * internet is IP. * </p> * * @param protocol * The protocol to inspect for. To specify all, you can use <code>IP</code>, because all traffic on AWS and * on the internet is IP. * @see StatefulRuleProtocol */ public void setProtocol(String protocol) { this.protocol = protocol; } /** * <p> * The protocol to inspect for. To specify all, you can use <code>IP</code>, because all traffic on AWS and on the * internet is IP. * </p> * * @return The protocol to inspect for. To specify all, you can use <code>IP</code>, because all traffic on AWS and * on the internet is IP. * @see StatefulRuleProtocol */ public String getProtocol() { return this.protocol; } /** * <p> * The protocol to inspect for. To specify all, you can use <code>IP</code>, because all traffic on AWS and on the * internet is IP. * </p> * * @param protocol * The protocol to inspect for. To specify all, you can use <code>IP</code>, because all traffic on AWS and * on the internet is IP. * @return Returns a reference to this object so that method calls can be chained together. * @see StatefulRuleProtocol */ public Header withProtocol(String protocol) { setProtocol(protocol); return this; } /** * <p> * The protocol to inspect for. To specify all, you can use <code>IP</code>, because all traffic on AWS and on the * internet is IP. * </p> * * @param protocol * The protocol to inspect for. To specify all, you can use <code>IP</code>, because all traffic on AWS and * on the internet is IP. * @return Returns a reference to this object so that method calls can be chained together. * @see StatefulRuleProtocol */ public Header withProtocol(StatefulRuleProtocol protocol) { this.protocol = protocol.toString(); return this; } /** * <p> * The source IP address or address range to inspect for, in CIDR notation. To match with any address, specify * <code>ANY</code>. * </p> * <p> * Specify an IP address or a block of IP addresses in Classless Inter-Domain Routing (CIDR) notation. Network * Firewall supports all address ranges for IPv4. * </p> * <p> * Examples: * </p> * <ul> * <li> * <p> * To configure Network Firewall to inspect for the IP address 192.0.2.44, specify <code>192.0.2.44/32</code>. * </p> * </li> * <li> * <p> * To configure Network Firewall to inspect for IP addresses from 192.0.2.0 to 192.0.2.255, specify * <code>192.0.2.0/24</code>. * </p> * </li> * </ul> * <p> * For more information about CIDR notation, see the Wikipedia entry <a * href="https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing">Classless Inter-Domain Routing</a>. * </p> * * @param source * The source IP address or address range to inspect for, in CIDR notation. To match with any address, * specify <code>ANY</code>. </p> * <p> * Specify an IP address or a block of IP addresses in Classless Inter-Domain Routing (CIDR) notation. * Network Firewall supports all address ranges for IPv4. * </p> * <p> * Examples: * </p> * <ul> * <li> * <p> * To configure Network Firewall to inspect for the IP address 192.0.2.44, specify <code>192.0.2.44/32</code> * . * </p> * </li> * <li> * <p> * To configure Network Firewall to inspect for IP addresses from 192.0.2.0 to 192.0.2.255, specify * <code>192.0.2.0/24</code>. * </p> * </li> * </ul> * <p> * For more information about CIDR notation, see the Wikipedia entry <a * href="https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing">Classless Inter-Domain Routing</a>. */ public void setSource(String source) { this.source = source; } /** * <p> * The source IP address or address range to inspect for, in CIDR notation. To match with any address, specify * <code>ANY</code>. * </p> * <p> * Specify an IP address or a block of IP addresses in Classless Inter-Domain Routing (CIDR) notation. Network * Firewall supports all address ranges for IPv4. * </p> * <p> * Examples: * </p> * <ul> * <li> * <p> * To configure Network Firewall to inspect for the IP address 192.0.2.44, specify <code>192.0.2.44/32</code>. * </p> * </li> * <li> * <p> * To configure Network Firewall to inspect for IP addresses from 192.0.2.0 to 192.0.2.255, specify * <code>192.0.2.0/24</code>. * </p> * </li> * </ul> * <p> * For more information about CIDR notation, see the Wikipedia entry <a * href="https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing">Classless Inter-Domain Routing</a>. * </p> * * @return The source IP address or address range to inspect for, in CIDR notation. To match with any address, * specify <code>ANY</code>. </p> * <p> * Specify an IP address or a block of IP addresses in Classless Inter-Domain Routing (CIDR) notation. * Network Firewall supports all address ranges for IPv4. * </p> * <p> * Examples: * </p> * <ul> * <li> * <p> * To configure Network Firewall to inspect for the IP address 192.0.2.44, specify * <code>192.0.2.44/32</code>. * </p> * </li> * <li> * <p> * To configure Network Firewall to inspect for IP addresses from 192.0.2.0 to 192.0.2.255, specify * <code>192.0.2.0/24</code>. * </p> * </li> * </ul> * <p> * For more information about CIDR notation, see the Wikipedia entry <a * href="https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing">Classless Inter-Domain Routing</a>. */ public String getSource() { return this.source; } /** * <p> * The source IP address or address range to inspect for, in CIDR notation. To match with any address, specify * <code>ANY</code>. * </p> * <p> * Specify an IP address or a block of IP addresses in Classless Inter-Domain Routing (CIDR) notation. Network * Firewall supports all address ranges for IPv4. * </p> * <p> * Examples: * </p> * <ul> * <li> * <p> * To configure Network Firewall to inspect for the IP address 192.0.2.44, specify <code>192.0.2.44/32</code>. * </p> * </li> * <li> * <p> * To configure Network Firewall to inspect for IP addresses from 192.0.2.0 to 192.0.2.255, specify * <code>192.0.2.0/24</code>. * </p> * </li> * </ul> * <p> * For more information about CIDR notation, see the Wikipedia entry <a * href="https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing">Classless Inter-Domain Routing</a>. * </p> * * @param source * The source IP address or address range to inspect for, in CIDR notation. To match with any address, * specify <code>ANY</code>. </p> * <p> * Specify an IP address or a block of IP addresses in Classless Inter-Domain Routing (CIDR) notation. * Network Firewall supports all address ranges for IPv4. * </p> * <p> * Examples: * </p> * <ul> * <li> * <p> * To configure Network Firewall to inspect for the IP address 192.0.2.44, specify <code>192.0.2.44/32</code> * . * </p> * </li> * <li> * <p> * To configure Network Firewall to inspect for IP addresses from 192.0.2.0 to 192.0.2.255, specify * <code>192.0.2.0/24</code>. * </p> * </li> * </ul> * <p> * For more information about CIDR notation, see the Wikipedia entry <a * href="https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing">Classless Inter-Domain Routing</a>. * @return Returns a reference to this object so that method calls can be chained together. */ public Header withSource(String source) { setSource(source); return this; } /** * <p> * The source port to inspect for. You can specify an individual port, for example <code>1994</code> and you can * specify a port range, for example <code>1990:1994</code>. To match with any port, specify <code>ANY</code>. * </p> * * @param sourcePort * The source port to inspect for. You can specify an individual port, for example <code>1994</code> and you * can specify a port range, for example <code>1990:1994</code>. To match with any port, specify * <code>ANY</code>. */ public void setSourcePort(String sourcePort) { this.sourcePort = sourcePort; } /** * <p> * The source port to inspect for. You can specify an individual port, for example <code>1994</code> and you can * specify a port range, for example <code>1990:1994</code>. To match with any port, specify <code>ANY</code>. * </p> * * @return The source port to inspect for. You can specify an individual port, for example <code>1994</code> and you * can specify a port range, for example <code>1990:1994</code>. To match with any port, specify * <code>ANY</code>. */ public String getSourcePort() { return this.sourcePort; } /** * <p> * The source port to inspect for. You can specify an individual port, for example <code>1994</code> and you can * specify a port range, for example <code>1990:1994</code>. To match with any port, specify <code>ANY</code>. * </p> * * @param sourcePort * The source port to inspect for. You can specify an individual port, for example <code>1994</code> and you * can specify a port range, for example <code>1990:1994</code>. To match with any port, specify * <code>ANY</code>. * @return Returns a reference to this object so that method calls can be chained together. */ public Header withSourcePort(String sourcePort) { setSourcePort(sourcePort); return this; } /** * <p> * The direction of traffic flow to inspect. If set to <code>ANY</code>, the inspection matches bidirectional * traffic, both from the source to the destination and from the destination to the source. If set to * <code>FORWARD</code>, the inspection only matches traffic going from the source to the destination. * </p> * * @param direction * The direction of traffic flow to inspect. If set to <code>ANY</code>, the inspection matches bidirectional * traffic, both from the source to the destination and from the destination to the source. If set to * <code>FORWARD</code>, the inspection only matches traffic going from the source to the destination. * @see StatefulRuleDirection */ public void setDirection(String direction) { this.direction = direction; } /** * <p> * The direction of traffic flow to inspect. If set to <code>ANY</code>, the inspection matches bidirectional * traffic, both from the source to the destination and from the destination to the source. If set to * <code>FORWARD</code>, the inspection only matches traffic going from the source to the destination. * </p> * * @return The direction of traffic flow to inspect. If set to <code>ANY</code>, the inspection matches * bidirectional traffic, both from the source to the destination and from the destination to the source. If * set to <code>FORWARD</code>, the inspection only matches traffic going from the source to the * destination. * @see StatefulRuleDirection */ public String getDirection() { return this.direction; } /** * <p> * The direction of traffic flow to inspect. If set to <code>ANY</code>, the inspection matches bidirectional * traffic, both from the source to the destination and from the destination to the source. If set to * <code>FORWARD</code>, the inspection only matches traffic going from the source to the destination. * </p> * * @param direction * The direction of traffic flow to inspect. If set to <code>ANY</code>, the inspection matches bidirectional * traffic, both from the source to the destination and from the destination to the source. If set to * <code>FORWARD</code>, the inspection only matches traffic going from the source to the destination. * @return Returns a reference to this object so that method calls can be chained together. * @see StatefulRuleDirection */ public Header withDirection(String direction) { setDirection(direction); return this; } /** * <p> * The direction of traffic flow to inspect. If set to <code>ANY</code>, the inspection matches bidirectional * traffic, both from the source to the destination and from the destination to the source. If set to * <code>FORWARD</code>, the inspection only matches traffic going from the source to the destination. * </p> * * @param direction * The direction of traffic flow to inspect. If set to <code>ANY</code>, the inspection matches bidirectional * traffic, both from the source to the destination and from the destination to the source. If set to * <code>FORWARD</code>, the inspection only matches traffic going from the source to the destination. * @return Returns a reference to this object so that method calls can be chained together. * @see StatefulRuleDirection */ public Header withDirection(StatefulRuleDirection direction) { this.direction = direction.toString(); return this; } /** * <p> * The destination IP address or address range to inspect for, in CIDR notation. To match with any address, specify * <code>ANY</code>. * </p> * <p> * Specify an IP address or a block of IP addresses in Classless Inter-Domain Routing (CIDR) notation. Network * Firewall supports all address ranges for IPv4. * </p> * <p> * Examples: * </p> * <ul> * <li> * <p> * To configure Network Firewall to inspect for the IP address 192.0.2.44, specify <code>192.0.2.44/32</code>. * </p> * </li> * <li> * <p> * To configure Network Firewall to inspect for IP addresses from 192.0.2.0 to 192.0.2.255, specify * <code>192.0.2.0/24</code>. * </p> * </li> * </ul> * <p> * For more information about CIDR notation, see the Wikipedia entry <a * href="https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing">Classless Inter-Domain Routing</a>. * </p> * * @param destination * The destination IP address or address range to inspect for, in CIDR notation. To match with any address, * specify <code>ANY</code>. </p> * <p> * Specify an IP address or a block of IP addresses in Classless Inter-Domain Routing (CIDR) notation. * Network Firewall supports all address ranges for IPv4. * </p> * <p> * Examples: * </p> * <ul> * <li> * <p> * To configure Network Firewall to inspect for the IP address 192.0.2.44, specify <code>192.0.2.44/32</code> * . * </p> * </li> * <li> * <p> * To configure Network Firewall to inspect for IP addresses from 192.0.2.0 to 192.0.2.255, specify * <code>192.0.2.0/24</code>. * </p> * </li> * </ul> * <p> * For more information about CIDR notation, see the Wikipedia entry <a * href="https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing">Classless Inter-Domain Routing</a>. */ public void setDestination(String destination) { this.destination = destination; } /** * <p> * The destination IP address or address range to inspect for, in CIDR notation. To match with any address, specify * <code>ANY</code>. * </p> * <p> * Specify an IP address or a block of IP addresses in Classless Inter-Domain Routing (CIDR) notation. Network * Firewall supports all address ranges for IPv4. * </p> * <p> * Examples: * </p> * <ul> * <li> * <p> * To configure Network Firewall to inspect for the IP address 192.0.2.44, specify <code>192.0.2.44/32</code>. * </p> * </li> * <li> * <p> * To configure Network Firewall to inspect for IP addresses from 192.0.2.0 to 192.0.2.255, specify * <code>192.0.2.0/24</code>. * </p> * </li> * </ul> * <p> * For more information about CIDR notation, see the Wikipedia entry <a * href="https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing">Classless Inter-Domain Routing</a>. * </p> * * @return The destination IP address or address range to inspect for, in CIDR notation. To match with any address, * specify <code>ANY</code>. </p> * <p> * Specify an IP address or a block of IP addresses in Classless Inter-Domain Routing (CIDR) notation. * Network Firewall supports all address ranges for IPv4. * </p> * <p> * Examples: * </p> * <ul> * <li> * <p> * To configure Network Firewall to inspect for the IP address 192.0.2.44, specify * <code>192.0.2.44/32</code>. * </p> * </li> * <li> * <p> * To configure Network Firewall to inspect for IP addresses from 192.0.2.0 to 192.0.2.255, specify * <code>192.0.2.0/24</code>. * </p> * </li> * </ul> * <p> * For more information about CIDR notation, see the Wikipedia entry <a * href="https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing">Classless Inter-Domain Routing</a>. */ public String getDestination() { return this.destination; } /** * <p> * The destination IP address or address range to inspect for, in CIDR notation. To match with any address, specify * <code>ANY</code>. * </p> * <p> * Specify an IP address or a block of IP addresses in Classless Inter-Domain Routing (CIDR) notation. Network * Firewall supports all address ranges for IPv4. * </p> * <p> * Examples: * </p> * <ul> * <li> * <p> * To configure Network Firewall to inspect for the IP address 192.0.2.44, specify <code>192.0.2.44/32</code>. * </p> * </li> * <li> * <p> * To configure Network Firewall to inspect for IP addresses from 192.0.2.0 to 192.0.2.255, specify * <code>192.0.2.0/24</code>. * </p> * </li> * </ul> * <p> * For more information about CIDR notation, see the Wikipedia entry <a * href="https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing">Classless Inter-Domain Routing</a>. * </p> * * @param destination * The destination IP address or address range to inspect for, in CIDR notation. To match with any address, * specify <code>ANY</code>. </p> * <p> * Specify an IP address or a block of IP addresses in Classless Inter-Domain Routing (CIDR) notation. * Network Firewall supports all address ranges for IPv4. * </p> * <p> * Examples: * </p> * <ul> * <li> * <p> * To configure Network Firewall to inspect for the IP address 192.0.2.44, specify <code>192.0.2.44/32</code> * . * </p> * </li> * <li> * <p> * To configure Network Firewall to inspect for IP addresses from 192.0.2.0 to 192.0.2.255, specify * <code>192.0.2.0/24</code>. * </p> * </li> * </ul> * <p> * For more information about CIDR notation, see the Wikipedia entry <a * href="https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing">Classless Inter-Domain Routing</a>. * @return Returns a reference to this object so that method calls can be chained together. */ public Header withDestination(String destination) { setDestination(destination); return this; } /** * <p> * The destination port to inspect for. You can specify an individual port, for example <code>1994</code> and you * can specify a port range, for example <code>1990:1994</code>. To match with any port, specify <code>ANY</code>. * </p> * * @param destinationPort * The destination port to inspect for. You can specify an individual port, for example <code>1994</code> and * you can specify a port range, for example <code>1990:1994</code>. To match with any port, specify * <code>ANY</code>. */ public void setDestinationPort(String destinationPort) { this.destinationPort = destinationPort; } /** * <p> * The destination port to inspect for. You can specify an individual port, for example <code>1994</code> and you * can specify a port range, for example <code>1990:1994</code>. To match with any port, specify <code>ANY</code>. * </p> * * @return The destination port to inspect for. You can specify an individual port, for example <code>1994</code> * and you can specify a port range, for example <code>1990:1994</code>. To match with any port, specify * <code>ANY</code>. */ public String getDestinationPort() { return this.destinationPort; } /** * <p> * The destination port to inspect for. You can specify an individual port, for example <code>1994</code> and you * can specify a port range, for example <code>1990:1994</code>. To match with any port, specify <code>ANY</code>. * </p> * * @param destinationPort * The destination port to inspect for. You can specify an individual port, for example <code>1994</code> and * you can specify a port range, for example <code>1990:1994</code>. To match with any port, specify * <code>ANY</code>. * @return Returns a reference to this object so that method calls can be chained together. */ public Header withDestinationPort(String destinationPort) { setDestinationPort(destinationPort); return this; } /** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getProtocol() != null) sb.append("Protocol: ").append(getProtocol()).append(","); if (getSource() != null) sb.append("Source: ").append(getSource()).append(","); if (getSourcePort() != null) sb.append("SourcePort: ").append(getSourcePort()).append(","); if (getDirection() != null) sb.append("Direction: ").append(getDirection()).append(","); if (getDestination() != null) sb.append("Destination: ").append(getDestination()).append(","); if (getDestinationPort() != null) sb.append("DestinationPort: ").append(getDestinationPort()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof Header == false) return false; Header other = (Header) obj; if (other.getProtocol() == null ^ this.getProtocol() == null) return false; if (other.getProtocol() != null && other.getProtocol().equals(this.getProtocol()) == false) return false; if (other.getSource() == null ^ this.getSource() == null) return false; if (other.getSource() != null && other.getSource().equals(this.getSource()) == false) return false; if (other.getSourcePort() == null ^ this.getSourcePort() == null) return false; if (other.getSourcePort() != null && other.getSourcePort().equals(this.getSourcePort()) == false) return false; if (other.getDirection() == null ^ this.getDirection() == null) return false; if (other.getDirection() != null && other.getDirection().equals(this.getDirection()) == false) return false; if (other.getDestination() == null ^ this.getDestination() == null) return false; if (other.getDestination() != null && other.getDestination().equals(this.getDestination()) == false) return false; if (other.getDestinationPort() == null ^ this.getDestinationPort() == null) return false; if (other.getDestinationPort() != null && other.getDestinationPort().equals(this.getDestinationPort()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getProtocol() == null) ? 0 : getProtocol().hashCode()); hashCode = prime * hashCode + ((getSource() == null) ? 0 : getSource().hashCode()); hashCode = prime * hashCode + ((getSourcePort() == null) ? 0 : getSourcePort().hashCode()); hashCode = prime * hashCode + ((getDirection() == null) ? 0 : getDirection().hashCode()); hashCode = prime * hashCode + ((getDestination() == null) ? 0 : getDestination().hashCode()); hashCode = prime * hashCode + ((getDestinationPort() == null) ? 0 : getDestinationPort().hashCode()); return hashCode; } @Override public Header clone() { try { return (Header) super.clone(); } catch (CloneNotSupportedException e) { throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e); } } @com.amazonaws.annotation.SdkInternalApi @Override public void marshall(ProtocolMarshaller protocolMarshaller) { com.amazonaws.services.networkfirewall.model.transform.HeaderMarshaller.getInstance().marshall(this, protocolMarshaller); } }
[ "" ]
2118efdccd2f08275cbebf3640021c9158ed5360
f0da100684df368520eba3613269a88bb50800c7
/Wscliente/src/java/clientservlet/ClienteConversor.java
f645c1479ed6d203591e338b55a2ccf4aecef5cb
[]
no_license
fgabrielqr/ConversorDeMoedas
3103e3735a2d310b814f9bc4fd35ed22860ebf49
c65bcb08810676e62c0c72efb05adba245c950d5
refs/heads/master
2023-01-30T09:17:35.409997
2020-12-02T23:45:39
2020-12-02T23:45:39
318,020,926
0
0
null
null
null
null
UTF-8
Java
false
false
4,961
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 clientservlet; import java.io.IOException; import java.io.PrintWriter; import java.text.DecimalFormat; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.xml.ws.WebServiceRef; import wsaula.ConversorService; /** * * @author fgabr */ @WebServlet(name = "ClienteConversor", urlPatterns = {"/ClienteConversor"}) public class ClienteConversor extends HttpServlet { @WebServiceRef(wsdlLocation = "WEB-INF/wsdl/localhost_8000/conversor.wsdl") private ConversorService service; /** * Processes requests for both HTTP <code>GET</code> and <code>POST</code> * methods. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String m = request.getParameter("moeda"); String a = request.getParameter("valor"); double b = Double.parseDouble(a); double result; DecimalFormat df = new DecimalFormat(); switch(m) { case "rd": result = realToDolar(b); break; case "dr": result = dolarToReal(b); break; case "re": result = realToEuro(b); break; case "er": result = euroToReal(b); break; case "rpa": result = realToPesoArgentino(b); break; case "par": result = pesoargentinoToReal(b); break; default: result = 0.0; } response.setContentType("text/html;charset=UTF-8"); try (PrintWriter out = response.getWriter()) { out.println("<!DOCTYPE html>"); out.println("<html>"); out.println("<head>"); out.println("<title>Resultado Conversão</title>"); out.println("</head>"); out.println("<body>"); out.println("<h3>Resultado: " + df.format(result) + "</h3>"); out.println("</body>"); out.println("</html>"); } } // <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code."> /** * Handles the HTTP <code>GET</code> method. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); } /** * Handles the HTTP <code>POST</code> method. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); } /** * Returns a short description of the servlet. * * @return a String containing servlet description */ @Override public String getServletInfo() { return "Short description"; }// </editor-fold> private double dolarToReal(double arg0) { wsaula.Conversor port = service.getConversorPort(); return port.dolarToReal(arg0); } private double euroToReal(double arg0) { wsaula.Conversor port = service.getConversorPort(); return port.euroToReal(arg0); } private double pesoargentinoToReal(double arg0) { wsaula.Conversor port = service.getConversorPort(); return port.pesoargentinoToReal(arg0); } private double realToDolar(double arg0) { wsaula.Conversor port = service.getConversorPort(); return port.realToDolar(arg0); } private double realToEuro(double arg0) { wsaula.Conversor port = service.getConversorPort(); return port.realToEuro(arg0); } private double realToPesoArgentino(double arg0) { wsaula.Conversor port = service.getConversorPort(); return port.realToPesoArgentino(arg0); } }
[ "fgabrielqr@gmail.com" ]
fgabrielqr@gmail.com
c78773a2e85aa54046a86dbf474b181a8d4eee58
7faf59d09d8902ab2d28176b511935e9962d3217
/src/main/java/com/smartech/course/racing/exception/RacingException.java
e4863c129e2b6625e25c486cb2d5c15b2fd4e6a3
[]
no_license
alexey-solomatin/racing-simulator
e56eda4a84345f8ea8d174e2488c4d2119fccf5f
bd967220e68fe905966a1b68b6f6b316561dc00b
refs/heads/master
2016-09-15T00:18:43.872686
2015-11-25T20:30:42
2015-11-27T14:22:39
44,610,046
0
0
null
null
null
null
UTF-8
Java
false
false
1,183
java
/** * */ package com.smartech.course.racing.exception; /** * Basic racing exception * @author Alexey Solomatin * */ public class RacingException extends Exception { /** * */ private static final long serialVersionUID = -5169344918041985529L; /** * */ public RacingException() { // TODO Auto-generated constructor stub } /** * @param message */ public RacingException(String message) { super(message); // TODO Auto-generated constructor stub } /** * @param cause */ public RacingException(Throwable cause) { super(cause); // TODO Auto-generated constructor stub } /** * @param message * @param cause */ public RacingException(String message, Throwable cause) { super(message, cause); // TODO Auto-generated constructor stub } /** * @param message * @param cause * @param enableSuppression * @param writableStackTrace */ public RacingException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { super(message, cause, enableSuppression, writableStackTrace); // TODO Auto-generated constructor stub } }
[ "alexey.solomatin@gmail.com" ]
alexey.solomatin@gmail.com
52097d6623127de51feeaa70fe1c8a0d7a1d8a58
c2f13575aaf5c528de9fe354f9c2690c22f053c5
/app/src/main/java/com/app/fr/fruiteefy/Util/cardpogo.java
6e036fc326694c83d59d51f3fc2649c4231742bd
[]
no_license
priyankaprojectsccube/Frutify
fc5269762ee5f4c82f1feaffbe65b557186d6135
8736b20fc1978e449fabdd9b1274c724024f2631
refs/heads/master
2023-02-15T00:39:13.140017
2021-01-05T05:04:15
2021-01-05T05:04:15
323,298,378
0
0
null
null
null
null
UTF-8
Java
false
false
508
java
package com.app.fr.fruiteefy.Util; public class cardpogo { String id,cardtype,cardno; public String getId() { return id; } public void setId(String id) { this.id = id; } public String getCardtype() { return cardtype; } public void setCardtype(String cardtype) { this.cardtype = cardtype; } public String getCardno() { return cardno; } public void setCardno(String cardno) { this.cardno = cardno; } }
[ "priyankaccube9@gmail.com" ]
priyankaccube9@gmail.com
e002be9fbb3d0eb8df6bfb88cf7ea6076a1c28cf
2e46156b4234a9a347d2004c906d5ec835ec984b
/src/me/gteam/logman/service/impl/FittingdetailServiceImpl.java
676907d6e3bcb7a177a23c26acfa09e3e7947e39
[]
no_license
zhaoxudong/logman
4484262ddfaef600c02bca5b2c8f3e28b8a35246
b7ce51e82c4eb19e412b2dd22fe4d604754e093b
refs/heads/master
2021-01-23T11:55:54.022163
2015-03-10T07:38:45
2015-03-10T07:38:45
26,519,891
0
3
null
2014-11-12T11:02:12
2014-11-12T04:54:59
Java
UTF-8
Java
false
false
1,105
java
package me.gteam.logman.service.impl; import java.io.Serializable; import java.util.Collection; import javax.annotation.Resource; import org.springframework.stereotype.Service; import me.gteam.logman.dao.FittingdetailDao; import me.gteam.logman.domain.Fittingdetail; import me.gteam.logman.service.FittingdetailService; @Service("fittingdetailService") public class FittingdetailServiceImpl implements FittingdetailService{ @Resource(name="fittingdetailDao") private FittingdetailDao fittingdetailDao; public void saveFittingdetail(Fittingdetail fittingdetail) { this.fittingdetailDao.saveEntry(fittingdetail); } public void updateFittingdetail(Fittingdetail fittingdetail){ this.fittingdetailDao.updateEntry(fittingdetail); } public void deleteFittingdetailByID(Serializable id, String deleteMode) { this.fittingdetailDao.deleteEntry(id); } public Collection<Fittingdetail> getAllFittingdetail() { return this.fittingdetailDao.getAllEntry(); } public Fittingdetail getFittingdetailById(Serializable id) { return (Fittingdetail)this.fittingdetailDao.getEntryById(id); } }
[ "1165399120@qq.com" ]
1165399120@qq.com
56b4944c093ade9f844964efaaac0297df11ebc6
3a1d860a1740252c963186f010df06e4b42343d9
/compiler-plugin/src/main/java/io/ballerina/stdlib/rabbitmq/plugin/PluginConstants.java
ca021e1f900dcdbcb3957b331ce9292cc468318a
[ "Apache-2.0" ]
permissive
hevayo/module-ballerinax-rabbitmq
d9152cf9851c64d278d69a12aedd919e10ff86fa
78c9159950c667dad094bf3d9aa8321b4c7f4e35
refs/heads/master
2023-07-05T11:14:56.239575
2021-08-19T10:49:07
2021-08-19T10:49:07
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,570
java
/* * Copyright (c) 2021, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. * * WSO2 Inc. 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 io.ballerina.stdlib.rabbitmq.plugin; /** * RabbitMQ compiler plugin constants. */ public class PluginConstants { // compiler plugin constants public static final String PACKAGE_PREFIX = "rabbitmq"; public static final String PACKAGE_ORG = "ballerinax"; public static final String REMOTE_QUALIFIER = "REMOTE"; public static final String ON_MESSAGE_FUNC = "onMessage"; public static final String ON_REQUEST_FUNC = "onRequest"; public static final String ON_ERROR_FUNC = "onError"; // parameters public static final String MESSAGE = "Message"; public static final String CALLER = "Caller"; public static final String CONTENT_FIELD = "content"; public static final String ROUTING_KEY_FIELD = "routingKey"; public static final String EXCHANGE_FIELD = "exchange"; public static final String PROPS_FIELD = "properties"; public static final String DELIVERY_TAG_FIELD = "deliveryTag"; public static final String ERROR_PARAM = "Error"; // return types error or nil public static final String ERROR = "error"; public static final String RABBITMQ_ERROR = PACKAGE_PREFIX + ":" + ERROR_PARAM; public static final String NIL = "?"; public static final String ERROR_OR_NIL = ERROR + NIL; public static final String NIL_OR_ERROR = "()|" + ERROR; public static final String RABBITMQ_ERROR_OR_NIL = RABBITMQ_ERROR + NIL; public static final String NIL_OR_RABBITMQ_ERROR = "()|" + RABBITMQ_ERROR; static final String[] ANY_DATA_RETURN_VALUES = {ERROR, RABBITMQ_ERROR, ERROR_OR_NIL, RABBITMQ_ERROR_OR_NIL, NIL_OR_ERROR, NIL_OR_RABBITMQ_ERROR, "string", "int", "float", "decimal", "boolean", "xml", "anydata", "string|error", "int|error", "float|error", "decimal|error", "boolean|error", "xml|error", "anydata|error", "error|string", "error|int", "float|error", "error|decimal", "error|boolean", "error|boolean", "error|anydata", "string?", "anydata?", "int?", "float?", "decimal?", "xml?", "boolean?"}; /** * Compilation errors. */ enum CompilationErrors { ON_MESSAGE_OR_ON_REQUEST("Only one of either onMessage or onRequest is allowed.", "RABBITMQ_101"), NO_ON_MESSAGE_OR_ON_REQUEST("Service must have either remote method onMessage or onRequest.", "RABBITMQ_102"), INVALID_REMOTE_FUNCTION("Invalid remote method.", "RABBITMQ_103"), INVALID_FUNCTION("Resource functions are not allowed.", "RABBITMQ_104"), FUNCTION_SHOULD_BE_REMOTE("Method must have the remote qualifier.", "RABBITMQ_105"), MUST_HAVE_MESSAGE("Must have the method parameter rabbitmq:Message.", "RABBITMQ_106"), MUST_HAVE_MESSAGE_AND_ERROR("Must have the method parameters rabbitmq:Message and rabbitmq:Error.", "RABBITMQ_107"), INVALID_FUNCTION_PARAM_MESSAGE("Invalid method parameter. Only rabbitmq:Message is allowed.", "RABBITMQ_108"), INVALID_FUNCTION_PARAM_ERROR("Invalid method parameter. Only rabbitmq:Error is allowed.", "RABBITMQ_109"), INVALID_FUNCTION_PARAM_CALLER("Invalid method parameter. Only rabbitmq:Caller is allowed.", "RABBITMQ_110"), ONLY_PARAMS_ALLOWED("Invalid method parameter count. Only rabbitmq:Message and " + "rabbitmq:Caller are allowed.", "RABBITMQ_111"), ONLY_PARAMS_ALLOWED_ON_ERROR("Invalid method parameter count. Only rabbitmq:Message and " + "rabbitmq:Error are allowed.", "RABBITMQ_112"), INVALID_RETURN_TYPE_ERROR_OR_NIL("Invalid return type. Only error? or rabbitmq:Error? is allowed.", "RABBITMQ_113"), INVALID_RETURN_TYPE_ANY_DATA("Invalid return type. Only anydata or error is allowed.", "RABBITMQ_114"), INVALID_MULTIPLE_LISTENERS("Multiple listener attachments. Only one rabbitmq:Listener is allowed.", "RABBITMQ_115"), INVALID_ANNOTATION_NUMBER("Only one service config annotation is allowed.", "RABBITMQ_116"), NO_ANNOTATION("No @rabbitmq:ServiceConfig{} annotation is found.", "RABBITMQ_117"), INVALID_ANNOTATION("Invalid service config annotation. Only @rabbitmq:ServiceConfig{} is allowed.", "RABBITMQ_118"), INVALID_SERVICE_ATTACH_POINT("Invalid service attach point. Only string literals are allowed.", "RABBITMQ_119"); private final String error; private final String errorCode; CompilationErrors(String error, String errorCode) { this.error = error; this.errorCode = errorCode; } String getError() { return error; } String getErrorCode() { return errorCode; } } private PluginConstants() { } }
[ "arshika.nm@gmail.com" ]
arshika.nm@gmail.com
7442cb8d370b8d96d23f7aef14ce7a5460961661
75767e4c4e615a307ee4ec4979e7fbd2614bdf5b
/src/main/java/com/ydh/redsheep/entity/TableNameBO.java
abab3154942428885f1ddebd3daae886ef6122d6
[]
no_license
yangdehong/mapper_model
ca856d9dadea6a7f12f21e9623fc59eaf9f74164
778b91228052938b1921df24c6979591c534bc22
refs/heads/master
2022-07-26T13:00:28.785450
2020-08-26T03:59:05
2020-08-26T03:59:05
195,197,689
1
0
null
2020-07-01T23:42:10
2019-07-04T08:08:56
Java
UTF-8
Java
false
false
357
java
package com.ydh.redsheep.entity; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; /** * * @author : yangdehong * @date : 2019-07-04 15:02 */ @Data @NoArgsConstructor @AllArgsConstructor public class TableNameBO { private String tableName; private String bigTableName; private String smallTableName; }
[ "ydh199078" ]
ydh199078
c9711ab818a9712b7228a019f3f82ec90fcfc172
4edb7fc276c97c1fd495b63967624ae30d099b9d
/src/main/java/br/com/ebdes/desafiolecom/controladores/ClienteController.java
0d0bd8a3cb1e95d7da9cba12d9728441986d2f14
[]
no_license
krawler/desafioLecom
0250be2f6b34576f8a8f8e0f54b77fdf4b54b4a2
a3277af0b029d6226f7d4c5df5a2ae05f4a91bb1
refs/heads/master
2021-01-10T08:34:51.361817
2015-11-03T18:23:58
2015-11-03T18:23:58
43,437,375
1
0
null
2015-10-14T01:26:11
2015-09-30T14:20:46
JavaScript
UTF-8
Java
false
false
2,019
java
package br.com.ebdes.desafiolecom.controladores; import java.util.List; import java.util.logging.Logger; import javax.websocket.server.PathParam; import javax.validation.Valid; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.servlet.ModelAndView; import br.com.ebdes.desafiolecom.dao.DAOCliente; import br.com.ebdes.desafiolecom.dao.DAOOrdemServico; import br.com.ebdes.desafiolecom.dao.DAOServico; import br.com.ebdes.desafiolecom.entidades.Cliente; import br.com.ebdes.desafiolecom.entidades.OrdemServico; @Controller @RequestMapping("/cliente") public class ClienteController { private static Logger logger = Logger.getLogger("ClienteController"); @Autowired private DAOCliente daoCliente; @RequestMapping("/listar") public ModelAndView listar(){ return new ModelAndView("cliente/listar") .addObject("clientes", daoCliente.list(0, 20)); } @RequestMapping("/cadastro") public ModelAndView cadastro(){ ModelAndView mav = new ModelAndView("cliente/cadastro"); mav.getModel().put("cliente", new Cliente()); mav.getModel().put("campo", ""); return mav; } @RequestMapping("/cadastro/{id}") public ModelAndView cadastro(@PathVariable("id") Long id){ ModelAndView mav = new ModelAndView(); mav.getModel().put("cliente", daoCliente.get(id)); mav.setViewName("cliente/cadastro"); return mav; } @RequestMapping(value="/incluir", method=RequestMethod.POST) public String incluir(@Valid Cliente cliente, String campo){ daoCliente.persistir(cliente); return "redirect:listar"; } @RequestMapping(value="/excluir/{id}") public String excluir(@PathVariable("id") Long id){ Cliente cliente = daoCliente.get(id); daoCliente.excluir(cliente); return "redirect:../listar"; } }
[ "august.rafael@gmail.com" ]
august.rafael@gmail.com
4dc6009fa95f4bf0cddc19d373586a9d594e11a9
f54d7225d1b89c4a846e28555d64918431e84d14
/Source/jProtocol/src/jProtocol/helper/ByteHelper.java
e2a8053c3a42b36639e311cd6349cc7263f17f62
[]
no_license
tompetersen/bachelor-thesis
a63c6dfe961f0ee7c282d9768efa316a5f974311
3839f24d6e9526ff8c57df05b2490ef793bac834
refs/heads/master
2020-12-29T18:48:07.782660
2016-01-13T14:27:33
2016-01-13T14:27:33
35,272,199
0
0
null
null
null
null
UTF-8
Java
false
false
4,226
java
package jProtocol.helper; import java.nio.ByteBuffer; /** * Some convenience methods used for byte array conversions. * * @author Tom Petersen, 2015 */ public class ByteHelper { /** * Converts a hex encoded byte string to a byte array. * * @param s the hex string, e.g. 00 5f 73 f4 (without spaces) * * @return the resulting byte array */ public static byte[] hexStringToBytes(String s) { if (s.length() % 2 != 0) { throw new RuntimeException("Hexstring must have even length."); } int len = s.length(); byte[] data = new byte[len / 2]; for (int i = 0; i < len; i += 2) { data[i / 2] = (byte) ((Character.digit(s.charAt(i), 16) << 4) + Character.digit(s.charAt(i+1), 16)); } return data; } final protected static char[] hexArray = "0123456789ABCDEF".toCharArray(); /** * Converts a byte array to a hex encoded byte string. * * @param bytes the byte array * * @return the resulting hex string */ public static String bytesToHexString(byte[] bytes) { char[] hexChars = new char[bytes.length * 2]; for ( int j = 0; j < bytes.length; j++ ) { int v = bytes[j] & 0xFF; hexChars[j * 2] = hexArray[v >>> 4]; hexChars[j * 2 + 1] = hexArray[v & 0x0F]; } return new String(hexChars); } /** * Concatenates two byte arrays. * * @param a byte array a * @param b byte array b * * @return the concatenated byte array [a]+[b] */ public static byte[] concatenate(byte[] a, byte[] b) { byte[] result = new byte[a.length + b.length]; System.arraycopy(a, 0, result, 0, a.length); System.arraycopy(b, 0, result, a.length, b.length); return result; } /** * Creates byte array of bytes of a long variable. * * @param l the long variable * * @return the bytes */ public static byte[] longToByteArray(long l) { ByteBuffer buffer = ByteBuffer.allocate(Long.BYTES); buffer.putLong(l); return buffer.array(); } /** * Converts an int value to a four byte array. * * @param value the int value * * @return the byte array (big endian) */ public static byte[] intToByteArray(int value) { return new byte[] { (byte)(value >>> 24), (byte)(value >>> 16), (byte)(value >>> 8), (byte)value}; } /** * Converts a four byte array to its int value. * * @param b the byte array (big endian) * * @return the int value */ public static int byteArrayToInt(byte[] b) { if (b.length != 4) { throw new IllegalArgumentException("Array must have length 4!"); } return b[3] & 0xFF | (b[2] & 0xFF) << 8 | (b[1] & 0xFF) << 16 | (b[0] & 0xFF) << 24; } /** * Converts an int value to a three byte array. The first byte of the int value will be ignored. * * @param value the int value * * @return the byte array (big endian) */ public static byte[] intToThreeByteArray(int value) { return new byte[] { (byte)(value >>> 16), (byte)(value >>> 8), (byte)value}; } /** * Converts a three byte array to its int value. * * @param b the byte array (big endian) * * @return the int value */ public static int threeByteArrayToInt(byte[] b) { if (b.length != 3) { throw new IllegalArgumentException("Array must have length 3!"); } return b[2] & 0xFF | (b[1] & 0xFF) << 8 | (b[0] & 0xFF) << 16; } /** * Converts an int value to a two byte array. The first two bytes of the int value will be ignored. * * @param value the int value * * @return the byte array (big endian) */ public static byte[] intToTwoByteArray(int value) { return new byte[] { (byte)(value >>> 8), (byte)value}; } /** * Converts a two byte array to its int value. * * @param b the byte array (big endian) * * @return the int value */ public static int twoByteArrayToInt(byte[] b) { if (b.length != 2) { throw new IllegalArgumentException("Array must have length 2!"); } return b[1] & 0xFF | (b[0] & 0xFF) << 8; } }
[ "toomy1@gmx.de" ]
toomy1@gmx.de
6c00468a6c6cacb836fe42ef9fd7113729291616
f0ac7fade85dd9683d1fb7a8361194b1d0778dca
/src/Documento.java
5c25a352f36b1ab6964ccbcff712884df63b1809
[]
no_license
pcastro86/ProyectoCurso
50dbdf36fda65f74ac29066e7b0f54c5a778fcf6
993871d30a6c456d403cb5b4bb4d1c8ce50dabca
refs/heads/main
2022-12-27T20:18:05.829413
2020-10-18T16:36:28
2020-10-18T16:36:28
305,147,203
0
0
null
null
null
null
UTF-8
Java
false
false
169
java
public class Documento { public String tipo; public int numero; public void mostrarDocumento(){ System.out.println(tipo + " : " + numero); } }
[ "pilarcastro86@gmail.com" ]
pilarcastro86@gmail.com
62ac4fe14ad252e76a88bf8bd4e67938b16ec6bd
da12945a17295cf4f0ec89361467cfaa45722a43
/CapBook/src/main/java/com/cg/capbook/beans/Notifications.java
43ca17ec53cdcd717b270d349f102f98363f84b0
[]
no_license
Renukavarma/Team1_CapBook_Repo
633023294f4024e32bac40afcab6d137ec4512e8
ebbc7c94811645dd93e4b9f3bcd2c5d3af23c5cc
refs/heads/master
2020-04-09T07:11:22.742517
2018-12-11T06:50:39
2018-12-11T06:50:39
160,144,373
0
0
null
null
null
null
UTF-8
Java
false
false
995
java
package com.cg.capbook.beans; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.ManyToOne; @Entity public class Notifications { @Id @GeneratedValue(strategy=GenerationType.SEQUENCE) private int notificationId; @ManyToOne private Person person; private String message; public Notifications() { } public Notifications( Person person, String message) { super(); this.person = person; this.message = message; } public int getNotificationId() { return notificationId; } public void setNotificationId(int notificationId) { this.notificationId = notificationId; } public Person getPerson() { return person; } public void setPerson(Person person) { this.person = person; } public String getMessage() { return message; } public void setMessage(String message) { this.message = message; } }
[ "ktirunag@PUNHWD13104.corp.capgemini.com" ]
ktirunag@PUNHWD13104.corp.capgemini.com
96d7c09d1d8e0930d8a124fefd0074b5f8c587e6
941fd5f1402dcb2c6e7eb1cb567e09f856d66818
/src/controller/Admin_chinhsuachitietthongtinnguoidung.java
c50c7fd129007cc5560993faee4bb536e160c34e
[]
no_license
ThienCN/QuanLyTTTinHoc
9d7fa34ddf1145d209b5617cff7ef3da595ed2ed
571a74ca581315c6c4d9cea21ed3ec0f21b6b4b9
refs/heads/master
2022-02-22T15:59:38.955825
2019-09-17T05:25:54
2019-09-17T05:25:54
113,864,039
0
0
null
2017-12-29T16:56:59
2017-12-11T13:44:41
Java
UTF-8
Java
false
false
3,084
java
package controller; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.google.gson.Gson; import DAO.AdminDAO; import model.NguoiDungModel; @WebServlet("/Admin_chinhsuachitietthongtinnguoidung") public class Admin_chinhsuachitietthongtinnguoidung extends HttpServlet { private static final long serialVersionUID = 1L; public Admin_chinhsuachitietthongtinnguoidung() { super(); } protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { request.getRequestDispatcher("./WEB-INF/Admin_chinh-sua-chi-tiet-thong-tin-ND.jsp").forward(request, response); } protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { int flag=Integer.parseInt(request.getParameter("flag")); response.setContentType("application/json;charset=UTF-8"); request.setCharacterEncoding("utf-8"); PrintWriter out = response.getWriter(); //flag=1: Load thông tin người dùng cần chỉnh sửa lên trang if(flag == 1) { NguoiDungModel nguoiDungChinhSuaThongTin = (NguoiDungModel)getServletContext().getAttribute("nguoiDungChinhSuaThongTin"); if(nguoiDungChinhSuaThongTin != null) { Gson gson = new Gson(); String objectToReturn = gson.toJson(nguoiDungChinhSuaThongTin); out.write(objectToReturn); out.flush(); } else { out.write("{\"check\":\"fail\"}"); out.flush(); } } //flag=2: Cập nhật người dùng if(flag == 2) { String maND = request.getParameter("maND"); String hoTen = request.getParameter("hoTen"); String CMND = request.getParameter("CMND"); String ngaySinh = request.getParameter("ngaySinh"); String diaChi = request.getParameter("diaChi"); String SDT = request.getParameter("SDT"); boolean gioiTinh = Boolean.parseBoolean(request.getParameter("gioiTinh")); String trinhDoHV = request.getParameter("trinhDoHV"); String email = request.getParameter("email"); String matKhau = request.getParameter("matKhau"); int chucDanh = Integer.parseInt(request.getParameter("chucDanh")); //3: Nhân viên //4: Quản trị viên if(chucDanh == 3) { int kq = AdminDAO.CapNhatNhanVien(maND, hoTen, ngaySinh, diaChi, SDT, CMND, trinhDoHV, email, gioiTinh, matKhau); if(kq>0) { out.write("{\"check\":\"ok\"}"); out.flush(); } else { out.write("{\"check\":\"fail\"}"); out.flush(); } } if(chucDanh == 4) { int kq = AdminDAO.CapNhatQuanTriVien(maND, hoTen, ngaySinh, diaChi, SDT, CMND, trinhDoHV, email, gioiTinh, matKhau); if(kq>0) { out.write("{\"check\":\"ok\"}"); out.flush(); } else { out.write("{\"check\":\"fail\"}"); out.flush(); } } } } }
[ "hoangkimphung070994@gmail.com" ]
hoangkimphung070994@gmail.com
f3477a561aa0bceff23c8c1d88e36d19fc539ddc
8b7d1b2450f2262cee1375ce7d8ae4e6fd3d872c
/src/Method/Transmission.java
541077abe3c86b356272b17ad1e8bad7f30b0deb
[]
no_license
shiqun1992/MC-Top-K
8f125c5013a2c72ef8affa1b40ad496374abccd1
ee901985bfa3f4d1f4ef8c43bc4b9950946eca43
refs/heads/master
2021-07-21T14:37:17.272362
2017-10-30T07:17:33
2017-10-30T07:17:33
108,815,212
0
0
null
null
null
null
UTF-8
Java
false
false
1,876
java
package Method; import Adlist.Data.Data; import Adlist.Pattern.Pattern; import java.util.*; /** * Created by shiqun on 16/7/13. */ public class Transmission { Pattern pattern; Data data; public Transmission(Data data, Pattern pattern) { this.data = data; this.pattern = pattern; } //只是找一个结果; public void startWithTermination(MidsideNode Parent, MidsideNode child) { //使用递归的方式; //找到一个统计分数然后加入到堆栈中去;/ //用来判断一个点是否能够能成匹配; Set<Integer> Patternids = new HashSet<>(); //递归遍历孩子节点; Iterator iter = child.TrustWithchild.entrySet().iterator(); while (iter.hasNext()) { //获取一个孩子; Map.Entry entry = (Map.Entry) iter.next(); MidsideNode nextChild = (MidsideNode) entry.getKey(); startWithTermination(Parent, nextChild); // if (nextChild.isMatching == true) { Patternids.add(nextChild.MatchedPatternNodeid); } } if (Patternids.size()==pattern.adlist .get(child.MatchedPatternNodeid).outdegree) { child.isMatching =true; iter = child.TrustWithchild.entrySet().iterator(); while (iter.hasNext()) { //获取一个孩子; Map.Entry entry = (Map.Entry) iter.next(); // double trust = (double) entry.getValue(); Parent.sumOfTrust_low += trust; Parent.matchingPaths_low++; // MidsideNode nextChild = (MidsideNode) entry.getKey(); Parent.matches_low.add(nextChild.dataVNode); } } } }
[ "1229587131@qq.com" ]
1229587131@qq.com
aa2fbea66cc12ad22b94809ca8391c0a6bf650da
14302b0744259ff3d527ddd09103d784158cf8f8
/ssm_parent/ssm_dao/src/main/java/com/itheima/ssm/pojo/Items.java
9cc513aba5799f7c1248736eb6d8e2925a1d7872
[]
no_license
jj89757wl/java_repo3
88ecd4e2f39f913d5c5ef5da17ee5f1ed9622974
98ffb7dfdd3cd72631bc7fe9e6ce9f69d53cad50
refs/heads/master
2022-12-22T14:09:44.683613
2019-07-19T03:39:07
2019-07-19T03:39:07
197,696,861
0
0
null
2022-12-15T23:42:38
2019-07-19T03:40:21
HTML
UTF-8
Java
false
false
1,482
java
package com.itheima.ssm.pojo; import java.util.Date; /** * @version:1.8 * @Auther:JJ89757 * @Date:2019/7/1 14:25 */ public class Items { private Integer id; private String name; private Float price; private String pic; private Date createtime; private String detail; public Items() { } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public Float getPrice() { return price; } public void setPrice(Float price) { this.price = price; } public String getPic() { return pic; } public void setPic(String pic) { this.pic = pic; } public Date getCreatetime() { return createtime; } public void setCreatetime(Date createtime) { this.createtime = createtime; } public String getDetail() { return detail; } public void setDetail(String detail) { this.detail = detail; } @Override public String toString() { return "Items{" + "id=" + id + ", name='" + name + '\'' + ", price=" + price + ", pic='" + pic + '\'' + ", createtime=" + createtime + ", detail='" + detail + '\'' + '}'; } }
[ "jj89757wl@hotmail.com" ]
jj89757wl@hotmail.com
27bc1d92d5f8e7094df1b5ecbdf46a6c01df3afd
d332cb0c7cd491293fd659950f95ee71faad3b68
/com/dailycoder/journaldev/PrimeNumberCheck.java
272859ebe772f191a5cd910d9b74073d1752c7fa
[]
no_license
tushar77more/DailyCoder
654a6f3724d2a34d2426c1b8b1c62d4cb15771a6
20401c7b3afa1da69a6ee8ed6fa3d1f80ae26592
refs/heads/main
2023-05-13T12:27:05.552690
2021-05-30T12:15:14
2021-05-30T12:15:14
367,273,120
0
0
null
2021-05-23T09:51:05
2021-05-14T06:41:47
Java
UTF-8
Java
false
false
507
java
package com.dailycoder.journaldev; public class PrimeNumberCheck { public static void main(String[] args) { int a = 19; int b = 49; System.out.println("Number "+a+" is prime "+isPrime(a)); System.out.println("Number "+b+" is prime "+isPrime(b)); } private static boolean isPrime(int a) { if(a==0 || a==1) return false; if(a==2) return true; for(int i=2;i<a/2;i++) { if(a % i==0) return false; } return true; } }
[ "noreply@github.com" ]
tushar77more.noreply@github.com
c76488969393c6f17a7a7b9ca6b8421cadf0de06
6ef8b5510394c70564a2a420a2d17e26a1b17862
/app/src/main/java/com/iranplanner/tourism/iranplanner/ui/fragment/pandaMap/MapPandaComponent.java
aa4abf2fcdfba339671dea60686a1f260fefc507
[]
no_license
HoDaVM/IranPlanner
cf07834a6f904ca94e853ecf313e2642704af784
85dd37987b0bd5582f439f9d0e42f88d7b1acc6a
refs/heads/master
2020-03-28T19:29:41.100559
2018-09-16T07:12:48
2018-09-16T07:12:49
148,982,244
0
0
null
null
null
null
UTF-8
Java
false
false
684
java
package com.iranplanner.tourism.iranplanner.ui.fragment.pandaMap; import com.iranplanner.tourism.iranplanner.di.data.component.NetComponent; import com.iranplanner.tourism.iranplanner.di.model.CustomScope; import com.iranplanner.tourism.iranplanner.ui.activity.login.LoginActivity; import com.iranplanner.tourism.iranplanner.ui.activity.login.LoginModule; import com.iranplanner.tourism.iranplanner.ui.fragment.LoginFragment; import dagger.Component; /** * Created by Hoda on 11-May-16. */ @CustomScope @Component(dependencies = NetComponent.class, modules = {MapPandaModule.class}) public interface MapPandaComponent { void inject(MapPandaFragment mapPandaFragment); }
[ "aahrabian@gmail.com" ]
aahrabian@gmail.com
510be0900c7d23f1e875f55e00619fa62e39ecb8
35f069aad9f7040e20494dac11f826bba41d029e
/src/main/java/com/fiveamsolutions/vtools/service/UserService.java
024c1b2e43579a14de4c0f0099caf56d099f907b
[]
no_license
v-makarenko/vtoolsmq
4be3bc3965aaeeee2d64c359a30f6f18617f354d
8a0dd75b196c0e641bb8b4b20124540aaaa2814b
refs/heads/master
2021-01-10T02:04:58.893206
2015-12-03T16:34:44
2015-12-03T16:34:44
47,275,758
0
0
null
null
null
null
UTF-8
Java
false
false
6,629
java
package com.fiveamsolutions.vtools.service; import com.fiveamsolutions.vtools.domain.Authority; import com.fiveamsolutions.vtools.domain.PersistentToken; import com.fiveamsolutions.vtools.domain.User; import com.fiveamsolutions.vtools.repository.AuthorityRepository; import com.fiveamsolutions.vtools.repository.PersistentTokenRepository; import com.fiveamsolutions.vtools.repository.UserRepository; import com.fiveamsolutions.vtools.security.SecurityUtils; import com.fiveamsolutions.vtools.service.util.RandomUtil; import java.time.ZonedDateTime; import java.time.LocalDate; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.stereotype.Service; import javax.inject.Inject; import java.util.*; /** * Service class for managing users. */ @Service public class UserService { private final Logger log = LoggerFactory.getLogger(UserService.class); @Inject private PasswordEncoder passwordEncoder; @Inject private UserRepository userRepository; @Inject private PersistentTokenRepository persistentTokenRepository; @Inject private AuthorityRepository authorityRepository; public Optional<User> activateRegistration(String key) { log.debug("Activating user for activation key {}", key); userRepository.findOneByActivationKey(key) .map(user -> { // activate given user for the registration key. user.setActivated(true); user.setActivationKey(null); userRepository.save(user); log.debug("Activated user: {}", user); return user; }); return Optional.empty(); } public Optional<User> completePasswordReset(String newPassword, String key) { log.debug("Reset user password for reset key {}", key); return userRepository.findOneByResetKey(key) .filter(user -> { ZonedDateTime oneDayAgo = ZonedDateTime.now().minusHours(24); return user.getResetDate().isAfter(oneDayAgo); }) .map(user -> { user.setPassword(passwordEncoder.encode(newPassword)); user.setResetKey(null); user.setResetDate(null); userRepository.save(user); return user; }); } public Optional<User> requestPasswordReset(String mail) { return userRepository.findOneByEmail(mail) .filter(User::getActivated) .map(user -> { user.setResetKey(RandomUtil.generateResetKey()); user.setResetDate(ZonedDateTime.now()); userRepository.save(user); return user; }); } public User createUserInformation(String login, String password, String firstName, String lastName, String email, String langKey) { User newUser = new User(); Authority authority = authorityRepository.findOne("ROLE_USER"); Set<Authority> authorities = new HashSet<>(); String encryptedPassword = passwordEncoder.encode(password); newUser.setLogin(login); // new user gets initially a generated password newUser.setPassword(encryptedPassword); newUser.setFirstName(firstName); newUser.setLastName(lastName); newUser.setEmail(email); newUser.setLangKey(langKey); // new user is not active newUser.setActivated(false); // new user gets registration key newUser.setActivationKey(RandomUtil.generateActivationKey()); authorities.add(authority); newUser.setAuthorities(authorities); userRepository.save(newUser); log.debug("Created Information for User: {}", newUser); return newUser; } public void updateUserInformation(String firstName, String lastName, String email, String langKey) { userRepository.findOneByLogin(SecurityUtils.getCurrentUser().getUsername()).ifPresent(u -> { u.setFirstName(firstName); u.setLastName(lastName); u.setEmail(email); u.setLangKey(langKey); userRepository.save(u); log.debug("Changed Information for User: {}", u); }); } public void changePassword(String password) { userRepository.findOneByLogin(SecurityUtils.getCurrentUser().getUsername()).ifPresent(u -> { String encryptedPassword = passwordEncoder.encode(password); u.setPassword(encryptedPassword); userRepository.save(u); log.debug("Changed password for User: {}", u); }); } public Optional<User> getUserWithAuthoritiesByLogin(String login) { return userRepository.findOneByLogin(login).map(u -> { u.getAuthorities().size(); return u; }); } public User getUserWithAuthorities(String id) { User user = userRepository.findOne(id); user.getAuthorities().size(); // eagerly load the association return user; } public User getUserWithAuthorities() { User user = userRepository.findOneByLogin(SecurityUtils.getCurrentUser().getUsername()).get(); user.getAuthorities().size(); // eagerly load the association return user; } /** * Persistent Token are used for providing automatic authentication, they should be automatically deleted after * 30 days. * <p/> * <p> * This is scheduled to get fired everyday, at midnight. * </p> */ @Scheduled(cron = "0 0 0 * * ?") public void removeOldPersistentTokens() { LocalDate now = LocalDate.now(); persistentTokenRepository.findByTokenDateBefore(now.minusMonths(1)).stream().forEach(token -> { log.debug("Deleting token {}", token.getSeries()); persistentTokenRepository.delete(token); }); } /** * Not activated users should be automatically deleted after 3 days. * <p/> * <p> * This is scheduled to get fired everyday, at 01:00 (am). * </p> */ @Scheduled(cron = "0 0 1 * * ?") public void removeNotActivatedUsers() { ZonedDateTime now = ZonedDateTime.now(); List<User> users = userRepository.findAllByActivatedIsFalseAndCreatedDateBefore(now.minusDays(3)); for (User user : users) { log.debug("Deleting not activated user {}", user.getLogin()); userRepository.delete(user); } } }
[ "icarter@5amsolutions.com" ]
icarter@5amsolutions.com
a573e9297f921166d43c5aa7f63bc9589355cdbe
09515ff5dc08354a7e0c2219524e965ee19f92de
/src/main/java/ua/com/smiddle/emulator/Application.java
277420abce3c20f52a3aa77861d815275c6b673e
[]
no_license
KryvkoSergii/emulator
a7b35d6ef369d627fcbabf7405beffb36e59f292
4d6820adcac5c3ef97f3e6a47d4470e8027cc6aa
refs/heads/master
2020-12-24T09:07:48.416804
2016-12-09T16:12:15
2016-12-09T16:12:15
73,307,654
0
0
null
null
null
null
UTF-8
Java
false
false
3,463
java
package ua.com.smiddle.emulator; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.annotation.*; import org.springframework.scheduling.annotation.EnableAsync; import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; import org.springframework.web.servlet.ViewResolver; import org.springframework.web.servlet.config.annotation.DefaultServletHandlerConfigurer; import org.springframework.web.servlet.config.annotation.EnableWebMvc; import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; import org.springframework.web.servlet.view.InternalResourceViewResolver; import org.springframework.web.servlet.view.JstlView; import ua.com.smiddle.emulator.core.model.ServerDescriptor; import ua.com.smiddle.emulator.core.services.Transport; import java.util.concurrent.Executor; /** * @author srg on 14.09.16. * @project emulator */ @SpringBootApplication @EnableWebMvc @Configuration @EnableAutoConfiguration @EnableScheduling @EnableAsync @ComponentScan(basePackages = "ua.com.smiddle.emulator.core") @PropertySource("classpath:application.properties") public class Application extends WebMvcConfigurerAdapter { public static void main(String[] args) { SpringApplication.run(Application.class, args); } @Bean(name = "threadPoolSender") public Executor threadPoolTaskExecutor() { ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); executor.setCorePoolSize(4); executor.setMaxPoolSize(10); executor.setQueueCapacity(7000); executor.setThreadNamePrefix("EventSenderThread-"); executor.initialize(); return executor; } @Bean(name = "Transport", destroyMethod = "destroyBean") @Scope(value = "prototype") public Transport getTransport() { return new Transport(); } @Bean(name = "ServerDescriptor") @Scope(value = "prototype") public ServerDescriptor clientConnection() { return new ServerDescriptor(); } @Override public void addResourceHandlers(ResourceHandlerRegistry registry) { registry .addResourceHandler("/recourses/**") .addResourceLocations("/recourses/"); } @Override public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer) { configurer.enable(); } @Bean @Description("Вспомагательный класс который указывает фреймворку откуда брать страницы для отображения") public ViewResolver setupViewResolver() { InternalResourceViewResolver resolver = new InternalResourceViewResolver(); resolver.setPrefix("/WEB-INF/pages/"); resolver.setSuffix(".jsp"); resolver.setViewClass(JstlView.class); resolver.setOrder(1); return resolver; // // UrlBasedViewResolver resolver = new UrlBasedViewResolver(); // resolver.setPrefix("/WEB-INF/pages/"); // resolver.setSuffix(".jsp"); // resolver.setViewClass(JstlView.class); // resolver.setOrder(1); // return resolver; } }
[ "kryvkosergii@gmail.com" ]
kryvkosergii@gmail.com
45a28039c7313dbdc30b1ea5fad3bc17ed528e1b
3dd53282f1f3d7c00114253d914b20a81a382fb5
/Exception/RealisationException.java
785f50d0bf293f8d91ea4c23a267f18efbafa147
[]
no_license
ArVladan/Java-training
ca2f0a53a5c424585c319fcaf5900815359c9e16
3f51edb69605fb9c3fdde73285920714114f3a31
refs/heads/master
2021-06-11T07:52:43.206110
2016-12-11T21:01:01
2016-12-11T21:01:01
null
0
0
null
null
null
null
UTF-8
Java
false
false
284
java
package myexeption; public class RealisationException { static MyException a = new MyException(); public static void main(String[] args) { int p = 1234; int p2 = 123; try { a.test(p); a.test(p2); } catch (CastomException e) { System.out.println(e.getCastEx()); } } }
[ "vladan25@gmail.com" ]
vladan25@gmail.com
c951b9e748b684f8d2fb0f20ea1533ca13f803a6
57955a2d0e149586ea77062877963d9709d868de
/src/main/java/com/algaworks/os/api/model/ClienteResumoModel.java
22e15f2d57824a09489efa94e54a376feea8d0d4
[]
no_license
LucasTengan/serviceorder
967670bd4cf7d073fa9b7b72515ade1f94b3db8f
2d79024793e5add65622df53fca4aa397b753d0d
refs/heads/main
2023-03-31T17:30:45.739631
2021-04-04T21:11:43
2021-04-04T21:11:43
346,148,184
1
0
null
null
null
null
UTF-8
Java
false
false
147
java
package com.algaworks.os.api.model; import lombok.Data; @Data public class ClienteResumoModel { private Long id; private String nome; }
[ "lucastengan@usp.br" ]
lucastengan@usp.br
b302bdc816fa2212ddf958da9145a9897134e827
d65f8942aa4fdd1a0aeef6e7522e6b31f88d2300
/xqh-api/src/main/java/com/essence/business/xqh/api/floodForecast/service/SqybModelPlanInfoService.java
50a83fedfbebbf4f394f64fce82007ecefae55c1
[]
no_license
Chao240750188/xqh
72e145e23ecfe734ceb2d65e37d906ab1fecfb00
da47f222948fe7cc6141b9a9ae27054b92a1b864
refs/heads/master
2023-07-16T03:58:14.952408
2021-09-01T02:07:07
2021-09-01T02:07:07
330,581,766
0
0
null
null
null
null
UTF-8
Java
false
false
3,219
java
package com.essence.business.xqh.api.floodForecast.service; import com.essence.business.xqh.api.floodForecast.dto.*; import com.essence.business.xqh.common.returnFormat.SystemSecurityMessage; import com.essence.framework.jpa.Paginator; import com.essence.framework.jpa.PaginatorParam; import javax.servlet.http.HttpServletResponse; import java.util.List; /** * 洪水预报预警--方案信息 * @Author huangxiaoli * @Description * @Date 10:47 2020/12/31 * @Param * @return **/ public interface SqybModelPlanInfoService { /** * 保存模型记录 * @param modelPlanInfo */ SqybModelPlanInfoDto saveModelPlanInfo (SqybModelPlanInfoDto modelPlanInfo); /** * 根据方案id查询方案 * @param planId */ SqybModelPlanInfoDto findByPlanId(String planId); /** * 分页查询方案列表 * @param param * @return */ Paginator<SqybModelPlanInfoDto> getPlanInfoListPage(PaginatorParam param); /** * 删除计算方案 * @param planId * @return */ Object deletePlanInfo(String planId); /** * 查询方案降雨条件 * @param planId * @return */ List<RainFallSumDto> getPlanInPutRain(String planId); /** * 查询方案蒸发条件 * @param planId * @return */ List<EvaporationSumDto> getPlanInPutEvapor(String planId); /** * 查询模型输出结果 * @param planId * @return */ List<RainFallTime> getPlanOutPutRain(String planId); /** * LiuGt add at 2020-03-19 * 向导入降雨量数据模板文件中设置方案的起始时间和结束时间 * @param response * @param planId 方案ID */ void setRainfallTimeToTemplate(HttpServletResponse response, String planId); /** * LiuGt add at 2020-03-17 * 向导入蒸发量数据模板文件中设置方案的起始时间和结束时间 * @param response * @param planId 方案ID */ void setEvaporTimeToTemplate(HttpServletResponse response, String planId); /** * LiuGt add at 2020-03-18 * 查询方案计算结果数据(入库流量) * 返回值添加了实测流量,误差率 * @return */ PlanResultViewDto getPlanResult(String planId); /** * 编辑方案模型运行的条件数据 * @param modelLoopRun * @return */ SqybModelLoopRunDto editModelLoopRun(SqybModelLoopRunDto modelLoopRun); /** * 查询最新的方案模型运行条件数据 * @return */ SqybModelLoopRunDto queryNewModelLoopRun(); /** * 设置能启动模型滚动计算条件的降雨数据(仅测试滚动计算使用) * LiuGt add at 2020-05-20 * @return */ String setAutoRunModelRain(); /** * 查询多个方案对比的结果 * @param planIds * @return */ SystemSecurityMessage queryPlanContrastResult(List<String> planIds); /** * 方案结果展示 - 查询指定方案输入数据(各时段平均降雨和累积降雨) * @param planId * @return */ List<HourTimeDrpListDto> queryPlanInputRainfall(String planId); /** * 方案结果展示 - 查询水库预测水位 * LiuGt add at 2020-07-09 * @return */ HourTimeWaterLevelViewDto queryResForecastWaterLevel(String planId); }
[ "240750188@qq.com" ]
240750188@qq.com
7bf10d677077d7521aa0685000db64fe53be68fb
013530419a5c73d1965f6af20b49b8bf5bd48b5a
/kakulator/src/main/java/com/mycompany/kakulator/Main.java
c8164e81ffde9a237032c0c393be240934f62821
[]
no_license
VashchenyaVolodymyr/labs
feec738392820d78dac6b97eb614ed60fe35be07
d3906d28e330f330279365f31470df40ad696d01
refs/heads/main
2023-01-19T02:39:30.188216
2020-11-26T21:41:10
2020-11-26T21:41:10
316,317,851
0
0
null
2020-11-26T20:04:11
2020-11-26T19:14:26
Java
UTF-8
Java
false
false
1,254
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 com.mycompany.kakulator; import java.util.Scanner; // калькулятор считает модули от операций над двумя числами public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); System.out.print("A = "); double A = in.nextDouble(); System.out.print("B = "); double B = in.nextDouble(); System.out.print("Mod = "); double mod = in.nextDouble(); //System.out.print("For + : "); System.out.println((A + B) % mod); //System.out.print("For - : "); System.out.println((A - B) % mod); // System.out.print("For / : "); System.out.println((A / B) % mod); //System.out.print("For * :"); System.out.println((A * B) % mod); //System.out.print("For ^ : "); System.out.println((Math.pow(A, B)) % mod); } }
[ "vashvol322@gmail.com" ]
vashvol322@gmail.com
ae1a9c805e60fa1a75a007e2bd53dfcfd497e5d4
df8e9e40fb96b18713cf12c41e9d9d92d04a108b
/PowerToolPlus/src/me/proxygames/powertool/files/checkitem.java
c40e53207236c2acb04730bff77ca32607a08c30
[]
no_license
ProxyGames14/PowerToolsPlus
e389ad9de2905433fa6ca86c77ba81f40e27e7bc
f963e3bb961a79aa61057b997ebae8479a5ecfb4
refs/heads/master
2020-06-27T02:58:10.999285
2017-07-14T12:44:39
2017-07-14T12:44:39
97,041,785
0
0
null
null
null
null
UTF-8
Java
false
false
601
java
package me.proxygames.powertool.files; import org.bukkit.entity.Player; public class checkitem { @SuppressWarnings("deprecation") public static boolean checkitemid(Player player) { String item = player.getItemInHand().getTypeId() + "-" + player.getItemInHand().getDurability(); if(filemenu.getplayerfile(player).getString("Items.List." + item) == null) return false; else return true; } @SuppressWarnings("deprecation") public static String getitemid(Player player) { return (player.getItemInHand().getTypeId() + "-" + player.getItemInHand().getDurability()); } }
[ "noreply@github.com" ]
ProxyGames14.noreply@github.com
87ce1dd82b8a88e06b4addbcfaf1a95e1eb75cd4
12af0c6745975ea7c739fcf2b506b3c8f8496070
/src/main/java/org/wso2/custom/CustomSystemRolesRetainedProvisionHandler.java
8232af0e8857421b3a0e01df028d9f0199c63c8c
[]
no_license
SiluniPathirana/CustomSystemRolesRetainedProvisionHandler
3485aad07389d1c0dfcd5ed775cea0435a1ca64d
475118e75cfd0831ea2fbede2726f4a233eb10bd
refs/heads/master
2020-05-17T09:34:13.515679
2019-04-26T14:10:00
2019-04-26T14:10:00
183,637,200
0
0
null
null
null
null
UTF-8
Java
false
false
640
java
package org.wso2.custom; import org.wso2.carbon.user.core.UserRealm; import org.wso2.carbon.user.core.UserStoreException; import org.wso2.carbon.identity.application.authentication.framework.handler.provisioning.impl.*; import java.util.ArrayList; import java.util.List; public class CustomSystemRolesRetainedProvisionHandler extends SystemRolesRetainedProvisionHandler { @Override protected List<String> retrieveRolesToBeDeleted(UserRealm realm, List<String> currentRolesList, List<String> rolesToAdd) throws UserStoreException { return new ArrayList<>(); } }
[ "siluni@wso2.com" ]
siluni@wso2.com
d524d6131109240e1f3875c040ac2609af907a29
38ef0698b360675644f3f56f5f8077afbb3cbec6
/board/src/main/java/com/example/board/domain/entity/BoardEntity.java
12f4545d4498a1ec2552bd61a26cca176e1c4ca5
[]
no_license
khs020731/test
2726656aad10f9f3c8a632126bc655d2c837fa99
f81ed5468589678b654ddcbfe3bb8a1db319ea3d
refs/heads/main
2023-03-09T18:25:08.276109
2021-02-26T08:56:37
2021-02-26T08:56:37
325,183,412
0
0
null
null
null
null
UTF-8
Java
false
false
876
java
package com.example.board.domain.entity; import lombok.AccessLevel; import lombok.Builder; import lombok.Getter; import lombok.NoArgsConstructor; import javax.persistence.*; @NoArgsConstructor(access = AccessLevel.PROTECTED) @Getter @Entity @Table(name = "board") public class BoardEntity extends TimeEntity { @Id @GeneratedValue(strategy= GenerationType.IDENTITY) private Long id; @Column(length = 100, nullable = false) private String writer; @Column(length = 100, nullable = false) private String title; @Column(columnDefinition = "TEXT", nullable = false) private String content; @Builder public BoardEntity(Long id, String title, String content, String writer) { this.id = id; this.writer = writer; this.title = title; this.content = content; } }
[ "noreply@github.com" ]
khs020731.noreply@github.com
71333270368d9fec7a3bd41b8223b4d1a4568441
c103ad2905ae018ce41415a5a470f9d9375dc8a3
/src/main/java/Dto/InnerDto.java
5205ca4512d061611d6c3848af069bf15fff9526
[]
no_license
simonkrivonosov/JmhLab
93a16bc0ebc532429a686285288d6e697cee1c14
752d3c7b92342fe9d6df15c41fbaa9166c8982e3
refs/heads/main
2023-01-21T17:56:36.763181
2020-11-30T18:24:17
2020-11-30T18:24:17
316,996,767
0
0
null
null
null
null
UTF-8
Java
false
false
167
java
package Dto; import java.io.Serializable; class InnerDto implements Serializable { public final String name = "innerDto"; public final Double x = Math.PI; }
[ "simon.krivonosov@gmail.com" ]
simon.krivonosov@gmail.com
0a8b6120a57a17580f12d91f5cd8f532aaa7f403
90e7d87ed51b1ea14a8ada11b0fb97f8503acf45
/src/step_math1/Baekjoon_2839.java
f55aa19ab3f26eb6b104ae57b2204398ef6efd00
[]
no_license
KimWonJun/Baekjoon-Algorithm
7883b6c43328d3b41adbe93112a6cd4652c9ed93
e4e39c89b1cd9840af022b4708942f0cccc557b6
refs/heads/master
2022-12-22T21:17:08.105610
2022-12-13T15:35:03
2022-12-13T15:35:03
195,809,129
0
0
null
null
null
null
UTF-8
Java
false
false
555
java
package step_math1; import java.util.Scanner; public class Baekjoon_2839 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int sugar = sc.nextInt(); int five = 0; int three = 0; while(sugar % 5 != 0 && sugar > 0) { sugar-=3; three++; } five = sugar / 5; sugar = sugar % 5; if(sugar < 0){ System.out.println(-1); } else{ System.out.println(five + three); } } }
[ "kwj0313im@naver.com" ]
kwj0313im@naver.com
33f328c6a4f412777e5de13b3a263a36acf69fe1
8e9eaac47e0d3b18276af668bb5a3f58ebecab92
/src/org/poreddy/collections/io/ReadAndWriteRun.java
d158b7a8ca3048fcb1ce629e93a1cf02f1abef8f
[]
no_license
pporeddy/JavaIO
5b2d6fee308b6935f2e565f9da2e9979676fc138
01ffbcfbf9264e8c928990cb5cdb7e1816f94781
refs/heads/master
2019-01-02T08:44:19.205637
2013-10-04T17:07:00
2013-10-04T17:07:00
null
0
0
null
null
null
null
UTF-8
Java
false
false
168
java
package org.poreddy.collections.io; public class ReadAndWriteRun { public static void main(String[] arg) { ReadData data = new ReadData(); data.Read(); } }
[ "pporeddy@uno.edu" ]
pporeddy@uno.edu
4711e791a51c0be653528a55111e9af0d1e77157
08113b6fc4b84226357f036a9c52341cca5982dc
/app/src/main/java/com/example/imagenesupt/MiFresco.java
ef7e7219e9f278174435516a333a029963ba09db
[]
no_license
ArlynC/ImagenesUpt
dd37bed146fc496ba26475f66168a05693528702
d53178bae67f09db6fbecd07b67617434fca3cb6
refs/heads/master
2020-12-28T12:48:39.916787
2020-02-16T05:16:51
2020-02-16T05:16:51
238,338,850
0
0
null
null
null
null
UTF-8
Java
false
false
770
java
package com.example.imagenesupt; import androidx.appcompat.app.AppCompatActivity; import android.net.Uri; import android.os.Bundle; import com.facebook.drawee.backends.pipeline.Fresco; import com.facebook.drawee.view.SimpleDraweeView; import com.facebook.imagepipeline.core.ImagePipeline; public class MiFresco extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Fresco.initialize(this); setContentView(R.layout.activity_mi_fresco); Uri uri = Uri.parse("https://fugacious-bits.000webhostapp.com/images.jpg"); SimpleDraweeView draweeView = (SimpleDraweeView) findViewById(R.id.my_image_view); draweeView.setImageURI(uri); } }
[ "alejandra321.any@gmail.com" ]
alejandra321.any@gmail.com
1c639a325dbb087af03b18d7638d4b143bdbc25e
6ba20aa444c7ea92dd4c64a188ef75a7f0640260
/td4/TD4/src/model/ContactHandler.java
8a5d8f7d71777679e2ef3f49ec9b82d5c8e46a5c
[]
no_license
tudorluchy/NF28-TD
de0b589ede9c081e12e11151360de8c5855c1cab
0e6ee995b74de9c53831facc8de1d398e1237acb
refs/heads/master
2020-03-30T02:36:22.238573
2014-07-03T11:08:50
2014-07-03T11:08:50
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,790
java
package model; import java.util.ArrayList; import java.util.List; import java.util.Stack; import javax.swing.tree.DefaultMutableTreeNode; import org.xml.sax.Attributes; import org.xml.sax.SAXException; import org.xml.sax.helpers.DefaultHandler; public class ContactHandler extends DefaultHandler { /** * Noeud parent */ private DefaultMutableTreeNode parentNode; /** * Noeud courant */ private DefaultMutableTreeNode currentNode; /** * Construction d'une liste de contacts */ private List<Contact> contactList; /** * Construction d'un contact */ private Contact contact; /** * Stocker les balises */ private Stack<String> elementStack; /** * Stocker les objets contacts */ private Stack<Contact> objectStack; /** * Construction du contenu entre les balises */ StringBuilder currentText = new StringBuilder(); /** * Constructor */ public ContactHandler() { super(); parentNode = null; currentNode = null; elementStack = new Stack<String>(); objectStack = new Stack<Contact>(); contactList = new ArrayList<>(); } /** * Retourne la racine de l'arbre * @return */ public DefaultMutableTreeNode getRoot() { return parentNode; } /** * Retourne un modèle d'arbre * @return */ public ContactTreeModel getContactTreeModel() { ContactTreeModel contactTreeModel = new ContactTreeModel(getRoot()); return contactTreeModel; } /** * Retourne une liste de contacts * @return */ public List<Contact> getContactList() { return contactList; } /** * Retourne la balise en cours de traitement */ private String currentElement() { return (String) this.elementStack.peek(); } /** * Début d'une balise */ @Override public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { DefaultMutableTreeNode newNode = null; //Push it in element stack this.elementStack.push(qName); // pas de feuille : categorie (string) ou contact (objet) if ((qName != "nom") && (qName != "mail") && (qName != "icone")) { // contact if (qName == "contact") { contact = new Contact(); newNode = new DefaultMutableTreeNode(contact); this.objectStack.push(contact); } else { // categorie newNode = new DefaultMutableTreeNode(qName); } // root if (currentNode == null) { parentNode = newNode; } else { // add child currentNode.add(newNode); newNode.setParent(currentNode); } currentNode = newNode; } } /** * Fin d'une balise */ @Override public void endElement(String uri, String localName, String qName) throws SAXException { // </nom> if ("nom".equals(currentElement())) { // list ((Contact) this.objectStack.peek()).setNom(currentText.toString()); // node ((Contact) currentNode.getUserObject()).setNom(currentText.toString()); currentText = new StringBuilder(); // </mail> } else if ("mail".equals(currentElement())) { // list ((Contact) this.objectStack.peek()).setMail(currentText.toString()); // node ((Contact) currentNode.getUserObject()).setMail(currentText.toString()); currentText = new StringBuilder(); // </icone> } else if ("icone".equals(currentElement())) { // list ((Contact) this.objectStack.peek()).setIcone(currentText.toString()); // node ((Contact) currentNode.getUserObject()).setIcone(currentText.toString()); currentText = new StringBuilder(); } //Remove last added element this.elementStack.pop(); //Contact instance has been constructed so pop it from object stack and push in contact list if ("contact".equals(qName)) { Contact c = (Contact) this.objectStack.pop(); this.contactList.add(c); } // pas de feuille : on remonte au parent if ((qName != "nom") && (qName != "mail") && (qName != "icone")) { currentNode = (DefaultMutableTreeNode)currentNode.getParent(); } } /** * Lit contenu entre les balises */ @Override public void characters(char ch[], int start, int length) throws SAXException { String content = new String(ch, start, length); // ignore empty content if (content.trim().equals("") || content.trim().equals("\n")) { return; } currentText.append(content); } }
[ "tudorluchy@gmail.com" ]
tudorluchy@gmail.com
58af74686c5def69e7dfe79571a0da6cbb38a08d
17c30fed606a8b1c8f07f3befbef6ccc78288299
/P9_8_0_0/src/main/java/java/util/function/-$Lambda$VGDeaUHZQIZywZW2ttlyhwk3Cmk.java
42c8caf9a0f14acbf4b6d9d8707479437383ac7e
[]
no_license
EggUncle/HwFrameWorkSource
4e67f1b832a2f68f5eaae065c90215777b8633a7
162e751d0952ca13548f700aad987852b969a4ad
refs/heads/master
2020-04-06T14:29:22.781911
2018-11-09T05:05:03
2018-11-09T05:05:03
157,543,151
1
0
null
2018-11-14T12:08:01
2018-11-14T12:08:01
null
UTF-8
Java
false
false
1,832
java
package java.util.function; final /* synthetic */ class -$Lambda$VGDeaUHZQIZywZW2ttlyhwk3Cmk implements DoubleUnaryOperator { /* renamed from: java.util.function.-$Lambda$VGDeaUHZQIZywZW2ttlyhwk3Cmk$1 */ final /* synthetic */ class AnonymousClass1 implements DoubleUnaryOperator { private final /* synthetic */ Object -$f0; private final /* synthetic */ Object -$f1; private final /* synthetic */ double $m$0(double arg0) { return ((DoubleUnaryOperator) this.-$f0).lambda$-java_util_function_DoubleUnaryOperator_3397((DoubleUnaryOperator) this.-$f1, arg0); } public /* synthetic */ AnonymousClass1(Object obj, Object obj2) { this.-$f0 = obj; this.-$f1 = obj2; } public final double applyAsDouble(double d) { return $m$0(d); } } /* renamed from: java.util.function.-$Lambda$VGDeaUHZQIZywZW2ttlyhwk3Cmk$2 */ final /* synthetic */ class AnonymousClass2 implements DoubleUnaryOperator { private final /* synthetic */ Object -$f0; private final /* synthetic */ Object -$f1; private final /* synthetic */ double $m$0(double arg0) { return ((DoubleUnaryOperator) this.-$f0).lambda$-java_util_function_DoubleUnaryOperator_2626((DoubleUnaryOperator) this.-$f1, arg0); } public /* synthetic */ AnonymousClass2(Object obj, Object obj2) { this.-$f0 = obj; this.-$f1 = obj2; } public final double applyAsDouble(double d) { return $m$0(d); } } private final /* synthetic */ double $m$0(double arg0) { return DoubleUnaryOperator.lambda$-java_util_function_DoubleUnaryOperator_3682(arg0); } public final double applyAsDouble(double d) { return $m$0(d); } }
[ "lygforbs0@mail.com" ]
lygforbs0@mail.com
14e73970be5ab5c66155249802780cde45a1f8ca
2278022ad2621f7d4e4d734fd97707ae91fe518a
/workspace_java/ch10-inner/src/com/inner/s01/LocalMain01.java
2849723a72e0901ca325ab304f96d6baee3e6d52
[]
no_license
TaeHyungK/KH_Academy
6506199d1222a7d4d51e2a650769fd565e5d802c
d014b7bf25d6fc282d856696b5da0e8997900fc5
refs/heads/master
2021-09-09T01:46:25.995181
2018-03-13T06:48:06
2018-03-13T06:48:06
106,348,733
0
0
null
null
null
null
UHC
Java
false
false
325
java
package com.inner.s01; public class LocalMain01 { public void innerTest() { class Inner { public void getData() { System.out.println("Local 내부 클래스"); } } Inner i = new Inner(); i.getData(); } public static void main(String[] args) { LocalMain01 m = new LocalMain01(); m.innerTest(); } }
[ "rlaxogud555@gmail.com" ]
rlaxogud555@gmail.com
6632c355dd1171ed1c6877f183da3bb299e46acc
a8224d03bcbab04c5880127a8a4143d9880c99b7
/server/src/main/java/com/capgemini/server/ServerApplication.java
48a830884199c5a73ce69776e0a8b869dbfc13ef
[]
no_license
HariniBhuvana/microservice-Eureka-Servers
b763750cad1756ab033d43e132617c49d89af4a2
6c2de290d50824876aef79c072a126d88f4f0480
refs/heads/master
2020-04-01T10:23:56.510785
2018-10-15T13:15:18
2018-10-15T13:15:18
153,114,146
0
0
null
null
null
null
UTF-8
Java
false
false
495
java
package com.capgemini.server; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.client.discovery.EnableDiscoveryClient; import org.springframework.cloud.config.server.EnableConfigServer; @EnableDiscoveryClient @EnableConfigServer @SpringBootApplication public class ServerApplication { public static void main(String[] args) { SpringApplication.run(ServerApplication.class, args); } }
[ "harini.k@capgemini.com" ]
harini.k@capgemini.com
7d2baa1215fad10bf5911f420abca500bd3056f6
aad82f53c79bb1b0fa0523ca0b9dd18d8f39ec6d
/Anjana M R/27jan/program5_checked_exception2.java
bf067e544b8f36d3314e7b1c6a9b450fe3678ebd
[]
no_license
Cognizant-Training-Coimbatore/Lab-Excercise-Batch-2
54b4d87238949f3ffa0b3f0209089a1beb93befe
58d65b309377b1b86a54d541c3d1ef5acb868381
refs/heads/master
2020-12-22T06:12:23.330335
2020-03-17T12:32:29
2020-03-17T12:32:29
236,676,704
1
0
null
2020-10-13T19:56:02
2020-01-28T07:00:34
Java
UTF-8
Java
false
false
374
java
import java.io.FileInputStream; class fileMgmt { void fileRead() throws IOException { FileInputStream fis=null; fis=new FileInputStream("B:/myfile.txt"); int k; while((k=fis.read())!=-1) { System.out.println((char)k); } fis.close(); } } public class program5_checked_exception2 { public static void main(String[] args) { } }
[ "noreply@github.com" ]
Cognizant-Training-Coimbatore.noreply@github.com
58434c0bd7e9ba010311b499c2d7c64bbaca3a62
5b134e3b180a25968862e2957dafefc47361a450
/src/java/controller/ProjectController.java
eade7f8b43602dcc7ae3b429c4a9c058259fb61c
[]
no_license
melokissy/assist-api
801fe6214d4158d2bddea2d2cbfe790a73ce58d0
71ef4e6dbfe29c4e1d58f24c6e8365248b25129c
refs/heads/master
2023-05-25T09:18:32.409360
2021-04-04T04:17:05
2021-04-04T04:17:05
345,418,467
0
0
null
null
null
null
UTF-8
Java
false
false
1,353
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 controller; import dao.ProjectDAO; import java.util.List; import model.Project; import model.Ticket; /** * * @author Kissy de Melo */ public class ProjectController { private final ProjectDAO pDAO = new ProjectDAO(); public List<Project> projects() throws Exception { try { return pDAO.projects(); } catch (Exception e) { throw new Exception("Não foi possível listar projeto"); } } public Project search(Integer id) throws Exception { try { return pDAO.search(id); } catch (Exception e) { throw new Exception("Não foi possível localizar o projeto"); } } public Project insert(Project project) throws Exception { try { pDAO.insertProject(project); } catch (Exception e) { throw new Exception("Não foi possivel cadastrar projeto"); } return project; } public Project delete(Integer idProject) { Project selectProject = this.pDAO.search(idProject); return this.pDAO.delete(selectProject); } }
[ "kissybatista@gmail.com" ]
kissybatista@gmail.com
26f69f3359a0adf4d19fd7a24a8afcf46454a788
3aa96bd2717db1ab965e1dd7987d782c8a4c3b59
/src/com/vaani/algo/compete/cc150/chap4treegraph/TopologicalSort.java
3c8005e60666518d129836205a29c589f64bb1c6
[ "LicenseRef-scancode-warranty-disclaimer" ]
no_license
sjl421/AlgorithmUtil
1121683fcb7f40fea96af6bb83a73980156b4ca4
edc3bcdd648a3e6981e8b1f0ae74f0f349225081
refs/heads/master
2020-04-15T20:56:27.872900
2018-09-01T07:00:00
2018-09-25T07:00:00
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,207
java
package com.vaani.algo.compete.cc150.chap4treegraph; import com.vaani.algo.ds.core.graph.DirectedGraph; import com.vaani.algo.ds.core.graph.Vertex; import java.util.*; /** * Created by Xiaomeng on 11/25/2014. */ public class TopologicalSort { public static Vertex[] topologicalSort(DirectedGraph graph) { Set<Vertex> vertexSet = graph.getVertexSet(); if (vertexSet.size() < 2) { return vertexSet.toArray(new Vertex[0]); } LinkedList<Vertex> sortedList = new LinkedList<Vertex>(); TimeRecorder recorder = new TimeRecorder(); for (Vertex vertex : vertexSet) { if (vertex.color == Vertex.Color.WHITE) { visitVertex(graph, vertex, recorder, sortedList); } } return sortedList.toArray(new Vertex[0]); } /** * 深度优先搜索(Depth First Search) */ public static void visitVertex(DirectedGraph graph, Vertex vertex, TimeRecorder recorder, LinkedList<Vertex> sortedList) { recorder.time += 1; vertex.color = Vertex.Color.GRAY; vertex.discover = recorder.time; Map<Vertex, List<Vertex>> edgeMap = graph.getAdjacencys(); List<Vertex> adjacencys = edgeMap.get(vertex); if (adjacencys != null && adjacencys.size() > 0) { for (Vertex adjacency : adjacencys) { if (adjacency.color == Vertex.Color.WHITE) { adjacency.parent = vertex; visitVertex(graph, adjacency, recorder, sortedList); } } } recorder.time += 1; vertex.color = Vertex.Color.BLACK; vertex.finish = recorder.time; sortedList.addLast(vertex); } public static void printVertex(Vertex[] Vertexs) { for (Vertex vertex : Vertexs) { System.out.println(vertex.getName() + " discover time:" + vertex.getDiscover() + " finish time:" + vertex.getFinish()); } } public static void main(String[] args) { DirectedGraph graph = new DirectedGraph(); Set<Vertex> vertexSet = graph.getVertexSet(); Map<Vertex, List<Vertex>> edgeMap = graph.getAdjacencys(); Vertex aVertex = new Vertex('a'); Vertex bVertex = new Vertex('b'); Vertex cVertex = new Vertex('c'); Vertex dVertex = new Vertex('d'); vertexSet.add(aVertex); vertexSet.add(bVertex); vertexSet.add(cVertex); vertexSet.add(dVertex); edgeMap.put(aVertex, new ArrayList<Vertex>()); edgeMap.put(bVertex, new ArrayList<Vertex>()); edgeMap.put(dVertex, new ArrayList<Vertex>()); edgeMap.get(bVertex).add(dVertex); edgeMap.get(bVertex).add(aVertex); edgeMap.get(dVertex).add(aVertex); edgeMap.get(aVertex).add(cVertex); Vertex[] sortedVertexs = topologicalSort(graph); printVertex(sortedVertexs); } public static class TimeRecorder { private int time = 0; public int getTime() { return time; } public void setTime(int time) { this.time = time; } } }
[ "kinshuk.ram@gmail.com" ]
kinshuk.ram@gmail.com
2384aa1ab08c573a76c10148a2da85fcf6a434f1
d1330a1f36c078d90a843fc9829c0770b048d11a
/src/Arcari/Leonardo/BattagliaNavale/EventiGioco.java
eaed5835ddefe5b1d4d57cbb7b58794e42f84cb0
[]
no_license
PoliCRJava/JavaTest
a501b9bc4a5d55517ad2e3d417df4f0541dc3428
a1d2397652422792db91c0a644e0abcf7dd11c5e
refs/heads/master
2021-01-24T15:06:18.889331
2016-06-12T09:20:28
2016-06-12T09:20:28
55,073,452
1
0
null
null
null
null
UTF-8
Java
false
false
174
java
package Arcari.Leonardo.BattagliaNavale; /** * Created by leonardoarcari on 06/04/16. */ public enum EventiGioco { COLPITO, ACQUA, AFFONDATO, SCONFITTA; }
[ "lippol94@gmail.com" ]
lippol94@gmail.com
5d7b44375a178e43aedb364c035d587ccdac565e
333aa944147ee5a8d0f7bb523c6263f77c8afe6c
/src/main/java/erp/dao/provider/DetailDaoProvider.java
f64d0f8949407bc2496bede880f8781b4a8b7de9
[ "MIT" ]
permissive
cuidh/RunningAccount
f2f57b248779bd09d48da67669eacd4b7bc7d62d
9d7a2412d69cc69dae826e998838312e390b9abd
refs/heads/master
2022-11-22T11:50:23.067356
2020-07-27T12:09:12
2020-07-27T12:09:12
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,128
java
package erp.dao.provider; import erp.domain.Detail; import erp.vo.req.DetailFilterVo; import org.apache.ibatis.jdbc.SQL; import java.util.List; /** * @author Yhaobo * @date 2020/3/13 */ public class DetailDaoProvider { public String listByFilterSql(DetailFilterVo vo) { return new SQL() {{ SELECT("*"); FROM("detail"); if (vo.getBackDate() != null && vo.getFrontDate() != null) { WHERE("d_date between #{frontDate} and #{backDate}"); } if (vo.getDescription() != null && vo.getDescription().length() > 2) { WHERE("d_description like #{description}"); } if (vo.getProjectId() != null) { WHERE("p_id=#{projectId}"); } if (vo.getAccountId() != null) { WHERE("a_id=#{accountId}"); } if (vo.getDepartmentId() != null) { WHERE("dep_id=#{departmentId}"); } if (vo.getCategoryId() != null) { WHERE("c_id=#{categoryId}"); } ORDER_BY("d_date desc"); }}.toString(); } public String addByBatchSql(List<Detail> list) { return new SQL() {{ INSERT_INTO("detail"); INTO_COLUMNS("d_date,d_description,p_id,a_id,dep_id,c_id,d_earning,d_expense"); for (int i = 0; i < list.size(); i++) { INTO_VALUES( "#{list[" + i + "].date},#{list[" + i + "].description}," + "(select id from project where name=#{list[" + i + "].project.name})," + "(select id from account where name=#{list[" + i + "].account.name})," + "(select id from department where name=#{list[" + i + "].department.name})," + "(select id from category where name=#{list[" + i + "].category.name})," + "#{list[" + i + "].earning},#{list[" + i + "].expense}"); ADD_ROW(); } }}.toString(); } }
[ "517046205@qq.com" ]
517046205@qq.com
4dde514763bdea3625af036f786ee21a605eb506
268592c417a8f6fbcfec98a8af17d7cb9f1f6cee
/debop4k-data-orm/src/test/java/debop4k/data/orm/springdata/interceptors/CustomerRepository.java
099bf82ddec83cd4043cbd3e249ada2608d3c702
[ "Apache-2.0" ]
permissive
debop/debop4k
8a8e29e76b590e72599fb69888c2eb2e90952c10
5a621998b88b4d416f510971536abf3bf82fb2f0
refs/heads/develop
2021-06-14T22:48:58.156606
2019-08-06T15:49:34
2019-08-06T15:49:34
60,844,667
37
12
Apache-2.0
2021-04-22T17:45:14
2016-06-10T12:01:14
Kotlin
UTF-8
Java
false
false
870
java
/* * Copyright (c) 2016. Sunghyouk Bae <sunghyouk.bae@gmail.com> * 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 debop4k.data.orm.springdata.interceptors; import org.springframework.data.repository.CrudRepository; public interface CustomerRepository extends CrudRepository<Customer, Integer> { Customer findByLastname(String lastname); }
[ "sunghyouk.bae@gmail.com" ]
sunghyouk.bae@gmail.com
6ce9bf77143c4c13062660666455d1c14e9ac76d
a4e60aa4e2cb5d2f2a82b1a2eef99027029a6316
/firstProject/src/com/yedam/collection/StudentTest.java
5393024b537601bc0749959cd68d4b7c5bedac65
[]
no_license
doeun1/firstPoject
929d7b67f649d44377def909d58799b256d40389
69f4e512370b2c8561f2cb3615696767e8e750bb
refs/heads/master
2022-12-08T17:56:26.978229
2020-08-27T06:41:24
2020-08-27T06:41:24
286,663,664
0
0
null
null
null
null
UTF-8
Java
false
false
2,132
java
package com.yedam.collection; import java.util.ArrayList; import java.util.List; import java.util.Scanner; import com.yedam.classes.Friend; public class StudentTest { static Scanner sn = new Scanner(System.in); static Student[] sd = new Student[3]; public static void main(String[] args) { /* * 1. 학생이름, 수학점수, 영어점수 입력 2. 수학평균, 영어평균 계산 3.수학 최고점, 학생 조회\ 9. 종료 arraylist사용 */ List<Student> list = new ArrayList(); while (true) { System.out.println("1. 학생이름, 수학점수, 영어점수를 입력하세요"); System.out.println("2. 수학평균, 영어평균을 계산하는 분석"); System.out.println("3. 수학 최고점과 학생 조회"); System.out.println("9. 종료"); double tm = 0; double te = 0; int mm = 0;// 수학최고점수 int maxvalue = 0; int maxindex = 0; int k = sn.nextInt(); if (k == 1) { for (int j = 0; j < 3; j++) { int i = sn.nextInt(); sn.nextLine(); String s = sn.nextLine(); int e = sn.nextInt(); list.add(new Student(s, i, e)); } } if (k == 2) { for (int a = 0; a < list.size(); a++) { tm += list.get(a).getMath(); te += list.get(a).getEng(); if (mm < list.get(a).getMath()) { mm = list.get(a).getMath(); } } System.out.println("수학평균 : " + tm / 3); System.out.println("영어평균 : " + te / 3); } if (k == 3) { for (int i = 0; i < list.size(); i++) { if (maxvalue < list.get(i).getMath()) { maxvalue = list.get(i).getMath(); maxindex = i; } } System.out.println("최고수학점수" + list.get(maxindex).getMath() + "이름" + list.get(maxindex).getName()); System.out.println(mm); } if (k ==4) break; /* * * if (i == 1) { System.out.println("학생이름 : "); sn.nextLine(); * System.out.println("수학점수 :"); sn.nextInt(); sn.nextLine(); * System.out.println("영어점수 :"); sn.nextLine(); } else if (i == 2) { * * } else if (i == 3) { * * } else if (i == 9) break; */ } } }
[ "hneu86@naver.com" ]
hneu86@naver.com
5665aa5ad51ddda5ee03aeecc908aacc828e221f
8c7ddc426213f2cdd514e4c2fdaedd569fa7d3ea
/Java/wechat-nowait/src/main/java/com/metaarchit/wechat/nowait/service/impl/WxUserServiceImpl.java
5a16edb7c977d00b4f0451ec69e15efe92af79d8
[]
no_license
ChenChenJH/wechat-nowait
5a0b5941d534c7e616790239352edaa0b53a1079
81ae4714aa90ccb8c687d35a23abbd2424117481
refs/heads/master
2021-09-02T04:36:18.071782
2017-12-30T11:03:56
2017-12-30T11:03:56
113,017,251
0
1
null
null
null
null
UTF-8
Java
false
false
2,549
java
package com.metaarchit.wechat.nowait.service.impl; import java.util.List; import javax.annotation.Resource; import org.springframework.stereotype.Service; import com.metaarchit.wechat.nowait.dao.WxUserDao; import com.metaarchit.wechat.nowait.model.WxUser; import com.metaarchit.wechat.nowait.service.WxUserService; import com.metaarchit.wechat.nowait.util.HttpsUtil; /** * 微信用戶業務邏輯處理接口實現類 * @author HuangKailie * @createTime 2017-11-16 15:21:54 */ @Service public class WxUserServiceImpl implements WxUserService { @Resource private WxUserDao wxUserDao; /** * 微信用戶登錄 * @param appid 小程序ID * @param secret 小程序密鑰 * @param code 登錄憑證 * @return String JSON格式數據,包括openid以及session_key */ public String login(String appid, String secret, String code) throws Exception { String json = HttpsUtil.getSession_keyAndOpenID(appid, secret, code); System.out.println(json); return null; } /** * 獲取所有微信用戶 * @return List<WxUser> 微信用戶信息列表 */ public List<WxUser> listAllWxUser() { List<WxUser> wxUsers = wxUserDao.selectAllWxUser(); if (wxUsers.size() <= 0) { System.out.println("數據庫表為空!"); } return wxUsers; } /** * 添加新微信用戶 * @param wxUser WxUser類對象 * @return int 用戶id號 */ public int saveWxUser(WxUser wxUser) { wxUserDao.insertWxUser(wxUser); int i = wxUser.getId(); if (i > 0) { System.out.println("添加成功,微信用戶Id號為:" + i); } else { System.out.println("添加失敗!"); } return i; } /** * 判斷手機號是否存在 * @param phone 手機號 * @return boolean 存在返回true,不存在返回false */ public boolean containsPhone(String phone) { int count = wxUserDao.selectCountByPhone(phone); if (count > 0) return true; return false; } /** * 根據用戶openId獲取用戶已綁定手機號 * @param openid 用戶openId * @return String 用戶所綁定的手機號 */ public String getPhoneByOpenId(String openid) { String phone = null; phone = wxUserDao.selectPhoneByOpenId(openid); return phone; } /** * 根據用戶openId獲取用戶Id * @param openId 微信用戶openId * @return 用戶Id */ public int getWxUserId(String openId) { int id = 0; try { id = wxUserDao.selectIdByOpenId(openId); } catch (Exception e) { System.out.println("用戶未綁定手機號,因此數據庫未錄入用戶信息!"); } return id; } }
[ "1319869958@qq.com" ]
1319869958@qq.com
c348977a7518b152437a23a776eff8b0e58a4aa2
477c901f3715048a8cbd3a5a2f860a5472bf4dfc
/src/main/java/com/learn/datastructures/QuestionOne.java
5dda9811f8948b6ab527b8ab999474353761f480
[]
no_license
depu19/datastructures
673e34382caf7ab859a06251cfdf8c4e5215c94e
ed718da3638d860aaeb5f72933abf1ad45bf0bb4
refs/heads/master
2023-08-26T11:13:25.572785
2021-10-11T11:35:07
2021-10-11T11:35:07
415,897,158
0
0
null
null
null
null
UTF-8
Java
false
false
1,024
java
package com.learn.datastructures; public class QuestionOne { /** * An element in a sorted array can be found in O(log n) time via binary search. * But suppose we rotate an ascending order sorted array at some pivot unknown to you beforehand. * So for instance, 1 2 3 4 5 might become 3 4 5 1 2. Devise a way to find an element in the rotated array in O(log n) time. * * @param args */ public static void main(String[] args) { int arr[] = {0, 4, 5, 7, 8, 66, 77, 99}; int element = 66; int low = 0; int high = arr.length - 1; while (low <= high) { int mid = low + high / 2; if (arr[mid] < element) { low = mid + 1; } else if (arr[mid] > element) { high = mid - 1; } else { System.out.println("Found " + element + "@ index " + mid); } } if (low > high) { System.out.println("Not found"); } } }
[ "depu19@gmail.com" ]
depu19@gmail.com
c61db397e3c58fb363dd83330bef1266da40dc3c
330fcd57d61cd940a5b54a0e75ba29716a645b16
/app/src/main/java/com/example/todolist/fragment/MainFragment.java
2091246bc1c620ed5448e3f133d67c92ea99fe45
[]
no_license
Kuasa5Indra/android-ToDoList
b7b9042c2b57de234ce10410ab1333427cc94f7e
9f4697001b1cf4bb0376ea77d89725d10ac70178
refs/heads/master
2023-01-10T08:04:30.972033
2020-11-08T16:47:45
2020-11-08T16:47:45
296,236,234
0
0
null
null
null
null
UTF-8
Java
false
false
3,999
java
package com.example.todolist.fragment; import android.content.Intent; import android.os.Build; import android.os.Bundle; import android.view.ContextMenu; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.ListView; import android.widget.PopupMenu; import android.widget.Toast; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.annotation.RequiresApi; import com.example.todolist.R; import com.example.todolist.activity.CreateTaskActivity; import com.example.todolist.activity.EditTaskActivity; import com.example.todolist.activity.MainActivity; import com.example.todolist.adapter.TaskAdapter; import com.example.todolist.base.BaseFragment; import com.example.todolist.model.Task; import com.example.todolist.presenter.MainPresenter; import com.example.todolist.presenter.MainPresenterImpl; import com.example.todolist.view.MainView; import com.google.android.material.floatingactionbutton.FloatingActionButton; public class MainFragment extends BaseFragment implements MainView { private FloatingActionButton addButton; private ListView todolistview; private MainPresenter presenter; public MainFragment() { } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { super.onCreateView(inflater, container, savedInstanceState); View view = inflater.inflate(R.layout.fragment_main, container, false); todolistview = view.findViewById(R.id.todolistview); addButton = view.findViewById(R.id.floatingActionButton); addButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { presenter.onTapCreateTask(); } }); presenter = new MainPresenterImpl(this, getContext()); presenter.onLoadTasks(getContext()); return view; } @Override public void redirectToCreateTaskForm() { Intent intent = new Intent(getActivity(), CreateTaskActivity.class); startActivity(intent); getActivity().finish(); } @Override public void redirectToEditTaskForm(Task task) { Intent intent = new Intent(getActivity(), EditTaskActivity.class); intent.putExtra("id", task.getId()); intent.putExtra("title", task.getTitle()); intent.putExtra("desc", task.getDescription()); intent.putExtra("datetime", task.getDateTime()); startActivity(intent); getActivity().finish(); } @Override public void setupToDoList(TaskAdapter adapter) { todolistview.setAdapter(adapter); registerForContextMenu(todolistview); } @Override public void onCreateContextMenu(@NonNull ContextMenu menu, @NonNull View v, @Nullable ContextMenu.ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); MenuInflater inflater = getActivity().getMenuInflater(); inflater.inflate(R.menu.ud_menu, menu); } @Override public boolean onContextItemSelected(@NonNull MenuItem item) { AdapterView.AdapterContextMenuInfo info= (AdapterView.AdapterContextMenuInfo) item.getMenuInfo(); Long id = todolistview.getItemIdAtPosition(info.position); switch (item.getItemId()){ case R.id.edit_task: presenter.onEditTask(id.intValue()); return true; case R.id.delete_task: presenter.onDeleteTask(id.intValue()); presenter.onLoadTasks(getContext()); return true; default: return super.onContextItemSelected(item); } } }
[ "adityaindra135@gmail.com" ]
adityaindra135@gmail.com
aae00cb36c90aa1a6411734fbb1a31be1930ee18
43d65922c8ebbe612e667ec20196937c76ef280a
/frameworks/spring-boot/src/it/webflux/src/test/java/io/dekorate/webflux/DemoApplicationTests.java
84c20d764a2d2bff0e4f71abf96b58bc68418db5
[ "Apache-2.0" ]
permissive
Albertoimpl/dekorate
9aeaae2ce87c4c883766768b8dd0c70a518b68e3
a32c4b8c5692d49fe3e9ebc484fa7574a9390ef4
refs/heads/master
2020-08-14T00:52:17.099002
2019-10-24T17:31:09
2019-10-25T06:19:25
215,067,177
0
0
Apache-2.0
2019-10-14T14:35:34
2019-10-14T14:35:33
null
UTF-8
Java
false
false
1,020
java
package io.dekorate.webflux; import io.dekorate.utils.Serialization; import io.dekorate.deps.kubernetes.api.model.KubernetesList; import io.dekorate.deps.kubernetes.api.model.HasMetadata; import io.dekorate.deps.kubernetes.api.model.Service; import java.util.Optional; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.*; public class DemoApplicationTests { @Test public void shouldContainService() { KubernetesList list = Serialization.unmarshal(getClass().getClassLoader().getResourceAsStream("META-INF/dekorate/kubernetes.yml")); assertNotNull(list); Service service = findFirst(list, Service.class).orElseThrow(IllegalStateException::new); assertNotNull(service); assertEquals(1, list.getItems().stream().filter(i -> Service.class.isInstance(i)).count()); } <T extends HasMetadata> Optional<T> findFirst(KubernetesList list, Class<T> t) { return (Optional<T>) list.getItems().stream() .filter(i -> t.isInstance(i)) .findFirst(); } }
[ "iocanel@gmail.com" ]
iocanel@gmail.com
c1f67d77acbe66ef5ca379c5e9c1700416e55123
59de2f3b5f42931c500887a5187d22fc0a62c784
/src/shipUpgrades/UpgradeMediumPlating.java
fed61309c8433746b709bb279b6c62a8302c35de
[]
no_license
ehavlisch/Heat-Death
fdfad825014a5f72d52dd9a1eac094a799b4e9c0
92566fbe15bf898aee603342f5b6878bb937b73c
refs/heads/master
2020-04-06T03:55:50.881308
2016-08-25T00:23:14
2016-08-25T00:23:14
19,593,165
0
0
null
null
null
null
UTF-8
Java
false
false
255
java
package shipUpgrades; public class UpgradeMediumPlating extends Upgrade { public UpgradeMediumPlating() { name = "Medium Hull Plating"; this.cost = -100; this.maxHull = 600; this.efficiency = 2; family = UpgradeFamily.Hull; mass = 200; } }
[ "evan" ]
evan
7183df6c4a9a55fcbf993fd64a221647650041e8
d8ce80acfe100eaf4d1fd685fc49d395e951f485
/src/gui/administrateur/Ajouter_Console.java
cbbb9d5eed52470bed71cbf9b23534ce9c5d22c4
[]
no_license
davidwolfs/Projet_Java
b5c9833645bd2e3952d5b279af956694feaf1a38
4e63e226625c386f508199f00c1df7ebe12dc16c
refs/heads/master
2020-04-02T04:31:15.071155
2018-11-30T01:02:25
2018-11-30T01:02:25
154,020,725
0
0
null
null
null
null
ISO-8859-1
Java
false
false
2,877
java
package gui.administrateur; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.border.EmptyBorder; import exo.Administrateur; import exo.Console; import javax.swing.JLabel; import javax.swing.JTextField; import javax.swing.JButton; import java.awt.event.ActionListener; import java.sql.Connection; import java.awt.event.ActionEvent; public class Ajouter_Console extends JFrame { /** * */ private static final long serialVersionUID = -7907158422454634533L; private JPanel contentPane; private JTextField textFieldNom; private JButton btnAjouterConsole; private JLabel labelMsgErreur; private JButton btnRetour; @SuppressWarnings("unused") private Connection connect; /** * Create the frame. */ public Ajouter_Console(Connection connect, Administrateur currentAdministrateur) { this.connect = connect; setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 533, 357); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); contentPane.setLayout(null); JLabel lblNom = new JLabel("Nom"); lblNom.setBounds(87, 66, 79, 14); contentPane.add(lblNom); textFieldNom = new JTextField(); textFieldNom.setBounds(317, 64, 130, 17); contentPane.add(textFieldNom); textFieldNom.setColumns(10); labelMsgErreur = new JLabel(""); labelMsgErreur.setBounds(169, 277, 220, 14); contentPane.add(labelMsgErreur); btnAjouterConsole = new JButton("Ajouter"); btnAjouterConsole.addActionListener(new ActionListener() { public boolean champsVide() { boolean valid = true; if (textFieldNom.getText().isEmpty()) { labelMsgErreur.setText("Veuillez remplir tous les champs."); valid = false; } return valid; } public void actionPerformed(ActionEvent e) { if (champsVide()) { Console console = new Console(textFieldNom.getText()); console.setId(-1); if (console.alreadyExist(console, connect)) { labelMsgErreur.setText("Cette console existe déjà."); } else { console.create(console, connect); dispose(); Gestion_Jeux_Consoles gestion_Jeux_Consoles = new Gestion_Jeux_Consoles(connect, currentAdministrateur); gestion_Jeux_Consoles.setVisible(true); gestion_Jeux_Consoles.setResizable(false); } } } }); btnAjouterConsole.setBounds(53, 247, 113, 23); contentPane.add(btnAjouterConsole); btnRetour = new JButton("Retour"); btnRetour.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { dispose(); Gestion_Jeux_Consoles gestion_Jeux_Consoles = new Gestion_Jeux_Consoles(connect, currentAdministrateur); gestion_Jeux_Consoles.setVisible(true); gestion_Jeux_Consoles.setResizable(false); } }); btnRetour.setBounds(393, 247, 89, 23); contentPane.add(btnRetour); } }
[ "abc@example.com" ]
abc@example.com
9d4e68bec25c9cf2b5810ce5ea13d43c1e60f1ac
32ca0a296f4486852f42ac62cd339db5e9e0624a
/src/test/java/step_Definition/SameBrowserInstance.java
bf9d45073899d6256499e749e4b8c67077807f45
[]
no_license
Harshit378/PassionTeaCucumber
1be20660479cdd33d7954956462cc43661a93087
1fc6a9e6ec905d13857a9c2caf3fa744a4bb084e
refs/heads/master
2021-06-23T21:18:19.826696
2017-09-06T07:56:39
2017-09-06T07:56:39
92,601,539
0
0
null
null
null
null
UTF-8
Java
false
false
2,090
java
package step_Definition; import java.net.MalformedURLException; import java.util.List; import org.openqa.selenium.By; import org.openqa.selenium.support.ui.Select; import cucumber.api.DataTable; import cucumber.api.java.en.Given; import cucumber.api.java.en.When; public class SameBrowserInstance { public SameBrowserInstance() { // Empty Constructor } @Given("^User opens the \"([^\"]*)\"$") public void user_opens_the(String arg1) throws Throwable { Hooks.getDriver().navigate().to(arg1); } @When("^I enter invalid data on the page$") public void enterData(DataTable table) throws MalformedURLException, InterruptedException{ //Initialize data table List<List<String>> data = table.raw(); System.out.println("-*-*-*-*--*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*" + data.size()); //Enter data Hooks.getDriver().findElement(By.name("firstname")).sendKeys(data.get(1).get(1)); Hooks.getDriver().findElement(By.name("lastname")).sendKeys(data.get(2).get(1)); Hooks.getDriver().findElement(By.name("reg_email__")).sendKeys(data.get(3).get(1)); Hooks.getDriver().findElement(By.name("reg_email_confirmation__")). sendKeys(data.get(4).get(1)); Hooks.getDriver().findElement(By.name("reg_passwd__")).sendKeys(data.get(5).get(1)); Select dropdownB = new Select(Hooks.getDriver().findElement(By.name("birthday_day"))); dropdownB.selectByValue("15"); Select dropdownM = new Select(Hooks.getDriver().findElement(By.name("birthday_month"))); dropdownM.selectByValue("6"); Select dropdownY = new Select(Hooks.getDriver().findElement(By.name("birthday_year"))); dropdownY.selectByValue("1990"); Hooks.getDriver().findElement(By.className("_58mt")).click(); // Click submit button Hooks.getDriver().findElement(By.name("websubmit")).click(); } /* public void examples(Examples examples) { int count = examples.getRows().size(); System.out.println("Count is " + count); }*/ }
[ "noreply@github.com" ]
Harshit378.noreply@github.com
4de8890752c0675b659a3b01f6d0554d395a999b
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/2/2_36c73c13e21915b66bedd77df9a7adf596a60464/LogFactory/2_36c73c13e21915b66bedd77df9a7adf596a60464_LogFactory_s.java
de372e926538bbf3ded14d9bef0882c44b2b7ebd
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
83,039
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 org.apache.commons.logging; import java.io.BufferedReader; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintStream; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.net.URL; import java.net.URLConnection; import java.security.AccessController; import java.security.PrivilegedAction; import java.util.Enumeration; import java.util.Hashtable; import java.util.Properties; /** * <p>Factory for creating {@link Log} instances, with discovery and * configuration features similar to that employed by standard Java APIs * such as JAXP.</p> * * <p><strong>IMPLEMENTATION NOTE</strong> - This implementation is heavily * based on the SAXParserFactory and DocumentBuilderFactory implementations * (corresponding to the JAXP pluggability APIs) found in Apache Xerces.</p> * * @author Craig R. McClanahan * @author Costin Manolache * @author Richard A. Sitze * @version $Revision$ $Date$ */ public abstract class LogFactory { // Implementation note re AccessController usage // // It is important to keep code invoked via an AccessController to small // auditable blocks. Such code must carefully evaluate all user input // (parameters, system properties, config file contents, etc). As an // example, a Log implementation should not write to its logfile // with an AccessController anywhere in the call stack, otherwise an // insecure application could configure the log implementation to write // to a protected file using the privileges granted to JCL rather than // to the calling application. // // Under no circumstance should a non-private method return data that is // retrieved via an AccessController. That would allow an insecure app // to invoke that method and obtain data that it is not permitted to have. // // Invoking user-supplied code with an AccessController set is not a major // issue (eg invoking the constructor of the class specified by // HASHTABLE_IMPLEMENTATION_PROPERTY). That class will be in a different // trust domain, and therefore must have permissions to do whatever it // is trying to do regardless of the permissions granted to JCL. There is // a slight issue in that untrusted code may point that environment var // to another trusted library, in which case the code runs if both that // lib and JCL have the necessary permissions even when the untrusted // caller does not. That's a pretty hard route to exploit though. // ----------------------------------------------------- Manifest Constants /** * The name (<code>priority</code>) of the key in the config file used to * specify the priority of that particular config file. The associated value * is a floating-point number; higher values take priority over lower values. */ public static final String PRIORITY_KEY = "priority"; /** * The name (<code>use_tccl</code>) of the key in the config file used * to specify whether logging classes should be loaded via the thread * context class loader (TCCL), or not. By default, the TCCL is used. */ public static final String TCCL_KEY = "use_tccl"; /** * The name (<code>org.apache.commons.logging.LogFactory</code>) of the property * used to identify the LogFactory implementation * class name. This can be used as a system property, or as an entry in a * configuration properties file. */ public static final String FACTORY_PROPERTY = "org.apache.commons.logging.LogFactory"; /** * The fully qualified class name of the fallback <code>LogFactory</code> * implementation class to use, if no other can be found. */ public static final String FACTORY_DEFAULT = "org.apache.commons.logging.impl.LogFactoryImpl"; /** * The name (<code>commons-logging.properties</code>) of the properties file to search for. */ public static final String FACTORY_PROPERTIES = "commons-logging.properties"; /** * JDK1.3+ <a href="http://java.sun.com/j2se/1.3/docs/guide/jar/jar.html#Service%20Provider"> * 'Service Provider' specification</a>. * */ protected static final String SERVICE_ID = "META-INF/services/org.apache.commons.logging.LogFactory"; /** * The name (<code>org.apache.commons.logging.diagnostics.dest</code>) * of the property used to enable internal commons-logging * diagnostic output, in order to get information on what logging * implementations are being discovered, what classloaders they * are loaded through, etc. * <p> * If a system property of this name is set then the value is * assumed to be the name of a file. The special strings * STDOUT or STDERR (case-sensitive) indicate output to * System.out and System.err respectively. * <p> * Diagnostic logging should be used only to debug problematic * configurations and should not be set in normal production use. */ public static final String DIAGNOSTICS_DEST_PROPERTY = "org.apache.commons.logging.diagnostics.dest"; /** * When null (the usual case), no diagnostic output will be * generated by LogFactory or LogFactoryImpl. When non-null, * interesting events will be written to the specified object. */ private static PrintStream diagnosticsStream = null; /** * A string that gets prefixed to every message output by the * logDiagnostic method, so that users can clearly see which * LogFactory class is generating the output. */ private static String diagnosticPrefix; /** * <p>Setting this system property * (<code>org.apache.commons.logging.LogFactory.HashtableImpl</code>) * value allows the <code>Hashtable</code> used to store * classloaders to be substituted by an alternative implementation. * </p> * <p> * <strong>Note:</strong> <code>LogFactory</code> will print: * <code><pre> * [ERROR] LogFactory: Load of custom hashtable failed</em> * </pre></code> * to system error and then continue using a standard Hashtable. * </p> * <p> * <strong>Usage:</strong> Set this property when Java is invoked * and <code>LogFactory</code> will attempt to load a new instance * of the given implementation class. * For example, running the following ant scriplet: * <code><pre> * &lt;java classname="${test.runner}" fork="yes" failonerror="${test.failonerror}"&gt; * ... * &lt;sysproperty * key="org.apache.commons.logging.LogFactory.HashtableImpl" * value="org.apache.commons.logging.AltHashtable"/&gt; * &lt;/java&gt; * </pre></code> * will mean that <code>LogFactory</code> will load an instance of * <code>org.apache.commons.logging.AltHashtable</code>. * </p> * <p> * A typical use case is to allow a custom * Hashtable implementation using weak references to be substituted. * This will allow classloaders to be garbage collected without * the need to release them (on 1.3+ JVMs only, of course ;) * </p> */ public static final String HASHTABLE_IMPLEMENTATION_PROPERTY = "org.apache.commons.logging.LogFactory.HashtableImpl"; /** Name used to load the weak hashtable implementation by names */ private static final String WEAK_HASHTABLE_CLASSNAME = "org.apache.commons.logging.impl.WeakHashtable"; /** * A reference to the classloader that loaded this class. This is the * same as LogFactory.class.getClassLoader(). However computing this * value isn't quite as simple as that, as we potentially need to use * AccessControllers etc. It's more efficient to compute it once and * cache it here. */ private static ClassLoader thisClassLoader; // ----------------------------------------------------------- Constructors /** * Protected constructor that is not available for public use. */ protected LogFactory() { } // --------------------------------------------------------- Public Methods /** * Return the configuration attribute with the specified name (if any), * or <code>null</code> if there is no such attribute. * * @param name Name of the attribute to return */ public abstract Object getAttribute(String name); /** * Return an array containing the names of all currently defined * configuration attributes. If there are no such attributes, a zero * length array is returned. */ public abstract String[] getAttributeNames(); /** * Convenience method to derive a name from the specified class and * call <code>getInstance(String)</code> with it. * * @param clazz Class for which a suitable Log name will be derived * * @exception LogConfigurationException if a suitable <code>Log</code> * instance cannot be returned */ public abstract Log getInstance(Class clazz) throws LogConfigurationException; /** * <p>Construct (if necessary) and return a <code>Log</code> instance, * using the factory's current set of configuration attributes.</p> * * <p><strong>NOTE</strong> - Depending upon the implementation of * the <code>LogFactory</code> you are using, the <code>Log</code> * instance you are returned may or may not be local to the current * application, and may or may not be returned again on a subsequent * call with the same name argument.</p> * * @param name Logical name of the <code>Log</code> instance to be * returned (the meaning of this name is only known to the underlying * logging implementation that is being wrapped) * * @exception LogConfigurationException if a suitable <code>Log</code> * instance cannot be returned */ public abstract Log getInstance(String name) throws LogConfigurationException; /** * Release any internal references to previously created {@link Log} * instances returned by this factory. This is useful in environments * like servlet containers, which implement application reloading by * throwing away a ClassLoader. Dangling references to objects in that * class loader would prevent garbage collection. */ public abstract void release(); /** * Remove any configuration attribute associated with the specified name. * If there is no such attribute, no action is taken. * * @param name Name of the attribute to remove */ public abstract void removeAttribute(String name); /** * Set the configuration attribute with the specified name. Calling * this with a <code>null</code> value is equivalent to calling * <code>removeAttribute(name)</code>. * * @param name Name of the attribute to set * @param value Value of the attribute to set, or <code>null</code> * to remove any setting for this attribute */ public abstract void setAttribute(String name, Object value); // ------------------------------------------------------- Static Variables /** * The previously constructed <code>LogFactory</code> instances, keyed by * the <code>ClassLoader</code> with which it was created. */ protected static Hashtable factories = null; /** * Prevously constructed <code>LogFactory</code> instance as in the * <code>factories</code> map, but for the case where * <code>getClassLoader</code> returns <code>null</code>. * This can happen when: * <ul> * <li>using JDK1.1 and the calling code is loaded via the system * classloader (very common)</li> * <li>using JDK1.2+ and the calling code is loaded via the boot * classloader (only likely for embedded systems work).</li> * </ul> * Note that <code>factories</code> is a <i>Hashtable</i> (not a HashMap), * and hashtables don't allow null as a key. */ protected static LogFactory nullClassLoaderFactory = null; /** * Create the hashtable which will be used to store a map of * (context-classloader -> logfactory-object). Version 1.2+ of Java * supports "weak references", allowing a custom Hashtable class * to be used which uses only weak references to its keys. Using weak * references can fix memory leaks on webapp unload in some cases (though * not all). Version 1.1 of Java does not support weak references, so we * must dynamically determine which we are using. And just for fun, this * code also supports the ability for a system property to specify an * arbitrary Hashtable implementation name. * <p> * Note that the correct way to ensure no memory leaks occur is to ensure * that LogFactory.release(contextClassLoader) is called whenever a * webapp is undeployed. */ private static final Hashtable createFactoryStore() { Hashtable result = null; String storeImplementationClass; try { storeImplementationClass = getSystemProperty(HASHTABLE_IMPLEMENTATION_PROPERTY, null); } catch(SecurityException ex) { // Permissions don't allow this to be accessed. Default to the "modern" // weak hashtable implementation if it is available. storeImplementationClass = null; } if (storeImplementationClass == null) { storeImplementationClass = WEAK_HASHTABLE_CLASSNAME; } try { Class implementationClass = Class.forName(storeImplementationClass); result = (Hashtable) implementationClass.newInstance(); } catch (Throwable t) { // ignore if (!WEAK_HASHTABLE_CLASSNAME.equals(storeImplementationClass)) { // if the user's trying to set up a custom implementation, give a clue if (isDiagnosticsEnabled()) { // use internal logging to issue the warning logDiagnostic("[ERROR] LogFactory: Load of custom hashtable failed"); } else { // we *really* want this output, even if diagnostics weren't // explicitly enabled by the user. System.err.println("[ERROR] LogFactory: Load of custom hashtable failed"); } } } if (result == null) { result = new Hashtable(); } return result; } // --------------------------------------------------------- Static Methods /** Utility method to safely trim a string. */ private static String trim(String src) { if (src == null) { return null; } return src.trim(); } /** * <p>Construct (if necessary) and return a <code>LogFactory</code> * instance, using the following ordered lookup procedure to determine * the name of the implementation class to be loaded.</p> * <ul> * <li>The <code>org.apache.commons.logging.LogFactory</code> system * property.</li> * <li>The JDK 1.3 Service Discovery mechanism</li> * <li>Use the properties file <code>commons-logging.properties</code> * file, if found in the class path of this class. The configuration * file is in standard <code>java.util.Properties</code> format and * contains the fully qualified name of the implementation class * with the key being the system property defined above.</li> * <li>Fall back to a default implementation class * (<code>org.apache.commons.logging.impl.LogFactoryImpl</code>).</li> * </ul> * * <p><em>NOTE</em> - If the properties file method of identifying the * <code>LogFactory</code> implementation class is utilized, all of the * properties defined in this file will be set as configuration attributes * on the corresponding <code>LogFactory</code> instance.</p> * * <p><em>NOTE</em> - In a multithreaded environment it is possible * that two different instances will be returned for the same * classloader environment. * </p> * * @exception LogConfigurationException if the implementation class is not * available or cannot be instantiated. */ public static LogFactory getFactory() throws LogConfigurationException { // Identify the class loader we will be using ClassLoader contextClassLoader = getContextClassLoaderInternal(); if (contextClassLoader == null) { // This is an odd enough situation to report about. This // output will be a nuisance on JDK1.1, as the system // classloader is null in that environment. if (isDiagnosticsEnabled()) { logDiagnostic("Context classloader is null."); } } // Return any previously registered factory for this class loader LogFactory factory = getCachedFactory(contextClassLoader); if (factory != null) { return factory; } if (isDiagnosticsEnabled()) { logDiagnostic( "[LOOKUP] LogFactory implementation requested for the first time for context classloader " + objectId(contextClassLoader)); logHierarchy("[LOOKUP] ", contextClassLoader); } // Load properties file. // // If the properties file exists, then its contents are used as // "attributes" on the LogFactory implementation class. One particular // property may also control which LogFactory concrete subclass is // used, but only if other discovery mechanisms fail.. // // As the properties file (if it exists) will be used one way or // another in the end we may as well look for it first. Properties props = getConfigurationFile(contextClassLoader, FACTORY_PROPERTIES); // Determine whether we will be using the thread context class loader to // load logging classes or not by checking the loaded properties file (if any). ClassLoader baseClassLoader = contextClassLoader; if (props != null) { String useTCCLStr = props.getProperty(TCCL_KEY); if (useTCCLStr != null) { // The Boolean.valueOf(useTCCLStr).booleanValue() formulation // is required for Java 1.2 compatability. if (Boolean.valueOf(useTCCLStr).booleanValue() == false) { // Don't use current context classloader when locating any // LogFactory or Log classes, just use the class that loaded // this abstract class. When this class is deployed in a shared // classpath of a container, it means webapps cannot deploy their // own logging implementations. It also means that it is up to the // implementation whether to load library-specific config files // from the TCCL or not. baseClassLoader = thisClassLoader; } } } // Determine which concrete LogFactory subclass to use. // First, try a global system property if (isDiagnosticsEnabled()) { logDiagnostic( "[LOOKUP] Looking for system property [" + FACTORY_PROPERTY + "] to define the LogFactory subclass to use..."); } try { String factoryClass = getSystemProperty(FACTORY_PROPERTY, null); if (factoryClass != null) { if (isDiagnosticsEnabled()) { logDiagnostic( "[LOOKUP] Creating an instance of LogFactory class '" + factoryClass + "' as specified by system property " + FACTORY_PROPERTY); } factory = newFactory(factoryClass, baseClassLoader, contextClassLoader); } else { if (isDiagnosticsEnabled()) { logDiagnostic( "[LOOKUP] No system property [" + FACTORY_PROPERTY + "] defined."); } } } catch (SecurityException e) { if (isDiagnosticsEnabled()) { logDiagnostic( "[LOOKUP] A security exception occurred while trying to create an" + " instance of the custom factory class" + ": [" + trim(e.getMessage()) + "]. Trying alternative implementations..."); } ; // ignore } catch(RuntimeException e) { // This is not consistent with the behaviour when a bad LogFactory class is // specified in a services file. // // One possible exception that can occur here is a ClassCastException when // the specified class wasn't castable to this LogFactory type. if (isDiagnosticsEnabled()) { logDiagnostic( "[LOOKUP] An exception occurred while trying to create an" + " instance of the custom factory class" + ": [" + trim(e.getMessage()) + "] as specified by a system property."); } throw e; } // Second, try to find a service by using the JDK1.3 class // discovery mechanism, which involves putting a file with the name // of an interface class in the META-INF/services directory, where the // contents of the file is a single line specifying a concrete class // that implements the desired interface. if (factory == null) { if (isDiagnosticsEnabled()) { logDiagnostic( "[LOOKUP] Looking for a resource file of name [" + SERVICE_ID + "] to define the LogFactory subclass to use..."); } try { InputStream is = getResourceAsStream(contextClassLoader, SERVICE_ID); if( is != null ) { // This code is needed by EBCDIC and other strange systems. // It's a fix for bugs reported in xerces BufferedReader rd; try { rd = new BufferedReader(new InputStreamReader(is, "UTF-8")); } catch (java.io.UnsupportedEncodingException e) { rd = new BufferedReader(new InputStreamReader(is)); } String factoryClassName = rd.readLine(); rd.close(); if (factoryClassName != null && ! "".equals(factoryClassName)) { if (isDiagnosticsEnabled()) { logDiagnostic( "[LOOKUP] Creating an instance of LogFactory class " + factoryClassName + " as specified by file '" + SERVICE_ID + "' which was present in the path of the context" + " classloader."); } factory = newFactory(factoryClassName, baseClassLoader, contextClassLoader ); } } else { // is == null if (isDiagnosticsEnabled()) { logDiagnostic( "[LOOKUP] No resource file with name '" + SERVICE_ID + "' found."); } } } catch( Exception ex ) { // note: if the specified LogFactory class wasn't compatible with LogFactory // for some reason, a ClassCastException will be caught here, and attempts will // continue to find a compatible class. if (isDiagnosticsEnabled()) { logDiagnostic( "[LOOKUP] A security exception occurred while trying to create an" + " instance of the custom factory class" + ": [" + trim(ex.getMessage()) + "]. Trying alternative implementations..."); } ; // ignore } } // Third try looking into the properties file read earlier (if found) if (factory == null) { if (props != null) { if (isDiagnosticsEnabled()) { logDiagnostic( "[LOOKUP] Looking in properties file for entry with key '" + FACTORY_PROPERTY + "' to define the LogFactory subclass to use..."); } String factoryClass = props.getProperty(FACTORY_PROPERTY); if (factoryClass != null) { if (isDiagnosticsEnabled()) { logDiagnostic( "[LOOKUP] Properties file specifies LogFactory subclass '" + factoryClass + "'"); } factory = newFactory(factoryClass, baseClassLoader, contextClassLoader); // TODO: think about whether we need to handle exceptions from newFactory } else { if (isDiagnosticsEnabled()) { logDiagnostic( "[LOOKUP] Properties file has no entry specifying LogFactory subclass."); } } } else { if (isDiagnosticsEnabled()) { logDiagnostic( "[LOOKUP] No properties file available to determine" + " LogFactory subclass from.."); } } } // Fourth, try the fallback implementation class if (factory == null) { if (isDiagnosticsEnabled()) { logDiagnostic( "[LOOKUP] Loading the default LogFactory implementation '" + FACTORY_DEFAULT + "' via the same classloader that loaded this LogFactory" + " class (ie not looking in the context classloader)."); } // Note: unlike the above code which can try to load custom LogFactory // implementations via the TCCL, we don't try to load the default LogFactory // implementation via the context classloader because: // * that can cause problems (see comments in newFactory method) // * no-one should be customising the code of the default class // Yes, we do give up the ability for the child to ship a newer // version of the LogFactoryImpl class and have it used dynamically // by an old LogFactory class in the parent, but that isn't // necessarily a good idea anyway. factory = newFactory(FACTORY_DEFAULT, thisClassLoader, contextClassLoader); } if (factory != null) { /** * Always cache using context class loader. */ cacheFactory(contextClassLoader, factory); if( props!=null ) { Enumeration names = props.propertyNames(); while (names.hasMoreElements()) { String name = (String) names.nextElement(); String value = props.getProperty(name); factory.setAttribute(name, value); } } } return factory; } /** * Convenience method to return a named logger, without the application * having to care about factories. * * @param clazz Class from which a log name will be derived * * @exception LogConfigurationException if a suitable <code>Log</code> * instance cannot be returned */ public static Log getLog(Class clazz) throws LogConfigurationException { return (getFactory().getInstance(clazz)); } /** * Convenience method to return a named logger, without the application * having to care about factories. * * @param name Logical name of the <code>Log</code> instance to be * returned (the meaning of this name is only known to the underlying * logging implementation that is being wrapped) * * @exception LogConfigurationException if a suitable <code>Log</code> * instance cannot be returned */ public static Log getLog(String name) throws LogConfigurationException { return (getFactory().getInstance(name)); } /** * Release any internal references to previously created {@link LogFactory} * instances that have been associated with the specified class loader * (if any), after calling the instance method <code>release()</code> on * each of them. * * @param classLoader ClassLoader for which to release the LogFactory */ public static void release(ClassLoader classLoader) { if (isDiagnosticsEnabled()) { logDiagnostic("Releasing factory for classloader " + objectId(classLoader)); } synchronized (factories) { if (classLoader == null) { if (nullClassLoaderFactory != null) { nullClassLoaderFactory.release(); nullClassLoaderFactory = null; } } else { LogFactory factory = (LogFactory) factories.get(classLoader); if (factory != null) { factory.release(); factories.remove(classLoader); } } } } /** * Release any internal references to previously created {@link LogFactory} * instances, after calling the instance method <code>release()</code> on * each of them. This is useful in environments like servlet containers, * which implement application reloading by throwing away a ClassLoader. * Dangling references to objects in that class loader would prevent * garbage collection. */ public static void releaseAll() { if (isDiagnosticsEnabled()) { logDiagnostic("Releasing factory for all classloaders."); } synchronized (factories) { Enumeration elements = factories.elements(); while (elements.hasMoreElements()) { LogFactory element = (LogFactory) elements.nextElement(); element.release(); } factories.clear(); if (nullClassLoaderFactory != null) { nullClassLoaderFactory.release(); nullClassLoaderFactory = null; } } } // ------------------------------------------------------ Protected Methods /** * Safely get access to the classloader for the specified class. * <p> * Theoretically, calling getClassLoader can throw a security exception, * and so should be done under an AccessController in order to provide * maximum flexibility. However in practice people don't appear to use * security policies that forbid getClassLoader calls. So for the moment * all code is written to call this method rather than Class.getClassLoader, * so that we could put AccessController stuff in this method without any * disruption later if we need to. * <p> * Even when using an AccessController, however, this method can still * throw SecurityException. Commons-logging basically relies on the * ability to access classloaders, ie a policy that forbids all * classloader access will also prevent commons-logging from working: * currently this method will throw an exception preventing the entire app * from starting up. Maybe it would be good to detect this situation and * just disable all commons-logging? Not high priority though - as stated * above, security policies that prevent classloader access aren't common. * <p> * Note that returning an object fetched via an AccessController would * technically be a security flaw anyway; untrusted code that has access * to a trusted JCL library could use it to fetch the classloader for * a class even when forbidden to do so directly. * * @since 1.1 */ protected static ClassLoader getClassLoader(Class clazz) { try { return clazz.getClassLoader(); } catch(SecurityException ex) { if (isDiagnosticsEnabled()) { logDiagnostic( "Unable to get classloader for class '" + clazz + "' due to security restrictions - " + ex.getMessage()); } throw ex; } } /** * Returns the current context classloader. * <p> * In versions prior to 1.1, this method did not use an AccessController. * In version 1.1, an AccessController wrapper was incorrectly added to * this method, causing a minor security flaw. * <p> * In version 1.1.1 this change was reverted; this method no longer uses * an AccessController. User code wishing to obtain the context classloader * must invoke this method via AccessController.doPrivileged if it needs * support for that. * * @return the context classloader associated with the current thread, * or null if security doesn't allow it. * * @throws LogConfigurationException if there was some weird error while * attempting to get the context classloader. * * @throws SecurityException if the current java security policy doesn't * allow this class to access the context classloader. */ protected static ClassLoader getContextClassLoader() throws LogConfigurationException { return directGetContextClassLoader(); } /** * Calls LogFactory.directGetContextClassLoader under the control of an * AccessController class. This means that java code running under a * security manager that forbids access to ClassLoaders will still work * if this class is given appropriate privileges, even when the caller * doesn't have such privileges. Without using an AccessController, the * the entire call stack must have the privilege before the call is * allowed. * * @return the context classloader associated with the current thread, * or null if security doesn't allow it. * * @throws LogConfigurationException if there was some weird error while * attempting to get the context classloader. * * @throws SecurityException if the current java security policy doesn't * allow this class to access the context classloader. */ private static ClassLoader getContextClassLoaderInternal() throws LogConfigurationException { return (ClassLoader)AccessController.doPrivileged( new PrivilegedAction() { public Object run() { return directGetContextClassLoader(); } }); } /** * Return the thread context class loader if available; otherwise return * null. * <p> * Most/all code should call getContextClassLoaderInternal rather than * calling this method directly. * <p> * The thread context class loader is available for JDK 1.2 * or later, if certain security conditions are met. * <p> * Note that no internal logging is done within this method because * this method is called every time LogFactory.getLogger() is called, * and we don't want too much output generated here. * * @exception LogConfigurationException if a suitable class loader * cannot be identified. * * @exception SecurityException if the java security policy forbids * access to the context classloader from one of the classes in the * current call stack. * @since 1.1 */ protected static ClassLoader directGetContextClassLoader() throws LogConfigurationException { ClassLoader classLoader = null; try { // Are we running on a JDK 1.2 or later system? Method method = Thread.class.getMethod("getContextClassLoader", (Class[]) null); // Get the thread context class loader (if there is one) try { classLoader = (ClassLoader)method.invoke(Thread.currentThread(), (Object[]) null); } catch (IllegalAccessException e) { throw new LogConfigurationException ("Unexpected IllegalAccessException", e); } catch (InvocationTargetException e) { /** * InvocationTargetException is thrown by 'invoke' when * the method being invoked (getContextClassLoader) throws * an exception. * * getContextClassLoader() throws SecurityException when * the context class loader isn't an ancestor of the * calling class's class loader, or if security * permissions are restricted. * * In the first case (not related), we want to ignore and * keep going. We cannot help but also ignore the second * with the logic below, but other calls elsewhere (to * obtain a class loader) will trigger this exception where * we can make a distinction. */ if (e.getTargetException() instanceof SecurityException) { ; // ignore } else { // Capture 'e.getTargetException()' exception for details // alternate: log 'e.getTargetException()', and pass back 'e'. throw new LogConfigurationException ("Unexpected InvocationTargetException", e.getTargetException()); } } } catch (NoSuchMethodException e) { // Assume we are running on JDK 1.1 classLoader = getClassLoader(LogFactory.class); // We deliberately don't log a message here to outputStream; // this message would be output for every call to LogFactory.getLog() // when running on JDK1.1 // // if (outputStream != null) { // outputStream.println( // "Method Thread.getContextClassLoader does not exist;" // + " assuming this is JDK 1.1, and that the context" // + " classloader is the same as the class that loaded" // + " the concrete LogFactory class."); // } } // Return the selected class loader return classLoader; } /** * Check cached factories (keyed by contextClassLoader) * * @param contextClassLoader is the context classloader associated * with the current thread. This allows separate LogFactory objects * per component within a container, provided each component has * a distinct context classloader set. This parameter may be null * in JDK1.1, and in embedded systems where jcl-using code is * placed in the bootclasspath. * * @return the factory associated with the specified classloader if * one has previously been created, or null if this is the first time * we have seen this particular classloader. */ private static LogFactory getCachedFactory(ClassLoader contextClassLoader) { LogFactory factory = null; if (contextClassLoader == null) { // We have to handle this specially, as factories is a Hashtable // and those don't accept null as a key value. // // nb: nullClassLoaderFactory might be null. That's ok. factory = nullClassLoaderFactory; } else { factory = (LogFactory) factories.get(contextClassLoader); } return factory; } /** * Remember this factory, so later calls to LogFactory.getCachedFactory * can return the previously created object (together with all its * cached Log objects). * * @param classLoader should be the current context classloader. Note that * this can be null under some circumstances; this is ok. * * @param factory should be the factory to cache. This should never be null. */ private static void cacheFactory(ClassLoader classLoader, LogFactory factory) { // Ideally we would assert(factory != null) here. However reporting // errors from within a logging implementation is a little tricky! if (factory != null) { if (classLoader == null) { nullClassLoaderFactory = factory; } else { factories.put(classLoader, factory); } } } /** * Return a new instance of the specified <code>LogFactory</code> * implementation class, loaded by the specified class loader. * If that fails, try the class loader used to load this * (abstract) LogFactory. * <p> * <h2>ClassLoader conflicts</h2> * Note that there can be problems if the specified ClassLoader is not the * same as the classloader that loaded this class, ie when loading a * concrete LogFactory subclass via a context classloader. * <p> * The problem is the same one that can occur when loading a concrete Log * subclass via a context classloader. * <p> * The problem occurs when code running in the context classloader calls * class X which was loaded via a parent classloader, and class X then calls * LogFactory.getFactory (either directly or via LogFactory.getLog). Because * class X was loaded via the parent, it binds to LogFactory loaded via * the parent. When the code in this method finds some LogFactoryYYYY * class in the child (context) classloader, and there also happens to be a * LogFactory class defined in the child classloader, then LogFactoryYYYY * will be bound to LogFactory@childloader. It cannot be cast to * LogFactory@parentloader, ie this method cannot return the object as * the desired type. Note that it doesn't matter if the LogFactory class * in the child classloader is identical to the LogFactory class in the * parent classloader, they are not compatible. * <p> * The solution taken here is to simply print out an error message when * this occurs then throw an exception. The deployer of the application * must ensure they remove all occurrences of the LogFactory class from * the child classloader in order to resolve the issue. Note that they * do not have to move the custom LogFactory subclass; that is ok as * long as the only LogFactory class it can find to bind to is in the * parent classloader. * <p> * @param factoryClass Fully qualified name of the <code>LogFactory</code> * implementation class * @param classLoader ClassLoader from which to load this class * @param contextClassLoader is the context that this new factory will * manage logging for. * * @exception LogConfigurationException if a suitable instance * cannot be created * @since 1.1 */ protected static LogFactory newFactory(final String factoryClass, final ClassLoader classLoader, final ClassLoader contextClassLoader) throws LogConfigurationException { // Note that any unchecked exceptions thrown by the createFactory // method will propagate out of this method; in particular a // ClassCastException can be thrown. Object result = AccessController.doPrivileged( new PrivilegedAction() { public Object run() { return createFactory(factoryClass, classLoader); } }); if (result instanceof LogConfigurationException) { LogConfigurationException ex = (LogConfigurationException) result; if (isDiagnosticsEnabled()) { logDiagnostic( "An error occurred while loading the factory class:" + ex.getMessage()); } throw ex; } if (isDiagnosticsEnabled()) { logDiagnostic( "Created object " + objectId(result) + " to manage classloader " + objectId(contextClassLoader)); } return (LogFactory)result; } /** * Method provided for backwards compatibility; see newFactory version that * takes 3 parameters. * <p> * This method would only ever be called in some rather odd situation. * Note that this method is static, so overriding in a subclass doesn't * have any effect unless this method is called from a method in that * subclass. However this method only makes sense to use from the * getFactory method, and as that is almost always invoked via * LogFactory.getFactory, any custom definition in a subclass would be * pointless. Only a class with a custom getFactory method, then invoked * directly via CustomFactoryImpl.getFactory or similar would ever call * this. Anyway, it's here just in case, though the "managed class loader" * value output to the diagnostics will not report the correct value. */ protected static LogFactory newFactory(final String factoryClass, final ClassLoader classLoader) { return newFactory(factoryClass, classLoader, null); } /** * Implements the operations described in the javadoc for newFactory. * * @param factoryClass * * @param classLoader used to load the specified factory class. This is * expected to be either the TCCL or the classloader which loaded this * class. Note that the classloader which loaded this class might be * "null" (ie the bootloader) for embedded systems. * * @return either a LogFactory object or a LogConfigurationException object. * @since 1.1 */ protected static Object createFactory(String factoryClass, ClassLoader classLoader) { // This will be used to diagnose bad configurations // and allow a useful message to be sent to the user Class logFactoryClass = null; try { if (classLoader != null) { try { // First the given class loader param (thread class loader) // Warning: must typecast here & allow exception // to be generated/caught & recast properly. logFactoryClass = classLoader.loadClass(factoryClass); if (LogFactory.class.isAssignableFrom(logFactoryClass)) { if (isDiagnosticsEnabled()) { logDiagnostic( "Loaded class " + logFactoryClass.getName() + " from classloader " + objectId(classLoader)); } } else { // // This indicates a problem with the ClassLoader tree. // An incompatible ClassLoader was used to load the // implementation. // As the same classes // must be available in multiple class loaders, // it is very likely that multiple JCL jars are present. // The most likely fix for this // problem is to remove the extra JCL jars from the // ClassLoader hierarchy. // if (isDiagnosticsEnabled()) { logDiagnostic( "Factory class " + logFactoryClass.getName() + " loaded from classloader " + objectId(logFactoryClass.getClassLoader()) + " does not extend '" + LogFactory.class.getName() + "' as loaded by this classloader."); logHierarchy("[BAD CL TREE] ", classLoader); } } return (LogFactory) logFactoryClass.newInstance(); } catch (ClassNotFoundException ex) { if (classLoader == thisClassLoader) { // Nothing more to try, onwards. if (isDiagnosticsEnabled()) { logDiagnostic( "Unable to locate any class called '" + factoryClass + "' via classloader " + objectId(classLoader)); } throw ex; } // ignore exception, continue } catch (NoClassDefFoundError e) { if (classLoader == thisClassLoader) { // Nothing more to try, onwards. if (isDiagnosticsEnabled()) { logDiagnostic( "Class '" + factoryClass + "' cannot be loaded" + " via classloader " + objectId(classLoader) + " - it depends on some other class that cannot" + " be found."); } throw e; } // ignore exception, continue } catch(ClassCastException e) { if (classLoader == thisClassLoader) { // There's no point in falling through to the code below that // tries again with thisClassLoader, because we've just tried // loading with that loader (not the TCCL). Just throw an // appropriate exception here. final boolean implementsLogFactory = implementsLogFactory(logFactoryClass); // // Construct a good message: users may not actual expect that a custom implementation // has been specified. Several well known containers use this mechanism to adapt JCL // to their native logging system. // String msg = "The application has specified that a custom LogFactory implementation should be used but " + "Class '" + factoryClass + "' cannot be converted to '" + LogFactory.class.getName() + "'. "; if (implementsLogFactory) { msg = msg + "The conflict is caused by the presence of multiple LogFactory classes in incompatible classloaders. " + "Background can be found in http://commons.apache.org/logging/tech.html. " + "If you have not explicitly specified a custom LogFactory then it is likely that " + "the container has set one without your knowledge. " + "In this case, consider using the commons-logging-adapters.jar file or " + "specifying the standard LogFactory from the command line. "; } else { msg = msg + "Please check the custom implementation. "; } msg = msg + "Help can be found @http://commons.apache.org/logging/troubleshooting.html."; if (isDiagnosticsEnabled()) { logDiagnostic(msg); } ClassCastException ex = new ClassCastException(msg); throw ex; } // Ignore exception, continue. Presumably the classloader was the // TCCL; the code below will try to load the class via thisClassLoader. // This will handle the case where the original calling class is in // a shared classpath but the TCCL has a copy of LogFactory and the // specified LogFactory implementation; we will fall back to using the // LogFactory implementation from the same classloader as this class. // // Issue: this doesn't handle the reverse case, where this LogFactory // is in the webapp, and the specified LogFactory implementation is // in a shared classpath. In that case: // (a) the class really does implement LogFactory (bad log msg above) // (b) the fallback code will result in exactly the same problem. } } /* At this point, either classLoader == null, OR * classLoader was unable to load factoryClass. * * In either case, we call Class.forName, which is equivalent * to LogFactory.class.getClassLoader().load(name), ie we ignore * the classloader parameter the caller passed, and fall back * to trying the classloader associated with this class. See the * javadoc for the newFactory method for more info on the * consequences of this. * * Notes: * * LogFactory.class.getClassLoader() may return 'null' * if LogFactory is loaded by the bootstrap classloader. */ // Warning: must typecast here & allow exception // to be generated/caught & recast properly. if (isDiagnosticsEnabled()) { logDiagnostic( "Unable to load factory class via classloader " + objectId(classLoader) + " - trying the classloader associated with this LogFactory."); } logFactoryClass = Class.forName(factoryClass); return (LogFactory) logFactoryClass.newInstance(); } catch (Exception e) { // Check to see if we've got a bad configuration if (isDiagnosticsEnabled()) { logDiagnostic("Unable to create LogFactory instance."); } if (logFactoryClass != null && !LogFactory.class.isAssignableFrom(logFactoryClass)) { return new LogConfigurationException( "The chosen LogFactory implementation does not extend LogFactory." + " Please check your configuration.", e); } return new LogConfigurationException(e); } } /** * Determines whether the given class actually implements <code>LogFactory</code>. * Diagnostic information is also logged. * <p> * <strong>Usage:</strong> to diagnose whether a classloader conflict is the cause * of incompatibility. The test used is whether the class is assignable from * the <code>LogFactory</code> class loaded by the class's classloader. * @param logFactoryClass <code>Class</code> which may implement <code>LogFactory</code> * @return true if the <code>logFactoryClass</code> does extend * <code>LogFactory</code> when that class is loaded via the same * classloader that loaded the <code>logFactoryClass</code>. */ private static boolean implementsLogFactory(Class logFactoryClass) { boolean implementsLogFactory = false; if (logFactoryClass != null) { try { ClassLoader logFactoryClassLoader = logFactoryClass.getClassLoader(); if (logFactoryClassLoader == null) { logDiagnostic("[CUSTOM LOG FACTORY] was loaded by the boot classloader"); } else { logHierarchy("[CUSTOM LOG FACTORY] ", logFactoryClassLoader); Class factoryFromCustomLoader = Class.forName("org.apache.commons.logging.LogFactory", false, logFactoryClassLoader); implementsLogFactory = factoryFromCustomLoader.isAssignableFrom(logFactoryClass); if (implementsLogFactory) { logDiagnostic("[CUSTOM LOG FACTORY] " + logFactoryClass.getName() + " implements LogFactory but was loaded by an incompatible classloader."); } else { logDiagnostic("[CUSTOM LOG FACTORY] " + logFactoryClass.getName() + " does not implement LogFactory."); } } } catch (SecurityException e) { // // The application is running within a hostile security environment. // This will make it very hard to diagnose issues with JCL. // Consider running less securely whilst debugging this issue. // logDiagnostic("[CUSTOM LOG FACTORY] SecurityException thrown whilst trying to determine whether " + "the compatibility was caused by a classloader conflict: " + e.getMessage()); } catch (LinkageError e) { // // This should be an unusual circumstance. // LinkageError's usually indicate that a dependent class has incompatibly changed. // Another possibility may be an exception thrown by an initializer. // Time for a clean rebuild? // logDiagnostic("[CUSTOM LOG FACTORY] LinkageError thrown whilst trying to determine whether " + "the compatibility was caused by a classloader conflict: " + e.getMessage()); } catch (ClassNotFoundException e) { // // LogFactory cannot be loaded by the classloader which loaded the custom factory implementation. // The custom implementation is not viable until this is corrected. // Ensure that the JCL jar and the custom class are available from the same classloader. // Running with diagnostics on should give information about the classloaders used // to load the custom factory. // logDiagnostic("[CUSTOM LOG FACTORY] LogFactory class cannot be loaded by classloader which loaded the " + "custom LogFactory implementation. Is the custom factory in the right classloader?"); } } return implementsLogFactory; } /** * Applets may run in an environment where accessing resources of a loader is * a secure operation, but where the commons-logging library has explicitly * been granted permission for that operation. In this case, we need to * run the operation using an AccessController. */ private static InputStream getResourceAsStream(final ClassLoader loader, final String name) { return (InputStream)AccessController.doPrivileged( new PrivilegedAction() { public Object run() { if (loader != null) { return loader.getResourceAsStream(name); } else { return ClassLoader.getSystemResourceAsStream(name); } } }); } /** * Given a filename, return an enumeration of URLs pointing to * all the occurrences of that filename in the classpath. * <p> * This is just like ClassLoader.getResources except that the * operation is done under an AccessController so that this method will * succeed when this jarfile is privileged but the caller is not. * This method must therefore remain private to avoid security issues. * <p> * If no instances are found, an Enumeration is returned whose * hasMoreElements method returns false (ie an "empty" enumeration). * If resources could not be listed for some reason, null is returned. */ private static Enumeration getResources(final ClassLoader loader, final String name) { PrivilegedAction action = new PrivilegedAction() { public Object run() { try { if (loader != null) { return loader.getResources(name); } else { return ClassLoader.getSystemResources(name); } } catch(IOException e) { if (isDiagnosticsEnabled()) { logDiagnostic( "Exception while trying to find configuration file " + name + ":" + e.getMessage()); } return null; } catch(NoSuchMethodError e) { // we must be running on a 1.1 JVM which doesn't support // ClassLoader.getSystemResources; just return null in // this case. return null; } } }; Object result = AccessController.doPrivileged(action); return (Enumeration) result; } /** * Given a URL that refers to a .properties file, load that file. * This is done under an AccessController so that this method will * succeed when this jarfile is privileged but the caller is not. * This method must therefore remain private to avoid security issues. * <p> * Null is returned if the URL cannot be opened. */ private static Properties getProperties(final URL url) { PrivilegedAction action = new PrivilegedAction() { public Object run() { InputStream stream = null; try { // We must ensure that useCaches is set to false, as the // default behaviour of java is to cache file handles, and // this "locks" files, preventing hot-redeploy on windows. URLConnection connection = url.openConnection(); connection.setDefaultUseCaches(false); stream = connection.getInputStream(); if (stream != null) { Properties props = new Properties(); props.load(stream); stream.close(); stream = null; return props; } } catch(IOException e) { if (isDiagnosticsEnabled()) { logDiagnostic("Unable to read URL " + url); } } finally { if (stream != null) { try { stream.close(); } catch(Throwable t) { // ignore exception; this should not happen if (isDiagnosticsEnabled()) { logDiagnostic("Unable to close stream for URL " + url); } } } } return null; } }; return (Properties) AccessController.doPrivileged(action); } /** * Locate a user-provided configuration file. * <p> * The classpath of the specified classLoader (usually the context classloader) * is searched for properties files of the specified name. If none is found, * null is returned. If more than one is found, then the file with the greatest * value for its PRIORITY property is returned. If multiple files have the * same PRIORITY value then the first in the classpath is returned. * <p> * This differs from the 1.0.x releases; those always use the first one found. * However as the priority is a new field, this change is backwards compatible. * <p> * The purpose of the priority field is to allow a webserver administrator to * override logging settings in all webapps by placing a commons-logging.properties * file in a shared classpath location with a priority > 0; this overrides any * commons-logging.properties files without priorities which are in the * webapps. Webapps can also use explicit priorities to override a configuration * file in the shared classpath if needed. */ private static final Properties getConfigurationFile( ClassLoader classLoader, String fileName) { Properties props = null; double priority = 0.0; URL propsUrl = null; try { Enumeration urls = getResources(classLoader, fileName); if (urls == null) { return null; } while (urls.hasMoreElements()) { URL url = (URL) urls.nextElement(); Properties newProps = getProperties(url); if (newProps != null) { if (props == null) { propsUrl = url; props = newProps; String priorityStr = props.getProperty(PRIORITY_KEY); priority = 0.0; if (priorityStr != null) { priority = Double.parseDouble(priorityStr); } if (isDiagnosticsEnabled()) { logDiagnostic( "[LOOKUP] Properties file found at '" + url + "'" + " with priority " + priority); } } else { String newPriorityStr = newProps.getProperty(PRIORITY_KEY); double newPriority = 0.0; if (newPriorityStr != null) { newPriority = Double.parseDouble(newPriorityStr); } if (newPriority > priority) { if (isDiagnosticsEnabled()) { logDiagnostic( "[LOOKUP] Properties file at '" + url + "'" + " with priority " + newPriority + " overrides file at '" + propsUrl + "'" + " with priority " + priority); } propsUrl = url; props = newProps; priority = newPriority; } else { if (isDiagnosticsEnabled()) { logDiagnostic( "[LOOKUP] Properties file at '" + url + "'" + " with priority " + newPriority + " does not override file at '" + propsUrl + "'" + " with priority " + priority); } } } } } } catch (SecurityException e) { if (isDiagnosticsEnabled()) { logDiagnostic("SecurityException thrown while trying to find/read config files."); } } if (isDiagnosticsEnabled()) { if (props == null) { logDiagnostic( "[LOOKUP] No properties file of name '" + fileName + "' found."); } else { logDiagnostic( "[LOOKUP] Properties file of name '" + fileName + "' found at '" + propsUrl + '"'); } } return props; } /** * Read the specified system property, using an AccessController so that * the property can be read if JCL has been granted the appropriate * security rights even if the calling code has not. * <p> * Take care not to expose the value returned by this method to the * calling application in any way; otherwise the calling app can use that * info to access data that should not be available to it. */ private static String getSystemProperty(final String key, final String def) throws SecurityException { return (String) AccessController.doPrivileged( new PrivilegedAction() { public Object run() { return System.getProperty(key, def); } }); } /** * Determines whether the user wants internal diagnostic output. If so, * returns an appropriate writer object. Users can enable diagnostic * output by setting the system property named {@link #DIAGNOSTICS_DEST_PROPERTY} to * a filename, or the special values STDOUT or STDERR. */ private static void initDiagnostics() { String dest; try { dest = getSystemProperty(DIAGNOSTICS_DEST_PROPERTY, null); if (dest == null) { return; } } catch(SecurityException ex) { // We must be running in some very secure environment. // We just have to assume output is not wanted.. return; } if (dest.equals("STDOUT")) { diagnosticsStream = System.out; } else if (dest.equals("STDERR")) { diagnosticsStream = System.err; } else { try { // open the file in append mode FileOutputStream fos = new FileOutputStream(dest, true); diagnosticsStream = new PrintStream(fos); } catch(IOException ex) { // We should report this to the user - but how? return; } } // In order to avoid confusion where multiple instances of JCL are // being used via different classloaders within the same app, we // ensure each logged message has a prefix of form // [LogFactory from classloader OID] // // Note that this prefix should be kept consistent with that // in LogFactoryImpl. However here we don't need to output info // about the actual *instance* of LogFactory, as all methods that // output diagnostics from this class are static. String classLoaderName; try { ClassLoader classLoader = thisClassLoader; if (thisClassLoader == null) { classLoaderName = "BOOTLOADER"; } else { classLoaderName = objectId(classLoader); } } catch(SecurityException e) { classLoaderName = "UNKNOWN"; } diagnosticPrefix = "[LogFactory from " + classLoaderName + "] "; } /** * Indicates true if the user has enabled internal logging. * <p> * By the way, sorry for the incorrect grammar, but calling this method * areDiagnosticsEnabled just isn't java beans style. * * @return true if calls to logDiagnostic will have any effect. * @since 1.1 */ protected static boolean isDiagnosticsEnabled() { return diagnosticsStream != null; } /** * Write the specified message to the internal logging destination. * <p> * Note that this method is private; concrete subclasses of this class * should not call it because the diagnosticPrefix string this * method puts in front of all its messages is LogFactory@...., * while subclasses should put SomeSubClass@... * <p> * Subclasses should instead compute their own prefix, then call * logRawDiagnostic. Note that calling isDiagnosticsEnabled is * fine for subclasses. * <p> * Note that it is safe to call this method before initDiagnostics * is called; any output will just be ignored (as isDiagnosticsEnabled * will return false). * * @param msg is the diagnostic message to be output. */ private static final void logDiagnostic(String msg) { if (diagnosticsStream != null) { diagnosticsStream.print(diagnosticPrefix); diagnosticsStream.println(msg); diagnosticsStream.flush(); } } /** * Write the specified message to the internal logging destination. * * @param msg is the diagnostic message to be output. * @since 1.1 */ protected static final void logRawDiagnostic(String msg) { if (diagnosticsStream != null) { diagnosticsStream.println(msg); diagnosticsStream.flush(); } } /** * Generate useful diagnostics regarding the classloader tree for * the specified class. * <p> * As an example, if the specified class was loaded via a webapp's * classloader, then you may get the following output: * <pre> * Class com.acme.Foo was loaded via classloader 11111 * ClassLoader tree: 11111 -> 22222 (SYSTEM) -> 33333 -> BOOT * </pre> * <p> * This method returns immediately if isDiagnosticsEnabled() * returns false. * * @param clazz is the class whose classloader + tree are to be * output. */ private static void logClassLoaderEnvironment(Class clazz) { if (!isDiagnosticsEnabled()) { return; } try { // Deliberately use System.getProperty here instead of getSystemProperty; if // the overall security policy for the calling application forbids access to // these variables then we do not want to output them to the diagnostic stream. logDiagnostic("[ENV] Extension directories (java.ext.dir): " + System.getProperty("java.ext.dir")); logDiagnostic("[ENV] Application classpath (java.class.path): " + System.getProperty("java.class.path")); } catch(SecurityException ex) { logDiagnostic("[ENV] Security setting prevent interrogation of system classpaths."); } String className = clazz.getName(); ClassLoader classLoader; try { classLoader = getClassLoader(clazz); } catch(SecurityException ex) { // not much useful diagnostics we can print here! logDiagnostic( "[ENV] Security forbids determining the classloader for " + className); return; } logDiagnostic( "[ENV] Class " + className + " was loaded via classloader " + objectId(classLoader)); logHierarchy("[ENV] Ancestry of classloader which loaded " + className + " is ", classLoader); } /** * Logs diagnostic messages about the given classloader * and it's hierarchy. The prefix is prepended to the message * and is intended to make it easier to understand the logs. * @param prefix * @param classLoader */ private static void logHierarchy(String prefix, ClassLoader classLoader) { if (!isDiagnosticsEnabled()) { return; } ClassLoader systemClassLoader; if (classLoader != null) { final String classLoaderString = classLoader.toString(); logDiagnostic(prefix + objectId(classLoader) + " == '" + classLoaderString + "'"); } try { systemClassLoader = ClassLoader.getSystemClassLoader(); } catch(SecurityException ex) { logDiagnostic( prefix + "Security forbids determining the system classloader."); return; } if (classLoader != null) { StringBuffer buf = new StringBuffer(prefix + "ClassLoader tree:"); for(;;) { buf.append(objectId(classLoader)); if (classLoader == systemClassLoader) { buf.append(" (SYSTEM) "); } try { classLoader = classLoader.getParent(); } catch(SecurityException ex) { buf.append(" --> SECRET"); break; } buf.append(" --> "); if (classLoader == null) { buf.append("BOOT"); break; } } logDiagnostic(buf.toString()); } } /** * Returns a string that uniquely identifies the specified object, including * its class. * <p> * The returned string is of form "classname@hashcode", ie is the same as * the return value of the Object.toString() method, but works even when * the specified object's class has overidden the toString method. * * @param o may be null. * @return a string of form classname@hashcode, or "null" if param o is null. * @since 1.1 */ public static String objectId(Object o) { if (o == null) { return "null"; } else { return o.getClass().getName() + "@" + System.identityHashCode(o); } } // ---------------------------------------------------------------------- // Static initialiser block to perform initialisation at class load time. // // We can't do this in the class constructor, as there are many // static methods on this class that can be called before any // LogFactory instances are created, and they depend upon this // stuff having been set up. // // Note that this block must come after any variable declarations used // by any methods called from this block, as we want any static initialiser // associated with the variable to run first. If static initialisers for // variables run after this code, then (a) their value might be needed // by methods called from here, and (b) they might *override* any value // computed here! // // So the wisest thing to do is just to place this code at the very end // of the class file. // ---------------------------------------------------------------------- static { // note: it's safe to call methods before initDiagnostics (though // diagnostic output gets discarded). thisClassLoader = getClassLoader(LogFactory.class); initDiagnostics(); logClassLoaderEnvironment(LogFactory.class); factories = createFactoryStore(); if (isDiagnosticsEnabled()) { logDiagnostic("BOOTSTRAP COMPLETED"); } } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
20833de226a8261a775a984933949608939e7bcc
88762804f33098f5e791d5fb3e83a16ee733cdba
/app/src/main/java/curso_intermedio/temas/Temain_4.java
1cc69446ba4900b172ebf0955c8c61573f3d079f
[]
no_license
SaulGrez/curso_fi
ab89b4e03919dd2ec486a6574bed7fb04ac2ad34
cb1ba44a5669373d2892cbfca3e573f7004c6cf3
refs/heads/master
2022-12-29T20:31:11.568404
2020-10-19T20:15:27
2020-10-19T20:15:27
304,196,766
0
0
null
2020-10-19T20:15:29
2020-10-15T03:12:51
Java
UTF-8
Java
false
false
862
java
package curso_intermedio.temas; public class Temain_4 { private String descripcion4i; private String titulo4i; private String image4i; public Temain_4() { } public Temain_4(String descripcion4i, String titulo4i, String image4i) { this.descripcion4i = descripcion4i; this.titulo4i = titulo4i; this.image4i = image4i; } public String getDescripcion4i() { return descripcion4i; } public void setDescripcion4i(String descripcion4i) { this.descripcion4i = descripcion4i; } public String getTitulo4i() { return titulo4i; } public void setTitulo4i(String titulo4i) { this.titulo4i = titulo4i; } public String getImage4i() { return image4i; } public void setImage4i(String image4i) { this.image4i = image4i; } }
[ "gr356052@uaeh.edu.mx" ]
gr356052@uaeh.edu.mx
7aa43e0324af9a38d753b0aa6b6cbef44c047170
446920fedd9aadda2093e3c9423e664d680e779d
/AdvancedVillages-Branching/src/com/pi/bukkit/worldgen/villa/BranchVillageGenerator.java
8585c2bdab02c65c216f185029b94221b18e59af
[]
no_license
Equinox-/Bukkit-Plugins
afadf8618d6f19bab18d9811d5be3c9381dc5dbe
c0461d4d6ff24d4992320224034dcd3a0fe6f3da
refs/heads/master
2021-01-01T19:28:23.627572
2013-08-05T18:34:13
2013-08-05T18:34:13
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,140
java
package com.pi.bukkit.worldgen.villa; import java.util.Arrays; import java.util.List; import java.util.Random; import org.bukkit.Material; import org.bukkit.World; import org.bukkit.generator.BlockPopulator; import org.bukkit.generator.ChunkGenerator; import com.pi.villa.gen.VillageGenerator; public class BranchVillageGenerator extends ChunkGenerator { private final BranchVillagePlugin plugin; public BranchVillageGenerator(BranchVillagePlugin plug) { this.plugin = plug; } @Override public List<BlockPopulator> getDefaultPopulators(World w) { return Arrays .asList(new BlockPopulator[] { new VillageGenerator() }); } private int getBlockIndex(int x, int y, int z) { if (y > 127) y = 127; return (((x << 4) + z) << 7) + y; } @Override public byte[] generate(World w, Random rand, int chunkX, int chunkZ) { byte[] data = new byte[32768]; for (int x = 0; x < 16; x++) { for (int z = 0; z < 16; z++) { for (int y = 0; y < 64; y++) { data[getBlockIndex(x, y, z)] = (byte) Material.GRASS.getId(); } } } return data; } }
[ "equinoxscripts@gmail.com" ]
equinoxscripts@gmail.com
9e5c0875f3d068cfe7565451251f4eca28f9dcf6
0bd7ea084e648b99bb5079fe3a95b9ae7959b72e
/src/tests1/DriverListTests.java
00d60251a5445e28ddc856a34ab85ef0ace94557
[]
no_license
donnpie/QuickFoodOrderSystem
ca602aa0a01803ef9676b60bc67a9f7affc46bce
60d6b204a69f31dcb6e4aafa0b0e4b6ce08abbde
refs/heads/master
2023-03-13T20:25:30.865040
2021-03-05T08:24:56
2021-03-05T08:24:56
341,872,287
0
0
null
2021-02-24T11:51:30
2021-02-24T11:05:34
null
UTF-8
Java
false
false
978
java
package tests1; import static org.junit.jupiter.api.Assertions.*; import org.junit.jupiter.api.Test; import main.Driver; import main.DriverList; import main.Restaurant; class DriverListTests { @Test void PickDriverInAreaWithLowestNumberOfOrders_HappyPath() { //Expected values String expectedName = "Driver1"; String expectedLocation = "location"; int expectedNumOfDeliveries = 1; Driver d1 = new Driver("Driver2", "location", 5); Driver d2 = new Driver(expectedName, expectedLocation, expectedNumOfDeliveries); Driver d3 = new Driver("Driver3", "Location3", 4); DriverList dl = new DriverList(); dl.Add(d1); dl.Add(d2); dl.Add(d3); Restaurant r = new Restaurant("Name", "1234", "location", 1); Driver d = dl.PickDriverInAreaWithLowestNumberOfOrders(r); assertEquals(d.GetName(), expectedName); assertEquals(d.GetLocation().toString(), expectedLocation); assertEquals(d.GetNumOfDeliveries(), expectedNumOfDeliveries); } }
[ "donnpie@gmail.com" ]
donnpie@gmail.com
4363c95fe3a51d45511c29bce5301f8958f6982a
22ed582fcd39578b16a90678d25335138322ab3d
/Android/SmartDoorbell/app/src/main/java/com/example/omnia/smartdoorbell/history/BlockFragment.java
95dcb26685a61930bd38b31a7bfdbbbd7bd410b4
[]
no_license
ruthdaniel/Smart-Doorbell
935b447d5b0225403e225a8ef640fda3417ad504
9a45db977717405a4e83817eaeff8650203707db
refs/heads/master
2021-09-16T06:01:28.051846
2018-06-17T17:23:35
2018-06-17T17:23:35
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,400
java
package com.example.omnia.smartdoorbell.history; import android.content.SharedPreferences; import android.net.Uri; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Toast; 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.StringRequest; import com.android.volley.toolbox.Volley; import com.example.omnia.smartdoorbell.R; import com.example.omnia.smartdoorbell.models.history; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import java.util.ArrayList; import java.util.List; public class BlockFragment extends Fragment { RecyclerView rec; List<history> block; String ip,url; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View v= inflater.inflate(R.layout.fragment_block, container, false); Log.e(" 2- ","on creat view fragment all :"); rec = (RecyclerView) v.findViewById(R.id.blocklistHistory); Log.e(" 3- ","get rec :"); rec.setLayoutManager(new LinearLayoutManager(getActivity())); Log.e(" 5- "," rec.setLayoutManager:"); Log.e(" 1- ", "on creat fragment :"); block = new ArrayList<>(); // ip=getArguments().getString("ip"); SharedPreferences sharedPreferences = getActivity().getSharedPreferences("sharedfile", getActivity().MODE_PRIVATE); ip = sharedPreferences.getString("ipServer", "nulllllllll"); // ip = "192.168.1.4:5005"; url = "http://" + ip + "/show_history/block".trim(); System.out.println(" url :" + url); Log.e(" url log ", url + ""); System.out.println(" url :" + url); RequestQueue queue = Volley.newRequestQueue(getContext()); // Start the queue queue.start(); StringRequest stringRequest = new StringRequest(Request.Method.GET, url, new Response.Listener<String>() { @Override public void onResponse(String response) { try { JSONObject jsonObject = new JSONObject(response); JSONArray jsonArray = jsonObject.getJSONArray("history"); for (int i = 0; i < jsonArray.length(); i++) { JSONObject currentobj = jsonArray.getJSONObject(i); String id = currentobj.getString("id"); String imagename = currentobj.getString("imagename"); String state = currentobj.getString("state"); String action = currentobj.getString("action"); String time = currentobj.getString("time"); String name = currentobj.getString("name"); String relation = currentobj.getString("relation"); history history = new history(); history.setId(id); history.setImage(imagename); history.setName(name); history.setTime(time); history.setState(state); history.setActhion(action); history.setRelation(relation); block.add(history); AdpterListHistory adpterListHistoryblock = new AdpterListHistory(getContext(), block,ip); Log.e(" 4- ","create adpter : ip ="+ip); Toast.makeText(getContext(), "list size : "+ block.size(), Toast.LENGTH_LONG).show(); rec.setAdapter(adpterListHistoryblock); Log.e(" 6- "," rec.setadpter:"); } } catch (JSONException e) { e.printStackTrace(); } } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { System.out.println("error : " + error); Log.e("error ", error + ""); Toast.makeText(getActivity(), "error" + error, Toast.LENGTH_LONG).show(); } }); queue.add(stringRequest); return v; } @Override public void onCreate( Bundle savedInstanceState) { super.onCreate(savedInstanceState); } /** * This interface must be implemented by activities that contain this * fragment to allow an interaction in this fragment to be communicated * to the activity and potentially other fragments contained in that * activity. * <p> * See the Android Training lesson <a href= * "http://developer.android.com/training/basics/fragments/communicating.html" * >Communicating with Other Fragments</a> for more information. */ public interface OnFragmentInteractionListener { // TODO: Update argument type and name void onFragmentInteraction(Uri uri); } }
[ "omnia.ali36036@yahoo.com" ]
omnia.ali36036@yahoo.com
879a5582efd48b0ebc2c41f834bbcbcbd1e48f03
8c3e71fa9784f340e256d9d184f681c3fc0f3d33
/src/easy/_190_ReverseBits.java
15fc2a6b1ebff69f7f756a36d2dde49e771f2682
[]
no_license
SagiZJS/LeetCode
56e6b9786973ea1f94ff4645f12c755e4b35e157
1e294450a26cc8677576aa57ca2745282748f6f1
refs/heads/master
2020-05-07T16:58:21.124311
2019-12-05T22:40:28
2019-12-05T22:40:28
180,707,008
0
0
null
null
null
null
UTF-8
Java
false
false
1,676
java
package easy; public class _190_ReverseBits { // public int reverseBits(int n) { // char[] digits = new char[32]; // for (int i = 0; i < 32;i++) { // digits[i] = '0'; // } // // char[] tempChars = Integer.toBinaryString(n).toCharArray(); // System.arraycopy(tempChars, 0, digits, 32 - tempChars.length, tempChars.length); // for (int i = 0; i < 16; i++) { // char temp = digits[i]; // digits[i] = digits[31 - i]; // digits[31-i] = temp; // } // // if (digits[0] != '1') { // return Integer.valueOf(new String(digits).substring(1), 2); // } else { // int add = Integer.valueOf(new String(digits).substring(1), 2); // return Integer.MIN_VALUE + add; // } // } public int reverseBits(int n) { int lp = 0X80000000; int rp = 0X00000001; int count = 0; int ret = 0X00000000; while(count < 16){ int step = 31 - count * 2; int l = (lp & n) >>> step; int r = (rp & n) << step; ret |= l | r; lp >>>= 1; rp <<= 1; count++; } return ret; } public static void main(String[] args) { _190_ReverseBits s = new _190_ReverseBits(); System.out.println(s.reverseBits(-3)); System.out.println((-1 ^ 0x40000000)<<1); // System.out.println(Integer.toBinaryString(Integer.MIN_VALUE)); // System.out.println("11111111111111111111111111111111".length()); // System.out.println(Integer.valueOf("11111", 2)); } }
[ "" ]
3e3f8c4bef251c6f2ce1b23ee7137f8b3b58f67a
b513180c527ddbfbf011b978d3cd28202ef2b3aa
/src/main/java/com/example/vhr/mapper/OpLogMapper.java
fb0267e532c0191539b2ee2dcc147398603288bb
[]
no_license
my-echo-smy/myvhr
87a0ac2b3a5e3bf520b90302bd2d32250c105190
aec30617dac3d9e08b647c6cd6f7efc064b93600
refs/heads/master
2022-10-24T05:21:53.584110
2020-06-15T09:13:46
2020-06-15T09:13:46
270,942,580
0
0
null
null
null
null
UTF-8
Java
false
false
352
java
package com.example.vhr.mapper; import com.example.vhr.model.OpLog; public interface OpLogMapper { int deleteByPrimaryKey(Integer id); int insert(OpLog record); int insertSelective(OpLog record); OpLog selectByPrimaryKey(Integer id); int updateByPrimaryKeySelective(OpLog record); int updateByPrimaryKey(OpLog record); }
[ "2441241367@qq.com" ]
2441241367@qq.com
481ae3a845a4267f1667c55862b950100b9bf0b9
33e54d59dcf2602b1d5079f28144ccac5fa2f6eb
/java-learn/src/main/java/com/liucan/classes/ItemManager.java
d32b122b97c6be3c3a73d109d54fd2613778e139
[]
no_license
whoisloda123/bank
1c433aa2dbe53847bfd0ca60758379d9f84d065d
cad9158b49d2424126db67d3e1a340a459676baf
refs/heads/master
2022-12-23T14:42:15.852354
2021-05-19T08:10:52
2021-05-19T08:10:52
129,715,883
0
1
null
2022-12-16T08:22:09
2018-04-16T09:09:37
Java
UTF-8
Java
false
false
1,321
java
package com.liucan.classes; import lombok.AllArgsConstructor; /** * 局部类,成员类,静态成员类 * * @author liucan * @version 18-12-9 */ public class ItemManager { private Item[] itemArray; private int index = 0; public ItemManager(int size) { itemArray = new Item[size]; } public void add(Item item) { itemArray[index++] = item; } public ItemList getItemList() { return new ItemList(); } public static class ItemList1 { private Integer key; private Integer value; } //成员类 private class ItemList { private Integer key; private Integer value; public void test() { } } public Iterator iterator() { //局部类 class IteratorImple implements Iterator { @Override public boolean hasMoreElements() { return itemArray.length > index; } @Override public Object nextElement() { return itemArray[index++]; } } return new IteratorImple(); } } @AllArgsConstructor(staticName = "of") class Item { private String name; private String value; } interface Iterator { boolean hasMoreElements(); Object nextElement(); }
[ "553650590@qq.com" ]
553650590@qq.com
28063ecf192095784e7949bb1a358791db790f32
be0de2dfbfafe3c10fd6f54e79cb23809f9609b8
/sample-apps/msa-flight/src/main/java/com/example/m9amsa/flight/service/AirplaneService.java
3f9e9849ac5000578b46c1b631f44eadbedb3864
[]
no_license
Macchinetta/microservices-development-guideline
adc78da69b2f8970fac50245ec9ee48ba4b54507
b26ad356f74fb28b26109cecda7f37d9ca7c28f1
refs/heads/master
2021-04-19T21:47:29.393193
2020-03-02T08:38:59
2021-03-23T06:25:01
249,630,511
0
0
null
null
null
null
UTF-8
Java
false
false
2,437
java
/* * Copyright(c) 2019 NTT Corporation. * * 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.example.m9amsa.flight.service; import java.util.List; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Example; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import com.example.m9amsa.flight.entity.Airplane; import com.example.m9amsa.flight.entity.AirplaneRepository; import com.example.m9amsa.flight.model.AirplaneInfo; /** * 機体情報ビジネスロジック。 * */ @Service public class AirplaneService { /** * 機体情報リポジトリ。 */ @Autowired AirplaneRepository airplaneRepository; /** * 機体情報を登録します。 * * <pre> * 既に同じ機体情報が登録されている場合は更新を行います。 * </pre> * * @param airplaneInfo 機体情報。 * @return DBに保存した機体情報。 */ @Transactional public Airplane addAirplane(AirplaneInfo airplaneInfo) { Example<Airplane> airplaneExample = Example.of(Airplane.builder().name(airplaneInfo.getName()).build()); Airplane airplane = airplaneRepository.findOne(airplaneExample).orElse(airplaneInfo.asEntity()); BeanUtils.copyProperties(airplaneInfo, airplane, "id"); return airplaneRepository.save(airplane); } /** * 機体情報を参照します。 * * <pre> * 登録されている機体情報をすべて取得します。 * </pre> * * @return 機体情報のリスト。機体情報が存在しない場合は0件のリストを返却します。 */ @Transactional(readOnly = true) public List<Airplane> findAirplaneList() { return airplaneRepository.findAll(); } }
[ "dev@nota.m001.jp" ]
dev@nota.m001.jp
54634c26e338a26043199c1096d51805d8cb664a
53d2f84ab0da0d02696f90f2489382e53fc9d2b9
/solr01/src/main/java/com/itheima/pojo/Product.java
167fa6dbc2220556c3c66b5641a1b01c546a4d14
[]
no_license
LuoTailong/spider
b86a6382d74d8c42b7e5282e0f8703fe16cc5ef8
0288f419a83a8bf8836f55285566af5a7f682bc9
refs/heads/master
2022-09-08T13:48:34.470379
2019-06-16T07:55:51
2019-06-16T07:55:51
192,164,952
0
0
null
2022-09-01T23:08:37
2019-06-16T07:55:45
Java
UTF-8
Java
false
false
1,519
java
package com.itheima.pojo; import org.apache.solr.client.solrj.beans.Field; public class Product { @Field private String id; @Field private String title; @Field private String name; @Field private Long price; @Field private String content; public Product() { } public Product(String id, String title, String name, Long price, String content) { this.id = id; this.title = title; this.name = name; this.price = price; this.content = content; } public String getContent() { return content; } public void setContent(String content) { this.content = content; } public String getId() { return id; } public void setId(String id) { this.id = id; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getName() { return name; } public void setName(String name) { this.name = name; } public Long getPrice() { return price; } public void setPrice(Long price) { this.price = price; } @Override public String toString() { return "Product{" + "id='" + id + '\'' + ", title='" + title + '\'' + ", name='" + name + '\'' + ", price=" + price + ", content='" + content + '\'' + '}'; } }
[ "18645999845@163.com" ]
18645999845@163.com
6b993ca17c2238727eec675ac0ba08f86376f767
90a0183c1fdd464dff1b95acd8ea1607ab1220ab
/src/main/java/com/mycompany/myapp/web/rest/PlaceResource.java
5722bc314d7efb94afc9e4271b63a9f355aca364
[]
no_license
BulkSecurityGeneratorProject/ngtools-sample
28da85507ff1d1d7f98cae1309ec8f5d4820048c
9b60dff59aa6d464032c3d375268a5ca12ab8962
refs/heads/master
2022-12-10T08:18:03.645098
2017-06-28T15:43:33
2017-06-28T15:43:33
296,548,445
0
0
null
2020-09-18T07:35:46
2020-09-18T07:35:45
null
UTF-8
Java
false
false
5,441
java
package com.mycompany.myapp.web.rest; import com.codahale.metrics.annotation.Timed; import com.mycompany.myapp.domain.Place; import com.mycompany.myapp.repository.PlaceRepository; import com.mycompany.myapp.repository.search.PlaceSearchRepository; import com.mycompany.myapp.web.rest.util.HeaderUtil; import io.github.jhipster.web.util.ResponseUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; import javax.validation.Valid; import java.net.URI; import java.net.URISyntaxException; import java.util.List; import java.util.Optional; import java.util.stream.Collectors; import java.util.stream.StreamSupport; import static org.elasticsearch.index.query.QueryBuilders.*; /** * REST controller for managing Place. */ @RestController @RequestMapping("/api") public class PlaceResource { private final Logger log = LoggerFactory.getLogger(PlaceResource.class); private static final String ENTITY_NAME = "place"; private final PlaceRepository placeRepository; private final PlaceSearchRepository placeSearchRepository; public PlaceResource(PlaceRepository placeRepository, PlaceSearchRepository placeSearchRepository) { this.placeRepository = placeRepository; this.placeSearchRepository = placeSearchRepository; } /** * POST /places : Create a new place. * * @param place the place to create * @return the ResponseEntity with status 201 (Created) and with body the new place, or with status 400 (Bad Request) if the place has already an ID * @throws URISyntaxException if the Location URI syntax is incorrect */ @PostMapping("/places") @Timed public ResponseEntity<Place> createPlace(@Valid @RequestBody Place place) throws URISyntaxException { log.debug("REST request to save Place : {}", place); if (place.getId() != null) { return ResponseEntity.badRequest().headers(HeaderUtil.createFailureAlert(ENTITY_NAME, "idexists", "A new place cannot already have an ID")).body(null); } Place result = placeRepository.save(place); placeSearchRepository.save(result); return ResponseEntity.created(new URI("/api/places/" + result.getId())) .headers(HeaderUtil.createEntityCreationAlert(ENTITY_NAME, result.getId().toString())) .body(result); } /** * PUT /places : Updates an existing place. * * @param place the place to update * @return the ResponseEntity with status 200 (OK) and with body the updated place, * or with status 400 (Bad Request) if the place is not valid, * or with status 500 (Internal Server Error) if the place couldn't be updated * @throws URISyntaxException if the Location URI syntax is incorrect */ @PutMapping("/places") @Timed public ResponseEntity<Place> updatePlace(@Valid @RequestBody Place place) throws URISyntaxException { log.debug("REST request to update Place : {}", place); if (place.getId() == null) { return createPlace(place); } Place result = placeRepository.save(place); placeSearchRepository.save(result); return ResponseEntity.ok() .headers(HeaderUtil.createEntityUpdateAlert(ENTITY_NAME, place.getId().toString())) .body(result); } /** * GET /places : get all the places. * * @return the ResponseEntity with status 200 (OK) and the list of places in body */ @GetMapping("/places") @Timed public List<Place> getAllPlaces() { log.debug("REST request to get all Places"); return placeRepository.findAllWithEagerRelationships(); } /** * GET /places/:id : get the "id" place. * * @param id the id of the place to retrieve * @return the ResponseEntity with status 200 (OK) and with body the place, or with status 404 (Not Found) */ @GetMapping("/places/{id}") @Timed public ResponseEntity<Place> getPlace(@PathVariable Long id) { log.debug("REST request to get Place : {}", id); Place place = placeRepository.findOneWithEagerRelationships(id); return ResponseUtil.wrapOrNotFound(Optional.ofNullable(place)); } /** * DELETE /places/:id : delete the "id" place. * * @param id the id of the place to delete * @return the ResponseEntity with status 200 (OK) */ @DeleteMapping("/places/{id}") @Timed public ResponseEntity<Void> deletePlace(@PathVariable Long id) { log.debug("REST request to delete Place : {}", id); placeRepository.delete(id); placeSearchRepository.delete(id); return ResponseEntity.ok().headers(HeaderUtil.createEntityDeletionAlert(ENTITY_NAME, id.toString())).build(); } /** * SEARCH /_search/places?query=:query : search for the place corresponding * to the query. * * @param query the query of the place search * @return the result of the search */ @GetMapping("/_search/places") @Timed public List<Place> searchPlaces(@RequestParam String query) { log.debug("REST request to search Places for query {}", query); return StreamSupport .stream(placeSearchRepository.search(queryStringQuery(query)).spliterator(), false) .collect(Collectors.toList()); } }
[ "d4udts@gmail.com" ]
d4udts@gmail.com
7ddd9779a0044700987c0d2aa86290223e469c83
9b893c0732414cc7d491250b5bc2d4a1dd73fe8c
/mn_sdk/src/main/java/com/mn/player/audio/AudioRunable.java
ebd231063d3adfbaf784c371cd9fdc689589222b
[]
no_license
wy749814530/MNOpenKit-AndroidX
570c13d66bd478b9bbdff1177cd235286d6791db
055acdf827372f25f021bca0922921e01f30438d
refs/heads/master
2022-12-06T11:09:51.102559
2020-08-18T03:06:32
2020-08-18T03:06:32
275,717,601
0
0
null
null
null
null
UTF-8
Java
false
false
2,405
java
package com.mn.player.audio; import java.util.ArrayDeque; import java.util.Deque; import static java.lang.Thread.sleep; /** * Created by WIN on 2018/5/18. */ public class AudioRunable implements Runnable { private OnAudioObserver _runableAudio; private volatile Deque<AudioBean> deque = new ArrayDeque<>(); private Thread thread = null; public void writeAudio(long lTaskContext, int nChannelId, long userdata, byte[] InData, int nDataLen, int nEncodeType) { if (thread != null) { AudioBean audioBean = new AudioBean(); audioBean.set_lTaskContext(lTaskContext); audioBean.set_nChannelId(nChannelId); audioBean.set_userdata(userdata); audioBean.set_InData(InData); audioBean.set_nDataLen(nDataLen); audioBean.set_nEncodeType(nEncodeType); deque.addLast(audioBean); } } public AudioRunable(OnAudioObserver runableAudio) { this._runableAudio = runableAudio; } public void clearAll() { deque.clear(); } public boolean isRunning(){ return thread!=null; } public void startRun() { synchronized (this) { if (thread == null) { clearAll(); thread = new Thread(this); thread.start(); } } } public void stopRun() { synchronized (this) { if (thread != null) { thread.interrupt(); thread = null; } clearAll(); } } @Override public void run() { while (thread != null && !thread.isInterrupted()) { if (deque.size() > 10) { while (deque.size() > 5) { deque.pollFirst(); } } if (!deque.isEmpty() && deque.size() > 0) { AudioBean mAudioBean = deque.pollFirst(); if (mAudioBean != null) { _runableAudio.onRunableAudioData(mAudioBean.get_lTaskContext(), mAudioBean.get_nChannelId(), mAudioBean.get_userdata(), mAudioBean.get_InData(), mAudioBean.get_nDataLen(), mAudioBean.get_nEncodeType()); } } try { sleep(10); } catch (InterruptedException e) { e.printStackTrace(); } } } }
[ "wy749814530@163.com" ]
wy749814530@163.com
4856b50c54a362a55d0be5dd9403725e3b59283b
dee86d38fba5315ed6bb865ad5ae92fb5a5436b2
/app/src/main/java/com/esq/e_list/DataForDetailedTask.java
8ee404f1c49b9e3418baf707f3bdd70929f73089
[]
no_license
EbhomenyeEmmanuel/To-do-EList
38e3a9c9f71a03938bc439baf0ae2e4335528619
18909dd0c0c6c91d472dd35f231209190790caf9
refs/heads/master
2021-05-17T19:31:11.859181
2020-03-29T02:43:13
2020-03-29T02:43:13
250,938,746
0
0
null
null
null
null
UTF-8
Java
false
false
749
java
package com.esq.e_list; import java.util.ArrayList; public class DataForDetailedTask { private String taskName; private int taskNumber; public DataForDetailedTask(String taskName, int taskNumber){ this.taskName = taskName; this.taskNumber = taskNumber; } public DataForDetailedTask(String taskName){ this(taskName, 0); } public String getTaskName() { return taskName; } public static int lastTaskId = 0; public static ArrayList<DataForDetailedTask> createDetailedTasksList(String taskText){ ArrayList<DataForDetailedTask> mainTasks = new ArrayList<>(); mainTasks.add(new DataForDetailedTask(taskText)); ++lastTaskId; return mainTasks; } }
[ "eebhomenye@yahoo.com" ]
eebhomenye@yahoo.com
17aae7ff1752b99caa562022b62761309811c5af
5ba4e0b67de10c3894e43481accfc27196d8beb3
/src/main/java/com/axj/demo/config/ThymeleafConfiguration.java
206c44e3294665839f4821f6b46744c4fc22ae75
[]
no_license
aixinjing/jhipster
8511f3c0d310d236f27adddaed2a1871dd6f3bd6
6fcce1474166ef3cde6a5cf2f175879c7604d937
refs/heads/master
2021-01-21T15:07:21.971221
2016-07-12T08:12:18
2016-07-12T08:12:18
57,101,322
0
0
null
null
null
null
UTF-8
Java
false
false
948
java
package com.axj.demo.config; import org.apache.commons.lang.CharEncoding; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.context.annotation.*; import org.thymeleaf.templateresolver.ClassLoaderTemplateResolver; @Configuration public class ThymeleafConfiguration { private final Logger log = LoggerFactory.getLogger(ThymeleafConfiguration.class); @Bean @Description("Thymeleaf template resolver serving HTML 5 emails") public ClassLoaderTemplateResolver emailTemplateResolver() { ClassLoaderTemplateResolver emailTemplateResolver = new ClassLoaderTemplateResolver(); emailTemplateResolver.setPrefix("mails/"); emailTemplateResolver.setSuffix(".html"); emailTemplateResolver.setTemplateMode("HTML5"); emailTemplateResolver.setCharacterEncoding(CharEncoding.UTF_8); emailTemplateResolver.setOrder(1); return emailTemplateResolver; } }
[ "15848114752@163.com" ]
15848114752@163.com
3a7d714f19e7d4d6f9f9cd6799522c099416cd23
74ebb2bc0a6acf518c4c7b181a7ea698a90967e4
/cloud-collection-core-service/src/main/java/com/geekluxun/util/ExceptionUtil.java
779e098763460c1fc4535f8b59664d5c7ca7a2f9
[]
no_license
geekluxun/cloud-collection
4ff7079645f5aca33189c3103f1a7d758c790d10
f1126159a70eb2c31a28dd1373d18a22593ce5df
refs/heads/master
2020-03-15T04:40:37.294086
2019-02-28T12:47:08
2019-02-28T12:47:08
131,971,139
2
0
null
null
null
null
UTF-8
Java
false
false
909
java
/* * Copyright 1999-2018 Alibaba Group Holding Ltd. * * 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.geekluxun.util; import com.alibaba.csp.sentinel.slots.block.BlockException; import lombok.extern.slf4j.Slf4j; /** * */ @Slf4j public final class ExceptionUtil { public static void handleException(BlockException ex) { log.warn("被限流处理了!!!!"); } }
[ "geekluxun@163.com" ]
geekluxun@163.com
5d7495c649975277ddb7a28f52303e8c773ffdf1
26d6febf72987bb402f7f77057949ff97ab9dba6
/gray-plugin-framework/src/main/java/com/rainbow/gray/framework/event/RuleClearedEvent.java
d723803220c3e1b7d8487f8d39980b1294399b91
[]
no_license
liuyunlong1229/gray
48aacfe00eb5370020ac25be9b25df796c12538a
96d4dc54c9ad1e0a570404959c7801b75f6750a1
refs/heads/master
2023-01-23T12:48:22.631827
2020-11-23T11:27:27
2020-11-23T11:27:27
315,288,535
1
0
null
null
null
null
UTF-8
Java
false
false
444
java
package com.rainbow.gray.framework.event; import java.io.Serializable; import com.rainbow.gray.framework.entity.RuleType; public class RuleClearedEvent implements Serializable { private static final long serialVersionUID = -4942710381954711909L; private RuleType ruleType; public RuleClearedEvent(RuleType ruleType) { this.ruleType = ruleType; } public RuleType getRuleType() { return ruleType; } }
[ "yunlongliu@pateo.com.cn" ]
yunlongliu@pateo.com.cn
f9731f86925b3f52aa9352dc5e9ddb8af4249e25
1dc8b9e71d6a41c3e28a79408312bd4ee17f53fc
/src/Controller.java
93bf1af73472322909955565cfcd619fb617f7e4
[]
no_license
masudhabib/Toy-Compiler1
2ec00abca2dde3455856e254c923d7910798f0b8
8c53425b689807058e2c9ceb7dfbcdd3a21499f1
refs/heads/master
2023-01-19T14:52:53.389713
2020-12-02T20:26:47
2020-12-02T20:26:47
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,810
java
import java.util.Arrays; import java.util.Scanner; import static java.lang.Character.isDigit; import static java.lang.Character.isLetter; public class Controller { public static void main(String args[]) { char expr[]= new char[20]; //storing the input from command line char operators[] = new char[20]; //storing expression and operator char variables[] = new char[20]; // storing variable or identifier int constants[] = new int[20]; //storing literals int cnt,i,j,dg; //cnt to store string length int vc =0,lc=0,oc=0; System.out.println("\n LEXICAL ANALYZER FOR AN EXPRESSION \n\n"); System.out.println("Enter the String\n"); //to read input and save it to an array int numberOfLinesToRead = 1; try(Scanner sc = new Scanner(System.in)){ StringBuilder buff = new StringBuilder(); while(numberOfLinesToRead-- > 0){ String line = sc.nextLine(); String noSpaces = line.replaceAll("\\s", ""); buff.append(noSpaces); } expr = buff.toString().toCharArray(); System.out.println("Array "+Arrays.toString(expr)); }catch (Exception e) { e.printStackTrace(); } cnt = expr.length; System.out.println("String length " + cnt); //To display string length for (i = 0; i < cnt; i++) { if( isLetter(expr[i]) ) //Condition for current element to be a variable { variables[vc]=expr[i]; vc++; } else if(expr[i] == '+' || expr[i] == '-' || expr[i] == '/' || expr[i] == '*' || expr[i] == '=' || expr[i] == '^') // Conditions to check for operators { operators[oc] = expr[i]; oc++; } else if(isDigit(expr[i])) // current element to change to be digit { dg= (expr[i]-'0'); i=i+1; if (isDigit(expr[i])) //Run loop until successive elements are digits { dg = dg*10 + (expr[i]-'0'); i++; } i= i-1; constants[lc] = dg; lc++; } } System.out.printf("\nThe literals are: \n"); for(j=0;j<lc;j++) { System.out.println(""+constants[j]); } System.out.println("\nThe operators are: \n"); for(j=0;j<oc;j++) { System.out.println(""+operators[j]); } System.out.println("\nThe variables are: \n"); for(j=0;j<vc;j++) { System.out.println("" +variables[j]); } } }
[ "svasamsetti@my.harrisburgu.edu" ]
svasamsetti@my.harrisburgu.edu
cec0c44dc06dd63c079967f29b9c3d61a8ba37c5
99f81d26e05a5a10c3b72fb0a158189f4ebdbe91
/cnysite/src/main/java/com/cny/cnysite/common/service/CrudService.java
8e7d0b1d1c61658e04e8e29fb0e01500863c756b
[ "Apache-2.0" ]
permissive
menyin/cnysitewraper
279723fc560cbbcd7cd34dd418c59a5f96c458f0
46ae268c9af0d2a1782e59d4dded016b94535a9e
refs/heads/master
2023-02-22T11:07:48.436075
2021-06-24T09:26:24
2021-06-24T09:26:24
133,467,584
0
0
null
2023-02-22T05:55:32
2018-05-15T06:11:58
JavaScript
UTF-8
Java
false
false
1,889
java
/** * Copyright &copy; 2012-2016 <a href="https://github.com/thinkgem/jeesite">JeeSite</a> All rights reserved. */ package com.cny.cnysite.common.service; import java.util.List; import com.cny.cnysite.common.persistence.CrudDao; import com.cny.cnysite.common.persistence.DataEntity; import com.cny.cnysite.common.persistence.Page; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.transaction.annotation.Transactional; import com.cny.cnysite.common.persistence.CrudDao; import com.cny.cnysite.common.persistence.DataEntity; import com.cny.cnysite.common.persistence.Page; /** * Service基类 * @author ThinkGem * @version 2014-05-16 */ @Transactional(readOnly = true) public abstract class CrudService<D extends CrudDao<T>, T extends DataEntity<T>> extends BaseService { /** * 持久层对象 */ @Autowired protected D dao; /** * 获取单条数据 * @param id * @return */ public T get(String id) { return dao.get(id); } /** * 获取单条数据 * @param entity * @return */ public T get(T entity) { return dao.get(entity); } /** * 查询列表数据 * @param entity * @return */ public List<T> findList(T entity) { return dao.findList(entity); } /** * 查询分页数据 * @param page 分页对象 * @param entity * @return */ public Page<T> findPage(Page<T> page, T entity) { entity.setPage(page); page.setList(dao.findList(entity)); return page; } /** * 保存数据(插入或更新) * @param entity */ @Transactional(readOnly = false) public void save(T entity) { if (entity.getIsNewRecord()){ entity.preInsert(); dao.insert(entity); }else{ entity.preUpdate(); dao.update(entity); } } /** * 删除数据 * @param entity */ @Transactional(readOnly = false) public void delete(T entity) { dao.delete(entity); } }
[ "3331866906@qq.com" ]
3331866906@qq.com
1686cd35437b6e512eeef2601ccdbcbc723e7b46
bfd466bbda6be219471f1ee75d4e4a2a552014ae
/GroceryDemo/app/src/main/java/com/freshbrigade/market/Fragment/View_time_fragment.java
d9348d5042311275cb3951a69b95d2a6d11507ce
[]
no_license
fresh-brigade/FreshBrigadeNewSide
7dedefd04645a7e8376420dcfba0e9fd0e2808fc
e247eece0b3811e8cd9f39f2c6a0413001e867b5
refs/heads/master
2020-12-27T02:23:27.691884
2020-02-02T07:35:56
2020-02-02T07:35:56
237,731,982
0
0
null
null
null
null
UTF-8
Java
false
false
5,333
java
package com.freshbrigade.market.Fragment; import android.app.Fragment; import android.os.Bundle; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Toast; import com.android.volley.NoConnectionError; import com.android.volley.Request; import com.android.volley.Response; import com.android.volley.TimeoutError; import com.android.volley.VolleyError; import com.android.volley.VolleyLog; import org.json.JSONException; import org.json.JSONObject; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import com.freshbrigade.market.Adapter.Home_adapter; import com.freshbrigade.market.Adapter.View_time_adapter; import com.freshbrigade.market.Config.BaseURL; import com.freshbrigade.market.Model.Category_model; import com.freshbrigade.market.AppController; import com.freshbrigade.market.MainActivity; import com.freshbrigade.market.R; import com.freshbrigade.market.util.ConnectivityReceiver; import com.freshbrigade.market.util.CustomVolleyJsonRequest; import com.freshbrigade.market.util.RecyclerTouchListener; import com.freshbrigade.market.util.Session_management; public class View_time_fragment extends Fragment { private static String TAG = View_time_fragment.class.getSimpleName(); private RecyclerView rv_time; private List<String> time_list = new ArrayList<>(); private List<Category_model> category_modelList = new ArrayList<>(); private Home_adapter adapter; private String getdate; private Session_management sessionManagement; public View_time_fragment() { // Required empty public constructor } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View view = inflater.inflate(R.layout.fragment_time_list, container, false); ((MainActivity) getActivity()).setTitle(getResources().getString(R.string.delivery_time)); sessionManagement = new Session_management(getActivity()); rv_time = (RecyclerView) view.findViewById(R.id.rv_times); rv_time.setLayoutManager(new LinearLayoutManager(getActivity())); getdate = getArguments().getString("date"); // check internet connection if (ConnectivityReceiver.isConnected()) { makeGetTimeRequest(getdate); } else { ((MainActivity) getActivity()).onNetworkConnectionChanged(false); } rv_time.addOnItemTouchListener(new RecyclerTouchListener(getActivity(), rv_time, new RecyclerTouchListener.OnItemClickListener() { @Override public void onItemClick(View view, int position) { String gettime = time_list.get(position); sessionManagement.cleardatetime(); sessionManagement.creatdatetime(getdate,gettime); ((MainActivity) getActivity()).onBackPressed(); } @Override public void onLongItemClick(View view, int position) { } })); return view; } /** * Method to make json object request where json response starts wtih { */ private void makeGetTimeRequest(String date) { // Tag used to cancel the request String tag_json_obj = "json_time_req"; Map<String, String> params = new HashMap<String, String>(); params.put("date",date); CustomVolleyJsonRequest jsonObjReq = new CustomVolleyJsonRequest(Request.Method.POST, BaseURL.GET_TIME_SLOT_URL, params, new Response.Listener<JSONObject>() { @Override public void onResponse(JSONObject response) { Log.d(TAG, response.toString()); try { Boolean status = response.getBoolean("responce"); if (status) { for(int i=0;i<response.getJSONArray("times").length();i++) { time_list.add(""+response.getJSONArray("times").get(i)); } View_time_adapter adapter = new View_time_adapter(time_list); rv_time.setAdapter(adapter); adapter.notifyDataSetChanged(); } } catch (JSONException e) { e.printStackTrace(); } } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { VolleyLog.d(TAG, "Error: " + error.getMessage()); if (error instanceof TimeoutError || error instanceof NoConnectionError) { Toast.makeText(getActivity(), getResources().getString(R.string.connection_time_out), Toast.LENGTH_SHORT).show(); } } }); // Adding request to request queue AppController.getInstance().addToRequestQueue(jsonObjReq, tag_json_obj); } }
[ "sankhla675291@gmail.com" ]
sankhla675291@gmail.com
90992a69e79784961c3e677cc19ae3475f5940a9
6992a7c22f3aaf7cb687254b012f456b1a7d5340
/app/src/main/java/com/example/dell/alkitabanak/page4_nuh.java
f0090cb139a8e9f277a76d1c8e41f32e8401fc94
[]
no_license
ViviReis/BibleForKids
c6a37a644509173c09aa3c84a04e4e7ecfe25cc7
550cab05a95ea3d3f67e98f4b64aee65b7f532b3
refs/heads/master
2020-06-15T12:04:26.870731
2018-07-25T07:52:32
2018-07-25T07:52:32
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,897
java
package com.example.dell.alkitabanak; import android.content.Intent; import android.graphics.Typeface; import android.media.MediaPlayer; import android.support.v7.app.ActionBarActivity; import android.os.Bundle; import android.view.KeyEvent; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.TextView; public class page4_nuh extends ActionBarActivity { TextView tx_view4; MediaPlayer mediaPlayer,mediaPlayer2,mediaPlayerDubbing; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.page4_nuh); tx_view4=(TextView)findViewById(R.id.textViewPageFour); Typeface myTypeface = Typeface.createFromAsset(getAssets(),"josefin.ttf"); tx_view4.setTypeface(myTypeface); mediaPlayer=MediaPlayer.create(this,R.raw.page_flip);//kasih suara Page Flip mediaPlayer.start(); getSupportActionBar().hide(); } @Override protected void onPause() { super.onPause(); mediaPlayerDubbing.release(); mediaPlayer2.release(); } @Override protected void onResume() { super.onResume(); mediaPlayerDubbing=MediaPlayer.create(this,R.raw.dub4_new); mediaPlayer2=MediaPlayer.create(this,R.raw.thunderstorm);//kasih suara Page Flip mediaPlayer2.setLooping(true); mediaPlayer2.setVolume(0.4f,0.4f);//atur volume disini! mediaPlayer2.start(); } @Override public boolean onKeyDown(int keyCode, KeyEvent event) { if(keyCode==KeyEvent.KEYCODE_BACK){ mediaPlayer.release(); mediaPlayer2.release(); if(mediaPlayerDubbing.isPlaying()) { mediaPlayerDubbing.release(); } Intent intent = new Intent(getApplicationContext(), page3_nuh.class);//jangan lupa ubah startActivity(intent); } return super.onKeyDown(keyCode, event); } public void onClickDub(View v){ if(mediaPlayerDubbing.isPlaying()) { mediaPlayerDubbing.seekTo(0); } else { mediaPlayerDubbing.setVolume(1.0f, 1.0f); mediaPlayerDubbing.start(); } } public void onClickPrevPageFour(View view){ Intent intent = new Intent(getApplicationContext(), page3_nuh.class); mediaPlayer.release(); mediaPlayer2.release(); if(mediaPlayerDubbing.isPlaying()) { mediaPlayerDubbing.release(); } startActivity(intent); } public void onClickNextPageFour(View view){ Intent intensi = new Intent(getApplicationContext(), page5_nuh.class); mediaPlayer.release(); mediaPlayer2.release(); mediaPlayerDubbing.release(); startActivity(intensi); } }
[ "Dell" ]
Dell
bfd9441172550d0fc577a9bcfe379758387ff457
3c8e2c43aeb374daa907650b2e63b920bc6338c5
/HouseTempActivity.java
dd32719e23a7415214f39cdc8548d0c3ec01e43c
[]
no_license
tish0/SmartHome-Android
35ba20576cde122e2b563f1399a54ddd8f135b33
54dcc4856b4cab0ec124f34969e6e43438455444
refs/heads/master
2021-01-12T03:28:20.932311
2017-01-06T15:09:28
2017-01-06T15:09:28
null
0
0
null
null
null
null
UTF-8
Java
false
false
344
java
package com.peneff.smarthome; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; public class HouseTempActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_house_temp); } }
[ "tish.peneff@gmail.com" ]
tish.peneff@gmail.com
ed38bd5237c614f8237848725eff9d558ba569fa
609565604ec97ffd7ad3aab72270cd605feb7dd4
/src/main/java/ru/hh/school/cache/memory/MemoryCache.java
896c48fb2c428172b19fd3bcfb1ed64243451542
[]
no_license
dborovikov/mcache
e0f85a27f70cc8e4d93564d9a6a05d5b7d131305
ffa3d880a30dcefdc7760476f877aa1037ac15b8
refs/heads/master
2020-04-26T04:20:27.862511
2011-12-23T10:00:16
2011-12-23T10:00:16
3,039,416
0
1
null
null
null
null
UTF-8
Java
false
false
793
java
package ru.hh.school.cache.memory; import static com.google.common.collect.Maps.newHashMap; import java.io.Serializable; import java.util.Map; import ru.hh.school.cache.BoundedCache; import ru.hh.school.cache.CacheStrategy; public class MemoryCache extends BoundedCache { private final Map<String, Serializable> map = newHashMap(); public MemoryCache(CacheStrategy strategy, int maxSize) { super(maxSize, strategy); } @Override protected Serializable removeInternal(String key) { return map.remove(key); } @Override protected void putInternal(String key, Serializable value) { map.put(key, value); } @Override protected Serializable getInternal(String key) { return map.get(key); } @Override public int size() { return map.size(); } }
[ "d.borovikov@hh.ru" ]
d.borovikov@hh.ru
171eb5bb0e003bf01669d3771dd1cc5c1ff616a9
f8d9c11707d5910ee065b16da713c9cdb38d1ae0
/src/main/java/thinkingjava/controlling/BreakAndContinue.java
5f03e722b9e305760f54732170318c66f1e882ed
[]
no_license
ThemanerL/thinking-java
c4417a783bd408728b2a512e6723de5b9f7ea31c
485a194766dfd54c7558c3146082580acd004914
refs/heads/master
2023-02-05T09:05:49.528383
2020-10-27T01:55:52
2020-10-27T01:55:52
149,605,282
0
0
null
2020-10-27T01:55:53
2018-09-20T12:23:17
Java
UTF-8
Java
false
false
526
java
package thinkingjava.controlling; /** * @author 李重辰 */ public class BreakAndContinue { public static void main(String[] args) { int i1 = 100; for (int i = 0; i < i1; i++) { if (i == 74) { break; } if (i % 9 != 0) { continue; } System.out.println(i); } int i = 0; while (true) { i++; int j = i * 27; if (j == 1269) { break; } if (i % 10 != 0) { continue; } System.out.println(i); } } }
[ "themaner@qq.com" ]
themaner@qq.com
53e9c9a0520839aba672ce73e3d8551ad5d99845
ff7487dc9d8c2b3f0c9ec1c55967a856177a1470
/src/main/Main.java
1ef8015112c7f70226fd0d140b6ba38cbba54441
[]
no_license
busra39/conference-app
59ace3e03137c0e45e5e4d8350f1f6c7d87501a2
a6dc820affd0e063a442974994e6d6dc7a5df942
refs/heads/master
2020-03-14T07:54:51.445373
2018-04-29T17:28:13
2018-04-29T17:28:13
131,514,141
2
0
null
null
null
null
UTF-8
Java
false
false
616
java
package main; public class Main { public static final int MORNING_SESSION_START = 9; public static final int MORNING_SESSION_END = 12; public static final int NOON_SESSION_START = 1; public static final int NOON_SESSION_END = 5; public static final String TALKS_PATH = "Input.txt"; public static void main(String[] args) { ConferenceUtil util = new ConferenceUtil(); util.processSessions(MORNING_SESSION_START, MORNING_SESSION_END, NOON_SESSION_START, NOON_SESSION_END); util.processTalks(TALKS_PATH); util.processDays(); util.output(); } }
[ "busra.canak@comeon.com" ]
busra.canak@comeon.com
b20ec5588ee7a08abb20adcf19156a0de6886c78
1965454f688c180e520fd213ac6158815f12d7ac
/src/main/java/hu/dpc/edu/rest/entity/DigestBuilder.java
44d438c8b31c6a178f5d5c238be3f403c3b3b61b
[]
no_license
thevrg/customer-repository
4cb994d461a0e6947b1bfe8729aae09906b3f2b8
b0338f4e46a508471685653df67cac658d8ff056
refs/heads/master
2021-01-17T18:02:53.025183
2016-06-09T15:57:19
2016-06-09T15:57:19
60,770,426
0
0
null
null
null
null
UTF-8
Java
false
false
899
java
package hu.dpc.edu.rest.entity; import java.math.BigInteger; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; /** * Created by vrg on 08/06/16. */ public class DigestBuilder { private final MessageDigest digest; public DigestBuilder() { try { this.digest = MessageDigest.getInstance("SHA-1"); } catch (NoSuchAlgorithmException ex) { throw new RuntimeException(ex); } } public DigestBuilder update(String value) { digest.update("|".getBytes()); digest.update(value.getBytes()); return this; } public DigestBuilder update(Object value) { return update(String.valueOf(value)); } public String build() { try { return new BigInteger(digest.digest()).toString(10); } finally { digest.reset(); } } }
[ "peter.varga@dpc.hu" ]
peter.varga@dpc.hu
521cb368f54c1f4632a21c49e11e9eee73a9546c
e75668c9539f6962f20e83eb50033bd0fafd4740
/src/main/java/pl/cinema/springboot/mapper/ShowMapper.java
dfa9c4b2492db3c483461f1907b16e2d3fde478c
[]
no_license
decemberdayt/CinemaMaster
25d9019826e206782bc12b32994b0892f8f88de3
594a7d5b0dda09a942600ea8ef91c561faa7d1f5
refs/heads/master
2023-03-18T20:23:33.932350
2021-03-08T22:02:01
2021-03-08T22:02:01
334,406,381
0
0
null
null
null
null
UTF-8
Java
false
false
1,166
java
package pl.cinema.springboot.mapper; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Select; import pl.cinema.springboot.model.Show; import pl.cinema.springboot.model.views.AllShowPerMovie; import java.util.List; @Mapper public interface ShowMapper { @Select("SELECT * FROM ANONYMOUS.SHOW") List<Show> getAll(); @Select("SELECT S.*, H.NUMBEROFROWS, H.NUMBEROFSEATS, M.TITLE\n" + "FROM ANONYMOUS.SHOW S\n" + "INNER JOIN ANONYMOUS.HALL H\n" + "ON\n" + " H.IDHALL = S.IDHALL\n" + "INNER JOIN ANONYMOUS.MOVIE M\n" + "ON\n" + " M.IDMOVIE = S.IDMOVIE\n" + "WHERE S.IDMOVIE = #{idMovie}") List<AllShowPerMovie> getAllShowPerMovie(int idMovie); @Select("SELECT S.*, H.NUMBEROFROWS, H.NUMBEROFSEATS, M.TITLE\n" + "FROM ANONYMOUS.SHOW S\n" + "INNER JOIN ANONYMOUS.HALL H\n" + "ON\n" + " H.IDHALL = S.IDHALL\n" + "INNER JOIN ANONYMOUS.MOVIE M\n" + "ON\n" + " M.IDMOVIE = S.IDMOVIE") List<AllShowPerMovie> getAllShow(); }
[ "decemberdayt@users.noreply.github.com" ]
decemberdayt@users.noreply.github.com
ea3985fdd03239c8c3e39368d23e6a2139bfb543
1f328c7dfd58f64bca21bdd4a8ada69dbe3ae235
/src/com/lin/school1/bean/Article.java
16ffbf41a467335bcf552c7301f270f0846ea493
[ "Apache-2.0" ]
permissive
pengtaolin/school1
d36362510fb6820703bf6a07926e33ba8110b0bb
cc18d40cb1eb97e2c88a0541526d4f5b0883ec87
refs/heads/master
2021-01-13T06:17:43.280058
2017-06-22T12:32:31
2017-06-22T12:32:31
95,088,368
0
0
null
null
null
null
UTF-8
Java
false
false
2,565
java
package com.lin.school1.bean; import java.io.Serializable; import java.util.Date; /** * 文章信息 * @author Administrator * */ public class Article implements Serializable{ private static final long serialVersionUID = -7071281946635202447L; /** * 文章ID */ private int articleId; /** * 文章作者 */ private String articleAuthor; /** * 文章标题 */ private String articleTitle; /** * 文章内容 */ private String articleContent; /** * 文章的url */ private String articleUrl; /** * 点击量 */ private int articleNumber; /** * 上传时间 */ private Date articleTime; /** * 所属的栏目 */ private Column column; /** * 文章的状态 * 0正常 * 1删除 * */ private int articleState; public int getArticleId() { return articleId; } public void setArticleId(int articleId) { this.articleId = articleId; } public String getArticleAuthor() { return articleAuthor; } public void setArticleAuthor(String articleAuthor) { this.articleAuthor = articleAuthor; } public String getArticleTitle() { return articleTitle; } public void setArticleTitle(String articleTitle) { this.articleTitle = articleTitle; } public String getArticleContent() { return articleContent; } public void setArticleContent(String articleContent) { this.articleContent = articleContent; } public String getArticleUrl() { return articleUrl; } public void setArticleUrl(String articleUrl) { this.articleUrl = articleUrl; } public int getArticleNumber() { return articleNumber; } public void setArticleNumber(int articleNumber) { this.articleNumber = articleNumber; } public Date getArticleTime() { return articleTime; } public void setArticleTime(Date articleTime) { this.articleTime = articleTime; } public Column getColumn() { return column; } public void setColumn(Column column) { this.column = column; } public int getArticleState() { return articleState; } public void setArticleState(int articleState) { this.articleState = articleState; } @Override public String toString() { return "Article [articleId=" + articleId + ", articleAuthor=" + articleAuthor + ", articleTitle=" + articleTitle + ", articleContent=" + articleContent + ", articleUrl=" + articleUrl + ", articleNumber=" + articleNumber + ", articleTime=" + articleTime + ", column=" + column + ", articleState=" + articleState + "]"; } }
[ "Administrator@USER-20161003RJ" ]
Administrator@USER-20161003RJ
3b5c97ad19777dfeea3715cb08f3eb3199b7edf4
9033b05d6f6522faa5bcd83834246398d048fd32
/src/main/java/com/example/cinema/cinema/exceptions/handler/FilmNotFoundException.java
e8efd525162222b8da75de875f910a6ae7a16c11
[]
no_license
magda94/cinema
f03687bf5dc47a65f07d71025b667eae566b2697
d1f71ebd6d2c3e56f631eeefaa9fc5a4845ba49e
refs/heads/master
2021-07-15T17:07:51.728045
2021-01-30T15:57:05
2021-01-30T15:57:05
233,373,010
1
0
null
2021-01-30T15:57:06
2020-01-12T10:14:33
Java
UTF-8
Java
false
false
238
java
package com.example.cinema.cinema.exceptions.handler; import java.util.function.Supplier; public class FilmNotFoundException extends RuntimeException { public FilmNotFoundException(String message) { super(message); } }
[ "magdapuscizna@gmail.com" ]
magdapuscizna@gmail.com
9ddf7e6a7c428b78d27216604b0695d7cd515bf3
afeb0d22b85b62db34ed67fa97dbfa61f79ec791
/src/main/java/interviewbit/level3/string/stringparsing/validipaddresses/Solution.java
5b022871f4e27902785f058bc2df4357fd20b619
[]
no_license
ajaypadvi/programming
fa214d20ba91334c0d5adf35e08eee1ddec80fbc
f95db8095e166c37c3d75aa0201089a6abc24c41
refs/heads/master
2021-05-08T01:01:52.306522
2017-11-30T07:28:21
2017-11-30T07:28:21
107,847,613
0
0
null
null
null
null
UTF-8
Java
false
false
1,543
java
package interviewbit.level3.string.stringparsing.validipaddresses; import java.util.ArrayList; /* Given a string containing only digits, restore it by returning all possible valid IP address combinations. A valid IP address must be in the form of A.B.C.D, where A,B,C and D are numbers from 0-255. The numbers cannot be 0 prefixed unless they are 0. Example: Given “25525511135”, return [“255.255.11.135”, “255.255.111.35”]. (Make sure the returned strings are sorted in order) */ public class Solution { public ArrayList<String> restoreIpAddresses(String number) { ArrayList<String> result = new ArrayList<>(); int l = number.length() - 3; for (int a = 0; a < 3 && a < l; a++) { for (int b = 0; b < 3 && b < l - a; b++) { for (int c = 0; c < 3 && c < l - a - b; c++) { StringBuilder sb = new StringBuilder(number); if (Integer.parseInt(sb.substring(0, a + 1)) < 256 && Integer.parseInt(sb.substring(a + 1, a + b + 2)) < 256 && Integer.parseInt(sb.substring(a + b + 2, a + b + c + 3)) < 256 && Integer.parseInt(sb.substring(a + b + c + 3)) < 256) { sb.insert(a + 1, "."); sb.insert(a + b + 3, "."); sb.insert(a + b + c + 5, "."); result.add(sb.toString()); } } } } return result; } }
[ "ajayadvi@gmail.com" ]
ajayadvi@gmail.com
f04bc67f40fdba4cb1cead78973f10c63dba0e76
dca1458249a708ad11950cdc18daf860fc568b34
/app/src/main/java/com/ljmob/districtactivity/entity/MessageBox.java
3efe01e5437c4ff1ec946e5f9f0f4c2a01af9280
[]
no_license
ruijindp/DistrictActivity
4aab166e808c7c38d5821d9fd87a6613bb2a3c39
c83191596cfd66911c09741856cf2757d7a03bb9
refs/heads/master
2020-12-24T20:51:44.870208
2016-05-20T10:21:01
2016-05-20T10:21:01
56,294,466
0
0
null
null
null
null
UTF-8
Java
false
false
386
java
package com.ljmob.districtactivity.entity; import com.londonx.lutil.entity.LEntity; /** * Created by london on 15/7/22. * 消息(我参与的) */ public class MessageBox extends LEntity { public int message_size; public String message_type; public String sender; public String comment_description; public String created_at; public Result activity_result; }
[ "360128674@qq.com" ]
360128674@qq.com
224bdd53f4c30cecfe79882746d9e490e0ce56a7
41dbf13f345fcf0347c6cecc5947d44fcffd1cf0
/web-customer-tracker-aop/src/main/java/com/turing/springdemo/service/CustomerService.java
00a8726245b4630eeb6bb50963f4ab65218d1c8d
[]
no_license
tanbinh123/learning-spring
dc20dc59d125976a287515d098a401dbdfcf0b83
19660636d255d6b3d04718a60201aed4442ad192
refs/heads/master
2022-12-18T14:38:04.675037
2020-09-26T19:35:39
2020-09-26T19:35:39
452,321,058
1
0
null
2022-01-26T15:06:05
2022-01-26T15:06:04
null
UTF-8
Java
false
false
318
java
package com.turing.springdemo.service; import com.turing.springdemo.entity.Customer; import java.util.List; public interface CustomerService { public List<Customer> getCustomers(); public void saveCustomer(Customer theCustomer); Customer getCustomer(int theId); void deleteCustomer(int theId); }
[ "aroupdhruba@gmail.com" ]
aroupdhruba@gmail.com
f9d66656eb7829695bb2458bcab539ca6eb72dcb
a9da706f450fbb5410b8e8d2c4f02c18e622b093
/P2PBBS/tags/version0.71/src/bbs/server/BBSServer.java
68de2fb3764f3d26744faa341fa3fae397aa2948
[]
no_license
nishio-dens/nisel-bbs
d707639c12da8ace3ade087655856aa1f9cf38e9
804a30d26b3b907322bd0f86530d4a0ed285bae4
refs/heads/master
2021-04-22T13:27:39.852930
2010-02-05T08:53:31
2010-02-05T08:53:31
24,786,782
2
1
null
null
null
null
UTF-8
Java
false
false
3,699
java
package bbs.server; import java.io.IOException; import java.net.InetSocketAddress; import java.util.concurrent.ThreadFactory; import java.util.concurrent.TimeUnit; import ow.util.concurrent.ConcurrentNonBlockingThreadPoolExecutor; import bbs.client.handler.ClientReadHandler; import bbs.dht.InitDHTException; import bbs.manager.BBSManager; import bbs.server.handler.BackupHandler; import bbs.server.handler.CanBackupHandler; import bbs.server.handler.CanManageHandler; import bbs.server.handler.DeleteHandler; import bbs.server.handler.GetHandler; import bbs.server.handler.GetLocalHandler; import bbs.server.handler.HaveHandler; import bbs.server.handler.IsManageHandler; import bbs.server.handler.ManageHandler; import bbs.server.handler.NotFoundHandler; import bbs.server.handler.PingHandler; import bbs.server.handler.ReadHandler; import bbs.server.handler.StatusHandler; import bbs.server.handler.WriteHandler; import com.sun.net.httpserver.HttpServer; /** * * @author nishio * */ public class BBSServer { //HTTPサーバ private HttpServer server; //BBSManager private BBSManager manager; public BBSServer() { this.server = null; } /** * サーバ初期化 * @param initNodeAddress 初期ノード * @param statControllerAddress ネットワーク状態を送信するアドレス * @param selfNodeAddress 自身のアドレス * @param dhtPort DHT待ち受けポート(UDP) * @param serverPort サーバ待ち受けポート(TCP) * @throws InitDHTException * @throws IOException */ public void start(String initNodeAddress, String statControllerAddress, String selfNodeAddress, int dhtPort, int serverPort) throws InitDHTException, IOException { this.manager = new BBSManager(initNodeAddress, statControllerAddress, selfNodeAddress, dhtPort); this.server = HttpServer.create(new InetSocketAddress( serverPort ), 0); //待ちうけハンドラーを設定 server.createContext("/", new NotFoundHandler()); //ping server.createContext("/command/ping", new PingHandler(manager)); //have server.createContext("/command/have/", new HaveHandler(manager)); //get server.createContext("/command/get/", new GetHandler(manager)); //read server.createContext("/command/read/", new ReadHandler(manager)); //getlocal server.createContext("/command/getlocal/", new GetLocalHandler(manager)); //canbackup server.createContext("/command/canbackup/", new CanBackupHandler(manager)); //backup server.createContext("/command/backup/", new BackupHandler(manager)); //write server.createContext("/command/write/", new WriteHandler(manager)); //canmanage server.createContext("/command/canmanage/", new CanManageHandler(manager)); //ismanage server.createContext("/command/ismanage/", new IsManageHandler(manager)); //manage server.createContext("/command/manage/", new ManageHandler(manager)); //status server.createContext("/command/status", new StatusHandler(manager)); //delete server.createContext("/command/delete", new DeleteHandler(manager)); //クライアント機能 //トピック一覧,及びトピック取得 server.createContext("/read/", new ClientReadHandler(manager, serverPort) ); //executor server.setExecutor(new ConcurrentNonBlockingThreadPoolExecutor(0, 10, 3L, TimeUnit.SECONDS, new DaemonThreadFactory())); //サーバ起動 server.start(); } /** * * @author nishio * */ private final static class DaemonThreadFactory implements ThreadFactory { public Thread newThread(Runnable r) { Thread t = new Thread(r); t.setName("deamonThread"); t.setDaemon(true); return t; } } }
[ "spark_xp@790d7f44-0ad2-4011-823a-3f93e9cbe0a0" ]
spark_xp@790d7f44-0ad2-4011-823a-3f93e9cbe0a0
82a07b1af9932cfe144e905bece1d76e76366b68
c81dd37adb032fb057d194b5383af7aa99f79c6a
/java/com/facebook/ads/redexgen/X/C0857Xs.java
fb9636eb9ce6a7376ab3e02047457f6eabb92088
[]
no_license
hongnam207/pi-network-source
1415a955e37fe58ca42098967f0b3307ab0dc785
17dc583f08f461d4dfbbc74beb98331bf7f9e5e3
refs/heads/main
2023-03-30T07:49:35.920796
2021-03-28T06:56:24
2021-03-28T06:56:24
null
0
0
null
null
null
null
UTF-8
Java
false
false
9,523
java
package com.facebook.ads.redexgen.X; import java.nio.ByteBuffer; import java.nio.ByteOrder; /* renamed from: com.facebook.ads.redexgen.X.Xs reason: case insensitive filesystem */ public final class C0857Xs implements B3 { public static String[] A0E; public int A00; public int A01 = -1; public int A02; public int A03; public int A04 = -1; public int A05; public long A06; public ByteBuffer A07 = B3.A00; public ByteBuffer A08 = B3.A00; public boolean A09; public boolean A0A; public boolean A0B; public byte[] A0C = new byte[0]; public byte[] A0D = new byte[0]; static { A03(); } public static void A03() { A0E = new String[]{"tvm2mqRs7a3ehYHdc1yBQoSNsWCnK", "tOWfSaULM8EnbecBF3SZtCA", "iNgvpQne2", "1AcoT6GEPIUQ3JZIKBz6KhI4GHeuy79P", "lryhUlLd6yxpw4rz006xnThMb", "3cZRB", "VTjWgXugqiR9aqruhTtZOoVTfcJyB76i", "EEKliZG5v6PVzs3xPcyqxwhc3FAivYta"}; } private int A00(long j) { return (int) ((((long) this.A04) * j) / 1000000); } private int A01(ByteBuffer byteBuffer) { for (int limit = byteBuffer.limit() - 1; limit >= byteBuffer.position(); limit -= 2) { if (Math.abs((int) byteBuffer.get(limit)) > 4) { int i = this.A00; return ((limit / i) * i) + i; } } int position = byteBuffer.position(); String[] strArr = A0E; if (strArr[5].length() != strArr[1].length()) { String[] strArr2 = A0E; strArr2[5] = "KbmXU"; strArr2[1] = "sStp2WQndpDzY5UDNElAkrU"; return position; } throw new RuntimeException(); } private int A02(ByteBuffer byteBuffer) { for (int position = byteBuffer.position() + 1; position < byteBuffer.limit(); position += 2) { if (Math.abs((int) byteBuffer.get(position)) > 4) { int i = this.A00; return i * (position / i); } } return byteBuffer.limit(); } private void A04(int i) { if (this.A07.capacity() < i) { this.A07 = ByteBuffer.allocateDirect(i).order(ByteOrder.nativeOrder()); } else { this.A07.clear(); } if (i > 0) { this.A0A = true; } } private void A05(ByteBuffer byteBuffer) { A04(byteBuffer.remaining()); this.A07.put(byteBuffer); this.A07.flip(); this.A08 = this.A07; } private void A06(ByteBuffer byteBuffer) { int maybeSilenceInputSize = byteBuffer.limit(); int A022 = A02(byteBuffer); int position = A022 - byteBuffer.position(); byte[] bArr = this.A0C; int length = bArr.length; int maybeSilenceBufferRemaining = this.A02; int i = length - maybeSilenceBufferRemaining; if (A022 >= maybeSilenceInputSize || position >= i) { int min = Math.min(position, i); byteBuffer.limit(byteBuffer.position() + min); String[] strArr = A0E; if (strArr[0].length() != strArr[2].length()) { String[] strArr2 = A0E; strArr2[6] = "wWIHZuTOncQcUu5TT4FAsoGOHgVjS7Hw"; strArr2[3] = "FL1HwHnzDnNmmMdWBTP73LL49pAAT75M"; byteBuffer.get(this.A0C, this.A02, min); this.A02 += min; int i2 = this.A02; byte[] bArr2 = this.A0C; if (i2 == bArr2.length) { if (this.A0A) { A0A(bArr2, this.A03); this.A06 += (long) ((this.A02 - (this.A03 * 2)) / this.A00); } else { this.A06 += (long) ((i2 - this.A03) / this.A00); } A09(byteBuffer, this.A0C, this.A02); this.A02 = 0; this.A05 = 2; } byteBuffer.limit(maybeSilenceInputSize); return; } throw new RuntimeException(); } A0A(bArr, maybeSilenceBufferRemaining); this.A02 = 0; this.A05 = 0; } private void A07(ByteBuffer byteBuffer) { int limit = byteBuffer.limit(); byteBuffer.limit(Math.min(limit, byteBuffer.position() + this.A0C.length)); int A012 = A01(byteBuffer); if (A012 == byteBuffer.position()) { this.A05 = 1; } else { byteBuffer.limit(A012); A05(byteBuffer); } byteBuffer.limit(limit); } private void A08(ByteBuffer byteBuffer) { int limit = byteBuffer.limit(); int A022 = A02(byteBuffer); byteBuffer.limit(A022); this.A06 += (long) (byteBuffer.remaining() / this.A00); A09(byteBuffer, this.A0D, this.A03); if (A022 < limit) { A0A(this.A0D, this.A03); this.A05 = 0; byteBuffer.limit(limit); } } private void A09(ByteBuffer byteBuffer, byte[] bArr, int i) { int min = Math.min(byteBuffer.remaining(), this.A03); int i2 = this.A03 - min; System.arraycopy(bArr, i - i2, this.A0D, 0, i2); byteBuffer.position(byteBuffer.limit() - min); byteBuffer.get(this.A0D, i2, min); } private void A0A(byte[] bArr, int i) { A04(i); this.A07.put(bArr, 0, i); this.A07.flip(); this.A08 = this.A07; } public final long A0B() { return this.A06; } public final void A0C(boolean z) { this.A09 = z; flush(); } @Override // com.facebook.ads.redexgen.X.B3 public final boolean A47(int i, int i2, int i3) throws B2 { if (i3 == 2) { if (this.A04 == i) { int i4 = this.A01; if (A0E[4].length() != 25) { throw new RuntimeException(); } String[] strArr = A0E; strArr[0] = "H8XMnFWveFctl2wFWM9cW2gP9UHr1"; strArr[2] = "PgSQZHBtM"; if (i4 == i2) { return false; } } this.A04 = i; this.A01 = i2; this.A00 = i2 * 2; return true; } throw new B2(i, i2, i3); } @Override // com.facebook.ads.redexgen.X.B3 public final ByteBuffer A6a() { ByteBuffer byteBuffer = this.A08; this.A08 = B3.A00; return byteBuffer; } @Override // com.facebook.ads.redexgen.X.B3 public final int A6b() { return this.A01; } @Override // com.facebook.ads.redexgen.X.B3 public final int A6c() { return 2; } @Override // com.facebook.ads.redexgen.X.B3 public final int A6d() { return this.A04; } @Override // com.facebook.ads.redexgen.X.B3 public final boolean A7V() { return this.A04 != -1 && this.A09; } @Override // com.facebook.ads.redexgen.X.B3 public final boolean A7Z() { return this.A0B && this.A08 == B3.A00; } @Override // com.facebook.ads.redexgen.X.B3 public final void ABu() { this.A0B = true; int i = this.A02; if (i > 0) { A0A(this.A0C, i); } if (!this.A0A) { this.A06 += (long) (this.A03 / this.A00); } } @Override // com.facebook.ads.redexgen.X.B3 public final void ABv(ByteBuffer byteBuffer) { while (byteBuffer.hasRemaining() && !this.A08.hasRemaining()) { int i = this.A05; if (i != 0) { String[] strArr = A0E; if (strArr[5].length() != strArr[1].length()) { String[] strArr2 = A0E; strArr2[4] = "AiWUvfGcxq4zga3HVbzIicdLH"; strArr2[4] = "AiWUvfGcxq4zga3HVbzIicdLH"; if (i == 1) { A06(byteBuffer); } else if (i == 2) { A08(byteBuffer); } else { throw new IllegalStateException(); } } else { throw new RuntimeException(); } } else { A07(byteBuffer); } } } @Override // com.facebook.ads.redexgen.X.B3 public final void flush() { if (A7V()) { int A002 = A00(150000) * this.A00; if (this.A0C.length != A002) { this.A0C = new byte[A002]; } this.A03 = A00(20000) * this.A00; int length = this.A0D.length; int i = this.A03; if (length != i) { this.A0D = new byte[i]; } } this.A05 = 0; this.A08 = B3.A00; this.A0B = false; this.A06 = 0; String[] strArr = A0E; if (strArr[5].length() != strArr[1].length()) { String[] strArr2 = A0E; strArr2[5] = "CYbGl"; strArr2[1] = "FkXGzwkTO5dsiSfEVL3DvOQ"; this.A02 = 0; this.A0A = false; return; } throw new RuntimeException(); } @Override // com.facebook.ads.redexgen.X.B3 public final void reset() { this.A09 = false; flush(); this.A07 = B3.A00; this.A01 = -1; this.A04 = -1; this.A03 = 0; this.A0C = new byte[0]; this.A0D = new byte[0]; } }
[ "nganht2@vng.com.vn" ]
nganht2@vng.com.vn
4f62cabf3a5591a92ad35d657aae526bb0a5ea86
e7449fded368566ac19426c8d271fa58bea31f0c
/src/main/java/com/revature/service/ReserveServices.java
422c047dd65039db947876a1bfd049f9a5f542d7
[]
no_license
Janu1208/watercanapp-core
e91e18193e5fbb510f271da211c7e13f8ac9d5aa
5e23e2c8b640b52216415416ef598f97e1958ec7
refs/heads/master
2023-08-19T23:20:51.414746
2019-10-03T00:33:47
2019-10-03T00:33:47
209,464,461
0
0
null
null
null
null
UTF-8
Java
false
false
1,305
java
package com.revature.service; import java.sql.SQLException; import com.revature.dao.ReserveDAO; import com.revature.dao.ReserveDAOImp; import com.revature.dao.StockDAO; import com.revature.dao.StockDAOImp; import com.revature.model.Reserve; import com.revature.util.Logger; public class ReserveServices { private static final Logger logger=Logger.getInstance(); /** * it will give facility for the user to reserve cans * reserved cans should be greater than zero and it should not be null * @param reserve * @throws */ public Reserve reserveCan( Reserve reserve) throws SQLException { StockDAO sdao =new StockDAOImp(); int availableStock = sdao.findavaiability(); logger.info("Available"+availableStock + ",reserveCans:"+reserve.getReserveCans()); int totalCanAfterReserve=0; ReserveDAO rdao=new ReserveDAOImp(); if (reserve.getReserveCans() <= availableStock) { rdao.addReserveCans(reserve); try { totalCanAfterReserve=availableStock - reserve.getReserveCans(); sdao.updateStock(totalCanAfterReserve); reserve=rdao.selectReserve(reserve.getUserId()); } catch (SQLException e) { e.printStackTrace(); throw new SQLException(e.getMessage()); } } else { reserve=null; } return reserve; } }
[ "janshi@gmail.com" ]
janshi@gmail.com
8c97cd4975dd6f3aad23e455228f2cdb61ff3575
8e67ba1aabadf541f90dd427571562a4818a2521
/Support/src/main/java/com/bbm/sdk/support/kms/BlackBerryKMSSource.java
014e7aa39ea1a0cbc6babb8b06470ced48bba477
[]
no_license
sarinal/CakeCept
d11c5979d3ec417457a134201e928fff4f6d7dcf
5f35d8ccf9b38ba2b16fcaab2796908fb5f81e77
refs/heads/master
2020-04-09T03:35:50.431227
2018-12-03T04:19:06
2018-12-03T04:20:08
159,698,576
0
0
null
null
null
null
UTF-8
Java
false
false
9,219
java
/* * Copyright (c) 2018 BlackBerry. All Rights Reserved. * * You must obtain a license from and pay any applicable license fees to * BlackBerry before you may reproduce, modify or distribute this * software, or any work that includes all or part of this software. * * This file may contain contributions from others. Please review this entire * file for other proprietary rights or license notices. */ package com.bbm.sdk.support.kms; import android.support.annotation.NonNull; import com.bbm.sdk.BBMEnterprise; import com.bbm.sdk.bbmds.GlobalSetupState; import com.bbm.sdk.bbmds.GlobalSyncPasscodeState; import com.bbm.sdk.bbmds.inbound.SyncError; import com.bbm.sdk.bbmds.inbound.SyncPasscodeChangeResult; import com.bbm.sdk.bbmds.internal.Existence; import com.bbm.sdk.bbmds.outbound.SyncPasscodeChange; import com.bbm.sdk.bbmds.outbound.SyncStart; import com.bbm.sdk.reactive.ObservableMonitor; import com.bbm.sdk.reactive.SingleshotMonitor; import com.bbm.sdk.service.InboundMessageObservable; import com.bbm.sdk.support.protect.KeySource; import com.bbm.sdk.support.protect.PasscodeProvider; import com.bbm.sdk.support.protect.UserChallengePasscodeProvider; import java.util.UUID; /** * This class listens to BlackBerry KMS events from bbmcore. * The PasscodeProvider is prompted for a passcode when required. * * To use the BlackBerry KMS as the key source set it using {@link com.bbm.sdk.support.util.KeySourceManager#setKeySource(KeySource)} */ public class BlackBerryKMSSource implements KeySource { private PasscodeProvider mPasscodeProvider; private PasscodeProvider.PasscodeError mPreviousError = PasscodeProvider.PasscodeError.None; private InboundMessageObservable<SyncError> mSyncErrorObservable; private boolean forgotPasscode = false; // Observe the global setup state to determine when to prompt the user for a passcode private ObservableMonitor mPasscodeMonitor = new ObservableMonitor() { @Override protected void run() { GlobalSetupState setupState = BBMEnterprise.getInstance().getBbmdsProtocol().getGlobalSetupState().get(); if (setupState.exists == Existence.MAYBE) { return; } //If the setup state is "SyncRequired" then check the SyncPasscodeState, if necessary prompt the user for a passcode if (setupState.state == GlobalSetupState.State.SyncRequired) { GlobalSyncPasscodeState passcodeState = BBMEnterprise.getInstance().getBbmdsProtocol().getGlobalSyncPasscodeState().get(); if (passcodeState.exists == Existence.MAYBE || mPasscodeProvider == null) { return; } switch (passcodeState.value) { case New: //Prompt the user to provide a new passcode mPasscodeProvider.requestNewPasscode(false, mPreviousError); break; case Existing: mPasscodeProvider.provideExistingPasscode(false, mPreviousError); break; case None: case Unspecified: //No action required break; } } else if (setupState.state == GlobalSetupState.State.Ongoing) { //Reset the passcode error. mPreviousError = PasscodeProvider.PasscodeError.None; } } }; //Observe sync errors private ObservableMonitor mSyncErrorMonitor = new ObservableMonitor() { @Override protected void run() { SyncError syncError = mSyncErrorObservable.get(); if (syncError.exists == Existence.MAYBE) { return; } switch (syncError.error) { case Failure: mPreviousError = PasscodeProvider.PasscodeError.SyncFailure; break; case IncorrectPasscode: mPreviousError = PasscodeProvider.PasscodeError.IncorrectPasscode; break; case Timeout: mPreviousError = PasscodeProvider.PasscodeError.SyncTimeout; break; case Unspecified: default: mPreviousError = PasscodeProvider.PasscodeError.None; } } }; public BlackBerryKMSSource(@NonNull UserChallengePasscodeProvider passcodeProvider) { mPasscodeProvider = passcodeProvider; mSyncErrorObservable = new InboundMessageObservable<>( new SyncError(), BBMEnterprise.getInstance().getBbmdsProtocolConnector() ); } private void sendSyncPasscodeChange(String passcode) { //Setup a consumer to listen for the SyncPasscodeChangeResult String cookie = UUID.randomUUID().toString(); InboundMessageObservable<SyncPasscodeChangeResult> changeResult = new InboundMessageObservable<>( new SyncPasscodeChangeResult(), cookie, BBMEnterprise.getInstance().getBbmdsProtocolConnector() ); SingleshotMonitor.run(() -> { if (changeResult.get().exists == Existence.MAYBE) { return false; } switch (changeResult.get().result) { case Success: //We're done break; case TemporaryFailure: //Re-prompt but include the temporary failure error mPasscodeProvider.requestNewPasscode(true, PasscodeProvider.PasscodeError.TemporaryFailure); break; default: break; } return true; }); //Send a request to change the passcode SyncPasscodeChange changePasscode = new SyncPasscodeChange(passcode); BBMEnterprise.getInstance().getBbmdsProtocol().send(changePasscode); } /** * Start monitoring GlobalPasscodeState and monitor for sync errors. */ @Override public void start() { mPasscodeMonitor.activate(); mSyncErrorMonitor.activate(); } /** * Stop monitoring the GlobalPasscodeState and monitoring for sync errors. */ @Override public void stop() { mPasscodeMonitor.dispose(); mSyncErrorMonitor.dispose(); } @Override public void retryFailedEvents() { //Nothing retry of key storage requests is completed by bbmcore } /** * Request a new passcode from the user. * After the passcode is retrieved it will be provided to bbmcore via {@link #sendSyncPasscodeChange} */ @Override public void changePasscode() { mPasscodeProvider.requestNewPasscode(true, PasscodeProvider.PasscodeError.None); } /** * Provide the supplied passcode to bbmcore. * If the GlobalPasscodeState is 'Existing' or 'New' the passcode is sent via {@link SyncStart} * If the GlobalPasscodeState is 'None' the passcode is sent via {@link SyncPasscodeChange} * @param passcode the passcode provided by the user. */ public void setPasscode(@NonNull String passcode) { SingleshotMonitor.run(() -> { GlobalSyncPasscodeState passcodeState = BBMEnterprise.getInstance().getBbmdsProtocol().getGlobalSyncPasscodeState().get(); if (passcodeState.exists == Existence.MAYBE) { return false; } if (forgotPasscode) { //Force state to 'New' to reset the passcode passcodeState.value = GlobalSyncPasscodeState.State.New; } switch (passcodeState.value) { case New: //Send the new passcode to bbmcore to complete setup SyncStart syncStart = new SyncStart(passcode).action(SyncStart.Action.New); BBMEnterprise.getInstance().getBbmdsProtocol().send(syncStart); break; case Existing: //Send the existing passcode to bbmcore complete setup. syncStart = new SyncStart(passcode).action(SyncStart.Action.Existing); BBMEnterprise.getInstance().getBbmdsProtocol().send(syncStart); break; case None: //We aren't setting up so change the passcode sendSyncPasscodeChange(passcode); break; default: //Fall out and return true } return true; }); } /** * Retrieve a new passcode, after the passcode is retrieved it will be provided to bbmcore via * {@link SyncStart} with action 'New'. */ @Override public void forgotPasscode() { //If the user forgets their passcode for the key storage we can send a syncStart with action 'New' forgotPasscode = true; mPasscodeProvider.requestNewPasscode(false, PasscodeProvider.PasscodeError.None); } }
[ "sarina-luu@hotmail.com" ]
sarina-luu@hotmail.com