id
int64
1
194k
buggy
stringlengths
23
37.5k
fixed
stringlengths
6
37.4k
193,001
}, new ErrorListener() { @Override public void onErrorResponse(VolleyError volleyError) { Log.e("Query", volleyError.getMessage(), volleyError); mProgressDialog.cancel(); <BUG>Toast.makeText(QueryActivity.this, R.string.system_busy, Toast.LENGTH_SHORT).show(); }</BUG> }) { @Override public Map<String, String> getHeaders() throws AuthFailureError {
}, new ErrorListener() { @Override public void onErrorResponse(VolleyError volleyError) { Log.e("Query", volleyError.getMessage(), volleyError); mProgressDialog.cancel(); SnackbarUtils.show(QueryActivity.this, R.string.system_busy); } }) { @Override public Map<String, String> getHeaders() throws AuthFailureError {
193,002
if (etPostId.length() != 0 && tvComName.length() != 0) { btnQuery.setEnabled(true); } else { btnQuery.setEnabled(false); } <BUG>} @Override protected void onResume() { super.onResume(); initUnCheck();</BUG> }
if (etPostId.length() != 0 && tvComName.length() != 0) { btnQuery.setEnabled(true); } else { btnQuery.setEnabled(false); } }
193,003
if (drawerLayout.isDrawerOpen(GravityCompat.START)) { drawerLayout.closeDrawers(); return; } if (System.currentTimeMillis() - mExitTime > 2000) { <BUG>mExitTime = System.currentTimeMillis(); Snackbar.make(getWindow().getDecorView().findViewById(android.R.id.content), R.string.click2exit, Snackbar.LENGTH_SHORT).show();</BUG> } else { finish();
if (drawerLayout.isDrawerOpen(GravityCompat.START)) { drawerLayout.closeDrawers(); return; } if (System.currentTimeMillis() - mExitTime > 2000) { mExitTime = System.currentTimeMillis(); SnackbarUtils.show(this, R.string.click2exit); } else { finish();
193,004
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,005
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,006
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,007
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,008
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,009
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,010
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,011
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,012
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,013
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,014
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,015
import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.security.DigestOutputStream; import java.security.MessageDigest; <BUG>import java.security.NoSuchAlgorithmException; import java.util.ArrayList; import java.util.Collections; import java.util.List;</BUG> public final class PatchUtils {
import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.security.DigestOutputStream; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.text.DateFormat; import java.util.ArrayList; import java.util.Collections; import java.util.Date; import java.util.List; public final class PatchUtils {
193,016
package org.jboss.as.patching; import org.jboss.as.controller.AttributeDefinition; <BUG>import org.jboss.as.controller.SimpleAttributeDefinition;</BUG> import org.jboss.as.controller.SimpleAttributeDefinitionBuilder; import org.jboss.dmr.ModelType; <BUG>class Constants { </BUG> static final AttributeDefinition PATCH_ID = SimpleAttributeDefinitionBuilder.create("patch-id", ModelType.STRING).build();
package org.jboss.as.patching; import org.jboss.as.controller.AttributeDefinition; import org.jboss.as.controller.SimpleAttributeDefinitionBuilder; import org.jboss.dmr.ModelType; public class Constants {
193,017
package org.jboss.as.patching; import org.jboss.as.controller.OperationFailedException; import org.jboss.as.patching.runner.PatchingException; import org.jboss.logging.Messages; import org.jboss.logging.annotations.Message; <BUG>import org.jboss.logging.annotations.MessageBundle; import java.io.IOException;</BUG> import java.util.List; @MessageBundle(projectCode = "JBAS") public interface PatchMessages {
package org.jboss.as.patching; import org.jboss.as.controller.OperationFailedException; import org.jboss.as.patching.runner.PatchingException; import org.jboss.logging.Messages; import org.jboss.logging.annotations.Message; import org.jboss.logging.annotations.MessageBundle; import org.jboss.logging.annotations.Cause; import java.io.IOException; import java.util.List; @MessageBundle(projectCode = "JBAS") public interface PatchMessages {
193,018
package org.jboss.as.patching.runner; <BUG>import org.jboss.as.boot.DirectoryStructure; import org.jboss.as.patching.LocalPatchInfo;</BUG> import org.jboss.as.patching.PatchInfo; import org.jboss.as.patching.PatchLogger; import org.jboss.as.patching.PatchMessages;
package org.jboss.as.patching.runner; import static org.jboss.as.patching.runner.PatchUtils.generateTimestamp; import org.jboss.as.boot.DirectoryStructure; import org.jboss.as.patching.CommonAttributes; import org.jboss.as.patching.LocalPatchInfo; import org.jboss.as.patching.PatchInfo; import org.jboss.as.patching.PatchLogger; import org.jboss.as.patching.PatchMessages;
193,019
private static final String PATH_DELIMITER = "/"; public static final byte[] NO_CONTENT = PatchingTask.NO_CONTENT; enum Element { ADDED_BUNDLE("added-bundle"), ADDED_MISC_CONTENT("added-misc-content"), <BUG>ADDED_MODULE("added-module"), BUNDLES("bundles"),</BUG> CUMULATIVE("cumulative"), DESCRIPTION("description"), MISC_FILES("misc-files"),
private static final String PATH_DELIMITER = "/"; public static final byte[] NO_CONTENT = PatchingTask.NO_CONTENT; enum Element { ADDED_BUNDLE("added-bundle"), ADDED_MISC_CONTENT("added-misc-content"), ADDED_MODULE("added-module"), APPLIES_TO_VERSION("applies-to-version"), BUNDLES("bundles"), CUMULATIVE("cumulative"), DESCRIPTION("description"), MISC_FILES("misc-files"),
193,020
writer.writeEndElement(); final Patch.PatchType type = patch.getPatchType(); <BUG>final List<String> appliesTo = patch.getAppliesTo();</BUG> if(type == Patch.PatchType.ONE_OFF) { <BUG>writer.writeEmptyElement(Element.ONE_OFF.name); </BUG> } else { <BUG>writer.writeEmptyElement(Element.CUMULATIVE.name); </BUG> writer.writeAttribute(Attribute.RESULTING_VERSION.name, patch.getResultingVersion());
writer.writeEndElement(); writer.writeStartElement(Element.DESCRIPTION.name); writer.writeCharacters(patch.getDescription()); writer.writeEndElement(); final Patch.PatchType type = patch.getPatchType(); if(type == Patch.PatchType.ONE_OFF) { writer.writeStartElement(Element.ONE_OFF.name); } else { writer.writeStartElement(Element.CUMULATIVE.name); writer.writeAttribute(Attribute.RESULTING_VERSION.name, patch.getResultingVersion());
193,021
} else { <BUG>writer.writeEmptyElement(Element.CUMULATIVE.name); </BUG> writer.writeAttribute(Attribute.RESULTING_VERSION.name, patch.getResultingVersion()); } <BUG>writer.writeAttribute(Attribute.APPLIES_TO_VERSION.name, appliesTo); final List<ContentModification> bundlesAdd = new ArrayList<ContentModification>();</BUG> final List<ContentModification> bundlesUpdate = new ArrayList<ContentModification>(); final List<ContentModification> bundlesRemove = new ArrayList<ContentModification>(); final List<ContentModification> miscAdd = new ArrayList<ContentModification>();
} else { writer.writeStartElement(Element.CUMULATIVE.name); writer.writeAttribute(Attribute.RESULTING_VERSION.name, patch.getResultingVersion()); } writeAppliesToVersions(writer, patch.getAppliesTo()); writer.writeEndElement(); // </one-off> or </cumulative> final List<ContentModification> bundlesAdd = new ArrayList<ContentModification>(); final List<ContentModification> bundlesUpdate = new ArrayList<ContentModification>(); final List<ContentModification> bundlesRemove = new ArrayList<ContentModification>(); final List<ContentModification> miscAdd = new ArrayList<ContentModification>();
193,022
final int count = reader.getAttributeCount(); for (int i = 0; i < count; i++) { final String value = reader.getAttributeValue(i); final Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i)); switch (attribute) { <BUG>case APPLIES_TO_VERSION: builder.addAppliesTo(value); break;</BUG> case RESULTING_VERSION: if(type == Patch.PatchType.CUMULATIVE) {
final int count = reader.getAttributeCount(); for (int i = 0; i < count; i++) { final String value = reader.getAttributeValue(i); final Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i)); switch (attribute) { case RESULTING_VERSION: if(type == Patch.PatchType.CUMULATIVE) {
193,023
final StringBuilder path = new StringBuilder(); for(final String p : item.getPath()) { path.append(p).append(PATH_DELIMITER); } path.append(item.getName()); <BUG>writer.writeAttribute(Attribute.PATH.name, path.toString()); if(type != ModificationType.REMOVE) {</BUG> writer.writeAttribute(Attribute.HASH.name, bytesToHexString(item.getContentHash())); } if(type != ModificationType.ADD) {
final StringBuilder path = new StringBuilder(); for(final String p : item.getPath()) { path.append(p).append(PATH_DELIMITER); } path.append(item.getName()); writer.writeAttribute(Attribute.PATH.name, path.toString()); if (item.isDirectory()) { writer.writeAttribute(Attribute.DIRECTORY.name, "true"); } if(type != ModificationType.REMOVE) { writer.writeAttribute(Attribute.HASH.name, bytesToHexString(item.getContentHash())); } if(type != ModificationType.ADD) {
193,024
private static FGStorageManager instance; private final Logger logger = FoxGuardMain.instance().getLogger();</BUG> private final Set<LoadEntry> loaded = new HashSet<>(); private final Path directory = getDirectory(); private final Map<String, Path> worldDirectories; <BUG>private FGStorageManager() { defaultModifiedMap = new CacheMap<>((k, m) -> {</BUG> if (k instanceof IFGObject) { m.put((IFGObject) k, true); return true;
private static FGStorageManager instance; public final HashMap<IFGObject, Boolean> defaultModifiedMap; private final UserStorageService userStorageService; private final Logger logger = FoxGuardMain.instance().getLogger(); private final Set<LoadEntry> loaded = new HashSet<>(); private final Path directory = getDirectory(); private final Map<String, Path> worldDirectories; private FGStorageManager() { userStorageService = FoxGuardMain.instance().getUserStorage(); defaultModifiedMap = new CacheMap<>((k, m) -> { if (k instanceof IFGObject) { m.put((IFGObject) k, true); return true;
193,025
constructDirectory(singleDir); try { fgObject.save(singleDir); } catch (Exception e) { <BUG>logger.error("There was an error while saving region \"" + name + "\"!", e); </BUG> } <BUG>logger.info("Saving metadata for region \"" + name + "\""); </BUG> try (DB metaDB = DBMaker.fileDB(singleDir.resolve("metadata.foxdb").normalize().toString()).make()) {
constructDirectory(singleDir); try { fgObject.save(singleDir); } catch (Exception e) { logger.error("There was an error while saving region " + logName + "!", e); } logger.info("Saving metadata for region " + logName); try (DB metaDB = DBMaker.fileDB(singleDir.resolve("metadata.foxdb").normalize().toString()).make()) {
193,026
metaCategory.set(FGUtil.getCategory(fgObject)); <BUG>metaType.set(fgObject.getUniqueTypeString()); metaEnabled.set(fgObject.isEnabled());</BUG> } } else { <BUG>logger.info("Region \"" + name + "\" is already up to date. Skipping..."); </BUG> } mainMap.put(name, FGUtil.getCategory(fgObject)); <BUG>typeMap.put(name, fgObject.getUniqueTypeString()); enabledMap.put(name, fgObject.isEnabled());</BUG> defaultModifiedMap.put(fgObject, false);
metaCategory.set(FGUtil.getCategory(fgObject)); metaType.set(fgObject.getUniqueTypeString()); metaOwner.set(owner); metaEnabled.set(fgObject.isEnabled()); } } else { logger.info("Region " + logName + " is already up to date. Skipping..."); } mainMap.put(name, FGUtil.getCategory(fgObject)); typeMap.put(name, fgObject.getUniqueTypeString()); ownerMap.put(name, owner); enabledMap.put(name, fgObject.isEnabled()); defaultModifiedMap.put(fgObject, false);
193,027
mainMap.put(name, FGUtil.getCategory(fgObject)); <BUG>typeMap.put(name, fgObject.getUniqueTypeString()); enabledMap.put(name, fgObject.isEnabled());</BUG> defaultModifiedMap.put(fgObject, false); } else { <BUG>logger.info("Region " + fgObject.getName() + " does not need saving. Skipping..."); </BUG> } if (fgObject.saveLinks()) { linksMap.put(name, serializeHandlerList(fgObject.getHandlers()));
mainMap.put(name, FGUtil.getCategory(fgObject)); typeMap.put(name, fgObject.getUniqueTypeString()); ownerMap.put(name, owner); enabledMap.put(name, fgObject.isEnabled()); defaultModifiedMap.put(fgObject, false); } else { logger.info("Region " + logName + " does not need saving. Skipping..."); } if (fgObject.saveLinks()) { linksMap.put(name, serializeHandlerList(fgObject.getHandlers()));
193,028
constructDirectory(singleDir); try { fgObject.save(singleDir); } catch (Exception e) { <BUG>logger.error("There was an error while saving world region \"" + name + "\" in world \"" + world.getName() + "\"!", e); </BUG> } <BUG>logger.info("Saving metadata for world region \"" + name + "\""); </BUG> try (DB metaDB = DBMaker.fileDB(singleDir.resolve("metadata.foxdb").normalize().toString()).make()) {
constructDirectory(singleDir); try { fgObject.save(singleDir); } catch (Exception e) { logger.error("There was an error while saving world region " + logName + " in world " + world.getName() + "!", e); } logger.info("Saving metadata for world region " + logName); try (DB metaDB = DBMaker.fileDB(singleDir.resolve("metadata.foxdb").normalize().toString()).make()) {
193,029
metaCategory.set(FGUtil.getCategory(fgObject)); <BUG>metaType.set(fgObject.getUniqueTypeString()); metaEnabled.set(fgObject.isEnabled());</BUG> } } else { <BUG>logger.info("Region \"" + name + "\" is already up to date. Skipping..."); </BUG> } mainMap.put(name, FGUtil.getCategory(fgObject)); <BUG>typeMap.put(name, fgObject.getUniqueTypeString()); enabledMap.put(name, fgObject.isEnabled());</BUG> defaultModifiedMap.put(fgObject, false);
metaCategory.set(FGUtil.getCategory(fgObject)); metaType.set(fgObject.getUniqueTypeString()); metaOwner.set(owner); metaEnabled.set(fgObject.isEnabled()); } } else { logger.info("Region " + logName + " is already up to date. Skipping..."); } mainMap.put(name, FGUtil.getCategory(fgObject)); typeMap.put(name, fgObject.getUniqueTypeString()); ownerMap.put(name, owner); enabledMap.put(name, fgObject.isEnabled()); defaultModifiedMap.put(fgObject, false);
193,030
mainMap.put(name, FGUtil.getCategory(fgObject)); <BUG>typeMap.put(name, fgObject.getUniqueTypeString()); enabledMap.put(name, fgObject.isEnabled());</BUG> defaultModifiedMap.put(fgObject, false); } else { <BUG>logger.info("World region " + fgObject.getName() + " does not need saving. Skipping..."); </BUG> } if (fgObject.saveLinks()) { linksMap.put(name, serializeHandlerList(fgObject.getHandlers()));
mainMap.put(name, FGUtil.getCategory(fgObject)); typeMap.put(name, fgObject.getUniqueTypeString()); ownerMap.put(name, owner); enabledMap.put(name, fgObject.isEnabled()); defaultModifiedMap.put(fgObject, false); } else { logger.info("World region " + logName + " does not need saving. Skipping..."); } if (fgObject.saveLinks()) { linksMap.put(name, serializeHandlerList(fgObject.getHandlers()));
193,031
String name = fgObject.getName(); Path singleDir = dir.resolve(name.toLowerCase()); </BUG> boolean shouldSave = fgObject.shouldSave(); if (force || shouldSave) { <BUG>logger.info((shouldSave ? "S" : "Force s") + "aving handler \"" + name + "\" in directory: " + singleDir); </BUG> constructDirectory(singleDir); try { fgObject.save(singleDir);
String name = fgObject.getName(); UUID owner = fgObject.getOwner(); boolean isOwned = !owner.equals(SERVER_UUID); Optional<User> userOwner = userStorageService.get(owner); String logName = (userOwner.isPresent() ? userOwner.get().getName() + ":" : "") + (isOwned ? owner + ":" : "") + name; if (fgObject.autoSave()) { Path singleDir = serverDir.resolve(name.toLowerCase()); boolean shouldSave = fgObject.shouldSave(); if (force || shouldSave) { logger.info((shouldSave ? "S" : "Force s") + "aving handler " + logName + " in directory: " + singleDir); constructDirectory(singleDir); try { fgObject.save(singleDir);
193,032
constructDirectory(singleDir); try { fgObject.save(singleDir); } catch (Exception e) { <BUG>logger.error("There was an error while saving region \"" + name + "\"!", e); </BUG> } <BUG>logger.info("Saving metadata for region \"" + name + "\""); </BUG> try (DB metaDB = DBMaker.fileDB(singleDir.resolve("metadata.foxdb").normalize().toString()).make()) {
constructDirectory(singleDir); try { fgObject.save(singleDir); } catch (Exception e) { logger.error("There was an error while saving region " + logName + "!", e); } logger.info("Saving metadata for region " + logName); try (DB metaDB = DBMaker.fileDB(singleDir.resolve("metadata.foxdb").normalize().toString()).make()) {
193,033
metaCategory.set(FGUtil.getCategory(fgObject)); <BUG>metaType.set(fgObject.getUniqueTypeString()); metaEnabled.set(fgObject.isEnabled());</BUG> } } else { <BUG>logger.info("Region \"" + name + "\" is already up to date. Skipping..."); </BUG> } mainMap.put(name, FGUtil.getCategory(fgObject)); <BUG>typeMap.put(name, fgObject.getUniqueTypeString()); enabledMap.put(name, fgObject.isEnabled());</BUG> defaultModifiedMap.put(fgObject, false);
metaCategory.set(FGUtil.getCategory(fgObject)); metaType.set(fgObject.getUniqueTypeString()); metaOwner.set(owner); metaEnabled.set(fgObject.isEnabled()); } } else { logger.info("Region " + logName + " is already up to date. Skipping..."); } mainMap.put(name, FGUtil.getCategory(fgObject)); typeMap.put(name, fgObject.getUniqueTypeString()); ownerMap.put(name, owner); enabledMap.put(name, fgObject.isEnabled()); defaultModifiedMap.put(fgObject, false);
193,034
mainMap.put(name, FGUtil.getCategory(fgObject)); <BUG>typeMap.put(name, fgObject.getUniqueTypeString()); enabledMap.put(name, fgObject.isEnabled());</BUG> defaultModifiedMap.put(fgObject, false); } else { <BUG>logger.info("Region " + fgObject.getName() + " does not need saving. Skipping..."); </BUG> } if (fgObject.saveLinks()) { linksMap.put(name, serializeHandlerList(fgObject.getHandlers()));
mainMap.put(name, FGUtil.getCategory(fgObject)); typeMap.put(name, fgObject.getUniqueTypeString()); ownerMap.put(name, owner); enabledMap.put(name, fgObject.isEnabled()); defaultModifiedMap.put(fgObject, false); } else { logger.info("Region " + logName + " does not need saving. Skipping..."); } if (fgObject.saveLinks()) { linksMap.put(name, serializeHandlerList(fgObject.getHandlers()));
193,035
if (fgObject.autoSave()) { Path singleDir = dir.resolve(name.toLowerCase()); </BUG> boolean shouldSave = fgObject.shouldSave(); if (force || shouldSave) { <BUG>logger.info((shouldSave ? "S" : "Force s") + "aving world region \"" + name + "\" in directory: " + singleDir); </BUG> constructDirectory(singleDir); try { fgObject.save(singleDir);
if (fgObject.autoSave()) { Path singleDir = serverDir.resolve(name.toLowerCase()); boolean shouldSave = fgObject.shouldSave(); if (force || shouldSave) { logger.info((shouldSave ? "S" : "Force s") + "aving world region " + logName + " in directory: " + singleDir); constructDirectory(singleDir); try { fgObject.save(singleDir);
193,036
</BUG> constructDirectory(singleDir); try { fgObject.save(singleDir); } catch (Exception e) { <BUG>logger.error("There was an error while saving world region \"" + name + "\" in world \"" + world.getName() + "\"!", e); </BUG> } <BUG>logger.info("Saving metadata for world region \"" + name + "\""); </BUG> try (DB metaDB = DBMaker.fileDB(singleDir.resolve("metadata.foxdb").normalize().toString()).make()) {
if (fgObject.autoSave()) { Path singleDir = serverDir.resolve(name.toLowerCase()); boolean shouldSave = fgObject.shouldSave(); if (force || shouldSave) { logger.info((shouldSave ? "S" : "Force s") + "aving world region " + logName + " in directory: " + singleDir); constructDirectory(singleDir); try { fgObject.save(singleDir); } catch (Exception e) { logger.error("There was an error while saving world region " + logName + " in world " + world.getName() + "!", e); } logger.info("Saving metadata for world region " + logName); try (DB metaDB = DBMaker.fileDB(singleDir.resolve("metadata.foxdb").normalize().toString()).make()) {
193,037
metaCategory.set(FGUtil.getCategory(fgObject)); <BUG>metaType.set(fgObject.getUniqueTypeString()); metaEnabled.set(fgObject.isEnabled());</BUG> } } else { <BUG>logger.info("Region \"" + name + "\" is already up to date. Skipping..."); }</BUG> mainMap.put(name, FGUtil.getCategory(fgObject)); <BUG>typeMap.put(name, fgObject.getUniqueTypeString()); enabledMap.put(name, fgObject.isEnabled());</BUG> defaultModifiedMap.put(fgObject, false);
metaCategory.set(FGUtil.getCategory(fgObject)); metaType.set(fgObject.getUniqueTypeString()); metaOwner.set(owner); metaEnabled.set(fgObject.isEnabled()); } } else { logger.info("Region " + name + " is already up to date. Skipping..."); } mainMap.put(name, FGUtil.getCategory(fgObject)); typeMap.put(name, fgObject.getUniqueTypeString()); ownerMap.put(name, owner); enabledMap.put(name, fgObject.isEnabled());
193,038
mainMap.put(name, FGUtil.getCategory(fgObject)); <BUG>typeMap.put(name, fgObject.getUniqueTypeString()); enabledMap.put(name, fgObject.isEnabled());</BUG> defaultModifiedMap.put(fgObject, false); } else { <BUG>logger.info("World region " + fgObject.getName() + " does not need saving. Skipping..."); </BUG> } if (fgObject.saveLinks()) { linksMap.put(name, serializeHandlerList(fgObject.getHandlers()));
mainMap.put(name, FGUtil.getCategory(fgObject)); typeMap.put(name, fgObject.getUniqueTypeString()); ownerMap.put(name, owner); enabledMap.put(name, fgObject.isEnabled()); defaultModifiedMap.put(fgObject, false); } else { logger.info("World region " + logName + " does not need saving. Skipping..."); } if (fgObject.saveLinks()) { linksMap.put(name, serializeHandlerList(fgObject.getHandlers()));
193,039
public synchronized void loadRegionLinks() { logger.info("Loading region links"); try (DB mainDB = DBMaker.fileDB(directory.resolve("regions.foxdb").normalize().toString()).make()) { Map<String, String> linksMap = mainDB.hashMap("links", Serializer.STRING, Serializer.STRING).createOrOpen(); linksMap.entrySet().forEach(entry -> { <BUG>IRegion region = FGManager.getInstance().getRegion(entry.getKey()); if (region != null) { logger.info("Loading links for region \"" + region.getName() + "\"");</BUG> String handlersString = entry.getValue();
public synchronized void loadRegionLinks() { logger.info("Loading region links"); try (DB mainDB = DBMaker.fileDB(directory.resolve("regions.foxdb").normalize().toString()).make()) { Map<String, String> linksMap = mainDB.hashMap("links", Serializer.STRING, Serializer.STRING).createOrOpen(); linksMap.entrySet().forEach(entry -> { Optional<IRegion> regionOpt = FGManager.getInstance().getRegion(entry.getKey()); if (regionOpt.isPresent()) { IRegion region = regionOpt.get(); logger.info("Loading links for region \"" + region.getName() + "\""); String handlersString = entry.getValue();
193,040
public synchronized void loadWorldRegionLinks(World world) { logger.info("Loading world region links for world \"" + world.getName() + "\""); try (DB mainDB = DBMaker.fileDB(worldDirectories.get(world.getName()).resolve("wregions.foxdb").normalize().toString()).make()) { Map<String, String> linksMap = mainDB.hashMap("links", Serializer.STRING, Serializer.STRING).createOrOpen(); linksMap.entrySet().forEach(entry -> { <BUG>IRegion region = FGManager.getInstance().getWorldRegion(world, entry.getKey()); if (region != null) { logger.info("Loading links for world region \"" + region.getName() + "\"");</BUG> String handlersString = entry.getValue();
public synchronized void loadWorldRegionLinks(World world) { logger.info("Loading world region links for world \"" + world.getName() + "\""); try (DB mainDB = DBMaker.fileDB(worldDirectories.get(world.getName()).resolve("wregions.foxdb").normalize().toString()).make()) { Map<String, String> linksMap = mainDB.hashMap("links", Serializer.STRING, Serializer.STRING).createOrOpen(); linksMap.entrySet().forEach(entry -> { Optional<IWorldRegion> regionOpt = FGManager.getInstance().getWorldRegion(world, entry.getKey()); if (regionOpt.isPresent()) { IWorldRegion region = regionOpt.get(); logger.info("Loading links for world region \"" + region.getName() + "\""); String handlersString = entry.getValue();
193,041
StringBuilder builder = new StringBuilder(); for (Iterator<IHandler> it = handlers.iterator(); it.hasNext(); ) { builder.append(it.next().getName()); if (it.hasNext()) builder.append(","); } <BUG>return builder.toString(); }</BUG> private final class LoadEntry { public final String name; public final Type type;
StringBuilder builder = new StringBuilder(); for (Iterator<IHandler> it = handlers.iterator(); it.hasNext(); ) { builder.append(it.next().getName()); if (it.hasNext()) builder.append(","); } return builder.toString(); } public enum Type { REGION, WREGION, HANDLER } private final class LoadEntry { public final String name; public final Type type;
193,042
import org.spongepowered.api.world.Locatable; import org.spongepowered.api.world.Location; import org.spongepowered.api.world.World; import javax.annotation.Nullable; import java.util.*; <BUG>import java.util.stream.Collectors; import static net.foxdenstudio.sponge.foxcore.plugin.util.Aliases.*;</BUG> public class CommandHere extends FCCommandBase { private static final String[] PRIORITY_ALIASES = {"priority", "prio", "p"}; private static final FlagMapper MAPPER = map -> key -> value -> {
import org.spongepowered.api.world.Locatable; import org.spongepowered.api.world.Location; import org.spongepowered.api.world.World; import javax.annotation.Nullable; import java.util.*; import java.util.stream.Collectors; import java.util.stream.Stream; import static net.foxdenstudio.sponge.foxcore.plugin.util.Aliases.*; public class CommandHere extends FCCommandBase { private static final String[] PRIORITY_ALIASES = {"priority", "prio", "p"}; private static final FlagMapper MAPPER = map -> key -> value -> {
193,043
import net.foxdenstudio.sponge.foxguard.plugin.handler.GlobalHandler; import net.foxdenstudio.sponge.foxguard.plugin.handler.IHandler; import net.foxdenstudio.sponge.foxguard.plugin.object.IFGObject; import net.foxdenstudio.sponge.foxguard.plugin.object.IGlobal; import net.foxdenstudio.sponge.foxguard.plugin.region.IRegion; <BUG>import net.foxdenstudio.sponge.foxguard.plugin.region.world.GlobalWorldRegion;</BUG> import org.spongepowered.api.Sponge; import org.spongepowered.api.command.CommandException; import org.spongepowered.api.command.CommandResult; import org.spongepowered.api.command.CommandSource; import org.spongepowered.api.command.args.ArgumentParseException; <BUG>import org.spongepowered.api.entity.living.player.Player;</BUG> import org.spongepowered.api.text.Text;
import net.foxdenstudio.sponge.foxguard.plugin.handler.GlobalHandler; import net.foxdenstudio.sponge.foxguard.plugin.handler.IHandler; import net.foxdenstudio.sponge.foxguard.plugin.object.IFGObject; import net.foxdenstudio.sponge.foxguard.plugin.object.IGlobal; import net.foxdenstudio.sponge.foxguard.plugin.region.IRegion; import org.spongepowered.api.Sponge; import org.spongepowered.api.command.CommandException; import org.spongepowered.api.command.CommandResult; import org.spongepowered.api.command.CommandSource; import org.spongepowered.api.command.args.ArgumentParseException; import org.spongepowered.api.text.Text;
193,044
import org.spongepowered.api.world.Locatable; import org.spongepowered.api.world.Location; import org.spongepowered.api.world.World; import javax.annotation.Nullable; import java.util.List; <BUG>import java.util.Optional; import static net.foxdenstudio.sponge.foxcore.plugin.util.Aliases.*;</BUG> public class CommandDelete extends FCCommandBase { private static final FlagMapper MAPPER = map -> key -> value -> { map.put(key, value);
import org.spongepowered.api.world.Locatable; import org.spongepowered.api.world.Location; import org.spongepowered.api.world.World; import javax.annotation.Nullable; import java.util.List; import java.util.Optional; import java.util.stream.Stream; import static net.foxdenstudio.sponge.foxcore.plugin.util.Aliases.*; public class CommandDelete extends FCCommandBase { private static final FlagMapper MAPPER = map -> key -> value -> { map.put(key, value);
193,045
.append(Text.of(TextColors.GREEN, "Usage: ")) .append(getUsage(source)) .build()); return CommandResult.empty(); } else if (isIn(REGIONS_ALIASES, parse.args[0])) { <BUG>if (parse.args.length < 2) throw new CommandException(Text.of("Must specify a name!")); IRegion region = FGManager.getInstance().getRegion(parse.args[1]); </BUG> boolean isWorldRegion = false; if (region == null) {
.append(Text.of(TextColors.GREEN, "Usage: ")) .append(getUsage(source)) .build()); return CommandResult.empty(); } else if (isIn(REGIONS_ALIASES, parse.args[0])) { if (parse.args.length < 2) throw new CommandException(Text.of("Must specify a name!")); String regionName = parse.args[1]; IRegion region = FGManager.getInstance().getRegion(regionName).orElse(null); boolean isWorldRegion = false; if (region == null) {
193,046
</BUG> isWorldRegion = true; } if (region == null) <BUG>throw new CommandException(Text.of("No region exists with the name \"" + parse.args[1] + "\"!")); if (region instanceof GlobalWorldRegion) { </BUG> throw new CommandException(Text.of("You may not delete the global region!")); }
if (world == null) throw new CommandException(Text.of("No world exists with name \"" + worldName + "\"!")); } } if (world == null) throw new CommandException(Text.of("Must specify a world!")); region = FGManager.getInstance().getWorldRegion(world, regionName).orElse(null); isWorldRegion = true; } if (region == null) throw new CommandException(Text.of("No region exists with the name \"" + regionName + "\"!")); if (region instanceof IGlobal) { throw new CommandException(Text.of("You may not delete the global region!")); }
193,047
source.getName() + " deleted " + (isWorldRegion ? "world" : "") + "region" ); return CommandResult.success(); } else if (isIn(HANDLERS_ALIASES, parse.args[0])) { if (parse.args.length < 2) throw new CommandException(Text.of("Must specify a name!")); <BUG>IHandler handler = FGManager.getInstance().gethandler(parse.args[1]); if (handler == null) throw new ArgumentParseException(Text.of("No handler exists with that name!"), parse.args[1], 1); if (handler instanceof GlobalHandler)</BUG> throw new CommandException(Text.of("You may not delete the global handler!"));
source.getName() + " deleted " + (isWorldRegion ? "world" : "") + "region" ); return CommandResult.success(); } else if (isIn(HANDLERS_ALIASES, parse.args[0])) { if (parse.args.length < 2) throw new CommandException(Text.of("Must specify a name!")); Optional<IHandler> handlerOpt = FGManager.getInstance().gethandler(parse.args[1]); if (!handlerOpt.isPresent()) throw new ArgumentParseException(Text.of("No handler exists with that name!"), parse.args[1], 1); IHandler handler = handlerOpt.get(); if (handler instanceof GlobalHandler) throw new CommandException(Text.of("You may not delete the global handler!"));
193,048
.excludeCurrent(true) .autoCloseQuotes(true) .parse(); if (parse.current.type.equals(AdvCmdParser.CurrentElement.ElementType.ARGUMENT)) { if (parse.current.index == 0) <BUG>return ImmutableList.of("region", "handler").stream() .filter(new StartsWithPredicate(parse.current.token))</BUG> .map(args -> parse.current.prefix + args) .collect(GuavaCollectors.toImmutableList()); else if (parse.current.index == 1) {
.excludeCurrent(true) .autoCloseQuotes(true) .parse(); if (parse.current.type.equals(AdvCmdParser.CurrentElement.ElementType.ARGUMENT)) { if (parse.current.index == 0) return Stream.of("region", "handler") .filter(new StartsWithPredicate(parse.current.token)) .map(args -> parse.current.prefix + args) .collect(GuavaCollectors.toImmutableList()); else if (parse.current.index == 1) {
193,049
.excludeCurrent(true) .autoCloseQuotes(true) .parse(); if (parse.current.type.equals(AdvCmdParser.CurrentElement.ElementType.ARGUMENT)) { if (parse.current.index == 0) <BUG>return ImmutableList.of("region", "handler").stream() .filter(new StartsWithPredicate(parse.current.token))</BUG> .map(args -> parse.current.prefix + args) .collect(GuavaCollectors.toImmutableList()); else if (parse.current.index == 1) {
.excludeCurrent(true) .autoCloseQuotes(true) .parse(); if (parse.current.type.equals(AdvCmdParser.CurrentElement.ElementType.ARGUMENT)) { if (parse.current.index == 0) return Stream.of("region", "handler") .filter(new StartsWithPredicate(parse.current.token)) .map(args -> parse.current.prefix + args) .collect(GuavaCollectors.toImmutableList()); else if (parse.current.index == 1) {
193,050
.autoCloseQuotes(true) .leaveFinalAsIs(true) .parse(); if (parse.current.type.equals(AdvCmdParser.CurrentElement.ElementType.ARGUMENT)) { if (parse.current.index == 0) <BUG>return ImmutableList.of("region", "worldregion", "handler", "controller").stream() </BUG> .filter(new StartsWithPredicate(parse.current.token)) .collect(GuavaCollectors.toImmutableList()); else if (parse.current.index == 1) {
.autoCloseQuotes(true) .leaveFinalAsIs(true) .parse(); if (parse.current.type.equals(AdvCmdParser.CurrentElement.ElementType.ARGUMENT)) { if (parse.current.index == 0) return Stream.of("region", "worldregion", "handler", "controller") .filter(new StartsWithPredicate(parse.current.token)) .collect(GuavaCollectors.toImmutableList()); else if (parse.current.index == 1) {
193,051
.excludeCurrent(true) .autoCloseQuotes(true) .parse(); if (parse.current.type.equals(AdvCmdParser.CurrentElement.ElementType.ARGUMENT)) { if (parse.current.index == 0) <BUG>return ImmutableList.of("region", "handler").stream() .filter(new StartsWithPredicate(parse.current.token))</BUG> .map(args -> parse.current.prefix + args) .collect(GuavaCollectors.toImmutableList()); else if (parse.current.index > 0) {
.excludeCurrent(true) .autoCloseQuotes(true) .parse(); if (parse.current.type.equals(AdvCmdParser.CurrentElement.ElementType.ARGUMENT)) { if (parse.current.index == 0) return Stream.of("region", "handler") .filter(new StartsWithPredicate(parse.current.token)) .map(args -> parse.current.prefix + args) .collect(GuavaCollectors.toImmutableList()); else if (parse.current.index > 0) {
193,052
@Dependency(id = "foxcore") }, description = "A world protection plugin built for SpongeAPI. Requires FoxCore.", authors = {"gravityfox"}, url = "https://github.com/FoxDenStudio/FoxGuard") <BUG>public final class FoxGuardMain { public final Cause pluginCause = Cause.builder().named("plugin", this).build(); private static FoxGuardMain instanceField;</BUG> @Inject private Logger logger;
@Dependency(id = "foxcore") }, description = "A world protection plugin built for SpongeAPI. Requires FoxCore.", authors = {"gravityfox"}, url = "https://github.com/FoxDenStudio/FoxGuard") public final class FoxGuardMain { private static FoxGuardMain instanceField; public final Cause pluginCause = Cause.builder().named("plugin", this).build(); @Inject private Logger logger;
193,053
private UserStorageService userStorage; private EconomyService economyService = null; private boolean loaded = false; private FCCommandDispatcher fgDispatcher; public static FoxGuardMain instance() { <BUG>return instanceField; }</BUG> @Listener public void construct(GameConstructionEvent event) { instanceField = this;
private UserStorageService userStorage; private EconomyService economyService = null; private boolean loaded = false; private FCCommandDispatcher fgDispatcher; public static FoxGuardMain instance() { return instanceField; } public static Cause getCause() { return instance().pluginCause; } @Listener public void construct(GameConstructionEvent event) { instanceField = this;
193,054
return configDirectory; } public boolean isLoaded() { return loaded; } <BUG>public static Cause getCause() { return instance().pluginCause; }</BUG> public EconomyService getEconomyService() { return economyService;
return configDirectory; } public boolean isLoaded() { return loaded; } public EconomyService getEconomyService() { return economyService;
193,055
private final BufferedImage icyLogo; private final int bgImgWidth; private final int bgImgHeight; private final Color textColor; private final Color bgTextColor; <BUG>private BufferedImage cachedImage; private int cachedImgWidth; private int cachedImgHeight; private Color lastBGColor;</BUG> public BackgroundDesktopOverlay()
private final BufferedImage icyLogo; private final int bgImgWidth; private final int bgImgHeight; private final Color textColor; private final Color bgTextColor; public BackgroundDesktopOverlay()
193,056
private int cachedImgHeight; private Color lastBGColor;</BUG> public BackgroundDesktopOverlay() { super(); <BUG>backGround = ResourceUtil.getImage(BACKGROUND_PATH + Integer.toString(Random.nextInt(1)) + ".jpg"); </BUG> icyLogo = ResourceUtil.getImage("logoICY.png"); textColor = new Color(0, 0, 0, 0.5f); bgTextColor = new Color(1, 1, 1, 0.5f);
private final BufferedImage icyLogo; private final int bgImgWidth; private final int bgImgHeight; private final Color textColor; private final Color bgTextColor; public BackgroundDesktopOverlay() { super(); backGround = ImageUtil.toGray(ResourceUtil.getImage(BACKGROUND_PATH + Integer.toString(Random.nextInt(1)) + ".jpg")); icyLogo = ResourceUtil.getImage("logoICY.png"); textColor = new Color(0, 0, 0, 0.5f); bgTextColor = new Color(1, 1, 1, 0.5f);
193,057
icyLogo = ResourceUtil.getImage("logoICY.png"); textColor = new Color(0, 0, 0, 0.5f); bgTextColor = new Color(1, 1, 1, 0.5f); bgImgWidth = backGround.getWidth(); bgImgHeight = backGround.getHeight(); <BUG>cachedImgWidth = bgImgWidth * 2; cachedImgHeight = bgImgHeight * 2; lastBGColor = Color.gray; run();</BUG> }
icyLogo = ResourceUtil.getImage("logoICY.png"); textColor = new Color(0, 0, 0, 0.5f); bgTextColor = new Color(1, 1, 1, 0.5f); bgImgWidth = backGround.getWidth(); bgImgHeight = backGround.getHeight(); }
193,058
rect.y = limit; return true; } return false; } <BUG>public Viewer[] getInternalViewers(boolean wantNotVisible, boolean wantIconized) </BUG> { final List<Viewer> result = new ArrayList<Viewer>(); for (Viewer viewer : Icy.getMainInterface().getViewers())
rect.y = limit; return true; } return false; } public static Viewer[] getInternalViewers(boolean wantNotVisible, boolean wantIconized) { final List<Viewer> result = new ArrayList<Viewer>(); for (Viewer viewer : Icy.getMainInterface().getViewers())
193,059
addItem(PluginLoader.getPlugin(className)); } void addItem(PluginDescriptor plugin) { if ((plugin != null) && plugin.isActionable()) <BUG>{ final IcyCommandButton pluginButton = PluginCommandButton.createButton(plugin);</BUG> newPluginsBandDef.addItem(plugin.getClassName(), RibbonElementPriority.TOP); systemWorkspace.save(); newPluginsBand.addCommandButton(pluginButton, RibbonElementPriority.TOP);
addItem(PluginLoader.getPlugin(className)); } void addItem(PluginDescriptor plugin) { if ((plugin != null) && plugin.isActionable()) { plugin.loadIcon(); final IcyCommandButton pluginButton = PluginCommandButton.createButton(plugin); newPluginsBandDef.addItem(plugin.getClassName(), RibbonElementPriority.TOP); systemWorkspace.save(); newPluginsBand.addCommandButton(pluginButton, RibbonElementPriority.TOP);
193,060
if (item != null) { final AbstractCommandButton button = RibbonUtil.findButton( RibbonUtil.getBand(RibbonUtil.getTask(ribbon, item.getTaskName()), item.getBandName()), item.getClassName()); <BUG>if (button != null) PluginCommandButton.setButton(button, plugin); }</BUG> else {
if (item != null) { final AbstractCommandButton button = RibbonUtil.findButton( RibbonUtil.getBand(RibbonUtil.getTask(ribbon, item.getTaskName()), item.getBandName()), item.getClassName()); if (button != null) { plugin.loadIcon(); PluginCommandButton.setButton(button, plugin); } } else {
193,061
final List<PluginDescriptor> sequenceImporterPlugins = PluginLoader.getPlugins(SequenceImporter.class); if (!sequenceImporterPlugins.isEmpty()) { importPanel.addButtonGroup("Sequence importer"); for (PluginDescriptor plugin : sequenceImporterPlugins) <BUG>{ final AbstractCommandButton button = PluginCommandButton.createButton(plugin, false, false);</BUG> button.addActionListener(new ActionListener() { @Override
final List<PluginDescriptor> sequenceImporterPlugins = PluginLoader.getPlugins(SequenceImporter.class); if (!sequenceImporterPlugins.isEmpty()) { importPanel.addButtonGroup("Sequence importer"); for (PluginDescriptor plugin : sequenceImporterPlugins) { plugin.loadIcon(); final AbstractCommandButton button = PluginCommandButton.createButton(plugin, false, false); button.addActionListener(new ActionListener() { @Override
193,062
final boolean canSetBounds = (roi != null) ? roi.canSetBounds() : false; final boolean canSetPosition = (roi != null) ? roi.canSetPosition() : false; final boolean hasROIinClipboard = Clipboard.isType(Clipboard.TYPE_ROILIST); final boolean hasROILinkinClipboard = Clipboard.isType(Clipboard.TYPE_ROILINKLIST); final boolean editable = !readOnly; <BUG>final int dim = (roi != null) ? roi.getDimension() : 0; ThreadUtil.sleep(1);</BUG> ThreadUtil.invokeNow(new Runnable() { @Override
final boolean canSetBounds = (roi != null) ? roi.canSetBounds() : false; final boolean canSetPosition = (roi != null) ? roi.canSetPosition() : false; final boolean hasROIinClipboard = Clipboard.isType(Clipboard.TYPE_ROILIST); final boolean hasROILinkinClipboard = Clipboard.isType(Clipboard.TYPE_ROILINKLIST); final boolean editable = !readOnly; final int dim = (roi != null) ? roi.getDimension() : 0; if (!hasSequence) modifiedRois = null; ThreadUtil.sleep(1); ThreadUtil.invokeNow(new Runnable() { @Override
193,063
{ super(); final String name = plugin.getName(); final String description = plugin.getDescription(); final String website = plugin.getWeb(); <BUG>final String author = plugin.getAuthor(); final ImageIcon plugIcon = plugin.getIcon();</BUG> final Image plugImg = plugin.getImage(); setTitle(name); if (plugIcon != PluginDescriptor.DEFAULT_ICON)
{ public PluginRichToolTip(PluginDescriptor plugin) { super(); final String name = plugin.getName(); final String description = plugin.getDescription(); final String website = plugin.getWeb(); final String author = plugin.getAuthor(); plugin.loadImages(); final ImageIcon plugIcon = plugin.getIcon(); final Image plugImg = plugin.getImage(); setTitle(name); if (plugIcon != PluginDescriptor.DEFAULT_ICON)
193,064
bottomPanel.add(new JSeparator(SwingConstants.HORIZONTAL), BorderLayout.NORTH); bottomPanel.add(buttonsPanel, BorderLayout.CENTER); setLayout(new BorderLayout()); add(topPanel, BorderLayout.NORTH); add(centerPanel, BorderLayout.CENTER); <BUG>add(bottomPanel, BorderLayout.SOUTH); addToDesktopPane();</BUG> setLocation(10 * Random.nextInt(20) + 40, 10 * Random.nextInt(10) + 40); setVisible(true); requestFocus();
bottomPanel.add(new JSeparator(SwingConstants.HORIZONTAL), BorderLayout.NORTH); bottomPanel.add(buttonsPanel, BorderLayout.CENTER); setLayout(new BorderLayout()); add(topPanel, BorderLayout.NORTH); add(centerPanel, BorderLayout.CENTER); add(bottomPanel, BorderLayout.SOUTH); updateGui(); addToDesktopPane(); setLocation(10 * Random.nextInt(20) + 40, 10 * Random.nextInt(10) + 40); setVisible(true); requestFocus();
193,065
} }); } }); } <BUG>else updateGui();</BUG> } void updateGui() {
} }); } }); } } void updateGui() {
193,066
void updateGui() { final Font sysFont = pluginAuthorLabel.getFont(); final Image img = plugin.getImage(); final String description = plugin.getDescription(); <BUG>final String changesLog = plugin.getChangesLog(); final String author = plugin.getAuthor();</BUG> final String email = plugin.getEmail(); <BUG>final String web = plugin.getWeb(); pluginImage.setImage(img);</BUG> if (StringUtil.isEmpty(description))
void updateGui() { final Font sysFont = pluginAuthorLabel.getFont(); final Image img = plugin.getImage(); final String description = plugin.getDescription(); final String changesLog = plugin.getChangeLog(); final String author = plugin.getAuthor(); final String email = plugin.getEmail(); final String web = plugin.getWeb(); if (img == null) pluginImage.setImage(PluginDescriptor.DEFAULT_IMAGE); else pluginImage.setImage(img); if (StringUtil.isEmpty(description))
193,067
<BUG>package org.apache.commons.jcs.auxiliary.lateral.socket.tcp; import org.apache.commons.jcs.auxiliary.lateral.LateralElementDescriptor;</BUG> import org.apache.commons.jcs.auxiliary.lateral.socket.tcp.behavior.ITCPLateralCacheAttributes; import org.apache.commons.jcs.io.ObjectInputStreamClassLoaderAware; import org.apache.commons.logging.Log;
package org.apache.commons.jcs.auxiliary.lateral.socket.tcp; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.net.InetSocketAddress; import java.net.Socket; import org.apache.commons.jcs.auxiliary.lateral.LateralElementDescriptor; import org.apache.commons.jcs.auxiliary.lateral.socket.tcp.behavior.ITCPLateralCacheAttributes; import org.apache.commons.jcs.io.ObjectInputStreamClassLoaderAware; import org.apache.commons.logging.Log;
193,068
import org.apache.commons.jcs.auxiliary.lateral.LateralElementDescriptor;</BUG> import org.apache.commons.jcs.auxiliary.lateral.socket.tcp.behavior.ITCPLateralCacheAttributes; import org.apache.commons.jcs.io.ObjectInputStreamClassLoaderAware; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; <BUG>import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.net.InetSocketAddress; import java.net.Socket;</BUG> public class LateralTCPSender
package org.apache.commons.jcs.auxiliary.lateral.socket.tcp; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.net.InetSocketAddress; import java.net.Socket; import org.apache.commons.jcs.auxiliary.lateral.LateralElementDescriptor; import org.apache.commons.jcs.auxiliary.lateral.socket.tcp.behavior.ITCPLateralCacheAttributes; import org.apache.commons.jcs.io.ObjectInputStreamClassLoaderAware; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; public class LateralTCPSender
193,069
<BUG>package org.apache.commons.jcs.access; import org.apache.commons.jcs.JCS;</BUG> import org.apache.commons.jcs.access.behavior.ICacheAccess; import org.apache.commons.jcs.access.exception.CacheException; import org.apache.commons.jcs.access.exception.ConfigurationException;
package org.apache.commons.jcs.access; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Set; import org.apache.commons.jcs.JCS; import org.apache.commons.jcs.access.behavior.ICacheAccess; import org.apache.commons.jcs.access.exception.CacheException; import org.apache.commons.jcs.access.exception.ConfigurationException;
193,070
import org.apache.commons.jcs.engine.behavior.ICompositeCacheAttributes; import org.apache.commons.jcs.engine.behavior.IElementAttributes; import org.apache.commons.jcs.engine.stats.behavior.ICacheStats; import org.apache.commons.jcs.utils.props.AbstractPropertyContainer; import org.apache.commons.logging.Log; <BUG>import org.apache.commons.logging.LogFactory; import java.io.Serializable; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Set; public class PartitionedCacheAccess<K extends Serializable, V extends Serializable></BUG> extends AbstractPropertyContainer
import org.apache.commons.jcs.engine.behavior.ICompositeCacheAttributes; import org.apache.commons.jcs.engine.behavior.IElementAttributes; import org.apache.commons.jcs.engine.stats.behavior.ICacheStats; import org.apache.commons.jcs.utils.props.AbstractPropertyContainer; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; public class PartitionedCacheAccess<K, V> extends AbstractPropertyContainer
193,071
<BUG>package org.apache.commons.jcs.auxiliary.remote.http.server; import org.apache.commons.jcs.engine.behavior.ICacheElement;</BUG> import org.apache.commons.jcs.engine.behavior.ICacheServiceNonLocal; import org.apache.commons.jcs.engine.behavior.ICompositeCacheManager; import org.apache.commons.jcs.engine.control.CompositeCache;
package org.apache.commons.jcs.auxiliary.remote.http.server; import java.io.IOException; import java.io.Serializable; import java.util.Map; import java.util.Set; import org.apache.commons.jcs.engine.behavior.ICacheElement; import org.apache.commons.jcs.engine.behavior.ICacheServiceNonLocal; import org.apache.commons.jcs.engine.behavior.ICompositeCacheManager; import org.apache.commons.jcs.engine.control.CompositeCache;
193,072
import org.apache.commons.jcs.engine.control.CompositeCache; import org.apache.commons.jcs.engine.logging.CacheEvent; import org.apache.commons.jcs.engine.logging.behavior.ICacheEvent; import org.apache.commons.jcs.engine.logging.behavior.ICacheEventLogger; import org.apache.commons.logging.Log; <BUG>import org.apache.commons.logging.LogFactory; import java.io.IOException; import java.io.Serializable; import java.util.Map; import java.util.Set; public abstract class AbstractRemoteCacheService<K extends Serializable, V extends Serializable></BUG> implements ICacheServiceNonLocal<K, V>
import org.apache.commons.jcs.engine.control.CompositeCache; import org.apache.commons.jcs.engine.logging.CacheEvent; import org.apache.commons.jcs.engine.logging.behavior.ICacheEvent; import org.apache.commons.jcs.engine.logging.behavior.ICacheEventLogger; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; public abstract class AbstractRemoteCacheService<K, V> implements ICacheServiceNonLocal<K, V>
193,073
if ( cacheEventLogger != null ) { cacheEventLogger.logApplicationEvent( source, eventName, optionalDetails ); } } <BUG>protected <T extends Serializable> void logICacheEvent( ICacheEvent<T> cacheEvent ) {</BUG> if ( cacheEventLogger != null ) { cacheEventLogger.logICacheEvent( cacheEvent );
if ( cacheEventLogger != null ) { cacheEventLogger.logApplicationEvent( source, eventName, optionalDetails ); } } protected <T> void logICacheEvent( ICacheEvent<T> cacheEvent ) { if ( cacheEventLogger != null ) { cacheEventLogger.logICacheEvent( cacheEvent );
193,074
<BUG>package org.apache.commons.jcs.auxiliary.remote.http.server; import org.apache.commons.jcs.engine.behavior.ICacheElement;</BUG> import org.apache.commons.jcs.engine.behavior.ICompositeCacheManager; import org.apache.commons.jcs.engine.control.CompositeCache; <BUG>import org.apache.commons.jcs.engine.logging.behavior.ICacheEventLogger; import java.io.IOException; import java.io.Serializable; import java.util.Map; import java.util.Set; public class RemoteHttpCacheService<K extends Serializable, V extends Serializable></BUG> extends AbstractRemoteCacheService<K, V>
package org.apache.commons.jcs.auxiliary.remote.http.server; import java.io.IOException; import java.util.Map; import java.util.Set; import org.apache.commons.jcs.engine.behavior.ICacheElement; import org.apache.commons.jcs.engine.behavior.ICompositeCacheManager; import org.apache.commons.jcs.engine.control.CompositeCache; import org.apache.commons.jcs.engine.logging.behavior.ICacheEventLogger; public class RemoteHttpCacheService<K, V> extends AbstractRemoteCacheService<K, V>
193,075
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,076
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,077
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,078
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,079
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,080
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,081
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,082
<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,083
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,084
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,085
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,086
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,087
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,088
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,089
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,090
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,091
} 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,092
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,093
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,094
RecordingSize supportedRecordingSize = wrapper.getSupportedRecordingSize(320, 240); assertEquals(supportedRecordingSize.width, 640); assertEquals(supportedRecordingSize.height, 480); } @Test <BUG>public void getSupportedVideoSizesHoneyComb() { NativeCamera mockCamera = mock(NativeCamera.class); configureMockCameraParameters(mockCamera, 640, 480, 1280, 960); final CameraWrapper wrapper = spy(new CameraWrapper(mockCamera, Surface.ROTATION_0)); List<Size> supportedVideoSizes = wrapper.getSupportedVideoSizes(VERSION_CODES.HONEYCOMB);</BUG> assertEquals(640, supportedVideoSizes.get(0).width);
RecordingSize supportedRecordingSize = wrapper.getSupportedRecordingSize(320, 240); assertEquals(supportedRecordingSize.width, 640); assertEquals(supportedRecordingSize.height, 480); } @Test public void getSupportedVideoSizesHoneyComb() { NativeCamera mockCamera = createCameraWithMockParameters(640, 480, 1280, 960); final CameraWrapper wrapper = new CameraWrapper(mockCamera, Surface.ROTATION_0); List<Size> supportedVideoSizes = wrapper.getSupportedVideoSizes(VERSION_CODES.HONEYCOMB); assertEquals(640, supportedVideoSizes.get(0).width);
193,095
verify(mockCamera, times(1)).updateNativeCameraParameters(mockParameters); } @Test public void setPreviewFormatWhenConfiguringCamera() throws Exception { NativeCamera mockCamera = mock(NativeCamera.class); <BUG>Parameters mockParameters = createMockParametersWithPreviewSize(800, 600); </BUG> doReturn(mockParameters).when(mockCamera).getNativeCameraParameters(); final CameraWrapper wrapper = new CameraWrapper(mockCamera, 0); wrapper.configureForPreview(800, 600);
verify(mockCamera, times(1)).updateNativeCameraParameters(mockParameters); } @Test public void setPreviewFormatWhenConfiguringCamera() throws Exception { NativeCamera mockCamera = mock(NativeCamera.class); Parameters mockParameters = createMockParameters(0, 0, 800, 600); doReturn(mockParameters).when(mockCamera).getNativeCameraParameters(); final CameraWrapper wrapper = new CameraWrapper(mockCamera, 0); wrapper.configureForPreview(800, 600);
193,096
verify(mockParameters, times(1)).setPreviewFormat(ImageFormat.NV21); } @Test public void setPreviewSizeWhenConfiguringCamera() throws Exception { NativeCamera mockCamera = mock(NativeCamera.class); <BUG>Parameters mockParameters = createMockParametersWithPreviewSize(300, 700); </BUG> doReturn(mockParameters).when(mockCamera).getNativeCameraParameters(); final CameraWrapper wrapper = new CameraWrapper(mockCamera, 0); wrapper.configureForPreview(800, 600);
verify(mockParameters, times(1)).setPreviewFormat(ImageFormat.NV21); } @Test public void setPreviewSizeWhenConfiguringCamera() throws Exception { NativeCamera mockCamera = mock(NativeCamera.class); Parameters mockParameters = createMockParameters(0, 0, 300, 700); doReturn(mockParameters).when(mockCamera).getNativeCameraParameters(); final CameraWrapper wrapper = new CameraWrapper(mockCamera, 0); wrapper.configureForPreview(800, 600);
193,097
verify(mockParameters, times(1)).setPreviewSize(300, 700); } @Test public void updateParametersWhenConfiguringCamera() throws Exception { NativeCamera mockCamera = mock(NativeCamera.class); <BUG>Parameters mockParameters = createMockParametersWithPreviewSize(800, 600); </BUG> doReturn(mockParameters).when(mockCamera).getNativeCameraParameters(); final CameraWrapper wrapper = new CameraWrapper(mockCamera, 0); wrapper.configureForPreview(800, 600);
verify(mockParameters, times(1)).setPreviewSize(300, 700); } @Test public void updateParametersWhenConfiguringCamera() throws Exception { NativeCamera mockCamera = mock(NativeCamera.class); Parameters mockParameters = createMockParameters(0, 0, 800, 600); doReturn(mockParameters).when(mockCamera).getNativeCameraParameters(); final CameraWrapper wrapper = new CameraWrapper(mockCamera, 0); wrapper.configureForPreview(800, 600);
193,098
package com.shatteredpixel.shatteredpixeldungeon.scenes; import android.opengl.GLES20; import com.shatteredpixel.shatteredpixeldungeon.Assets; import com.shatteredpixel.shatteredpixeldungeon.Badges; <BUG>import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.tiles.DungeonTerrainTilemap;</BUG> import com.shatteredpixel.shatteredpixeldungeon.tiles.DungeonTilemap; import com.shatteredpixel.shatteredpixeldungeon.tiles.FogOfWar; import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
package com.shatteredpixel.shatteredpixeldungeon.scenes; import android.opengl.GLES20; import com.shatteredpixel.shatteredpixeldungeon.Assets; import com.shatteredpixel.shatteredpixeldungeon.Badges; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.tiles.GridTileMap; import com.shatteredpixel.shatteredpixeldungeon.tiles.DungeonTerrainTilemap; import com.shatteredpixel.shatteredpixeldungeon.tiles.DungeonTilemap; import com.shatteredpixel.shatteredpixeldungeon.tiles.FogOfWar; import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
193,099
import java.util.ArrayList; import java.util.Locale; public class GameScene extends PixelScene { static GameScene scene; private SkinnedBlock water; <BUG>private DungeonTerrainTilemap tiles; private TerrainFeaturesTilemap terrainFeatures;</BUG> private DungeonWallsTilemap walls; private WallBlockingTilemap wallBlocking; private FogOfWar fog;
import java.util.ArrayList; import java.util.Locale; public class GameScene extends PixelScene { static GameScene scene; private SkinnedBlock water; private DungeonTerrainTilemap tiles; private GridTileMap visualGrid; private TerrainFeaturesTilemap terrainFeatures; private DungeonWallsTilemap walls; private WallBlockingTilemap wallBlocking; private FogOfWar fog;
193,100
terrain.add( tiles ); customTiles = new Group(); terrain.add(customTiles); for( CustomTileVisual visual : Dungeon.level.customTiles){ addCustomTile(visual.create()); <BUG>} terrainFeatures = new TerrainFeaturesTilemap(Dungeon.level.plants, Dungeon.level.traps);</BUG> terrain.add(terrainFeatures); levelVisuals = Dungeon.level.addVisuals(); add(levelVisuals);
terrain.add( tiles ); customTiles = new Group(); terrain.add(customTiles); for( CustomTileVisual visual : Dungeon.level.customTiles){ addCustomTile(visual.create()); } visualGrid = new GridTileMap(); terrain.add( visualGrid ); terrainFeatures = new TerrainFeaturesTilemap(Dungeon.level.plants, Dungeon.level.traps); terrain.add(terrainFeatures); levelVisuals = Dungeon.level.addVisuals(); add(levelVisuals);