id
int64
1
194k
buggy
stringlengths
23
37.5k
fixed
stringlengths
6
37.4k
193,401
resetLineSize(); } protected void initViewSize() { mWidth = getMeasuredWidth(); mHeight = getMeasuredHeight(); <BUG>leftPadding = LeafUtil.dp2px(getContext(), 15); topPadding = leftPadding; rightPadding = leftPadding; bottomPadding = LeafUtil.dp2px(getContext(), 20); </BUG> }
resetLineSize(); } protected void initViewSize() { mWidth = getMeasuredWidth(); mHeight = getMeasuredHeight(); leftPadding = LeafUtil.dp2px(mContext, 20); rightPadding = LeafUtil.dp2px(mContext, 10); topPadding = LeafUtil.dp2px(mContext, 15); bottomPadding = LeafUtil.dp2px(mContext, 20); }
193,402
paint.setStrokeWidth(LeafUtil.dp2px(mContext, axisY.getAxisLineWidth())); List<AxisValue> valuesX = axisX.getValues(); int sizeX = valuesX.size(); for (int i = 1; i < sizeX; i++) { AxisValue value = valuesX.get(i); <BUG>canvas.drawLine(value.getPointX() + value.getTextWidth() / 2, axisY.getStartY() - LeafUtil.dp2px(mContext, axisY.getAxisWidth()), value.getPointX() + value.getTextWidth() / 2, axisY.getStopY(), paint); }</BUG> }
paint.setStrokeWidth(LeafUtil.dp2px(mContext, axisY.getAxisLineWidth())); List<AxisValue> valuesX = axisX.getValues(); int sizeX = valuesX.size(); for (int i = 1; i < sizeX; i++) { AxisValue value = valuesX.get(i); canvas.drawLine(value.getPointX(), axisY.getStartY() - LeafUtil.dp2px(mContext, axisY.getAxisWidth()), value.getPointX(), axisY.getStopY(), paint); } }
193,403
paint.setStrokeWidth(LeafUtil.dp2px(mContext, axisX.getAxisLineWidth())); List<AxisValue> valuesY = axisY.getValues(); int sizeY = valuesY.size(); for (int i = 1; i < sizeY; i++) { AxisValue value = valuesY.get(i); <BUG>canvas.drawLine(axisY.getStartX() + axisX.getValues().get(0).getTextWidth() / 2 + LeafUtil.dp2px(mContext, axisX.getAxisWidth()), value.getPointY(),</BUG> axisX.getStopX(), value.getPointY() , paint); <BUG>} }</BUG> }
paint.setStrokeWidth(LeafUtil.dp2px(mContext, axisX.getAxisLineWidth())); List<AxisValue> valuesY = axisY.getValues(); int sizeY = valuesY.size(); for (int i = 1; i < sizeY; i++) { AxisValue value = valuesY.get(i); canvas.drawLine(axisY.getStartX() + LeafUtil.dp2px(mContext, axisX.getAxisWidth()), value.getPointY(), axisX.getStopX(), value.getPointY() , paint);
193,404
point.setRectF(rectF); float labelRadius = LeafUtil.dp2px(mContext,line.getLabelRadius()); labelPaint.setColor(line.getLabelColor()); canvas.drawRoundRect(rectF, labelRadius, labelRadius, labelPaint); labelPaint.setColor(Color.WHITE); <BUG>float xCoordinate = point.getOriginX() - textW / 2; float yCoordinate = bottom - (bottom - top - textH) / 2 ;</BUG> canvas.drawText(point.getLabel(), xCoordinate, yCoordinate, labelPaint); } }
point.setRectF(rectF); float labelRadius = LeafUtil.dp2px(mContext,line.getLabelRadius()); labelPaint.setColor(line.getLabelColor()); canvas.drawRoundRect(rectF, labelRadius, labelRadius, labelPaint); labelPaint.setColor(Color.WHITE); float xCoordinate = left + (right - left - textW) / 2; float yCoordinate = bottom - (bottom - top - textH) / 2 ; canvas.drawText(point.getLabel(), xCoordinate, yCoordinate, labelPaint);
193,405
import org.exist.storage.txn.Txn; import org.exist.util.Configuration; import org.exist.util.DatabaseConfigurationException; import org.exist.util.FileUtils; import org.exist.xmldb.XmldbURI; <BUG>import static org.junit.Assert.assertNotNull; import static org.junit.Assert.fail;</BUG> import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path;
import org.exist.storage.txn.Txn; import org.exist.util.Configuration; import org.exist.util.DatabaseConfigurationException; import org.exist.util.FileUtils; import org.exist.xmldb.XmldbURI; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path;
193,406
import java.nio.file.Paths; import java.util.List; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; <BUG>import org.exist.TestUtils; import org.exist.util.FileUtils;</BUG> import org.exist.util.MimeTable; import org.exist.util.MimeType; <BUG>import org.exist.xmldb.DatabaseInstanceManager;</BUG> import org.exist.xmldb.IndexQueryService; import org.exist.xmldb.XQueryService; <BUG>import org.exist.xmldb.XmldbURI;</BUG> import org.junit.AfterClass;
import java.nio.file.Paths; import java.util.List; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; import org.exist.TestUtils; import org.exist.test.ExistXmldbEmbeddedServer; import org.exist.util.FileUtils; import org.exist.util.MimeTable; import org.exist.util.MimeType;
193,407
import org.exist.xmldb.XQueryService; <BUG>import org.exist.xmldb.XmldbURI;</BUG> import org.junit.AfterClass; <BUG>import org.junit.BeforeClass; import org.junit.Test; import org.xmldb.api.DatabaseManager;</BUG> import org.xmldb.api.base.Collection; <BUG>import org.xmldb.api.base.Database;</BUG> import org.xmldb.api.base.Resource; import org.xmldb.api.base.ResourceSet; import org.xmldb.api.base.XMLDBException; <BUG>import org.xmldb.api.modules.CollectionManagementService;</BUG> import org.xmldb.api.modules.XMLResource;
import org.exist.xmldb.XQueryService; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.ClassRule; import org.junit.Test; import org.xmldb.api.base.Collection; import org.xmldb.api.base.Resource; import org.xmldb.api.base.ResourceSet; import org.xmldb.api.base.XMLDBException; import org.xmldb.api.modules.XMLResource;
193,408
import org.xmldb.api.base.ResourceSet; import org.xmldb.api.base.XMLDBException; <BUG>import org.xmldb.api.modules.CollectionManagementService;</BUG> import org.xmldb.api.modules.XMLResource; import org.xmldb.api.modules.XUpdateQueryService; <BUG>public class ConcurrencyTest { private static Collection test; private static String COLLECTION_CONFIG1 = </BUG> "<collection xmlns=\"http://exist-db.org/collection-config/1.0\">" +
import org.xmldb.api.base.ResourceSet; import org.xmldb.api.base.XMLDBException; import org.xmldb.api.modules.XMLResource; import org.xmldb.api.modules.XUpdateQueryService; public class ConcurrencyTest { @ClassRule public static final ExistXmldbEmbeddedServer existEmbeddedServer = new ExistXmldbEmbeddedServer(); private static Collection test; private static final String COLLECTION_CONFIG1 = "<collection xmlns=\"http://exist-db.org/collection-config/1.0\">" +
193,409
" </lucene>" + " </index>" + "</collection>"; @Test public void store() { <BUG>ExecutorService executor = Executors.newFixedThreadPool(10); </BUG> for (int i = 0; i < 10; i++) { final String name = "thread" + i; final Runnable run = () -> {
" </lucene>" + " </index>" + "</collection>"; @Test public void store() { final ExecutorService executor = Executors.newFixedThreadPool(10); for (int i = 0; i < 10; i++) { final String name = "thread" + i; final Runnable run = () -> {
193,410
} executor.shutdown(); boolean terminated = false; try { terminated = executor.awaitTermination(60 * 60, TimeUnit.SECONDS); <BUG>} catch (InterruptedException e) { </BUG> } assertTrue(terminated); }
} }; executor.submit(run); } executor.shutdown(); boolean terminated = false; try { terminated = executor.awaitTermination(60 * 60, TimeUnit.SECONDS); } catch (final InterruptedException e) { } assertTrue(terminated); }
193,411
for (int i = 0; i < 5; i++) { final String name = "thread" + i; Runnable run = () -> { try { xupdateDocs(name); <BUG>} catch (XMLDBException | IOException e) { </BUG> e.printStackTrace(); fail(e.getMessage()); }
for (int i = 0; i < 5; i++) { final String name = "thread" + i; Runnable run = () -> { try { xupdateDocs(name); } catch (final XMLDBException | IOException e) { e.printStackTrace(); fail(e.getMessage()); }
193,412
<BUG>package org.gedcomx.conversion; import org.gedcomx.conclusion.Person;</BUG> import org.gedcomx.conclusion.Relationship; <BUG>import org.gedcomx.contributor.Agent;</BUG> import org.gedcomx.source.SourceDescription; import java.io.IOException; <BUG>import java.util.Date; public interface GedcomxConversionResult { void addPerson(Person person, Date lastModified) throws IOException; void addRelationship(Relationship relationship, Date lastModified) throws IOException; void addSourceDescription(SourceDescription description, Date lastModified) throws IOException; public void setDatasetContributor(Agent person, Date lastModified) throws IOException; void addOrganization(Agent organization, Date lastModified) throws IOException; }</BUG>
package org.gedcomx.conversion; import org.gedcomx.Gedcomx; import org.gedcomx.agent.Agent; import org.gedcomx.conclusion.Person; import org.gedcomx.conclusion.Relationship; import org.gedcomx.source.SourceDescription;
193,413
import org.gedcomx.common.ResourceReference; import org.gedcomx.common.URI;</BUG> import org.gedcomx.conclusion.Relationship; import org.gedcomx.conversion.GedcomxConversionResult; <BUG>import org.gedcomx.contributor.Address; import org.gedcomx.contributor.Agent;</BUG> import org.gedcomx.source.CitationField; import org.gedcomx.source.SourceDescription; import org.gedcomx.source.SourceReference; import org.gedcomx.types.ConfidenceLevel;
import org.gedcomx.common.ResourceReference; import org.gedcomx.common.TextValue; import org.gedcomx.common.URI; import org.gedcomx.conclusion.Relationship; import org.gedcomx.conversion.GedcomxConversionResult; import org.gedcomx.source.CitationField; import org.gedcomx.source.SourceDescription; import org.gedcomx.source.SourceReference; import org.gedcomx.types.ConfidenceLevel;
193,414
try { boolean sourceDescriptionHasData = false; boolean sourceReferenceHasData = false; SourceDescription gedxSourceDescription = new SourceDescription(); org.gedcomx.source.SourceCitation citation = new org.gedcomx.source.SourceCitation(); <BUG>citation.setCitationTemplate(new ResourceReference(URI.create("http://gedcomx.org/gedcom5-conversion-v1-SOUR-mapping"))); </BUG> citation.setFields(new ArrayList<CitationField>()); citation.setValue(""); if (dqSource.getRef() != null) {
try { boolean sourceDescriptionHasData = false; boolean sourceReferenceHasData = false; SourceDescription gedxSourceDescription = new SourceDescription(); org.gedcomx.source.SourceCitation citation = new org.gedcomx.source.SourceCitation(); citation.setCitationTemplate(new ResourceReference(URI.create("gedcom5:citation-template"))); citation.setFields(new ArrayList<CitationField>()); citation.setValue(""); if (dqSource.getRef() != null) {
193,415
citation.setFields(new ArrayList<CitationField>()); citation.setValue(""); if (dqSource.getRef() != null) { gedxSourceDescription.setId(dqSource.getRef() + "-" + Long.toHexString(SequentialIdentifierGenerator.getNextId())); SourceReference componentOf = new SourceReference(); <BUG>componentOf.setSourceDescriptionURI(URI.create(CommonMapper.getDescriptionEntryName(dqSource.getRef()))); </BUG> gedxSourceDescription.setComponentOf(componentOf); sourceDescriptionHasData = true; if (dqSource.getDate() != null) {
citation.setFields(new ArrayList<CitationField>()); citation.setValue(""); if (dqSource.getRef() != null) { gedxSourceDescription.setId(dqSource.getRef() + "-" + Long.toHexString(SequentialIdentifierGenerator.getNextId())); SourceReference componentOf = new SourceReference(); componentOf.setDescriptionRef(URI.create(CommonMapper.getSourceDescriptionReference(dqSource.getRef()))); gedxSourceDescription.setComponentOf(componentOf); sourceDescriptionHasData = true; if (dqSource.getDate() != null) {
193,416
citation.getFields().add(field); citation.setValue(citation.getValue() + (citation.getValue().length() > 0 ? ", " + dqSource.getDate() : dqSource.getDate())); } if (dqSource.getPage() != null) { CitationField field = new CitationField(); <BUG>field.setName(URI.create("http://gedcomx.org/gedcom5-conversion-v1-SOUR-mapping/page")); field.setValue(dqSource.getPage());</BUG> citation.getFields().add(field); citation.setValue(citation.getValue() + (citation.getValue().length() > 0 ? ", " + dqSource.getPage() : dqSource.getPage())); }
citation.getFields().add(field); citation.setValue(citation.getValue() + (citation.getValue().length() > 0 ? ", " + dqSource.getDate() : dqSource.getDate())); } if (dqSource.getPage() != null) { CitationField field = new CitationField(); field.setName(URI.create("gedcom5:citation-template/page")); field.setValue(dqSource.getPage()); citation.getFields().add(field); citation.setValue(citation.getValue() + (citation.getValue().length() > 0 ? ", " + dqSource.getPage() : dqSource.getPage())); }
193,417
gedxSourceDescription.setId("SOUR-" + Long.toHexString(SequentialIdentifierGenerator.getNextId())); citation.setValue(dqSource.getValue()); citation.setCitationTemplate(null); sourceDescriptionHasData = true; } <BUG>String entryName = CommonMapper.getDescriptionEntryName(gedxSourceDescription.getId()); </BUG> SourceReference gedxSourceReference = new SourceReference(); <BUG>gedxSourceReference.setSourceDescriptionURI(URI.create(entryName)); </BUG> if (dqSource.getText() != null) {
gedxSourceDescription.setId("SOUR-" + Long.toHexString(SequentialIdentifierGenerator.getNextId())); citation.setValue(dqSource.getValue()); citation.setCitationTemplate(null); sourceDescriptionHasData = true; } String entryName = CommonMapper.getSourceDescriptionReference(gedxSourceDescription.getId()); SourceReference gedxSourceReference = new SourceReference(); gedxSourceReference.setDescriptionRef(URI.create(entryName)); if (dqSource.getText() != null) {
193,418
if (dqSource.getText() != null) { logger.warn(ConversionContext.getContext(), "GEDCOM X does not currently support text extracted from a source."); } ConfidenceLevel gedxConfidenceLevel = toConfidenceLevel(dqSource.getQuality()); if (gedxConfidenceLevel != null) { <BUG>Attribution attribution = new Attribution(); attribution.setKnownConfidenceLevel(gedxConfidenceLevel); gedxSourceReference.setAttribution(attribution);</BUG> sourceReferenceHasData = true; }
if (dqSource.getText() != null) { logger.warn(ConversionContext.getContext(), "GEDCOM X does not currently support text extracted from a source."); } ConfidenceLevel gedxConfidenceLevel = toConfidenceLevel(dqSource.getQuality()); if (gedxConfidenceLevel != null) { sourceReferenceHasData = true; }
193,419
int cntMedia = dqSource.getMedia().size() + dqSource.getMediaRefs().size(); if (cntMedia > 0) { logger.warn(ConversionContext.getContext(), "Did not process {} media items or references to media items.", cntMedia); } if (sourceDescriptionHasData) { <BUG>gedxSourceDescription.setCitation(citation); result.addSourceDescription(gedxSourceDescription, null); sourceReferenceHasData = true;</BUG> }
int cntMedia = dqSource.getMedia().size() + dqSource.getMediaRefs().size(); if (cntMedia > 0) { logger.warn(ConversionContext.getContext(), "Did not process {} media items or references to media items.", cntMedia); } if (sourceDescriptionHasData) { gedxSourceDescription.setCitations(Arrays.asList(citation)); result.addSourceDescription(gedxSourceDescription); sourceReferenceHasData = true; }
193,420
return extractedDate; } public static ConfidenceLevel toConfidenceLevel(String dqQuality) { ConfidenceLevel confidenceLevel; if ("3".equals(dqQuality)) { <BUG>confidenceLevel = ConfidenceLevel.Certainly; </BUG> } else if ("2".equals(dqQuality)) { <BUG>confidenceLevel = ConfidenceLevel.Possibly; </BUG> } else if ("1".equals(dqQuality)) {
return extractedDate; } public static ConfidenceLevel toConfidenceLevel(String dqQuality) { ConfidenceLevel confidenceLevel; if ("3".equals(dqQuality)) { confidenceLevel = ConfidenceLevel.High; } else if ("2".equals(dqQuality)) { confidenceLevel = ConfidenceLevel.Medium;
193,421
} else if ("2".equals(dqQuality)) { <BUG>confidenceLevel = ConfidenceLevel.Possibly; </BUG> } else if ("1".equals(dqQuality)) { <BUG>confidenceLevel = ConfidenceLevel.Apparently; </BUG> } else if ("0".equals(dqQuality)) { <BUG>confidenceLevel = ConfidenceLevel.Perhaps; </BUG> } else {
} else if ("2".equals(dqQuality)) { confidenceLevel = ConfidenceLevel.Medium; } else if ("1".equals(dqQuality)) { confidenceLevel = ConfidenceLevel.Low; } else if ("0".equals(dqQuality)) { confidenceLevel = ConfidenceLevel.Low; } else {
193,422
relationship.setPerson2(toReference(personId2)); return relationship; } public static ResourceReference toReference(String gedxPersonId) { ResourceReference reference = new ResourceReference(); <BUG>reference.setResource( new URI(getPersonEntryName(gedxPersonId))); </BUG> return reference; } public static boolean inCanonicalGlobalFormat(String telephoneNumber) {
relationship.setPerson2(toReference(personId2)); return relationship; } public static ResourceReference toReference(String gedxPersonId) { ResourceReference reference = new ResourceReference(); reference.setResource( new URI(getPersonReference(gedxPersonId))); return reference; } public static boolean inCanonicalGlobalFormat(String telephoneNumber) {
193,423
final Pattern pattern = Pattern.compile("^\\+[\\d \\.\\(\\)\\-/]+"); return pattern.matcher(telephoneNumber).matches(); } public static void populateAgent(Agent agent, String id, String name, org.folg.gedcom.model.Address address, String phone, String fax, String email, String www) { agent.setId(id); <BUG>agent.setName(name); if(address != null) {</BUG> agent.setAddresses(new ArrayList<Address>()); Address gedxAddress = new Address(); gedxAddress.setValue(address.getValue());
final Pattern pattern = Pattern.compile("^\\+[\\d \\.\\(\\)\\-/]+"); return pattern.matcher(telephoneNumber).matches(); } public static void populateAgent(Agent agent, String id, String name, org.folg.gedcom.model.Address address, String phone, String fax, String email, String www) { agent.setId(id); agent.setNames(Arrays.asList(new TextValue(name))); if(address != null) { agent.setAddresses(new ArrayList<Address>()); Address gedxAddress = new Address(); gedxAddress.setValue(address.getValue());
193,424
TodoItemRepository repository = new TodoItemRepository(BEAN_FACTORY); ApplicationElement application = new ApplicationElement(repository, i18n); Element body = Browser.getDocument().getBody(); body.appendChild(application.asElement()); body.appendChild(new FooterElement(i18n).asElement()); <BUG>Element e = new MyBuilder().ahref( "http://www.google.com" ) .img( "https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png" ).end() .end().build(); body.appendChild( e );</BUG> History.addValueChangeHandler(event -> application.filter(event.getValue()));
TodoItemRepository repository = new TodoItemRepository(BEAN_FACTORY); ApplicationElement application = new ApplicationElement(repository, i18n); Element body = Browser.getDocument().getBody(); body.appendChild(application.asElement()); body.appendChild(new FooterElement(i18n).asElement()); History.addValueChangeHandler(event -> application.filter(event.getValue()));
193,425
private final I18n i18n; private Filter filter; ApplicationElement(TodoItemRepository repository, I18n i18n) { this.repository = repository; this.i18n = i18n; <BUG>Elements.Builder builder = new Elements.Builder() .section().css("todoapp")</BUG> .header().css("header") .h(1).innerText(i18n.constants().todos()).end() .input(text)
private final I18n i18n; private Filter filter; ApplicationElement(TodoItemRepository repository, I18n i18n) { this.repository = repository; this.i18n = i18n; TodoBuilder builder = new TodoBuilder() .section().css("todoapp") .header().css("header") .h(1).innerText(i18n.constants().todos()).end() .input(text)
193,426
@Override public String toString() { return (container ? "container" : "simple") + " @ " + level + ": " + element.getTagName(); } } <BUG>public static class Builder extends CoreBuilder<Builder> { public Builder() { super(Browser.getDocument()); } protected Builder(Document document) { super( document );</BUG> }
@Override public String toString() { return (container ? "container" : "simple") + " @ " + level + ": " + element.getTagName();
193,427
return start(document.createElement(tag)); } public B start(Element element) { elements.push(new ElementInfo(element, true, level)); level++; <BUG>return (B) this; }</BUG> public B end() { assertCurrent(); if (level == 0) {
return start(document.createElement(tag)); } public B start(Element element) { elements.push(new ElementInfo(element, true, level)); level++; return that(); } public B end() { assertCurrent(); if (level == 0) {
193,428
Element closingElement = elements.peek().element; for (ElementInfo child : children) { closingElement.appendChild(child.element); } level--; <BUG>return (B) this; }</BUG> private String dumpElements() { return elements.toString(); }
Element closingElement = elements.peek().element; for (ElementInfo child : children) { closingElement.appendChild(child.element); } level--; return that(); } private String dumpElements() { return elements.toString(); }
193,429
} public B on(EventType type, EventListener listener) { assertCurrent(); Element element = elements.peek().element; type.register(element, listener); <BUG>return (B) this; }</BUG> public B rememberAs(String id) { assertCurrent(); references.put(id, elements.peek().element);
} public B attr(String name, String value) { assertCurrent(); elements.peek().element.setAttribute(name, value); return that(); }
193,430
import static org.junit.Assert.assertNotNull; import static org.mockito.Matchers.anyString; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; public class ElementsBuilderTest { <BUG>private Elements.Builder builder; </BUG> @Before public void setUp() { Document document = mock(Document.class);
import static org.junit.Assert.assertNotNull; import static org.mockito.Matchers.anyString; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; public class ElementsBuilderTest { private TestableBuilder builder; @Before public void setUp() { Document document = mock(Document.class);
193,431
when(document.createParagraphElement()).thenAnswer(invocation -> new StandaloneElement("p")); when(document.createSelectElement()).thenAnswer(invocation -> new StandaloneInputElement("select")); when(document.createSpanElement()).thenAnswer(invocation -> new StandaloneElement("span")); when(document.createTextAreaElement()).thenAnswer(invocation -> new StandaloneInputElement("textarea")); when(document.createUListElement()).thenAnswer(invocation -> new StandaloneElement("ul")); <BUG>builder = new Elements.Builder(document); </BUG> } @Test public void headings() {
when(document.createParagraphElement()).thenAnswer(invocation -> new StandaloneElement("p")); when(document.createSelectElement()).thenAnswer(invocation -> new StandaloneInputElement("select")); when(document.createSpanElement()).thenAnswer(invocation -> new StandaloneElement("span")); when(document.createTextAreaElement()).thenAnswer(invocation -> new StandaloneInputElement("textarea")); when(document.createUListElement()).thenAnswer(invocation -> new StandaloneElement("ul")); builder = new TestableBuilder(document); } @Test public void headings() {
193,432
public static int lavaBowDurability = 1750; <BUG>@ModConfigProperty(category = "Weapons.Bows.Properties", name = "guardianBowDurability", comment = "Set the amount of durability the Guardian Bow have") </BUG> public static int guardianBowDurability = 1800; <BUG>@ModConfigProperty(category = "Weapons.Bows.Properties", name = "superStarBowDurability", comment = "Set the amount of durability the Super Star Bow have") </BUG> public static int superStarBowDurability = 1950; <BUG>@ModConfigProperty(category = "Weapons.Bows.Properties", name = "enderDragonBowDurability", comment = "Set the amount of durability the Ender Dragon Bow have") </BUG> public static int enderDragonBowDurability = 2310;
public static int lavaBowDurability = 1750; @ModConfigProperty(category = "Weapons.Guardian.Bow", name = "guardianBowDurability", comment = "Set the amount of durability the Guardian Bow have") public static int guardianBowDurability = 1800; @ModConfigProperty(category = "Weapons.SuperStar.Bow", name = "superStarBowDurability", comment = "Set the amount of durability the Super Star Bow have") public static int superStarBowDurability = 1950; @ModConfigProperty(category = "Weapons.EnderDragon.Bow", name = "enderDragonBowDurability", comment = "Set the amount of durability the Ender Dragon Bow have") public static int enderDragonBowDurability = 2310;
193,433
public static boolean debugMode = false; @ModConfigProperty(category = "Debug", name = "debugModeGOTG", comment = "Enable/Disable Debug Mode for the Gift Of The Gods") public static boolean debugModeGOTG = false; @ModConfigProperty(category = "Debug", name = "debugModeEnchantments", comment = "Enable/Disable Debug Mode for the Enchantments") public static boolean debugModeEnchantments = false; <BUG>@ModConfigProperty(category = "Weapons", name = "enableSwordsRecipes", comment = "Enable/Disable The ArmorPlus Sword's Recipes") public static boolean enableSwordsRecipes = true; @ModConfigProperty(category = "Weapons", name = "enableBattleAxesRecipes", comment = "Enable/Disable The ArmorPlus Battle Axes's Recipes") public static boolean enableBattleAxesRecipes = true; @ModConfigProperty(category = "Weapons", name = "enableBowsRecipes", comment = "Enable/Disable The ArmorPlus Bows's Recipes") public static boolean enableBowsRecipes = true; @ModConfigProperty(category = "Armors.SuperStarArmor.Effects", name = "enableSuperStarHRegen", comment = "Enable/Disable The Super Star Helmet Regeneration") </BUG> public static boolean enableSuperStarHRegen = true;
public static boolean debugMode = false; @ModConfigProperty(category = "Debug", name = "debugModeGOTG", comment = "Enable/Disable Debug Mode for the Gift Of The Gods") public static boolean debugModeGOTG = false; @ModConfigProperty(category = "Debug", name = "debugModeEnchantments", comment = "Enable/Disable Debug Mode for the Enchantments") public static boolean debugModeEnchantments = false; @ModConfigProperty(category = "Weapons", name = "enableSwordsRecipes", comment = "Enable/Disable ArmorPlus Sword's Recipes") public static boolean enableSwordsRecipes = true; @ModConfigProperty(category = "Weapons", name = "enableBattleAxesRecipes", comment = "Enable/Disable ArmorPlus Battle Axes's Recipes") public static boolean enableBattleAxesRecipes = true; @ModConfigProperty(category = "Weapons", name = "enableBowsRecipes", comment = "Enable/Disable ArmorPlus Bows's Recipes")
193,434
public static boolean enableSlimeArmor = true; <BUG>@ModConfigProperty(category = "Armors.SteelArmor.Registry", name = "enableSteelArmor", comment = "Enable/Disable The Steel Armors From the Game") </BUG> public static boolean enableSteelArmor = true; <BUG>@ModConfigProperty(category = "Armors.ElectricalArmor.Registry", name = "enableElectricalArmor", comment = "Enable/Disable The Electrical Armors From the Game") </BUG> public static boolean enableElectricalArmor = true; <BUG>@ModConfigProperty(category = "FlightAbility", name = "enableFlightAbility", comment = "Enable/Disable The Armors Flight") </BUG> public static boolean enableFlightAbility = true;
public static boolean enableSlimeArmor = true; @ModConfigProperty(category = "Armors.SteelArmor.Registry", name = "enableSteelArmor", comment = "Enable/Disable the Steel Armors from the Game") public static boolean enableSteelArmor = true; @ModConfigProperty(category = "Armors.ElectricalArmor.Registry", name = "enableElectricalArmor", comment = "Enable/Disable the Electrical Armors from the Game") public static boolean enableElectricalArmor = true; @ModConfigProperty(category = "FlightAbility", name = "enableFlightAbility", comment = "Enable/Disable the Armors Flight") public static boolean enableFlightAbility = true;
193,435
package org.glowroot.agent.embedded.init; import java.io.Closeable; import java.io.File; <BUG>import java.lang.instrument.Instrumentation; import java.util.Map;</BUG> import java.util.concurrent.CountDownLatch; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService;
package org.glowroot.agent.embedded.init; import java.io.Closeable; import java.io.File; import java.lang.instrument.Instrumentation; import java.util.List; import java.util.Map; import java.util.concurrent.CountDownLatch; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService;
193,436
import java.util.concurrent.ScheduledExecutorService; import javax.annotation.Nullable; import com.google.common.base.MoreObjects; import com.google.common.base.Stopwatch; import com.google.common.base.Supplier; <BUG>import com.google.common.base.Ticker; import org.checkerframework.checker.nullness.qual.MonotonicNonNull;</BUG> import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.glowroot.agent.collector.Collector.AgentConfigUpdater;
import java.util.concurrent.ScheduledExecutorService; import javax.annotation.Nullable; import com.google.common.base.MoreObjects; import com.google.common.base.Stopwatch; import com.google.common.base.Supplier; import com.google.common.base.Ticker; import com.google.common.collect.ImmutableList; import org.checkerframework.checker.nullness.qual.MonotonicNonNull; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.glowroot.agent.collector.Collector.AgentConfigUpdater;
193,437
import org.glowroot.agent.init.EnvironmentCreator; import org.glowroot.agent.init.GlowrootThinAgentInit; import org.glowroot.agent.init.JRebelWorkaround; import org.glowroot.agent.util.LazyPlatformMBeanServer; import org.glowroot.common.live.LiveAggregateRepository.LiveAggregateRepositoryNop; <BUG>import org.glowroot.common.live.LiveTraceRepository.LiveTraceRepositoryNop; import org.glowroot.common.repo.ConfigRepository; import org.glowroot.common.util.Clock;</BUG> import org.glowroot.common.util.OnlyUsedByTests; import org.glowroot.ui.CreateUiModuleBuilder;
import org.glowroot.agent.init.EnvironmentCreator; import org.glowroot.agent.init.GlowrootThinAgentInit; import org.glowroot.agent.init.JRebelWorkaround; import org.glowroot.agent.util.LazyPlatformMBeanServer; import org.glowroot.common.live.LiveAggregateRepository.LiveAggregateRepositoryNop; import org.glowroot.common.live.LiveTraceRepository.LiveTraceRepositoryNop; import org.glowroot.common.repo.AgentRepository; import org.glowroot.common.repo.ConfigRepository; import org.glowroot.common.repo.ImmutableAgentRollup; import org.glowroot.common.util.Clock; import org.glowroot.common.util.OnlyUsedByTests; import org.glowroot.ui.CreateUiModuleBuilder;
193,438
SimpleRepoModule simpleRepoModule = new SimpleRepoModule(dataSource, dataDir, clock, ticker, configRepository, backgroundExecutor); simpleRepoModule.registerMBeans(new PlatformMBeanServerLifecycleImpl( agentModule.getLazyPlatformMBeanServer())); CollectorImpl collectorImpl = new CollectorImpl( <BUG>simpleRepoModule.getAgentDao(), simpleRepoModule.getAggregateDao(), simpleRepoModule.getTraceDao(),</BUG> simpleRepoModule.getGaugeValueDao()); collectorProxy.setInstance(collectorImpl); collectorImpl.init(baseDir, EnvironmentCreator.create(glowrootVersion),
SimpleRepoModule simpleRepoModule = new SimpleRepoModule(dataSource, dataDir, clock, ticker, configRepository, backgroundExecutor); simpleRepoModule.registerMBeans(new PlatformMBeanServerLifecycleImpl( agentModule.getLazyPlatformMBeanServer())); CollectorImpl collectorImpl = new CollectorImpl( simpleRepoModule.getEnvironmentDao(), simpleRepoModule.getAggregateDao(), simpleRepoModule.getTraceDao(), simpleRepoModule.getGaugeValueDao()); collectorProxy.setInstance(collectorImpl); collectorImpl.init(baseDir, EnvironmentCreator.create(glowrootVersion),
193,439
.baseDir(baseDir) .glowrootDir(glowrootDir) .ticker(ticker) .clock(clock) .liveJvmService(agentModule.getLiveJvmService()) <BUG>.configRepository(simpleRepoModule.getConfigRepository()) .agentRepository(simpleRepoModule.getAgentDao()) </BUG> .transactionTypeRepository(simpleRepoModule.getTransactionTypeRepository()) .traceAttributeNameRepository(
.baseDir(baseDir) .glowrootDir(glowrootDir) .ticker(ticker) .clock(clock) .liveJvmService(agentModule.getLiveJvmService()) .configRepository(simpleRepoModule.getConfigRepository()) .agentRepository(new AgentRepositoryImpl()) .environmentRepository(simpleRepoModule.getEnvironmentDao()) .transactionTypeRepository(simpleRepoModule.getTransactionTypeRepository()) .traceAttributeNameRepository(
193,440
.baseDir(baseDir) .glowrootDir(glowrootDir) .ticker(ticker) .clock(clock) .liveJvmService(null) <BUG>.configRepository(simpleRepoModule.getConfigRepository()) .agentRepository(simpleRepoModule.getAgentDao()) </BUG> .transactionTypeRepository(simpleRepoModule.getTransactionTypeRepository()) .traceAttributeNameRepository(
.baseDir(baseDir) .glowrootDir(glowrootDir) .ticker(ticker) .clock(clock) .liveJvmService(agentModule.getLiveJvmService()) .configRepository(simpleRepoModule.getConfigRepository()) .agentRepository(new AgentRepositoryImpl()) .environmentRepository(simpleRepoModule.getEnvironmentDao()) .transactionTypeRepository(simpleRepoModule.getTransactionTypeRepository()) .traceAttributeNameRepository(
193,441
} @Override public void lazyRegisterMBean(Object object, String name) { lazyPlatformMBeanServer.lazyRegisterMBean(object, name); } <BUG>} } </BUG>
} void initEmbeddedServer() throws Exception { if (simpleRepoModule == null) { return; }
193,442
package org.glowroot.agent.config; import com.google.common.collect.ImmutableList; <BUG>import org.immutables.value.Value; import org.glowroot.wire.api.model.AgentConfigOuterClass.AgentConfig;</BUG> @Value.Immutable public abstract class UiConfig { @Value.Default
package org.glowroot.agent.config; import com.google.common.collect.ImmutableList; import org.immutables.value.Value; import org.glowroot.common.config.ConfigDefaults; import org.glowroot.wire.api.model.AgentConfigOuterClass.AgentConfig; @Value.Immutable public abstract class UiConfig { @Value.Default
193,443
class RepoAdminImpl implements RepoAdmin { private final DataSource dataSource; private final List<CappedDatabase> rollupCappedDatabases; private final CappedDatabase traceCappedDatabase; private final ConfigRepository configRepository; <BUG>private final AgentDao agentDao; </BUG> private final GaugeValueDao gaugeValueDao; private final GaugeNameDao gaugeNameDao; private final TransactionTypeDao transactionTypeDao;
class RepoAdminImpl implements RepoAdmin { private final DataSource dataSource; private final List<CappedDatabase> rollupCappedDatabases; private final CappedDatabase traceCappedDatabase; private final ConfigRepository configRepository; private final EnvironmentDao agentDao; private final GaugeValueDao gaugeValueDao; private final GaugeNameDao gaugeNameDao; private final TransactionTypeDao transactionTypeDao;
193,444
private final TransactionTypeDao transactionTypeDao; private final FullQueryTextDao fullQueryTextDao; private final TraceAttributeNameDao traceAttributeNameDao; RepoAdminImpl(DataSource dataSource, List<CappedDatabase> rollupCappedDatabases, CappedDatabase traceCappedDatabase, ConfigRepository configRepository, <BUG>AgentDao agentDao, GaugeValueDao gaugeValueDao, GaugeNameDao gaugeNameDao, </BUG> TransactionTypeDao transactionTypeDao, FullQueryTextDao fullQueryTextDao, TraceAttributeNameDao traceAttributeNameDao) { this.dataSource = dataSource;
private final TransactionTypeDao transactionTypeDao; private final FullQueryTextDao fullQueryTextDao; private final TraceAttributeNameDao traceAttributeNameDao; RepoAdminImpl(DataSource dataSource, List<CappedDatabase> rollupCappedDatabases, CappedDatabase traceCappedDatabase, ConfigRepository configRepository, EnvironmentDao agentDao, GaugeValueDao gaugeValueDao, GaugeNameDao gaugeNameDao, TransactionTypeDao transactionTypeDao, FullQueryTextDao fullQueryTextDao, TraceAttributeNameDao traceAttributeNameDao) { this.dataSource = dataSource;
193,445
this.fullQueryTextDao = fullQueryTextDao; this.traceAttributeNameDao = traceAttributeNameDao; } @Override public void deleteAllData() throws Exception { <BUG>Environment environment = agentDao.readEnvironment(""); dataSource.deleteAll();</BUG> agentDao.reinitAfterDeletingDatabase(); gaugeValueDao.reinitAfterDeletingDatabase(); gaugeNameDao.invalidateCache();
this.fullQueryTextDao = fullQueryTextDao; this.traceAttributeNameDao = traceAttributeNameDao; } @Override public void deleteAllData() throws Exception { Environment environment = agentDao.read(""); dataSource.deleteAll(); agentDao.reinitAfterDeletingDatabase(); gaugeValueDao.reinitAfterDeletingDatabase(); gaugeNameDao.invalidateCache();
193,446
List<GaugeConfig> configs = Lists.newArrayList(configService.getGaugeConfigs()); for (GaugeConfig loopConfig : configs) { if (loopConfig.mbeanObjectName().equals(gaugeConfig.getMbeanObjectName())) { throw new DuplicateMBeanObjectNameException(); } <BUG>} String version = Versions.getVersion(gaugeConfig); for (GaugeConfig loopConfig : configs) { if (Versions.getVersion(loopConfig.toProto()).equals(version)) { throw new IllegalStateException("This exact gauge already exists"); } } configs.add(GaugeConfig.create(gaugeConfig));</BUG> configService.updateGaugeConfigs(configs);
List<GaugeConfig> configs = Lists.newArrayList(configService.getGaugeConfigs()); for (GaugeConfig loopConfig : configs) { if (loopConfig.mbeanObjectName().equals(gaugeConfig.getMbeanObjectName())) { throw new DuplicateMBeanObjectNameException();
193,447
configService.updateGaugeConfigs(configs); } } @Override public void updateGaugeConfig(String agentId, AgentConfig.GaugeConfig gaugeConfig, <BUG>String priorVersion) throws Exception { synchronized (writeLock) {</BUG> List<GaugeConfig> configs = Lists.newArrayList(configService.getGaugeConfigs()); boolean found = false; for (ListIterator<GaugeConfig> i = configs.listIterator(); i.hasNext();) {
configService.updateGaugeConfigs(configs); } } @Override public void updateGaugeConfig(String agentId, AgentConfig.GaugeConfig gaugeConfig, String priorVersion) throws Exception { GaugeConfig config = GaugeConfig.create(gaugeConfig); synchronized (writeLock) { List<GaugeConfig> configs = Lists.newArrayList(configService.getGaugeConfigs()); boolean found = false; for (ListIterator<GaugeConfig> i = configs.listIterator(); i.hasNext();) {
193,448
boolean found = false; for (ListIterator<GaugeConfig> i = configs.listIterator(); i.hasNext();) { GaugeConfig loopConfig = i.next(); String loopVersion = Versions.getVersion(loopConfig.toProto()); if (loopVersion.equals(priorVersion)) { <BUG>i.set(GaugeConfig.create(gaugeConfig)); found = true; break;</BUG> } else if (loopConfig.mbeanObjectName().equals(gaugeConfig.getMbeanObjectName())) { throw new DuplicateMBeanObjectNameException();
boolean found = false; for (ListIterator<GaugeConfig> i = configs.listIterator(); i.hasNext();) { GaugeConfig loopConfig = i.next(); String loopVersion = Versions.getVersion(loopConfig.toProto()); if (loopVersion.equals(priorVersion)) { i.set(config); found = true; } else if (loopConfig.mbeanObjectName().equals(gaugeConfig.getMbeanObjectName())) { throw new DuplicateMBeanObjectNameException();
193,449
boolean found = false; for (ListIterator<PluginConfig> i = configs.listIterator(); i.hasNext();) { PluginConfig loopPluginConfig = i.next(); if (pluginId.equals(loopPluginConfig.id())) { String loopVersion = Versions.getVersion(loopPluginConfig.toProto()); <BUG>checkVersionsEqual(loopVersion, priorVersion); PluginDescriptor pluginDescriptor = getPluginDescriptor(pluginId); i.set(PluginConfig.create(pluginDescriptor, properties));</BUG> found = true; break;
boolean found = false; for (ListIterator<GaugeConfig> i = configs.listIterator(); i.hasNext();) { GaugeConfig loopConfig = i.next(); String loopVersion = Versions.getVersion(loopConfig.toProto()); if (loopVersion.equals(version)) { i.remove(); found = true; break;
193,450
boolean found = false; for (ListIterator<InstrumentationConfig> i = configs.listIterator(); i.hasNext();) { InstrumentationConfig loopConfig = i.next(); String loopVersion = Versions.getVersion(loopConfig.toProto()); if (loopVersion.equals(priorVersion)) { <BUG>i.set(InstrumentationConfig.create(instrumentationConfig)); found = true; break; }</BUG> }
boolean found = false; for (ListIterator<InstrumentationConfig> i = configs.listIterator(); i.hasNext();) { InstrumentationConfig loopConfig = i.next(); String loopVersion = Versions.getVersion(loopConfig.toProto()); if (loopVersion.equals(priorVersion)) { i.set(config); found = true; } else if (loopConfig.equals(config)) { throw new IllegalStateException("This exact instrumentation already exists"); } }
193,451
package org.glowroot.agent.embedded.init; import java.io.File; import java.util.List; import org.glowroot.agent.collector.Collector; <BUG>import org.glowroot.agent.embedded.repo.AgentDao; import org.glowroot.agent.embedded.repo.AggregateDao; import org.glowroot.agent.embedded.repo.GaugeValueDao;</BUG> import org.glowroot.agent.embedded.repo.TraceDao; import org.glowroot.wire.api.model.AgentConfigOuterClass.AgentConfig;
package org.glowroot.agent.embedded.init; import java.io.File; import java.util.List; import org.glowroot.agent.collector.Collector; import org.glowroot.agent.embedded.repo.AggregateDao; import org.glowroot.agent.embedded.repo.EnvironmentDao; import org.glowroot.agent.embedded.repo.GaugeValueDao; import org.glowroot.agent.embedded.repo.TraceDao; import org.glowroot.wire.api.model.AgentConfigOuterClass.AgentConfig;
193,452
</BUG> private final AggregateDao aggregateDao; private final TraceDao traceDao; private final GaugeValueDao gaugeValueDao; <BUG>CollectorImpl(AgentDao agentDao, AggregateDao aggregateRepository, TraceDao traceRepository, GaugeValueDao gaugeValueRepository) { this.agentDao = agentDao;</BUG> this.aggregateDao = aggregateRepository; this.traceDao = traceRepository;
import org.glowroot.wire.api.model.CollectorServiceOuterClass.Environment; import org.glowroot.wire.api.model.CollectorServiceOuterClass.GaugeValue; import org.glowroot.wire.api.model.CollectorServiceOuterClass.LogEvent; import org.glowroot.wire.api.model.TraceOuterClass.Trace; class CollectorImpl implements Collector { private final EnvironmentDao agentDao; private final AggregateDao aggregateDao; private final TraceDao traceDao; private final GaugeValueDao gaugeValueDao; CollectorImpl(EnvironmentDao agentDao, AggregateDao aggregateRepository, TraceDao traceRepository, GaugeValueDao gaugeValueRepository) { this.agentDao = agentDao; this.aggregateDao = aggregateRepository; this.traceDao = traceRepository;
193,453
public class SimpleRepoModule { private static final long SNAPSHOT_REAPER_PERIOD_MINUTES = 5; private final DataSource dataSource; private final ImmutableList<CappedDatabase> rollupCappedDatabases; private final CappedDatabase traceCappedDatabase; <BUG>private final AgentDao agentDao; private final TransactionTypeDao transactionTypeDao;</BUG> private final AggregateDao aggregateDao; private final TraceAttributeNameDao traceAttributeNameDao; private final TraceDao traceDao;
public class SimpleRepoModule { private static final long SNAPSHOT_REAPER_PERIOD_MINUTES = 5; private final DataSource dataSource; private final ImmutableList<CappedDatabase> rollupCappedDatabases; private final CappedDatabase traceCappedDatabase; private final EnvironmentDao environmentDao; private final TransactionTypeDao transactionTypeDao; private final AggregateDao aggregateDao; private final TraceAttributeNameDao traceAttributeNameDao; private final TraceDao traceDao;
193,454
rollupCappedDatabases.add(new CappedDatabase(file, sizeKb, ticker)); } this.rollupCappedDatabases = ImmutableList.copyOf(rollupCappedDatabases); traceCappedDatabase = new CappedDatabase(new File(dataDir, "trace-detail.capped.db"), storageConfig.traceCappedDatabaseSizeMb() * 1024, ticker); <BUG>agentDao = new AgentDao(dataSource); </BUG> transactionTypeDao = new TransactionTypeDao(dataSource); rollupLevelService = new RollupLevelService(configRepository, clock); FullQueryTextDao fullQueryTextDao = new FullQueryTextDao(dataSource);
rollupCappedDatabases.add(new CappedDatabase(file, sizeKb, ticker)); } this.rollupCappedDatabases = ImmutableList.copyOf(rollupCappedDatabases); traceCappedDatabase = new CappedDatabase(new File(dataDir, "trace-detail.capped.db"), storageConfig.traceCappedDatabaseSizeMb() * 1024, ticker); environmentDao = new EnvironmentDao(dataSource); transactionTypeDao = new TransactionTypeDao(dataSource); rollupLevelService = new RollupLevelService(configRepository, clock); FullQueryTextDao fullQueryTextDao = new FullQueryTextDao(dataSource);
193,455
traceDao = new TraceDao(dataSource, traceCappedDatabase, transactionTypeDao, fullQueryTextDao, traceAttributeNameDao); GaugeNameDao gaugeNameDao = new GaugeNameDao(dataSource); gaugeValueDao = new GaugeValueDao(dataSource, gaugeNameDao, clock); repoAdmin = new RepoAdminImpl(dataSource, rollupCappedDatabases, traceCappedDatabase, <BUG>configRepository, agentDao, gaugeValueDao, gaugeNameDao, transactionTypeDao, </BUG> fullQueryTextDao, traceAttributeNameDao); if (backgroundExecutor == null) { reaperRunnable = null;
traceDao = new TraceDao(dataSource, traceCappedDatabase, transactionTypeDao, fullQueryTextDao, traceAttributeNameDao); GaugeNameDao gaugeNameDao = new GaugeNameDao(dataSource); gaugeValueDao = new GaugeValueDao(dataSource, gaugeNameDao, clock); repoAdmin = new RepoAdminImpl(dataSource, rollupCappedDatabases, traceCappedDatabase, configRepository, environmentDao, gaugeValueDao, gaugeNameDao, transactionTypeDao, fullQueryTextDao, traceAttributeNameDao); if (backgroundExecutor == null) { reaperRunnable = null;
193,456
new TraceCappedDatabaseStats(traceCappedDatabase), "org.glowroot:type=TraceCappedDatabase"); platformMBeanServerLifecycle.lazyRegisterMBean(new H2DatabaseStats(dataSource), "org.glowroot:type=H2Database"); } <BUG>public AgentDao getAgentDao() { return agentDao; </BUG> } public TransactionTypeRepository getTransactionTypeRepository() {
new TraceCappedDatabaseStats(traceCappedDatabase), "org.glowroot:type=TraceCappedDatabase"); platformMBeanServerLifecycle.lazyRegisterMBean(new H2DatabaseStats(dataSource), "org.glowroot:type=H2Database"); } public EnvironmentDao getEnvironmentDao() { return environmentDao; } public TransactionTypeRepository getTransactionTypeRepository() {
193,457
} else { updateMemo(); callback.updateMemo(); } dismiss(); <BUG>}else{ </BUG> Toast.makeText(getActivity(), getString(R.string.toast_memo_empty), Toast.LENGTH_SHORT).show(); } }
} else { updateMemo(); callback.updateMemo(); } dismiss(); } else { Toast.makeText(getActivity(), getString(R.string.toast_memo_empty), Toast.LENGTH_SHORT).show(); } }
193,458
} @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_memo); <BUG>ChinaPhoneHelper.setStatusBar(this,true); </BUG> topicId = getIntent().getLongExtra("topicId", -1); if (topicId == -1) { finish();
} } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_memo); ChinaPhoneHelper.setStatusBar(this, true); topicId = getIntent().getLongExtra("topicId", -1); if (topicId == -1) { finish();
193,459
import android.widget.RelativeLayout; import android.widget.TextView; import com.kiminonawa.mydiary.R; import com.kiminonawa.mydiary.db.DBManager; import com.kiminonawa.mydiary.shared.EditMode; <BUG>import com.kiminonawa.mydiary.shared.ThemeManager; import java.util.List; public class MemoAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> implements EditMode { </BUG> private List<MemoEntity> memoList;
import android.widget.RelativeLayout; import android.widget.TextView; import com.kiminonawa.mydiary.R; import com.kiminonawa.mydiary.db.DBManager; import com.kiminonawa.mydiary.shared.EditMode; import com.kiminonawa.mydiary.shared.ThemeManager; import com.marshalchen.ultimaterecyclerview.dragsortadapter.DragSortAdapter; import java.util.List; public class MemoAdapter extends DragSortAdapter<DragSortAdapter.ViewHolder> implements EditMode { private List<MemoEntity> memoList;
193,460
private DBManager dbManager; private boolean isEditMode = false; private EditMemoDialogFragment.MemoCallback callback; private static final int TYPE_HEADER = 0; private static final int TYPE_ITEM = 1; <BUG>public MemoAdapter(FragmentActivity activity, long topicId, List<MemoEntity> memoList, DBManager dbManager, EditMemoDialogFragment.MemoCallback callback) { this.mActivity = activity;</BUG> this.topicId = topicId; this.memoList = memoList;
private DBManager dbManager; private boolean isEditMode = false; private EditMemoDialogFragment.MemoCallback callback; private static final int TYPE_HEADER = 0; private static final int TYPE_ITEM = 1; public MemoAdapter(FragmentActivity activity, long topicId, List<MemoEntity> memoList, DBManager dbManager, EditMemoDialogFragment.MemoCallback callback, RecyclerView recyclerView) { super(recyclerView); this.mActivity = activity; this.topicId = topicId; this.memoList = memoList;
193,461
this.memoList = memoList; this.dbManager = dbManager; this.callback = callback; } @Override <BUG>public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { </BUG> View view; if (isEditMode) { if (viewType == TYPE_HEADER) {
this.memoList = memoList; this.dbManager = dbManager; this.callback = callback; } @Override public DragSortAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { View view; if (isEditMode) { if (viewType == TYPE_HEADER) {
193,462
editMemoDialogFragment.show(mActivity.getSupportFragmentManager(), "editMemoDialogFragment"); } }); } } <BUG>protected class MemoViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener { private View rootView; private TextView TV_memo_item_content;</BUG> private ImageView IV_memo_item_delete;
editMemoDialogFragment.show(mActivity.getSupportFragmentManager(), "editMemoDialogFragment"); } }); } } protected class MemoViewHolder extends DragSortAdapter.ViewHolder implements View.OnClickListener, View.OnLongClickListener { private View rootView; private ImageView IV_memo_item_dot; private TextView TV_memo_item_content; private ImageView IV_memo_item_delete;
193,463
MemoEntry.COLUMN_REF_TOPIC__ID + " = ?" , new String[]{String.valueOf(topicId)}); } public Cursor selectMemo(long topicId) { Cursor c = db.query(MemoEntry.TABLE_NAME, null, MemoEntry.COLUMN_REF_TOPIC__ID + " = ?", new String[]{String.valueOf(topicId)}, null, null, <BUG>MemoEntry._ID + " DESC", null); </BUG> if (c != null) { c.moveToFirst(); }
MemoEntry.COLUMN_REF_TOPIC__ID + " = ?" , new String[]{String.valueOf(topicId)}); } public Cursor selectMemo(long topicId) { Cursor c = db.query(MemoEntry.TABLE_NAME, null, MemoEntry.COLUMN_REF_TOPIC__ID + " = ?", new String[]{String.valueOf(topicId)}, null, null, MemoEntry.COLUMN_ORDER + " ASC", null); if (c != null) { c.moveToFirst(); }
193,464
MemoEntry._ID + " = ?", new String[]{String.valueOf(memoId)}); } public long updateMemoContent(long memoId, String memoContent) { ContentValues values = new ContentValues(); <BUG>values.put(MemoEntry.COLUMN_CONTENT, memoContent); return db.update(</BUG> MemoEntry.TABLE_NAME, values, MemoEntry._ID + " = ?",
MemoEntry._ID + " = ?", new String[]{String.valueOf(memoId)}); } public long updateMemoContent(long memoId, String memoContent) { ContentValues values = new ContentValues(); values.put(MemoEntry.COLUMN_CONTENT, memoContent); return db.update( MemoEntry.TABLE_NAME, values, MemoEntry._ID + " = ?",
193,465
</BUG> import com.jolbox.bonecp.BoneCP; import org.bukkit.plugin.Plugin; public interface IEchoPetPlugin extends Plugin { <BUG>public ISpawnUtil getSpawnUtil(); </BUG> public String getPrefix(); public String getCommandString(); public String getAdminCommandString(); PetRegistry getPetRegistry();
import com.dsh105.commodus.config.YAMLConfig; import com.dsh105.echopet.compat.api.config.ConfigOptions; import com.dsh105.echopet.compat.api.plugin.hook.IVanishProvider; import com.dsh105.echopet.compat.api.plugin.hook.IWorldGuardProvider; import com.dsh105.echopet.compat.api.registration.PetRegistry; import com.dsh105.echopet.compat.api.util.INMS; import com.jolbox.bonecp.BoneCP; import org.bukkit.plugin.Plugin; public interface IEchoPetPlugin extends Plugin { public INMS getSpawnUtil(); public String getPrefix(); public String getCommandString(); public String getAdminCommandString(); PetRegistry getPetRegistry();
193,466
@Override public void onEnable() { EchoPet.setPlugin(this); isUsingNetty = CommonReflection.isUsingNetty(); this.configManager = new YAMLConfigManager(this); <BUG>COMMAND_MANAGER = new CommandManager(this); try { Class.forName(ReflectionUtil.COMPAT_NMS_PATH + ".SpawnUtil"); } catch (ClassNotFoundException e) {</BUG> EchoPet.LOG.log(ChatColor.RED + "SonarPet " + ChatColor.GOLD
@Override public void onEnable() { EchoPet.setPlugin(this); isUsingNetty = CommonReflection.isUsingNetty(); this.configManager = new YAMLConfigManager(this); COMMAND_MANAGER = new CommandManager(this); if (!INMS.isSupported()) { EchoPet.LOG.log(ChatColor.RED + "SonarPet " + ChatColor.GOLD
193,467
import com.dsh105.echopet.compat.api.event.PetTeleportEvent; import com.dsh105.echopet.compat.api.plugin.EchoPet; import com.dsh105.echopet.compat.api.plugin.uuid.UUIDMigration; import com.dsh105.echopet.compat.api.reflection.ReflectionConstants; import com.dsh105.echopet.compat.api.reflection.SafeMethod; <BUG>import com.dsh105.echopet.compat.api.util.Lang; import com.dsh105.echopet.compat.api.util.PetNames;</BUG> import com.dsh105.echopet.compat.api.util.PlayerUtil; import com.dsh105.echopet.compat.api.util.ReflectionUtil; import com.dsh105.echopet.compat.api.util.StringSimplifier;
import com.dsh105.echopet.compat.api.event.PetTeleportEvent; import com.dsh105.echopet.compat.api.plugin.EchoPet; import com.dsh105.echopet.compat.api.plugin.uuid.UUIDMigration; import com.dsh105.echopet.compat.api.reflection.ReflectionConstants; import com.dsh105.echopet.compat.api.reflection.SafeMethod; import com.dsh105.echopet.compat.api.util.Lang; import com.dsh105.echopet.compat.api.util.INMS; import com.dsh105.echopet.compat.api.util.PetNames; import com.dsh105.echopet.compat.api.util.PlayerUtil; import com.dsh105.echopet.compat.api.util.ReflectionUtil; import com.dsh105.echopet.compat.api.util.StringSimplifier;
193,468
this.getRider().removePet(false); } new BukkitRunnable() { @Override public void run() { <BUG>method.invoke(PlayerUtil.playerToEntityPlayer(getOwner()), getEntityPet()); ownerIsMounting = false;</BUG> if (getEntityPet() instanceof IEntityNoClipPet) { ((IEntityNoClipPet) getEntityPet()).noClip(false); }
this.getRider().removePet(false); } new BukkitRunnable() { @Override public void run() { INMS.getInstance().mount(getOwner(), getEntityPet().getBukkitEntity()); ownerIsMounting = false; if (getEntityPet() instanceof IEntityNoClipPet) { ((IEntityNoClipPet) getEntityPet()).noClip(false);
193,469
rest("/cart/").description("Personal Shopping Cart Service") .produces(MediaType.APPLICATION_JSON_VALUE) .options("/{cartId}") .route().id("getCartOptionsRoute").end().endRest() .options("/checkout/{cartId}") <BUG>.route().id("checkoutCartOptionsRoute").end().endRest() .options("/{cartId}/{itemId}/{quantity}")</BUG> .route().id("cartAddDeleteOptionsRoute").end().endRest() .post("/checkout/{cartId}").description("Finalize shopping cart and process payment") .param().name("cartId").type(RestParamType.path).description("The ID of the cart to process").dataType("string").endParam()
rest("/cart/").description("Personal Shopping Cart Service") .produces(MediaType.APPLICATION_JSON_VALUE) .options("/{cartId}") .route().id("getCartOptionsRoute").end().endRest() .options("/checkout/{cartId}") .route().id("checkoutCartOptionsRoute").end().endRest() .options("/{cartId}/{tmpId}") .route().id("cartSetOptionsRoute").end().endRest() .options("/{cartId}/{itemId}/{quantity}") .route().id("cartAddDeleteOptionsRoute").end().endRest() .post("/checkout/{cartId}").description("Finalize shopping cart and process payment") .param().name("cartId").type(RestParamType.path).description("The ID of the cart to process").dataType("string").endParam()
193,470
import org.rajawali3d.materials.Material; import org.rajawali3d.materials.methods.DiffuseMethod; import org.rajawali3d.materials.textures.ATexture; import org.rajawali3d.materials.textures.StreamingTexture; import org.rajawali3d.materials.textures.Texture; <BUG>import org.rajawali3d.math.Matrix4; import org.rajawali3d.math.vector.Vector3;</BUG> import org.rajawali3d.primitives.ScreenQuad; import org.rajawali3d.primitives.Sphere; import org.rajawali3d.renderer.RajawaliRenderer;
import org.rajawali3d.materials.Material; import org.rajawali3d.materials.methods.DiffuseMethod; import org.rajawali3d.materials.textures.ATexture; import org.rajawali3d.materials.textures.StreamingTexture; import org.rajawali3d.materials.textures.Texture; import org.rajawali3d.math.Matrix4; import org.rajawali3d.math.Quaternion; import org.rajawali3d.math.vector.Vector3; import org.rajawali3d.primitives.ScreenQuad; import org.rajawali3d.primitives.Sphere; import org.rajawali3d.renderer.RajawaliRenderer;
193,471
translationMoon.setRepeatMode(Animation.RepeatMode.INFINITE); translationMoon.setTransformable3D(moon); getCurrentScene().registerAnimation(translationMoon); translationMoon.play(); } <BUG>public void updateRenderCameraPose(TangoPoseData devicePose, DeviceExtrinsics extrinsics) { Pose cameraPose = ScenePoseCalculator.toOpenGlCameraPose(devicePose, extrinsics); getCurrentCamera().setRotation(cameraPose.getOrientation()); getCurrentCamera().setPosition(cameraPose.getPosition()); }</BUG> public int getTextureId() {
translationMoon.setRepeatMode(Animation.RepeatMode.INFINITE); translationMoon.setTransformable3D(moon); getCurrentScene().registerAnimation(translationMoon); translationMoon.play(); } public void updateRenderCameraPose(TangoPoseData cameraPose) { float[] rotation = cameraPose.getRotationAsFloats(); float[] translation = cameraPose.getTranslationAsFloats(); Quaternion quaternion = new Quaternion(rotation[3], rotation[0], rotation[1], rotation[2]); getCurrentCamera().setRotation(quaternion.conjugate()); getCurrentCamera().setPosition(translation[0], translation[1], translation[2]); } public int getTextureId() {
193,472
package com.projecttango.examples.java.helloareadescription; import com.google.atap.tangoservice.Tango; <BUG>import com.google.atap.tangoservice.Tango.OnTangoUpdateListener; import com.google.atap.tangoservice.TangoConfig;</BUG> import com.google.atap.tangoservice.TangoCoordinateFramePair; import com.google.atap.tangoservice.TangoErrorException; import com.google.atap.tangoservice.TangoEvent;
package com.projecttango.examples.java.helloareadescription; import com.google.atap.tangoservice.Tango; import com.google.atap.tangoservice.Tango.OnTangoUpdateListener; import com.google.atap.tangoservice.TangoAreaDescriptionMetaData; import com.google.atap.tangoservice.TangoConfig; import com.google.atap.tangoservice.TangoCoordinateFramePair; import com.google.atap.tangoservice.TangoErrorException; import com.google.atap.tangoservice.TangoEvent;
193,473
Toast.makeText(this, R.string.tango_not_ready, Toast.LENGTH_SHORT).show(); return; } Bundle bundle = new Bundle(); TangoAreaDescriptionMetaData metaData = mTango.loadAreaDescriptionMetaData(mCurrentUuid); <BUG>byte[] adfNameBytes = metaData.get("name"); if (adfNameBytes != null) {</BUG> String fillDialogName = new String(adfNameBytes); <BUG>bundle.putString("name", fillDialogName); } bundle.putString("id", mCurrentUuid); FragmentManager manager = getFragmentManager();</BUG> SetAdfNameDialog setAdfNameDialog = new SetAdfNameDialog();
Toast.makeText(this, R.string.tango_not_ready, Toast.LENGTH_SHORT).show(); return; } Bundle bundle = new Bundle(); TangoAreaDescriptionMetaData metaData = mTango.loadAreaDescriptionMetaData(mCurrentUuid); byte[] adfNameBytes = metaData.get(TangoAreaDescriptionMetaData.KEY_NAME); if (adfNameBytes != null) { String fillDialogName = new String(adfNameBytes); bundle.putString(TangoAreaDescriptionMetaData.KEY_NAME, fillDialogName); } bundle.putString(TangoAreaDescriptionMetaData.KEY_UUID, mCurrentUuid); FragmentManager manager = getFragmentManager(); SetAdfNameDialog setAdfNameDialog = new SetAdfNameDialog();
193,474
package com.projecttango.examples.java.augmentedreality; import com.google.atap.tangoservice.Tango; import com.google.atap.tangoservice.Tango.OnTangoUpdateListener; import com.google.atap.tangoservice.TangoCameraIntrinsics; import com.google.atap.tangoservice.TangoConfig; <BUG>import com.google.atap.tangoservice.TangoCoordinateFramePair; import com.google.atap.tangoservice.TangoEvent;</BUG> import com.google.atap.tangoservice.TangoOutOfDateException; import com.google.atap.tangoservice.TangoPoseData; import com.google.atap.tangoservice.TangoXyzIjData;
package com.projecttango.examples.java.augmentedreality; import com.google.atap.tangoservice.Tango; import com.google.atap.tangoservice.Tango.OnTangoUpdateListener; import com.google.atap.tangoservice.TangoCameraIntrinsics; import com.google.atap.tangoservice.TangoConfig; import com.google.atap.tangoservice.TangoCoordinateFramePair; import com.google.atap.tangoservice.TangoErrorException; import com.google.atap.tangoservice.TangoEvent; import com.google.atap.tangoservice.TangoOutOfDateException; import com.google.atap.tangoservice.TangoPoseData; import com.google.atap.tangoservice.TangoXyzIjData;
193,475
super.onResume(); if (!mIsConnected) { mTango = new Tango(AugmentedRealityActivity.this, new Runnable() { @Override public void run() { <BUG>try { connectTango();</BUG> setupRenderer(); mIsConnected = true; } catch (TangoOutOfDateException e) {
super.onResume(); if (!mIsConnected) { mTango = new Tango(AugmentedRealityActivity.this, new Runnable() { @Override public void run() { try { TangoSupport.initialize(); connectTango(); setupRenderer(); mIsConnected = true; } catch (TangoOutOfDateException e) {
193,476
if (lastFramePose.statusCode == TangoPoseData.POSE_VALID) { mRenderer.updateRenderCameraPose(lastFramePose, mExtrinsics); mCameraPoseTimestamp = lastFramePose.timestamp;</BUG> } else { <BUG>Log.w(TAG, "Can't get device pose at time: " + mRgbTimestampGlThread); }</BUG> } } } @Override
if (lastFramePose.statusCode == TangoPoseData.POSE_VALID) { mRenderer.updateRenderCameraPose(lastFramePose); mCameraPoseTimestamp = lastFramePose.timestamp; } else { Log.w(TAG, "Can't get device pose at time: " + mRgbTimestampGlThread); } } } } @Override
193,477
public ReportElement getBase() { return base; } @Override public float print(PDDocument document, PDPageContentStream stream, int pageNumber, float startX, float startY, float allowedWidth) throws IOException { <BUG>PDPage currPage = (PDPage) document.getDocumentCatalog().getPages().get(pageNo); PDPageContentStream pageStream = new PDPageContentStream(document, currPage, true, false); </BUG> base.print(document, pageStream, pageNo, x, y, width); pageStream.close();
public ReportElement getBase() { return base; } @Override public float print(PDDocument document, PDPageContentStream stream, int pageNumber, float startX, float startY, float allowedWidth) throws IOException { PDPage currPage = document.getDocumentCatalog().getPages().get(pageNo); PDPageContentStream pageStream = new PDPageContentStream(document, currPage, PDPageContentStream.AppendMode.APPEND, false); base.print(document, pageStream, pageNo, x, y, width); pageStream.close();
193,478
public PdfTextStyle(String config) { Assert.hasText(config); String[] split = config.split(","); Assert.isTrue(split.length == 3, "config must look like: 10,Times-Roman,#000000"); fontSize = Integer.parseInt(split[0]); <BUG>font = resolveStandard14Name(split[1]); color = new Color(Integer.valueOf(split[2].substring(1), 16));</BUG> } public int getFontSize() { return fontSize;
public PdfTextStyle(String config) { Assert.hasText(config); String[] split = config.split(","); Assert.isTrue(split.length == 3, "config must look like: 10,Times-Roman,#000000"); fontSize = Integer.parseInt(split[0]); font = getFont(split[1]); color = new Color(Integer.valueOf(split[2].substring(1), 16)); } public int getFontSize() { return fontSize;
193,479
import org.apache.pdfbox.pdmodel.PDDocument; <BUG>import org.apache.pdfbox.pdmodel.edit.PDPageContentStream; import org.apache.pdfbox.pdmodel.font.PDFont;</BUG> import org.springframework.util.StringUtils; <BUG>import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.Map;</BUG> public class ReportRichTextBox extends ReportTextBox { public ReportRichTextBox(PdfTextStyle textConfig, float lineDistance, String text) {
import org.apache.pdfbox.pdmodel.PDDocument; import org.apache.pdfbox.pdmodel.PDPageContentStream; import org.springframework.util.StringUtils; public class ReportRichTextBox extends ReportTextBox { public ReportRichTextBox(PdfTextStyle textConfig, float lineDistance, String text) {
193,480
package cc.catalysts.boot.report.pdf.elements; import org.apache.pdfbox.pdmodel.PDDocument; <BUG>import org.apache.pdfbox.pdmodel.edit.PDPageContentStream; import java.io.IOException;</BUG> import java.util.ArrayList; import java.util.Collection; import java.util.LinkedList;
package cc.catalysts.boot.report.pdf.elements; import org.apache.pdfbox.pdmodel.PDDocument; import org.apache.pdfbox.pdmodel.PDPageContentStream; import java.io.IOException; import java.util.ArrayList; import java.util.Collection; import java.util.LinkedList;
193,481
package cc.catalysts.boot.report.pdf.elements; import cc.catalysts.boot.report.pdf.config.PdfTextStyle; import cc.catalysts.boot.report.pdf.utils.ReportAlignType; import org.apache.pdfbox.pdmodel.PDPageContentStream; <BUG>import org.apache.pdfbox.pdmodel.font.PDFont; import org.slf4j.Logger;</BUG> import org.slf4j.LoggerFactory; import org.springframework.util.StringUtils; import java.io.IOException;
package cc.catalysts.boot.report.pdf.elements; import cc.catalysts.boot.report.pdf.config.PdfTextStyle; import cc.catalysts.boot.report.pdf.utils.ReportAlignType; import org.apache.pdfbox.pdmodel.PDPageContentStream; import org.apache.pdfbox.pdmodel.font.PDFont; import org.apache.pdfbox.pdmodel.font.PDType1Font; import org.apache.pdfbox.util.Matrix; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.util.StringUtils; import java.io.IOException;
193,482
addTextSimple(stream, textConfig, textX, nextLineY, ""); return nextLineY; } try { <BUG>String[] split = splitText(textConfig.getFont(), textConfig.getFontSize(), allowedWidth, fixedText); </BUG> float x = calculateAlignPosition(textX, align, textConfig, allowedWidth, split[0]); if (!underline) { addTextSimple(stream, textConfig, x, nextLineY, split[0]); } else {
addTextSimple(stream, textConfig, textX, nextLineY, ""); return nextLineY; } try { String[] split = splitText(textConfig.getFont(), textConfig.getFontSize(), allowedWidth, text); float x = calculateAlignPosition(textX, align, textConfig, allowedWidth, split[0]); if (!underline) { addTextSimple(stream, textConfig, x, nextLineY, split[0]); } else {
193,483
public static void addTextSimple(PDPageContentStream stream, PdfTextStyle textConfig, float textX, float textY, String text) { try { stream.setFont(textConfig.getFont(), textConfig.getFontSize()); stream.setNonStrokingColor(textConfig.getColor()); stream.beginText(); <BUG>stream.newLineAtOffset(textX, textY); stream.showText(text);</BUG> } catch (Exception e) { LOG.warn("Could not add text: " + e.getClass() + " - " + e.getMessage()); }
public static void addTextSimple(PDPageContentStream stream, PdfTextStyle textConfig, float textX, float textY, String text) { try { stream.setFont(textConfig.getFont(), textConfig.getFontSize()); stream.setNonStrokingColor(textConfig.getColor()); stream.beginText(); stream.setTextMatrix(new Matrix(1,0,0,1, textX, textY)); stream.showText(text); } catch (Exception e) { LOG.warn("Could not add text: " + e.getClass() + " - " + e.getMessage()); }
193,484
public static void addTextSimpleUnderlined(PDPageContentStream stream, PdfTextStyle textConfig, float textX, float textY, String text) { addTextSimple(stream, textConfig, textX, textY, text); try { float lineOffset = textConfig.getFontSize() / 8F; stream.setStrokingColor(textConfig.getColor()); <BUG>stream.setLineWidth(0.5F); stream.drawLine(textX, textY - lineOffset, textX + getTextWidth(textConfig.getFont(), textConfig.getFontSize(), text), textY - lineOffset); </BUG> stream.stroke(); } catch (IOException e) {
public static void addTextSimpleUnderlined(PDPageContentStream stream, PdfTextStyle textConfig, float textX, float textY, String text) { addTextSimple(stream, textConfig, textX, textY, text); try { float lineOffset = textConfig.getFontSize() / 8F; stream.setStrokingColor(textConfig.getColor()); stream.setLineWidth(0.5F); stream.moveTo(textX, textY - lineOffset); stream.lineTo(textX + getTextWidth(textConfig.getFont(), textConfig.getFontSize(), text), textY - lineOffset); stream.stroke(); } catch (IOException e) {
193,485
list.add(text.length()); return list; } public static String[] splitText(PDFont font, int fontSize, float allowedWidth, String text) { String endPart = ""; <BUG>String shortenedText = text; List<String> breakSplitted = Arrays.asList(shortenedText.split("(\\r\\n)|(\\n)|(\\n\\r)")).stream().collect(Collectors.toList()); if (breakSplitted.size() > 1) {</BUG> String[] splittedFirst = splitText(font, fontSize, allowedWidth, breakSplitted.get(0)); StringBuilder remaining = new StringBuilder(splittedFirst[1] == null ? "" : splittedFirst[1] + "\n");
list.add(text.length()); return list; } public static String[] splitText(PDFont font, int fontSize, float allowedWidth, String text) { String endPart = ""; List<String> breakSplitted = Arrays.asList(text.split("(\\r\\n)|(\\n)|(\\n\\r)")).stream().collect(Collectors.toList()); if (breakSplitted.size() > 1) { String[] splittedFirst = splitText(font, fontSize, allowedWidth, breakSplitted.get(0)); StringBuilder remaining = new StringBuilder(splittedFirst[1] == null ? "" : splittedFirst[1] + "\n");
193,486
StringBuilder remaining = new StringBuilder(splittedFirst[1] == null ? "" : splittedFirst[1] + "\n"); breakSplitted.stream().skip(1).forEach(s -> remaining.append(s + "\n")); remaining.deleteCharAt(remaining.length() - 1); return new String[]{splittedFirst[0], remaining.toString()}; } <BUG>if (getTextWidth(font, fontSize, shortenedText) <= allowedWidth && shortenedText.indexOf((char) 13) == -1) { return new String[]{shortenedText, null}; }</BUG> boolean cleanSplit = true; <BUG>List<Integer> indexes = getWrapableIndexes(shortenedText); int start = 0;</BUG> int j = indexes.size() - 1;
StringBuilder remaining = new StringBuilder(splittedFirst[1] == null ? "" : splittedFirst[1] + "\n"); breakSplitted.stream().skip(1).forEach(s -> remaining.append(s + "\n")); remaining.deleteCharAt(remaining.length() - 1); return new String[]{splittedFirst[0], remaining.toString()}; } if (getTextWidth(font, fontSize, text) <= allowedWidth && text.indexOf((char) 13) == -1) { return new String[]{text, null}; } boolean cleanSplit = true; List<Integer> indexes = getWrapableIndexes(text); int start = 0; int j = indexes.size() - 1;
193,487
boolean cleanSplit = true; <BUG>List<Integer> indexes = getWrapableIndexes(shortenedText); int start = 0;</BUG> int j = indexes.size() - 1; int end = indexes.get(j); <BUG>int lineBreakPos = shortenedText.indexOf(10); if (lineBreakPos != -1 && getTextWidth(font, fontSize, shortenedText.substring(start, lineBreakPos)) <= allowedWidth) { end = lineBreakPos;</BUG> } else { <BUG>while (getTextWidth(font, fontSize, shortenedText.substring(start, end)) > allowedWidth) { if (j == 0) {</BUG> cleanSplit = false;
boolean cleanSplit = true; List<Integer> indexes = getWrapableIndexes(text); int start = 0; int j = indexes.size() - 1; int end = indexes.get(j); int lineBreakPos = text.indexOf(10); if (lineBreakPos != -1 && getTextWidth(font, fontSize, text.substring(start, lineBreakPos)) <= allowedWidth) { end = lineBreakPos; } else { while (getTextWidth(font, fontSize, text.substring(start, end)) > allowedWidth) { if (j == 0) { cleanSplit = false;
193,488
customTokens.put("%%mlFinalForestsPerHost%%", hubConfig.finalForestsPerHost.toString()); customTokens.put("%%mlTraceAppserverName%%", hubConfig.traceHttpName); customTokens.put("%%mlTracePort%%", hubConfig.tracePort.toString()); customTokens.put("%%mlTraceDbName%%", hubConfig.traceDbName); customTokens.put("%%mlTraceForestsPerHost%%", hubConfig.traceForestsPerHost.toString()); <BUG>customTokens.put("%%mlModulesDbName%%", hubConfig.modulesDbName); }</BUG> public void init() { try { LOGGER.error("PLUGINS DIR: " + pluginsDir.toString());
customTokens.put("%%mlFinalForestsPerHost%%", hubConfig.finalForestsPerHost.toString()); customTokens.put("%%mlTraceAppserverName%%", hubConfig.traceHttpName); customTokens.put("%%mlTracePort%%", hubConfig.tracePort.toString()); customTokens.put("%%mlTraceDbName%%", hubConfig.traceDbName); customTokens.put("%%mlTraceForestsPerHost%%", hubConfig.traceForestsPerHost.toString()); customTokens.put("%%mlModulesDbName%%", hubConfig.modulesDbName); customTokens.put("%%mlTriggersDbName%%", hubConfig.triggersDbName); customTokens.put("%%mlSchemasDbName%%", hubConfig.schemasDbName); } public void init() { try { LOGGER.error("PLUGINS DIR: " + pluginsDir.toString());
193,489
package com.reprezen.swagedit.model; import java.util.ArrayList; import java.util.List; <BUG>import com.fasterxml.jackson.core.JsonLocation;</BUG> import com.fasterxml.jackson.core.JsonPointer; public class ArrayNode extends AbstractNode { private final List<AbstractNode> elements = new ArrayList<>(); public ArrayNode(AbstractNode parent, JsonPointer ptr) { super(parent, ptr); <BUG>} public ArrayNode(AbstractNode parent, JsonPointer ptr, JsonLocation location) { super(parent, ptr, location);</BUG> }
package com.reprezen.swagedit.model; import java.util.ArrayList; import java.util.List; import com.fasterxml.jackson.core.JsonPointer; public class ArrayNode extends AbstractNode { private final List<AbstractNode> elements = new ArrayList<>(); public ArrayNode(AbstractNode parent, JsonPointer ptr) { super(parent, ptr); }
193,490
public int size() { return Iterables.size(elements()); } public abstract String getText(); public Position getPosition(IDocument document) { <BUG>int startLine = getStart().getLineNr() - 1; int offset = 0;</BUG> int length = 0; <BUG>int endLine = getEnd().getLineNr() - 1; int endCol = getEnd().getColumnNr() - 1; try {</BUG> offset = document.getLineOffset(startLine);
public int size() { return Iterables.size(elements()); } public abstract String getText(); public Position getPosition(IDocument document) { int startLine = getStart().getLine(); int offset = 0; int length = 0; int endLine = getEnd().getLine(); int endCol = getEnd().getColumn(); try { offset = document.getLineOffset(startLine);
193,491
} @RootTask static Task<Exec.Result> exec(String parameter, int number) { Task<String> task1 = MyTask.create(parameter); Task<Integer> task2 = Adder.create(number, number + 2); <BUG>return Task.ofType(Exec.Result.class).named("exec", "/bin/sh") .in(() -> task1)</BUG> .in(() -> task2) .process(Exec.exec((str, i) -> args("/bin/sh", "-c", "\"echo " + i + "\""))); }
} @RootTask static Task<Exec.Result> exec(String parameter, int number) { Task<String> task1 = MyTask.create(parameter); Task<Integer> task2 = Adder.create(number, number + 2); return Task.named("exec", "/bin/sh").ofType(Exec.Result.class) .in(() -> task1) .in(() -> task2) .process(Exec.exec((str, i) -> args("/bin/sh", "-c", "\"echo " + i + "\""))); }
193,492
return args; } static class MyTask { static final int PLUS = 10; static Task<String> create(String parameter) { <BUG>return Task.ofType(String.class).named("MyTask", parameter) .in(() -> Adder.create(parameter.length(), PLUS))</BUG> .in(() -> Fib.create(parameter.length())) .process((sum, fib) -> something(parameter, sum, fib)); }
return args; } static class MyTask { static final int PLUS = 10; static Task<String> create(String parameter) { return Task.named("MyTask", parameter).ofType(String.class) .in(() -> Adder.create(parameter.length(), PLUS)) .in(() -> Fib.create(parameter.length())) .process((sum, fib) -> something(parameter, sum, fib)); }
193,493
final String instanceField = "from instance"; final TaskContext context = TaskContext.inmem(); final AwaitingConsumer<String> val = new AwaitingConsumer<>(); @Test public void shouldJavaUtilSerialize() throws Exception { <BUG>Task<Long> task1 = Task.ofType(Long.class).named("Foo", "Bar", 39) .process(() -> 9999L); Task<String> task2 = Task.ofType(String.class).named("Baz", 40) .in(() -> task1)</BUG> .ins(() -> singletonList(task1))
final String instanceField = "from instance"; final TaskContext context = TaskContext.inmem(); final AwaitingConsumer<String> val = new AwaitingConsumer<>(); @Test public void shouldJavaUtilSerialize() throws Exception { Task<Long> task1 = Task.named("Foo", "Bar", 39).ofType(Long.class) .process(() -> 9999L); Task<String> task2 = Task.named("Baz", 40).ofType(String.class) .in(() -> task1) .ins(() -> singletonList(task1))
193,494
assertEquals(des.id().name(), "Baz"); assertEquals(val.awaitAndGet(), "[9999] hello 10004"); } @Test(expected = NotSerializableException.class) public void shouldNotSerializeWithInstanceFieldReference() throws Exception { <BUG>Task<String> task = Task.ofType(String.class).named("WithRef") .process(() -> instanceField + " causes an outer reference");</BUG> serialize(task); } @Test
assertEquals(des.id().name(), "Baz"); assertEquals(val.awaitAndGet(), "[9999] hello 10004"); } @Test(expected = NotSerializableException.class) public void shouldNotSerializeWithInstanceFieldReference() throws Exception { Task<String> task = Task.named("WithRef").ofType(String.class) .process(() -> instanceField + " causes an outer reference"); serialize(task); } @Test
193,495
serialize(task); } @Test public void shouldSerializeWithLocalReference() throws Exception { String local = instanceField; <BUG>Task<String> task = Task.ofType(String.class).named("WithLocalRef") .process(() -> local + " won't cause an outer reference");</BUG> serialize(task); Task<String> des = deserialize(); context.evaluate(des).consume(val);
serialize(task); } @Test public void shouldSerializeWithLocalReference() throws Exception { String local = instanceField; Task<String> task = Task.named("WithLocalRef").ofType(String.class) .process(() -> local + " won't cause an outer reference"); serialize(task); Task<String> des = deserialize(); context.evaluate(des).consume(val);
193,496
TaskContext taskContext = TaskContext.inmem(); TaskContext.Value<Long> value = taskContext.evaluate(fib92); value.consume(f92 -> System.out.println("fib(92) = " + f92)); } static Task<Long> create(long n) { <BUG>TaskBuilder<Long> fib = Task.ofType(Long.class).named("Fib", n); </BUG> if (n < 2) { return fib .process(() -> n);
TaskContext taskContext = TaskContext.inmem(); TaskContext.Value<Long> value = taskContext.evaluate(fib92); value.consume(f92 -> System.out.println("fib(92) = " + f92)); } static Task<Long> create(long n) { TaskBuilder<Long> fib = Task.named("Fib", n).ofType(Long.class); if (n < 2) { return fib .process(() -> n);
193,497
} @RootTask public static Task<String> standardArgs(int first, String second) { firstInt = first; secondString = second; <BUG>return Task.ofType(String.class).named("StandardArgs", first, second) .process(() -> second + " " + first * 100);</BUG> } @Test public void shouldParseFlags() throws Exception {
} @RootTask public static Task<String> standardArgs(int first, String second) { firstInt = first; secondString = second; return Task.named("StandardArgs", first, second).ofType(String.class) .process(() -> second + " " + first * 100); } @Test public void shouldParseFlags() throws Exception {
193,498
assertThat(parsedEnum, is(CustomEnum.BAR)); } @RootTask public static Task<String> enums(CustomEnum enm) { parsedEnum = enm; <BUG>return Task.ofType(String.class).named("Enums", enm) .process(enm::toString);</BUG> } @Test public void shouldParseCustomTypes() throws Exception {
assertThat(parsedEnum, is(CustomEnum.BAR)); } @RootTask public static Task<String> enums(CustomEnum enm) { parsedEnum = enm; return Task.named("Enums", enm).ofType(String.class) .process(enm::toString); } @Test public void shouldParseCustomTypes() throws Exception {
193,499
assertThat(parsedType.content, is("blarg parsed for you!")); } @RootTask public static Task<String> customType(CustomType myType) { parsedType = myType; <BUG>return Task.ofType(String.class).named("Types", myType.content) .process(() -> myType.content);</BUG> } public enum CustomEnum { BAR
assertThat(parsedType.content, is("blarg parsed for you!")); } @RootTask public static Task<String> customType(CustomType myType) { parsedType = myType; return Task.named("Types", myType.content).ofType(String.class) .process(() -> myType.content); } public enum CustomEnum { BAR
193,500
package com.blankj.utilcode.utils; import android.content.ComponentName; import android.content.Context; import android.content.Intent; <BUG>import android.graphics.Bitmap;</BUG> import android.net.Uri; import android.os.Build; import android.os.Bundle; <BUG>import android.provider.MediaStore; import android.webkit.MimeTypeMap;</BUG> import java.io.File;
package com.blankj.utilcode.utils; import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.net.Uri; import android.os.Build; import android.os.Bundle; import android.provider.MediaStore; import android.support.v4.content.FileProvider; import android.webkit.MimeTypeMap; import java.io.File;