id
int64
1
49k
buggy
stringlengths
34
37.5k
fixed
stringlengths
2
37k
45,701
final int pixelStride = dst.getPixelStride(); final int[] bandOffsets = dst.getBandOffsets(); final short[][] data = dst.getShortDataArrays(); final float[] warpData = new float[2 * dstWidth]; int lineOffset = 0; <BUG>if (caseA) { for (int h = 0; h < dstHeight; h++) {</BUG> int pixelOffset = lineOffset; lineOffset += lineStride; warp.warpRect(dst.getX(), dst.getY() + h, dstWidth, 1, warpData);
if(hasROI && !roiContainsTile && roiIter == null){ throw new IllegalArgumentException("Error on creating the ROI iterator"); } if (caseA || (caseB && roiContainsTile)) { for (int h = 0; h < dstHeight; h++) {
45,702
minX = src.getMinX(); maxX = src.getMaxX(); minY = src.getMinY(); maxY = src.getMaxY(); } else { <BUG>iterSource = RandomIterFactory.create(src, src.getBounds(), TILE_CACHED, ARRAY_CALC); minX = src.getMinX() + 1; // Left padding maxX = src.getMaxX() - 2; // Right padding minY = src.getMinY() + 1; // Top padding maxY = src.getMaxY() - 2; // Bottom padding </BUG> }
iterSource = getRandomIterator(src, null); minX = src.getMinX() + leftPad; // Left padding maxX = src.getMaxX() - rightPad; // Right padding minY = src.getMinY() + topPad; // Top padding maxY = src.getMaxY() - bottomPad; // Bottom padding
45,703
final int pixelStride = dst.getPixelStride(); final int[] bandOffsets = dst.getBandOffsets(); final short[][] data = dst.getShortDataArrays(); final float[] warpData = new float[2 * dstWidth]; int lineOffset = 0; <BUG>if (caseA) { for (int h = 0; h < dstHeight; h++) {</BUG> int pixelOffset = lineOffset; lineOffset += lineStride; warp.warpRect(dst.getX(), dst.getY() + h, dstWidth, 1, warpData);
if(hasROI && !roiContainsTile && roiIter == null){ throw new IllegalArgumentException("Error on creating the ROI iterator"); } if (caseA || (caseB && roiContainsTile)) { for (int h = 0; h < dstHeight; h++) {
45,704
minX = src.getMinX(); maxX = src.getMaxX(); minY = src.getMinY(); maxY = src.getMaxY(); } else { <BUG>iterSource = RandomIterFactory.create(src, src.getBounds(), TILE_CACHED, ARRAY_CALC); minX = src.getMinX() + 1; // Left padding maxX = src.getMaxX() - 2; // Right padding minY = src.getMinY() + 1; // Top padding maxY = src.getMaxY() - 2; // Bottom padding </BUG> }
iterSource = getRandomIterator(src, null); minX = src.getMinX() + leftPad; // Left padding maxX = src.getMaxX() - rightPad; // Right padding minY = src.getMinY() + topPad; // Top padding maxY = src.getMaxY() - bottomPad; // Bottom padding
45,705
final int pixelStride = dst.getPixelStride(); final int[] bandOffsets = dst.getBandOffsets(); final int[][] data = dst.getIntDataArrays(); final float[] warpData = new float[2 * dstWidth]; int lineOffset = 0; <BUG>if (caseA) { for (int h = 0; h < dstHeight; h++) {</BUG> int pixelOffset = lineOffset; lineOffset += lineStride; warp.warpRect(dst.getX(), dst.getY() + h, dstWidth, 1, warpData);
if(hasROI && !roiContainsTile && roiIter == null){ throw new IllegalArgumentException("Error on creating the ROI iterator"); } if (caseA || (caseB && roiContainsTile)) { for (int h = 0; h < dstHeight; h++) {
45,706
minX = src.getMinX(); maxX = src.getMaxX(); minY = src.getMinY(); maxY = src.getMaxY(); } else { <BUG>iterSource = RandomIterFactory.create(src, src.getBounds(), TILE_CACHED, ARRAY_CALC); minX = src.getMinX() + 1; // Left padding maxX = src.getMaxX() - 2; // Right padding minY = src.getMinY() + 1; // Top padding maxY = src.getMaxY() - 2; // Bottom padding </BUG> }
iterSource = getRandomIterator(src, null); minX = src.getMinX() + leftPad; // Left padding maxX = src.getMaxX() - rightPad; // Right padding minY = src.getMinY() + topPad; // Top padding maxY = src.getMaxY() - bottomPad; // Bottom padding
45,707
final int pixelStride = dst.getPixelStride(); final int[] bandOffsets = dst.getBandOffsets(); final float[][] data = dst.getFloatDataArrays(); final float[] warpData = new float[2 * dstWidth]; int lineOffset = 0; <BUG>if (caseA) { for (int h = 0; h < dstHeight; h++) {</BUG> int pixelOffset = lineOffset; lineOffset += lineStride; warp.warpRect(dst.getX(), dst.getY() + h, dstWidth, 1, warpData);
if(hasROI && !roiContainsTile && roiIter == null){ throw new IllegalArgumentException("Error on creating the ROI iterator"); } if (caseA || (caseB && roiContainsTile)) { for (int h = 0; h < dstHeight; h++) {
45,708
minX = src.getMinX(); maxX = src.getMaxX(); minY = src.getMinY(); maxY = src.getMaxY(); } else { <BUG>iterSource = RandomIterFactory.create(src, src.getBounds(), TILE_CACHED, ARRAY_CALC); minX = src.getMinX() + 1; // Left padding maxX = src.getMaxX() - 2; // Right padding minY = src.getMinY() + 1; // Top padding maxY = src.getMaxY() - 2; // Bottom padding </BUG> }
iterSource = getRandomIterator(src, null); minX = src.getMinX() + leftPad; // Left padding maxX = src.getMaxX() - rightPad; // Right padding minY = src.getMinY() + topPad; // Top padding maxY = src.getMaxY() - bottomPad; // Bottom padding
45,709
final int pixelStride = dst.getPixelStride(); final int[] bandOffsets = dst.getBandOffsets(); final double[][] data = dst.getDoubleDataArrays(); final float[] warpData = new float[2 * dstWidth]; int lineOffset = 0; <BUG>if (caseA) { for (int h = 0; h < dstHeight; h++) {</BUG> int pixelOffset = lineOffset; lineOffset += lineStride; warp.warpRect(dst.getX(), dst.getY() + h, dstWidth, 1, warpData);
if(hasROI && !roiContainsTile && roiIter == null){ throw new IllegalArgumentException("Error on creating the ROI iterator"); } if (caseA || (caseB && roiContainsTile)) { for (int h = 0; h < dstHeight; h++) {
45,710
menu.setEnabled(false); menubar.add(menu); menu = new Menu("Sketch"); menu.add(new MenuItem("Play")); menu.add(new MenuItem("Present")); <BUG>menu.add(new MenuItem("Stop")); menu.addActionListener(this);</BUG> menubar.add(menu); frame.setMenuBar(menubar); Insets insets = frame.getInsets();
menu.addSeparator(); menu.add(new MenuItem("Beautify")); menu.addActionListener(this);
45,711
import java.net.*; import java.util.*; import java.util.zip.*; public class PdeEditor extends Panel { static final String DEFAULT_PROGRAM = "// type program here\n"; <BUG>static final String NEW_SKETCH_ITEM = "( new sketch )"; static final String SKETCH_PREFIX_NAME = "sketch-"; static final String CODE_FILENAME = "sketch.pde";</BUG> static final String EMPTY = " "; PdeEditorButtons buttons;
[DELETED]
45,712
userName = user; skOpen(path, name); } else { skNew(); } <BUG>} catch (Exception e) { skNew();</BUG> } } public void doPlay() {
userName = "default";
45,713
sketchDir.mkdirs(); new File(sketchDir, "data").mkdirs(); new File(sketchDir, "build").mkdirs(); File sketchFile = new File(sketchDir, sketchName + ".pde"); new FileOutputStream(sketchFile); <BUG>handleOpen(sketchFile, sketchDir); </BUG> } catch (IOException e) { e.printStackTrace(); }
handleOpen(sketchName, sketchFile, sketchDir);
45,714
byte data[] = new byte[length]; int count = 0; while (count != length) { data[count++] = (byte) input.read(); } <BUG>textarea.setText(new String(data)); header.reset();</BUG> } catch (FileNotFoundException e1) { e1.printStackTrace(); } catch (IOException e2) {
sketchName = isketchName; sketchFile = isketchFile; sketchDir = isketchDir; header.reset();
45,715
e2.printStackTrace(); } buttons.clear(); } public void doSave() { <BUG>handleSave(lastFile == null); </BUG> } public void doSaveAs() { handleSave(true);
handleSave(sketchName == null);
45,716
public void doSaveAs() { handleSave(true); } protected void handleSave(boolean promptUser) { message("Saving file..."); <BUG>String s = textarea.getText(); String directory = lastDirectory; String filename = lastFile; System.out.println("1");</BUG> if (promptUser) {
String directory = sketchFile.getPath(); //lastDirectory; String filename = sketchFile.getName(); //lastFile;
45,717
buttons.clear(); return; } <BUG>handleExport(new File(directory), projectName, null); } protected void handleExport(File appletDir, String projectName, </BUG> File dataDir) { try { String program = textarea.getText();
} else if (project.indexOf(' ') != -1) { // space in filename message("Project name cannot have spaces."); handleExport(new File(directory), project, null); protected void handleExport(File appletDir, String exportSketchName,
45,718
</BUG> if (!engine.compileJava()) { return; } <BUG>String javaName = projectName + ".java"; </BUG> copyFile(new File(javaName), new File(appletDir, javaName)); int wide = BApplet.DEFAULT_WIDTH; int high = BApplet.DEFAULT_HEIGHT; int index = program.indexOf("size(");
File dataDir) { try { String program = textarea.getText(); KjcEngine engine = new KjcEngine(program, this); appletDir.mkdirs(); exportSketchName = engine.writeJava(exportSketchName, false); String javaName = exportSketchName + ".java";
45,719
PrintStream ps = new PrintStream(fos); ps.println("<HTML> <BODY BGCOLOR=\"white\">"); ps.println(); ps.println("<BR> <BR> <BR> <CENTER>"); ps.println(); <BUG>ps.print("<APPLET CODE=\"" + projectName + "\" ARCHIVE=\""); ps.print(projectName + ".jar"); </BUG> ps.println("\" WIDTH=" + wide + " HEIGHT=" + high + ">");
ps.print("<APPLET CODE=\"" + exportSketchName + "\" ARCHIVE=\""); ps.print(exportSketchName + ".jar");
45,720
ps.print(projectName + ".jar"); </BUG> ps.println("\" WIDTH=" + wide + " HEIGHT=" + high + ">"); ps.println("</APPLET>"); ps.println(); <BUG>ps.println("<A HREF=\"" + projectName + ".java\">source code</A>"); </BUG> ps.println(); ps.println("</CENTER>"); ps.println("</BODY> </HTML>");
PrintStream ps = new PrintStream(fos); ps.println("<HTML> <BODY BGCOLOR=\"white\">"); ps.println("<BR> <BR> <BR> <CENTER>"); ps.print("<APPLET CODE=\"" + exportSketchName + "\" ARCHIVE=\""); ps.print(exportSketchName + ".jar"); ps.println("<A HREF=\"" + exportSketchName + ".java\">source code</A>");
45,721
ps.close(); String exportDir = ("lib" + File.separator + "export" + File.separator); String bagelClasses[] = new File(exportDir).list(); FileOutputStream zipOutputFile = <BUG>new FileOutputStream(new File(appletDir, projectName + ".jar")); </BUG> ZipOutputStream zos = new ZipOutputStream(zipOutputFile); ZipEntry entry; for (int i = 0; i < bagelClasses.length; i++) {
new FileOutputStream(new File(appletDir, exportSketchName + ".jar"));
45,722
userTitleLeft = userLeft - PdeEditor.INSET_SIZE - metrics.stringWidth(USER_TITLER); int baseline = (sizeH + fontAscent) / 2; g.setColor(backgroundColor); g.fillRect(0, 0, imageW, imageH); <BUG>boolean boringUser = user.equals("default"); </BUG> g.setColor(secondaryColor); g.drawString(SKETCH_TITLER, sketchTitleLeft, baseline); if (!boringUser) g.drawString(USER_TITLER, userTitleLeft, baseline);
boolean boringUser = editor.userName.equals("default");
45,723
import java.util.Set; import org.opennms.netmgt.bsm.service.model.BusinessServiceDTO; import org.opennms.netmgt.bsm.service.model.IpServiceDTO; import org.opennms.netmgt.model.OnmsSeverity; public interface BusinessServiceManager { <BUG>List<BusinessServiceDTO> findAll(); Long save(BusinessServiceDTO newObject);</BUG> void update(BusinessServiceDTO objectToUpdate); BusinessServiceDTO getById(Long id); void delete(Long id);
List<BusinessServiceDTO> search(BusinessServiceSearchCriteria businessServiceSearchCriteria); Long save(BusinessServiceDTO newObject);
45,724
import java.util.Set; import java.util.stream.Collectors; import org.opennms.netmgt.bsm.persistence.api.BusinessService; import org.opennms.netmgt.bsm.persistence.api.BusinessServiceDao; import org.opennms.netmgt.bsm.persistence.api.OnmsMonitoredServiceHelper; <BUG>import org.opennms.netmgt.bsm.service.BusinessServiceManager; import org.opennms.netmgt.bsm.service.BusinessServiceStateMachine;</BUG> import org.opennms.netmgt.bsm.service.model.BusinessServiceDTO; import org.opennms.netmgt.bsm.service.model.IpServiceDTO; import org.opennms.netmgt.dao.api.MonitoredServiceDao;
import org.opennms.netmgt.bsm.service.BusinessServiceSearchCriteria; import org.opennms.netmgt.bsm.service.BusinessServiceStateMachine;
45,725
if(worldIn.getTileEntity(pos) != null){ TileEntity te = worldIn.getTileEntity(pos); if(te.hasCapability(Capabilities.HEAT_HANDLER_CAPABILITY, null) && te.getCapability(Capabilities.HEAT_HANDLER_CAPABILITY, null).getTemp() >= -273D + mult){ te.getCapability(Capabilities.HEAT_HANDLER_CAPABILITY, null).addHeat(-mult); } <BUG>for(EnumFacing dir : EnumFacing.values()){ if(te.hasCapability(Capabilities.ROTARY_HANDLER_CAPABILITY, dir)){ te.getCapability(Capabilities.ROTARY_HANDLER_CAPABILITY, dir).addEnergy(-mult, false, false); break;</BUG> }
if(te.hasCapability(Capabilities.HEAT_HANDLER_CAPABILITY, null)){ te.getCapability(Capabilities.HEAT_HANDLER_CAPABILITY, null).addHeat(mult);
45,726
public static double betterRound(double numIn, int decPlac){ double opOn = Math.round(numIn * Math.pow(10, decPlac)) / Math.pow(10D, decPlac); return opOn; } public static double centerCeil(double numIn, int tiers){ <BUG>return ((numIn > 0) ? Math.ceil(numIn * tiers) : Math.floor(numIn * tiers)) / tiers; </BUG> } public static double findEfficiency(double speedIn, double lowerLimit, double upperLimit){ speedIn = Math.abs(speedIn);
return ((numIn > 0) ? Math.ceil(numIn * (double) tiers) : Math.floor(numIn * (double) tiers)) / (double) tiers;
45,727
package com.Da_Technomancer.crossroads.API; import com.Da_Technomancer.crossroads.API.DefaultStorageHelper.DefaultStorage; import com.Da_Technomancer.crossroads.API.heat.DefaultHeatHandler; import com.Da_Technomancer.crossroads.API.heat.IHeatHandler; import com.Da_Technomancer.crossroads.API.magic.DefaultMagicHandler; <BUG>import com.Da_Technomancer.crossroads.API.magic.IMagicHandler; import com.Da_Technomancer.crossroads.API.rotary.DefaultRotaryHandler; import com.Da_Technomancer.crossroads.API.rotary.IRotaryHandler; </BUG> import net.minecraftforge.common.capabilities.Capability;
import com.Da_Technomancer.crossroads.API.rotary.DefaultAxleHandler; import com.Da_Technomancer.crossroads.API.rotary.DefaultCogHandler; import com.Da_Technomancer.crossroads.API.rotary.IAxleHandler; import com.Da_Technomancer.crossroads.API.rotary.ICogHandler;
45,728
import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.capabilities.CapabilityInject; import net.minecraftforge.common.capabilities.CapabilityManager; public class Capabilities{ @CapabilityInject(IHeatHandler.class) <BUG>public static Capability<IHeatHandler> HEAT_HANDLER_CAPABILITY = null; @CapabilityInject(IRotaryHandler.class) public static Capability<IRotaryHandler> ROTARY_HANDLER_CAPABILITY = null; </BUG> @CapabilityInject(IMagicHandler.class)
@CapabilityInject(IAxleHandler.class) public static Capability<IAxleHandler> AXLE_HANDLER_CAPABILITY = null; @CapabilityInject(ICogHandler.class) public static Capability<ICogHandler> COG_HANDLER_CAPABILITY = null;
45,729
public IEffect getMixEffect(Color col){ if(col == null){ return effect; } int top = Math.max(col.getBlue(), Math.max(col.getRed(), col.getGreen())); <BUG>if(top < rand.nextInt(128) + 128){ return voidEffect;</BUG> } return effect; }
if(top != 255){ return voidEffect;
45,730
minX = src.getMinX(); maxX = src.getMaxX(); minY = src.getMinY(); maxY = src.getMaxY(); } else { <BUG>iterSource = RandomIterFactory.create(src, src.getBounds(), TILE_CACHED, ARRAY_CALC); minX = src.getMinX() + 1; // Left padding maxX = src.getMaxX() - 2; // Right padding minY = src.getMinY() + 1; // Top padding maxY = src.getMaxY() - 2; // Bottom padding </BUG> }
iterSource = getRandomIterator(src, null); minX = src.getMinX() + leftPad; // Left padding maxX = src.getMaxX() - rightPad; // Right padding minY = src.getMinY() + topPad; // Top padding maxY = src.getMaxY() - bottomPad; // Bottom padding
45,731
final int lineStride = dst.getScanlineStride(); final int pixelStride = dst.getPixelStride(); final int[] bandOffsets = dst.getBandOffsets(); final byte[][] data = dst.getByteDataArrays(); final float[] warpData = new float[2 * dstWidth]; <BUG>int lineOffset = 0; if (ctable == null) { // source does not have IndexColorModel if (caseA) { for (int h = 0; h < dstHeight; h++) {</BUG> int pixelOffset = lineOffset;
if(hasROI && !roiContainsTile && roiIter == null){ throw new IllegalArgumentException("Error on creating the ROI iterator"); } if (caseA || (caseB && roiContainsTile)) { for (int h = 0; h < dstHeight; h++) {
45,732
pixelOffset += pixelStride; } // COLS LOOP } // ROWS LOOP } } else {// source has IndexColorModel <BUG>if (caseA) { for (int h = 0; h < dstHeight; h++) {</BUG> int pixelOffset = lineOffset; lineOffset += lineStride; warp.warpRect(dst.getX(), dst.getY() + h, dstWidth, 1, warpData);
} else if (caseB) { for (int h = 0; h < dstHeight; h++) {
45,733
minX = src.getMinX(); maxX = src.getMaxX(); minY = src.getMinY(); maxY = src.getMaxY(); } else { <BUG>iterSource = RandomIterFactory.create(src, src.getBounds(), TILE_CACHED, ARRAY_CALC); minX = src.getMinX() + 1; // Left padding maxX = src.getMaxX() - 2; // Right padding minY = src.getMinY() + 1; // Top padding maxY = src.getMaxY() - 2; // Bottom padding </BUG> }
iterSource = getRandomIterator(src, null); minX = src.getMinX() + leftPad; // Left padding maxX = src.getMaxX() - rightPad; // Right padding minY = src.getMinY() + topPad; // Top padding maxY = src.getMaxY() - bottomPad; // Bottom padding
45,734
final int pixelStride = dst.getPixelStride(); final int[] bandOffsets = dst.getBandOffsets(); final short[][] data = dst.getShortDataArrays(); final float[] warpData = new float[2 * dstWidth]; int lineOffset = 0; <BUG>if (caseA) { for (int h = 0; h < dstHeight; h++) {</BUG> int pixelOffset = lineOffset; lineOffset += lineStride; warp.warpRect(dst.getX(), dst.getY() + h, dstWidth, 1, warpData);
if(hasROI && !roiContainsTile && roiIter == null){ throw new IllegalArgumentException("Error on creating the ROI iterator"); } if (caseA || (caseB && roiContainsTile)) { for (int h = 0; h < dstHeight; h++) {
45,735
minX = src.getMinX(); maxX = src.getMaxX(); minY = src.getMinY(); maxY = src.getMaxY(); } else { <BUG>iterSource = RandomIterFactory.create(src, src.getBounds(), TILE_CACHED, ARRAY_CALC); minX = src.getMinX() + 1; // Left padding maxX = src.getMaxX() - 2; // Right padding minY = src.getMinY() + 1; // Top padding maxY = src.getMaxY() - 2; // Bottom padding </BUG> }
iterSource = getRandomIterator(src, null); minX = src.getMinX() + leftPad; // Left padding maxX = src.getMaxX() - rightPad; // Right padding minY = src.getMinY() + topPad; // Top padding maxY = src.getMaxY() - bottomPad; // Bottom padding
45,736
final int pixelStride = dst.getPixelStride(); final int[] bandOffsets = dst.getBandOffsets(); final short[][] data = dst.getShortDataArrays(); final float[] warpData = new float[2 * dstWidth]; int lineOffset = 0; <BUG>if (caseA) { for (int h = 0; h < dstHeight; h++) {</BUG> int pixelOffset = lineOffset; lineOffset += lineStride; warp.warpRect(dst.getX(), dst.getY() + h, dstWidth, 1, warpData);
if(hasROI && !roiContainsTile && roiIter == null){ throw new IllegalArgumentException("Error on creating the ROI iterator"); } if (caseA || (caseB && roiContainsTile)) { for (int h = 0; h < dstHeight; h++) {
45,737
minX = src.getMinX(); maxX = src.getMaxX(); minY = src.getMinY(); maxY = src.getMaxY(); } else { <BUG>iterSource = RandomIterFactory.create(src, src.getBounds(), TILE_CACHED, ARRAY_CALC); minX = src.getMinX() + 1; // Left padding maxX = src.getMaxX() - 2; // Right padding minY = src.getMinY() + 1; // Top padding maxY = src.getMaxY() - 2; // Bottom padding </BUG> }
iterSource = getRandomIterator(src, null); minX = src.getMinX() + leftPad; // Left padding maxX = src.getMaxX() - rightPad; // Right padding minY = src.getMinY() + topPad; // Top padding maxY = src.getMaxY() - bottomPad; // Bottom padding
45,738
final int pixelStride = dst.getPixelStride(); final int[] bandOffsets = dst.getBandOffsets(); final int[][] data = dst.getIntDataArrays(); final float[] warpData = new float[2 * dstWidth]; int lineOffset = 0; <BUG>if (caseA) { for (int h = 0; h < dstHeight; h++) {</BUG> int pixelOffset = lineOffset; lineOffset += lineStride; warp.warpRect(dst.getX(), dst.getY() + h, dstWidth, 1, warpData);
if(hasROI && !roiContainsTile && roiIter == null){ throw new IllegalArgumentException("Error on creating the ROI iterator"); } if (caseA || (caseB && roiContainsTile)) { for (int h = 0; h < dstHeight; h++) {
45,739
minX = src.getMinX(); maxX = src.getMaxX(); minY = src.getMinY(); maxY = src.getMaxY(); } else { <BUG>iterSource = RandomIterFactory.create(src, src.getBounds(), TILE_CACHED, ARRAY_CALC); minX = src.getMinX() + 1; // Left padding maxX = src.getMaxX() - 2; // Right padding minY = src.getMinY() + 1; // Top padding maxY = src.getMaxY() - 2; // Bottom padding </BUG> }
iterSource = getRandomIterator(src, null); minX = src.getMinX() + leftPad; // Left padding maxX = src.getMaxX() - rightPad; // Right padding minY = src.getMinY() + topPad; // Top padding maxY = src.getMaxY() - bottomPad; // Bottom padding
45,740
final int pixelStride = dst.getPixelStride(); final int[] bandOffsets = dst.getBandOffsets(); final float[][] data = dst.getFloatDataArrays(); final float[] warpData = new float[2 * dstWidth]; int lineOffset = 0; <BUG>if (caseA) { for (int h = 0; h < dstHeight; h++) {</BUG> int pixelOffset = lineOffset; lineOffset += lineStride; warp.warpRect(dst.getX(), dst.getY() + h, dstWidth, 1, warpData);
if(hasROI && !roiContainsTile && roiIter == null){ throw new IllegalArgumentException("Error on creating the ROI iterator"); } if (caseA || (caseB && roiContainsTile)) { for (int h = 0; h < dstHeight; h++) {
45,741
minX = src.getMinX(); maxX = src.getMaxX(); minY = src.getMinY(); maxY = src.getMaxY(); } else { <BUG>iterSource = RandomIterFactory.create(src, src.getBounds(), TILE_CACHED, ARRAY_CALC); minX = src.getMinX() + 1; // Left padding maxX = src.getMaxX() - 2; // Right padding minY = src.getMinY() + 1; // Top padding maxY = src.getMaxY() - 2; // Bottom padding </BUG> }
iterSource = getRandomIterator(src, null); minX = src.getMinX() + leftPad; // Left padding maxX = src.getMaxX() - rightPad; // Right padding minY = src.getMinY() + topPad; // Top padding maxY = src.getMaxY() - bottomPad; // Bottom padding
45,742
final int pixelStride = dst.getPixelStride(); final int[] bandOffsets = dst.getBandOffsets(); final double[][] data = dst.getDoubleDataArrays(); final float[] warpData = new float[2 * dstWidth]; int lineOffset = 0; <BUG>if (caseA) { for (int h = 0; h < dstHeight; h++) {</BUG> int pixelOffset = lineOffset; lineOffset += lineStride; warp.warpRect(dst.getX(), dst.getY() + h, dstWidth, 1, warpData);
if(hasROI && !roiContainsTile && roiIter == null){ throw new IllegalArgumentException("Error on creating the ROI iterator"); } if (caseA || (caseB && roiContainsTile)) { for (int h = 0; h < dstHeight; h++) {
45,743
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 java.util.stream.Stream; import static net.foxdenstudio.sponge.foxcore.plugin.util.Aliases.*;
45,744
.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) {
String regionName = parse.args[1]; IRegion region = FGManager.getInstance().getRegion(regionName).orElse(null);
45,745
</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); throw new CommandException(Text.of("No region exists with the name \"" + regionName + "\"!")); if (region instanceof IGlobal) {
45,746
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!"));
Optional<IHandler> handlerOpt = FGManager.getInstance().gethandler(parse.args[1]); if (!handlerOpt.isPresent()) IHandler handler = handlerOpt.get(); if (handler instanceof GlobalHandler)
45,747
.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) {
return Stream.of("region", "handler") .filter(new StartsWithPredicate(parse.current.token))
45,748
.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) {
return Stream.of("region", "handler") .filter(new StartsWithPredicate(parse.current.token))
45,749
@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;
private static FoxGuardMain instanceField;
45,750
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;
} public static Cause getCause() { return instance().pluginCause; }
45,751
return configDirectory; } public boolean isLoaded() { return loaded; } <BUG>public static Cause getCause() { return instance().pluginCause; }</BUG> public EconomyService getEconomyService() { return economyService;
[DELETED]
45,752
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 java.util.stream.Stream; import static net.foxdenstudio.sponge.foxcore.plugin.util.Aliases.*;
45,753
.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) {
return Stream.of("region", "handler") .filter(new StartsWithPredicate(parse.current.token))
45,754
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;
public final HashMap<IFGObject, Boolean> defaultModifiedMap; private final UserStorageService userStorageService; private final Logger logger = FoxGuardMain.instance().getLogger(); userStorageService = FoxGuardMain.instance().getUserStorage(); defaultModifiedMap = new CacheMap<>((k, m) -> {
45,755
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);
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()); logger.info((shouldSave ? "S" : "Force s") + "aving handler " + logName + " in directory: " + singleDir);
45,756
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);
Path singleDir = serverDir.resolve(name.toLowerCase()); logger.info((shouldSave ? "S" : "Force s") + "aving world region " + logName + " in directory: " + singleDir);
45,757
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();
Optional<IRegion> regionOpt = FGManager.getInstance().getRegion(entry.getKey()); if (regionOpt.isPresent()) { IRegion region = regionOpt.get(); logger.info("Loading links for region \"" + region.getName() + "\"");
45,758
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();
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() + "\"");
45,759
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;
public enum Type { REGION, WREGION, HANDLER
45,760
.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) {
return Stream.of("region", "worldregion", "handler", "controller")
45,761
import org.apache.hadoop.crypto.key.KeyProviderFactory; import org.apache.hadoop.fs.CommonConfigurationKeysPublic; import org.apache.hadoop.fs.Path; import org.apache.hadoop.security.Credentials; import org.apache.hadoop.security.ProviderUtils; <BUG>import org.apache.hadoop.security.UserGroupInformation; import org.apache.hadoop.security.authentication.client.AuthenticationException;</BUG> import org.apache.hadoop.security.authentication.client.ConnectionConfigurator; import org.apache.hadoop.security.ssl.SSLFactory; import org.apache.hadoop.security.token.Token;
import org.apache.hadoop.security.authentication.client.AuthenticatedURL; import org.apache.hadoop.security.authentication.client.AuthenticationException;
45,762
import org.apache.hadoop.crypto.key.KeyProviderCryptoExtension; import org.apache.hadoop.crypto.key.KeyProviderCryptoExtension.CryptoExtension; import com.google.common.base.Preconditions; @InterfaceAudience.Private public class KMSClientProvider extends KeyProvider implements CryptoExtension, <BUG>KeyProviderDelegationTokenExtension.DelegationTokenExtension { public static final String TOKEN_KIND = "kms-dt";</BUG> public static final String SCHEME_NAME = "kms"; private static final String UTF8 = "UTF-8"; private static final String CONTENT_TYPE = "Content-Type";
private static final String ANONYMOUS_REQUESTS_DISALLOWED = "Anonymous requests are disallowed"; public static final String TOKEN_KIND = "kms-dt";
45,763
private static final String HTTP_POST = "POST"; private static final String HTTP_PUT = "PUT"; private static final String HTTP_DELETE = "DELETE"; private static final String CONFIG_PREFIX = "hadoop.security.kms.client."; public static final String TIMEOUT_ATTR = CONFIG_PREFIX + "timeout"; <BUG>public static final int DEFAULT_TIMEOUT = 60; private final ValueQueue<EncryptedKeyVersion> encKeyVersionQueue;</BUG> private class EncryptedQueueRefiller implements ValueQueue.QueueRefiller<EncryptedKeyVersion> { @Override
public static final String AUTH_RETRY = CONFIG_PREFIX + "authentication.retry-count"; public static final int DEFAULT_AUTH_RETRY = 1; private final ValueQueue<EncryptedKeyVersion> encKeyVersionQueue;
45,764
sslFactory.init(); } catch (GeneralSecurityException ex) { throw new IOException(ex); } } <BUG>int timeout = conf.getInt(TIMEOUT_ATTR, DEFAULT_TIMEOUT); configurator = new TimeoutConnConfigurator(timeout, sslFactory);</BUG> encKeyVersionQueue = new ValueQueue<KeyProviderCryptoExtension.EncryptedKeyVersion>( conf.getInt(
authRetry = conf.getInt(AUTH_RETRY, DEFAULT_AUTH_RETRY); configurator = new TimeoutConnConfigurator(timeout, sslFactory);
45,765
conn.setDoOutput(true); } conn = configureConnection(conn); return conn; } <BUG>private <T> T call(HttpURLConnection conn, Map jsonOutput, int expectedResponse, Class<T> klass) </BUG> throws IOException { T ret = null;
int expectedResponse, Class<T> klass) throws IOException { return call(conn, jsonOutput, expectedResponse, klass, authRetry); int expectedResponse, Class<T> klass, int authRetryCount)
45,766
t = "\"" + t + "\""; } conn.addRequestProperty("Cookie", AUTH_COOKIE_EQ + t); } } <BUG>public static void extractToken(HttpURLConnection conn, Token token) throws IOException, AuthenticationException { if (conn.getResponseCode() == HttpURLConnection.HTTP_OK) { Map<String, List<String>> headers = conn.getHeaderFields();</BUG> List<String> cookies = headers.get("Set-Cookie");
int respCode = conn.getResponseCode(); if (respCode == HttpURLConnection.HTTP_OK || respCode == HttpURLConnection.HTTP_CREATED || respCode == HttpURLConnection.HTTP_ACCEPTED) { Map<String, List<String>> headers = conn.getHeaderFields();
45,767
import org.apache.hadoop.fs.Path; import org.apache.hadoop.io.Text; import org.apache.hadoop.minikdc.MiniKdc; import org.apache.hadoop.security.Credentials; import org.apache.hadoop.security.SecurityUtil; <BUG>import org.apache.hadoop.security.UserGroupInformation; import org.apache.hadoop.security.authorize.AuthorizationException; import org.apache.hadoop.security.ssl.KeyStoreTestUtil; import org.junit.AfterClass;</BUG> import org.junit.Assert;
import org.apache.hadoop.security.authentication.client.AuthenticatedURL; import org.apache.hadoop.security.token.delegation.web.DelegationTokenAuthenticatedURL; import org.junit.AfterClass;
45,768
import javax.security.auth.login.AppConfigurationEntry; import javax.security.auth.login.LoginContext; import java.io.File; import java.io.FileWriter; import java.io.IOException; <BUG>import java.io.Writer; import java.net.InetAddress;</BUG> import java.net.InetSocketAddress; import java.net.ServerSocket; import java.net.SocketTimeoutException;
import java.lang.reflect.Field; import java.lang.reflect.Method; import java.net.InetAddress;
45,769
conf.set(KMSACLs.Type.ROLLOVER.getAclConfigKey(), KMSACLs.Type.ROLLOVER.toString() + ",SET_KEY_MATERIAL"); conf.set(KeyAuthorizationKeyProvider.KEY_ACL + "k0.ALL", "*"); conf.set(KeyAuthorizationKeyProvider.KEY_ACL + "k1.ALL", "*"); conf.set(KeyAuthorizationKeyProvider.KEY_ACL + "k2.ALL", "*"); <BUG>conf.set(KeyAuthorizationKeyProvider.KEY_ACL + "k3.ALL", "*"); writeConf(testDir, conf); KMSCallable<KeyProvider> c = new KMSCallable<KeyProvider>() { </BUG> @Override
[DELETED]
45,770
} <BUG>}); return kp; } }; final KeyProvider retKp = runServer(null, null, testDir, c); runServer(c.getKMSUrl().getPort(), null, null, testDir,</BUG> new KMSCallable<Void>() {
runServer(c.getKMSUrl().getPort(), null, null, testDir,
45,771
</BUG> } <BUG>retKp.createKey("k2", new byte[16], new KeyProvider.Options(conf)); retKp.createKey("k3", new byte[16], new KeyProvider.Options(conf));</BUG> return null; } }); return null;
new PrivilegedExceptionAction<Void>() { @Override public Void run() throws Exception {
45,772
import java.time.ZonedDateTime; import java.util.Optional; import static java.util.Optional.empty; import static models.ControllerUtils.*; import static models.ExpirationUtils.now; <BUG>import static models.ExpirationUtils.toDate; public class AddProxy extends Controller {</BUG> private static final int INITIAL_PROXY_DURATION = 7; private static final int MAX_PROXIES = 3; private final Repository repository;
@With(RedirectAction.class) public class AddProxy extends Controller {
45,773
@Inject AddProxy(Repository repository, MailSender mailSender) { this.repository = repository; this.mailSender = mailSender; } <BUG>public Result addProxy(String proxy, String email) { Http.Request request = request(); Lang lang = getBestLanguage(request, lang());</BUG> Optional<MailAddress> maybeUserMail = toMailAddress(email);
public Result addProxy(String langCode, String proxy, String email) {
45,774
import views.html.error_page; import views.html.proxy_deleted; import java.util.Optional; import static java.util.Optional.empty; import static models.ControllerUtils.*; <BUG>import static models.ExpirationUtils.formatInstant; public class DeleteProxy extends Controller {</BUG> private static final Logger LOGGER = LoggerFactory.getLogger(DeleteProxy.class.getName()); private final Repository repository; @Inject
@With(RedirectAction.class) public class DeleteProxy extends Controller {
45,775
private final Repository repository; @Inject DeleteProxy(Repository repository) { this.repository = repository; } <BUG>public Result confirmDeletion(String p, String h) { Http.Request request = request(); Lang language = getBestLanguage(request, lang());</BUG> Optional<MailAddress> maybeProxyMail = toMailAddress(p);
public Result confirmDeletion(String langCode, String p, String h) {
45,776
Http.Request request = request(); Lang language = getBestLanguage(request, lang());</BUG> Optional<MailAddress> maybeProxyMail = toMailAddress(p); if (!maybeProxyMail.isPresent() || h == null) { <BUG>return badRequest(error_page.render(language, empty())); </BUG> } MailAddress proxyMail = maybeProxyMail.get(); Optional<ProxyMail> maybeProxy = repository.getProxy(proxyMail);
private final Repository repository; @Inject DeleteProxy(Repository repository) { this.repository = repository; public Result confirmDeletion(String langCode, String p, String h) { return badRequest(error_page.render(lang(), empty()));
45,777
ConfirmProxy(StatsRepository statsRepo, Repository repository, SpamCatcher spamCatcher) { this.statsRepo = statsRepo; this.repository = repository; this.spamCatcher = spamCatcher; } <BUG>public Result confirm(String p, String h) throws Exception { Http.Request request = request(); Lang language = getBestLanguage(request, lang());</BUG> Optional<MailAddress> maybeProxyMail = toMailAddress(p);
public Result confirm(String langCode, String p, String h) throws Exception {
45,778
Http.Request request = request(); Lang language = getBestLanguage(request, lang());</BUG> Optional<MailAddress> maybeProxyMail = toMailAddress(p); if (!maybeProxyMail.isPresent() || h == null) { <BUG>return badRequest(error_page.render(language, empty())); </BUG> } MailAddress proxyAddress = maybeProxyMail.get(); Optional<ProxyMail> maybeProxy = repository.getProxy(proxyAddress);
ConfirmProxy(StatsRepository statsRepo, Repository repository, SpamCatcher spamCatcher) { this.statsRepo = statsRepo; this.repository = repository; this.spamCatcher = spamCatcher; public Result confirm(String langCode, String p, String h) throws Exception { return badRequest(error_page.render(lang(), empty()));
45,779
private final Repository repository; @Inject ExtendProxy(Repository repository) { this.repository = repository; } <BUG>public Result extend(String p, String h) { Http.Request request = request(); Lang language = getBestLanguage(request, lang());</BUG> Optional<MailAddress> maybeProxyMail = toMailAddress(p);
public Result extend(String langCode, String p, String h) {
45,780
Http.Request request = request(); Lang language = getBestLanguage(request, lang());</BUG> Optional<MailAddress> maybeProxyMail = toMailAddress(p); if (!maybeProxyMail.isPresent() || h == null) { <BUG>return badRequest(error_page.render(language, empty())); </BUG> } MailAddress proxyMail = maybeProxyMail.get(); Optional<ProxyMail> maybeProxy = repository.getProxy(proxyMail);
private final Repository repository; @Inject ExtendProxy(Repository repository) { this.repository = repository; public Result extend(String langCode, String p, String h) { return badRequest(error_page.render(lang(), empty()));
45,781
ZonedDateTime maxExpirationTime = toZonedDateTime(proxy.getCreationTime()).plusDays(getMaxProxyDuration()); ZonedDateTime newExpirationTime = getNewExpirationTime(toZonedDateTime(proxy.getExpirationTime()).plusDays(getIncrementDaysAdded()), maxExpirationTime); Date expirationTimeDate = toDate(newExpirationTime); proxy.setExpirationTime(expirationTimeDate); repository.update(proxy); <BUG>String date = formatInstant(expirationTimeDate, language); return ok(proxy_extended.render(language, proxyMail, date)); </BUG> }
String date = formatInstant(expirationTimeDate, lang()); return ok(proxy_extended.render(lang(), proxyMail, date));
45,782
import views.html.forward;</BUG> import javax.inject.Singleton; <BUG>import static models.ControllerUtils.getBestLanguage; @Singleton public class Landing extends Controller { public Result index() { Lang lang = getBestLanguage(request(), lang()); return ok(forward.render(lang)); </BUG> }
package controllers; import play.mvc.Controller; import play.mvc.Result; import play.mvc.With; import views.html.forward; @With(RedirectAction.class) public Result index(String langCode) { return ok(forward.render(lang()));
45,783
.Jdk(Supplier.class::getName) .Fj(() -> "fj.F0") .Fugue(Supplier.class::getName) .Fugue2(() -> "com.google.common.base.Supplier") .Javaslang(Supplier.class::getName) <BUG>.HighJ(Supplier.class.getName()) .apply(flavour));</BUG> } public static TypeElement findF(Flavour flavour, Elements elements) { return elements.getTypeElement(Flavours.cases()
.Guava(() -> "com.google.common.base.Supplier") .apply(flavour));
45,784
.Jdk(Function.class.getName()) .Fj("fj.F") .Fugue(Function.class.getName()) .Fugue2("com.google.common.base.Function") .Javaslang("javaslang.Function1") <BUG>.HighJ("org.highj.function.F1") .apply(flavour));</BUG> } public static OptionType findOptionType(Flavour flavour, Elements elements) { return Flavours.cases()
.Guava("com.google.common.base.Function") .apply(flavour));
45,785
.Jdk(() -> optionType(elements.getTypeElement(Optional.class.getName()), "empty", "of")) .Fj(() -> optionType(elements.getTypeElement("fj.data.Option"), "none", "some")) .Fugue(() -> optionType(elements.getTypeElement("io.atlassian.fugue.Option"), "none", "some")) .Fugue2(() -> optionType(elements.getTypeElement("com.atlassian.fugue.Option"), "none", "some")) .Javaslang(() -> optionType(elements.getTypeElement("javaslang.control.Option"), "none", "some")) <BUG>.HighJ(() -> optionType(elements.getTypeElement("org.highj.data.Maybe"), "Nothing", "Just")) .apply(flavour);</BUG> } public static Optional<EitherType> findEitherType(Flavour flavour, Elements elements) { return Flavours.cases()
.Guava(() -> optionType(elements.getTypeElement("com.google.common.base.Optional"), "absent", "of")) .apply(flavour);
45,786
.Jdk(Optional::<EitherType>empty) .Fj(() -> Optional.of(eitherType(elements.getTypeElement("fj.data.Either"), "left", "right"))) .Fugue(() -> Optional.of(eitherType(elements.getTypeElement("io.atlassian.fugue.Either"), "left", "right"))) .Fugue2(() -> Optional.of(eitherType(elements.getTypeElement("com.atlassian.fugue.Either"), "left", "right"))) .Javaslang(() -> Optional.of(eitherType(elements.getTypeElement("javaslang.control.Either"), "left", "right"))) <BUG>.HighJ(() -> Optional.of(eitherType(elements.getTypeElement("org.highj.data.Either"), "Left", "Right"))) .apply(flavour);</BUG> } public static String supplierApplyMethod(DeriveUtils deriveUtils, DeriveContext deriveContext) { return deriveUtils.allAbstractMethods(findF0(deriveContext.flavour(), deriveUtils.elements())).get(0).getSimpleName().toString();
.Guava(Optional::<EitherType>empty) .apply(flavour);
45,787
import android.content.Intent; import android.os.AsyncTask; import android.os.Bundle; import android.util.Log; import com.appboy.configuration.XmlAppConfigurationProvider; <BUG>import com.appboy.push.AppboyNotificationUtils; public final class AppboyGcmReceiver extends BroadcastReceiver {</BUG> private static final String TAG = String.format("%s.%s", Constants.APPBOY_LOG_TAG_PREFIX, AppboyGcmReceiver.class.getName()); private static final String GCM_RECEIVE_INTENT_ACTION = "com.google.android.c2dm.intent.RECEIVE"; private static final String GCM_REGISTRATION_INTENT_ACTION = "com.google.android.c2dm.intent.REGISTRATION";
import com.appboy.support.AppboyLogger; public final class AppboyGcmReceiver extends BroadcastReceiver {
45,788
private static final String GCM_DELETED_MESSAGES_KEY = "deleted_messages"; private static final String GCM_NUMBER_OF_MESSAGES_DELETED_KEY = "total_deleted"; public static final String CAMPAIGN_ID_KEY = Constants.APPBOY_PUSH_CAMPAIGN_ID_KEY; @Override public void onReceive(Context context, Intent intent) { <BUG>Log.i(TAG, String.format("Received broadcast message. Message: %s", intent.toString())); </BUG> String action = intent.getAction(); if (GCM_REGISTRATION_INTENT_ACTION.equals(action)) { XmlAppConfigurationProvider appConfigurationProvider = new XmlAppConfigurationProvider(context);
AppboyLogger.i(TAG, String.format("Received broadcast message. Message: %s", intent.toString()));
45,789
} else if (Constants.APPBOY_CANCEL_NOTIFICATION_ACTION.equals(action) && intent.hasExtra(Constants.APPBOY_CANCEL_NOTIFICATION_TAG)) { int notificationId = intent.getIntExtra(Constants.APPBOY_CANCEL_NOTIFICATION_TAG, Constants.APPBOY_DEFAULT_NOTIFICATION_ID); NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); notificationManager.cancel(Constants.APPBOY_PUSH_NOTIFICATION_TAG, notificationId); } else { <BUG>Log.w(TAG, String.format("The GCM receiver received a message not sent from Appboy. Ignoring the message.")); </BUG> } } boolean handleRegistrationIntent(Context context, Intent intent) {
AppboyLogger.w(TAG, String.format("The GCM receiver received a message not sent from Appboy. Ignoring the message."));
45,790
Log.e(TAG, "Device does not support GCM."); } else if ("INVALID_PARAMETERS".equals(error)) { Log.e(TAG, "The request sent by the device does not contain the expected parameters. This phone does not " + "currently support GCM."); } else { <BUG>Log.w(TAG, String.format("Received an unrecognised GCM registration error type. Ignoring. Error: %s", error)); </BUG> } } else if (registrationId != null) { Appboy.getInstance(context).registerAppboyPushMessages(registrationId);
AppboyLogger.w(TAG, String.format("Received an unrecognised GCM registration error type. Ignoring. Error: %s", error));
45,791
} else if (registrationId != null) { Appboy.getInstance(context).registerAppboyPushMessages(registrationId); } else if (intent.hasExtra(GCM_UNREGISTERED_KEY)) { Appboy.getInstance(context).unregisterAppboyPushMessages(); } else { <BUG>Log.w(TAG, "The GCM registration message is missing error information, registration id, and unregistration " + </BUG> "confirmation. Ignoring."); return false; }
AppboyLogger.w(TAG, "The GCM registration message is missing error information, registration id, and unregistration " +
45,792
if (GCM_DELETED_MESSAGES_KEY.equals(messageType)) { int totalDeleted = intent.getIntExtra(GCM_NUMBER_OF_MESSAGES_DELETED_KEY, -1); if (totalDeleted == -1) { Log.e(TAG, String.format("Unable to parse GCM message. Intent: %s", intent.toString())); } else { <BUG>Log.i(TAG, String.format("GCM deleted %d messages. Fetch them from Appboy.", totalDeleted)); </BUG> } return false; } else {
AppboyLogger.i(TAG, String.format("GCM deleted %d messages. Fetch them from Appboy.", totalDeleted));
45,793
package com.appboy; import android.content.BroadcastReceiver; import android.content.Intent; import android.os.AsyncTask; import android.os.Bundle; <BUG>import android.util.Log; import android.content.Context;</BUG> import android.app.Notification; import android.app.NotificationManager; import com.appboy.configuration.XmlAppConfigurationProvider;
import com.appboy.support.AppboyLogger; import android.content.Context;
45,794
} else if (Constants.APPBOY_CANCEL_NOTIFICATION_ACTION.equals(action) && intent.hasExtra(Constants.APPBOY_CANCEL_NOTIFICATION_TAG)) { int notificationId = intent.getIntExtra(Constants.APPBOY_CANCEL_NOTIFICATION_TAG, Constants.APPBOY_DEFAULT_NOTIFICATION_ID); NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); notificationManager.cancel(Constants.APPBOY_PUSH_NOTIFICATION_TAG, notificationId); } else { <BUG>Log.w(TAG, String.format("The ADM receiver received a message not sent from Appboy. Ignoring the message.")); </BUG> } } boolean handleRegistrationIntent(Context context, Intent intent) {
AppboyLogger.w(TAG, String.format("The ADM receiver received a message not sent from Appboy. Ignoring the message."));
45,795
Notification notification = null; IAppboyNotificationFactory appboyNotificationFactory = AppboyNotificationUtils.getActiveNotificationFactory(); try { notification = appboyNotificationFactory.createNotification(appConfigurationProvider, context, admExtras, appboyExtras); } catch(Exception e) { <BUG>Log.e(TAG, "Failed to create notification.", e); </BUG> return false; } if (notification == null) {
AppboyLogger.e(TAG, "Failed to create notification.", e);
45,796
package com.appboy; import android.graphics.Bitmap; import android.graphics.BitmapFactory; <BUG>import android.util.Log; import java.io.InputStream;</BUG> import java.net.MalformedURLException; import java.net.UnknownHostException; public class AppboyImageUtils {
import com.appboy.support.AppboyLogger; import java.io.InputStream;
45,797
public class AppboyImageUtils { private static final String TAG = String.format("%s.%s", Constants.APPBOY_LOG_TAG_PREFIX, AppboyImageUtils.class.getName()); public static final int BASELINE_SCREEN_DPI = 160; public static Bitmap downloadImageBitmap(String imageUrl) { if (imageUrl == null || imageUrl.length() == 0) { <BUG>Log.i(TAG, "Null or empty Url string passed to image bitmap download. Not attempting download."); </BUG> return null; } Bitmap bitmap = null;
AppboyLogger.i(TAG, "Null or empty Url string passed to image bitmap download. Not attempting download.");
45,798
else if (t == ANY_CYPHER_OPTION) { r = AnyCypherOption(b, 0); } else if (t == ANY_FUNCTION_INVOCATION) { r = AnyFunctionInvocation(b, 0); <BUG>} else if (t == BULK_IMPORT_QUERY) {</BUG> r = BulkImportQuery(b, 0); } else if (t == CALL) {
else if (t == ARRAY) { r = Array(b, 0); else if (t == BULK_IMPORT_QUERY) {
45,799
if (!r) r = MapLiteral(b, l + 1); if (!r) r = MapProjection(b, l + 1); if (!r) r = CountStar(b, l + 1); if (!r) r = ListComprehension(b, l + 1); if (!r) r = PatternComprehension(b, l + 1); <BUG>if (!r) r = Expression1_12(b, l + 1); if (!r) r = FilterFunctionInvocation(b, l + 1);</BUG> if (!r) r = ExtractFunctionInvocation(b, l + 1); if (!r) r = ReduceFunctionInvocation(b, l + 1); if (!r) r = AllFunctionInvocation(b, l + 1);
if (!r) r = Array(b, l + 1); if (!r) r = FilterFunctionInvocation(b, l + 1);
45,800
import java.util.ArrayList; import java.util.Date; import java.util.LinkedList; import org.apache.commons.lang3.StringUtils; public class Log { <BUG>private final static String FEHLER = "Fehler(" + Const.PROGRAMMNAME + "): "; private static class Error {</BUG> String cl = ""; int nr = 0; int count = 0;
public final static String LILNE = "################################################################################"; private static class Error {